joomla_test/modules/mod_yahoostylenewsslider/helper.php

113 lines
4.1 KiB
PHP
Raw Normal View History

2020-01-02 22:20:31 +07:00
<?php
/**
* helper.php Social Crowd Module for Joomla
*
* @version 1.2
* @package mod_socialcrowd
* @author Sabuj kundu ( http://codeboxr.com )
* @copyright Copyright (C) 2011-2013 http://codeboxr.com. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @ help: http://codeboxr.com/product/social-crowd-for-joomla
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
//var_dump(JPATH_COMPONENT);
/*require_once (JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . 'article.php');*/
require_once JPATH_SITE.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_content'. DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . 'article.php';
require_once JPATH_SITE.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_content'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'route.php';
/**
* Social Crowd Module
*
* @package Joomla
* @subpackage Module
* @since 1.0
*/
class modYahooStyleNewsSlider{
/**
* Main Outout method
*
* Method is called from mod_socialcrowd.php
*
* @param object module params
* @param object module reference object
* @return string
*/
#
static function getOutput( $params, $module ) {
$output = '';
$enable_cache = $params->get('cache',0);
$cachetime = $params->get('cache_time',0);
$output = '';
$cacheparams = new stdClass;
$cacheparams->cachemode = 'safeuri';
$cacheparams->class = 'modYahooStyleNewsSlider';
$cacheparams->method = 'getContent';
$cacheparams->methodparams = array($params,$module);
$cacheparams->modeparams = array('id'=>'int','Itemid'=>'int');
$output = JModuleHelper::moduleCache ($module, $params, $cacheparams);
return $output;
}//end function getOutput
static function getContent($params, $module){
$output = new stdClass();
$output->content = '';
$output->error = array();
$component = $params->get('component','content');
$modulepath = JPATH_SITE.DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.'mod_yahoostylenewsslider'.DIRECTORY_SEPARATOR;
if($component == 'content'){
$filename = $modulepath.'yahoostylenewsslider'.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'content.php';
$com = JPATH_SITE.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_content'.DIRECTORY_SEPARATOR.'content.php';
if(!file_exists($com)){
$output->error[] = 'Content Component is not installed';
}else if(!file_exists($filename)){
$output->error[] = 'Content component support file missing';
}else{
require_once $filename;
$output->content = modYahooStyleNewsSliderContent::getItemContent($params, $module);
//var_dump(count($output->content));
}
}else if($component == 'k2'){
$filename = $modulepath.'yahoostylenewsslider'.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'k2.php';
$com = JPATH_SITE.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_k2'.DIRECTORY_SEPARATOR.'k2.php';
if(!file_exists($com)){
$output->error[] = 'K2 Component is not installed';
}else if(!file_exists($filename)){
$output->error[] = 'K2 component support is only for Premium Version Of the Module';
}else{
require_once $filename;
$output->content = modYahooStyleNewsSliderK2::getItemK2($params, $module);
}
}else{
$output->error[] = 'Selected Component Support has not been added in this version';
}
return $output;
}//end of getOutput function
} //end of class modYahooStyleNewsSlider
?>