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


PHP Page::load方法代码示例

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


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

示例1: 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

示例2: 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

示例3: getContent

 /**
  * @return bool|string
  * @throws \SystemException
  */
 public function getContent()
 {
     switch ($this->popup->content_type) {
         case 'imageUrl':
             return "<img src='{$this->popup->content_image_url}'>";
             break;
         case 'imageUpload':
             return '<img src="' . MediaLibrary::instance()->getPathUrl($this->popup->content_image_upload) . '">';
             break;
         case 'page':
             /** @var Page $page */
             $page = Page::load(Theme::getActiveTheme(), $this->popup->content_page);
             $cms = new CmsController();
             return $cms->run($page->url)->getContent();
             break;
         case 'markdown':
             return \Markdown::parse($this->popup->content_markdown);
             break;
     }
 }
开发者ID:janusnic,项目名称:octobercms-popup,代码行数:24,代码来源:PopupHelper.php

示例4: 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

示例5: render

 /**
  * Renders a page in its entirety, including component initialization.
  * AJAX will be disabled for this process.
  * @param string $pageFile Specifies the CMS page file name to run.
  * @param array  $parameters  Routing parameters.
  * @param \Cms\Classes\Theme  $theme  Theme object
  */
 public static function render($pageFile, $parameters = [], $theme = null)
 {
     if (!$theme && !($theme = Theme::getActiveTheme())) {
         throw new CmsException(Lang::get('cms::lang.theme.active.not_found'));
     }
     $controller = new static($theme);
     $controller->getRouter()->setParameters($parameters);
     if (($page = Page::load($theme, $pageFile)) === null) {
         throw new CmsException(Lang::get('cms::lang.page.not_found_name', ['name' => $pageFile]));
     }
     return $controller->runPage($page, false);
 }
开发者ID:Tripplefix,项目名称:pfadiorion,代码行数:19,代码来源:Controller.php

示例6: testNamespaces

 public function testNamespaces()
 {
     $theme = Theme::load('test');
     $page = Page::load($theme, 'code-namespaces.htm');
     $this->assertNotEmpty($page);
     $parser = new CodeParser($page);
     $info = $parser->parse();
     $this->assertInternalType('array', $info);
     $this->assertArrayHasKey('filePath', $info);
     $this->assertArrayHasKey('className', $info);
     $this->assertArrayHasKey('source', $info);
     $this->assertFileExists($info['filePath']);
     $controller = new Controller($theme);
     $obj = $parser->source($page, null, $controller);
     $this->assertInstanceOf('\\Cms\\Classes\\PageCode', $obj);
     $referenceFilePath = base_path() . '/tests/fixtures/cms/reference/namespaces.php';
     $this->assertFileExists($referenceFilePath);
     $referenceContents = $this->getContents($referenceFilePath);
     $referenceContents = str_replace('{className}', $info['className'], $referenceContents);
     $this->assertEquals($referenceContents, $this->getContents($info['filePath']));
 }
开发者ID:aydancoskun,项目名称:octobercms,代码行数:21,代码来源:CodeParserTest.php


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