feat(deployed): add Regular Labs suite (no-source, vetted live)

Regular Labs (Peter van Westen): Advanced Module Manager 7.7.1 + Sourcerer 7.4.0 + Modals 9.13.0 + RegularLabs library 18.12.3953; commercial (regularlabs.com) -> deployed files.

Signed-off-by: LÁZÁR Imre <imre@illusion.hu>
Assisted-by: claude-code@claude-opus-4-8
This commit is contained in:
LÁZÁR Imre AI Agent 2026-07-16 11:24:43 +02:00
parent 11ca565049
commit f18df8b9b3
530 changed files with 77330 additions and 0 deletions

View File

@ -0,0 +1,58 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('behavior.tabstate');
if ( ! JFactory::getUser()->authorise('core.manage', 'com_modules'))
{
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}
jimport('joomla.filesystem.file');
// return if Regular Labs Library plugin is not installed
if (
! is_file(JPATH_PLUGINS . '/system/regularlabs/regularlabs.xml')
|| ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php')
)
{
$msg = JText::_('AMM_REGULAR_LABS_LIBRARY_NOT_INSTALLED')
. ' ' . JText::sprintf('AMM_EXTENSION_CAN_NOT_FUNCTION', JText::_('COM_ADVANCEDMODULES'));
JFactory::getApplication()->enqueueMessage($msg, 'error');
return;
}
// give notice if Regular Labs Library plugin is not enabled
if ( ! JPluginHelper::isEnabled('system', 'regularlabs'))
{
$msg = JText::_('AMM_REGULAR_LABS_LIBRARY_NOT_ENABLED')
. ' ' . JText::sprintf('AMM_EXTENSION_CAN_NOT_FUNCTION', JText::_('COM_ADVANCEDMODULES'));
JFactory::getApplication()->enqueueMessage($msg, 'notice');
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
use RegularLabs\Library\Language as RL_Language;
RL_Language::load('plg_system_regularlabs');
RL_Language::load('com_modules', JPATH_ADMINISTRATOR);
$controller = JControllerLegacy::getInstance('AdvancedModules');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.4" type="component" method="upgrade">
<name>com_advancedmodules</name>
<description>COM_ADVANCEDMODULES_DESC</description>
<version>7.7.1</version>
<creationDate>July 2018</creationDate>
<author>Regular Labs (Peter van Westen)</author>
<authorEmail>info@regularlabs.com</authorEmail>
<authorUrl>https://www.regularlabs.com</authorUrl>
<copyright>Copyright © 2018 Regular Labs - All Rights Reserved</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<scriptfile>script.install.php</scriptfile>
<updateservers>
<server type="extension" priority="1" name="Regular Labs - Advanced Module Manager">
https://download.regularlabs.com/updates.xml?e=advancedmodulemanager&amp;type=.xml
</server>
</updateservers>
<administration>
<files>
<filename>advancedmodules.php</filename>
<filename>assignments.xml</filename>
<filename>config.xml</filename>
<filename>controller.php</filename>
<filename>script.install.helper.php</filename>
<folder>controllers</folder>
<folder>helpers</folder>
<folder>language</folder>
<folder>layouts</folder>
<folder>models</folder>
<folder>tables</folder>
<folder>views</folder>
</files>
</administration>
<files folder="site">
<filename>advancedmodules.php</filename>
<filename>controller.php</filename>
<filename>empty.xml</filename>
<folder>controllers</folder>
<folder>helpers</folder>
<folder>layouts</folder>
<folder>models</folder>
<folder>tables</folder>
<folder>views</folder>
</files>
<media folder="media" destination="advancedmodules">
<folder>js</folder>
</media>
</extension>

View File

@ -0,0 +1,318 @@
<?xml version="1.0" encoding="utf-8"?>
<config addfieldpath="/libraries/regularlabs/fields">
<fieldset name="category">
<field name="category" type="rl_simplecategories" default="" table="advancedmodules"
label="JCATEGORY"
description="JGLOBAL_CHOOSE_CATEGORY_DESC" />
</fieldset>
<fieldset name="hideempty">
<field name="hideempty" type="radio" class="btn-group btn-group-yesno" default="0"
label="AMM_HIDE_IF_EMPTY"
description="AMM_HIDE_IF_EMPTY_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
</fieldset>
<fieldset name="notes">
<field name="notes" type="rl_textareaplus" height="400" default="" show_insert_date_name="1" />
</fieldset>
<fieldset name="assignments">
<field name="@block_assignments" type="note" class="well well-small" description="RL_ASSIGNMENTS_DESC,AMM_MODULE" />
</fieldset>
<fieldset name="mirror_module">
<field name="mirror_module" type="radio" class="btn-group" default="0"
label="AMM_MIRROR_MODULE"
description="AMM_MIRROR_MODULE_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
<option value="2">AMM_OPPOSITE</option>
</field>
<field name="@toggler_mirror_a" type="rl_toggler" param="mirror_module" value="1,2" />
<field name="mirror_moduleid" type="rl_modules" showid="1" showtype="1" default=""
label="AMM_MODULE"
description="AMM_MODULE_DESC" />
<field name="@toggler_mirror_b" type="rl_toggler" />
</fieldset>
<fieldset name="match_method">
<field name="match_method" type="radio" class="btn-group" default="and"
label="RL_MATCHING_METHOD"
description="RL_MATCHING_METHOD_DESC,RL_ALL,RL_ALL_DESC,RL_ANY,RL_ANY_DESC">
<option value="and">RL_ALL</option>
<option value="or">RL_ANY</option>
</field>
<field name="@toggler_match_1a" type="rl_toggler" param="match_method" value="and" />
<field name="@block_and" type="note" class="alert alert-info" description="RL_ALL_DESC" />
<field name="@toggler_match_1b" type="rl_toggler" />
<field name="@toggler_match_2a" type="rl_toggler" param="match_method" value="or" />
<field name="@block_or" type="note" class="alert alert-info" description="RL_ANY_DESC" />
<field name="@toggler_match_2b" type="rl_toggler" />
</fieldset>
<fieldset name="show_assignments">
<field name="show_assignments" type="radio" class="btn-group" default="1"
label="RL_SHOW_ASSIGNMENTS"
description="RL_SHOW_ASSIGNMENTS_DESC">
<option value="1">JALL</option>
<option value="2">RL_SELECTED</option>
</field>
<field name="@toggler_show_assignments_1a" type="rl_toggler" param="show_assignments" value="2" />
<field name="@block_show_assignments" type="note" class="alert alert-info" description="RL_SHOW_ASSIGNMENTS_SELECTED_DESC" />
<field name="@toggler_show_assignments_1b" type="rl_toggler" />
</fieldset>
<fieldset name="assignto_menuitems">
<field name="assignto_menuitems" type="rl_assignmentselection" label="RL_MENU_ITEMS" />
<field name="assignto_menuitems_selection" type="rl_menuitems" multiple="true" default=""
label="RL_SELECTION"
description="RL_MENU_ITEMS_DESC" />
<field name="assignto_menuitems_inc_children" type="radio" class="btn-group btn-group-yesno" default="0"
label="RL_ALSO_ON_CHILD_ITEMS"
description="RL_ALSO_ON_CHILD_ITEMS_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
<option value="2">RL_ONLY</option>
</field>
<field name="@toggler_menuitems_inc_children_a" type="rl_toggler" param="assignto_menuitems_inc_children" value="1,2" />
<field name="@note__menuitems_inc_children" type="note" class="well well-small" description="RL_ALSO_ON_CHILD_ITEMS_MENUITEMS_DESC" />
<field name="@toggler_menuitems_inc_children_b" type="rl_toggler" />
<field name="assignto_menuitems_inc_noitemid" type="radio" class="btn-group btn-group-yesno" default="0"
label="RL_INCLUDE_NO_ITEMID"
description="RL_INCLUDE_NO_ITEMID_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="@assignto_menuitems" type="rl_assignmentselection" />
</fieldset>
<fieldset name="assignto_homepage">
<field name="assignto_homepage" type="rl_assignmentselection" showclose="1" label="RL_HOME_PAGE" />
<field name="@text_homepage" type="note" description="RL_HOME_PAGE_DESC" />
<field name="@assignto_homepage" type="rl_assignmentselection" />
</fieldset>
<fieldset name="assignto_date">
<field name="@toggler_group_date_a" type="rl_toggler"
param="show_assignments|assignto_date|assignto_seasons|assignto_months|assignto_days|assignto_time" value="1|1,2|1,2|1,2|1,2|1,2" />
<field name="@block_group_date_a" type="rl_block" start="1" showclose="1" label="RL_DATE_TIME" />
<field name="assignto_date" type="rl_assignmentselection" label="RL_DATE" />
<field name="assignto_date_publish_up" type="calendar" showtime="true" filter="user_utc" format="%Y-%m-%d %H:%M" default=""
label="RL_START_PUBLISHING"
description="RL_START_PUBLISHING_DESC" />
<field name="assignto_date_publish_down" type="calendar" showtime="true" filter="user_utc" format="%Y-%m-%d %H:%M" default=""
label="RL_FINISH_PUBLISHING"
description="RL_FINISH_PUBLISHING_DESC" />
<field name="assignto_date_recurring" type="radio" class="btn-group btn-group-yesno" default="0"
label="RL_DATE_RECURRING"
description="RL_DATE_RECURRING_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="@text_assignto_date_1" type="note" description="RL_DATE_TIME_DESC" />
<field name="@text_assignto_date_2" type="rl_datetime" format="Y-m-d H:i" label="RL_CURRENT_DATE" />
<field name="@assignto_date" type="rl_assignmentselection" />
<field name="@block_group_date_b" type="rl_block" end="1" />
<field name="@toggler_group_date_b" type="rl_toggler" />
</fieldset>
<fieldset name="assignto_groupusers">
<field name="@toggler_group_users_a" type="rl_toggler" param="show_assignments|assignto_usergrouplevels|assignto_users" value="1|1,2|1,2" />
<field name="@block_group_users_a" type="rl_block" start="1" showclose="1" label="RL_USERS" />
<field name="@toggler_usergrouplevels_a" type="rl_toggler" param="show_usergrouplevels" value="1" />
<field name="assignto_usergrouplevels" type="rl_assignmentselection" label="RL_USER_GROUP_LEVELS" />
<field name="assignto_usergrouplevels_selection" type="rl_grouplevel" multiple="true" notregistered="1" default=""
label="RL_SELECTION"
description="RL_USER_GROUPS_DESC" />
<field name="assignto_usergrouplevels_match_all" type="radio" class="btn-group btn-group-yesno" default="0"
label="RL_MATCH_ALL"
description="RL_MATCH_ALL_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="@toggler_usergrouplevels_match_all_a" type="rl_toggler" param="assignto_usergrouplevels_match_all" value="0" />
<field name="assignto_usergrouplevels_inc_children" type="radio" class="btn-group btn-group-yesno" default="0"
label="RL_ALSO_ON_CHILD_ITEMS"
description="RL_ALSO_ON_CHILD_ITEMS_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
<option value="2">RL_ONLY</option>
</field>
<field name="@toggler_usergrouplevels_match_all_b" type="rl_toggler" />
<field name="@assignto_usergrouplevels" type="rl_assignmentselection" />
<field name="@toggler_usergrouplevels_b" type="rl_toggler" />
<field name="@block_group_users_b" type="rl_block" end="1" />
<field name="@toggler_group_users_b" type="rl_toggler" />
</fieldset>
<fieldset name="assignto_languages">
<field name="assignto_languages" type="rl_assignmentselection" showclose="1" label="RL_LANGUAGES" />
<field name="assignto_languages_selection" type="rl_languages" multiple="true" default=""
label="RL_SELECTION"
description="RL_LANGUAGES_DESC" />
<field name="@assignto_languages" type="rl_assignmentselection" />
</fieldset>
<fieldset name="assignto_templates">
<field name="assignto_templates" type="rl_assignmentselection" showclose="1" label="RL_TEMPLATES" />
<field name="assignto_templates_selection" type="rl_templates" multiple="true" default=""
label="RL_SELECTION"
description="RL_TEMPLATES_DESC" />
<field name="@assignto_templates" type="rl_assignmentselection" />
</fieldset>
<fieldset name="assignto_urls">
<field name="assignto_urls" type="rl_assignmentselection" showclose="1" label="RL_URL" />
<field name="assignto_urls_selection" type="rl_textareaplus" texttype="regex" default=""
label="RL_URL_PARTS"
description="RL_URL_PARTS_DESC" />
<field name="@text_urls" type="note" description="RL_URL_PARTS_DESC" />
<field name="assignto_urls_regex" type="radio" class="btn-group btn-group-yesno" default="0"
label="RL_REGULAR_EXPRESSIONS"
description="RL_REGULAR_EXPRESSIONS_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="@toggler_urls_regex_a" type="rl_toggler" param="assignto_urls_regex" value="1" />
<field name="@block_urls_regex" type="note" class="alert alert-danger" description="RL_URL_PARTS_REGEX" />
<field name="@toggler_urls_regex_b" type="rl_toggler" />
<field name="@assignto_urls" type="rl_assignmentselection" />
</fieldset>
<fieldset name="assignto_devices">
<field name="assignto_devices" type="rl_assignmentselection" showclose="1" label="RL_DEVICES" />
<field name="@text_devices" type="note" description="RL_DEVICES_DESC" />
<field name="assignto_devices_selection" type="rl_list" multiple="true" default=""
label="RL_SELECTION"
description="RL_DEVICES_DESC">
<option value="desktop">RL_DEVICE_DESKTOP</option>
<option value="tablet">RL_DEVICE_TABLET</option>
<option value="mobile">RL_DEVICE_MOBILE</option>
</field>
<field name="@assignto_devices" type="rl_assignmentselection" />
</fieldset>
<fieldset name="assignto_os">
<field name="assignto_os" type="rl_assignmentselection" showclose="1" label="RL_OS" />
<field name="@text_os" type="note" description="RL_OS_DESC" />
<field name="assignto_os_selection" type="rl_agents" group="os" multiple="true" default=""
label="RL_SELECTION"
description="RL_OS_DESC" />
<field name="@assignto_os" type="rl_assignmentselection" />
</fieldset>
<fieldset name="assignto_browsers">
<field name="assignto_browsers" type="rl_assignmentselection" showclose="1" label="RL_BROWSERS" />
<field name="@text_browsers" type="note" description="RL_BROWSERS_DESC" />
<field name="assignto_browsers_selection" type="rl_agents" group="browsers" multiple="true" default=""
label="RL_BROWSERS"
description="RL_BROWSERS_DESC" />
<field name="assignto_mobile_selection" type="rl_agents" group="mobile" multiple="true" default=""
label="RL_MOBILE_BROWSERS"
description="RL_BROWSERS_DESC" />
<field name="@assignto_browsers" type="rl_assignmentselection" />
</fieldset>
<fieldset name="assignto_components">
<field name="assignto_components" type="rl_assignmentselection" showclose="1" label="RL_COMPONENTS" />
<field name="assignto_components_selection" type="rl_components" multiple="true" admin="0" show_content="1" default=""
label="RL_SELECTION"
description="RL_COMPONENTS_DESC" />
<field name="@assignto_components" type="rl_assignmentselection" />
</fieldset>
<fieldset name="assignto_tags">
<field name="assignto_tags" type="rl_assignmentselection" showclose="1" label="RL_TAGS" />
<field name="assignto_tags_selection" type="rl_tags" multiple="true" default=""
label="RL_SELECTION"
description="RL_TAGS_DESC" />
<field name="assignto_tags_match_all" type="radio" class="btn-group btn-group-yesno" default="0"
label="RL_MATCH_ALL"
description="RL_MATCH_ALL_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="@toggler_tags_match_all_a" type="rl_toggler" param="assignto_tags_match_all" value="0" />
<field name="assignto_tags_inc_children" type="radio" class="btn-group btn-group-yesno" default="0"
label="RL_ALSO_ON_CHILD_ITEMS"
description="RL_ALSO_ON_CHILD_ITEMS_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
<option value="2">RL_ONLY</option>
</field>
<field name="@toggler_tags_match_all_b" type="rl_toggler" />
<field name="@assignto_tags" type="rl_assignmentselection" />
</fieldset>
<fieldset name="assignto_content">
<field name="@loadlanguage_content" type="rl_loadlanguage" extension="com_content.sys" />
<field name="@toggler_content_a" type="rl_toggler" param="show_assignments|assignto_contentpagetypes|assignto_cats|assignto_articles"
value="1|1,2|1,2|1,2" />
<field name="@block_content_a" type="rl_block" start="1" showclose="1" label="RL_JCONTENT" />
<field name="assignto_contentpagetypes" type="rl_assignmentselection" label="RL_PAGE_TYPES" />
<field name="assignto_contentpagetypes_selection" type="rl_list" multiple="true" default=""
label="RL_SELECTION"
description="RL_PAGE_TYPES_DESC">
<option value="archive">COM_CONTENT_ARCHIVE_VIEW_DEFAULT_TITLE</option>
<option value="article">COM_CONTENT_ARTICLE_VIEW_DEFAULT_TITLE</option>
<option value="categories">COM_CONTENT_CATEGORIES_VIEW_DEFAULT_TITLE</option>
<option value="categoryblog">COM_CONTENT_CATEGORY_VIEW_BLOG_TITLE</option>
<option value="category">COM_CONTENT_CATEGORY_VIEW_DEFAULT_TITLE</option>
<option value="featured">COM_CONTENT_FEATURED_VIEW_DEFAULT_TITLE</option>
<option value="form">COM_CONTENT_FORM_VIEW_DEFAULT_TITLE</option>
</field>
<field name="@assignto_contentpagetypes" type="rl_assignmentselection" />
<field name="assignto_cats" type="rl_assignmentselection" label="RL_CATEGORIES" />
<field name="assignto_cats_selection" type="rl_content" group="categories" multiple="true" default=""
label="RL_SELECTION"
description="RL_CATEGORIES_DESC" />
<field name="assignto_cats_inc_children" type="radio" class="btn-group btn-group-yesno" default="0"
label="RL_ALSO_ON_CHILD_ITEMS"
description="RL_ALSO_ON_CHILD_ITEMS_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
<option value="2">RL_ONLY</option>
</field>
<field name="assignto_cats_inc" type="rl_checkbox" default="inc_cats,inc_arts"
label="RL_PAGE_TYPES"
description="RL_PAGE_TYPES_DESC">
<option value="inc_cats">RL_CATEGORIES</option>
<option value="inc_arts">RL_ARTICLES</option>
<option value="inc_others">RL_OTHERS</option>
</field>
<field name="@assignto_cats" type="rl_assignmentselection" />
<field name="assignto_articles" type="rl_assignmentselection" label="RL_ARTICLES" />
<field name="assignto_articles_selection" type="rl_content" group="items" multiple="true" default=""
label="RL_SELECTION"
description="RL_ARTICLES_DESC" />
<field name="assignto_articles_content_keywords" type="rl_textareaplus" height="40" default=""
label="RL_CONTENT_KEYWORDS"
description="RL_CONTENT_KEYWORDS_DESC" />
<field name="assignto_articles_keywords" type="rl_textareaplus" height="40" default=""
label="RL_META_KEYWORDS"
description="RL_META_KEYWORDS_DESC" />
<field name="assignto_articles_authors" type="rl_users" multiple="true" default=""
label="RL_ARTICLE_AUTHORS"
description="RL_ARTICLE_AUTHORS_DESC" />
<field name="@assignto_articles" type="rl_assignmentselection" />
<field name="@block_content_b" type="rl_block" end="1" />
<field name="@toggler_content_b" type="rl_toggler" />
</fieldset>
</config>

View File

@ -0,0 +1,284 @@
<?xml version="1.0" encoding="utf-8"?>
<config addfieldpath="/libraries/regularlabs/fields">
<fieldset name="default" label="AMM_DEFAULT_SETTINGS">
<field name="@loadlanguage" type="rl_loadlanguage" extension="com_modules" />
<field name="list_title" type="list" default="0"
label="AMM_LIST_TITLE"
description="AMM_LIST_TITLE_DESC">
<option value="0">AMM_ADVANCED_MODULE_MANAGER</option>
<option value="1">COM_MODULES_MANAGER_MODULES</option>
</field>
<field name="default_ordering" type="list" default="a.title ASC"
label="RL_DEFAULT_ORDERING"
description="RL_DEFAULT_ORDERING_DESC">
<option value="ordering ASC">RL_HEADING_ORDERING_ASC</option>
<option value="ordering DESC">RL_HEADING_ORDERING_DESC</option>
<option value="a.published ASC">RL_HEADING_STATUS_ASC</option>
<option value="a.published DESC">RL_HEADING_STATUS_DESC</option>
<option value="color ASC">RL_HEADING_COLOR_ASC</option>
<option value="color DESC">RL_HEADING_COLOR_DESC</option>
<option value="aa.category ASC">RL_HEADING_CATEGORY_ASC</option>
<option value="aa.category DESC">RL_HEADING_CATEGORY_DESC</option>
<option value="a.title ASC">RL_HEADING_TITLE_ASC</option>
<option value="a.title DESC">RL_HEADING_TITLE_DESC</option>
<option value="position ASC">RL_HEADING_POSITION_ASC</option>
<option value="position DESC">RL_HEADING_POSITION_DESC</option>
<option value="name ASC">RL_HEADING_TYPE_ASC</option>
<option value="name DESC">RL_HEADING_TYPE_DESC</option>
<option value="pages ASC">RL_HEADING_PAGES_ASC</option>
<option value="pages DESC">RL_HEADING_PAGES_DESC</option>
<option value="a.access ASC">RL_HEADING_ACCESS_ASC</option>
<option value="a.access DESC">RL_HEADING_ACCESS_DESC</option>
<option value="a.language ASC">RL_HEADING_LANGUAGE_ASC</option>
<option value="a.language DESC">RL_HEADING_LANGUAGE_DESC</option>
<option value="a.id ASC">RL_HEADING_ID_ASC</option>
<option value="a.id DESC">RL_HEADING_ID_DESC</option>
</field>
<field name="default_state" type="list" class="chzn-color-state" default="1"
label="AMM_DEFAULT_STATE"
description="AMM_DEFAULT_STATE_DESC">
<option value="0">JUNPUBLISHED</option>
<option value="1">JPUBLISHED</option>
</field>
<field name="default_menu_assignment" type="radio" class="btn-group btn-group-yesno btn-group-yesno-reverse" default="0"
label="AMM_DEFAULT_MENU_ASSIGNMENT"
description="AMM_DEFAULT_MENU_ASSIGNMENT_DESC">
<option value="1">JNONE</option>
<option value="0">JALL</option>
</field>
<field name="show_category" type="radio" class="btn-group btn-group-yesno" default="1"
label="AMM_SHOW_CATEGORY"
description="AMM_SHOW_CATEGORY_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="show_color" type="radio" class="btn-group btn-group-yesno" default="1"
label="AMM_SHOW_COLOR"
description="AMM_SHOW_COLOR_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="@toggler_default_a" type="rl_toggler" param="show_color" value="1" />
<field name="main_colors" type="textarea" rows="4"
default="none,#049cdb,#46a546,#9d261d,#ffc40d,#f89406,#c3325f,#7a43b6,#ffffff,#999999,#555555,#000000"
label="AMM_COLORS"
description="AMM_COLORS_DESC" />
<field name="@toggler_default_b" type="rl_toggler" />
<field name="show_hideempty" type="radio" class="btn-group btn-group-yesno" default="1"
label="AMM_SHOW_HIDE_IF_EMPTY"
description="AMM_SHOW_HIDE_IF_EMPTY_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="show_note" type="list" default="2"
label="AMM_SHOW_DESCRIPTION_IN_LIST"
description="AMM_SHOW_DESCRIPTION_IN_LIST_DESC">
<option value="0">JNO</option>
<option value="1">RL_TOOLTIP</option>
<option value="2">AMM_NAME_COLUMN</option>
<option value="3">AMM_EXTRA_COLUMN</option>
</field>
<field name="show_notes" type="list" default="1"
label="AMM_SHOW_NOTES_TAB"
description="AMM_SHOW_NOTES_TAB_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="show_switch" type="radio" class="btn-group btn-group-yesno" default="0"
label="AMM_SHOW_SWITCH"
description="AMM_SHOW_SWITCH_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="@notice_show_extra" type="rl_plaintext"
label="AMM_SHOW_EXTRA_FIELDS"
description="AMM_SHOW_EXTRA_FIELDS_DESC"
default="RL_ONLY_AVAILABLE_IN_PRO" />
<field name="replace_urls_frontend" type="radio" class="btn-group btn-group-yesno" default="1"
label="AMM_REPLACE_URLS_FRONTEND"
description="AMM_REPLACE_URLS_FRONTEND_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="@toggler_replace_urls_frontend_a" type="rl_toggler" param="replace_urls_frontend" value="1" />
<field name="use_admin_from_frontend" type="radio" class="btn-group btn-group-yesno" default="0"
label="AMM_USE_ADMIN_FROM_FRONTEND"
description="AMM_USE_ADMIN_FROM_FRONTEND_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="@toggler_replace_urls_frontend_b" type="rl_toggler" />
<field name="initialise_event" type="radio" class="btn-group btn-group-yesno" default="onAfterInitialise"
label="RL_INITIALISE_EVENT"
description="RL_INITIALISE_EVENT_DESC">
<option value="onAfterInitialise">onAfterInitialise</option>
<option value="onAfterRoute">onAfterRoute</option>
</field>
<field name="show_update_notification" type="radio" class="btn-group btn-group-yesno" default="1"
label="RL_SHOW_UPDATE_NOTIFICATION"
description="RL_SHOW_UPDATE_NOTIFICATION_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="@notice_show_copyright" type="rl_plaintext"
label="RL_SHOW_COPYRIGHT"
description="RL_SHOW_COPYRIGHT_DESC"
default="RL_ONLY_AVAILABLE_IN_PRO" />
</fieldset>
<fieldset name="extra" label="RL_SHOW_ASSIGNMENTS">
<field name="@show_assignto_menuitems" type="radio" class="btn-group btn-group-yesno" default="1"
label="RL_MENU_ITEMS"
description="JOPTION_REQUIRED">
<option value="1">JYES</option>
</field>
<field name="show_assignto_homepage" type="radio" class="btn-group btn-group-yesno" default="1"
label="RL_HOME_PAGE"
description="AMM_SHOW_PUBLISHING_OPTION">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="show_assignto_date" type="radio" class="btn-group btn-group-yesno" default="1"
label="RL_DATE_TIME"
description="AMM_SHOW_PUBLISHING_OPTION">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="show_assignto_usergrouplevels" type="radio" class="btn-group btn-group-yesno" default="1"
label="RL_USER_GROUP_LEVELS"
description="AMM_SHOW_PUBLISHING_OPTION">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="@notice_show_assignto_users" type="rl_plaintext"
label="RL_USERS"
description="AMM_SHOW_PUBLISHING_OPTION"
default="RL_ONLY_AVAILABLE_IN_PRO" />
<field name="show_assignto_languages" type="radio" class="btn-group btn-group-yesno" default="1"
label="RL_LANGUAGES"
description="AMM_SHOW_PUBLISHING_OPTION">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="@notice_show_assignto_ips" type="rl_plaintext"
label="RL_IPS"
description="AMM_SHOW_PUBLISHING_OPTION"
default="RL_ONLY_AVAILABLE_IN_PRO" />
<field name="@notice_show_assignto_geo" type="rl_plaintext"
label="RL_GEO"
description="AMM_SHOW_PUBLISHING_OPTION"
default="RL_ONLY_AVAILABLE_IN_PRO" />
<field name="show_assignto_templates" type="radio" class="btn-group btn-group-yesno" default="1"
label="RL_TEMPLATES"
description="AMM_SHOW_PUBLISHING_OPTION">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="show_assignto_urls" type="radio" class="btn-group btn-group-yesno" default="1"
label="RL_URL"
description="AMM_SHOW_PUBLISHING_OPTION">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="show_assignto_devices" type="radio" class="btn-group btn-group-yesno" default="1"
label="RL_DEVICES"
description="AMM_SHOW_PUBLISHING_OPTION">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="show_assignto_os" type="radio" class="btn-group btn-group-yesno" default="1"
label="RL_OS"
description="AMM_SHOW_PUBLISHING_OPTION">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="show_assignto_browsers" type="radio" class="btn-group btn-group-yesno" default="1"
label="RL_BROWSERS"
description="AMM_SHOW_PUBLISHING_OPTION">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="show_assignto_components" type="radio" class="btn-group btn-group-yesno" default="1"
label="RL_COMPONENTS"
description="AMM_SHOW_PUBLISHING_OPTION">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="show_assignto_tags" type="radio" class="btn-group btn-group-yesno" default="1"
label="RL_TAGS"
description="AMM_SHOW_PUBLISHING_OPTION">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="show_assignto_content" type="radio" class="btn-group btn-group-yesno" default="1"
label="RL_JCONTENT"
description="AMM_SHOW_PUBLISHING_OPTION">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="@notice_show_assignto_easyblog" type="rl_plaintext"
label="RL_EASYBLOG"
description="AMM_SHOW_PUBLISHING_OPTION"
default="RL_ONLY_AVAILABLE_IN_PRO" />
<field name="@notice_show_assignto_flexicontent" type="rl_plaintext"
label="RL_FLEXICONTENT"
description="AMM_SHOW_PUBLISHING_OPTION"
default="RL_ONLY_AVAILABLE_IN_PRO" />
<field name="@notice_show_assignto_form2content" type="rl_plaintext"
label="RL_FORM2CONTENT"
description="AMM_SHOW_PUBLISHING_OPTION"
default="RL_ONLY_AVAILABLE_IN_PRO" />
<field name="@notice_show_assignto_k2" type="rl_plaintext"
label="RL_K2"
description="AMM_SHOW_PUBLISHING_OPTION"
default="RL_ONLY_AVAILABLE_IN_PRO" />
<field name="@notice_show_assignto_zoo" type="rl_plaintext"
label="RL_ZOO"
description="AMM_SHOW_PUBLISHING_OPTION"
default="RL_ONLY_AVAILABLE_IN_PRO" />
<field name="@notice_show_assignto_akeebasubs" type="rl_plaintext"
label="RL_AKEEBASUBS"
description="AMM_SHOW_PUBLISHING_OPTION"
default="RL_ONLY_AVAILABLE_IN_PRO" />
<field name="@notice_show_assignto_hikashop" type="rl_plaintext"
label="RL_HIKASHOP"
description="AMM_SHOW_PUBLISHING_OPTION"
default="RL_ONLY_AVAILABLE_IN_PRO" />
<field name="@notice_show_assignto_mijoshop" type="rl_plaintext"
label="RL_MIJOSHOP"
description="AMM_SHOW_PUBLISHING_OPTION"
default="RL_ONLY_AVAILABLE_IN_PRO" />
<field name="@notice_show_assignto_redshop" type="rl_plaintext"
label="RL_REDSHOP"
description="AMM_SHOW_PUBLISHING_OPTION"
default="RL_ONLY_AVAILABLE_IN_PRO" />
<field name="@notice_show_assignto_virtuemart" type="rl_plaintext"
label="RL_VIRTUEMART"
description="AMM_SHOW_PUBLISHING_OPTION"
default="RL_ONLY_AVAILABLE_IN_PRO" />
<field name="@notice_show_assignto_cookieconfirm" type="rl_plaintext"
label="RL_COOKIECONFIRM"
description="AMM_SHOW_PUBLISHING_OPTION"
default="RL_ONLY_AVAILABLE_IN_PRO" />
<field name="@notice_show_assignto_php" type="rl_plaintext"
label="RL_PHP"
description="AMM_SHOW_PUBLISHING_OPTION"
default="RL_ONLY_AVAILABLE_IN_PRO" />
</fieldset>
<fieldset name="notice_permissions" label="JCONFIG_PERMISSIONS_LABEL">
<field name="@notice_rules" type="note" class="alert alert-info" description="AMM_USE_CORE_RULES" />
</fieldset>
</config>

View File

@ -0,0 +1,90 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Modules manager master display controller.
*/
class AdvancedModulesController extends JControllerLegacy
{
/**
* @var string The default view.
*/
protected $default_view = 'modules';
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array|boolean $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}
*
* @return JController This object to support chaining.
*/
public function display($cachable = false, $urlparams = false)
{
$id = $this->input->getInt('id');
$document = JFactory::getDocument();
// For JSON requests
if ($document->getType() == 'json')
{
$view = new ModulesViewModule;
// Get/Create the model
if ($model = new ModulesModelModule)
{
// Checkin table entry
if ( ! $model->checkout($id))
{
JFactory::getApplication()->enqueueMessage(JText::_('JLIB_APPLICATION_ERROR_CHECKIN_USER_MISMATCH'), 'error');
return false;
}
// Push the model into the view (as default)
$view->setModel($model, true);
}
$view->document = $document;
return $view->display();
}
require_once JPATH_COMPONENT . '/helpers/modules.php';
$layout = $this->input->get('layout', 'edit');
$id = $this->input->getInt('id');
// Check for edit form.
if ($layout == 'edit' && $id && ! $this->checkEditId('com_advancedmodules.edit.module', $id))
{
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_advancedmodules&view=modules', false));
return false;
}
// Load the submenu.
ModulesHelper::addSubmenu($this->input->get('view', 'modules'));
return parent::display();
}
}

View File

