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


PHP PageRepository::getFirstWebPage方法代码示例

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


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

示例1: fetch_the_id

 /**
  * Get The Page ID
  * This gets the id of the page, checks if the page is in the domain and if the page is accessible
  * Sets variables such as $this->sys_page, $this->loginUser, $this->gr_list, $this->id, $this->type, $this->domainStartPage, $this->idParts
  *
  * @return void
  * @access private
  * @todo Define visibility
  */
 public function fetch_the_id()
 {
     $GLOBALS['TT']->push('fetch_the_id initialize/', '');
     // Initialize the page-select functions.
     $this->sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
     $this->sys_page->versioningPreview = $this->fePreview === 2 || intval($this->workspacePreview) || \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('ADMCMD_view') ? TRUE : FALSE;
     $this->sys_page->versioningWorkspaceId = $this->whichWorkspace();
     $this->sys_page->init($this->showHiddenPage);
     // Set the valid usergroups for FE
     $this->initUserGroups();
     // Sets sys_page where-clause
     $this->setSysPageWhereClause();
     // Splitting $this->id by a period (.).
     // First part is 'id' and second part (if exists) will overrule the &type param
     $idParts = explode('.', $this->id, 2);
     $this->id = $idParts[0];
     if (isset($idParts[1])) {
         $this->type = $idParts[1];
     }
     // Splitting $this->id by a comma (,).
     // First part is 'id' and other parts are just stored for use in scripts.
     // Still used in the old wapversion.lib files.
     $this->idParts = explode(',', $this->id);
     $this->id = $this->idParts[0];
     // Hook for further id manipulation
     if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['modifyPageId'])) {
         $_params = array('id' => $this->id);
         $newId = FALSE;
         foreach ($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['modifyPageId'] as $_funcRef) {
             $deprecationMessage = 'Hook $TYPO3_CONF_VARS[SC_OPTIONS][tslib/class.tslib_fe.php][modifyPageId] is ' . 'deprecated since 6.0 and will be removed two versions later';
             if (!is_object($_funcRef) || !is_a($_funcRef, 'Closure')) {
                 $deprecationMessage .= '- used by ' . $_funcRef;
             }
             \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog($deprecationMessage);
             $newIdFromFunc = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($_funcRef, $_params, $this);
             if ($newIdFromFunc !== FALSE) {
                 $newId = $newIdFromFunc;
             }
         }
         if ($newId !== FALSE) {
             $this->id = $newId;
         }
     }
     // If $this->id is a string, it's an alias
     $this->checkAndSetAlias();
     // The id and type is set to the integer-value - just to be sure...
     $this->id = intval($this->id);
     $this->type = intval($this->type);
     $GLOBALS['TT']->pull();
     // We find the first page belonging to the current domain
     $GLOBALS['TT']->push('fetch_the_id domain/', '');
     // The page_id of the current domain
     $this->domainStartPage = $this->findDomainRecord($this->TYPO3_CONF_VARS['SYS']['recursiveDomainSearch']);
     if (!$this->id) {
         if ($this->domainStartPage) {
             // If the id was not previously set, set it to the id of the domain.
             $this->id = $this->domainStartPage;
         } else {
             // Find the first 'visible' page in that domain
             $theFirstPage = $this->sys_page->getFirstWebPage($this->id);
             if ($theFirstPage) {
                 $this->id = $theFirstPage['uid'];
             } else {
                 $message = 'No pages are found on the rootlevel!';
                 if ($this->checkPageUnavailableHandler()) {
                     $this->pageUnavailableAndExit($message);
                 } else {
                     \TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($message, 'cms', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
                     throw new \TYPO3\CMS\Core\Error\Http\ServiceUnavailableException($message, 1301648975);
                 }
             }
         }
     }
     $GLOBALS['TT']->pull();
     $GLOBALS['TT']->push('fetch_the_id rootLine/', '');
     // We store the originally requested id
     $requestedId = $this->id;
     $this->getPageAndRootlineWithDomain($this->domainStartPage);
     $GLOBALS['TT']->pull();
     if ($this->pageNotFound && $this->TYPO3_CONF_VARS['FE']['pageNotFound_handling']) {
         $pNotFoundMsg = array(1 => 'ID was not an accessible page', 2 => 'Subsection was found and not accessible', 3 => 'ID was outside the domain', 4 => 'The requested page alias does not exist');
         $this->pageNotFoundAndExit($pNotFoundMsg[$this->pageNotFound]);
     }
     if ($this->page['url_scheme'] > 0) {
         $newUrl = '';
         $requestUrlScheme = parse_url(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), PHP_URL_SCHEME);
         if ((int) $this->page['url_scheme'] === \t3lib_utility_http::SCHEME_HTTP && $requestUrlScheme == 'https') {
             $newUrl = 'http://' . substr(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), 8);
         } elseif ((int) $this->page['url_scheme'] === \t3lib_utility_http::SCHEME_HTTPS && $requestUrlScheme == 'http') {
             $newUrl = 'https://' . substr(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), 7);
         }
//.........这里部分代码省略.........
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:101,代码来源:TypoScriptFrontendController.php

