Example #1
0
 protected function Init()
 {
     $this->prefix = Request::GetData('prefix');
     $this->page = Page::Schema()->ByID(Request::GetData('page'));
     if (!$this->page) {
         throw new \Exception('Required parameter page invalid or missing');
     }
     $this->serializer = new ArrayLinesSerializer();
     $this->oblParams = FrontendRouter::GatherParams($this->page->GetUrl());
     $this->params = $this->serializer->LinesToArray(Request::GetData('params'));
     $this->AddObligatoryFields();
     $this->AddOptionalParamsField();
     $this->AddFragmentField();
     $this->AddSubmit();
     return parent::Init();
 }
Example #2
0
 /**
  * 
  * @param Page $page
  * @return boolean
  */
 function AddPageCommands(Page $page)
 {
     $pageUrl = $page->GetUrl();
     $params = FrontendRouter::GatherParams($pageUrl);
     if (count($params) == 0) {
         return false;
     }
     $this->writer->AddContent($this->PageStartComment($page));
     $this->writer->AddContent($this->SiteHostCondition($page->GetSite()));
     $folderCondition = $this->SiteFolderCondition($page->GetSite());
     if ($folderCondition) {
         $this->writer->AddContent($folderCondition);
     }
     $this->writer->AddContent($this->PageRule($page, $params));
     $this->writer->AddContent($this->PageEndComment($page));
     return true;
 }
Example #3
0
 /**
  * Adds a single page to the sitemap
  * @param Page $page The page
  */
 private function AddPage(Page $page)
 {
     if (!$this->PageAllowed($page)) {
         return;
     }
     $params = FrontendRouter::GatherParams($page->GetUrl());
     if (count($params) == 0) {
         $changeFreq = ChangeFrequency::ByValue($page->GetSitemapChangeFrequency());
         $priority = $page->GetSitemapRelevance();
         $lastLog = LogEvaluator::LastPageModLog($page, $this->resolver);
         $lastMod = $lastLog ? $lastLog->GetChanged() : null;
         $this->sitemap->AddUrl(FrontendRouter::PageUrl($page), $changeFreq, $priority, $lastMod);
     }
 }