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


PHP PageModel::findPublishedRegularWithoutGuestsByIds方法代码示例

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


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

示例1: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     // Get all active pages
     $objPages = \PageModel::findPublishedRegularWithoutGuestsByIds($this->pages);
     // Return if there are no pages
     if ($objPages === null) {
         return;
     }
     $arrPages = array();
     // Sort the array keys according to the given order
     if ($this->orderPages != '') {
         $tmp = deserialize($this->orderPages);
         if (!empty($tmp) && is_array($tmp)) {
             $arrPages = array_map(function () {
             }, array_flip($tmp));
         }
     }
     // Add the items to the pre-sorted array
     while ($objPages->next()) {
         /** @var \PageModel $objModel */
         $objModel = $objPages->current();
         $arrPages[$objPages->id] = $objModel->loadDetails()->row();
         // see #3765
     }
     $items = array();
     foreach ($arrPages as $arrPage) {
         $arrPage['title'] = strip_insert_tags($arrPage['title']);
         $arrPage['pageTitle'] = strip_insert_tags($arrPage['pageTitle']);
         // Get href
         switch ($arrPage['type']) {
             case 'redirect':
                 $href = $arrPage['url'];
                 break;
             case 'forward':
                 if (($objNext = \PageModel::findPublishedById($arrPage['jumpTo'])) !== null) {
                     $strForceLang = null;
                     $objNext->loadDetails();
                     // Check the target page language (see #4706)
                     if (\Config::get('addLanguageToUrl')) {
                         $strForceLang = $objNext->language;
                     }
                     $href = $this->generateFrontendUrl($objNext->row(), null, $strForceLang, true);
                     break;
                 }
                 // DO NOT ADD A break; STATEMENT
             // DO NOT ADD A break; STATEMENT
             default:
                 $href = $this->generateFrontendUrl($arrPage, null, $arrPage['rootLanguage'], true);
                 break;
         }
         $items[] = array('href' => $href, 'title' => specialchars($arrPage['pageTitle'] ?: $arrPage['title']), 'link' => $arrPage['title']);
     }
     $this->Template->items = $items;
     $this->Template->formId = 'tl_quicklink_' . $this->id;
     $this->Template->request = ampersand(\Environment::get('request'), true);
     $this->Template->title = $this->customLabel ?: $GLOBALS['TL_LANG']['MSC']['quicklink'];
     $this->Template->button = specialchars($GLOBALS['TL_LANG']['MSC']['go']);
 }
开发者ID:jamesdevine,项目名称:core-bundle,代码行数:61,代码来源:ModuleQuicklink.php

示例2: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     // Get all active pages
     $objPages = \PageModel::findPublishedRegularWithoutGuestsByIds($this->pages);
     // Return if there are no pages
     if ($objPages === null) {
         return;
     }
     $arrPages = array();
     // Sort the array keys according to the given order
     if ($this->orderPages != '') {
         $tmp = deserialize($this->orderPages);
         if (!empty($tmp) && is_array($tmp)) {
             $arrPages = array_map(function () {
             }, array_flip($tmp));
         }
     }
     $arrPages = array_values(array_filter($arrPages));
     // Add the items to the pre-sorted array
     while ($objPages->next()) {
         $arrPages[$objPages->id] = $objPages->current();
     }
     $items = array();
     /** @var \PageModel[] $arrPages */
     foreach ($arrPages as $objPage) {
         $objPage->title = strip_insert_tags($objPage->title);
         $objPage->pageTitle = strip_insert_tags($objPage->pageTitle);
         // Get href
         switch ($objPage->type) {
             case 'redirect':
                 $href = $objPage->url;
                 break;
             case 'forward':
                 if (($objNext = $objPage->getRelated('jumpTo')) !== null) {
                     /** @var \PageModel $objNext */
                     $href = $objNext->getFrontendUrl();
                     break;
                 }
                 // DO NOT ADD A break; STATEMENT
             // DO NOT ADD A break; STATEMENT
             default:
                 $href = $objPage->getFrontendUrl();
                 break;
         }
         $items[] = array('href' => $href, 'title' => specialchars($objPage->pageTitle ?: $objPage->title), 'link' => $objPage->title);
     }
     $this->Template->items = $items;
     $this->Template->request = ampersand(\Environment::get('request'), true);
     $this->Template->title = $this->customLabel ?: $GLOBALS['TL_LANG']['MSC']['quicklink'];
     $this->Template->button = specialchars($GLOBALS['TL_LANG']['MSC']['go']);
 }