示例2: fetch_the_id

 /**
  * Get The Page ID
  * This gets the id of the page, checks if the page is in the domain and if the page is accessible
  * Sets variables such as $this->sys_page, $this->loginUser, $this->gr_list, $this->id, $this->type, $this->domainStartPage
  *
  * @throws ServiceUnavailableException
  * @return void
  * @access private
  */
 public function fetch_the_id()
 {
     $timeTracker = $this->getTimeTracker();
     $timeTracker->push('fetch_the_id initialize/', '');
     // Initialize the page-select functions.
     $this->sys_page = GeneralUtility::makeInstance(PageRepository::class);
     $this->sys_page->versioningPreview = $this->fePreview === 2 || (int) $this->workspacePreview || (bool) GeneralUtility::_GP('ADMCMD_view');
     $this->sys_page->versioningWorkspaceId = $this->whichWorkspace();
     $this->sys_page->init($this->showHiddenPage);
     // Set the valid usergroups for FE
     $this->initUserGroups();
     // Sets sys_page where-clause
     $this->setSysPageWhereClause();
     // Splitting $this->id by a period (.).
     // First part is 'id' and second part (if exists) will overrule the &type param
     $idParts = explode('.', $this->id, 2);
     $this->id = $idParts[0];
     if (isset($idParts[1])) {
         $this->type = $idParts[1];
     }
     // If $this->id is a string, it's an alias
     $this->checkAndSetAlias();
     // The id and type is set to the integer-value - just to be sure...
     $this->id = (int) $this->id;
     $this->type = (int) $this->type;
     $timeTracker->pull();
     // We find the first page belonging to the current domain
     $timeTracker->push('fetch_the_id domain/', '');
     // The page_id of the current domain
     $this->domainStartPage = $this->findDomainRecord($this->TYPO3_CONF_VARS['SYS']['recursiveDomainSearch']);
     if (!$this->id) {
         if ($this->domainStartPage) {
             // If the id was not previously set, set it to the id of the domain.
             $this->id = $this->domainStartPage;
         } else {
             // Find the first 'visible' page in that domain
             $theFirstPage = $this->sys_page->getFirstWebPage($this->id);
             if ($theFirstPage) {
                 $this->id = $theFirstPage['uid'];
             } else {
                 $message = 'No pages are found on the rootlevel!';
                 if ($this->checkPageUnavailableHandler()) {
                     $this->pageUnavailableAndExit($message);
                 } else {
                     GeneralUtility::sysLog($message, 'cms', GeneralUtility::SYSLOG_SEVERITY_ERROR);
                     throw new ServiceUnavailableException($message, 1301648975);
                 }
             }
         }
     }
     $timeTracker->pull();
     $timeTracker->push('fetch_the_id rootLine/', '');
     // We store the originally requested id
     $this->requestedId = $this->id;
     $this->getPageAndRootlineWithDomain($this->domainStartPage);
     $timeTracker->pull();
     if ($this->pageNotFound && $this->TYPO3_CONF_VARS['FE']['pageNotFound_handling']) {
         $pNotFoundMsg = array(1 => 'ID was not an accessible page', 2 => 'Subsection was found and not accessible', 3 => 'ID was outside the domain', 4 => 'The requested page alias does not exist');
         $this->pageNotFoundAndExit($pNotFoundMsg[$this->pageNotFound]);
     }
     if ($this->page['url_scheme'] > 0) {
         $newUrl = '';
         $requestUrlScheme = parse_url(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), PHP_URL_SCHEME);
         if ((int) $this->page['url_scheme'] === HttpUtility::SCHEME_HTTP && $requestUrlScheme == 'https') {
             $newUrl = 'http://' . substr(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), 8);
         } elseif ((int) $this->page['url_scheme'] === HttpUtility::SCHEME_HTTPS && $requestUrlScheme == 'http') {
             $newUrl = 'https://' . substr(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), 7);
         }
         if ($newUrl !== '') {
             if ($_SERVER['REQUEST_METHOD'] === 'POST') {
                 $headerCode = HttpUtility::HTTP_STATUS_303;
             } else {
                 $headerCode = HttpUtility::HTTP_STATUS_301;
             }
             HttpUtility::redirect($newUrl, $headerCode);
         }
     }
     // Set no_cache if set
     if ($this->page['no_cache']) {
         $this->set_no_cache('no_cache is set in page properties');
     }
     // Init SYS_LASTCHANGED
     $this->register['SYS_LASTCHANGED'] = (int) $this->page['tstamp'];
     if ($this->register['SYS_LASTCHANGED'] < (int) $this->page['SYS_LASTCHANGED']) {
         $this->register['SYS_LASTCHANGED'] = (int) $this->page['SYS_LASTCHANGED'];
     }
     if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['fetchPageId-PostProcessing'])) {
         foreach ($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['fetchPageId-PostProcessing'] as $functionReference) {
             $parameters = array('parentObject' => $this);
             GeneralUtility::callUserFunction($functionReference, $parameters, $this);
         }
//.........这里部分代码省略.........
开发者ID:Torsten85,项目名称:TYPO3.CMS,代码行数:101,代码来源:TypoScriptFrontendController.php


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