public function onRun() { $url = Request::path(); if (!strlen($url)) { $url = '/'; } $router = new Router(Theme::getActiveTheme()); $this->page = $this->page['page'] = $router->findByUrl($url); if ($this->page) { $this->seo_title = $this->page['seo_title'] = $this->page->getViewBag()->property('seo_title'); $this->title = $this->page['title'] = $this->page->getViewBag()->property('title'); $this->seo_description = $this->page['seo_description'] = $this->page->getViewBag()->property('seo_description'); $this->seo_keywords = $this->page['seo_keywords'] = $this->page->getViewBag()->property('seo_keywords'); $this->canonical_url = $this->page['canonical_url'] = $this->page->getViewBag()->property('canonical_url'); $this->redirect_url = $this->page['redirect_url'] = $this->page->getViewBag()->property('redirect_url'); $this->robot_index = $this->page['robot_index'] = $this->page->getViewBag()->property('robot_index'); $this->robot_follow = $this->page['robot_follow'] = $this->page->getViewBag()->property('robot_follow'); $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; } } }
public function onRun() { $url = $this->getRouter()->getUrl(); if (!strlen($url)) { $url = '/'; } $theme = Theme::getActiveTheme(); $router = new Router($theme); $page = $router->findByUrl($url); if ($page) { $tree = StaticPageClass::buildMenuTree($theme); $code = $startCode = $page->getBaseFileName(); $breadcrumbs = []; while ($code) { if (!isset($tree[$code])) { continue; } $pageInfo = $tree[$code]; if ($pageInfo['navigation_hidden']) { $code = $pageInfo['parent']; continue; } $reference = new MenuItemReference(); $reference->title = $pageInfo['title']; $reference->url = URL::to($pageInfo['url']); $reference->isActive = $code == $startCode; $breadcrumbs[] = $reference; $code = $pageInfo['parent']; } $breadcrumbs = array_reverse($breadcrumbs); $this->breadcrumbs = $this->page['breadcrumbs'] = $breadcrumbs; } }
public function onRun() { $url = $this->getRouter()->getUrl(); if (!strlen($url)) { $url = '/'; } $router = new Router(Theme::getActiveTheme()); $this->pageObject = $this->page['page'] = $router->findByUrl($url); if ($this->pageObject) { $this->title = $this->page['title'] = array_get($this->pageObject->viewBag, 'title'); $this->extraData = $this->page['extraData'] = $this->defineExtraData(); } }
public function onRun() { $url = Request::path(); if (!strlen($url)) { $url = '/'; } $router = new Router(Theme::getActiveTheme()); $this->pageObject = $this->page['page'] = $router->findByUrl($url); if ($this->pageObject) { $this->title = $this->page['title'] = $this->pageObject->getViewBag()->property('title'); $this->extraData = $this->page['extraData'] = $this->defineExtraData(); } }
/** * Creates a CMS page from a static page and configures it. * @param string $url Specifies the static page URL. * @return \Cms\Classes\Page Returns the CMS page object or NULL of the requested page was not found. */ public function initCmsPage($url) { $router = new Router($this->theme); $page = $router->findByUrl($url); if (!$page) { return null; } $viewBag = $page->viewBag; $cmsPage = CmsPage::inTheme($this->theme); $cmsPage->url = $url; $cmsPage->apiBag['staticPage'] = $page; /* * Transfer specific values from the content view bag to the page settings object. */ $viewBagToSettings = ['title', 'layout', 'meta_title', 'meta_description', 'is_hidden']; foreach ($viewBagToSettings as $property) { $cmsPage->settings[$property] = array_get($viewBag, $property); } return $cmsPage; }
/** * Creates a CMS page from a static page and configures it. * @param string $url Specifies the static page URL. * @return \Cms\Classes\Page Returns the CMS page object or NULL of the requested page was not found. */ public function initCmsPage($url) { $router = new Router($this->theme); $page = $router->findByUrl($url); if (!$page) { return null; } $viewBag = $page->getViewBag(); $cmsPage = new Page($this->theme); $cmsPage->apiBag['staticPage'] = $page; $cmsPage->title = $viewBag->property('title'); $cmsPage->settings['url'] = $url; $cmsPage->settings['components'] = []; /* * Transfer specific values from the content view bag to the page settings object. */ $viewBagToSettings = ['is_hidden', 'layout', 'meta_title', 'meta_description']; foreach ($viewBagToSettings as $property) { $cmsPage->settings[$property] = $viewBag->property($property); } return $cmsPage; }