• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Contao\Config类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Contao\Config的典型用法代码示例。如果您正苦于以下问题:PHP Config类的具体用法?PHP Config怎么用?PHP Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Config类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var PageModel $objPage */
     global $objPage;
     $lang = null;
     $host = null;
     // Start from the website root if there is no reference page
     if (!$this->rootPage) {
         $this->rootPage = $objPage->rootId;
     } else {
         $objRootPage = \PageModel::findWithDetails($this->rootPage);
         // Set the language
         if (\Config::get('addLanguageToUrl') && $objRootPage->rootLanguage != $objPage->rootLanguage) {
             $lang = $objRootPage->rootLanguage;
         }
         // Set the domain
         if ($objRootPage->rootId != $objPage->rootId && $objRootPage->domain != '' && $objRootPage->domain != $objPage->domain) {
             $host = $objRootPage->domain;
         }
     }
     $this->showLevel = 0;
     $this->hardLimit = false;
     $this->levelOffset = 0;
     $this->Template->items = $this->renderNavigation($this->rootPage, 1, $host, $lang);
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:28,代码来源:ModuleSitemap.php


示例2: insertProSearchLegend

 /**
  * @param $strName
  * @return null
  */
 public function insertProSearchLegend($strName)
 {
     $activeTables = deserialize(Config::get('searchIndexModules'));
     $coreModulesArr = $activeTables ? $activeTables : array();
     if (in_array($strName, $coreModulesArr) && $GLOBALS['TL_DCA'][$strName]) {
         if (!$this->createColsIfNotExist($strName)) {
             return null;
         }
         $palletesArr = $GLOBALS['TL_DCA'][$strName]['palettes'] ? $GLOBALS['TL_DCA'][$strName]['palettes'] : array();
         static::loadLanguageFile('tl_prosearch_data');
         // legend label setzen
         $GLOBALS['TL_LANG'][$strName]['prosearch_legend'] = $GLOBALS['TL_LANG']['tl_prosearch_data']['prosearch_legend'];
         foreach ($palletesArr as $k => $pallete) {
             if ($k == '__selector__') {
                 continue;
             }
             $palleteArr = explode(';', $pallete);
             if (count($palleteArr) == 1) {
                 $GLOBALS['TL_DCA'][$strName]['palettes'][$k] .= ';' . static::palettesStr();
             } else {
                 $GLOBALS['TL_DCA'][$strName]['palettes'][$k] = str_replace($palleteArr[0], $palleteArr[0] . ';' . static::palettesStr(), $GLOBALS['TL_DCA'][$strName]['palettes'][$k]);
             }
         }
         $GLOBALS['TL_DCA'][$strName]['config']['onload_callback'][] = array('ProSearchPalette', 'getAvailabletags');
         foreach ($this->getFields() as $field => $method) {
             $GLOBALS['TL_DCA'][$strName]['fields'][$field] = call_user_func(array('ProSearchPalette', $method));
         }
     }
 }
开发者ID:alnv,项目名称:prosearch,代码行数:33,代码来源:ProSearchPalette.php


示例3: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var PageModel $objPage */
     global $objPage;
     // Set the trail and level
     if ($this->defineRoot && $this->rootPage > 0) {
         $trail = array($this->rootPage);
         $level = 0;
     } else {
         $trail = $objPage->trail;
         $level = $this->levelOffset > 0 ? $this->levelOffset : 0;
     }
     $lang = null;
     $host = null;
     // Overwrite the domain and language if the reference page belongs to a differnt root page (see #3765)
     if ($this->defineRoot && $this->rootPage > 0) {
         $objRootPage = \PageModel::findWithDetails($this->rootPage);
         // Set the language
         if (\Config::get('addLanguageToUrl') && $objRootPage->rootLanguage != $objPage->rootLanguage) {
             $lang = $objRootPage->rootLanguage;
         }
         // Set the domain
         if ($objRootPage->rootId != $objPage->rootId && $objRootPage->domain != '' && $objRootPage->domain != $objPage->domain) {
             $host = $objRootPage->domain;
         }
     }
     $this->Template->request = ampersand(\Environment::get('indexFreeRequest'));
     $this->Template->skipId = 'skipNavigation' . $this->id;
     $this->Template->skipNavigation = specialchars($GLOBALS['TL_LANG']['MSC']['skipNavigation']);
     $this->Template->items = $this->renderNavigation($trail[$level], 1, $host, $lang);
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:34,代码来源:ModuleNavigation.php


