_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q243200 | Idna.encode | validation | public static function encode($strDomain)
{
if ($strDomain == '')
{
return '';
}
$objPunycode = new Punycode();
try
{
return $objPunycode->encode($strDomain);
}
catch (LabelOutOfBoundsException $e)
{
return '';
}
} | php | {
"resource": ""
} |
q243201 | Idna.decode | validation | public static function decode($strDomain)
{
if ($strDomain == '')
{
return '';
}
$objPunycode = new Punycode();
try
{
return $objPunycode->decode($strDomain);
}
catch (LabelOutOfBoundsException $e)
{
return '';
}
} | php | {
"resource": ""
} |
q243202 | Idna.encodeEmail | validation | public static function encodeEmail($strEmail)
{
if ($strEmail == '')
{
return '';
}
if (strpos($strEmail, '@') === false)
{
return $strEmail; // see #6241
}
$arrChunks = explode('@', $strEmail);
$strHost = static::encode(array_pop($arrChunks));
if ($strHost == '')
{
return '';
}
re... | php | {
"resource": ""
} |
q243203 | Idna.decodeEmail | validation | public static function decodeEmail($strEmail)
{
if ($strEmail == '')
{
return '';
}
if (strpos($strEmail, '@') === false)
{
return $strEmail; // see #6241
}
$arrChunks = explode('@', $strEmail);
$strHost = static::decode(array_pop($arrChunks));
if ($strHost == '')
{
return '';
}
re... | php | {
"resource": ""
} |
q243204 | Idna.encodeUrl | validation | public static function encodeUrl($strUrl)
{
if ($strUrl == '')
{
return '';
}
// Empty anchor (see #3555) or insert tag
if ($strUrl == '#' || strncmp($strUrl, '{{', 2) === 0)
{
return $strUrl;
}
// E-mail address
if (strncmp($strUrl, 'mailto:', 7) === 0)
{
return static::encodeEmail($str... | php | {
"resource": ""
} |
q243205 | Idna.decodeUrl | validation | public static function decodeUrl($strUrl)
{
if ($strUrl == '')
{
return '';
}
// Empty anchor (see #3555) or insert tag
if ($strUrl == '#' || strncmp($strUrl, '{{', 2) === 0)
{
return $strUrl;
}
// E-mail address
if (strncmp($strUrl, 'mailto:', 7) === 0)
{
return static::decodeEmail($str... | php | {
"resource": ""
} |
q243206 | ModuleRandomImage.generate | validation | public function generate()
{
$this->multiSRC = StringUtil::deserialize($this->multiSRC);
if (empty($this->multiSRC) || !\is_array($this->multiSRC))
{
return '';
}
$this->objFiles = FilesModel::findMultipleByUuids($this->multiSRC);
if ($this->objFiles === null)
{
return '';
}
return parent::... | php | {
"resource": ""
} |
q243207 | FilesModel.findByPk | validation | public static function findByPk($varValue, array $arrOptions=array())
{
if (static::$strPk == 'id')
{
return static::findById($varValue, $arrOptions);
}
return parent::findByPk($varValue, $arrOptions);
} | php | {
"resource": ""
} |
q243208 | FilesModel.findById | validation | public static function findById($intId, array $arrOptions=array())
{
if (Validator::isUuid($intId))
{
return static::findByUuid($intId, $arrOptions);
}
return static::findOneBy('id', $intId, $arrOptions);
} | php | {
"resource": ""
} |
q243209 | FilesModel.findByPid | validation | public static function findByPid($intPid, array $arrOptions=array())
{
$t = static::$strTable;
// Convert UUIDs to binary
if (Validator::isStringUuid($intPid))
{
$intPid = StringUtil::uuidToBin($intPid);
}
return static::findBy(array("$t.pid=UNHEX(?)"), bin2hex($intPid), $arrOptions);
} | php | {
"resource": ""
} |
q243210 | FilesModel.findMultipleByIds | validation | public static function findMultipleByIds($arrIds, array $arrOptions=array())
{
if (empty($arrIds) || !\is_array($arrIds))
{
return null;
}
if (Validator::isUuid(current($arrIds)))
{
return static::findMultipleByUuids($arrIds, $arrOptions);
}
return parent::findMultipleByIds($arrIds, $arrOptions);... | php | {
"resource": ""
} |
q243211 | FilesModel.findByUuid | validation | public static function findByUuid($strUuid, array $arrOptions=array())
{
$t = static::$strTable;
// Convert UUIDs to binary
if (Validator::isStringUuid($strUuid))
{
$strUuid = StringUtil::uuidToBin($strUuid);
}
// Check the model registry (does not work by default due to UNHEX())
if (empty($arrOptio... | php | {
"resource": ""
} |
q243212 | FilesModel.findMultipleByUuids | validation | public static function findMultipleByUuids($arrUuids, array $arrOptions=array())
{
if (empty($arrUuids) || !\is_array($arrUuids))
{
return null;
}
$t = static::$strTable;
foreach ($arrUuids as $k=>$v)
{
// Convert UUIDs to binary
if (Validator::isStringUuid($v))
{
$v = StringUtil::uuidToB... | php | {
"resource": ""
} |
q243213 | FilesModel.findByPath | validation | public static function findByPath($path, array $arrOptions=array())
{
$rootDir = System::getContainer()->getParameter('kernel.project_dir');
if (strncmp($path, $rootDir . '/', \strlen($rootDir) + 1) === 0)
{
$path = substr($path, \strlen($rootDir) + 1);
}
return static::findOneBy('path', $path, $arrOpti... | php | {
"resource": ""
} |
q243214 | FilesModel.findMultipleByPaths | validation | public static function findMultipleByPaths($arrPaths, array $arrOptions=array())
{
if (empty($arrPaths) || !\is_array($arrPaths))
{
return null;
}
$t = static::$strTable;
if (!isset($arrOptions['order']))
{
$arrOptions['order'] = Database::getInstance()->findInSet("$t.path", $arrPaths);
}
retu... | php | {
"resource": ""
} |
q243215 | FilesModel.findMultipleByUuidsAndExtensions | validation | public static function findMultipleByUuidsAndExtensions($arrUuids, $arrExtensions, array $arrOptions=array())
{
if (empty($arrUuids) || empty($arrExtensions) || !\is_array($arrUuids) || !\is_array($arrExtensions))
{
return null;
}
foreach ($arrExtensions as $k=>$v)
{
if (!preg_match('/^[a-z0-9]{2,5}$/... | php | {
"resource": ""
} |
q243216 | FilesModel.findMultipleFilesByFolder | validation | public static function findMultipleFilesByFolder($strPath, array $arrOptions=array())
{
$t = static::$strTable;
$strPath = str_replace(array('\\', '%', '_'), array('\\\\', '\\%', '\\_'), $strPath);
return static::findBy(array("$t.type='file' AND $t.path LIKE ? AND $t.path NOT LIKE ?"), array($strPath.'/%', $str... | php | {
"resource": ""
} |
q243217 | FilesModel.findMultipleFoldersByFolder | validation | public static function findMultipleFoldersByFolder($strPath, array $arrOptions=array())
{
$t = static::$strTable;
$strPath = str_replace(array('\\', '%', '_'), array('\\\\', '\\%', '\\_'), $strPath);
return static::findBy(array("$t.type='folder' AND $t.path LIKE ? AND $t.path NOT LIKE ?"), array($strPath.'/%', ... | php | {
"resource": ""
} |
q243218 | PreviewUrlCreateListener.onPreviewUrlCreate | validation | public function onPreviewUrlCreate(PreviewUrlCreateEvent $event): void
{
if (!$this->framework->isInitialized() || 'news' !== $event->getKey()) {
return;
}
$request = $this->requestStack->getCurrentRequest();
if (null === $request) {
throw new \RuntimeExcept... | php | {
"resource": ""
} |
q243219 | Message.add | validation | public static function add($strMessage, $strType, $strScope=TL_MODE)
{
if ($strMessage == '')
{
return;
}
if (!\in_array($strType, static::getTypes()))
{
throw new \Exception("Invalid message type $strType");
}
System::getContainer()->get('session')->getFlashBag()->add(static::getFlashBagKey($str... | php | {
"resource": ""
} |
q243220 | Message.generate | validation | public static function generate($strScope=TL_MODE)
{
$strMessages = static::generateUnwrapped($strScope);
if ($strMessages != '')
{
$strMessages = '<div class="tl_message">' . $strMessages . '</div>';
}
return $strMessages;
} | php | {
"resource": ""
} |
q243221 | Message.generateUnwrapped | validation | public static function generateUnwrapped($strScope=TL_MODE, $blnRaw=false)
{
$session = System::getContainer()->get('session');
if (!$session->isStarted())
{
return '';
}
$strMessages = '';
$flashBag = $session->getFlashBag();
foreach (static::getTypes() as $strType)
{
$strClass = strtolower($... | php | {
"resource": ""
} |
q243222 | Message.reset | validation | public static function reset()
{
$session = System::getContainer()->get('session');
if (!$session->isStarted())
{
return;
}
$session->getFlashBag()->clear();
} | php | {
"resource": ""
} |
q243223 | Message.hasError | validation | public static function hasError($strScope=TL_MODE)
{
$session = System::getContainer()->get('session');
if (!$session->isStarted())
{
return false;
}
return $session->getFlashBag()->has(static::getFlashBagKey('error', $strScope));
} | php | {
"resource": ""
} |
q243224 | Message.hasMessages | validation | public static function hasMessages($strScope=TL_MODE)
{
return static::hasError($strScope) || static::hasConfirmation($strScope) || static::hasNew($strScope) || static::hasInfo($strScope) || static::hasRaw($strScope);
} | php | {
"resource": ""
} |
q243225 | ImageSizes.getAllOptions | validation | public function getAllOptions(): array
{
$this->loadOptions();
$event = new ImageSizesEvent($this->options);
$this->eventDispatcher->dispatch(ContaoCoreEvents::IMAGE_SIZES_ALL, $event);
return $event->getImageSizes();
} | php | {
"resource": ""
} |
q243226 | ImageSizes.getOptionsForUser | validation | public function getOptionsForUser(BackendUser $user): array
{
$this->loadOptions();
if ($user->isAdmin) {
$event = new ImageSizesEvent($this->options, $user);
} else {
$options = array_map(
static function ($val) {
return is_numeri... | php | {
"resource": ""
} |
q243227 | ImageSizes.loadOptions | validation | private function loadOptions(): void
{
if (null !== $this->options) {
return;
}
// The framework is required to have the TL_CROP options available
$this->framework->initialize();
$this->options = $GLOBALS['TL_CROP'];
$rows = $this->connection->fetchAll(... | php | {
"resource": ""
} |
q243228 | ImageSizes.filterOptions | validation | private function filterOptions(array $allowedSizes): array
{
if (empty($allowedSizes)) {
return [];
}
$filteredSizes = [];
foreach ($this->options as $group => $sizes) {
if ('image_sizes' === $group) {
$this->filterImageSizes($sizes, $allowed... | php | {
"resource": ""
} |
q243229 | Frontend.getRootPageFromUrl | validation | public static function getRootPageFromUrl()
{
$host = Environment::get('host');
$logger = System::getContainer()->get('monolog.logger.contao');
$accept_language = Environment::get('httpAcceptLanguage');
// The language is set in the URL
if (!empty($_GET['language']) && Config::get('addLanguageToUrl'))
{
... | php | {
"resource": ""
} |
q243230 | Frontend.addToUrl | validation | public static function addToUrl($strRequest, $blnIgnoreParams=false, $arrUnset=array())
{
$arrGet = $blnIgnoreParams ? array() : $_GET;
// Clean the $_GET values (thanks to thyon)
foreach (array_keys($arrGet) as $key)
{
$arrGet[$key] = Input::get($key, true, true);
}
$arrFragments = preg_split('/&(amp... | php | {
"resource": ""
} |
q243231 | Frontend.jumpToOrReload | validation | protected function jumpToOrReload($intId, $strParams=null, $strForceLang=null)
{
if ($strForceLang !== null)
{
@trigger_error('Using Frontend::jumpToOrReload() with $strForceLang has been deprecated and will no longer work in Contao 5.0.', E_USER_DEPRECATED);
}
/** @var PageModel $objPage */
global $objP... | php | {
"resource": ""
} |
q243232 | Frontend.getLoginStatus | validation | protected function getLoginStatus($strCookie)
{
@trigger_error('Using Frontend::getLoginStatus() has been deprecated and will no longer work in Contao 5.0. Use Symfony security instead.', E_USER_DEPRECATED);
$objTokenChecker = System::getContainer()->get('contao.security.token_checker');
if ($strCookie == 'BE_... | php | {
"resource": ""
} |
q243233 | Frontend.getMetaData | validation | public static function getMetaData($strData, $strLanguage)
{
if (empty($strLanguage))
{
return array();
}
$arrData = StringUtil::deserialize($strData);
// Convert the language to a locale (see #5678)
$strLanguage = str_replace('-', '_', $strLanguage);
if (!\is_array($arrData) || !isset($arrData[$st... | php | {
"resource": ""
} |
q243234 | Frontend.prepareMetaDescription | validation | protected function prepareMetaDescription($strText)
{
$strText = $this->replaceInsertTags($strText, false);
$strText = strip_tags($strText);
$strText = str_replace("\n", ' ', $strText);
$strText = StringUtil::substr($strText, 320);
return trim($strText);
} | php | {
"resource": ""
} |
q243235 | Frontend.indexPageIfApplicable | validation | public static function indexPageIfApplicable(Response $objResponse)
{
global $objPage;
if ($objPage === null)
{
return;
}
// Index page if searching is allowed and there is no back end user
if (Config::get('enableSearch') && $objResponse->getStatusCode() == 200 && !BE_USER_LOGGED_IN && !$objPage->noSe... | php | {
"resource": ""
} |
q243236 | Feed.generateRss | validation | public function generateRss()
{
$this->adjustPublicationDate();
$xml = '<?xml version="1.0" encoding="' . Config::get('characterSet') . '"?>';
$xml .= '<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:atom="http://www.w3.org/2005/Atom">';
$xml .= '<channel>';
$xml .= '<title>' . StringU... | php | {
"resource": ""
} |
q243237 | Feed.adjustPublicationDate | validation | protected function adjustPublicationDate()
{
if (!empty($this->arrItems) && $this->arrItems[0]->published > $this->published)
{
$this->published = $this->arrItems[0]->published;
}
} | php | {
"resource": ""
} |
q243238 | ParameterDumper.dump | validation | public function dump(): void
{
if (
empty($this->parameters['parameters']['secret']) ||
'ThisTokenIsNotSoSecretChangeIt' === $this->parameters['parameters']['secret']
) {
$this->parameters['parameters']['secret'] = bin2hex(random_bytes(32));
}
if ... | php | {
"resource": ""
} |
q243239 | LanguageResolver.getLocale | validation | public function getLocale(): string
{
foreach ($this->getAcceptedLocales() as $locale) {
if (file_exists($this->translationsDir.'/messages.'.$locale.'.xlf')) {
return $locale;
}
}
return 'en';
} | php | {
"resource": ""
} |
q243240 | LanguageResolver.getAcceptedLocales | validation | private function getAcceptedLocales(): array
{
$accepted = [];
$locales = [];
// The implementation differs from the original implementation and also works with .jp browsers
preg_match_all(
'/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.\d+))?/i',
$this->r... | php | {
"resource": ""
} |
q243241 | BackendCsvImportController.fetchData | validation | private function fetchData(FileUpload $uploader, string $separator, callable $callback): array
{
$data = [];
$files = $this->getFiles($uploader);
$delimiter = $this->getDelimiter($separator);
foreach ($files as $file) {
$fp = fopen($file, 'r');
while (false ... | php | {
"resource": ""
} |
q243242 | BackendCsvImportController.getFiles | validation | private function getFiles(FileUpload $uploader): array
{
$files = $uploader->uploadTo('system/tmp');
if (\count($files) < 1) {
throw new \RuntimeException($this->translator->trans('ERR.all_fields', [], 'contao_default'));
}
foreach ($files as &$file) {
$exte... | php | {
"resource": ""
} |
q243243 | PackageUtil.getVersion | validation | public static function getVersion(string $packageName): string
{
$version = Versions::getVersion($packageName);
return static::parseVersion($version);
} | php | {
"resource": ""
} |
q243244 | PackageUtil.getNormalizedVersion | validation | public static function getNormalizedVersion(string $packageName): string
{
$chunks = explode('.', static::getVersion($packageName));
$chunks += [0, 0, 0];
if (\count($chunks) > 3) {
$chunks = \array_slice($chunks, 0, 3);
}
return implode('.', $chunks);
} | php | {
"resource": ""
} |
q243245 | FormTextField.addAttributes | validation | public function addAttributes($arrAttributes)
{
parent::addAttributes($arrAttributes);
if ($this->type != 'number')
{
return;
}
foreach (array('minlength', 'minval', 'maxlength', 'maxval') as $name)
{
if (isset($arrAttributes[$name]))
{
$this->$name = $arrAttributes[$name];
}
}
} | php | {
"resource": ""
} |
q243246 | ModuleUnsubscribe.validateForm | validation | protected function validateForm(Widget $objWidget=null)
{
// Validate the e-mail address
$varInput = Idna::encodeEmail(Input::post('email', true));
if (!Validator::isEmail($varInput))
{
$this->Template->mclass = 'error';
$this->Template->message = $GLOBALS['TL_LANG']['ERR']['email'];
return false;
... | php | {
"resource": ""
} |
q243247 | ModuleUnsubscribe.removeRecipient | validation | protected function removeRecipient($strEmail, $arrRemove)
{
// Remove the subscriptions
if (($objRemove = NewsletterRecipientsModel::findByEmailAndPids($strEmail, $arrRemove)) !== null)
{
while ($objRemove->next())
{
$strHash = md5($objRemove->email);
// Add a blacklist entry (see #4999)
if ((... | php | {
"resource": ""
} |
q243248 | ExceptionConverterListener.onKernelException | validation | public function onKernelException(GetResponseForExceptionEvent $event): void
{
$exception = $event->getException();
if ($exception->getPrevious() instanceof ResourceNotFoundException && !$this->hasRootPages()) {
$exception = new NoRootPageFoundException('No root page found', 0, $excepti... | php | {
"resource": ""
} |
q243249 | Translator.loadLanguageFile | validation | private function loadLanguageFile(string $name): void
{
/** @var System $system */
$system = $this->framework->getAdapter(System::class);
$system->loadLanguageFile($name);
} | php | {
"resource": ""
} |
q243250 | GlobalsMapListener.onInitializeSystem | validation | public function onInitializeSystem(): void
{
foreach ($this->globals as $key => $value) {
if (\is_array($value) && isset($GLOBALS[$key]) && \is_array($GLOBALS[$key])) {
$GLOBALS[$key] = array_replace_recursive($GLOBALS[$key], $value);
} else {
$GLOBALS... | php | {
"resource": ""
} |
q243251 | InitializeController.indexAction | validation | public function indexAction(): InitializeControllerResponse
{
@trigger_error('Custom entry points are deprecated and will no longer work in Contao 5.0.', E_USER_DEPRECATED);
$masterRequest = $this->get('request_stack')->getMasterRequest();
if (null === $masterRequest) {
throw n... | php | {
"resource": ""
} |
q243252 | CalendarFeedModel.findByCalendar | validation | public static function findByCalendar($intId, array $arrOptions=array())
{
$t = static::$strTable;
return static::findBy(array("$t.calendars LIKE '%\"" . (int) $intId . "\"%'"), null, $arrOptions);
} | php | {
"resource": ""
} |
q243253 | ClassLoader.addNamespace | validation | public static function addNamespace($name)
{
@trigger_error('Using ClassLoader::addNamespace() has been deprecated and will no longer work in Contao 5.0.', E_USER_DEPRECATED);
if (\in_array($name, self::$namespaces))
{
return;
}
array_unshift(self::$namespaces, $name);
} | php | {
"resource": ""
} |
q243254 | ClassLoader.addNamespaces | validation | public static function addNamespaces($names)
{
@trigger_error('Using ClassLoader::addNamespaces() has been deprecated and will no longer work in Contao 5.0.', E_USER_DEPRECATED);
foreach ($names as $name)
{
self::addNamespace($name);
}
} | php | {
"resource": ""
} |
q243255 | ClassLoader.addClasses | validation | public static function addClasses($classes)
{
@trigger_error('Using ClassLoader::addClasses() has been deprecated and will no longer work in Contao 5.0.', E_USER_DEPRECATED);
foreach ($classes as $class=>$file)
{
self::addClass($class, $file);
}
} | php | {
"resource": ""
} |
q243256 | ClassLoader.load | validation | public static function load($class)
{
if (class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false))
{
return;
}
$rootDir = System::getContainer()->getParameter('kernel.project_dir');
// The class file is set in the mapper
if (isset(self::$classes[$class]))
{
i... | php | {
"resource": ""
} |
q243257 | FileUpload.generateMarkup | validation | public function generateMarkup()
{
$return = '
<div>
<input type="file" name="' . $this->strName . '[]" class="tl_upload_field" onfocus="Backend.getScrollOffset()" multiple required>
</div>';
if (isset($GLOBALS['TL_LANG']['tl_files']['fileupload'][1]))
{
$return .= '
<p class="tl_help tl_tip">' . s... | php | {
"resource": ""
} |
q243258 | FileUpload.resizeUploadedImage | validation | protected function resizeUploadedImage($strImage)
{
// The feature is disabled
if (Config::get('imageWidth') < 1 && Config::get('imageHeight') < 1)
{
return false;
}
$objFile = new File($strImage);
// Not an image
if (!$objFile->isSvgImage && !$objFile->isGdImage)
{
return false;
}
$arrIma... | php | {
"resource": ""
} |
q243259 | ContaoCoreExtension.setImagineService | validation | private function setImagineService(array $config, ContainerBuilder $container): void
{
$imagineServiceId = $config['image']['imagine_service'];
// Generate if not present
if (null === $imagineServiceId) {
$class = $this->getImagineImplementation();
$imagineServiceId ... | php | {
"resource": ""
} |
q243260 | ContaoCoreExtension.overwriteImageTargetDir | validation | private function overwriteImageTargetDir(array $config, ContainerBuilder $container): void
{
if (!isset($config['image']['target_path'])) {
return;
}
$container->setParameter(
'contao.image.target_dir',
$container->getParameter('kernel.project_dir').'/'.$... | php | {
"resource": ""
} |
q243261 | ModuleFaq.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 categories
$objFaq = FaqCategoryModel::fi... | php | {
"resource": ""
} |
q243262 | PageModel.findPublishedByPid | validation | public static function findPublishedByPid($intPid, array $arrOptions=array())
{
$t = static::$strTable;
$arrColumns = array("$t.pid=?");
if (!static::isPreviewMode($arrOptions))
{
$time = Date::floorToMinute();
$arrColumns[] = "($t.start='' OR $t.start<='$time') AND ($t.stop='' OR $t.stop>'" . ($time + ... | php | {
"resource": ""
} |
q243263 | PageModel.findFirstPublishedRootByHostAndLanguage | validation | public static function findFirstPublishedRootByHostAndLanguage($strHost, $varLanguage, array $arrOptions=array())
{
@trigger_error('Using PageModel::findFirstPublishedRootByHostAndLanguage() has been deprecated and will no longer work Contao 5.0.', E_USER_DEPRECATED);
$t = static::$strTable;
$objDatabase = Data... | php | {
"resource": ""
} |
q243264 | PageModel.findFirstPublishedByPid | validation | public static function findFirstPublishedByPid($intPid, array $arrOptions=array())
{
$t = static::$strTable;
$arrColumns = array("$t.pid=? AND $t.type!='root' AND $t.type!='error_401' AND $t.type!='error_403' AND $t.type!='error_404'");
if (!static::isPreviewMode($arrOptions))
{
$time = Date::floorToMinute... | php | {
"resource": ""
} |
q243265 | PageModel.findByAliases | validation | public static function findByAliases($arrAliases, array $arrOptions=array())
{
if (empty($arrAliases) || !\is_array($arrAliases))
{
return null;
}
// Remove everything that is not an alias
$arrAliases = array_filter(array_map(function ($v) { return preg_match('/^[\w\/.-]+$/u', $v) ? $v : null; }, $arrAli... | php | {
"resource": ""
} |
q243266 | PageModel.findPublishedByIdOrAlias | validation | public static function findPublishedByIdOrAlias($varId, array $arrOptions=array())
{
$t = static::$strTable;
$arrColumns = !preg_match('/^[1-9]\d*$/', $varId) ? array("$t.alias=?") : array("$t.id=?");
if (!static::isPreviewMode($arrOptions))
{
$time = Date::floorToMinute();
$arrColumns[] = "($t.start=''... | php | {
"resource": ""
} |
q243267 | PageModel.findPublishedSubpagesWithoutGuestsByPid | validation | public static function findPublishedSubpagesWithoutGuestsByPid($intPid, $blnShowHidden=false, $blnIsSitemap=false)
{
$time = Date::floorToMinute();
$objSubpages = Database::getInstance()->prepare("SELECT p1.*, (SELECT COUNT(*) FROM tl_page p2 WHERE p2.pid=p1.id AND p2.type!='root' AND p2.type!='error_401' AND p2.... | php | {
"resource": ""
} |
q243268 | PageModel.findPublishedRegularWithoutGuestsByIds | validation | public static function findPublishedRegularWithoutGuestsByIds($arrIds, array $arrOptions=array())
{
if (empty($arrIds) || !\is_array($arrIds))
{
return null;
}
$t = static::$strTable;
$arrColumns = array("$t.id IN(" . implode(',', array_map('\intval', $arrIds)) . ") AND $t.type!='error_401' AND $t.type!=... | php | {
"resource": ""
} |
q243269 | PageModel.findPublishedRegularWithoutGuestsByPid | validation | public static function findPublishedRegularWithoutGuestsByPid($intPid, array $arrOptions=array())
{
$t = static::$strTable;
$arrColumns = array("$t.pid=? AND $t.type!='root' AND $t.type!='error_401' AND $t.type!='error_403' AND $t.type!='error_404'");
if (FE_USER_LOGGED_IN)
{
$arrColumns[] = "$t.guests=''"... | php | {
"resource": ""
} |
q243270 | PageModel.findPublishedFallbackByHostname | validation | public static function findPublishedFallbackByHostname($strHost, array $arrOptions=array())
{
// Try to load from the registry (see #8544)
if (empty($arrOptions))
{
$objModel = Registry::getInstance()->fetch(static::$strTable, $strHost, 'contao.dns-fallback');
if ($objModel !== null)
{
return $objM... | php | {
"resource": ""
} |
q243271 | PageModel.findPublishedRootPages | validation | public static function findPublishedRootPages(array $arrOptions=array())
{
$t = static::$strTable;
$arrColumns = array("$t.type=?");
if (!static::isPreviewMode($arrOptions))
{
$time = Date::floorToMinute();
$arrColumns[] = "($t.start='' OR $t.start<='$time') AND ($t.stop='' OR $t.stop>'" . ($time + 60) ... | php | {
"resource": ""
} |
q243272 | PageModel.findParentsById | validation | public static function findParentsById($intId)
{
$arrModels = array();
while ($intId > 0 && ($objPage = static::findByPk($intId)) !== null)
{
$intId = $objPage->pid;
$arrModels[] = $objPage;
}
if (empty($arrModels))
{
return null;
}
return static::createCollection($arrModels, 'tl_page');
} | php | {
"resource": ""
} |
q243273 | PageModel.findFirstActiveByMemberGroups | validation | public static function findFirstActiveByMemberGroups($arrIds)
{
if (empty($arrIds) || !\is_array($arrIds))
{
return null;
}
$time = Date::floorToMinute();
$objDatabase = Database::getInstance();
$arrIds = array_map('\intval', $arrIds);
$objResult = $objDatabase->prepare("SELECT p.* FROM tl_member_gr... | php | {
"resource": ""
} |
q243274 | PageModel.findWithDetails | validation | public static function findWithDetails($intId)
{
$objPage = static::findByPk($intId);
if ($objPage === null)
{
return null;
}
return $objPage->loadDetails();
} | php | {
"resource": ""
} |
q243275 | PageModel.onRegister | validation | public function onRegister(Registry $registry)
{
parent::onRegister($registry);
// Register this model as being the fallback page for a given dns
if ($this->fallback && $this->type == 'root' && !$registry->isRegisteredAlias($this, 'contao.dns-fallback', $this->dns))
{
$registry->registerAlias($this, 'conta... | php | {
"resource": ""
} |
q243276 | PageModel.onUnregister | validation | public function onUnregister(Registry $registry)
{
parent::onUnregister($registry);
// Unregister the fallback page
if ($this->fallback && $this->type == 'root' && $registry->isRegisteredAlias($this, 'contao.dns-fallback', $this->dns))
{
$registry->unregisterAlias($this, 'contao.dns-fallback', $this->dns);... | php | {
"resource": ""
} |
q243277 | PageModel.getAbsoluteUrl | validation | public function getAbsoluteUrl($strParams=null)
{
$this->loadDetails();
$objUrlGenerator = System::getContainer()->get('contao.routing.url_generator');
$strUrl = $objUrlGenerator->generate
(
($this->alias ?: $this->id) . $strParams,
array
(
'_locale' => $this->rootLanguage,
'_domain' => $thi... | php | {
"resource": ""
} |
q243278 | PageModel.getSlugOptions | validation | public function getSlugOptions()
{
$slugOptions = array('locale'=>$this->language);
if ($this->validAliasCharacters)
{
$slugOptions['validChars'] = $this->validAliasCharacters;
}
return $slugOptions;
} | php | {
"resource": ""
} |
q243279 | PageModel.applyLegacyLogic | validation | private function applyLegacyLogic($strUrl, $strParams)
{
// Decode sprintf placeholders
if (strpos($strParams, '%') !== false)
{
@trigger_error('Using sprintf placeholders in URLs has been deprecated and will no longer work in Contao 5.0.', E_USER_DEPRECATED);
$arrMatches = array();
preg_match_all('/%(... | php | {
"resource": ""
} |
q243280 | PictureFactory.createConfig | validation | private function createConfig($size): array
{
if (!\is_array($size)) {
$size = [0, 0, $size];
}
$config = new PictureConfiguration();
$attributes = [];
if (!isset($size[2]) || !is_numeric($size[2])) {
$resizeConfig = new ResizeConfiguration();
... | php | {
"resource": ""
} |
q243281 | PictureFactory.createConfigItem | validation | private function createConfigItem($imageSize): PictureConfigurationItem
{
$configItem = new PictureConfigurationItem();
$resizeConfig = new ResizeConfiguration();
if (null !== $imageSize) {
$resizeConfig
->setWidth($imageSize->width)
->setHeight($... | php | {
"resource": ""
} |
q243282 | SymlinkUtil.symlink | validation | public static function symlink(string $target, string $link, string $rootDir): void
{
static::validateSymlink($target, $link, $rootDir);
$fs = new Filesystem();
if (!$fs->isAbsolutePath($target)) {
$target = $rootDir.'/'.$target;
}
if (!$fs->isAbsolutePath($lin... | php | {
"resource": ""
} |
q243283 | SymlinkUtil.validateSymlink | validation | public static function validateSymlink(string $target, string $link, string $rootDir): void
{
if ('' === $target) {
throw new \InvalidArgumentException('The symlink target must not be empty.');
}
if ('' === $link) {
throw new \InvalidArgumentException('The symlink pa... | php | {
"resource": ""
} |
q243284 | NewsletterRecipientsModel.findByEmailAndPids | validation | public static function findByEmailAndPids($strEmail, $arrPids, array $arrOptions=array())
{
if (empty($arrPids) || !\is_array($arrPids))
{
return null;
}
$t = static::$strTable;
return static::findBy(array("$t.email=? AND $t.pid IN(" . implode(',', array_map('\intval', $arrPids)) . ")"), $strEmail, $arr... | php | {
"resource": ""
} |
q243285 | ConnectionFactory.create | validation | public static function create(array $parameters): ?Connection
{
$params = [
'driver' => 'pdo_mysql',
'host' => $parameters['parameters']['database_host'],
'port' => $parameters['parameters']['database_port'],
'user' => $parameters['parameters']['database_user'... | php | {
"resource": ""
} |
q243286 | ContentCode.generate | validation | public function generate()
{
if (TL_MODE == 'BE')
{
$return = '<pre>'. htmlspecialchars($this->code) .'</pre>';
if ($this->headline != '')
{
$return = '<'. $this->hl .'>'. $this->headline .'</'. $this->hl .'>'. $return;
}
return $return;
}
return parent::generate();
} | php | {
"resource": ""
} |
q243287 | AbstractLockedCommand.getTempDir | validation | private function getTempDir(): string
{
$container = $this->getContainer();
$tmpDir = sys_get_temp_dir().'/'.md5($container->getParameter('kernel.project_dir'));
if (!is_dir($tmpDir)) {
$container->get('filesystem')->mkdir($tmpDir);
}
return $tmpDir;
} | php | {
"resource": ""
} |
q243288 | DoctrineSchemaListener.onSchemaIndexDefinition | validation | public function onSchemaIndexDefinition(SchemaIndexDefinitionEventArgs $event): void
{
// Skip for doctrine/dbal >= 2.9
if (method_exists(AbstractPlatform::class, 'supportsColumnLengthIndexes')) {
return;
}
$connection = $event->getConnection();
if (!$connection... | php | {
"resource": ""
} |
q243289 | ContaoTableHandler.createStatement | validation | private function createStatement(): void
{
if (null !== $this->statement) {
return;
}
if (null === $this->container || !$this->container->has($this->dbalServiceName)) {
throw new \RuntimeException('The container has not been injected or the database service is missin... | php | {
"resource": ""
} |
q243290 | ContaoTableHandler.executeHook | validation | private function executeHook(string $message, ContaoContext $context): void
{
if (null === $this->container || !$this->container->has('contao.framework')) {
return;
}
$framework = $this->container->get('contao.framework');
if (!$this->hasAddLogEntryHook() || !$framework... | php | {
"resource": ""
} |
q243291 | FrontendUser.findBy | validation | public function findBy($strColumn, $varValue)
{
if (parent::findBy($strColumn, $varValue) === false)
{
return false;
}
$this->arrGroups = $this->groups;
return true;
} | php | {
"resource": ""
} |
q243292 | FrontendUser.save | validation | public function save()
{
$groups = $this->groups;
$this->arrData['groups'] = $this->arrGroups;
parent::save();
$this->groups = $groups;
} | php | {
"resource": ""
} |
q243293 | Picture.create | validation | public static function create($file, $size=null)
{
if (\is_string($file))
{
$file = new File(rawurldecode($file));
}
$imageSize = null;
$picture = new static($file);
// tl_image_size ID as resize mode
if (\is_array($size) && !empty($size[2]) && is_numeric($size[2]))
{
$size = (int) $size[2];
... | php | {
"resource": ""
} |
q243294 | Picture.getTemplateData | validation | public function getTemplateData()
{
$rootDir = System::getContainer()->getParameter('kernel.project_dir');
$image = System::getContainer()->get('contao.image.image_factory')->create($rootDir . '/' . $this->image->getOriginalPath());
$config = new PictureConfiguration();
$config->setSize($this->getConfiguratio... | php | {
"resource": ""
} |
q243295 | Picture.getConfigurationItem | validation | protected function getConfigurationItem($imageSize)
{
$configItem = new PictureConfigurationItem();
$resizeConfig = new ResizeConfiguration();
$mode = $imageSize->resizeMode;
if (substr_count($mode, '_') === 1)
{
$importantPart = $this->image->setImportantPart(null)->getImportantPart();
$mode = expl... | php | {
"resource": ""
} |
q243296 | SectionWizard.validator | validation | protected function validator($varInput)
{
$arrTitles = array();
$arrIds = array();
$arrSections = array();
foreach ($varInput as $arrSection)
{
// Title and ID are required
if ((!empty($arrSection['title']) && empty($arrSection['id'])) || (empty($arrSection['title']) && !empty($arrSection['id'])))
... | php | {
"resource": ""
} |
q243297 | tl_page.setRootType | validation | public function setRootType(Contao\DataContainer $dc)
{
if (Contao\Input::get('act') != 'create')
{
return;
}
// Insert into
if (Contao\Input::get('pid') == 0)
{
$GLOBALS['TL_DCA']['tl_page']['fields']['type']['default'] = 'root';
}
elseif (Contao\Input::get('mode') == 1)
{
$objPage = $this... | php | {
"resource": ""
} |
q243298 | tl_page.checkRootType | validation | public function checkRootType($varValue, Contao\DataContainer $dc)
{
if ($varValue != 'root' && $dc->activeRecord->pid == 0)
{
throw new Exception($GLOBALS['TL_LANG']['ERR']['topLevelRoot']);
}
return $varValue;
} | php | {
"resource": ""
} |
q243299 | tl_page.makeRedirectPageMandatory | validation | public function makeRedirectPageMandatory(Contao\DataContainer $dc)
{
$objPage = $this->Database->prepare("SELECT * FROM " . $dc->table . " WHERE id=?")
->limit(1)
->execute($dc->id);
if ($objPage->numRows && $objPage->type == 'logout')
{
$GLOBALS['TL_DCA']['tl_page']['fields']['jumpTo'][... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.