开发者ID:bytehead,项目名称:contao-core,代码行数:54,代码来源:ModuleQuicklink.php

示例3: compile

 protected function compile()
 {
     global $objPage;
     $items = array();
     $groups = array();
     if (FE_USER_LOGGED_IN) {
         $this->import('FrontendUser', 'User');
         $groups = $this->User->groups;
     }
     $objPages = \PageModel::findPublishedRegularWithoutGuestsByIds(deserialize($this->pages, true));
     if ($objPages === null) {
         return;
     }
     $arrPages = array();
     // Sort the array keys according to the given order
     if ($this->orderPages != '') {
         $tmp = deserialize($this->orderPages);
         if (!empty($tmp) && is_array($tmp)) {
             $arrPages = array_map(function () {
             }, array_flip($tmp));
         }
     }
     if ($this->navigationTpl == '') {
         $this->navigationTpl = 'nav_default';
     }
     $objTemplate = new \FrontendTemplate($this->navigationTpl);
     $objTemplate->type = get_class($this);
     $objTemplate->cssID = $this->cssID;
     $objTemplate->level = 'level_1';
     while ($objPages->next()) {
         $_groups = deserialize($arrPage['groups']);
         if (!$arrPage['protected'] || BE_USER_LOGGED_IN || is_array($_groups) && count(array_intersect($_groups, $groups)) || $this->showProtected) {
             $arrPages[$objPages->id] = $this->getPageData($objPages);
             if ($objPages->rsmm_enabled) {
                 $arrPages[$objPages->id]['subitems'] = $this->renderNavigation($objPages->id);
             }
         }
     }
     $items = array_values($arrPages);
     // Add classes first and last
     $items[0]['class'] = trim($items[0]['class'] . ' first');
     $last = count($items) - 1;
     $items[$last]['class'] = trim($items[$last]['class'] . ' last');
     $objTemplate->items = $items;
     $this->Template->request = \Environment::get('indexFreeRequest');
     $this->Template->skipId = 'skipNavigation' . $this->id;
     $this->Template->skipNavigation = specialchars($GLOBALS['TL_LANG']['MSC']['skipNavigation']);
     $this->Template->items = !empty($items) ? $objTemplate->parse() : '';
 }
开发者ID:madeyourday,项目名称:contao-rocksolid-mega-menu,代码行数:49,代码来源:MenuCustom.php

示例4: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     // Get all active pages
     $arrPages = \PageModel::findPublishedRegularWithoutGuestsByIds($this->pages)->getData();
     if (empty($arrPages)) {
         return;
     }
     $items = array();
     foreach ($arrPages as $arrPage) {
         $arrPage['title'] = strip_insert_tags($arrPage['title']);
         $arrPage['pageTitle'] = strip_insert_tags($arrPage['pageTitle']);
         $items[] = array('href' => $this->generateFrontendUrl($arrPage), 'title' => specialchars($arrPage['pageTitle'] ?: $arrPage['title']), 'link' => $arrPage['title']);
     }
     $this->Template->items = $items;
     $this->Template->request = ampersand(\Environment::get('request'), true);
     $this->Template->title = $this->customLabel ?: $GLOBALS['TL_LANG']['MSC']['quicklink'];
     $this->Template->button = specialchars($GLOBALS['TL_LANG']['MSC']['go']);
 }
开发者ID:rikaix,项目名称:core,代码行数:21,代码来源:ModuleQuicklink.php

