/** * @params object parameters set by user for the plugin * @return string a list of sef urls similar to that of the current page */ function shGetSimilarUrls($path, $params) { // init result $urls = ''; // current path $path = JString::trim($path); $path = JString::trim($path, '.'); // if empty, we may be on a non-sef urls if (empty($path)) { return $urls; } $urlList = shFindSimilarUrls($path, $params); $urls = shFormatSimilarUrls($urlList); return $urls; }
/** * @params object parameters set by user for the plugin * @return string a list of sef urls similar to that of the current page */ function shGetSimilarUrls($params) { // init result $urls = ''; // first get current sef url $shPageInfo =& shRouter::shPageInfo(); // current path $path = JString::trim($shPageInfo->shCurrentPagePath); $path = JString::trim($path, '.'); // if empty, we may be on a non-sef urls if (empty($path)) { return $urls; } $urlList = shFindSimilarUrls($path, $params); $urls = shFormatSimilarUrls($urlList); return $urls; }
/** * Lookup urls similar to the (not found) request * stored in $this->_url * * @param boolean $returnZeroElement if true, an empty object is store in result * if there is not data available. If false, result is left null */ protected function _getSimilarUrls($returnZeroElement) { // check if we have not already done the job if (is_null($this->_data)) { if (is_callable('shFindSimilarUrls')) { // get plugin params $plugin =& JPluginHelper::getPlugin('sh404sefcore', 'sh404sefsimilarurls'); // init params from plugin $pluginParams = new JParameter($plugin->params); // call our similar url function // TODO: move similar url into a model $this->_data = shFindSimilarUrls($this->_url->oldurl, $pluginParams); $this->_total = is_array($this->_data) ? count($this->_data) : 0; if ($returnZeroElement && empty($this->_data)) { // create an empty record and return it $this->_data = array(JTable::getInstance($this->_defaultTable, 'Sh404sefTable')); } } } }