当前位置: 首页>>代码示例>>PHP>>正文


PHP Input::getUnusedGet方法代码示例

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


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

示例1: run


//.........这里部分代码省略.........
     if ($objPage instanceof Model\Collection) {
         $objPage = $objPage->current();
     }
     // If the page has an alias, it can no longer be called via ID (see #7661)
     if ($objPage->alias != '' && preg_match('#^' . $objPage->id . '[$/.]#', \Environment::get('relativeRequest'))) {
         $this->User->authenticate();
         throw new PageNotFoundException('Page not found');
     }
     // Load a website root page object (will redirect to the first active regular page)
     if ($objPage->type == 'root') {
         /** @var PageRoot $objHandler */
         $objHandler = new $GLOBALS['TL_PTY']['root']();
         $objHandler->generate($objPage->id);
     }
     // Inherit the settings from the parent pages if it has not been done yet
     if (!is_bool($objPage->protected)) {
         $objPage->loadDetails();
     }
     // Set the admin e-mail address
     if ($objPage->adminEmail != '') {
         list($GLOBALS['TL_ADMIN_NAME'], $GLOBALS['TL_ADMIN_EMAIL']) = \StringUtil::splitFriendlyEmail($objPage->adminEmail);
     } else {
         list($GLOBALS['TL_ADMIN_NAME'], $GLOBALS['TL_ADMIN_EMAIL']) = \StringUtil::splitFriendlyEmail(\Config::get('adminEmail'));
     }
     // Exit if the root page has not been published (see #2425)
     // Do not try to load the 404 page, it can cause an infinite loop!
     if (!BE_USER_LOGGED_IN && !$objPage->rootIsPublic) {
         throw new PageNotFoundException('Page not found');
     }
     // Check wether the language matches the root page language
     if (\Config::get('addLanguageToUrl') && \Input::get('language') != $objPage->rootLanguage) {
         $this->User->authenticate();
         $this->log('No active page for page ID "' . $pageId . '" and language "' . \Input::get('language') . '" (' . \Environment::get('base') . \Environment::get('request') . ')', __METHOD__, TL_ERROR);
         throw new PageNotFoundException('Page not found');
     }
     // Check whether there are domain name restrictions
     if ($objPage->domain != '') {
         // Load an error 404 page object
         if ($objPage->domain != \Environment::get('host')) {
             $this->User->authenticate();
             $this->log('Page ID "' . $pageId . '" was requested via "' . \Environment::get('host') . '" but can only be accessed via "' . $objPage->domain . '" (' . \Environment::get('base') . \Environment::get('request') . ')', __METHOD__, TL_ERROR);
             throw new PageNotFoundException('Page not found');
         }
     }
     // Authenticate the user
     if (!$this->User->authenticate() && $objPage->protected && !BE_USER_LOGGED_IN) {
         $this->log('Access to page ID "' . $pageId . '" denied (' . \Environment::get('base') . \Environment::get('request') . ')', __METHOD__, TL_ERROR);
         throw new AccessDeniedException('Access denied');
     }
     // Check the user groups if the page is protected
     if ($objPage->protected && !BE_USER_LOGGED_IN) {
         $arrGroups = $objPage->groups;
         // required for empty()
         if (!is_array($arrGroups) || empty($arrGroups) || !count(array_intersect($arrGroups, $this->User->groups))) {
             $this->log('Page ID "' . $pageId . '" can only be accessed by groups "' . implode(', ', (array) $objPage->groups) . '" (current user groups: ' . implode(', ', $this->User->groups) . ')', __METHOD__, TL_ERROR);
             throw new AccessDeniedException('Access denied');
         }
     }
     // Backup some globals (see #7659)
     $arrHead = $GLOBALS['TL_HEAD'];
     $arrBody = $GLOBALS['TL_BODY'];
     $arrMootools = $GLOBALS['TL_MOOTOOLS'];
     $arrJquery = $GLOBALS['TL_JQUERY'];
     try {
         // Generate the page
         switch ($objPage->type) {
             case 'error_404':
                 /** @var PageError404 $objHandler */
                 $objHandler = new $GLOBALS['TL_PTY']['error_404']();
                 return $objHandler->getResponse();
                 break;
             case 'error_403':
                 /** @var PageError403 $objHandler */
                 $objHandler = new $GLOBALS['TL_PTY']['error_403']();
                 return $objHandler->getResponse($objRootPage);
                 break;
             default:
                 /** @var PageRegular $objHandler */
                 $objHandler = new $GLOBALS['TL_PTY'][$objPage->type]();
                 // Backwards compatibility
                 if (!method_exists($objHandler, 'getResponse')) {
                     ob_start();
                     $objHandler->generate($objPage, true);
                     return new Response(ob_get_clean(), http_response_code());
                 }
                 return $objHandler->getResponse($objPage, true);
                 break;
         }
     } catch (\UnusedArgumentsException $e) {
         // Restore the globals (see #7659)
         $GLOBALS['TL_HEAD'] = $arrHead;
         $GLOBALS['TL_BODY'] = $arrBody;
         $GLOBALS['TL_MOOTOOLS'] = $arrMootools;
         $GLOBALS['TL_JQUERY'] = $arrJquery;
         /** @var PageError404 $objHandler */
         $objHandler = new $GLOBALS['TL_PTY']['error_404']();
         $this->log('The request for page ID "' . $pageId . '" contained unused GET parameters: "' . implode('", "', \Input::getUnusedGet()) . '" (' . \Environment::get('base') . \Environment::get('request') . ')', __METHOD__, TL_ERROR);
         return $objHandler->getResponse();
     }
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:101,代码来源:FrontendIndex.php


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