示例4: run

 /**
  * Run the controller and parse the login template
  *
  * @return Response
  */
 public function run()
 {
     /** @var BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_login');
     $strHeadline = sprintf($GLOBALS['TL_LANG']['MSC']['loginTo'], \Config::get('websiteTitle'));
     $objTemplate->theme = \Backend::getTheme();
     $objTemplate->messages = \Message::generate();
     $objTemplate->base = \Environment::get('base');
     $objTemplate->language = $GLOBALS['TL_LANGUAGE'];
     $objTemplate->languages = \System::getLanguages(true);
     $objTemplate->title = \StringUtil::specialchars($strHeadline);
     $objTemplate->charset = \Config::get('characterSet');
     $objTemplate->action = ampersand(\Environment::get('request'));
     $objTemplate->userLanguage = $GLOBALS['TL_LANG']['tl_user']['language'][0];
     $objTemplate->headline = $strHeadline;
     $objTemplate->curLanguage = \Input::post('language') ?: str_replace('-', '_', $GLOBALS['TL_LANGUAGE']);
     $objTemplate->curUsername = \Input::post('username') ?: '';
     $objTemplate->uClass = $_POST && empty($_POST['username']) ? ' class="login_error"' : '';
     $objTemplate->pClass = $_POST && empty($_POST['password']) ? ' class="login_error"' : '';
     $objTemplate->loginButton = \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['loginBT']);
     $objTemplate->username = $GLOBALS['TL_LANG']['tl_user']['username'][0];
     $objTemplate->password = $GLOBALS['TL_LANG']['MSC']['password'][0];
     $objTemplate->feLink = $GLOBALS['TL_LANG']['MSC']['feLink'];
     $objTemplate->default = $GLOBALS['TL_LANG']['MSC']['default'];
     $objTemplate->jsDisabled = $GLOBALS['TL_LANG']['MSC']['jsDisabled'];
     return $objTemplate->getResponse();
 }
开发者ID:contao,项目名称:core-bundle,代码行数:32,代码来源:BackendIndex.php


示例5: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var PageModel $objPage */
     global $objPage;
     $lang = null;
     $host = null;
     // Start from the website root if there is no reference page
     if (!$this->rootPage) {
         $this->rootPage = $objPage->rootId;
     } else {
         $objRootPage = \PageModel::findWithDetails($this->rootPage);
         // Set the language
         if (\Config::get('addLanguageToUrl') && $objRootPage->rootLanguage != $objPage->rootLanguage) {
             $lang = $objRootPage->rootLanguage;
         }
         // Set the domain
         if ($objRootPage->rootId != $objPage->rootId && $objRootPage->domain != '' && $objRootPage->domain != $objPage->domain) {
             $host = $objRootPage->domain;
         }
     }
     $this->Template->formId = 'tl_quicknav_' . $this->id;
     $this->Template->targetPage = $GLOBALS['TL_LANG']['MSC']['targetPage'];
     $this->Template->button = \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['go']);
     $this->Template->title = $this->customLabel ?: $GLOBALS['TL_LANG']['MSC']['quicknav'];
     $this->Template->request = ampersand(\Environment::get('request'), true);
     $this->Template->items = $this->getQuicknavPages($this->rootPage, 1, $host, $lang);
 }
开发者ID:qzminski,项目名称:contao-core-bundle,代码行数:30,代码来源:ModuleQuicknav.php


