_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q243300 | tl_page.generateSitemap | validation | public function generateSitemap()
{
/** @var Symfony\Component\HttpFoundation\Session\SessionInterface $objSession */
$objSession = Contao\System::getContainer()->get('session');
$session = $objSession->get('sitemap_updater');
if (empty($session) || !\is_array($session))
{
return;
}
$this->import('... | php | {
"resource": ""
} |
q243301 | tl_page.scheduleUpdate | validation | public function scheduleUpdate(Contao\DataContainer $dc)
{
// Return if there is no ID
if (!$dc->activeRecord || !$dc->activeRecord->id || Contao\Input::get('act') == 'copy')
{
return;
}
/** @var Symfony\Component\HttpFoundation\Session\SessionInterface $objSession */
$objSession = Contao\System::getCo... | php | {
"resource": ""
} |
q243302 | tl_page.generateAlias | validation | public function generateAlias($varValue, Contao\DataContainer $dc)
{
$objPage = Contao\PageModel::findWithDetails($dc->id);
$aliasExists = function (string $alias) use ($dc, $objPage): bool
{
$objAliasIds = $this->Database->prepare("SELECT id FROM tl_page WHERE alias=? AND id!=?")
->execute($alia... | php | {
"resource": ""
} |
q243303 | tl_page.generateArticle | validation | public function generateArticle(Contao\DataContainer $dc)
{
// Return if there is no active record (override all)
if (!$dc->activeRecord)
{
return;
}
// No title or not a regular page
if ($dc->activeRecord->title == '' || !\in_array($dc->activeRecord->type, array('regular', 'error_401', 'error_403', 'e... | php | {
"resource": ""
} |
q243304 | tl_page.purgeSearchIndex | validation | public function purgeSearchIndex(Contao\DataContainer $dc)
{
if (!$dc->id)
{
return;
}
$objResult = $this->Database->prepare("SELECT id FROM tl_search WHERE pid=?")
->execute($dc->id);
while ($objResult->next())
{
$this->Database->prepare("DELETE FROM tl_search WHERE id=?")
->exec... | php | {
"resource": ""
} |
q243305 | tl_page.checkFeedAlias | validation | public function checkFeedAlias($varValue, Contao\DataContainer $dc)
{
// No change or empty value
if ($varValue == $dc->value || $varValue == '')
{
return $varValue;
}
$varValue = Contao\StringUtil::standardize($varValue); // see #5096
$this->import('Contao\Automator', 'Automator');
$arrFeeds = $thi... | php | {
"resource": ""
} |
q243306 | tl_page.checkJumpTo | validation | public function checkJumpTo($varValue, Contao\DataContainer $dc)
{
if ($varValue == $dc->id)
{
throw new Exception($GLOBALS['TL_LANG']['ERR']['circularReference']);
}
return $varValue;
} | php | {
"resource": ""
} |
q243307 | tl_page.getPageTypes | validation | public function getPageTypes(Contao\DataContainer $dc)
{
$arrOptions = array();
foreach (array_keys($GLOBALS['TL_PTY']) as $pty)
{
// Root pages are allowed on the first level only (see #6360)
if ($pty == 'root' && $dc->activeRecord && $dc->activeRecord->pid > 0)
{
continue;
}
// Allow the c... | php | {
"resource": ""
} |
q243308 | tl_page.getPageLayouts | validation | public function getPageLayouts()
{
$objLayout = $this->Database->execute("SELECT l.id, l.name, t.name AS theme FROM tl_layout l LEFT JOIN tl_theme t ON l.pid=t.id ORDER BY t.name, l.name");
if ($objLayout->numRows < 1)
{
return array();
}
$return = array();
while ($objLayout->next())
{
$return[$... | php | {
"resource": ""
} |
q243309 | tl_page.copyPageWithSubpages | validation | public function copyPageWithSubpages($row, $href, $label, $title, $icon, $attributes, $table)
{
if ($GLOBALS['TL_DCA'][$table]['config']['closed'])
{
return '';
}
$objSubpages = Contao\PageModel::findByPid($row['id']);
return ($objSubpages !== null && $objSubpages->count() > 0 && $this->User->hasAccess(... | php | {
"resource": ""
} |
q243310 | tl_page.cutPage | validation | public function cutPage($row, $href, $label, $title, $icon, $attributes)
{
return ($this->User->hasAccess($row['type'], 'alpty') && $this->User->isAllowed(Contao\BackendUser::CAN_EDIT_PAGE_HIERARCHY, $row)) ? '<a href="'.$this->addToUrl($href.'&id='.$row['id']).'" title="'.Contao\StringUtil::specialchars($title)... | php | {
"resource": ""
} |
q243311 | tl_page.deletePage | validation | public function deletePage($row, $href, $label, $title, $icon, $attributes)
{
$root = func_get_arg(7);
return ($this->User->hasAccess($row['type'], 'alpty') && $this->User->isAllowed(Contao\BackendUser::CAN_DELETE_PAGE, $row) && ($this->User->isAdmin || !\in_array($row['id'], $root))) ? '<a href="'.$this->addToUr... | php | {
"resource": ""
} |
q243312 | ModuleEventReader.getDateAndTime | validation | private function getDateAndTime(CalendarEventsModel $objEvent, PageModel $objPage, $intStartTime, $intEndTime, $span)
{
$strDate = Date::parse($objPage->dateFormat, $intStartTime);
if ($span > 0)
{
$strDate = Date::parse($objPage->dateFormat, $intStartTime) . $GLOBALS['TL_LANG']['MSC']['cal_timeSeparator'] .... | php | {
"resource": ""
} |
q243313 | tl_news_feed.getAllowedArchives | validation | public function getAllowedArchives()
{
if ($this->User->isAdmin)
{
$objArchive = Contao\NewsArchiveModel::findAll();
}
else
{
$objArchive = Contao\NewsArchiveModel::findMultipleByIds($this->User->news);
}
$return = array();
if ($objArchive !== null)
{
while ($objArchive->next())
{
$... | php | {
"resource": ""
} |
q243314 | tl_form.getAllTables | validation | public function getAllTables()
{
$arrTables = $this->Database->listTables();
$arrViews = Contao\System::getContainer()->get('database_connection')->getSchemaManager()->listViews();
if (!empty($arrViews))
{
$arrTables = array_merge($arrTables, array_keys($arrViews));
natsort($arrTables);
}
return ar... | php | {
"resource": ""
} |
q243315 | Automator.purgeSearchTables | validation | public function purgeSearchTables()
{
$objDatabase = Database::getInstance();
// Truncate the tables
$objDatabase->execute("TRUNCATE TABLE tl_search");
$objDatabase->execute("TRUNCATE TABLE tl_search_index");
$strCachePath = StringUtil::stripRootDir(System::getContainer()->getParameter('kernel.cache_dir'))... | php | {
"resource": ""
} |
q243316 | Automator.purgeVersionTable | validation | public function purgeVersionTable()
{
$objDatabase = Database::getInstance();
// Truncate the table
$objDatabase->execute("TRUNCATE TABLE tl_version");
// Add a log entry
$this->log('Purged the version table', __METHOD__, TL_CRON);
} | php | {
"resource": ""
} |
q243317 | Automator.purgeImageCache | validation | public function purgeImageCache()
{
$container = System::getContainer();
$strTargetPath = StringUtil::stripRootDir($container->getParameter('contao.image.target_dir'));
$strRootDir = $container->getParameter('kernel.project_dir');
// Walk through the subfolders
foreach (scan($strRootDir . '/' . $strTargetPa... | php | {
"resource": ""
} |
q243318 | Automator.purgeScriptCache | validation | public function purgeScriptCache()
{
// assets/js and assets/css
foreach (array('assets/js', 'assets/css') as $dir)
{
// Purge the folder
$objFolder = new Folder($dir);
$objFolder->purge();
}
// Recreate the internal style sheets
$this->import(StyleSheets::class, 'StyleSheets');
$this->StyleShe... | php | {
"resource": ""
} |
q243319 | Automator.purgePageCache | validation | public function purgePageCache()
{
$strCacheDir = StringUtil::stripRootDir(System::getContainer()->getParameter('kernel.cache_dir'));
$objFolder = new Folder($strCacheDir . '/http_cache');
$objFolder->purge();
// Add a log entry
$this->log('Purged the page cache', __METHOD__, TL_CRON);
} | php | {
"resource": ""
} |
q243320 | Automator.purgeInternalCache | validation | public function purgeInternalCache()
{
$container = System::getContainer();
$clearer = $container->get('contao.cache.clear_internal');
$clearer->clear($container->getParameter('kernel.cache_dir'));
// Add a log entry
$this->log('Purged the internal cache', __METHOD__, TL_CRON);
} | php | {
"resource": ""
} |
q243321 | Automator.purgeRegistrations | validation | public function purgeRegistrations()
{
$objMember = MemberModel::findExpiredRegistrations();
if ($objMember === null)
{
return;
}
while ($objMember->next())
{
$objMember->delete();
}
// Add a log entry
$this->log('Purged the unactivated member registrations', __METHOD__, TL_CRON);
} | php | {
"resource": ""
} |
q243322 | Automator.purgeOptInTokens | validation | public function purgeOptInTokens()
{
/** @var OptIn $optIn */
$optIn = System::getContainer()->get('contao.opt-in');
$optIn->purgeTokens();
// Add a log entry
$this->log('Purged the expired double opt-in tokens', __METHOD__, TL_CRON);
} | php | {
"resource": ""
} |
q243323 | Automator.generateXmlFiles | validation | public function generateXmlFiles()
{
// Sitemaps
$this->generateSitemap();
// HOOK: add custom jobs
if (isset($GLOBALS['TL_HOOKS']['generateXmlFiles']) && \is_array($GLOBALS['TL_HOOKS']['generateXmlFiles']))
{
foreach ($GLOBALS['TL_HOOKS']['generateXmlFiles'] as $callback)
{
$this->import($callbac... | php | {
"resource": ""
} |
q243324 | Automator.generateInternalCache | validation | public function generateInternalCache()
{
$container = System::getContainer();
$warmer = $container->get('contao.cache.warm_internal');
$warmer->warmUp($container->getParameter('kernel.cache_dir'));
// Add a log entry
$this->log('Generated the internal cache', __METHOD__, TL_CRON);
} | php | {
"resource": ""
} |
q243325 | Automator.rotateLogs | validation | public function rotateLogs()
{
@trigger_error('Using Automator::rotateLogs() has been deprecated and will no longer work in Contao 5.0. Use the logger service instead, which rotates its log files automatically.', E_USER_DEPRECATED);
$rootDir = System::getContainer()->getParameter('kernel.project_dir');
$arrFile... | php | {
"resource": ""
} |
q243326 | TemplateLoader.addFiles | validation | public static function addFiles($files)
{
foreach ($files as $name=>$file)
{
self::addFile($name, $file);
}
} | php | {
"resource": ""
} |
q243327 | TemplateLoader.getPath | validation | public static function getPath($template, $format, $custom='templates')
{
$file = $template . '.' . $format;
$rootDir = System::getContainer()->getParameter('kernel.project_dir');
// Check the theme folder first
if (file_exists($rootDir . '/' . $custom . '/' . $file))
{
return $rootDir . '/' . $custom . ... | php | {
"resource": ""
} |
q243328 | TemplateLoader.getDefaultPath | validation | public static function getDefaultPath($template, $format)
{
$file = $template . '.' . $format;
$container = System::getContainer();
$rootDir = $container->getParameter('kernel.project_dir');
if (isset(self::$files[$template]))
{
return $rootDir . '/' . self::$files[$template] . '/' . $file;
}
$strPa... | php | {
"resource": ""
} |
q243329 | TemplateLoader.initialize | validation | public static function initialize()
{
$objFilesystem = new Filesystem();
$container = System::getContainer();
$strCacheDir = $container->getParameter('kernel.cache_dir');
// Try to load from cache
if (file_exists($strCacheDir . '/contao/config/templates.php'))
{
self::addFiles(include $strCacheDir . '/... | php | {
"resource": ""
} |
q243330 | CommentsModel.findPublishedBySourceAndParent | validation | public static function findPublishedBySourceAndParent($strSource, $intParent, $blnDesc=false, $intLimit=0, $intOffset=0, array $arrOptions=array())
{
$t = static::$strTable;
$arrColumns = array("$t.source=? AND $t.parent=?");
if (!static::isPreviewMode($arrOptions))
{
$arrColumns[] = "$t.published='1'";
... | php | {
"resource": ""
} |
q243331 | CommentsModel.countPublishedBySourceAndParent | validation | public static function countPublishedBySourceAndParent($strSource, $intParent, array $arrOptions=array())
{
$t = static::$strTable;
$arrColumns = array("$t.source=? AND $t.parent=?");
if (!static::isPreviewMode($arrOptions))
{
$arrColumns[] = "$t.published='1'";
}
return static::countBy($arrColumns, a... | php | {
"resource": ""
} |
q243332 | Form.generate | validation | public function generate()
{
if (TL_MODE == 'BE')
{
$objTemplate = new BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['CTE']['form'][0]) . ' ###';
$objTemplate->id = $this->id;
$objTemplate->link = $this->title;
$objTemplate->href = 'contao/mai... | php | {
"resource": ""
} |
q243333 | Form.initializeSession | validation | protected function initializeSession($formId)
{
if (Input::post('FORM_SUBMIT') != $formId)
{
return;
}
$arrMessageBox = array('TL_ERROR', 'TL_CONFIRM', 'TL_INFO');
$_SESSION['FORM_DATA'] = \is_array($_SESSION['FORM_DATA']) ? $_SESSION['FORM_DATA'] : array();
foreach ($arrMessageBox as $tl)
{
if (... | php | {
"resource": ""
} |
q243334 | FormPassword.validator | validation | protected function validator($varInput)
{
$this->blnSubmitInput = false;
if (!\strlen($varInput) && (\strlen($this->varValue) || !$this->mandatory))
{
return '';
}
// Check password length either from DCA or use Config as fallback (#1087)
$intLength = $this->minlength ?: Config::get('minPasswordLength... | php | {
"resource": ""
} |
q243335 | ScopeAwareTrait.isScope | validation | private function isScope(string $scope): bool
{
if (
null === $this->container
|| null === ($request = $this->container->get('request_stack')->getCurrentRequest())
) {
return false;
}
$matcher = $this->container->get('contao.routing.scope_matcher'... | php | {
"resource": ""
} |
q243336 | Date.createDateRanges | validation | protected function createDateRanges()
{
if (!empty($this->arrRange))
{
return;
}
$intYear = date('Y', $this->strDate);
$intMonth = date('m', $this->strDate);
$intDay = date('d', $this->strDate);
$this->arrRange['day']['begin'] = mktime(0, 0, 0, $intMonth, $intDay, $intYear);
$this->arrRange['day']... | php | {
"resource": ""
} |
q243337 | Date.getWeekBegin | validation | public function getWeekBegin($intStartDay=0)
{
$intOffset = date('w', $this->strDate) - $intStartDay;
if ($intOffset < 0)
{
$intOffset += 7;
}
return strtotime('-' . $intOffset . ' days', $this->strDate);
} | php | {
"resource": ""
} |
q243338 | Date.getRegexp | validation | public static function getRegexp($strFormat=null)
{
if ($strFormat === null)
{
$strFormat = static::getNumericDateFormat();
}
if (!static::isNumericFormat($strFormat))
{
throw new \Exception(sprintf('Invalid date format "%s"', $strFormat));
}
return preg_replace_callback('/[a-zA-Z]/', function ($... | php | {
"resource": ""
} |
q243339 | Date.formatToJs | validation | public static function formatToJs($strFormat)
{
$chunks = str_split($strFormat);
foreach ($chunks as $k=>$v)
{
switch ($v)
{
case 'D': $chunks[$k] = 'a'; break;
case 'j': $chunks[$k] = 'e'; break;
case 'l': $chunks[$k] = 'A'; break;
case 'S': $chunks[$k] = 'o'; break;
case 'F': $chunks... | php | {
"resource": ""
} |
q243340 | Date.getNumericDateFormat | validation | public static function getNumericDateFormat()
{
if (TL_MODE == 'FE')
{
/** @var PageModel $objPage */
global $objPage;
if ($objPage->dateFormat != '' && static::isNumericFormat($objPage->dateFormat))
{
return $objPage->dateFormat;
}
}
return Config::get('dateFormat');
} | php | {
"resource": ""
} |
q243341 | Date.getNumericTimeFormat | validation | public static function getNumericTimeFormat()
{
if (TL_MODE == 'FE')
{
/** @var PageModel $objPage */
global $objPage;
if ($objPage->timeFormat != '' && static::isNumericFormat($objPage->timeFormat))
{
return $objPage->timeFormat;
}
}
return Config::get('timeFormat');
} | php | {
"resource": ""
} |
q243342 | Date.getNumericDatimFormat | validation | public static function getNumericDatimFormat()
{
if (TL_MODE == 'FE')
{
/** @var PageModel $objPage */
global $objPage;
if ($objPage->datimFormat != '' && static::isNumericFormat($objPage->datimFormat))
{
return $objPage->datimFormat;
}
}
return Config::get('datimFormat');
} | php | {
"resource": ""
} |
q243343 | Date.resolveCustomModifiers | validation | protected static function resolveCustomModifiers($strDate)
{
if (strpos($strDate, '::') === false)
{
return $strDate;
}
System::loadLanguageFile('default');
if (!$GLOBALS['TL_LANG']['MSC']['dayShortLength'])
{
$GLOBALS['TL_LANG']['MSC']['dayShortLength'] = 3;
}
if (!$GLOBALS['TL_LANG']['MSC'][... | php | {
"resource": ""
} |
q243344 | InstallTool.hasOldDatabase | validation | public function hasOldDatabase(): bool
{
if (!$this->hasTable('tl_layout')) {
return false;
}
$sql = $this->connection
->getDatabasePlatform()
->getListTableColumnsSQL('tl_layout', $this->connection->getDatabase())
;
$columns = $this->con... | php | {
"resource": ""
} |
q243345 | InstallTool.getTemplates | validation | public function getTemplates(): array
{
/** @var SplFileInfo[] $finder */
$finder = Finder::create()
->files()
->name('*.sql')
->in($this->rootDir.'/templates')
;
$templates = [];
foreach ($finder as $file) {
$templates[] = $f... | php | {
"resource": ""
} |
q243346 | ModuleFaqList.generateFaqLink | validation | protected function generateFaqLink($objFaq)
{
/** @var FaqCategoryModel $objCategory */
$objCategory = $objFaq->getRelated('pid');
$jumpTo = (int) $objCategory->jumpTo;
// A jumpTo page is not mandatory for FAQ categories (see #6226) but required for the FAQ list module
if ($jumpTo < 1)
{
throw new \Ex... | php | {
"resource": ""
} |
q243347 | FormModel.getMaxUploadFileSize | validation | public function getMaxUploadFileSize()
{
$objResult = Database::getInstance()->prepare("SELECT MAX(maxlength) AS maxlength FROM tl_form_field WHERE pid=? AND invisible='' AND type='upload' AND maxlength>0")
->execute($this->id);
if ($objResult->numRows > 0 && $objResult->maxlength > 0)
{
return $... | php | {
"resource": ""
} |
q243348 | OptInModel.findOneByRelatedTableAndId | validation | public static function findOneByRelatedTableAndId($strTable, $intId, array $arrOptions=array())
{
@trigger_error('Using the Contao\OptInModel::findOneByRelatedTableAndIds() method has been deprecated and will no longer work in Contao 5.0. Use the Contao\OptInModel::findByRelatedTableAndIds() method instead.', E_USER... | php | {
"resource": ""
} |
q243349 | OptInModel.findByRelatedTableAndIds | validation | public static function findByRelatedTableAndIds($strTable, array $arrIds, array $arrOptions=array())
{
$t = static::$strTable;
$objDatabase = Database::getInstance();
$objResult = $objDatabase->prepare("SELECT * FROM $t WHERE $t.id IN (SELECT pid FROM tl_opt_in_related WHERE relTable=? AND relId IN(" . implode(... | php | {
"resource": ""
} |
q243350 | OptInModel.getRelatedRecords | validation | public function getRelatedRecords()
{
$arrRelated = array();
$objDatabase = Database::getInstance();
$objRelated = $objDatabase->prepare("SELECT * FROM tl_opt_in_related WHERE pid=?")
->execute($this->id);
while ($objRelated->next())
{
$arrRelated[$objRelated->relTable][] = $objRelated->relId;... | php | {
"resource": ""
} |
q243351 | OptInModel.setRelatedRecords | validation | public function setRelatedRecords(array $arrRelated)
{
$objDatabase = Database::getInstance();
$objCount = $objDatabase->prepare("SELECT COUNT(*) AS count FROM tl_opt_in_related WHERE pid=?")
->execute($this->id);
if ($objCount->count > 0)
{
throw new \LogicException(sprintf('Token "%s" already co... | php | {
"resource": ""
} |
q243352 | UserPasswordCommand.askForPassword | validation | private function askForPassword(string $label, InputInterface $input, OutputInterface $output): string
{
$question = new Question($label);
$question->setHidden(true);
$question->setMaxAttempts(3);
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
... | php | {
"resource": ""
} |
q243353 | PageError404.generate | validation | public function generate()
{
/** @var PageModel $objPage */
global $objPage;
$obj404 = $this->prepare();
$objPage = $obj404->loadDetails();
/** @var PageRegular $objHandler */
$objHandler = new $GLOBALS['TL_PTY']['regular']();
header('HTTP/1.1 404 Not Found');
$objHandler->generate($objPage);
} | php | {
"resource": ""
} |
q243354 | ModuleArticlenav.generate | validation | public function generate()
{
if (TL_MODE == 'BE')
{
$objTemplate = new BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['articlenav'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $... | php | {
"resource": ""
} |
q243355 | BackendMenuListener.onBuild | validation | public function onBuild(MenuEvent $event): void
{
$token = $this->tokenStorage->getToken();
if (null === $token) {
return;
}
$user = $token->getUser();
if (!$user instanceof BackendUser) {
return;
}
$factory = $event->getFactory();
... | php | {
"resource": ""
} |
q243356 | ContaoContext.getFieldValue | validation | private function getFieldValue(?PageModel $page): string
{
if (null === $page) {
return '';
}
return (string) $page->{$this->field};
} | php | {
"resource": ""
} |
q243357 | tl_user_group.addTemplateWarning | validation | public function addTemplateWarning()
{
if (Contao\Input::get('act') && Contao\Input::get('act') != 'select')
{
return;
}
$objResult = $this->Database->query("SELECT COUNT(*) AS cnt FROM tl_user_group WHERE modules LIKE '%\"tpl_editor\"%'");
if ($objResult->cnt > 0)
{
Contao\Message::addInfo($GLOBAL... | php | {
"resource": ""
} |
q243358 | tl_user_group.getExcludedFields | validation | public function getExcludedFields()
{
$processed = array();
/** @var SplFileInfo[] $files */
$files = Contao\System::getContainer()->get('contao.resource_finder')->findIn('dca')->depth(0)->files()->name('*.php');
foreach ($files as $file)
{
if (\in_array($file->getBasename(), $processed))
{
conti... | php | {
"resource": ""
} |
q243359 | Installer.generateSqlForm | validation | public function generateSqlForm()
{
@trigger_error('Using the Installer::generateSqlForm() method has been deprecated and will no longer work in Contao 5.0.', E_USER_DEPRECATED);
$count = 0;
$return = '';
$sql_command = $this->compileCommands();
if (empty($sql_command))
{
return '';
}
$_SESSION['... | php | {
"resource": ""
} |
q243360 | Installer.getFromDca | validation | public function getFromDca()
{
$return = array();
$processed = array();
/** @var SplFileInfo[] $files */
$files = System::getContainer()->get('contao.resource_finder')->findIn('dca')->depth(0)->files()->name('*.php');
foreach ($files as $file)
{
if (\in_array($file->getBasename(), $processed))
{
... | php | {
"resource": ""
} |
q243361 | Installer.getFromFile | validation | public function getFromFile()
{
$return = array();
/** @var SplFileInfo[] $files */
$files = System::getContainer()->get('contao.resource_finder')->findIn('config')->depth(0)->files()->name('database.sql');
foreach ($files as $file)
{
$return = array_replace_recursive($return, SqlFileParser::parse($file... | php | {
"resource": ""
} |
q243362 | ModuleLoader.getActive | validation | public static function getActive()
{
@trigger_error('Using ModuleLoader::getActive() has been deprecated and will no longer work in Contao 5.0.', E_USER_DEPRECATED);
$bundles = array_keys(System::getContainer()->getParameter('kernel.bundles'));
foreach (static::$legacy as $bundleName => $module)
{
if (\in... | php | {
"resource": ""
} |
q243363 | Combiner.add | validation | public function add($strFile, $strVersion=null, $strMedia='all')
{
$strType = strrchr($strFile, '.');
// Check the file type
if ($strType != self::CSS && $strType != self::JS && $strType != self::SCSS && $strType != self::LESS)
{
throw new \InvalidArgumentException("Invalid file $strFile");
}
$strMode... | php | {
"resource": ""
} |
q243364 | Combiner.addMultiple | validation | public function addMultiple(array $arrFiles, $strVersion=null, $strMedia='screen')
{
foreach ($arrFiles as $strFile)
{
$this->add($strFile, $strVersion, $strMedia);
}
} | php | {
"resource": ""
} |
q243365 | Combiner.getFileUrls | validation | public function getFileUrls()
{
$return = array();
$strTarget = substr($this->strMode, 1);
foreach ($this->arrFiles as $arrFile)
{
// Compile SCSS/LESS files into temporary files
if ($arrFile['extension'] == self::SCSS || $arrFile['extension'] == self::LESS)
{
$strPath = 'assets/' . $strTarget . ... | php | {
"resource": ""
} |
q243366 | Combiner.getDebugMarkup | validation | protected function getDebugMarkup()
{
$return = $this->getFileUrls();
foreach ($return as $k=>$v)
{
$options = StringUtil::resolveFlaggedUrl($v);
$return[$k] = $v;
if ($options->mtime)
{
$return[$k] .= '?v=' . substr(md5($options->mtime), 0, 8);
}
if ($options->media)
{
$return[$k... | php | {
"resource": ""
} |
q243367 | Combiner.handleCss | validation | protected function handleCss($content, $arrFile)
{
$content = $this->fixPaths($content, $arrFile);
// Add the media type if there is no @media command in the code
if ($arrFile['media'] != '' && $arrFile['media'] != 'all' && strpos($content, '@media') === false)
{
$content = '@media ' . $arrFile['media'] . ... | php | {
"resource": ""
} |
q243368 | Combiner.fixPaths | validation | protected function fixPaths($content, $arrFile)
{
$strName = $arrFile['name'];
// Strip the web/ prefix
if (strpos($strName, $this->strWebDir .'/') === 0)
{
$strName = substr($strName, \strlen($this->strWebDir) + 1);
}
$strDirname = \dirname($strName);
$strGlue = ($strDirname != '.') ? $strDirname .... | php | {
"resource": ""
} |
q243369 | TemplateInheritance.endblock | validation | public function endblock()
{
// Check for open blocks
if (empty($this->arrBlockNames))
{
throw new \Exception('You must start a block before you can end it');
}
// Get the block name
$name = array_pop($this->arrBlockNames);
// Root template
if ($this->strParent === null)
{
// Handle nested bl... | php | {
"resource": ""
} |
q243370 | Config.initialize | validation | protected function initialize()
{
if (static::$blnHasLcf === null)
{
static::preload();
}
$strCacheDir = System::getContainer()->getParameter('kernel.cache_dir');
if (file_exists($strCacheDir . '/contao/config/config.php'))
{
include $strCacheDir . '/contao/config/config.php';
}
else
{
try... | php | {
"resource": ""
} |
q243371 | Config.markModified | validation | protected function markModified()
{
// Return if marked as modified already
if ($this->blnIsModified === true)
{
return;
}
$this->blnIsModified = true;
// Reset the top and bottom content (see #344)
$this->strTop = '';
$this->strBottom = '';
// Import the Files object (required in the destructo... | php | {
"resource": ""
} |
q243372 | Config.save | validation | public function save()
{
if ($this->strTop == '')
{
$this->strTop = '<?php';
}
$strFile = trim($this->strTop) . "\n\n";
$strFile .= "### INSTALL SCRIPT START ###\n";
foreach ($this->arrData as $k=>$v)
{
$strFile .= "$k = $v\n";
}
$strFile .= "### INSTALL SCRIPT STOP ###\n";
$this->strBott... | php | {
"resource": ""
} |
q243373 | Config.add | validation | public function add($strKey, $varValue)
{
$this->markModified();
$this->arrData[$strKey] = $this->escape($varValue) . ';';
} | php | {
"resource": ""
} |
q243374 | Config.persist | validation | public static function persist($strKey, $varValue)
{
$objConfig = static::getInstance();
if (strncmp($strKey, '$GLOBALS', 8) !== 0)
{
$strKey = "\$GLOBALS['TL_CONFIG']['$strKey']";
}
$objConfig->add($strKey, $varValue);
} | php | {
"resource": ""
} |
q243375 | Config.remove | validation | public static function remove($strKey)
{
$objConfig = static::getInstance();
if (strncmp($strKey, '$GLOBALS', 8) !== 0)
{
$strKey = "\$GLOBALS['TL_CONFIG']['$strKey']";
}
$objConfig->delete($strKey);
} | php | {
"resource": ""
} |
q243376 | Config.preload | validation | public static function preload()
{
// Load the default files
include __DIR__ . '/../../config/default.php';
include __DIR__ . '/../../config/agents.php';
include __DIR__ . '/../../config/mimetypes.php';
$rootDir = System::getContainer()->getParameter('kernel.project_dir');
// Include the local configurat... | php | {
"resource": ""
} |
q243377 | Config.loadParameters | validation | protected static function loadParameters()
{
$container = System::getContainer();
if ($container === null)
{
return;
}
if ($container->hasParameter('contao.localconfig') && \is_array($params = $container->getParameter('contao.localconfig')))
{
foreach ($params as $key=>$value)
{
$GLOBALS['TL... | php | {
"resource": ""
} |
q243378 | Config.escape | validation | protected function escape($varValue)
{
if (is_numeric($varValue) && !preg_match('/e|^[+-]?0[^.]/', $varValue) && $varValue < PHP_INT_MAX)
{
return $varValue;
}
if (\is_bool($varValue))
{
return $varValue ? 'true' : 'false';
}
if ($varValue == 'true')
{
return 'true';
}
if ($varValue == ... | php | {
"resource": ""
} |
q243379 | InsecureInstallationListener.onKernelRequest | validation | public function onKernelRequest(GetResponseEvent $event): void
{
$request = $event->getRequest();
// Skip the check on localhost
if (\in_array($request->getClientIp(), ['127.0.0.1', 'fe80::1', '::1'], true)) {
return;
}
// The document root is not in a subdirect... | php | {
"resource": ""
} |
q243380 | MergeHttpHeadersListener.onKernelResponse | validation | public function onKernelResponse(FilterResponseEvent $event): void
{
if (!$this->framework->isInitialized()) {
return;
}
// Fetch remaining headers and add them to the response
$this->fetchHttpHeaders();
$this->setResponseHeaders($event->getResponse());
} | php | {
"resource": ""
} |
q243381 | MergeHttpHeadersListener.fetchHttpHeaders | validation | private function fetchHttpHeaders(): void
{
$this->headers = array_merge($this->headers, $this->headerStorage->all());
$this->headerStorage->clear();
} | php | {
"resource": ""
} |
q243382 | UserSessionListener.onKernelResponse | validation | public function onKernelResponse(FilterResponseEvent $event): void
{
if (!$this->scopeMatcher->isContaoMasterRequest($event)) {
return;
}
$token = $this->tokenStorage->getToken();
if (null === $token || $this->authenticationTrustResolver->isAnonymous($token)) {
... | php | {
"resource": ""
} |
q243383 | UserSessionListener.getSessionBag | validation | private function getSessionBag(Request $request): SessionBagInterface
{
if (!$request->hasSession() || null === ($session = $request->getSession())) {
throw new \RuntimeException('The request did not contain a session.');
}
$name = 'contao_frontend';
if ($this->scopeMat... | php | {
"resource": ""
} |
q243384 | PageError403.generate | validation | public function generate($objRootPage=null)
{
/** @var PageModel $objPage */
global $objPage;
$obj403 = $this->prepare($objRootPage);
$objPage = $obj403->loadDetails();
/** @var PageRegular $objHandler */
$objHandler = new $GLOBALS['TL_PTY']['regular']();
header('HTTP/1.1 403 Forbidden');
$objHandle... | php | {
"resource": ""
} |
q243385 | AuthenticationProvider.onBadCredentials | validation | public function onBadCredentials(User $user, AuthenticationException $exception): AuthenticationException
{
--$user->loginCount;
if ($user->loginCount > 0) {
$user->save();
return new BadCredentialsException(
sprintf('Invalid password submitted for username ... | php | {
"resource": ""
} |
q243386 | InsertTags.replace | validation | public function replace($strBuffer, $blnCache=true)
{
$strBuffer = $this->doReplace($strBuffer, $blnCache);
// Run the replacement recursively (see #8172)
while (strpos($strBuffer, '{{') !== false && ($strTmp = $this->doReplace($strBuffer, $blnCache)) != $strBuffer)
{
$strBuffer = $strTmp;
}
return $s... | php | {
"resource": ""
} |
q243387 | Newsletter.generateEmailObject | validation | protected function generateEmailObject(Result $objNewsletter, $arrAttachments)
{
$objEmail = new Email();
$objEmail->from = $objNewsletter->sender;
$objEmail->subject = $objNewsletter->subject;
// Add sender name
if ($objNewsletter->senderName != '')
{
$objEmail->fromName = $objNewsletter->senderName;
... | php | {
"resource": ""
} |
q243388 | Newsletter.sendNewsletter | validation | protected function sendNewsletter(Email $objEmail, Result $objNewsletter, $arrRecipient, $text, $html, $css=null)
{
// Prepare the text content
$objEmail->text = StringUtil::parseSimpleTokens($text, $arrRecipient);
if (!$objNewsletter->sendText)
{
// Default template
if ($objNewsletter->template == '')
... | php | {
"resource": ""
} |
q243389 | Newsletter.removeSubscriptions | validation | public function removeSubscriptions($intUser, $strMode)
{
if (!$intUser)
{
return;
}
// Delete or deactivate
if ($strMode == 'close_delete')
{
$this->Database->prepare("DELETE FROM tl_newsletter_recipients WHERE email=(SELECT email FROM tl_member WHERE id=?)")
->execute($intUser);
}
els... | php | {
"resource": ""
} |
q243390 | Newsletter.createNewUser | validation | public function createNewUser($intUser, $arrData)
{
$arrNewsletters = StringUtil::deserialize($arrData['newsletter'], true);
// Return if there are no newsletters
if (!\is_array($arrNewsletters))
{
return;
}
$time = time();
// Add recipients
foreach ($arrNewsletters as $intNewsletter)
{
$int... | php | {
"resource": ""
} |
q243391 | Newsletter.activateAccount | validation | public function activateAccount($objUser)
{
$arrNewsletters = StringUtil::deserialize($objUser->newsletter, true);
// Return if there are no newsletters
if (!\is_array($arrNewsletters))
{
return;
}
// Activate e-mail addresses
foreach ($arrNewsletters as $intNewsletter)
{
$intNewsletter = (int)... | php | {
"resource": ""
} |
q243392 | Newsletter.onToggleVisibility | validation | public function onToggleVisibility($blnDisabled, DataContainer $dc)
{
if (!$dc->id)
{
return $blnDisabled;
}
$objUser = $this->Database->prepare("SELECT email FROM tl_member WHERE id=?")
->limit(1)
->execute($dc->id);
if ($objUser->numRows)
{
$this->Database->prepare("UPDATE tl_... | php | {
"resource": ""
} |
q243393 | Newsletter.synchronize | validation | public function synchronize($varValue, $objUser, $objModule=null)
{
// Return if there is no user (e.g. upon registration)
if ($objUser === null)
{
return $varValue;
}
$blnIsFrontend = true;
// If called from the back end, the second argument is a DataContainer object
if ($objUser instanceof DataCon... | php | {
"resource": ""
} |
q243394 | Newsletter.updateAccount | validation | public function updateAccount()
{
$intUser = Input::get('id');
// Front end call
if (TL_MODE == 'FE')
{
$this->import(FrontendUser::class, 'User');
$intUser = $this->User->id;
}
// Return if there is no user (e.g. upon registration)
if (!$intUser)
{
return;
}
// Edit account
if (TL_MO... | php | {
"resource": ""
} |
q243395 | Newsletter.getNewsletters | validation | public function getNewsletters($objModule)
{
$objNewsletter = NewsletterChannelModel::findAll();
if ($objNewsletter === null)
{
return array();
}
$arrNewsletters = array();
// Return all channels if $objModule is null (see #5874)
if ($objModule === null || TL_MODE == 'BE')
{
while ($objNewslet... | php | {
"resource": ""
} |
q243396 | Newsletter.getSearchablePages | validation | public function getSearchablePages($arrPages, $intRoot=0, $blnIsSitemap=false)
{
$arrRoot = array();
if ($intRoot > 0)
{
$arrRoot = $this->Database->getChildRecords($intRoot, 'tl_page');
}
$arrProcessed = array();
$time = Date::floorToMinute();
// Get all channels
$objNewsletter = NewsletterChann... | php | {
"resource": ""
} |
q243397 | TextStore.validator | validation | protected function validator($varInput)
{
if ($varInput == '*****')
{
$this->blnSubmitInput = false;
return true;
}
return parent::validator($varInput);
} | php | {
"resource": ""
} |
q243398 | ContentYouTube.generate | validation | public function generate()
{
if ($this->youtube == '')
{
return '';
}
if (TL_MODE == 'BE')
{
$return = '<p><a href="https://youtu.be/' . $this->youtube . '" target="_blank" rel="noreferrer noopener">youtu.be/' . $this->youtube . '</a></p>';
if ($this->headline != '')
{
$return = '<'. $this-... | php | {
"resource": ""
} |
q243399 | Updater.run292Update | validation | public function run292Update()
{
$this->Database->query("ALTER TABLE `tl_calendar_events` CHANGE `startTime` `startTime` int(10) unsigned NULL");
$this->Database->query("ALTER TABLE `tl_calendar_events` CHANGE `endTime` `endTime` int(10) unsigned NULL");
$this->Database->query("ALTER TABLE `tl_calendar_events` C... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.