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


PHP Page::getCurrentPage方法代码示例

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


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

示例1: setupSiteInterfaceLocalization

 public static function setupSiteInterfaceLocalization(Page $c = null)
 {
     if (!$c) {
         $c = Page::getCurrentPage();
     }
     $app = Facade::getFacadeApplication();
     // don't translate dashboard pages
     $dh = $app->make('helper/concrete/dashboard');
     if ($dh->inDashboard($c)) {
         return;
     }
     $ms = Section::getBySectionOfSite($c);
     if (!is_object($ms)) {
         $ms = static::getPreferredSection();
     }
     if (!$ms) {
         return;
     }
     $locale = $ms->getLocale();
     if ($locale) {
         $app->make('session')->set('multilingual_default_locale', $locale);
         $loc = Localization::getInstance();
         $loc->setContextLocale('site', $locale);
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:25,代码来源:Detector.php

示例2: setupSiteInterfaceLocalization

 public static function setupSiteInterfaceLocalization(Page $c = null)
 {
     if (\User::isLoggedIn() && Config::get('concrete.multilingual.keep_users_locale')) {
         return;
     }
     if (!$c) {
         $c = Page::getCurrentPage();
     }
     // don't translate dashboard pages
     $dh = \Core::make('helper/concrete/dashboard');
     if ($dh->inDashboard($c)) {
         return;
     }
     $ms = Section::getBySectionOfSite($c);
     if (!is_object($ms)) {
         $ms = static::getPreferredSection();
     }
     if (!$ms) {
         return;
     }
     $locale = $ms->getLocale();
     if (strlen($locale)) {
         \Localization::changeLocale($locale);
     }
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:25,代码来源:Detector.php

示例3: setupSiteInterfaceLocalization

 public static function setupSiteInterfaceLocalization(Page $c = null)
 {
     $loc = \Localization::getInstance();
     if (!(\User::isLoggedIn() && Config::get('concrete.multilingual.keep_users_locale'))) {
         if (!$c) {
             $c = Page::getCurrentPage();
         }
         // don't translate dashboard pages
         $dh = \Core::make('helper/concrete/dashboard');
         if ($dh->inDashboard($c)) {
             return;
         }
         $locale = null;
         $ms = Section::getBySectionOfSite($c);
         if ($ms) {
             $locale = $ms->getLocale();
         }
         if (!$locale) {
             if (Config::get('concrete.multilingual.use_previous_locale') && Session::has('previous_locale')) {
                 $locale = Session::get('previous_locale');
             }
             if (!$locale) {
                 $ms = static::getPreferredSection();
                 if ($ms) {
                     $locale = $ms->getLocale();
                 }
             }
         }
         if ($locale) {
             $loc->setLocale($locale);
         }
     }
     Session::set('previous_locale', $loc->getLocale());
 }
开发者ID:WillemAnchor,项目名称:concrete5,代码行数:34,代码来源:Detector.php

示例4: registerEvents

 public function registerEvents()
 {
     $app = $this->app;
     $events = $this->app->make('director');
     // Add the sitemap icons listener
     $events->addListener('on_before_render', function ($event) use($app) {
         $c = Page::getCurrentPage();
         $view = $event->getArgument('view');
         $assets = $app->make('asset_pipeline/helper/assets');
         $theme = null;
         if (is_object($c)) {
             $theme = $c->getCollectionThemeObject();
         } else {
             $theme = Theme::getSiteTheme();
         }
         // TODO: If there are page-specific styles set, should we use
         //       this one instead:
         //$style = $c->getCustomStyleObject();
         $style = $theme->getThemeCustomStyleObject();
         if (is_object($style)) {
             $valueList = $style->getValueList();
             if ($valueList instanceof \Concrete\Core\StyleCustomizer\Style\ValueList) {
                 $variables = array();
                 foreach ($valueList->getValues() as $value) {
                     $variables = array_merge($value->toLessVariablesArray(), $variables);
                 }
                 $assets->setStylesheetVariables('theme', $variables);
             }
         }
         $view->addScopeItems(array('assets' => $assets));
     });
 }
开发者ID:mainio,项目名称:c5_asset_pipeline,代码行数:32,代码来源:PackageServiceProvider.php

示例5: on_start

 public function on_start()
 {
     Events::addListener('on_before_render', function () {
         $c = Page::getCurrentPage();
         if (is_object($c) && $c->isEditMode()) {
             $view = View::getInstance();
             $html = new Html();
             $view->addHeaderItem($html->css('area_hints.css', 'area_hints'));
         }
     });
 }
开发者ID:Remo,项目名称:concrete5-area-hints,代码行数:11,代码来源:controller.php

示例6: on_start

 /**
  * On CMS boot.
  *
  * @return void
  */
 public function on_start()
 {
     $this->registerAssets();
     Events::addListener('on_before_render', function ($e) {
         $c = Page::getCurrentPage();
         if ($c instanceof Page) {
             $r = ResponseAssetGroup::get();
             if (!$c->isEditMode()) {
                 $r->requireAsset('smooth-scrolling');
             }
         }
     });
 }
开发者ID:olsgreen,项目名称:concrete-smooth-scrolling,代码行数:18,代码来源:controller.php

示例7: view

 /**
  * @return bool|null
  */
 public function view()
 {
     // Check for a valid File in the view
     $f = $this->getFileObject();
     $this->set('f', $f);
     // On-State image available
     $foS = $this->getFileOnstateObject();
     $this->set('foS', $foS);
     $imgPaths = [];
     $imgPaths['hover'] = File::getRelativePathFromID($this->fOnstateID);
     $imgPaths['default'] = File::getRelativePathFromID($this->getFileID());
     $this->set('imgPaths', $imgPaths);
     $this->set('altText', $this->getAltText());
     $this->set('title', $this->getTitle());
     $this->set('linkURL', $this->getLinkURL());
     $this->set('c', Page::getCurrentPage());
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:20,代码来源:controller.php

示例8: setThemeContext

 public function setThemeContext($theme = null)
 {
     if ($theme === null) {
         $c = Page::getCurrentPage();
         if (is_object($c)) {
             $theme = $c->getCollectionThemeObject();
         } else {
             $theme = Theme::getSiteTheme();
         }
     }
     if (!is_object($theme)) {
         // TODO: Check whether this can happen or not...
         throw new Exception(t("No theme available for the page!"));
     }
     $env = Environment::get();
     $r = $env->getRecord(DIRNAME_THEMES . '/' . $theme->getThemeHandle(), $theme->getPackageHandle());
     $this->themeBasePath = $r->file;
 }
开发者ID:mainio,项目名称:c5_asset_pipeline,代码行数:18,代码来源:Assets.php

示例9: getByName

 /**
  * @param string $stackName
  * @param string $cvID
  * @param int $multilingualContentSource
  *
  * @return Page
  */
 public static function getByName($stackName, $cvID = 'RECENT', Site $site = null, $multilingualContentSource = self::MULTILINGUAL_CONTENT_SOURCE_CURRENT)
 {
     $c = Page::getCurrentPage();
     if (is_object($c) && !$c->isError()) {
         $identifier = sprintf('/stack/name/%s/%s/%s/%s', $stackName, $c->getCollectionID(), $cvID, $multilingualContentSource);
         $cache = Core::make('cache/request');
         $item = $cache->getItem($identifier);
         if (!$item->isMiss()) {
             $cID = $item->get();
         } else {
             $item->lock();
             $db = Database::connection();
             $ms = false;
             $detector = Core::make('multilingual/detector');
             if ($detector->isEnabled()) {
                 $ms = self::getMultilingualSectionFromType($multilingualContentSource);
             }
             $sql = 'select cID from Stacks where stName = ?';
             $q = array($stackName);
             if ($ms) {
                 $sql .= ' and (stMultilingualSection = ? or stMultilingualSection = 0)';
                 $q[] = $ms->getCollectionID();
             } else {
                 $sql .= ' and stMultilingualSection = 0';
             }
             $sql .= ' and siteTreeID = ?';
             if ($ms) {
                 $sql .= ' order by stMultilingualSection desc';
             }
             $sql .= ' limit 1';
             if (!is_object($site)) {
                 $site = \Core::make('site')->getSite();
             }
             $q[] = $site->getDefaultLocale()->getSiteTree()->getSiteTreeID();
             $cID = $db->fetchColumn($sql, $q);
             $cache->save($item->set($cID));
         }
     } else {
         $db = Database::connection();
         $cID = $db->fetchColumn('select cID from Stacks where stName = ? and stMultilingualSection = 0', array($stackName));
     }
     return $cID ? static::getByID($cID, $cvID) : null;
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:50,代码来源:Stack.php

示例10: getCurrentSection

 /**
  * Gets the MultilingualSection object for the current section of the site.
  *
  * @return Section
  */
 public static function getCurrentSection()
 {
     static $lang;
     if (!isset($lang)) {
         $c = Page::getCurrentPage();
         if ($c instanceof Page) {
             $lang = self::getBySectionOfSite($c);
         }
     }
     return $lang;
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:16,代码来源:Section.php

示例11: pagePermissionObject

 /**
  * Get the Concrete5 permission object for the given page.
  * @return Permissions
  */
 protected function pagePermissionObject()
 {
     if ($this->_pagePermissionObj === null) {
         $this->_pagePermissionObj = new \Concrete\Core\Permission\Checker(\Concrete\Core\Page\Page::getCurrentPage());
     }
     return $this->_pagePermissionObj;
 }
开发者ID:jhartman86,项目名称:jhmrfc,代码行数:11,代码来源:jhmr_page_controller.php

示例12: getPreviousCollection

 /**
  * @return bool|Page
  */
 public function getPreviousCollection()
 {
     $page = false;
     $app = Facade::getFacadeApplication();
     $db = $app->make('database')->connection();
     $cID = 1;
     $currentPage = Page::getCurrentPage();
     while ($cID > 0) {
         switch ($this->orderBy) {
             case 'chrono_desc':
                 $cID = $db->GetOne('select Pages.cID from Pages inner join CollectionVersions cv on Pages.cID = cv.cID where cvIsApproved = 1 and cvDatePublic < ? and cParentID = ?  order by cvDatePublic desc', [$currentPage->getCollectionDatePublic(), $currentPage->getCollectionParentID()]);
                 break;
             case 'chrono_asc':
                 $cID = $db->GetOne('select Pages.cID from Pages inner join CollectionVersions cv on Pages.cID = cv.cID where cvIsApproved = 1 and cvDatePublic > ? and cParentID = ?  order by cvDatePublic asc', [$currentPage->getCollectionDatePublic(), $currentPage->getCollectionParentID()]);
                 break;
             case 'display_desc':
                 $cID = $db->GetOne('select cID from Pages where cDisplayOrder > ? and cParentID = ? order by cDisplayOrder asc', [$currentPage->getCollectionDisplayOrder(), $currentPage->getCollectionParentID()]);
                 break;
             case 'display_asc':
             default:
                 $cID = $db->GetOne('select cID from Pages where cDisplayOrder < ? and cParentID = ? order by cDisplayOrder desc', [$currentPage->getCollectionDisplayOrder(), $currentPage->getCollectionParentID()]);
                 break;
         }
         if ($cID > 0) {
             $page = Page::getByID($cID, 'RECENT');
             $currentPage = $page;
             $cp = new Permissions($page);
             if ($cp->canRead() && $page->getAttribute('exclude_nav') != 1) {
                 break;
             } else {
                 $page = false;
                 //avoid accidentally returning this $page if we're on last loop iteration
             }
         }
     }
     if (!is_object($page) && $this->loopSequence) {
         $c = Page::getCurrentPage();
         $parent = Page::getByID($c->getCollectionParentID(), 'ACTIVE');
         switch ($this->orderBy) {
             case 'chrono_desc':
                 return $parent->getFirstChild('cvDatePublic desc');
                 break;
             case 'chrono_asc':
                 return $parent->getFirstChild('cvDatePublic asc');
                 break;
             case 'display_desc':
                 return $parent->getFirstChild('cDisplayOrder asc');
                 break;
             case 'display_asc':
             default:
                 return $parent->getFirstChild('cDisplayOrder desc');
                 break;
         }
     }
     return $page;
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:59,代码来源:controller.php

示例13: __construct

 public function __construct()
 {
     $c = Page::getCurrentPage();
     $this->currentTheme = $c->getCollectionThemeObject();
 }
开发者ID:mainio,项目名称:c5_asset_pipeline,代码行数:5,代码来源:AbstractFunctionProvider.php


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