示例6: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var PageModel $objPage */
     global $objPage;
     $arrJumpTo = array();
     $arrNewsletter = array();
     $strRequest = ampersand(\Environment::get('request'), true);
     $objNewsletter = \NewsletterModel::findSentByPids($this->nl_channels);
     if ($objNewsletter !== null) {
         while ($objNewsletter->next()) {
             /** @var NewsletterChannelModel $objTarget */
             if (!($objTarget = $objNewsletter->getRelated('pid')) instanceof NewsletterChannelModel) {
                 continue;
             }
             $jumpTo = intval($objTarget->jumpTo);
             // A jumpTo page is not mandatory for newsletter channels (see #6521) but required for the list module
             if ($jumpTo < 1) {
                 throw new \Exception("Newsletter channels without redirect page cannot be used in a newsletter list");
             }
             $strUrl = $strRequest;
             if (!isset($arrJumpTo[$objTarget->jumpTo])) {
                 if (($objJumpTo = $objTarget->getRelated('jumpTo')) instanceof PageModel) {
                     /** @var PageModel $objJumpTo */
                     $arrJumpTo[$objTarget->jumpTo] = $objJumpTo->getFrontendUrl(\Config::get('useAutoItem') ? '/%s' : '/items/%s');
                 } else {
                     $arrJumpTo[$objTarget->jumpTo] = $strUrl;
                 }
             }
             $strUrl = $arrJumpTo[$objTarget->jumpTo];
             $strAlias = $objNewsletter->alias ?: $objNewsletter->id;
             $arrNewsletter[] = array('subject' => $objNewsletter->subject, 'title' => \StringUtil::stripInsertTags($objNewsletter->subject), 'href' => sprintf($strUrl, $strAlias), 'date' => \Date::parse($objPage->dateFormat, $objNewsletter->date), 'datim' => \Date::parse($objPage->datimFormat, $objNewsletter->date), 'time' => \Date::parse($objPage->timeFormat, $objNewsletter->date), 'channel' => $objNewsletter->pid);
         }
     }
     $this->Template->newsletters = $arrNewsletter;
 }
开发者ID:contao,项目名称:newsletter-bundle,代码行数:38,代码来源:ModuleNewsletterList.php