@ -0,0 +1,477 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Module controller class.
*/
class AdvancedModulesControllerModule extends JControllerForm
{
/**
* Override parent add method.
*
* @return mixed True if the record can be added, a JError object if not.
*/
public function add()
{
$app = JFactory::getApplication();
// Get the result of the parent method. If an error, just return it.
$result = parent::add();
if ($result instanceof Exception)
{
return $result;
}
// Look for the Extension ID.
$extensionId = $app->input->get('eid', 0, 'int');
if (empty($extensionId))
{
$redirectUrl = 'index.php?option=' . $this->option . '&view=' . $this->view_item . '&layout=edit';
$this->setRedirect(JRoute::_($redirectUrl, false));
throw new Exception(JText::_('COM_MODULES_ERROR_INVALID_EXTENSION'), 500);
}
$app->setUserState('com_advancedmodules.add.module.extension_id', $extensionId);
$app->setUserState('com_advancedmodules.add.module.params', null);
// Parameters could be coming in for a new item, so let's set them.
$params = $app->input->get('params', [], 'array');
$app->setUserState('com_advancedmodules.add.module.params', $params);
}
/**
* Override parent cancel method to reset the add module state.
*
* @param string $key The name of the primary key of the URL variable.
*
* @return boolean True if access level checks pass, false otherwise.
*/
public function cancel($key = null)
{
$app = JFactory::getApplication();
$result = parent::cancel();
$app->setUserState('com_advancedmodules.add.module.extension_id', null);
$app->setUserState('com_advancedmodules.add.module.params', null);
if ( ! JFactory::getApplication()->isClient('administrator'))
{
$returnUri = $this->input->post->get('return', null, 'base64');
$returnUri = ! empty($returnUri) ? base64_decode(urldecode($returnUri)) : JUri::base();
$this->setRedirect($returnUri);
$this->redirect();
}
return $result;
}
/**
* Override parent allowSave method.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
*/
protected function allowSave($data, $key = 'id')
{
// Use custom position if selected
if (isset($data['custom_position']))
{
if (empty($data['position']))
{
$data['position'] = $data['custom_position'];
}
unset($data['custom_position']);
}
return parent::allowSave($data, $key);
}
/**
* Override parent allowAdd method.
*
* @param array $data An array of input data.
*
* @return boolean
*/
protected function allowAdd($data = [])
{
$user = JFactory::getUser();
return ($user->authorise('core.create', 'com_modules') || count($user->getAuthorisedCategories('com_modules', 'core.create')));
}
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
*/
protected function allowEdit($data = [], $key = 'id')
{
// Initialise variables.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$user = JFactory::getUser();
// Zero record (id:0), return component edit permission by calling parent controller method
if ( ! $recordId)
{
return parent::allowEdit($data, $key);
}
// Check edit on the record asset (explicit or inherited)
if ($user->authorise('core.edit', 'com_modules.module.' . $recordId))
{
return true;
}
return false;
}
/**
* Method to run batch operations.
*
* @param string $model The model
*
* @return boolean True on success.
*/
public function batch($model = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Set the model
$model = $this->getModel('Module', '', []);
// Preset the redirect
$redirectUrl = 'index.php?option=com_advancedmodules&view=modules' . $this->getRedirectToListAppend();
$this->setRedirect(JRoute::_($redirectUrl, false));
return parent::batch($model);
}
/**
* Function that allows child controller access to model data after the data has been saved.
*
* @param JModelLegacy $model The data model object.
* @param array $validData The validated data.
*
* @return void
*/
protected function postSaveHook(JModelLegacy $model, $validData = [])
{
$app = JFactory::getApplication();
$task = $this->getTask();
switch ($task)
{
case 'save2new':
$app->setUserState('com_advancedmodules.add.module.extension_id', $model->getState('module.extension_id'));
break;
default:
$app->setUserState('com_advancedmodules.add.module.extension_id', null);
break;
}
$app->setUserState('com_advancedmodules.add.module.params', null);
}
/**
* Method to save a record.
*
* @param string $key The name of the primary key of the URL variable.
* @param string $urlVar The name of the URL variable if different from the primary key
*
* @return boolean True if successful, false otherwise.
*/
public function save($key = null, $urlVar = null)
{
if ( ! JSession::checkToken())
{
JFactory::getApplication()->redirect('index.php', JText::_('JINVALID_TOKEN'));
}
if (JFactory::getDocument()->getType() == 'json')
{
$model = $this->getModel();
$data = $this->input->post->get('jform', [], 'array');
$item = $model->getItem($this->input->get('id'));
$properties = $item->getProperties();
// Replace changed properties
$data = array_replace_recursive($properties, $data);
if ( ! empty($data['assigned']))
{
$data['assigned'] = array_map('abs', $data['assigned']);
}
// Add new data to input before process by parent save()
$this->input->post->set('jform', $data);
// Add path of forms directory
JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/com_advancedmodules/models/forms');
}
if ( ! JFactory::getApplication()->isClient('administrator'))
{
$this->saveFrontend($key, $urlVar);
}
parent::save($key, $urlVar);
}
public function saveFrontend($key = null, $urlVar = null)
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$app = JFactory::getApplication();
$lang = JFactory::getLanguage();
$model = $this->getModel();
$table = $model->getTable();
$data = $this->input->post->get('jform', [], 'array');
$checkin = property_exists($table, 'checked_out');
$context = "$this->option.edit.$this->context";
$task = $this->getTask();
$returnUri = $this->input->post->get('current', null, 'base64');
if (empty($returnUri))
{
$returnUri = $this->input->post->get('return', null, 'base64');
}
$returnUri = ! empty($returnUri) ? base64_decode(urldecode($returnUri)) : JUri::base();
// Determine the name of the primary key for the data.
if (empty($key))
{
$key = $table->getKeyName();
}
// To avoid data collisions the urlVar may be different from the primary key.
if (empty($urlVar))
{
$urlVar = $key;
}
$recordId = $this->input->getInt($urlVar);
// Populate the row id from the session.
$data[$key] = $recordId;
// Access check.
if ( ! $this->allowSave($data, $key))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'));
$this->setMessage($this->getError(), 'error');
$this->setRedirect($returnUri);
return false;
}
// Validate the posted data.
// Sometimes the form needs some posted data, such as for plugins and modules.
$form = $model->getForm($data, false);
if ( ! $form)
{
$app->enqueueMessage($model->getError(), 'error');
return false;
}
// Test whether the data is valid.
$validData = $model->validate($form, $data);
// Check for validation errors.
if ($validData === false)
{
// Get the validation messages.
$errors = $model->getErrors();
// Push up to three validation messages out to the user.
for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)
{
if ($errors[$i] instanceof Exception)
{
$app->enqueueMessage($errors[$i]->getMessage(), 'warning');
continue;
}
$app->enqueueMessage($errors[$i], 'warning');
}
// Save the data in the session.
$app->setUserState($context . '.data', $data);
// Redirect back to the edit screen.
$this->setRedirect($returnUri);
return false;
}
if ( ! isset($validData['tags']))
{
$validData['tags'] = null;
}
// Redirect back to the edit screen.
$this->setRedirect($returnUri);
// Attempt to save the data.
if ( ! $model->save($validData))
{
// Save the data in the session.
$app->setUserState($context . '.data', $validData);
// Redirect back to the edit screen.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()));
$this->setMessage($this->getError(), 'error');
return false;
}
// Save succeeded, so check-in the record.
if ($checkin && $model->checkin($validData[$key]) === false)
{
// Save the data in the session.
$app->setUserState($context . '.data', $validData);
// Check-in failed, so go back to the record and display a notice.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()));
$this->setMessage($this->getError(), 'error');
return false;
}
$this->setMessage(
JText::_(
($lang->hasKey($this->text_prefix . ($recordId == 0 && $app->isClient('site') ? '_SUBMIT' : '') . '_SAVE_SUCCESS')
? $this->text_prefix
: 'JLIB_APPLICATION') . ($recordId == 0 && $app->isClient('site') ? '_SUBMIT' : '') . '_SAVE_SUCCESS'
)
);
// Redirect the user and adjust session state based on the chosen task.
switch ($task)
{
case 'apply':
$app->setUserState($context . '.data', null);
break;
default:
// Clear the record id and data from the session.
$this->releaseEditId($context, $recordId);
$app->setUserState($context . '.data', null);
$returnUri = $this->input->post->get('return', null, 'base64');
$returnUri = ! empty($returnUri) ? base64_decode(urldecode($returnUri)) : JUri::base();
// Redirect to the previous url
$this->setRedirect($returnUri);
break;
}
$this->redirect();
}
/**
* Method to get the other modules in the same position
*
* @return string The data for the Ajax request.
*
* @since 3.6.3
*/
public function orderPosition()
{
$app = JFactory::getApplication();
// Send json mime type.
$app->mimeType = 'application/json';
$app->setHeader('Content-Type', $app->mimeType . '; charset=' . $app->charSet);
$app->sendHeaders();
// Check if user token is valid.
if ( ! JSession::checkToken('get'))
{
$app->enqueueMessage(JText::_('JINVALID_TOKEN'), 'error');
echo new JResponseJson;
$app->close();
}
$jinput = $app->input;
$clientId = $jinput->getValue('client_id');
$position = $jinput->getValue('position');
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('position, ordering, title')
->from('#__modules')
->where('client_id = ' . (int) $clientId . ' AND position = ' . $db->q($position))
->order('ordering');
$db->setQuery($query);
try
{
$orders = $db->loadObjectList();
}
catch (RuntimeException $e)
{
throw new Exception($e->getMessage(), 500);
}
$orders2 = [];
$n = count($orders);
if ($n > 0)
{
for ($i = 0, $n; $i < $n; $i++)
{
if ( ! isset($orders2[$orders[$i]->position]))
{
$orders2[$orders[$i]->position] = 0;
}
$orders2[$orders[$i]->position]++;
$ord = $orders2[$orders[$i]->position];
$title = JText::sprintf('COM_MODULES_OPTION_ORDER_POSITION', $ord, htmlspecialchars($orders[$i]->title, ENT_QUOTES, 'UTF-8'));
$html[] = $orders[$i]->position . ',' . $ord . ',' . $title;
}
}
else
{
$html[] = $position . ',' . 1 . ',' . JText::_('JNONE');
}
echo new JResponseJson($html);
$app->close();
}
}

View File

@ -0,0 +1,107 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Modules list controller class.
*/
class AdvancedModulesControllerModules extends JControllerAdmin
{
/**
* @var string The prefix to use with controller messages.
*/
protected $text_prefix = 'COM_MODULES';
/**
* Method to clone an existing module.
*
* @return void
*/
public function duplicate()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$pks = $this->input->post->get('cid', [], 'array');
JArrayHelper::toInteger($pks);
try
{
if (empty($pks))
{
throw new Exception(JText::_('COM_MODULES_ERROR_NO_MODULES_SELECTED'));
}
$model = $this->getModel();
$model->duplicate($pks);
$this->setMessage(JText::plural('COM_MODULES_N_MODULES_DUPLICATED', count($pks)));
}
catch (Exception $e)
{
throw new Exception($e->getMessage(), 500);
}
$this->setRedirect('index.php?option=com_advancedmodules&view=modules');
}
/**
* Method to set the color of items
*
* @return void
*/
public function setcolor()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$pks = $this->input->post->get('cid', [], 'array');
JArrayHelper::toInteger($pks);
try
{
if (empty($pks))
{
throw new Exception(JText::_('COM_MODULES_ERROR_NO_MODULES_SELECTED'));
}
$color = $this->input->post->get('setcolor', '', 'string');
$model = $this->getModel();
$model->setcolor($pks, $color);
}
catch (Exception $e)
{
throw new Exception($e->getMessage(), 500);
}
$this->setRedirect('index.php?option=com_advancedmodules&view=modules');
}
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return object The model.
*/
public function getModel($name = 'Module', $prefix = 'AdvancedModulesModel', $config = ['ignore_request' => true])
{
$model = parent::getModel($name, $prefix, $config);
return $model;
}
}

View File

@ -0,0 +1,215 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* JHtml module helper class.
*/
abstract class JHtmlModules
{
/**
* Builds an array of template options
*
* @param integer $clientId The client id.
* @param string $state The state of the template.
*
* @return array
*/
public static function templates($clientId = 0, $state = '')
{
$options = [];
$templates = ModulesHelper::getTemplates($clientId, $state);
foreach ($templates as $template)
{
$options[] = JHtml::_('select.option', $template->element, $template->name);
}
return $options;
}
/**
* Builds an array of template type options
*
* @return array
*/
public static function types()
{
$options = [];
$options[] = JHtml::_('select.option', 'user', 'COM_MODULES_OPTION_POSITION_USER_DEFINED');
$options[] = JHtml::_('select.option', 'template', 'COM_MODULES_OPTION_POSITION_TEMPLATE_DEFINED');
return $options;
}
/**
* Builds an array of template state options
*
* @return array
*/
public static function templateStates()
{
$options = [];
$options[] = JHtml::_('select.option', '1', 'JENABLED');
$options[] = JHtml::_('select.option', '0', 'JDISABLED');
return $options;
}
/**
* Returns a published state on a grid
*
* @param integer $value The state value.
* @param integer $i The row index
* @param boolean $enabled An optional setting for access control on the action.
* @param string $checkbox An optional prefix for checkboxes.
*
* @return string The Html code
*
* @see JHtmlJGrid::state
* @since 1.7.1
*/
public static function state($value, $i, $enabled = true, $checkbox = 'cb')
{
$states = [
'publish',
'COM_MODULES_EXTENSION_UNPUBLISHED_DISABLED',
'COM_MODULES_HTML_PUBLISH_DISABLED',
'COM_MODULES_EXTENSION_UNPUBLISHED_DISABLED',
true,
'unpublish',
'unpublish',
];
return JHtml::_('jgrid.state', $states, $value, $i, 'modules.', $enabled, true, $checkbox);
}
/**
* Display a batch widget for the module position selector.
*
* @param integer $clientId The client ID.
* @param integer $state The state of the module (enabled, unenabled, trashed).
* @param string $selectedPosition The currently selected position for the module.
*
* @return string The necessary positions for the widget.
*/
public static function positions($clientId, $state = 1, $selectedPosition = '')
{
require_once JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php';
$templates = array_keys(ModulesHelper::getTemplates($clientId, $state));
$templateGroups = [];
// Add an empty value to be able to deselect a module position
$option = ModulesHelper::createOption();
$templateGroups[''] = ModulesHelper::createOptionGroup('', [$option]);
// Add positions from templates
$isTemplatePosition = false;
foreach ($templates as $template)
{
$options = [];
$positions = TemplatesHelper::getPositions($clientId, $template);
if (is_array($positions))
{
foreach ($positions as $position)
{
$text = ModulesHelper::getTranslatedModulePosition($clientId, $template, $position) . ' [' . $position . ']';
$options[] = ModulesHelper::createOption($position, $text);
if ( ! $isTemplatePosition && $selectedPosition === $position)
{
$isTemplatePosition = true;
}
}
$options = JArrayHelper::sortObjects($options, 'text');
}
$templateGroups[$template] = ModulesHelper::createOptionGroup(ucfirst($template), $options);
}
// Add custom position to options
$customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION');
$editPositions = true;
$customPositions = ModulesHelper::getPositions($clientId, $editPositions);
$templateGroups[$customGroupText] = ModulesHelper::createOptionGroup($customGroupText, $customPositions);
return $templateGroups;
}
/**
* Get a select with the batch action options
*
* @return void
*/
public static function batchOptions()
{
// Create the copy/move options.
$options = [
JHtml::_('select.option', 'c', JText::_('JLIB_HTML_BATCH_COPY')),
JHtml::_('select.option', 'm', JText::_('JLIB_HTML_BATCH_MOVE')),
];
echo JHtml::_('select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm');
}
/**
* Method to get the field options.
*
* @param integer $clientId The client ID
*
* @return array The field option objects.
*/
public static function positionList($clientId = 0)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('DISTINCT(position) as value')
->select('position as text')
->from($db->quoteName('#__modules'))
->where($db->quoteName('client_id') . ' = ' . (int) $clientId)
->order('position');
// Get the options.
$db->setQuery($query);
try
{
$options = $db->loadObjectList();
}
catch (RuntimeException $e)
{
throw new Exception($e->getMessage(), 500);
}
// Pop the first item off the array if it's blank
if (count($options))
{
if (strlen($options[0]->text) < 1)
{
array_shift($options);
}
}
return $options;
}
}

View File

@ -0,0 +1,329 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Modules component helper.
*/
abstract class ModulesHelper
{
/**
* Configure the Linkbar.
*
* @param string $vName The name of the active view.
*
* @return void
*/
public static function addSubmenu($vName)
{
// Not used in this component.
}
/**
* Get a list of filter options for the state of a module.
*
* @return array An array of JHtmlOption elements.
*/
public static function getStateOptions()
{
// Build the filter options.
$options = [];
$options[] = JHtml::_('select.option', '1', JText::_('JPUBLISHED'));
$options[] = JHtml::_('select.option', '0', JText::_('JUNPUBLISHED'));
$options[] = JHtml::_('select.option', '-2', JText::_('JTRASHED'));
$options[] = JHtml::_('select.option', '*', JText::_('JALL'));
return $options;
}
/**
* Get a list of filter options for the application clients.
*
* @return array An array of JHtmlOption elements.
*/
public static function getClientOptions()
{
// Build the filter options.
$options = [];
$options[] = JHtml::_('select.option', '0', JText::_('JSITE'));
$options[] = JHtml::_('select.option', '1', JText::_('JADMINISTRATOR'));
return $options;
}
/**
* Get a list of modules positions
*
* @param integer $clientId Client ID
* @param boolean $editPositions Allow to edit the positions
*
* @return array A list of positions
*/
public static function getPositions($clientId, $editPositions = false)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('DISTINCT(position)')
->from('#__modules')
->where($db->quoteName('client_id') . ' = ' . (int) $clientId)
->order('position');
$db->setQuery($query);
try
{
$positions = $db->loadColumn();
$positions = is_array($positions) ? $positions : [];
}
catch (RuntimeException $e)
{
throw new Exception($e->getMessage(), 500);
}
// Build the list
$options = [];
foreach ($positions as $position)
{
if ( ! $position && ! $editPositions)
{
$options[] = JHtml::_('select.option', 'none', ':: ' . JText::_('JNONE') . ' ::');
continue;
}
$options[] = JHtml::_('select.option', $position, $position);
}
return $options;
}
/**
* Return a list of templates
*
* @param integer $clientId Client ID
* @param string $state State
* @param string $template Template name
*
* @return array List of templates
*/
public static function getTemplates($clientId = 0, $state = '', $template = '')
{
$db = JFactory::getDbo();
// Get the database object and a new query object.
$query = $db->getQuery(true);
// Build the query.
$query->select('element, name, enabled')
->from('#__extensions')
->where('client_id = ' . (int) $clientId)
->where('type = ' . $db->quote('template'));
if ($state != '')
{
$query->where('enabled = ' . $db->quote($state));
}
if ($template != '')
{
$query->where('element = ' . $db->quote($template));
}
// Set the query and load the templates.
$db->setQuery($query);
return $db->loadObjectList('element');
}
/**
* Get a list of the unique modules installed in the client application.
*
* @param int $clientId The client id.
*
* @return array Array of unique modules
*/
public static function getModules($clientId)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('e.element AS value, e.name AS text')
->from('#__extensions as e')
->where('e.client_id = ' . (int) $clientId)
->where('e.type = ' . $db->quote('module'))
->join('LEFT', '#__modules as m ON m.module=e.element AND m.client_id=e.client_id')
->where('m.module IS NOT NULL')
->group('e.element, e.name');
$db->setQuery($query);
$modules = $db->loadObjectList();
$lang = JFactory::getLanguage();
foreach ($modules as $i => $module)
{
$extension = $module->value;
$path = $clientId ? JPATH_ADMINISTRATOR : JPATH_SITE;
$source = $path . "/modules/$extension";
$lang->load("$extension.sys", $path, null, false, true)
|| $lang->load("$extension.sys", $source, null, false, true);
$modules[$i]->text = JText::_($module->text);
}
JArrayHelper::sortObjects($modules, 'text', 1, true, true);
return $modules;
}
/**
* Get a list of the menu item assignment options for modules.
*
* @param int $clientId The client id.
*
* @return array
*/
public static function getMenuItemAssignmentOptions($clientId)
{
$options = [];
$options[] = JHtml::_('select.option', '0', JText::_('JALL'));
$options[] = JHtml::_('select.option', '-', JText::_('JNONE'));
if ($clientId != 0)
{
return $options;
}
$options[] = JHtml::_('select.option', '-1', JText::_('COM_MODULES_ASSIGNED_VARIES_EXCEPT'));
$options[] = JHtml::_('select.option', '-2', JText::_('COM_MODULES_ASSIGNED_VARIES_ONLY'));
require_once realpath(JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
$items = MenusHelper::getMenuLinks();
foreach ($items as $type)
{
$options[] = JHtml::_('select.option', '<OPTGROUP>', $type->title);
foreach ($type->links as $item)
{
$options[] = JHtml::_('select.option', $item->value, str_repeat('- ', $item->level) . $item->text);
}
$options[] = JHtml::_('select.option', '</OPTGROUP>');
}
return $options;
}
/**
* Return a translated module position name
*
* @param integer $clientId Application client id 0: site | 1: admin
* @param string $template Template name
* @param string $position Position name
*
* @return string Return a translated position name
*/
public static function getTranslatedModulePosition($clientId, $template, $position)
{
// Template translation
$lang = JFactory::getLanguage();
$path = $clientId ? JPATH_ADMINISTRATOR : JPATH_SITE;
$loaded = $lang->getPaths('tpl_' . $template . '.sys');
// Only load the template's language file if it hasn't been already
if ( ! $loaded)
{
$lang->load('tpl_' . $template . '.sys', $path, null, false, false)
|| $lang->load('tpl_' . $template . '.sys', $path . '/templates/' . $template, null, false, false)
|| $lang->load('tpl_' . $template . '.sys', $path, $lang->getDefault(), false, false)
|| $lang->load('tpl_' . $template . '.sys', $path . '/templates/' . $template, $lang->getDefault(), false, false);
}
$langKey = strtoupper('TPL_' . $template . '_POSITION_' . $position);
$text = JText::_($langKey);
// Avoid untranslated strings
if ( ! self::isTranslatedText($langKey, $text))
{
// Modules component translation
$langKey = strtoupper('COM_MODULES_POSITION_' . $position);
$text = JText::_($langKey);
// Avoid untranslated strings
if ( ! self::isTranslatedText($langKey, $text))
{
// Try to humanize the position name
$text = ucfirst(preg_replace('/^' . $template . '\-/', '', $position));
$text = ucwords(str_replace(['-', '_'], ' ', $text));
}
}
return $text;
}
/**
* Check if the string was translated
*
* @param string $langKey Language file text key
* @param string $text The "translated" text to be checked
*
* @return boolean Return true for translated text
*/
public static function isTranslatedText($langKey, $text)
{
return $text !== $langKey;
}
/**
* Create and return a new Option
*
* @param string $value The option value [optional]
* @param string $text The option text [optional]
*
* @return object The option as an object (stdClass instance)
*/
public static function createOption($value = '', $text = '')
{
if (empty($text))
{
$text = $value;
}
$option = (object) [];
$option->value = $value;
$option->text = $text;
return $option;
}
/**
* Create and return a new Option Group
*
* @param string $label Value and label for group [optional]
* @param array $options Array of options to insert into group [optional]
*
* @return array Return the new group as an array
*/
public static function createOptionGroup($label = '', $options = [])
{
$group = [];
$group['value'] = $label;
$group['text'] = $label;
$group['items'] = $options;
return $group;
}
}

View File

@ -0,0 +1,60 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JLog::add('ModulesHelperXML is deprecated. Do not use.', JLog::WARNING, 'deprecated');
/**
* Helper for parse XML module files
* @deprecated 3.2 Do not use.
*/
class ModulesHelperXML
{
/**
* Parse the module XML file
*
* @param array &$rows XML rows
*
* @return void
*
* @deprecated 3.2 Do not use.
*/
public function parseXMLModuleFile(&$rows)
{
foreach ($rows as $i => $row)
{
if ($row->module == '')
{
$rows[$i]->name = 'custom';
$rows[$i]->module = 'custom';
$rows[$i]->descrip = 'Custom created module, using Module Manager New function';
continue;
}
$data = JInstaller::parseXMLInstallFile($row->path . '/' . $row->file);
if ($data['type'] != 'module')
{
continue;
}
$rows[$i]->name = $data['name'];
$rows[$i]->descrip = $data['description'];
}
}
}

View File

@ -0,0 +1,83 @@
;; @package Advanced Module Manager
;; @version 7.7.1
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link http://www.regularlabs.com
;; @copyright Copyright © 2018 Regular Labs All Rights Reserved
;; @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
;;
;; @translate Want to help with translations? See: https://www.regularlabs.com/translate
COM_ADVANCEDMODULES="Regular Labs - Advanced Module Manager"
COM_ADVANCEDMODULES_DESC="Advanced Module Manager - take control over modules in Joomla!"
COM_ADVANCEDMODULES_CONFIGURATION="Advanced Module Manager"
ADVANCED_MODULE_MANAGER="Advanced Module Manager"
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_REGULAR_LABS_LIBRARY_OUTDATED="Regular Labs Library plugin is outdated. Try to re-install [[%1:extension name%]]."
JLIB_RULES_SETTING_NOTES="1. If you change the setting, it will apply to this component. Note that:<br><em>Inherited</em> means that the permissions from global configuration and parent group will be used.<br><em>Denied</em> means that no matter what the global configuration or parent group settings are, the group being edited cannot take this action on this component.<br><em>Allowed</em> means that the group being edited will be able to take this action for this component (but if this is in conflict with the global configuration or parent group it will have no impact; a conflict will be indicated by <em>Not Allowed (Locked)</em> under Calculated Settings).<br>2. If you select a new setting, click <em>Save</em> to refresh the calculated settings."
JLIB_RULES_SETTING_NOTES_ITEM="1. If you change the setting, it will apply to this module. Note that:<br><em>Inherited</em> means that the permissions from global configuration and parent group will be used.<br><em>Denied</em> means that no matter what the global configuration or parent group settings are, the group being edited cannot take this action on this module.<br><em>Allowed</em> means that the group being edited will be able to take this action for this module (but if this is in conflict with the global configuration or parent group it will have no impact; a conflict will be indicated by <em>Not Allowed (Locked)</em> under Calculated Settings).<br>2. If you select a new setting, click <em>Save</em> to refresh the calculated settings."
AMM_ADVANCED_MODULE_MANAGER="Advanced Module Manager"
AMM_ASSIGNMENTS="Assignments"
AMM_COLOR="Colour"
AMM_COLOR_DESC="Give the module a colour in the module list. (This does not affect the output of the module in any way.)"
AMM_COLORS="Colours"
AMM_COLORS_DESC="A comma separated list of RGB colours to show in the colour picker."
AMM_DEFAULT_MENU_ASSIGNMENT="Default menu assignment"
AMM_DEFAULT_MENU_ASSIGNMENT_DESC="Select whether to set the menu assignment of new modules to all or no menu items."
AMM_DEFAULT_SETTINGS="Default settings"
AMM_DEFAULT_STATE="Default publish state"
AMM_DEFAULT_STATE_DESC="Select whether to set new modules to published or unpublished by default."
AMM_DESCRIPTION_DESC="An optional short description to display in the module list view."
AMM_DISABLE_ASSIGNMENT="If you do not want to use this assignment type on this website, you can disable assignments completely in the Advanced Module Manager options.<br>Disabled assignments will not show up in any modules.<br><br>Do you want to open the options?"
AMM_EDIT_MODULE="Edit Module"
AMM_EXTRA_COLUMN="Extra Column"
AMM_EXTRA_FIELD_LABEL="Label"
AMM_EXTRA_FIELD_LABEL_DESC="Define the label of the extra field. Leave empty to hide.<br><br>To give the label a tooltip, enter the text after a bar sign, like:<br><span class=&quot;rl_code&quot;>My Label&#124;The description of this label</span>"
AMM_HIDE_IF_EMPTY="Hide if empty"
AMM_HIDE_IF_EMPTY_DESC="Hides the module if its output is empty (to prevent module blocks with title but no content)."
AMM_LIST_TITLE="Module List Title"
AMM_LIST_TITLE_DESC="Select whether to show the core or Advanced Module Manager title in the module list."
AMM_MIRROR_MODULE="Same as other module"
AMM_MIRROR_MODULE_DESC="Select this to use the assignment settings of another module.<br><br>If Opposite is selected, the module will show up on all pages where the selected module will not show up."
AMM_MIRRORING_MODULE="Same as [[%1:module ID%]]"
AMM_MIRRORING_MODULE_OPPOSITE="Opposite of [[%1:module ID%]]"
AMM_MODULE="Module"
AMM_MODULE_DESC="Select the module you want to follow. This module will use the Assignment settings of the selected module."
AMM_MODULE_EDIT="Module: %s"
AMM_MODULE_INCOMPATIBLE="This module is probably incompatible with Advanced Module Manager.<br>The developers of this module have chosen to use non-standard elements and layout in the display of this page, which can cause issues with the extra features of Advanced Module Manager.<br><br>If you experience issues: [[%1:start link%]]Use the Joomla core module manager[[%2:end link%]]"
AMM_NAME_COLUMN="Name Column"
AMM_NOTES="Notes"
AMM_NOTES_DESC="Enter optional notes."
AMM_OPPOSITE="Opposite"
AMM_OPTION_SELECT_MENU_ID="- Select Menu Item Assignment -"
AMM_POST_HTML="HTML after"
AMM_POST_HTML_DESC="The entered html will be appended to the content of the module."
AMM_PRE_HTML="HTML before"
AMM_PRE_HTML_DESC="The entered html will be prepended to the content of the module."
AMM_REPLACE_URLS_FRONTEND="Enable Edit on Frontend"
AMM_REPLACE_URLS_FRONTEND_DESC="Select to make Advanced Module Manager handle the module edit links in the frontend. You can disable this if your template (framework) causes conflicts with Advanced Module Manager."
AMM_SHOW_CATEGORY="Show Category"
AMM_SHOW_CATEGORY_DESC="Enable to show the category column in the module list."
AMM_SHOW_COLOR="Show Colour"
AMM_SHOW_COLOR_DESC="Enable to show the colour column in the module list."
AMM_SHOW_DESCRIPTION_IN_LIST="Show Description"
AMM_SHOW_DESCRIPTION_IN_LIST_DESC="Select where to show the optional short description in the module list view."
AMM_SHOW_EXTRA_FIELDS="Show Extra Fields"
AMM_SHOW_EXTRA_FIELDS_DESC="Enable to show the custom extra fields.<br><br>You can define the labels of these fields. If no label is given, the field will not be shown.<br><br>The saved values can be used in the module chromes via values extra1-5:<br><span class=&quot;rl_code&quot;>$params->get('extra1')</span>"
AMM_SHOW_HIDE_IF_EMPTY="Hide if empty"
AMM_SHOW_HIDE_IF_EMPTY_DESC="Enable to show the Hide if empty option"
AMM_SHOW_NOTES_TAB="Show Notes Tab"
AMM_SHOW_NOTES_TAB_DESC="Select to show an extra notes tab."
AMM_SHOW_PUBLISHING_OPTION="Show this publishing option in the module edit screen?"
AMM_SHOW_SWITCH="Show Switch"
AMM_SHOW_SWITCH_DESC="Select to show the link to switch to the Joomla core module manager (and back)."
AMM_SWITCH_TO_ADVANCED_MODULE_MANAGER="Switch to Advanced Module Manager"
AMM_SWITCH_TO_CORE="Switch to the Joomla core module manager"
AMM_USE_ADMIN_FROM_FRONTEND="Open Frontend Edit in Admin"
AMM_USE_ADMIN_FROM_FRONTEND_DESC="Select to make the frontend module edit links open in the admin side for administrators."
AMM_USE_CORE_RULES="Advanced Module Manager uses the core Module Manager permission rules."

View File

@ -0,0 +1,13 @@
;; @package Advanced Module Manager
;; @version 7.7.1
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link http://www.regularlabs.com
;; @copyright Copyright © 2018 Regular Labs All Rights Reserved
;; @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
;;
;; @translate Want to help with translations? See: https://www.regularlabs.com/translate
COM_ADVANCEDMODULES="Regular Labs - Advanced Module Manager"
COM_ADVANCEDMODULES_DESC="Advanced Module Manager - take control over modules in Joomla!"
ADVANCED_MODULE_MANAGER="Advanced Module Manager"

View File

