Example #1
0
 /**
  * Fix link in the canonical metatag
  * It works only with
  * - item
  * - category
  */
 public function canonicalFix()
 {
     if (!$this->_jbrequest->is('option', 'com_zoo')) {
         return null;
     }
     $this->_jbdebug->mark('jbzoo-sef::canonicalFix::start');
     $flags = array($this->_jbrequest->getWord('task'), $this->_jbrequest->getWord('view'), $this->_jbrequest->getWord('layout'));
     $newCanUrl = null;
     if (in_array('item', $flags)) {
         $itemId = $this->_jbrequest->getSystem('item');
         $newCanUrl = $this->_getUrl($this->_itemTable->get($itemId), 'item');
     } else {
         if (in_array('category', $flags)) {
             $categoryId = $this->_jbrequest->getSystem('category');
             $newCanUrl = $this->_getUrl($this->_catTable->get($categoryId), 'category');
         }
     }
     if ($newCanUrl) {
         // remove all canocical link
         $headData = $this->_joomlaDoc->getHeadData();
         $canKey = array_search(array('relation' => 'canonical', 'relType' => 'rel', 'attribs' => array()), $headData['links']);
         unset($headData['links'][$canKey]);
         $this->_joomlaDoc->setHeadData($headData);
         // set new url
         $baseUrl = $this->_jbrouter->getHostUrl();
         $this->_joomlaDoc->addHeadLink($baseUrl . $newCanUrl, 'canonical');
     }
     $this->_jbdebug->mark('jbzoo-sef::canonicalFix::finish');
 }
Example #2
0
 /**
  * Generate admin menu
  * @param array $params
  * @return string
  */
 public function admin(array $params = array())
 {
     if (!isset($params['controller'])) {
         $params['controller'] = $this->_jbrequest->getCtrl();
     }
     $task = $this->_jbrequest->getWord('task');
     if (!isset($params['task']) && !empty($task)) {
         $params['task'] = $task;
     }
     if (!isset($params['option'])) {
         $params['option'] = 'com_zoo';
     }
     return $this->_url($params, true, JURI::root() . 'administrator/index.php');
 }
Example #3
0
 /**
  * Wrapper for AppView init and rendering
  * @param string $tpl
  */
 protected function renderView($tpl = null)
 {
     $isJoomlaTmpl = $this->_jbrequest->is('tmpl', 'component');
     $ctrl = $this->_jbrequest->getCtrl();
     $task = $this->_jbrequest->getWord('task');
     $path = $this->app->path->path('jbviews:' . $ctrl);
     $view = $this->getView($ctrl);
     // warpper hack
     if (!$isJoomlaTmpl) {
         $jVersion = $this->app->jbversion->joomla('2.7.0') ? '3' : '2';
         echo $view->partial('menu');
         echo '<div class="jbzoo box-bottom joomla-' . $jVersion . '">';
     }
     // render view
     $view->addTemplatePath($path)->setLayout($task)->display($tpl);
     // warpper hack
     if (!$isJoomlaTmpl) {
         echo '</div>';
     }
 }