Люди помогите, как сделать чтоб плагин выводил "Упорядочить по алфавиту","Сортировать по Теги" не друг под другом , а в 2 колонки
<?php
/*------------------------------------------------------------------------
# elite_related_news.php - Plugin eRelated News
# ------------------------------------------------------------------------
# author E-Content Site
# copyright Copyright (C) 2010 econtentsite.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.econtentsite.com
# Technical Support: Forum - http://forum.econtentsite.com
-------------------------------------------------------------------------*/
// no direct access
defined ( '_JEXEC' ) or die ( 'Restricted access' );
jimport ( 'joomla.plugin.plugin' );
class plgContentElite_Related_News extends JPlugin {
function plgContentElite_Related_News(&$subject, $params) {
parent::__construct ( $subject, $params );
}
function onPrepareContent(&$article, &$params, $limitstart) {
global $mainframe, $option;
if ((JRequest::getString('view','')!='article') || ($option != 'com_content') || (!$article->id)) {
return false;
}
$plugin =& JPluginHelper::getPlugin('content', 'elite_related_news');
$plg_param = new JParameter( $plugin->params );
$nonsection = $plg_param->get('nodisplaysection','');
$noncategory= $plg_param->get('nodisplaycategory', '');
$arr_nonsection = explode(',', $nonsection);
$arr_noncategory = explode(',', $noncategory);
if (is_int(array_search($article->sectionid, $arr_nonsection)) || is_int(array_search($article->catid, $arr_noncategory))) {
return false;
}
$lang =& JFactory::getLanguage();
$lang->load('plg_content_elite_related_news', JPATH_ADMINISTRATOR);
require_once (JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'elite_related_news' . DS . 'autocuttext.php');
$show['created'] = intval($plg_param->get ( 'showcreated', 0 ));
$obj = new stdClass();
$obj->key = intval($plg_param->get ( 'createdposition', 0 ));
$obj->value = 'created';
$position[] = $obj;
$show['modified'] = intval($plg_param->get ( 'showmodified', 0 ));
$obj = new stdClass();
$obj->key = intval($plg_param->get ( 'alphabetposition', 0 ));
$obj->value = 'modified';
$position[] = $obj;
$show['alphabet'] = intval($plg_param->get ( 'showalphabet', 0 ));
$obj = new stdClass();
$obj->key = intval($plg_param->get ( 'alphabetposition', 0 ));
$obj->value = 'alphabet';
$position[] = $obj;
$show['randomize'] = intval($plg_param->get ( 'showrandomize', 0 ));
$obj = new stdClass();
$obj->key = intval($plg_param->get ( 'randomizeposition', 0 ));
$obj->value = 'randomize';
$position[] = $obj;
$show['ordering'] = intval($plg_param->get ( 'showordering', 0 ));
$obj = new stdClass();
$obj->key = intval($plg_param->get ( 'orderingposition', 0 ));
$obj->value = 'ordering';
$position[] = $obj;
$show['ordertag'] = intval($plg_param->get ( 'showordertag', 0 ));
$obj = new stdClass();
$obj->key = intval($plg_param->get ( 'ordertagposition', 0 ));
$obj->value = 'ordertag';
$position[] = $obj;
for ($i = 0; $i < count($position)-1; $i++) {
for ($j = $i+1; $j < count($position); $j++) {
if ($position[$i]->key>$position[$j]->key) {
$tmp = $position[$i];
$position[$i] = $position[$j];
$position[$j] = $tmp;
}
}
}
$document = & JFactory::getDocument ();
$document->addStyleDeclaration ( "
.erelated_news {
border-bottom: 1px solid #D2DADB;
border-top: 1px solid #D2DADB;
margin: 18px 0 0 !important;
padding: 9px 0 0 5px !important;
}
.erelated_footer {
background: none repeat scroll 0 0 transparent !important;
float: right;
margin: 0;
padding: 0;
text-decoration: none !important;
text-transform: none;
}
.erelated_footer a {
background-color: inherit;
color: #CCCCCC !important;
font: 9px Verdana,Arial,Sans-Serif !important;
}
.erelated_tags {
border-top: 1px solid #D2DADB;
margin: 18px 0 0 !important;
padding: 9px 0 0 5px !important;
font-weight: bold;
}
");
$enabletags = intval($plg_param->get ( 'enabletags', 1 ));
if ($enabletags) {
$tags = $this->tagsGenerated($article, $plg_param, $limitstart);
$tagsdisplay = $this->tagDisplay($tags);
$article->text .= $tagsdisplay;
$article->metakey = implode(', ', $tags);
}
$autodescription = intval($plg_param->get ( 'autodescription', 1 ));
if ($autodescription) {
$metadesc = $this->autoDescription($article, $plg_param, $limitstart);
if ($metadesc) {
$article->metadesc = $metadesc;
}
}
foreach ($position as $item) {
if ($item->value=='created' && $show['created']) {
$buffer=$this->getOrderCreated($article, $plg_param, $limitstart);
$article->text.=$buffer;
}
if ($item->value=='modified' && $show['modified']) {
$buffer=$this->getOrderModified($article, $plg_param, $limitstart);
$article->text.=$buffer;
}
if ($item->value=='alphabet' && $show['alphabet']) {
$buffer=$this->getOrderAlphabet($article, $plg_param, $limitstart);
$article->text.=$buffer;
}
if ($item->value=='randomize' && $show['randomize']) {
$buffer=$this->getOrderRandomize($article, $plg_param, $limitstart);
$article->text.=$buffer;
}
if ($item->value=='ordering' && $show['ordering']) {
$buffer=$this->getOrderOrdering($article, $plg_param, $limitstart);
$article->text.=$buffer;
}
if ($item->value=='ordertag' && $show['ordertag']) {
if (!$enabletags) {
$tags = $this->tagsGenerated($article, $plg_param, $limitstart);
}
$buffer=$this->getOrderOrderTag($article, $plg_param, $limitstart, $tags);
$article->text.=$buffer;
}
}
}
function autoDescription(&$article, &$params, $limitstart){
if (trim($article->metadesc)!= ''){
return false;
}
$wordnumber = intval($params->get ( 'descriptionword', 1 ));
$text = new AutoCutText ( $article->text, $wordnumber );
$introtext = strip_tags ( $text->getIntro () );
return $introtext;
}
function tagDisplay($tags){
$buffer = '<div class="erelated_tags">'.JText::_('Tags').':';
for ($i = 0; $i < count($tags); $i++) {
$tag = trim($tags[$i]);
if ($tag) {
$buffer .= ' <a href='.JRoute::_('index.php?option=com_search&searchword='.$tag.'&searchphrase=exact').' target="_blank">'.$tag.'</a> ';
}
}
$buffer .= '</div>';
return $buffer;
}
function tagsGenerated(&$article, &$params, $limitstart) {
global $mainframe, $option;
$autokeyword = intval($params->get ( 'autokeyword', 1 ));
$keyword = explode(',', $article->metakey);
$keyword = trim($keyword[0]) == '' ? array() : $keyword;
$defaultkeyword = $params->get ( 'defaultkeyword', '' );
$defaultkeyword = explode(',', $defaultkeyword);
$defaultkeyword = (trim($defaultkeyword[0]) == '')? array() : $defaultkeyword;
$blacklistkeyword = $params->get ( 'blacklistkeyword', '' );
$articletmp = strip_tags($article->text);
if (!$autokeyword) {
for ($i = 0; $i < count($defaultkeyword); $i++) {
$str_default = trim($defaultkeyword[$i]);
if ($str_default=='') {
continue;
}
if (@preg_match('/'. $str_default .'/i', $article->metakey)) {
continue;
}
if (@preg_match('/'. $str_default .'/i', $blacklistkeyword)) {
continue;
}
if (@preg_match('/'. $str_default .'/i', $articletmp)) {
$keyword [] = $str_default;
}
}
return $keyword;
}
$db = &JFactory::getDBO();
$query = "SELECT * FROM #__core_log_searches WHERE search_term<>''";
$db->setQuery($query);
$rows = $db->loadObjectList();
for ($i = 0; $i < count($rows); $i++) {
$search_term = trim($rows[$i]->search_term);
if ($search_term=='') {
continue;
}
if (@preg_match('/'. $search_term .'/i', $article->metakey, $match)) {
continue;
}
if (@preg_match('/'. $search_term .'/i', $blacklistkeyword)) {
continue;
}
if (@preg_match('/'.$search_term.'/i', $articletmp, $match)) {
$keyword[] = $search_term;
}
}
$str_keyword = implode(' , ', $keyword);
for ($i = 0; $i < count($defaultkeyword); $i++) {
$str_default = trim($defaultkeyword[$i]);
if ($str_default=='') {
continue;
}
if (@preg_match('/'. $str_default .'/i', $blacklistkeyword)) {
continue;
}
if (@preg_match('/'. $str_default .'/i', $str_keyword)) {
continue;
}
if (@preg_match('/'. $str_default .'/i', $articletmp)) {
$keyword [] = $str_default;
}
}
return $keyword;
}
function makeClean($data) {
$str = preg_replace('/<.*?a.*?>/i', '', $data);
$str = preg_replace('/<img.*?>/i', '', $data);
$str = preg_replace('/<.*?script.*?>/i', '', $data);
}
function getOrderCreated(&$article, &$params, $limitstart) {
$arr ['numberview'] = $params->get ( 'creatednumberview', 10 );
$arr ['showtitle'] = $params->get ( 'createdshowtitle', 1 );
$arr ['c_title'] = $params->get ( 'createdtitle', '' );
$arr ['showdate'] = $params->get ( 'showdate', 1 );
$arr ['separate'] = $params->get ( 'separate', '' );
$arr ['dateformat'] = $params->get ( 'dateformat', '' );
$arr ['showcategory'] = $params->get ( 'createdshowcategory', 0 );
$arr ['recent'] = $params->get ( 'createdrecent', 'lastest' );
$arr ['nosection'] = $params->get ( 'createdsection', '' );
$arr ['nocategory'] = $params->get ( 'createdcategory', '' );
$arr ['showtip'] = $params->get ( 'showtip', 1 );
$arr ['numberword'] = $params->get ( 'numberword', 50 );
$arr ['displaytip'] = $params->get ( 'displaytip', 0 );
$arr ['tipstyle'] = $params->get ( 'tipstyle', 0 );
$arr ['width'] = $params->get ( 'width', 250 );
$arr ['custom_tip'] = $params->get ( 'custom_tip', '' );
$arr ['custom_title'] = $params->get ( 'custom_title', '' );
$arr ['custom_text'] = $params->get ( 'custom_text', '' );
$arr ['effect'] = $params->get ( 'effect', 1 );
$arr ['showdelay'] = $params->get ( 'showdelay', 0 );
$arr ['hidedelay'] = $params->get ( 'hidedelay', 0 );
$arr ['order'] = 'created';
return $this->getData($article->id, $arr);
}
function getOrderModified(&$article, &$params, $limitstart){
$arr ['numberview'] = $params->get ( 'modifiednumberview', 10 );
$arr ['showtitle'] = $params->get ( 'modifiedshowtitle', 1 );
$arr ['c_title'] = $params->get ( 'modifiedtitle', '' );
$arr ['showdate'] = $params->get ( 'showdate', 1 );
$arr ['separate'] = $params->get ( 'separate', '' );
$arr ['dateformat'] = $params->get ( 'dateformat', '' );
$arr ['showcategory'] = $params->get ( 'modifiedshowcategory', 0 );
$arr ['recent'] = $params->get ( 'modifiedrecent', 'lastest' );
$arr ['nosection'] = $params->get ( 'modifiedsection', '' );
$arr ['nocategory'] = $params->get ( 'modifiedcategory', '' );
$arr ['showtip'] = $params->get ( 'showtip', 1 );
$arr ['numberword'] = $params->get ( 'numberword', 50 );
$arr ['displaytip'] = $params->get ( 'displaytip', 0 );
$arr ['tipstyle'] = $params->get ( 'tipstyle', 0 );
$arr ['width'] = $params->get ( 'width', 250 );
$arr ['custom_tip'] = $params->get ( 'custom_tip', '' );
$arr ['custom_title'] = $params->get ( 'custom_title', '' );
$arr ['custom_text'] = $params->get ( 'custom_text', '' );
$arr ['effect'] = $params->get ( 'effect', 1 );
$arr ['showdelay'] = $params->get ( 'showdelay', 0 );
$arr ['hidedelay'] = $params->get ( 'hidedelay', 0 );
$arr ['order'] = 'modified';
return $this->getData($article->id, $arr);
}
function getOrderAlphabet(&$article, &$params, $limitstart){
$arr ['numberview'] = $params->get ( 'alphabetnumberview', 10 );
$arr ['showtitle'] = $params->get ( 'alphabetshowtitle', 1 );
$arr ['c_title'] = $params->get ( 'alphabettitle', '' );
$arr ['showdate'] = $params->get ( 'showdate', 1 );
$arr ['separate'] = $params->get ( 'separate', '' );
$arr ['dateformat'] = $params->get ( 'dateformat', '' );
$arr ['showcategory'] = $params->get ( 'alphabetshowcategory', 0 );
$arr ['recent'] = $params->get ( 'alphabetrecent', 'lastest' );
$arr ['nosection'] = $params->get ( 'alphabetsection', '' );
$arr ['nocategory'] = $params->get ( 'alphabetcategory', '' );
$arr ['showtip'] = $params->get ( 'showtip', 1 );
$arr ['numberword'] = $params->get ( 'numberword', 50 );
$arr ['displaytip'] = $params->get ( 'displaytip', 0 );
$arr ['tipstyle'] = $params->get ( 'tipstyle', 0 );
$arr ['width'] = $params->get ( 'width', 250 );
$arr ['custom_tip'] = $params->get ( 'custom_tip', '' );
$arr ['custom_title'] = $params->get ( 'custom_title', '' );
$arr ['custom_text'] = $params->get ( 'custom_text', '' );
$arr ['effect'] = $params->get ( 'effect', 1 );
$arr ['showdelay'] = $params->get ( 'showdelay', 0 );
$arr ['hidedelay'] = $params->get ( 'hidedelay', 0 );
$arr ['order'] = 'title';
return $this->getData($article->id, $arr);
}
function getOrderOrdering(&$article, &$params, $limitstart){
$arr ['numberview'] = $params->get ( 'orderingnumberview', 10 );
$arr ['showtitle'] = $params->get ( 'orderingshowtitle', 1 );
$arr ['c_title'] = $params->get ( 'orderingtitle', '' );
$arr ['showdate'] = $params->get ( 'showdate', 1 );
$arr ['separate'] = $params->get ( 'separate', '' );
$arr ['dateformat'] = $params->get ( 'dateformat', '' );
$arr ['showcategory'] = $params->get ( 'orderingshowcategory', 0 );
$arr ['recent'] = $params->get ( 'orderingrecent', 'lastest' );
$arr ['nosection'] = $params->get ( 'orderingsection', '' );
$arr ['nocategory'] = $params->get ( 'orderingcategory', '' );
$arr ['showtip'] = $params->get ( 'showtip', 1 );
$arr ['numberword'] = $params->get ( 'numberword', 50 );
$arr ['displaytip'] = $params->get ( 'displaytip', 0 );
$arr ['tipstyle'] = $params->get ( 'tipstyle', 0 );
$arr ['width'] = $params->get ( 'width', 250 );
$arr ['custom_tip'] = $params->get ( 'custom_tip', '' );
$arr ['custom_title'] = $params->get ( 'custom_title', '' );
$arr ['custom_text'] = $params->get ( 'custom_text', '' );
$arr ['effect'] = $params->get ( 'effect', 1 );
$arr ['showdelay'] = $params->get ( 'showdelay', 0 );
$arr ['hidedelay'] = $params->get ( 'hidedelay', 0 );
$arr ['order'] = 'ordering';
return $this->getData($article->id, $arr);
}
function getOrderRandomize(&$article, &$params, $limitstart){
$arr ['numberview'] = $params->get ( 'randomizenumberview', 10 );
$arr ['showtitle'] = $params->get ( 'randomizeshowtitle', 1 );
$arr ['c_title'] = $params->get ( 'randomizetitle', '' );
$arr ['showdate'] = $params->get ( 'showdate', 1 );
$arr ['separate'] = $params->get ( 'separate', '' );
$arr ['dateformat'] = $params->get ( 'dateformat', '' );
$arr ['showcategory'] = $params->get ( 'randomizeshowcategory', 0 );
$arr ['recent'] = 'randomize';
$arr ['nosection'] = $params->get ( 'randomizesection', '' );
$arr ['nocategory'] = $params->get ( 'randomizecategory', '' );
$arr ['showtip'] = $params->get ( 'showtip', 1 );
$arr ['numberword'] = $params->get ( 'numberword', 50 );
$arr ['displaytip'] = $params->get ( 'displaytip', 0 );
$arr ['tipstyle'] = $params->get ( 'tipstyle', 0 );
$arr ['width'] = $params->get ( 'width', 250 );
$arr ['custom_tip'] = $params->get ( 'custom_tip', '' );
$arr ['custom_title'] = $params->get ( 'custom_title', '' );
$arr ['custom_text'] = $params->get ( 'custom_text', '' );
$arr ['effect'] = $params->get ( 'effect', 1 );
$arr ['showdelay'] = $params->get ( 'showdelay', 0 );
$arr ['hidedelay'] = $params->get ( 'hidedelay', 0 );
$arr ['order'] = 'randomize';
return $this->getData($article->id, $arr);
}
function getOrderOrderTag(&$article, &$params, $limitstart, $tags){
$arr ['numberview'] = $params->get ( 'ordertagnumberview', 10 );
$arr ['showtitle'] = $params->get ( 'ordertagshowtitle', 1 );
$arr ['c_title'] = $params->get ( 'ordertagtitle', '' );
$arr ['showdate'] = $params->get ( 'showdate', 1 );
$arr ['separate'] = $params->get ( 'separate', '' );
$arr ['dateformat'] = $params->get ( 'dateformat', '' );
$arr ['showcategory'] = $params->get ( 'ordertagshowcategory', 0 );
$arr ['recent'] = $params->get ( 'ordertagrecent', 'lastest' );
$arr ['nosection'] = $params->get ( 'ordertagsection', '' );
$arr ['nocategory'] = $params->get ( 'ordertagcategory', '' );
$arr ['showtip'] = $params->get ( 'showtip', 1 );
$arr ['numberword'] = $params->get ( 'numberword', 50 );
$arr ['displaytip'] = $params->get ( 'displaytip', 0 );
$arr ['tipstyle'] = $params->get ( 'tipstyle', 0 );
$arr ['width'] = $params->get ( 'width', 250 );
$arr ['custom_tip'] = $params->get ( 'custom_tip', '' );
$arr ['custom_title'] = $params->get ( 'custom_title', '' );
$arr ['custom_text'] = $params->get ( 'custom_text', '' );
$arr ['effect'] = $params->get ( 'effect', 1 );
$arr ['showdelay'] = $params->get ( 'showdelay', 0 );
$arr ['hidedelay'] = $params->get ( 'hidedelay', 0 );
$arr ['tags']= $tags;
$arr ['order'] = 'ordertag';
return $this->getData($article->id, $arr);
}
function getData($id, $arr) {
global $mainframe, $Itemid;
$numberview = $arr ['numberview'];
$showtitle = $arr ['showtitle'];
$c_title = $arr ['c_title'];
$order = $arr ['order'];
$showdate = $arr ['showdate'];
$separate = $arr ['separate'];
$dateformat = $arr ['dateformat'];
$category = $arr ['showcategory'];
$recent = $arr ['recent'];
$nosection = $arr ['nosection'];
$nocategory = $arr ['nocategory'];
$showtip = $arr ['showtip'];
$numberword = $arr ['numberword'];
$displaytip = $arr ['displaytip'];
$tipstyle = $arr ['tipstyle'];
$width = $arr ['width'];
$custom_tip = $arr ['custom_tip'];
$custom_title = $arr ['custom_title'];
$custom_text = $arr ['custom_text'];
$effect = $arr ['effect'];
$showdelay = $arr ['showdelay'];
$hidedelay = $arr ['hidedelay'];
$row = &JTable::getInstance ( 'content' );
$row->load ( $id );
$db = &JFactory::getDBO ();
$where = array ();
$where [] = "id != $row->id";
$jnow = & JFactory::getDate ();
$now = $jnow->toMySQL ();
$nullDate = $db->getNullDate ();
$where [] .= ' ( state = 1' . ' AND ( publish_up = ' . $db->Quote ( $nullDate ). ' OR publish_up <= ' . $db->Quote ( $now ). ' )' . ' AND ( publish_down = ' . $db->Quote ( $nullDate ). ' OR publish_down >= ' . $db->Quote ( $now ). ' )' . ' ) ';
if ($order != 'ordertag') {
$where [] = "catid = " . $row->catid;
}
switch ($recent) {
case 'newer' :
if ($order == 'ordertag') {
$where [] = " created >= '" . $row->created . "'";
} elseif ($order != 'title' && $order != 'ordering'){
$where [] = " $order >= '" . $row->$order . "'";
} elseif ($order == 'ordering' || $order == 'title') {
$where [] = " $order <= '" . $row->$order . "'";
}
break;
case 'older' :
if ($order == 'ordertag'){
$where [] = " created <= '" . $row->created . "'";
} elseif ($order != 'title' && $order != 'ordering'){
$where [] = " $order <= '" . $row->$order . "'";
} elseif ($order == 'ordering' || $order == 'title') {
$where [] = " $order >= '" . $row->$order . "'";
}
break;
case 'randomize':
case 'lastest' :
default :
break;
}
if ($nosection) {
$where [] = " NOT (sectionid in ($nosection)) ";
}
if ($nocategory) {
$where [] = " NOT (catid in ($nocategory)) ";
}
if ($order == 'ordertag') {
$ordercmd = 'created';
} else {
$ordercmd = $order;
}
if ($order == 'title' || $order == 'ordering') {
$ordercmd .= ' ASC';
} else {
$ordercmd .= ' DESC';
}
if ($order == 'ordertag') {
$tags = $arr ['tags'];
for ($i = 0; $i < count($tags); $i++) {
$tags[$i] = " `introtext` LIKE '%".$tags[$i]."%' OR `fulltext` LIKE '%".$tags[$i]."%' ";
}
$where [] = '('.implode(' OR ', $tags).')';
}
$where_str = implode ( ' AND ', $where );
if ($order=='randomize') {
$query = "SELECT * FROM #__content WHERE " . $where_str;
} else {
$query = "SELECT * FROM #__content WHERE " . $where_str . " ORDER BY " . $ordercmd;
}
$db->setQuery ( $query );
$rows = $db->loadObjectList ();
if (! count ( $rows )) {
return false;
}
$classname = uniqid ( 'erelated_' );
JHTML::_ ( 'behavior.tooltip' );
$document = & JFactory::getDocument ();
$effect_script = $effect ? "initialize:function(){this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0);},onShow: function(toolTip) {this.fx.start(1);},onHide: function(toolTip) { this.fx.start(0);}," : '';
if (! $tipstyle) {
$document->addStyleDeclaration ( "
.$classname-tip {
color: #000;
width: " . $width . "px;
z-index: 13000;
}
.$classname-title {
font-weight: bold;
font-size: 11px;
margin: 0;
color: #000000;
padding: 8px 8px 4px;
background: #FFFFFF;
border-bottom: 1px solid #D2DADB;
border-top: 1px solid #D2DADB;
border-left: 1px solid #D2DADB;
border-right: 1px solid #D2DADB;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
}
.$classname-text {
font-size: 11px;
padding: 4px 8px 8px;
background: #FFFFFF;
border-bottom: 1px solid #D2DADB;
border-right: 1px solid #D2DADB;
border-left: 1px solid #D2DADB;
-moz-border-radius-bottomleft: 5px;
-moz-border-radius-bottomright: 5px;
}
" );
?>
<script type="text/javascript">
window.addEvent('load', function(){
var <?php echo $classname;?> = new Tips($$('.<?php echo $classname; ?>'), {<?php echo $effect_script;?>
showDelay: <?php echo $showdelay;?>,
hideDelay: <?php echo $hidedelay;?>,
className: '<?php echo $classname;?>'
});
});
</script>
<?php
} else {
$document->addStyleDeclaration ( "
.$classname-tip {
width: " . $width . "px;
$custom_tip
}
.$classname-title {
$custom_title
}
.$classname-text {
$custom_text
}
" );
?>
<script type="text/javascript">
window.addEvent('load', function(){
var <?php echo $classname;?> = new Tips($$('.<?php echo $classname; ?>'),{<?php echo $effect_script;?>
showDelay: <?php echo $showdelay;?>,
hideDelay: <?php echo $hidedelay;?>,
className: '<?php echo $classname;?>'
});
});
</script>
<?php
}
switch ($recent) {
case 'newer' :
$start = count ( $rows ) - $numberview;
$start = ($start < 0)? 0 : $start;
$data = array_slice ( $rows, $start, $numberview );
$title = JText::_ ( 'MORE_RECENT_ARTICLES' );
break;
case 'older' :
$data = array_slice ( $rows, 0, $numberview );
$title = JText::_ ( 'OLDER_ARTICLES' );
break;
case 'randomize':
$rows = $this->shuffle_assoc($rows);
$data = array_slice ( $rows, 0, $numberview );
$title = JText::_ ( 'OTHER_ARTICLES' );
break;
case 'lastest' :
default :
$data = array_slice ( $rows, 0, $numberview );
$title = JText::_( 'LATEST_ARTICLES' );
break;
}
switch ($order) {
case 'created' :
$datetitle = JText::_ ( 'DATETILECREATE' );
break;
case 'modified' :
$datetitle = JText::_ ( 'DATETILEMODIFIED' );
break;
default :
$datetitle = JText::_ ( 'DATETILECREATE' );
break;
}
$category_row = &JTable::getInstance('category');
$category_row->load($row->catid);
$title = ($c_title == '')? $title : $c_title;
$title = (intval($category))? $title.' - '.$category_row->title : $title;
$title = intval ( $showtitle )? $title : '';
$buffer = "<div class=\"erelated_news\"><span><b>" . $title . "</b></span><ul style=\"text-align:left;\">";
for($i = 0; $i < count ( $data ); $i ++) {
$introtext = $data [$i]->introtext;
switch ($displaytip) {
case 0:
$introtext = strip_tags ( $introtext );
$introtext = $this->filterintro ( $introtext, $numberword );
break;
case 1:
preg_match('/<img.*?src="(.*?)".*>/i', $introtext, $match);
$imagetip = '';
if (count($match)) {
$imglink = $this->makelink(JURI::root(),$match[1]);
$imagetip = htmlspecialchars('<img title="'.$data [$i]->title.'" alt="'.$data [$i]->title.'" src="'.$imglink.'" border="0" style="float: left; padding: 5px; width: '.round($width/3).'px;" />');
}
$introtext = strip_tags ( $introtext );
$introtext = $imagetip.$this->filterintro ( $introtext, $numberword );
break;
case 2:
default:
$text = new AutoCutText ( $introtext, $numberword );
$introtext = htmlspecialchars ( $text->getIntro () );
break;
}
$dateshow = $order=='modified' ? $data [$i]->modified : $data [$i]->created;
switch ($showdate) {
case 1 :
$before = ' ';
$after = ' ';
break;
case 2 :
$before = '<small>('. $datetitle . ' ' . date ( $dateformat, strtotime ( $dateshow ) ). ') ' . $separate . '</small> ';
$after = ' ';
break;
case 3 :
$before = ' ';
$after = ' <small>'. $separate . ' (' . $datetitle . ' ' . date ( $dateformat, strtotime ( $dateshow ) ). ')</small>';
break;
default :
$before = ' ';
$after = ' ';
break;
}
if ($showtip) {
$buffer .= '
<li>
' . $before . '<a class="' . $classname . '" title="' . htmlspecialchars ( $data [$i]->title ). '::' . $introtext . '..." href="' . JRoute::_ ( "index.php?option=com_content&view=article&id=" . $data [$i]->id . ':' . $data [$i]->alias . '&catid=' . $data [$i]->catid . '&Itemid=' . $Itemid ). '">' . $data [$i]->title . '</a> ' . $after . '
</li>';
} else {
$buffer .= '
<li>
' . $before . '<a href="' . JRoute::_ ( "index.php?option=com_content&view=article&id=" . $data [$i]->id . ':' . $data [$i]->alias . '&catid=' . $data [$i]->catid . '&Itemid=' . $Itemid ). '">' . $data [$i]->title . '</a> ' . $after . '
</li>';
}
}
$buffer .= '<div class="erelated_footer"><a target="_blank" title="Секс форум" href="http://institutsexa.ru/forum/index.html">Секс форум</a></div>';
$buffer .= "</ul></div>";
return $buffer;
}
function shuffle_assoc($list) {
if (!is_array($list)) return $list;
$keys = array_keys($list);
shuffle($keys);
$random = array();
foreach ($keys as $key)
$random[$key] = $list[$key];
return $random;
}
function filterintro($introtext, $numberword) {
$arr_text = preg_split ( '/ /', trim ( $introtext ) );
$newarray = array_slice ( $arr_text, 0, $numberword );
$text = implode ( ' ', $newarray );
return $text;
}
function makelink($host='', $link){
if (preg_match('/^http:\/\/.*/i', $link) || preg_match('/^mailto:.*/i', $link)) {
return $link;
} elseif (preg_match('/^\/.*/i', $link)) {
$referer = parse_url($host);
$domain = $referer['host'];
return 'http://'.$domain.$link;
} else{
$slash = strrpos($host, '/') + 1;
$host = substr($host,0, $slash);
return $host.$link;
}
}
}