- md5
- 9ab6ebf77d36af563d905f3cefd0f62c
- sha1
- 976ca3bef19e98e44675b97f4317f66fa23f7afe
- sha256
- da04ac419faece68fec58f8109f5a14b00b1c25c4ccc3e4ca0e26713c57dd622
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
<?php
/**
* @package Joomla.Administrator
* @subpackage mod_quickicon
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Module\Quickicon\Administrator\Helper;
\defined('_JEXEC') or die;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Router\Route;
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
use Joomla\Registry\Registry;
/**
* Helper for mod_quickicon
*
* @since 1.6
*/
abstract class QuickIconHelper
{
/**
* Stack to hold buttons
*
* @var array[]
* @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 Registry $params The module parameters
* @param CMSApplication $application The application
*
* @return array An array of buttons
*
* @since 1.6
*/
public static function &getButtons(Registry $params, CMSApplication $application = null)
{
if ($application == null)
{
$application = Factory::getApplication();
}
$key = (string) $params;
$context = (string) $params->get('context', 'mod_quickicon');
if (!isset(self::$buttons[$key]))
{
// Load mod_quickicon language file in case this method is called before rendering the module
$application->getLanguage()->load('mod_quickicon');
self::$buttons[$key] = [];
if ($params->get('show_users'))
{
$tmp = [
'image' => 'fas fa-users',
'link' => Route::_('index.php?option=com_users&view=users'),
'linkadd' => Route::_('index.php?option=com_users&task=user.add'),
'name' => 'MOD_QUICKICON_USER_MANAGER',
'access' => array('core.manage', 'com_users', 'core.create', 'com_users'),
'group' => 'MOD_QUICKICON_SITE',
];
if ($params->get('show_users') == 2)
{
$tmp['ajaxurl'] = 'index.php?option=com_users&task=users.getQuickiconContent&format=json';
}
self::$buttons[$key][] = $tmp;
}
if ($params->get('show_menuitems'))
{
$tmp = [
'image' => 'fas fa-list',
'link' => Route::_('index.php?option=com_menus&view=items&menutype='),
'linkadd' => Route::_('index.php?option=com_menus&task=item.add'),
'name' => 'MOD_QUICKICON_MENUITEMS_MANAGER',
'access' => array('core.manage', 'com_menus', 'core.create', 'com_menus'),
'group' => 'MOD_QUICKICON_STRUCTURE',
];
if ($params->get('show_menuitems') == 2)
{
$tmp['ajaxurl'] = 'index.php?option=com_menus&task=items.getQuickiconContent&format=json';
}
self::$buttons[$key][] = $tmp;
}
if ($params->get('show_articles'))
{
$tmp = [
'image' => 'fas fa-file-alt',
'link' => Route::_('index.php?option=com_content&view=articles'),
'linkadd' => Route::_('index.php?option=com_content&task=article.add'),
'name' => 'MOD_QUICKICON_ARTICLE_MANAGER',
'access' => array('core.manage', 'com_content', 'core.create', 'com_content'),
'group' => 'MOD_QUICKICON_SITE',
];
if ($params->get('show_articles') == 2)
{
$tmp['ajaxurl'] = 'index.php?option=com_content&task=articles.getQuickiconContent&format=json';
}
self::$buttons[$key][] = $tmp;
}
if ($params->get('show_categories'))
{
$tmp = [
'image' => 'fas fa-folder-open',
'link' => Route::_('index.php?option=com_categories&view=categories&extension=com_content'),
'linkadd' => Route::_('index.php?option=com_categories&task=category.add'),
'name' => 'MOD_QUICKICON_CATEGORY_MANAGER',
'access' => array('core.manage', 'com_categories', 'core.create', 'com_categories'),
'group' => 'MOD_QUICKICON_SITE',
];
if ($params->get('show_categories') == 2)
{
$tmp['ajaxurl'] = 'index.php?option=com_categories&task=categories.getQuickiconContent&format=json';
}
self::$buttons[$key][] = $tmp;
}
if ($params->get('show_media'))
{
self::$buttons[$key][] = [
'image' => 'fas fa-images',
'link' => Route::_('index.php?option=com_media'),
'name' => 'MOD_QUICKICON_MEDIA_MANAGER',
'access' => array('core.manage', 'com_media'),
'group' => 'MOD_QUICKICON_SITE',
];
}
if ($params->get('show_modules'))
{
$tmp = [
'image' => 'fas fa-cube',
'link' => Route::_('index.php?option=com_modules&view=modules&client_id=0'),
'linkadd' => Route::_('index.php?option=com_modules&view=select&client_id=0'),
'name' => 'MOD_QUICKICON_MODULE_MANAGER',
'access' => array('core.manage', 'com_modules'),
'group' => 'MOD_QUICKICON_SITE'
];
if ($params->get('show_modules') == 2)
{
$tmp['ajaxurl'] = 'index.php?option=com_modules&task=modules.getQuickiconContent&format=json';
}
self::$buttons[$key][] = $tmp;
}
if ($params->get('show_plugins'))
{
$tmp = [
'image' => 'fas fa-plug',
'link' => Route::_('index.php?option=com_plugins'),
'name' => 'MOD_QUICKICON_PLUGIN_MANAGER',
'access' => array('core.manage', 'com_plugins'),
'group' => 'MOD_QUICKICON_SITE'
];
if ($params->get('show_plugins') == 2)
{
$tmp['ajaxurl'] = 'index.php?option=com_plugins&task=plugins.getQuickiconContent&format=json';
}
self::$buttons[$key][] = $tmp;
}
if ($params->get('show_template_styles'))
{
self::$buttons[$key][] = [
'image' => 'fas fa-paint-brush',
'link' => Route::_('index.php?option=com_templates&view=styles&client_id=0'),
'name' => 'MOD_QUICKICON_TEMPLATE_STYLES',
'access' => array('core.admin', 'com_templates'),
'group' => 'MOD_QUICKICON_SITE'
];
}
if ($params->get('show_template_code'))
{
self::$buttons[$key][] = [
'image' => 'fas fa-code',
'link' => Route::_('index.php?option=com_templates&view=templates&client_id=0'),
'name' => 'MOD_QUICKICON_TEMPLATE_CODE',
'access' => array('core.admin', 'com_templates'),
'group' => 'MOD_QUICKICON_SITE'
];
}
if ($params->get('show_checkin'))
{
$tmp = [
'image' => 'fas fa-unlock-alt',
'link' => Route::_('index.php?option=com_checkin'),
'name' => 'MOD_QUICKICON_CHECKINS',
'access' => array('core.admin', 'com_checkin'),
'group' => 'MOD_QUICKICON_SYSTEM'
];
if ($params->get('show_checkin') == 2)
{
$tmp['ajaxurl'] = 'index.php?option=com_checkin&task=getQuickiconContent&format=json';
}
self::$buttons[$key][] = $tmp;
}
if ($params->get('show_cache'))
{
$tmp = [
'image' => 'fas fa-cloud',
'link' => Route::_('index.php?option=com_cache'),
'name' => 'MOD_QUICKICON_CACHE',
'access' => array('core.admin', 'com_cache'),
'group' => 'MOD_QUICKICON_SYTEM'
];
if ($params->get('show_cache') == 2)
{
$tmp['ajaxurl'] = 'index.php?option=com_cache&task=display.getQuickiconContent&format=json';
}
self::$buttons[$key][] = $tmp;
}
if ($params->get('show_global'))
{
self::$buttons[$key][] = [
'image' => 'fas fa-cog',
'link' => Route::_('index.php?option=com_config'),
'name' => 'MOD_QUICKICON_GLOBAL_CONFIGURATION',
'access' => array('core.manage', 'com_config', 'core.admin', 'com_config'),
'group' => 'MOD_QUICKICON_SYSTEM',
];
}
PluginHelper::importPlugin('quickicon');
$arrays = (array) $application->triggerEvent(
'onGetIcons',
new QuickIconsEvent('onGetIcons', ['context' => $context])
);
foreach ($arrays as $response)
{
if (!\is_array($response))
{
continue;
}
foreach ($response as $icon)
{
$default = array(
'link' => null,
'image' => null,
'text' => null,
'name' => null,
'linkadd' => null,
'access' => true,
'class' => null,
'group' => 'MOD_QUICKICON',
);
$icon = array_merge($default, $icon);
if (!\is_null($icon['link']) && !\is_null($icon['text']))
{
self::$buttons[$key][] = $icon;
}
}
}
}
return self::$buttons[$key];
}
}
The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.