| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Old Sites/eadsa/modules/mod_list_article/ |
Upload File : |
<?php
/**
* @version $Id: helper.php 8379 2007-08-10 23:20:01Z eddieajau $
* @package Joomla
* @copyright Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
* Camp26.com
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
class modListArticleHelper {
function getData($id, $params){
global $mainframe, $Itemid;
$feature = $params->get('feature',3);
$mycategory = $params->get('mycategory',0);
$mysection = $params->get('mysection',0);
$numberview = $params->get('numberview',10);
$showtitle = $params->get('showtitle', 1);
$c_title = $params->get('title','');
$order = $params->get('order', 'created');
$showdate = $params->get('showdate',1);
$separate = $params->get('separate','');
$dateformat = $params->get('dateformat','');
$category = $params->get('category',0);
$recent = $params->get('recent','lastest');
$showtip = $params->get('showtip',1);
$numberword = $params->get('numberword', 300);
$cleantext = $params->get('cleantext',0);
$tipstyle = $params->get('tipstyle', 0);
$width = $params->get('width', 250);
$custom_tip = $params->get('custom_tip','');
$custom_title = $params->get('custom_title','');
$custom_text = $params->get('custom_text','');
$effect = $params->get('effect',1);
$showdelay = $params->get('showdelay',0);
$hidedelay = $params->get('hidedelay',0);
$row = &JTable::getInstance('content');
$row->load($id);
$category_row = &JTable::getInstance('category');
$category_row->load($row->catid);
$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).' )'.
' ) ';
switch ($feature) {
case 1:
if($mycategory) $where[] = ' catid='.$mycategory;
else return '';
break;
case 2:
if($mysection) $where[] = ' sectionid='.$mysection;
else return '';
break;
case 3:
default:
$where[] = "catid = ".$row->catid;
switch ($recent){
case 'newer':
if($order !='title' && $order !='ordering')
$where[] = " $order >= '".$row->$order."'";
break;
case 'older':
if($order !='title' && $order !='ordering')
$where[] = " $order <= '".$row->$order."'";
break;
case 'lastest':
default:
break;
}
break;
}
$where_str = implode(' AND ',$where);
if($order =='title' || $order == 'ordering'){
$order .= ' ASC';
}
else {
$order .= ' DESC';
}
$query = "SELECT * FROM #__content WHERE ".$where_str." ORDER BY ".$order;
$db->setQuery($query);
$rows = $db->loadObjectList();
if (!count($rows)) {
return false;
}
require_once(JPATH_SITE.DS.'modules'.DS.'mod_list_article'.DS.'helpers'.DS.'autocuttext.php');
$classname = uniqid('yos_article_');
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: #3E4F14;
padding: 8px 8px 4px;
background: #C3DF7D;
border-bottom: 1px solid #B5CF74;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
}
.$classname-text {
font-size: 11px;
padding: 4px 8px 8px;
background: #CFDFA7;
-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 '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::_(' ');
break;
}
$title = ($c_title=='') ? $title : $c_title;
$title = (intval($category)&&$feature==1) ? $title.' '.$category_row->title : $title;
$title = intval($showtitle) ? $title : '';
$buffer="<div class=\"yos_list_article\"><span><b>".$title."</b></span><ul style=\"text-align:left;\">";
for ($i = 0; $i<count($data); $i++){
$introtext = $data[$i]->introtext;
if ($cleantext) {
JFilterOutput::cleanText($introtext);
$introtext = $this->filterintro($introtext, $numberword);
} else {
$text = new AutoCutText($introtext, $numberword);
$introtext = htmlspecialchars($text->getIntro());
}
switch ($showdate) {
case 1:
$before = ' ';
$after = ' ';
break;
case 2:
$before = $datetitle.' '. date( $dateformat,strtotime( $data[$i]->created)).' '.$separate.' ';
$after = ' ';
break;
case 3:
$before = ' ';
$after = $separate.' '.$datetitle.' '. date( $dateformat,strtotime( $data[$i]->created));
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.="</ul></div>";
return $buffer;
}
function filterintro($introtext, $numberword){
$arr_text = preg_split('/ /',trim($introtext));
$newarray = array_slice($arr_text, 0, $numberword);
$text = implode(' ',$newarray);
return $text;
}
}