本文整理汇总了PHP中TYPO3\CMS\Frontend\Page\PageRepository类的典型用法代码示例。如果您正苦于以下问题:PHP PageRepository类的具体用法?PHP PageRepository怎么用?PHP PageRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PageRepository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Initializes the class.
*/
public function __construct()
{
$this->databaseConnection = $GLOBALS['TYPO3_DB'];
$this->tsfe = $GLOBALS['TSFE'];
// Warning! It is important to init the new object and not reuse any existing object
// $this->pageRepository->sys_language_uid must stay 0 because we will do overlays manually
$this->pageRepository = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
$this->pageRepository->init(FALSE);
}
示例2: evaluateCondition
/**
* This method decides if the condition is TRUE or FALSE. It can be overriden in extending viewhelpers to adjust functionality.
*
* @param array $arguments ViewHelper arguments to evaluate the condition for this ViewHelper, allows for flexiblity in overriding this method.
* @return bool
*/
protected static function evaluateCondition($arguments = NULL)
{
$pageUid = $arguments['pageUid'];
$respectSiteRoot = $arguments['respectSiteRoot'];
if (NULL === $pageUid || TRUE === empty($pageUid) || 0 === intval($pageUid)) {
$pageUid = $GLOBALS['TSFE']->id;
}
$pageSelect = new PageRepository();
$page = $pageSelect->getPage($pageUid);
if (TRUE === (bool) $respectSiteRoot && TRUE === isset($page['is_siteroot']) && TRUE === (bool) $page['is_siteroot']) {
return FALSE;
}
return TRUE === isset($page['pid']) && 0 < $page['pid'];
}
示例3: evaluateCondition
/**
* @param array $arguments
* @return bool
*/
protected static function evaluateCondition($arguments = null)
{
$pageUid = $arguments['pageUid'];
$respectSiteRoot = $arguments['respectSiteRoot'];
if (null === $pageUid || true === empty($pageUid) || 0 === intval($pageUid)) {
$pageUid = $GLOBALS['TSFE']->id;
}
$pageSelect = new PageRepository();
$page = $pageSelect->getPage($pageUid);
if ($respectSiteRoot && isset($page['is_siteroot']) && $page['is_siteroot']) {
return false;
}
return true === isset($page['pid']) && 0 < $page['pid'];
}
示例4: createSysPageIfNecessary
/**
* Creates $this->sysPage if it does not exist yet
*
* @return void
*/
protected function createSysPageIfNecessary()
{
if (!is_object($this->sysPage)) {
$this->sysPage = $this->apiWrapper->getPageRepository();
$this->sysPage->init($GLOBALS['TSFE']->showHiddenPage || $this->pObj->isBEUserLoggedIn());
}
}
示例5: createSysPageIfNecessary
/**
* Creates $this->sysPage if it does not exist yet
*
* @return void
*/
protected function createSysPageIfNecessary()
{
if (!is_object($this->sysPage)) {
$this->sysPage = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
$this->sysPage->init($GLOBALS['TSFE']->showHiddenPage || $this->pObj->isBEUserLoggedIn());
}
}
示例6: getRecordArray
/**
* Queries the database for the page record and returns it.
*
* @param integer $uid Page id
* @throws RuntimeException
* @return array
*/
protected function getRecordArray($uid)
{
if (!isset(self::$pageRecordCache[$this->getCacheIdentifier($uid)])) {
if (!is_array($GLOBALS['TCA']['pages']['columns'])) {
if (isset($GLOBALS['TSFE'])) {
$GLOBALS['TSFE']->includeTCA($GLOBALS['TSFE']->TCAloaded);
}
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA('pages');
}
$row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(implode(',', self::$rootlineFields), 'pages', 'uid = ' . intval($uid) . ' AND pages.deleted = 0 AND pages.doktype <> ' . \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_RECYCLER);
if (empty($row)) {
throw new \RuntimeException('Could not fetch page data for uid ' . $uid . '.', 1343589451);
}
$this->pageContext->versionOL('pages', $row, FALSE, TRUE);
$this->pageContext->fixVersioningPid('pages', $row);
if (is_array($row)) {
$row = $this->enrichWithRelationFields($uid, $row);
$this->pageContext->getPageOverlay($row, $this->languageUid);
self::$pageRecordCache[$this->getCacheIdentifier($uid)] = $row;
}
}
if (!is_array(self::$pageRecordCache[$this->getCacheIdentifier($uid)])) {
throw new \RuntimeException('Broken rootline. Could not resolve page with uid ' . $uid . '.', 1343464101);
}
return self::$pageRecordCache[$this->getCacheIdentifier($uid)];
}
示例7: render
/**
* Render method
*
* @param integer $pageUid
* @param boolean $respectSiteRoot
* @return string
*/
public function render($pageUid = NULL, $respectSiteRoot = FALSE)
{
if (NULL === $pageUid || TRUE === empty($pageUid) || 0 === intval($pageUid)) {
$pageUid = $GLOBALS['TSFE']->id;
}
$pageSelect = new PageRepository();
$page = $pageSelect->getPage($pageUid);
if (TRUE === (bool) $respectSiteRoot && TRUE === isset($page['is_siteroot']) && TRUE === (bool) $page['is_siteroot']) {
return $this->renderElseChild();
}
if (TRUE === isset($page['pid']) && 0 < $page['pid']) {
return $this->renderThenChild();
} else {
return $this->renderElseChild();
}
}
示例8: setCache
/**
* @param null $data
* @param null $hashVars
* @return null
*/
public function setCache($data = null, $hashVars = null)
{
$lifetime = mktime(23, 59, 59) + 1 - time();
$cacheID = $this->getCacheID(array($hashVars));
PageRepository::storeHash($cacheID, serialize($data), $this->_extKey . '_cache', $lifetime);
return $data;
}
示例9: resolveShortcutParentPage
/**
* Resolves shortcuts for the shortcut of type PageRepository::SHORTCUT_MODE_PARENT_PAGE.
*
* @param array $page
* @param array $processedPages
* @return array
*/
private function resolveShortcutParentPage(array $page, array &$processedPages)
{
$page = $this->pageRepository->getPage($page['pid'], FALSE);
if ($page && $page['doktype'] == PageRepository::DOKTYPE_SHORTCUT) {
$page = $this->resolveShortcutProcess($page, $processedPages);
}
return $page;
}
示例10: setCache
public function setCache($data, $funcName = null, $hashVars = null)
{
$tmp = $data;
if (!is_array($data)) {
$tmp = array('__string' => $data);
}
// Um Mitternacht endet der Cache
$lifetime = mktime(23, 59, 59) + 1 - time();
\TYPO3\CMS\Frontend\Page\PageRepository::storeHash($this->getCacheHash($hashVars, $funcName), serialize($tmp), $this->getCacheIdentifier($funcName), $lifetime);
return $data;
}
示例11: render
/**
* Retrieve page details from given page id
*
* @param integer $pageId
* @param string $as
* @return string Rendered string
*/
public function render($pageId, $as = 'page')
{
$this->templateVariableContainer->add($as, $this->pageRepository->getPage($pageId));
$output = $this->renderChildren();
$this->templateVariableContainer->remove($as);
return $output;
}
示例12: collectPages
/**
* return void
*/
protected function collectPages()
{
$rootline = $this->pageRepository->getRootLine($GLOBALS['TSFE']->id);
foreach ($rootline as $page) {
$this->collectPage($this->pageRepository->getPage($page['uid']));
}
$this->generateUrlCollection();
}
示例13: migrationOfLegacyFieldsIsOnlyDoneWhenRelationFieldIsVisibleInType
/**
* @test
* @dataProvider conteRowsOfDifferentTypesDataProvider
*/
public function migrationOfLegacyFieldsIsOnlyDoneWhenRelationFieldIsVisibleInType($dbRow, $expectedCaption, $fileProperties)
{
$fileReference = $this->getMock('TYPO3\\CMS\\Core\\Resource\\FileReference', array(), array(), '', FALSE);
$fileReference->expects($this->once())->method('getProperties')->will($this->returnValue($fileProperties));
$fileReference->expects($this->any())->method('getOriginalFile')->will($this->returnValue($this->getMock('TYPO3\\CMS\\Core\\Resource\\File', array(), array(), '', FALSE)));
$fileReference->expects($this->any())->method('getPublicUrl')->will($this->returnValue('path/to/file'));
$this->pageRepositoryMock->expects($this->any())->method('getFileReferences')->will($this->returnValue(array($fileReference)));
\TYPO3\CMS\Core\Resource\Service\FrontendContentAdapterService::modifyDBRow($dbRow, 'tt_content');
$this->assertSame($expectedCaption, $dbRow['imagecaption']);
}
示例14: indexAction
/**
* renders the given theme
*
* @return void
*/
public function indexAction()
{
$this->templateName = $this->evaluateTypoScript('plugin.tx_themes.settings.templateName');
$templateFile = $this->getTemplateFile();
if ($templateFile !== NULL) {
$this->view->setTemplatePathAndFilename($templateFile);
}
$this->view->assign('templateName', $this->templateName);
$this->view->assign('theme', $this->themeRepository->findByPageOrRootline($GLOBALS['TSFE']->id));
$this->view->assign('page', $this->pageRepository->getPage($GLOBALS['TSFE']->id));
$this->view->assign('data', $this->pageRepository->getPage($GLOBALS['TSFE']->id));
$this->view->assign('TSFE', $GLOBALS['TSFE']);
}
示例15: getPageTree
/**
* recursive function for building a page array
*
* @param array $page the current page
* @param int $depth the current depth
* @param array $pages contains all pages so far
* @param int $level the tree level required for the UI grid
* @return array
*/
protected function getPageTree($page, $depth, $pages = [], $level = 0)
{
// default query settings
$fields = '*';
$sortField = 'sorting';
// decrease the depth
$depth--;
// add the current language value
if ($this->modParams['lang'] > 0) {
$page['sys_language_uid'] = $this->languages[$page['_PAGES_OVERLAY_LANGUAGE'] ?: 0];
}
if ($this->showResults) {
$results = $this->getResults($page);
$page['results'] = $results['Percentage']['count'];
}
$page['level'] = $level;
// add the page to the pages array
$pages[] =& $page;
// fetch subpages and set the treelevel
if ($depth > 0) {
$subPages = $this->pageRepository->getMenu($page['uid'], $fields, $sortField);
if (count($subPages) > 0) {
$page['$$treeLevel'] = $level;
$level++;
foreach ($subPages as &$subPage) {
$pages = $this->getPageTree($subPage, $depth, $pages, $level);
}
}
}
return $pages;
}