Exemple #1
0
 /**
  * Find all children of the given page
  * optional inherit priority and changefreq
  *
  * @param integer $uid            
  * @param Tx_Hriseo_Domain_Model_Pages $parent            
  * @return array
  */
 public function findChildren($uid, Tx_Hriseo_Domain_Model_Pages $parent = null)
 {
     $pages = array();
     $sql = "SELECT * FROM `pages` ";
     $sql .= "WHERE `no_search` = 0 AND `deleted` = 0 ";
     $sql .= "AND `doktype` = 1 AND `pid` = {$uid} ";
     $query = $this->createQuery();
     $query->statement($sql);
     foreach ($query->execute() as $page) {
         if ($parent instanceof Tx_Hriseo_Domain_Model_Pages) {
             if ('' != $parent->getChangefreq()) {
                 $page->setChangefreq($parent->getChangefreq());
             }
             if (0 < $parent->getPriority()) {
                 $page->setPriority($parent->getPriority());
             }
         }
         $pages[] = $page;
     }
     return $pages;
 }
 /**
  * render the tags for one page (<loc> and <lastmod>)
  *
  * @param Tx_Hriseo_Domain_Model_Pages $page            
  * @return string
  */
 public function render($page)
 {
     $cObj = new tslib_cObj();
     $path = $cObj->getTypoLink_URL($page->getUid());
     return sprintf("Disallow: /%s", $path);
 }
 /**
  * render the tags for one page (<loc> and <lastmod>)
  *
  * @param Tx_Hriseo_Domain_Model_Pages $page            
  * @return string
  */
 public function render($page)
 {
     $cObj = new tslib_cObj();
     $path = $cObj->getTypoLink_URL($page->getUid());
     // @see http://sitemaps.org and
     // http://php.net/manual/de/function.htmlspecialchars.php
     $link = htmlspecialchars($this->settings['baseURL'] . $path, ENT_QUOTES, 'UTF-8', false);
     $this->loc->setContent($link);
     $ret = $this->loc->render();
     $date = new DateTime();
     $date->setTimestamp($page->getLastmod());
     $this->lastmod->setContent($date->format('Y-m-d'));
     $ret .= $this->lastmod->render();
     $changefreq = $page->getChangefreq();
     if (!empty($changefreq)) {
         $this->tagBuilder->reset();
         $this->tagBuilder->setTagName('changefreq');
         $this->tagBuilder->setContent($changefreq);
         $ret .= $this->tagBuilder->render();
     }
     $priority = $page->getPriority();
     // 0.0: ignore
     // 0.5: default - do not display
     if (0 < $priority and 0.5 != $priority) {
         $this->tagBuilder->reset();
         $this->tagBuilder->setTagName('priority');
         $this->tagBuilder->setContent(number_format($priority, 1));
         $ret .= $this->tagBuilder->render();
     }
     return $ret;
 }