예제 #1
0
 /**
  * Prepares the document
  */
 protected function _prepareDocument()
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu();
     $title = NULL;
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     if ($menu) {
         $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
     }
     $title = $this->params->get('page_title', '');
     if ($this->folder->getDisplayName()) {
         $title = $this->folder->getDisplayName();
     }
     // Check for empty title and add site name if param is set
     if (empty($title)) {
         $title = $app->getCfg('sitename');
     } elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
         $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
     } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
     }
     if (empty($title)) {
         $title = $this->folder->getDisplayName();
     }
     $this->document->setTitle($title);
     if ($this->folder->getText()) {
         $this->document->setDescription($this->folder->getText());
     } elseif (!$this->folder->getText() && $this->params->get('menu-meta_description')) {
         $this->document->setDescription($this->params->get('menu-meta_description'));
     }
 }
예제 #2
0
 /**
  * Prepares the document
  */
 protected function _prepareDocument()
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu();
     $menu = $menus->getActive();
     $title = null;
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     if ($menu) {
         $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
     }
     $title = $this->params->get('page_title', '');
     // checks for empty title or sets the folder description if
     // the current menu item is not the event view. This avoids
     // having the title of them menu item on all sub events
     if (empty($title) || isset($menu->query['view']) && strcmp($menu->query['view'], 'event') != 0) {
         $title = $this->folder->getDisplayName();
     }
     // Check for empty title and add site name if param is set
     if (empty($title)) {
         $title = $app->getCfg('sitename');
     } elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
         $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
     } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
     }
     if (empty($title)) {
         $title = $this->folder->getDisplayName();
     }
     $this->document->setTitle($title);
     $description = $this->params->get('menu-meta_description');
     if (empty($description)) {
         $description = $this->folder->getMetadata()->get('metadesc');
     }
     // set the text of the folder as description if the meta desc is not set
     // or the menu item does not link to a single event
     if (empty($description) || isset($menu->query['view']) && strcmp($menu->query['view'], 'event') != 0) {
         $description = strip_tags($this->folder->getText());
     }
     $this->document->setDescription($description);
     $keys = $this->folder->getMetadata()->get('metakey');
     if ($this->params->get('menu-meta_keywords')) {
         $keys = $this->params->get('menu-meta_keywords');
     }
     $this->document->setMetadata('keywords', $keys);
     if ($this->params->get('robots')) {
         $this->document->setMetadata('robots', $this->params->get('robots'));
     }
     $this->document->setMetadata('fragment', '!');
 }
예제 #3
0
 /**
  * Prepares the document
  */
 protected function _prepareDocument()
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu();
     $title = null;
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     if ($menu) {
         $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
     }
     $title = $this->params->get('page_title', '');
     if ($this->folder->getDisplayName()) {
         $title = $this->folder->getDisplayName();
     }
     $title .= " - " . $this->position . ' / ' . $this->folder->getFileCount();
     // Check for empty title and add site name if param is set
     if (empty($title)) {
         $title = $app->getCfg('sitename');
     } elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
         $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
     } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
     }
     if (empty($title)) {
         $title = $this->folder->getDisplayName();
     }
     if ($this->document) {
         $description = $this->folder->getMetadata()->get('metadesc');
         if (!empty($description)) {
             $this->document->setDescription($description);
         } elseif ($this->folder->getText()) {
             $this->document->setDescription(strip_tags($this->folder->getText()));
         } elseif (!$this->folder->getText() && $this->params->get('menu-meta_description')) {
             $this->document->setDescription($this->params->get('menu-meta_description'));
         }
         if ($this->params->get('menu-meta_keywords')) {
             $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
         } else {
             $this->document->setMetadata('keywords', $this->folder->getMetadata()->get('metakey'));
         }
         if ($this->params->get('robots')) {
             $this->document->setMetadata('robots', $this->params->get('robots'));
         }
         $this->document->setTitle($title);
         $this->document->setMetadata('fragment', '!');
     }
 }