| Current Path : /proc/1908984/root/proc/self/root/proc/self/root/proc/2411249/cwd/ |
| Current File : //proc/1908984/root/proc/self/root/proc/self/root/proc/2411249/cwd/advancedmodules.tar |
js/frontediting.js 0000644 00000003016 15234432302 0010210 0 ustar 00 /**
* @package Advanced Module Manager
* @version 9.8.0PRO
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
(function($) {
$(document).ready(function() {
// Menu items edit icons:
setTimeout(function() {
$('.jmoddiv[data-jmenuedittip] .nav li,.jmoddiv[data-jmenuedittip].nav li,.jmoddiv[data-jmenuedittip] .nav .nav-child li,.jmoddiv[data-jmenuedittip].nav .nav-child li').on({
mouseenter: function() {
const itemids = /\bitem-(\d+)\b/.exec($(this).attr('class'));
if (typeof itemids[1] !== 'string') {
return;
}
setTimeout(function() {
$('a.jfedit-menu').each(function() {
const menuitemEditUrl = $(this).prop('href')
.replace(
/(?:\/administrator)?\/index.php\?option=com_advancedmodules.*?edit([^\d]+).+$/,
'/administrator/index.php?option=com_menus&view=item&layout=edit$1' + itemids[1]
);
$(this).prop('href', menuitemEditUrl);
});
}, 10);
}
});
}, 1000);
});
})(jQuery);
js/frontediting.min.js 0000644 00000001455 15234432302 0010777 0 ustar 00 /*
* Copyright © 2023 Regular Labs - All Rights Reserved
* GNU General Public License version 2 or later
*/
(function($){$(document).ready(function(){setTimeout(function(){$('.jmoddiv[data-jmenuedittip] .nav li,.jmoddiv[data-jmenuedittip].nav li,.jmoddiv[data-jmenuedittip] .nav .nav-child li,.jmoddiv[data-jmenuedittip].nav .nav-child li').on({mouseenter:function(){const itemids=/\bitem-(\d+)\b/.exec($(this).attr('class'));if(typeof itemids[1]!=='string'){return;}
setTimeout(function(){$('a.jfedit-menu').each(function(){const menuitemEditUrl=$(this).prop('href').replace(/(?:\/administrator)?\/index.php\?option=com_advancedmodules.*?edit([^\d]+).+$/,'/administrator/index.php?option=com_menus&view=item&layout=edit$1'+itemids[1]);$(this).prop('href',menuitemEditUrl);});},10);}});},1000);});})(jQuery);
language/ar-AA/ar-AA.plg_system_advancedmodules.ini 0000644 00000002367 15234436746 0016223 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_SYSTEM_ADVANCEDMODULES="System - Regular Labs - Advanced Module Manager"
PLG_SYSTEM_ADVANCEDMODULES_DESC="Advanced Module Manager - خيارات متقدمة لإدارة الموديلات في نظام جوملا!"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
; ADVANCEDMODULEMANAGER_DESC="With Advanced Module Manager you have extra options and functionality to control your modules."
AMM_EXTENSION_CAN_NOT_FUNCTION="[[%1:extension name%]] لا يمكن تشغيله."
AMM_REGULAR_LABS_LIBRARY_NOT_ENABLED="مُنتج Regular Labs Library غير مُمكن."
AMM_REGULAR_LABS_LIBRARY_NOT_INSTALLED="مُنتج Regular Labs Library غير مُثبت."
AMM_SETTINGS="يرجى زيارة [[%1:start link%]]مدير الموديلات[[%2:end link%]] للتطبيقات."
AMM_THE_COMPONENT="تطبيق إدارة الموديلات المتقدم"
language/ar-AA/ar-AA.plg_system_advancedmodules.sys.ini 0000644 00000001253 15234436746 0017031 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_SYSTEM_ADVANCEDMODULES="System - Regular Labs - Advanced Module Manager"
PLG_SYSTEM_ADVANCEDMODULES_DESC="Advanced Module Manager - خيارات متقدمة لإدارة الموديلات في نظام جوملا!"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
language/de-DE/de-DE.plg_system_advancedmodules.ini 0000644 00000002237 15234436746 0016211 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_SYSTEM_ADVANCEDMODULES="System - Regular Labs - Advanced Module Manager"
PLG_SYSTEM_ADVANCEDMODULES_DESC="Advanced Module Manager - fortgeschrittene Modulfunktionen für Joomla!"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
ADVANCEDMODULEMANAGER_DESC="Advanced Module Manager - erweiterte Modulfunktionen in Joomla!."
AMM_EXTENSION_CAN_NOT_FUNCTION="[[%1:extension name%]] kann daher nicht funktionieren."
AMM_REGULAR_LABS_LIBRARY_NOT_ENABLED="Das Regular Labs Library Plugin ist nicht aktiviert."
AMM_REGULAR_LABS_LIBRARY_NOT_INSTALLED="Das Regular Labs Library Plugin ist nicht installiert."
AMM_SETTINGS="Bitte den [[%1:start link%]]Module Manager[[%2:end link%]] für die Einstellungen besuchen"
AMM_THE_COMPONENT="die Advanced Module Manager-Komponente"
language/de-DE/de-DE.plg_system_advancedmodules.sys.ini 0000644 00000001205 15234436746 0017020 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_SYSTEM_ADVANCEDMODULES="System - Regular Labs - Advanced Module Manager"
PLG_SYSTEM_ADVANCEDMODULES_DESC="Advanced Module Manager - fortgeschrittene Modulfunktionen für Joomla!"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
language/en-GB/en-GB.plg_system_advancedmodules.ini 0000644 00000002205 15234436746 0016230 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_SYSTEM_ADVANCEDMODULES="System - Regular Labs - Advanced Module Manager"
PLG_SYSTEM_ADVANCEDMODULES_DESC="Advanced Module Manager - take control over modules in Joomla!"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
ADVANCEDMODULEMANAGER_DESC="With Advanced Module Manager you have extra options and functionality to control your modules."
AMM_EXTENSION_CAN_NOT_FUNCTION="[[%1:extension name%]] cannot function."
AMM_REGULAR_LABS_LIBRARY_NOT_ENABLED="Regular Labs Library plugin is not enabled."
AMM_REGULAR_LABS_LIBRARY_NOT_INSTALLED="Regular Labs Library plugin is not installed."
AMM_SETTINGS="Please see the [[%1:start link%]]Module Manager[[%2:end link%]] for settings."
AMM_THE_COMPONENT="the Advanced Module Manager component"
language/en-GB/en-GB.plg_system_advancedmodules.sys.ini 0000644 00000001174 15234436746 0017051 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_SYSTEM_ADVANCEDMODULES="System - Regular Labs - Advanced Module Manager"
PLG_SYSTEM_ADVANCEDMODULES_DESC="Advanced Module Manager - take control over modules in Joomla!"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
language/fa-IR/fa-IR.plg_system_advancedmodules.ini 0000644 00000002517 15234436746 0016252 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_SYSTEM_ADVANCEDMODULES="System - Regular Labs - Advanced Module Manager"
PLG_SYSTEM_ADVANCEDMODULES_DESC="Advanced Module Manager - امکانات حرفه ای براي مدیریت ماژول ها در جوملا"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
ADVANCEDMODULEMANAGER_DESC="با Advanced Module Manager شما تنظیمات و گزینه های بیشتری برای کنترل ماژول ها دارید"
AMM_EXTENSION_CAN_NOT_FUNCTION="[[%1:extension name%]] نمی تواند کار کند."
AMM_REGULAR_LABS_LIBRARY_NOT_ENABLED="پلاگین Regular Labs Library فعال نشده است."
AMM_REGULAR_LABS_LIBRARY_NOT_INSTALLED="پلاگین Regular Labs Library نصب نشده است."
AMM_SETTINGS="لطفا براي اعمال تنظيمات به [[%1:start link%]]مدیریت ماژول[[%2:end link%]] مراجعه کنید (پارامترها)"
AMM_THE_COMPONENT="کامپوننت Advanced Module Manager"
language/fa-IR/fa-IR.plg_system_advancedmodules.sys.ini 0000644 00000001252 15234436746 0017062 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_SYSTEM_ADVANCEDMODULES="System - Regular Labs - Advanced Module Manager"
PLG_SYSTEM_ADVANCEDMODULES_DESC="Advanced Module Manager - امکانات حرفه ای براي مدیریت ماژول ها در جوملا"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
language/fr-FR/fr-FR.plg_system_advancedmodules.ini 0000644 00000002272 15234436746 0016304 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_SYSTEM_ADVANCEDMODULES="Système - Regular Labs - Advanced Module Manager"
PLG_SYSTEM_ADVANCEDMODULES_DESC="Advanced Module Manager - Options avancées pour les modules Joomla!"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
ADVANCEDMODULEMANAGER_DESC="Avec Advanced Module Manager vous disposez d'options et de fonctions supplémentaires pour contrôler vos modules."
AMM_EXTENSION_CAN_NOT_FUNCTION="[[%1:extension name%]] ne peut pas fonctionner."
AMM_REGULAR_LABS_LIBRARY_NOT_ENABLED="Le plugin Regular Labs Library n'est pas activé."
AMM_REGULAR_LABS_LIBRARY_NOT_INSTALLED="Le plugin Regular Labs Library n'est pas installé."
AMM_SETTINGS="Regardez [[%1:start link%]]Module de gestion[[%2:end link%]] pour la configuration."
AMM_THE_COMPONENT="Le composant Advanced Module Manager"
language/fr-FR/fr-FR.plg_system_advancedmodules.sys.ini 0000644 00000001204 15234436746 0017113 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_SYSTEM_ADVANCEDMODULES="Système - Regular Labs - Advanced Module Manager"
PLG_SYSTEM_ADVANCEDMODULES_DESC="Advanced Module Manager - Options avancées pour les modules Joomla!"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
language/ja-JP/ja-JP.plg_system_advancedmodules.ini 0000644 00000002551 15234436746 0016256 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_SYSTEM_ADVANCEDMODULES="システム - Regular Labs - Advanced Module Manager"
PLG_SYSTEM_ADVANCEDMODULES_DESC="Advanced Module Manager - Joomla! モジュールの高度なオプション"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
ADVANCEDMODULEMANAGER_DESC="「Advanced Module Manager」を使用すると、モジュールをコントロールする追加のオプションと機能が使えます。"
AMM_EXTENSION_CAN_NOT_FUNCTION="[[%1:extension name%]] は機能しません。"
AMM_REGULAR_LABS_LIBRARY_NOT_ENABLED="Regular Labs フレームワークプラグインがインストールされていません。"
AMM_REGULAR_LABS_LIBRARY_NOT_INSTALLED="Regular Labs フレームワークプラグインがインストールされていません。"
AMM_SETTINGS="設定(パラメータ)については、[[%1:start link%]]モジュール管理[[%2:end link%]]を参照して下さい"
AMM_THE_COMPONENT="Advanced Module Manager コンポーネント"
language/ja-JP/ja-JP.plg_system_advancedmodules.sys.ini 0000644 00000001220 15234436746 0017063 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_SYSTEM_ADVANCEDMODULES="システム - Regular Labs - Advanced Module Manager"
PLG_SYSTEM_ADVANCEDMODULES_DESC="Advanced Module Manager - Joomla! モジュールの高度なオプション"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
src/Helpers/advancedmodulehelper.php 0000644 00000051075 15234436746 0013647 0 ustar 00 <?php
/**
* @package Advanced Module Manager
* @version 9.8.0PRO
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Language\Text as JText;
use Joomla\CMS\Log\Log as JLog;
use RegularLabs\Library\ArrayHelper as RL_Array;
use RegularLabs\Library\Conditions as RL_Conditions;
use RegularLabs\Library\Document as RL_Document;
use RegularLabs\Library\ParametersNew as RL_Parameters;
use RegularLabs\Library\PluginTag as RL_PluginTag;
use RegularLabs\Library\RegEx as RL_RegEx;
use RegularLabs\Plugin\System\AdvancedModules\Params;
jimport('joomla.filesystem.file');
/*
* ModuleHelper methods
*/
class AdvancedModules
{
static $current_module = null;
public static function getCurrentModule()
{
return self::$current_module;
}
public static function setCurrentModule($module)
{
self::$current_module = $module;
}
}
class PlgSystemAdvancedModuleHelper
{
var $mirror_ids = [];
public function onPrepareModuleList(&$modules)
{
// return if is not frontend
if ( ! RL_Document::isClient('site'))
{
return;
}
jimport('joomla.filesystem.file');
$modules = is_null($modules) ? $this->getModuleList() : $modules;
if (is_array($modules) && empty($modules))
{
return;
}
[$remove_positions, $remove_modules] = $this->getRemovePositionsAndModules();
$filtered_modules = [];
foreach ($modules as $module)
{
if (empty($module->id))
{
continue;
}
if (
in_array($module->position, $remove_positions)
|| in_array($module->id, $remove_modules)
|| in_array($module->module, $remove_modules)
|| in_array($module->title, $remove_modules)
)
{
continue;
}
$module->name = substr($module->module, 4);
if (JFactory::getApplication()->input->get('option') == 'com_ajax')
{
$filtered_modules[] = $module;
continue;
}
$this->setAdvancedParams($module);
if ($module->advancedparams === 0)
{
if (isset($module->published) && ! $module->published)
{
continue;
}
$filtered_modules[] = $module;
continue;
}
$this->setExtraParams($module);
$module->reverse = 0;
$this->setMirrorParams($module);
$this->removeDisabledAssignments($module->advancedparams);
AdvancedModules::setCurrentModule($module);
$assignments = RL_Conditions::getConditionsFromParams($module->advancedparams);
$module->published = RL_Conditions::pass(
$assignments,
$module->advancedparams->match_method,
null,
$module
);
if ($module->reverse)
{
$module->published = ! $module->published;
}
if (isset($module->published) && ! $module->published)
{
continue;
}
$filtered_modules[] = $module;
}
$modules = array_values($filtered_modules);
unset($filtered_modules);
}
public function onRenderModule(&$module)
{
// Module already nulled
if (is_null($module))
{
return;
}
// Do nothing if is not frontend
if ( ! RL_Document::isClient('site'))
{
return;
}
// return true if module is empty (this will empty the content)
if ($this->isEmpty($module))
{
$module = null;
return;
}
// Add pre and post html
$this->addHTML($module);
}
private function addHTML(&$module)
{
$this->setAdvancedParams($module);
// return false if module params are not found
if (empty($module->advancedparams))
{
return;
}
$params = $module->advancedparams;
// do nothing if no advanced params are set
if (empty($params))
{
return;
}
// prepend the pre html
if (isset($params->pre_html) && $params->pre_html)
{
$module->content = $params->pre_html . $module->content;
}
// append the post html
if (isset($params->post_html) && $params->post_html)
{
$module->content .= $params->post_html;
}
}
private function getAdvancedParams($module)
{
if (empty($module->id))
{
return '{}';
}
if (isset($module->adv_params))
{
return $module->adv_params;
}
return $this->getAdvancedParamsById($module->id);
}
private function getAdvancedParamsById($id = 0)
{
if ( ! $id)
{
return '{}';
}
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('a.params')
->from('#__advancedmodules AS a')
->where('a.moduleid = ' . (int) $id);
$db->setQuery($query);
$params = $db->loadResult();
if (empty($params))
{
$params = '{}';
}
return $params;
}
private function getConfig()
{
static $instance;
if (is_object($instance))
{
return $instance;
}
$instance = RL_Parameters::getComponent('advancedmodules');
return $instance;
}
private function getMirrorModuleId($module)
{
if (isset($module->mirror_id))
{
return $module->mirror_id;
}
return $this->getMirrorModuleIdById($module->id);
}
private function getMirrorModuleIdById($id)
{
if (isset($this->mirror_ids[$id]))
{
return $this->mirror_ids[$id];
}
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('a.mirror_id')
->from('#__advancedmodules AS a')
->where('a.moduleid = ' . (int) $id);
$db->setQuery($query);
$this->mirror_ids[$id] = $db->loadResult();
return $this->mirror_ids[$id];
}
private function getModuleList()
{
$app = JFactory::getApplication();
$user = JFactory::getApplication()->getIdentity() ?: JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
$lang = JFactory::getLanguage()->getTag();
$clientId = (int) $app->getClientId();
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('m.id, m.title, m.module, m.position, m.content, m.showtitle, m.params')
->select('am.mirror_id, am.params AS advancedparams, 0 AS menuid, m.publish_up, m.publish_down')
->from('#__modules AS m')
->join('LEFT', '#__extensions AS e ON e.element = m.module AND e.client_id = m.client_id')
->join('LEFT', '#__advancedmodules as am ON am.moduleid = m.id')
->where('m.published = 1')
->where('e.enabled = 1')
->where('m.access IN (' . $groups . ')')
->where('m.client_id = ' . $clientId);
// Filter by language
if ($app->isClient('site') && $app->getLanguageFilter())
{
$query->where('m.language IN (' . $db->quote($lang) . ',' . $db->quote('*') . ')');
}
$query->order('m.position, m.ordering');
// Set the query
$db->setQuery($query);
try
{
$modules = $db->loadObjectList();
}
catch (RuntimeException $e)
{
JLog::add(JText::sprintf('JLIB_APPLICATION_ERROR_MODULE_LOAD', $e->getMessage()), JLog::WARNING, 'jerror');
return [];
}
return array_values($modules);
}
private function getRemovePositionsAndModules()
{
if ( ! $buffer = RL_Document::getComponentBuffer())
{
return [[], []];
}
$params = Params::get();
$remove_positions = [];
$remove_modules = [];
RL_RegEx::matchAll(Params::getRegex(), $buffer, $matches);
foreach ($matches as $match)
{
// Get the values from the tag
$attributes = RL_PluginTag::getAttributesFromString($match['attributes'], 'nokey');
$key_aliases = [
'modules' => ['module'],
'positions' => ['position'],
];
RL_PluginTag::replaceKeyAliases($attributes, $key_aliases);
if ( ! empty($attributes->positions))
{
$remove_positions = array_merge($remove_positions, RL_Array::toArray($attributes->positions));
}
if ( ! empty($attributes->modules))
{
$remove_modules = array_merge($remove_modules, RL_Array::toArray($attributes->modules));
}
if (empty($attributes->nokey))
{
continue;
}
if ($match['type'] == $params->tag_remove_modulepos)
{
$remove_positions[] = $attributes->nokey;
continue;
}
$remove_modules[] = $attributes->nokey;
}
return [array_unique($remove_positions), array_unique($remove_modules)];
}
private function isEmpty(&$module)
{
if ( ! isset($module->content))
{
return true;
}
$this->setAdvancedParams($module);
// return false if module params are not found
if (empty($module->advancedparams))
{
return false;
}
$params = $module->advancedparams;
// return false if hideempty is off in module params
if (empty($params)
|| (( ! isset($params->hideempty) || ! $params->hideempty) && empty($params->if_empty_html)))
{
return false;
}
$config = $this->getConfig();
// return false if use_hideempty is off in main config
if ( ! $config->use_hideempty)
{
return false;
}
$content = trim($module->content);
// remove empty tags to see if module can be considered as empty
if ( ! empty($content))
{
// remove html and hidden whitespace
$content = str_replace(chr(194) . chr(160), ' ', $content);
$content = str_replace([' ', ' '], ' ', $content);
// remove comment tags
$content = RL_RegEx::replace('<\!--.*?-->', '', $content);
// remove all closing tags
$content = RL_RegEx::replace('</[^>]+>', '', $content);
// remove tags to be ignored
$tags = 'p|div|span|strong|b|em|i|ul|font|br|h[0-9]|fieldset|label|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|form';
$search = '<(?:' . $tags . ')(?:\s[^>]*)?>';
if (RL_RegEx::match($search, $content))
{
$content = RL_RegEx::replace($search, '', $content);
}
$content = trim($content);
}
if ( ! empty($content))
{
return false;
}
if ( ! empty($params->if_empty_html))
{
$module->content = $params->if_empty_html;
return false;
}
return true;
}
private function removeDisabledAssignments(&$params)
{
$config = $this->getConfig();
if ( ! $config->show_assignto_homepage)
{
$params->assignto_homepage = 0;
}
if ( ! $config->show_assignto_usergrouplevels)
{
$params->assignto_usergrouplevels = 0;
}
if ( ! $config->show_assignto_users)
{
$params->assignto_users = 0;
}
if ( ! $config->show_assignto_date)
{
$params->assignto_date = 0;
$params->assignto_seasons = 0;
$params->assignto_months = 0;
$params->assignto_days = 0;
$params->assignto_time = 0;
}
if ( ! $config->show_assignto_languages)
{
$params->assignto_languages = 0;
}
if ( ! $config->show_assignto_ips)
{
$params->assignto_ips = 0;
}
if ( ! $config->show_assignto_geo)
{
$params->assignto_geocontinents = 0;
$params->assignto_geocountries = 0;
$params->assignto_georegions = 0;
$params->assignto_geopostalcodes = 0;
}
if ( ! $config->show_assignto_templates)
{
$params->assignto_templates = 0;
}
if ( ! $config->show_assignto_urls)
{
$params->assignto_urls = 0;
}
if ( ! $config->show_assignto_devices)
{
$params->assignto_devices = 0;
}
if ( ! $config->show_assignto_os)
{
$params->assignto_os = 0;
}
if ( ! $config->show_assignto_browsers)
{
$params->assignto_browsers = 0;
}
if ( ! $config->show_assignto_components)
{
$params->assignto_components = 0;
}
if ( ! $config->show_assignto_tags)
{
$params->show_assignto_tags = 0;
}
if ( ! $config->show_assignto_content)
{
$params->assignto_contentpagetypes = 0;
$params->assignto_cats = 0;
$params->assignto_articles = 0;
}
if ( ! $config->show_assignto_easyblog)
{
$params->assignto_easyblogpagetypes = 0;
$params->assignto_easyblogcats = 0;
$params->assignto_easyblogtags = 0;
$params->assignto_easyblogitems = 0;
}
if ( ! $config->show_assignto_flexicontent)
{
$params->assignto_flexicontentpagetypes = 0;
$params->assignto_flexicontenttags = 0;
$params->assignto_flexicontenttypes = 0;
}
if ( ! $config->show_assignto_form2content)
{
$params->assignto_form2contentprojects = 0;
}
if ( ! $config->show_assignto_k2)
{
$params->assignto_k2pagetypes = 0;
$params->assignto_k2cats = 0;
$params->assignto_k2tags = 0;
$params->assignto_k2items = 0;
}
if ( ! $config->show_assignto_zoo)
{
$params->assignto_zoopagetypes = 0;
$params->assignto_zoocats = 0;
$params->assignto_zooitems = 0;
}
if ( ! $config->show_assignto_akeebasubs)
{
$params->assignto_akeebasubspagetypes = 0;
$params->assignto_akeebasubslevels = 0;
}
if ( ! $config->show_assignto_hikashop)
{
$params->assignto_hikashoppagetypes = 0;
$params->assignto_hikashopcats = 0;
$params->assignto_hikashopproducts = 0;
}
if ( ! $config->show_assignto_mijoshop)
{
$params->assignto_mijoshoppagetypes = 0;
$params->assignto_mijoshopcats = 0;
$params->assignto_mijoshopproducts = 0;
}
if ( ! $config->show_assignto_redshop)
{
$params->assignto_redshoppagetypes = 0;
$params->assignto_redshopcats = 0;
$params->assignto_redshopproducts = 0;
}
if ( ! $config->show_assignto_virtuemart)
{
$params->assignto_virtuemartpagetypes = 0;
$params->assignto_virtuemartcats = 0;
$params->assignto_virtuemartproducts = 0;
}
if ( ! $config->show_assignto_cookieconfirm)
{
$params->assignto_cookieconfirm = 0;
}
if ( ! $config->show_assignto_php)
{
$params->assignto_php = 0;
}
}
private function setAdvancedParams(&$module)
{
if (empty($module->id))
{
return;
}
if (isset($module->advancedparams) && is_object($module->advancedparams))
{
return;
}
if ( ! isset($module->advancedparams))
{
$module->advancedparams = $this->getAdvancedParams($module);
}
$module->advancedparams = json_decode($module->advancedparams);
if (is_null($module->advancedparams))
{
$module->advancedparams = (object) [];
}
if (
! isset($module->advancedparams->assignto_menuitems)
|| isset($module->advancedparams->assignto_urls_selection_sef)
|| (
! is_array($module->advancedparams->assignto_menuitems)
&& strpos($module->advancedparams->assignto_menuitems, '|') !== false
)
)
{
require_once JPATH_ADMINISTRATOR . '/components/com_advancedmodules/models/module.php';
$model = new AdvancedModulesModelModule;
$module->advancedparams = (object) $model->initAssignments($module->id, $module);
}
$xmlfile_assignments = JPATH_ADMINISTRATOR . '/components/com_advancedmodules/assignments.xml';
$use_cache = $module->use_amm_cache ?? true;
$module->advancedparams = RL_Parameters::getObjectFromRegistry($module->advancedparams, $xmlfile_assignments, '', $use_cache);
}
private function setExtraParams(&$module)
{
$extraparams = [];
for ($e = 1; $e <= 5; $e++)
{
$var = 'extra' . $e;
$extraparams[$var] = $module->advancedparams->{$var} ?? '';
}
if (empty($extraparams))
{
return;
}
if (empty($module->params))
{
$module->params = json_encode($extraparams);
return;
}
$params = (array) json_decode($module->params, true);
$params = array_merge($params, $extraparams);
$module->params = json_encode($params);
}
private function setMirrorParams(&$module)
{
$module->mirror_id = $this->getMirrorModuleId($module);
if (empty($module->mirror_id))
{
return;
}
$mirror_id = $module->mirror_id < 0 ? $module->mirror_id * -1 : $module->mirror_id;
$count = 0;
while ($count++ < 10)
{
if ( ! $test_mirrorid = $this->getMirrorModuleIdById($mirror_id))
{
break;
}
$mirror_id = $test_mirrorid;
}
if (empty($mirror_id))
{
return;
}
$xmlfile_assignments = JPATH_ADMINISTRATOR . '/components/com_advancedmodules/assignments.xml';
$module->reverse = $module->mirror_id < 0;
if ($mirror_id == $module->id)
{
$empty = (object) [];
$mirror_params = RL_Parameters::getObjectFromRegistry($empty, $xmlfile_assignments);
}
else
{
if (isset($modules[$mirror_id]))
{
if ( ! isset($modules[$mirror_id]->advancedparams))
{
$modules[$mirror_id]->advancedparams = $this->getAdvancedParamsById($mirror_id);
$modules[$mirror_id]->advancedparams = RL_Parameters::getObjectFromRegistry($modules[$mirror_id]->advancedparams, $xmlfile_assignments);
}
$mirror_params = $modules[$mirror_id]->advancedparams;
}
else
{
$mirror_params = $this->getAdvancedParamsById($mirror_id);
$mirror_params = RL_Parameters::getObjectFromRegistry($mirror_params, $xmlfile_assignments);
}
}
// Keep the advanced settings that shouldn't be mirrored
$settings_to_keep = [
'hideempty', 'color',
'pre_html', 'post_html',
'extra1', 'extra2', 'extra3', 'extra4', 'extra5'
];
foreach ($settings_to_keep as $key)
{
if ( ! isset($module->advancedparams->{$key}))
{
continue;
}
$mirror_params->{$key} = $module->advancedparams->{$key};
}
$module->advancedparams = $mirror_params;
}
}
src/Document.php 0000644 00000010412 15234436746 0007636 0 ustar 00 <?php
/**
* @package Advanced Module Manager
* @version 9.8.0PRO
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
namespace RegularLabs\Plugin\System\AdvancedModules;
defined('_JEXEC') or die;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\CMS\Language\Text as JText;
use Joomla\CMS\Router\Route as JRoute;
use RegularLabs\Library\Document as RL_Document;
use RegularLabs\Library\Language as RL_Language;
use RegularLabs\Library\RegEx as RL_RegEx;
class Document
{
public static function loadFrontEditScript()
{
$user = JFactory::getApplication()->getIdentity() ?: JFactory::getUser();
if ( ! $user->authorise('core.edit', 'com_menus')
|| ! JFactory::getApplication()->get('frontediting', 1) == 2
)
{
return;
}
JHtml::_('jquery.framework');
RL_Document::script('advancedmodules/frontediting.min.js', '9.8.0.p');
}
/**
* Replace links to com_modules with com_advancedmodules
*/
public static function replaceLinks(&$string)
{
if (RL_Document::isClient('administrator') && JFactory::getApplication()->input->get('option') == 'com_modules')
{
self::replaceLinksInCoreModuleManager();
return;
}
$params = Params::get();
// Replace in link specifically in frontend
if (RL_Document::isClient('site') && $params->replace_urls_frontend)
{
self::replaceLinksInFrontend($string);
}
// Replace remaining links in modules in admin and frontend
if ( ! RL_Document::isClient('site') || $params->replace_urls_frontend)
{
self::replaceLinksModules($string);
}
}
private static function replaceLinksInCoreModuleManager()
{
RL_Language::load('com_advancedmodules');
$body = JFactory::getApplication()->getBody();
$url = 'index.php?option=com_advancedmodules';
if (JFactory::getApplication()->input->get('view') == 'module')
{
$url .= '&task=module.edit&id=' . (int) JFactory::getApplication()->input->get('id');
}
$link = '<a style="float:right;" href="' . JRoute::_($url) . '">' . JText::_('AMM_SWITCH_TO_ADVANCED_MODULE_MANAGER') . '</a><div style="clear:both;"></div>';
$body = RL_RegEx::replace('(</div>\s*</form>\s*(<\!--.*?-->\s*)*</div>)', $link . '\1', $body);
JFactory::getApplication()->setBody($body);
}
private static function replaceLinksInFrontend(&$string)
{
if (strpos($string, 'jmodediturl=') === false)
{
return;
}
$user = JFactory::getApplication()->getIdentity() ?: JFactory::getUser();
$params = Params::get();
$url = 'index.php?option=com_advancedmodules&view=edit&task=edit';
if ($user->authorise('core.manage', 'com_modules') && $params->use_admin_from_frontend)
{
$url = 'administrator/index.php?option=com_advancedmodules&task=module.edit';
}
$frontend_urls = [
'index.php?option=com_config&controller=config.display.modules',
'administrator/index.php?option=com_modules&view=module&layout=edit',
];
array_walk($frontend_urls, function (&$value) {
$value = RL_RegEx::quote($value);
});
$string = RL_RegEx::replace(
'(jmodediturl="[^"]*)(' . implode('|', $frontend_urls) . ')',
'\1' . $url,
$string
);
}
private static function replaceLinksModules(&$string)
{
if (strpos($string, 'com_modules') === false)
{
return;
}
$string = RL_RegEx::replace(
'((["\'])[^\s"\'%]*\?option=com_)(modules(\2|[^a-z-].*?\2))',
'\1advanced\3',
$string
);
$string = str_replace(
[
'?option=com_advancedmodules&force=1',
'?option=com_advancedmodules&force=1',
],
'?option=com_modules',
$string
);
}
}
src/ModuleHelper.php 0000644 00000001572 15234436746 0010454 0 ustar 00 <?php
/**
* @package Advanced Module Manager
* @version 9.8.0PRO
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
namespace RegularLabs\Plugin\System\AdvancedModules;
defined('_JEXEC') or die;
use Joomla\CMS\Factory as JFactory;
use PlgSystemAdvancedModuleHelper;
class ModuleHelper
{
public static function registerEvents()
{
require_once __DIR__ . '/Helpers/advancedmodulehelper.php';
$class = new PlgSystemAdvancedModuleHelper;
JFactory::getApplication()->registerEvent('onRenderModule', [$class, 'onRenderModule']);
JFactory::getApplication()->registerEvent('onPrepareModuleList', [$class, 'onPrepareModuleList']);
}
}
src/Params.php 0000644 00000004164 15234436746 0007312 0 ustar 00 <?php
/**
* @package Advanced Module Manager
* @version 9.8.0PRO
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
namespace RegularLabs\Plugin\System\AdvancedModules;
defined('_JEXEC') or die;
use RegularLabs\Library\ParametersNew as RL_Parameters;
use RegularLabs\Library\PluginTag as RL_PluginTag;
use RegularLabs\Library\RegEx as RL_RegEx;
class Params
{
protected static $params = null;
public static function get()
{
if ( ! is_null(self::$params))
{
return self::$params;
}
$params = RL_Parameters::getComponent('advancedmodules');
self::$params = $params;
return self::$params;
}
public static function getRegex($get_surrounding = false)
{
$params = self::get();
// Tag character start and end
[$tag_start, $tag_end] = self::getTagCharacters();
$tag_start = RL_RegEx::quote($tag_start);
$tag_end = RL_RegEx::quote($tag_end);
$tags = RL_RegEx::quote([$params->tag_remove_modules, $params->tag_remove_module, $params->tag_remove_modulepos], 'type');
$regex = $tag_start
. $tags
. ' (?<attributes>.*?)'
. $tag_end;
if ( ! $get_surrounding)
{
return $regex;
}
$pre = RL_PluginTag::getRegexSurroundingTagsPre();
$post = RL_PluginTag::getRegexSurroundingTagsPost();
return $pre . $regex . $post;
}
public static function getTagCharacters()
{
$params = self::get();
if ( ! isset($params->tag_character_start))
{
self::setTagCharacters();
}
return [$params->tag_character_start, $params->tag_character_end];
}
public static function setTagCharacters()
{
$params = self::get();
[self::$params->tag_character_start, self::$params->tag_character_end] = explode('.', $params->tag_characters);
}
}
vendor/composer/ClassLoader.php 0000644 00000037304 15234436746 0012622 0 ustar 00 <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see https://www.php-fig.org/psr/psr-0/
* @see https://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
/** @var ?string */
private $vendorDir;
// PSR-4
/**
* @var array[]
* @psalm-var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, array<int, string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, string>
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
* @var array[]
* @psalm-var array<string, array<string, string[]>>
*/
private $prefixesPsr0 = array();
/**
* @var array[]
* @psalm-var array<string, string>
*/
private $fallbackDirsPsr0 = array();
/** @var bool */
private $useIncludePath = false;
/**
* @var string[]
* @psalm-var array<string, string>
*/
private $classMap = array();
/** @var bool */
private $classMapAuthoritative = false;
/**
* @var bool[]
* @psalm-var array<string, bool>
*/
private $missingClasses = array();
/** @var ?string */
private $apcuPrefix;
/**
* @var self[]
*/
private static $registeredLoaders = array();
/**
* @param ?string $vendorDir
*/
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
}
/**
* @return string[]
*/
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
}
return array();
}
/**
* @return array[]
* @psalm-return array<string, array<int, string>>
*/
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
/**
* @return array[]
* @psalm-return array<string, string>
*/
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
/**
* @return array[]
* @psalm-return array<string, string>
*/
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
/**
* @return string[] Array of classname => path
* @psalm-return array<string, string>
*/
public function getClassMap()
{
return $this->classMap;
}
/**
* @param string[] $classMap Class to filename map
* @psalm-param array<string, string> $classMap
*
* @return void
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 base directories
*
* @return void
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*
* @return void
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*
* @return void
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*
* @return void
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*
* @return void
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
if (null === $this->vendorDir) {
return;
}
if ($prepend) {
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
} else {
unset(self::$registeredLoaders[$this->vendorDir]);
self::$registeredLoaders[$this->vendorDir] = $this;
}
}
/**
* Unregisters this instance as an autoloader.
*
* @return void
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
if (null !== $this->vendorDir) {
unset(self::$registeredLoaders[$this->vendorDir]);
}
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return true|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
return null;
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
/**
* Returns the currently registered loaders indexed by their corresponding vendor directories.
*
* @return self[]
*/
public static function getRegisteredLoaders()
{
return self::$registeredLoaders;
}
/**
* @param string $class
* @param string $ext
* @return string|false
*/
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*
* @param string $file
* @return void
* @private
*/
function includeFile($file)
{
include $file;
}
vendor/composer/InstalledVersions.php 0000644 00000035217 15234436746 0014077 0 ustar 00 <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer;
use Composer\Autoload\ClassLoader;
use Composer\Semver\VersionParser;
/**
* This class is copied in every Composer installed project and available to all
*
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require its presence, you can require `composer-runtime-api ^2.0`
*/
class InstalledVersions
{
/**
* @var mixed[]|null
* @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
*/
private static $installed;
/**
* @var bool|null
*/
private static $canGetVendors;
/**
* @var array[]
* @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/
private static $installedByVendor = array();
/**
* Returns a list of all package names which are present, either by being installed, replaced or provided
*
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
/**
* Returns a list of all package names with a specific type e.g. 'library'
*
* @param string $type
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackagesByType($type)
{
$packagesByType = array();
foreach (self::getInstalled() as $installed) {
foreach ($installed['versions'] as $name => $package) {
if (isset($package['type']) && $package['type'] === $type) {
$packagesByType[] = $name;
}
}
}
return $packagesByType;
}
/**
* Checks whether the given package is installed
*
* This also returns true if the package name is provided or replaced by another package
*
* @param string $packageName
* @param bool $includeDevRequirements
* @return bool
*/
public static function isInstalled($packageName, $includeDevRequirements = true)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
}
}
return false;
}
/**
* Checks whether the given package satisfies a version constraint
*
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
*
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
*
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
* @param string $packageName
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
* @return bool
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
/**
* Returns a version constraint representing all the range(s) which are installed for a given package
*
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
* whether a given version of a package is installed, and not just whether it exists
*
* @param string $packageName
* @return string Version constraint usable with composer/semver
*/
public static function getVersionRanges($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
$ranges = array();
if (isset($installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}
return $installed['versions'][$packageName]['version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getPrettyVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return $installed['versions'][$packageName]['pretty_version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
*/
public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
return $installed['versions'][$packageName]['reference'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
*/
public static function getInstallPath($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @return array
* @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
*/
public static function getRootPackage()
{
$installed = self::getInstalled();
return $installed[0]['root'];
}
/**
* Returns the raw installed.php data for custom implementations
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
* @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
*/
public static function getRawData()
{
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = include __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
return self::$installed;
}
/**
* Returns the raw data of all installed.php which are currently loaded for custom implementations
*
* @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/
public static function getAllRawData()
{
return self::getInstalled();
}
/**
* Lets you reload the static array from another file
*
* This is only useful for complex integrations in which a project needs to use
* this class but then also needs to execute another project's autoloader in process,
* and wants to ensure both projects have access to their version of installed.php.
*
* A typical case would be PHPUnit, where it would need to make sure it reads all
* the data it needs from this class, then call reload() with
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
* the project in which it runs can then also use this class safely, without
* interference between PHPUnit's dependencies and the project's dependencies.
*
* @param array[] $data A vendor/composer/installed.php data set
* @return void
*
* @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
*/
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
}
/**
* @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
}
}
}
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = require __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
$installed[] = self::$installed;
return $installed;
}
}
vendor/composer/LICENSE 0000644 00000002056 15234436746 0010716 0 ustar 00
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
vendor/composer/autoload_classmap.php 0000644 00000000350 15234436746 0014110 0 ustar 00 <?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
);
vendor/composer/autoload_namespaces.php 0000644 00000000225 15234436746 0014425 0 ustar 00 <?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);
vendor/composer/autoload_psr4.php 0000644 00000000341 15234436746 0013175 0 ustar 00 <?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'RegularLabs\\Plugin\\System\\AdvancedModules\\' => array($baseDir . '/src'),
);
vendor/composer/autoload_real.php 0000644 00000003467 15234436746 0013244 0 ustar 00 <?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit0607aff10648ef74c8ea6dd76ad3cc2d
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit0607aff10648ef74c8ea6dd76ad3cc2d', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit0607aff10648ef74c8ea6dd76ad3cc2d', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit0607aff10648ef74c8ea6dd76ad3cc2d::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
return $loader;
}
}
vendor/composer/autoload_static.php 0000644 00000002144 15234436746 0013577 0 ustar 00 <?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInit0607aff10648ef74c8ea6dd76ad3cc2d
{
public static $prefixLengthsPsr4 = array (
'R' =>
array (
'RegularLabs\\Plugin\\System\\AdvancedModules\\' => 42,
),
);
public static $prefixDirsPsr4 = array (
'RegularLabs\\Plugin\\System\\AdvancedModules\\' =>
array (
0 => __DIR__ . '/../..' . '/src',
),
);
public static $classMap = array (
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit0607aff10648ef74c8ea6dd76ad3cc2d::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit0607aff10648ef74c8ea6dd76ad3cc2d::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit0607aff10648ef74c8ea6dd76ad3cc2d::$classMap;
}, null, ClassLoader::class);
}
}
vendor/composer/installed.json 0000644 00000000105 15234436746 0012554 0 ustar 00 {
"packages": [],
"dev": true,
"dev-package-names": []
}
vendor/composer/installed.php 0000644 00000001334 15234436746 0012377 0 ustar 00 <?php return array(
'root' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '1005f7331037063170ca4f1a6861984f9b932586',
'name' => '__root__',
'dev' => true,
),
'versions' => array(
'__root__' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '1005f7331037063170ca4f1a6861984f9b932586',
'dev_requirement' => false,
),
),
);
vendor/autoload.php 0000644 00000000262 15234436746 0010400 0 ustar 00 <?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit0607aff10648ef74c8ea6dd76ad3cc2d::getLoader();
advancedmodules.php 0000644 00000002521 15234436746 0010431 0 ustar 00 <?php
/**
* @package Advanced Module Manager
* @version 9.8.0PRO
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
use RegularLabs\Library\ActionLogPlugin as RL_ActionLogPlugin;
use RegularLabs\Library\Document as RL_Document;
use RegularLabs\Library\Extension as RL_Extension;
defined('_JEXEC') or die;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php')
|| ! is_file(JPATH_LIBRARIES . '/regularlabs/src/ActionLogPlugin.php')
)
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
if ( ! RL_Document::isJoomlaVersion(3))
{
RL_Extension::disable('advancedmodules', 'plugin', 'actionlog');
return;
}
if (true)
{
class PlgActionlogAdvancedModules extends RL_ActionLogPlugin
{
public $name = 'ADVANCEDMODULEMANAGER';
public $alias = 'advancedmodules';
public function __construct(&$subject, array $config = [])
{
parent::__construct($subject, $config);
$this->items = [
'module' => (object) [
'title' => 'PLG_ACTIONLOG_JOOMLA_TYPE_MODULE',
],
];
}
}
}
advancedmodules.xml 0000644 00000003373 15234436746 0010450 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?>
<extension version="3" type="plugin" group="actionlog" method="upgrade">
<name>PLG_ACTIONLOG_ADVANCEDMODULES</name>
<description>PLG_ACTIONLOG_ADVANCEDMODULES_DESC</description>
<version>9.8.0PRO</version>
<creationDate>August 2023</creationDate>
<author>Regular Labs (Peter van Westen)</author>
<authorEmail>info@regularlabs.com</authorEmail>
<authorUrl>https://regularlabs.com</authorUrl>
<copyright>Copyright © 2023 Regular Labs - All Rights Reserved</copyright>
<license>GNU General Public License version 2 or later</license>
<files>
<file plugin="advancedmodules">advancedmodules.php</file>
<folder>language</folder>
</files>
<config>
<fields name="params" addfieldpath="/libraries/regularlabs/fields">
<fieldset name="basic">
<field name="@load_language_regularlabs" type="rl_loadlanguage" extension="plg_system_regularlabs"/>
<field name="@load_language" type="rl_loadlanguage" extension="plg_actionlog_advancedmodules"/>
<field name="@license" type="rl_license" extension="ADVANCEDMODULEMANAGER"/>
<field name="@version" type="rl_version" extension="ADVANCEDMODULEMANAGER"/>
<field name="@dependency" type="rl_dependency" label="RR_THE_COMPONENT" file="/administrator/components/com_advancedmodules/advancedmodules.xml"/>
<field name="@header" type="rl_header" label="ADVANCEDMODULEMANAGER" description="ADVANCEDMODULEMANAGER_DESC" url="https://regularlabs.com/advancedmodulemanager"/>
<field name="@note__settings" type="note" class="alert alert-info" description="AMM_SETTINGS,<a href="index.php?option=com_advancedmodules" target="_blank">,</a>"/>
</fieldset>
</fields>
</config>
</extension>
script.install.php 0000644 00000125626 15234436746 0010260 0 ustar 00 <?php
/**
* @package Advanced Module Manager
* @version 9.8.0PRO
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Installer\Manifest\PackageManifest as JPackageManifest;
use Joomla\CMS\Language\Text as JText;
if ( ! class_exists('pkg_advancedmodulesInstallerScript'))
{
class pkg_advancedmodulesInstallerScript
{
static $adapter;
static $current_version;
static $extensions = [];
static $file_string;
static $min_joomla_version = [3 => '3.9.0', 4 => '4.0'];
static $min_php_version = [3 => '7.4', 4 => '7.4'];
static $name;
static $new_manifest;
static $package_name;
static $previous_version;
static $previous_joomla_version;
static $dependancies = [
'regularlabs',
'conditions',
];
public function postflight($install_type, $adapter)
{
static::$adapter = $adapter;
if ( ! in_array($install_type, ['install', 'update']))
{
return true;
}
self::updateManifestFile();
self::updatePackageIds();
self::publishExtensions($install_type);
self::updateUpdateSites();
self::removeUnusedLanguageFiles();
self::clearCache();
self::displayMessages();
return true;
}
private function removeUnusedLanguageFiles()
{
$joomla_version = self::getJoomlaVersion();
$packages_folder = __DIR__ . '/packages/j' . $joomla_version;
$installed_languages = array_unique(array_merge(
JFolder::folders(JPATH_SITE . '/language', '^[a-z]+-[A-Z]+$'),
JFolder::folders(JPATH_ADMINISTRATOR . '/language', '^[a-z]+-[A-Z]+$')
));
$package_languages = JFolder::folders($packages_folder, '^[a-z]+-[A-Z]+$', true, true);
$remove_folders = [];
foreach ($package_languages as $path)
{
$path = str_replace($packages_folder . '/', '', $path);
// remove leading package folders
$path = preg_replace('#^[^/]+/packages/#', '', $path);
// continue if there are not exactly 2 slashes in the path
if (substr_count($path, '/') !== 2)
{
continue;
}
[$extension, $unused, $language] = explode('/', $path);
// skip if this is an installed language
if (in_array($language, $installed_languages))
{
continue;
}
$folder = self::getFolderFromExtensionName($extension);
// skip if no extension folder was found
if ( ! $folder)
{
continue;
}
$folder = self::getFolderFromExtensionName($extension) . '/language/' . $language;
// skip if folder doesn't exist
if ( ! is_dir($folder))
{
continue;
}
$remove_folders[] = self::getFolderFromExtensionName($extension) . '/language/' . $language;
}
if (empty($remove_folders))
{
return;
}
self::delete($remove_folders);
}
private static function getFolderFromExtensionName($extension)
{
[$type, $name] = explode('_', $extension, 2);
switch ($type)
{
case 'com':
return JPATH_ADMINISTRATOR . '/components/com_' . $name;
case 'mod':
return JPATH_ADMINISTRATOR . '/modules/mod_' . $name;
case 'plg':
[$folder, $name] = explode('_', $name, 2);
return JPATH_SITE . '/plugins/' . $folder . '/' . $name;
default:
return false;
}
}
private static function delete($files = [])
{
foreach ($files as $file)
{
if (is_dir($file))
{
JFolder::delete($file);
}
if (is_file($file))
{
JFile::delete($file);
}
}
}
public function preflight($install_type, $adapter)
{
static::$adapter = $adapter;
if ( ! in_array($install_type, ['install', 'update']))
{
return true;
}
$manifest = $adapter->getManifest();
static::$package_name = trim($manifest->packagename);
static::$name = trim($manifest->name);
static::$current_version = trim($manifest->version);
static::$previous_version = self::getPreviousVersion();
static::$previous_joomla_version = self::getPreviousJoomlaVersion();
if ( ! self::canInstall())
{
return false;
}
self::setNewManifest();
return true;
}
private static function canInstall()
{
if ( ! self::passJoomlaVersion())
{
return false;
}
if ( ! self::passMinimumPHPVersion())
{
return false;
}
return true;
}
private static function clearCache()
{
JFactory::getCache()->clean('_system');
JFactory::getCache()->clean('com_plugins');
JFactory::getCache()->clean('com_modules');
}
private static function displayChangelog()
{
$msg = self::getInstallationLanguageString();
JFactory::getApplication()->enqueueMessage(
JText::sprintf(
$msg,
'<strong>' . JText::_(static::$name . '_SHORT') . '</strong>',
'<strong>' . static::$current_version . '</strong>'
), 'success'
);
$changelog = self::getChangelog();
JFactory::getApplication()->enqueueMessage($changelog, 'info');
}
private static function displayMessages()
{
self::displayChangelog();
self::reorderMessageQueue();
}
private static function getChangelog()
{
$changelog = file_get_contents(__DIR__ . '/CHANGELOG.txt');
$changelog = "\n" . trim(preg_replace('#^.* \*/#s', '', $changelog));
$changelog = preg_replace("#\r#s", '', $changelog);
$parts = explode("\n\n", $changelog);
if (empty($parts))
{
return '';
}
$changelog = [];
// Add first entry to the changelog
$changelog[] = array_shift($parts);
$previous_version_simple = preg_replace('#^([0-9\.]+).*$#', '\1', static::$previous_version);
if (preg_match('#^[0-9]+-[a-z]+-[0-9]+ : v([0-9\.]+(?:-dev[0-9]+)?)\n#i', trim($changelog[0]), $match))
{
$this_version = $match[1];
}
// Add extra older entries if this is an upgrade based on previous installed version
if (static::$previous_version)
{
foreach ($parts as $part)
{
$part = trim($part);
if ( ! preg_match('#^[0-9]+-[a-z]+-[0-9]+ : v([0-9\.]+(?:-dev[0-9]+)?)\n#i', $part, $match))
{
continue;
}
$changelog_version = $match[1];
if (version_compare($changelog_version, $previous_version_simple, '<='))
{
break;
}
$changelog[] = $part;
}
}
$joomla_version = self::getJoomlaVersion();
$badge_classes = [
'default' => $joomla_version == 3 ? 'label label-sm label-default' : 'rl-badge badge bg-secondary',
'success' => $joomla_version == 3 ? 'label label-sm label-success' : 'rl-badge badge text-white bg-success',
'info' => $joomla_version == 3 ? 'label label-sm label-info' : 'rl-badge badge text-white bg-info',
'warning' => $joomla_version == 3 ? 'label label-sm label-warning' : 'rl-badge badge text-white bg-warning',
'danger' => $joomla_version == 3 ? 'label label-sm label-important' : 'rl-badge badge text-white bg-danger',
];
$changelog = implode('</pre>' . "\n\n", $changelog);
// + Added ! Removed ^ Changed # Fixed
$change_types = [
'+' => ['title' => 'Added', 'class' => $badge_classes['success']],
'^' => ['title' => 'Changed', 'class' => $badge_classes['info']],
'#' => ['title' => 'Fixed', 'class' => $badge_classes['warning']],
'!' => ['title' => 'Removed', 'class' => $badge_classes['danger']],
];
foreach ($change_types as $char => $type)
{
$changelog = preg_replace(
'#\n ' . preg_quote($char, '#') . ' #',
"\n" . '<span class="' . $type['class'] . '" title="' . $type['title'] . '">' . $char . '</span> ',
$changelog
);
}
// Extract note
$note = '';
if (preg_match('#\n > (.*?)\n#s', $changelog, $match))
{
$note = $match[1];
$changelog = str_replace($match[0], "\n", $changelog);
}
$changelog = preg_replace('#see: (https://www\.regularlabs\.com[^ \)]*)#s', '<a href="\1" target="_blank">see documentation</a>', $changelog);
$changelog = preg_replace(
"#(\n+)([0-9]+.*?) : v([0-9\.]+(?:-dev[0-9]*)?)([^\n]*?\n+)#",
'\1'
. '<code>v\3</code> [\2]'
. '\4<pre>',
$changelog
) . '</pre>';
$code_styling = $joomla_version == 3
? 'white-space: pre-wrap;line-height: 1.6em;max-height: 120px;overflow: auto;'
: 'white-space: pre-wrap;line-height: 1.6em;';
$changelog = str_replace(
[
'<pre>',
'[FREE]',
'[PRO]',
],
[
'<pre class="border bg-light p-2" style="' . $code_styling . '">',
'<span class="' . $badge_classes['success'] . '">FREE</span>',
'<span class="' . $badge_classes['info'] . '">PRO</span>',
],
$changelog
);
$changelog = preg_replace(
'#\[J([1-9][\.0-9]*)\]#',
'<span class="' . $badge_classes['default'] . '">J\1</span>',
$changelog
);
$msg = self::getInstallationLanguageString();
$title1 = JText::sprintf(
$msg,
'<strong>' . JText::_(static::$name . '_SHORT') . '</strong>',
'<strong>' . static::$current_version . '</strong>'
);
$title2 = JText::_('PKG_RL_LATEST_CHANGES');
if (
static::$previous_version
&& version_compare(static::$previous_version, static::$current_version, '<')
)
{
$title2 = JText::sprintf('PKG_RL_LATEST_CHANGES_SINCE', $previous_version_simple);
$previous_version_major = (int) static::$previous_version;
$current_version_major = (int) static::$current_version;
if (version_compare($previous_version_major, $current_version_major, '<'))
{
JFactory::getApplication()->enqueueMessage(JText::sprintf(
'PKG_RL_MAJOR_UPGRADE',
'<strong>' . JText::_(static::$name . '_SHORT') . '</strong>'
), 'warning');
}
}
if (strpos(static::$current_version, 'dev') !== false)
{
$note = '';
}
return '<h3>' . $title1 . '</h3>'
. '<h4>' . $title2 . '</h4>'
. ($note ? '<div class="alert alert-warning">' . $note . '</div>' : '')
. $changelog;
}
private static function getExtensions()
{
if ( ! empty(static::$extensions))
{
return static::$extensions;
}
$manifest = self::getNewManifest();
$xml = $manifest->asXML();
self::removeDependanciesFromString($xml);
$file = __DIR__ . '/pkg_' . static::$package_name . '.xml';
file_put_contents($file, $xml);
$package_manifest = new JPackageManifest($file);
static::$extensions = $package_manifest->filelist;
foreach (static::$extensions as $extension)
{
if ($extension->type != 'module')
{
continue;
}
$extension->position = self::getModulePositionFromXMLString($xml, $extension->id);
}
return static::$extensions;
}
private static function getFilesString($xml)
{
$tag = 'files_j' . self::getJoomlaVersion();
$string = self::getTagStringFromXml($xml, $tag, 'files');
static::$file_string = $string;
if (empty($string))
{
return '';
}
self::removeDependanciesIfOlder($string);
return $string;
}
private static function removeDependanciesFromString(&$string)
{
foreach (static::$dependancies as $dependancy)
{
self::removePackageFilesFromString($string, $dependancy);
}
}
private static function removeDependanciesIfOlder(&$string)
{
foreach (static::$dependancies as $dependancy)
{
self::removeDependancyIfOlder($string, $dependancy);
}
}
private static function removeDependancyIfOlder(&$string, $dependancy)
{
if ( ! self::shouldUpdateDependancy($dependancy))
{
self::removePackageFilesFromString($string, $dependancy);
}
}
private static function getFirstExtension()
{
$extensions = self::getExtensions();
return reset($extensions);
}
private static function getInstallationLanguageString()
{
if ( ! static::$previous_version)
{
return 'PKG_RL_EXTENSION_INSTALLED';
}
if (static::$previous_version == static::$current_version)
{
return 'PKG_RL_EXTENSION_REINSTALLED';
}
return 'PKG_RL_EXTENSION_UPDATED';
}
private static function getJoomlaVersion()
{
$version = (int) JVERSION;
if ($version == 5)
{
return 4;
}
return $version;
}
private static function getPackageId($package_name = '')
{
$package_name = $package_name ?: static::$package_name;
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('extension_id')
->from('#__extensions')
->where($db->quoteName('element') . ' = ' . $db->quote('pkg_' . $package_name));
$db->setQuery($query);
return $db->loadResult();
}
private static function getMainXmlFile($package_name = '', $include_pkg = true)
{
$package_name = $package_name ?: static::$package_name;
$file_paths = [
self::getManifestFilePathPackage($package_name),
self::getManifestFilePathLibrary($package_name),
self::getManifestFilePathComponent($package_name),
self::getManifestFilePathSystemPlugin($package_name),
self::getManifestFilePathFieldsPlugin($package_name),
self::getManifestFilePathModule($package_name),
];
if ( ! $include_pkg)
{
unset($file_paths[0]);
}
foreach ($file_paths as $file_path)
{
if (file_exists($file_path))
{
return $file_path;
}
}
return '';
}
private static function getManifestWithoutDependancies()
{
$manifest = static::$adapter->getManifest();
$xml = $manifest->asXML();
self::removeDependanciesFromString($xml);
return simplexml_load_string($xml);
}
private static function getModulePositionFromXMLString($xml, $id)
{
preg_match('#position="([^"]+)"[^>]* id="' . $id . '"#', $xml, $match);
return isset($match['1']) ? $match['1'] : '';
}
private static function getNewManifest()
{
if ( ! is_null(static::$new_manifest))
{
return static::$new_manifest;
}
$manifest = static::$adapter->getManifest();
$xml = $manifest->asXML();
$files = self::getFilesString($xml);
$xml = preg_replace('#<files .*?</files>#s', $files, $xml);
$xml = preg_replace('#<(files_j[3-4]).*?</\1>#s', '', $xml);
static::$new_manifest = simplexml_load_string($xml);
return static::$new_manifest;
}
private static function getManifestFilePathPackage($package_name = '')
{
$package_name = $package_name ?: static::$package_name;
return JPATH_MANIFESTS . '/packages/pkg_' . $package_name . '.xml';
}
private static function getManifestFilePathLibrary($package_name = '')
{
$package_name = $package_name ?: static::$package_name;
return JPATH_LIBRARIES . '/' . $package_name . '/' . $package_name . '.xml';
}
private static function getManifestFilePathComponent($package_name = '')
{
$package_name = $package_name ?: static::$package_name;
return JPATH_ADMINISTRATOR . '/components/com_' . $package_name . '/com_' . $package_name . '.xml';
}
private static function getManifestFilePathModule($package_name = '')
{
$package_name = $package_name ?: static::$package_name;
return JPATH_SITE . '/modules/mod_' . $package_name . '/mod_' . $package_name . '.xml';
}
private static function getManifestFilePathFieldsPlugin($package_name = '')
{
$package_name = $package_name ?: static::$package_name;
return JPATH_PLUGINS . '/fields/' . $package_name . '/' . $package_name . '.xml';
}
private static function getManifestFilePathSystemPlugin($package_name = '')
{
$package_name = $package_name ?: static::$package_name;
return JPATH_PLUGINS . '/system/' . $package_name . '/' . $package_name . '.xml';
}
private static function getVersionFromManifest($manifest_file)
{
if ( ! $manifest_file || ! file_exists($manifest_file))
{
return '';
}
$manifest = new JPackageManifest($manifest_file);
return isset($manifest->version) ? trim($manifest->version) : '';
}
private static function getCurrentVersion($package_name = '')
{
$package_name = $package_name ?: static::$package_name;
$joomla_version = self::getJoomlaVersion();
$manifest_file = __DIR__ . '/packages/j' . $joomla_version . '/pkg_' . $package_name . '/pkg_' . $package_name . '.xml';
return self::getVersionFromManifest($manifest_file);
}
private static function getPreviousVersion($package_name = '')
{
$package_name = $package_name ?: static::$package_name;
$manifest_file = self::getMainXmlFile($package_name);
return self::getVersionFromManifest($manifest_file);
}
private static function getPreviousJoomlaVersion($package_name = '')
{
$package_name = $package_name ?: static::$package_name;
$manifest_file = self::getMainXmlFile($package_name, false);
if ( ! $manifest_file || ! file_exists($manifest_file))
{
return '';
}
$xml = simplexml_load_file($manifest_file);
if ( ! $xml)
{
return '';
}
return (int) $xml->attributes()->version;
}
private static function getTagStringFromXml($xml, $from_tag, $to_tag)
{
$found = preg_match('#<' . $from_tag . '.*?</' . $from_tag . '>#s', $xml, $match);
if ( ! $found)
{
return '';
}
return str_replace($from_tag, $to_tag, $match[0]);
}
private static function hasFilesForJoomlaVersion($joomla_version)
{
$manifest = static::$adapter->getManifest();
return count($manifest->{'files_j' . $joomla_version}->children());
}
private static function passFreeOverProCheck()
{
}
private static function passJoomlaVersion()
{
$joomla_version = self::getJoomlaVersion();
if ( ! self::hasFilesForJoomlaVersion($joomla_version))
{
JFactory::getApplication()->enqueueMessage(
JText::sprintf(
'PKG_RL_NOT_COMPATIBLE_JOOMLA',
'<strong>' . JText::_(static::$name . '_SHORT') . '</strong>',
'<strong>' . self::getJoomlaVersion() . '</strong>'
),
'error'
);
return false;
}
$min_joomla_version = static::$min_joomla_version[$joomla_version];
if (version_compare(JVERSION, $min_joomla_version, '<'))
{
JFactory::getApplication()->enqueueMessage(
JText::sprintf(
'PKG_RL_NOT_COMPATIBLE_UPDATE',
'<strong>' . JText::_(static::$name . '_SHORT') . '</strong>',
'<strong>' . JVERSION . '</strong>',
'<strong>' . $min_joomla_version . '</strong>'
),
'error'
);
return false;
}
return true;
}
private static function passMinimumPHPVersion()
{
$joomla_version = self::getJoomlaVersion();
$min_php_version = static::$min_php_version[$joomla_version];
if (version_compare(PHP_VERSION, $min_php_version, '<'))
{
JFactory::getApplication()->enqueueMessage(
JText::sprintf(
'PKG_RL_NOT_COMPATIBLE_PHP',
'<strong>' . JText::_(static::$name . '_SHORT') . '</strong>',
'<strong>' . PHP_VERSION . '</strong>',
'<strong>' . $min_php_version . '</strong>'
),
'error'
);
return false;
}
return true;
}
/**
* Enable an extension
*
* @param string $type The extension type.
* @param string $name The name of the extension (the element field).
* @param string $plugin_folder
* @param string $module_position
* @param integer $client The application id (0: Joomla CMS site; 1: Joomla CMS administrator).
* @param bool $force
*/
private static function publishExtension($type, $name, $plugin_folder = 'system', $module_position = 'status', $client_id = 0, $force = false)
{
switch ($type)
{
case 'component' :
self::publishComponent($name, $client_id);
break;
case 'module' :
self::publishModule($name, $module_position, $client_id, $force);
break;
case 'plugin' :
self::publishPlugin($name, $plugin_folder);
break;
default:
break;
}
}
private static function publishExtensions($install_type)
{
$extensions = self::getExtensions();
$joomla_version = self::getJoomlaVersion();
foreach ($extensions as $extension)
{
$is_admin_module = $extension->client == 'administrator' && $extension->type == 'module';
$force = $joomla_version > static::$previous_joomla_version
|| $is_admin_module
|| $extension->id == 'regularlabs';
if ($install_type == 'update' && ! $force)
{
continue;
}
self::publishExtension(
$extension->type,
$extension->id,
isset($extension->group) ? $extension->group : 'system',
isset($extension->position) ? $extension->position : 'status',
$extension->client === 'site' ? 0 : 1,
$is_admin_module
);
}
}
private static function publishModule($name, $module_position = 'status', $client_id = 0, $force = false)
{
$db = JFactory::getDbo();
// Get module id
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->select($db->quoteName('position'))
->from('#__modules')
->where($db->quoteName('module') . ' = ' . $db->quote($name))
->where($db->quoteName('client_id') . ' = ' . (int) $client_id);
$db->setQuery($query, 0, 1);
$module = $db->loadObject();
if (empty($module))
{
return;
}
// check if module is already in the modules_menu table (meaning it is already saved)
$query->clear()
->select($db->quoteName('moduleid'))
->from('#__modules_menu')
->where($db->quoteName('moduleid') . ' = ' . (int) $module->id)
->setLimit(1);
$db->setQuery($query);
$exists = $db->loadResult();
if ($exists && $force)
{
$query = $db->getQuery(true)
->update('#__modules')
->set('published = 1')
->where($db->quoteName('id') . ' = ' . (int) $module->id);
$db->setQuery($query);
$db->execute();
return;
}
if ($exists)
{
return;
}
// Get highest ordering number in position
$query->clear()
->select($db->quoteName('ordering'))
->from('#__modules')
->where($db->quoteName('position') . ' = ' . $db->quote($module_position))
->where($db->quoteName('client_id') . ' = ' . (int) $client_id)
->order('ordering DESC');
$db->setQuery($query, 0, 1);
$ordering = $db->loadResult();
$ordering++;
// publish module and set ordering number
$query->clear()
->update('#__modules')
->set($db->quoteName('published') . ' = 1')
->set($db->quoteName('ordering') . ' = ' . (int) $ordering)
->set($db->quoteName('position') . ' = ' . $db->quote($module_position))
->where($db->quoteName('id') . ' = ' . (int) $module->id);
$db->setQuery($query);
$db->execute();
// add module to the modules_menu table
$query->clear()
->insert('#__modules_menu')
->columns([$db->quoteName('moduleid'), $db->quoteName('menuid')])
->values((int) $module->id . ', 0');
$db->setQuery($query);
$db->execute();
}
private static function publishPlugin($name, $plugin_folder)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->update('#__extensions')
->set($db->quoteName('enabled') . ' = 1')
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
->where($db->quoteName('folder') . ' = ' . $db->quote($plugin_folder))
->where($db->quoteName('element') . ' = ' . $db->quote($name));
$db->setQuery($query);
$db->execute();
}
private static function publishComponent($name, $client_id = 0, $force = false)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->update('#__extensions')
->set($db->quoteName('enabled') . ' = 1')
->where($db->quoteName('type') . ' = ' . $db->quote('component'))
->where($db->quoteName('element') . ' = ' . $db->quote($name))
->where($db->quoteName('client_id') . ' = ' . (int) $client_id);
$db->setQuery($query);
$db->execute();
}
private static function removeDuplicateUpdateSite()
{
$db = JFactory::getDbo();
// First check to see if there is a pro entry
$query = $db->getQuery(true)
->select($db->quoteName('update_site_id'))
->from('#__update_sites')
->where($db->quoteName('location') . ' LIKE ' . $db->quote('%download.regularlabs.com%'))
->where($db->quoteName('location') . ' LIKE ' . $db->quote('%e=' . static::$package_name . '%'))
->where($db->quoteName('location') . ' LIKE ' . $db->quote('%pro=1%'))
->setLimit(1);
$db->setQuery($query);
$id = $db->loadResult();
// Otherwise just get the first match
if ( ! $id)
{
$query->clear()
->select($db->quoteName('update_site_id'))
->from('#__update_sites')
->where($db->quoteName('location') . ' LIKE ' . $db->quote('%download.regularlabs.com%'))
->where($db->quoteName('location') . ' LIKE ' . $db->quote('%e=' . static::$package_name . '%'));
$db->setQuery($query, 0, 1);
$id = $db->loadResult();
// Add pro=1 to the found update site
$query->clear()
->update('#__update_sites')
->set($db->quoteName('location')
. ' = replace(' . $db->quoteName('location') . ', ' . $db->quote('&type=') . ', ' . $db->quote('&pro=1&type=') . ')')
->where($db->quoteName('update_site_id') . ' = ' . (int) $id);
$db->setQuery($query);
$db->execute();
}
if ( ! $id)
{
return;
}
$query->clear()
->select($db->quoteName('update_site_id'))
->from('#__update_sites')
->where($db->quoteName('location') . ' LIKE ' . $db->quote('%download.regularlabs.com%'))
->where($db->quoteName('location') . ' LIKE ' . $db->quote('%e=' . static::$package_name . '%'))
->where($db->quoteName('update_site_id') . ' != ' . $id);
$db->setQuery($query);
$ids = $db->loadColumn();
if (empty($ids))
{
return;
}
$query->clear()
->delete('#__update_sites')
->where($db->quoteName('update_site_id') . ' IN (' . implode(',', $ids) . ')');
$db->setQuery($query);
$db->execute();
$query->clear()
->delete('#__update_sites_extensions')
->where($db->quoteName('update_site_id') . ' IN (' . implode(',', $ids) . ')');
$db->setQuery($query);
$db->execute();
}
private static function removePackageFilesFromString(&$string, $package_name = '')
{
$package_name = $package_name ?: static::$package_name;
$string = preg_replace('#<file [^>]*id="' . $package_name . '">.*?</file>#s', '', $string);
}
private static function removeOldUpdateSites()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('update_site_id'))
->from('#__update_sites')
->where($db->quoteName('location') . ' LIKE ' . $db->quote('%nonumber.nl%'));
$db->setQuery($query);
$ids = $db->loadColumn();
self::removeUpdateSitesByIds($ids);
}
private static function removePackageId($id)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->update('#__extensions')
->set($db->quoteName('package_id') . ' = 0')
->where($db->quoteName('extension_id') . ' = ' . (int) $id);
$db->setQuery($query);
$db->execute();
}
private static function removeUpdateSitesByIds($ids = [])
{
if (empty($ids))
{
return;
}
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->delete('#__update_sites')
->where($db->quoteName('update_site_id') . ' IN (' . implode(',', $ids) . ')');
$db->setQuery($query);
$db->execute();
$query->clear()
->delete('#__update_sites_extensions')
->where($db->quoteName('update_site_id') . ' IN (' . implode(',', $ids) . ')');
$db->setQuery($query);
$db->execute();
}
private static function removeXXXUpdateSites()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('update_site_id'))
->from('#__update_sites')
->where($db->quoteName('location') . ' LIKE ' . $db->quote('%regularlabs.com/updates.xml?e=XXX%'));
$db->setQuery($query);
$ids = $db->loadColumn();
self::removeUpdateSitesByIds($ids);
}
private static function reorderMessageQueue()
{
$old_messages = JFactory::getApplication()->getMessageQueue(true);
$library_version = self::getCurrentVersion('regularlabs');
$library_messages = [];
foreach ($old_messages as $message)
{
if (strpos($message['message'], $library_version) !== false)
{
$library_messages[] = $message;
continue;
}
JFactory::getApplication()->enqueueMessage($message['message'], $message['type']);
}
foreach ($library_messages as $message)
{
JFactory::getApplication()->enqueueMessage($message['message'], $message['type']);
}
}
private static function saveDownloadKey($key)
{
$key = trim($key);
if ( ! $key)
{
return false;
}
if ( ! preg_match('#^[a-zA-Z0-9]{8}[A-Z0-9]{8}$#', $key, $match))
{
return false;
}
$db = JFactory::getDbo();
// Add the key on all regularlabs.com urls
$query = $db->getQuery(true)
->update('#__update_sites')
->set($db->quoteName('extra_query') . ' = ' . $db->quote('k=' . $key))
->where($db->quoteName('location') . ' LIKE ' . $db->quote('%download.regularlabs.com%'))
->where($db->quoteName('location') . ' LIKE ' . $db->quote('%&pro=%'));
$db->setQuery($query);
$db->execute();
return true;
}
private static function setNewManifest()
{
$manifest = self::getNewManifest();
static::$adapter->setManifest($manifest);
}
private static function setPackageId($element, $id)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->update('#__extensions')
->set($db->quoteName('package_id') . ' = ' . (int) $id)
->where($db->quoteName('element') . ' = ' . $db->quote($element));
$db->setQuery($query);
$db->execute();
}
private static function shouldUpdateDependancy($package_name)
{
$previous_version = self::getPreviousVersion($package_name);
if ( ! $previous_version)
{
return true;
}
$current_version = self::getCurrentVersion($package_name);
if ( ! $current_version)
{
return true;
}
return version_compare($previous_version, $current_version, '<=');
}
private static function updateDownloadKey()
{
if (self::updateDownloadKeyFromDatabase())
{
return;
}
self::updateDownloadKeyFromExtensionManager();
}
private static function updateDownloadKeyFromDatabase()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('extra_query')
->from('#__update_sites')
->where($db->quoteName('extra_query') . ' LIKE ' . $db->quote('k=%'))
->where($db->quoteName('location') . ' LIKE ' . $db->quote('%download.regularlabs.com%'));
$db->setQuery($query);
$key = $db->loadResult();
if ( ! $key)
{
return false;
}
if ( ! preg_match('#k=([a-zA-Z0-9]{8}[A-Z0-9]{8})#si', $key, $match))
{
return false;
}
return self::saveDownloadKey($match[1]);
}
private static function updateDownloadKeyFromExtensionManager()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('params'))
->from('#__extensions')
->where($db->quoteName('element') . ' = ' . $db->quote('com_regularlabsmanager'));
$db->setQuery($query);
$params = $db->loadResult();
if ( ! $params)
{
return false;
}
$params = json_decode($params);
if ( ! isset($params->key))
{
return false;
}
return self::saveDownloadKey($params->key);
}
private static function updateHttptoHttpsInUpdateSites()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->update('#__update_sites')
->set($db->quoteName('location') . ' = REPLACE('
. $db->quoteName('location') . ', '
. $db->quote('http://') . ', '
. $db->quote('https://')
. ')')
->where($db->quoteName('location') . ' LIKE ' . $db->quote('http://download.regularlabs.com%'));
$db->setQuery($query);
$db->execute();
}
private static function updateManifestFile()
{
$manifest = self::getManifestWithoutDependancies();
file_put_contents(self::getManifestFilePathPackage(), $manifest->asXML());
}
private static function updateNamesInUpdateSites()
{
$db = JFactory::getDbo();
$name = JText::_(static::$name);
$name .= ' [PRO]';
$query = $db->getQuery(true)
->update('#__update_sites')
->set($db->quoteName('name') . ' = ' . $db->quote($name))
->where($db->quoteName('location') . ' LIKE ' . $db->quote('%download.regularlabs.com%'))
->where($db->quoteName('location') . ' LIKE ' . $db->quote('%e=' . static::$package_name . '%'));
$db->setQuery($query);
$db->execute();
}
private static function updatePackageIds()
{
$lib_package_id = self::getPackageId('regularlabs');
self::setPackageId('regularlabs', $lib_package_id);
self::removePackageId($lib_package_id);
}
private static function updateUpdateSites()
{
self::removeOldUpdateSites();
self::removeXXXUpdateSites();
self::updateNamesInUpdateSites();
self::updateHttptoHttpsInUpdateSites();
self::removeDuplicateUpdateSite();
self::updateDownloadKey();
}
}
}
language/de-DE/de-DE.plg_actionlog_advancedmodules.ini 0000644 00000001744 15234624746 0016645 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_ACTIONLOG_ADVANCEDMODULES="Aktionsprotokoll - Regular Labs - Erweiterter Modul-Manager"
PLG_ACTIONLOG_ADVANCEDMODULES_DESC="Protokollierung der Aktionen von Benutzern für den Erweiterten Modul-Manager"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
ADVANCEDMODULEMANAGER_DESC="Advanced Module Manager - erweiterte Modulfunktionen in Joomla!."
AMM_SETTINGS="Bitte den [[%1:start link%]]Module Manager[[%2:end link%]] für die Einstellungen besuchen"
AMM_THE_COMPONENT="die Advanced Module Manager-Komponente"
AMM_THE_SYSTEM_PLUGIN="das Advanced Module Manager System-Plugin"
language/de-DE/de-DE.plg_actionlog_advancedmodules.sys.ini 0000644 00000001235 15234624746 0017455 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_ACTIONLOG_ADVANCEDMODULES="Aktionsprotokoll - Regular Labs - Erweiterter Modul-Manager"
PLG_ACTIONLOG_ADVANCEDMODULES_DESC="Protokollierung der Aktionen von Benutzern für den Erweiterten Modul-Manager"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
language/en-GB/en-GB.plg_actionlog_advancedmodules.ini 0000644 00000001726 15234624746 0016671 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_ACTIONLOG_ADVANCEDMODULES="Action Log - Regular Labs - Advanced Module Manager"
PLG_ACTIONLOG_ADVANCEDMODULES_DESC="Record the actions of users for Advanced Module Manager"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
ADVANCEDMODULEMANAGER_DESC="With Advanced Module Manager you have extra options and functionality to control your modules."
AMM_SETTINGS="Please see the [[%1:start link%]]Module Manager[[%2:end link%]] for settings."
AMM_THE_COMPONENT="the Advanced Module Manager component"
AMM_THE_SYSTEM_PLUGIN="the Advanced Module Manager system plugin"
language/en-GB/en-GB.plg_actionlog_advancedmodules.sys.ini 0000644 00000001177 15234624746 0017506 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_ACTIONLOG_ADVANCEDMODULES="Action Log - Regular Labs - Advanced Module Manager"
PLG_ACTIONLOG_ADVANCEDMODULES_DESC="Record the actions of users for Advanced Module Manager"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
language/fa-IR/fa-IR.plg_actionlog_advancedmodules.ini 0000644 00000002114 15234624746 0016675 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
; PLG_ACTIONLOG_ADVANCEDMODULES="Action Log - Regular Labs - Advanced Module Manager"
; PLG_ACTIONLOG_ADVANCEDMODULES_DESC="Record the actions of users for Advanced Module Manager"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
ADVANCEDMODULEMANAGER_DESC="با Advanced Module Manager شما تنظیمات و گزینه های بیشتری برای کنترل ماژول ها دارید"
AMM_SETTINGS="لطفا براي اعمال تنظيمات به [[%1:start link%]]مدیریت ماژول[[%2:end link%]] مراجعه کنید (پارامترها)"
AMM_THE_COMPONENT="کامپوننت Advanced Module Manager"
; AMM_THE_SYSTEM_PLUGIN="the Advanced Module Manager system plugin"
language/fa-IR/fa-IR.plg_actionlog_advancedmodules.sys.ini 0000644 00000001203 15234624746 0017510 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
; PLG_ACTIONLOG_ADVANCEDMODULES="Action Log - Regular Labs - Advanced Module Manager"
; PLG_ACTIONLOG_ADVANCEDMODULES_DESC="Record the actions of users for Advanced Module Manager"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
language/fr-FR/fr-FR.plg_actionlog_advancedmodules.ini 0000644 00000002004 15234624746 0016727 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_ACTIONLOG_ADVANCEDMODULES="Journal d'action - Regular Labs - Advanced Module Manager"
PLG_ACTIONLOG_ADVANCEDMODULES_DESC="Enregistrer les actions des utilisateurs pour Advanced Module Manager"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
ADVANCEDMODULEMANAGER_DESC="Avec Advanced Module Manager vous disposez d'options et de fonctions supplémentaires pour contrôler vos modules."
AMM_SETTINGS="Regardez [[%1:start link%]]Module de gestion[[%2:end link%]] pour la configuration."
AMM_THE_COMPONENT="Le composant Advanced Module Manager"
AMM_THE_SYSTEM_PLUGIN="le plugin système Advanced Module Manager"
language/fr-FR/fr-FR.plg_actionlog_advancedmodules.sys.ini 0000644 00000001223 15234624746 0017546 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_ACTIONLOG_ADVANCEDMODULES="Journal d'action - Regular Labs - Advanced Module Manager"
PLG_ACTIONLOG_ADVANCEDMODULES_DESC="Enregistrer les actions des utilisateurs pour Advanced Module Manager"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
language/ja-JP/ja-JP.plg_actionlog_advancedmodules.ini 0000644 00000002100 15234624746 0016676 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
; PLG_ACTIONLOG_ADVANCEDMODULES="Action Log - Regular Labs - Advanced Module Manager"
; PLG_ACTIONLOG_ADVANCEDMODULES_DESC="Record the actions of users for Advanced Module Manager"
ADVANCEDMODULEMANAGER="Advanced Module Manager"
ADVANCEDMODULEMANAGER_DESC="「Advanced Module Manager」を使用すると、モジュールをコントロールする追加のオプションと機能が使えます。"
AMM_SETTINGS="設定(パラメータ)については、[[%1:start link%]]モジュール管理[[%2:end link%]]を参照して下さい"
AMM_THE_COMPONENT="Advanced Module Manager コンポーネント"
; AMM_THE_SYSTEM_PLUGIN="the Advanced Module Manager system plugin"
language/ja-JP/ja-JP.plg_actionlog_advancedmodules.sys.ini 0000644 00000001203 15234624746 0017516 0 ustar 00 ;; @package Advanced Module Manager
;; @version 9.8.0PRO
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link https://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license GNU General Public License version 2 or later
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
; PLG_ACTIONLOG_ADVANCEDMODULES="Action Log - Regular Labs - Advanced Module Manager"
; PLG_ACTIONLOG_ADVANCEDMODULES_DESC="Record the actions of users for Advanced Module Manager"
ADVANCEDMODULEMANAGER="Advanced Module Manager"