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


PHP Classes\Page类代码示例

本文整理汇总了PHP中Cms\Classes\Page的典型用法代码示例。如果您正苦于以下问题:PHP Page类的具体用法?PHP Page怎么用?PHP Page使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getParentOptions

 public function getParentOptions()
 {
     $ParentOptions = array('' => '-- chose one --');
     $pages = Page::sortBy('baseFileName')->lists('baseFileName', 'baseFileName');
     $ParentOptions = array_merge($ParentOptions, $pages);
     return $ParentOptions;
 }
开发者ID:fuunnx,项目名称:loveandzucchini,代码行数:7,代码来源:Archive.php

示例2: getCmsPageOptions

 public function getCmsPageOptions()
 {
     if (!($theme = Theme::getEditTheme())) {
         throw new ApplicationException('Unable to find the active theme.');
     }
     return Page::listInTheme($theme)->lists('fileName', 'fileName');
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:7,代码来源:MaintenanceSetting.php

示例3: getPropertyOptions

 public function getPropertyOptions($property)
 {
     if ($property == 'eventPage') {
         return Page::sortBy('baseFileName')->lists('baseFileName', 'baseFileName');
     }
     return self::getPropertyOptions($property);
 }
开发者ID:anqqa,项目名称:klubitus-octobercms-plugins,代码行数:7,代码来源:EventList.php

示例4: getUrlPageName

 public function getUrlPageName()
 {
     if (static::$urlPageName !== null) {
         return static::$urlPageName;
     }
     /*
      * Cache
      */
     $key = 'urlMaker' . $this->urlComponentName . crc32(get_class($this));
     $cached = Cache::get($key, false);
     if ($cached !== false && ($cached = @unserialize($cached)) !== false) {
         $filePath = array_get($cached, 'path');
         $mtime = array_get($cached, 'mtime');
         if (!File::isFile($filePath) || $mtime != File::lastModified($filePath)) {
             $cached = false;
         }
     }
     if ($cached !== false) {
         return static::$urlPageName = array_get($cached, 'fileName');
     }
     $page = Page::useCache()->whereComponent($this->urlComponentName, 'isPrimary', '1')->first();
     if (!$page) {
         throw new ApplicationException(sprintf('Unable to a find a primary component "%s" for generating a URL in %s.', $this->urlComponentName, get_class($this)));
     }
     $baseFileName = $page->getBaseFileName();
     $filePath = $page->getFullPath();
     $cached = ['path' => $filePath, 'fileName' => $baseFileName, 'mtime' => @File::lastModified($filePath)];
     Cache::put($key, serialize($cached), Config::get('cms.parsedPageCacheTTL', 1440));
     return static::$urlPageName = $baseFileName;
 }
开发者ID:chesterx,项目名称:pay-plugin,代码行数:30,代码来源:UrlMaker.php

示例5: onRun

 public function onRun()
 {
     $theme = Theme::getActiveTheme();
     $page = Page::load($theme, $this->page->baseFileName);
     $this->page["hasBlog"] = false;
     if (!$page->hasComponent("blogPost")) {
         $this->seo_title = $this->page["seo_title"] = empty($this->page->meta_title) ? $this->page->title : $this->page->meta_title;
         $this->seo_description = $this->page["seo_description"] = $this->page->meta_description;
         $this->seo_keywords = $this->page["seo_keywords"] = $this->page->seo_keywords;
         $this->canonical_url = $this->page["canonical_url"] = $this->page->canonical_url;
         $this->redirect_url = $this->page["redirect_url"] = $this->page->redirect_url;
         $this->robot_follow = $this->page["robot_follow"] = $this->page->robot_follow;
         $this->robot_index = $this->page["robot_index"] = $this->page->robot_index;
         $settings = Settings::instance();
         if ($settings->enable_og_tags) {
             $this->ogTitle = empty($this->page->meta_title) ? $this->page->title : $this->page->meta_title;
             $this->ogDescription = $this->page->meta_description;
             $this->ogUrl = empty($this->page->canonical_url) ? Request::url() : $this->page->canonical_url;
             $this->ogSiteName = $settings->og_sitename;
             $this->ogFbAppId = $settings->og_fb_appid;
         }
     } else {
         $this->hasBlog = $this->page["hasBlog"] = true;
     }
 }
开发者ID:janusnic,项目名称:oc-seo-extension,代码行数:25,代码来源:CmsPage.php

示例6: init

 /**
  * Initialize.
  *
  * @return void
  * @throws \Krisawzm\DemoManager\Classes\DemoManagerException
  */
 protected function init()
 {
     $backendUser = BackendAuth::getUser();
     $baseTheme = $this->theme = Config::get('krisawzm.demomanager::base_theme', null);
     if ($backendUser) {
         if ($backendUser->login == Config::get('krisawzm.demomanager::admin.login', 'admin')) {
             $this->theme = $baseTheme;
         } else {
             $this->theme = $backendUser->login;
         }
     } else {
         if (UserCounter::instance()->limit()) {
             $action = Config::get('krisawzm.demomanager::limit_action', 'reset');
             if ($action == 'reset') {
                 DemoManager::instance()->resetEverything();
                 // @todo queue/async?
                 $this->theme = $this->newDemoUser()->login;
             } elseif ($action == 'maintenance') {
                 $theme = Theme::load($baseTheme);
                 Event::listen('cms.page.beforeDisplay', function ($controller, $url, $page) use($theme) {
                     return Page::loadCached($theme, 'maintenance');
                 });
             } elseif ($action == 'nothing') {
                 $this->theme = $baseTheme;
             } else {
                 throw new DemoManagerException('User limit is reached, but an invalid action is defined.');
             }
         } else {
             $this->theme = $this->newDemoUser()->login;
             // @todo Remember the username after signing out.
             //       Could prove useful as some plugins may
             //       have some different offline views.
         }
     }
 }
开发者ID:janusnic,项目名称:demomanager-plugin,代码行数:41,代码来源:DemoAuth.php

示例7: getDetaultPaymentPage

 public static function getDetaultPaymentPage($params = [])
 {
     $settings = self::instance();
     if (empty($settings->default_payment_page)) {
         return null;
     }
     return Page::url($settings->default_payment_page, $params);
 }
开发者ID:dogiedog,项目名称:pay-plugin,代码行数:8,代码来源:Settings.php

示例8: getSpecificOptions

 public function getSpecificOptions()
 {
     $renderType = Request::input('render');
     // Load the country property value from POST
     $pages = Page::sortBy('baseFileName')->lists('baseFileName', 'baseFileName');
     $Options = ['none' => [], 'settings' => [], 'parent' => [], 'specific' => $pages];
     return $Options[$renderType];
 }
开发者ID:betes-curieuses-design,项目名称:AllianceEducation,代码行数:8,代码来源:Bloglist.php

示例9: getUrlOptions

 /**
  * Get a list of all pages. Prepend an empty option to the start
  *
  * @return array
  */
 public function getUrlOptions()
 {
     $allPages = Page::sortBy('baseFileName')->lists('title', 'baseFileName');
     $pages = array('' => 'No page link');
     foreach ($allPages as $key => $value) {
         $pages[$key] = "{$key}";
     }
     return $pages;
 }
开发者ID:aydancoskun,项目名称:octobercms,代码行数:14,代码来源:Cookielawbanner.php

示例10: spoofPageCode

 private function spoofPageCode()
 {
     // Spoof all the objects we need to make a page object
     $theme = Theme::load('test');
     $page = Page::load($theme, 'index.htm');
     $layout = Layout::load($theme, 'content.htm');
     $controller = new Controller($theme);
     $parser = new CodeParser($page);
     $pageObj = $parser->source($page, $layout, $controller);
     return $pageObj;
 }
开发者ID:mechiko,项目名称:staff-october,代码行数:11,代码来源:ComponentManagerTest.php

示例11: testLists

 public function testLists()
 {
     // Default theme: test
     $pages = Page::lists('baseFileName');
     sort($pages);
     $this->assertEquals(["404", "a/a-page", "ajax-test", "authors", "b/b-page", "blog-archive", "blog-post", "code-namespaces", "component-custom-render", "component-partial", "component-partial-nesting", "component-partial-override", "cycle-test", "index", "no-component", "no-component-class", "no-layout", "no-partial", "optional-full-php-tags", "optional-short-php-tags", "throw-php", "with-component", "with-components", "with-content", "with-layout", "with-partials", "with-placeholder"], $pages);
     $layouts = Layout::lists('baseFileName');
     sort($layouts);
     $this->assertEquals(["a/a-layout", "ajax-test", "content", "cycle-test", "no-php", "partials", "php-parser-test", "placeholder", "sidebar"], $layouts);
     $pages = Page::inTheme('NON_EXISTENT_THEME')->lists('baseFileName');
     $this->assertEmpty($pages);
 }
开发者ID:mechiko,项目名称:staff-october,代码行数:12,代码来源:CmsObjectQueryTest.php

示例12: testTargetCmsPageRedirect

 public function testTargetCmsPageRedirect()
 {
     $page = Page::load(Theme::getActiveTheme(), 'adrenth-redirect-testpage');
     if ($page === null) {
         $page = new Page();
         $page->title = 'Testpage';
         $page->url = '/adrenth/redirect/testpage';
         $page->setFileNameAttribute('adrenth-redirect-testpage');
         $page->save();
     }
     $redirect = new Redirect(['match_type' => Redirect::TYPE_EXACT, 'target_type' => Redirect::TARGET_TYPE_CMS_PAGE, 'from_url' => '/this-should-be-source', 'cms_page' => 'adrenth-redirect-testpage', 'requirements' => null, 'status_code' => 302, 'from_date' => Carbon::now(), 'to_date' => Carbon::now()->addWeek()]);
     self::assertTrue($redirect->save());
     $rule = RedirectRule::createWithModel($redirect);
     self::assertInstanceOf(RedirectRule::class, $rule);
     $manager = RedirectManager::createWithRule($rule);
     self::assertInstanceOf(RedirectManager::class, $manager);
     $result = $manager->match('/this-should-be-source');
     self::assertInstanceOf(RedirectRule::class, $result);
     self::assertEquals('http://localhost/adrenth/redirect/testpage', $manager->getLocation($result));
     self::assertTrue($page->delete());
 }
开发者ID:adrenth,项目名称:redirect,代码行数:21,代码来源:RedirectManagerTest.php

示例13: getPagesDropDown

 public function getPagesDropDown()
 {
     if (!$this->pages) {
         $theme = Theme::getEditTheme();
         $pages = Page::listInTheme($theme, true);
         $this->pages = [];
         foreach ($pages as $page) {
             $this->pages[$page->baseFileName] = $page->title . ' (' . $page->url . ')';
         }
     }
     return $this->pages;
 }
开发者ID:janusnic,项目名称:OctoberCMS,代码行数:12,代码来源:Settings.php

示例14: getUrl

 /**
  *
  * Generates url for the item to be resolved
  *
  * @param int $year - year number
  * @param string $pageCode - page code to be used
  * @param $theme
  * @return string
  */
 protected static function getUrl($year, $pageCode, $theme)
 {
     $page = CmsPage::loadCached($theme, $pageCode);
     if (!$page) {
         return '';
     }
     $properties = $page->getComponentProperties('blogArchive');
     if (!isset($properties['yearParam'])) {
         return '';
     }
     $paramName = $properties['yearParam'];
     $url = CmsPage::url($page->getBaseFileName(), [$paramName => $year]);
     return $url;
 }
开发者ID:graker,项目名称:blogarchive,代码行数:23,代码来源:SitemapProvider.php

示例15: scanForMessages

 /**
  * Scans the theme templates for message references.
  * @return void
  */
 public function scanForMessages()
 {
     $messages = [];
     foreach (Layout::all() as $layout) {
         $messages = array_merge($messages, $this->parseContent($layout->markup));
     }
     foreach (Page::all() as $page) {
         $messages = array_merge($messages, $this->parseContent($page->markup));
     }
     foreach (Partial::all() as $partial) {
         $messages = array_merge($messages, $this->parseContent($partial->markup));
     }
     Message::importMessages($messages);
 }
开发者ID:aydancoskun,项目名称:octobercms,代码行数:18,代码来源:ThemeScanner.php


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