| Current Path : /home/w/u/e/wuectly/www/03cbe/ |
| Current File : /home/w/u/e/wuectly/www/03cbe/helper.php.tar |
home/wuectly/www/modules/mod_syndicate/helper.php 0000604 00000001500 15245536013 0016272 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage mod_syndicate
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Utilities\ArrayHelper;
/**
* Helper for mod_syndicate
*
* @since 1.5
*/
class ModSyndicateHelper
{
/**
* Gets the link
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return array The link as a string
*
* @since 1.5
*/
public static function getLink(&$params)
{
$document = JFactory::getDocument();
foreach ($document->_links as $link => $value)
{
$value = ArrayHelper::toString($value);
if (strpos($value, 'application/' . $params->get('format') . '+xml'))
{
return $link;
}
}
}
}
home/wuectly/www/modules/mod_articles_archive/helper.php 0000604 00000004625 15245536174 0017641 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage mod_articles_archive
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_articles_archive
*
* @since 1.5
*/
class ModArchiveHelper
{
/**
* Retrieve list of archived articles
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return array
*
* @since 1.5
*/
public static function getList(&$params)
{
// Get database
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($query->month($db->quoteName('created')) . ' AS created_month')
->select('MIN(' . $db->quoteName('created') . ') AS created')
->select($query->year($db->quoteName('created')) . ' AS created_year')
->from('#__content')
->where('state = 2')
->group($query->year($db->quoteName('created')) . ', ' . $query->month($db->quoteName('created')))
->order($query->year($db->quoteName('created')) . ' DESC, ' . $query->month($db->quoteName('created')) . ' DESC');
// Filter by language
if (JFactory::getApplication()->getLanguageFilter())
{
$query->where('language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
}
$db->setQuery($query, 0, (int) $params->get('count'));
try
{
$rows = (array) $db->loadObjectList();
}
catch (RuntimeException $e)
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
return array();
}
$app = JFactory::getApplication();
$menu = $app->getMenu();
$item = $menu->getItems('link', 'index.php?option=com_content&view=archive', true);
$itemid = (isset($item) && !empty($item->id)) ? '&Itemid=' . $item->id : '';
$i = 0;
$lists = array();
foreach ($rows as $row)
{
$date = JFactory::getDate($row->created);
$createdMonth = $date->format('n');
$createdYear = $date->format('Y');
$createdYearCal = JHtml::_('date', $row->created, 'Y');
$monthNameCal = JHtml::_('date', $row->created, 'F');
$lists[$i] = new stdClass;
$lists[$i]->link = JRoute::_('index.php?option=com_content&view=archive&year=' . $createdYear . '&month=' . $createdMonth . $itemid);
$lists[$i]->text = JText::sprintf('MOD_ARTICLES_ARCHIVE_DATE', $monthNameCal, $createdYearCal);
$i++;
}
return $lists;
}
}
home/wuectly/www/administrator/modules/mod_logged/helper.php 0000604 00000003500 15245557212 0020436 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage mod_logged
*
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_logged
*
* @since 1.5
*/
abstract class ModLoggedHelper
{
/**
* Get a list of logged users.
*
* @param \Joomla\Registry\Registry &$params The module parameters.
*
* @return mixed An array of users, or false on error.
*
* @throws RuntimeException
*/
public static function getList(&$params)
{
$db = JFactory::getDbo();
$user = JFactory::getUser();
$query = $db->getQuery(true)
->select('s.time, s.client_id, u.id, u.name, u.username')
->from('#__session AS s')
->join('LEFT', '#__users AS u ON s.userid = u.id')
->where('s.guest = 0');
$db->setQuery($query, 0, $params->get('count', 5));
try
{
$results = $db->loadObjectList();
}
catch (RuntimeException $e)
{
throw $e;
}
foreach ($results as $k => $result)
{
$results[$k]->logoutLink = '';
if ($user->authorise('core.manage', 'com_users'))
{
$results[$k]->editLink = JRoute::_('index.php?option=com_users&task=user.edit&id=' . $result->id);
$results[$k]->logoutLink = JRoute::_('index.php?option=com_login&task=logout&uid=' . $result->id . '&' . JSession::getFormToken() . '=1');
}
if ($params->get('name', 1) == 0)
{
$results[$k]->name = $results[$k]->username;
}
}
return $results;
}
/**
* Get the alternate title for the module
*
* @param \Joomla\Registry\Registry $params The module parameters.
*
* @return string The alternate title for the module.
*/
public static function getTitle($params)
{
return JText::plural('MOD_LOGGED_TITLE', $params->get('count', 5));
}
}
home/wuectly/www/administrator/modules/mod_privacy_dashboard/helper.php 0000604 00000001630 15245557301 0022662 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage mod_privacy_dashboard
*
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper class for admin privacy dashboard module
*
* @since 3.9.0
*/
class ModPrivacyDashboardHelper
{
/**
* Method to retrieve information about the site privacy requests
*
* @return array Array containing site privacy requests
*
* @since 3.9.0
*/
public static function getData()
{
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_privacy/models', 'PrivacyModel');
/** @var PrivacyModelDashboard $model */
$model = JModelLegacy::getInstance('Dashboard', 'PrivacyModel');
try
{
return $model->getRequestCounts();
}
catch (JDatabaseException $e)
{
return array();
}
}
}
home/wuectly/www/administrator/modules/mod_quickicon/helper.php 0000604 00000014376 15245557322 0021201 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage mod_quickicon
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_quickicon
*
* @since 1.6
*/
abstract class ModQuickIconHelper
{
/**
* Stack to hold buttons
*
* @since 1.6
*/
protected static $buttons = array();
/**
* Helper method to return button list.
*
* This method returns the array by reference so it can be
* used to add custom buttons or remove default ones.
*
* @param JObject $params The module parameters.
*
* @return array An array of buttons
*
* @since 1.6
*/
public static function &getButtons($params)
{
$key = (string) $params;
if (!isset(self::$buttons[$key]))
{
$context = $params->get('context', 'mod_quickicon');
if ($context == 'mod_quickicon')
{
// Load mod_quickicon language file in case this method is called before rendering the module
JFactory::getLanguage()->load('mod_quickicon');
self::$buttons[$key] = array(
array(
'link' => JRoute::_('index.php?option=com_content&task=article.add'),
'image' => 'pencil-2',
'icon' => 'header/icon-48-article-add.png',
'text' => JText::_('MOD_QUICKICON_ADD_NEW_ARTICLE'),
'access' => array('core.manage', 'com_content', 'core.create', 'com_content'),
'group' => 'MOD_QUICKICON_CONTENT',
),
array(
'link' => JRoute::_('index.php?option=com_content'),
'image' => 'stack',
'icon' => 'header/icon-48-article.png',
'text' => JText::_('MOD_QUICKICON_ARTICLE_MANAGER'),
'access' => array('core.manage', 'com_content'),
'group' => 'MOD_QUICKICON_CONTENT',
),
array(
'link' => JRoute::_('index.php?option=com_categories&extension=com_content'),
'image' => 'folder',
'icon' => 'header/icon-48-category.png',
'text' => JText::_('MOD_QUICKICON_CATEGORY_MANAGER'),
'access' => array('core.manage', 'com_content'),
'group' => 'MOD_QUICKICON_CONTENT',
),
array(
'link' => JRoute::_('index.php?option=com_media'),
'image' => 'pictures',
'icon' => 'header/icon-48-media.png',
'text' => JText::_('MOD_QUICKICON_MEDIA_MANAGER'),
'access' => array('core.manage', 'com_media'),
'group' => 'MOD_QUICKICON_CONTENT',
),
array(
'link' => JRoute::_('index.php?option=com_menus'),
'image' => 'list-view',
'icon' => 'header/icon-48-menumgr.png',
'text' => JText::_('MOD_QUICKICON_MENU_MANAGER'),
'access' => array('core.manage', 'com_menus'),
'group' => 'MOD_QUICKICON_STRUCTURE',
),
array(
'link' => JRoute::_('index.php?option=com_users'),
'image' => 'users',
'icon' => 'header/icon-48-user.png',
'text' => JText::_('MOD_QUICKICON_USER_MANAGER'),
'access' => array('core.manage', 'com_users'),
'group' => 'MOD_QUICKICON_USERS',
),
array(
'link' => JRoute::_('index.php?option=com_modules'),
'image' => 'cube',
'icon' => 'header/icon-48-module.png',
'text' => JText::_('MOD_QUICKICON_MODULE_MANAGER'),
'access' => array('core.manage', 'com_modules'),
'group' => 'MOD_QUICKICON_STRUCTURE',
),
array(
'link' => JRoute::_('index.php?option=com_config'),
'image' => 'cog',
'icon' => 'header/icon-48-config.png',
'text' => JText::_('MOD_QUICKICON_GLOBAL_CONFIGURATION'),
'access' => array('core.manage', 'com_config', 'core.admin', 'com_config'),
'group' => 'MOD_QUICKICON_CONFIGURATION',
),
array(
'link' => JRoute::_('index.php?option=com_templates'),
'image' => 'eye',
'icon' => 'header/icon-48-themes.png',
'text' => JText::_('MOD_QUICKICON_TEMPLATE_MANAGER'),
'access' => array('core.manage', 'com_templates'),
'group' => 'MOD_QUICKICON_CONFIGURATION',
),
array(
'link' => JRoute::_('index.php?option=com_languages'),
'image' => 'comments-2',
'icon' => 'header/icon-48-language.png',
'text' => JText::_('MOD_QUICKICON_LANGUAGE_MANAGER'),
'access' => array('core.manage', 'com_languages'),
'group' => 'MOD_QUICKICON_CONFIGURATION',
),
array(
'link' => JRoute::_('index.php?option=com_installer'),
'image' => 'download',
'icon' => 'header/icon-48-extension.png',
'text' => JText::_('MOD_QUICKICON_INSTALL_EXTENSIONS'),
'access' => array('core.manage', 'com_installer'),
'group' => 'MOD_QUICKICON_EXTENSIONS',
),
);
}
else
{
self::$buttons[$key] = array();
}
// Include buttons defined by published quickicon plugins
JPluginHelper::importPlugin('quickicon');
$app = JFactory::getApplication();
$arrays = (array) $app->triggerEvent('onGetIcons', array($context));
foreach ($arrays as $response)
{
foreach ($response as $icon)
{
$default = array(
'link' => null,
'image' => 'cog',
'text' => null,
'access' => true,
'group' => 'MOD_QUICKICON_EXTENSIONS',
);
$icon = array_merge($default, $icon);
if (!is_null($icon['link']) && !is_null($icon['text']))
{
self::$buttons[$key][] = $icon;
}
}
}
}
return self::$buttons[$key];
}
/**
* Classifies the $buttons by group
*
* @param array $buttons The buttons
*
* @return array The buttons sorted by groups
*
* @since 3.2
*/
public static function groupButtons($buttons)
{
$groupedButtons = array();
foreach ($buttons as $button)
{
$groupedButtons[$button['group']][] = $button;
}
return $groupedButtons;
}
/**
* Get the alternate title for the module
*
* @param JObject $params The module parameters.
* @param JObject $module The module.
*
* @return string The alternate title for the module.
*
* @deprecated 4.0 Unused. Title can be adjusted in module itself if needed.
*/
public static function getTitle($params, $module)
{
$key = $params->get('context', 'mod_quickicon') . '_title';
if (JFactory::getLanguage()->hasKey($key))
{
return JText::_($key);
}
else
{
return $module->title;
}
}
}
home/wuectly/www/libraries/fof/form/helper.php 0000604 00000013536 15245561203 0015504 0 ustar 00 <?php
/**
* @package FrameworkOnFramework
* @subpackage form
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Protect from unauthorized access
defined('FOF_INCLUDED') or die;
JLoader::import('joomla.form.helper');
/**
* FOFForm's helper class.
* Provides a storage for filesystem's paths where FOFForm's entities reside and
* methods for creating those entities. Also stores objects with entities'
* prototypes for further reusing.
*
* @package FrameworkOnFramework
* @since 2.0
*/
class FOFFormHelper extends JFormHelper
{
/**
* Method to load a form field object given a type.
*
* @param string $type The field type.
* @param boolean $new Flag to toggle whether we should get a new instance of the object.
*
* @return mixed JFormField object on success, false otherwise.
*
* @since 11.1
*/
public static function loadFieldType($type, $new = true)
{
return self::loadType('field', $type, $new);
}
/**
* Method to load a form field object given a type.
*
* @param string $type The field type.
* @param boolean $new Flag to toggle whether we should get a new instance of the object.
*
* @return mixed JFormField object on success, false otherwise.
*
* @since 11.1
*/
public static function loadHeaderType($type, $new = true)
{
return self::loadType('header', $type, $new);
}
/**
* Method to load a form entity object given a type.
* Each type is loaded only once and then used as a prototype for other objects of same type.
* Please, use this method only with those entities which support types (forms don't support them).
*
* @param string $entity The entity.
* @param string $type The entity type.
* @param boolean $new Flag to toggle whether we should get a new instance of the object.
*
* @return mixed Entity object on success, false otherwise.
*
* @since 11.1
*/
protected static function loadType($entity, $type, $new = true)
{
// Reference to an array with current entity's type instances
$types = &self::$entities[$entity];
$key = md5($type);
// Return an entity object if it already exists and we don't need a new one.
if (isset($types[$key]) && $new === false)
{
return $types[$key];
}
$class = self::loadClass($entity, $type);
if ($class !== false)
{
// Instantiate a new type object.
$types[$key] = new $class;
return $types[$key];
}
else
{
return false;
}
}
/**
* Attempt to import the JFormField class file if it isn't already imported.
* You can use this method outside of JForm for loading a field for inheritance or composition.
*
* @param string $type Type of a field whose class should be loaded.
*
* @return mixed Class name on success or false otherwise.
*
* @since 11.1
*/
public static function loadFieldClass($type)
{
return self::loadClass('field', $type);
}
/**
* Attempt to import the FOFFormHeader class file if it isn't already imported.
* You can use this method outside of JForm for loading a field for inheritance or composition.
*
* @param string $type Type of a field whose class should be loaded.
*
* @return mixed Class name on success or false otherwise.
*
* @since 11.1
*/
public static function loadHeaderClass($type)
{
return self::loadClass('header', $type);
}
/**
* Load a class for one of the form's entities of a particular type.
* Currently, it makes sense to use this method for the "field" and "rule" entities
* (but you can support more entities in your subclass).
*
* @param string $entity One of the form entities (field or rule).
* @param string $type Type of an entity.
*
* @return mixed Class name on success or false otherwise.
*
* @since 2.0
*/
public static function loadClass($entity, $type)
{
if (strpos($type, '.'))
{
list($prefix, $type) = explode('.', $type);
$altPrefix = $prefix;
}
else
{
$prefix = 'FOF';
$altPrefix = 'J';
}
$class = JString::ucfirst($prefix, '_') . 'Form' . JString::ucfirst($entity, '_') . JString::ucfirst($type, '_');
$altClass = JString::ucfirst($altPrefix, '_') . 'Form' . JString::ucfirst($entity, '_') . JString::ucfirst($type, '_');
if (class_exists($class))
{
return $class;
}
elseif (class_exists($altClass))
{
return $altClass;
}
// Get the field search path array.
$paths = self::addPath($entity);
// If the type is complex, add the base type to the paths.
if ($pos = strpos($type, '_'))
{
// Add the complex type prefix to the paths.
for ($i = 0, $n = count($paths); $i < $n; $i++)
{
// Derive the new path.
$path = $paths[$i] . '/' . strtolower(substr($type, 0, $pos));
// If the path does not exist, add it.
if (!in_array($path, $paths))
{
$paths[] = $path;
}
}
// Break off the end of the complex type.
$type = substr($type, $pos + 1);
}
// Try to find the class file.
$type = strtolower($type) . '.php';
$filesystem = FOFPlatform::getInstance()->getIntegrationObject('filesystem');
foreach ($paths as $path)
{
if ($file = $filesystem->pathFind($path, $type))
{
require_once $file;
if (class_exists($class))
{
break;
}
elseif (class_exists($altClass))
{
break;
}
}
}
// Check for all if the class exists.
if (class_exists($class))
{
return $class;
}
elseif (class_exists($altClass))
{
return $altClass;
}
else
{
return false;
}
}
/**
* Method to add a path to the list of header include paths.
*
* @param mixed $new A path or array of paths to add.
*
* @return array The list of paths that have been added.
*/
public static function addHeaderPath($new = null)
{
return self::addPath('header', $new);
}
}
home/wuectly/www/modules/mod_search/helper.php 0000604 00000001074 15245561527 0015572 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage mod_search
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_search
*
* @since 1.5
*/
class ModSearchHelper
{
/**
* Display the search button as an image.
*
* @return string The HTML for the image.
*
* @since 1.5
*/
public static function getSearchImage()
{
return JHtml::_('image', 'searchButton.gif', '', null, true, true);
}
}
home/wuectly/www/modules/mod_articles_latest/helper.php 0000604 00000007356 15245561527 0017520 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage mod_articles_latest
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('ContentHelperRoute', JPATH_SITE . '/components/com_content/helpers/route.php');
JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_content/models', 'ContentModel');
use Joomla\Utilities\ArrayHelper;
/**
* Helper for mod_articles_latest
*
* @since 1.6
*/
abstract class ModArticlesLatestHelper
{
/**
* Retrieve a list of article
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return mixed
*
* @since 1.6
*/
public static function getList(&$params)
{
// Get the dbo
$db = JFactory::getDbo();
// Get an instance of the generic articles model
$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
// Set application parameters in model
$app = JFactory::getApplication();
$appParams = $app->getParams();
$model->setState('params', $appParams);
$model->setState('list.start', 0);
$model->setState('filter.published', 1);
// Set the filters based on the module params
$model->setState('list.limit', (int) $params->get('count', 5));
// This module does not use tags data
$model->setState('load_tags', false);
// Access filter
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
$model->setState('filter.access', $access);
// Category filter
$model->setState('filter.category_id', $params->get('catid', array()));
// User filter
$userId = JFactory::getUser()->get('id');
switch ($params->get('user_id'))
{
case 'by_me' :
$model->setState('filter.author_id', (int) $userId);
break;
case 'not_me' :
$model->setState('filter.author_id', $userId);
$model->setState('filter.author_id.include', false);
break;
case 'created_by' :
$model->setState('filter.author_id', $params->get('author', array()));
break;
case '0' :
break;
default:
$model->setState('filter.author_id', (int) $params->get('user_id'));
break;
}
// Filter by language
$model->setState('filter.language', $app->getLanguageFilter());
// Featured switch
$featured = $params->get('show_featured', '');
if ($featured === '')
{
$model->setState('filter.featured', 'show');
}
elseif ($featured)
{
$model->setState('filter.featured', 'only');
}
else
{
$model->setState('filter.featured', 'hide');
}
// Set ordering
$order_map = array(
'm_dsc' => 'a.modified DESC, a.created',
'mc_dsc' => 'CASE WHEN (a.modified = ' . $db->quote($db->getNullDate()) . ') THEN a.created ELSE a.modified END',
'c_dsc' => 'a.created',
'p_dsc' => 'a.publish_up',
'random' => $db->getQuery(true)->Rand(),
);
$ordering = ArrayHelper::getValue($order_map, $params->get('ordering'), 'a.publish_up');
$dir = 'DESC';
$model->setState('list.ordering', $ordering);
$model->setState('list.direction', $dir);
$items = $model->getItems();
foreach ($items as &$item)
{
$item->slug = $item->id . ':' . $item->alias;
/** @deprecated Catslug is deprecated, use catid instead. 4.0 */
$item->catslug = $item->catid . ':' . $item->category_alias;
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->catid, $item->language));
}
else
{
$item->link = JRoute::_('index.php?option=com_users&view=login');
}
}
return $items;
}
}
home/wuectly/www/modules/mod_iccalendar/helper.php 0000604 00000126143 15245561553 0016416 0 ustar 00 <?php
/**
*------------------------------------------------------------------------------
* iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
*------------------------------------------------------------------------------
* @package com_icagenda - mod_iccalendar
* @copyright Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
*
* @license GNU General Public License version 3 or later; see LICENSE.txt
* @author Cyril Rezé (Lyr!C) - doorknob
* @link http://www.joomlic.com
*
* @version 3.5.12 2015-10-01
* @since 3.1.9 (1.0)
*------------------------------------------------------------------------------
*/
/**
* iCagenda - iC calendar
*/
// No direct access to this file
defined('_JEXEC') or die();
jimport('joomla.methods');
jimport('joomla.environment.request');
jimport('joomla.application.component.helper');
// Module Class
class modiCcalendarHelper
{
private function construct($params)
{
$this->modid = $params->get('id');
$this->template = $params->get('template');
$this->format = $params->get('format');
$this->date_separator = $params->get('date_separator');
$this->setTodayTimezone = $params->get('setTodayTimezone');
$this->displayDatesTimezone = $params->get('displayDatesTimezone');
$this->filtering_shortDesc = $params->get('filtering_shortDesc', '');
$this->limit = $params->get('paramlimit', '')
? $params->get('paramlimit_Content')
: false;
$this->catid = $params->get('mcatid');
$this->number = $params->get('number');
$this->onlyStDate = $params->get('onlyStDate');
$this->firstMonth = $params->get('firstMonth', null);
$this->month_nav = $params->get('month_nav', '1');
$this->year_nav = $params->get('year_nav', '1');
// $linkid = JRequest::getInt('Itemid');
$this->itemid = JRequest::getInt('Itemid');
$this->mod_iccalendar = '#mod_iccalendar_' . $this->modid;
// Get media path
$params_media = JComponentHelper::getParams('com_media');
$image_path = $params_media->get('image_path', 'images');
// Features Options
$this->features_icon_size = $params->get('features_icon_size');
$this->show_icon_title = $params->get('show_icon_title');
$this->features_icon_root = JURI::base() . "{$image_path}/icagenda/feature_icons/{$this->features_icon_size}/";
// First day of the current month
$this_month = $this->firstMonth
? date("Y-m-d", strtotime("+1 month", strtotime($this->firstMonth)))
: JHtml::date('now', 'Y-m-01', null);
$iccaldate = JRequest::getVar('iccaldate', ''); // Get date set in month/year navigation
// This should be the first day of a month
$date_start = $iccaldate ? date('Y-m-01', strtotime($iccaldate)) : $this_month;
// Add filter to restrict the number of events using the 'next' date
if ($date_start > $this_month)
{
// Month to be displayed is in the future
// Events required start from the current month
$filter_start = $this_month;
}
else
{
// Month to be displayed is current or past
// Events required start from the display month
$filter_start = $date_start;
}
$this->date_start = $date_start;
$this->addFilter('e.next', '' . $filter_start . '', '>=');
// An end date for selection is not possible because it may prevent display of past events where the next
// scheduled instance of an event is after the end of the display month
// $filter_end = date('Y-m-d', strtotime('+1 month', strtotime($this->date_start)));
// $this->addFilter('e.next', "'$filter_end'",'<');
// Get Array of categories to be displayed
if (isset($this->catid)
&& ! empty($this->catid))
{
$cat_filter_param = $this->catid;
if ( ! is_array($cat_filter_param))
{
$catFilter = array($cat_filter_param);
}
else
{
$catFilter = $cat_filter_param;
}
$cats_option = implode(', ', $catFilter);
if ($catFilter != array(0))
{
$this->addFilter('e.catid', '(' . $cats_option . ')', ' IN ');
}
}
}
function start($params)
{
$this->construct($params);
}
function addFilter($key, $var, $for = NULL)
{
$for = ($for == NULL) ? '=' : $for;
$this->filter[] = $key . $for . $var;
}
// Class Method
function getStamp($params)
{
$iCparams = JComponentHelper::getParams('com_icagenda');
$eventTimeZone = null;
// Itemid Request (automatic detection of the first iCagenda menu-link, by menuID)
$iC_list_menus = icagendaMenus::iClistMenuItemsInfo();
$nb_menu = count($iC_list_menus);
$nolink = $nb_menu ? false : true;
$app = JFactory::getApplication();
$menu = $app->getMenu();
$isSef = $app->getCfg( 'sef' );
$date_var = ($isSef == 1) ? '?date=' :'&date=';
// Check if GD is enabled on the server
if (extension_loaded('gd') && function_exists('gd_info'))
{
$thumb_generator = $iCparams->get('thumb_generator', 1);
}
else
{
$thumb_generator = 0;
}
$datetime_today = JHtml::date('now', 'Y-m-d H:i');
$timeformat = $iCparams->get('timeformat', 1);
$lang_time = ($timeformat == 1) ? 'H:i' : 'h:i A';
// Check if fopen is allowed
$result = ini_get('allow_url_fopen');
$fopen = empty($result) ? false : true;
$this->start($params);
// Get the database
$db = JFactory::getDbo();
$query = $db->getQuery(true);
// Build the query
$query->select('e.*,
e.place as place_name,
c.title as cat_title,
c.alias as cat_alias,
c.color as cat_color,
c.ordering as cat_order
')
->from($db->qn('#__icagenda_events').' AS e')
->leftJoin($db->qn('#__icagenda_category').' AS c ON '.$db->qn('c.id').' = '.$db->qn('e.catid'));
// Where Category is Published
$query->where('c.state = 1');
// Where State is Published
$query->where('e.state = 1');
// Where event is Approved
$query->where('e.approval = 0');
// Add filters
if (isset($this->filter))
{
foreach ($this->filter as $filter)
{
$query->where($filter);
}
}
// Check Access Levels
$user = JFactory::getUser();
$userID = $user->id;
$userLevels = $user->getAuthorisedViewLevels();
if (version_compare(JVERSION, '3.0', 'lt'))
{
$userGroups = $user->getAuthorisedGroups();
}
else
{
$userGroups = $user->groups;
}
$userAccess = implode(', ', $userLevels);
if (!in_array('8', $userGroups))
{
$query->where('e.access IN (' . $userAccess . ')');
}
// Features - extract the number of displayable icons per event
$query->select('feat.count AS features');
$sub_query = $db->getQuery(true);
$sub_query->select('fx.event_id, COUNT(*) AS count');
$sub_query->from('`#__icagenda_feature_xref` AS fx');
$sub_query->innerJoin("`#__icagenda_feature` AS f ON fx.feature_id=f.id AND f.state=1 AND f.icon<>'-1'");
$sub_query->group('fx.event_id');
$query->leftJoin('(' . (string) $sub_query . ') AS feat ON e.id=feat.event_id');
// Registrations total
$query->select('r.count AS registered, r.date AS reg_date');
$sub_query = $db->getQuery(true);
$sub_query->select('r.eventid, sum(r.people) AS count, r.date AS date');
$sub_query->from('`#__icagenda_registration` AS r');
$sub_query->where('r.state > 0');
$sub_query->group('r.eventid');
$query->leftJoin('(' . (string) $sub_query . ') AS r ON e.id=r.eventid');
// Run the query
$db->setQuery($query);
// Invoke the query
$result = $db->loadObjectList();
$registrations = icagendaEventsData::registeredList();
foreach ($result AS $record)
{
$record_registered = array();
foreach ($registrations AS $reg_by_event)
{
$ex_reg_by_event = explode('@@', $reg_by_event);
if ($ex_reg_by_event[0] == $record->id)
{
$record_registered[] = $ex_reg_by_event[0] . '@@' . $ex_reg_by_event[1] . '@@' . $ex_reg_by_event[2];
}
}
$record->registered = $record_registered;
}
// Set start/end dates of the current month
$days = self::getNbOfDaysInMonth($this->date_start);
$current_date_start = $this->date_start;
$month_start = date('m', strtotime($current_date_start));
$month_end = date('m', strtotime('+1 month', strtotime($current_date_start)));
$day_end = date('m', strtotime('+'.$days.' days', strtotime($current_date_start)));
$year_end = ($month_start == '12')
? date('Y', strtotime("+1 year", strtotime($this->date_start)))
: date('Y', strtotime($this->date_start));
$current_date_end = $year_end . '-' . $month_end . '-' . $day_end;
$days = $this->getDays($this->date_start, 'Y-m-d H:i');
$total_items = 0;
$displayed_items = 0;
foreach ($result as $item)
{
// Extract the feature details, if needed
$features = array();
if (is_null($item->features) || empty($this->features_icon_size))
{
$item->features = array();
}
else
{
$item->features = icagendaEvents::featureIcons($item->id);
}
if (isset($item->features) && is_array($item->features))
{
foreach ($item->features as $feature)
{
$features[] = array('icon' => $feature->icon, 'icon_alt' => $feature->icon_alt);
}
}
// list calendar dates
$AllDates = array();
$next = isset($next) ? $next : '';
$allSingleDates_array = $this->getDatelist($item->dates, $next);
// If Single Dates, added to all dates for this event
if (isset($datemultiplelist)
&& $datemultiplelist != NULL
&& is_array($datemultiplelist))
{
$allSingleDates_array = array_merge($AllDates, $datemultiplelist);
}
foreach ($allSingleDates_array as $sd)
{
$this_date = JHtml::date($sd, 'Y-m-d', null);
if (strtotime($this_date) >= strtotime($current_date_start)
&& strtotime($this_date) < strtotime($current_date_end))
{
array_push($AllDates, $sd);
}
}
// Get WeekDays Array
$WeeksDays = iCDatePeriod::weekdaysToArray($item->weekdays);
// Get Period Dates
$StDate = JHtml::date($item->startdate, 'Y-m-d H:i', $eventTimeZone);
$EnDate = JHtml::date($item->enddate, 'Y-m-d H:i', $eventTimeZone);
$perioddates = iCDatePeriod::listDates($item->startdate, $item->enddate, $eventTimeZone);
$onlyStDate = isset($this->onlyStDate) ? $this->onlyStDate : '';
// Check the period if individual dates
$only_startdate = ($item->weekdays || $item->weekdays == '0') ? false : true;
// if (isset($perioddates) && $perioddates != NULL)
// {
if ($onlyStDate == 1)
{
if (strtotime($StDate) >= strtotime($current_date_start)
&& strtotime($StDate) < strtotime($current_date_end))
{
array_push($AllDates, date('Y-m-d H:i', strtotime($item->startdate)));
}
}
else
{
foreach ($perioddates as $Dat)
{
$this_date = JHtml::date($Dat, 'Y-m-d', null);
if (in_array(date('w', strtotime($Dat)), $WeeksDays))
{
$SingleDate = date('Y-m-d H:i', strtotime($Dat));
if (strtotime($this_date) >= strtotime($current_date_start)
&& strtotime($this_date) < strtotime($current_date_end))
{
array_push($AllDates, $SingleDate);
}
}
}
}
// }
rsort($AllDates);
// requête Itemid
$iCmenuitem = $params->get('iCmenuitem', '');
if (is_numeric($iCmenuitem))
{
$linkid = $iCmenuitem;
}
else
{
$linkid = icagendaMenus::thisEventItemid($item->next, $item->catid, $iC_list_menus);
}
$eventnumber = $item->id ? $item->id : null;
$event_slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
$total_items = $total_items + 1;
if ( $linkid
&& ! $nolink
&& JComponentHelper::getComponent('com_icagenda', true)->enabled
)
{
$displayed_items = $displayed_items + 1;
$urlevent = JRoute::_('index.php?option=com_icagenda&view=list&layout=event&id=' . $event_slug . '&Itemid=' . (int)$linkid);
}
else
{
$urlevent = '#';
}
$descShort = icagendaEvents::shortDescription($item->desc, true, $this->filtering_shortDesc, $this->limit);
/**
* Get Thumbnail
*/
// START iCthumb
// Set if run iCthumb
if ($item->image
&& $thumb_generator == 1)
{
// Generate small thumb if not exist
$thumb_img = icagendaThumb::sizeSmall($item->image);
}
elseif ($item->image
&& $thumb_generator == 0)
{
$thumb_img = $item->image;
}
else
{
$thumb_img = $item->image ? 'media/com_icagenda/images/nophoto.jpg' : '';
}
// END iCthumb
$evtParams = '';
$evtParams = new JRegistry($item->params);
// Display Time
$r_time = $params->get('dp_time', 1) ? true : false;
// Display City
$r_city = $params->get('dp_city', 1) ? $item->city : false;
// Display Country
$r_country = $params->get('dp_country', 1) ? $item->country : false;
// Display Venue Name
$r_place = $params->get('dp_venuename', 1) ? $item->place_name : false;
// Display Intro Text
$dp_shortDesc = $params->get('dp_shortDesc', '');
// Short Description
if ($dp_shortDesc == '1')
{
$descShort = $item->shortdesc ? $item->shortdesc : false;
}
// Auto-Introtext
elseif ($dp_shortDesc == '2')
{
$descShort = $descShort ? $descShort : false;
}
// Hide
elseif ($dp_shortDesc == '0')
{
$descShort = false;
}
// Auto (First Short Description, if does not exist, Auto-generated short description from the full description. And if does not exist, will use meta description if not empty)
else
{
$e_shortdesc = $item->shortdesc ? $item->shortdesc : $descShort;
$descShort = $e_shortdesc ? $e_shortdesc : $item->metadesc;
}
// Display Registration Infos
$dp_regInfos = $params->get('dp_regInfos', 1);
$maxTickets = ($dp_regInfos == 1) ? $evtParams->get('maxReg', '1000000') : false;
$typeReg = ($dp_regInfos == 1) ? $evtParams->get('typeReg', '1') : false;
$event = array(
'id' => (int)$item->id,
'Itemid' => (int)$linkid,
'title' => $item->title,
'next' => $this->formatDate($item->next),
'image' => $thumb_img,
'file' => $item->file,
'address' => $item->address,
'city' => $r_city,
'country' => $r_country,
'place' => $r_place,
'description' => $item->desc,
'descShort' => $descShort,
'cat_title' => $item->cat_title,
'cat_order' => $item->cat_order,
'cat_color' => $item->cat_color,
'nb_events' => count($item->id),
'no_image' => JTEXT::_('MOD_ICCALENDAR_NO_IMAGE'),
'params' => $item->params,
'features_icon_size' => $this->features_icon_size,
'features_icon_root' => $this->features_icon_root,
'show_icon_title' => $this->show_icon_title,
'features' => $features,
'item' => $item,
);
// Access Control
$access = $item->access ? $item->access : '1';
// Language Control
$languages = array(JFactory::getLanguage()->getTag(), '*');
$eventLang = isset($item->language) ? $item->language : '*';
// Get Option Dislay Time
$displaytime = isset($item->displaytime) ? $item->displaytime : '';
$events_per_day = array();
// Get List of Dates
if ((in_array($access, $userLevels) || in_array('8', $userGroups))
&& in_array($eventLang, $languages)
&& is_array($event)
&& $linkid
)
{
$past_dates = 0;
foreach ($AllDates as $d)
{
// Control if date is past
if (strtotime($d) < strtotime($datetime_today))
{
$past_dates = $past_dates + 1;
}
}
foreach ($AllDates as $d)
{
$this_date_control = date('Y-m-d H:i', strtotime($d));
if ($only_startdate && in_array($this_date_control, $perioddates))
{
$set_date_in_url = '';
}
else
{
$set_date_in_url = $date_var . iCDate::dateToAlias($d, 'Y-m-d H:i');
}
if ($r_time)
{
$time = array(
'time' => date($lang_time, strtotime($d)),
'displaytime' => $displaytime,
'url' => $urlevent . $set_date_in_url
);
}
else
{
$time = array(
'time' => '',
'displaytime' => '',
'url' => $urlevent . $set_date_in_url
);
}
$event = array_merge($event, $time);
$this_date = $item->reg_date ? date('Y-m-d H:i:s', strtotime($d)) : 'period';
$registrations = ($dp_regInfos == 1) ? true : false;
$registered = ($dp_regInfos == 1)
? self::getNbTicketsBooked($this_date, $item->registered, $eventnumber, $set_date_in_url)
: false;
$maxTickets = ($maxTickets != '1000000') ? $maxTickets : false;
$TicketsLeft = ($dp_regInfos == 1 && $maxTickets)
? ($maxTickets - self::getNbTicketsBooked($this_date, $item->registered, $eventnumber, $set_date_in_url))
: false;
// If period started, and registration is set to "for all dates of the event"
if ($maxTickets
// && strtotime($item->startdate) < strtotime($datetime_today)
&& $past_dates
&& $typeReg == 2
)
{
$date_sold_out = JText::_('MOD_ICCALENDAR_REGISTRATION_CLOSED');
}
elseif ($maxTickets)
{
$date_sold_out = ($TicketsLeft <= 0) ? JText::_('MOD_ICCALENDAR_REGISTRATION_DATE_NO_TICKETS_LEFT') : false;
}
else
{
$date_sold_out = false;
}
$reg_infos = array(
'registrations' => $registrations,
'registered' => $registered,
'maxTickets' => $maxTickets,
'TicketsLeft' => $TicketsLeft,
'date_sold_out' => $date_sold_out
);
$event = array_merge($event, $reg_infos);
foreach ($days as $k => $dy)
{
// $d_date = JHtml::date($d, 'Y-m-d', $eventTimeZone);
$d_date = date('Y-m-d', strtotime($d));
$dy_date = date('Y-m-d', strtotime($dy['date']));
if ($d_date == $dy_date)
{
array_push ($days[$k]['events'], $event);
}
}
}
}
}
$i = '';
if ($nolink || !JComponentHelper::getComponent('com_icagenda', true)->enabled)
{
do {
echo '<div style="color:#a40505; text-align: center;"><b>info :</b></div><div style="color:#a40505; font-size: 0.8em; text-align: center;">'.JText::_( 'MOD_ICCALENDAR_COM_ICAGENDA_MENULINK_UNPUBLISHED_MESSAGE' ).'</div>';
} while ($i > 0);
}
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id AS nbevt')->from('`#__icagenda_events` AS e')->where('e.state > 0');
$db->setQuery($query);
$nbevt = $db->loadResult();
$nbevt = count($nbevt);
$no_event_message = '<div class="ic-msg-no-event">' . JText::_('MOD_ICCALENDAR_NO_EVENT') . '</div>';
if ($nbevt == NULL)
{
echo $no_event_message;
}
// To be Checked
$total_items = count($result);
if ($displayed_items == '0'
&& $total_items > 0)
{
echo $no_event_message;
}
if ($total_items > $displayed_items)
{
$not_displayed = ($total_items - $displayed_items);
$user = JFactory::getUser();
if ($user->authorise('core.admin'))
{
echo '<div class="alert alert-warning">' . JText::sprintf('IC_MODULE_ALERT_EVENTS_NOT_DISPLAYED', $not_displayed) . '</div>';
}
}
return $days;
}
public static function getNbTicketsBooked($date, $event_registered, $event_id, $set_date_in_url)
{
$event_registered = is_array($event_registered) ? $event_registered : array();
$nb_registrations = 0;
foreach ($event_registered AS $reg)
{
$ex_reg = explode('@@', $reg); // eventid@@date@@people
if ( ! $date || $date == 'period')
{
$nb_registrations = $nb_registrations + $ex_reg[2];
}
elseif (date('Y-m-d H:i', strtotime($date)) == date('Y-m-d H:i', strtotime($ex_reg[1])))
{
$nb_registrations = $nb_registrations + $ex_reg[2];
}
elseif ( ! $set_date_in_url && $ex_reg[1] == 'period' && $event_id == $ex_reg[0])
{
$nb_registrations = $nb_registrations + $ex_reg[2];
}
}
return $nb_registrations;
}
// Function to get Format Date (using option format, and translation)
protected function formatDate($date, $tz = false)
{
// Date Format Option (Global Component Option)
$date_format_global = JComponentHelper::getParams('com_icagenda')->get('date_format_global', 'Y - m - d');
$date_format_global = ($date_format_global !== '0') ? $date_format_global : 'Y - m - d'; // Previous 3.5.6 setting
// Date Format Option (Module Option)
$date_format_module = isset($this->format) ? $this->format : '';
$date_format_module = ($date_format_module !== '0') ? $date_format_module : ''; // Previous 3.5.6 setting
// Set Date Format option to be used
$format = $date_format_module ? $date_format_module : $date_format_global;
// Separator Option
$separator = isset($this->date_separator) ? $this->date_separator : ' ';
if ( ! is_numeric($format))
{
// Update old Date Format options of versions before 2.1.7
$format = str_replace(array('nosep', 'nosep', 'sepb', 'sepa'), '', $format);
$format = str_replace('.', ' .', $format);
$format = str_replace(',', ' ,', $format);
}
$dateFormatted = iCGlobalize::dateFormat($date, $format, $separator, $tz);
return $dateFormatted;
}
// Function to get TimeZone offset
function get_timezone_offset($remote_tz, $origin_tz = null)
{
if ($origin_tz === null)
{
if (!is_string($origin_tz = date_default_timezone_get()))
{
return false; // A UTC timestamp was returned -- bail out!
}
}
$origin_dtz = new DateTimeZone($origin_tz);
$remote_dtz = new DateTimeZone($remote_tz);
$origin_dt = new DateTime("now", $origin_dtz);
$remote_dt = new DateTime("now", $remote_dtz);
$offset = $origin_dtz->getOffset($origin_dt) - $remote_dtz->getOffset($remote_dt);
return $offset;
}
function getNbOfDaysInMonth($date)
{
$lang = JFactory::getLanguage();
// Get Nb of days in the month in Jalali/Persian calendar
if ($lang->getTag() == 'fa-IR')
{
$date_to_persian = $date;
$persian_month = date('m', strtotime($date_to_persian));
$persian_year = date('Y', strtotime($date_to_persian));
$leap_year = fa_IRDate::leap_persian($persian_year);
if ($persian_month < 7)
{
$days = 31;
}
elseif ($persian_month == 12)
{
$days = $leap_year ? 30 : 29;
}
else
{
$days = 30;
}
}
// Get Nb of days in the month in Gregorian calendar
else
{
$days = date("t", strtotime($date));
}
return $days;
}
// Generate the days of the month
function getDays($d, $f)
{
$lang = JFactory::getLanguage();
$eventTimeZone = null;
$days = self::getNbOfDaysInMonth($d);
// Set Month and Year
$ex_data = explode('-', $d);
$month = $ex_data[1];
$year = $ex_data[0];
$jour = $ex_data[2];
$list = array();
//
// Setting function of the visitor Time Zone
//
$today = time();
$config = JFactory::getConfig();
$joomla_offset = $config->get('offset');
$displayDatesTimezone = '0'; // Option not active
$opt_TimeZone = isset($this->setTodayTimezone) ? $this->setTodayTimezone : '';
$gmt_today = gmdate('Y-m-d H:i:s', $today);
$today_timestamp = strtotime($gmt_today);
$GMT_timezone = 'Etc/UTC';
if ($opt_TimeZone == 'SITE')
{
// Joomla Server Time Zone
$visitor_timezone = $joomla_offset;
$offset = $this->get_timezone_offset($GMT_timezone, $visitor_timezone);
$visitor_today = JHtml::date(($today_timestamp+$offset), 'Y-m-d H:i:s', null);
$UTCsite = $offset / 3600;
if ($UTCsite > 0) $UTCsite = '+'.$UTCsite;
if ($displayDatesTimezone == '1')
{
echo '<small>' . JHtml::date('now', 'Y-m-d H:i:s', true) . ' UTC' . $UTCsite . '</small><br />';
}
}
elseif ($opt_TimeZone == 'UTC')
{
// UTC Time Zone
$offset = 0;
$visitor_today = JHtml::date(($today_timestamp+$offset), 'Y-m-d H:i:s', null);
$UTC = $offset / 3600;
if ($UTC > 0) $UTC = '+'.$UTC;
if ($displayDatesTimezone == '1')
{
echo '<small>' . gmdate('Y-m-d H:i:s', $today) . ' UTC' . $UTC . '</small><br />';
}
}
else
{
$visitor_today = JHtml::date(($today_timestamp), 'Y-m-d H:i:s', null);
}
$date_today = str_replace(' ', '-', $visitor_today);
$date_today = str_replace(':', '-', $date_today);
$ex_data = explode('-', $date_today);
$v_month = $ex_data[1];
$v_year = $ex_data[0];
$v_day = $ex_data[2];
$v_hours = $ex_data[3];
$v_minutes = $ex_data[4];
for ($a = 1; $a <= $days; $a++)
{
$calday = $a;
$this_date_a = $year . '-' . $month . '-' . $a;
if ($lang->getTag() == 'fa-IR')
{
$this_date_cal = iCGlobalizeConvert::jalaliToGregorian($year, $month, $a, true);
}
else
{
$this_date_cal = $year . '-' . $month . '-' . $a;
}
if (($a == $v_day) && ($month == $v_month) && ($year == $v_year))
{
$classDay = 'style_Today';
}
else
{
$classDay = 'style_Day';
}
$datejour = JHtml::date($this_date_cal, 'Y-m-d', $eventTimeZone);
$this_year_month = $year . '-' . $month . '-00';
$list_a_date = date('Y-m-d H:i', strtotime($this_date_a));
// Set Date in tooltip header
$date_to_format = $this->formatDate($this_date_cal, false);
$list[$calday]['dateTitle'] = $date_to_format;
// $list[$calday]['datecal'] = JHtml::date($this_date_a, 'j', null);
// $list[$calday]['monthcal'] = JHtml::date($this_date_a, 'm', null);
// $list[$calday]['yearcal'] = JHtml::date($this_date_a, 'Y', null);
$list[$calday]['date'] = date('Y-m-d H:i', strtotime($this_date_cal));
// $list[$calday]['dateFormat'] = strftime($f, strtotime($this_date_a));
$list[$calday]['week'] = date('N', strtotime($this_date_a));
$list[$calday]['day'] = '<div class="' . $classDay . '">' . $a . '</div>';
// Set cal_date
$list[$calday]['this_day'] = date('Y-m-d', strtotime($this_date_a));
// Added in 2.1.2 (change in NAME_day.php)
$list[$calday]['ifToday'] = $classDay;
$list[$calday]['Days'] = $a;
// Set event array
$list[$calday]['events'] = array();
}
return $list;
}
/***/
/**
* Single Dates list for one event
*/
private function getDatelist($dates, $next)
{
$dates = iCString::isSerialized($dates) ? unserialize($dates) : array();
$da = array();
foreach ($dates as $d)
{
if (strtotime($d) >= strtotime($next) && iCDate::isDate($d))
{
array_push($da, date('Y-m-d H:i', strtotime($d)));
}
}
return $da;
}
/** Systeme de navigation **/
function getNav($date_start, $modid)
{
$app = JFactory::getApplication();
$isSef = $app->getCfg( 'sef' );
// Return Current URL
$url = JUri::getInstance()->toString() . '#tag';
$url = preg_replace('/&iccaldate=[^&]*/', '', $url);
$url = preg_replace('/\?iccaldate=[^\?]*/', '', $url);
// Set Separator for Navigation Var
$separator = strpos($url, '?') !== false ? '&' : '?';
// Remove fragment (hashtag could be added by a third party extension, eg. nonumber framework)
$parsed_url = parse_url($url);
$fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
$url = str_replace($fragment, '', $url);
// Return Current URL Filtered
$url = htmlspecialchars($url);
// Start Date
$ex_date = explode('-', $date_start);
$year = $ex_date[0];
$month = $ex_date[1];
$day = 1;
if ($month != 1)
{
$backMonth = $month-1;
$backYear = $year;
}
elseif ($month == 1)
{
$backMonth = 12;
$backYear = $year-1;
}
if ($month != 12)
{
$nextMonth = $month+1;
$nextYear = $year;
}
elseif ($month == 12)
{
$nextMonth = 1;
$nextYear = $year+1;
}
$backYYear = $year-1;
$nextYYear = $year+1;
// Create Navigation Arrows
$classBackYear = 'backicY icagendabtn_' . $modid;
$urlBackYear = $url . $separator . 'iccaldate=' . $backYYear . '-' . $month . '-' . $day;
$iconBackYear = '<span class="iCicon iCicon-backicY"></span>';
$backY = '<a class="' . $classBackYear . '" href="' . $urlBackYear . '" rel="nofollow">' . $iconBackYear . '</a>';
$classBackMonth = 'backic icagendabtn_' . $modid;
$urlBackMonth = $url . $separator . 'iccaldate=' . $backYear . '-' . $backMonth . '-' . $day;
$iconBackMonth = '<span class="iCicon iCicon-backic"></span>';
$back = '<a class="' . $classBackMonth . '" href="' . $urlBackMonth . '" rel="nofollow">' . $iconBackMonth . '</a>';
$classNextMonth = 'nextic icagendabtn_' . $modid;
$urlNextMonth = $url . $separator . 'iccaldate=' . $nextYear . '-' . $nextMonth . '-' . $day;
$iconNextMonth = '<span class="iCicon iCicon-nextic"></span>';
$next = '<a class="' . $classNextMonth . '" href="' . $urlNextMonth . '" rel="nofollow">' . $iconNextMonth . '</a>';
$classNextYear = 'nexticY icagendabtn_' . $modid;
$urlNextYear = $url . $separator . 'iccaldate=' . $nextYYear . '-' . $month . '-' . $day;
$iconNextYear = '<span class="iCicon iCicon-nexticY"></span>';
$nextY = '<a class="' . $classNextYear . '" href="' . $urlNextYear . '" rel="nofollow">' . $iconNextYear . '</a>';
if ( ! $this->month_nav) $back = $next = '';
if ( ! $this->year_nav) $backY = $nextY = '';
/** translate the month in the calendar module -- Leland Vandervort **/
$dateFormat = date('Y-m-d', strtotime($date_start));
// split out the month and year to obtain translation key for JText using joomla core translation
$t_day = strftime("%d", strtotime("$dateFormat"));
$t_month = date('F', strtotime($dateFormat));
$t_year = strftime("%Y", strtotime("$dateFormat"));
$lang = JFactory::getLanguage();
$langTag = $lang->getTag();
$yearBeforeMonth = array('ar-AA', 'ja-JP');
$monthBeforeYear = in_array($langTag, $yearBeforeMonth) ? 0 : 1;
/**
* Get prefix, suffix and separator for month and year in calendar title
*/
// Separator Month/Year
$separator_month_year = JText::_('SEPARATOR_MONTH_YEAR');
if ($separator_month_year == 'CALENDAR_SEPARATOR_MONTH_YEAR_FACULTATIVE')
{
$separator_month_year = ' ';
}
elseif ($separator_month_year == 'NO_SEPARATOR')
{
$separator_month_year = '';
}
// Prefix Month (Facultative)
$prefix_month = JText::_('PREFIX_MONTH');
if ($prefix_month == 'CALENDAR_PREFIX_MONTH_FACULTATIVE')
{
$prefix_month = '';
}
// Suffix Month (Facultative)
$suffix_month = JText::_('SUFFIX_MONTH');
if ($suffix_month == 'CALENDAR_SUFFIX_MONTH_FACULTATIVE')
{
$suffix_month = '';
}
// Prefix Year (Facultative)
$prefix_year = JText::_('PREFIX_YEAR');
if ($prefix_year == 'CALENDAR_PREFIX_YEAR_FACULTATIVE')
{
$prefix_year = '';
}
// Suffix Year (Facultative)
$suffix_year = JText::_('SUFFIX_YEAR');
if ($suffix_year == 'CALENDAR_SUFFIX_YEAR_FACULTATIVE')
{
$suffix_year = '';
}
$SEP = $separator_month_year;
$PM = $prefix_month;
$SM = $suffix_month;
$PY = $prefix_year;
$SY = $suffix_year;
// Get MONTH_CAL string or if not translated, use MONTHS
$array_months = array(
'JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE',
'JULY', 'AUGUST', 'SEPTEMBER', 'OCTOBER', 'NOVEMBER', 'DECEMBER'
);
$cal_string = $t_month . '_CAL';
$missing_cal_string = iCFilterOutput::stringToJText($cal_string);
if ( in_array($missing_cal_string, $array_months) )
{
// if MONTHS_CAL strings not translated in current language, use MONTHS strings
$month_J = JText::_( $t_month );
}
else
{
// Use MONTHS_CAL strings when translated in current language
$month_J = JText::_( $t_month . '_CAL' );
}
// Set Calendar Title
if ($monthBeforeYear == 0)
{
$title = $PY . $t_year . $SY . $SEP . $PM . $month_J . $SM;
}
else
{
$title = $PM . $month_J . $SM . $SEP . $PY . $t_year . $SY;
}
// Set Nav Bar for calendar
$html = '<div class="icnav">' . $backY . $back . $nextY . $next;
$html.= '<div class="titleic">' . $title . '</div>';
$html.= '</div><div style="clear:both"></div>';
return $html;
}
}
class cal
{
public $data;
public $template;
public $t_calendar;
public $t_day;
public $nav;
public $fontcolor;
private $header_text;
function __construct ($data, $t_calendar, $t_day, $nav,
$firstday, $columns_bg_color,
$calfontcolor, $OneEventbgcolor, $Eventsbgcolor, $bgcolor, $bgimage, $bgimagerepeat,
$moduleclass_sfx, $modid, $template, $ictip_ordering, $header_text)
{
$this->data = $data;
$this->t_calendar = $t_calendar;
$this->t_day = $t_day;
$this->nav = $nav;
$this->firstday = $firstday;
$this->calfontcolor = $calfontcolor;
$this->OneEventbgcolor = $OneEventbgcolor;
$this->Eventsbgcolor = $Eventsbgcolor;
$this->bgcolor = $bgcolor;
$this->bgimage = $bgimage;
$this->bgimagerepeat = $bgimagerepeat;
$this->moduleclass_sfx = $moduleclass_sfx;
$this->modid = $modid;
$this->template = $template;
$this->ictip_ordering = $ictip_ordering;
$this->header_text = $header_text;
// Columns Background colors
$cbc = $columns_bg_color;
$this->weekdays = array('MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN');
switch ($this->firstday)
{
case 0:
$this->colbg = array($cbc[0], $cbc[1], $cbc[2], $cbc[3], $cbc[4], $cbc[5], $cbc[6]);
$this->day = array(7, 1, 2, 3, 4, 5, 6);
break;
case 1:
$this->colbg = array($cbc[1], $cbc[2], $cbc[3], $cbc[4], $cbc[5], $cbc[6], $cbc[0]);
$this->day = array(1, 2, 3, 4, 5, 6, 7);
break;
case 2:
$this->colbg = array($cbc[2], $cbc[3], $cbc[4], $cbc[5], $cbc[6], $cbc[0], $cbc[1]);
$this->day = array(2, 3, 4, 5, 6, 7, 1);
break;
case 3:
$this->colbg = array($cbc[3], $cbc[4], $cbc[5], $cbc[6], $cbc[0], $cbc[1], $cbc[2]);
$this->day = array(3, 4, 5, 6, 7, 1, 2);
break;
case 4:
$this->colbg = array($cbc[4], $cbc[5], $cbc[6], $cbc[0], $cbc[1], $cbc[2], $cbc[3]);
$this->day = array(4, 5, 6, 7, 1, 2, 3);
break;
case 5:
$this->colbg = array($cbc[5], $cbc[6], $cbc[0], $cbc[1], $cbc[2], $cbc[3], $cbc[4]);
$this->day = array(5, 6, 7, 1, 2, 3, 4);
break;
case 6:
$this->colbg = array($cbc[6], $cbc[0], $cbc[1], $cbc[2], $cbc[3], $cbc[4], $cbc[5]);
$this->day = array(6, 7, 1, 2, 3, 4, 5);
break;
default:
$this->colbg = array($cbc[0], $cbc[1], $cbc[2], $cbc[3], $cbc[4], $cbc[5], $cbc[6]);
$this->day = array(7, 1, 2, 3, 4, 5, 6);
break;
}
}
function days()
{
$this_calfontcolor = str_replace(' ', '', $this->calfontcolor);
$calfontcolor = ! empty($this_calfontcolor) ? ' color:' . $this->calfontcolor . ';' : '';
$this_bgcolor = str_replace(' ', '', $this->bgcolor);
$bgcolor = ! empty($this_bgcolor) ? ' background-color:' . $this->bgcolor . ';' : '';
$this_bgimage = str_replace(' ', '', $this->bgimage);
$bgimage = ! empty($this_bgimage) ? ' background-image:url(\'' . $this->bgimage . '\');' : '';
$this_bgimagerepeat = str_replace(' ', '', $this->bgimagerepeat);
$bgimagerepeat = ! empty($this_bgimagerepeat) ? ' background-repeat:' . $this->bgimagerepeat . ';' : '';
$iCcal_style = '';
if ( ! empty($this_calfontcolor)
|| ! empty($this_bgcolor)
|| ! empty($this_bgimage)
|| ! empty($this_bgimagerepeat) )
{
$iCcal_style.= 'style="';
}
$iCcal_style.= $calfontcolor . $bgcolor . $bgimage;
$iCcal_style.= ($this_bgimagerepeat && $this_bgimage) ? $bgimagerepeat : '';
$iCcal_style.= (empty($this_bgcolor) && empty($this_bgimage)) ? ' background-color: transparent; background-image: none;' : '';
$iCcal_style.= '"';
// Verify Hex color strings
$OneEventbgcolor = preg_match('/^#[a-f0-9]{6}$/i', $this->OneEventbgcolor) ? $this->OneEventbgcolor : '';
$Eventsbgcolor = preg_match('/^#[a-f0-9]{6}$/i', $this->Eventsbgcolor) ? $this->Eventsbgcolor : '';
echo '<div class="' . $this->template . ' iccalendar ' . $this->moduleclass_sfx . '" ' . $iCcal_style . ' id="' . $this->modid . '">';
echo '<div id="mod_iccalendar_' . $this->modid . '">
<div class="icagenda_header">' . $this->header_text . '
</div>' . $this->nav . '
<table id="icagenda_calendar" class="ic-table" style="width:100%;">
<thead>
<tr>
<th style="width:14.2857143%;background:' . $this->colbg[0] . ';">' . JText::_($this->weekdays[($this->day[0]-1)]) . '</th>
<th style="width:14.2857143%;background:' . $this->colbg[1] . ';">' . JText::_($this->weekdays[($this->day[1]-1)]) . '</th>
<th style="width:14.2857143%;background:' . $this->colbg[2] . ';">' . JText::_($this->weekdays[($this->day[2]-1)]) . '</th>
<th style="width:14.2857143%;background:' . $this->colbg[3] . ';">' . JText::_($this->weekdays[($this->day[3]-1)]) . '</th>
<th style="width:14.2857143%;background:' . $this->colbg[4] . ';">' . JText::_($this->weekdays[($this->day[4]-1)]) . '</th>
<th style="width:14.2857143%;background:' . $this->colbg[5] . ';">' . JText::_($this->weekdays[($this->day[5]-1)]) . '</th>
<th style="width:14.2857143%;background:' . $this->colbg[6] . ';">' . JText::_($this->weekdays[($this->day[6]-1)]) . '</th>
</tr>
</thead>
';
switch ($this->data[1]['week'])
{
case $this->day[0]:
break;
case $this->day[1]:
echo '<tr><td colspan="1"></td>';
break;
case $this->day[2]:
echo '<tr><td colspan="2"></td>';
break;
case $this->day[3]:
echo '<tr><td colspan="3"></td>';
break;
case $this->day[4]:
echo '<tr><td colspan="4"></td>';
break;
case $this->day[5]:
echo '<tr><td colspan="5"></td>';
break;
case $this->day[6]:
echo '<tr><td colspan="6"></td>';
break;
default:
echo '<tr><td colspan="' . ($this->data[1]['week']-$this->firstday) . '"></td>';
break;
}
foreach ($this->data as $d)
{
$stamp = new day($d);
switch($stamp->week)
{
case $this->day[0]:
echo '<tr><td style="background:' . $this->colbg[0] . ';">';
break;
case $this->day[1]:
echo '<td style="background:' . $this->colbg[1] . ';">';
break;
case $this->day[2]:
echo '<td style="background:' . $this->colbg[2] . ';">';
break;
case $this->day[3]:
echo '<td style="background:' . $this->colbg[3] . ';">';
break;
case $this->day[4]:
echo '<td style="background:' . $this->colbg[4] . ';">';
break;
case $this->day[5]:
echo '<td style="background:' . $this->colbg[5] . ';">';
break;
case $this->day[6]:
echo '<td style="background:' . $this->colbg[6] . ';">';
break;
default:
echo '<td>';
break;
}
$count_events = count($stamp->events);
if ($OneEventbgcolor
&& $OneEventbgcolor != ' '
&& $count_events == '1')
{
$bg_day = $OneEventbgcolor;
}
elseif ($Eventsbgcolor
&& $Eventsbgcolor != ' '
&& $count_events > '1')
{
$bg_day = $Eventsbgcolor;
}
else
{
$bg_day = isset($stamp->events[0]['cat_color']) ? $stamp->events[0]['cat_color'] : '#d4d4d4';
}
$bgcolor = iCColor::getBrightness($bg_day);
$bgcolor = ($bgcolor == 'bright') ? 'ic-bright' : 'ic-dark';
$order = 'first';
$multi_events = isset($stamp->events[1]['cat_color']) ? 'icmulti' : '';
// Ordering by time New Theme Packs (since 3.2.9)
$events = $stamp->events;
// Option for Ordering is not yet finished. This developpement is in brainstorming...
$ictip_ordering = '1';
$ictip_ordering = $this->ictip_ordering;
if ($ictip_ordering == '1_ASC-1_ASC' || $ictip_ordering == '1_ASC-1_DESC') $ictip_ordering = '1_ASC';
if ($ictip_ordering == '2_ASC-2_ASC' || $ictip_ordering == '2_ASC-2_DESC') $ictip_ordering = '2_ASC';
if ($ictip_ordering == '1_DESC-1_ASC' || $ictip_ordering == '1_DESC-1_DESC') $ictip_ordering = '1_DESC';
if ($ictip_ordering == '2_DESC-2_ASC' || $ictip_ordering == '2_DESC-2_DESC') $ictip_ordering = '2_DESC';
// Create Functions for Ordering
// Default $newfunc_1_ASC_2_ASC - edited 2015-07-01 to fix ordering by Time when am/pm
$newfunc_1_ASC_2_ASC = create_function('$a, $b', 'if ($a["time"] == $b["time"]){ return strcasecmp($a["cat_title"], $b["cat_title"]); } else { return strcasecmp(date("H:i", strtotime($a["time"])), date("H:i", strtotime($b["time"]))); }');
$newfunc_1_ASC_2_DESC = create_function('$a, $b', 'if ($a["time"] == $b["time"]){ return strcasecmp($b["cat_title"], $a["cat_title"]); } else { return strcasecmp($a["time"], $b["time"]); }');
$newfunc_1_DESC_2_ASC = create_function('$a, $b', 'if ($a["time"] == $b["time"]){ return strcasecmp($a["cat_title"], $b["cat_title"]); } else { return strcasecmp($b["time"], $a["time"]); }');
$newfunc_1_DESC_2_DESC = create_function('$a, $b', 'if ($a["time"] == $b["time"]){ return strcasecmp($b["cat_title"], $a["cat_title"]); } else { return strcasecmp($b["time"], $a["time"]); }');
$newfunc_2_ASC_1_ASC = create_function('$a, $b', 'if ($a["cat_title"] == $b["cat_title"]){ return strcasecmp($a["time"], $b["time"]); } else { return strcasecmp($a["cat_title"], $b["cat_title"]); }');
$newfunc_2_ASC_1_DESC = create_function('$a, $b', 'if ($a["cat_title"] == $b["cat_title"]){ return strcasecmp($b["time"], $a["time"]); } else { return strcasecmp($a["cat_title"], $b["cat_title"]); }');
$newfunc_2_DESC_1_ASC = create_function('$a, $b', 'if ($a["cat_title"] == $b["cat_title"]){ return strcasecmp($a["time"], $b["time"]); } else { return strcasecmp($b["cat_title"], $a["cat_title"]); }');
$newfunc_2_DESC_1_DESC = create_function('$a, $b', 'if ($a["cat_title"] == $b["cat_title"]){ return strcasecmp($b["time"], $a["time"]); } else { return strcasecmp($b["cat_title"], $a["cat_title"]); }');
$newfunc_1_ASC = create_function('$a, $b', 'return strcasecmp($a["time"], $b["time"]);');
$newfunc_2_ASC = create_function('$a, $b', 'return strcasecmp($a["cat_title"], $b["cat_title"]);');
$newfunc_1_DESC = create_function('$a, $b', 'return strcasecmp($b["time"], $a["time"]);');
$newfunc_2_DESC = create_function('$a, $b', 'return strcasecmp($b["cat_title"], $a["cat_title"]);');
// Order by time - Old Theme Packs (before 3.2.9) : Update Theme Pack to get all options
usort($stamp->events, $newfunc_1_ASC_2_ASC);
// Time ASC and if same time : Category Title ASC (default)
if ($ictip_ordering == '1_ASC-2_ASC')
{
usort($events, $newfunc_1_ASC_2_ASC);
}
// Time ASC and if same time : Category Title DESC
if ($ictip_ordering == '1_ASC-2_DESC')
{
usort($events, $newfunc_1_ASC_2_DESC);
}
// Time DESC and if same time : Category Title ASC
if ($ictip_ordering == '1_DESC-2_ASC')
{
usort($events, $newfunc_1_DESC_2_ASC);
}
// Time DESC and if same time : Category Title DESC
if ($ictip_ordering == '1_DESC-2_DESC')
{
usort($events, $newfunc_1_DESC_2_DESC);
}
// Category Title ASC and if same category : Time ASC
if ($ictip_ordering == '2_ASC-1_ASC')
{
usort($events, $newfunc_2_ASC_1_ASC);
}
// Category Title ASC and if same category : Time DESC
if ($ictip_ordering == '2_ASC-1_DESC')
{
usort($events, $newfunc_2_ASC_1_DESC);
}
// Category Title DESC and if same category : Time ASC
if ($ictip_ordering == '2_DESC-1_ASC')
{
usort($events, $newfunc_2_DESC_1_ASC);
}
// Category Title DESC and if same category : Time DESC
if ($ictip_ordering == '2_DESC-1_DESC')
{
usort($events, $newfunc_2_DESC_1_DESC);
}
// If main ordering and sub-ordering on Time : set TIME ASC (with no sub-ordering)
if ($ictip_ordering == '1_ASC')
{
usort($events, $newfunc_1_ASC);
}
// If main ordering and sub-ordering on Category Title : set CATEGORY TITLE ASC (with no sub-ordering)
if ($ictip_ordering == '2_ASC')
{
usort($events, $newfunc_2_ASC);
}
// Load template for day infotip
require $this->t_day;
switch('week')
{
case $this->day[6]:
echo '</td></tr>';
break;
default:
echo '</td>';
break;
}
}
switch ($stamp->week)
{
case $this->day[6]:
break;
default:
echo '<td colspan="' . (7-$stamp->week) . '"></td></tr>';
break;
}
echo '</table></div>';
echo '</div>';
}
}
class day
{
public $date;
public $week;
public $day;
public $month;
public $year;
public $events;
public $fontcolor;
function __construct($day)
{
foreach ($day as $k=>$v)
{
$this->$k = $v;
}
}
}
home/wuectly/www/modules/mod_banners/helper.php 0000604 00000003237 15245561555 0015761 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage mod_banners
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Environment\Browser;
/**
* Helper for mod_banners
*
* @since 1.5
*/
class ModBannersHelper
{
/**
* Retrieve list of banners
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return mixed
*/
public static function &getList(&$params)
{
JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_banners/models', 'BannersModel');
$document = JFactory::getDocument();
$app = JFactory::getApplication();
$keywords = explode(',', $document->getMetaData('keywords'));
$config = ComponentHelper::getParams('com_banners');
$model = JModelLegacy::getInstance('Banners', 'BannersModel', array('ignore_request' => true));
$model->setState('filter.client_id', (int) $params->get('cid'));
$model->setState('filter.category_id', $params->get('catid', array()));
$model->setState('list.limit', (int) $params->get('count', 1));
$model->setState('list.start', 0);
$model->setState('filter.ordering', $params->get('ordering'));
$model->setState('filter.tag_search', $params->get('tag_search'));
$model->setState('filter.keywords', $keywords);
$model->setState('filter.language', $app->getLanguageFilter());
$banners = $model->getItems();
if ($banners)
{
if ($config->get('track_robots_impressions', 1) == 1 || !Browser::getInstance()->isRobot())
{
$model->impress();
}
}
return $banners;
}
}
home/wuectly/www/modules/mod_related_items/helper.php 0000604 00000010267 15245562610 0017144 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage mod_related_items
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('ContentHelperRoute', JPATH_SITE . '/components/com_content/helpers/route.php');
/**
* Helper for mod_related_items
*
* @since 1.5
*/
abstract class ModRelatedItemsHelper
{
/**
* Get a list of related articles
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return array
*/
public static function getList(&$params)
{
$db = JFactory::getDbo();
$app = JFactory::getApplication();
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
$date = JFactory::getDate();
$maximum = (int) $params->get('maximum', 5);
// Get an instance of the generic articles model
JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_content/models');
$articles = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
if ($articles === false)
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
return array();
}
// Set application parameters in model
$appParams = $app->getParams();
$articles->setState('params', $appParams);
$option = $app->input->get('option');
$view = $app->input->get('view');
if (!($option === 'com_content' && $view === 'article'))
{
return array();
}
$temp = $app->input->getString('id');
$temp = explode(':', $temp);
$id = $temp[0];
$nullDate = $db->getNullDate();
$now = $date->toSql();
$related = array();
$query = $db->getQuery(true);
if ($id)
{
// Select the meta keywords from the item
$query->select('metakey')
->from('#__content')
->where('id = ' . (int) $id);
$db->setQuery($query);
try
{
$metakey = trim($db->loadResult());
}
catch (RuntimeException $e)
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
return array();
}
// Explode the meta keys on a comma
$keys = explode(',', $metakey);
$likes = array();
// Assemble any non-blank word(s)
foreach ($keys as $key)
{
$key = trim($key);
if ($key)
{
$likes[] = $db->escape($key);
}
}
if (count($likes))
{
// Select other items based on the metakey field 'like' the keys found
$query->clear()
->select('a.id')
->from('#__content AS a')
->where('a.id != ' . (int) $id)
->where('a.state = 1')
->where('a.access IN (' . $groups . ')');
$wheres = array();
foreach ($likes as $keyword)
{
$wheres[] = 'a.metakey LIKE ' . $db->quote('%' . $keyword . '%');
}
$query->where('(' . implode(' OR ', $wheres) . ')')
->where('(a.publish_up = ' . $db->quote($nullDate) . ' OR a.publish_up <= ' . $db->quote($now) . ')')
->where('(a.publish_down = ' . $db->quote($nullDate) . ' OR a.publish_down >= ' . $db->quote($now) . ')');
// Filter by language
if (JLanguageMultilang::isEnabled())
{
$query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
}
$db->setQuery($query, 0, $maximum);
try
{
$articleIds = $db->loadColumn();
}
catch (RuntimeException $e)
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
return array();
}
if (count($articleIds))
{
$articles->setState('filter.article_id', $articleIds);
$articles->setState('filter.published', 1);
$related = $articles->getItems();
}
unset($articleIds);
}
}
if (count($related))
{
// Prepare data for display using display options
foreach ($related as &$item)
{
$item->slug = $item->id . ':' . $item->alias;
/** @deprecated Catslug is deprecated, use catid instead. 4.0 */
$item->catslug = $item->catid . ':' . $item->category_alias;
$item->route = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language));
}
}
return $related;
}
}
home/wuectly/www/modules/mod_articles_news/helper.php 0000604 00000013424 15245570235 0017165 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage mod_articles_news
*
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('ContentHelperRoute', JPATH_SITE . '/components/com_content/helpers/route.php');
JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_content/models', 'ContentModel');
/**
* Helper for mod_articles_news
*
* @since 1.6
*/
abstract class ModArticlesNewsHelper
{
/**
* Get a list of the latest articles from the article model
*
* @param \Joomla\Registry\Registry &$params object holding the models parameters
*
* @return mixed
*
* @since 1.6
*/
public static function getList(&$params)
{
// Get an instance of the generic articles model
$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
// Set application parameters in model
$app = JFactory::getApplication();
$appParams = $app->getParams();
$model->setState('params', $appParams);
$model->setState('list.start', 0);
$model->setState('filter.published', 1);
// Set the filters based on the module params
$model->setState('list.limit', (int) $params->get('count', 5));
// This module does not use tags data
$model->setState('load_tags', false);
// Access filter
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
$model->setState('filter.access', $access);
// Category filter
$model->setState('filter.category_id', $params->get('catid', array()));
// Filter by language
$model->setState('filter.language', $app->getLanguageFilter());
// Filer by tag
$model->setState('filter.tag', $params->get('tag', array()));
// Featured switch
$featured = $params->get('show_featured', '');
if ($featured === '')
{
$model->setState('filter.featured', 'show');
}
elseif ($featured)
{
$model->setState('filter.featured', 'only');
}
else
{
$model->setState('filter.featured', 'hide');
}
// Set ordering
$ordering = $params->get('ordering', 'a.publish_up');
$model->setState('list.ordering', $ordering);
if (trim($ordering) === 'rand()')
{
$model->setState('list.ordering', JFactory::getDbo()->getQuery(true)->Rand());
}
else
{
$direction = $params->get('direction', 1) ? 'DESC' : 'ASC';
$model->setState('list.direction', $direction);
$model->setState('list.ordering', $ordering);
}
// Check if we should trigger additional plugin events
$triggerEvents = $params->get('triggerevents', 1);
// Retrieve Content
$items = $model->getItems();
foreach ($items as &$item)
{
$item->readmore = strlen(trim($item->fulltext));
$item->slug = $item->id . ':' . $item->alias;
/** @deprecated Catslug is deprecated, use catid instead. 4.0 */
$item->catslug = $item->catid . ':' . $item->category_alias;
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->catid, $item->language));
$item->linkText = JText::_('MOD_ARTICLES_NEWS_READMORE');
}
else
{
$item->link = new JUri(JRoute::_('index.php?option=com_users&view=login', false));
$item->link->setVar('return', base64_encode(ContentHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language)));
$item->linkText = JText::_('MOD_ARTICLES_NEWS_READMORE_REGISTER');
}
$item->introtext = JHtml::_('content.prepare', $item->introtext, '', 'mod_articles_news.content');
// Remove any images belongs to the text
if (!$params->get('image'))
{
$item->introtext = preg_replace('/<img[^>]*>/', '', $item->introtext);
}
// Show the Intro/Full image field of the article
if ($params->get('img_intro_full') !== 'none')
{
$images = json_decode($item->images);
$item->imageSrc = '';
$item->imageAlt = '';
$item->imageCaption = '';
if ($params->get('img_intro_full') === 'intro' && !empty($images->image_intro))
{
$item->imageSrc = htmlspecialchars($images->image_intro, ENT_COMPAT, 'UTF-8');
$item->imageAlt = htmlspecialchars($images->image_intro_alt, ENT_COMPAT, 'UTF-8');
if ($images->image_intro_caption)
{
$item->imageCaption = htmlspecialchars($images->image_intro_caption, ENT_COMPAT, 'UTF-8');
}
}
elseif ($params->get('img_intro_full') === 'full' && !empty($images->image_fulltext))
{
$item->imageSrc = htmlspecialchars($images->image_fulltext, ENT_COMPAT, 'UTF-8');
$item->imageAlt = htmlspecialchars($images->image_fulltext_alt, ENT_COMPAT, 'UTF-8');
if ($images->image_intro_caption)
{
$item->imageCaption = htmlspecialchars($images->image_fulltext_caption, ENT_COMPAT, 'UTF-8');
}
}
}
if ($triggerEvents)
{
$item->text = '';
$app->triggerEvent('onContentPrepare', array ('com_content.article', &$item, &$params, 0));
$results = $app->triggerEvent('onContentAfterTitle', array('com_content.article', &$item, &$params, 0));
$item->afterDisplayTitle = trim(implode("\n", $results));
$results = $app->triggerEvent('onContentBeforeDisplay', array('com_content.article', &$item, &$params, 0));
$item->beforeDisplayContent = trim(implode("\n", $results));
$results = $app->triggerEvent('onContentAfterDisplay', array('com_content.article', &$item, &$params, 0));
$item->afterDisplayContent = trim(implode("\n", $results));
}
else
{
$item->afterDisplayTitle = '';
$item->beforeDisplayContent = '';
$item->afterDisplayContent = '';
}
}
return $items;
}
}
home/wuectly/www/libraries/regularlabs/helpers/helper.php 0000604 00000003406 15245570534 0017736 0 ustar 00 <?php
/**
* @package Regular Labs Library
* @version 21.4.10972
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2021 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use RegularLabs\Library\Article as RL_Article;
use RegularLabs\Library\Cache as RL_Cache;
use RegularLabs\Library\Document as RL_Document;
use RegularLabs\Library\Parameters as RL_Parameters;
if (is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
}
class RLHelper
{
public static function getPluginHelper($plugin, $params = null)
{
if ( ! class_exists('RegularLabs\Library\Cache'))
{
return null;
}
$hash = md5('getPluginHelper_' . $plugin->get('_type') . '_' . $plugin->get('_name') . '_' . json_encode($params));
if (RL_Cache::has($hash))
{
return RL_Cache::get($hash);
}
if ( ! $params)
{
$params = RL_Parameters::getInstance()->getPluginParams($plugin->get('_name'));
}
$file = JPATH_PLUGINS . '/' . $plugin->get('_type') . '/' . $plugin->get('_name') . '/helper.php';
if ( ! is_file($file))
{
return null;
}
require_once $file;
$class = get_class($plugin) . 'Helper';
return RL_Cache::set(
$hash,
new $class($params)
);
}
public static function processArticle(&$article, &$context, &$helper, $method, $params = [])
{
class_exists('RegularLabs\Library\Article') && RL_Article::process($article, $context, $helper, $method, $params);
}
public static function isCategoryList($context)
{
return class_exists('RegularLabs\Library\Document') && RL_Document::isCategoryList($context);
}
}
home/wuectly/www/libraries/f0f/layout/helper.php 0000604 00000002350 15245570545 0015760 0 ustar 00 <?php
/**
* @package FrameworkOnFramework
* @subpackage layout
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Protect from unauthorized access
defined('F0F_INCLUDED') or die;
/**
* Helper to render a F0FLayout object, storing a base path
*
* @package FrameworkOnFramework
* @since x.y
*/
class F0FLayoutHelper extends JLayoutHelper
{
/**
* Method to render the layout.
*
* @param string $layoutFile Dot separated path to the layout file, relative to base path
* @param object $displayData Object which properties are used inside the layout file to build displayed output
* @param string $basePath Base path to use when loading layout files
*
* @return string
*/
public static function render($layoutFile, $displayData = null, $basePath = '')
{
$basePath = empty($basePath) ? self::$defaultBasePath : $basePath;
// Make sure we send null to F0FLayoutFile if no path set
$basePath = empty($basePath) ? null : $basePath;
$layout = new F0FLayoutFile($layoutFile, $basePath);
$renderedLayout = $layout->render($displayData);
return $renderedLayout;
}
}
home/wuectly/www/administrator/modules/mod_feed/helper.php 0000604 00000001736 15245570567 0020121 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage mod_feed
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_feed
*
* @since 1.5
*/
class ModFeedHelper
{
/**
* Method to load a feed.
*
* @param JRegisty $params The parameters object.
*
* @return JFeedReader|string Return a JFeedReader object or a string message if error.
*
* @since 1.5
*/
public static function getFeed($params)
{
// Module params
$rssurl = $params->get('rssurl', '');
// Get RSS parsed object
try
{
jimport('joomla.feed.factory');
$feed = new JFeedFactory;
$rssDoc = $feed->getFeed($rssurl);
}
catch (Exception $e)
{
return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
}
if (empty($rssDoc))
{
return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
}
return $rssDoc;
}
}
home/wuectly/www/administrator/includes/helper.php 0000604 00000001737 15245571346 0016512 0 ustar 00 <?php
/**
* @package Joomla.Administrator
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Joomla! Administrator Application helper class.
* Provide many supporting API functions.
*
* @since 1.5
*
* @deprecated 4.0 Deprecated without replacement
*/
class JAdministratorHelper
{
/**
* Return the application option string [main component].
*
* @return string The component to access.
*
* @since 1.5
*/
public static function findOption()
{
$app = JFactory::getApplication();
$option = strtolower($app->input->get('option'));
$app->loadIdentity();
$user = $app->getIdentity();
if ($user->get('guest') || !$user->authorise('core.login.admin'))
{
$option = 'com_login';
}
if (empty($option))
{
$option = 'com_cpanel';
}
$app->input->set('option', $option);
return $option;
}
}
home/wuectly/www/modules/mod_users_latest/helper.php 0000604 00000002763 15245572017 0017044 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage mod_users_latest
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_users_latest
*
* @since 1.6
*/
class ModUsersLatestHelper
{
/**
* Get users sorted by activation date
*
* @param \Joomla\Registry\Registry $params module parameters
*
* @return array The array of users
*
* @since 1.6
*/
public static function getUsers($params)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName(array('a.id', 'a.name', 'a.username', 'a.registerDate')))
->order($db->quoteName('a.registerDate') . ' DESC')
->from('#__users AS a');
$user = JFactory::getUser();
if (!$user->authorise('core.admin') && $params->get('filter_groups', 0) == 1)
{
$groups = $user->getAuthorisedGroups();
if (empty($groups))
{
return array();
}
$query->join('LEFT', '#__user_usergroup_map AS m ON m.user_id = a.id')
->join('LEFT', '#__usergroups AS ug ON ug.id = m.group_id')
->where('ug.id in (' . implode(',', $groups) . ')')
->where('ug.id <> 1');
}
$db->setQuery($query, 0, $params->get('shownumber', 5));
try
{
return (array) $db->loadObjectList();
}
catch (RuntimeException $e)
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
return array();
}
}
}
home/wuectly/www/modules/mod_wrapper/helper.php 0000604 00000002604 15245572056 0016004 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage mod_wrapper
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_wrapper
*
* @since 1.5
*/
class ModWrapperHelper
{
/**
* Gets the parameters for the wrapper
*
* @param mixed &$params The parameters set in the administrator section
*
* @return mixed ¶ms The modified parameters
*
* @since 1.5
*/
public static function getParams(&$params)
{
$params->def('url', '');
$params->def('scrolling', 'auto');
$params->def('height', '200');
$params->def('height_auto', 0);
$params->def('width', '100%');
$params->def('add', 1);
$params->def('name', 'wrapper');
$url = $params->get('url');
if ($params->get('add'))
{
// Adds 'http://' if none is set
if (strpos($url, '/') === 0)
{
// Relative URL in component. use server http_host.
$url = 'http://' . $_SERVER['HTTP_HOST'] . $url;
}
elseif (strpos($url, 'http') === false && strpos($url, 'https') === false)
{
$url = 'http://' . $url;
}
}
// Auto height control
if ($params->def('height_auto'))
{
$load = 'onload="iFrameHeight(this)"';
}
else
{
$load = '';
}
$params->set('load', $load);
$params->set('url', $url);
return $params;
}
}
home/wuectly/www/modules/mod_breadcrumbs/helper.php 0000604 00000004625 15245572332 0016617 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage mod_breadcrumbs
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_breadcrumbs
*
* @since 1.5
*/
class ModBreadCrumbsHelper
{
/**
* Retrieve breadcrumb items
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return array
*/
public static function getList(&$params)
{
// Get the PathWay object from the application
$app = JFactory::getApplication();
$pathway = $app->getPathway();
$items = $pathway->getPathWay();
$lang = JFactory::getLanguage();
$menu = $app->getMenu();
// Look for the home menu
if (JLanguageMultilang::isEnabled())
{
$home = $menu->getDefault($lang->getTag());
}
else
{
$home = $menu->getDefault();
}
$count = count($items);
// Don't use $items here as it references JPathway properties directly
$crumbs = array();
for ($i = 0; $i < $count; $i ++)
{
$crumbs[$i] = new stdClass;
$crumbs[$i]->name = stripslashes(htmlspecialchars($items[$i]->name, ENT_COMPAT, 'UTF-8'));
$crumbs[$i]->link = !is_null($items[$i]->link) ? JRoute::_($items[$i]->link) : '';
}
if ($params->get('showHome', 1))
{
$item = new stdClass;
$item->name = htmlspecialchars($params->get('homeText', JText::_('MOD_BREADCRUMBS_HOME')), ENT_COMPAT, 'UTF-8');
$item->link = JRoute::_('index.php?Itemid=' . $home->id);
array_unshift($crumbs, $item);
}
return $crumbs;
}
/**
* Set the breadcrumbs separator for the breadcrumbs display.
*
* @param string $custom Custom xhtml compliant string to separate the items of the breadcrumbs
*
* @return string Separator string
*
* @since 1.5
*/
public static function setSeparator($custom = null)
{
$lang = JFactory::getLanguage();
// If a custom separator has not been provided we try to load a template
// specific one first, and if that is not present we load the default separator
if ($custom === null)
{
if ($lang->isRtl())
{
$_separator = JHtml::_('image', 'system/arrow_rtl.png', null, null, true);
}
else
{
$_separator = JHtml::_('image', 'system/arrow.png', null, null, true);
}
}
else
{
$_separator = htmlspecialchars($custom, ENT_COMPAT, 'UTF-8');
}
return $_separator;
}
}
home/wuectly/www/modules/mod_menu/helper.php 0000604 00000014531 15245573346 0015275 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage mod_menu
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_menu
*
* @since 1.5
*/
class ModMenuHelper
{
/**
* Get a list of the menu items.
*
* @param \Joomla\Registry\Registry &$params The module options.
*
* @return array
*
* @since 1.5
*/
public static function getList(&$params)
{
$app = JFactory::getApplication();
$menu = $app->getMenu();
// Get active menu item
$base = self::getBase($params);
$user = JFactory::getUser();
$levels = $user->getAuthorisedViewLevels();
asort($levels);
$key = 'menu_items' . $params . implode(',', $levels) . '.' . $base->id;
$cache = JFactory::getCache('mod_menu', '');
if ($cache->contains($key))
{
$items = $cache->get($key);
}
else
{
$path = $base->tree;
$start = (int) $params->get('startLevel', 1);
$end = (int) $params->get('endLevel', 0);
$showAll = $params->get('showAllChildren', 1);
$items = $menu->getItems('menutype', $params->get('menutype'));
$hidden_parents = array();
$lastitem = 0;
if ($items)
{
foreach ($items as $i => $item)
{
$item->parent = false;
if (isset($items[$lastitem]) && $items[$lastitem]->id == $item->parent_id && $item->params->get('menu_show', 1) == 1)
{
$items[$lastitem]->parent = true;
}
if (($start && $start > $item->level)
|| ($end && $item->level > $end)
|| (!$showAll && $item->level > 1 && !in_array($item->parent_id, $path))
|| ($start > 1 && !in_array($item->tree[$start - 2], $path)))
{
unset($items[$i]);
continue;
}
// Exclude item with menu item option set to exclude from menu modules
if (($item->params->get('menu_show', 1) == 0) || in_array($item->parent_id, $hidden_parents))
{
$hidden_parents[] = $item->id;
unset($items[$i]);
continue;
}
$item->deeper = false;
$item->shallower = false;
$item->level_diff = 0;
if (isset($items[$lastitem]))
{
$items[$lastitem]->deeper = ($item->level > $items[$lastitem]->level);
$items[$lastitem]->shallower = ($item->level < $items[$lastitem]->level);
$items[$lastitem]->level_diff = ($items[$lastitem]->level - $item->level);
}
$lastitem = $i;
$item->active = false;
$item->flink = $item->link;
// Reverted back for CMS version 2.5.6
switch ($item->type)
{
case 'separator':
break;
case 'heading':
// No further action needed.
break;
case 'url':
if ((strpos($item->link, 'index.php?') === 0) && (strpos($item->link, 'Itemid=') === false))
{
// If this is an internal Joomla link, ensure the Itemid is set.
$item->flink = $item->link . '&Itemid=' . $item->id;
}
break;
case 'alias':
$item->flink = 'index.php?Itemid=' . $item->params->get('aliasoptions');
// Get the language of the target menu item when site is multilingual
if (JLanguageMultilang::isEnabled())
{
$newItem = JFactory::getApplication()->getMenu()->getItem((int) $item->params->get('aliasoptions'));
// Use language code if not set to ALL
if ($newItem != null && $newItem->language && $newItem->language !== '*')
{
$item->flink .= '&lang=' . $newItem->language;
}
}
break;
default:
$item->flink = 'index.php?Itemid=' . $item->id;
break;
}
if ((strpos($item->flink, 'index.php?') !== false) && strcasecmp(substr($item->flink, 0, 4), 'http'))
{
$item->flink = JRoute::_($item->flink, true, $item->params->get('secure'));
}
else
{
$item->flink = JRoute::_($item->flink);
}
// We prevent the double encoding because for some reason the $item is shared for menu modules and we get double encoding
// when the cause of that is found the argument should be removed
$item->title = htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8', false);
$item->anchor_css = htmlspecialchars($item->params->get('menu-anchor_css', ''), ENT_COMPAT, 'UTF-8', false);
$item->anchor_title = htmlspecialchars($item->params->get('menu-anchor_title', ''), ENT_COMPAT, 'UTF-8', false);
$item->anchor_rel = htmlspecialchars($item->params->get('menu-anchor_rel', ''), ENT_COMPAT, 'UTF-8', false);
$item->menu_image = $item->params->get('menu_image', '') ?
htmlspecialchars($item->params->get('menu_image', ''), ENT_COMPAT, 'UTF-8', false) : '';
$item->menu_image_css = htmlspecialchars($item->params->get('menu_image_css', ''), ENT_COMPAT, 'UTF-8', false);
}
if (isset($items[$lastitem]))
{
$items[$lastitem]->deeper = (($start ?: 1) > $items[$lastitem]->level);
$items[$lastitem]->shallower = (($start ?: 1) < $items[$lastitem]->level);
$items[$lastitem]->level_diff = ($items[$lastitem]->level - ($start ?: 1));
}
}
$cache->store($items, $key);
}
return $items;
}
/**
* Get base menu item.
*
* @param \Joomla\Registry\Registry &$params The module options.
*
* @return object
*
* @since 3.0.2
*/
public static function getBase(&$params)
{
// Get base menu item from parameters
if ($params->get('base'))
{
$base = JFactory::getApplication()->getMenu()->getItem($params->get('base'));
}
else
{
$base = false;
}
// Use active menu item if no base found
if (!$base)
{
$base = self::getActive($params);
}
return $base;
}
/**
* Get active menu item.
*
* @param \Joomla\Registry\Registry &$params The module options.
*
* @return object
*
* @since 3.0.2
*/
public static function getActive(&$params)
{
$menu = JFactory::getApplication()->getMenu();
return $menu->getActive() ?: self::getDefault();
}
/**
* Get default menu item (home page) for current language.
*
* @return object
*/
public static function getDefault()
{
$menu = JFactory::getApplication()->getMenu();
$lang = JFactory::getLanguage();
// Look for the home menu
if (JLanguageMultilang::isEnabled())
{
return $menu->getDefault($lang->getTag());
}
else
{
return $menu->getDefault();
}
}
}
home/wuectly/www/modules/mod_random_image/helper.php 0000604 00000005706 15245603130 0016740 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage mod_random_image
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\String\StringHelper;
/**
* Helper for mod_random_image
*
* @since 1.5
*/
class ModRandomImageHelper
{
/**
* Retrieves a random image
*
* @param \Joomla\Registry\Registry &$params module parameters object
* @param array $images list of images
*
* @return mixed
*/
public static function getRandomImage(&$params, $images)
{
$width = $params->get('width', 100);
$height = $params->get('height', null);
$i = count($images);
$random = mt_rand(0, $i - 1);
$image = $images[$random];
$size = getimagesize(JPATH_BASE . '/' . $image->folder . '/' . $image->name);
if ($size[0] < $width)
{
$width = $size[0];
}
$coeff = $size[0] / $size[1];
if ($height === null)
{
$height = (int) ($width / $coeff);
}
else
{
$newheight = min($height, (int) ($width / $coeff));
if ($newheight < $height)
{
$height = $newheight;
}
else
{
$width = $height * $coeff;
}
}
$image->width = $width;
$image->height = $height;
$image->folder = str_replace('\\', '/', $image->folder);
return $image;
}
/**
* Retrieves images from a specific folder
*
* @param \Joomla\Registry\Registry &$params module params
* @param string $folder folder to get the images from
*
* @return array
*/
public static function getImages(&$params, $folder)
{
$type = $params->get('type', 'jpg');
$files = array();
$images = array();
$dir = JPATH_BASE . '/' . $folder;
// Check if directory exists
if (is_dir($dir))
{
if ($handle = opendir($dir))
{
while (false !== ($file = readdir($handle)))
{
if ($file !== '.' && $file !== '..' && $file !== 'CVS' && $file !== 'index.html')
{
$files[] = $file;
}
}
}
closedir($handle);
$i = 0;
foreach ($files as $img)
{
if (!is_dir($dir . '/' . $img) && preg_match('/' . $type . '/', $img))
{
$images[$i] = new stdClass;
$images[$i]->name = $img;
$images[$i]->folder = $folder;
$i++;
}
}
}
return $images;
}
/**
* Get sanitized folder
*
* @param \Joomla\Registry\Registry &$params module params objects
*
* @return mixed
*/
public static function getFolder(&$params)
{
$folder = $params->get('folder');
$LiveSite = JUri::base();
// If folder includes livesite info, remove
if (StringHelper::strpos($folder, $LiveSite) === 0)
{
$folder = str_replace($LiveSite, '', $folder);
}
// If folder includes absolute path, remove
if (StringHelper::strpos($folder, JPATH_SITE) === 0)
{
$folder = str_replace(JPATH_BASE, '', $folder);
}
return str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $folder);
}
}
home/wuectly/www/libraries/fof/utils/config/helper.php 0000604 00000005143 15245606743 0017152 0 ustar 00 <?php
/**
* @package FrameworkOnFramework
* @subpackage utils
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('FOF_INCLUDED') or die;
/**
* A utility class to help you fetch component parameters without going through JComponentHelper
*/
class FOFUtilsConfigHelper
{
/**
* Caches the component parameters without going through JComponentHelper. This is necessary since JComponentHelper
* cannot be reset or updated once you update parameters in the database.
*
* @var array
*/
private static $componentParams = array();
/**
* Loads the component's configuration parameters so they can be accessed by getComponentConfigurationValue
*
* @param string $component The component for loading the parameters
* @param bool $force Should I force-reload the configuration information?
*/
public final static function loadComponentConfig($component, $force = false)
{
if (isset(self::$componentParams[$component]) && !is_null(self::$componentParams[$component]) && !$force)
{
return;
}
$db = FOFPlatform::getInstance()->getDbo();
$sql = $db->getQuery(true)
->select($db->qn('params'))
->from($db->qn('#__extensions'))
->where($db->qn('type') . ' = ' . $db->q('component'))
->where($db->qn('element') . " = " . $db->q($component));
$db->setQuery($sql);
$config_ini = $db->loadResult();
// OK, Joomla! 1.6 stores values JSON-encoded so, what do I do? Right!
$config_ini = trim($config_ini);
if ((substr($config_ini, 0, 1) == '{') && substr($config_ini, -1) == '}')
{
$config_ini = json_decode($config_ini, true);
}
else
{
$config_ini = FOFUtilsIniParser::parse_ini_file($config_ini, false, true);
}
if (is_null($config_ini) || empty($config_ini))
{
$config_ini = array();
}
self::$componentParams[$component] = $config_ini;
}
/**
* Retrieves the value of a component configuration parameter without going through JComponentHelper
*
* @param string $component The component for loading the parameter value
* @param string $key The key to retrieve
* @param mixed $default The default value to use in case the key is missing
*
* @return mixed
*/
public final static function getComponentConfigurationValue($component, $key, $default = null)
{
self::loadComponentConfig($component, false);
if (array_key_exists($key, self::$componentParams[$component]))
{
return self::$componentParams[$component][$key];
}
else
{
return $default;
}
}
} home/wuectly/www/modules/mod_whosonline/helper.php 0000604 00000005176 15245607031 0016510 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage mod_whosonline
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_whosonline
*
* @since 1.5
*/
class ModWhosonlineHelper
{
/**
* Show online count
*
* @return array The number of Users and Guests online.
*
* @since 1.5
**/
public static function getOnlineCount()
{
$db = JFactory::getDbo();
// Calculate number of guests and users
$result = array();
$user_array = 0;
$guest_array = 0;
$whereCondition = JFactory::getConfig()->get('shared_session', '0') ? 'IS NULL' : '= 0';
$query = $db->getQuery(true)
->select('guest, client_id')
->from('#__session')
->where('client_id ' . $whereCondition);
$db->setQuery($query);
try
{
$sessions = (array) $db->loadObjectList();
}
catch (RuntimeException $e)
{
$sessions = array();
}
if (count($sessions))
{
foreach ($sessions as $session)
{
// If guest increase guest count by 1
if ($session->guest == 1)
{
$guest_array ++;
}
// If member increase member count by 1
if ($session->guest == 0)
{
$user_array ++;
}
}
}
$result['user'] = $user_array;
$result['guest'] = $guest_array;
return $result;
}
/**
* Show online member names
*
* @param mixed $params The parameters
*
* @return array (array) $db->loadObjectList() The names of the online users.
*
* @since 1.5
**/
public static function getOnlineUserNames($params)
{
$whereCondition = JFactory::getConfig()->get('shared_session', '0') ? 'IS NULL' : '= 0';
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName(array('a.username', 'a.userid', 'a.client_id')))
->from('#__session AS a')
->where($db->quoteName('a.userid') . ' != 0')
->where($db->quoteName('a.client_id') . ' ' . $whereCondition)
->group($db->quoteName(array('a.username', 'a.userid', 'a.client_id')));
$user = JFactory::getUser();
if (!$user->authorise('core.admin') && $params->get('filter_groups', 0) == 1)
{
$groups = $user->getAuthorisedGroups();
if (empty($groups))
{
return array();
}
$query->join('LEFT', '#__user_usergroup_map AS m ON m.user_id = a.userid')
->join('LEFT', '#__usergroups AS ug ON ug.id = m.group_id')
->where('ug.id in (' . implode(',', $groups) . ')')
->where('ug.id <> 1');
}
$db->setQuery($query);
try
{
return (array) $db->loadObjectList();
}
catch (RuntimeException $e)
{
return array();
}
}
}
home/wuectly/www/administrator/modules/mod_latestactions/helper.php 0000604 00000003537 15245607713 0022066 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage mod_latestactions
*
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
/**
* Helper for mod_latestactions
*
* @since 3.9.0
*/
abstract class ModLatestActionsHelper
{
/**
* Get a list of articles.
*
* @param \Joomla\Registry\Registry &$params The module parameters.
*
* @return mixed An array of action logs, or false on error.
*/
public static function getList(&$params)
{
JLoader::register('ActionlogsModelActionlogs', JPATH_ADMINISTRATOR . '/components/com_actionlogs/models/actionlogs.php');
JLoader::register('ActionlogsHelper', JPATH_ADMINISTRATOR . '/components/com_actionlogs/helpers/actionlogs.php');
/* @var ActionlogsModelActionlogs $model */
$model = BaseDatabaseModel::getInstance('Actionlogs', 'ActionlogsModel', array('ignore_request' => true));
// Set the Start and Limit
$model->setState('list.start', 0);
$model->setState('list.limit', $params->get('count', 5));
$model->setState('list.ordering', 'a.id');
$model->setState('list.direction', 'DESC');
$rows = $model->getItems();
// Load all actionlog plugins language files
ActionlogsHelper::loadActionLogPluginsLanguage();
foreach ($rows as $row)
{
$row->message = ActionlogsHelper::getHumanReadableLogMessage($row);
}
return $rows;
}
/**
* Get the alternate title for the module
*
* @param \Joomla\Registry\Registry $params The module parameters.
*
* @return string The alternate title for the module.
*
* @since 3.9.1
*/
public static function getTitle($params)
{
return Text::plural('MOD_LATESTACTIONS_TITLE', $params->get('count', 5));
}
}
home/wuectly/www/modules/mod_stats/helper.php 0000604 00000006770 15245613320 0015460 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage mod_stats
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_stats
*
* @since 1.5
*/
class ModStatsHelper
{
/**
* Get list of stats
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return array
*/
public static function &getList(&$params)
{
$app = JFactory::getApplication();
$db = JFactory::getDbo();
$rows = array();
$query = $db->getQuery(true);
$serverinfo = $params->get('serverinfo', 0);
$siteinfo = $params->get('siteinfo', 0);
$counter = $params->get('counter', 0);
$increase = $params->get('increase', 0);
$i = 0;
if ($serverinfo)
{
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_OS');
$rows[$i]->data = substr(php_uname(), 0, 7);
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_PHP');
$rows[$i]->data = phpversion();
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_($db->name);
$rows[$i]->data = $db->getVersion();
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_TIME');
$rows[$i]->data = JHtml::_('date', 'now', 'H:i');
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_CACHING');
$rows[$i]->data = $app->get('caching') ? JText::_('JENABLED') : JText::_('JDISABLED');
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_GZIP');
$rows[$i]->data = $app->get('gzip') ? JText::_('JENABLED') : JText::_('JDISABLED');
$i++;
}
if ($siteinfo)
{
$query->select('COUNT(id) AS count_users')
->from('#__users');
$db->setQuery($query);
try
{
$users = $db->loadResult();
}
catch (RuntimeException $e)
{
$users = false;
}
$query->clear()
->select('COUNT(id) AS count_items')
->from('#__content')
->where('state = 1');
$db->setQuery($query);
try
{
$items = $db->loadResult();
}
catch (RuntimeException $e)
{
$items = false;
}
if ($users)
{
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_USERS');
$rows[$i]->data = $users;
$i++;
}
if ($items)
{
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_ARTICLES');
$rows[$i]->data = $items;
$i++;
}
}
if ($counter)
{
$query->clear()
->select('SUM(hits) AS count_hits')
->from('#__content')
->where('state = 1');
$db->setQuery($query);
try
{
$hits = $db->loadResult();
}
catch (RuntimeException $e)
{
$hits = false;
}
if ($hits)
{
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_ARTICLES_VIEW_HITS');
$rows[$i]->data = $hits + $increase;
$i++;
}
}
// Include additional data defined by published system plugins
JPluginHelper::importPlugin('system');
$arrays = (array) $app->triggerEvent('onGetStats', array('mod_stats'));
foreach ($arrays as $response)
{
foreach ($response as $row)
{
// We only add a row if the title and data are given
if (isset($row['title']) && isset($row['data']))
{
$rows[$i] = new stdClass;
$rows[$i]->title = $row['title'];
$rows[$i]->icon = isset($row['icon']) ? $row['icon'] : 'info';
$rows[$i]->data = $row['data'];
$i++;
}
}
}
return $rows;
}
}
home/wuectly/www/modules/mod_articles_popular/helper.php 0000604 00000006102 15245613416 0017665 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage mod_articles_popular
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('ContentHelperRoute', JPATH_SITE . '/components/com_content/helpers/route.php');
JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_content/models', 'ContentModel');
/**
* Helper for mod_articles_popular
*
* @since 1.6
*/
abstract class ModArticlesPopularHelper
{
/**
* Get a list of popular articles from the articles model
*
* @param \Joomla\Registry\Registry &$params object holding the models parameters
*
* @return mixed
*/
public static function getList(&$params)
{
// Get an instance of the generic articles model
$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
// Set application parameters in model
$app = JFactory::getApplication();
$appParams = $app->getParams();
$model->setState('params', $appParams);
$model->setState('list.start', 0);
$model->setState('filter.published', 1);
// Set the filters based on the module params
$model->setState('list.limit', (int) $params->get('count', 5));
$model->setState('filter.featured', $params->get('show_front', 1) == 1 ? 'show' : 'hide');
// This module does not use tags data
$model->setState('load_tags', false);
// Access filter
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
$model->setState('filter.access', $access);
// Category filter
$model->setState('filter.category_id', $params->get('catid', array()));
// Date filter
$date_filtering = $params->get('date_filtering', 'off');
if ($date_filtering !== 'off')
{
$model->setState('filter.date_filtering', $date_filtering);
$model->setState('filter.date_field', $params->get('date_field', 'a.created'));
$model->setState('filter.start_date_range', $params->get('start_date_range', '1000-01-01 00:00:00'));
$model->setState('filter.end_date_range', $params->get('end_date_range', '9999-12-31 23:59:59'));
$model->setState('filter.relative_date', $params->get('relative_date', 30));
}
// Filter by language
$model->setState('filter.language', $app->getLanguageFilter());
// Ordering
$model->setState('list.ordering', 'a.hits');
$model->setState('list.direction', 'DESC');
$items = $model->getItems();
foreach ($items as &$item)
{
$item->slug = $item->id . ':' . $item->alias;
/** @deprecated Catslug is deprecated, use catid instead. 4.0 */
$item->catslug = $item->catid . ':' . $item->category_alias;
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->catid, $item->language));
}
else
{
$item->link = JRoute::_('index.php?option=com_users&view=login');
}
}
return $items;
}
}
home/wuectly/www/components/com_config/controller/helper.php 0000604 00000005071 15245613430 0020461 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper class for controllers
*
* @since 3.2
*/
class ConfigControllerHelper
{
/**
* Method to parse a controller from a url
* Defaults to the base controllers and passes an array of options.
* $options[0] is the location of the controller which defaults to the core libraries (referenced as 'j'
* and then the named folder within the component entry point file.
* $options[1] is the name of the controller file,
* $options[2] is the name of the folder found in the component controller folder for controllers
* not prefixed with Config.
* Additional options maybe added to parameterize the controller.
*
* @param JApplicationBase $app An application object
*
* @return JController A JController object
*
* @since 3.2
*/
public function parseController($app)
{
$tasks = array();
if ($task = $app->input->get('task'))
{
// Toolbar expects old style but we are using new style
// Remove when toolbar can handle either directly
if (strpos($task, '/') !== false)
{
$tasks = explode('/', $task);
}
else
{
$tasks = explode('.', $task);
}
}
elseif ($controllerTask = $app->input->get('controller'))
{
// Temporary solution
if (strpos($controllerTask, '/') !== false)
{
$tasks = explode('/', $controllerTask);
}
else
{
$tasks = explode('.', $controllerTask);
}
}
if (empty($tasks[0]) || $tasks[0] === 'Config')
{
$location = 'Config';
}
else
{
$location = ucfirst(strtolower($tasks[0]));
}
if (empty($tasks[1]))
{
$activity = 'Display';
}
else
{
$activity = ucfirst(strtolower($tasks[1]));
}
$view = '';
if (!empty($tasks[2]))
{
$view = ucfirst(strtolower($tasks[2]));
}
// Some special handling for com_config administrator
$option = $app->input->get('option');
if ($option === 'com_config' && $app->isClient('administrator'))
{
$component = $app->input->get('component');
if (!empty($component))
{
$view = 'Component';
}
elseif ($option === 'com_config')
{
$view = 'Application';
}
}
$controllerName = $location . 'Controller' . $view . $activity;
if (!class_exists($controllerName))
{
return false;
}
$controller = new $controllerName;
$controller->options = array();
$controller->options = $tasks;
return $controller;
}
}
home/wuectly/www/modules/mod_bgmax/helper.php 0000604 00000044447 15245613474 0015435 0 ustar 00 <?php
/*------------------------------------------------------------------------
# mod_bgmax - bgMax
# ------------------------------------------------------------------------
# author lomart
# copyright : Copyright (C) 2011 lomart.fr All Rights Reserved.
# @license : http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Website : http://lomart.fr
# Technical Support: Forum - http://forum.joomla.fr
-------------------------------------------------------------------------*/
// no direct access
defined('_JEXEC') or die('Restricted access');
global $bgmaxDebug;
/**
* retourne une couleur en notation hexa sur 6 caracteres sans #
**/
function bg_hex2hex($color)
{
$color = trim($color,'#');
if (strlen($color) == 6) {
return $color;
} elseif (strlen($color) == 3) {
return $color[0].$color[0].$color[1].$color[1].$color[2].$color[2];
} else {
return "";
}
}
/**
* retourne une couleur en notation hexa (#RGB ou #RRGGBB ou RGB)
* sous la forme d'une chaine "r,v,b"
**/
function bg_hex2rgb($color)
{
$color = trim($color,'#');
if (strlen($color) == 6) {
list($r, $g, $b) = array($color[0].$color[1], $color[2].$color[3], $color[4].$color[5]);
} elseif (strlen($color) == 3) {
list($r, $g, $b) = array($color[0].$color[0], $color[1].$color[1], $color[2].$color[2]);
} else {
return false;
}
return hexdec($r).','.hexdec($g).','.hexdec($b);
}
/**
* Retourne la couleur du pixel en bas a gauche de l'image
**/
function colorImageBottom($imageName) {
// recuperer le type et la taille de l'image
// Pb sur certains JPG qui retourne ''
list($imgW, $imgH, $imgTyp) = getimagesize($imageName);
switch ( $imgTyp ) {
case 1 : $im = imagecreatefromgif($imageName); break;
case 2;
case ' ' : $im = imagecreatefromjpeg($imageName); break;
case 3 : $im = imagecreatefrompng($imageName); break;
default: {
$app = JFactory::getApplication();
$app->enqueueMessage(JTEXT::_('IMGNAME_ERROR').'[name='.$imageName.'] [ type='.$imgTyp.'] [ format= '.$imgW.'x'.$imgH,'error');
var_dump(gd_info() );
return "";
}
}
$rgb = imagecolorat($im, 2, ($imgH-2));
$hex = sprintf("%06X", $rgb);
return $hex;
}
/**
* Retourne une date JJ-MM-AAAA au format AAAA-MM-JJ
*
**/
function bg_formatDate($date) {
$tmp = explode('-',$date);
$tmp = array_reverse($tmp);
return implode('-',$tmp);
}
/**
* Retourne une image au hasard - adaptation de ja_purity_ii
**/
function getRandomImage ($img_folder) {
$imglist=array();
if ($dh = @opendir($img_folder)) {
while (($f = readdir($dh)) !== false) {
$ext = substr(trim(strtolower($f)),-3);
if (($ext == 'jpg') || ($ext == 'gif') || ($ext == 'png')) {
$imglist[] = $f;
}
}
closedir($dh);
}
if(!count($imglist)) return '';
$random = rand(0, count($imglist)-1);
$image = $imglist[$random];
return $image;
}
/**
* Retourne vrai si execution sur mobile
**/
function bg_isMobile() {
return preg_match("/(avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]);
}
class modBgMaxHelper
{
/**
* Retourne un tableau avec les arguments a ajouter dans la page
* $bgmax["head"] : chaine a ajouter dans head
* $bgmax["body"] : chaine a ajouter dans body a la position module
**/
public static function getBgMaxInfos(&$params, $modTitle)
{
$app = JFactory::getApplication();
// tableau pour retour
$bgmax = array("head" => "", "body" => "");
// DEBUG affiche la totalite des parametres pour analyse
$bgmaxDebug = $params->get('bgmaxDebug');
if ($bgmaxDebug=='2') {
$user = JFactory::getUser();
if (!$user->id) $bgmaxDebug = false;
}
/****
* PERIODE : DOIT-ON PUBLIER ?
****/
// attention, ambiguite si date fin vide et heure indiquee:
// on traite comme periode horaire journaliere
$ok = false;
$debDate = str_replace('/','-',substr($params->get('debDate'),0,10)); // compatibilite ancienne version
$debDate = bg_formatDate($debDate);
$debTime=$params->get('debTime','00:00');
$endDate = str_replace('/','-',substr($params->get('endDate'),0,10)); // compatibilite ancienne version
$endDate = bg_formatDate($endDate);
$endTime=$params->get('endTime','23:59');
// Pour faciliter les calculs, on force la date debut/fin à une date infinie si une date de fin/debut complete est indiquee. le cas d'une heure sans date n'est pas geree
if ((strlen($endDate)==10) && (strlen($debDate)==0)) { $debDate='1900-01-01'; }
if ((strlen($debDate)==10) && (strlen($endDate)==0)) { $endDate='2900-01-01'; }
// il faut que les 2 dates soient exprimees de la même maniere!
if (strlen($debDate)!= strlen($endDate)) {
$app->enqueueMessage('Les dates DEBUT et FIN doivent avoir le meme format');
}
// la date et heure actuelle au format pour comparaison
// $nowDate = (strlen($debDate)==1) ? date('N'): bg_formatDate(substr(date('d-m-Y'),0, strlen($debDate)));
// $nowTime = date('H:i');
$config = JFactory::getConfig();
$now = JFactory::getDate('now',$config->get('offset'));
$nowDate = (strlen($debDate)==1) ? $now->format('N',true): bg_formatDate(substr($now->format('d-m-Y',true),0, strlen($debDate)));
$nowTime = $now->format('H:i',true);
// Analyse
if (strlen($debDate)==0) {// permanent ou période horaire
if ($debTime>$endTime) { //18:00 -> 8:00 sur 2 jours
$ok = (($nowTime>=$debTime) || ($nowTime<=$endTime));
$period_msg = 'Day 1 '.$debTime.' <= '.$nowTime.' <= Day 2 '.$endTime.'<br>';
} else { // 08:00 -> 18:00 sur la journee
$ok = (($nowTime>=$debTime) && ($nowTime<=$endTime));
$period_msg = 'Same day '.$debTime.' <= '.$nowTime.' <= '.$endTime.'<br>';
}
} else {
// maj date pour calcul sur 2 ans
if ($debDate>$endDate) {
$inc=array(0,7,31,0,0,12);
$tmp = explode('-',$endDate);
$tmp[0] += $inc[strlen($debDate)];
$endDate = implode('-',$tmp);
// actu date courante
if ($nowDate<$debDate) {
$tmp = explode('-',$nowDate);
$tmp[0] += $inc[strlen($debDate)];
$nowDate = implode('-',$tmp);
}
}
if ($params->get('period_mode')) {
$ok = (($debDate<=$nowDate) && ($nowDate<=$endDate)) && (($debTime<=$nowTime) && ($nowTime<=$endTime));
$period_msg =($debDate.' <= '.$nowDate.' <= '.$endDate).' AND '.($debTime.' <= '.$nowTime.' <= '.$endTime).'<br>';
} else {
$ok = (($debDate.$debTime)<=($nowDate.$nowTime)) && (($nowDate.$nowTime)<=($endDate.$endTime));
$period_msg =($debDate.$debTime).' <= '.($nowDate.$nowTime).' <= '.($endDate.$endTime).'<br>';
}
}
if (!$ok) {
if ($bgmaxDebug) {
$msg = '#NO# BGMAX - '.$modTitle.': <br>'.$period_msg;
$app->enqueueMessage($msg);
}
return;
}
/****
* MOBILE : DOIT-ON PUBLIER ?
****/
switch ($bgFilter=$params->get('filterMobile')) {
case 'always':
$ok = true;
break;
case 'mobile':
$ok = bg_isMobile();
break;
case 'desktop':
$ok = !bg_isMobile();
break;
}
if (!$ok) {
if ($bgmaxDebug) {
$msg = '#NO# BGMAX - '.$modTitle.': ';
$msg.= 'view only on '.$params->get('filterMobile');
$app->enqueueMessage($msg);
}
return;
}
/****
* CONTENU : DOIT-ON PUBLIER ?
****/
if ( ($bgFilter=$params->get('filterContent')) || ($bgmaxDebug) ) {
$bg_id = JRequest::getVar( 'id', 0, 'get', 'int');
$bg_menuid = JRequest::getVar( 'Itemid', 0, 'get', 'int');
$bg_option = trim(JRequest::getVar( 'option', 0 ) );
$bg_layout = trim(JRequest::getVar( 'layout', 0 ) );
$bg_view = trim(JRequest::getVar( 'view', 0 ) );
$bg_artid=''; $bg_catid='';
switch ($bg_view) {
case 'article':
$bg_artid = $bg_id; $bg_id = '';
$database = JFactory::getDBO();
$query = "SELECT catid FROM #__content WHERE id=".$bg_artid;
$database->setQuery($query);
$row = $database->loadObject();
$bg_catid = (($row!=null) ? $row->catid : '');
break;
case 'categories' :
$bg_catid = intval(JRequest::getVar( 'id', 0 ) );
break;
}
$context = $bg_option;
$context.= '+menuid='.$bg_menuid;
$context.= '+view='.$bg_view;
if ($bg_layout) $context.= '+layout='.$bg_layout;
if ($bg_id) $context.= '+id='.$bg_id;
if ($bg_artid) $context.= '+artid='.$bg_artid;
if ($bg_catid) $context.= '+catid='.$bg_catid;
/*
Si une des lignes de critere correspond, le module sera affiche
un '-' inverse la condition
exemple, on affiche le module si :
view=blog -menuid=2 // vue blog non appell� par menu 2
catid=3 // OU articles de categorie 3
-artid=2 // MAIS PAS si article d'ID 2
*/
if ($bgFilter) {
$context = '+'.$context.'+'; // pour recherche
$arr = explode("\n",$bgFilter);
foreach ($arr as &$lign) {
$ok = true;
$mots = explode(" ",$lign);
foreach ( $mots as $mot ) {
if ($mot) {
if ($mot[0]=="-") {
if (stristr($context, '+'.substr($mot,1).'+')) {
$ok=false; break;
}
} elseif ($mot[0]=="+") {
if (!stristr($context, '+'.substr($mot,1).'+')) {
$ok=false; break;
}
} else {
if (!stristr($context, '+'.$mot.'+')) {
$ok=false; break;
}
}
}
} // foreach mot
if ($ok) break; // si ligne OK, on affiche
}
if (!$ok) {
if ($bgmaxDebug) {
$msg = '#ERR# BGMAX - '.$modTitle.': <br>';
$msg.= 'Context:'.$context;
$msg.= '<br />Filters: '.nl2br($bgFilter, ' || ');
$app->enqueueMessage($msg);}
return;
}
} // if debug or Filtercontent
} // if critere ou debug
/*************************************
* ON AFFICHE
*************************************/
if ($bgmaxDebug) {
$msg = JText::_('INFO_DEBUG').'#OK# BGMAX - '.$modTitle.': <br>'.$period_msg;
if (isset($context)) $msg.= 'Context:'.$context;
$app->enqueueMessage($msg);
}
/****
* QUELLE IMAGE AFFICHER ?
* Ordre des priorites :
* 1 - celle indiquee dans la zone texte
* 2 - au hasard dans le dossier indique
* 3 - aucune, uniquement la couleur
****/
/* 1 */
$bgImage = $params->get('image_path', '');
if ($bgImage) {
// chemin relatif a la racine
$bgImageAbs = JPATH_ROOT.strtr('/'.$bgImage, '/', DIRECTORY_SEPARATOR);
$bgImage = trim(JURI::base(),'/').'/'.$bgImage;
/* 2 */
} elseif ($params->get('image_url', '')) {
$bgImageAbs = $params->get('image_url', '');
$bgImage = $bgImageAbs;
/* 3 */
} elseif ($params->get('RandomFolder', '-1')!='-1') {
$rep = '/images/bgmax/'.$params->get('RandomFolder').'/';
$bgImage = getRandomImage(JPATH_ROOT.strtr($rep, '/', DIRECTORY_SEPARATOR));
if ($bgImage) {
$bgImageAbs = JPATH_ROOT.strtr($rep.$bgImage, '/', DIRECTORY_SEPARATOR);
$bgImage = trim(JURI::base(),'/').$rep.$bgImage;
}
}
if ($bgmaxDebug) {$app->enqueueMessage("Image (abs): ".$bgImageAbs);}
/****
* couleur de fond
****/
$bodyColor = bg_hex2hex($params->get('bodyColor', '#FFFFFF'));
if ( ($bgImage) && ($params->get('bodyColorAuto', '0')=='1') ) {
$bodyColor = colorImageBottom($bgImageAbs);
}
/****
* TAILLE, POSITION ET EFFETS
****/
$bgMode = $params->get('mode', 'max'); // max, full ou none
$bgEnlarge = $params->get('enlarge', '1');
$bgReduce = $params->get('reduce', '1');
$bgPosition = $params->get('position', 'absolute');
$bgHAlign = $params->get('align', 'center');
$bgVAlign = $params->get('vertAlign', 'top');
$bgFadeActive = $params->get('fadeActive', '0');
$bgFadeAfter = $params->get('fadeAfter', '0');
$bgFadeDuration = $params->get('fadeDuration', '1000');
$bgFadeFrame = $params->get('fadeframeRate', '30');
$bgZIndex = $params->get('zIndex', '-1');
$bgFFHack = $params->get('ffHack', '0px');
/****
* BLOC CONTENU
****/
$contentSelector = $params->get('contentSelector', '');
$contentColor = bg_hex2hex($params->get('contentColor', ''));
$contentOpacity = trim($params->get('contentOpacity', '100'),'%');
$contentWidth = $params->get('contentWidth', '');
$contentAlign = $params->get('contentAlign', '');
/****
* CODE COMPLEMENTAIRE
****/
if ($headOther = $params->get('headOther', '')) {
$headOther = "<style type='text/css'>".$headOther."</style>";
if ($bgmaxDebug) {
$app->enqueueMessage('Complementary code: <code>'.htmlspecialchars($headOther).'</code>');
}
}
$headFile = $params->get('headFile', '-1');
if ($headFile!='-1') {
$headFile = JPATH_ROOT.strtr('/images/bgmax/'.$headFile, '/', DIRECTORY_SEPARATOR);
if (file_exists($headFile)) {
$code = file($headFile);
$headOther = implode('', $code);
if ($bgmaxDebug) {
$app->enqueueMessage('headfile: '.$headFile.'<code>'.htmlspecialchars($headOther).'</code>');
}
} else {
$app->enqueueMessage('headFile: '.$headFile.' **NOT FIND**','error');
}
}
/****
* Traitement de l'ajout image
****/
if ( (strstr($bgMode, 'repeat')) || ($bgMode == 'cover') || ($bgImage == "") ) {
//-------------------------------------------
//-----> Affichage image SANS le script bgmax
//-------------------------------------------
if ($bgImage) {
$str = 'background:';
$str.= '#'.$bodyColor;
$str.= ' url('.$bgImage.')';
if ($bgMode == 'cover') {
$str.= ' no-repeat';
$str2 = ' background-size:cover !important;';
} else {
$str.= ' '.$bgMode;
$str2 = '';
}
$str.= ' '.$bgHAlign.' '.$bgVAlign;
if ($bgPosition=='fixed') {$str.= ' fixed';}
$str.= ' !important;';
$bgmax["head"] .= '<style type="text/css">body {'.$str.$str2.'} </style>';
}
} else {
//-------------------------------------------
//-----> Affichage image AVEC le script bgmax
//-------------------------------------------
// Appel du script JS dans HEAD
$site_base = JURI::base();
if(substr($site_base, -1)=="/") {$site_base = substr($site_base, 0, -1);}
$bgmax["head"] = '<script type="text/javascript" src="'.$site_base.'/modules/mod_bgmax/bgMax.min.js"></script>';
// Definir la couleur sous image
if ($bodyColor) {
$bgmax["head"] .= '<style type="text/css">body {background-color:#'.$bodyColor.' !important;}</style>';
}
// Appel de la fonction JS dans BODY
$str = "";
if ($bgMode == 'full') {$str.= 'mode:"full",';}
if ($bgEnlarge != '1') {$str.= 'enlarge:0,';}
if ($bgReduce != '1') {$str.= 'reduce:0,';}
if ($bgPosition != 'absolute') {$str.= 'position:"fixed",';}
if ($bgHAlign != 'center') {$str.= 'align:"'.$bgHAlign.'",';}
switch ($bgVAlign) {
case "center" : $str.= 'vertAlign:"middle",'; break;
case "bottom" : $str.= 'vertAlign:"bottom",'; break;
}
if ($bgZIndex != '-1') {$str.= 'zIndex:'.$bgZIndex.',';}
if ($bgFFHack != '0px') {$str.= 'ffHack:"'.$bgFFHack.'",';}
if ($bgFadeActive == '1') {
$str .= 'fadeAfter:'.$bgFadeAfter.',';
$str .= 'fadeOptions:{duration:'.$bgFadeDuration.',';
$str .= 'frameRate:'.$bgFadeFrame.'}';
}
$str = trim($str,",");
if ($str) {$str = ", {".$str."}";}
$bgmax["body"]= '<script type="text/javascript">bgMax.init("'.$bgImage.'"'.$str.');</script>';
} // if
/*****
* STYLE COMMUN (AVEC ou SANS BGMAX)
*****/
$str = "";
// bloc qui contient tout le contenu
if ($contentSelector) {
$str.= '<style type="text/css">';
$str.= $contentSelector.' {';
if ($contentWidth) {
$str.= 'width:'.$contentWidth.';';
switch ($contentAlign) {
case 'left' : $str.= 'margin-left: 0;'; break;
case 'center' : $str.= 'margin: 0 auto;'; break;
case 'right' : $str.= 'margin-right: 0; margin-left: auto;'; break;
}
}
if ($contentColor) {
$str.= 'background-color: #'.$contentColor.';';
}
if ($contentOpacity == '0') {
$str.= 'background-color: transparent;';
} else {
if ($contentOpacity != '100') {
$str.= 'background-color: rgba(';
$str.= bg_hex2rgb($contentColor).',';
$str.= ($contentOpacity / 100).') !important;';
}
}
$str.= '}</style>';
// si transparence: hack pour IE
if (($contentOpacity != '0') && ($contentOpacity != '100')) {
$sval = dechex($contentOpacity * 2.55);
$sval.= $contentColor;
$str.= '<!--[if lte IE 8]> <style type="text/css">';
$str.= $contentSelector.' {';
$str.= 'background:transparent; ';
$str.= 'filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#'.$sval.',endColorstr=#'.$sval.');';
$str.= 'zoom: 1;';
$str.= '} </style> <![endif]-->';
}
} // fin if $contentSelector
/*******
* COMPLEMENT DE CODE POUR HEAD
*******/
if ($headOther) {
$str.= $headOther;
}
$bgmax["head"] .= $str;
if ($bgmaxDebug) {
$app->enqueueMessage('----------------------------');
foreach ($bgmax as $key=>$value) {
$app->enqueueMessage($key.' => <code>'.htmlentities($value).'</code>');
}
}
return $bgmax;
} // fin function getBgMaxInfos
} // class
home/wuectly/www/modules/mod_articles_category/helper.php 0000604 00000034742 15245613501 0020026 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage mod_articles_category
*
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\String\StringHelper;
$com_path = JPATH_SITE . '/components/com_content/';
JLoader::register('ContentHelperRoute', $com_path . 'helpers/route.php');
JModelLegacy::addIncludePath($com_path . 'models', 'ContentModel');
/**
* Helper for mod_articles_category
*
* @since 1.6
*/
abstract class ModArticlesCategoryHelper
{
/**
* Get a list of articles from a specific category
*
* @param \Joomla\Registry\Registry &$params object holding the models parameters
*
* @return mixed
*
* @since 1.6
*/
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);
$articles->setState('list.start', 0);
$articles->setState('filter.published', 1);
// Set the filters based on the module params
$articles->setState('list.limit', (int) $params->get('count', 0));
$articles->setState('load_tags', $params->get('show_tags', 0) || $params->get('article_grouping', 'none') === 'tags');
// 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' :
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) ?: 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
$ordering = $params->get('article_ordering', 'a.ordering');
switch ($ordering)
{
case 'random':
$articles->setState('list.ordering', JFactory::getDbo()->getQuery(true)->Rand());
break;
case 'rating_count':
case 'rating':
$articles->setState('list.ordering', $ordering);
$articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC'));
if (!JPluginHelper::isEnabled('content', 'vote'))
{
$articles->setState('list.ordering', 'a.ordering');
}
break;
default:
$articles->setState('list.ordering', $ordering);
$articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC'));
break;
}
// Filter by multiple tags
$articles->setState('filter.tag', $params->get('filter_tag', array()));
$articles->setState('filter.featured', $params->get('show_front', 'show'));
$articles->setState('filter.author_id', $params->get('created_by', array()));
$articles->setState('filter.author_id.include', $params->get('author_filtering_type', 1));
$articles->setState('filter.author_alias', $params->get('created_by_alias', array()));
$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);
// Exclude
$articles->setState('filter.article_id.include', false);
}
$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', 100);
// 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)
{
$item->slug = $item->id . ':' . $item->alias;
/** @deprecated Catslug is deprecated, use catid instead. 4.0 */
$item->catslug = $item->catid . ':' . $item->category_alias;
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->catid, $item->language));
}
else
{
$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 = '';
if ($show_date)
{
$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 : '';
if ($show_introtext)
{
$item->introtext = JHtml::_('content.prepare', $item->introtext, '', 'mod_articles_category.content');
$item->introtext = self::_cleanIntrotext($item->introtext);
}
$item->displayIntrotext = $show_introtext ? self::truncate($item->introtext, $introtext_limit) : '';
$item->displayReadmore = $item->alternative_readmore;
}
return $items;
}
/**
* Strips unnecessary tags from the introtext
*
* @param string $introtext introtext to sanitize
*
* @return mixed|string
*
* @since 1.6
*/
public static function _cleanIntrotext($introtext)
{
$introtext = str_replace(array('<p>','</p>'), ' ', $introtext);
$introtext = strip_tags($introtext, '<a><em><strong>');
$introtext = trim($introtext);
return $introtext;
}
/**
* Method to truncate introtext
*
* The goal is to get the proper length plain text string with as much of
* the html intact as possible with all tags properly closed.
*
* @param string $html The content of the introtext to be truncated
* @param integer $maxLength The maximum number of characters to render
*
* @return string The truncated string
*
* @since 1.6
*/
public static function truncate($html, $maxLength = 0)
{
$baseLength = strlen($html);
// First get the plain text string. This is the rendered text we want to end up with.
$ptString = JHtml::_('string.truncate', $html, $maxLength, $noSplit = true, $allowHtml = false);
for ($maxLength; $maxLength < $baseLength;)
{
// Now get the string if we allow html.
$htmlString = JHtml::_('string.truncate', $html, $maxLength, $noSplit = true, $allowHtml = true);
// Now get the plain text from the html string.
$htmlStringToPtString = JHtml::_('string.truncate', $htmlString, $maxLength, $noSplit = true, $allowHtml = false);
// If the new plain text string matches the original plain text string we are done.
if ($ptString === $htmlStringToPtString)
{
return $htmlString;
}
// Get the number of html tag characters in the first $maxlength characters
$diffLength = strlen($ptString) - strlen($htmlStringToPtString);
// Set new $maxlength that adjusts for the html tags
$maxLength += $diffLength;
if ($baseLength <= $maxLength || $diffLength <= 0)
{
return $htmlString;
}
}
return $html;
}
/**
* Groups items by field
*
* @param array $list list of items
* @param string $fieldName name of field that is used for grouping
* @param string $direction ordering direction
* @param null $fieldNameToKeep field name to keep
*
* @return array
*
* @since 1.6
*/
public static function groupBy($list, $fieldName, $direction, $fieldNameToKeep = null)
{
$grouped = array();
if (!is_array($list))
{
if ($list == '')
{
return $grouped;
}
$list = array($list);
}
foreach ($list as $key => $item)
{
if (!isset($grouped[$item->$fieldName]))
{
$grouped[$item->$fieldName] = array();
}
if ($fieldNameToKeep === null)
{
$grouped[$item->$fieldName][$key] = $item;
}
else
{
$grouped[$item->$fieldName][$key] = $item->$fieldNameToKeep;
}
unset($list[$key]);
}
$direction($grouped);
return $grouped;
}
/**
* Groups items by date
*
* @param array $list list of items
* @param string $type type of grouping
* @param string $direction ordering direction
* @param string $monthYearFormat date format to use
* @param string $field date field to group by
*
* @return array
*
* @since 1.6
*/
public static function groupByDate($list, $type = 'year', $direction = 'ksort', $monthYearFormat = 'F Y', $field = 'created')
{
$grouped = array();
if (!is_array($list))
{
if ($list == '')
{
return $grouped;
}
$list = array($list);
}
foreach ($list as $key => $item)
{
switch ($type)
{
case 'month_year' :
$month_year = StringHelper::substr($item->$field, 0, 7);
if (!isset($grouped[$month_year]))
{
$grouped[$month_year] = array();
}
$grouped[$month_year][$key] = $item;
break;
case 'year' :
default:
$year = StringHelper::substr($item->$field, 0, 4);
if (!isset($grouped[$year]))
{
$grouped[$year] = array();
}
$grouped[$year][$key] = $item;
break;
}
unset($list[$key]);
}
$direction($grouped);
if ($type === 'month_year')
{
foreach ($grouped as $group => $items)
{
$date = new JDate($group);
$formatted_group = $date->format($monthYearFormat);
$grouped[$formatted_group] = $items;
unset($grouped[$group]);
}
}
return $grouped;
}
/**
* Groups items by tags
*
* @param array $list list of items
* @param string $direction ordering direction
*
* @return array
*
* @since 3.9.0
*/
public static function groupByTags($list, $direction = 'ksort')
{
$grouped = array();
$untagged = array();
if (!$list)
{
return $grouped;
}
foreach ($list as $item)
{
if ($item->tags->itemTags)
{
foreach ($item->tags->itemTags as $tag)
{
$grouped[$tag->title][] = $item;
}
}
else
{
$untagged[] = $item;
}
}
$direction($grouped);
if ($untagged)
{
$grouped['MOD_ARTICLES_CATEGORY_UNTAGGED'] = $untagged;
}
return $grouped;
}
}
home/wuectly/www/administrator/modules/mod_stats_admin/helper.php 0000604 00000010412 15245615150 0021477 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage mod_stats_admin
*
* @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper class for admin stats module
*
* @since 3.0
*/
class ModStatsHelper
{
/**
* Method to retrieve information about the site
*
* @param JObject &$params Params object
*
* @return array Array containing site information
*
* @since 3.0
*/
public static function getStats(&$params)
{
$app = JFactory::getApplication();
$db = JFactory::getDbo();
$rows = array();
$query = $db->getQuery(true);
$serverinfo = $params->get('serverinfo', 0);
$siteinfo = $params->get('siteinfo', 0);
$counter = $params->get('counter', 0);
$increase = $params->get('increase', 0);
$i = 0;
if ($serverinfo)
{
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_OS');
$rows[$i]->icon = 'screen';
$rows[$i]->data = substr(php_uname(), 0, 7);
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_PHP');
$rows[$i]->icon = 'cogs';
$rows[$i]->data = phpversion();
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_($db->name);
$rows[$i]->icon = 'database';
$rows[$i]->data = $db->getVersion();
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_TIME');
$rows[$i]->icon = 'clock';
$rows[$i]->data = JHtml::_('date', 'now', 'H:i');
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_CACHING');
$rows[$i]->icon = 'dashboard';
$rows[$i]->data = $app->get('caching') ? JText::_('JENABLED') : JText::_('JDISABLED');
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_GZIP');
$rows[$i]->icon = 'lightning';
$rows[$i]->data = $app->get('gzip') ? JText::_('JENABLED') : JText::_('JDISABLED');
$i++;
}
if ($siteinfo)
{
$query->select('COUNT(id) AS count_users')
->from('#__users');
$db->setQuery($query);
try
{
$users = $db->loadResult();
}
catch (RuntimeException $e)
{
$users = false;
}
$query->clear()
->select('COUNT(id) AS count_items')
->from('#__content')
->where('state = 1');
$db->setQuery($query);
try
{
$items = $db->loadResult();
}
catch (RuntimeException $e)
{
$items = false;
}
if ($users)
{
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_USERS');
$rows[$i]->icon = 'users';
$rows[$i]->data = $users;
$rows[$i]->link = JRoute::_('index.php?option=com_users');
$i++;
}
if ($items)
{
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_ARTICLES');
$rows[$i]->icon = 'file';
$rows[$i]->data = $items;
$rows[$i]->link = JRoute::_('index.php?option=com_content&view=articles&filter[published]=1');
$i++;
}
}
if ($counter)
{
$query->clear()
->select('SUM(hits) AS count_hits')
->from('#__content')
->where('state = 1');
$db->setQuery($query);
try
{
$hits = $db->loadResult();
}
catch (RuntimeException $e)
{
$hits = false;
}
if ($hits)
{
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_ARTICLES_VIEW_HITS');
$rows[$i]->icon = 'eye';
$rows[$i]->data = number_format($hits + $increase, 0, JText::_('DECIMALS_SEPARATOR'), JText::_('THOUSANDS_SEPARATOR'));
$i++;
}
}
// Include additional data defined by published system plugins
JPluginHelper::importPlugin('system');
$app = JFactory::getApplication();
$arrays = (array) $app->triggerEvent('onGetStats', array('mod_stats_admin'));
foreach ($arrays as $response)
{
foreach ($response as $row)
{
// We only add a row if the title and data are given
if (isset($row['title']) && isset($row['data']))
{
$rows[$i] = new stdClass;
$rows[$i]->title = $row['title'];
$rows[$i]->icon = isset($row['icon']) ? $row['icon'] : 'info';
$rows[$i]->data = $row['data'];
$rows[$i]->link = isset($row['link']) ? $row['link'] : null;
$i++;
}
}
}
return $rows;
}
}
home/wuectly/www/administrator/modules/mod_latest/helper.php 0000604 00000006353 15245622161 0020476 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage mod_latest
*
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_content/models', 'ContentModel');
/**
* Helper for mod_latest
*
* @since 1.5
*/
abstract class ModLatestHelper
{
/**
* Get a list of articles.
*
* @param \Joomla\Registry\Registry &$params The module parameters.
*
* @return mixed An array of articles, or false on error.
*/
public static function getList(&$params)
{
$user = JFactory::getuser();
// Get an instance of the generic articles model
$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
// Set List SELECT
$model->setState('list.select', 'a.id, a.title, a.checked_out, a.checked_out_time, ' .
' a.access, a.created, a.created_by, a.created_by_alias, a.featured, a.state, a.publish_up, a.publish_down');
// Set Ordering filter
switch ($params->get('ordering', 'c_dsc'))
{
case 'm_dsc':
$model->setState('list.ordering', 'modified DESC, created');
$model->setState('list.direction', 'DESC');
break;
case 'c_dsc':
default:
$model->setState('list.ordering', 'created');
$model->setState('list.direction', 'DESC');
break;
}
// Set Category Filter
$categoryId = $params->get('catid', null);
if (is_numeric($categoryId))
{
$model->setState('filter.category_id', $categoryId);
}
// Set User Filter.
$userId = $user->get('id');
switch ($params->get('user_id', '0'))
{
case 'by_me':
$model->setState('filter.author_id', $userId);
break;
case 'not_me':
$model->setState('filter.author_id', $userId);
$model->setState('filter.author_id.include', false);
break;
}
// Set the Start and Limit
$model->setState('list.start', 0);
$model->setState('list.limit', $params->get('count', 5));
$items = $model->getItems();
if ($error = $model->getError())
{
JError::raiseError(500, $error);
return false;
}
// Set the links
foreach ($items as &$item)
{
if ($user->authorise('core.edit', 'com_content.article.' . $item->id))
{
$item->link = JRoute::_('index.php?option=com_content&task=article.edit&id=' . $item->id);
}
else
{
$item->link = '';
}
}
return $items;
}
/**
* Get the alternate title for the module.
*
* @param \Joomla\Registry\Registry $params The module parameters.
*
* @return string The alternate title for the module.
*/
public static function getTitle($params)
{
$who = $params->get('user_id', '0');
$catid = (int) $params->get('catid', null);
$type = $params->get('ordering', 'c_dsc') == 'c_dsc' ? '_CREATED' : '_MODIFIED';
if ($catid)
{
$category = JCategories::getInstance('Content')->get($catid);
if ($category)
{
$title = $category->title;
}
else
{
$title = JText::_('MOD_POPULAR_UNEXISTING');
}
}
else
{
$title = '';
}
return JText::plural(
'MOD_LATEST_TITLE' . $type . ($catid ? '_CATEGORY' : '') . ($who != '0' ? "_$who" : ''),
(int) $params->get('count', 5),
$title
);
}
}
home/wuectly/www/modules/mod_finder/helper.php 0000604 00000004533 15245624376 0015601 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage mod_finder
*
* @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Utilities\ArrayHelper;
/**
* Finder module helper.
*
* @since 2.5
*/
class ModFinderHelper
{
/**
* Method to get hidden input fields for a get form so that control variables
* are not lost upon form submission.
*
* @param string $route The route to the page. [optional]
* @param integer $paramItem The menu item ID. (@since 3.1) [optional]
*
* @return string A string of hidden input form fields
*
* @since 2.5
*/
public static function getGetFields($route = null, $paramItem = 0)
{
// Determine if there is an item id before routing.
$needId = !JUri::getInstance($route)->getVar('Itemid');
$fields = array();
$uri = JUri::getInstance(JRoute::_($route));
$uri->delVar('q');
// Create hidden input elements for each part of the URI.
foreach ($uri->getQuery(true) as $n => $v)
{
$fields[] = '<input type="hidden" name="' . $n . '" value="' . $v . '" />';
}
// Add a field for Itemid if we need one.
if ($needId)
{
$id = $paramItem ?: JFactory::getApplication()->input->get('Itemid', '0', 'int');
$fields[] = '<input type="hidden" name="Itemid" value="' . $id . '" />';
}
return implode('', $fields);
}
/**
* Get Smart Search query object.
*
* @param \Joomla\Registry\Registry $params Module parameters.
*
* @return FinderIndexerQuery object
*
* @since 2.5
*/
public static function getQuery($params)
{
$app = JFactory::getApplication();
$input = $app->input;
$request = $input->request;
$filter = JFilterInput::getInstance();
// Get the static taxonomy filters.
$options = array();
$options['filter'] = ($request->get('f', 0, 'int') !== 0) ? $request->get('f', '', 'int') : $params->get('searchfilter');
$options['filter'] = $filter->clean($options['filter'], 'int');
// Get the dynamic taxonomy filters.
$options['filters'] = $request->get('t', '', 'array');
$options['filters'] = $filter->clean($options['filters'], 'array');
$options['filters'] = ArrayHelper::toInteger($options['filters']);
// Instantiate a query object.
return new FinderIndexerQuery($options);
}
}
home/wuectly/www/administrator/modules/mod_menu/helper.php 0000604 00000003037 15245630030 0020134 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage mod_menu
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_menu
*
* @since 1.5
*/
abstract class ModMenuHelper
{
/**
* Get a list of the available menus.
*
* @return array An array of the available menus (from the menu types table).
*
* @since 1.6
*
* @deprecated 4.0
*/
public static function getMenus()
{
$db = JFactory::getDbo();
// Search for home menu and language if exists
$subQuery = $db->getQuery(true)
->select('b.menutype, b.home, b.language, l.image, l.sef, l.title_native')
->from('#__menu AS b')
->leftJoin('#__languages AS l ON l.lang_code = b.language')
->where('b.home != 0')
->where('(b.client_id = 0 OR b.client_id IS NULL)');
// Get all menu types with optional home menu and language
$query = $db->getQuery(true)
->select('a.id, a.asset_id, a.menutype, a.title, a.description, a.client_id')
->select('c.home, c.language, c.image, c.sef, c.title_native')
->from('#__menu_types AS a')
->leftJoin('(' . (string) $subQuery . ') c ON c.menutype = a.menutype')
->order('a.id');
$db->setQuery($query);
try
{
$result = $db->loadObjectList();
}
catch (RuntimeException $e)
{
$result = array();
JFactory::getApplication()->enqueueMessage(JText::sprintf('JERROR_LOADING_MENUS', $e->getMessage()), 'error');
}
return $result;
}
}
home/wuectly/www/administrator/modules/mod_version/helper.php 0000604 00000001770 15245630104 0020661 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage mod_version
*
* @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_version
*
* @since 1.6
*/
abstract class ModVersionHelper
{
/**
* Get the member items of the submenu.
*
* @param \Joomla\Registry\Registry &$params The parameters object.
*
* @return string String containing the current Joomla version based on the selected format.
*/
public static function getVersion(&$params)
{
$version = new JVersion;
$versionText = $version->getShortVersion();
$product = $params->get('product', 1);
if ($params->get('format', 'short') === 'long')
{
$versionText = str_replace($version::PRODUCT . ' ', '', $version->getLongVersion());
}
if (!empty($product))
{
$versionText = $version::PRODUCT . ' ' . $versionText;
}
return $versionText;
}
}