first commit

This commit is contained in:
2026-02-08 21:16:11 +01:00
commit e17b7026fd
8881 changed files with 1160453 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<config addfieldprefix="RegularLabs\Library\Form\Field">
<fieldset name="code">
<field name="@code" type="Note" class="rl-alert alert alert-info rl-alert-light" text="SRC_CODE_DESC"/>
<field name="@code__a" type="Block" start="1" label="SRC_CODE"/>
<field name="code" type="Editor" editor="codemirror" label=""/>
<field name="@code__b" type="Block" end="1"/>
</fieldset>
<fieldset name="css">
<field name="@css_file__a" type="Block" start="1" label="SRC_FILE"/>
<field name="@css_file" type="Note" text="SRC_CSS_FILE_DESC"/>
<field name="@note__css_file" type="OnlyPro" label=""/>
<field name="@css_file__b" type="Block" end="1"/>
<field name="@css_code__a" type="Block" start="1" label="SRC_CODE"/>
<field name="@css_code" type="Note" text="SRC_CSS_CODE_DESC"/>
<field name="@note__css_code" type="OnlyPro" label=""/>
<field name="@css_code__b" type="Block" end="1"/>
</fieldset>
<fieldset name="js">
<field name="@js_file__a" type="Block" start="1" label="SRC_FILE"/>
<field name="@js_file" type="Note" text="SRC_JS_FILE_DESC"/>
<field name="@note__js_file" type="OnlyPro" label=""/>
<field name="@js_file__b" type="Block" end="1"/>
<field name="@js_code__a" type="Block" start="1" label="SRC_CODE"/>
<field name="@note__js_code" type="OnlyPro" label=""/>
<field name="@js_code__b" type="Block" end="1"/>
</fieldset>
<fieldset name="php">
<field name="@php_file__a" type="Block" start="1" label="SRC_FILE"/>
<field name="@note__php_file" type="OnlyPro" label=""/>
<field name="@php_file__b" type="Block" end="1"/>
<field name="@php_code__a" type="Block" start="1" label="SRC_CODE"/>
<field name="@php_code" type="Note" text="SRC_PHP_CODE_DESC"/>
<field name="@note__php_code" type="OnlyPro" label=""/>
<field name="@php_code__b" type="Block" end="1"/>
</fieldset>
<fieldset name="settings">
<field name="trim" type="Radio" default="0" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="SRC_TRIM" description="SRC_TRIM_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="raw" type="Radio" default="0" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="SRC_RAW" description="SRC_RAW_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
</fieldset>
</config>

View File

@@ -0,0 +1,19 @@
;; @package Sourcerer
;; @version 9.4.1
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link http://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_EDITORS-XTD_SOURCERER="Button - Regular Labs - Sourcerer"
PLG_EDITORS-XTD_SOURCERER_DESC="Sourcerer - place any code in Joomla!"
SOURCERER="Sourcerer"
CODE="Code"
SOURCERER_DESC="With the Sourcerer editor button you can easily place your code (with Sourcerer tags and styling) into your text."
SRC_SETTINGS="Please see the [[%1:start link%]]Sourcerer system plugin[[%2:end link%]] for settings."
SRC_THE_SYSTEM_PLUGIN="the Sourcerer system plugin"

View File

@@ -0,0 +1,13 @@
;; @package Sourcerer
;; @version 9.4.1
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link http://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_EDITORS-XTD_SOURCERER="Button - Regular Labs - Sourcerer"
PLG_EDITORS-XTD_SOURCERER_DESC="Sourcerer - place any code in Joomla!"
SOURCERER="Sourcerer"

View File

@@ -0,0 +1,19 @@
;; @package Sourcerer
;; @version 9.4.1
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link http://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_EDITORS-XTD_SOURCERER="Przycisk - Regular Labs - Sourcerer"
PLG_EDITORS-XTD_SOURCERER_DESC="Sourcerer - Wstaw każdy kod do Joomli!"
SOURCERER="Sourcerer"
CODE="Kod"
SOURCERER_DESC="Za pomocą przycisku Sourcerer edytora można łatwo umieścić kod (z tagów Sourcerer i styling) do tekstu."
SRC_SETTINGS="Więcej informacji na temat ustawień znajdziesz na stronie- [[%1:start link%]]dodatku systemowego Sourcerer[[%2:end link%]]."
SRC_THE_SYSTEM_PLUGIN="dodatek systemowy Sourcerer"

View File

@@ -0,0 +1,13 @@
;; @package Sourcerer
;; @version 9.4.1
;;
;; @author Peter van Westen <info@regularlabs.com>
;; @link http://regularlabs.com
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
;; @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
;;
;; @translate Want to help with translations? See: https://regularlabs.com/translate
PLG_EDITORS-XTD_SOURCERER="Przycisk - Regular Labs - Sourcerer"
PLG_EDITORS-XTD_SOURCERER_DESC="Sourcerer - Wstaw każdy kod do Joomli!"
SOURCERER="Sourcerer"

View File

@@ -0,0 +1,59 @@
<?php
/**
* @package Sourcerer
* @version 9.4.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Filesystem\File as JFile;
use Joomla\CMS\Filesystem\Folder as JFolder;
class PlgEditorsXtdSourcererInstallerScript
{
public function postflight($install_type, $adapter)
{
if ( ! in_array($install_type, ['install', 'update']))
{
return true;
}
self::deleteJoomla3Files();
return true;
}
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_SITE . '/plugins/editors-xtd/sourcerer/layouts',
JPATH_SITE . '/plugins/editors-xtd/sourcerer/fields.xml',
JPATH_SITE . '/plugins/editors-xtd/sourcerer/helper.php',
JPATH_SITE . '/plugins/editors-xtd/sourcerer/popup.php',
JPATH_SITE . '/plugins/editors-xtd/sourcerer/popup.tmpl.php',
]
);
}
}

View File

@@ -0,0 +1,67 @@
<?php
/**
* @package Sourcerer
* @version 9.4.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
use Joomla\CMS\Language\Text as JText;
use Joomla\CMS\Uri\Uri as JUri;
use RegularLabs\Library\Document as RL_Document;
use RegularLabs\Library\EditorButtonPlugin as RL_EditorButtonPlugin;
use RegularLabs\Library\Extension as RL_Extension;
defined('_JEXEC') or die;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/regularlabs.xml')
|| ! is_file(JPATH_LIBRARIES . '/regularlabs/src/EditorButtonPlugin.php')
|| ! is_file(JPATH_LIBRARIES . '/regularlabs/src/DownloadKey.php')
)
{
return;
}
if ( ! RL_Document::isJoomlaVersion(4))
{
RL_Extension::disable('sourcerer', 'plugin', 'editors-xtd');
return;
}
if (true)
{
class PlgButtonSourcerer extends RL_EditorButtonPlugin
{
protected $button_icon = '<svg viewBox="0 0 24 24" style="fill:none;" width="24" height="24" fill="none" stroke="currentColor">'
. '<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4" />'
. '</svg>';
protected function getPopupOptions()
{
$options = parent::getPopupOptions();
$options['confirmCallback'] = 'RegularLabs.Sourcerer.Button.insertText(\'' . $this->editor_name . '\')';
$options['confirmText'] = JText::_('RL_INSERT');
return $options;
}
protected function loadScripts()
{
$params = $this->getParams();
RL_Document::scriptOptions([
'syntax_word' => $params->syntax_word,
'tag_characters' => explode('.', $params->tag_characters),
'color_code' => (bool) $params->color_code,
'root' => JUri::root(true),
], 'Sourcerer');
RL_Document::script('sourcerer.button');
}
}
}

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="4" type="plugin" group="editors-xtd" method="upgrade">
<name>PLG_EDITORS-XTD_SOURCERER</name>
<description>PLG_EDITORS-XTD_SOURCERER_DESC</description>
<version>9.4.1</version>
<creationDate>February 2023</creationDate>
<author>Regular Labs (Peter van Westen)</author>
<authorEmail>info@regularlabs.com</authorEmail>
<authorUrl>https://regularlabs.com</authorUrl>
<copyright>Copyright © 2023 Regular Labs - All Rights Reserved</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<namespace path="src">RegularLabs\Plugin\EditorButton\Sourcerer</namespace>
<scriptfile>script.install.php</scriptfile>
<files>
<file plugin="sourcerer">sourcerer.php</file>
<folder>forms</folder>
<folder>language</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
<config>
<fields name="params" addfieldprefix="RegularLabs\Library\Form\Field">
<fieldset name="basic">
<field name="@load_language_regularlabs" type="LoadLanguage" extension="plg_system_regularlabs"/>
<field name="@license" type="License" extension="SOURCERER"/>
<field name="@version" type="Version" extension="SOURCERER"/>
<field name="@dependency" type="Dependency" label="SRC_THE_SYSTEM_PLUGIN" file="/plugins/system/sourcerer/sourcerer.xml"/>
<field name="@header" type="Header" label="SOURCERER" description="SOURCERER_DESC" url="https://regularlabs.com/sourcerer"/>
<field name="@note__settings" type="Note" class="rl-alert alert alert-info rl-alert-light" text="SRC_SETTINGS,&lt;a href=&quot;index.php?option=com_plugins&amp;filter[folder]=system&amp;filter[search]=sourcerer&quot; target=&quot;_blank&quot;&gt;,&lt;/a&gt;"/>
</fieldset>
</fields>
</config>
</extension>

View File

@@ -0,0 +1,37 @@
<?php
/**
* @package Sourcerer
* @version 9.4.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
namespace RegularLabs\Plugin\EditorButton\Sourcerer;
defined('_JEXEC') or die;
use Joomla\CMS\Factory as JFactory;
use RegularLabs\Library\Document as RL_Document;
use RegularLabs\Library\EditorButtonPopup as RL_EditorButtonPopup;
use RegularLabs\Library\RegEx as RL_RegEx;
class Popup extends RL_EditorButtonPopup
{
protected $extension = 'sourcerer';
protected $require_core_auth = false;
protected function loadScripts()
{
$editor_name = JFactory::getApplication()->input->getString('editor', 'text');
// Remove any dangerous character to prevent cross site scripting
$editor_name = RL_RegEx::replace('[\'\";\s]', '', $editor_name);
RL_Document::script('sourcerer.popup');
$script = "document.addEventListener('DOMContentLoaded', function(){RegularLabs.Sourcerer.Popup.init('" . $editor_name . "')});";
RL_Document::scriptDeclaration($script, 'Sourcerer', true, 'after');
}
}

View File

@@ -0,0 +1,64 @@
<?php
/**
* @package Sourcerer
* @version 9.4.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Editor\Editor as JEditor;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Form\Form as JForm;
use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\CMS\Language\Text as JText;
use Joomla\CMS\Plugin\PluginHelper as JPluginHelper;
$xmlfile = dirname(__FILE__, 2) . '/forms/popup.xml';
$form = new JForm('sourcerer');
$form->loadFile($xmlfile, 1, '//config');
$editor_plugin = JPluginHelper::getPlugin('editors', 'codemirror');
if (empty($editor_plugin))
{
JFactory::getApplication()->enqueueMessage(JText::sprintf('SRC_ERROR_CODEMIRROR_DISABLED', '<a href="index.php?option=com_plugins&filter[folder]=editors&filter[search]=codemirror" target="_blank">', '</a>'), 'error');
return '';
}
$user = JFactory::getApplication()->getIdentity() ?: JFactory::getUser();
$editor = JEditor::getInstance('codemirror');
?>
<div class="container-fluid container-main">
<form action="index.php" id="sourcererForm" method="post" style="width:99%">
<input type="hidden" name="type" id="type" value="url">
<?php echo JHtml::_('uitab.startTabSet', 'main', ['active' => 'code']); ?>
<?php
$tabs = [
'code' => 'SRC_CODE',
'css' => 'SRC_CSS',
'js' => 'SRC_JAVASCRIPT',
'php' => 'SRC_PHP',
'settings' => 'SRC_TAG_SETTINGS',
];
foreach ($tabs as $id => $title)
{
echo JHtml::_('uitab.addTab', 'main', $id, JText::_($title));
echo $form->renderFieldset($id);
echo JHtml::_('uitab.endTab');
}
?>
<?php echo JHtml::_('uitab.endTabSet'); ?>
</form>
</div>