Файловый менеджер - Редактировать - /var/www/iplanru/data/old/www/i-plan.ru/components/com_sef/sef_ext/com_k2.php
Назад
<?php /** * K2 SEF extension for Joomla! * * @copyright 2009 JoomAce LLC * @license http://www.joomace.net/company/license * www.joomace.net * @package JoomSEF */ // Check to ensure this file is included in Joomla! defined('_JEXEC') or die('Restricted access.'); class SefExt_com_k2 extends SefExt { var $params; function getCategoryTitle($id) { $cats = $this->params->get('category_inc', '2'); $categories = array(); if ($cats == '0') $id = 0; while ($id > 0) { $database =& JFactory::getDBO(); $database->setQuery("SELECT id, name, parent FROM #__k2_categories WHERE id = ".$id); $rows = $database->loadRow(); $name = (($this->params->get('categoryid_inc', '0') != '0') ? $id.'-' : '').$rows[1]; array_unshift($categories, $name); $id = $rows[2]; if ($cats == '1') break; } return $categories; } function getItemTitle($id) { $database =& JFactory::getDBO(); $database->setQuery("SELECT id, title, catid FROM #__k2_items WHERE id =".$id); $rows = $database->loadRow(); $category = $this->getCategoryTitle($rows[2]); $name = (($this->params->get('itemid_inc', '0') != '0') ? $id.'-' : '').$rows[1]; array_push($category, $name); return $category; } function getAuthorTitle($id) { $database =& JFactory::getDBO(); $database->setQuery ( 'SELECT id, name FROM #__users WHERE id = '.$id); $rows = $database->loadRow(); $name = (($this->params->get('authorid_inc', '0') != '0') ? $id.'-' : '').$rows[1]; return $name; } function googleNews($title, $id) { $num = ''; $add = $this->params->get('google_news', '0'); if($add == '1') { // Article ID $digits = trim($this->params->get('google_news_digits', '2')); if(!is_numeric($digits)) { $digits = '3'; } $num = sprintf('%0'.$digits.'d', $id); } else if($add == '2') { // Publish date $db =& JFactory::getDBO(); $query = "SELECT `publish_up` FROM `#__k2_items` WHERE `id` = '$id'"; $db->setQuery($query); $time = $db->loadResult(); $time = strtotime($time); $date = $this->params->get('google_news_dateformat', 'ddmm'); $search = array('dd', 'd', 'mm', 'm', 'yyyy', 'yy'); $replace = array(date('d', $time), date('j', $time), date('m', $time), date('n', $time), date('Y', $time), date('y', $time)); $num = str_replace($search, $replace, $date); } if(!empty($num)) { $sefConfig =& SEFConfig::getConfig(); $sep = $sefConfig->replacement; $where = $this->params->get('google_news_pos', '1'); if($where == '1') { $title = $title.$sep.$num; } else { $title = $num.$sep.$title; } } return $title; } function beforeCreate(&$uri) { // Remove the part after ':' from variables if(!is_null($uri->getVar('id'))) SEFTools::fixVariable($uri, 'id'); if(!is_null($uri->getVar('layout'))) $uri->delVar('layout'); return; } function create(&$uri) { $vars = $uri->getQuery(true); extract($vars); $title = array(); $this->params = SEFTools::getExtParams('com_k2'); $title[] = JoomSEF::_getMenuTitle(@$option, @$task, @$Itemid); if(isset($view)) { switch($view) { case 'itemlist': unset($view); break; case 'item': if(isset($id)) $title = array_merge($title, $this->getItemTitle($id)); if($this->params->get('google_news', '0') != '0') { $i = count($title) - 1; $title[$i] = $this->googleNews($title[$i], $id); } unset($view); break; default: $title[] = $view; } } if(isset($task)){ switch($task){ case 'category': if(isset($id)) $title = array_merge($title, $this->getCategoryTitle($id)); unset($task); break; case 'tag': $title = null; $title[] = JText::_('TAGS'); if(isset($tag)) $title[] = $tag; unset($task); break; case 'user': $title[] = JText::_('Author'); if(isset($id)) $title[] = $this->getAuthorTitle($id); unset($task); break; case 'edit': if(isset($cid)) $title = array_merge($title, $this->getItemTitle($cid)); $title[] = JText::_('Edit'); unset($task); break; case 'search': $title[] = JText::_('Search'); if (!empty($searchword)) $title[] = $searchword; unset($task); unset($searchword); break; case 'date': $title[] = 'date'; if (!empty($year)) $title[] = $year; if (!empty($month)) $title[] = $month; if (!empty($day)) $title[] = $day; unset($task); unset($year); unset($month); unset($day); break; default: $title[] = $task; } } if (isset($format)) $title[] = $format; if (isset($type)) $title[] = $type; if (isset($print) && $print == '1') $title[] = JText::_('PRINT'); $nonSefVars = array(); if (isset($limit)) $nonSefVars['limit'] = $limit; if (isset($limitstart)) $nonSefVars['limitstart'] = $limitstart; $newUri = $uri; if (count($title) > 0) $newUri = JoomSEF::_sefGetLocation($uri, $title, @$task, @$limit, @$limitstart, @$lang, $nonSefVars); return $newUri; } } ?>
| ver. 1.4 |
Github
|
.
| PHP 5.4.45-1~dotdeb+6.1 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка