Spade
Mini Shell
home/lmsyaran/public_html/modules/mod_phocacart_search/helper.php000064400000003040151167217330021417
0ustar00<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die;
class ModPhocaCartSearchHelper
{
public static function getAjax() {
jimport('joomla.application.module.helper');
if (!JComponentHelper::isEnabled('com_phocacart')) {
echo '<div class="alert alert-error
alert-danger">'.JText::_('Phoca Cart Error') .
' - ' . JText::_('Phoca Cart is not installed on your
system').'</div>';
return;
}
JLoader::registerPrefix('Phocacart', JPATH_ADMINISTRATOR
. '/components/com_phocacart/libraries/phocacart');
$lang = JFactory::getLanguage();
$lang->load('com_phocacart');
$module = JModuleHelper::getModule('phocacart_search');
$params = new JRegistry();
$params->loadString($module->params);
$search = new PhocacartSearch();
$search->ajax = 1;
$search->search_options = $params->get(
'search_options', 0 );
$search->hide_buttons = $params->get( 'hide_buttons',
0 );
$search->display_inner_icon = $params->get(
'display_inner_icon', 0 );
$search->load_component_media = $params->get(
'load_component_media', 1 );
$search->placeholder_text = $params->get(
'placeholder_text', '' );
$search->display_active_parameters = $params->get(
'display_active_parameters', 0 );
echo $search->renderSearch();
}
}
home/lmsyaran/public_html/modules/mod_articles_categories/helper.php000064400000002025151167370630022146
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_categories
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_articles_categories
*
* @since 1.5
*/
abstract class ModArticlesCategoriesHelper
{
/**
* Get list of articles
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return array
*
* @since 1.5
*/
public static function getList(&$params)
{
$options = array();
$options['countItems'] = $params->get('numitems',
0);
$categories = JCategories::getInstance('Content', $options);
$category = $categories->get($params->get('parent',
'root'));
if ($category !== null)
{
$items = $category->getChildren();
$count = $params->get('count', 0);
if ($count > 0 && count($items) > $count)
{
$items = array_slice($items, 0, $count);
}
return $items;
}
}
}
home/lmsyaran/public_html/modules/mod_articles_popular/helper.php000064400000006117151167411320021501
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_popular
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @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/lmsyaran/public_html/modules/mod_search/helper.php000064400000001111151170000060017350
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_search
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @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/lmsyaran/public_html/joomla35/modules/mod_whosonline/helper.php000064400000005176151172304320021750
0ustar00<?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();
}
}
}