/** * 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'); }
/** * Filter link * @param string $elemId * @param string $value * @param JRegistry $moduleParams * @param int $mode * @return string */ public function filter($elemId, $value, $moduleParams, $mode = 0) { $urlParams = array('option' => 'com_zoo', 'controller' => 'search', 'task' => 'filter', 'app_id' => $moduleParams->get('application'), 'Itemid' => $moduleParams->get('menuitem'), 'type' => $moduleParams->get('type'), 'limit' => $moduleParams->get('limit', 10), 'exact' => 1, 'order' => $moduleParams->get('order')); if ($mode == 0) { $urlParams['e'][$elemId] = $value; } elseif ($mode == 1) { $urlParams['e'] = $this->_jbrequest->getElements(); $urlParams['e'][$elemId] = $value; } elseif ($mode == 2) { $urlParams['e'] = $this->_jbrequest->getElements(); unset($urlParams['e'][$elemId]); } if ($moduleParams->get('depend_category', 0)) { $categoryId = $this->_jbrequest->getSystem('category'); if ($categoryId > 0 && !isset($urlParams['e']['_itemcategory'])) { $urlParams['e']['_itemcategory'] = $categoryId; } } return $this->_url($urlParams); }