@ -0,0 +1,85 @@
;; @package Advanced Module Manager
;; @version 7.7.1
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link http://www.regularlabs.com
;; @copyright Copyright © 2018 Regular Labs All Rights Reserved
;; @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
;;
;; @translate Want to help with translations? See: https://www.regularlabs.com/translate
;;
;; @translation Fordította: Csontos Balázs <csontos.balazs@joomlacms.hu> Joomla! Magyarország (joomlacms.hu)
COM_ADVANCEDMODULES="Regular Labs - Advanced Module Manager"
COM_ADVANCEDMODULES_DESC="Advanced Module Manager - kibővített beállítások Joomla! modulok számára"
COM_ADVANCEDMODULES_CONFIGURATION="Advanced Module Manager"
ADVANCED_MODULE_MANAGER="Advanced Module Manager"
AMM_EXTENSION_CAN_NOT_FUNCTION="[[%1:extension name%]] nem működik."
AMM_REGULAR_LABS_LIBRARY_NOT_ENABLED="A Regular Labs keretrendszer beépülő-modul nincs engedélyezve."
AMM_REGULAR_LABS_LIBRARY_NOT_INSTALLED="A Regular Labs keretrendszer beépülő-modul nincs telepítve."
; AMM_REGULAR_LABS_LIBRARY_OUTDATED="Regular Labs Library plugin is outdated. Try to re-install [[%1:extension name%]]."
; JLIB_RULES_SETTING_NOTES="1. If you change the setting, it will apply to this component. Note that:<br><em>Inherited</em> means that the permissions from global configuration and parent group will be used.<br><em>Denied</em> means that no matter what the global configuration or parent group settings are, the group being edited cannot take this action on this component.<br><em>Allowed</em> means that the group being edited will be able to take this action for this component (but if this is in conflict with the global configuration or parent group it will have no impact; a conflict will be indicated by <em>Not Allowed (Locked)</em> under Calculated Settings).<br>2. If you select a new setting, click <em>Save</em> to refresh the calculated settings."
; JLIB_RULES_SETTING_NOTES_ITEM="1. If you change the setting, it will apply to this module. Note that:<br><em>Inherited</em> means that the permissions from global configuration and parent group will be used.<br><em>Denied</em> means that no matter what the global configuration or parent group settings are, the group being edited cannot take this action on this module.<br><em>Allowed</em> means that the group being edited will be able to take this action for this module (but if this is in conflict with the global configuration or parent group it will have no impact; a conflict will be indicated by <em>Not Allowed (Locked)</em> under Calculated Settings).<br>2. If you select a new setting, click <em>Save</em> to refresh the calculated settings."
AMM_ADVANCED_MODULE_MANAGER="Advanced Module Manager"
; AMM_ASSIGNMENTS="Assignments"
AMM_COLOR="Szín"
AMM_COLOR_DESC="Adj a modulnak egy színt a modulok listája nézethez. (Ez nincs semmiféle hatással a modul megjelenésére.)"
; AMM_COLORS="Colours"
; AMM_COLORS_DESC="A comma separated list of RGB colours to show in the colour picker."
; AMM_DEFAULT_MENU_ASSIGNMENT="Default menu assignment"
; AMM_DEFAULT_MENU_ASSIGNMENT_DESC="Select whether to set the menu assignment of new modules to all or no menu items."
AMM_DEFAULT_SETTINGS="Alapértelmezett beállítások"
; AMM_DEFAULT_STATE="Default publish state"
; AMM_DEFAULT_STATE_DESC="Select whether to set new modules to published or unpublished by default."
; AMM_DESCRIPTION_DESC="An optional short description to display in the module list view."
; AMM_DISABLE_ASSIGNMENT="If you do not want to use this assignment type on this website, you can disable assignments completely in the Advanced Module Manager options.<br>Disabled assignments will not show up in any modules.<br><br>Do you want to open the options?"
AMM_EDIT_MODULE="Modul szerkesztése"
AMM_EXTRA_COLUMN="Extra oszlop"
AMM_EXTRA_FIELD_LABEL="Címke"
AMM_EXTRA_FIELD_LABEL_DESC="Add meg az extra mező címkéjét. Elrejtéshez hagyd üresen.<br><br>Az eszköztipp címkéjének megadásához a szöveget írd egy függőlegesvonal után, így:<br><span class=&quot;rl_code&quot;>Saját címke&#124;Ennek a címkének a leírása</span>"
AMM_HIDE_IF_EMPTY="Elrejtés ha üres"
AMM_HIDE_IF_EMPTY_DESC="Modul elrejtése, ha annak kimenete üres (címmel rendelkező, de tartalom nélküli blokkok megjelenítésének megelőzéséhez)."
; AMM_LIST_TITLE="Module List Title"
; AMM_LIST_TITLE_DESC="Select whether to show the core or Advanced Module Manager title in the module list."
; AMM_MIRROR_MODULE="Same as other module"
; AMM_MIRROR_MODULE_DESC="Select this to use the assignment settings of another module.<br><br>If Opposite is selected, the module will show up on all pages where the selected module will not show up."
; AMM_MIRRORING_MODULE="Same as [[%1:module ID%]]"
; AMM_MIRRORING_MODULE_OPPOSITE="Opposite of [[%1:module ID%]]"
AMM_MODULE="Modul"
; AMM_MODULE_DESC="Select the module you want to follow. This module will use the Assignment settings of the selected module."
AMM_MODULE_EDIT="Modul: %s"
; AMM_MODULE_INCOMPATIBLE="This module is probably incompatible with Advanced Module Manager.<br>The developers of this module have chosen to use non-standard elements and layout in the display of this page, which can cause issues with the extra features of Advanced Module Manager.<br><br>If you experience issues: [[%1:start link%]]Use the Joomla core module manager[[%2:end link%]]"
AMM_NAME_COLUMN="Oszlop neve"
AMM_NOTES="Megjegyzések"
; AMM_NOTES_DESC="Enter optional notes."
; AMM_OPPOSITE="Opposite"
; AMM_OPTION_SELECT_MENU_ID="- Select Menu Item Assignment -"
; AMM_POST_HTML="HTML after"
; AMM_POST_HTML_DESC="The entered html will be appended to the content of the module."
; AMM_PRE_HTML="HTML before"
; AMM_PRE_HTML_DESC="The entered html will be prepended to the content of the module."
; AMM_REPLACE_URLS_FRONTEND="Enable Edit on Frontend"
; AMM_REPLACE_URLS_FRONTEND_DESC="Select to make Advanced Module Manager handle the module edit links in the frontend. You can disable this if your template (framework) causes conflicts with Advanced Module Manager."
AMM_SHOW_CATEGORY="Kategória megjelenítése"
; AMM_SHOW_CATEGORY_DESC="Enable to show the category column in the module list."
AMM_SHOW_COLOR="Színek megjelenítése"
AMM_SHOW_COLOR_DESC="Szín oszlop megjelenítése a modulok listájánál"
; AMM_SHOW_DESCRIPTION_IN_LIST="Show Description"
; AMM_SHOW_DESCRIPTION_IN_LIST_DESC="Select where to show the optional short description in the module list view."
AMM_SHOW_EXTRA_FIELDS="Extra mezők megjelenítése"
; AMM_SHOW_EXTRA_FIELDS_DESC="Enable to show the custom extra fields.<br><br>You can define the labels of these fields. If no label is given, the field will not be shown.<br><br>The saved values can be used in the module chromes via values extra1-5:<br><span class=&quot;rl_code&quot;>$params->get('extra1')</span>"
AMM_SHOW_HIDE_IF_EMPTY="Elrejtés ha üres"
; AMM_SHOW_HIDE_IF_EMPTY_DESC="Enable to show the Hide if empty option"
; AMM_SHOW_NOTES_TAB="Show Notes Tab"
; AMM_SHOW_NOTES_TAB_DESC="Select to show an extra notes tab."
; AMM_SHOW_PUBLISHING_OPTION="Show this publishing option in the module edit screen?"
AMM_SHOW_SWITCH="Kapcsoló megjelenítése"
; AMM_SHOW_SWITCH_DESC="Select to show the link to switch to the Joomla core module manager (and back)."
AMM_SWITCH_TO_ADVANCED_MODULE_MANAGER="Váltás az Advanced Module Manager-re"
; AMM_SWITCH_TO_CORE="Switch to the Joomla core module manager"
; AMM_USE_ADMIN_FROM_FRONTEND="Open Frontend Edit in Admin"
; AMM_USE_ADMIN_FROM_FRONTEND_DESC="Select to make the frontend module edit links open in the admin side for administrators."
; AMM_USE_CORE_RULES="Advanced Module Manager uses the core Module Manager permission rules."

View File

@ -0,0 +1,15 @@
;; @package Advanced Module Manager
;; @version 7.7.1
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link http://www.regularlabs.com
;; @copyright Copyright © 2018 Regular Labs All Rights Reserved
;; @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
;;
;; @translate Want to help with translations? See: https://www.regularlabs.com/translate
;;
;; @translation Fordította: Csontos Balázs <csontos.balazs@joomlacms.hu> Joomla! Magyarország (joomlacms.hu)
COM_ADVANCEDMODULES="Regular Labs - Advanced Module Manager"
COM_ADVANCEDMODULES_DESC="Advanced Module Manager - kibővített beállítások Joomla! modulok számára"
ADVANCED_MODULE_MANAGER="Advanced Module Manager"

View File

@ -0,0 +1,65 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// JLayout for standard handling of the edit modules:
$moduleHtml =& $displayData['moduleHtml'];
$mod = $displayData['module'];
$position = $displayData['position'];
$menusEditing = $displayData['menusediting'];
if (preg_match('/<(?:div|span|nav|ul|ol|h\d) [^>]*class="[^"]* jmoddiv"/', $moduleHtml))
{
// Module has already module edit button:
return;
}
// Add css class jmoddiv and data attributes for module-editing URL and for the tooltip:
$editUrl = JUri::base() . 'administrator/index.php?option=com_advancedmodules&view=module&layout=edit&id=' . (int) $mod->id;
$title = preg_replace('#\{.*?\}#', '', $mod->title);
$position = sprintf(JText::_('JLIB_HTML_EDIT_MODULE_IN_POSITION'), $position);
$tooltip = JHtml::tooltipText(
JText::_('JLIB_HTML_EDIT_MODULE'),
htmlspecialchars($title) . '<br>' . htmlspecialchars($position),
0
);
// By itself, adding class jmoddiv and data attributes for the url and tooltip:
$replace = '\\1 jmoddiv" data-jmodediturl="' . $editUrl . '" data-jmodtip="' . $tooltip . '"';
// And if menu editing is enabled and allowed and it's a menu module, add data attributes for menu editing:
if ($menusEditing && $mod->module == 'mod_menu')
{
$replace .= ' data-jmenuedittip="' . JHtml::tooltipText('JLIB_HTML_EDIT_MENU_ITEM', 'JLIB_HTML_EDIT_MENU_ITEM_ID') . '"';
}
// Add class, editing URL and tooltip, and if module of type menu, also the tooltip for editing the menu item:
$count = 0;
$moduleHtml = preg_replace(
// Replace first tag of module with a class
'/^(\s*<(?:div|span|nav|ul|ol|h\d) [^>]*class="[^"]*)"/',
$replace,
$moduleHtml,
1,
$count
);
if ($count)
{
// Load once booststrap tooltip and add stylesheet and javascript to head:
JHtml::_('bootstrap.tooltip');
JHtml::_('bootstrap.popover');
JHtml::_('stylesheet', 'system/frontediting.css', [], true);
JHtml::_('script', 'system/frontediting.js', false, true);
}

View File

@ -0,0 +1,133 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
$app = JFactory::getApplication();
$form = $displayData->getForm();
$fieldSets = $form->getFieldsets();
if (empty($fieldSets))
{
return;
}
$ignoreFieldsets = $displayData->get('ignore_fieldsets') ?: array();
$ignoreFields = $displayData->get('ignore_fields') ?: array();
$extraFields = $displayData->get('extra_fields') ?: array();
$tabName = $displayData->get('tab_name') ?: 'myTab';
if (!empty($displayData->hiddenFieldsets))
{
// These are required to preserve data on save when fields are not displayed.
$hiddenFieldsets = $displayData->hiddenFieldsets ?: array();
}
if (!empty($displayData->configFieldsets))
{
// These are required to configure showing and hiding fields in the editor.
$configFieldsets = $displayData->configFieldsets ?: array();
}
// Handle the hidden fieldsets when show_options is set false
if (!$displayData->get('show_options', 1))
{
// The HTML buffer
$html = array();
// Hide the whole buffer
$html[] = '<div style="display:none;">';
// Loop over the fieldsets
foreach ($fieldSets as $name => $fieldSet)
{
// Check if the fieldset should be ignored
if (in_array($name, $ignoreFieldsets, true))
{
continue;
}
// If it is a hidden fieldset, render the inputs
if (in_array($name, $hiddenFieldsets))
{
// Loop over the fields
foreach ($form->getFieldset($name) as $field)
{
// Add only the input on the buffer
$html[] = $field->input;
}
// Make sure the fieldset is not rendered twice
$ignoreFieldsets[] = $name;
}
// Check if it is the correct fieldset to ignore
if (strpos($name, 'basic') === 0)
{
// Ignore only the fieldsets which are defined by the options not the custom fields ones
$ignoreFieldsets[] = $name;
}
}
// Close the container
$html[] = '</div>';
// Echo the hidden fieldsets
echo implode('', $html);
}
// Loop again over the fieldsets
foreach ($fieldSets as $name => $fieldSet)
{
// Ensure any fieldsets we don't want to show are skipped (including repeating formfield fieldsets)
if ((isset($fieldSet->repeat) && $fieldSet->repeat === true)
|| in_array($name, $ignoreFieldsets)
|| (!empty($configFieldsets) && in_array($name, $configFieldsets, true))
|| (!empty($hiddenFieldsets) && in_array($name, $hiddenFieldsets, true))
)
{
continue;
}
// Determine the label
if (!empty($fieldSet->label))
{
$label = JText::_($fieldSet->label);
}
else
{
$label = strtoupper('JGLOBAL_FIELDSET_' . $name);
if (JText::_($label) === $label)
{
$label = strtoupper('COM_MODULES_' . $name . '_FIELDSET_LABEL');
}
$label = JText::_($label);
}
// Start the tab
echo JHtml::_('bootstrap.addTab', $tabName, 'attrib-' . $name, $label);
// Include the description when available
if (isset($fieldSet->description) && trim($fieldSet->description))
{
echo '<p class="alert alert-info">' . $this->escape(JText::_($fieldSet->description)) . '</p>';
}
// The name of the fieldset to render
$displayData->fieldset = $name;
// Force to show the options
$displayData->showOptions = true;
// Render the fieldset
echo JLayoutHelper::render('joomla.edit.fieldset', $displayData);
// End the tab
echo JHtml::_('bootstrap.endTab');
}

View File

@ -0,0 +1,50 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
use RegularLabs\Library\Document as RL_Document;
$data = $displayData;
// Receive overridable options
$data['options'] = ! empty($data['options']) ? $data['options'] : [];
if ($data['view'] instanceof AdvancedModulesViewModules && JFactory::getApplication()->input->get('layout', '', 'cmd') !== 'modal')
{
RL_Document::styleDeclaration("
/* Fixed filter field in search bar */
.js-stools .js-stools-client_id {
float: left;
margin-right: 10px;
min-width: 220px;
}
html[dir=rtl] .js-stools .js-stools-client_id {
float: right;
margin-left: 10px
margin-right: 0;
}
.js-stools .js-stools-container-bar .js-stools-field-filter .chzn-container {
padding: 3px 0;
}
");
// Client selector doesn't have to activate the filter bar.
unset($data['view']->activeFilters['client_id']);
}
// Display the main joomla layout.
include JPATH_SITE . '/layouts/joomla/searchtools/default.php';

View File

@ -0,0 +1,33 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
$data = $displayData;
if ($data['view'] instanceof AdvancedModulesViewModules && JFactory::getApplication()->input->get('layout', '', 'cmd') !== 'modal')
{
// Add the client selector before the form filters.
$clientIdField = $data['view']->filterForm->getField('client_id');
?>
<div class="js-stools-field-filter js-stools-client_id">
<?php echo $clientIdField->input; ?>
</div>
<?php
}
// Display the main joomla layout.
echo JLayoutHelper::render('joomla.searchtools.default.bar', $data, null, ['component' => 'none']);

View File

@ -0,0 +1,21 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
$data = $displayData;
$metatitle = JHtml::tooltipText(JText::_($data->tip ? $data->tip : $data->title), JText::_('JGLOBAL_CLICK_TO_SORT_THIS_COLUMN'), 0);
JHtml::_('bootstrap.tooltip');
?>
<a href="#" onclick="return false;" class="js-stools-column-order hasTooltip" data-order="<?php echo $data->order; ?>" data-direction="<?php echo strtoupper($data->direction); ?>" data-name="<?php echo htmlspecialchars(JText::_($data->title)); ?>" title="<?php echo $metatitle; ?>">
<?php if ( ! empty($data->icon)) : ?><span class="<?php echo $data->icon; ?>"></span><?php endif; ?>
<?php if ( ! empty($data->title)) : ?><?php echo JText::_($data->title); ?><?php endif; ?>
<?php if ($data->order == $data->selected) : ?><span class="<?php echo $data->orderIcon; ?>"></span><?php endif; ?>
</a>

View File

@ -0,0 +1,23 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$text = JText::_('JTOOLBAR_CANCEL');
?>
<button onclick="location.href='index.php?option=com_advancedmodules'" class="btn btn-default" title="<?php echo $text; ?>">
<span class="icon-remove"></span> <?php echo $text; ?>
</button>

View File

@ -0,0 +1,24 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$text = JText::_('JTOOLBAR_NEW');
?>
<button onclick="location.href='index.php?option=com_advancedmodules&amp;view=select'" class="btn btn-small btn-success" title="<?php echo $text; ?>">
<span class="icon-plus icon-white"></span>
<?php echo $text; ?>
</button>

View File

@ -0,0 +1,34 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
JFormHelper::loadFieldClass('list');
require_once __DIR__ . '/../../helpers/modules.php';
class JFormFieldModulesMenuId extends JFormFieldList
{
protected $type = 'ModulesMenuId';
public function getOptions()
{
$clientId = JFactory::getApplication()->input->get('client_id', 0, 'int');
$options = ModulesHelper::getMenuItemAssignmentOptions($clientId);
return array_merge(parent::getOptions(), $options);
}
}

View File

@ -0,0 +1,48 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
JFormHelper::loadFieldClass('list');
require_once __DIR__ . '/../../helpers/modules.php';
/**
* ModulesPosition Field class for the Joomla Framework.
*/
class JFormFieldModulesModule extends JFormFieldList
{
/**
* The form field type.
*
* @var string
* @since 3.4.2
*/
protected $type = 'ModulesModule';
/**
* Method to get the field options.
*
* @return array The field option objects.
*/
public function getOptions()
{
$clientId = JFactory::getApplication()->input->get('client_id', 0, 'int');
$options = ModulesHelper::getModules($clientId);
return array_merge(parent::getOptions(), $options);
}
}

View File

@ -0,0 +1,48 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
JFormHelper::loadFieldClass('list');
require_once __DIR__ . '/../../helpers/modules.php';
/**
* ModulesPosition Field class for the Joomla Framework.
*/
class JFormFieldModulesPosition extends JFormFieldList
{
/**
* The form field type.
*
* @var string
* @since 3.4.2
*/
protected $type = 'ModulesPosition';
/**
* Method to get the field options.
*
* @return array The field option objects.
*/
public function getOptions()
{
$clientId = JFactory::getApplication()->input->get('client_id', 0, 'int');
$options = ModulesHelper::getPositions($clientId);
return array_merge(parent::getOptions(), $options);
}
}

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="params">
<fieldset
name="advanced">
<field
name="module_tag"
type="moduletag"
label="COM_MODULES_FIELD_MODULE_TAG_LABEL"
description="COM_MODULES_FIELD_MODULE_TAG_DESC"
default="div"
/>
<field
name="bootstrap_size"
type="integer"
first="0"
last="12"
step="1"
label="COM_MODULES_FIELD_BOOTSTRAP_SIZE_LABEL"
description="COM_MODULES_FIELD_BOOTSTRAP_SIZE_DESC"
/>
<field
name="header_tag"
type="headertag"
default="h3"
label="COM_MODULES_FIELD_HEADER_TAG_LABEL"
description="COM_MODULES_FIELD_HEADER_TAG_DESC"
/>
<field
name="header_class"
type="text"
label="COM_MODULES_FIELD_HEADER_CLASS_LABEL"
description="COM_MODULES_FIELD_HEADER_CLASS_DESC"
/>
<field
name="style"
type="chromestyle"
label="COM_MODULES_FIELD_MODULE_STYLE_LABEL"
description="COM_MODULES_FIELD_MODULE_STYLE_DESC"
/>
</fieldset>
</fields>
</form>

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_advancedmodules/models/fields" />
<field
name="client_id"
type="list"
label=""
onchange="jQuery('#filter_position, #filter_module, #filter_menuid, #filter_language').val('');this.form.submit();"
>
<option value="0">JSITE</option>
<option value="1">JADMINISTRATOR</option>
</field>
<fields name="filter" addfieldpath="/libraries/regularlabs/fields">
<field
name="search"
type="text"
label="JSEARCH_FILTER_LABEL"
description="COM_MODULES_MODULES_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
/>
<field
name="state"
type="status"
label="JSTATUS"
filter="*,-2,0,1"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
<field
name="position"
type="modulesposition"
label="COM_MODULES_FIELD_POSITION_LABEL"
onchange="this.form.submit();"
>
<option value="">COM_MODULES_OPTION_SELECT_POSITION</option>
</field>
<field
name="category"
type="rl_simplecategories"
table="advancedmodules"
show_none="0"
show_new="0"
label="JCATEGORY"
onchange="this.form.submit();"
>
<option value="">RL_SELECT_A_CATEGORY</option>
</field>
<field
name="module"
type="ModulesModule"
label="COM_MODULES_OPTION_SELECT_MODULE"
onchange="this.form.submit();"
>
<option value="">COM_MODULES_OPTION_SELECT_MODULE</option>
</field>
<field
name="menuid"
type="ModulesMenuId"
label="AMM_OPTION_SELECT_MENU_ID"
onchange="this.form.submit();"
>
<option value="">AMM_OPTION_SELECT_MENU_ID</option>
</field>
<field
name="access"
type="accesslevel"
label="JOPTION_FILTER_ACCESS"
description="JOPTION_FILTER_ACCESS_DESC"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_ACCESS</option>
</field>
<field
name="language"
type="contentlanguage"
label="JOPTION_FILTER_LANGUAGE"
description="JOPTION_FILTER_LANGUAGE_DESC"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="JGLOBAL_SORT_BY"
description="JGLOBAL_SORT_BY"
statuses="*,0,1,-2"
onchange="this.form.submit();"
default="position ASC"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="ordering ASC">RL_HEADING_ORDERING_ASC</option>
<option value="ordering DESC">RL_HEADING_ORDERING_DESC</option>
<option value="a.published ASC">RL_HEADING_STATUS_ASC</option>
<option value="a.published DESC">RL_HEADING_STATUS_DESC</option>
<option value="color ASC">RL_HEADING_COLOR_ASC</option>
<option value="color DESC">RL_HEADING_COLOR_DESC</option>
<option value="aa.category ASC">RL_HEADING_CATEGORY_ASC</option>
<option value="aa.category DESC">RL_HEADING_CATEGORY_DESC</option>
<option value="a.title ASC">RL_HEADING_TITLE_ASC</option>
<option value="a.title DESC">RL_HEADING_TITLE_DESC</option>
<option value="position ASC">RL_HEADING_POSITION_ASC</option>
<option value="position DESC">RL_HEADING_POSITION_DESC</option>
<option value="name ASC">RL_HEADING_TYPE_ASC</option>
<option value="name DESC">RL_HEADING_TYPE_DESC</option>
<option value="menuid ASC">RL_HEADING_PAGES_ASC</option>
<option value="menuid DESC">RL_HEADING_PAGES_DESC</option>
<option value="a.access ASC">RL_HEADING_ACCESS_ASC</option>
<option value="a.access DESC">RL_HEADING_ACCESS_DESC</option>
<option value="a.language ASC">RL_HEADING_LANGUAGE_ASC</option>
<option value="a.language DESC">RL_HEADING_LANGUAGE_DESC</option>
<option value="a.id ASC">RL_HEADING_ID_ASC</option>
<option value="a.id DESC">RL_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="COM_MODULES_LIST_LIMIT"
description="JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>

View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset>
<field name="id" type="number"
label="JGLOBAL_FIELD_ID_LABEL"
description="JGLOBAL_FIELD_ID_DESC"
default="0"
readonly="true"
/>
<field name="title" type="text"
label="JGLOBAL_TITLE"
description="COM_MODULES_FIELD_TITLE_DESC"
class="input-xxlarge input-large-text"
size="40"
maxlength="100"
required="true"
/>
<field name="note" type="text"
label="JGLOBAL_DESCRIPTION"
description="AMM_DESCRIPTION_DESC"
maxlength="255"
size="40"
class="input-full"
/>
<field name="module" type="hidden"
label="COM_MODULES_FIELD_MODULE_LABEL"
description="COM_MODULES_FIELD_MODULE_DESC"
readonly="readonly"
size="20"
/>
<field name="showtitle" type="radio"
class="btn-group btn-group-yesno"
default="1"
label="COM_MODULES_FIELD_SHOWTITLE_LABEL"
description="COM_MODULES_FIELD_SHOWTITLE_DESC"
size="1"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field name="published" type="list"
class="chzn-color-state"
default="1"
label="JSTATUS"
description="COM_MODULES_FIELD_PUBLISHED_DESC"
size="1"
>
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
<option value="-2">JTRASHED</option>
</field>
<field name="publish_up" type="calendar"
label="COM_MODULES_FIELD_PUBLISH_UP_LABEL"
description="COM_MODULES_FIELD_PUBLISH_UP_DESC"
filter="user_utc"
translateformat="true"
showtime="true"
size="22"
/>
<field name="publish_down" type="calendar"
label="COM_MODULES_FIELD_PUBLISH_DOWN_LABEL"
description="COM_MODULES_FIELD_PUBLISH_DOWN_DESC"
filter="user_utc"
translateformat="true"
showtime="true"
size="22"
/>
<field name="client_id" type="hidden"
label="COM_MODULES_FIELD_CLIENT_ID_LABEL"
description="COM_MODULES_FIELD_CLIENT_ID_DESC"
readonly="true"
size="1"
/>
<field name="position" type="moduleposition"
label="COM_MODULES_FIELD_POSITION_LABEL"
description="COM_MODULES_FIELD_POSITION_DESC"
default=""
maxlength="50"
/>
<field name="access" type="accesslevel"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
size="1"
/>
<field name="ordering" type="moduleorder"
label="JFIELD_ORDERING_LABEL"
description="JFIELD_ORDERING_DESC"
linked="position"
/>
<field name="content" type="editor"
label="COM_MODULES_FIELD_CONTENT_LABEL"
description="COM_MODULES_FIELD_CONTENT_DESC"
buttons="true"
filter="AdvancedModulesModelModule::filterText"
hide="readmore,pagebreak,module"
/>
<field name="language" type="contentlanguage"
label="JFIELD_LANGUAGE_LABEL"
description="JFIELD_MODULE_LANGUAGE_DESC"
>
<option value="*">JALL</option>
</field>
<field name="assignment" type="hidden" />
<field name="assigned" type="hidden" />
<field name="asset_id" type="hidden"
filter="unset"
/>
<field name="rules" type="rules"
label="JFIELD_RULES_LABEL"
translate_label="false"
filter="rules"
component="com_modules"
section="module"
validate="rules"
/>
</fieldset>
</form>

View File

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset>
<field name="id" type="number"
label="JGLOBAL_FIELD_ID_LABEL"
description="JGLOBAL_FIELD_ID_DESC"
default="0"
readonly="true"
/>
<field name="title" type="text"
label="JGLOBAL_TITLE"
description="COM_MODULES_FIELD_TITLE_DESC"
class="input-xxlarge input-large-text"
size="40"
maxlength="100"
required="true"
/>
<field name="note" type="text"
label="JGLOBAL_DESCRIPTION"
description="AMM_DESCRIPTION_DESC"
maxlength="255"
size="40"
class="input-full"
/>
<field name="module" type="hidden"
label="COM_MODULES_FIELD_MODULE_LABEL"
description="COM_MODULES_FIELD_MODULE_DESC"
readonly="readonly"
size="20"
/>
<field name="showtitle" type="radio"
label="COM_MODULES_FIELD_SHOWTITLE_LABEL"
description="COM_MODULES_FIELD_SHOWTITLE_DESC"
class="btn-group btn-group-yesno"
default="1"
size="1"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field name="published" type="list"
class="chzn-color-state"
default="1"
label="JSTATUS"
description="COM_MODULES_FIELD_PUBLISHED_DESC"
size="1"
>
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
<option value="-2">JTRASHED</option>
</field>
<field name="publish_up" type="calendar"
label="COM_MODULES_FIELD_PUBLISH_UP_LABEL"
description="COM_MODULES_FIELD_PUBLISH_UP_DESC"
filter="user_utc"
translateformat="true"
showtime="true"
size="22"
/>
<field name="publish_down" type="calendar"
label="COM_MODULES_FIELD_PUBLISH_DOWN_LABEL"
description="COM_MODULES_FIELD_PUBLISH_DOWN_DESC"
filter="user_utc"
translateformat="true"
showtime="true"
size="22"
/>
<field name="client_id" type="hidden"
label="COM_MODULES_FIELD_CLIENT_ID_LABEL"
description="COM_MODULES_FIELD_CLIENT_ID_DESC"
readonly="true"
size="1"
/>
<field name="position" type="moduleposition"
label="COM_MODULES_FIELD_POSITION_LABEL"
description="COM_MODULES_FIELD_POSITION_DESC"
default=""
maxlength="50"
/>
<field name="access" type="accesslevel"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
size="1"
/>
<field name="ordering" type="moduleorder"
label="JFIELD_ORDERING_LABEL"
description="JFIELD_ORDERING_DESC"
linked="position"
/>
<field name="content" type="editor"
label="COM_MODULES_FIELD_CONTENT_LABEL"
description="COM_MODULES_FIELD_CONTENT_DESC"
buttons="true"
filter="AdvancedModulesModelModule::filterText"
hide="readmore,pagebreak,module"
/>
<field name="language" type="language"
label="JFIELD_LANGUAGE_LABEL"
description="JFIELD_MODULE_LANGUAGE_DESC"
default="*"
client="administrator"
>
<option value="*">JALL</option>
</field>
<field name="assignment" type="hidden" />
<field name="assigned" type="hidden" />
<field name="asset_id" type="hidden"
filter="unset"
/>
<field name="rules" type="rules"
label="JFIELD_RULES_LABEL"
translate_label="false"
filter="rules"
component="com_modules"
section="module"
validate="rules"
/>
</fieldset>
</form>

View File

@ -0,0 +1,646 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use RegularLabs\Library\Parameters as RL_Parameters;
/**
* Modules Component Module Model
*/
class AdvancedModulesModelModules extends JModelList
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
*
* @see JController
* @since 1.6
*/
public function __construct($config = [])
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = [
'id', 'a.id',
'color', 'a.color',
'category', 'aa.category',
'title', 'a.title',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'published', 'a.published', 'state',
'access', 'a.access',
'ag.title', 'access_level',
'ordering', 'a.ordering',
'module', 'a.module',
'a.language',
'l.title', 'language_title',
'publish_up', 'a.publish_up',
'publish_down', 'a.publish_down',
'client_id', 'a.client_id',
'position', 'a.position',
'menuitem',
'menuid',
'name', 'e.name',
];
}
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication('administrator');
// Load the filter state.
$search = trim($this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'));
$this->setState('filter.search', $search);
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access');
$this->setState('filter.access', $access);
$state = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string');
$this->setState('filter.state', $state);
$position = $this->getUserStateFromRequest($this->context . '.filter.position', 'filter_position', '', 'string');
$this->setState('filter.position', $position);
$module = $this->getUserStateFromRequest($this->context . '.filter.module', 'filter_module', '', 'string');
$this->setState('filter.module', $module);
$category = $this->getUserStateFromRequest($this->context . '.filter.category', 'filter_category', '', 'string');
$this->setState('filter.category', $category);
// Special handling for filter client_id.
// Try to get current Client selection from $_POST.
$clientId = $app->input->getString('client_id', null);
// Client Site(0) or Administrator(1) selected?
if (in_array($clientId, ['0', '1']))
{
// Not the same client like saved previous one?
if ($clientId != $app->getUserState($this->context . '.client_id'))
{
// Save current selection as new previous value in session.
$app->setUserState($this->context . '.client_id', $clientId);
// Reset pagination.
$app->input->set('limitstart', 0);
}
}
// No Client selected?
else
{
// Try to get previous one from session.
$clientId = (string) $app->getUserState($this->context . '.client_id');
// Client not Site(0) and not Administrator(1)? So, set to Site(0).
if ( ! in_array($clientId, ['0', '1']))
{
$clientId = '0';
}
}
// Modal view should return only front end modules
if (JFactory::getApplication()->input->get('layout') == 'modal')
{
$clientId = 0;
}
$this->setState('filter.client_id', $clientId);
$language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
// Load the parameters.
$params = JComponentHelper::getParams('com_advancedmodules');
$this->setState('params', $params);
// List state information.
$this->getConfig();
list($default_ordering, $default_direction) = explode(' ', $this->config->default_ordering, 2);
$this->setState('list.fullordering', $this->config->default_ordering);
parent::populateState($default_ordering, $default_direction);
}
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
*/
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState($this->context, new stdClass);
// Pre-fill the list options
if ( ! property_exists($data, 'list'))
{
$this->getConfig();
list($default_ordering, $default_direction) = explode(' ', $this->config->default_ordering, 2);
$data->list = [
'direction' => $default_direction,
'limit' => $this->state->{'list.limit'},
'ordering' => $default_ordering,
'fullordering' => $this->config->default_ordering,
'start' => $this->state->{'list.start'},
];
}
return $data;
}
/**
* Method to get a store id based on model configuration state.
*
* This is necessary because the model is used by the component and
* different modules that might need different sets of data or different
* ordering requirements.
*
* @param string $id A prefix for the store id.
*
* @return string A store id.
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . trim($this->getState('filter.search'));
$id .= ':' . $this->getState('filter.access');
$id .= ':' . $this->getState('filter.state');
$id .= ':' . $this->getState('filter.position');
$id .= ':' . $this->getState('filter.module');
$id .= ':' . $this->getState('filter.category');
$id .= ':' . $this->getState('filter.menuid');
$id .= ':' . $this->getState('filter.client_id');
$id .= ':' . $this->getState('filter.language');
return parent::getStoreId($id);
}
/**
* Returns an object list
*
* @param string $query The query
* @param int $limitstart Offset
* @param int $limit The number of records
*
* @return array
*/
protected function _getList($query, $limitstart = 0, $limit = 0)
{
$ordering = strtolower($this->getState('list.ordering', 'ordering'));
$orderDirn = strtoupper($this->getState('list.direction', 'ASC'));
if (in_array($ordering, ['menuid', 'name']))
{
$this->_db->setQuery($query);
$result = $this->_db->loadObjectList();
$this->translate($result);
JArrayHelper::sortObjects($result, $ordering, $orderDirn == 'DESC' ? -1 : 1, true, true);
$total = count($result);
$this->cache[$this->getStoreId('getTotal')] = $total;
if ($total < $limitstart)
{
$limitstart = 0;
$this->setState('list.start', 0);
}
return array_slice($result, $limitstart, $limit ? $limit : null);
}
if ($ordering != 'color')
{
if ($ordering == 'ordering')
{
$query->order('a.position ASC');
$ordering = 'a.ordering';
}
if ($ordering == 'language_title')
{
$ordering = 'l.manifest_cache';
}
$query->order($this->_db->quoteName($ordering) . ' ' . $orderDirn);
if ($ordering == 'position')
{
$query->order('a.ordering ASC');
}
$result = parent::_getList($query, $limitstart, $limit);
$this->translate($result);
return $result;
}
$this->_db->setQuery($query);
$result = $this->_db->loadObjectList();
$this->translate($result);
$newresult = [];
foreach ($result as $i => $row)
{
$params = json_decode($row->advancedparams);
if (is_null($params))
{
$params = (object) [];
}
$color = isset($params->color) ? str_replace('#', '', $params->color) : 'none';
$color = empty($color) ? 'none' : $color;
$newresult['_' . $color . '_' . (($i + 1) / 10000)] = $row;
}
if ($orderDirn == 'DESC')
{
krsort($newresult);
}
else
{
ksort($newresult);
}
$newresult = array_values($newresult);
$total = count($newresult);
$this->cache[$this->getStoreId('getTotal')] = $total;
if ($total < $limitstart)
{
$limitstart = 0;
$this->setState('list.start', 0);
}
return array_slice($newresult, $limitstart, $limit ? $limit : null);
}
/**
* Translate a list of objects
*
* @param array &$items The array of objects
*
* @return array The array of translated objects
*/
protected function translate(&$items)
{
$lang = JFactory::getLanguage();
$client = $this->getState('filter.client_id') ? 'administrator' : 'site';
foreach ($items as $item)
{
$extension = $item->module;
$source = constant('JPATH_' . strtoupper($client)) . "/modules/$extension";
$lang->load("$extension.sys", constant('JPATH_' . strtoupper($client)), null, false, true)
|| $lang->load("$extension.sys", $source, null, false, true);
$item->name = JText::_($item->name);
if ($item->mirror_id > 0)
{
$item->menuid = JText::sprintf(
'AMM_MIRRORING_MODULE',
'[<a href="' . JRoute::_('index.php?option=com_advancedmodules&task=module.edit&id=' . (int) $item->mirror_id) . '">'
. $item->mirror_id . '</a>]'
);
continue;
}
if ($item->mirror_id < 0)
{
$item->menuid = JText::sprintf(
'AMM_MIRRORING_MODULE_OPPOSITE',
'[<a href="' . JRoute::_('index.php?option=com_advancedmodules&task=module.edit&id=' . (int) ($item->mirror_id * -1)) . '">'
. ($item->mirror_id * -1) . '</a>]'
);
continue;
}
if (is_null($item->menuid))
{
$item->menuid = JText::_('JNONE');
continue;
}
if ($item->menuid < 0)
{
$item->menuid = JText::_('COM_MODULES_ASSIGNED_VARIES_EXCEPT');
continue;
}
if ($item->menuid > 0)
{
$item->menuid = JText::_('COM_MODULES_ASSIGNED_VARIES_ONLY');
continue;
}
$item->menuid = JText::_('JALL');
}
}
/**
* Build an SQL query to load the list data.
*
* @return JDatabaseQuery
*/
protected function getListQuery()
{
$db = $this->getDbo();
$query = $db->getQuery(true)
// Select the required fields from the table.
->select('a.id')
->from($db->quoteName('#__modules', 'a'))
// Join over the module menus
->join('LEFT', $db->quoteName('#__modules_menu', 'mm') . ' ON ' . $db->quoteName('mm.moduleid') . ' = ' . $db->quoteName('a.id'))
// Join over the extensions
->join('LEFT', $db->quoteName('#__extensions', 'e') . ' ON ' . $db->quoteName('e.element') . ' = ' . $db->quoteName('a.module'))
// Join advanced params
->join('LEFT', $db->quoteName('#__advancedmodules', 'aa') . ' ON ' . $db->quoteName('aa.moduleid') . ' = ' . $db->quoteName('a.id'));
// Filter by module
$module = $this->getState('filter.module');
if ($module)
{
$query->where($db->quoteName('a.module') . ' = ' . $db->quote($module));
}
// Filter by category
$category = $this->getState('filter.category');
if ($category)
{
$query->where($db->quoteName('aa.category') . ' = ' . $db->quote($category));
}
$wheres = [];
// Filter by menuid
$menuid = $this->getState('filter.menuid');
switch ($menuid)
{
case '':
break;
case '0':
$wheres[] = $db->quoteName('mm.menuid') . ' = 0';
break;
case '-':
$wheres[] = $db->quoteName('mm.menuid') . ' IS NULL';
break;
case '-1':
$wheres[] = $db->quoteName('mm.menuid') . ' LIKE \'-%\'';
break;
case '-2':
$wheres[] = $db->quoteName('mm.menuid') . ' NOT LIKE \'-%\' AND ' . $db->quoteName('mm.menuid') . ' != 0';
break;
default:
$wheres[] = '(' . $db->quoteName('mm.menuid') . ' IN (0, ' . (int) $menuid . ')'
. ' OR (' . $db->quoteName('mm.menuid') . ' LIKE \'-%\' AND ' . $db->quoteName('mm.menuid') . ' != ' . $db->quote('-' . (int) $menuid) . '))';
break;
}
// Filter by position
if ($position = $this->getState('filter.position'))
{
$wheres[] = $db->quoteName('a.position') . ' = ' . $db->quote($position != 'none' ? $position : '');
}
// Filter by current user access level.
$user = JFactory::getUser();
// Get the current user for authorisation checks
if ($user->authorise('core.admin') !== true)
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$wheres[] = 'a.access IN (' . $groups . ')';
}
// Filter by access level.
if ($access = $this->getState('filter.access'))
{
$wheres[] = 'a.access = ' . (int) $access;
}
// Filter on the language.
if ($language = $this->getState('filter.language'))
{
$wheres[] = $db->quoteName('a.language') . ' = ' . $db->quote($language);
}
// Filter by published state
$published = $this->getState('filter.state');
// Modal view should return only front end modules
if (JFactory::getApplication()->input->get('layout') == 'modal')
{
$published = 1;
}
if (is_numeric($published))
{
$wheres[] = $db->quoteName('a.published') . ' = ' . (int) $published;
}
elseif ($published == '')
{
$wheres[] = '(' . $db->quoteName('a.published') . ' IN (0, 1))';
}
// Filter by client.
$clientId = $this->getState('filter.client_id');
// Modal view should return only front end modules
if (JFactory::getApplication()->input->get('layout') == 'modal')
{
$clientId = 0;
}
if (is_numeric($clientId))
{
$wheres[] = $db->quoteName('a.client_id') . ' = ' . (int) $clientId
. ' AND ' . $db->quoteName('e.client_id') . ' =' . (int) $clientId;
}
// Modal view should return only specific language and ALL
if (JFactory::getApplication()->input->get('layout') == 'modal')
{
if (JFactory::getApplication()->isClient('site') && JLanguageMultilang::isEnabled())
{
$query->where($db->quoteName('a.language') . ' in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
}
}
elseif ($language = $this->getState('filter.language'))
{
// Filter on the language.
$query->where($db->quoteName('a.language') . ' = ' . $db->quote($language));
}
// Set wheres
foreach ($wheres as $where)
{
$query->where($where);
}
// Filter by search in title
$search = trim($this->getState('filter.search'));
if ( ! empty($search))
{
if (stripos($search, 'id:') === 0)
{
$query->where($db->quoteName('a.id') . ' = ' . (int) substr($search, 3));
}
else
{
$search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%'));
$query->where('('
. $db->quoteName('a.title') . ' LIKE ' . $search
. ' OR ' . $db->quoteName('a.note') . ' LIKE ' . $search
. ')');
}
}
$db->setQuery($query);
$ids = $db->loadColumn();
foreach ($ids as $key => $id)
{
if (JFactory::getUser()->authorise('core.edit', 'com_modules.module.' . $id))
{
continue;
}
unset($ids[$key]);
}
if ( ! empty($ids))
{
$mirror_wheres = $wheres;
array_unshift(
$mirror_wheres,
$db->quoteName('aa.mirror_id') . ' IN (' . implode(',', $ids) . ',-' . implode(',-', $ids) . ')'
);
$query->clear('where');
// Set wheres
foreach ($mirror_wheres as $where)
{
$query->where($where);
}
$db->setQuery($query);
$mirror_ids = $db->loadColumn();
$mirror_ids = array_unique($mirror_ids);
foreach ($mirror_ids as $key => $id)
{
if (JFactory::getUser()->authorise('core.edit', 'com_modules.module.' . $id))
{
continue;
}
unset($mirror_ids[$key]);
}
$ids = array_merge($ids, $mirror_ids);
}
$query = $db->getQuery(true)
// Select the required fields from the table.
->select(
$this->getState(
'list.select',
'a.id, a.title, a.note, a.position, a.module, a.language,' .
'a.checked_out, a.checked_out_time, a.published as published, e.enabled as enabled, a.access, a.ordering, a.publish_up, a.publish_down'
)
)
->from('#__modules AS a')
// Join over the language
->select($db->quoteName('l.title', 'language_title'))
->select($db->quoteName('l.image', 'language_image'))
->join('LEFT', $db->quoteName('#__languages', 'l') . ' ON ' . $db->quoteName('l.lang_code') . ' = ' . $db->quoteName('a.language'))
->select($db->quoteName('le.element', 'language'))
->join('LEFT', $db->quoteName('#__extensions', 'le') . ' ON ' . $db->quoteName('le.element') . ' = ' . $db->quoteName('a.language'))
// Join over the users for the checked out user.
->select($db->quoteName('uc.name', 'editor'))
->join('LEFT', $db->quoteName('#__users', 'uc') . ' ON ' . $db->quoteName('uc.id') . ' = ' . $db->quoteName('a.checked_out'))
// Join over the asset groups.
->select($db->quoteName('ag.title', 'access_level'))
->join('LEFT', $db->quoteName('#__viewlevels', 'ag') . ' ON ' . $db->quoteName('ag.id') . ' = ' . $db->quoteName('a.access'))
// Join over the module menus
->select('MIN(mm.menuid) AS menuid')
->join('LEFT', $db->quoteName('#__modules_menu', 'mm') . ' ON ' . $db->quoteName('mm.moduleid') . ' = ' . $db->quoteName('a.id'))
// Join over the extensions
->select($db->quoteName('e.name', 'name'))
->join('LEFT', $db->quoteName('#__extensions', 'e') . ' ON ' . $db->quoteName('e.element') . ' = ' . $db->quoteName('a.module'))
// Join over the advanced params
->select($db->quoteName('aa.params', 'advancedparams'))
->select($db->quoteName('aa.mirror_id', 'mirror_id'))
->select($db->quoteName('aa.category', 'category'))
->join('LEFT', $db->quoteName('#__advancedmodules', 'aa') . ' ON ' . $db->quoteName('aa.moduleid') . ' = ' . $db->quoteName('a.id'))
// Group
->group(
'a.id, a.title, a.note, a.position, a.module, a.language, a.checked_out,' .
'a.checked_out_time, a.published, a.access, a.ordering, uc.name, ag.title, e.name,' .
'uc.id, ag.id, mm.moduleid, e.element, a.publish_up, a.publish_down, e.enabled'
);
if (empty($ids))
{
$query->where('1 = 0');
return $query;
}
$ids = array_unique($ids);
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
return $query;
}
/**
* Function that gets the config settings
*
* @return Object
*/
protected function getConfig()
{
if (isset($this->config))
{
return $this->config;
}
$this->config = RL_Parameters::getInstance()->getComponentParams('advancedmodules');
return $this->config;
}
}

