uawdijnntqw1x1x1
IP : 216.73.216.84
Hostname : webm003.cluster107.gra.hosting.ovh.net
Kernel : Linux webm003.cluster107.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
OS : Linux
PATH:
/
home
/
opticamezl
/
www
/
newok
/
07d6c
/
.
/
.
/
..
/
api
/
..
/
modules
/
mod_responsive_slider
/
helper.php
/
/
<?php /** * @title Responsive Slider for Articles * @version 3.x * @copyright Copyright (C) 2011-2014 Minitek, All rights reserved. * @license GNU General Public License version 3 or later. * @author url http://www.minitek.gr/ * @author email info@minitek.gr * @developers Minitek.gr */ defined('_JEXEC') or die; jimport('joomla.filesystem.folder'); if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR); if( !defined('PhpThumbFactoryLoaded') ) { require_once dirname(__FILE__).DS.'admin'.DS.'phpthumb/ThumbLib.inc.php'; define('PhpThumbFactoryLoaded',1); } $com_path = JPATH_SITE.'/components/com_content/'; require_once $com_path.'router.php'; require_once $com_path.'helpers/route.php'; JModelLegacy::addIncludePath($com_path . '/models', 'ContentModel'); /** * Helper for mod_articles_category * * @package Joomla.Site * @subpackage mod_articles_category */ abstract class ResponsiveSliderHelper { public static function getList(&$params) { // Get an instance of the generic articles model $articles = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true)); // Set application parameters in model $app = JFactory::getApplication(); $appParams = $app->getParams(); $articles->setState('params', $appParams); // Set the filters based on the module params $articles->setState('list.start', 0); $articles->setState('list.limit', (int) $params->get('count', 0)); $articles->setState('filter.published', 1); // Access filter $access = !JComponentHelper::getParams('com_content')->get('show_noauth'); $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id')); $articles->setState('filter.access', $access); // Prep for Normal or Dynamic Modes $mode = $params->get('mode', 'normal'); switch ($mode) { case 'dynamic': $option = $app->input->get('option'); $view = $app->input->get('view'); if ($option === 'com_content') { switch($view) { case 'category': $catids = array($app->input->getInt('id')); break; case 'categories': $catids = array($app->input->getInt('id')); break; case 'article': if ($params->get('show_on_article_page', 1)) { $article_id = $app->input->getInt('id'); $catid = $app->input->getInt('catid'); if (!$catid) { // Get an instance of the generic article model $article = JModelLegacy::getInstance('Article', 'ContentModel', array('ignore_request' => true)); $article->setState('params', $appParams); $article->setState('filter.published', 1); $article->setState('article.id', (int) $article_id); $item = $article->getItem(); $catids = array($item->catid); } else { $catids = array($catid); } } else { // Return right away if show_on_article_page option is off return; } break; case 'featured': default: // Return right away if not on the category or article views return; } } else { // Return right away if not on a com_content page return; } break; case 'normal': default: $catids = $params->get('catid'); $articles->setState('filter.category_id.include', (bool) $params->get('category_filtering_type', 1)); break; } // Category filter if ($catids) { if ($params->get('show_child_category_articles', 0) && (int) $params->get('levels', 0) > 0) { // Get an instance of the generic categories model $categories = JModelLegacy::getInstance('Categories', 'ContentModel', array('ignore_request' => true)); $categories->setState('params', $appParams); $levels = $params->get('levels', 1) ? $params->get('levels', 1) : 9999; $categories->setState('filter.get_children', $levels); $categories->setState('filter.published', 1); $categories->setState('filter.access', $access); $additional_catids = array(); foreach ($catids as $catid) { $categories->setState('filter.parentId', $catid); $recursive = true; $items = $categories->getItems($recursive); if ($items) { foreach ($items as $category) { $condition = (($category->level - $categories->getParent()->level) <= $levels); if ($condition) { $additional_catids[] = $category->id; } } } } $catids = array_unique(array_merge($catids, $additional_catids)); } $articles->setState('filter.category_id', $catids); } // Ordering $articles->setState('list.ordering', $params->get('article_ordering', 'a.ordering')); $articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC')); // New Parameters $articles->setState('filter.featured', $params->get('show_front', 'show')); $articles->setState('filter.author_id', $params->get('created_by', "")); $articles->setState('filter.author_id.include', $params->get('author_filtering_type', 1)); $articles->setState('filter.author_alias', $params->get('created_by_alias', "")); $articles->setState('filter.author_alias.include', $params->get('author_alias_filtering_type', 1)); $excluded_articles = $params->get('excluded_articles', ''); if ($excluded_articles) { $excluded_articles = explode("\r\n", $excluded_articles); $articles->setState('filter.article_id', $excluded_articles); $articles->setState('filter.article_id.include', false); // Exclude } $date_filtering = $params->get('date_filtering', 'off'); if ($date_filtering !== 'off') { $articles->setState('filter.date_filtering', $date_filtering); $articles->setState('filter.date_field', $params->get('date_field', 'a.created')); $articles->setState('filter.start_date_range', $params->get('start_date_range', '1000-01-01 00:00:00')); $articles->setState('filter.end_date_range', $params->get('end_date_range', '9999-12-31 23:59:59')); $articles->setState('filter.relative_date', $params->get('relative_date', 30)); } // Filter by language $articles->setState('filter.language', $app->getLanguageFilter()); $items = $articles->getItems(); // Display options $show_date = $params->get('show_date', 0); $show_date_field = $params->get('show_date_field', 'created'); $show_date_format = $params->get('show_date_format', 'Y-m-d H:i:s'); $show_category = $params->get('show_category', 0); $show_hits = $params->get('show_hits', 0); $show_author = $params->get('show_author', 0); $show_introtext = $params->get('show_introtext', 0); $introtext_limit = $params->get('introtext_limit', 15); $title_limit = $params->get('title_limit', 15); $imageWidth = (int)$params->get( 'image_width', 864 ); $imageHeight = (int)$params->get( 'image_height', 354 ); $imageWidthth = (int)$params->get( 'thumb_width', 864 ); $imageHeightth = (int)$params->get( 'thumb_height', 354 ); // Find current Article ID if on an article page $option = $app->input->get('option'); $view = $app->input->get('view'); if ($option === 'com_content' && $view === 'article') { $active_article_id = $app->input->getInt('id'); } else { $active_article_id = 0; } // Prepare data for display using display options foreach ($items as &$item) { // General image $images = json_decode($item->images, true); if ($params->get('image_type')=='introtext') { $item->mainimage = $images['image_intro']; } else if ($params->get('image_type')=='fulltext') { $item->mainimage = $images['image_fulltext']; } else if ($params->get('image_type')=='inline') { preg_match('/<img.+src=[\'"](?P<src>.+)[\'"].*>/i', $item->introtext, $new_image); if (array_key_exists('src', $new_image)) { $item->mainimage = $new_image['src']; } else { $item->mainimage = $images['image_intro']; } } $item->slug = $item->id.':'.$item->alias; $item->catslug = $item->catid ? $item->catid .':'.$item->category_alias : $item->catid; if ($access || in_array($item->access, $authorised)) { // We know that user has the privilege to view the article $item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug)); } else { $app = JFactory::getApplication(); $menu = $app->getMenu(); $menuitems = $menu->getItems('link', 'index.php?option=com_users&view=login'); if (isset($menuitems[0])) { $Itemid = $menuitems[0]->id; } elseif ($app->input->getInt('Itemid') > 0) { // Use Itemid from requesting page only if there is no existing menu $Itemid = $app->input->getInt('Itemid'); } $item->link = JRoute::_('index.php?option=com_users&view=login&Itemid='.$Itemid); } // Used for styling the active article $item->active = $item->id == $active_article_id ? 'active' : ''; $item->displayDate = ''; $item->displayDate = JHTML::_('date', $item->$show_date_field, $show_date_format); if ($item->catid) { $item->displayCategoryLink = JRoute::_(ContentHelperRoute::getCategoryRoute($item->catid)); $item->displayCategoryTitle = $show_category ? '<a href="'.$item->displayCategoryLink.'">'.$item->category_title.'</a>' : ''; } else { $item->displayCategoryTitle = $show_category ? $item->category_title : ''; } $item->displayHits = $show_hits ? $item->hits : ''; $item->displayAuthorName = $show_author ? $item->author : ''; $item->displayIntrotext = self::wordLimit($item->introtext, $introtext_limit); $item->title = self::wordLimit($item->title, $title_limit); // Crop images if ( $item->mainimage && $image = self::renderImages($item->mainimage, $imageWidth, $imageHeight, $item->title ) ) { $item->mainimage = $image; } if ( $item->mainimage && $image = self::renderImages($item->mainimage, $imageWidthth, $imageHeightth, $item->title ) ) { $item->mainimage_th = $image; } } return $items; } public static function _cleanIntrotext($introtext) { $introtext = str_replace('<p>', ' ', $introtext); $introtext = str_replace('</p>', ' ', $introtext); $introtext = strip_tags($introtext, '<a><em><strong>'); $introtext = trim($introtext); return $introtext; } public static function makeDir( $path ) { $folders = explode ( '/', ( $path ) ); $tmppath = JPATH_SITE.DS.'images'.DS.'reslidercon'.DS; if( !file_exists($tmppath) ) { JFolder::create( $tmppath, 0755 ); }; for( $i = 0; $i < count ( $folders ) - 1; $i ++) { if (! file_exists ( $tmppath . $folders [$i] ) && ! JFolder::create( $tmppath . $folders [$i], 0755) ) { return false; } $tmppath = $tmppath . $folders [$i] . DS; } return true; } public static function renderImages( $path, $width, $height, $title='' ) { $path = str_replace( JURI::base(), '', $path ); $imgSource = JPATH_SITE.DS. str_replace( '/', DS, $path ); if ( file_exists($imgSource) ) { $path = $width."x".$height.'/'.$path; $thumbPath = JPATH_SITE.DS.'images'.DS.'reslidercon'.DS. str_replace( '/', DS, $path ); if ( !file_exists($thumbPath) ) { $thumb = PhpThumbFactory::create( $imgSource ); if( !self::makeDir( $path ) ) { return ''; } $thumb->adaptiveResize( $width, $height); $thumb->save( $thumbPath ); } $path = JURI::base().'images/reslidercon/'.$path; } return $path; } public static function wordLimit($str, $limit = 100, $end_char = '…') { if (JString::trim($str) == '') return $str; // always strip tags for text $str = strip_tags($str); $find = array("/\r|\n/u", "/\t/u", "/\s\s+/u"); $replace = array(" ", " ", " "); $str = preg_replace($find, $replace, $str); preg_match('/\s*(?:\S*\s*){'.(int)$limit.'}/u', $str, $matches); if (JString::strlen($matches[0]) == JString::strlen($str)) $end_char = ''; return JString::rtrim($matches[0]).$end_char; } }
/home/opticamezl/www/newok/07d6c/././../api/../modules/mod_responsive_slider/helper.php