示例5: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var \PageModel $objPage */
     global $objPage;
     $items = array();
     $groups = array();
     // Get all groups of the current front end user
     if (FE_USER_LOGGED_IN) {
         $this->import('FrontendUser', 'User');
         $groups = $this->User->groups;
     }
     // Get all active pages
     $objPages = \PageModel::findPublishedRegularWithoutGuestsByIds($this->pages);
     // Return if there are no pages
     if ($objPages === null) {
         return;
     }
     $arrPages = array();
     // Sort the array keys according to the given order
     if ($this->orderPages != '') {
         $tmp = deserialize($this->orderPages);
         if (!empty($tmp) && is_array($tmp)) {
             $arrPages = array_map(function () {
             }, array_flip($tmp));
         }
     }
     // Add the items to the pre-sorted array
     while ($objPages->next()) {
         /** @var \PageModel $objPages */
         $objModel = $objPages->current();
         $arrPages[$objPages->id] = $objModel->loadDetails()->row();
         // see #3765
     }
     // Set default template
     if ($this->navigationTpl == '') {
         $this->navigationTpl = 'nav_default';
     }
     /** @var \FrontendTemplate|object $objTemplate */
     $objTemplate = new \FrontendTemplate($this->navigationTpl);
     $objTemplate->type = get_class($this);
     $objTemplate->cssID = $this->cssID;
     // see #4897 and 6129
     $objTemplate->level = 'level_1';
     foreach ($arrPages as $arrPage) {
         // Skip hidden pages (see #5832)
         if (!is_array($arrPage)) {
             continue;
         }
         $_groups = deserialize($arrPage['groups']);
         // Do not show protected pages unless a back end or front end user is logged in
         if (!$arrPage['protected'] || BE_USER_LOGGED_IN || is_array($_groups) && count(array_intersect($_groups, $groups)) || $this->showProtected) {
             // Get href
             switch ($arrPage['type']) {
                 case 'redirect':
                     $href = $arrPage['url'];
                     break;
                 case 'forward':
                     if (($objNext = \PageModel::findPublishedById($arrPage['jumpTo'])) !== null) {
                         $strForceLang = null;
                         $objNext->loadDetails();
                         // Check the target page language (see #4706)
                         if (\Config::get('addLanguageToUrl')) {
                             $strForceLang = $objNext->language;
                         }
                         $href = $this->generateFrontendUrl($objNext->row(), null, $strForceLang, true);
                         break;
                     }
                     // DO NOT ADD A break; STATEMENT
                 // DO NOT ADD A break; STATEMENT
                 default:
                     $href = $this->generateFrontendUrl($arrPage, null, $arrPage['rootLanguage'], true);
                     break;
             }
             $trail = in_array($arrPage['id'], $objPage->trail);
             // Active page
             if ($objPage->id == $arrPage['id'] && $href == \Environment::get('request')) {
                 $strClass = trim($arrPage['cssClass']);
                 $row = $arrPage;
                 $row['isActive'] = true;
                 $row['isTrail'] = false;
                 $row['class'] = trim('active ' . $strClass);
                 $row['title'] = specialchars($arrPage['title'], true);
                 $row['pageTitle'] = specialchars($arrPage['pageTitle'], true);
                 $row['link'] = $arrPage['title'];
                 $row['href'] = $href;
                 $row['nofollow'] = strncmp($arrPage['robots'], 'noindex', 7) === 0;
                 $row['target'] = '';
                 $row['description'] = str_replace(array("\n", "\r"), array(' ', ''), $arrPage['description']);
                 // Override the link target
                 if ($arrPage['type'] == 'redirect' && $arrPage['target']) {
                     $row['target'] = ' target="_blank"';
                 }
                 $items[] = $row;
             } else {
                 $strClass = trim($arrPage['cssClass'] . ($trail ? ' trail' : ''));
                 $row = $arrPage;
                 $row['isActive'] = false;
//.........这里部分代码省略.........
开发者ID:jamesdevine,项目名称:core-bundle,代码行数:101,代码来源:ModuleCustomnav.php

示例6: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var \PageModel $objPage */
     global $objPage;
     $items = array();
     $groups = array();
     // Get all groups of the current front end user
     if (FE_USER_LOGGED_IN) {
         $this->import('FrontendUser', 'User');
         $groups = $this->User->groups;
     }
     // Get all active pages
     $objPages = \PageModel::findPublishedRegularWithoutGuestsByIds($this->pages);
     // Return if there are no pages
     if ($objPages === null) {
         return;
     }
     $arrPages = array();
     // Sort the array keys according to the given order
     if ($this->orderPages != '') {
         $tmp = deserialize($this->orderPages);
         if (!empty($tmp) && is_array($tmp)) {
             $arrPages = array_map(function () {
             }, array_flip($tmp));
         }
     }
     // Add the items to the pre-sorted array
     while ($objPages->next()) {
         $arrPages[$objPages->id] = $objPages->current();
     }
     $arrPages = array_values(array_filter($arrPages));
     // Set default template
     if ($this->navigationTpl == '') {
         $this->navigationTpl = 'nav_default';
     }
     /** @var \FrontendTemplate|object $objTemplate */
     $objTemplate = new \FrontendTemplate($this->navigationTpl);
     $objTemplate->type = get_class($this);
     $objTemplate->cssID = $this->cssID;
     // see #4897 and 6129
     $objTemplate->level = 'level_1';
     /** @var \PageModel[] $arrPages */
     foreach ($arrPages as $objModel) {
         $_groups = deserialize($objModel->groups);
         // Do not show protected pages unless a back end or front end user is logged in
         if (!$objModel->protected || BE_USER_LOGGED_IN || is_array($_groups) && count(array_intersect($_groups, $groups)) || $this->showProtected) {
             // Get href
             switch ($objModel->type) {
                 case 'redirect':
                     $href = $objModel->url;
                     break;
                 case 'forward':
                     if (($objNext = $objModel->getRelated('jumpTo')) !== null) {
                         /** @var \PageModel $objNext */
                         $href = $objNext->getFrontendUrl();
                         break;
                     }
                     // DO NOT ADD A break; STATEMENT
                 // DO NOT ADD A break; STATEMENT
                 default:
                     $href = $objModel->getFrontendUrl();
                     break;
             }
             $trail = in_array($objModel->id, $objPage->trail);
             // Active page
             if ($objPage->id == $objModel->id && $href == \Environment::get('request')) {
                 $strClass = trim($objModel->cssClass);
                 $row = $objModel->row();
                 $row['isActive'] = true;
                 $row['isTrail'] = false;
                 $row['class'] = trim('active ' . $strClass);
                 $row['title'] = specialchars($objModel->title, true);
                 $row['pageTitle'] = specialchars($objModel->pageTitle, true);
                 $row['link'] = $objModel->title;
                 $row['href'] = $href;
                 $row['nofollow'] = strncmp($objModel->robots, 'noindex', 7) === 0;
                 $row['target'] = '';
                 $row['description'] = str_replace(array("\n", "\r"), array(' ', ''), $objModel->description);
                 // Override the link target
                 if ($objModel->type == 'redirect' && $objModel->target) {
                     $row['target'] = $objPage->outputFormat == 'xhtml' ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
                 }
                 $items[] = $row;
             } else {
                 $strClass = trim($objModel->cssClass . ($trail ? ' trail' : ''));
                 $row = $objModel->row();
                 $row['isActive'] = false;
                 $row['isTrail'] = $trail;
                 $row['class'] = $strClass;
                 $row['title'] = specialchars($objModel->title, true);
                 $row['pageTitle'] = specialchars($objModel->pageTitle, true);
                 $row['link'] = $objModel->title;
                 $row['href'] = $href;
                 $row['nofollow'] = strncmp($objModel->robots, 'noindex', 7) === 0;
                 $row['target'] = '';
                 $row['description'] = str_replace(array("\n", "\r"), array(' ', ''), $objModel->description);
                 // Override the link target
//.........这里部分代码省略.........
开发者ID:bytehead,项目名称:contao-core,代码行数:101,代码来源:ModuleCustomnav.php

示例7: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     global $objPage;
     $items = array();
     $groups = array();
     // Get all groups of the current front end user
     if (FE_USER_LOGGED_IN) {
         $this->import('FrontendUser', 'User');
         $groups = $this->User->groups;
     }
     // Get all active pages
     $objPages = \PageModel::findPublishedRegularWithoutGuestsByIds($this->pages);
     // Return if there are no pages
     if ($objPages === null) {
         return;
     }
     $arrPages = array();
     while ($objPages->next()) {
         $arrPages[] = $objPages->row();
     }
     // Set default template
     if ($this->navigationTpl == '') {
         $this->navigationTpl = 'nav_default';
     }
     $objTemplate = new \FrontendTemplate($this->navigationTpl);
     $objTemplate->type = get_class($this);
     $objTemplate->level = 'level_1';
     foreach ($arrPages as $arrPage) {
         $_groups = deserialize($arrPage['groups']);
         // Do not show protected pages unless a back end or front end user is logged in
         if (!$arrPage['protected'] || BE_USER_LOGGED_IN || is_array($_groups) && count(array_intersect($_groups, $groups)) || $this->showProtected) {
             // Get href
             switch ($arrPage['type']) {
                 case 'redirect':
                     $href = $arrPage['url'];
                     break;
                 case 'forward':
                     if (($objNext = \PageModel::findPublishedById($arrPage['jumpTo'])) !== null) {
                         $href = $this->generateFrontendUrl($objNext->row());
                         break;
                     }
                     // DO NOT ADD A break; STATEMENT
                 // DO NOT ADD A break; STATEMENT
                 default:
                     $href = $this->generateFrontendUrl($arrPage);
                     break;
             }
             // Active page
             if ($objPage->id == $arrPage['id']) {
                 $strClass = trim($arrPage['cssClass']);
                 $row = $arrPage;
                 $row['isActive'] = true;
                 $row['class'] = trim('active ' . $strClass);
                 $row['title'] = specialchars($arrPage['title'], true);
                 $row['pageTitle'] = specialchars($arrPage['pageTitle'], true);
                 $row['link'] = $arrPage['title'];
                 $row['href'] = $href;
                 $row['nofollow'] = strncmp($arrPage['robots'], 'noindex', 7) === 0;
                 $row['target'] = '';
                 $row['description'] = str_replace(array("\n", "\r"), array(' ', ''), $arrPage['description']);
                 // Override the link target
                 if ($arrPage['type'] == 'redirect' && $arrPage['target']) {
                     $row['target'] = $objPage->outputFormat == 'xhtml' ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
                 }
                 $items[] = $row;
             } else {
                 $strClass = trim($arrPage['cssClass'] . (in_array($arrPage['id'], $objPage->trail) ? ' trail' : ''));
                 $row = $arrPage;
                 $row['isActive'] = false;
                 $row['class'] = $strClass;
                 $row['title'] = specialchars($arrPage['title'], true);
                 $row['pageTitle'] = specialchars($arrPage['pageTitle'], true);
                 $row['link'] = $arrPage['title'];
                 $row['href'] = $href;
                 $row['nofollow'] = strncmp($arrPage['robots'], 'noindex', 7) === 0;
                 $row['target'] = '';
                 $row['description'] = str_replace(array("\n", "\r"), array(' ', ''), $arrPage['description']);
                 // Override the link target
                 if ($arrPage['type'] == 'redirect' && $arrPage['target']) {
                     $row['target'] = $objPage->outputFormat == 'xhtml' ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
                 }
                 $items[] = $row;
             }
         }
     }
     // Add classes first and last
     $items[0]['class'] = trim($items[0]['class'] . ' first');
     $last = count($items) - 1;
     $items[$last]['class'] = trim($items[$last]['class'] . ' last');
     $objTemplate->items = $items;
     $this->Template->request = $this->getIndexFreeRequest(true);
     $this->Template->skipId = 'skipNavigation' . $this->id;
     $this->Template->skipNavigation = specialchars($GLOBALS['TL_LANG']['MSC']['skipNavigation']);
     $this->Template->items = !empty($items) ? $objTemplate->parse() : '';
 }
开发者ID:rburch,项目名称:core,代码行数:98,代码来源:ModuleCustomnav.php


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