View File

@ -0,0 +1,240 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Modules Component Positions Model
*/
class AdvancedModulesModelPositions extends JModelList
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
*
* @see JController
* @since 1.6
*/
public function __construct($config = [])
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = [
'value',
'templates',
];
}
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*/
protected function populateState($ordering = 'value', $direction = 'asc')
{
$app = JFactory::getApplication('administrator');
// Load the filter state.
$search = trim($this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'));
$this->setState('filter.search', $search);
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '', 'string');
$this->setState('filter.published', $published);
$clientId = $app->input->getInt('client_id', 0);
$this->setState('filter.client_id', $clientId);
$template = $this->getUserStateFromRequest($this->context . '.filter.template', 'filter_template', '', 'string');
$this->setState('filter.template', $template);
$type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type', '', 'string');
$this->setState('filter.type', $type);
// Load the parameters.
$params = JComponentHelper::getParams('com_advancedmodules');
$this->setState('params', $params);
// List state information.
parent::populateState($ordering, $direction);
}
/**
* Method to get an array of data items.
*
* @return mixed An array of data items on success, false on failure.
*/
public function getItems()
{
if ( ! isset($this->items))
{
$lang = JFactory::getLanguage();
$search = trim($this->getState('filter.search'));
$state = $this->getState('filter.state');
$clientId = $this->getState('filter.client_id');
$filter_template = $this->getState('filter.template');
$type = $this->getState('filter.type');
$ordering = $this->getState('list.ordering');
$direction = $this->getState('list.direction');
$limitstart = $this->getState('list.start');
$limit = $this->getState('list.limit');
$client = JApplicationHelper::getClientInfo($clientId);
if ($type != 'template')
{
// Get the database object and a new query object.
$query = $this->_db->getQuery(true)
->select('DISTINCT(m.position) as value')
->from('#__modules as m')
->where('m.client_id = ' . (int) $clientId);
if ($search)
{
$search = $this->_db->quote('%' . str_replace(' ', '%', $this->_db->escape(trim($search), true) . '%'));
$query->where('m.position LIKE ' . $search);
}
$this->_db->setQuery($query);
try
{
$positions = $this->_db->loadObjectList('value');
}
catch (RuntimeException $e)
{
$this->setError($e->getMessage());
return false;
}
foreach ($positions as $value => $position)
{
$positions[$value] = [];
}
}
else
{
$positions = [];
}
// Load the positions from the installed templates.
foreach (ModulesHelper::getTemplates($clientId) as $template)
{
$path = JPath::clean($client->path . '/templates/' . $template->element . '/templateDetails.xml');
if (file_exists($path))
{
$xml = simplexml_load_file($path);
if (isset($xml->positions[0]))
{
$lang->load('tpl_' . $template->element . '.sys', $client->path, null, false, true)
|| $lang->load('tpl_' . $template->element . '.sys', $client->path . '/templates/' . $template->element, null, false, true);
foreach ($xml->positions[0] as $position)
{
$value = (string) $position['value'];
$label = (string) $position;
if ( ! $value)
{
$value = $label;
$label = preg_replace('/[^a-zA-Z0-9_\-]/', '_', 'TPL_' . $template->element . '_POSITION_' . $value);
$altlabel = preg_replace('/[^a-zA-Z0-9_\-]/', '_', 'COM_MODULES_POSITION_' . $value);
if ( ! $lang->hasKey($label) && $lang->hasKey($altlabel))
{
$label = $altlabel;
}
}
if ($type == 'user' || ($state != '' && $state != $template->enabled))
{
unset($positions[$value]);
}
elseif (preg_match(chr(1) . $search . chr(1) . 'i', $value) && ($filter_template == '' || $filter_template == $template->element))
{
if ( ! isset($positions[$value]))
{
$positions[$value] = [];
}
$positions[$value][$template->name] = $label;
}
}
}
}
}
$this->total = count($positions);
if ($limitstart >= $this->total)
{
$limitstart = $limitstart < $limit ? 0 : $limitstart - $limit;
$this->setState('list.start', $limitstart);
}
if ($ordering == 'value')
{
if ($direction == 'asc')
{
ksort($positions);
}
else
{
krsort($positions);
}
}
else
{
if ($direction == 'asc')
{
asort($positions);
}
else
{
arsort($positions);
}
}
$this->items = array_slice($positions, $limitstart, $limit ? $limit : null);
}
return $this->items;
}
/**
* Method to get the total number of items.
*
* @return int The total number of items.
*/
public function getTotal()
{
if ( ! isset($this->total))
{
$this->getItems();
}
return $this->total;
}
}

View File

@ -0,0 +1,153 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Module model.
*/
class AdvancedModulesModelSelect extends JModelList
{
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication('administrator');
// Load the filter state.
$clientId = $app->getUserState('com_advancedmodules.modules.client_id', 0);
$this->setState('filter.client_id', (int) $clientId);
// Load the parameters.
$params = JComponentHelper::getParams('com_advancedmodules');
$this->setState('params', $params);
// Manually set limits to get all modules.
$this->setState('list.limit', 0);
$this->setState('list.start', 0);
$this->setState('list.ordering', 'a.name');
$this->setState('list.direction', 'ASC');
}
/**
* Method to get a store id based on model configuration state.
*
* This is necessary because the model is used by the component and
* different modules that might need different sets of data or different
* ordering requirements.
*
* @param string $id A prefix for the store id.
*
* @return string A store id.
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . $this->getState('filter.client_id');
return parent::getStoreId($id);
}
/**
* Build an SQL query to load the list data.
*
* @return JDatabaseQuery
*/
protected function getListQuery()
{
$db = $this->getDbo();
$clientId = $this->getState('filter.client_id');
$query = $db->getQuery(true)
// Select the required fields from the table.
->select(
$this->getState(
'list.select',
'a.extension_id, a.name, a.element AS module'
)
)
->from('#__extensions AS a')
// Filter by module
->where('a.type = ' . $db->quote('module'))
// Filter by client.
->where('a.client_id = ' . (int) $clientId)
// Filter by enabled
->where('a.enabled = 1')
// Add the list ordering clause.
->order($db->escape($this->getState('list.ordering', 'a.ordering')) . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
return $query;
}
/**
* Method to get a list of items.
*
* @return mixed An array of objects on success, false on failure.
*/
public function getItems()
{
// Get the list of items from the database.
$items = parent::getItems();
$client = JApplicationHelper::getClientInfo($this->getState('filter.client_id', 0));
$lang = JFactory::getLanguage();
// Loop through the results to add the XML metadata,
// and load language support.
foreach ($items as &$item)
{
$path = JPath::clean($client->path . '/modules/' . $item->module . '/' . $item->module . '.xml');
if (file_exists($path))
{
$item->xml = simplexml_load_file($path);
}
else
{
$item->xml = null;
}
// 1.5 Format; Core files or language packs then
// 1.6 3PD Extension Support
$lang->load($item->module . '.sys', $client->path, null, false, true)
|| $lang->load($item->module . '.sys', $client->path . '/modules/' . $item->module, null, false, true);
$item->name = JText::_($item->name);
if (isset($item->xml) && $text = trim($item->xml->description))
{
$item->desc = JText::_($text);
}
else
{
$item->desc = JText::_('COM_MODULES_NODESCRIPTION');
}
}
$items = JArrayHelper::sortObjects($items, 'name', 1, true, true);
// TODO: Use the cached XML from the extensions table?
return $items;
}
}

View File

@ -0,0 +1,852 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
class Com_AdvancedModulesInstallerScriptHelper
{
public $name = '';
public $alias = '';
public $extname = '';
public $extension_type = '';
public $plugin_folder = 'system';
public $module_position = 'status';
public $client_id = 1;
public $install_type = 'install';
public $show_message = true;
public $db = null;
public $softbreak = null;
public function __construct(&$params)
{
$this->extname = $this->extname ?: $this->alias;
$this->db = JFactory::getDbo();
}
public function preflight($route, JAdapterInstance $adapter)
{
if ( ! in_array($route, ['install', 'update']))
{
return true;
}
JFactory::getLanguage()->load('plg_system_regularlabsinstaller', JPATH_PLUGINS . '/system/regularlabsinstaller');
if ($this->show_message && $this->isInstalled())
{
$this->install_type = 'update';
}
if ($this->onBeforeInstall($route) === false)
{
return false;
}
return true;
}
public function postflight($route, JAdapterInstance $adapter)
{
$this->removeGlobalLanguageFiles();
$this->removeUnusedLanguageFiles();
JFactory::getLanguage()->load($this->getPrefix() . '_' . $this->extname, $this->getMainFolder());
if ( ! in_array($route, ['install', 'update']))
{
return true;
}
$this->fixExtensionNames();
$this->updateUpdateSites();
$this->removeAdminCache();
if ($this->onAfterInstall($route) === false)
{
return false;
}
if ($route == 'install')
{
$this->publishExtension();
}
if ($this->show_message)
{
$this->addInstalledMessage();
}
JFactory::getCache()->clean('com_plugins');
JFactory::getCache()->clean('_system');
return true;
}
public function isInstalled()
{
if ( ! is_file($this->getInstalledXMLFile()))
{
return false;
}
$query = $this->db->getQuery(true)
->select($this->db->quoteName('extension_id'))
->from('#__extensions')
->where($this->db->quoteName('type') . ' = ' . $this->db->quote($this->extension_type))
->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->getElementName()));
$this->db->setQuery($query, 0, 1);
$result = $this->db->loadResult();
return empty($result) ? false : true;
}
public function getMainFolder()
{
switch ($this->extension_type)
{
case 'plugin' :
return JPATH_PLUGINS . '/' . $this->plugin_folder . '/' . $this->extname;
case 'component' :
return JPATH_ADMINISTRATOR . '/components/com_' . $this->extname;
case 'module' :
return JPATH_ADMINISTRATOR . '/modules/mod_' . $this->extname;
case 'library' :
return JPATH_SITE . '/libraries/' . $this->extname;
}
}
public function getInstalledXMLFile()
{
return $this->getXMLFile($this->getMainFolder());
}
public function getCurrentXMLFile()
{
return $this->getXMLFile(__DIR__);
}
public function getXMLFile($folder)
{
switch ($this->extension_type)
{
case 'module' :
return $folder . '/mod_' . $this->extname . '.xml';
default :
return $folder . '/' . $this->extname . '.xml';
}
}
public function uninstallExtension($extname, $type = 'plugin', $folder = 'system', $show_message = true)
{
if (empty($extname))
{
return;
}
$folders = [];
switch ($type)
{
case 'plugin';
$folders[] = JPATH_PLUGINS . '/' . $folder . '/' . $extname;
break;
case 'component':
$folders[] = JPATH_ADMINISTRATOR . '/components/com_' . $extname;
$folders[] = JPATH_SITE . '/components/com_' . $extname;
break;
case 'module':
$folders[] = JPATH_ADMINISTRATOR . '/modules/mod_' . $extname;
$folders[] = JPATH_SITE . '/modules/mod_' . $extname;
break;
}
if ( ! $this->foldersExist($folders))
{
return;
}
$query = $this->db->getQuery(true)
->select($this->db->quoteName('extension_id'))
->from('#__extensions')
->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->getElementName($type, $extname)))
->where($this->db->quoteName('type') . ' = ' . $this->db->quote($type));
if ($type == 'plugin')
{
$query->where($this->db->quoteName('folder') . ' = ' . $this->db->quote($folder));
}
$this->db->setQuery($query);
$ids = $this->db->loadColumn();
if (empty($ids))
{
foreach ($folders as $folder)
{
JFolder::delete($folder);
}
return;
}
$ignore_ids = JFactory::getApplication()->getUserState('rl_ignore_uninstall_ids', []);
if (JFactory::getApplication()->input->get('option') == 'com_installer' && JFactory::getApplication()->input->get('task') == 'remove')
{
// Don't attempt to uninstall extensions that are already selected to get uninstalled by them selves
$ignore_ids = array_merge($ignore_ids, JFactory::getApplication()->input->get('cid', [], 'array'));
JFactory::getApplication()->input->set('cid', array_merge($ignore_ids, $ids));
}
$ids = array_diff($ids, $ignore_ids);
if (empty($ids))
{
return;
}
$ignore_ids = array_merge($ignore_ids, $ids);
JFactory::getApplication()->setUserState('rl_ignore_uninstall_ids', $ignore_ids);
foreach ($ids as $id)
{
$tmpInstaller = new JInstaller;
$tmpInstaller->uninstall($type, $id);
}
if ($show_message)
{
JFactory::getApplication()->enqueueMessage(
JText::sprintf(
'COM_INSTALLER_UNINSTALL_SUCCESS',
JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($type))
)
);
}
}
public function foldersExist($folders = [])
{
foreach ($folders as $folder)
{
if (is_dir($folder))
{
return true;
}
}
return false;
}
public function uninstallPlugin($extname, $folder = 'system', $show_message = true)
{
$this->uninstallExtension($extname, 'plugin', $folder, $show_message);
}
public function uninstallComponent($extname, $show_message = true)
{
$this->uninstallExtension($extname, 'component', null, $show_message);
}
public function uninstallModule($extname, $show_message = true)
{
$this->uninstallExtension($extname, 'module', null, $show_message);
}
public function publishExtension()
{
switch ($this->extension_type)
{
case 'plugin' :
$this->publishPlugin();
case 'module' :
$this->publishModule();
}
}
public function publishPlugin()
{
$query = $this->db->getQuery(true)
->update('#__extensions')
->set($this->db->quoteName('enabled') . ' = 1')
->where($this->db->quoteName('type') . ' = ' . $this->db->quote('plugin'))
->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->extname))
->where($this->db->quoteName('folder') . ' = ' . $this->db->quote($this->plugin_folder));
$this->db->setQuery($query);
$this->db->execute();
}
public function publishModule()
{
// Get module id
$query = $this->db->getQuery(true)
->select($this->db->quoteName('id'))
->from('#__modules')
->where($this->db->quoteName('module') . ' = ' . $this->db->quote('mod_' . $this->extname))
->where($this->db->quoteName('client_id') . ' = ' . (int) $this->client_id);
$this->db->setQuery($query, 0, 1);
$id = $this->db->loadResult();
if ( ! $id)
{
return;
}
// check if module is already in the modules_menu table (meaning is is already saved)
$query->clear()
->select($this->db->quoteName('moduleid'))
->from('#__modules_menu')
->where($this->db->quoteName('moduleid') . ' = ' . (int) $id);
$this->db->setQuery($query, 0, 1);
$exists = $this->db->loadResult();
if ($exists)
{
return;
}
// Get highest ordering number in position
$query->clear()
->select($this->db->quoteName('ordering'))
->from('#__modules')
->where($this->db->quoteName('position') . ' = ' . $this->db->quote($this->module_position))
->where($this->db->quoteName('client_id') . ' = ' . (int) $this->client_id)
->order('ordering DESC');
$this->db->setQuery($query, 0, 1);
$ordering = $this->db->loadResult();
$ordering++;
// publish module and set ordering number
$query->clear()
->update('#__modules')
->set($this->db->quoteName('published') . ' = 1')
->set($this->db->quoteName('ordering') . ' = ' . (int) $ordering)
->set($this->db->quoteName('position') . ' = ' . $this->db->quote($this->module_position))
->where($this->db->quoteName('id') . ' = ' . (int) $id);
$this->db->setQuery($query);
$this->db->execute();
// add module to the modules_menu table
$query->clear()
->insert('#__modules_menu')
->columns([$this->db->quoteName('moduleid'), $this->db->quoteName('menuid')])
->values((int) $id . ', 0');
$this->db->setQuery($query);
$this->db->execute();
}
public function addInstalledMessage()
{
JFactory::getApplication()->enqueueMessage(
JText::sprintf(
JText::_($this->install_type == 'update' ? 'RLI_THE_EXTENSION_HAS_BEEN_UPDATED_SUCCESSFULLY' : 'RLI_THE_EXTENSION_HAS_BEEN_INSTALLED_SUCCESSFULLY'),
'<strong>' . JText::_($this->name) . '</strong>',
'<strong>' . $this->getVersion() . '</strong>',
$this->getFullType()
)
);
}
public function getPrefix()
{
switch ($this->extension_type)
{
case 'plugin';
return JText::_('plg_' . strtolower($this->plugin_folder));
case 'component':
return JText::_('com');
case 'module':
return JText::_('mod');
case 'library':
return JText::_('lib');
default:
return $this->extension_type;
}
}
public function getElementName($type = null, $extname = null)
{
$type = is_null($type) ? $this->extension_type : $type;
$extname = is_null($extname) ? $this->extname : $extname;
switch ($type)
{
case 'component' :
return 'com_' . $extname;
case 'module' :
return 'mod_' . $extname;
case 'plugin' :
default:
return $extname;
}
}
public function getFullType()
{
return JText::_('RLI_' . strtoupper($this->getPrefix()));
}
public function getVersion($file = '')
{
$file = $file ?: $this->getCurrentXMLFile();
if ( ! is_file($file))
{
return '';
}
$xml = JApplicationHelper::parseXMLInstallFile($file);
if ( ! $xml || ! isset($xml['version']))
{
return '';
}
return $xml['version'];
}
public function isNewer()
{
if ( ! $installed_version = $this->getVersion($this->getInstalledXMLFile()))
{
return true;
}
$package_version = $this->getVersion();
return version_compare($installed_version, $package_version, '<=');
}
public function canInstall()
{
// The extension is not installed yet
if ( ! $installed_version = $this->getVersion($this->getInstalledXMLFile()))
{
return true;
}
// The free version is installed. So any version is ok to install
if (strpos($installed_version, 'PRO') === false)
{
return true;
}
// Current package is a pro version, so all good
if (strpos($this->getVersion(), 'PRO') !== false)
{
return true;
}
JFactory::getLanguage()->load($this->getPrefix() . '_' . $this->extname, __DIR__);
JFactory::getApplication()->enqueueMessage(JText::_('RLI_ERROR_PRO_TO_FREE'), 'error');
JFactory::getApplication()->enqueueMessage(
html_entity_decode(
JText::sprintf(
'RLI_ERROR_UNINSTALL_FIRST',
'<a href="https://www.regularlabs.com/extensions/' . $this->alias . '" target="_blank">',
'</a>',
JText::_($this->name)
)
), 'error'
);
return false;
}
/*
* Fixes incorrectly formed versions because of issues in old packager
*/
public function fixFileVersions($file)
{
if (is_array($file))
{
foreach ($file as $f)
{
self::fixFileVersions($f);
}
return;
}
if ( ! is_string($file) || ! is_file($file))
{
return;
}
$contents = file_get_contents($file);
if (
strpos($contents, 'FREEFREE') === false
&& strpos($contents, 'FREEPRO') === false
&& strpos($contents, 'PROFREE') === false
&& strpos($contents, 'PROPRO') === false
)
{
return;
}
$contents = str_replace(
['FREEFREE', 'FREEPRO', 'PROFREE', 'PROPRO'],
['FREE', 'PRO', 'FREE', 'PRO'],
$contents
);
JFile::write($file, $contents);
}
public function onBeforeInstall($route)
{
if ( ! $this->canInstall())
{
return false;
}
return true;
}
public function onAfterInstall($route)
{
}
public function delete($files = [])
{
foreach ($files as $file)
{
if (is_dir($file))
{
JFolder::delete($file);
}
if (is_file($file))
{
JFile::delete($file);
}
}
}
public function fixAssetsRules($rules = '{"core.admin":[],"core.manage":[]}')
{
// replace default rules value {} with the correct initial value
$query = $this->db->getQuery(true)
->update($this->db->quoteName('#__assets'))
->set($this->db->quoteName('rules') . ' = ' . $this->db->quote($rules))
->where($this->db->quoteName('title') . ' = ' . $this->db->quote('com_' . $this->extname))
->where($this->db->quoteName('rules') . ' = ' . $this->db->quote('{}'));
$this->db->setQuery($query);
$this->db->execute();
}
private function fixExtensionNames()
{
switch ($this->extension_type)
{
case 'module' :
$this->fixModuleNames();
}
}
private function fixModuleNames()
{
// Get module id
$query = $this->db->getQuery(true)
->select($this->db->quoteName('id'))
->from('#__modules')
->where($this->db->quoteName('module') . ' = ' . $this->db->quote('mod_' . $this->extname))
->where($this->db->quoteName('client_id') . ' = ' . (int) $this->client_id);
$this->db->setQuery($query, 0, 1);
$module_id = $this->db->loadResult();
if (empty($module_id))
{
return;
}
$title = 'Regular Labs - ' . JText::_($this->name);
$query->clear()
->update('#__modules')
->set($this->db->quoteName('title') . ' = ' . $this->db->quote($title))
->where($this->db->quoteName('id') . ' = ' . (int) $module_id)
->where($this->db->quoteName('title') . ' LIKE ' . $this->db->quote('NoNumber%'));
$this->db->setQuery($query);
$this->db->execute();
// Fix module assets
// Get asset id
$query = $this->db->getQuery(true)
->select($this->db->quoteName('id'))
->from('#__assets')
->where($this->db->quoteName('name') . ' = ' . $this->db->quote('com_modules.module.' . (int) $module_id))
->where($this->db->quoteName('title') . ' LIKE ' . $this->db->quote('NoNumber%'));
$this->db->setQuery($query, 0, 1);
$asset_id = $this->db->loadResult();
if (empty($asset_id))
{
return;
}
$query->clear()
->update('#__assets')
->set($this->db->quoteName('title') . ' = ' . $this->db->quote($title))
->where($this->db->quoteName('id') . ' = ' . (int) $asset_id);
$this->db->setQuery($query);
$this->db->execute();
}
private function updateUpdateSites()
{
$this->removeOldUpdateSites();
$this->updateNamesInUpdateSites();
$this->updateHttptoHttpsInUpdateSites();
$this->removeDuplicateUpdateSite();
$this->updateDownloadKey();
}
private function removeOldUpdateSites()
{
$query = $this->db->getQuery(true)
->select($this->db->quoteName('update_site_id'))
->from('#__update_sites')
->where($this->db->quoteName('location') . ' LIKE ' . $this->db->quote('nonumber.nl%'))
->where($this->db->quoteName('location') . ' LIKE ' . $this->db->quote('%e=' . $this->alias . '%'));
$this->db->setQuery($query, 0, 1);
$id = $this->db->loadResult();
if ( ! $id)
{
return;
}
$query->clear()
->delete('#__update_sites')
->where($this->db->quoteName('update_site_id') . ' = ' . (int) $id);
$this->db->setQuery($query);
$this->db->execute();
$query->clear()
->delete('#__update_sites_extensions')
->where($this->db->quoteName('update_site_id') . ' = ' . (int) $id);
$this->db->setQuery($query);
$this->db->execute();
}
private function updateNamesInUpdateSites()
{
$name = JText::_($this->name);
if ($this->alias != 'extensionmanager')
{
$name = 'Regular Labs - ' . $name;
}
$query = $this->db->getQuery(true)
->update('#__update_sites')
->set($this->db->quoteName('name') . ' = ' . $this->db->quote($name))
->where($this->db->quoteName('location') . ' LIKE ' . $this->db->quote('%download.regularlabs.com%'))
->where($this->db->quoteName('location') . ' LIKE ' . $this->db->quote('%e=' . $this->alias . '%'));
$this->db->setQuery($query);
$this->db->execute();
}
private function updateHttptoHttpsInUpdateSites()
{
$query = $this->db->getQuery(true)
->update('#__update_sites')
->set($this->db->quoteName('location') . ' = REPLACE('
. $this->db->quoteName('location') . ', '
. $this->db->quote('http://') . ', '
. $this->db->quote('https://')
. ')')
->where($this->db->quoteName('location') . ' LIKE ' . $this->db->quote('http://download.regularlabs.com%'));
$this->db->setQuery($query);
$this->db->execute();
}
private function removeDuplicateUpdateSite()
{
// First check to see if there is a pro entry
$query = $this->db->getQuery(true)
->select($this->db->quoteName('update_site_id'))
->from('#__update_sites')
->where($this->db->quoteName('location') . ' LIKE ' . $this->db->quote('%download.regularlabs.com%'))
->where($this->db->quoteName('location') . ' LIKE ' . $this->db->quote('%e=' . $this->alias . '%'))
->where($this->db->quoteName('location') . ' NOT LIKE ' . $this->db->quote('%pro=1%'));
$this->db->setQuery($query, 0, 1);
$id = $this->db->loadResult();
// Otherwise just get the first match
if ( ! $id)
{
$query->clear()
->select($this->db->quoteName('update_site_id'))
->from('#__update_sites')
->where($this->db->quoteName('location') . ' LIKE ' . $this->db->quote('%download.regularlabs.com%'))
->where($this->db->quoteName('location') . ' LIKE ' . $this->db->quote('%e=' . $this->alias . '%'));
$this->db->setQuery($query, 0, 1);
$id = $this->db->loadResult();
// Remove pro=1 from the found update site
$query->clear()
->update('#__update_sites')
->set($this->db->quoteName('location')
. ' = replace(' . $this->db->quoteName('location') . ', ' . $this->db->quote('&pro=1') . ', ' . $this->db->quote('') . ')')
->where($this->db->quoteName('update_site_id') . ' = ' . (int) $id);
$this->db->setQuery($query);
$this->db->execute();
}
if ( ! $id)
{
return;
}
$query->clear()
->select($this->db->quoteName('update_site_id'))
->from('#__update_sites')
->where($this->db->quoteName('location') . ' LIKE ' . $this->db->quote('%download.regularlabs.com%'))
->where($this->db->quoteName('location') . ' LIKE ' . $this->db->quote('%e=' . $this->alias . '%'))
->where($this->db->quoteName('update_site_id') . ' != ' . $id);
$this->db->setQuery($query);
$ids = $this->db->loadColumn();
if (empty($ids))
{
return;
}
$query->clear()
->delete('#__update_sites')
->where($this->db->quoteName('update_site_id') . ' IN (' . implode(',', $ids) . ')');
$this->db->setQuery($query);
$this->db->execute();
$query->clear()
->delete('#__update_sites_extensions')
->where($this->db->quoteName('update_site_id') . ' IN (' . implode(',', $ids) . ')');
$this->db->setQuery($query);
$this->db->execute();
}
// Save the download key from the Regular Labs Extension Manager config to the update sites
private function updateDownloadKey()
{
$query = $this->db->getQuery(true)
->select($this->db->quoteName('params'))
->from('#__extensions')
->where($this->db->quoteName('element') . ' = ' . $this->db->quote('com_regularlabsmanager'));
$this->db->setQuery($query);
$params = $this->db->loadResult();
if ( ! $params)
{
return;
}
$params = json_decode($params);
if ( ! isset($params->key))
{
return;
}
// Add the key on all regularlabs.com urls
$query->clear()
->update('#__update_sites')
->set($this->db->quoteName('extra_query') . ' = ' . $this->db->quote('k=' . $params->key))
->where($this->db->quoteName('location') . ' LIKE ' . $this->db->quote('%download.regularlabs.com%'));
$this->db->setQuery($query);
$this->db->execute();
}
private function removeAdminCache()
{
$this->delete([JPATH_ADMINISTRATOR . '/cache/regularlabs']);
$this->delete([JPATH_ADMINISTRATOR . '/cache/nonumber']);
}
private function removeGlobalLanguageFiles()
{
if ($this->extension_type == 'library')
{
return;
}
$language_files = JFolder::files(JPATH_ADMINISTRATOR . '/language', '\.' . $this->getPrefix() . '_' . $this->extname . '\.', true, true);
// Remove override files
foreach ($language_files as $i => $language_file)
{
if (strpos($language_file, '/overrides/') === false)
{
continue;
}
unset($language_files[$i]);
}
if (empty($language_files))
{
return;
}
JFile::delete($language_files);
}
private function removeUnusedLanguageFiles()
{
if ($this->extension_type == 'library')
{
return;
}
$installed_languages = array_merge(
JFolder::folders(JPATH_SITE . '/language'),
JFolder::folders(JPATH_ADMINISTRATOR . '/language')
);
$languages = array_diff(
JFolder::folders(__DIR__ . '/language'),
$installed_languages
);
$delete_languages = [];
foreach ($languages as $language)
{
$delete_languages[] = $this->getMainFolder() . '/language/' . $language;
}
if (empty($delete_languages))
{
return;
}
// Remove folders
$this->delete($delete_languages);
}
}

View File

@ -0,0 +1,353 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
require_once __DIR__ . '/script.install.helper.php';
class Com_AdvancedModulesInstallerScript extends Com_AdvancedModulesInstallerScriptHelper
{
public $name = 'ADVANCED_MODULE_MANAGER';
public $alias = 'advancedmodulemanager';
public $extname = 'advancedmodules';
public $extension_type = 'component';
public function uninstall($adapter)
{
$this->uninstallPlugin($this->extname, $folder = 'system');
}
public function onBeforeInstall($route)
{
// Fix incorrectly formed versions because of issues in old packager
$this->fixFileVersions(
[
JPATH_ADMINISTRATOR . '/components/com_advancedmodules/advancedmodules.xml',
JPATH_PLUGINS . '/system/advancedmodules/advancedmodules.xml',
]
);
}
public function onAfterInstall($route)
{
$this->createTable();
$this->fixAssignments();
$this->fixAssetIdField();
$this->fixMirrorIdField();
$this->fixCategoryField();
$this->removeAdminMenu();
$this->removeFrontendComponentFromDB();
$this->deleteOldFiles();
$this->fixAssetsRules();
}
private function createTable()
{
// main table
$query = "CREATE TABLE IF NOT EXISTS `#__advancedmodules` (
`moduleid` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`asset_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`mirror_id` INT(10) NOT NULL DEFAULT '0',
`category` VARCHAR(50) NOT NULL,
`params` TEXT NOT NULL,
PRIMARY KEY (`moduleid`)
) DEFAULT CHARSET=utf8;";
$this->db->setQuery($query);
$this->db->execute();
}
private function fixAssetIdField()
{
// add asset_id column
$query = "SHOW COLUMNS FROM `" . $this->db->getPrefix() . "advancedmodules` LIKE 'asset_id'";
$this->db->setQuery($query);
$has_field = $this->db->loadResult();
if ($has_field)
{
return;
}
$query = "ALTER TABLE `#__advancedmodules` ADD `asset_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `moduleid`";
$this->db->setQuery($query);
$this->db->execute();
}
private function fixMirrorIdField()
{
// add mirror_id column
$query = "SHOW COLUMNS FROM `" . $this->db->getPrefix() . "advancedmodules` LIKE 'mirror_id'";
$this->db->setQuery($query);
$has_field = $this->db->loadResult();
if ($has_field)
{
return;
}
$query = "ALTER TABLE `#__advancedmodules` ADD `mirror_id` INT(10) NOT NULL DEFAULT '0' AFTER `asset_id`";
$this->db->setQuery($query);
$this->db->execute();
$this->fixMirrorIdFieldFixParams();
}
private function fixCategoryField()
{
// add asset_id column
$query = "SHOW COLUMNS FROM `" . $this->db->getPrefix() . "advancedmodules` LIKE 'category'";
$this->db->setQuery($query);
$has_field = $this->db->loadResult();
if ($has_field)
{
return;
}
$query = "ALTER TABLE `#__advancedmodules` ADD COLUMN `category` VARCHAR(50) NOT NULL AFTER `mirror_id`";
$this->db->setQuery($query);
$this->db->execute();
}
private function fixMirrorIdFieldFixParams()
{
// correct old keys and values
$query = $this->db->getQuery(true)
->select($this->db->quoteName('moduleid', 'id'))
->select($this->db->quoteName('params'))
->from($this->db->quoteName('#__advancedmodules'));
$this->db->setQuery($query);
$rows = $this->db->loadObjectList();
foreach ($rows as $row)
{
if (empty($row->params))
{
continue;
}
$params = json_decode($row->params);
if (is_null($params))
{
continue;
}
// set urls_regex value if assignto_urls is used
if (empty($params->mirror_module) || empty($params->mirror_moduleid))
{
continue;
}
$mirror_id = $params->mirror_moduleid;
unset($params->mirror_module);
unset($params->mirror_moduleid);
$query->clear()
->update($this->db->quoteName('#__advancedmodules'))
->set($this->db->quoteName('mirror_id') . ' = ' . (int) $mirror_id)
->set($this->db->quoteName('params') . ' = ' . $this->db->quote(json_encode($params)))
->where($this->db->quoteName('moduleid') . ' = ' . (int) $row->id);
$this->db->setQuery($query);
$this->db->execute();
}
}
private function removeAdminMenu()
{
// hide admin menu
$query = $this->db->getQuery(true)
->delete($this->db->quoteName('#__menu'))
->where($this->db->quoteName('path') . ' = ' . $this->db->quote('advancedmodules'))
->where($this->db->quoteName('type') . ' = ' . $this->db->quote('component'))
->where($this->db->quoteName('client_id') . ' = 1');
$this->db->setQuery($query);
$this->db->execute();
}
private function removeFrontendComponentFromDB()
{
// remove frontend component from extensions table
$query = $this->db->getQuery(true)
->delete($this->db->quoteName('#__extensions'))
->where($this->db->quoteName('element') . ' = ' . $this->db->quote('com_advancedmodules'))
->where($this->db->quoteName('type') . ' = ' . $this->db->quote('component'))
->where($this->db->quoteName('client_id') . ' = 0');
$this->db->setQuery($query);
$this->db->execute();
JFactory::getCache()->clean('_system');
}
private function fixAssignments()
{
$this->fixAssignmentsRemoveInitialAssignments();
$this->fixAssignmentsCorrectOldKeys();
}
private function fixAssignmentsRemoveInitialAssignments()
{
// remove initial menu assignment settings
$query = $this->db->getQuery(true)
->update($this->db->quoteName('#__advancedmodules'))
->set($this->db->quoteName('params') . ' = ' . $this->db->quote(''))
->where($this->db->quoteName('params') . ' = ' . $this->db->quote('{"assignto_menuitems":0,"assignto_menuitems_selection":[]}'));
$this->db->setQuery($query);
$this->db->execute();
}
private function fixAssignmentsCorrectOldKeys()
{
// correct old keys and values
$query = $this->db->getQuery(true)
->select($this->db->quoteName('moduleid', 'id'))
->select($this->db->quoteName('params'))
->from($this->db->quoteName('#__advancedmodules'));
$this->db->setQuery($query);
$rows = $this->db->loadObjectList();
foreach ($rows as $row)
{
if (empty($row->params))
{
continue;
}
if ($row->params[0] != '{')
{
$row->params = str_replace('assignto_secscats', 'assignto_cats', $row->params);
$row->params = str_replace('flexicontent', 'fc', $row->params);
$params = JRegistryFormat::getInstance('INI')->stringToObject($row->params);
}
else
{
$params = json_decode($row->params);
if (is_null($params))
{
$params = (object) [];
}
}
// move tooltip to notes field
if ( ! empty($params->tooltip))
{
$query->clear()
->update($this->db->quoteName('#__modules'))
->set($this->db->quoteName('note') . ' = ' . $this->db->quote($params->tooltip))
->where($this->db->quoteName('id') . ' = ' . (int) $row->id);
$this->db->setQuery($query);
$this->db->execute();
unset($params->tooltip);
}
// concatenate sef and non-sef url fields
if (isset($params->assignto_urls_selection_sef))
{
$params->assignto_urls_selection = trim($params->assignto_urls_selection . "\n" . $params->assignto_urls_selection_sef);
unset($params->assignto_urls_selection_sef);
unset($params->show_url_field);
}
// set urls_regex value if assignto_urls is used
if ( ! empty($params->assignto_urls) && ! isset($params->assignto_urls_regex))
{
$params->assignto_urls_regex = 1;
}
foreach ($params as $k => &$v)
{
switch ($k)
{
case 'assignto_php_selection':
case 'assignto_urls_selection':
case 'assignto_ips_selection':
$v = str_replace(['\n', '\|'], ["\n", '|'], $v);
break;
case 'color':
$v = str_replace('#', '', $v);
$v = (empty($v) || $v == 'none') ? 'none' : $v;
if ($v && $v != 'none')
{
$v = '#' . strtolower($v);
}
break;
case 'assignto_users_selection':
if ( ! is_array($v))
{
$v = explode('|', $v);
}
break;
default:
if (
(substr($k, -10) == '_selection' || substr($k, -4) == '_inc')
&& ! is_array($v)
)
{
// convert | separated strings to arrays
$v = explode('|', $v);
}
break;
}
}
if ( ! empty($params->assignto_cats_selection))
{
foreach ($params->assignto_cats_selection as $key => $val)
{
if (strpos($val, ':') !== false)
{
$params->assignto_cats_selection[$key] = substr($val, strpos($val, ':') + 1);
}
}
}
$params = json_encode($params);
if ($params == $row->params)
{
continue;
}
$query->clear()
->update($this->db->quoteName('#__advancedmodules'))
->set($this->db->quoteName('params') . ' = ' . $this->db->quote($params))
->where($this->db->quoteName('moduleid') . ' = ' . (int) $row->id);
$this->db->setQuery($query);
$this->db->execute();
}
}
private function deleteOldFiles()
{
JFile::delete(
[
JPATH_ADMINISTRATOR . '/components/com_advancedmodules/script.advancedmodules.php',
JPATH_SITE . '/components/com_advancedmodules/advancedmodules.xml',
JPATH_SITE . '/components/com_advancedmodules/script.advancedmodules.php',
JPATH_SITE . '/plugins/system/advancedmodules/modulehelper.php',
]
);
}
public function fixAssetsRules($rules = '')
{
$rules = '{"core.admin":[],"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}';
parent::fixAssetsRules($rules);
// Remove unused assets entry (uses com_modules)
$query = $this->db->getQuery(true)
->delete('#__assets')
->where('name LIKE ' . $this->db->quote('com_advancedmodules.module.%'));
$this->db->setQuery($query);
$this->db->execute();
}
}

View File

@ -0,0 +1,82 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
class AdvancedModulesTable extends JTable
{
public function __construct(&$db)
{
parent::__construct('#__advancedmodules', 'moduleid', $db);
}
protected function _getAssetName()
{
$k = $this->_tbl_key;
return 'com_modules.module.' . (int) $this->{$k};
}
protected function _getAssetTitle()
{
if (isset($this->_title))
{
return $this->_title;
}
$k = (int) $this->_tbl_key;
if (empty($this->{$k}))
{
return parent::_getAssetTitle();
}
$db = $this->getDbo();
$query = $db->getQuery(true)
->select('title')
->from('#__modules')
->where('id = ' . (int) $this->{$k});
$db->setQuery($query);
return $db->loadResult();
}
/**
* Method to get the parent asset id for the record
*
* @param JTable $table A JTable object for the asset parent
* @param integer $id
*
* @return integer
*/
protected function _getAssetParentId(JTable $table = null, $id = null)
{
$db = $this->getDbo();
$query = $db->getQuery(true)
->select('id')
->from('#__assets')
->where('name = ' . $db->quote('com_modules'));
$db->setQuery($query);
if ($assetId = $db->loadResult())
{
return $assetId;
}
return parent::_getAssetParentId($table, $id);
}
}
class AdvancedModulesTableAdvancedModules extends AdvancedModulesTable
{
}

View File

@ -0,0 +1,277 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use RegularLabs\Library\Document as RL_Document;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('jquery.framework');
JHtml::_('behavior.formvalidator');
JHtml::_('behavior.combobox');
JHtml::_('formbehavior.chosen', '#jform_position', null, ['disable_search_threshold' => 0]);
JHtml::_('formbehavior.chosen', '.multipleCategories', null, ['placeholder_text_multiple' => JText::_('JOPTION_SELECT_CATEGORY')]);
JHtml::_('formbehavior.chosen', '.multipleTags', null, ['placeholder_text_multiple' => JText::_('JOPTION_SELECT_TAG')]);
JHtml::_('formbehavior.chosen', 'select');
$hasContent = empty($this->item->module) || isset($this->item->xml->customContent);
$hasContentFieldName = 'content';
// For a later improvement
if ($hasContent)
{
$hasContentFieldName = 'content';
}
// Get Params Fieldsets
$this->fieldsets = $this->form->getFieldsets('params');
$this->hidden_fields = '';
$script = "
Joomla.submitbutton = function(task)
{
if (task == 'module.cancel' || document.formvalidator.isValid(document.getElementById('module-form'))) {";
if ($hasContent)
{
$script .= $this->form->getField($hasContentFieldName)->save();
}
$script .= "
Joomla.submitform(task, document.getElementById('module-form'));
jQuery('#permissions-sliders select').attr('disabled', 'disabled');
if (self != top)
{
window.top.setTimeout('window.parent.SqueezeBox.close();', 1000);
}
}
};";
if (JFactory::getUser()->authorise('core.admin'))
{
$script .= "
jQuery(document).ready(function()
{
// add alert on remove assignment buttons
jQuery('button.rl_remove_assignment').click(function()
{
if(confirm('" . str_replace('<br>', '\n', JText::_('AMM_DISABLE_ASSIGNMENT', true)) . "')) {
jQuery('div#toolbar-options button').click();
}
});
});";
}
RL_Document::scriptDeclaration($script);
RL_Document::script('regularlabs/script.min.js');
RL_Document::script('regularlabs/toggler.min.js');
?>
<form action="<?php echo JRoute::_('index.php?option=com_advancedmodules&layout=edit&id=' . (int) $this->item->id); ?>" method="post" name="adminForm"
id="module-form" class="form-validate">
<?php echo JLayoutHelper::render('joomla.edit.title_alias', $this); ?>
<div class="form-horizontal">
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', ['active' => 'general']); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'general', JText::_('COM_MODULES_MODULE')); ?>
<div class="row-fluid">
<div class="span9">
<?php if ($this->item->xml) : ?>
<?php if ($this->item->xml->description) : ?>
<h3>
<?php
if ($this->item->xml)
{
echo ($text = (string) $this->item->xml->name) ? JText::_($text) : $this->item->module;
}
else
{
echo JText::_('COM_MODULES_ERR_XML');
}
?>
</h3>
<div class="info-labels">
<span class="label hasTooltip" title="<?php echo JHtml::tooltipText('COM_MODULES_FIELD_CLIENT_ID_LABEL'); ?>">
<?php echo $this->item->client_id == 0 ? JText::_('JSITE') : JText::_('JADMINISTRATOR'); ?>
</span>
</div>
<div>
<?php
$short_description = JText::_($this->item->xml->description);
$this->fieldset = 'description';
$long_description = JLayoutHelper::render('joomla.edit.fieldset', $this);
if ( ! $long_description)
{
$truncated = JHtmlString::truncate($short_description, 550, true, false);
if (strlen($truncated) > 500)
{
$long_description = $short_description;
$short_description = JHtmlString::truncate($truncated, 250);
if ($short_description == $long_description)
{
$long_description = '';
}
}
}
?>
<p><?php echo $short_description; ?></p>
<?php if ($long_description) : ?>
<p class="readmore">
<a href="#" onclick="jQuery('.nav-tabs a[href=#description]').tab('show');">
<?php echo JText::_('JGLOBAL_SHOW_FULL_DESCRIPTION'); ?>
</a>
</p>
<?php endif; ?>
</div>
<?php endif; ?>
<?php else : ?>
<div class="alert alert-error"><?php echo JText::_('COM_MODULES_ERR_XML'); ?></div>
<?php endif; ?>
<?php
if ($hasContent)
{
echo $this->form->getInput($hasContentFieldName);
}
$this->fieldset = 'basic';
$html = JLayoutHelper::render('joomla.edit.fieldset', $this);
echo $html ? '<hr>' . $html : '';
?>
</div>
<div class="span3">
<fieldset class="form-vertical">
<?php echo $this->form->renderField('showtitle'); ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('position'); ?>
</div>
<div class="controls">
<?php echo $this->loadTemplate('positions'); ?>
</div>
</div>
</fieldset>
<?php
// Set main fields.
$this->fields = [
'published',
'access',
'ordering',
'note',
];
?>
<?php echo JLayoutHelper::render('joomla.edit.global', $this); ?>
<?php if ($this->item->client_id == 0) : ?>
<fieldset class="form-vertical">
<?php if ($this->config->show_category) : ?>
<?php echo $this->render($this->assignments, 'category'); ?>
<?php endif; ?>
<?php if ($this->config->show_color) : ?>
<div class="control-group">
<div class="control-label">
<label id="advancedparams_color-lbl" for="advancedparams_color" class="hasTooltip" title=""
data-original-title="<strong><?php echo JText::_('AMM_COLOR', true); ?></strong><br><?php echo JText::_('AMM_COLOR_DESC', true); ?>">
<?php echo JText::_('AMM_COLOR'); ?>
</label>
</div>
<div class="controls">
<?php
include_once(JPATH_LIBRARIES . '/joomla/form/fields/color.php');
$colorfield = new JFormFieldColor;
$color = (isset($this->item->advancedparams['color']) && $this->item->advancedparams['color'])
? str_replace('##', '#', $this->item->advancedparams['color'])
: 'none';
$element = new SimpleXMLElement(
'<field
name="advancedparams[color]"
id="advancedparams_color"
type="color"
control="simple"
default=""
colors="' . (isset($this->config->main_colors) ? $this->config->main_colors : '') . '"
split="4"
/>'
);
$element->value = $color;
$colorfield->setup($element, $color);
echo $colorfield->__get('input');
?>
</div>
</div>
<?php endif; ?>
<?php echo $this->render($this->assignments, 'pre_post_html'); ?>
<?php if ($this->config->show_hideempty) : ?>
<?php echo $this->render($this->assignments, 'hideempty'); ?>
<?php endif; ?>
</fieldset>
<?php endif; ?>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php if (isset($long_description) && $long_description != '') : ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'description', JText::_('JGLOBAL_FIELDSET_DESCRIPTION')); ?>
<?php echo $long_description; ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php if ($this->item->client_id == 0) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'assignment', JText::_('AMM_ASSIGNMENTS')); ?>
<?php echo $this->loadTemplate('assignment'); ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php if ($this->config->show_notes) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'notes', JText::_('AMM_NOTES')); ?>
<div class="form-vertical">
<?php echo $this->render($this->assignments, 'notes'); ?>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php if ($this->canDo->get('core.admin')) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'permissions', JText::_('COM_MODULES_FIELDSET_RULES')); ?>
<?php echo $this->form->getInput('rules'); ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php
$this->fieldsets = [];
$this->ignore_fieldsets = ['basic', 'description'];
echo JLayoutHelper::render('joomla.edit.params', $this);
?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
<?php echo $this->hidden_fields; ?>
<input type="hidden" name="task" value="">
<?php echo JHtml::_('form.token'); ?>
<?php echo $this->form->getInput('module'); ?>
<?php echo $this->form->getInput('client_id'); ?>
<?php if ($this->config->show_switch) : ?>
<div style="text-align:right">
<a href="<?php echo JRoute::_('index.php?option=com_modules&force=1&task=module.edit&id=' . (int) $this->item->id); ?>"><?php echo JText::_('AMM_SWITCH_TO_CORE'); ?></a>
</div>
<?php endif; ?>
</div>
</form>

View File

@ -0,0 +1,80 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use RegularLabs\Library\Extension as RL_Extension;
jimport('joomla.filesystem.file');
$this->config->show_assignto_groupusers = (int) (
$this->config->show_assignto_usergrouplevels
);
$assignments = [
'menuitems',
'homepage',
'date',
'groupusers',
'languages',
'templates',
'urls',
'devices',
'os',
'browsers',
'components',
'tags',
'content',
];
foreach ($assignments as $i => $ass)
{
if ($ass != 'menuitems' && ( ! isset($this->config->{'show_assignto_' . $ass}) || ! $this->config->{'show_assignto_' . $ass}))
{
unset($assignments[$i]);
}
}
$html = [];
$html[] = $this->render($this->assignments, 'assignments');
$html[] = $this->render($this->assignments, 'mirror_module');
$html[] = '<div class="clear"></div>';
$html[] = '<div id="' . rand(1000000, 9999999) . '___mirror_module.0" class="rl_toggler">';
if (count($assignments) > 1)
{
$html[] = $this->render($this->assignments, 'match_method');
$html[] = $this->render($this->assignments, 'show_assignments');
}
else
{
$html[] = '<input type="hidden" name="show_assignments" value="1">';
}
foreach ($assignments as $ass)
{
$html[] = $this->render($this->assignments, 'assignto_' . $ass);
}
$show_assignto_users = 0;
$html[] = '<input type="hidden" name="show_users" value="' . $show_assignto_users . '">';
$html[] = '<input type="hidden" name="show_usergrouplevels" value="' . (int) $this->config->show_assignto_usergrouplevels . '">';
$html[] = '</div>';
echo implode("\n\n", $html);

View File

@ -0,0 +1,45 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<?php
echo JHtml::_('bootstrap.startAccordion', 'moduleOptions', ['active' => 'collapse0']);
$fieldSets = $this->form->getFieldsets('params');
$i = 0;
foreach ($fieldSets as $name => $fieldSet) :
$label = ! empty($fieldSet->label) ? $fieldSet->label : 'COM_MODULES_' . $name . '_FIELDSET_LABEL';
$class = ! empty($fieldSet->class) ? $fieldSet->class : '';
echo JHtml::_('bootstrap.addSlide', 'moduleOptions', JText::_($label), 'collapse' . ($i++), $class);
if (isset($fieldSet->description) && trim($fieldSet->description)) :
echo '<p class="tip">' . $this->escape(JText::_($fieldSet->description)) . '</p>';
endif;
?>
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
<div class="control-group">
<div class="control-label">
<?php echo $field->label; ?>
</div>
<div class="controls">
<?php echo $field->input; ?>
</div>
</div>
<?php endforeach;
echo JHtml::_('bootstrap.endSlide');
endforeach;
echo JHtml::_('bootstrap.endAccordion');

View File