示例7: generate

 /**
  * Display a wildcard in the back end
  *
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         /** @var BackendTemplate|object $objTemplate */
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['eventreader'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set the item from the auto_item parameter
     if (!isset($_GET['events']) && \Config::get('useAutoItem') && isset($_GET['auto_item'])) {
         \Input::setGet('events', \Input::get('auto_item'));
     }
     // Do not index or cache the page if no event has been specified
     if (!\Input::get('events')) {
         /** @var PageModel $objPage */
         global $objPage;
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     $this->cal_calendar = $this->sortOutProtected(\StringUtil::deserialize($this->cal_calendar));
     // Do not index or cache the page if there are no calendars
     if (!is_array($this->cal_calendar) || empty($this->cal_calendar)) {
         /** @var PageModel $objPage */
         global $objPage;
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     return parent::generate();
 }
开发者ID:contao,项目名称:calendar-bundle,代码行数:40,代码来源:ModuleEventReader.php


示例8: run

 /**
  * Run the controller and parse the template
  *
  * @return Response
  */
 public function run()
 {
     /** @var \BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_preview');
     $objTemplate->base = \Environment::get('base');
     $objTemplate->language = $GLOBALS['TL_LANGUAGE'];
     $objTemplate->title = specialchars($GLOBALS['TL_LANG']['MSC']['fePreview']);
     $objTemplate->charset = \Config::get('characterSet');
     $objTemplate->site = \Input::get('site', true);
     $objTemplate->switchHref = \System::getContainer()->get('router')->generate('contao_backend_switch');
     if (\Input::get('url')) {
         $objTemplate->url = \Environment::get('base') . \Input::get('url');
     } elseif (\Input::get('page')) {
         $objTemplate->url = $this->redirectToFrontendPage(\Input::get('page'), \Input::get('article'), true);
     } else {
         $objTemplate->url = \System::getContainer()->get('router')->generate('contao_root', [], UrlGeneratorInterface::ABSOLUTE_URL);
     }
     // Switch to a particular member (see #6546)
     if (\Input::get('user') && $this->User->isAdmin) {
         $objUser = \MemberModel::findByUsername(\Input::get('user'));
         if ($objUser !== null) {
             $strHash = $this->getSessionHash('FE_USER_AUTH');
             // Remove old sessions
             $this->Database->prepare("DELETE FROM tl_session WHERE tstamp<? OR hash=?")->execute(time() - \Config::get('sessionTimeout'), $strHash);
             // Insert the new session
             $this->Database->prepare("INSERT INTO tl_session (pid, tstamp, name, sessionID, ip, hash) VALUES (?, ?, ?, ?, ?, ?)")->execute($objUser->id, time(), 'FE_USER_AUTH', \System::getContainer()->get('session')->getId(), \Environment::get('ip'), $strHash);
             // Set the cookie
             $this->setCookie('FE_USER_AUTH', $strHash, time() + \Config::get('sessionTimeout'), null, null, false, true);
             $objTemplate->user = \Input::post('user');
         }
     }
     return $objTemplate->getResponse();
 }
开发者ID:jamesdevine,项目名称:core-bundle,代码行数:38,代码来源:BackendPreview.php


示例9: generate

 /**
  * Redirect to an internal page
  *
  * @param \PageModel $objPage
  */
 public function generate($objPage)
 {
     // Forward to the jumpTo or first published page
     if ($objPage->jumpTo) {
         /** @var \PageModel $objNextPage */
         $objNextPage = $objPage->getRelated('jumpTo');
     } else {
         $objNextPage = \PageModel::findFirstPublishedRegularByPid($objPage->id);
     }
     // Forward page does not exist
     if ($objNextPage === null) {
         $this->log('Forward page ID "' . $objPage->jumpTo . '" does not exist', __METHOD__, TL_ERROR);
         throw new ForwardPageNotFoundException('Forward page not found');
     }
     $strForceLang = null;
     // Check the target page language (see #4706)
     if (\Config::get('addLanguageToUrl')) {
         $objNextPage->loadDetails();
         // see #3983
         $strForceLang = $objNextPage->language;
     }
     $strGet = '';
     $strQuery = \Environment::get('queryString');
     $arrQuery = array();
     // Extract the query string keys (see #5867)
     if ($strQuery != '') {
         $arrChunks = explode('&', $strQuery);
         foreach ($arrChunks as $strChunk) {
             list($k, ) = explode('=', $strChunk, 2);
             $arrQuery[] = $k;
         }
     }
     // Add $_GET parameters
     if (!empty($_GET)) {
         foreach (array_keys($_GET) as $key) {
             if (\Config::get('addLanguageToUrl') && $key == 'language') {
                 continue;
             }
             // Ignore the query string parameters (see #5867)
             if (in_array($key, $arrQuery)) {
                 continue;
             }
             // Ignore the auto_item parameter (see #5886)
             if ($key == 'auto_item') {
                 $strGet .= '/' . \Input::get($key);
             } else {
                 $strGet .= '/' . $key . '/' . \Input::get($key);
             }
         }
     }
     // Append the query string (see #5867)
     if ($strQuery != '') {
         $strQuery = '?' . $strQuery;
     }
     $this->redirect($this->generateFrontendUrl($objNextPage->row(), $strGet, $strForceLang) . $strQuery, $objPage->redirect == 'temporary' ? 302 : 301);
 }
开发者ID:jamesdevine,项目名称:core-bundle,代码行数:61,代码来源:PageForward.php


示例10: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     try {
         $this->apiKey = Config::get('clr_api_key');
         $this->soap = new SoapClient(Config::get('clr_wsdl_url'));
     } catch (Exception $e) {
         $this->log('Kein API-Key oder WSDL-File für cleverreach.de in den Einstellungen hinterlegt', 'CleverReach::construct', TL_ERROR);
     }
     parent::__construct();
 }
开发者ID:dreebit,项目名称:cleverreach,代码行数:13,代码来源:CleverReach.php


示例11: run

 /**
  * Run the controller and parse the template
  *
  * @return Response
  */
 public function run()
 {
     /** @var BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_alerts');
     $objTemplate->theme = \Backend::getTheme();
     $objTemplate->base = \Environment::get('base');
     $objTemplate->language = $GLOBALS['TL_LANGUAGE'];
     $objTemplate->title = \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['systemMessages']);
     $objTemplate->charset = \Config::get('characterSet');
     $objTemplate->messages = \Message::generateUnwrapped() . \Backend::getSystemMessages();
     return $objTemplate->getResponse();
 }
开发者ID:contao,项目名称:core-bundle,代码行数:17,代码来源:BackendAlerts.php


示例12: rebuild

 /**
  * Rebuild the cache and return true on success, false otherwise
  *
  * @param ProviderInterface $dataProvider
  * @param ContentModel      $contentElement
  *
  * @return bool
  */
 public function rebuild(ProviderInterface $dataProvider, ContentModel $contentElement)
 {
     $factory = new Factory($dataProvider);
     if (($video = $factory->createVideo($contentElement->vimeo_videoId)) === null) {
         return false;
     }
     if (Config::get('vimeo_allImages') && $dataProvider->getVideoImages($contentElement->vimeo_videoId) === null) {
         return false;
     }
     if ($dataProvider->getVideoImage($contentElement->vimeo_videoId, Config::get('vimeo_imageIndex')) === null) {
         return false;
     }
     return true;
 }
开发者ID:derhaeuptling,项目名称:contao-vimeo-api,代码行数:22,代码来源:VideoHandler.php


示例13: generate

 /**
  * @return string
  */
 public function generate()
 {
     // translation
     $bStr = $GLOBALS['TL_LANG']['MSC']['ajaxSearchIndex']['button'];
     // load active modules
     $activeModules = deserialize(Config::get('searchIndexModules'));
     // encode to json
     $json = json_encode($activeModules);
     // set to global js varaible
     $GLOBALS['TL_MOOTOOLS'][] = '<script>var proSearchActiveModules = ' . $json . ';</script>';
     // load js
     $GLOBALS['TL_JAVASCRIPT'][] = $GLOBALS['PS_PUBLIC_PATH'] . 'JsIndex.js|static';
     return '<div class="index_list"><ul class="ul"></ul></div><div class="ajaxSearchIndex"><a class="tl_submit" style="margin-bottom: 5px; margin-top: 5px" onclick="Backend.getScrollOffset();return AjaxRequest.ajaxSearchIndex()">' . $bStr . '</a></div>';
 }
开发者ID:alnv,项目名称:prosearch,代码行数:17,代码来源:AjaxSearchIndex.php


示例14: getForwardUrl

 /**
  * Return the URL to the jumpTo or first published page
  *
  * @param PageModel $objPage
  *
  * @return string
  *
  * @throws ForwardPageNotFoundException
  */
 private function getForwardUrl($objPage)
 {
     if ($objPage->jumpTo) {
         /** @var PageModel $objNextPage */
         $objNextPage = $objPage->getRelated('jumpTo');
     } else {
         $objNextPage = \PageModel::findFirstPublishedRegularByPid($objPage->id);
     }
     // Forward page does not exist
     if (!$objNextPage instanceof PageModel) {
         $this->log('Forward page ID "' . $objPage->jumpTo . '" does not exist', __METHOD__, TL_ERROR);
         throw new ForwardPageNotFoundException('Forward page not found');
     }
     $strGet = '';
     $strQuery = \Environment::get('queryString');
     $arrQuery = array();
     // Extract the query string keys (see #5867)
     if ($strQuery != '') {
         $arrChunks = explode('&', $strQuery);
         foreach ($arrChunks as $strChunk) {
             list($k) = explode('=', $strChunk, 2);
             $arrQuery[] = $k;
         }
     }
     // Add $_GET parameters
     if (!empty($_GET)) {
         foreach (array_keys($_GET) as $key) {
             if (\Config::get('addLanguageToUrl') && $key == 'language') {
                 continue;
             }
             // Ignore the query string parameters (see #5867)
             if (in_array($key, $arrQuery)) {
                 continue;
             }
             // Ignore the auto_item parameter (see #5886)
             if ($key == 'auto_item') {
                 $strGet .= '/' . \Input::get($key);
             } else {
                 $strGet .= '/' . $key . '/' . \Input::get($key);
             }
         }
     }
     // Append the query string (see #5867)
     if ($strQuery != '') {
         $strQuery = '?' . $strQuery;
     }
     return $objNextPage->getAbsoluteUrl($strGet) . $strQuery;
 }
开发者ID:contao,项目名称:core-bundle,代码行数:57,代码来源:PageForward.php


示例15: run

 /**
  * Run the controller
  *
  * @return Response
  */
 public function run()
 {
     $objResponse = new Response();
     // Do not run if there is POST data or the last execution was less than a minute ago
     if (!empty($_POST) || $this->hasToWait()) {
         return $objResponse;
     }
     $arrLock = array();
     $arrIntervals = array('monthly', 'weekly', 'daily', 'hourly', 'minutely');
     // Store the current timestamps
     $arrCurrent = array('monthly' => date('Ym'), 'weekly' => date('YW'), 'daily' => date('Ymd'), 'hourly' => date('YmdH'), 'minutely' => date('YmdHi'));
     // Get the timestamps from tl_cron
     $objLock = $this->Database->query("SELECT * FROM tl_cron WHERE name !='lastrun'");
     while ($objLock->next()) {
         $arrLock[$objLock->name] = $objLock->value;
     }
     // Create the database entries
     foreach ($arrIntervals as $strInterval) {
         if (!isset($arrLock[$strInterval])) {
             $arrLock[$strInterval] = 0;
             $this->Database->query("INSERT INTO tl_cron (name, value) VALUES ('{$strInterval}', 0)");
         }
     }
     // Run the jobs
     foreach ($arrIntervals as $strInterval) {
         $intCurrent = $arrCurrent[$strInterval];
         // Skip empty intervals and jobs that have been executed already
         if (empty($GLOBALS['TL_CRON'][$strInterval]) || $arrLock[$strInterval] == $intCurrent) {
             continue;
         }
         // Update the database before the jobs are executed, in case one of them fails
         $this->Database->query("UPDATE tl_cron SET value={$intCurrent} WHERE name='{$strInterval}'");
         // Add a log entry if in debug mode (see #4729)
         if (\Config::get('debugMode')) {
             $this->log('Running the ' . $strInterval . ' cron jobs', __METHOD__, TL_CRON);
         }
         foreach ($GLOBALS['TL_CRON'][$strInterval] as $callback) {
             $this->import($callback[0]);
             $this->{$callback[0]}->{$callback[1]}();
         }
         // Add a log entry if in debug mode (see #4729)
         if (\Config::get('debugMode')) {
             $this->log(ucfirst($strInterval) . ' cron jobs complete', __METHOD__, TL_CRON);
         }
     }
     return $objResponse;
 }
开发者ID:contao,项目名称:core-bundle,代码行数:52,代码来源:FrontendCron.php


示例16: validate

 /**
  * Validate a token
  *
  * @param string $strToken The request token
  *
  * @return boolean True if the token matches the stored one
  */
 public static function validate($strToken)
 {
     // The feature has been disabled
     if (\Config::get('disableRefererCheck') || defined('BYPASS_TOKEN_CHECK')) {
         return true;
     }
     // Check against the whitelist (thanks to Tristan Lins) (see #3164)
     if (\Config::get('requestTokenWhitelist')) {
         $strHostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
         foreach (\Config::get('requestTokenWhitelist') as $strDomain) {
             if ($strDomain == $strHostname || preg_match('/\\.' . preg_quote($strDomain, '/') . '$/', $strHostname)) {
                 return true;
             }
         }
     }
     $container = \System::getContainer();
     return $container->get('security.csrf.token_manager')->isTokenValid(new CsrfToken($container->getParameter('contao.csrf_token_name'), $strToken));
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:25,代码来源:RequestToken.php


示例17: checkForUpdates

 /**
  * Check for new \Contao versions
  */
 public function checkForUpdates()
 {
     if (!is_numeric(BUILD)) {
         return;
     }
     // HOOK: proxy module
     if (Config::get('useProxy')) {
         $objRequest = new \ProxyRequest();
     } else {
         $objRequest = new \Request();
     }
     $objRequest->send(\Config::get('liveUpdateBase') . (LONG_TERM_SUPPORT ? 'lts-version.txt' : 'version.txt'));
     if (!$objRequest->hasError()) {
         \System::getContainer()->get('contao.cache')->save('latest-version', $objRequest->response);
     }
     // Add a log entry
     $this->log('Checked for Contao updates', __METHOD__, TL_CRON);
 }
开发者ID:bytehead,项目名称:core-bundle,代码行数:21,代码来源:Automator.php


示例18: rebuild

 /**
  * Rebuild the cache and return true on success, false otherwise
  *
  * @param ProviderInterface $dataProvider
  * @param ContentModel      $contentElement
  *
  * @return bool
  */
 public function rebuild(ProviderInterface $dataProvider, ContentModel $contentElement)
 {
     $factory = new Factory($dataProvider);
     $album = $factory->createAlbum($contentElement->vimeo_albumId, true, $contentElement->vimeo_sorting, $contentElement->vimeo_sortingDirection);
     if ($album === null) {
         return false;
     }
     /** @var Video $video */
     foreach ($album->getVideos() as $video) {
         if (Config::get('vimeo_allImages') && $dataProvider->getVideoImages($video->getId()) === null) {
             return false;
         }
         if ($dataProvider->getVideoImage($video->getId(), Config::get('vimeo_imageIndex')) === null) {
             return false;
         }
     }
     return true;
 }
开发者ID:derhaeuptling,项目名称:contao-vimeo-api,代码行数:26,代码来源:AlbumHandler.php


示例19: __construct

 /**
  * Initialize the object
  */
 public function __construct()
 {
     //Safely store the $_GET and $_POST vals in AjaxInput
     AjaxInput::initialize();
     // Load the user object before calling the parent constructor
     $this->import('FrontendUser', 'User');
     parent::__construct();
     // Check whether a user is logged in
     define('BE_USER_LOGGED_IN', $this->getLoginStatus('BE_USER_AUTH'));
     define('FE_USER_LOGGED_IN', $this->getLoginStatus('FE_USER_AUTH'));
     // No back end user logged in
     if (!$_SESSION['DISABLE_CACHE']) {
         // Maintenance mode (see #4561 and #6353)
         if (Config::get('maintenanceMode')) {
             header('HTTP/1.1 503 Service Unavailable');
             die('This site is currently down for maintenance. Please come back later.');
         }
     }
 }
开发者ID:rhymedigital,项目名称:contao_rhyme_ajax,代码行数:22,代码来源:index.php


示例20: prepare

 /**
  * Prepare the output
  *
  * @return \PageModel
  *
  * @internal
  */
 protected function prepare()
 {
     // Check the search index (see #3761)
     \Search::removeEntry(\Environment::get('relativeRequest'));
     // Find the matching root page
     $objRootPage = $this->getRootPageFromUrl();
     // Forward if the language should be but is not set (see #4028)
     if (\Config::get('addLanguageToUrl')) {
         // Get the request string without the script name
         $strRequest = \Environment::get('relativeRequest');
         // Only redirect if there is no language fragment (see #4669)
         if ($strRequest != '' && !preg_match('@^[a-z]{2}(\\-[A-Z]{2})?/@', $strRequest)) {
             // Handle language fragments without trailing slash (see #7666)
             if (preg_match('@^[a-z]{2}(\\-[A-Z]{2})?$@', $strRequest)) {
                 $this->redirect(\Environment::get('request') . '/', 301);
             } else {
                 if ($strRequest == \Environment::get('request')) {
                     $strRequest = $objRootPage->language . '/' . $strRequest;
                 } else {
                     $strRequest = \Environment::get('script') . '/' . $objRootPage->language . '/' . $strRequest;
                 }
                 $this->redirect($strRequest, 301);
             }
         }
     }
     // Look for a 404 page
     $obj404 = \PageModel::find404ByPid($objRootPage->id);
     // Die if there is no page at all
     if (null === $obj404) {
         throw new PageNotFoundException('Page not found');
     }
     // Forward to another page
     if ($obj404->autoforward && $obj404->jumpTo) {
         $objNextPage = \PageModel::findPublishedById($obj404->jumpTo);
         if (null === $objNextPage) {
             $this->log('Forward page ID "' . $obj404->jumpTo . '" does not exist', __METHOD__, TL_ERROR);
             throw new ForwardPageNotFoundException('Forward page not found');
         }
         $this->redirect($this->generateFrontendUrl($objNextPage->row(), null, $objRootPage->language), $obj404->redirect == 'temporary' ? 302 : 301);
     }
     return $obj404;
 }
开发者ID:jamesdevine,项目名称:core-bundle,代码行数:49,代码来源:PageError404.php



注:本文中的Contao\Config类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Contao\Date类代码示例发布时间:2022-05-23
下一篇:
PHP Contao\BackendTemplate类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap