File manager - Edit - /home/opticamezl/www/newok/com_rereplacer.tar
Back
script.install.php 0000604 00000007610 15174106422 0010230 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ defined('_JEXEC') or die; use Joomla\CMS\Factory as JFactory; use Joomla\Filesystem\File as JFile; use Joomla\Filesystem\Folder as JFolder; use RegularLabs\Component\Conditions\Administrator\Helper\ConvertAssignments as ConditionsConvertAssignments; class Com_ReReplacerInstallerScript { public function postflight($install_type, $adapter) { if ( ! in_array($install_type, ['install', 'update'])) { return true; } self::createTable(); self::fixColumns(); self::deleteJoomla3Files(); return true; } private static function convertAssignmentsToConditions() { } private static function createTable() { $db = JFactory::getDbo(); $query = "CREATE TABLE IF NOT EXISTS `#__rereplacer` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(100) NOT NULL, `description` TEXT NOT NULL, `category` VARCHAR(50) NOT NULL, `color` VARCHAR(8) NULL DEFAULT NULL, `search` TEXT NOT NULL, `replace` TEXT NOT NULL, `area` TEXT NOT NULL, `params` TEXT NOT NULL, `published` TINYINT(1) NOT NULL DEFAULT '0', `ordering` INT NOT NULL DEFAULT '0', `checked_out` INT UNSIGNED DEFAULT NULL, `checked_out_time` datetime NULL DEFAULT NULL, PRIMARY KEY (`id`), KEY `id` (`id`,`published`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; $db->setQuery($query); $db->execute(); $db->setQuery('ALTER TABLE `#__rereplacer` MODIFY `checked_out` INT UNSIGNED DEFAULT NULL;'); $db->execute(); $db->setQuery('ALTER TABLE `#__rereplacer` MODIFY `checked_out_time` datetime NULL DEFAULT NULL;'); $db->execute(); $db->setQuery('UPDATE `#__rereplacer` SET `checked_out` = NULL WHERE `checked_out` = 0;'); $db->execute(); $db->setQuery('UPDATE `#__rereplacer` SET `checked_out_time` = NULL WHERE CAST(`checked_out_time` AS CHAR(20)) = \'0000-00-00 00:00:00\';'); $db->execute(); } private static function delete($files = []) { foreach ($files as $file) { if (is_dir($file)) { JFolder::delete($file); } if (is_file($file)) { JFile::delete($file); } } } private static function deleteJoomla3Files() { self::delete( [ JPATH_ADMINISTRATOR . '/components/com_rereplacer/controllers', JPATH_ADMINISTRATOR . '/components/com_rereplacer/helpers', JPATH_ADMINISTRATOR . '/components/com_rereplacer/models', JPATH_ADMINISTRATOR . '/components/com_rereplacer/views', JPATH_ADMINISTRATOR . '/components/com_rereplacer/tables', JPATH_ADMINISTRATOR . '/components/com_rereplacer/controller.php', JPATH_ADMINISTRATOR . '/components/com_rereplacer/item_params.xml', JPATH_ADMINISTRATOR . '/components/com_rereplacer/rereplacer.php', ] ); } private static function fixColumns() { $db = JFactory::getDbo(); $query = 'SHOW COLUMNS FROM `#__rereplacer`'; $db->setQuery($query); $columns = $db->loadColumn(); if ( ! in_array('color', $columns)) { $query = "ALTER TABLE `#__rereplacer` ADD `color` VARCHAR(8) NULL DEFAULT NULL AFTER `category`;"; $db->setQuery($query); $db->execute(); } } } rereplacer.xml 0000604 00000002226 15174106422 0007412 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <extension version="4" type="component" method="upgrade"> <name>COM_REREPLACER</name> <description>COM_REREPLACER_DESC</description> <version>14.4.1</version> <creationDate>July 2025</creationDate> <author>Regular Labs (Peter van Westen)</author> <authorEmail>info@regularlabs.com</authorEmail> <authorUrl>https://regularlabs.com</authorUrl> <copyright>Copyright © 2025 Regular Labs - All Rights Reserved</copyright> <license>GNU General Public License version 2 or later</license> <namespace path="src">RegularLabs\Component\ReReplacer</namespace> <scriptfile>script.install.php</scriptfile> <administration> <menu link="option=com_rereplacer" img="class:regularlabs-rereplacer">COM_REREPLACER</menu> <files folder="admin"> <file>access.xml</file> <file>config.xml</file> <file>rereplacer.xml</file> <folder>forms</folder> <folder>language</folder> <folder>services</folder> <folder>src</folder> <folder>tmpl</folder> </files> </administration> <media folder="media" destination="rereplacer"> <folder>images</folder> </media> </extension> language/en-GB/en-GB.com_rereplacer.ini 0000604 00000027067 15174106422 0013603 0 ustar 00 ;; @package ReReplacer ;; @version 14.4.1 ;; ;; @author Peter van Westen <info@regularlabs.com> ;; @link https://regularlabs.com ;; @copyright Copyright © 2025 Regular Labs All Rights Reserved ;; @license GNU General Public License version 2 or later ;; ;; @translate Want to help with translations? See: https://regularlabs.com/translate COM_REREPLACER="Regular Labs - ReReplacer" COM_REREPLACER_DESC="ReReplacer - advanced search and replace for Joomla!" COM_REREPLACER_CONFIGURATION="ReReplacer" REREPLACER="ReReplacer" RR_EXTENSION_CAN_NOT_FUNCTION="[[%1:extension name%]] cannot function." RR_REGULAR_LABS_LIBRARY_NOT_ENABLED="Regular Labs Library plugin is not enabled." RR_REGULAR_LABS_LIBRARY_NOT_INSTALLED="Regular Labs Library plugin is not installed." RR_ADMIN="Admin" RR_AREA="Area" RR_AREA_BODY="Body (not in head)" RR_AREA_BODY_DESC="In the whole site except the head of the html." RR_AREA_BODY_SHORT="Body" RR_AREA_COMPONENT="Components" RR_AREA_COMPONENT_DESC="In the main area of your site. So in all components, but not in modules and other elements outside the main area." RR_AREA_COMPONENT_SHORT="Components" RR_AREA_CONTENT="Content (Articles & Categories)" RR_AREA_CONTENT_DESC="Only in articles from the article manager. So not in forum articles, for instance. And also not in articles shown through modules." RR_AREA_CONTENT_NOTE="The replacement will only be done in the content, title and author name of the article(s)." RR_AREA_CONTENT_SHORT="Content" RR_AREA_EVERYWHERE="Everywhere" RR_AREA_EVERYWHERE_DESC="In the whole site, so also in the head of the html." RR_AREA_EVERYWHERE_SHORT="Everywhere" RR_AREA_HEAD="Head (not in body)" RR_AREA_HEAD_DESC="Only in the head section of the html (the top part containing the title and other meta tags)." RR_AREA_HEAD_SHORT="Head" RR_CASE="Case" RR_CASE_SENSITIVE="Case sensitive" RR_CASE_SENSITIVE_DESC="If selected, the searches will be case sensitive. So 'word' will not match 'WORD' or 'Word'." RR_CHOOSE_FILE="Choose a valid ReReplacer export file." RR_DESCRIPTION_DESC="Give the item a short description telling you what it actually does. Everything following '---' will not be displayed in the list view." RR_DO_NOTHING="Do Nothing" RR_DYNAMIC_TAGS_DESC="Here is an overview of extra codes and dynamic tags you can/should use in different situations." RR_ELSE="Else" RR_ELSE_DESC="Select whether to replace with something else if assignments are not matched." RR_ENABLE_IN_ADMIN="Enable in Admin" RR_ENABLE_IN_ADMIN_ARE_YOU_SURE="Enabled in Admin! If your search/replace has errors, it could prevent you from entering your administrator! Are you sure?" RR_ENABLE_IN_ADMIN_DESC="If enabled, the replacements will also be done in the Administrator.<br><br><strong>Be careful!</strong><br>Only activate this if you really need to.<br>If your search/replace has errors, it could prevent you from entering your administrator!" RR_ENABLE_IN_AREA="Enable in area" RR_ENABLE_IN_AREA_DESC="Select where to do the searches." RR_ENABLE_IN_AREA_TEMPLATE="%1$s<br><br><strong>%2$s</strong><br>%3$s<br><br><strong>%4$s</strong><br>%5$s<br><br><strong>%6$s</strong><br>%7$s<br><br><strong>%8$s</strong><br>%9$s<br><br><strong>%10$s</strong><br>%11$s" RR_ENABLE_IN_AUTHOR="Enable in author names" RR_ENABLE_IN_AUTHOR_DESC="If enabled, the replacements will also be done in the author name field." RR_ENABLE_IN_CATEGORY="Enable in categories" RR_ENABLE_IN_CATEGORY_DESC="If enabled, the replacements will also be done in the title and description of the category" RR_ENABLE_IN_CONTENT="Enable in content" RR_ENABLE_IN_CONTENT_DESC="If enabled, the replacements will also be done in the content of the article/category." RR_ENABLE_IN_EDIT_FORMS="Enable in edit forms" RR_ENABLE_IN_EDIT_FORMS_ARE_YOU_SURE="Also replace in edit forms?<br>Only enable this if you really need to and you know what you are doing. Generally you do NOT want replacements to be done inside the input fields of edit forms." RR_ENABLE_IN_EDIT_FORMS_DESC="If enabled, the replacements will also be done in edit forms on the frontend." RR_ENABLE_IN_FEEDS="Enable in feeds" RR_ENABLE_IN_FEEDS_DESC="If enabled, the replacements will also be done in the website's feeds." RR_ENABLE_IN_TAGS="Enable in HTML tags" RR_ENABLE_IN_TAGS_DESC="If enabled, the replacements will also be done within HTML tags. You can also choose to do the replacements only within tags. This regards the actual tags <...>, not what is between a open and close tag." RR_ENABLE_IN_TITLE="Enable in titles" RR_ENABLE_IN_TITLE_DESC="If enabled, the replacements will also be done in the titles of the article/category." RR_HELP_ON_REGULAR_EXPRESSIONS="For help on regular expressions, see the [[%1:start link%]]Regular Expressions Cheat Sheet[[%2:end link%]]." RR_LIMIT_TO_TAG_SELECTION="Limit to tag selection" RR_LIMIT_TO_TAG_SELECTION_DESC="If enabled, the replacements will only be done within selected tags and tag parameters. Otherwise searches will be done within all tags." RR_MAX_REPLACEMENTS="Maximum Replacements" RR_MAX_REPLACEMENTS_DESC="Set the maximum number of replacements to do." RR_MESSAGE_NO_CONDITIONS="So the replacement will be done on all pages of your website." RR_NAME_DESC="Give the item a name." RR_ONLY_AVAILABLE_IN_SEARCH_AREA="This option is only available when '[[%1:option%]]' is set to '[[%2:value%]]'." RR_ONLY_BETWEEN_DESC="The search will only take place between the given (html) code. This only works if both the start and end field are entered.<br><br>The search will be done between the start code and the first found end code after it.<br><em>(You cannot use regular expressions in these fields.)</em>" RR_ONLY_BETWEEN_END="Only between (end)" RR_ONLY_BETWEEN_EXAMPLE="Example:<br>If you replace <span class="rl-code">-</span> by <span class="rl-code">/</span> between <span class="rl-code">a</span> and <span class="rl-code">b</span>:<br><span class="rl-code">a --- a --- b --- b</span><br>will become:<br><span class="rl-code">a /// a /// b --- b</span>" RR_ONLY_BETWEEN_START="Only between (start)" RR_OPTION_SELECT_CASE_SENSITIVE="- Select Case Sensitive -" RR_OPTION_SELECT_ENABLE_IN_ADMIN="- Select Enable in Admin -" RR_OPTION_SELECT_REGULAR_EXPRESSIONS="- Select Regular Expressions -" RR_OPTION_SELECT_SEARCH_AREA="- Select Search Area -" RR_PLEASE_CHOOSE_A_VALID_FILE="Please choose a valid ReReplacer export file." RR_PUBLISH_ITEMS="Publish items" RR_REGEX="RegEx" RR_REGULAR_EXPRESSIONS="Regular Expressions" RR_REGULAR_EXPRESSIONS_DESC="Select to treat the searches and replaces as regular expressions." RR_REGULAR_EXPRESSIONS_ON_DESC="Regular Expressions is switched on. Make sure the search field has valid regular expressions syntax." RR_REPLACE="Replace" RR_REPLACE_ALL="Replace All" RR_REPLACE_LIST_DESC="The replacement is treated as a list.<br>Enter a comma separated list of replacements. If you want all searches to be replaced with a single replacements, you can just enter that single string." RR_REPLACE_PHP_DESC="Replacing with PHP is enabled.<br>Make sure you surround your PHP code with <span class="rl-code">&lt;?php</span> and <span class="rl-code">?&gt;</span>." RR_REPLACE_REGULAR_EXPRESSIONS_DESC="Regular Expressions is enabled.<br>You can use the numbered back references (like: \1, \2).<br><br>Leave empty to remove the search(es)." RR_REPLACE_WITH_PHP="Replace with PHP" RR_REPLACE_WITH_PHP_DESC="Select to be able to use PHP code in the replacement. You do still need to surround your PHP code with the PHP tags." RR_REPLACE_WITH_SOMETHING_ELSE="Replace with something else" RR_SEARCH="Search" RR_SEARCH_AREAS="Search Areas" RR_SEARCH_LIST_DESC="The search is treated as a list.<br>Each comma indicates a new search string.<br>Keep in mind that spaces are matches too. So don't place spaces after the commas when making a list (unless you want to match words with a leading space)." RR_SEARCH_REGULAR_EXPRESSIONS_DESC="Regular Expressions is enabled.<br>Make sure the search field has valid regular expressions syntax.<br>You can use all regular expression syntaxes known by php." RR_SHOW_SEARCH_AND_REPLACE_FIELDS="Show search and replace fields" RR_SHOW_SEARCH_AND_REPLACE_FIELDS_DESC="Select whether to show the search and replace fields in the list by default." RR_STRIP_SURROUNDING_P_TAGS="Strip Wrapping Paragraphs" RR_STRIP_SURROUNDING_P_TAGS_DESC="Select to always remove paragraph tags directly wrapping the search string." RR_TAG_SELECTION="Tag selection" RR_TAG_SELECTION_DESC="A list of permitted tags and parameters to do the searches in. This regards the actual tags <...>, not what is between a open and close tag.<br>Use an asterisk to permit all tags/parameters. The syntax of this list is like this:<br><br><strong>tag_name_1[parameter_name_1, parameter_name_2] tag_name_2[parameter_name_1, parameter_name_2]</strong><br><br>Example (permits search in the values of the 'alt' and 'title' of all tags, permits search in the whole 'a' tag):<br><br><strong>*[alt,title] a[*]</strong>" RR_THE_ITEM="The item" RR_THE_ITEM_MUST_HAVE_A_NAME="The item must have a name." RR_THE_ITEM_MUST_HAVE_AN_XML_FILE="The item must have an xml file." RR_THE_ITEM_MUST_HAVE_SOMETHING_TO_SEARCH_FOR="The item must have something to search for." RR_THE_SEARCH_BETWEEN_STRINGS_SHOULD_BE_LONGER="The values of the 'Only search between' fields should be longer than %s characters." RR_THOROUGH="Thorough" RR_THOROUGH_DESC="If selected, the search will also replace new matches created by the replacement.<br><br>Do <strong>not</strong> use this if your replacement always creates a new match. If you do anyway, ReReplacer will only do the replacement for that match 100 times and then move on to the next match." RR_TREAT_AS_LIST="Treat as List" RR_TREAT_AS_LIST_DESC="If selected, the search and replace strings will be treated as lists. Use commas to separate the different list items. You must use [[comma]] to match actual commas.<br><br>If not selected, commas will be interpreted as normal commas and the search and replace strings will not be treated as list." RR_USE_FOR_LEADING_OR_TRAILING_SPACES="Use instead of leading and trailing spaces (otherwise they will get stripped upon saving)." RR_USE_IN_NORMAL="Use in Normal (non-regular expression) searches" RR_USE_IN_REGEX="Use in Regular Expression searches" RR_USE_IN_REPLACE="Use in the Replace field" RR_USE_IN_SEARCH="Use in the Search field" RR_USE_INSTEAD_OF_A_COMMA="Use instead of a comma when '%s' is selected. Use normal commas to create lists." RR_USE_S_MODIFIER="Use 'newline' modifier" RR_USE_S_MODIFIER_DESC="When this modifier is used, a dot meta character (.) in the pattern matches all characters including newlines. Without it, newlines are excluded." RR_USE_XML_FILE="Use XML File" RR_USE_XML_FILE_DESC="Select to use an xml file instead of the search/replace fields. With an xml file you can define multiple searches within one file." RR_USES_XML_FILE="Uses XML File" RR_USING_AN_XML_FILE="Using an XML file" RR_USING_AN_XML_FILE_DESC="With an xml file you can define multiple searches within one file.<br><br>The other settings here will be used for all the replacements in the xml file. But you can also overrule these per item in the xml file.<br><br>You can find an example xml file in the ReReplacer admin component folder." RR_WORD_SEARCH="Word Search" RR_WORD_SEARCH_DESC="Only handle whole words. It is considered a whole word if it is not preceded or followed by a letter.<br><br>So 'cat' is not found in 'cats' or 'category', but is found in 'cat2' and 'cat-flap'." RR_XML_FILE="XML File (from root)" RR_XML_FILE_DESC="The path of the XML file relative to the root of the website." language/en-GB/en-GB.com_rereplacer.sys.ini 0000604 00000001035 15174106422 0014403 0 ustar 00 ;; @package ReReplacer ;; @version 14.4.1 ;; ;; @author Peter van Westen <info@regularlabs.com> ;; @link https://regularlabs.com ;; @copyright Copyright © 2025 Regular Labs All Rights Reserved ;; @license GNU General Public License version 2 or later ;; ;; @translate Want to help with translations? See: https://regularlabs.com/translate COM_REREPLACER="Regular Labs - ReReplacer" COM_REREPLACER_DESC="ReReplacer - advanced search and replace for Joomla!" REREPLACER="ReReplacer" config.xml 0000604 00000006127 15174106422 0006537 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <config addfieldprefix="RegularLabs\Library\Form\Field"> <fieldset name="options" label="JOPTIONS"> <field name="@load_script_descriptions" type="LoadMedia" filetype="script" file="regularlabs.admin-form-descriptions"/> <field name="use_categories" type="Radio" default="1" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RL_USE_CATEGORIES" description="RL_USE_CATEGORIES_DESC"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="use_colors" type="Radio" default="1" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RL_USE_COLORS" description="RL_USE_COLORS_DESC"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="main_colors" type="TextArea" rows="4" default="none,#c0c6cf,#000000,#dc2a28,#fb6b14,#ffa813,#eac90a,#18a047,#0f9aa4,#115dda,#761bda,#d319a4" label="RL_COLORS" description="RL_COLORS_DESC" showon="use_colors:1"/> <field name="show_fields" type="Radio" default="0" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RR_SHOW_SEARCH_AND_REPLACE_FIELDS" description="RR_SHOW_SEARCH_AND_REPLACE_FIELDS_DESC"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="show_update_notification" type="Radio" default="1" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RL_SHOW_UPDATE_NOTIFICATION" description="RL_SHOW_UPDATE_NOTIFICATION_DESC"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="@show_copyright" type="Radio" default="1" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RL_SHOW_COPYRIGHT"> <option value="0" disabled="disabled">JNO</option> <option value="1">JYES</option> </field> <field name="@note__show_copyright" type="OnlyPro" label="" description="RL_SHOW_COPYRIGHT_DESC"/> </fieldset> <fieldset name="action_logs" label="RL_USER_ACTION_LOGS"> <field name="enable_actionlog" type="Radio" default="1" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RL_ENABLE_ACTIONLOG" description="RL_ENABLE_ACTIONLOG_DESC"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="actionlog_events" type="Checkboxes" multiple="true" default="create,update,delete,change_state" checked="create,update,delete,change_state" class="rl-form-checkboxes-not-inline" label="RL_ACTIONLOG_EVENTS" description="RL_ACTIONLOG_EVENTS_DESC" showon="enable_actionlog:1"> <option value="create">RL_ACTION_CREATE</option> <option value="update">RL_ACTION_UPDATE</option> <option value="delete">RL_ACTION_DELETE</option> <option value="change_state">RL_ACTION_CHANGE_STATE</option> </field> </fieldset> <fieldset name="permissions" label="JCONFIG_PERMISSIONS_LABEL" description="JCONFIG_PERMISSIONS_DESC"> <field name="rules" type="Rules" label="JCONFIG_PERMISSIONS_LABEL" filter="rules" validate="rules" component="com_rereplacer" section="component"/> </fieldset> </config> access.xml 0000604 00000001012 15174106422 0006517 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <access component="com_rereplacer"> <section name="component"> <action name="core.admin" title="JACTION_ADMIN"/> <action name="core.options" title="JACTION_OPTIONS"/> <action name="core.manage" title="JACTION_MANAGE"/> <action name="core.create" title="JACTION_CREATE"/> <action name="core.delete" title="JACTION_DELETE"/> <action name="core.edit" title="JACTION_EDIT"/> <action name="core.edit.state" title="JACTION_EDITSTATE"/> </section> </access> src/Controller/DisplayController.php 0000604 00000003366 15174106422 0013646 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ namespace RegularLabs\Component\ReReplacer\Administrator\Controller; defined('_JEXEC') or die; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\BaseController; use Joomla\CMS\Router\Route; /** * ReReplacer master display controller. */ class DisplayController extends BaseController { /** * @var string The default view. */ protected $default_view = 'items'; /** * @param boolean $cachable If true, the view output will be cached. * @param mixed $urlparams An array of safe URL parameters and their variable types, for valid values see {@link \JFilterInput::clean()}. * * @return static|boolean This object to support chaining or false on failure. */ public function display($cachable = false, $urlparams = false) { $view = $this->input->get('view', 'items'); $layout = $this->input->get('layout', 'default'); $id = $this->input->getInt('id'); // Check for edit form. if ($view == 'item' && $layout == 'edit' && ! $this->checkEditId('com_rereplacer.edit.item', $id)) { // Somehow the person just went to the form - we don't allow that. $this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 'error'); $this->setRedirect(Route::_('index.php?option=com_rereplacer&view=items', false)); return false; } return parent::display(); } } src/Controller/ItemController.php 0000604 00000001276 15174106422 0013135 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ namespace RegularLabs\Component\ReReplacer\Administrator\Controller; defined('_JEXEC') or die; use Joomla\CMS\MVC\Controller\FormController; class ItemController extends FormController { /** * @var string The prefix to use with controller messages. */ protected $text_prefix = 'RL'; // Parent class access checks are sufficient for this controller. } src/Controller/ItemsController.php 0000604 00000004336 15174106422 0013320 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ namespace RegularLabs\Component\ReReplacer\Administrator\Controller; defined('_JEXEC') or die; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\CMS\Router\Route; class ItemsController extends AdminController { /** * @var string The prefix to use with controller messages. */ protected $text_prefix = 'RL'; /** * Duplicate Method * Duplicate all items specified by array id */ public function duplicate() { $ids = $this->input->get('cid', [], 'array'); $model = $this->getModel('Items'); $item_model = $this->getModel('Item'); $model->duplicate($ids, $item_model); $this->setRedirect(Route::_('index.php?option=com_rereplacer&view=items', false)); } /** * Export Method * Export the selected items specified by id */ public function export() { $ids = $this->input->get('cid', [], 'array'); $model = $this->getModel('Items'); $model->export($ids); } /** * Proxy for getModel. * * @param string $name The name of the model. * @param string $prefix The prefix of the model. * @param array $config An array of settings. * * @return BaseDatabaseModel The model instance */ public function getModel($name = 'Item', $prefix = 'Administrator', $config = ['ignore_request' => true]) { return parent::getModel($name, $prefix, $config); } /** * Import Method * Set layout to import */ public function import() { $file = $this->input->files->get('file', null, 'raw'); // Get the model. $model = $this->getModel('Items'); $model_item = $this->getModel('Item'); $model->import($file, $model_item); $this->setRedirect(Route::_('index.php?option=com_rereplacer&view=items', false)); } } src/Extension/Component.php 0000604 00000001355 15174106422 0011764 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ namespace RegularLabs\Component\ReReplacer\Administrator\Extension; defined('JPATH_PLATFORM') or die; use Joomla\CMS\Component\Router\RouterServiceInterface; use Joomla\CMS\Component\Router\RouterServiceTrait; use Joomla\CMS\Extension\MVCComponent; use Joomla\CMS\HTML\HTMLRegistryAwareTrait; class Component extends MVCComponent implements RouterServiceInterface { use HTMLRegistryAwareTrait; use RouterServiceTrait; } src/Helper/Helper.php 0000604 00000002100 15174106422 0010471 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ namespace RegularLabs\Component\ReReplacer\Administrator\Helper; defined('_JEXEC') or die; use Joomla\CMS\Factory as JFactory; class Helper { public static $extension = 'com_rereplacer'; /** * Determines if the plugin for ReReplacer to work is enabled. * * @return boolean */ public static function isEnabled() { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->quote('enabled')) ->from($db->quoteName('#__extensions')) ->where($db->quoteName('folder') . ' = ' . $db->quote('system')) ->where($db->quoteName('element') . ' = ' . $db->quote('rereplacer')); $db->setQuery($query); return (boolean) $db->loadResult(); } } src/Model/ItemsModel.php 0000604 00000032132 15174106422 0011145 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ namespace RegularLabs\Component\ReReplacer\Administrator\Model; use Joomla\CMS\Factory as JFactory; use Joomla\CMS\Form\Form as JForm; use Joomla\CMS\Language\Text as JText; use Joomla\CMS\MVC\Model\ListModel; use RegularLabs\Library\Input as RL_Input; use RegularLabs\Library\Parameters as RL_Parameters; use RegularLabs\Library\RegEx as RL_RegEx; use RegularLabs\Library\StringHelper as RL_String; defined('_JEXEC') or die; class ItemsModel extends ListModel { protected $config; /** * @var string The prefix to use with controller messages. */ protected $text_prefix = 'RL'; /** * Constructor. * * @param array An optional associative array of configuration settings. * * @see JController */ public function __construct($config = []) { if (empty($config['filter_fields'])) { $config['filter_fields'] = [ 'area', 'a.area', 'casesensitive', 'a.casesensitive', 'category', 'a.category', 'color', 'a.color', 'description', 'a.description', 'enable_in_admin', 'a.enable_in_admin', 'id', 'a.id', 'name', 'a.name', 'ordering', 'a.ordering', 'regex', 'a.regex', 'replace', 'a.replace', 'search', 'a.search', 'state', 'a.published', ]; } parent::__construct($config); $this->config = RL_Parameters::getComponent('rereplacer'); } /** * Duplicate Method * Duplicate all items specified by array id */ public function duplicate($ids, $model) { foreach ($ids as $id) { $model->duplicate($id); } $msg = JText::sprintf('%d items duplicated', count($ids)); JFactory::getApplication()->enqueueMessage($msg); } /** * Export Method * Export the selected items specified by id */ public function export($ids) { $db = $this->getDbo(); $query = $db->getQuery(true) ->select('r.name') ->select('r.description') ->select('r.category') ->select('r.search') ->select('r.replace') ->select('r.area') ->select('r.params') ->select('r.published') ->select('r.ordering') ->from('#__rereplacer as r') ->where('r.id IN ( ' . implode(', ', $ids) . ' )'); $db->setQuery($query); $rows = $db->loadObjectList(); $this->exportDataToFile($rows); } public function exportDataToFile($rows) { $filename = 'ReReplacer Items'; if (count($rows) == 1) { $name = RL_String::strtolower(RL_String::html_entity_decoder($rows[0]->name)); $name = RL_RegEx::replace('[^a-z0-9_-]', '_', $name); $name = trim(RL_RegEx::replace('__+', '_', $name), '_-'); $filename = 'ReReplacer Item (' . $name . ')'; } $string = json_encode($rows); $this->exportStringToFile($string, $filename); } public function exportStringToFile($string, $filename) { // SET DOCUMENT HEADER if (RL_RegEx::match('Opera(/| )([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) { $UserBrowser = "Opera"; } elseif (RL_RegEx::match('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) { $UserBrowser = "IE"; } else { $UserBrowser = ''; } $mime_type = ($UserBrowser == 'IE' || $UserBrowser == 'Opera') ? 'application/octetstream' : 'application/octet-stream'; @ob_end_clean(); ob_start(); header('Content-Type: ' . $mime_type); header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT'); if ($UserBrowser == 'IE') { header('Content-Disposition: inline; filename="' . $filename . '.json"'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); echo $string; die; } header('Content-Disposition: attachment; filename="' . $filename . '.json"'); header('Pragma: no-cache'); echo $string; die; } /** * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return JForm A Form object on success, false on failure */ public function getForm($data = [], $loadData = true) { return $this->loadForm('com_rereplacer.items', 'items'); } public function getItems($getall = false) { // Get a storage key. $store = $this->getStoreId('', $getall); // Try to load the data from internal storage. if (isset($this->cache[$store])) { return $this->cache[$store]; } // Load the list items. if ($getall) { $db = $this->getDbo(); $query = $db->getQuery(true) // Select the required fields from the table. ->select('a.*') ->from($db->quoteName('#__rereplacer', 'a')) ->where($this->_db->quoteName('a.published') . ' = 1') ->order('a.ordering asc'); $this->_db->setQuery($query); $items = $this->_db->loadObjectList(); } else { $query = $this->_getListQuery(); $items = $this->_getList($query, $this->getStart(), $this->getState('list.limit')); } foreach ($items as $i => $item) { $params = RL_Parameters::getObjectFromRegistry($item->params, JPATH_ADMINISTRATOR . '/components/com_rereplacer/forms/item.xml'); foreach ($params as $key => $val) { if ( ! isset($item->{$key}) && ! is_object($val)) { $items[$i]->{$key} = $val; } } unset($items[$i]->params); } // Add the items to the internal cache. $this->cache[$store] = $items; return $items; } public function getItemsFromImportData($data) { $items = json_decode($data, true); if (is_null($items)) { return []; } return $items; } /** * Import Method * Import the selected items specified by id * and set Redirection to the list of items */ public function import($file, $model) { $msg = JText::_('RR_PLEASE_CHOOSE_A_VALID_FILE'); if (empty($file) || ! is_array($file) || ! isset($file['name'])) { JFactory::getApplication()->enqueueMessage($msg, 'warning'); return; } $file_format = pathinfo($file['name'], PATHINFO_EXTENSION); if ($file_format !== 'json') { JFactory::getApplication()->enqueueMessage($msg, 'warning'); return; } $publish_all = RL_Input::getInt('publish_all', 0); $data = file_get_contents($file['tmp_name']); if (empty($data)) { JFactory::getApplication()->enqueueMessage($msg, 'warning'); return; } $items = $this->getItemsFromImportData($data); if (empty($items)) { JFactory::getApplication()->enqueueMessage($msg, 'warning'); return; } foreach ($items as $item) { $item['id'] = 0; if ($publish_all == 0) { unset($item['published']); } elseif ($publish_all == 1) { $item['published'] = 1; } $saved = $model->save($item); if ($saved != 1) { $error = JText::_('Error Saving Item') . ' ( ' . $saved . ' )'; JFactory::getApplication()->enqueueMessage($error, 'error'); } } JFactory::getApplication()->enqueueMessage(JText::_('Items saved')); } /** * 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( $this->getState( 'list.select', 'a.*' ) ) ->from($db->quoteName('#__rereplacer', 'a')); $state = $this->getState('filter.state'); if (is_numeric($state)) { $query->where($db->quoteName('a.published') . ' = ' . ( int ) $state); } elseif ($state == '') { $query->where('( ' . $db->quoteName('a.published') . ' IN ( 0,1,2 ) )'); } $category = $this->getState('filter.category'); if ($category != '') { $query->where($db->quoteName('a.category') . ' = ' . $db->quote($category)); } $casesensitive = $this->getState('filter.casesensitive'); if ($casesensitive != '') { $query->where($db->quoteName('a.params') . ' LIKE ' . $db->quote('%"casesensitive":"' . $casesensitive . '"%')); } $regex = $this->getState('filter.regex'); if ($regex != '') { $query->where($db->quoteName('a.params') . ' LIKE ' . $db->quote('%"regex":"' . $regex . '"%')); } $enable_in_admin = $this->getState('filter.enable_in_admin'); if ($enable_in_admin != '') { $query->where($db->quoteName('a.params') . ' LIKE ' . $db->quote('%"enable_in_admin":"' . $enable_in_admin . '"%')); } $area = $this->getState('filter.area'); if ($area != '') { $query->where($db->quoteName('a.area') . ' = ' . $db->quote($area)); } // Filter the list over the search string if set. $search = $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('%' . $db->escape($search, true) . '%'); $query->where( '( ' . $db->quoteName('a.name') . ' LIKE ' . $search . ' OR ' . $db->quoteName('a.description') . ' LIKE ' . $search . ' OR ' . $db->quoteName('a.category') . ' LIKE ' . $search . ' OR ' . $db->quoteName('a.search') . ' LIKE ' . $search . ' OR ' . $db->quoteName('a.replace') . ' LIKE ' . $search . ' )' ); } } $query->select($db->quoteName('uc.name', 'editor')) ->join('LEFT', $db->quoteName('#__users', 'uc'), $db->quoteName('uc.id') . ' = ' . $db->quoteName('a.checked_out')); // Add the list ordering clause. $ordering = $this->state->get('list.ordering', 'a.ordering'); $direction = $this->state->get('list.direction', 'ASC'); if ($ordering == 'a.ordering') { $query->order('( ' . $db->quoteName('a.area') . ' != ' . $db->quote('articles') . ' )') ->order('( ' . $db->quoteName('a.area') . ' != ' . $db->quote('component') . ' )') ->order('( ' . $db->quoteName('a.area') . ' != ' . $db->quote('body') . ' AND ' . $db->quoteName('a.area') . ' != ' . $db->quote('') . ')') ->order('( ' . $db->quoteName('a.area') . ' != ' . $db->quote('everywhere') . ' )'); } $query->order($db->quoteName($db->escape($ordering)) . ' ' . $db->escape($direction)); return $query; } /** * 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 A prefix for the store id. * * @return string A store id. */ protected function getStoreId($id = '', $getall = 0) { // Compile the store id. $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.state'); $id .= ':' . $getall; return parent::getStoreId($id); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * */ protected function populateState($ordering = null, $direction = null) { // List state information. parent::populateState('a.ordering', 'asc'); } } src/Model/ItemModel.php 0000604 00000016613 15174106422 0010770 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ namespace RegularLabs\Component\ReReplacer\Administrator\Model; use Joomla\CMS\Factory as JFactory; use Joomla\CMS\Form\Form as JForm; use Joomla\CMS\Language\Text as JText; use Joomla\CMS\MVC\Model\AdminModel as JAdminModel; use Joomla\CMS\Object\CMSObject as JCMSObject; use Joomla\Utilities\ArrayHelper as JArray; use RegularLabs\Component\Conditions\Administrator\Model\ItemModel as Condition; use RegularLabs\Library\Input as RL_Input; use RegularLabs\Library\Parameters as RL_Parameters; use RegularLabs\Library\StringHelper as RL_String; defined('_JEXEC') or die; class ItemModel extends JAdminModel { /** * @var string The prefix to use with controller messages. */ protected $text_prefix = 'RL'; /** * @param array &$pks An array of record primary keys. * * @return boolean True if successful, false if an error occurs. */ public function delete(&$pks) { if ( ! parent::delete($pks)) { return false; } $this->removeConditions($pks); } /** * @param int $id * * @return boolean True on success. */ public function duplicate($id) { $item = $this->getItem($id); if (empty($item)) { return false; } // unset($item->_errors); unset($item->typeAlias); $from_id = $item->id; $item->id = 0; $item->published = 0; $this->incrementName($item->name, $item->id); $item = $this->validate(null, (array) $item); if ( ! parent::save($item)) { return false; } $to_id = $this->getState($this->getName() . '.id', 'id'); $this->copyConditions($from_id, $to_id); return true; } /** * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return JForm A Form object on success, false on failure */ public function getForm($data = [], $loadData = true) { // Get the form. $form = $this->loadForm('com_rereplacer.item', 'item', ['control' => 'jform', 'load_data' => $loadData]); if (empty($form)) { return false; } // Modify the form based on access controls. if ($this->canEditState((object) $data) != true) { // Disable fields for display. $form->setFieldAttribute('published', 'disabled', 'true'); // Disable fields while saving. // The controller has already verified this is a record you can edit. $form->setFieldAttribute('published', 'filter', 'unset'); } return $form; } /** * @return mixed Object on success, false on failure. */ public function getItem($pk = null) { // Initialise variables. $pk = ( ! empty($pk)) ? $pk : (int) $this->getState($this->getName() . '.id'); $table = $this->getTable(); if ($pk > 0) { // Attempt to load the row. $return = $table->load($pk); // Check for a table object error. if ($return === false && $table->getError()) { $this->setError($table->getError()); return false; } } $properties = $table->getProperties(1); $item = JArray::toObject($properties, JCMSObject::class); $params = RL_Parameters::getObjectFromRegistry($item->params, JPATH_ADMINISTRATOR . '/components/com_rereplacer/forms/item.xml'); foreach ($params as $key => $val) { if (isset($item->{$key})) { continue; } $item->{$key} = $val; } unset($item->params); return $item; } /** * @param array $data The form data. * * @return boolean True on success. */ public function save($data) { $task = RL_Input::getCmd('task'); if ($task == 'save2copy') { $data['published'] = 0; } $this->incrementName($data['name'], (int) $data['id']); if ( ! parent::save($data)) { return false; } if ($task != 'save2copy') { return true; } $from_id = RL_Input::getInt('id'); $to_id = $this->getState($this->getName() . '.id', 'id'); $this->copyConditions($from_id, $to_id); return true; } /** * Method to validate form data. */ public function validate($form, $data, $group = null) { // Check for valid name if (empty($data['name'])) { $this->setError(JText::_('RR_THE_ITEM_MUST_HAVE_A_NAME')); return false; } if (trim($data['search']) == '') { $this->setError(JText::_('RR_THE_ITEM_MUST_HAVE_SOMETHING_TO_SEARCH_FOR')); return false; } $params = []; $this->_db->setQuery('SHOW COLUMNS FROM #__rereplacer'); $dbkeys = $this->_db->loadColumn(); $newdata = []; foreach ($data as $key => $val) { if (in_array($key, $dbkeys)) { $newdata[$key] = $val; continue; } $params[$key] = $val; } $newdata['params'] = json_encode($params); return $newdata; } /** * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. */ protected function canDelete($record) { if ($record->published != -2) { return false; } return parent::canDelete($record); } /** * @return mixed The data for the form. */ protected function loadFormData() { // Check the session for previously entered form data. $data = JFactory::getApplication()->getUserState('com_rereplacer.edit.item.data', []); if (empty($data)) { $data = $this->getItem(); } $this->preprocessData('com_rereplacer.item', $data); return $data; } private function copyConditions($from_id, $to_id) { } private function incrementName(string &$name, int $id = 0) { while ($this->nameExists($name, $id)) { $name = RL_String::increment($name); } } private function nameExists($name, $id = 0) { $db = $this->getDbo(); $query = $db->getQuery(true) ->select('id') ->from('#__rereplacer') ->where($db->quoteName('name') . ' = ' . $db->quote($name)) ->where($db->quoteName('published') . ' != -2') ->setLimit(1); if ($id) { $query->where($db->quoteName('id') . ' != ' . (int) $id); } $db->setQuery($query); return (boolean) $db->loadResult(); } private function removeConditions($ids) { } } src/View/Items/HtmlView.php 0000604 00000012536 15174106422 0011603 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ namespace RegularLabs\Component\ReReplacer\Administrator\View\Items; use JForm; use JObject; use Joomla\CMS\Factory; use Joomla\CMS\Helper\ContentHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\GenericDataException; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\Pagination\Pagination; use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\Registry\Registry; use RegularLabs\Component\ReReplacer\Administrator\Helper\Helper; use RegularLabs\Library\Input as RL_Input; use RegularLabs\Library\Parameters as RL_Parameters; defined('_JEXEC') or die; /** * List View */ class HtmlView extends BaseHtmlView { /** * @var array */ public $activeFilters; /** * @var JForm */ public $filterForm; /** * @var boolean */ protected $collect_urls_enabled; /** * @var boolean */ protected $enabled; /** * @var array */ protected $items; /** * @var Pagination */ protected $pagination; /** * @var Registry */ protected $params; /** * @var object */ protected $state; /** * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed False if unsuccessful, otherwise void. * * @throws GenericDataException */ public function display($tpl = null) { $this->enabled = Helper::isEnabled(); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->config = RL_Parameters::getComponent('rereplacer'); $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); $this->hasCategories = $this->get('HasCategories'); $this->form = $this->get('Form'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new GenericDataException(implode("\n", $errors), 500); } $this->addToolbar(); return parent::display($tpl); } /** * @return void */ protected function addToolbar() { $user = Factory::getApplication()->getIdentity(); $canDo = ContentHelper::getActions('com_rereplacer'); $viewLayout = RL_Input::getCmd('layout', 'default'); $toolbar = Toolbar::getInstance('toolbar'); if ($viewLayout == 'import') { ToolbarHelper::title(Text::_('REREPLACER') . ': ' . Text::_('RL_IMPORT_ITEMS'), 'rereplacer icon-reglab'); ToolbarHelper::back(); return; } ToolbarHelper::title(Text::_('REREPLACER') . ': ' . Text::_('RL_Items'), 'rereplacer icon-reglab'); if ($canDo->get('core.create')) { $toolbar->addNew('item.add'); } if ($canDo->get('core.edit.state') || $user->authorise('core.admin')) { $dropdown = $toolbar->dropdownButton('status-group') ->text('JTOOLBAR_CHANGE_STATUS') ->toggleSplit(false) ->icon('icon-ellipsis-h') ->buttonClass('btn btn-action') ->listCheck(true); $childBar = $dropdown->getChildToolbar(); if ($canDo->get('core.edit.state')) { $childBar->publish('items.publish')->listCheck(true); $childBar->unpublish('items.unpublish')->listCheck(true); } if ($canDo->get('core.admin')) { $childBar->checkin('items.checkin')->listCheck(true); } if ($canDo->get('core.edit.state') && $this->state->get('filter.state') !== '-2') { $childBar->trash('items.trash')->listCheck(true); } if ($canDo->get('core.create')) { $childBar->standardButton('copy') ->text('JTOOLBAR_DUPLICATE') ->task('items.duplicate') ->listCheck(true); } if ($canDo->get('core.delete') && $this->state->get('filter.state') === '-2') { $toolbar->delete('items.delete') ->text('JTOOLBAR_EMPTY_TRASH') ->message('JGLOBAL_CONFIRM_DELETE') ->listCheck(true); } if ($canDo->get('core.create')) { $childBar->standardButton('file-export') ->text('RL_EXPORT') ->task('items.export') ->listCheck(true); } } if ($canDo->get('core.create')) { $toolbar->popupButton('file-import') ->icon('icon-file-import') ->text('RL_IMPORT') ->selector('importModal'); } if ($canDo->get('core.admin')) { $toolbar->preferences('com_rereplacer'); } } } src/View/Item/HtmlView.php 0000604 00000006764 15174106422 0011426 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ namespace RegularLabs\Component\ReReplacer\Administrator\View\Item; use Joomla\CMS\Factory as JFactory; use Joomla\CMS\Form\Form as JForm; use Joomla\CMS\Helper\ContentHelper as ContentHelper; use Joomla\CMS\Language\Text as JText; use Joomla\CMS\MVC\View\GenericDataException as JGenericDataException; use Joomla\CMS\MVC\View\HtmlView as JHtmlView; use Joomla\CMS\Toolbar\Toolbar as JToolbar; use Joomla\CMS\Toolbar\ToolbarHelper as JToolbarHelper; use RegularLabs\Library\Input as RL_Input; use RegularLabs\Library\Parameters as RL_Parameters; defined('_JEXEC') or die; /** * Item View */ class HtmlView extends JHtmlView { /** * @var object */ protected $config; /** * @var JForm */ protected $form; /** * @var object */ protected $item; /** * @var object */ protected $state; /** * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed False if unsuccessful, otherwise void. */ public function display($tpl = null) { $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); $this->config = RL_Parameters::getComponent('rereplacer', $this->state->params); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new JGenericDataException(implode("\n", $errors), 500); } $this->addToolbar(); parent::display($tpl); } /** * @return void */ protected function addToolbar() { $isNew = ($this->item->id == 0); $canDo = ContentHelper::getActions('com_rereplacer'); RL_Input::set('hidemainmenu', true); JToolbarHelper::title(JText::_('REREPLACER') . ': ' . JText::_('RL_ITEM'), 'rereplacer icon-reglab'); $toolbar = JToolbar::getInstance('toolbar'); $toolbarButtons = []; // If not checked out, can save the item. if ($canDo->get('core.edit')) { JToolbarHelper::apply('item.apply'); $toolbarButtons[] = ['save', 'item.save']; } /** * This component does not support Save as Copy due to uniqueness checks. * While it can be done, it causes too much confusion if the user does * not change the Old URL. */ if ($canDo->get('core.edit') && $canDo->get('core.create')) { $toolbarButtons[] = ['save2new', 'item.save2new']; } if ( ! $isNew && $canDo->get('core.create')) { $toolbarButtons[] = ['save2copy', 'item.save2copy']; } JToolbarHelper::saveGroup( $toolbarButtons, 'btn-success' ); if (empty($this->item->id)) { JToolbarHelper::cancel('item.cancel'); } else { JToolbarHelper::cancel('item.cancel', 'JTOOLBAR_CLOSE'); } $toolbar->appendButton('Popup', 'help', 'RL_DYNAMIC_TAGS', 'index.php?option=com_rereplacer&view=item&layout=dynamic_tags&tmpl=component', 800, 600, '', '', '', JText::_('RL_DYNAMIC_TAGS')); } } src/Service/HTML/ReReplacer.php 0000604 00000004110 15174106422 0012226 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ namespace RegularLabs\Component\ReReplacer\Administrator\Service\HTML; defined('_JEXEC') or die; use InvalidArgumentException; use Joomla\CMS\Language\Text; use Joomla\Utilities\ArrayHelper; class ReReplacer { /** * Display the published or unpublished state of an item. * * @param int $value The state value. * @param int $i The ID of the item. * @param boolean $canChange An optional prefix for the task. * * @return string * * @throws InvalidArgumentException * */ public function published($value = 0, $i = null, $canChange = true) { // Note: $i is required but has to be an optional argument in the function call due to argument order if (null === $i) { throw new InvalidArgumentException('$i is a required argument in JHtmlReReplacer::published'); } // Array of image, task, title, action $states = [ 1 => ['publish', 'items.unpublish', 'JENABLED', 'COM_REREPLACER_DISABLE_ITEM'], 0 => ['unpublish', 'items.publish', 'JDISABLED', 'COM_REREPLACER_ENABLE_ITEM'], 2 => ['archive', 'items.unpublish', 'JARCHIVED', 'JUNARCHIVE'], -2 => ['trash', 'items.publish', 'JTRASHED', 'COM_REREPLACER_ENABLE_ITEM'], ]; $state = ArrayHelper::getValue($states, (int) $value, $states[0]); $icon = $state[0]; if ($canChange) { $html = '<a href="#" onclick="return Joomla.listItemTask(\'cb' . $i . '\',\'' . $state[1] . '\')" class="tbody-icon' . ($value == 1 ? ' active' : '') . '" title="' . Text::_($state[3]) . '"><span class="icon-' . $icon . '" aria-hidden="true"></span></a>'; } return $html; } } src/Table/ItemTable.php 0000604 00000003020 15174106422 0010732 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ namespace RegularLabs\Component\ReReplacer\Administrator\Table; use Exception; use Joomla\CMS\Language\Text as JText; use Joomla\CMS\Table\Table; use Joomla\Database\DatabaseDriver; defined('_JEXEC') or die; class ItemTable extends Table { /** * @param DatabaseDriver $db Database object. */ public function __construct(DatabaseDriver $db) { parent::__construct('#__rereplacer', 'id', $db); } /** * Overloaded check function * * @return boolean * * @since 1.6 */ public function check() { try { parent::check(); } catch (Exception $e) { $this->setError($e->getMessage()); return false; } $this->name = trim($this->name); $this->search = trim($this->search); // Check for valid name if (empty($this->name)) { $this->setError(JText::_('RR_THE_ITEM_MUST_HAVE_A_NAME')); return false; } if (trim($this->search) == '') { $this->setError(JText::_('RR_THE_ITEM_MUST_HAVE_SOMETHING_TO_SEARCH_FOR')); return false; } return true; } } services/provider.php 0000604 00000003550 15174106422 0010733 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ defined('_JEXEC') or die; use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface; use Joomla\CMS\Extension\ComponentInterface; use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory; use Joomla\CMS\Extension\Service\Provider\MVCFactory; use Joomla\CMS\Extension\Service\Provider\RouterFactory; use Joomla\CMS\HTML\Registry; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\DI\Container; use Joomla\DI\ServiceProviderInterface; use RegularLabs\Component\ReReplacer\Administrator\Extension\Component; return new class implements ServiceProviderInterface { /** * Registers the service provider with a DI container. * * @param Container $container The DI container. * * @return void */ public function register(Container $container) { $container->registerServiceProvider(new MVCFactory('\\RegularLabs\\Component\\ReReplacer')); $container->registerServiceProvider(new ComponentDispatcherFactory('\\RegularLabs\\Component\\ReReplacer')); $container->registerServiceProvider(new RouterFactory('\\RegularLabs\\Component\\ReReplacer')); $container->set( ComponentInterface::class, function (Container $container) { $component = new Component($container->get(ComponentDispatcherFactoryInterface::class)); $component->setMVCFactory($container->get(MVCFactoryInterface::class)); $component->setRegistry($container->get(Registry::class)); return $component; } ); } }; forms/items.xml 0000604 00000000662 15174106422 0007537 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <form addfieldprefix="RegularLabs\Library\Form\Field"> <fieldset name="import"> <field name="file" type="File" accept=".json" label="RR_CHOOSE_FILE"/> <field name="publish_all" type="List" default="2" label="RR_PUBLISH_ITEMS"> <option value="1">JYES</option> <option value="0">JNO</option> <option value="2">RL_AS_EXPORTED</option> </field> </fieldset> </form> forms/item.xml 0000604 00000025077 15174106422 0007363 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <form addfieldprefix="RegularLabs\Library\Form\Field"> <fieldset> <field name="id" type="Number" default="0" class="readonly" readonly="true" label="JGLOBAL_FIELD_ID_LABEL"/> <field name="name" type="Text" default="" required="true" label="JGLOBAL_TITLE"/> </fieldset> <fieldset name="details"> <field name="published" type="List" default="1" size="1" class="form-select-color-state" label="JSTATUS"> <option value="1">JPUBLISHED</option> <option value="0">JUNPUBLISHED</option> <option value="-2">JTRASHED</option> </field> <field name="description" type="Textarea" height="160" default="" label="JGLOBAL_DESCRIPTION" description="RR_DESCRIPTION_DESC"/> </fieldset> <fieldset name="category"> <field name="category" type="SimpleCategory" default="" table="rereplacer" label="JCATEGORY" description="JGLOBAL_CHOOSE_CATEGORY_DESC"/> </fieldset> <fieldset name="search"> <field name="@block__search__a" type="Block" start="1" label="RR_SEARCH" showon="use_xml:0"/> <field name="@note__search_list" type="Note" class="rl-alert alert alert-warning" text="RR_SEARCH_LIST_DESC" showon="regex:0[AND]treat_as_list:1"/> <field name="@note__search_regex" type="Note" class="rl-alert alert alert-warning" text="RR_SEARCH_REGULAR_EXPRESSIONS_DESC" showon="regex:1"/> <field name="@note__search_regex_2" type="Note" class="rl-alert alert alert-info rl-alert-light" text="RR_HELP_ON_REGULAR_EXPRESSIONS,<a href="index.php?option=com_rereplacer&view=item&layout=regular_expressions&tmpl=component" target="_blank">,</a>" showon="regex:1"/> <field name="search" type="Editor" editor="codemirror" syntax="php" height="120" default="" label="" hiddenLabel="true"/> <field name="@block__search__b" type="Block" end="1"/> </fieldset> <fieldset name="replace"> <field name="@block__replace__a" type="Block" start="1" label="RR_REPLACE" showon="use_xml:0"/> <field name="@note__replace_list" type="Note" class="rl-alert alert alert-warning" text="RR_REPLACE_LIST_DESC" showon="regex:0[AND]treat_as_list:1"/> <field name="@note__replace_regex" type="Note" class="rl-alert alert alert-warning" text="RR_REPLACE_REGULAR_EXPRESSIONS_DESC" showon="regex:1"/> <field name="replace" type="Editor" editor="codemirror" syntax="php" height="120" default="" label="" hiddenLabel="true"/> <field name="@block__replace__b" type="Block" end="1"/> </fieldset> <fieldset name="xml"> </fieldset> <fieldset name="options"> <field name="@note__use_xml" type="OnlyPro" label="RR_USE_XML_FILE" description="RR_USE_XML_FILE_DESC"/> <field name="use_xml" type="Hidden" default="0"/> <field name="regex" type="Radio" default="0" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RR_REGULAR_EXPRESSIONS" description="RR_REGULAR_EXPRESSIONS_DESC"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="treat_as_list" type="Radio" default="0" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RR_TREAT_AS_LIST" description="RR_TREAT_AS_LIST_DESC" showon="regex:0"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="word_search" type="Radio" default="0" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RR_WORD_SEARCH" description="RR_WORD_SEARCH_DESC" showon="regex:0"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="s_modifier" type="Radio" default="1" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RR_USE_S_MODIFIER" description="RR_USE_S_MODIFIER_DESC" showon="regex:1"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="casesensitive" type="Radio" default="0" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RR_CASE_SENSITIVE" description="RR_CASE_SENSITIVE_DESC"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="max_replacements" type="Number" default="0" size="5" min="0" max="10" step="1" class="input-mini text-right" label="RR_MAX_REPLACEMENTS" description="RR_MAX_REPLACEMENTS_DESC"/> <field name="max_replacements" type="List" size="1" default="" class="w-auto" label="RR_MAX_REPLACEMENTS" description="RR_MAX_REPLACEMENTS_DESC"> <option value="" class="text-center">RR_REPLACE_ALL</option> <option value="1" class="text-center">1</option> <option value="2" class="text-center">2</option> <option value="3" class="text-center">3</option> <option value="4" class="text-center">4</option> <option value="5" class="text-center">5</option> <option value="6" class="text-center">6</option> <option value="7" class="text-center">7</option> <option value="8" class="text-center">8</option> <option value="9" class="text-center">9</option> <option value="10" class="text-center">10</option> </field> <field name="thorough" type="Radio" default="0" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RR_THOROUGH" description="RR_THOROUGH_DESC" showon="max_replacements:"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="strip_p_tags" type="Radio" default="0" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RR_STRIP_SURROUNDING_P_TAGS" description="RR_STRIP_SURROUNDING_P_TAGS_DESC"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="@note__treat_as_php" type="OnlyPro" label="RR_REPLACE_WITH_PHP" description="RR_REPLACE_WITH_PHP_DESC"/> </fieldset> <fieldset name="areas_1"> <field name="area" type="List" default="body" class="w-auto" label="RR_ENABLE_IN_AREA" description="RR_ENABLE_IN_AREA_TEMPLATE,RR_ENABLE_IN_AREA_DESC,RR_AREA_CONTENT,RR_AREA_CONTENT_DESC,RR_AREA_COMPONENT,RR_AREA_COMPONENT_DESC,RR_AREA_HEAD,RR_AREA_HEAD_DESC,RR_AREA_BODY,RR_AREA_BODY_DESC,RR_AREA_EVERYWHERE,RR_AREA_EVERYWHERE_DESC"> <option value="articles">RR_AREA_CONTENT</option> <option value="component">RR_AREA_COMPONENT</option> <option value="head">RR_AREA_HEAD</option> <option value="body">RR_AREA_BODY</option> <option value="everywhere">RR_AREA_EVERYWHERE</option> </field> <field name="@showon__areas_articles__a" type="ShowOn" value="area:articles"/> <field name="@note__areas_articles" type="Note" class="rl-alert alert alert-warning" text="RR_AREA_CONTENT_NOTE"/> <field name="enable_in_title" type="Radio" default="1" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RR_ENABLE_IN_TITLE" description="RR_ENABLE_IN_TITLE_DESC"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="enable_in_content" type="Radio" default="1" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RR_ENABLE_IN_CONTENT" description="RR_ENABLE_IN_CONTENT_DESC"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="enable_in_author" type="Radio" default="1" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RR_ENABLE_IN_AUTHOR" description="RR_ENABLE_IN_AUTHOR_DESC"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="enable_in_category" type="Radio" default="1" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RR_ENABLE_IN_CATEGORY" description="RR_ENABLE_IN_CATEGORY_DESC"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="@showon__areas_articles__b" type="ShowOn"/> <field name="enable_in_feeds" type="Radio" default="1" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RR_ENABLE_IN_FEEDS" description="RR_ENABLE_IN_FEEDS_DESC"> <option value="0">JNO</option> <option value="1">JYES</option> <option value="2" class="btn btn-outline-info">RL_ONLY</option> </field> <field name="enable_in_admin" type="Radio" default="0" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RR_ENABLE_IN_ADMIN" description="RR_ENABLE_IN_ADMIN_DESC"> <option value="0">JNO</option> <option value="1">JYES</option> <option value="2" class="btn btn-outline-info">RL_ONLY</option> </field> <field name="@note__areas_enable_in_admin" type="Note" class="rl-alert alert alert-warning" text="RR_ENABLE_IN_ADMIN_ARE_YOU_SURE" showon="enable_in_admin:1,2"/> <field name="enable_in_edit_forms" type="Radio" default="0" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RR_ENABLE_IN_EDIT_FORMS" description="RR_ENABLE_IN_EDIT_FORMS_DESC"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="@note__enable_in_edit_forms" type="Note" class="rl-alert alert alert-warning" text="RR_ENABLE_IN_EDIT_FORMS_ARE_YOU_SURE" showon="enable_in_edit_forms:1"/> </fieldset> <fieldset name="areas_2"> <field name="@note__between_start" type="OnlyPro" label="RR_ONLY_BETWEEN_START" description="%s<br><br>%s,RR_ONLY_BETWEEN_DESC,RR_ONLY_BETWEEN_EXAMPLE"/> <field name="@note__between_end" type="OnlyPro" label="RR_ONLY_BETWEEN_END" description="%s<br><br>%s,RR_ONLY_BETWEEN_DESC,RR_ONLY_BETWEEN_EXAMPLE"/> <field name="@note__enable_tags" type="OnlyPro" label="RR_ENABLE_IN_TAGS" description="RR_ENABLE_IN_TAGS_DESC"/> <field name="@note__limit_tagselect" type="OnlyPro" label="RR_LIMIT_TO_TAG_SELECTION" description="RR_LIMIT_TO_TAG_SELECTION_DESC"/> </fieldset> <fieldset name="conditions"> <field name="@load_language_conditions" type="LoadLanguage" extension="com_conditions"/> <field name="@note__assignments" type="OnlyPro"/> </fieldset> <!-- ELSE --> <fieldset name="other_replace"> <field name="@showon__other_replace__a" type="ShowOn" value="has_conditions:1"/> <field name="@block__other_replace__a" type="Block" start="1"/> <field name="other_doreplace" type="Radio" default="0" class="btn-group rl-btn-group" label="RR_ELSE" description="RR_ELSE_DESC"> <option value="0">RR_DO_NOTHING</option> <option value="1" class="btn btn-outline-info">RR_REPLACE_WITH_SOMETHING_ELSE</option> </field> <field name="other_replace" type="Editor" editor="codemirror" height="120" default="" label="RR_REPLACE" description="RR_REPLACE_DESC" showon="other_doreplace:1"/> <field name="@block__other_replace__b" type="Block" end="1"/> <field name="@showon__other_replace__b" type="ShowOn"/> </fieldset> <!-- <<< [PRO] <<< --> </form> forms/filter_items.xml 0000604 00000006006 15174106422 0011102 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <form addfieldprefix="RegularLabs\Library\Form\Field"> <fields name="filter"> <field name="search" type="Text" label="JSEARCH_FILTER_LABEL" hint="JSEARCH_FILTER"/> <field name="state" type="Status" optionsFilter="-2,0,1,*" label="JPUBLISHED" onchange="this.form.submit();"> <option value="">JOPTION_SELECT_PUBLISHED</option> </field> <field name="category" type="SimpleCategory" table="rereplacer" show_none="0" show_new="0" label="JCATEGORY" onchange="this.form.submit();"> <option value="">RL_SELECT_A_CATEGORY</option> </field> <field name="casesensitive" type="List" label="JPUBLISHED" onchange="this.form.submit();"> <option value="">RR_OPTION_SELECT_CASE_SENSITIVE</option> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="regex" type="List" label="JPUBLISHED" onchange="this.form.submit();"> <option value="">RR_OPTION_SELECT_REGULAR_EXPRESSIONS</option> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="enable_in_admin" type="List" label="JPUBLISHED" onchange="this.form.submit();"> <option value="">RR_OPTION_SELECT_ENABLE_IN_ADMIN</option> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="area" type="List" label="JPUBLISHED" onchange="this.form.submit();"> <option value="">RR_OPTION_SELECT_SEARCH_AREA</option> <option value="articles">RR_AREA_CONTENT</option> <option value="component">RR_AREA_COMPONENT</option> <option value="head">RR_AREA_HEAD</option> <option value="body">RR_AREA_BODY</option> <option value="everywhere">RR_AREA_EVERYWHERE</option> </field> </fields> <fields name="list"> <field name="fullordering" type="List" label="RL_LIST_FULL_ORDERING" onchange="this.form.submit();" default="a.ordering ASC"> <option value="">JGLOBAL_SORT_BY</option> <option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option> <option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option> <option value="a.published ASC">JSTATUS_ASC</option> <option value="a.published DESC">JSTATUS_DESC</option> <option value="a.name ASC">JGLOBAL_TITLE_ASC</option> <option value="a.name DESC">JGLOBAL_TITLE_DESC</option> <option value="a.description ASC">RL_HEADING_DESCRIPTION_ASC</option> <option value="a.description DESC">RL_HEADING_DESCRIPTION_DESC</option> <option value="a.category ASC">RL_HEADING_CATEGORY_ASC</option> <option value="a.category DESC">RL_HEADING_CATEGORY_DESC</option> <option value="a.color ASC">RL_HEADING_COLOR_ASC</option> <option value="a.color DESC">RL_HEADING_COLOR_DESC</option> <option value="a.id ASC">JGRID_HEADING_ID_ASC</option> <option value="a.id DESC">JGRID_HEADING_ID_DESC</option> </field> <field name="limit" type="Limitbox" label="JGLOBAL_LIST_LIMIT" default="25" onchange="this.form.submit();"/> </fields> </form> tmpl/items/default_import_footer.php 0000604 00000003157 15174106422 0013752 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ defined('_JEXEC') or die; use Joomla\CMS\Language\Text as JText; use RegularLabs\Library\Document as RL_Document; ?> <button type="button" class="btn btn-danger" data-bs-dismiss="modal"> <span class="icon-cancel" aria-hidden="true"></span> <?php echo JText::_('JCANCEL'); ?> </button> <button type="submit" id='import-submit-button-id' class="btn btn-success" data-submit-task='items.import'> <span class="icon-file-import" aria-hidden="true"></span> <?php echo JText::_('RL_IMPORT'); ?> </button> <?php RL_Document::scriptDeclaration(" (function(document, submitForm) { 'use strict'; var buttonDataSelector = 'data-submit-task'; var formId = 'adminForm'; var submitTask = function submitTask(task) { var form = document.getElementById(formId); if (form && task === 'items.import') { submitForm(task, form); } }; document.addEventListener('DOMContentLoaded', function() { var button = document.getElementById('import-submit-button-id'); if (button) { button.addEventListener('click', function(e) { var task = e.target.getAttribute(buttonDataSelector); submitTask(task); return false; }); } }); })(document, Joomla.submitform); "); ?> tmpl/items/default_import_body.php 0000604 00000001134 15174106422 0013402 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ defined('_JEXEC') or die; use Joomla\CMS\Factory; $published = (int) $this->state->get('filter.published'); $user = Factory::getUser(); ?> <div class="container rl-modal"> <div class="form-vertical"> <?php echo $this->form->renderFieldset('import'); ?> </div> </div> tmpl/items/default.php 0000604 00000042225 15174106422 0011001 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ defined('_JEXEC') or die; use Joomla\CMS\Factory as JFactory; use Joomla\CMS\HTML\HTMLHelper as JHtml; use Joomla\CMS\Language\Text as JText; use Joomla\CMS\Layout\LayoutHelper as JLayout; use Joomla\CMS\Router\Route as JRoute; use Joomla\CMS\Session\Session; use RegularLabs\Library\Document as RL_Document; use RegularLabs\Library\DownloadKey as RL_DownloadKey; use RegularLabs\Library\Form\Field\MiniColorField; use RegularLabs\Library\License as RL_License; use RegularLabs\Library\StringHelper as RL_String; use RegularLabs\Library\Version as RL_Version; RL_Document::style('regularlabs.admin-form'); $listOrder = RL_String::escape($this->state->get('list.ordering')); $listDirn = RL_String::escape($this->state->get('list.direction')); $ordering = ($listOrder == 'a.ordering'); $user = JFactory::getUser(); $canCreate = $user->authorise('core.create', 'com_rereplacer'); $canEdit = $user->authorise('core.edit', 'com_rereplacer'); $canChange = $user->authorise('core.edit.state', 'com_rereplacer'); $canCheckin = $user->authorise('core.manage', 'com_checkin'); $saveOrder = ($listOrder == 'a.ordering') && ! empty($this->items); if ($saveOrder) { $saveOrderingUrl = 'index.php?option=com_rereplacer&task=items.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1'; JHtml::_('draggablelist.draggable'); } $showColors = $this->config->use_colors; $showCategories = ($this->hasCategories && $this->config->use_categories); $cols = 10; $cols += ($this->config->show_fields ? 2 : 0); $cols += ($showColors ? 1 : 0); $cols += ($showCategories ? 1 : 0); if ($this->config->show_update_notification) { // Version check echo RL_Version::getMessage('REREPLACER'); } ?> <form action="<?php echo JRoute::_('index.php?option=com_rereplacer&view=items'); ?>" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data"> <?php // Search tools bar echo JLayout::render('joomla.searchtools.default', ['view' => $this]); ?> <table class="table table-striped" id="itemList"> <thead> <tr> <td scope="col" class="w-1 text-center d-none d-md-table-cell"> <?php echo JHtml::_('grid.checkall'); ?> </td> <th scope="col" class="w-1 text-center d-none d-md-table-cell"> <?php echo JHtml::_('searchtools.sort', '', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-sort'); ?> </th> <?php if ($showColors) : ?> <th scope="col" class="w-1 text-center d-none d-md-table-cell"> <?php echo JHtml::_('searchtools.sort', '', 'a.color', $listDirn, $listOrder); ?> </th> <?php endif; ?> <th scope="col" class="w-1 text-nowrap text-center"> <?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder); ?> </th> <th scope="col" class=""> <?php echo JHtml::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.name', $listDirn, $listOrder); ?> </th> <th scope="col" class="d-none d-md-table-cell"> <?php echo JHtml::_('searchtools.sort', 'JGLOBAL_DESCRIPTION', 'a.description', $listDirn, $listOrder); ?> </th> <?php if ($this->config->show_fields) : ?> <th scope="col" class="w-10 title d-none d-md-table-cell"> <?php echo JHtml::_('searchtools.sort', 'RR_SEARCH', 'a.search', $listDirn, $listOrder); ?> </th> <th scope="col" class="w-10 title d-none d-md-table-cell"> <?php echo JHtml::_('searchtools.sort', 'RR_REPLACE', 'a.replace', $listDirn, $listOrder); ?> </th> <?php endif; ?> <?php if ($showCategories) : ?> <th scope="col" class="w-3 text-nowrap d-none d-md-table-cell"> <?php echo JHtml::_('searchtools.sort', 'JCATEGORY', 'a.category', $listDirn, $listOrder); ?> </th> <?php endif; ?> <th scope="col" class="w-3 text-nowrap text-center d-none d-md-table-cell"> <?php echo JText::_('RR_CASE'); ?> </th> <th scope="col" class="w-3 text-nowrap text-center d-none d-md-table-cell"> <?php echo JText::_('RR_REGEX'); ?> </th> <th scope="col" class="w-3 text-nowrap text-center d-none d-md-table-cell"> <?php echo JText::_('RR_ADMIN'); ?> </th> <th scope="col" class="w-3 text-nowrap d-none d-md-table-cell"> <?php echo JText::_('RR_AREA'); ?> </th> <th scope="col" class="w-1 text-nowrap text-center d-none d-md-table-cell"> <?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?> </th> </tr> </thead> <tbody <?php if ($saveOrder) : ?> class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="<?php echo strtolower($listDirn); ?>" data-nested="false"<?php endif; ?>> <?php if (empty($this->items)): ?> <tr> <td colspan="<?php echo $cols; ?>"> <?php echo JText::_('RL_NO_ITEMS_FOUND'); ?> </td> </tr> <?php else: ?> <?php foreach ($this->items as $i => $item) : ?> <?php $canCheckinItem = ($canCheckin || $item->checked_out == 0 || $item->checked_out == $user->get('id')); $canChangeItem = ($canChange && $canCheckinItem); if ( ! empty($item->casesensitive)) { $case = '<span class=" " rel="tooltip" title="' . JText::_('RR_CASE_SENSITIVE') . '"><span class="icon-publish text-success" aria-hidden="true"></span></span>'; } else { $case = '<span class="disabled" rel="tooltip" title="' . JText::_('RL_NOT') . ' ' . JText::_('RR_CASE_SENSITIVE') . '"><span class="icon-cancel" aria-hidden="true"></span></span>'; } if ( ! empty($item->regex)) { $regex = '<span class="" rel="tooltip" title="' . JText::_('RR_REGULAR_EXPRESSIONS') . '"><span class="icon-publish text-success" aria-hidden="true"></span></span>'; } else { $regex = '<span class="disabled" rel="tooltip" title="' . JText::_('RL_NOT') . ' ' . JText::_('RR_REGULAR_EXPRESSIONS') . '"><span class="icon-cancel" aria-hidden="true"></span></span>'; } if ( ! empty($item->enable_in_admin)) { $enable_in_admin = '<span class="" rel="tooltip" title="' . JText::_('RR_ENABLE_IN_ADMIN') . '"><span class="icon-publish text-success" aria-hidden="true"></span></span>'; } else { $enable_in_admin = '<span class="disabled" rel="tooltip" title="' . JText::_('RL_NOT') . ' ' . JText::_('RR_ENABLE_IN_ADMIN') . '"><span class="icon-cancel" aria-hidden="true"></span></span>'; } $description = explode('---', $item->description); $area_name = $item->area == 'articles' ? 'CONTENT' : strtoupper($item->area); $area = JText::_('RR_AREA_' . $area_name . '_SHORT'); $area_tip = JText::_('RR_AREA_' . $area_name); ?> <tr class="row<?php echo $i % 2; ?>" data-draggable-group="<?php echo $item->area; ?>"> <td class="text-center d-none d-md-table-cell"> <?php echo JHtml::_('grid.id', $i, $item->id); ?> </td> <td class="order text-nowrap text-center d-none d-md-table-cell d-none d-md-table-cell"> <?php $iconClass = ''; if ( ! $canChange) { $iconClass = ' inactive'; } elseif ( ! $saveOrder) { $iconClass = ' inactive" title="' . JText::_('JORDERINGDISABLED'); } ?> <span class="sortable-handler<?php echo $iconClass ?>"> <span class="icon-ellipsis-v" aria-hidden="true"></span> </span> <?php if ($canChange && $saveOrder) : ?> <input type="text" class="hidden" name="order[]" size="5" value="<?php echo $item->ordering; ?>"> <?php endif; ?> </td> <?php if ($showColors) : ?> <td class="center inlist"> <?php $colorfield = new MiniColorField; $color = $item->color ?? ''; $element = new SimpleXMLElement( '<field id="color_' . $i . '" name="color_' . $i . '" type="MiniColor" default="" colors="' . ($this->config->main_colors ?? '') . '" table="rereplacer" item_id="' . $item->id . '" />' ); $element->value = $color; $colorfield->setup($element, $color); echo $colorfield->__get('input'); ?> </td> <?php endif; ?> <td class="text-center"> <?php echo JHtml::_('jgrid.published', $item->published, $i, 'items.', $canChangeItem); ?> </td> <td> <?php if ($item->checked_out) : ?> <?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'items.', $canCheckin); ?> <?php endif; ?> <?php if ($canEdit) : ?> <a href="<?php echo JRoute::_('index.php?option=com_rereplacer&task=item.edit&id=' . $item->id); ?>"> <?php echo RL_String::escape($item->name); ?></a> <?php else : ?> <?php echo RL_String::escape($item->name); ?> <?php endif; ?> </td> <td class="d-none d-md-table-cell"> <span><?php echo nl2br(RL_String::escape(trim($description[0]))); ?></span> <?php if ( ! empty($description[1])) : ?> <div role="tooltip"><?php echo nl2br(RL_String::escape(trim($description[1]))); ?></div> <?php endif; ?> </td> <?php if ($this->config->show_fields) : ?> <?php if ($item->use_xml) : ?> <td class="d-none d-md-table-cell" colspan="2"> <em>(<?php echo RL_String::escape(JText::_('RR_USES_XML_FILE')); ?>)</em> </td> <?php else : ?> <td class="d-none d-md-table-cell"> <span><?php echo RL_String::escape(RL_String::truncate(trim($item->search), 60)); ?></span> <?php if (RL_String::strlen(trim($item->search)) > 60) : ?> <div role="tooltip"> <strong><?php echo JText::_('RR_SEARCH'); ?></strong><br> <?php echo $item->search; ?> </div> <?php endif; ?> </td> <td class="d-none d-md-table-cell"> <span><?php echo RL_String::escape(RL_String::truncate(trim($item->replace), 60)); ?></span> <?php if (RL_String::strlen(trim($item->replace)) > 60) : ?> <div role="tooltip"> <strong><?php echo JText::_('RR_REPLACE'); ?></strong><br> <?php echo $item->replace; ?> </div> <?php endif; ?> </td> <?php endif; ?> <?php endif; ?> <?php if ($showCategories) : ?> <td class="d-none d-md-table-cell"> <?php $category = $item->category; $category_icon = ''; if (str_contains($category, '::')) { [$category, $category_icon] = explode('::', $category, 2); $category_icon = '<span class="icon-' . $category_icon . '"></span>'; } echo $category ? '<span class="badge rl-bg-teal">' . $category_icon . $category . '</span>' : ''; ?> </td> <?php endif; ?> <td class="text-center d-none d-md-table-cell"> <?php echo $case; ?> </td> <td class="text-center d-none d-md-table-cell"> <?php echo $regex; ?> </td> <td class="text-center d-none d-md-table-cell"> <?php echo $enable_in_admin; ?> </td> <td class="d-none d-md-table-cell"> <span rel="tooltip" title="<?php echo $area_tip; ?>"><?php echo $area; ?></span> </td> <td class="text-center d-none d-md-table-cell"> <?php echo (int) $item->id; ?> </td> </tr> <?php endforeach; ?> <?php endif; ?> </tbody> </table> <?php // load the pagination. ?> <?php echo $this->pagination->getListFooter(); ?> <?php if ($canCreate) : ?> <?php echo JHtml::_( 'bootstrap.renderModal', 'importModal', [ 'title' => JText::_('RL_IMPORT_ITEMS'), 'footer' => $this->loadTemplate('import_footer'), ], $this->loadTemplate('import_body') ); ?> <?php endif; ?> <input type="hidden" name="task" value=""> <input type="hidden" name="boxchecked" value="0"> <?php echo JHtml::_('form.token'); ?> </form> <?php // PRO Check echo RL_License::getMessage('REREPLACER'); // Copyright echo RL_Version::getFooter('REREPLACER'); tmpl/item/edit.php 0000604 00000011410 15174106422 0010107 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ defined('_JEXEC') or die; use Joomla\CMS\HTML\HTMLHelper as JHtml; use Joomla\CMS\Language\Text as JText; use Joomla\CMS\Layout\LayoutHelper as JLayout; use Joomla\CMS\Router\Route as JRoute; use RegularLabs\Library\Document as RL_Document; use RegularLabs\Library\Form\Field\MiniColorField; use RegularLabs\Library\Language as RL_Language; RL_Document::useScript('keepalive'); RL_Document::useScript('form.validate'); RL_Document::script('regularlabs.admin-form'); RL_Document::script('regularlabs.admin-form-descriptions'); RL_Language::load('com_conditions'); ?> <form action="<?php echo JRoute::_('index.php?option=com_rereplacer&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="item-form" aria-label="<?php echo JText::_('COM_REREPLACER_FORM_' . ((int) $this->item->id === 0 ? 'NEW' : 'EDIT'), true); ?>" class="form-validate"> <?php echo JLayout::render('joomla.edit.title_alias', $this); ?> <fieldset class="mt-3"> <?php echo JHtml::_('uitab.startTabSet', 'main', ['active' => 'details']); ?> <?php echo JHtml::_('uitab.addTab', 'main', 'details', JText::_('JDETAILS')); ?> <div class="row form-vertical"> <div class="col-xl-6"> <?php echo $this->form->renderFieldset('search'); ?> <?php echo $this->form->renderFieldset('replace'); ?> <?php echo $this->form->renderFieldset('xml'); ?> </div> <div class="col-lg-6 col-xl-3"> <?php echo $this->form->renderFieldset('options'); ?> </div> <div class="col-lg-6 col-xl-3"> <?php echo $this->form->renderFieldset('details'); ?> <?php if ($this->config->use_categories) : ?> <?php echo $this->form->renderFieldset('category'); ?> <?php endif; ?> <?php if ($this->config->use_colors) : ?> <div class="control-group"> <div class="control-label"> <label id="jform_extra_color-lbl" for="jform_extra_color" role="button" tabindex="0"> <?php echo JText::_('RL_COLOR'); ?> </label> </div> <div class="controls"> <?php $colorfield = new MiniColorField; $color = $this->item->color ?? ''; $element = new SimpleXMLElement( '<field name="jform[color]" type="MiniColor" default="" colors="' . ($this->config->main_colors ?? '') . '" table="rereplacer" item_id="' . $this->item->id . '" />' ); $element->value = $color; $colorfield->setup($element, $color); echo $colorfield->__get('input'); ?> </div> </div> <?php endif; ?> </div> </div> <?php echo JHtml::_('uitab.endTab'); ?> <?php echo JHtml::_('uitab.addTab', 'main', 'areas', JText::_('RR_SEARCH_AREAS')); ?> <div class="row form-vertical"> <div class="col-lg-6"> <?php echo $this->form->renderFieldset('areas_1'); ?> </div> <div class="col-lg-6"> <?php echo $this->form->renderFieldset('areas_2'); ?> </div> </div> <?php echo JHtml::_('uitab.endTab'); ?> <?php echo JHtml::_('uitab.addTab', 'main', 'conditions', JText::_('RL_CONDITIONS')); ?> <div class="row form-vertical"> <div class="col-lg-6"> <?php echo $this->form->renderFieldset('conditions'); ?> </div> <div class="col-lg-6"> <?php echo $this->form->renderFieldset('other_replace'); ?> </div> </div> <?php echo JHtml::_('uitab.endTab'); ?> <?php echo JHtml::_('uitab.endTabSet'); ?> <input type="hidden" name="task" value=""> <?php echo JHtml::_('form.token'); ?> </fieldset> </form> tmpl/item/regular_expressions.php 0000604 00000000664 15174106422 0013276 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ defined('_JEXEC') or die; ?> <img src="/media/rereplacer/images/regular-expressions-cheat-sheet-v2.png" width="763"> tmpl/item/dynamic_tags.php 0000604 00000025554 15174106422 0011642 0 ustar 00 <?php /** * @package ReReplacer * @version 14.4.1 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ defined('_JEXEC') or die; use Joomla\CMS\Factory as JFactory; use Joomla\CMS\Language\Text as JText; use RegularLabs\Library\Alias as RL_Alias; use RegularLabs\Library\Date as RL_Date; $user = JFactory::getApplication()->getIdentity() ?: JFactory::getUser(); $contact = (object) []; $db = JFactory::getDbo(); $table_name = $db->getPrefix() . 'contact_details'; if (in_array($table_name, $db->getTableList())) { $query = 'SHOW FIELDS FROM ' . $db->quoteName($table_name); $db->setQuery($query); $columns = $db->loadColumn(); if (in_array('misc', $columns)) { $query = $db->getQuery(true) ->select('c.misc') ->from('#__contact_details as c') ->where('c.user_id = ' . (int) $user->id); $db->setQuery($query); $contact = $db->loadObject(); } } $yes = '<td class="text-center text-success"><span class="icon-checkmark" aria-hidden="true"></span> ' . JText::_('JYES') . '</td>'; $no = '<td class="text-center text-danger" class="text-muted"><span class="icon-cancel" aria-hidden="true"></span> ' . JText::_('JNO') . '</td>'; ?> <div class="alert alert-danger"> <?php echo JText::_('RL_ONLY_AVAILABLE_IN_PRO'); ?> </div> <p><?php echo JText::_('RR_DYNAMIC_TAGS_DESC'); ?></p> <table class="table table-striped"> <thead> <tr> <th class="fw-bold" width="50%"> <?php echo JText::_('RL_INPUT_SYNTAX'); ?> </th> <th class="fw-bold"> <span><?php echo JText::_('RL_OUTPUT_EXAMPLE'); ?></span> </th> <th class="fw-bold"> <span><?php echo JText::_('JGLOBAL_DESCRIPTION'); ?></span> </th> <th class="text-center fw-bold"> <span rel="tooltip" title="<?php echo JText::_('RR_USE_IN_SEARCH'); ?>"><?php echo JText::_('RR_SEARCH'); ?></span> </th> <th class="text-center fw-bold"> <span rel="tooltip" title="<?php echo JText::_('RR_USE_IN_REPLACE'); ?>"><?php echo JText::_('RR_REPLACE'); ?></span> </th> </tr> </thead> <tbody> <tr> <td><code>[[comma]]</code></td> <td>,</td> <td><?php echo JText::_('RR_USE_INSTEAD_OF_A_COMMA,RR_TREAT_AS_LIST'); ?></td> <?php echo $yes; ?> <?php echo $yes; ?> </tr> <tr> <td><code>[[space]]</code></td> <td></td> <td><?php echo JText::_('RR_USE_FOR_LEADING_OR_TRAILING_SPACES'); ?></td> <?php echo $yes; ?> <?php echo $yes; ?> </tr> <tr> <td><code>[[user:id]]</code></td> <td><?php echo $user->id; ?></td> <td> <?php echo JText::_('RL_DYNAMIC_TAG_USER_ID'); ?> <br><em class="text-muted"><?php echo JText::_('RL_DYNAMIC_TAG_USER_TAG_DESC'); ?></em> </td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code>[[user:username]]</code></td> <td><?php echo $user->username; ?></td> <td> <?php echo JText::_('RL_DYNAMIC_TAG_USER_USERNAME'); ?> <br><em class="text-muted"><?php echo JText::_('RL_DYNAMIC_TAG_USER_TAG_DESC'); ?></em> </td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code>[[user:name]]</code></td> <td><?php echo $user->name; ?></td> <td> <?php echo JText::_('RL_DYNAMIC_TAG_USER_NAME'); ?> <br><em class="text-muted"><?php echo JText::_('RL_DYNAMIC_TAG_USER_TAG_DESC'); ?></em> </td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code>[[user:misc]]</code></td> <td><?php echo $contact->misc ?? ''; ?></td> <td> <?php echo JText::_('RL_DYNAMIC_TAG_USER_OTHER'); ?> <br><em class="text-muted"><?php echo JText::_('RL_DYNAMIC_TAG_USER_TAG_DESC'); ?></em> </td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code>[[article:id]]</code></td> <td>123</td> <td> <?php echo JText::_('RL_DYNAMIC_TAG_ARTICLE_ID'); ?> <br><em class="text-muted"> <?php echo JText::_('RR_ONLY_AVAILABLE_IN_SEARCH_AREA,RR_ENABLE_IN_AREA,RR_AREA_CONTENT'); ?> </em> </td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code>[[article:title]]</code></td> <td>My Article</td> <td> <?php echo JText::_('RL_DYNAMIC_TAG_ARTICLE_TITLE'); ?> <br><em class="text-muted"> <?php echo JText::_('RR_ONLY_AVAILABLE_IN_SEARCH_AREA,RR_ENABLE_IN_AREA,RR_AREA_CONTENT'); ?> </em> </td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code>[[article:alias]]</code></td> <td>my-article</td> <td> <?php echo JText::_('RL_DYNAMIC_TAG_ARTICLE_OTHER'); ?> <br><em class="text-muted"> <?php echo JText::_('RR_ONLY_AVAILABLE_IN_SEARCH_AREA,RR_ENABLE_IN_AREA,RR_AREA_CONTENT'); ?> </em> </td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code> [[date:%A, %d %B %Y]]<br> [[date:%Y-%m-%d]] </code></td> <td> <?php echo date(RL_Date::strftimeToDateFormat('%A, %d %B %Y')); ?><br> <?php echo date(RL_Date::strftimeToDateFormat('%Y-%m-%d')); ?> </td> <td><?php echo JText::sprintf('RL_DYNAMIC_TAG_DATE', '<a href="http://www.php.net/manual/function.strftime.php" target="_blank">', '</a>', '<span>[[date: %A, %d %B %Y]]</span>'); ?></td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code> [[random:0-100]]<br> [[random:1000-9999]] </code></td> <td> <?php echo rand(0, 100); ?><br> <?php echo rand(1000, 9999); ?> </td> <td><?php echo JText::_('RL_DYNAMIC_TAG_RANDOM'); ?></td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code> [[random:this,that]]<br> [[random:1-10,20,50,100]] </code></td> <td> <?php $values = ['this', 'that']; echo $values[rand(0, count($values) - 1)]; ?> <br> <?php $values = [rand(1, 10), 20, 50, 100]; echo $values[rand(0, count($values) - 1)]; ?> </td> <td><?php echo JText::_('RL_DYNAMIC_TAG_RANDOM_LIST'); ?></td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code>[[text:MY_STRING]]</code></td> <td><?php echo JText::_('RL_MY_STRING'); ?></td> <td><?php echo JText::_('RL_DYNAMIC_TAG_TEXT'); ?></td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code>[[counter]]</code></td> <td>1</td> <td><?php echo JText::_('RL_DYNAMIC_TAG_COUNTER'); ?></td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code>[[escape]] <wbr> \1 <wbr> [[/escape]]</code></td> <td><?php echo addslashes(html_entity_decode(JText::_('RL_DYNAMIC_TAG_STRING_EXAMPLE'))); ?></td> <td><?php echo JText::_('RL_DYNAMIC_TAG_ESCAPE'); ?></td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code>[[uppercase]] <wbr> \1 <wbr> [[/uppercase]]</code></td> <td><?php echo strtoupper(JText::_('RL_DYNAMIC_TAG_STRING_EXAMPLE')); ?></td> <td><?php echo JText::_('RL_DYNAMIC_TAG_UPPERCASE'); ?></td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code>[[lowercase]] <wbr> \1 <wbr> [[/lowercase]]</code></td> <td><?php echo strtolower(JText::_('RL_DYNAMIC_TAG_STRING_EXAMPLE')); ?></td> <td><?php echo JText::_('RL_DYNAMIC_TAG_LOWERCASE'); ?></td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code>[[notags]] <wbr> \1 <wbr> [[/notags]]</code></td> <td><?php echo strip_tags(JText::_('RL_DYNAMIC_TAG_STRING_EXAMPLE')); ?></td> <td><?php echo JText::_('RL_DYNAMIC_TAG_NOTAGS'); ?></td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code>[[nowhitespace]] <wbr> \1 <wbr> [[/nowhitespace]]</code></td> <td><?php echo str_replace(' ', '', strip_tags(JText::_('RL_DYNAMIC_TAG_STRING_EXAMPLE'))); ?></td> <td><?php echo JText::_('RL_DYNAMIC_TAG_NOWHITESPACE'); ?></td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code>[[toalias]] <wbr> \1 <wbr> [[/toalias]]</code></td> <td><?php echo RL_Alias::get(JText::_('RL_DYNAMIC_TAG_STRING_EXAMPLE')); ?></td> <td><?php echo JText::_('RL_DYNAMIC_TAG_TOALIAS'); ?></td> <?php echo $no; ?> <?php echo $yes; ?> </tr> <tr> <td><code>[[replace from="string" to="different world"]] <wbr> \1 <wbr> [[/replace]]</code></td> <td><?php echo str_replace('string', 'different world', JText::_('RL_DYNAMIC_TAG_STRING_EXAMPLE')); ?></td> <td><?php echo JText::_('RL_DYNAMIC_TAG_REPLACE'); ?></td> <?php echo $no; ?> <?php echo $yes; ?> </tr> </tbody> </table>
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Generation time: 0 |
proxy
|
phpinfo
|
Settings