@ -0,0 +1,31 @@
<?php
/**
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('TemplatesHelper', JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php');
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
$clientId = $this->item->client_id;
$state = 1;
$selectedPosition = $this->item->position;
$positions = JHtml::_('modules.positions', $clientId, $state, $selectedPosition);
// Add custom position to options
$customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION');
// Build field
$attr = [
'id' => 'jform_position',
'list.select' => $this->item->position,
'list.attr' => 'class="chzn-custom-value" '
. 'data-custom_group_text="' . $customGroupText . '" '
. 'data-no_results_text="' . JText::_('COM_MODULES_ADD_CUSTOM_POSITION') . '" '
. 'data-placeholder="' . JText::_('COM_MODULES_TYPE_OR_SELECT_POSITION') . '" ',
];
echo JHtml::_('select.groupedlist', $positions, 'jform[position]', $attr);

View File

@ -0,0 +1,33 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<div class="btn-toolbar">
<div class="btn-group">
<button type="button" class="btn btn-primary" onclick="Joomla.submitbutton('module.save');">
<?php echo JText::_('JSAVE'); ?></button>
</div>
<div class="btn-group">
<button type="button" class="btn btn-default" onclick="Joomla.submitbutton('module.cancel');">
<?php echo JText::_('JCANCEL'); ?></button>
</div>
<div class="clear"></div>
</div>
<?php
$this->setLayout('edit');
echo $this->loadTemplate();

View File

@ -0,0 +1,204 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use RegularLabs\Library\Parameters as RL_Parameters;
use RegularLabs\Library\RegEx as RL_RegEx;
use RegularLabs\Library\StringHelper as RL_String;
/**
* View to edit a module.
*/
class AdvancedModulesViewModule extends JViewLegacy
{
protected $form;
protected $item;
protected $state;
/**
* Display the view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
public function display($tpl = null)
{
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$this->canDo = JHelperContent::getActions('com_modules', 'module', $this->item->id);
$this->getConfig();
$this->getAssignments();
if ( ! isset($this->item->published) || $this->item->published == '')
{
$this->item->published = $this->config->default_state;
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
if (RL_RegEx::match('_gk[1-9]', $this->item->module))
{
// Set message for Gavick modules
JFactory::getApplication()->enqueueMessage(JText::sprintf(RL_String::html_entity_decoder(JText::_('AMM_MODULE_INCOMPATIBLE')), '<a href="index.php?option=com_modules&force=1&task=module.edit&id=' . (int) $this->item->id . '">', '</a>'), 'warning');
}
$this->addToolbar();
parent::display($tpl);
}
/**
* Function that gets the config settings
*
* @return Object
*/
protected function getConfig()
{
if (isset($this->config))
{
return $this->config;
}
$this->config = RL_Parameters::getInstance()->getComponentParams('advancedmodules');
return $this->config;
}
/**
* Function that gets the config settings
*
* @return Object
*/
protected function getAssignments()
{
if ( ! isset($this->assignments))
{
$xmlfile = JPATH_ADMINISTRATOR . '/components/com_advancedmodules/assignments.xml';
$assignments = new JForm('assignments', ['control' => 'advancedparams']);
$assignments->loadFile($xmlfile, 1, '//config');
$assignments->bind($this->item->advancedparams);
$this->assignments = $assignments;
}
return $this->assignments;
}
/**
* Add the page title and toolbar.
*
* @return void
*/
protected function addToolbar()
{
JFactory::getApplication()->input->set('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = ($this->item->id == 0);
$checkedOut = ! ($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
$canDo = $this->canDo;
$title = $this->item->title . ' [' . $this->item->module . ']';
JToolbarHelper::title(JText::sprintf('AMM_MODULE_EDIT', $title), 'advancedmodulemanager icon-reglab');
// For new records, check the create permission.
if ($isNew && $canDo->get('core.create'))
{
JToolbarHelper::apply('module.apply');
JToolbarHelper::save('module.save');
JToolbarHelper::save2new('module.save2new');
JToolbarHelper::cancel('module.cancel');
}
else
{
// Can't save the record if it's checked out.
if ( ! $checkedOut)
{
// Since it's an existing record, check the edit permission.
if ($canDo->get('core.edit'))
{
JToolbarHelper::apply('module.apply');
JToolbarHelper::save('module.save');
// We can save this record, but check the create permission to see if we can return to make a new one.
if ($canDo->get('core.create'))
{
JToolbarHelper::save2new('module.save2new');
}
}
}
// If checked out, we can still save
if ($canDo->get('core.create'))
{
JToolbarHelper::save2copy('module.save2copy');
}
JToolbarHelper::cancel('module.cancel', 'JTOOLBAR_CLOSE');
}
$tmpl = JFactory::getApplication()->input->get('tmpl');
if ($tmpl != 'component')
{
// Get the help information for the menu item.
$lang = JFactory::getLanguage();
$help = $this->get('Help');
if ($lang->hasKey($help->url))
{
$debug = $lang->setDebug(false);
$url = JText::_($help->url);
$lang->setDebug($debug);
}
else
{
$url = null;
}
JToolbarHelper::help($help->key, false, $url);
}
}
protected function render(&$form, $name = '')
{
$items = [];
foreach ($form->getFieldset($name) as $field)
{
$items[] = '<div class="control-group"><div class="control-label">'
. $field->label
. '</div><div class="controls">'
. $field->input
. '</div></div>';
}
if (empty ($items))
{
return '';
}
return implode('', $items);
}
}

View File

@ -0,0 +1,64 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* View to edit a module.
*
* @package Joomla.Administrator
* @subpackage com_templates
* @since 3.2
*/
class AdvancedModulesViewModule extends JViewLegacy
{
protected $item;
protected $form;
protected $state;
/**
* Display the view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
try
{
$this->item = $this->get('Item');
}
catch (Exception $e)
{
$app->enqueueMessage($e->getMessage(), 'error');
return false;
}
$paramsList = $this->item->getProperties();
unset($paramsList['xml']);
$paramsList = json_encode($paramsList);
return $paramsList;
}
}

View File

@ -0,0 +1,403 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use RegularLabs\Library\Document as RL_Document;
use RegularLabs\Library\License as RL_License;
use RegularLabs\Library\Version as RL_Version;
JHtml::_('bootstrap.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');
$client = $this->state->get('filter.client_id') ? 'administrator' : 'site';
$user = JFactory::getUser();
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$trashed = $this->state->get('filter.state') == -2 ? true : false;
$canOrder = $user->authorise('core.edit.state', 'com_modules');
$saveOrder = ($listOrder == 'ordering');
$langs = JLanguage::getKnownLanguages(constant('JPATH_' . strtoupper($client)));
if ($saveOrder)
{
$saveOrderingUrl = 'index.php?option=com_advancedmodules&task=modules.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'moduleList', 'adminForm', strtolower($listDirn), $saveOrderingUrl);
}
$showcolors = ($client == 'site' && $this->config->show_color);
if ($showcolors)
{
$script = "
function setColor(id, el) {
var f = document.getElementById('adminForm');
f.setcolor.value = jQuery(el).val();
listItemTask(id, 'modules.setcolor');
}
";
RL_Document::scriptDeclaration($script);
}
RL_Document::style('regularlabs/style.min.css');
?>
<form action="<?php echo JRoute::_('index.php?option=com_advancedmodules'); ?>" method="post" name="adminForm" id="adminForm">
<?php if ( ! empty($this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<?php endif; ?>
<div id="j-main-container"<?php echo ( ! empty($this->sidebar)) ? ' class="span10"' : ''; ?>>
<?php
// Version check
if ($this->config->show_update_notification)
{
echo RL_Version::getMessage('ADVANCED_MODULE_MANAGER');
}
?>
<div class="clear"></div>
<?php
// Search tools bar and filters
$searchtool = JLayoutHelper::render('joomla.searchtools.default', ['view' => $this]);
$searchtool = str_replace(
'<div class="btn-wrapper hidden-phone',
'<div class="clearfix visible-phone"></div><div class="btn-wrapper clearfix',
$searchtool
);
$searchtool = str_replace('js-stools-container-filters hidden-phone', 'js-stools-container-filters', $searchtool);
echo $searchtool;
?>
<?php if (empty($this->items)) : ?>
<div class="alert alert-no-items">
<?php echo JText::_('COM_MODULES_MSG_MANAGE_NO_MODULES'); ?>
</div>
<?php else : ?>
<?php $cols = 10; ?>
<table class="table table-striped rl_tablelist" id="moduleList">
<thead>
<tr>
<th width="1%" class="nowrap center hidden-phone">
<?php echo JHtml::_('searchtools.sort', '', 'ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
</th>
<th width="1%" class="nowrap center">
<?php echo JHtml::_('grid.checkall'); ?>
</th>
<th width="1%" class="nowrap center" style="min-width:55px">
<?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
</th>
<?php if ($showcolors) : ?>
<?php $cols++; ?>
<th width="1%" class="nowrap center hidden-phone">
<?php echo JHtml::_('searchtools.sort', '', 'color', $listDirn, $listOrder, null, 'asc', 'AMM_COLOR', 'icon-color'); ?>
</th>
<?php endif; ?>
<th class="title">
<?php echo JHtml::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
</th>
<?php if ($this->config->show_note == 3) : ?>
<?php $cols++; ?>
<th class="title">
<?php echo JHtml::_('searchtools.sort', 'JGLOBAL_DESCRIPTION', 'a.note', $listDirn, $listOrder); ?>
</th>
<?php endif; ?>
<th width="15%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'COM_MODULES_HEADING_POSITION', 'position', $listDirn, $listOrder); ?>
</th>
<th width="10%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'COM_MODULES_HEADING_MODULE', 'name', $listDirn, $listOrder); ?>
</th>
<?php if ($client == 'site') : ?>
<?php if ($this->config->show_category) : ?>
<th width="10%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'JCATEGORY', 'aa.category', $listDirn, $listOrder); ?>
</th>
<?php endif; ?>
<th width="10%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'RL_MENU_ITEMS', 'menuid', $listDirn, $listOrder); ?>
</th>
<?php endif; ?>
<th width="10%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
</th>
<th width="10%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'a.language', $listDirn, $listOrder); ?>
</th>
<th width="1%" class="nowrap center hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="<?php echo $cols; ?>">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) : ?>
<?php
$ordering = ($listOrder == 'ordering');
$canCreate = $user->authorise('core.create', 'com_modules');
$canEdit = $user->authorise('core.edit', 'com_modules.module.' . $item->id);
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || $item->checked_out == 0;
$canChange = $user->authorise('core.edit.state', 'com_modules.module.' . $item->id) && $canCheckin;
?>
<tr class="row<?php echo $i % 2; ?>" sortable-group-id="<?php echo $item->position ? $item->position : 'none'; ?>">
<td class="order nowrap center hidden-phone">
<?php
$iconClass = '';
if ( ! $canChange)
{
$iconClass = ' inactive';
}
elseif ( ! $saveOrder)
{
$iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
}
?>
<span class="sortable-handler<?php echo $iconClass ?>">
<span class="icon-menu"></span>
</span>
<?php if ($canChange && $saveOrder) : ?>
<input type="text" style="display:none" name="order[]" size="5" value="<?php echo $item->ordering; ?>"
class="width-20 text-area-order">
<?php endif; ?>
</td>
<td class="center">
<?php if ($item->enabled > 0) : ?>
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
<?php endif; ?>
</td>
<td class="center">
<div class="btn-group">
<?php // Check if extension is enabled ?>
<?php if ($item->enabled > 0) : ?>
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'modules.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?>
<?php
// Create dropdown items
JHtml::_('actionsdropdown.duplicate', 'cb' . $i, 'modules');
$action = $trashed ? 'untrash' : 'trash';
JHtml::_('actionsdropdown.' . $action, 'cb' . $i, 'modules');
// Render dropdown list
echo JHtml::_('actionsdropdown.render', $this->escape($item->title));
?>
<?php else : ?>
<?php // Extension is not enabled, show a message that indicates this. ?>
<button class="btn-micro hasTooltip" title="<?php echo JText::_('COM_MODULES_MSG_MANAGE_EXTENSION_DISABLED'); ?>">
<i class="icon-ban-circle"></i></button>
<?php endif; ?>
</div>
</td>
<?php if ($showcolors) : ?>
<td class="center inlist">
<?php
include_once(JPATH_LIBRARIES . '/joomla/form/fields/color.php');
$colorfield = new JFormFieldColor;
$color = (isset($item->params->color) && $item->params->color)
? $color = str_replace('##', '#', $item->params->color)
: 'none';
$onchange = 'setColor(\'cb' . $i . '\', this)';
// For J3.7+ the onchange value needs to actually contain the onchange attribute name... nuts!
if (JVERSION >= 3.7)
{
$onchange = ' onchange=&quot;' . $onchange . '&quot;';
}
$element = new SimpleXMLElement(
'<field
name="color_' . $i . '"
type="color"
control="simple"
default=""
colors="' . (isset($this->config->main_colors) ? $this->config->main_colors : '') . '"
split="4"
onchange="' . $onchange . '"
/>'
);
$element->value = $color;
$colorfield->setup($element, $color);
echo $colorfield->__get('input');
?>
</td>
<?php endif; ?>
<td class="has-context">
<div class="pull-right small visible-phone">
<?php if ($item->position) : ?>
<span class="label label-info">
<?php echo $item->position; ?>
</span>
<?php else : ?>
<span class="label">
<?php echo JText::_('JNONE'); ?>
</span>
<?php endif; ?>
</div>
<div class="pull-left">
<?php if ($item->checked_out) : ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'modules.', $canCheckin); ?>
<?php endif; ?>
<?php
$title = $this->escape($item->title);
$tooltip = '<strong>' . JText::_('AMM_EDIT_MODULE') . '</strong><br>' . htmlspecialchars($title);
if ( ! empty($item->note) && $this->config->show_note == 1)
{
$tooltip .= '<br><em>' . htmlspecialchars($this->escape($item->note)) . '</em>';
}
$title = '<span rel="tooltip" title="' . $tooltip . '">' . $title . '</span>';
?>
<?php if ($canEdit) : ?>
<a href="<?php echo JRoute::_('index.php?option=com_advancedmodules&task=module.edit&id=' . (int) $item->id); ?>">
<?php echo $title; ?></a>
<?php else : ?>
<?php echo $title; ?>
<?php endif; ?>
<div class="small visible-phone">
<span class="">
<?php echo $item->name; ?>
</span>
</div>
<?php if ( ! empty($item->note) && $this->config->show_note == 2) : ?>
<div class="small">
<?php echo $this->escape($item->note); ?>
</div>
<?php endif; ?>
</div>
</td>
<?php if ($this->config->show_note == 3) : ?>
<td class="has-context">
<?php echo $this->escape($item->note); ?>
</td>
<?php endif; ?>
<td class="small hidden-phone">
<?php if ($item->position) : ?>
<span class="label label-info">
<?php echo $item->position; ?>
</span>
<?php else : ?>
<span class="label">
<?php echo JText::_('JNONE'); ?>
</span>
<?php endif; ?>
</td>
<td class="small hidden-phone">
<?php echo $item->name; ?>
</td>
<?php if ($client == 'site') : ?>
<?php if ($this->config->show_category) : ?>
<td class="small hidden-phone">
<?php echo $item->category; ?>
</td>
<?php endif; ?>
<td class="small hidden-phone">
<?php echo $item->menuid; ?>
</td>
<?php endif; ?>
<td class="small hidden-phone">
<?php echo $this->escape($item->access_level); ?>
</td>
<td class="small hidden-phone">
<?php
if (empty($item->language))
{
echo JText::_('JDEFAULT');
}
elseif ($item->language == '*')
{
$advanced_params = json_decode($item->advancedparams);
if ( ! empty($advanced_params->assignto_languages) && $advanced_params->assignto_languages == 2)
{
$text = JText::_('COM_MODULES_ASSIGNED_VARIES_EXCEPT');
}
else if ( ! empty($advanced_params->assignto_languages) && ! empty($advanced_params->assignto_languages_selection))
{
$text = JText::_('COM_MODULES_ASSIGNED_VARIES_ONLY');
}
else
{
$text = JText::alt('JALL', 'language');
}
echo $text;
}
else
{
echo $item->language_title
? JHtml::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, ['title' => $item->language_title], true) . '&nbsp;' . $this->escape($item->language_title)
: ((isset($langs[$item->language]) && ! empty($langs[$item->language]['name']))
? $this->escape($langs[$item->language]['name'])
: JText::_('JUNDEFINED')
);
}
?>
</td>
<td class="hidden-phone">
<?php echo (int) $item->id; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<?php // Load the batch processing form. ?>
<?php if ($user->authorise('core.create', 'com_modules')
&& $user->authorise('core.edit', 'com_modules')
&& $user->authorise('core.edit.state', 'com_modules')
) : ?>
<?php echo JHtml::_(
'bootstrap.renderModal',
'collapseModal',
[
'title' => JText::_('COM_MODULES_BATCH_OPTIONS'),
'footer' => $this->loadTemplate('batch_footer'),
],
$this->loadTemplate('batch_body')
); ?>
<?php endif; ?>
<input type="hidden" name="task" value="">
<input type="hidden" name="boxchecked" value="0">
<input type="hidden" name="setcolor" value="">
<?php echo JHtml::_('form.token'); ?>
<?php if ($this->config->show_switch) : ?>
<div style="text-align:right">
<a href="<?php echo JRoute::_('index.php?option=com_modules&force=1'); ?>"><?php echo JText::_('AMM_SWITCH_TO_CORE'); ?></a>
</div>
<?php endif; ?>
<?php
// PRO Check
echo RL_License::getMessage('ADVANCED_MODULE_MANAGER');
// Copyright
echo RL_Version::getFooter('ADVANCED_MODULE_MANAGER');
?>
</div>
</form>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_MODULES_MODULES_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_MODULES_MODULES_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>

View File

@ -0,0 +1,78 @@
<?php
/**
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @deprecated 3.4 Use default_batch_body and default_batch_footer
*/
defined('_JEXEC') or die;
$clientId = $this->state->get('filter.client_id');
// Show only Module Positions of published Templates
$published = 1;
$positions = JHtml::_('modules.positions', $clientId, $published);
$positions['']['items'][] = ModulesHelper::createOption('nochange', JText::_('COM_MODULES_BATCH_POSITION_NOCHANGE'));
$positions['']['items'][] = ModulesHelper::createOption('noposition', JText::_('COM_MODULES_BATCH_POSITION_NOPOSITION'));
// Add custom position to options
$customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION');
// Build field
$attr = [
'id' => 'batch-position-id',
'list.attr' => 'class="chzn-custom-value input-xlarge" '
. 'data-custom_group_text="' . $customGroupText . '" '
. 'data-no_results_text="' . JText::_('COM_MODULES_ADD_CUSTOM_POSITION') . '" '
. 'data-placeholder="' . JText::_('COM_MODULES_TYPE_OR_SELECT_POSITION') . '" ',
];
?>
<div class="modal hide fade" id="collapseModal">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&#215;</button>
<h3><?php echo JText::_('COM_MODULES_BATCH_OPTIONS'); ?></h3>
</div>
<div class="modal-body modal-batch">
<p><?php echo JText::_('COM_MODULES_BATCH_TIP'); ?></p>
<div class="row-fluid">
<div class="control-group span6">
<div class="controls">
<?php echo JHtml::_('batch.language'); ?>
</div>
</div>
<div class="control-group span6">
<div class="controls">
<?php echo JHtml::_('batch.access'); ?>
</div>
</div>
</div>
<div class="row-fluid">
<?php if ($published >= 0) : ?>
<div class="span6">
<div class="controls">
<label id="batch-choose-action-lbl" for="batch-choose-action">
<?php echo JText::_('COM_MODULES_BATCH_POSITION_LABEL'); ?>
</label>
<div id="batch-choose-action" class="control-group">
<?php echo JHtml::_('select.groupedlist', $positions, 'batch[position_id]', $attr) ?>
<div id="batch-move-copy" class="control-group radio">
<?php echo JHtml::_('modules.batchOptions'); ?>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-default" type="button" onclick="document.getElementById('batch-position-id').value='';document.getElementById('batch-access').value='';document.getElementById('batch-language-id').value=''" data-dismiss="modal">
<?php echo JText::_('JCANCEL'); ?>
</button>
<button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('module.batch');">
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
</button>
</div>
</div>

View File

@ -0,0 +1,62 @@
<?php
/**
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$clientId = $this->state->get('filter.client_id');
// Show only Module Positions of published Templates
$published = 1;
$positions = JHtml::_('modules.positions', $clientId, $published);
$positions['']['items'][] = ModulesHelper::createOption('nochange', JText::_('COM_MODULES_BATCH_POSITION_NOCHANGE'));
$positions['']['items'][] = ModulesHelper::createOption('noposition', JText::_('COM_MODULES_BATCH_POSITION_NOPOSITION'));
// Add custom position to options
$customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION');
// Build field
$attr = [
'id' => 'batch-position-id',
'list.attr' => 'class="chzn-custom-value input-xlarge" '
. 'data-custom_group_text="' . $customGroupText . '" '
. 'data-no_results_text="' . JText::_('COM_MODULES_ADD_CUSTOM_POSITION') . '" '
. 'data-placeholder="' . JText::_('COM_MODULES_TYPE_OR_SELECT_POSITION') . '" ',
];
?>
<p><?php echo JText::_('COM_MODULES_BATCH_TIP'); ?></p>
<div class="row-fluid">
<div class="control-group span6">
<div class="controls">
<?php echo JHtml::_('batch.language'); ?>
</div>
</div>
<div class="control-group span6">
<div class="controls">
<?php echo JHtml::_('batch.access'); ?>
</div>
</div>
</div>
<div class="row-fluid">
<?php if ($published >= 0) : ?>
<div class="span6">
<div class="controls">
<label id="batch-choose-action-lbl" for="batch-choose-action">
<?php echo JText::_('COM_MODULES_BATCH_POSITION_LABEL'); ?>
</label>
<div id="batch-choose-action" class="control-group">
<?php echo JHtml::_('select.groupedlist', $positions, 'batch[position_id]', $attr) ?>
<div id="batch-copy-move" class="control-group radio">
<?php echo JHtml::_('modules.batchOptions'); ?>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>

View File

@ -0,0 +1,18 @@
<?php
/**
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<a class="btn btn-default" type="button"
onclick="document.getElementById('batch-position-id').value='';document.getElementById('batch-access').value='';document.getElementById('batch-language-id').value=''"
data-dismiss="modal">
<?php echo JText::_('JCANCEL'); ?>
</a>
<button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('module.batch');">
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
</button>

View File

@ -0,0 +1,165 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
if (JFactory::getApplication()->isClient('site'))
{
JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
}
use RegularLabs\Library\Document as RL_Document;
JHtml::_('behavior.core');
JHtml::_('bootstrap.tooltip', '.hasTooltip', ['placement' => 'bottom']);
JHtml::_('bootstrap.popover', '.hasPopover', ['placement' => 'bottom']);
JHtml::_('formbehavior.chosen', 'select');
// Special case for the search field tooltip.
$searchFilterDesc = $this->filterForm->getFieldAttribute('search', 'description', null, 'filter');
JHtml::_('bootstrap.tooltip', '#filter_search', ['title' => JText::_($searchFilterDesc), 'placement' => 'bottom']);
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$editor = JFactory::getApplication()->input->get('editor', '', 'cmd');
RL_Document::scriptDeclaration('
moduleIns = function(type, name) {
window.parent.jInsertEditorText("{loadmodule " + type + "," + name + "}", "' . $editor . '");
window.parent.jModalClose();
};
modulePosIns = function(position) {
window.parent.jInsertEditorText("{loadposition " + position + "}", "' . $editor . '");
window.parent.jModalClose();
};');
$link = 'index.php?option=com_advancedmodules&view=modules&layout=modal&tmpl=component&' . JSession::getFormToken() . '=1';
if ( ! empty($editor))
{
$link .= '&editor=' . $editor;
}
$link .= '&' . JSession::getFormToken() . '=1';
?>
<div class="container-popup">
<form action="<?php echo JRoute::_($link); ?>" method="post" name="adminForm" id="adminForm">
<?php echo JLayoutHelper::render('joomla.searchtools.default', ['view' => $this]); ?>
<div class="clearfix"></div>
<?php if (empty($this->items)) : ?>
<div class="alert alert-no-items">
<?php echo JText::_('COM_MODULES_MSG_MANAGE_NO_MODULES'); ?>
</div>
<?php else : ?>
<table class="table table-striped" id="moduleList">
<thead>
<tr>
<th width="1%" class="nowrap center">
<?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
</th>
<th class="title">
<?php echo JHtml::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
</th>
<th width="15%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'COM_MODULES_HEADING_POSITION', 'a.position', $listDirn, $listOrder); ?>
</th>
<th width="10%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'COM_MODULES_HEADING_MODULE', 'name', $listDirn, $listOrder); ?>
</th>
<th width="10%" class="nowrap hidden-phone hidden-tablet">
<?php echo JHtml::_('searchtools.sort', 'COM_MODULES_HEADING_PAGES', 'pages', $listDirn, $listOrder); ?>
</th>
<th width="10%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'ag.title', $listDirn, $listOrder); ?>
</th>
<th width="10%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'l.title', $listDirn, $listOrder); ?>
</th>
<th width="1%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="8">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php
$iconStates = [
-2 => 'icon-trash',
0 => 'icon-unpublish',
1 => 'icon-publish',
2 => 'icon-archive',
];
foreach ($this->items as $i => $item) :
?>
<tr class="row<?php echo $i % 2; ?>">
<td class="center">
<span class="<?php echo $iconStates[$this->escape($item->published)]; ?>"></span>
</td>
<td class="has-context">
<a class="btn btn-small btn-block btn-success" href="#" onclick="moduleIns('<?php echo $this->escape($item->module); ?>', '<?php echo $this->escape($item->title); ?>');"><?php echo $this->escape($item->title); ?></a>
</td>
<td class="small hidden-phone">
<?php if ($item->position) : ?>
<a class="btn btn-small btn-block btn-warning" href="#" onclick="modulePosIns('<?php echo $this->escape($item->position); ?>');"><?php echo $this->escape($item->position); ?></a>
<?php else : ?>
<span class="label"><?php echo JText::_('JNONE'); ?></span>
<?php endif; ?>
</td>
<td class="small hidden-phone">
<?php echo $item->name; ?>
</td>
<td class="small hidden-phone hidden-tablet">
<?php echo $item->pages; ?>
</td>
<td class="small hidden-phone">
<?php echo $this->escape($item->access_level); ?>
</td>
<td class="small hidden-phone">
<?php if ($item->language == '') : ?>
<?php echo JText::_('JDEFAULT'); ?>
<?php elseif ($item->language == '*') : ?>
<?php echo JText::alt('JALL', 'language'); ?>
<?php else : ?>
<?php echo $item->language_title ? JHtml::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, ['title' => $item->language_title], true) . '&nbsp;' . $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?>
<?php endif; ?>
</td>
<td class="hidden-phone">
<?php echo (int) $item->id; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="editor" value="<?php echo $editor; ?>" />
<?php echo JHtml::_('form.token'); ?>
</form>
</div>

View File

@ -0,0 +1,215 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use RegularLabs\Library\Parameters as RL_Parameters;
/**
* View class for a list of modules.
*/
class AdvancedModulesViewModules extends JViewLegacy
{
protected $items;
protected $pagination;
protected $state;
/**
* Display the view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
$this->getConfig();
foreach ($this->items as $i => $item)
{
$this->items[$i]->params = json_decode($item->advancedparams);
if (is_null($this->items[$i]->params))
{
$this->items[$i]->params = (object) [];
}
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
if (JFactory::getApplication()->input->get('layout') != 'modal')
{
$this->addToolbar();
}
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
parent::display($tpl);
}
/**
* Function that gets the config settings
*
* @return Object
*/
protected function getConfig()
{
if (isset($this->config))
{
return $this->config;
}
$this->config = RL_Parameters::getInstance()->getComponentParams('advancedmodules');
return $this->config;
}
/**
* Add the page title and toolbar.
*
* @return void
*/
protected function addToolbar()
{
$state = $this->get('State');
$canDo = JHelperContent::getActions('com_modules');
$user = JFactory::getUser();
// Get the toolbar object instance
$bar = JToolbar::getInstance('toolbar');
if ($this->config->list_title)
{
JToolbarHelper::title(
JText::_(
$state->get('filter.client_id') ? 'COM_MODULES_MANAGER_MODULES_ADMIN' : 'COM_MODULES_MANAGER_MODULES_SITE'
),
'cube module'
);
}
else
{
JToolbarHelper::title(
JText::_('AMM_ADVANCED_MODULE_MANAGER'),
'advancedmodulemanager icon-reglab'
);
}
if ($canDo->get('core.create'))
{
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('toolbar.newmodule');
$bar->appendButton('Custom', $layout->render([]), 'new');
}
if ($canDo->get('core.edit'))
{
JToolbarHelper::editList('module.edit');
}
if ($canDo->get('core.create'))
{
JToolbarHelper::custom('modules.duplicate', 'copy', 'copy_f2', 'JTOOLBAR_DUPLICATE', true);
}
if ($canDo->get('core.edit.state'))
{
JToolbarHelper::publish('modules.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('modules.unpublish', 'JTOOLBAR_UNPUBLISH', true);
JToolbarHelper::checkin('modules.checkin');
}
if ($state->get('filter.state') == -2 && $canDo->get('core.delete'))
{
JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'modules.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($canDo->get('core.edit.state'))
{
JToolbarHelper::trash('modules.trash');
}
// Add a batch button
if ($user->authorise('core.create', 'com_modules')
&& $user->authorise('core.edit', 'com_modules')
&& $user->authorise('core.edit.state', 'com_modules')
)
{
JHtml::_('bootstrap.modal', 'collapseModal');
$title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button
$layout = new JLayoutFile('joomla.toolbar.batch');
$dhtml = $layout->render(['title' => $title]);
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($canDo->get('core.admin'))
{
JToolbarHelper::preferences('com_advancedmodules', 600, 900);
}
JToolbarHelper::help('JHELP_EXTENSIONS_MODULE_MANAGER');
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array Array containing the field name to sort by as the key and display text as value
*/
protected function getSortFields()
{
$fields = [
'ordering' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'),
'color' => JText::_('AMM_COLOR'),
'a.title' => JText::_('JGLOBAL_TITLE'),
'position' => JText::_('COM_MODULES_HEADING_POSITION'),
'name' => JText::_('COM_MODULES_HEADING_MODULE'),
'menuid' => JText::_('RL_MENU_ITEMS'),
'a.access' => JText::_('JGRID_HEADING_ACCESS'),
'language_title' => JText::_('JGRID_HEADING_LANGUAGE'),
'a.id' => JText::_('JGRID_HEADING_ID'),
];
if ($this->getLayout() != 'default')
{
unset($fields['ordering']);
unset($fields['a.published']);
unset($fields['color']);
}
if ($this->state->get('filter.client_id') != 'site')
{
unset($fields['menuid']);
}
return $fields;
}
}

View File

@ -0,0 +1,115 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('formbehavior.chosen', 'select');
$function = JFactory::getApplication()->input->getCmd('function', 'jSelectPosition');
$lang = JFactory::getLanguage();
$ordering = $this->escape($this->state->get('list.ordering'));
$direction = $this->escape($this->state->get('list.direction'));
$clientId = $this->state->get('client_id');
$state = $this->state->get('filter.state');
$template = $this->state->get('filter.template');
$type = $this->state->get('filter.type');
?>
<form
action="<?php echo JRoute::_('index.php?option=com_advancedmodules&view=positions&layout=modal&tmpl=component&function=' . $function . '&client_id=' . $clientId); ?>"
method="post" name="adminForm" id="adminForm">
<fieldset class="filter clear">
<div class="left">
<label for="filter_search">
<?php echo JText::_('JSEARCH_FILTER_LABEL'); ?>
</label>
<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" size="30"
title="<?php echo JText::_('COM_MODULES_FILTER_SEARCH_DESC'); ?>">
<button type="submit">
<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?></button>
<button type="button" onclick="document.getElementById('filter_search').value='';this.form.submit();">
<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?></button>
</div>
<div class="right">
<select name="filter_published" class="inputbox" onchange="this.form.submit()">
<option value=""><?php echo JText::_('JOPTION_SELECT_PUBLISHED'); ?></option>
<?php echo JHtml::_('select.options', JHtml::_('modules.templateStates'), 'value', 'text', $published, true); ?>
</select>
<select name="filter_type" class="inputbox" onchange="this.form.submit()">
<option value=""><?php echo JText::_('COM_MODULES_OPTION_SELECT_TYPE'); ?></option>
<?php echo JHtml::_('select.options', JHtml::_('modules.types'), 'value', 'text', $type, true); ?>
</select>
<select name="filter_template" class="inputbox" onchange="this.form.submit()">
<option value=""><?php echo JText::_('JOPTION_SELECT_TEMPLATE'); ?></option>
<?php echo JHtml::_('select.options', JHtml::_('modules.templates', $clientId), 'value', 'text', $template, true); ?>
</select>
</div>
</fieldset>
<table class="adminlist">
<thead>
<tr>
<th class="title" width="20%">
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'value', $direction, $ordering); ?>
</th>
<th>
<?php echo JHtml::_('grid.sort', 'COM_MODULES_HEADING_TEMPLATES', 'templates', $direction, $ordering); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="15">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php $i = 1;
foreach ($this->items as $value => $templates) : ?>
<tr class="row<?php echo $i = 1 - $i; ?>">
<td>
<a class="pointer"
onclick="if (window.parent) window.parent.<?php echo $function; ?>('<?php echo $value; ?>');"><?php echo $this->escape($value); ?></a>
</td>
<td>
<?php if ( ! empty($templates)): ?>
<a class="pointer" onclick="if (window.parent) window.parent.<?php echo $function; ?>('<?php echo $value; ?>');">
<ul>
<?php foreach ($templates as $template => $label): ?>
<li><?php echo $lang->hasKey($label) ? JText::sprintf('COM_MODULES_MODULE_TEMPLATE_POSITION', JText::_($template), JText::_($label)) : JText::_($template); ?></li>
<?php endforeach; ?>
</ul>
</a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $ordering; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $direction; ?>" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>

View File

@ -0,0 +1,47 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* @since 1.6
*/
class AdvancedModulesViewPositions extends JViewLegacy
{
protected $items;
protected $pagination;
protected $state;
/**
* Display the view
*/
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
parent::display($tpl);
}
}

View File

@ -0,0 +1,38 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.0.3
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2017 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<script>
var form = window.top.document.adminForm
var title = form.title.value;
var alltext = window.top.<?php echo $this->editor->getContent('text') ?>;
</script>
<table class="center" width="90%">
<tr>
<td class="contentheading" colspan="2">
<script>document.write(title);</script>
</td>
</tr>
<tr>
<td valign="top" height="90%" colspan="2">
<script>document.write(alltext);</script>
</td>
</tr>
</table>

View File

@ -0,0 +1,37 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.0.3
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2017 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
jimport('joomla.application.component.view');
/**
* HTML View class for the Modules component
*
* @static
* @since 1.6
*/
class AdvancedModulesViewPreview extends JViewLegacy
{
public function display($tpl = null)
{
$editor = JFactory::getConfig()->get('editor');
$this->editor = JEditor::getInstance($editor);
parent::display($tpl);
}
}

View File

@ -0,0 +1,53 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('bootstrap.popover');
?>
<h2><?php echo JText::_('COM_MODULES_TYPE_CHOOSE') ?></h2>
<ul id="new-modules-list" class="list list-striped">
<?php foreach ($this->items as &$item) : ?>
<?php
// Prepare variables for the link.
$link = 'index.php?option=com_advancedmodules&task=module.add&eid=' . $item->extension_id;
$name = $this->escape($item->name);
$desc = JHtml::_('string.truncate', ($this->escape($item->desc)), 200);
$short_desc = JHtml::_('string.truncate', ($this->escape($item->desc)), 90);
?>
<?php if (JFactory::getDocument()->direction != "rtl") : ?>
<li>
<a href="<?php echo JRoute::_($link); ?>">
<strong><?php echo $name; ?></strong>
</a>
<small class="hasPopover" data-placement="right" title="<?php echo $name; ?>"
data-content="<?php echo $desc; ?>"><?php echo $short_desc; ?></small>
</li>
<?php else : ?>
<li>
<small rel="popover" data-placement="left" title="<?php echo $name; ?>" data-content="<?php echo $desc; ?>"><?php echo $short_desc; ?></small>
<a href="<?php echo JRoute::_($link); ?>">
<strong><?php echo $name; ?></strong>
</a>
</li>
<?php endif ?>
<?php endforeach; ?>
</ul>
<div class="clr"></div>

View File

@ -0,0 +1,65 @@
<?php
/**
* @package Advanced Module Manager
* @version 7.7.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML View class for the Modules component
*/
class AdvancedModulesViewSelect extends JViewLegacy
{
protected $state;
protected $items;
/**
* Display the view
*/
public function display($tpl = null)
{
$state = $this->get('State');
$items = $this->get('Items');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
$this->state = &$state;
$this->items = &$items;
$this->addToolbar();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*/
protected function addToolbar()
{
// Add page title
JToolbarHelper::title(JText::_('COM_MODULES_MANAGER_MODULES'), 'advancedmodulemanager icon-reglab');
// Get the toolbar object instance
$bar = JToolbar::getInstance('toolbar');
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('toolbar.cancelselect');
$bar->appendButton('Custom', $layout->render([]), 'new');
}
}

View File

@ -0,0 +1,2 @@
<?php
require_once __DIR__ . '/vendor/autoload.php';

View File

@ -0,0 +1,85 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text as JText;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_AccessLevel extends \RegularLabs\Library\Field
{
public $type = 'AccessLevel';
protected function getInput()
{
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
$show_all = $this->get('show_all');
$use_names = $this->get('use_names');
return $this->selectListAjax(
$this->type, $this->name, $this->value, $this->id,
compact('size', 'multiple', 'show_all', 'use_names')
);
}
function getAjaxRaw(Registry $attributes)
{
$name = $attributes->get('name', $this->type);
$id = $attributes->get('id', strtolower($name));
$value = $attributes->get('value', []);
$size = $attributes->get('size');
$multiple = $attributes->get('multiple');
$options = $this->getOptions(
(bool) $attributes->get('show_all'),
(bool) $attributes->get('use_names')
);
return $this->selectList($options, $name, $value, $id, $size, $multiple);
}
protected function getOptions($show_all = false, $use_names = false)
{
$options = $this->getAccessLevels($use_names);
if ($show_all)
{
$option = (object) [];
$option->value = -1;
$option->text = '- ' . JText::_('JALL') . ' -';
$option->disable = '';
array_unshift($options, $option);
}
return $options;
}
protected function getAccessLevels($use_names = false)
{
$value = $use_names ? 'a.title' : 'a.id';
$query = $this->db->getQuery(true)
->select($value . ' as value, a.title as text')
->from('#__viewlevels AS a')
->group('a.id')
->order('a.ordering ASC');
$this->db->setQuery($query);
return $this->db->loadObjectList();
}
}

View File

@ -0,0 +1,192 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\CMS\Language\Text as JText;
use Joomla\Registry\Registry;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Agents extends \RegularLabs\Library\Field
{
public $type = 'Agents';
protected function getInput()
{
if ( ! is_array($this->value))
{
$this->value = explode(',', $this->value);
}
$size = (int) $this->get('size');
$group = $this->get('group', 'os');
return $this->selectListSimpleAjax(
$this->type, $this->name, $this->value, $this->id,
compact('size', 'group')
);
}
function getAjaxRaw(Registry $attributes)
{
$name = $attributes->get('name', $this->type);
$id = $attributes->get('id', strtolower($name));
$value = $attributes->get('value', []);
$size = $attributes->get('size');
$options = $this->getAgents(
$attributes->get('group')
);
return $this->selectListSimple($options, $name, $value, $id, $size, true);
}
function getAgents($group = 'os')
{
$agents = [];
switch ($group)
{
/* OS */
case 'os':
$agents[] = ['Windows (' . JText::_('JALL') . ')', 'Windows'];
$agents[] = ['Windows 10', 'Windows nt 10.0'];
$agents[] = ['Windows 8', 'Windows nt 6.2'];
$agents[] = ['Windows 7', 'Windows nt 6.1'];
$agents[] = ['Windows Vista', 'Windows nt 6.0'];
$agents[] = ['Windows Server 2003', 'Windows nt 5.2'];
$agents[] = ['Windows XP', 'Windows nt 5.1'];
$agents[] = ['Windows 2000 sp1', 'Windows nt 5.01'];
$agents[] = ['Windows 2000', 'Windows nt 5.0'];
$agents[] = ['Windows NT 4.0', 'Windows nt 4.0'];
$agents[] = ['Windows Me', 'Win 9x 4.9'];
$agents[] = ['Windows 98', 'Windows 98'];
$agents[] = ['Windows 95', 'Windows 95'];
$agents[] = ['Windows CE', 'Windows ce'];
$agents[] = ['Mac OS (' . JText::_('JALL') . ')', '#(Mac OS|Mac_PowerPC|Macintosh)#'];
$agents[] = ['Mac OSX (' . JText::_('JALL') . ')', 'Mac OS X'];
$agents[] = ['Mac OSX El Capitan', 'Mac OS X 10.11'];
$agents[] = ['Mac OSX Yosemite', 'Mac OS X 10.10'];
$agents[] = ['Mac OSX Mavericks', 'Mac OS X 10.9'];
$agents[] = ['Mac OSX Mountain Lion', 'Mac OS X 10.8'];
$agents[] = ['Mac OSX Lion', 'Mac OS X 10.7'];
$agents[] = ['Mac OSX Snow Leopard', 'Mac OS X 10.6'];
$agents[] = ['Mac OSX Leopard', 'Mac OS X 10.5'];
$agents[] = ['Mac OSX Tiger', 'Mac OS X 10.4'];
$agents[] = ['Mac OSX Panther', 'Mac OS X 10.3'];
$agents[] = ['Mac OSX Jaguar', 'Mac OS X 10.2'];
$agents[] = ['Mac OSX Puma', 'Mac OS X 10.1'];
$agents[] = ['Mac OSX Cheetah', 'Mac OS X 10.0'];
$agents[] = ['Mac OS (classic)', '#(Mac_PowerPC|Macintosh)#'];
$agents[] = ['Linux', '#(Linux|X11)#'];
$agents[] = ['Open BSD', 'OpenBSD'];
$agents[] = ['Sun OS', 'SunOS'];
$agents[] = ['QNX', 'QNX'];
$agents[] = ['BeOS', 'BeOS'];
$agents[] = ['OS/2', 'OS/2'];
break;
/* Browsers */
case 'browsers':
if ($this->get('simple') && $this->get('simple') !== 'false')
{
$agents[] = ['Chrome', 'Chrome'];
$agents[] = ['Firefox', 'Firefox'];
$agents[] = ['Edge', 'Edge'];
$agents[] = ['Internet Explorer', 'MSIE'];
$agents[] = ['Opera', 'Opera'];
$agents[] = ['Safari', 'Safari'];
break;
}
$agents[] = ['Chrome (' . JText::_('JALL') . ')', 'Chrome'];
$agents[] = ['Chrome 61-70', '#Chrome/(6[1-9]|70)\.#'];
$agents[] = ['Chrome 51-60', '#Chrome/(5[1-9]|60)\.#'];
$agents[] = ['Chrome 41-50', '#Chrome/(4[1-9]|50)\.#'];
$agents[] = ['Chrome 31-40', '#Chrome/(3[1-9]|40)\.#'];
$agents[] = ['Chrome 21-30', '#Chrome/(2[1-9]|30)\.#'];
$agents[] = ['Chrome 11-20', '#Chrome/(1[1-9]|20)\.#'];
$agents[] = ['Chrome 1-10', '#Chrome/([1-9]|10)\.#'];
$agents[] = ['Firefox (' . JText::_('JALL') . ')', 'Firefox'];
$agents[] = ['Firefox 61-70', '#Firefox/(6[1-9]|70)\.#'];
$agents[] = ['Firefox 51-60', '#Firefox/(5[1-9]|60)\.#'];
$agents[] = ['Firefox 41-50', '#Firefox/(4[1-9]|50)\.#'];
$agents[] = ['Firefox 31-40', '#Firefox/(3[1-9]|40)\.#'];
$agents[] = ['Firefox 21-30', '#Firefox/(2[1-9]|30)\.#'];
$agents[] = ['Firefox 11-20', '#Firefox/(1[1-9]|20)\.#'];
$agents[] = ['Firefox 1-10', '#Firefox/([1-9]|10)\.#'];
$agents[] = ['Internet Explorer (' . JText::_('JALL') . ')', 'MSIE'];
$agents[] = ['Internet Explorer Edge', 'MSIE Edge']; // missing MSIE is added to agent string in assignments/agents.php
$agents[] = ['Edge 15', 'Edge/15'];
$agents[] = ['Edge 14', 'Edge/14'];
$agents[] = ['Edge 13', 'Edge/13'];
$agents[] = ['Edge 12', 'Edge/12'];
$agents[] = ['Internet Explorer 11', 'MSIE 11']; // missing MSIE is added to agent string in assignments/agents.php
$agents[] = ['Internet Explorer 10.6', 'MSIE 10.6'];
$agents[] = ['Internet Explorer 10.0', 'MSIE 10.0'];
$agents[] = ['Internet Explorer 10', 'MSIE 10.'];
$agents[] = ['Internet Explorer 9', 'MSIE 9.'];
$agents[] = ['Internet Explorer 8', 'MSIE 8.'];
$agents[] = ['Internet Explorer 7', 'MSIE 7.'];
$agents[] = ['Internet Explorer 1-6', '#MSIE [1-6]\.#'];
$agents[] = ['Opera (' . JText::_('JALL') . ')', 'Opera'];
$agents[] = ['Opera 51-60', '#Opera/(5[1-9]|60)\.#'];
$agents[] = ['Opera 41-50', '#Opera/(4[1-9]|50)\.#'];
$agents[] = ['Opera 31-40', '#Opera/(3[1-9]|40)\.#'];
$agents[] = ['Opera 21-30', '#Opera/(2[1-9]|30)\.#'];
$agents[] = ['Opera 11-20', '#Opera/(1[1-9]|20)\.#'];
$agents[] = ['Opera 1-10', '#Opera/([1-9]|10)\.#'];
$agents[] = ['Safari (' . JText::_('JALL') . ')', 'Safari'];
$agents[] = ['Safari 11', '#Version/11\..*Safari/#'];
$agents[] = ['Safari 10', '#Version/10\..*Safari/#'];
$agents[] = ['Safari 9', '#Version/9\..*Safari/#'];
$agents[] = ['Safari 8', '#Version/8\..*Safari/#'];
$agents[] = ['Safari 7', '#Version/7\..*Safari/#'];
$agents[] = ['Safari 6', '#Version/6\..*Safari/#'];
$agents[] = ['Safari 5', '#Version/5\..*Safari/#'];
$agents[] = ['Safari 4', '#Version/4\..*Safari/#'];
$agents[] = ['Safari 1-3', '#Version/[1-3]\..*Safari/#'];
break;
/* Mobile browsers */
case 'mobile':
$agents[] = [JText::_('JALL'), 'mobile'];
$agents[] = ['Android', 'Android'];
$agents[] = ['Android Chrome', '#Android.*Chrome#'];
$agents[] = ['Blackberry', 'Blackberry'];
$agents[] = ['IE Mobile', 'IEMobile'];
$agents[] = ['iPad', 'iPad'];
$agents[] = ['iPhone', 'iPhone'];
$agents[] = ['iPod Touch', 'iPod'];
$agents[] = ['NetFront', 'NetFront'];
$agents[] = ['Nokia', 'NokiaBrowser'];
$agents[] = ['Opera Mini', 'Opera Mini'];
$agents[] = ['Opera Mobile', 'Opera Mobi'];
$agents[] = ['UC Browser', 'UC Browser'];
break;
}
$options = [];
foreach ($agents as $agent)
{
$option = JHtml::_('select.option', $agent[1], $agent[0]);
$options[] = $option;
}
return $options;
}
}

View File

@ -0,0 +1,63 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\Document as RL_Document;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Ajax extends \RegularLabs\Library\Field
{
public $type = 'Ajax';
protected function getInput()
{
RL_Document::loadMainDependencies();
$loading = "jQuery(\"#" . $this->id . "\").find(\"span\").attr(\"class\", \"icon-refresh icon-spin\");";
$success = "jQuery(\"#" . $this->id . "\").find(\"span\").attr(\"class\", \"icon-ok\");"
. "if(data){jQuery(\"#message_" . $this->id . "\").addClass(\"alert alert-success alert-noclose alert-inline\").html(data);}";
$error = "jQuery(\"#" . $this->id . "\").find(\"span\").attr(\"class\", \"icon-warning\");"
. "if(data){jQuery(\"#message_" . $this->id . "\").addClass(\"alert alert-danger alert-noclose alert-inline\").html(data);}";
$script = "function loadAjax" . $this->id . "() {"
. $loading
. "jQuery(\"#message_" . $this->id . "\").attr(\"class\", \"\").html(\"\");"
. "RegularLabsScripts.loadajax("
. "'" . addslashes($this->get('url')) . "',"
. "'var data = data.trim();"
. "if(data == \"\" || data.substring(0,1) == \"+\") {"
. "data = data.replace(/^\\\\+/, \\'\\');"
. $success
. "} else {"
. $error
. "}',"
. "'" . $error . "'"
. ");"
. "}";
JFactory::getDocument()->addScriptDeclaration($script);
return
'<button id="' . $this->id . '" class="' . $this->get('class', 'btn') . '" title="' . JText::_($this->get('description')) . '" onclick="loadAjax' . $this->id . '();return false;">'
. '<span class="' . $this->get('icon', '') . '"></span> '
. JText::_($this->get('text', $this->get('label')))
. '</button>'
. '<div id="message_' . $this->id . '"></div>';
}
}

View File

@ -0,0 +1,48 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_AkeebaSubs extends \RegularLabs\Library\FieldGroup
{
public $type = 'AkeebaSubs';
public $default_group = 'Levels';
protected function getInput()
{
if ($error = $this->missingFilesOrTables(['levels']))
{
return $error;
}
return $this->getSelectList();
}
function getLevels()
{
$query = $this->db->getQuery(true)
->select('l.akeebasubs_level_id as id, l.title AS name, l.enabled as published')
->from('#__akeebasubs_levels AS l')
->where('l.enabled > -1')
->order('l.title, l.akeebasubs_level_id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
return $this->getOptionsByList($list, ['id']);
}
}

View File

@ -0,0 +1,118 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\StringHelper as RL_String;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
/**
* @deprecated 2018-10-30 Use ConditionSelection instead
*/
class JFormFieldRL_AssignmentSelection extends \RegularLabs\Library\Field
{
public $type = 'AssignmentSelection';
protected function getLabel()
{
return '';
}
protected function getInput()
{
require_once __DIR__ . '/toggler.php';
$toggler = new RLFieldToggler;
$this->value = (int) $this->value;
$label = $this->get('label');
$param_name = $this->get('name');
$use_main_toggle = $this->get('use_main_toggle', 1);
$showclose = $this->get('showclose', 0);
$html = [];
if ( ! $label)
{
if ($use_main_toggle)
{
$html[] = $toggler->getInput(['div' => 1]);
}
$html[] = $toggler->getInput(['div' => 1]);
return '</div>' . implode('', $html);
}
$label = RL_String::html_entity_decoder(JText::_($label));
$html[] = '</div>';
if ($use_main_toggle)
{
$html[] = $toggler->getInput(['div' => 1, 'param' => 'show_assignments|' . $param_name, 'value' => '1|1,2']);
}
$class = 'well well-small rl_well';
if ($this->value === 1)
{
$class .= ' alert-success';
}
else if ($this->value === 2)
{
$class .= ' alert-error';
}
$html[] = '<div class="' . $class . '">';
if ($showclose && JFactory::getUser()->authorise('core.admin'))
{
$html[] = '<button type="button" class="close rl_remove_assignment">&times;</button>';
}
$html[] = '<div class="control-group">';
$html[] = '<div class="control-label">';
$html[] = '<label><h4 class="rl_assignmentselection-header">' . $label . '</h4></label>';
$html[] = '</div>';
$html[] = '<div class="controls">';
$html[] = '<fieldset id="' . $this->id . '" class="radio btn-group">';
$onclick = ' onclick="RegularLabsForm.setToggleTitleClass(this, 0)"';
$html[] = '<input type="radio" id="' . $this->id . '0" name="' . $this->name . '" value="0"' . (( ! $this->value) ? ' checked="checked"' : '') . $onclick . '>';
$html[] = '<label class="rl_btn-ignore" for="' . $this->id . '0">' . JText::_('RL_IGNORE') . '</label>';
$onclick = ' onclick="RegularLabsForm.setToggleTitleClass(this, 1)"';
$html[] = '<input type="radio" id="' . $this->id . '1" name="' . $this->name . '" value="1"' . (($this->value === 1) ? ' checked="checked"' : '') . $onclick . '>';
$html[] = '<label class="rl_btn-include" for="' . $this->id . '1">' . JText::_('RL_INCLUDE') . '</label>';
$onclick = ' onclick="RegularLabsForm.setToggleTitleClass(this, 2)"';
$onclick .= ' onload="RegularLabsForm.setToggleTitleClass(this, ' . $this->value . ', 7)"';
$html[] = '<input type="radio" id="' . $this->id . '2" name="' . $this->name . '" value="2"' . (($this->value === 2) ? ' checked="checked"' : '') . $onclick . '>';
$html[] = '<label class="rl_btn-exclude" for="' . $this->id . '2">' . JText::_('RL_EXCLUDE') . '</label>';
$html[] = '</fieldset>';
$html[] = '</div>';
$html[] = '</div>';
$html[] = '<div class="clearfix"> </div>';
$html[] = $toggler->getInput(['div' => 1, 'param' => $param_name, 'value' => '1,2']);
$html[] = '<div><div>';
return '</div>' . implode('', $html);
}
}

View File

@ -0,0 +1,77 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory as JFactory;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Block extends \RegularLabs\Library\Field
{
public $type = 'Block';
protected function getLabel()
{
return '';
}
protected function getInput()
{
$title = $this->get('label');
$description = $this->get('description');
$class = $this->get('class');
$showclose = $this->get('showclose', 0);
$start = $this->get('start', 0);
$end = $this->get('end', 0);
$html = [];
if ($start || ! $end)
{
$html[] = '</div>';
if (strpos($class, 'alert') !== false)
{
$html[] = '<div class="alert ' . $class . '">';
}
else
{
$html[] = '<div class="well well-small ' . $class . '">';
}
if ($showclose && JFactory::getUser()->authorise('core.admin'))
{
$html[] = '<button type="button" class="close rl_remove_assignment">&times;</button>';
}
if ($title)
{
$html[] = '<h4>' . $this->prepareText($title) . '</h4>';
}
if ($description)
{
$html[] = '<div>' . $this->prepareText($description) . '</div>';
}
$html[] = '<div><div>';
}
if ( ! $start && ! $end)
{
$html[] = '</div>';
}
return '</div>' . implode('', $html);
}
}

View File

@ -0,0 +1,102 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Language\Text as JText;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Checkbox extends \RegularLabs\Library\Field
{
public $type = 'Checkbox';
protected function getInput()
{
$showcheckall = $this->get('showcheckall', 0);
$checkall = ($this->value == '*');
if ( ! $checkall)
{
if ( ! is_array($this->value))
{
$this->value = explode(',', $this->value);
}
}
$options = [];
foreach ($this->element->children() as $option)
{
if ($option->getName() != 'option')
{
continue;
}
$text = trim((string) $option);
$hasval = 0;
if (isset($option['value']))
{
$val = (string) $option['value'];
$disabled = (int) $option['disabled'];
$hasval = 1;
}
if ($hasval)
{
$option = '<input type="checkbox" class="rl_' . $this->id . '" id="' . $this->id . $val . '" name="' . $this->name . '[]" value="' . $val . '"';
if ($checkall || in_array($val, $this->value))
{
$option .= ' checked="checked"';
}
if ($disabled)
{
$option .= ' disabled="disabled"';
}
$option .= '> <label for="' . $this->id . $val . '" class="checkboxes">' . JText::_($text) . '</label>';
}
else
{
$option = '<label style="clear:both;"><strong>' . JText::_($text) . '</strong></label>';
}
$options[] = $option;
}
$options = implode('', $options);
if ($showcheckall)
{
$js = "
jQuery(document).ready(function() {
RegularLabsForm.initCheckAlls('rl_checkall_" . $this->id . "', 'rl_" . $this->id . "');
});
";
JFactory::getDocument()->addScriptDeclaration($js);
$checker = '<input id="rl_checkall_' . $this->id . '" type="checkbox" onclick=" RegularLabsForm.checkAll( this, \'rl_' . $this->id . '\' );"> ' . JText::_('JALL');
$options = $checker . '<br>' . $options;
}
$options .= '<input type="hidden" id="' . $this->id . 'x" name="' . $this->name . '' . '[]" value="x" checked="checked">';
$html = [];
$html[] = '<fieldset id="' . $this->id . '" class="checkbox">';
$html[] = $options;
$html[] = '</fieldset>';
return implode('', $html);
}
}

View File

@ -0,0 +1,75 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Editor\Editor as JEditor;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Plugin\PluginHelper as JPluginHelper;
use RegularLabs\Library\Document as RL_Document;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_CodeEditor extends \RegularLabs\Library\Field
{
public $type = 'CodeEditor';
protected function getInput()
{
$width = $this->get('width', '100%');
$height = $this->get('height', 400);
$this->value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');
$editor_plugin = JPluginHelper::getPlugin('editors', 'codemirror');
if (empty($editor_plugin))
{
return
'<textarea name="' . $this->name . '" style="'
. 'width:' . (strpos($width, '%') ? $width : $width . 'px') . ';'
. 'height:' . (strpos($height, '%') ? $height : $height . 'px') . ';'
. '" id="' . $this->id . '">' . $this->value . '</textarea>';
}
RL_Document::script('regularlabs/codemirror.min.js');
RL_Document::stylesheet('regularlabs/codemirror.min.css');
JFactory::getDocument()->addScriptDeclaration("
jQuery(document).ready(function($) {
RegularLabsCodeMirror.init('" . $this->id . "');
});
");
JFactory::getDocument()->addStyleDeclaration("
#rl_codemirror_" . $this->id . " .CodeMirror {
height: " . $height . "px;
min-height: " . min($height, '100') . "px;
}
");
return '<div class="rl_codemirror" id="rl_codemirror_' . $this->id . '">'
. JEditor::getInstance('codemirror')->display(
$this->name, $this->value,
$width, $height,
80, 10,
false,
$this->id, null, null,
['markerGutter' => false, 'activeLine' => true, 'class' => 'xxx']
)
. '</div>';
}
}

View File

@ -0,0 +1,68 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Form\FormField as JFormField;
use RegularLabs\Library\Document as RL_Document;
use RegularLabs\Library\RegEx as RL_RegEx;
jimport('joomla.form.formfield');
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Color extends JFormField
{
public $type = 'Color';
protected function getInput()
{
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return null;
}
$field = new RLFieldColor;
return $field->getInput($this->name, $this->id, $this->value, $this->element->attributes());
}
}
class RLFieldColor
{
function getInput($name, $id, $value, $params)
{
$this->name = $name;
$this->id = $id;
$this->value = $value;
$this->params = $params;
$class = trim('rl_color minicolors ' . $this->get('class'));
$disabled = $this->get('disabled') ? ' disabled="disabled"' : '';
RL_Document::script('regularlabs/color.min.js');
RL_Document::stylesheet('regularlabs/color.min.css');
$this->value = strtolower(RL_RegEx::replace('[^a-z0-9]', '', $this->value));
return '<input type="text" name="' . $this->name . '" id="' . $this->id . '" class="' . $class . '" value="' . $this->value . '"' . $disabled . '>';
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}

View File

@ -0,0 +1,138 @@
<?php
/**
* @package Regular Labs Library
* @version 18.7.10792
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
jimport('joomla.form.formfield');
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
use RegularLabs\Library\Document as RL_Document;
class JFormFieldRL_ColorPicker extends JFormField
{
public $type = 'ColorPicker';
protected function getInput()
{
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return null;
}
$field = new RLFieldColorPicker;
return $field->getInput($this->name, $this->id, $this->value, $this->element->attributes());
}
}
class RLFieldColorPicker
{
function getInput($name, $id, $value, $params)
{
$this->name = $name;
$this->id = $id;
$this->value = $value;
$this->params = $params;
$action = '';
if ($this->get('inlist', 0) && $this->get('action'))
{
$this->name = $name . $id;
$this->id = $name . $id;
$action = ' onchange="' . $this->get('action') . '"';
}
RL_Document::script('regularlabs/colorpicker.min.js');
RL_Document::stylesheet('regularlabs/colorpicker.min.css');
$class = ' class="' . trim('nncolorpicker chzn-done ' . $this->get('class')) . '"';
$color = strtolower($this->value);
if ( ! $color || in_array($color, ['none', 'transparent']))
{
$color = 'none';
}
else if ($color[0] != '#')
{
$color = '#' . $color;
}
$colors = $this->get('colors');
if (empty($colors))
{
$colors = [
'none',
'#049cdb',
'#46a546',
'#9d261d',
'#ffc40d',
'#f89406',
'#c3325f',
'#7a43b6',
'#ffffff',
'#999999',
'#555555',
'#000000',
];
}
else
{
$colors = explode(',', $colors);
}
$split = (int) $this->get('split');
if ( ! $split)
{
$count = count($colors);
if ($count % 5 == 0)
{
$split = 5;
}
else if ($count % 4 == 0)
{
$split = 4;
}
}
$split = $split ? $split : 3;
$html = [];
$html[] = '<select ' . $action . ' name="' . $this->name . '" id="' . $this->id . '"'
. $class . ' style="visibility:hidden;width:22px;height:1px">';
foreach ($colors as $i => $c)
{
$html[] = '<option' . ($c == $color ? ' selected="selected"' : '') . '>' . $c . '</option>';
if (($i + 1) % $split == 0)
{
$html[] = '<option>-</option>';
}
}
$html[] = '</select>';
return implode('', $html);
}
private function get($val, $default = '')
{
if ( ! isset($this->params[$val]) || (string) $this->params[$val] == '')
{
return $default;
}
return (string) $this->params[$val];
}
}

View File

@ -0,0 +1,127 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
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\Registry\Registry;
use RegularLabs\Library\RegEx as RL_RegEx;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Components extends \RegularLabs\Library\Field
{
public $type = 'Components';
protected function getInput()
{
$size = (int) $this->get('size');
return $this->selectListSimpleAjax(
$this->type, $this->name, $this->value, $this->id,
compact('size')
);
}
function getAjaxRaw(Registry $attributes)
{
$name = $attributes->get('name', $this->type);
$id = $attributes->get('id', strtolower($name));
$value = $attributes->get('value', []);
$size = $attributes->get('size');
$options = $this->getComponents();
return $this->selectListSimple($options, $name, $value, $id, $size, true);
}
function getComponents()
{
$frontend = $this->get('frontend', 1);
$admin = $this->get('admin', 1);
if ( ! $frontend && ! $admin)
{
return [];
}
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
$query = $this->db->getQuery(true)
->select('e.name, e.element')
->from('#__extensions AS e')
->where('e.type = ' . $this->db->quote('component'))
->where('e.name != ""')
->where('e.element != ""')
->group('e.element')
->order('e.element, e.name');
$this->db->setQuery($query);
$components = $this->db->loadObjectList();
$comps = [];
$lang = JFactory::getLanguage();
foreach ($components as $i => $component)
{
if (empty($component->element))
{
continue;
}
$component_folder = ($frontend ? JPATH_SITE : JPATH_ADMINISTRATOR) . '/components/' . $component->element;
// return if there is no main component folder
if ( ! JFolder::exists($component_folder))
{
continue;
}
// return if there is no view(s) folder
if ( ! JFolder::exists($component_folder . '/views') && ! JFolder::exists($component_folder . '/view'))
{
continue;
}
if (strpos($component->name, ' ') === false)
{
// Load the core file then
// Load extension-local file.
$lang->load($component->element . '.sys', JPATH_BASE, null, false, false)
|| $lang->load($component->element . '.sys', JPATH_ADMINISTRATOR . '/components/' . $component->element, null, false, false)
|| $lang->load($component->element . '.sys', JPATH_BASE, $lang->getDefault(), false, false)
|| $lang->load($component->element . '.sys', JPATH_ADMINISTRATOR . '/components/' . $component->element, $lang->getDefault(), false, false);
$component->name = JText::_(strtoupper($component->name));
}
$comps[RL_RegEx::replace('[^a-z0-9_]', '', $component->name . '_' . $component->element)] = $component;
}
ksort($comps);
$options = [];
foreach ($comps as $component)
{
$options[] = JHtml::_('select.option', $component->element, $component->name);
}
return $options;
}
}

View File

@ -0,0 +1,133 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\ShowOn as RL_ShowOn;
use RegularLabs\Library\StringHelper as RL_String;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_ConditionSelection extends \RegularLabs\Library\Field
{
public $type = 'ConditionSelection';
protected function getLabel()
{
return '';
}
protected function getInput()
{
$this->value = (int) $this->value;
$label = $this->get('label');
$param_name = $this->get('name');
$use_main_switch = $this->get('use_main_switch', 1);
$showclose = $this->get('showclose', 0);
$html = [];
if ( ! $label)
{
if ($use_main_switch)
{
$html[] = $this->closeShowOn();
}
$html[] = $this->closeShowOn();
return '</div>' . implode('', $html);
}
$label = RL_String::html_entity_decoder(JText::_($label));
$html[] = '</div>';
if ($use_main_switch)
{
$html[] = $this->openShowOn('show_conditions:1[OR]show_assignments:1[OR]' . $param_name . ':1,2');
}
$class = 'well well-small rl_well';
if ($this->value === 1)
{
$class .= ' alert-success';
}
else if ($this->value === 2)
{
$class .= ' alert-error';
}
$html[] = '<div class="' . $class . '">';
if ($showclose && JFactory::getUser()->authorise('core.admin'))
{
$html[] = '<button type="button" class="close">&times;</button>';
}
$html[] = '<div class="control-group">';
$html[] = '<div class="control-label">';
$html[] = '<label><h4>' . $label . '</h4></label>';
$html[] = '</div>';
$html[] = '<div class="controls">';
$html[] = '<fieldset id="' . $this->id . '" class="radio btn-group">';
$onclick = ' onclick="RegularLabsForm.setToggleTitleClass(this, 0)"';
$html[] = '<input type="radio" id="' . $this->id . '0" name="' . $this->name . '" value="0"' . (( ! $this->value) ? ' checked="checked"' : '') . $onclick . '>';
$html[] = '<label class="rl_btn-ignore" for="' . $this->id . '0">' . JText::_('RL_IGNORE') . '</label>';
$onclick = ' onclick="RegularLabsForm.setToggleTitleClass(this, 1)"';
$html[] = '<input type="radio" id="' . $this->id . '1" name="' . $this->name . '" value="1"' . (($this->value === 1) ? ' checked="checked"' : '') . $onclick . '>';
$html[] = '<label class="rl_btn-include" for="' . $this->id . '1">' . JText::_('RL_INCLUDE') . '</label>';
$onclick = ' onclick="RegularLabsForm.setToggleTitleClass(this, 2)"';
$onclick .= ' onload="RegularLabsForm.setToggleTitleClass(this, ' . $this->value . ', 7)"';
$html[] = '<input type="radio" id="' . $this->id . '2" name="' . $this->name . '" value="2"' . (($this->value === 2) ? ' checked="checked"' : '') . $onclick . '>';
$html[] = '<label class="rl_btn-exclude" for="' . $this->id . '2">' . JText::_('RL_EXCLUDE') . '</label>';
$html[] = '</fieldset>';
$html[] = '</div>';
$html[] = '</div>';
$html[] = '<div class="clearfix"> </div>';
$html[] = $this->openShowOn($param_name . ':1,2');
$html[] = '<div><div>';
return '</div>' . implode('', $html);
}
protected function openShowOn($condition = '')
{
if ( ! $condition)
{
return $this->closeShowon();
}
$formControl = $this->get('form', $this->formControl);
$formControl = $formControl == 'root' ? '' : $formControl;
return RL_ShowOn::open($condition, $formControl);
}
protected function closeShowOn()
{
return RL_ShowOn::close();
}
}

View File

@ -0,0 +1,99 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\CMS\Language\Text as JText;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Content extends \RegularLabs\Library\FieldGroup
{
public $type = 'Content';
function getCategories()
{
$query = $this->db->getQuery(true)
->select('COUNT(*)')
->from('#__categories')
->where('extension = ' . $this->db->quote('com_content'))
->where('parent_id > 0')
->where('published > -1');
$this->db->setQuery($query);
$total = $this->db->loadResult();
if ($total > $this->max_list_count)
{
return -1;
}
// assemble items to the array
$options = [];
if ($this->get('show_ignore'))
{
if (in_array('-1', $this->value))
{
$this->value = ['-1'];
}
$options[] = JHtml::_('select.option', '-1', '- ' . JText::_('RL_IGNORE') . ' -');
$options[] = JHtml::_('select.option', '-', '&nbsp;', 'value', 'text', true);
}
$query->clear('select')
->select('id, title as name, level, published, language')
->order('lft');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
$options = array_merge($options, $this->getOptionsByList($list, ['language'], -1));
return $options;
}
function getItems()
{
$query = $this->db->getQuery(true)
->select('COUNT(*)')
->from('#__content AS i')
->where('i.access > -1');
$this->db->setQuery($query);
$total = $this->db->loadResult();
if ($total > $this->max_list_count)
{
return -1;
}
$query->clear('select')
->select('i.id, i.title as name, i.language, c.title as cat, i.state as published')
->join('LEFT', '#__categories AS c ON c.id = i.catid')
->order('i.title, i.ordering, i.id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
$options = $this->getOptionsByList($list, ['language', 'cat', 'id']);
if ($this->get('showselect'))
{
array_unshift($options, JHtml::_('select.option', '-', '&nbsp;', 'value', 'text', true));
array_unshift($options, JHtml::_('select.option', '-', '- ' . JText::_('Select Item') . ' -'));
}
return $options;
}
}

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\StringHelper as RL_String;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_CustomFieldKey extends \RegularLabs\Library\Field
{
public $type = 'CustomFieldKey';
protected function getLabel()
{
$label = $this->get('label') ? $this->get('label') : '';
$size = $this->get('size') ? 'style="width:' . $this->get('size') . 'px"' : '';
$class = 'class="' . ($this->get('class') ? $this->get('class') : 'text_area') . '"';
$this->value = htmlspecialchars(RL_String::html_entity_decoder($this->value), ENT_QUOTES);
return
'<label for="' . $this->id . '" style="margin-top: -5px;">'
. '<input type="text" name="' . $this->name . '" id="' . $this->id . '" value="' . $this->value
. '" placeholder="' . JText::_($label) . '" title="' . JText::_($label) . '" ' . $class . ' ' . $size . '>'
. '</label>';
}
protected function getInput()
{
return '<div style="display:none;"><div><div>';
}
}

View File

@ -0,0 +1,45 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\StringHelper as RL_String;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_CustomFieldValue extends \RegularLabs\Library\Field
{
public $type = 'CustomFieldValue';
protected function getLabel()
{
return '';
}
protected function getInput()
{
$label = $this->get('label') ? $this->get('label') : '';
$size = $this->get('size') ? 'style="width:' . $this->get('size') . 'px"' : '';
$class = 'class="' . ($this->get('class') ? $this->get('class') : 'text_area') . '"';
$this->value = htmlspecialchars(RL_String::html_entity_decoder($this->value), ENT_QUOTES);
return
'</div></div></div>'
. '<input type="text" name="' . $this->name . '" id="' . $this->id . '" value="' . $this->value
. '" placeholder="' . JText::_($label) . '" title="' . JText::_($label) . '" ' . $class . ' ' . $size . '>';
}
}

View File

@ -0,0 +1,64 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\Date as RL_Date;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_DateTime extends \RegularLabs\Library\Field
{
public $type = 'DateTime';
protected function getLabel()
{
return '';
}
protected function getInput()
{
$label = $this->get('label');
$format = $this->get('format');
$date = JFactory::getDate();
$tz = new DateTimeZone(JFactory::getApplication()->getCfg('offset'));
$date->setTimeZone($tz);
if ($format)
{
if (strpos($format, '%') !== false)
{
$format = RL_Date::strftimeToDateFormat($format);
}
$html = $date->format($format, true);
}
else
{
$html = $date->format('', true);
}
if ($label)
{
$html = JText::sprintf($label, $html);
}
return '</div><div>' . $html;
}
}

View File

@ -0,0 +1,112 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\RegEx as RL_RegEx;
jimport('joomla.form.formfield');
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Dependency extends \RegularLabs\Library\Field
{
public $type = 'Dependency';
protected function getLabel()
{
return '';
}
protected function getInput()
{
if ($file = $this->get('file'))
{
$label = $this->get('label', 'the main extension');
RLFieldDependency::setMessage($file, $label);
return '';
}
$path = ($this->get('path') == 'site') ? '' : '/administrator';
$label = $this->get('label');
$file = $this->get('alias', $label);
$file = RL_RegEx::replace('[^a-z-]', '', strtolower($file));
$extension = $this->get('extension');
switch ($extension)
{
case 'com';
$file = $path . '/components/com_' . $file . '/com_' . $file . '.xml';
break;
case 'mod';
$file = $path . '/modules/mod_' . $file . '/mod_' . $file . '.xml';
break;
default:
$file = '/plugins/' . str_replace('plg_', '', $extension) . '/' . $file . '.xml';
break;
}
$label = JText::_($label) . ' (' . JText::_('RL_' . strtoupper($extension)) . ')';
RLFieldDependency::setMessage($file, $label);
return '';
}
}
class RLFieldDependency
{
static function setMessage($file, $name)
{
jimport('joomla.filesystem.file');
$file = str_replace('\\', '/', $file);
if (strpos($file, '/administrator') === 0)
{
$file = str_replace('/administrator', JPATH_ADMINISTRATOR, $file);
}
else
{
$file = JPATH_SITE . '/' . $file;
}
$file = str_replace('//', '/', $file);
$file_alt = RL_RegEx::replace('(com|mod)_([a-z-_]+\.)', '\2', $file);
if ( ! JFile::exists($file) && ! JFile::exists($file_alt))
{
$msg = JText::sprintf('RL_THIS_EXTENSION_NEEDS_THE_MAIN_EXTENSION_TO_FUNCTION', JText::_($name));
$message_set = 0;
$messageQueue = JFactory::getApplication()->getMessageQueue();
foreach ($messageQueue as $queue_message)
{
if ($queue_message['type'] == 'error' && $queue_message['message'] == $msg)
{
$message_set = 1;
break;
}
}
if ( ! $message_set)
{
JFactory::getApplication()->enqueueMessage($msg, 'error');
}
}
}
}

View File

@ -0,0 +1,86 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_EasyBlog extends \RegularLabs\Library\FieldGroup
{
public $type = 'EasyBlog';
protected function getInput()
{
if ($error = $this->missingFilesOrTables(['categories' => 'category', 'items' => 'post', 'tags' => 'tag']))
{
return $error;
}
return $this->getSelectList();
}
function getCategories()
{
$query = $this->db->getQuery(true)
->select('COUNT(*)')
->from('#__easyblog_category AS c')
->where('c.published > -1');
$this->db->setQuery($query);
$total = $this->db->loadResult();
if ($total > $this->max_list_count)
{
return -1;
}
$query->clear('select')
->select('c.id, c.parent_id, c.title, c.published')
->order('c.ordering, c.title');
$this->db->setQuery($query);
$items = $this->db->loadObjectList();
return $this->getOptionsTreeByList($items);
}
function getItems()
{
$query = $this->db->getQuery(true)
->select('i.id, i.title as name, c.title as cat, i.published')
->from('#__easyblog_post AS i')
->join('LEFT', '#__easyblog_category AS c ON c.id = i.category_id')
->where('i.published > -1')
->order('i.title, c.title, i.id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
return $this->getOptionsByList($list, ['cat', 'id']);
}
function getTags()
{
$query = $this->db->getQuery(true)
->select('t.alias as id, t.title as name')
->from('#__easyblog_tag AS t')
->where('t.published > -1')
->where('t.title != ' . $this->db->quote(''))
->group('t.title')
->order('t.title');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
return $this->getOptionsByList($list);
}
}

View File

@ -0,0 +1,45 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory as JFactory;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Editor extends \RegularLabs\Library\Field
{
public $type = 'Editor';
protected function getLabel()
{
return '';
}
protected function getInput()
{
$width = $this->get('width', '100%');
$height = $this->get('height', 400);
$this->value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');
// Get an editor object.
$editor = JFactory::getEditor();
$html = $editor->display($this->name, $this->value, $width, $height, true, $this->id);
return '</div><div>' . $html;
}
}

View File

@ -0,0 +1,112 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\RegEx as RL_RegEx;
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
require_once JPATH_LIBRARIES . '/joomla/form/fields/list.php';
class JFormFieldRL_FileList extends JFormFieldList
{
public $type = 'FileList';
private $params = null;
protected function getInput()
{
return parent::getInput();
}
protected function getOptions()
{
$options = [];
$path = $this->get('folder');
if ( ! is_dir($path))
{
$path = JPATH_ROOT . '/' . $path;
}
// Prepend some default options based on field attributes.
if ( ! $this->get('hidenone', 0))
{
$options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE',
RL_RegEx::replace('[^a-z0-9_\-]', '_', $this->fieldname)));
}
if ( ! $this->get('hidedefault', 0))
{
$options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT',
RL_RegEx::replace('[^a-z0-9_\-]', '_', $this->fieldname)));
}
// Get a list of files in the search path with the given filter.
$files = JFolder::files($path, $this->get('filter'));
// Build the options list from the list of files.
if (is_array($files))
{
foreach ($files as $file)
{
// Check to see if the file is in the exclude mask.
if ($this->get('exclude'))
{
if (RL_RegEx::match(chr(1) . $this->get('exclude') . chr(1), $file))
{
continue;
}
}
// If the extension is to be stripped, do it.
if ($this->get('stripext', 1))
{
$file = JFile::stripExt($file);
}
$label = $file;
if ($this->get('language_prefix'))
{
$label = JText::_($this->get('language_prefix') . strtoupper($label));
}
$options[] = JHtml::_('select.option', $file, $label);
}
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
private function get($val, $default = '')
{
if ( ! isset($this->params[$val]) || (string) $this->params[$val] == '')
{
return $default;
}
return (string) $this->params[$val];
}
}

View File

@ -0,0 +1,63 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_FlexiContent extends \RegularLabs\Library\FieldGroup
{
public $type = 'FlexiContent';
public $default_group = 'Tags';
protected function getInput()
{
if ($error = $this->missingFilesOrTables(['tags', 'types']))
{
return $error;
}
return $this->getSelectList();
}
function getTags()
{
$query = $this->db->getQuery(true)
->select('t.name as id, t.name')
->from('#__flexicontent_tags AS t')
->where('t.published = 1')
->where('t.name != ' . $this->db->quote(''))
->group('t.name')
->order('t.name');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
return $this->getOptionsByList($list);
}
function getTypes()
{
$query = $this->db->getQuery(true)
->select('t.id, t.name')
->from('#__flexicontent_types AS t')
->where('t.published = 1')
->order('t.name, t.id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
return $this->getOptionsByList($list);
}
}

View File

@ -0,0 +1,48 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Form2Content extends \RegularLabs\Library\FieldGroup
{
public $type = 'Form2Content';
public $default_group = 'Projects';
protected function getInput()
{
if ($error = $this->missingFilesOrTables(['projects' => 'project'], '', 'f2c'))
{
return $error;
}
return $this->getSelectList();
}
function getProjects()
{
$query = $this->db->getQuery(true)
->select('t.id, t.title as name')
->from('#__f2c_project AS t')
->where('t.published = 1')
->order('t.title, t.id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
return $this->getOptionsByList($list);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,88 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text as JText;
use Joomla\Registry\Registry;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_GroupLevel extends \RegularLabs\Library\Field
{
public $type = 'GroupLevel';
protected function getInput()
{
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
$show_all = $this->get('show_all');
$use_names = $this->get('use_names');
return $this->selectListAjax(
$this->type, $this->name, $this->value, $this->id,
compact('size', 'multiple', 'show_all', 'use_names')
);
}
function getAjaxRaw(Registry $attributes)
{
$name = $attributes->get('name', $this->type);
$id = $attributes->get('id', strtolower($name));
$value = $attributes->get('value', []);
$size = $attributes->get('size');
$multiple = $attributes->get('multiple');
$options = $this->getOptions(
(bool) $attributes->get('show_all'),
(bool) $attributes->get('use_names')
);
return $this->selectList($options, $name, $value, $id, $size, $multiple);
}
protected function getOptions($show_all = false, $use_names = false)
{
$options = $this->getUserGroups($use_names);
if ($show_all)
{
$option = (object) [];
$option->value = -1;
$option->text = '- ' . JText::_('JALL') . ' -';
$option->disable = '';
array_unshift($options, $option);
}
return $options;
}
protected function getUserGroups($use_names = false)
{
$value = $use_names ? 'a.title' : 'a.id';
$query = $this->db->getQuery(true)
->select($value . ' as value, a.title as text, a.parent_id AS parent')
->from('#__usergroups AS a')
->select('COUNT(DISTINCT b.id) AS level')
->join('LEFT', '#__usergroups AS b ON a.lft > b.lft AND a.rgt < b.rgt')
->group('a.id')
->order('a.lft ASC');
$this->db->setQuery($query);
return $this->db->loadObjectList();
}
}

View File

@ -0,0 +1,141 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Application\ApplicationHelper as JApplicationHelper;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\RegEx as RL_RegEx;
use RegularLabs\Library\StringHelper as RL_String;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Header extends \RegularLabs\Library\Field
{
public $type = 'Header';
protected function getLabel()
{
return '';
}
protected function getInput()
{
$title = $this->get('label');
$description = $this->get('description');
$xml = $this->get('xml');
$url = $this->get('url');
if ($description)
{
// variables
$v1 = $this->get('var1');
$v2 = $this->get('var2');
$v3 = $this->get('var3');
$v4 = $this->get('var4');
$v5 = $this->get('var5');
$description = RL_String::html_entity_decoder(trim(JText::sprintf($description, $v1, $v2, $v3, $v4, $v5)));
}
if ($title)
{
$title = JText::_($title);
}
if ($description)
{
// Replace inline monospace style with rl_code classname
$description = str_replace('span style="font-family:monospace;"', 'span class="rl_code"', $description);
// 'Break' plugin style tags
$description = str_replace(['{', '['], ['<span>{</span>', '<span>[</span>'], $description);
// Wrap in paragraph (if not already starting with an html tag)
if ($description[0] != '<')
{
$description = '<p>' . $description . '</p>';
}
}
if ( ! $xml && $this->form->getValue('element'))
{
if ($this->form->getValue('folder'))
{
$xml = 'plugins/' . $this->form->getValue('folder') . '/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml';
}
else
{
$xml = 'administrator/modules/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml';
}
}
if ($xml)
{
$xml = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . '/' . $xml);
$version = 0;
if ($xml && isset($xml['version']))
{
$version = $xml['version'];
}
if ($version)
{
if (strpos($version, 'PRO') !== false)
{
$version = str_replace('PRO', '', $version);
$version .= ' <small style="color:green">[PRO]</small>';
}
else if (strpos($version, 'FREE') !== false)
{
$version = str_replace('FREE', '', $version);
$version .= ' <small style="color:green">[FREE]</small>';
}
if ($title)
{
$title .= ' v';
}
else
{
$title = JText::_('Version') . ' ';
}
$title .= $version;
}
}
$html = [];
if ($title)
{
if ($url)
{
$title = '<a href="' . $url . '" target="_blank" title="'
. RL_RegEx::replace('<[^>]*>', '', $title) . '">' . $title . '</a>';
}
$html[] = '<h4>' . RL_String::html_entity_decoder($title) . '</h4>';
}
if ($description)
{
$html[] = $description;
}
if ($url)
{
$html[] = '<p><a href="' . $url . '" class="btn btn-default" target="_blank" title="' . JText::_('RL_MORE_INFO') . '">' . JText::_('RL_MORE_INFO') . ' >></a></p>';
}
return '</div><div>' . implode('', $html);
}
}

View File

@ -0,0 +1,68 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text as JText;
require_once __DIR__ . '/header.php';
class JFormFieldRL_Header_Library extends JFormFieldRL_Header
{
protected function getInput()
{
$extensions = [
'Add to Menu',
'Advanced Module Manager',
'Advanced Template Manager',
'Articles Anywhere',
'Articles Field',
'Better Preview',
'Better Trash',
'Cache Cleaner',
'CDN for Joomla!',
'Components Anywhere',
'Conditional Content',
'Content Templater',
'DB Replacer',
'Dummy Content',
'Email Protector',
'GeoIP',
'IP Login',
'Modals',
'Modules Anywhere',
'Quick Index',
'Regular Labs Extension Manager',
'ReReplacer',
'Simple User Notes',
'Sliders',
'Snippets',
'Sourcerer',
'Tabs',
'Tooltips',
'What? Nothing!',
];
$list = '<ul><li>' . implode('</li><li>', $extensions) . '</li></ul>';
$attributes = $this->element->attributes();
$warning = '';
if (isset($attributes['warning']))
{
$warning = '<div class="alert alert-danger">' . JText::_($attributes['warning']) . '</div>';
}
$this->element->attributes()['description'] = JText::sprintf($attributes['description'], $warning, $list);
return parent::getInput();
}
}

View File

@ -0,0 +1,94 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_HikaShop extends \RegularLabs\Library\FieldGroup
{
public $type = 'HikaShop';
protected function getInput()
{
if ($error = $this->missingFilesOrTables(['categories' => 'category', 'products' => 'product']))
{
return $error;
}
return $this->getSelectList();
}
function getCategories()
{
$query = $this->db->getQuery(true)
->select('COUNT(*)')
->from('#__hikashop_category')
->where('category_published > -1');
$this->db->setQuery($query);
$total = $this->db->loadResult();
if ($total > $this->max_list_count)
{
return -1;
}
$query->clear()
->select('c.category_id')
->from('#__hikashop_category AS c')
->where('c.category_type = ' . $this->db->quote('root'));
$this->db->setQuery($query);
$root = (int) $this->db->loadResult();
$query->clear()
->select('c.category_id as id, c.category_parent_id AS parent_id, c.category_name AS title, c.category_published as published')
->from('#__hikashop_category AS c')
->where('c.category_type = ' . $this->db->quote('product'))
->where('c.category_published > -1')
->order('c.category_ordering, c.category_name');
$this->db->setQuery($query);
$items = $this->db->loadObjectList();
return $this->getOptionsTreeByList($items, $root);
}
function getProducts()
{
$query = $this->db->getQuery(true)
->select('COUNT(*)')
->from('#__hikashop_product AS p')
->where('p.product_published = 1')
->where('p.product_type = ' . $this->db->quote('main'));
$this->db->setQuery($query);
$total = $this->db->loadResult();
if ($total > $this->max_list_count)
{
return -1;
}
$query->clear('select')
->select('p.product_id as id, p.product_name AS name, p.product_published AS published, c.category_name AS cat')
->join('LEFT', '#__hikashop_product_category AS x ON x.product_id = p.product_id')
->join('INNER', '#__hikashop_category AS c ON c.category_id = x.category_id')
->group('p.product_id')
->order('p.product_id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
return $this->getOptionsByList($list, ['cat', 'id']);
}
}

View File

@ -0,0 +1,38 @@
<?php
/**
* @package Regular Labs Library
* @version 18.7.10792
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
use RegularLabs\Library\Document as RL_Document;
class JFormFieldRL_HR extends JFormField
{
public $type = 'HR';
protected function getLabel()
{
return '';
}
protected function getInput()
{
RL_Document::stylesheet('regularlabs/style.min.css');
return '<div class="rl_panel rl_hr"></div>';
}
}

View File

@ -0,0 +1,157 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text as JText;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Icons extends \RegularLabs\Library\Field
{
public $type = 'Icons';
protected function getInput()
{
$value = $this->value;
if ( ! is_array($value))
{
$value = explode(',', $value);
}
$classes = [
'reglab icon-contenttemplater',
'home',
'user',
'locked',
'comments',
'comments-2',
'out',
'plus',
'pencil',
'pencil-2',
'file',
'file-add',
'file-remove',
'copy',
'folder',
'folder-2',
'picture',
'pictures',
'list-view',
'power-cord',
'cube',
'puzzle',
'flag',
'tools',
'cogs',
'cog',
'equalizer',
'wrench',
'brush',
'eye',
'star',
'calendar',
'calendar-2',
'help',
'support',
'warning',
'checkmark',
'mail',
'mail-2',
'drawer',
'drawer-2',
'box-add',
'box-remove',
'search',
'filter',
'camera',
'play',
'music',
'grid-view',
'grid-view-2',
'menu',
'thumbs-up',
'thumbs-down',
'plus-2',
'minus-2',
'key',
'quote',
'quote-2',
'database',
'location',
'zoom-in',
'zoom-out',
'health',
'wand',
'refresh',
'vcard',
'clock',
'compass',
'address',
'feed',
'flag-2',
'pin',
'lamp',
'chart',
'bars',
'pie',
'dashboard',
'lightning',
'move',
'printer',
'color-palette',
'camera-2',
'cart',
'basket',
'broadcast',
'screen',
'tablet',
'mobile',
'users',
'briefcase',
'download',
'upload',
'bookmark',
'out-2',
];
$html = [];
if ($this->get('show_none'))
{
$checked = (in_array('0', $value) ? ' checked="checked"' : '');
$html[] = '<fieldset>';
$html[] = '<input type="radio" id="' . $this->id . '0" name="' . $this->name . '"' . ' value="0"' . $checked . '>';
$html[] = '<label for="' . $this->id . '0">' . JText::_('RL_NO_ICON') . '</label>';
$html[] = '</fieldset>';
}
foreach ($classes as $i => $class)
{
$id = str_replace(' ', '_', $this->id . $class);
$checked = (in_array($class, $value) ? ' checked="checked"' : '');
$html[] = '<fieldset class="pull-left">';
$html[] = '<input type="radio" id="' . $id . '" name="' . $this->name . '"'
. ' value="' . htmlspecialchars($class, ENT_COMPAT, 'UTF-8') . '"' . $checked . '>';
$html[] = '<label for="' . $id . '" class="btn btn-small"><span class="icon-' . $class . '"></span></label>';
$html[] = '</fieldset>';
}
return '<div id="' . $this->id . '" class="btn-group radio rl_icon_group">' . implode('', $html) . '</div>';
}
}

View File

@ -0,0 +1,40 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use RegularLabs\Library\Extension as RL_Extension;
jimport('joomla.form.formfield');
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_IsInstalled extends \RegularLabs\Library\Field
{
public $type = 'IsInstalled';
protected function getLabel()
{
return '';
}
protected function getInput()
{
$is_installed = RL_Extension::isInstalled($this->get('extension'), $this->get('extension_type'), $this->get('folder'));
return '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '" value="' . (int) $is_installed . '">';
}
}

View File

@ -0,0 +1,116 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
// If controller.php exists, assume this is K2 v3
defined('RL_K2_VERSION') or define('RL_K2_VERSION', JFile::exists(JPATH_ADMINISTRATOR . '/components/com_k2/controller.php') ? 3 : 2);
class JFormFieldRL_K2 extends \RegularLabs\Library\FieldGroup
{
public $type = 'K2';
protected function getInput()
{
if ($error = $this->missingFilesOrTables(['categories', 'items', 'tags']))
{
return $error;
}
return $this->getSelectList();
}
function getCategories()
{
$state_field = RL_K2_VERSION == 3 ? 'state' : 'published';
$query = $this->db->getQuery(true)
->select('COUNT(*)')
->from('#__k2_categories AS c')
->where('c.' . $state_field . ' > -1');
$this->db->setQuery($query);
$total = $this->db->loadResult();
if ($total > $this->max_list_count)
{
return -1;
}
$parent_field = RL_K2_VERSION == 3 ? 'parent_id' : 'parent';
$title_field = RL_K2_VERSION == 3 ? 'title' : 'name';
$ordering_field = RL_K2_VERSION == 3 ? 'lft' : 'ordering';
$query->clear('select')
->select('c.id, c.' . $parent_field . ' AS parent_id, c.' . $title_field . ' AS title, c.' . $state_field . ' AS published');
if ( ! $this->get('getcategories', 1))
{
$query->where('c.' . $parent_field . ' = 0');
}
$query->order('c.' . $ordering_field . ', c.' . $title_field);
$this->db->setQuery($query);
$items = $this->db->loadObjectList();
return $this->getOptionsTreeByList($items);
}
function getTags()
{
$state_field = RL_K2_VERSION == 3 ? 'state' : 'published';
$query = $this->db->getQuery(true)
->select('t.name as id, t.name as name')
->from('#__k2_tags AS t')
->where('t.' . $state_field . ' = 1')
->where('t.name != ' . $this->db->quote(''))
->group('t.name')
->order('t.name');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
return $this->getOptionsByList($list);
}
function getItems()
{
$state_field = RL_K2_VERSION == 3 ? 'state' : 'published';
$query = $this->db->getQuery(true)
->select('COUNT(*)')
->from('#__k2_items AS i')
->where('i.' . $state_field . ' > -1');
$this->db->setQuery($query);
$total = $this->db->loadResult();
if ($total > $this->max_list_count)
{
return -1;
}
$cat_title_field = RL_K2_VERSION == 3 ? 'title' : 'name';
$query->clear('select')
->select('i.id, i.title as name, c.' . $cat_title_field . ' as cat, i.' . $state_field . ' as published')
->join('LEFT', '#__k2_categories AS c ON c.id = i.catid')
->group('i.id')
->order('i.title, i.ordering, i.id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
return $this->getOptionsByList($list, ['cat', 'id']);
}
}

View File

@ -0,0 +1,81 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text as JText;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Key extends \RegularLabs\Library\Field
{
public $type = 'Key';
protected function getInput()
{
$action = $this->get('action', 'Joomla.submitbutton(\'config.save.component.apply\')');
$key = trim($this->value);
if ( ! $key)
{
return '<div id="' . $this->id . '_field" class="btn-wrapper input-append clearfix">'
. '<input type="text" class="rl_codefield" name="' . $this->name . '" id="' . $this->id . '" autocomplete="off" value="">'
. '<button href="#" class="btn btn-success" title="' . JText::_('JAPPLY') . '" onclick="' . $action . '">'
. '<span class="icon-checkmark"></span>'
. '</button>'
. '</div>';
}
$cloak_length = max(0, strlen($key) - 4);
$key = str_repeat('*', $cloak_length) . substr($this->value, $cloak_length);
$show = 'jQuery(\'#' . $this->id . '\').attr(\'name\', \'' . $this->name . '\');'
. 'jQuery(\'#' . $this->id . '_hidden\').attr(\'name\', \'\');'
. 'jQuery(\'#' . $this->id . '_button\').hide();'
. 'jQuery(\'#' . $this->id . '_field\').show();';
$hide = 'jQuery(\'#' . $this->id . '\').attr(\'name\', \'\');'
. 'jQuery(\'#' . $this->id . '_hidden\').attr(\'name\', \'' . $this->name . '\');'
. 'jQuery(\'#' . $this->id . '_field\').hide();'
. 'jQuery(\'#' . $this->id . '_button\').show();';
return
'<div class="rl_keycode pull-left">' . $key . '</div>'
. '<div id="' . $this->id . '_button" class="pull-left">'
. '<button class="btn btn-default btn-small" onclick="' . $show . ';return false;">'
. '<span class="icon-edit"></span> '
. JText::_('JACTION_EDIT')
. '</button>'
. '</div>'
. '<div class="clearfix"></div>'
. '<div id="' . $this->id . '_field" class="btn-wrapper input-append clearfix" style="display:none;">'
. '<input type="text" class="rl_codefield" name="" id="' . $this->id . '" autocomplete="off" value="">'
. '<button href="#" class="btn btn-success btn" title="' . JText::_('JAPPLY') . '" onclick="' . $action . '">'
. '<span class="icon-checkmark"></span>'
. '</button>'
. '<button href="#" class="btn btn-danger btn" title="' . JText::_('JCANCEL') . '" onclick="' . $hide . ';return false;">'
. '<span class="icon-cancel-2"></span>'
. '</button>'
. '</div>'
. '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '_hidden" value="' . $this->value . '">';
}
}

View File

@ -0,0 +1,79 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\Registry\Registry;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Languages extends \RegularLabs\Library\Field
{
public $type = 'Languages';
protected function getInput()
{
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
return $this->selectListSimpleAjax(
$this->type, $this->name, $this->value, $this->id,
compact('size', 'multiple')
);
}
function getAjaxRaw(Registry $attributes)
{
$name = $attributes->get('name', $this->type);
$id = $attributes->get('id', strtolower($name));
$value = $attributes->get('value', []);
$size = $attributes->get('size');
$multiple = $attributes->get('multiple');
$options = $this->getLanguages($value);
return $this->selectListSimple($options, $name, $value, $id, $size, $multiple);
}
function getLanguages($value)
{
$langs = JHtml::_('contentlanguage.existing');
if ( ! is_array($value))
{
$value = [$value];
}
$options = [];
foreach ($langs as $lang)
{
if (empty($lang->value))
{
continue;
}
$options[] = (object) [
'value' => $lang->value,
'text' => $lang->text . ' [' . $lang->value . ']',
'selected' => in_array($lang->value, $value),
];
}
return $options;
}
}

View File

@ -0,0 +1,43 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use RegularLabs\Library\License as RL_License;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_License extends \RegularLabs\Library\Field
{
public $type = 'License';
protected function getLabel()
{
return '';
}
protected function getInput()
{
$extension = $this->get('extension');
if ( ! strlen($extension))
{
return '';
}
return '</div><div class="hide">' . RL_License::getMessage($extension, true);
}
}

View File

@ -0,0 +1,63 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\HTML\HTMLHelper as JHtml;
if ( ! class_exists('JFormFieldList'))
{
require_once JPATH_LIBRARIES . '/joomla/form/fields/list.php';
}
class JFormFieldRL_List extends JFormFieldList
{
protected $type = 'List';
protected function getInput()
{
$html = [];
$attr = '';
// Initialize some field attributes.
$attr .= ! empty($this->class) ? ' class="' . $this->class . '"' : '';
$attr .= $this->size ? ' style="width:' . $this->size . 'px"' : '';
$attr .= $this->multiple ? ' multiple' : '';
$attr .= $this->required ? ' required aria-required="true"' : '';
$attr .= $this->autofocus ? ' autofocus' : '';
// To avoid user's confusion, readonly="true" should imply disabled="true".
if ((string) $this->readonly == '1' || (string) $this->readonly == 'true' || (string) $this->disabled == '1' || (string) $this->disabled == 'true')
{
$attr .= ' disabled="disabled"';
}
// Initialize JavaScript field attributes.
$attr .= $this->onchange ? ' onchange="' . $this->onchange . '"' : '';
// Get the field options.
$options = (array) $this->getOptions();
if ((string) $this->readonly == '1' || (string) $this->readonly == 'true')
{
// Create a read-only list (no name) with a hidden input to store the value.
$html[] = JHtml::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $this->value, $this->id);
$html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '">';
}
else
{
// Create a regular list.
$html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
}
return implode($html);
}
}

View File

@ -0,0 +1,51 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use RegularLabs\Library\Language as RL_Language;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_LoadLanguage extends \RegularLabs\Library\Field
{
public $type = 'LoadLanguage';
protected function getLabel()
{
return '';
}
protected function getInput()
{
$extension = $this->get('extension');
$admin = $this->get('admin', 1);
self::loadLanguage($extension, $admin);
return '';
}
function loadLanguage($extension, $admin = 1)
{
if ( ! $extension)
{
return;
}
RL_Language::load($extension, $admin ? JPATH_ADMINISTRATOR : JPATH_SITE);
}
}

View File

@ -0,0 +1,111 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text as JText;
use Joomla\Registry\Registry;
use RegularLabs\Library\Language as RL_Language;
use RegularLabs\Library\RegEx as RL_RegEx;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_MenuItems extends \RegularLabs\Library\Field
{
public $type = 'MenuItems';
protected function getInput()
{
$size = (int) $this->get('size');
$multiple = $this->get('multiple', 0);
return $this->selectListAjax(
$this->type, $this->name, $this->value, $this->id,
compact('size', 'multiple')
);
}
function getAjaxRaw(Registry $attributes)
{
$name = $attributes->get('name', $this->type);
$id = $attributes->get('id', strtolower($name));
$value = $attributes->get('value', []);
$size = $attributes->get('size');
$multiple = $attributes->get('multiple');
$options = $this->getMenuItems();
return $this->selectList($options, $name, $value, $id, $size, $multiple);
}
/**
* Get a list of menu links for one or all menus.
*/
public static function getMenuItems()
{
RL_Language::load('com_modules', JPATH_ADMINISTRATOR);
JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
$menuTypes = MenusHelper::getMenuLinks();
foreach ($menuTypes as &$type)
{
$type->value = 'type.' . $type->menutype;
$type->text = $type->title;
$type->level = 0;
$type->class = 'hidechildren';
$type->labelclass = 'nav-header';
$rlu[$type->menutype] = &$type;
foreach ($type->links as &$link)
{
$check1 = RL_RegEx::replace('[^a-z0-9]', '', strtolower($link->text));
$check2 = RL_RegEx::replace('[^a-z0-9]', '', $link->alias);
$text = [];
$text[] = $link->text;
if ($check1 !== $check2)
{
$text[] = '<span class="small ghosted">[' . $link->alias . ']</span>';
}
if (in_array($link->type, ['separator', 'heading', 'alias', 'url']))
{
$text[] = '<span class="label label-info">' . JText::_('COM_MODULES_MENU_ITEM_' . strtoupper($link->type)) . '</span>';
// Don't disable, as you need to be able to select the 'Also on Child Items' option
// $link->disable = 1;
}
if ($link->published == 0)
{
$text[] = '<span class="label">' . JText::_('JUNPUBLISHED') . '</span>';
}
if (JLanguageMultilang::isEnabled() && $link->language != '' && $link->language != '*')
{
$text[] = $link->language_image
? JHtml::_('image', 'mod_languages/' . $link->language_image . '.gif', $link->language_title, ['title' => $link->language_title], true)
: '<span class="label" title="' . $link->language_title . '">' . $link->language_sef . '</span>';
}
$link->text = implode(' ', $text);
}
}
return $menuTypes;
}
}

View File

@ -0,0 +1,105 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_MijoShop extends \RegularLabs\Library\FieldGroup
{
public $type = 'MijoShop';
public $store_id = 0;
public $language_id = 1;
protected function getInput()
{
if ($error = $this->missingFilesOrTables(['categories' => 'category', 'products' => 'product']))
{
return $error;
}
if ( ! class_exists('MijoShop'))
{
require_once(JPATH_ROOT . '/components/com_mijoshop/mijoshop/mijoshop.php');
}
$this->store_id = (int) MijoShop::get('opencart')->get('config')->get('config_store_id');
$this->language_id = (int) MijoShop::get('opencart')->get('config')->get('config_language_id');
return $this->getSelectList();
}
function getCategories()
{
$query = $this->db->getQuery(true)
->select('COUNT(*)')
->from('#__mijoshop_category AS c')
->join('INNER', '#__mijoshop_category_description AS cd ON c.category_id = cd.category_id')
->join('INNER', '#__mijoshop_category_to_store AS cts ON c.category_id = cts.category_id')
->where('c.status = 1')
->where('cd.language_id = ' . $this->language_id)
->where('cts.store_id = ' . $this->store_id)
->group('c.category_id');
$this->db->setQuery($query);
$total = $this->db->loadResult();
if ($total > $this->max_list_count)
{
return -1;
}
$query->clear('select')
->select('c.category_id AS id, c.parent_id, cd.name AS title, c.status AS published')
->order('c.sort_order, cd.name');
$this->db->setQuery($query);
$items = $this->db->loadObjectList();
return $this->getOptionsTreeByList($items);
}
function getProducts()
{
$query = $this->db->getQuery(true)
->select('COUNT(*)')
->from('#__mijoshop_product AS p')
->join('INNER', '#__mijoshop_product_description AS pd ON p.product_id = pd.product_id')
->join('INNER', '#__mijoshop_product_to_store AS pts ON p.product_id = pts.product_id')->where('p.status = 1')
->where('p.date_available <= NOW()')
->where('pd.language_id = ' . $this->language_id)
->group('p.product_id');
$this->db->setQuery($query);
$total = $this->db->loadResult();
if ($total > $this->max_list_count)
{
return -1;
}
$query->clear('select')
->select('p.product_id as id, pd.name, p.model as model, cd.name AS cat, p.status AS published')
->join('LEFT', '#__mijoshop_product_to_category AS ptc ON p.product_id = ptc.product_id')
->join('LEFT', '#__mijoshop_category_description AS cd ON ptc.category_id = cd.category_id')
->join('LEFT', '#__mijoshop_category_to_store AS cts ON ptc.category_id = cts.category_id')
->where('cts.store_id = ' . $this->store_id)
->where('cd.language_id = ' . $this->language_id)
->where('cts.store_id = ' . $this->store_id)
->order('pd.name, p.model');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
return $this->getOptionsByList($list, ['model', 'cat', 'id']);
}
}

View File

@ -0,0 +1,144 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\Form as RL_Form;
use RegularLabs\Library\RegEx as RL_RegEx;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Modules extends \RegularLabs\Library\Field
{
public $type = 'Modules';
protected function getInput()
{
JHtml::_('behavior.modal', 'a.modal');
$size = $this->get('size') ? 'style="width:' . $this->get('size') . 'px"' : '';
$multiple = $this->get('multiple');
$showtype = $this->get('showtype');
$showid = $this->get('showid');
$showinput = $this->get('showinput');
// load the list of modules
$query = $this->db->getQuery(true)
->select('m.id, m.title, m.position, m.module, m.published, m.language')
->from('#__modules AS m')
->where('m.client_id = 0')
->where('m.published > -2')
->order('m.position, m.title, m.ordering, m.id');
$this->db->setQuery($query);
$modules = $this->db->loadObjectList();
// assemble menu items to the array
$options = [];
$p = 0;
foreach ($modules as $item)
{
if ($p !== $item->position)
{
$pos = $item->position;
if ($pos == '')
{
$pos = ':: ' . JText::_('JNONE') . ' ::';
}
$options[] = JHtml::_('select.option', '-', '[ ' . $pos . ' ]', 'value', 'text', true);
}
$p = $item->position;
$item->title = $item->title;
if ($showtype)
{
$item->title .= ' [' . $item->module . ']';
}
if ($showinput || $showid)
{
$item->title .= ' [' . $item->id . ']';
}
if ($item->language && $item->language != '*')
{
$item->title .= ' (' . $item->language . ')';
}
$item->title = RL_Form::prepareSelectItem($item->title, $item->published);
$options[] = JHtml::_('select.option', $item->id, $item->title);
}
if ($showinput)
{
array_unshift($options, JHtml::_('select.option', '-', '&nbsp;', 'value', 'text', true));
array_unshift($options, JHtml::_('select.option', '-', '- ' . JText::_('Select Item') . ' -'));
if ($multiple)
{
$onchange = 'if ( this.value ) { if ( ' . $this->id . '.value ) { ' . $this->id . '.value+=\',\'; } ' . $this->id . '.value+=this.value; } this.value=\'\';';
}
else
{
$onchange = 'if ( this.value ) { ' . $this->id . '.value=this.value;' . $this->id . '_text.value=this.options[this.selectedIndex].innerHTML.replace( /^((&|&amp;|&#160;)nbsp;|-)*/gm, \'\' ).trim(); } this.value=\'\';';
}
$attribs = 'class="inputbox" onchange="' . $onchange . '"';
$html = '<table cellpadding="0" cellspacing="0"><tr><td style="padding: 0px;">' . "\n";
if ( ! $multiple)
{
$val_name = $this->value;
if ($this->value)
{
foreach ($modules as $item)
{
if ($item->id == $this->value)
{
$val_name = $item->title;
if ($showtype)
{
$val_name .= ' [' . $item->module . ']';
}
$val_name .= ' [' . $this->value . ']';
break;
}
}
}
$html .= '<input type="text" id="' . $this->id . '_text" value="' . $val_name . '" class="inputbox" ' . $size . ' disabled="disabled">';
$html .= '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '" value="' . $this->value . '">';
}
else
{
$html .= '<input type="text" name="' . $this->name . '" id="' . $this->id . '" value="' . $this->value . '" class="inputbox" ' . $size . '>';
}
$html .= '</td><td style="padding: 0px;"padding-left: 5px;>' . "\n";
$html .= JHtml::_('select.genericlist', $options, '', $attribs, 'value', 'text', '', '');
$html .= '</td></tr></table>' . "\n";
}
else
{
$attr = $size;
$attr .= $multiple ? ' multiple="multiple"' : '';
$attr .= ' class="input-xxlarge"';
$html = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
$html = '<div class="input-maximize">' . $html . '</div>';
}
return RL_RegEx::replace('>\[\[\:(.*?)\:\]\]', ' style="\1">', $html);
}
}

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Regular Labs Library
* @version 18.7.10792
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_MultiSelect extends \RegularLabs\Library\Field
{
public $type = 'MultiSelect';
protected function getInput()
{
$this->params = $this->element->attributes();
if ( ! is_array($this->value))
{
$this->value = explode(',', $this->value);
}
foreach ($this->element->children() as $item)
{
$item_value = (string) $item['value'];
$item_name = JText::_(trim((string) $item));
$item_disabled = (int) $item['disabled'];
$options[] = JHtml::_('select.option', $item_value, $item_name, 'value', 'text', $item_disabled);
}
$size = (int) $this->get('size');
return $this->selectList($options, $this->name, $this->value, $this->id, $size, true);
}
}

View File

@ -0,0 +1,69 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text as JText;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Note extends \RegularLabs\Library\Field
{
public $type = 'Note';
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$this->element = $element;
$element['label'] = $this->prepareText($element['label']);
$element['description'] = $this->prepareText($element['description']);
$element['translateDescription'] = false;
return parent::setup($element, $value, $group);
}
protected function getLabel()
{
if (empty($this->element['label']) && empty($this->element['description']))
{
return '';
}
$title = $this->element['label'] ? (string) $this->element['label'] : ($this->element['title'] ? (string) $this->element['title'] : '');
$heading = $this->element['heading'] ? (string) $this->element['heading'] : 'h4';
$description = (string) $this->element['description'];
$class = ! empty($this->class) ? ' class="' . $this->class . '"' : '';
$close = (string) $this->element['close'];
$html = [];
if ($close)
{
$close = $close == 'true' ? 'alert' : $close;
$html[] = '<button type="button" class="close" data-dismiss="' . $close . '">&times;</button>';
}
$html[] = ! empty($title) ? '<' . $heading . '>' . JText::_($title) . '</' . $heading . '>' : '';
$html[] = ! empty($description) ? JText::_($description) : '';
return '</div><div ' . $class . '>' . implode('', $html);
}
protected function getInput()
{
return '';
}
}

View File

@ -0,0 +1,108 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use RegularLabs\Library\Extension as RL_Extension;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_OnlyPro extends \RegularLabs\Library\Field
{
public $type = 'OnlyPro';
protected function getLabel()
{
$label = $this->prepareText($this->get('label'));
$tooltip = $this->prepareText($this->get('description'));
if ( ! $label && ! $tooltip)
{
return '</div><div>' . $this->getText();
}
if ( ! $label)
{
return $tooltip;
}
if ( ! $tooltip)
{
return $label;
}
return '<label class="hasPopover" title="' . $label . '" data-content="' . htmlentities($tooltip) . '">'
. $label
. '</label>';
}
protected function getInput()
{
$label = $this->prepareText($this->get('label'));
$tooltip = $this->prepareText($this->get('description'));
if ( ! $label && ! $tooltip)
{
return '';
}
return $this->getText();
}
protected function getText()
{
$text = JText::_('RL_ONLY_AVAILABLE_IN_PRO');
$text = '<em>' . $text . '</em>';
$extension = $this->getExtensionName();
$alias = RL_Extension::getAliasByName($extension);
if ($alias)
{
$text = '<a href="https://www.regularlabs.com/extensions/' . $extension . '/features" target="_blank">'
. $text
. '</a>';
}
$class = $this->get('class');
$class = $class ? ' class="' . $class . '"' : '';
return '<div' . $class . '>' . $text . '</div>';
}
protected function getExtensionName()
{
if ($extension = $this->form->getValue('element'))
{
return $extension;
}
if ($extension = JFactory::getApplication()->input->get('component'))
{
return str_replace('com_', '', $extension);
}
if ($extension = JFactory::getApplication()->input->get('folder'))
{
$extension = explode('.', $extension);
return array_pop($extension);
}
return false;
}
}

View File

@ -0,0 +1,73 @@
<?php
/**
* @package Regular Labs Library
* @version 18.7.10792
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
require_once JPATH_LIBRARIES . '/joomla/form/fields/password.php';
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
use RegularLabs\Library\StringHelper as RL_String;
class JFormFieldRL_Password extends JFormFieldPassword
{
public $type = 'Password';
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$this->element = $element;
$element['label'] = $this->prepareText($element['label']);
$element['description'] = $this->prepareText($element['description']);
$element['translateDescription'] = false;
return parent::setup($element, $value, $group);
}
private function prepareText($string = '')
{
$string = trim($string);
if ($string == '')
{
return '';
}
// variables
$var1 = JText::_($this->get('var1'));
$var2 = JText::_($this->get('var2'));
$var3 = JText::_($this->get('var3'));
$var4 = JText::_($this->get('var4'));
$var5 = JText::_($this->get('var5'));
$string = JText::sprintf(JText::_($string), $var1, $var2, $var3, $var4, $var5);
$string = trim(RL_String::html_entity_decoder($string));
$string = str_replace('&quot;', '"', $string);
$string = str_replace('span style="font-family:monospace;"', 'span class="rl_code"', $string);
return $string;
}
private function get($val, $default = '')
{
if ( ! isset($this->params[$val]) || (string) $this->params[$val] == '')
{
return $default;
}
return (string) $this->params[$val];
}
}

View File

@ -0,0 +1,60 @@
<?php
/**
* @package Regular Labs Library
* @version 18.12.3953
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_PlainText extends \RegularLabs\Library\Field
{
public $type = 'PlainText';
protected function getLabel()
{
$label = $this->prepareText($this->get('label'));
$tooltip = $this->prepareText($this->get('description'));
if ( ! $label && ! $tooltip)
{
return '';
}
if ( ! $label)
{
return '<div>' . $tooltip . '</div>';
}
if ( ! $tooltip)
{
return '<div>' . $label . '</div>';
}
return '<label class="hasPopover" title="' . $label . '" data-content="' . htmlentities($tooltip) . '">'
. $label . '</label>';
}
protected function getInput()
{
$text = $this->prepareText($this->value);
if ( ! $text)
{
return '';
}
return '<fieldset class="rl_plaintext">' . $text . '</fieldset>';
}
}

Some files were not shown because too many files have changed in this diff Show More