first commit
This commit is contained in:
21
plugins/editors-xtd/article/article.xml
Normal file
21
plugins/editors-xtd/article/article.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="editors-xtd" method="upgrade">
|
||||
<name>plg_editors-xtd_article</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2009-10</creationDate>
|
||||
<copyright>(C) 2009 Open Source Matters, Inc.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>PLG_ARTICLE_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\EditorsXtd\Article</namespace>
|
||||
<files>
|
||||
<folder plugin="article">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_article.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_article.sys.ini</language>
|
||||
</languages>
|
||||
</extension>
|
||||
48
plugins/editors-xtd/article/services/provider.php
Normal file
48
plugins/editors-xtd/article/services/provider.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.article
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\Plugin\EditorsXtd\Article\Extension\Article;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$dispatcher = $container->get(DispatcherInterface::class);
|
||||
|
||||
$plugin = new Article(
|
||||
$dispatcher,
|
||||
(array) PluginHelper::getPlugin('editors-xtd', 'article')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
84
plugins/editors-xtd/article/src/Extension/Article.php
Normal file
84
plugins/editors-xtd/article/src/Extension/Article.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.article
|
||||
*
|
||||
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\EditorsXtd\Article\Extension;
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Session\Session;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Editor Article button
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
final class Article extends CMSPlugin
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.1
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Display the button
|
||||
*
|
||||
* @param string $name The name of the button to add
|
||||
*
|
||||
* @return CMSObject|void The button options as CMSObject, void if ACL check fails.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public function onDisplay($name)
|
||||
{
|
||||
$user = $this->getApplication()->getIdentity();
|
||||
|
||||
// Can create in any category (component permission) or at least in one category
|
||||
$canCreateRecords = $user->authorise('core.create', 'com_content')
|
||||
|| count($user->getAuthorisedCategories('com_content', 'core.create')) > 0;
|
||||
|
||||
// Instead of checking edit on all records, we can use **same** check as the form editing view
|
||||
$values = (array) $this->getApplication()->getUserState('com_content.edit.article.id');
|
||||
$isEditingRecords = count($values);
|
||||
|
||||
// This ACL check is probably a double-check (form view already performed checks)
|
||||
$hasAccess = $canCreateRecords || $isEditingRecords;
|
||||
if (!$hasAccess) {
|
||||
return;
|
||||
}
|
||||
|
||||
$link = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component&'
|
||||
. Session::getFormToken() . '=1&editor=' . $name;
|
||||
|
||||
$button = new CMSObject();
|
||||
$button->modal = true;
|
||||
$button->link = $link;
|
||||
$button->text = Text::_('PLG_ARTICLE_BUTTON_ARTICLE');
|
||||
$button->name = $this->_type . '_' . $this->_name;
|
||||
$button->icon = 'file-add';
|
||||
$button->iconSVG = '<svg viewBox="0 0 32 32" width="24" height="24"><path d="M28 24v-4h-4v4h-4v4h4v4h4v-4h4v-4zM2 2h18v6h6v10h2v-10l-8-'
|
||||
. '8h-20v32h18v-2h-16z"></path></svg>';
|
||||
$button->options = [
|
||||
'height' => '300px',
|
||||
'width' => '800px',
|
||||
'bodyHeight' => '70',
|
||||
'modalWidth' => '80',
|
||||
];
|
||||
|
||||
return $button;
|
||||
}
|
||||
}
|
||||
21
plugins/editors-xtd/contact/contact.xml
Normal file
21
plugins/editors-xtd/contact/contact.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="editors-xtd" method="upgrade">
|
||||
<name>plg_editors-xtd_contact</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2016-10</creationDate>
|
||||
<copyright>(C) 2016 Open Source Matters, Inc.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.7.0</version>
|
||||
<description>PLG_EDITORS-XTD_CONTACT_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\EditorsXtd\Contact</namespace>
|
||||
<files>
|
||||
<folder plugin="contact">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_contact.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_contact.sys.ini</language>
|
||||
</languages>
|
||||
</extension>
|
||||
48
plugins/editors-xtd/contact/services/provider.php
Normal file
48
plugins/editors-xtd/contact/services/provider.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.contact
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\Plugin\EditorsXtd\Contact\Extension\Contact;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$dispatcher = $container->get(DispatcherInterface::class);
|
||||
|
||||
$plugin = new Contact(
|
||||
$dispatcher,
|
||||
(array) PluginHelper::getPlugin('editors-xtd', 'contact')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
82
plugins/editors-xtd/contact/src/Extension/Contact.php
Normal file
82
plugins/editors-xtd/contact/src/Extension/Contact.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.contact
|
||||
*
|
||||
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\EditorsXtd\Contact\Extension;
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Session\Session;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Editor Contact button
|
||||
*
|
||||
* @since 3.7.0
|
||||
*/
|
||||
final class Contact extends CMSPlugin
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.7.0
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Display the button
|
||||
*
|
||||
* @param string $name The name of the button to add
|
||||
*
|
||||
* @return CMSObject|void The button options as CMSObject
|
||||
*
|
||||
* @since 3.7.0
|
||||
*/
|
||||
public function onDisplay($name)
|
||||
{
|
||||
$user = $this->getApplication()->getIdentity();
|
||||
|
||||
if (
|
||||
$user->authorise('core.create', 'com_contact')
|
||||
|| $user->authorise('core.edit', 'com_contact')
|
||||
|| $user->authorise('core.edit.own', 'com_contact')
|
||||
) {
|
||||
// The URL for the contacts list
|
||||
$link = 'index.php?option=com_contact&view=contacts&layout=modal&tmpl=component&'
|
||||
. Session::getFormToken() . '=1&editor=' . $name;
|
||||
|
||||
$button = new CMSObject();
|
||||
$button->modal = true;
|
||||
$button->link = $link;
|
||||
$button->text = Text::_('PLG_EDITORS-XTD_CONTACT_BUTTON_CONTACT');
|
||||
$button->name = $this->_type . '_' . $this->_name;
|
||||
$button->icon = 'address';
|
||||
$button->iconSVG = '<svg viewBox="0 0 448 512" width="24" height="24"><path d="M436 160c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20V48c'
|
||||
. '0-26.5-21.5-48-48-48H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h320c26.5 0 48-21.5 48-48v-48h20c6.6 0 12-5.4 1'
|
||||
. '2-12v-40c0-6.6-5.4-12-12-12h-20v-64h20c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20v-64h20zm-228-32c35.3 0 64 28.7'
|
||||
. ' 64 64s-28.7 64-64 64-64-28.7-64-64 28.7-64 64-64zm112 236.8c0 10.6-10 19.2-22.4 19.2H118.4C106 384 96 375.4 96 364.'
|
||||
. '8v-19.2c0-31.8 30.1-57.6 67.2-57.6h5c12.3 5.1 25.7 8 39.8 8s27.6-2.9 39.8-8h5c37.1 0 67.2 25.8 67.2 57.6v19.2z">'
|
||||
. '</path></svg>';
|
||||
|
||||
$button->options = [
|
||||
'height' => '300px',
|
||||
'width' => '800px',
|
||||
'bodyHeight' => '70',
|
||||
'modalWidth' => '80',
|
||||
];
|
||||
|
||||
return $button;
|
||||
}
|
||||
}
|
||||
}
|
||||
64
plugins/editors-xtd/convertforms/convertforms.php
Normal file
64
plugins/editors-xtd/convertforms/convertforms.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Convert Forms
|
||||
* @version 3.2.12 Free
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
class PlgButtonConvertforms extends JPlugin
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Application Object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* ConvertForms Button
|
||||
*
|
||||
* @param string $name The name of the button to add
|
||||
*
|
||||
* @return JObject The button object
|
||||
*/
|
||||
public function onDisplay($name)
|
||||
{
|
||||
$component = $this->app->input->getCmd('option');
|
||||
$basePath = $this->app->isClient('administrator') ? '' : 'administrator/';
|
||||
$link = $basePath . 'index.php?option=com_convertforms&view=editorbutton&layout=button&tmpl=component&e_name=' . $name . '&e_comp='. $component;
|
||||
|
||||
$button = new JObject;
|
||||
$button->modal = true;
|
||||
$button->class = 'btn cf';
|
||||
$button->link = $link;
|
||||
$button->text = JText::_('PLG_EDITORS-XTD_CONVERTFORMS_BUTTON_TEXT');
|
||||
$button->name = 'vcard';
|
||||
|
||||
if (defined('nrJ4'))
|
||||
{
|
||||
$button->options = [
|
||||
'height' => '200px',
|
||||
'bodyHeight' => '180px',
|
||||
'modalWidth' => '250px',
|
||||
];
|
||||
} else
|
||||
{
|
||||
$button->options = "{handler: 'iframe', size: {x: 350, y: 220}}";
|
||||
}
|
||||
|
||||
return $button;
|
||||
}
|
||||
}
|
||||
19
plugins/editors-xtd/convertforms/convertforms.xml
Normal file
19
plugins/editors-xtd/convertforms/convertforms.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension version="3.4" type="plugin" group="editors-xtd" method="upgrade">
|
||||
<name>PLG_EDITORS-XTD_CONVERTFORMS</name>
|
||||
<description>PLG_EDITORS-XTD_CONVERTFORMS_DESC</description>
|
||||
<creationDate>June 2017</creationDate>
|
||||
<copyright>Copyright © 2020 Tassos Marinos All Rights Reserved</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL</license>
|
||||
<author>Tassos Marinos</author>
|
||||
<authorEmail>info@tassos.gr</authorEmail>
|
||||
<authorUrl>http://www.tassos.gr</authorUrl>
|
||||
<version>1.0</version>
|
||||
<scriptfile>script.install.php</scriptfile>
|
||||
<files>
|
||||
<filename plugin="convertforms">convertforms.php</filename>
|
||||
<filename>script.install.helper.php</filename>
|
||||
<filename>form.xml</filename>
|
||||
<folder>language</folder>
|
||||
</files>
|
||||
</extension>
|
||||
10
plugins/editors-xtd/convertforms/form.xml
Normal file
10
plugins/editors-xtd/convertforms/form.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fieldset name="main" addfieldpath="administrator/components/com_convertforms/models/forms/fields">
|
||||
<field name="convertformid" type="convertforms"
|
||||
label="PLG_EDITORS-XTD_CONVERTFORMS_SELECT_FORM"
|
||||
description="PLG_EDITORS-XTD_CONVERTFORMS_SELECT_FORM_DESC"
|
||||
class="span12">
|
||||
</field>
|
||||
</fieldset>
|
||||
</form>
|
||||
@@ -0,0 +1,7 @@
|
||||
CONVERTFORMS="Convert Forms"
|
||||
PLG_EDITORS-XTD_CONVERTFORMS="Editor Button - Convert Forms"
|
||||
PLG_EDITORS-XTD_CONVERTFORMS_DESC="Convert Forms Button Creator"
|
||||
PLG_EDITORS-XTD_CONVERTFORMS_BUTTON_TEXT="Convert Forms"
|
||||
PLG_EDITORS-XTD_CONVERTFORMS_SELECT_FORM="Select form"
|
||||
PLG_EDITORS-XTD_CONVERTFORMS_SELECT_FORM_DESC="Select the form you'd like to insert"
|
||||
PLG_EDITORS-XTD_CONVERTFORMS_INSERTBUTTON="Insert shortcode"
|
||||
@@ -0,0 +1,3 @@
|
||||
CONVERTFORMS="Convert Forms"
|
||||
PLG_EDITORS-XTD_CONVERTFORMS="Editor Button - Convert Forms"
|
||||
PLG_EDITORS-XTD_CONVERTFORMS_DESC="Editor Button - Convert Forms Button Creator"
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
637
plugins/editors-xtd/convertforms/script.install.helper.php
Normal file
637
plugins/editors-xtd/convertforms/script.install.helper.php
Normal file
@@ -0,0 +1,637 @@
|
||||
<?php
|
||||
/**
|
||||
* Installer Script Helper
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2016 Tassos Marinos All Rights Reserved
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.filesystem.file');
|
||||
jimport('joomla.filesystem.folder');
|
||||
|
||||
class PlgEditorsxtdConvertformsInstallerScriptHelper
|
||||
{
|
||||
public $name = '';
|
||||
public $alias = '';
|
||||
public $extname = '';
|
||||
public $extension_type = '';
|
||||
public $plugin_folder = 'system';
|
||||
public $module_position = 'status';
|
||||
public $client_id = 1;
|
||||
public $install_type = 'install';
|
||||
public $show_message = true;
|
||||
public $autopublish = true;
|
||||
public $db = null;
|
||||
public $app = null;
|
||||
public $installedVersion;
|
||||
|
||||
public function __construct(&$params)
|
||||
{
|
||||
$this->extname = $this->extname ?: $this->alias;
|
||||
$this->db = JFactory::getDbo();
|
||||
$this->app = JFactory::getApplication();
|
||||
$this->installedVersion = $this->getVersion($this->getInstalledXMLFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* Preflight event
|
||||
*
|
||||
* @param string
|
||||
* @param JAdapterInstance
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function preflight($route, $adapter)
|
||||
{
|
||||
if (!in_array($route, array('install', 'update')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
JFactory::getLanguage()->load('plg_system_novaraininstaller', JPATH_PLUGINS . '/system/novaraininstaller');
|
||||
|
||||
if ($this->show_message && $this->isInstalled())
|
||||
{
|
||||
$this->install_type = 'update';
|
||||
}
|
||||
|
||||
if ($this->onBeforeInstall() === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Preflight event
|
||||
*
|
||||
* @param string
|
||||
* @param JAdapterInstance
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function postflight($route, $adapter)
|
||||
{
|
||||
JFactory::getLanguage()->load($this->getPrefix() . '_' . $this->extname, $this->getMainFolder());
|
||||
|
||||
if (!in_array($route, array('install', 'update')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->onAfterInstall() === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($route == 'install' && $this->autopublish)
|
||||
{
|
||||
$this->publishExtension();
|
||||
}
|
||||
|
||||
if ($this->show_message)
|
||||
{
|
||||
$this->addInstalledMessage();
|
||||
}
|
||||
|
||||
JFactory::getCache()->clean('com_plugins');
|
||||
JFactory::getCache()->clean('_system');
|
||||
}
|
||||
|
||||
public function isInstalled()
|
||||
{
|
||||
if (!is_file($this->getInstalledXMLFile()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = $this->db->getQuery(true)
|
||||
->select('extension_id')
|
||||
->from('#__extensions')
|
||||
->where($this->db->quoteName('type') . ' = ' . $this->db->quote($this->extension_type))
|
||||
->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->getElementName()));
|
||||
$this->db->setQuery($query, 0, 1);
|
||||
$result = $this->db->loadResult();
|
||||
|
||||
return empty($result) ? false : true;
|
||||
}
|
||||
|
||||
public function getMainFolder()
|
||||
{
|
||||
switch ($this->extension_type)
|
||||
{
|
||||
case 'plugin' :
|
||||
return JPATH_SITE . '/plugins/' . $this->plugin_folder . '/' . $this->extname;
|
||||
|
||||
case 'component' :
|
||||
return JPATH_ADMINISTRATOR . '/components/com_' . $this->extname;
|
||||
|
||||
case 'module' :
|
||||
return JPATH_ADMINISTRATOR . '/modules/mod_' . $this->extname;
|
||||
|
||||
case 'library' :
|
||||
return JPATH_SITE . '/libraries/' . $this->extname;
|
||||
}
|
||||
}
|
||||
|
||||
public function getInstalledXMLFile()
|
||||
{
|
||||
return $this->getXMLFile($this->getMainFolder());
|
||||
}
|
||||
|
||||
public function getCurrentXMLFile()
|
||||
{
|
||||
return $this->getXMLFile(__DIR__);
|
||||
}
|
||||
|
||||
public function getXMLFile($folder)
|
||||
{
|
||||
switch ($this->extension_type)
|
||||
{
|
||||
case 'module' :
|
||||
return $folder . '/mod_' . $this->extname . '.xml';
|
||||
default :
|
||||
return $folder . '/' . $this->extname . '.xml';
|
||||
}
|
||||
}
|
||||
|
||||
public function foldersExist($folders = array())
|
||||
{
|
||||
foreach ($folders as $folder)
|
||||
{
|
||||
if (is_dir($folder))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function publishExtension()
|
||||
{
|
||||
switch ($this->extension_type)
|
||||
{
|
||||
case 'plugin' :
|
||||
$this->publishPlugin();
|
||||
|
||||
case 'module' :
|
||||
$this->publishModule();
|
||||
}
|
||||
}
|
||||
|
||||
public function publishPlugin()
|
||||
{
|
||||
$query = $this->db->getQuery(true)
|
||||
->update('#__extensions')
|
||||
->set($this->db->quoteName('enabled') . ' = 1')
|
||||
->where($this->db->quoteName('type') . ' = ' . $this->db->quote('plugin'))
|
||||
->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->extname))
|
||||
->where($this->db->quoteName('folder') . ' = ' . $this->db->quote($this->plugin_folder));
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
}
|
||||
|
||||
public function publishModule()
|
||||
{
|
||||
// Get module id
|
||||
$query = $this->db->getQuery(true)
|
||||
->select('id')
|
||||
->from('#__modules')
|
||||
->where($this->db->quoteName('module') . ' = ' . $this->db->quote('mod_' . $this->extname))
|
||||
->where($this->db->quoteName('client_id') . ' = ' . (int) $this->client_id);
|
||||
$this->db->setQuery($query, 0, 1);
|
||||
$id = $this->db->loadResult();
|
||||
|
||||
if (!$id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// check if module is already in the modules_menu table (meaning is is already saved)
|
||||
$query->clear()
|
||||
->select('moduleid')
|
||||
->from('#__modules_menu')
|
||||
->where($this->db->quoteName('moduleid') . ' = ' . (int) $id);
|
||||
$this->db->setQuery($query, 0, 1);
|
||||
$exists = $this->db->loadResult();
|
||||
|
||||
if ($exists)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get highest ordering number in position
|
||||
$query->clear()
|
||||
->select('ordering')
|
||||
->from('#__modules')
|
||||
->where($this->db->quoteName('position') . ' = ' . $this->db->quote($this->module_position))
|
||||
->where($this->db->quoteName('client_id') . ' = ' . (int) $this->client_id)
|
||||
->order('ordering DESC');
|
||||
$this->db->setQuery($query, 0, 1);
|
||||
$ordering = $this->db->loadResult();
|
||||
$ordering++;
|
||||
|
||||
// publish module and set ordering number
|
||||
$query->clear()
|
||||
->update('#__modules')
|
||||
->set($this->db->quoteName('published') . ' = 1')
|
||||
->set($this->db->quoteName('ordering') . ' = ' . (int) $ordering)
|
||||
->set($this->db->quoteName('position') . ' = ' . $this->db->quote($this->module_position))
|
||||
->where($this->db->quoteName('id') . ' = ' . (int) $id);
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
|
||||
// add module to the modules_menu table
|
||||
$query->clear()
|
||||
->insert('#__modules_menu')
|
||||
->columns(array($this->db->quoteName('moduleid'), $this->db->quoteName('menuid')))
|
||||
->values((int) $id . ', 0');
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
}
|
||||
|
||||
public function addInstalledMessage()
|
||||
{
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
JText::sprintf(
|
||||
JText::_($this->install_type == 'update' ? 'NRI_THE_EXTENSION_HAS_BEEN_UPDATED_SUCCESSFULLY' : 'NRI_THE_EXTENSION_HAS_BEEN_INSTALLED_SUCCESSFULLY'),
|
||||
'<strong>' . JText::_($this->name) . '</strong>',
|
||||
'<strong>' . $this->getVersion() . '</strong>',
|
||||
$this->getFullType()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getPrefix()
|
||||
{
|
||||
switch ($this->extension_type)
|
||||
{
|
||||
case 'plugin';
|
||||
return JText::_('plg_' . strtolower($this->plugin_folder));
|
||||
|
||||
case 'component':
|
||||
return JText::_('com');
|
||||
|
||||
case 'module':
|
||||
return JText::_('mod');
|
||||
|
||||
case 'library':
|
||||
return JText::_('lib');
|
||||
|
||||
default:
|
||||
return $this->extension_type;
|
||||
}
|
||||
}
|
||||
|
||||
public function getElementName($type = null, $extname = null)
|
||||
{
|
||||
$type = is_null($type) ? $this->extension_type : $type;
|
||||
$extname = is_null($extname) ? $this->extname : $extname;
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case 'component' :
|
||||
return 'com_' . $extname;
|
||||
|
||||
case 'module' :
|
||||
return 'mod_' . $extname;
|
||||
|
||||
case 'plugin' :
|
||||
default:
|
||||
return $extname;
|
||||
}
|
||||
}
|
||||
|
||||
public function getFullType()
|
||||
{
|
||||
return JText::_('NRI_' . strtoupper($this->getPrefix()));
|
||||
}
|
||||
|
||||
public function isPro()
|
||||
{
|
||||
$versionFile = __DIR__ . "/version.php";
|
||||
|
||||
// If version file does not exist we assume a PRO version
|
||||
if (!JFile::exists($versionFile))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Load version file
|
||||
require_once $versionFile;
|
||||
return (bool) $NR_PRO;
|
||||
}
|
||||
|
||||
public function getVersion($file = '')
|
||||
{
|
||||
$file = $file ?: $this->getCurrentXMLFile();
|
||||
|
||||
if (!is_file($file))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
$xml = JInstaller::parseXMLInstallFile($file);
|
||||
|
||||
if (!$xml || !isset($xml['version']))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
return $xml['version'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks wether the extension can be installed or not
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function canInstall()
|
||||
{
|
||||
|
||||
// The extension is not installed yet. Accept Install.
|
||||
if (!$installed_version = $this->getVersion($this->getInstalledXMLFile()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Path to extension's version file
|
||||
$versionFile = $this->getMainFolder() . "/version.php";
|
||||
$NR_PRO = true;
|
||||
|
||||
// If version file does not exist we assume we have a PRO version installed
|
||||
if (file_exists($versionFile))
|
||||
{
|
||||
require_once($versionFile);
|
||||
}
|
||||
|
||||
// The free version is installed. Accept install.
|
||||
if (!(bool)$NR_PRO)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Current package is a PRO version. Accept install.
|
||||
if ($this->isPro())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// User is trying to update from PRO version to FREE. Do not accept install.
|
||||
JFactory::getLanguage()->load($this->getPrefix() . '_' . $this->extname, __DIR__);
|
||||
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
JText::_('NRI_ERROR_PRO_TO_FREE'), 'error'
|
||||
);
|
||||
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
html_entity_decode(
|
||||
JText::sprintf(
|
||||
'NRI_ERROR_UNINSTALL_FIRST',
|
||||
'<a href="http://www.tassos.gr/joomla-extensions/' . $this->alias . '" target="_blank">',
|
||||
'</a>',
|
||||
JText::_($this->name)
|
||||
)
|
||||
), 'error'
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if current version is newer than the installed one
|
||||
* Used for Novarain Framework
|
||||
*
|
||||
* @return boolean [description]
|
||||
*/
|
||||
public function isNewer()
|
||||
{
|
||||
if (!$installed_version = $this->getVersion($this->getInstalledXMLFile()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$package_version = $this->getVersion();
|
||||
|
||||
return version_compare($installed_version, $package_version, '<=');
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method triggered before installation
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function onBeforeInstall()
|
||||
{
|
||||
if (!$this->canInstall())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method triggered after installation
|
||||
*/
|
||||
public function onAfterInstall()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete files
|
||||
*
|
||||
* @param array $folders
|
||||
*/
|
||||
public function deleteFiles($files = array())
|
||||
{
|
||||
foreach ($files as $key => $file)
|
||||
{
|
||||
JFile::delete($file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes folders
|
||||
*
|
||||
* @param array $folders
|
||||
*/
|
||||
public function deleteFolders($folders = array())
|
||||
{
|
||||
foreach ($folders as $folder)
|
||||
{
|
||||
if (!is_dir($folder))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
JFolder::delete($folder);
|
||||
}
|
||||
}
|
||||
|
||||
public function dropIndex($table, $index)
|
||||
{
|
||||
$db = $this->db;
|
||||
|
||||
// Check if index exists first
|
||||
$query = 'SHOW INDEX FROM ' . $db->quoteName('#__' . $table) . ' WHERE KEY_NAME = ' . $db->quote($index);
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
|
||||
if (!$db->loadResult())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove index
|
||||
$query = 'ALTER TABLE ' . $db->quoteName('#__' . $table) . ' DROP INDEX ' . $db->quoteName($index);
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
}
|
||||
|
||||
public function dropUnwantedTables($tables) {
|
||||
|
||||
if (!$tables) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($tables as $table) {
|
||||
$query = "DROP TABLE IF EXISTS #__".$this->db->escape($table);
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
}
|
||||
}
|
||||
|
||||
public function dropUnwantedColumns($table, $columns) {
|
||||
|
||||
if (!$columns || !$table) {
|
||||
return;
|
||||
}
|
||||
|
||||
$db = $this->db;
|
||||
|
||||
// Check if columns exists in database
|
||||
function qt($n) {
|
||||
return(JFactory::getDBO()->quote($n));
|
||||
}
|
||||
|
||||
$query = 'SHOW COLUMNS FROM #__'.$table.' WHERE Field IN ('.implode(",", array_map("qt", $columns)).')';
|
||||
$db->setQuery($query);
|
||||
$rows = $db->loadColumn(0);
|
||||
|
||||
// Abort if we don't have any rows
|
||||
if (!$rows) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Let's remove the columns
|
||||
$q = "";
|
||||
foreach ($rows as $key => $column) {
|
||||
$comma = (($key+1) < count($rows)) ? "," : "";
|
||||
$q .= "drop ".$this->db->escape($column).$comma;
|
||||
}
|
||||
|
||||
$query = "alter table #__".$table." $q";
|
||||
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
}
|
||||
|
||||
public function fetch($table, $columns = "*", $where = null, $singlerow = false) {
|
||||
if (!$table) {
|
||||
return;
|
||||
}
|
||||
|
||||
$db = $this->db;
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query
|
||||
->select($columns)
|
||||
->from("#__$table");
|
||||
|
||||
if (isset($where)) {
|
||||
$query->where("$where");
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
return ($singlerow) ? $db->loadObject() : $db->loadObjectList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the Novarain Framework
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function loadFramework()
|
||||
{
|
||||
if (is_file(JPATH_PLUGINS . '/system/nrframework/autoload.php'))
|
||||
{
|
||||
include_once JPATH_PLUGINS . '/system/nrframework/autoload.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-orders plugin after passed array of plugins
|
||||
*
|
||||
* @param string $plugin Plugin element name
|
||||
* @param array $lowerPluginOrder Array of plugin element names
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function pluginOrderAfter($lowerPluginOrder)
|
||||
{
|
||||
|
||||
if (!is_array($lowerPluginOrder) || !count($lowerPluginOrder))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$db = $this->db;
|
||||
|
||||
// Get plugins max order
|
||||
$query = $db->getQuery(true);
|
||||
$query
|
||||
->select($db->quoteName('b.ordering'))
|
||||
->from($db->quoteName('#__extensions', 'b'))
|
||||
->where($db->quoteName('b.element') . ' IN ("'.implode("\",\"",$lowerPluginOrder).'")')
|
||||
->order('b.ordering desc');
|
||||
|
||||
$db->setQuery($query);
|
||||
$maxOrder = $db->loadResult();
|
||||
|
||||
if (is_null($maxOrder))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get plugin details
|
||||
$query
|
||||
->clear()
|
||||
->select(array($db->quoteName('extension_id'), $db->quoteName('ordering')))
|
||||
->from($db->quoteName('#__extensions'))
|
||||
->where($db->quoteName('element') . ' = ' . $db->quote($this->alias));
|
||||
|
||||
$db->setQuery($query);
|
||||
$pluginInfo = $db->loadObject();
|
||||
|
||||
if (!isset($pluginInfo->ordering) || $pluginInfo->ordering > $maxOrder)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the new plugin order
|
||||
$object = new stdClass();
|
||||
$object->extension_id = $pluginInfo->extension_id;
|
||||
$object->ordering = ($maxOrder + 1);
|
||||
|
||||
try {
|
||||
$db->updateObject('#__extensions', $object, 'extension_id');
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
24
plugins/editors-xtd/convertforms/script.install.php
Normal file
24
plugins/editors-xtd/convertforms/script.install.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Convert Forms
|
||||
* @version 3.2.12 Free
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
require_once __DIR__ . '/script.install.helper.php';
|
||||
|
||||
class PlgEditorsXtdConvertformsInstallerScript extends PlgEditorsXtdConvertformsInstallerScriptHelper
|
||||
{
|
||||
public $name = 'CONVERTFORMS';
|
||||
public $alias = 'convertforms';
|
||||
public $extension_type = 'plugin';
|
||||
public $plugin_folder = 'editors-xtd';
|
||||
public $show_message = false;
|
||||
}
|
||||
21
plugins/editors-xtd/fields/fields.xml
Normal file
21
plugins/editors-xtd/fields/fields.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="editors-xtd" method="upgrade">
|
||||
<name>plg_editors-xtd_fields</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2017-02</creationDate>
|
||||
<copyright>(C) 2017 Open Source Matters, Inc.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.7.0</version>
|
||||
<description>PLG_EDITORS-XTD_FIELDS_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\EditorsXtd\Fields</namespace>
|
||||
<files>
|
||||
<folder plugin="fields">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_fields.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_fields.sys.ini</language>
|
||||
</languages>
|
||||
</extension>
|
||||
48
plugins/editors-xtd/fields/services/provider.php
Normal file
48
plugins/editors-xtd/fields/services/provider.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.fields
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\Plugin\EditorsXtd\Fields\Extension\Fields;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$dispatcher = $container->get(DispatcherInterface::class);
|
||||
|
||||
$plugin = new Fields(
|
||||
$dispatcher,
|
||||
(array) PluginHelper::getPlugin('editors-xtd', 'fields')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
88
plugins/editors-xtd/fields/src/Extension/Fields.php
Normal file
88
plugins/editors-xtd/fields/src/Extension/Fields.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.fields
|
||||
*
|
||||
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\EditorsXtd\Fields\Extension;
|
||||
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Session\Session;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Editor Fields button
|
||||
*
|
||||
* @since 3.7.0
|
||||
*/
|
||||
final class Fields extends CMSPlugin
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.7.0
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Display the button
|
||||
*
|
||||
* @param string $name The name of the button to add
|
||||
*
|
||||
* @return CMSObject|void The button options as CMSObject
|
||||
*
|
||||
* @since 3.7.0
|
||||
*/
|
||||
public function onDisplay($name)
|
||||
{
|
||||
// Check if com_fields is enabled
|
||||
if (!ComponentHelper::isEnabled('com_fields')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Guess the field context based on view.
|
||||
$jinput = $this->getApplication()->getInput();
|
||||
$context = $jinput->get('option') . '.' . $jinput->get('view');
|
||||
|
||||
// Special context for com_categories
|
||||
if ($context === 'com_categories.category') {
|
||||
$context = $jinput->get('extension', 'com_content') . '.categories';
|
||||
}
|
||||
|
||||
$link = 'index.php?option=com_fields&view=fields&layout=modal&tmpl=component&context='
|
||||
. $context . '&editor=' . $name . '&' . Session::getFormToken() . '=1';
|
||||
|
||||
$button = new CMSObject();
|
||||
$button->modal = true;
|
||||
$button->link = $link;
|
||||
$button->text = Text::_('PLG_EDITORS-XTD_FIELDS_BUTTON_FIELD');
|
||||
$button->name = $this->_type . '_' . $this->_name;
|
||||
$button->icon = 'puzzle';
|
||||
$button->iconSVG = '<svg viewBox="0 0 576 512" width="24" height="24"><path d="M519.442 288.651c-41.519 0-59.5 31.593-82.058 31.593C377.'
|
||||
. '409 320.244 432 144 432 144s-196.288 80-196.288-3.297c0-35.827 36.288-46.25 36.288-85.985C272 19.216 243.885 0 210.'
|
||||
. '539 0c-34.654 0-66.366 18.891-66.366 56.346 0 41.364 31.711 59.277 31.711 81.75C175.885 207.719 0 166.758 0 166.758'
|
||||
. 'v333.237s178.635 41.047 178.635-28.662c0-22.473-40-40.107-40-81.471 0-37.456 29.25-56.346 63.577-56.346 33.673 0 61'
|
||||
. '.788 19.216 61.788 54.717 0 39.735-36.288 50.158-36.288 85.985 0 60.803 129.675 25.73 181.23 25.73 0 0-34.725-120.1'
|
||||
. '01 25.827-120.101 35.962 0 46.423 36.152 86.308 36.152C556.712 416 576 387.99 576 354.443c0-34.199-18.962-65.792-56'
|
||||
. '.558-65.792z"></path></svg>';
|
||||
$button->options = [
|
||||
'height' => '300px',
|
||||
'width' => '800px',
|
||||
'bodyHeight' => '70',
|
||||
'modalWidth' => '80',
|
||||
];
|
||||
|
||||
return $button;
|
||||
}
|
||||
}
|
||||
21
plugins/editors-xtd/image/image.xml
Normal file
21
plugins/editors-xtd/image/image.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="editors-xtd" method="upgrade">
|
||||
<name>plg_editors-xtd_image</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2004-08</creationDate>
|
||||
<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>PLG_IMAGE_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\EditorsXtd\Image</namespace>
|
||||
<files>
|
||||
<folder plugin="image">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_image.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_image.sys.ini</language>
|
||||
</languages>
|
||||
</extension>
|
||||
48
plugins/editors-xtd/image/services/provider.php
Normal file
48
plugins/editors-xtd/image/services/provider.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.image
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\Plugin\EditorsXtd\Image\Extension\Image;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$dispatcher = $container->get(DispatcherInterface::class);
|
||||
|
||||
$plugin = new Image(
|
||||
$dispatcher,
|
||||
(array) PluginHelper::getPlugin('editors-xtd', 'image')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
176
plugins/editors-xtd/image/src/Extension/Image.php
Normal file
176
plugins/editors-xtd/image/src/Extension/Image.php
Normal file
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.image
|
||||
*
|
||||
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\EditorsXtd\Image\Extension;
|
||||
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Editor Image button
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
final class Image extends CMSPlugin
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.1
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Display the button.
|
||||
*
|
||||
* @param string $name The name of the button to display.
|
||||
* @param string $asset The name of the asset being edited.
|
||||
* @param integer $author The id of the author owning the asset being edited.
|
||||
*
|
||||
* @return CMSObject|false
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public function onDisplay($name, $asset, $author)
|
||||
{
|
||||
$doc = $this->getApplication()->getDocument();
|
||||
$user = $this->getApplication()->getIdentity();
|
||||
$extension = $this->getApplication()->getInput()->get('option');
|
||||
|
||||
// For categories we check the extension (ex: component.section)
|
||||
if ($extension === 'com_categories') {
|
||||
$parts = explode('.', $this->getApplication()->getInput()->get('extension', 'com_content'));
|
||||
$extension = $parts[0];
|
||||
}
|
||||
|
||||
$asset = $asset !== '' ? $asset : $extension;
|
||||
|
||||
if (
|
||||
$user->authorise('core.edit', $asset)
|
||||
|| $user->authorise('core.create', $asset)
|
||||
|| (count($user->getAuthorisedCategories($asset, 'core.create')) > 0)
|
||||
|| ($user->authorise('core.edit.own', $asset) && $author === $user->id)
|
||||
|| (count($user->getAuthorisedCategories($extension, 'core.edit')) > 0)
|
||||
|| (count($user->getAuthorisedCategories($extension, 'core.edit.own')) > 0 && $author === $user->id)
|
||||
) {
|
||||
$doc->getWebAssetManager()
|
||||
->useScript('webcomponent.media-select')
|
||||
->useScript('webcomponent.field-media')
|
||||
->useStyle('webcomponent.media-select');
|
||||
|
||||
$doc->addScriptOptions('xtdImageModal', [$name . '_ImageModal']);
|
||||
$doc->addScriptOptions('media-picker-api', ['apiBaseUrl' => Uri::base() . 'index.php?option=com_media&format=json']);
|
||||
|
||||
if (count($doc->getScriptOptions('media-picker')) === 0) {
|
||||
$imagesExt = array_map(
|
||||
'trim',
|
||||
explode(
|
||||
',',
|
||||
ComponentHelper::getParams('com_media')->get(
|
||||
'image_extensions',
|
||||
'bmp,gif,jpg,jpeg,png,webp'
|
||||
)
|
||||
)
|
||||
);
|
||||
$audiosExt = array_map(
|
||||
'trim',
|
||||
explode(
|
||||
',',
|
||||
ComponentHelper::getParams('com_media')->get(
|
||||
'audio_extensions',
|
||||
'mp3,m4a,mp4a,ogg'
|
||||
)
|
||||
)
|
||||
);
|
||||
$videosExt = array_map(
|
||||
'trim',
|
||||
explode(
|
||||
',',
|
||||
ComponentHelper::getParams('com_media')->get(
|
||||
'video_extensions',
|
||||
'mp4,mp4v,mpeg,mov,webm'
|
||||
)
|
||||
)
|
||||
);
|
||||
$documentsExt = array_map(
|
||||
'trim',
|
||||
explode(
|
||||
',',
|
||||
ComponentHelper::getParams('com_media')->get(
|
||||
'doc_extensions',
|
||||
'doc,odg,odp,ods,odt,pdf,ppt,txt,xcf,xls,csv'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$doc->addScriptOptions('media-picker', [
|
||||
'images' => $imagesExt,
|
||||
'audios' => $audiosExt,
|
||||
'videos' => $videosExt,
|
||||
'documents' => $documentsExt,
|
||||
]);
|
||||
}
|
||||
|
||||
Text::script('JFIELD_MEDIA_LAZY_LABEL');
|
||||
Text::script('JFIELD_MEDIA_ALT_LABEL');
|
||||
Text::script('JFIELD_MEDIA_ALT_CHECK_LABEL');
|
||||
Text::script('JFIELD_MEDIA_ALT_CHECK_DESC_LABEL');
|
||||
Text::script('JFIELD_MEDIA_CLASS_LABEL');
|
||||
Text::script('JFIELD_MEDIA_FIGURE_CLASS_LABEL');
|
||||
Text::script('JFIELD_MEDIA_FIGURE_CAPTION_LABEL');
|
||||
Text::script('JFIELD_MEDIA_LAZY_LABEL');
|
||||
Text::script('JFIELD_MEDIA_SUMMARY_LABEL');
|
||||
Text::script('JFIELD_MEDIA_EMBED_CHECK_DESC_LABEL');
|
||||
Text::script('JFIELD_MEDIA_DOWNLOAD_CHECK_DESC_LABEL');
|
||||
Text::script('JFIELD_MEDIA_DOWNLOAD_CHECK_LABEL');
|
||||
Text::script('JFIELD_MEDIA_EMBED_CHECK_LABEL');
|
||||
Text::script('JFIELD_MEDIA_WIDTH_LABEL');
|
||||
Text::script('JFIELD_MEDIA_TITLE_LABEL');
|
||||
Text::script('JFIELD_MEDIA_HEIGHT_LABEL');
|
||||
Text::script('JFIELD_MEDIA_UNSUPPORTED');
|
||||
Text::script('JFIELD_MEDIA_DOWNLOAD_FILE');
|
||||
|
||||
$link = 'index.php?option=com_media&view=media&tmpl=component&e_name=' . $name . '&asset=' . $asset . '&mediatypes=0,1,2,3' . '&author=' . $author;
|
||||
|
||||
$button = new CMSObject();
|
||||
$button->modal = true;
|
||||
$button->link = $link;
|
||||
$button->text = Text::_('PLG_IMAGE_BUTTON_IMAGE');
|
||||
$button->name = $this->_type . '_' . $this->_name;
|
||||
$button->icon = 'pictures';
|
||||
$button->iconSVG = '<svg width="24" height="24" viewBox="0 0 512 512"><path d="M464 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48'
|
||||
. ' 48 48h416c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm-6 336H54a6 6 0 0 1-6-6V118a6 6 0 0 1 6-6h404a6 6'
|
||||
. ' 0 0 1 6 6v276a6 6 0 0 1-6 6zM128 152c-22.091 0-40 17.909-40 40s17.909 40 40 40 40-17.909 40-40-17.909-40-40-40'
|
||||
. 'zM96 352h320v-80l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L192 304l-39.515-39.515c-4.686-4.686-12.284-4'
|
||||
. '.686-16.971 0L96 304v48z"></path></svg>';
|
||||
$button->options = [
|
||||
'height' => '400px',
|
||||
'width' => '800px',
|
||||
'bodyHeight' => '70',
|
||||
'modalWidth' => '80',
|
||||
'tinyPath' => $link,
|
||||
'confirmCallback' => 'Joomla.getImage(Joomla.selectedMediaFile, \'' . $name . '\', this)',
|
||||
'confirmText' => Text::_('PLG_IMAGE_BUTTON_INSERT'),
|
||||
];
|
||||
|
||||
return $button;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
21
plugins/editors-xtd/menu/menu.xml
Normal file
21
plugins/editors-xtd/menu/menu.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="editors-xtd" method="upgrade">
|
||||
<name>plg_editors-xtd_menu</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2016-08</creationDate>
|
||||
<copyright>(C) 2016 Open Source Matters, Inc.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.7.0</version>
|
||||
<description>PLG_EDITORS-XTD_MENU_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\EditorsXtd\Menu</namespace>
|
||||
<files>
|
||||
<folder plugin="menu">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_menu.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_menu.sys.ini</language>
|
||||
</languages>
|
||||
</extension>
|
||||
48
plugins/editors-xtd/menu/services/provider.php
Normal file
48
plugins/editors-xtd/menu/services/provider.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.article
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\Plugin\EditorsXtd\Menu\Extension\Menu;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$dispatcher = $container->get(DispatcherInterface::class);
|
||||
|
||||
$plugin = new Menu(
|
||||
$dispatcher,
|
||||
(array) PluginHelper::getPlugin('editors-xtd', 'menu')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
83
plugins/editors-xtd/menu/src/Extension/Menu.php
Normal file
83
plugins/editors-xtd/menu/src/Extension/Menu.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.menu
|
||||
*
|
||||
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\EditorsXtd\Menu\Extension;
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Session\Session;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Editor menu button
|
||||
*
|
||||
* @since 3.7.0
|
||||
*/
|
||||
final class Menu extends CMSPlugin
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.7.0
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Display the button
|
||||
*
|
||||
* @param string $name The name of the button to add
|
||||
*
|
||||
* @since 3.7.0
|
||||
* @return CMSObject
|
||||
*/
|
||||
public function onDisplay($name)
|
||||
{
|
||||
/*
|
||||
* Use the built-in element view to select the menu item.
|
||||
* Currently uses blank class.
|
||||
*/
|
||||
$user = $this->getApplication()->getIdentity();
|
||||
|
||||
if (
|
||||
$user->authorise('core.create', 'com_menus')
|
||||
|| $user->authorise('core.edit', 'com_menus')
|
||||
) {
|
||||
$link = 'index.php?option=com_menus&view=items&layout=modal&tmpl=component&'
|
||||
. Session::getFormToken() . '=1&editor=' . $name;
|
||||
|
||||
$button = new CMSObject();
|
||||
$button->modal = true;
|
||||
$button->link = $link;
|
||||
$button->text = Text::_('PLG_EDITORS-XTD_MENU_BUTTON_MENU');
|
||||
$button->name = $this->_type . '_' . $this->_name;
|
||||
$button->icon = 'list';
|
||||
$button->iconSVG = '<svg viewBox="0 0 512 512" width="24" height="24"><path d="M80 368H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 1'
|
||||
. '6 0 0 0 16-16v-64a16 16 0 0 0-16-16zm0-320H16A16 16 0 0 0 0 64v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16V64a16 16 '
|
||||
. '0 0 0-16-16zm0 160H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm416 176H1'
|
||||
. '76a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16'
|
||||
. 'v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16'
|
||||
. 'h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"></path></svg>';
|
||||
|
||||
$button->options = [
|
||||
'height' => '300px',
|
||||
'width' => '800px',
|
||||
'bodyHeight' => '70',
|
||||
'modalWidth' => '80',
|
||||
];
|
||||
|
||||
return $button;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
plugins/editors-xtd/module/module.xml
Normal file
21
plugins/editors-xtd/module/module.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="editors-xtd" method="upgrade">
|
||||
<name>plg_editors-xtd_module</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2015-10</creationDate>
|
||||
<copyright>(C) 2015 Open Source Matters, Inc.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.5.0</version>
|
||||
<description>PLG_MODULE_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\EditorsXtd\Module</namespace>
|
||||
<files>
|
||||
<folder plugin="module">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_module.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_module.sys.ini</language>
|
||||
</languages>
|
||||
</extension>
|
||||
48
plugins/editors-xtd/module/services/provider.php
Normal file
48
plugins/editors-xtd/module/services/provider.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.article
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\Plugin\EditorsXtd\Module\Extension\Module;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$dispatcher = $container->get(DispatcherInterface::class);
|
||||
|
||||
$plugin = new Module(
|
||||
$dispatcher,
|
||||
(array) PluginHelper::getPlugin('editors-xtd', 'module')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
81
plugins/editors-xtd/module/src/Extension/Module.php
Normal file
81
plugins/editors-xtd/module/src/Extension/Module.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.module
|
||||
*
|
||||
* @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\EditorsXtd\Module\Extension;
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Session\Session;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Editor Module button
|
||||
*
|
||||
* @since 3.5
|
||||
*/
|
||||
final class Module extends CMSPlugin
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.5
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Display the button
|
||||
*
|
||||
* @param string $name The name of the button to add
|
||||
*
|
||||
* @return CMSObject|void The button options as CMSObject
|
||||
*
|
||||
* @since 3.5
|
||||
*/
|
||||
public function onDisplay($name)
|
||||
{
|
||||
/*
|
||||
* Use the built-in element view to select the module.
|
||||
* Currently uses blank class.
|
||||
*/
|
||||
$user = $this->getApplication()->getIdentity();
|
||||
|
||||
if (
|
||||
$user->authorise('core.create', 'com_modules')
|
||||
|| $user->authorise('core.edit', 'com_modules')
|
||||
|| $user->authorise('core.edit.own', 'com_modules')
|
||||
) {
|
||||
$link = 'index.php?option=com_modules&view=modules&layout=modal&tmpl=component&editor='
|
||||
. $name . '&' . Session::getFormToken() . '=1';
|
||||
$button = new CMSObject();
|
||||
$button->modal = true;
|
||||
$button->link = $link;
|
||||
$button->text = Text::_('PLG_MODULE_BUTTON_MODULE');
|
||||
$button->name = $this->_type . '_' . $this->_name;
|
||||
$button->icon = 'cube';
|
||||
$button->iconSVG = '<svg viewBox="0 0 512 512" width="24" height="24"><path d="M239.1 6.3l-208 78c-18.7 7-31.1 '
|
||||
. '25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 '
|
||||
. '26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 '
|
||||
. '78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z"></path></svg>';
|
||||
$button->options = [
|
||||
'height' => '300px',
|
||||
'width' => '800px',
|
||||
'bodyHeight' => '70',
|
||||
'modalWidth' => '80',
|
||||
];
|
||||
|
||||
return $button;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
plugins/editors-xtd/pagebreak/pagebreak.xml
Normal file
21
plugins/editors-xtd/pagebreak/pagebreak.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="editors-xtd" method="upgrade">
|
||||
<name>plg_editors-xtd_pagebreak</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2004-08</creationDate>
|
||||
<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>PLG_EDITORSXTD_PAGEBREAK_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\EditorsXtd\PageBreak</namespace>
|
||||
<files>
|
||||
<folder plugin="pagebreak">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_pagebreak.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_pagebreak.sys.ini</language>
|
||||
</languages>
|
||||
</extension>
|
||||
48
plugins/editors-xtd/pagebreak/services/provider.php
Normal file
48
plugins/editors-xtd/pagebreak/services/provider.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.pagebreak
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\Plugin\EditorsXtd\PageBreak\Extension\PageBreak;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$dispatcher = $container->get(DispatcherInterface::class);
|
||||
|
||||
$plugin = new PageBreak(
|
||||
$dispatcher,
|
||||
(array) PluginHelper::getPlugin('editors-xtd', 'pagebreak')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
90
plugins/editors-xtd/pagebreak/src/Extension/PageBreak.php
Normal file
90
plugins/editors-xtd/pagebreak/src/Extension/PageBreak.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.pagebreak
|
||||
*
|
||||
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\EditorsXtd\PageBreak\Extension;
|
||||
|
||||
use Joomla\CMS\Application\CMSWebApplicationInterface;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Editor Pagebreak button
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
final class PageBreak extends CMSPlugin
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.1
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Display the button
|
||||
*
|
||||
* @param string $name The name of the button to add
|
||||
*
|
||||
* @return CMSObject|void The button options as CMSObject
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public function onDisplay($name)
|
||||
{
|
||||
$app = $this->getApplication();
|
||||
|
||||
if (!$app instanceof CMSWebApplicationInterface) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user = $app->getIdentity();
|
||||
|
||||
// Can create in any category (component permission) or at least in one category
|
||||
$canCreateRecords = $user->authorise('core.create', 'com_content')
|
||||
|| count($user->getAuthorisedCategories('com_content', 'core.create')) > 0;
|
||||
|
||||
// Instead of checking edit on all records, we can use **same** check as the form editing view
|
||||
$values = (array) $app->getUserState('com_content.edit.article.id');
|
||||
$isEditingRecords = count($values);
|
||||
|
||||
// This ACL check is probably a double-check (form view already performed checks)
|
||||
$hasAccess = $canCreateRecords || $isEditingRecords;
|
||||
if (!$hasAccess) {
|
||||
return;
|
||||
}
|
||||
|
||||
$app->getDocument()->addScriptOptions('xtd-pagebreak', ['editor' => $name]);
|
||||
$link = 'index.php?option=com_content&view=article&layout=pagebreak&tmpl=component&e_name=' . $name;
|
||||
|
||||
$button = new CMSObject();
|
||||
$button->modal = true;
|
||||
$button->link = $link;
|
||||
$button->text = $app->getLanguage()->_('PLG_EDITORSXTD_PAGEBREAK_BUTTON_PAGEBREAK');
|
||||
$button->name = $this->_type . '_' . $this->_name;
|
||||
$button->icon = 'copy';
|
||||
$button->iconSVG = '<svg viewBox="0 0 32 32" width="24" height="24"><path d="M26 8h-6v-2l-6-6h-14v24h12v8h20v-18l-6-6zM26 10.828l3.172 3'
|
||||
. '.172h-3.172v-3.172zM14 2.828l3.172 3.172h-3.172v-3.172zM2 2h10v6h6v14h-16v-20zM30 30h-16v-6h6v-14h4v6h6v14z"></pa'
|
||||
. 'th></svg>';
|
||||
$button->options = [
|
||||
'height' => '200px',
|
||||
'width' => '400px',
|
||||
'bodyHeight' => '70',
|
||||
'modalWidth' => '80',
|
||||
];
|
||||
|
||||
return $button;
|
||||
}
|
||||
}
|
||||
264
plugins/editors-xtd/pagebuilderckbutton/pagebuilderckbutton.php
Normal file
264
plugins/editors-xtd/pagebuilderckbutton/pagebuilderckbutton.php
Normal file
@@ -0,0 +1,264 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2015 Cédric KEIFLIN alias ced1870
|
||||
* https://www.joomlack.fr
|
||||
* @license GNU/GPL
|
||||
* */
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Editor Pagebuilderckbutton buton
|
||||
*
|
||||
*/
|
||||
class PlgButtonPagebuilderckbutton extends JPlugin
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.1
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Pagebuilderckbutton button
|
||||
*
|
||||
* @param string $name The name of the button to add
|
||||
*
|
||||
*/
|
||||
public function onDisplay($name)
|
||||
{
|
||||
// loads the language files from the component frontend
|
||||
$lang = JFactory::getLanguage();
|
||||
$lang->load('com_pagebuilderck', JPATH_SITE . '/components/com_pagebuilderck', $lang->getTag(), false);
|
||||
|
||||
// load CKBox from the component
|
||||
include_once(JPATH_SITE . '/administrator/components/com_pagebuilderck/helpers/pagebuilderck.php');
|
||||
PagebuilderckHelper::loadCkbox();
|
||||
|
||||
// instantiate variables
|
||||
$doc = JFactory::getDocument();
|
||||
// $getContent = $this->_subject->getContent($name);
|
||||
|
||||
// get the list of pages
|
||||
$pages = json_encode($this->getPages());
|
||||
|
||||
// construct the JS code to manage the operations
|
||||
$js = "
|
||||
/* Function called on button click */
|
||||
function insertPagebuilderckbutton(editor) {
|
||||
pages = " . $pages . ";
|
||||
|
||||
// event.preventDefault();
|
||||
if (typeof(tinyMCE) == 'undefined') {
|
||||
var content = document.getElementById(editor).value;
|
||||
} else {
|
||||
var editor = tinyMCE.activeEditor;
|
||||
var content = editor.getContent({format: 'text'});
|
||||
}
|
||||
var re = /{pagebuilderck\s+(.*?)\s*}/ig;
|
||||
matches = content.match(re);
|
||||
createPagebuilderckPopup();
|
||||
|
||||
var PBCKmodal = jQuery('#pagebuilderckButtonModal');
|
||||
PBCKmodal.empty().append('<div class=\"inner\" />');
|
||||
PBCKmodalBody = PBCKmodal.find('> .inner').css('padding', '10px');
|
||||
PBCKmodalBody.append('<h4 class=pagebuilderckButtonModalTitle >" . JText::_('CK_NEW_TAG', true) . "</h4>');
|
||||
PBCKmodalBody.append('<div class=pagebuilderckButtonModalDesc >" . JText::_('CK_INSERT_NEW_DESC', true) . "</div>');
|
||||
PBCKmodalBody.append('<div class=\"clearfix\">'
|
||||
+'<a class=\"btn btn-primary\" onclick=\"loadPagebuilderckModalEdition(0)\" title=\"" . JText::_('CK_CREATE_NEW_PAGE_DESC', true) . "\"><i class=\"icon icon-new\"></i>" . JText::_('CK_CREATE_NEW_PAGE', true) . "</a>'
|
||||
+' '
|
||||
+'<a class=\"btn btn-primary\" onclick=\"loadPagebuilderckModalInsertChoice()\" title=\"" . JText::_('CK_INSERT_EXISTING_PAGE_DESC', true) . "\"><i class=\"icon icon-plus-2\"></i>" . JText::_('CK_INSERT_EXISTING_PAGE', true) . "</a>'
|
||||
+'</div>');
|
||||
if (matches && matches.length) {
|
||||
PBCKmodalBody.append('<hr style=\"margin:10px 0;\"/>');
|
||||
PBCKmodalBody.append('<h4 class=pagebuilderckButtonModalTitle >" . JText::_('CK_EXISTING_TAGS_FOUND', true) . "</h4>');
|
||||
PBCKmodalBody.append('<div class=pagebuilderckButtonModalDesc >" . JText::_('CK_EXISTING_TAGS_FOUND_DESC', true) . "</div>');
|
||||
for (var i = 0; i < matches.length; i++) {
|
||||
match = matches[i];
|
||||
var id = match.replace('pagebuilderck', '')
|
||||
.replace('{', '')
|
||||
.replace('}', '')
|
||||
.trim();
|
||||
addPagebuilderckEditionChoice(id);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
// jInsertEditorText('<hr id=\"system-readmore\" />', editor);
|
||||
}
|
||||
}
|
||||
|
||||
/* Called from the modal pages list, to insert the tag from the ID */
|
||||
function insertPagebuilderckTag(id) {
|
||||
// jInsertEditorText('{pagebuilderck '+id+'}', '" . $name . "');
|
||||
tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{pagebuilderck '+id+'}');
|
||||
CKBox.close('#CKBoxPagebuilderckButtonModal .ckboxmodal-footer');
|
||||
}
|
||||
|
||||
/* Create the popup */
|
||||
function createPagebuilderckPopup() {
|
||||
removeFooterSaveButton();
|
||||
if (! document.getElementById('pagebuilderckButtonModal')) {
|
||||
var popup = document.createElement('div');
|
||||
popup.id = 'pagebuilderckButtonModal';
|
||||
popup.className = 'pagebuilderckButtonModal';
|
||||
popup.style.height = '100%';
|
||||
document.body.appendChild(popup);
|
||||
popup.innerHTML = ''
|
||||
+'<h3>" . JText::_('CK_EDIT', true) . "</h3>'
|
||||
+'';
|
||||
}
|
||||
var PBCKmodal = jQuery('#pagebuilderckButtonModal');
|
||||
|
||||
CKBox.open({handler: 'inline', content: 'pagebuilderckButtonModal', style: {padding: '10px'}, id: 'CKBoxPagebuilderckButtonModal' });
|
||||
}
|
||||
|
||||
/* Add a line for each existing page to edit */
|
||||
function addPagebuilderckEditionChoice(id) {
|
||||
pages = " . $pages . ";
|
||||
var PBCKmodal = jQuery('#pagebuilderckButtonModal');
|
||||
var pagetitle = (typeof(pages[id]) != 'undefined') ? '" . JText::_('CK_TITLE', true) . ": <span class=\"label cktitle\">' + pages[id]['title'] + '</span>' : '';
|
||||
PBCKmodal.append('<div class=pagebuilderckButtonModalChoice><span class=\"\">" . JText::_('CK_ID', true) . "</span> : <span class=\"label label-info ckid\">'+id+'</span>' + pagetitle + '<a class=\"btn ckedit\" data-id='+id+' onclick=\"loadPagebuilderckModalEdition('+id+')\" ><i class=\"icon icon-edit\"></i>" . JText::_('CK_EDIT', true) . "</a></div>');
|
||||
}
|
||||
|
||||
/* Load the list of pages to select the one to insert */
|
||||
function loadPagebuilderckModalInsertChoice() {
|
||||
var PBCKmodal = jQuery('#pagebuilderckButtonModal');
|
||||
PBCKmodal.empty();
|
||||
PBCKmodal.prepend('<iframe class=\"iframe\" src=\"".JUri::base(true)."/index.php?option=com_pagebuilderck&view=pages&layout=modal&function=insertPagebuilderckTag&tmpl=component\"></iframe>');
|
||||
}
|
||||
|
||||
/* Load the edition area for the selected page */
|
||||
function loadPagebuilderckModalEdition(id) {
|
||||
var PBCKmodal = jQuery('#pagebuilderckButtonModal');
|
||||
removeFooterSaveButton();
|
||||
addFooterSaveButton();
|
||||
|
||||
PBCKmodal.empty();
|
||||
PBCKmodal.prepend('<iframe class=\"iframe\" src=\"".JUri::base(true)."/index.php?option=com_pagebuilderck&view=page&layout=modal&id='+id+'&tmpl=component\"></iframe>');
|
||||
if (id == 0) {
|
||||
addInsertNewPageButton();
|
||||
}
|
||||
}
|
||||
|
||||
/* Add the insert new page button */
|
||||
function addInsertNewPageButton() {
|
||||
jQuery('#pagebuilderckButtonModal').find('iframe').on('load', function() {
|
||||
var idval = jQuery('#pagebuilderckButtonModal').find('iframe').contents().find('input[name=\"id\"]').val();
|
||||
if (idval != '') {
|
||||
jQuery('#CKBoxPagebuilderckButtonModal').find('.ckboxmodal-footer').append('<button class=\"ckboxmodal-button btn btn-success saveck\" data-dismiss=\"modal\" aria-hidden=\"true\" onclick=\"jQuery(\'iframe\', jQuery(jQuery(this).parents(\'.ckboxmodal\')[0])).contents().find(\'#applyBtn\').click();insertPagebuilderckTag(' + idval + ')\"><i class=\"icon icon-checkmark\"></i>" . JText::_('CK_INSERT_PAGE_AND_CLOSE', true) . "</button>');
|
||||
}
|
||||
// add automatically the title for the page
|
||||
if (jQuery('#jform_title').length && jQuery('#jform_title').val()) {
|
||||
jQuery('#CKBoxPagebuilderckButtonModal').find('.ckboxmodal-body iframe').contents().find('input[name=\"title\"]').val(jQuery('#jform_title').val());
|
||||
}
|
||||
});
|
||||
jQuery('#CKBoxPagebuilderckButtonModal').find('.ckboxmodal-footer .savecloseck').hide();
|
||||
}
|
||||
|
||||
/* Add the save button */
|
||||
function addFooterSaveButton() {
|
||||
jQuery('#CKBoxPagebuilderckButtonModal').find('.ckboxmodal-footer').append('<button class=\"ckboxmodal-button btn btn-success saveck savecloseck\" data-dismiss=\"modal\" aria-hidden=\"true\" onclick=\"jQuery(\'iframe\', jQuery(jQuery(this).parents(\'.ckboxmodal\')[0])).contents().find(\'#saveBtn\').click();CKBox.close(\'#CKBoxPagebuilderckButtonModal .ckboxmodal-footer\', \'1\');\"><i class=\"icon icon-checkmark\"></i> " . JText::_('CK_SAVE_CLOSE', true) . "</button>');
|
||||
jQuery('#CKBoxPagebuilderckButtonModal').find('.ckboxmodal-footer').append('<button class=\"ckboxmodal-button btn btn-success saveck\" aria-hidden=\"true\" onclick=\"jQuery(\'iframe\', jQuery(jQuery(this).parents(\'.ckboxmodal\')[0])).contents().find(\'#applyBtn\').click();\"><i class=\"icon icon-checkmark\"></i> " . JText::_('CK_APPLY', true) . "</button>');
|
||||
}
|
||||
|
||||
/* Remove the save button (only needed on edition mode) */
|
||||
function removeFooterSaveButton() {
|
||||
jQuery('#CKBoxPagebuilderckButtonModal').find('.ckboxmodal-footer .saveck').remove();
|
||||
jQuery('#CKBoxPagebuilderckButtonModal').find('.ckboxmodal-footer .applyck').remove();
|
||||
}
|
||||
";
|
||||
|
||||
$css = '/** fullscreen mode for the Page Builder CK modal **/
|
||||
.pagebuilderckButtonModalFullscreen {
|
||||
top: 0 !important;
|
||||
left: 0 !important;
|
||||
right: 0 !important;
|
||||
margin: 0 !important;
|
||||
width: 100% !important;
|
||||
box-sizing: border-box;
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.pagebuilderckButtonModalFullscreen .ckboxmodal-body {
|
||||
max-height: 100% !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.pagebuilderckButtonModalFullscreen iframe {
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.pagebuilderckButtonModalDesc {
|
||||
padding: 0 0 10px 0;
|
||||
}
|
||||
|
||||
.pagebuilderckButtonModalChoice {
|
||||
border-bottom: 1px solid #ddd;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.pagebuilderckButtonModalChoice .label {
|
||||
margin: 0 7px;
|
||||
}
|
||||
|
||||
.pagebuilderckButtonModalChoice > span {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.pagebuilderckButtonModalChoice > span.ckid {
|
||||
min-width: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pagebuilderckButtonModalChoice > span.cktitle {
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
.pagebuilderckButtonModalChoice > span.ckedit {
|
||||
|
||||
}
|
||||
|
||||
.pagebuilderckButtonModal .ckboxmodal-body iframe {
|
||||
border: 0 none !important;
|
||||
max-height: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#CKBoxPagebuilderckButtonModal .icon {
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
';
|
||||
|
||||
$doc->addScriptDeclaration($js);
|
||||
$doc->addStyleDeclaration($css);
|
||||
$button = new JObject;
|
||||
$button->modal = false;
|
||||
$button->class = 'btn hasTooltip';
|
||||
$button->onclick = 'insertPagebuilderckbutton(\'' . $name . '\');return false;';
|
||||
$button->text = JText::_('PLG_PAGEBUILDERCKBUTTON');
|
||||
$button->name = 'grid';
|
||||
$button->title = JText::_('PLG_PAGEBUILDERCKBUTTON_DESC');
|
||||
|
||||
$button->link = '#';
|
||||
|
||||
return $button;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the list of published pages with names
|
||||
*
|
||||
* Return Array - The list of pages
|
||||
*/
|
||||
public function getPages() {
|
||||
$db = JFactory::getDbo();
|
||||
$q = "SELECT title, id FROM #__pagebuilderck_pages WHERE state=1";
|
||||
$db->setQuery($q);
|
||||
$db->execute();
|
||||
$pages = $db->loadObjectlist('id');
|
||||
|
||||
return $pages;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension version="3.0" type="plugin" group="editors-xtd" method="upgrade">
|
||||
<name>Button - Pagebuilder CK</name>
|
||||
<author>Cédric KEIFLIN</author>
|
||||
<creationDate>August 2015</creationDate>
|
||||
<copyright>Cédric KEIFLIN</copyright>
|
||||
<license>https://www.gnu.org/licenses/gpl.html</license>
|
||||
<authorEmail>ced1870@gmail.com</authorEmail>
|
||||
<authorUrl>https://www.joomlack.fr</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>Button - Pagebuilder CK. Manage the pages into the editor.</description>
|
||||
<files>
|
||||
<filename plugin="pagebuilderckbutton">pagebuilderckbutton.php</filename>
|
||||
</files>
|
||||
</extension>
|
||||
266
plugins/editors-xtd/pagebuilderckeditor/pagebuilderckeditor.php
Normal file
266
plugins/editors-xtd/pagebuilderckeditor/pagebuilderckeditor.php
Normal file
@@ -0,0 +1,266 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2016 Cédric KEIFLIN alias ced1870
|
||||
* https://www.joomlack.fr
|
||||
* @license GNU/GPL
|
||||
* */
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
//if (! defined('CK_LOADED')) define('CK_LOADED', 1);
|
||||
|
||||
require_once JPATH_ADMINISTRATOR . '/components/com_pagebuilderck/helpers/ckfof.php';
|
||||
use Pagebuilderck\CKFof;
|
||||
|
||||
/**
|
||||
* Editor Pagebuilderckeditor button
|
||||
*
|
||||
*/
|
||||
class PlgButtonPagebuilderckeditor extends JPlugin
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.1
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
protected $elements;
|
||||
|
||||
/**
|
||||
* Pagebuilderckeditor button
|
||||
*
|
||||
* @param string $name The name of the button to add
|
||||
*
|
||||
*/
|
||||
public function onDisplay($name)
|
||||
{
|
||||
|
||||
// check the name of the editor, if ckeditor then we must not load this button because we are already in the pagebuilder
|
||||
if ($name == 'ckeditor') return;
|
||||
|
||||
$doc = JFactory::getDocument();
|
||||
$app = JFactory::getApplication();
|
||||
$input = $app->input;
|
||||
$conf = JFactory::getConfig();
|
||||
$css = "";
|
||||
|
||||
$user = JFactory::getUser();
|
||||
|
||||
// authorize only in article edition admin and front, if the page builder ck editor has been allowed, comes from the system plugin
|
||||
if ($conf->get('pagebuilderck_allowed') != '1')
|
||||
return;
|
||||
|
||||
// loads the language files from the component frontend
|
||||
$lang = JFactory::getLanguage();
|
||||
$lang->load('com_pagebuilderck', JPATH_SITE . '/components/com_pagebuilderck', $lang->getTag(), false);
|
||||
$lang->load('com_pagebuilderck', JPATH_SITE, $lang->getTag(), false);
|
||||
|
||||
// for 3rd party integration
|
||||
$thirdPartyIntegrations = PagebuilderckHelper::getThirdPartyIntegrations();
|
||||
$attribsVar = $thirdPartyIntegrations['attribs'];
|
||||
$adminForm = $thirdPartyIntegrations['adminForm'];
|
||||
$fieldsname = $thirdPartyIntegrations['fieldsname'];
|
||||
|
||||
if ($input->get('option', '') !== 'com_content'
|
||||
&& $input->get('option', '') !== 'com_flexicontent'
|
||||
) {
|
||||
// if the field is not allowed in the list, don't show the button
|
||||
if ($name !== 'jform_' . $fieldsname) return;
|
||||
// if the integration params of PBCK does not allow, don't show the button
|
||||
if ($conf->get('pagebuilderck_allowed_' . $fieldsname, '1') == '0') return;
|
||||
}
|
||||
|
||||
// if the page builder ck editor must be used
|
||||
if ($input->get('pbck', '0') == '1') {
|
||||
$short_name = str_replace('jform_', '', $name);
|
||||
if ($conf->get('pagebuilderck_allowed_' . $short_name) != '1')
|
||||
return;
|
||||
|
||||
$conf = JFactory::getConfig();
|
||||
// Get the text filter data
|
||||
$params = JComponentHelper::getParams('com_config');
|
||||
$filters = CKFof::convertObjectToArray($params->get('filters'));
|
||||
// check if the user has the correct rights on the filters to save the article
|
||||
if (! in_array('8', $user->groups)) { // checks for super user group
|
||||
foreach($user->groups as $g) {
|
||||
if (isset($filters[$g])) {
|
||||
$filters[$g] = CKFof::convertObjectToArray($filters[$g]);
|
||||
if ($filters[$g]['filter_type'] === 'BL') $app->enqueueMessage('PAGE BUILDER CK : ' . JText::_('CK_WARNING_USERGROUP_FILTERTYPE_BLACKLIST'), 'error');
|
||||
}
|
||||
// if ($filters[$g]['filter_type'] === 'WL' && strpos($filters[$g]['filter_tags'], 'style') === false) $app->enqueueMessage('PAGE BUILDER CK : ' . JText::_('CK_WARNING_USERGROUP_FILTERTYPE_WHITELIST_NOSTYLE'), 'error');
|
||||
}
|
||||
}
|
||||
|
||||
include_once JPATH_ADMINISTRATOR . '/components/com_pagebuilderck/helpers/menustyles.php';
|
||||
include_once JPATH_ADMINISTRATOR . '/components/com_pagebuilderck/helpers/stylescss.php';
|
||||
// include_once JPATH_ADMINISTRATOR . '/components/com_pagebuilderck/helpers/ckeditor.php';
|
||||
include_once JPATH_ADMINISTRATOR . '/components/com_pagebuilderck/helpers/pagebuilderck.php';
|
||||
include_once JPATH_ADMINISTRATOR . '/components/com_pagebuilderck/helpers/ckmodel.php';
|
||||
|
||||
// get instance of the editor to load the css / js in the page
|
||||
// $this->ckeditor = PagebuilderckHelper::loadEditor();
|
||||
// need the tinymce instance for the items edition
|
||||
// Load the editor Tinymce or JCE
|
||||
$editor = $conf->get('pagebuilderck_replaced_editor') == 'jce' ? 'jce' : 'tinymce';
|
||||
$editor = JEditor::getInstance($editor);
|
||||
$editor->display('ckeditor', $html = '', $width = '', $height = '200px', $col='', $row='', $buttons = true, $id = 'ckeditor');
|
||||
// Get an instance of the model
|
||||
// JModelLegacy::addIncludePath(JPATH_SITE . '/administrator/components/com_pagebuilderck/models', 'PagebuilderckModel');
|
||||
$model = Pagebuilderck\CKModel::getInstance('Elements', 'Pagebuilderck');
|
||||
// $model = $this->getModel('Elements', '', array());
|
||||
$this->elements = $model->getItems();
|
||||
|
||||
str_replace('"', '\"', include_once(JPATH_ADMINISTRATOR . '/components/com_pagebuilderck/views/page/tmpl/include.php'));
|
||||
str_replace('"', '\"', include_once(JPATH_ADMINISTRATOR . '/components/com_pagebuilderck/views/page/tmpl/submitform.php'));
|
||||
str_replace('"', '\"', include_once(JPATH_ADMINISTRATOR . '/components/com_pagebuilderck/views/page/tmpl/menu.php'));
|
||||
str_replace('"', '\"', include_once(JPATH_ADMINISTRATOR . '/components/com_pagebuilderck/views/page/tmpl/toolbar.php'));
|
||||
str_replace('"', '\"', include_once(JPATH_ADMINISTRATOR . '/components/com_pagebuilderck/views/page/tmpl/contextmenu.php'));
|
||||
|
||||
// force the inclusion of the field with the value 1
|
||||
echo '<input id="jform_attribs_pagebuilderck_editor" type="hidden" value="1" name="jform[attribs][pagebuilderck_editor]">';
|
||||
|
||||
// section specific to content types
|
||||
$iscontenttype = $input->get('iscontenttype', 0, 'int');
|
||||
// force state with url variable, for debugging purposes
|
||||
$iscontenttype = isset($_GET['iscontenttype']) ? $_GET['iscontenttype'] : $iscontenttype;
|
||||
|
||||
echo '<input id="jform_attribs_pagebuilderck_iscontenttype" type="hidden" value="' . $iscontenttype . '" name="jform[attribs][pagebuilderck_iscontenttype]">';
|
||||
$contenttype = $input->get('contenttype', '', 'string');
|
||||
/*if ($iscontenttype === 1) {
|
||||
JPluginHelper::importPlugin( 'pagebuilderck' );
|
||||
ob_start();
|
||||
Pagebuilderck\CKFof::triggerEvent( 'onPagebuilderckLoadItemContent' . ucfirst($contenttype) );
|
||||
$contenttypehtml = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$contenttypehtml = str_replace("'", "\'", $contenttypehtml);
|
||||
$contenttypehtml = str_replace("\n", "", $contenttypehtml);
|
||||
$contenttypehtml = str_replace("\r", "", $contenttypehtml);
|
||||
} else {
|
||||
$contenttypehtml = '';
|
||||
}*/
|
||||
|
||||
$js1 = "
|
||||
function pbckeditorLoadEditor(name) {
|
||||
var cont = jQuery(name).parent();
|
||||
// cont.css('display', 'none');
|
||||
var html = '<div id=\"workspaceparentck\">'
|
||||
+'<div id=\"workspaceck\" class=\"pagebuilderck workspaceck" . ($input->get('iscontenttype', 0, 'int') === 1 ? ' ckiscontenttype' : '') ."\">'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
// load the page builder workspace and hide the textarea
|
||||
//cont.children().hide();
|
||||
cont.append(html);
|
||||
|
||||
// fix for RSFirewall
|
||||
jQuery(name).val(jQuery(name).val().replace(/<s-tyle/g, '<style'));
|
||||
jQuery(name).val(jQuery(name).val().replace(/s-tyle>/g, 'style>'));
|
||||
|
||||
var injectContentToPbck = false;
|
||||
// test if this is a new content or already created with page builder
|
||||
if (jQuery(name).length && ! jQuery(name).val().includes('rowck')) {
|
||||
injectContentToPbck = true;
|
||||
}
|
||||
|
||||
jQuery('#workspaceparentck').prepend(jQuery('#context-menu-ck'));
|
||||
if (jQuery(name).length && ! injectContentToPbck) {
|
||||
jQuery('#workspaceck').html(jQuery(name).val().replace(/\|URIROOT\|/g, '" . JUri::root(true) . "'));
|
||||
}
|
||||
|
||||
ckInitWorkspace();
|
||||
// manage content creation if is a content type
|
||||
if (PAGEBUILDERCK.ISCONTENTTYPE == '1' && injectContentToPbck) {
|
||||
var workspace = ckGetWorkspace();
|
||||
var newrowid = ckGetUniqueId('row_');
|
||||
var newrow = ckHtmlRow(newrowid);
|
||||
workspace.append(newrow);
|
||||
var newblockid = ckGetUniqueId('block_');
|
||||
var newblock = ckHtmlBlock(newblockid);
|
||||
jQuery('> .inner', newrow).append(newblock);
|
||||
ckInitBlocksSize(newrow);
|
||||
|
||||
jQuery('#workspaceck .blockck > .inner > .innercontent').addClass('ckfocus');
|
||||
ckAddItem('" . $contenttype . "');
|
||||
}
|
||||
// manage content creation for a standard article
|
||||
else if (injectContentToPbck) {
|
||||
jQuery('#workspaceck .blockck > .inner > .innercontent').addClass('ckfocus');
|
||||
ckAddItem('text');
|
||||
|
||||
// Override to get the appended text ID and update the data
|
||||
/*function ckTriggerAfterAdditem(id) {
|
||||
var content = jQuery('#" . $name . "').val();
|
||||
content = ckEditorToContent(content);
|
||||
jQuery('#'+id+' > .inner').html(content);
|
||||
}*/
|
||||
}
|
||||
|
||||
cont.css('display', '');
|
||||
|
||||
// adds the settings in JS to be sure that it is at the end of the front end form
|
||||
jQuery('#" . $adminForm . "').append('<input id=\"jform_" . $attribsVar . "_pagebuilderck_editor\" type=\"hidden\" value=\"1\" name=\"jform[" . $attribsVar . "][pagebuilderck_editor]\">');
|
||||
jQuery('#adminForm').append('<input id=\"jform_attribs_pagebuilderck_editor\" type=\"hidden\" value=\"1\" name=\"jform[attribs][pagebuilderck_editor]\">');
|
||||
jQuery('#adminForm').append('<input id=\"jform_attribs_pagebuilderck_iscontenttype\" type=\"hidden\" value=\"" . $iscontenttype . "\" name=\"jform[attribs][pagebuilderck_iscontenttype]\">');
|
||||
}
|
||||
|
||||
|
||||
// Override to get the appended text ID and update the data
|
||||
function ckTriggerAfterAdditem(id) {
|
||||
var content = jQuery('#" . $name . "').val();
|
||||
content = ckEditorToContent(content);
|
||||
jQuery('#'+id+' > .inner').html(content);
|
||||
}
|
||||
|
||||
JoomlaCK.beforesubmitbutton = function(task) {
|
||||
// check if the function exists, loads it
|
||||
if (typeof ckBeforeSaveWorkspace == 'function') { ckBeforeSaveWorkspace(); }
|
||||
|
||||
var workspace = jQuery('#workspaceck');
|
||||
|
||||
jQuery('#" . $name . "').val(workspace.html());
|
||||
|
||||
// JoomlaCK.submitbutton(task);
|
||||
}
|
||||
";
|
||||
|
||||
echo "<script>" . $js1 . "</script>";
|
||||
|
||||
$css .= "#" . $name . ",
|
||||
#" . $name . " + #editor-xtd-buttons,
|
||||
#editor-xtd-buttons,
|
||||
.editor-xtd-buttons
|
||||
{
|
||||
display: none;
|
||||
}";
|
||||
}
|
||||
|
||||
// construct the JS code to manage the operations
|
||||
$js2 = "
|
||||
jQuery(document).ready(function (){
|
||||
if (" . $input->get('pbck', '0') . " != '1') pbckeditorLoadEditorButton('#" . $name . "');
|
||||
if (" . $input->get('pbck', '0') . " == '1') pbckeditorLoadEditor('#" . $name . "');
|
||||
});
|
||||
|
||||
function pbckeditorLoadEditorButton(name) {
|
||||
var cont = jQuery(name).parent();
|
||||
cont.before('<a class=\"btn pbckswitch btn-secondary\" onclick=\"pbckLoadPagebuilderckEditor()\"><i class=\"icon icon-loop\"></i> " . JText::_('CK_LOAD_PAGEBUILDERCK_EDITOR', true) . "</a>');
|
||||
}
|
||||
|
||||
function pbckLoadPagebuilderckEditor() {
|
||||
var beSure = confirm('" . JText::_('CK_CONFIRM_PAGEBUILDERCK_EDITOR', true) . "');
|
||||
if (!beSure) return;
|
||||
|
||||
window.location.search += '&pbck=1';
|
||||
}
|
||||
";
|
||||
$doc->addScriptDeclaration($js2);
|
||||
|
||||
$css .= ".pbckswitch {
|
||||
margin: 5px 0;
|
||||
}";
|
||||
$doc->addStyleDeclaration($css);
|
||||
|
||||
if ($input->get('option', '') == 'com_flexicontent') $editor = $conf->set('editor', $conf->get('pagebuilderck_replaced_editor'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension version="3.0" type="plugin" group="editors-xtd" method="upgrade">
|
||||
<name>Editor - Pagebuilder CK</name>
|
||||
<author>Cédric KEIFLIN</author>
|
||||
<creationDate>Februar 2016</creationDate>
|
||||
<copyright>Cédric KEIFLIN</copyright>
|
||||
<license>https://www.gnu.org/licenses/gpl.html</license>
|
||||
<authorEmail>ced1870@gmail.com</authorEmail>
|
||||
<authorUrl>https://www.joomlack.fr</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>Editor - Add a button to switch between the native editor and Page Builder CK</description>
|
||||
<files>
|
||||
<filename plugin="pagebuilderckeditor">pagebuilderckeditor.php</filename>
|
||||
</files>
|
||||
</extension>
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/**
|
||||
* @package quantummanagerbutton
|
||||
* @author Dmitry Tsymbal <cymbal@delo-design.ru>
|
||||
* @copyright Copyright © 2019 Delo Design & NorrNext. All rights reserved.
|
||||
* @license GNU General Public License version 3 or later; see license.txt
|
||||
* @link https://www.norrnext.com
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Filter\OutputFilter;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Layout\FileLayout;
|
||||
|
||||
|
||||
JFormHelper::loadFieldClass('subform');
|
||||
|
||||
/**
|
||||
* @package ${NAMESPACE}
|
||||
*
|
||||
* @since version
|
||||
*/
|
||||
class JFormFieldQuantummanagerscopesinsert extends JFormFieldSubform
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'QuantumManagerScopesInsert';
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getInput()
|
||||
{
|
||||
$lang = Factory::getLanguage()->load('com_quantummanager', JPATH_ROOT . '/administrator/components/com_quantummanager');
|
||||
JLoader::register('QuantummanagerHelper', JPATH_ROOT . '/administrator/components/com_quantummanager/helpers/quantummanager.php');
|
||||
JLoader::register('QuantummanagerbuttonHelper', JPATH_ROOT . '/plugins/editors-xtd/quantummanagerbutton/helper.php');
|
||||
$scopesForInput = [];
|
||||
$currentValue = $this->value;
|
||||
$scopes = QuantummanagerHelper::getAllScope('all');
|
||||
$defaultValues = QuantummanagerbuttonHelper::defaultValues();
|
||||
$i = 0;
|
||||
foreach ($scopes as $scope)
|
||||
{
|
||||
|
||||
if($scope->id === 'sessionroot')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$findValue = null;
|
||||
|
||||
if(is_array($currentValue) && count($currentValue) > 0)
|
||||
{
|
||||
foreach ($currentValue as $value)
|
||||
{
|
||||
if ($value['id'] === $scope->id)
|
||||
{
|
||||
$findValue = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$title = '';
|
||||
|
||||
if (substr_count($scope->title, 'COM_QUANTUMMANAGER'))
|
||||
{
|
||||
$title = Text::_($scope->title);
|
||||
}
|
||||
|
||||
$defaultTemplateList = '';
|
||||
$defaultFieldsform = '';
|
||||
|
||||
if (isset($defaultValues[$scope->id]))
|
||||
{
|
||||
$defaultTemplateList = $defaultValues[$scope->id]->templatelist;
|
||||
$defaultFieldsform = json_encode($defaultValues[$scope->id]->fieldsform);
|
||||
}
|
||||
|
||||
$scopesForInput['scopes' . $i] = [
|
||||
'title' => $scope->title,
|
||||
'titleLabel' => $scope->title,
|
||||
'id' => $scope->id,
|
||||
'fieldsform' => $findValue !== null ? $findValue['fieldsform'] : $defaultFieldsform,
|
||||
'templatelist' => $findValue !== null ? $findValue['templatelist'] : $defaultTemplateList,
|
||||
];
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->value = $scopesForInput;
|
||||
$html = parent::getInput();
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
324
plugins/editors-xtd/quantummanagerbutton/helper.php
Normal file
324
plugins/editors-xtd/quantummanagerbutton/helper.php
Normal file
@@ -0,0 +1,324 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package quantummanagerbutton
|
||||
* @author Dmitry Tsymbal <cymbal@delo-design.ru>
|
||||
* @copyright Copyright © 2019 Delo Design & NorrNext. All rights reserved.
|
||||
* @license GNU General Public License version 3 or later; see license.txt
|
||||
* @link https://www.norrnext.com
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\FileLayout;
|
||||
|
||||
class QuantummanagerbuttonHelper
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var
|
||||
* @since version
|
||||
*/
|
||||
public static $template;
|
||||
|
||||
|
||||
public static function loadLang()
|
||||
{
|
||||
Factory::getLanguage()->load('plg_editors-xtd_quantummanagerbutton', JPATH_ADMINISTRATOR);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since version
|
||||
*/
|
||||
public static function getFieldsForScopes()
|
||||
{
|
||||
|
||||
$db = Factory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName(array('params')))
|
||||
->from('#__extensions')
|
||||
->where('element=' . $db->quote('quantummanagerbutton'));
|
||||
$extension = $db->setQuery($query)->loadObject();
|
||||
$params = json_decode($extension->params, JSON_OBJECT_AS_ARRAY);
|
||||
|
||||
if (!isset($params['scopes']) || empty($params['scopes']) || count((array) $params['scopes']) === 0)
|
||||
{
|
||||
$scopes = self::defaultValues();
|
||||
$scopes_custom = [];
|
||||
}
|
||||
else
|
||||
{
|
||||
$scopes = $params['scopes'];
|
||||
$scopes_custom = $params['customscopes'] ?? [];
|
||||
}
|
||||
|
||||
$output = [];
|
||||
|
||||
foreach ($scopes as $scope)
|
||||
{
|
||||
$scope = (array) $scope;
|
||||
$output[$scope['id']] = [
|
||||
'title' => $scope['title'],
|
||||
'fieldsform' => $scope['fieldsform']
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($scopes_custom as $scope)
|
||||
{
|
||||
$scope = (array) $scope;
|
||||
$output[$scope['id']] = [
|
||||
'title' => $scope['title'],
|
||||
'fieldsform' => $scope['fieldsform']
|
||||
];
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since version
|
||||
*/
|
||||
public static function getTemplateListForScopes()
|
||||
{
|
||||
$db = Factory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName(array('params')))
|
||||
->from('#__extensions')
|
||||
->where('element=' . $db->quote('quantummanagerbutton'));
|
||||
$extension = $db->setQuery($query)->loadObject();
|
||||
$params = json_decode($extension->params, JSON_OBJECT_AS_ARRAY);
|
||||
|
||||
if (!isset($params['scopes']) || empty($params['scopes']) || count((array) $params['scopes']) === 0)
|
||||
{
|
||||
$scopes = self::defaultValues();
|
||||
$scopes_custom = [];
|
||||
}
|
||||
else
|
||||
{
|
||||
$scopes = $params['scopes'];
|
||||
$scopes_custom = $params['customscopes'] ?? [];
|
||||
}
|
||||
|
||||
foreach ($scopes_custom as $scope)
|
||||
{
|
||||
$scopes[count($scopes)] = $scope;
|
||||
}
|
||||
|
||||
$output = [];
|
||||
|
||||
foreach ($scopes as $scope)
|
||||
{
|
||||
$scope = (array) $scope;
|
||||
|
||||
$templatelist = [];
|
||||
$templatelistFromScope = $scope['templatelist'];
|
||||
|
||||
if (!is_array($templatelistFromScope))
|
||||
{
|
||||
$templatelistFromScope = [
|
||||
[
|
||||
'templatename' => Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_SCOPES_NAME_DEFAULT'),
|
||||
'template' => '<a href="{file}" target="_blank">{name}</a>'
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($templatelistFromScope as $keyTemplate => $template)
|
||||
{
|
||||
$templateItem = '';
|
||||
if (preg_match("#^\{\{.*?\}\}$#isu", trim($template['template'])))
|
||||
{
|
||||
$layoutId = str_replace(['{', '}'], '', $template['template']);
|
||||
$templateItem = self::renderLayout($layoutId);
|
||||
}
|
||||
else
|
||||
{
|
||||
$templateItem = $template['template'];
|
||||
}
|
||||
|
||||
$enablefields = [];
|
||||
$matches = [];
|
||||
preg_match_all("#\{(.*?)\}#isu", $templateItem, $matches);
|
||||
|
||||
if (isset($matches[1]))
|
||||
{
|
||||
foreach ($matches[1] as $findField)
|
||||
{
|
||||
if (!in_array($findField, $enablefields))
|
||||
{
|
||||
$enablefields[] = $findField;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$templatelist[] = [
|
||||
'name' => $template['templatename'],
|
||||
'enablefields' => $enablefields,
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
$output[$scope['id']] = [
|
||||
'title' => $scope['title'],
|
||||
'templatelist' => $templatelist
|
||||
];
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $layoutId
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws Exception
|
||||
* @since version
|
||||
*/
|
||||
public static function renderLayout($layoutId)
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
$template = $app->getTemplate();
|
||||
|
||||
if (empty(self::$template))
|
||||
{
|
||||
$db = Factory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('template')
|
||||
->from('#__template_styles as e')
|
||||
->where('e.client_id = 0')
|
||||
->where('e.home = 1')
|
||||
->setLimit(1);
|
||||
$db->setQuery($query);
|
||||
$template = $db->loadObject();
|
||||
if (isset($template->template))
|
||||
{
|
||||
self::$template = $template->template;
|
||||
}
|
||||
}
|
||||
|
||||
$layout = new FileLayout($layoutId);
|
||||
$layout->addIncludePath([
|
||||
JPATH_ROOT . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, ['templates', self::$template, 'layouts', 'plg_quantummanagcontent']),
|
||||
JPATH_ROOT . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, ['templates', self::$template, 'html', 'layouts', 'plg_quantummanagcontent']),
|
||||
JPATH_ROOT . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, ['templates', self::$template, 'html', 'layouts', 'plg_content_quantummanagercontent']),
|
||||
JPATH_ROOT . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, ['templates', self::$template, 'html', 'plg_content_quantummanagercontent']),
|
||||
JPATH_ROOT . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, ['templates', self::$template, 'html', 'plg_quantummanagcontent']),
|
||||
JPATH_ROOT . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, ['templates', self::$template, 'html', 'plg_button_quantummanagerbutton']),
|
||||
]);
|
||||
|
||||
$output = $layout->render();
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since version
|
||||
*/
|
||||
public static function defaultValues()
|
||||
{
|
||||
$lang = Factory::getLanguage();
|
||||
$lang->load('plg_editors-xtd_quantummanagerbutton', JPATH_ADMINISTRATOR);
|
||||
$lang->load('com_quantummanager', JPATH_ROOT . '/administrator/components/com_quantummanager');
|
||||
|
||||
return [
|
||||
'images' => (object) [
|
||||
'id' => 'images',
|
||||
'title' => Text::_('COM_QUANTUMMANAGER_SCOPE_IMAGES'),
|
||||
'templatelist' => [
|
||||
'templatelist0' => [
|
||||
'templatename' => Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_SCOPES_NAME_IMAGE'),
|
||||
'templatebefore' => '',
|
||||
'template' => '<img src="{file}" alt="{alt}" width="{width}" height="{height}" />',
|
||||
'templateafter' => '',
|
||||
]
|
||||
],
|
||||
'fieldsform' => [
|
||||
'fieldsform0' => [
|
||||
'nametemplate' => 'width',
|
||||
'name' => Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_SCOPES_IMAGES_FIELDSFORM_WIDTH_NAME'),
|
||||
'default' => '',
|
||||
'type' => 'number',
|
||||
],
|
||||
'fieldsform1' => [
|
||||
'nametemplate' => 'height',
|
||||
'name' => Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_SCOPES_IMAGES_FIELDSFORM_HEIGHT_NAME'),
|
||||
'default' => '',
|
||||
'type' => 'number',
|
||||
],
|
||||
'fieldsform3' => [
|
||||
'nametemplate' => 'alt',
|
||||
'name' => Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_SCOPES_IMAGES_FIELDSFORM_ALT_NAME'),
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
]
|
||||
]
|
||||
],
|
||||
'docs' => (object) [
|
||||
'id' => 'docs',
|
||||
'title' => Text::_('COM_QUANTUMMANAGER_SCOPE_DOCS'),
|
||||
'templatelist' => [
|
||||
'templatelist0' => [
|
||||
'templatename' => Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_SCOPES_NAME_DOC'),
|
||||
'templatebefore' => '',
|
||||
'template' => '<a href="{file}" target="_blank">{name}</a>',
|
||||
'templateafter' => '',
|
||||
]
|
||||
],
|
||||
'fieldsform' => [
|
||||
'fieldsform0' => [
|
||||
'nametemplate' => 'name',
|
||||
'name' => Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_SCOPES_DOCS_FIELDSFORM_NAME_NAME'),
|
||||
'default' => Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_SCOPES_IMAGES_FIELDSFORM_DEFAULT_NAME'),
|
||||
'type' => 'text',
|
||||
],
|
||||
]
|
||||
],
|
||||
'music' => (object) [
|
||||
'id' => 'music',
|
||||
'title' => Text::_('COM_QUANTUMMANAGER_SCOPE_MUSIC'),
|
||||
'templatelist' => [
|
||||
'templatelist0' => [
|
||||
'templatename' => Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_SCOPES_NAME_AUDIO'),
|
||||
'templatebefore' => '',
|
||||
'template' => '<audio controls src="{file}"> ' . Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_SCOPES_MUSIC_TEMPLATE_TEXT') . '</audio>',
|
||||
'templateafter' => '',
|
||||
]
|
||||
],
|
||||
'fieldsform' => '',
|
||||
],
|
||||
'videos' => (object) [
|
||||
'id' => 'videos',
|
||||
'title' => Text::_('COM_QUANTUMMANAGER_SCOPE_VIDEOS'),
|
||||
'templatelist' => [
|
||||
'templatelist0' => [
|
||||
'templatename' => Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_SCOPES_NAME_VIDEO'),
|
||||
'templatebefore' => '',
|
||||
'template' => '<video src="{file}" autoplay>' . Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_SCOPES_VIDEOS_TEMPLATE_TEXT') . '</video>',
|
||||
'templateafter' => '',
|
||||
]
|
||||
],
|
||||
'fieldsform' => '',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,462 @@
|
||||
<?php
|
||||
/**
|
||||
* @package quantummanagerbutton
|
||||
* @author Dmitry Tsymbal <cymbal@delo-design.ru>
|
||||
* @copyright Copyright © 2019 Delo Design & NorrNext. All rights reserved.
|
||||
* @license GNU General Public License version 3 or later; see license.txt
|
||||
* @link https://www.norrnext.com
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\FileLayout;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Session\Session;
|
||||
|
||||
class PlgButtonQuantummanagerbutton extends CMSPlugin
|
||||
{
|
||||
|
||||
/**
|
||||
* Application object
|
||||
*
|
||||
* @var CMSApplication
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
|
||||
protected $install_quantummanager = false;
|
||||
|
||||
|
||||
public function __construct(&$subject, $config = array())
|
||||
{
|
||||
parent::__construct($subject, $config);
|
||||
|
||||
if(file_exists(JPATH_SITE . '/administrator/components/com_quantummanager/quantummanager.php'))
|
||||
{
|
||||
$this->install_quantummanager = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display the button.
|
||||
*
|
||||
* @param string $name The name of the button to add.
|
||||
*
|
||||
* @return CMSObject The button options as CMSObject.
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
public function onDisplay($name, $asset, $author)
|
||||
{
|
||||
|
||||
if(!$this->install_quantummanager)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->accessCheck())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
JLoader::register('QuantummanagerHelper', JPATH_ROOT . '/administrator/components/com_quantummanager/helpers/quantummanager.php');
|
||||
$function = 'function(){}';
|
||||
$isJoomla4 = QuantummanagerHelper::isJoomla4();
|
||||
|
||||
$link = 'index.php?option=com_ajax&plugin=quantummanagerbutton&group=editors-xtd&format=html&tmpl=component&plugin.task=getmodal&e_name=' . $name . '&asset=com_content&author='
|
||||
. Session::getFormToken() . '=1&function=' . $function . '&isjoomla4=' . ($isJoomla4 ? '1' : '0');
|
||||
|
||||
$button = new CMSObject();
|
||||
$button->modal = true;
|
||||
$button->class = 'btn';
|
||||
$button->link = $link;
|
||||
$button->text = Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_BUTTON');
|
||||
|
||||
if ($isJoomla4)
|
||||
{
|
||||
$button->name = $this->_type . '_' . $this->_name;
|
||||
$button->icon = 'pictures';
|
||||
$button->iconSVG = '<svg width="24" height="24" viewBox="0 0 512 512"><path d="M464 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48'
|
||||
. ' 48 48h416c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm-6 336H54a6 6 0 0 1-6-6V118a6 6 0 0 1 6-6h404a6 6'
|
||||
. ' 0 0 1 6 6v276a6 6 0 0 1-6 6zM128 152c-22.091 0-40 17.909-40 40s17.909 40 40 40 40-17.909 40-40-17.909-40-40-40'
|
||||
. 'zM96 352h320v-80l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L192 304l-39.515-39.515c-4.686-4.686-12.284-4'
|
||||
. '.686-16.971 0L96 304v48z"></path></svg>';
|
||||
$button->options = [
|
||||
'height' => '400px',
|
||||
'width' => '800px',
|
||||
'bodyHeight' => '70',
|
||||
'modalWidth' => '80',
|
||||
'tinyPath' => $link,
|
||||
'confirmCallback' => 'Joomla.getImage(Joomla.selectedMediaFile, \'' . $name . '\', this)',
|
||||
];
|
||||
|
||||
return $button;
|
||||
}
|
||||
|
||||
$button->name = 'file-add';
|
||||
$button->options = "{handler: 'iframe', size: {x: 1450, y: 700}, classWindow: 'quantummanager-modal-sbox-window'}";
|
||||
|
||||
$label = Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_BUTTON');
|
||||
|
||||
Factory::getDocument()->addStyleDeclaration(<<<EOT
|
||||
@media screen and (max-width: 1540px) {
|
||||
.mce-window[aria-label="{$label}"] {
|
||||
left: 2% !important;
|
||||
right: 0 !important;
|
||||
width: 95% !important;
|
||||
}
|
||||
|
||||
.mce-window[aria-label="{$label}"] .mce-reset
|
||||
{
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.mce-window[aria-label="{$label}"] .mce-window-body {
|
||||
width: 100% !important;
|
||||
height: calc(100% - 96px) !important;
|
||||
}
|
||||
|
||||
.mce-window[aria-label="{$label}"] .mce-foot {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.mce-window[aria-label="{$label}"] .mce-foot .mce-container-body {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.mce-window[aria-label="{$label}"] .mce-foot .mce-container-body .mce-widget {
|
||||
left: auto !important;
|
||||
right: 18px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-height: 700px) {
|
||||
|
||||
.mce-window[aria-label="{$label}"] {
|
||||
top: 2% !important;
|
||||
height: 95% !important;
|
||||
}
|
||||
|
||||
.mce-window[aria-label="{$label}"] .mce-window-body {
|
||||
height: calc(100% - 96px) !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
EOT
|
||||
);
|
||||
|
||||
return $button;
|
||||
}
|
||||
|
||||
|
||||
public function onAjaxQuantummanagerbutton()
|
||||
{
|
||||
|
||||
if(!$this->install_quantummanager)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
JLoader::register('QuantummanagerHelper', JPATH_ROOT . '/administrator/components/com_quantummanager/helpers/quantummanager.php');
|
||||
JLoader::register('QuantummanagerbuttonHelper', JPATH_ROOT . '/plugins/editors-xtd/quantummanagerbutton/helper.php');
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$data = $app->input->getArray();
|
||||
$task = $app->input->get('plugin_task');
|
||||
$html = '';
|
||||
|
||||
if (!$this->accessCheck())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ($task === 'getmodal')
|
||||
{
|
||||
QuantummanagerHelper::loadlang();
|
||||
$layout = new FileLayout('default', JPATH_ROOT . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, [
|
||||
'plugins', 'editors-xtd', 'quantummanagerbutton', 'tmpl'
|
||||
]));
|
||||
echo $layout->render();
|
||||
}
|
||||
|
||||
if ($task === 'prepareforcontent')
|
||||
{
|
||||
if (!isset($data['params'], $data['scope']))
|
||||
{
|
||||
$app->close();
|
||||
}
|
||||
|
||||
$scope = $data['scope'];
|
||||
$params = json_decode($data['params'], JSON_OBJECT_AS_ARRAY);
|
||||
$file = QuantummanagerHelper::preparePath($data['path'], false, $scope, true);
|
||||
$name = explode('/', $file);
|
||||
$filename = end($name);
|
||||
$type = explode('.', $file);
|
||||
$filetype = end($type);
|
||||
$filesize = filesize(JPATH_ROOT . '/' . $file);
|
||||
$scopesTemplate = $this->params->get('scopes', QuantummanagerbuttonHelper::defaultValues());
|
||||
$scopesCustom = $this->params->get('customscopes', []);
|
||||
$variables = [];
|
||||
$variablesParams = [];
|
||||
$html = '';
|
||||
|
||||
$shortCode = false;
|
||||
$template = '<a href="{file}" target="_blank">{name}</a>';
|
||||
|
||||
if(is_array($scopesCustom))
|
||||
{
|
||||
$scopesCustom = [];
|
||||
}
|
||||
|
||||
foreach ($scopesCustom as $scopeCustom)
|
||||
{
|
||||
$nameTmp = 'scopes' . count($scopesTemplate);
|
||||
$scopesTemplate->$nameTmp = $scopeCustom;
|
||||
}
|
||||
|
||||
foreach ($scopesTemplate as $scopesTemplateCurrent)
|
||||
{
|
||||
|
||||
$scopesTemplateCurrent = (object) $scopesTemplateCurrent;
|
||||
|
||||
if ($scopesTemplateCurrent->id === $scope)
|
||||
{
|
||||
|
||||
if (empty($scopesTemplateCurrent->templatelist))
|
||||
{
|
||||
foreach ($params['files'] as $item)
|
||||
{
|
||||
$file = QuantummanagerHelper::preparePath($data['path'], false, $scope, true) . DIRECTORY_SEPARATOR . $item['file'];
|
||||
$name = explode('/', $file);
|
||||
$filename = end($name);
|
||||
$type = explode('.', $file);
|
||||
$filetype = mb_strtolower(end($type));
|
||||
$filesize = filesize(JPATH_ROOT . '/' . $file);
|
||||
|
||||
$variables = [
|
||||
'{file}' => $file,
|
||||
'{filename}' => $filename,
|
||||
'{type}' => $filetype,
|
||||
'{size}' => QuantummanagerHelper::formatFileSize($filesize),
|
||||
];
|
||||
|
||||
if (file_exists(JPATH_ROOT . DIRECTORY_SEPARATOR . $file))
|
||||
{
|
||||
if (in_array($filetype, ['jpg', 'jpeg', 'png']))
|
||||
{
|
||||
list($width, $height, $type, $attr) = getimagesize(JPATH_ROOT . DIRECTORY_SEPARATOR . $file);
|
||||
$variables['{imagewidth}'] = $width;
|
||||
$variables['{imageheight}'] = $height;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($item['fields'] as $key => $value)
|
||||
{
|
||||
if (preg_match("#^\{.*?\}$#isu", $key))
|
||||
{
|
||||
$variables[$key] = trim($value);
|
||||
}
|
||||
}
|
||||
|
||||
$template = '<a href="{file}" target="_blank">{name}</a>';
|
||||
$variablesFind = [];
|
||||
$variablesReplace = [];
|
||||
|
||||
foreach ($variables as $key => $value)
|
||||
{
|
||||
$variablesFind[] = $key;
|
||||
$variablesReplace[] = $value;
|
||||
}
|
||||
|
||||
$template = str_replace($variablesFind, $variablesReplace, $template);
|
||||
$html .= preg_replace("#[\s\040]?[a-zA-Z0-9]{1,}\=\"\"#isu", '', $template);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($scopesTemplateCurrent->templatelist as $templateList)
|
||||
{
|
||||
$templateList = (object) $templateList;
|
||||
if (isset($params['template']) && $templateList->templatename === $params['template'])
|
||||
{
|
||||
//собираем по выбранному шаблону
|
||||
$templatebefore = '';
|
||||
$templateitems = '';
|
||||
$templateafter = '';
|
||||
$shortCode = false;
|
||||
|
||||
if (preg_match("#^\{\{.*?\}\}$#isu", trim($templateList->templatebefore)))
|
||||
{
|
||||
$templatebefore = '[before]' . $templateList->templatebefore . '[/before]';
|
||||
$shortCode = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$templatebefore = $templateList->templatebefore;
|
||||
}
|
||||
|
||||
$variablesForTemplate = [];
|
||||
foreach ($params['files'] as $item)
|
||||
{
|
||||
$file = QuantummanagerHelper::preparePath($data['path'], false, $scope, true) . DIRECTORY_SEPARATOR . $item['file'];
|
||||
$name = explode('/', $file);
|
||||
$filename = end($name);
|
||||
$type = explode('.', $file);
|
||||
$filetype = end($type);
|
||||
$filesize = filesize(JPATH_ROOT . '/' . $file);
|
||||
|
||||
$variables = [
|
||||
'{file}' => $file,
|
||||
'{filename}' => $filename,
|
||||
'{type}' => $filetype,
|
||||
'{size}' => QuantummanagerHelper::formatFileSize($filesize),
|
||||
];
|
||||
|
||||
if (file_exists(JPATH_ROOT . DIRECTORY_SEPARATOR . $file))
|
||||
{
|
||||
if (in_array($filetype, ['jpg', 'jpeg', 'png']))
|
||||
{
|
||||
list($width, $height, $type, $attr) = getimagesize(JPATH_ROOT . DIRECTORY_SEPARATOR . $file);
|
||||
$variables['{imagewidth}'] = $width;
|
||||
$variables['{imageheight}'] = $height;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($item['fields'] as $key => $value)
|
||||
{
|
||||
if (preg_match("#^\{.*?\}$#isu", $key))
|
||||
{
|
||||
$variables[$key] = trim($value);
|
||||
}
|
||||
}
|
||||
|
||||
$variablesFind = [];
|
||||
$variablesReplace = [];
|
||||
|
||||
foreach ($variables as $key => $value)
|
||||
{
|
||||
$variablesFind[] = $key;
|
||||
$variablesReplace[] = $value;
|
||||
}
|
||||
|
||||
foreach ($variables as $key => $value)
|
||||
{
|
||||
$variables[$key] = str_replace($variablesFind, $variablesReplace, $value);
|
||||
}
|
||||
|
||||
$variablesFind = [];
|
||||
$variablesReplace = [];
|
||||
|
||||
foreach ($variables as $key => $value)
|
||||
{
|
||||
$variablesFind[] = $key;
|
||||
$variablesReplace[] = $value;
|
||||
}
|
||||
|
||||
if (preg_match("#^\{\{.*?\}\}$#isu", trim($templateList->template)) || $shortCode)
|
||||
{
|
||||
$shortCode = true;
|
||||
$variablesForTemplate[] = $variables;
|
||||
}
|
||||
else
|
||||
{
|
||||
$item = str_replace($variablesFind, $variablesReplace, $templateList->template);
|
||||
$item = preg_replace("#[\s\040]?[a-zA-Z0-9]{1,}\=\"\"#isu", '', $item);
|
||||
$templateitems .= $item;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($shortCode)
|
||||
{
|
||||
$templateitems = '[item][variables]' . json_encode($variablesForTemplate) . '[/variables][template]' . $templateList->template . '[/template][/item]';
|
||||
}
|
||||
|
||||
if (preg_match("#^\{\{.*?\}\}$#isu", trim($templateList->templateafter)))
|
||||
{
|
||||
$templateafter = '[after]' . $templateList->templateafter . '[/after]';
|
||||
$shortCode = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$templateafter = $templateList->templateafter;
|
||||
}
|
||||
|
||||
if ($shortCode)
|
||||
{
|
||||
$html = '[qmcontent]' . $templatebefore . $templateitems . $templateafter . '[/qmcontent]';
|
||||
}
|
||||
else
|
||||
{
|
||||
$html = $templatebefore . $templateitems . $templateafter;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
echo $html;
|
||||
|
||||
$app->close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected function accessCheck()
|
||||
{
|
||||
|
||||
if ($this->app->isClient('administrator'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// проверяем на включенность параметра
|
||||
JLoader::register('QuantummanagerHelper', JPATH_ADMINISTRATOR . '/components/com_quantummanager/helpers/quantummanager.php');
|
||||
|
||||
if (!(int) QuantummanagerHelper::getParamsComponentValue('front', 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// проверяем что пользователь авторизован
|
||||
if (Factory::getUser()->id === 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$actions = QuantummanagerHelper::getActions();
|
||||
|
||||
if (!$actions->get('core.create'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension version="3.9" type="plugin" group="editors-xtd" method="upgrade">
|
||||
<name>PLG_BUTTON_QUANTUMMANAGERBUTTON</name>
|
||||
<author>Tsymbal</author>
|
||||
<creationDate>02.02.2020</creationDate>
|
||||
<copyright>Copyright © 2020 Delo Design & NorrNext. All rights reserved.</copyright>
|
||||
<license>https://www.gnu.org/copyleft/gpl.html GNU/GPL</license>
|
||||
<authorEmail>cymbal@delo-design.ru</authorEmail>
|
||||
<authorUrl>https://www.norrnext.com</authorUrl>
|
||||
<version>1.4</version>
|
||||
<description>PLG_BUTTON_QUANTUMMANAGERBUTTON_DESCRIPTION</description>
|
||||
<scriptfile>script.php</scriptfile>
|
||||
<languages folder="language">
|
||||
<language tag="en-GB">en-GB/en-GB.plg_editors-xtd_quantummanagerbutton.ini</language>
|
||||
<language tag="en-GB">en-GB/en-GB.plg_editors-xtd_quantummanagerbutton.sys.ini</language>
|
||||
<language tag="ru-RU">ru-RU/ru-RU.plg_editors-xtd_quantummanagerbutton.ini</language>
|
||||
<language tag="ru-RU">ru-RU/ru-RU.plg_editors-xtd_quantummanagerbutton.sys.ini</language>
|
||||
</languages>
|
||||
<media folder="media" destination="plg_button_quantummanagerbutton">
|
||||
<folder>css</folder>
|
||||
<folder>js</folder>
|
||||
</media>
|
||||
<files>
|
||||
<filename plugin="quantummanagerbutton">quantummanagerbutton.php</filename>
|
||||
<filename plugin="quantummanagerbutton">helper.php</filename>
|
||||
<folder>fields</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<config>
|
||||
<fields name="params" addfieldpath="/plugins/editors-xtd/quantummanagerbutton/fields">
|
||||
<fieldset name="basic">
|
||||
|
||||
<field type="note"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_DOCS_LABEL"
|
||||
description="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_DOCS"
|
||||
class="alert alert-info"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="scopes"
|
||||
type="quantummanagerscopesinsert"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES"
|
||||
required="true"
|
||||
buttons=" "
|
||||
multiple="true">
|
||||
<form>
|
||||
<field
|
||||
name="titleLabel"
|
||||
type="text"
|
||||
default=""
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_TITLE"
|
||||
disabled="disabled"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="title"
|
||||
type="hidden"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="id"
|
||||
type="hidden"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="fieldsform"
|
||||
type="subform"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_FIELDSFORM"
|
||||
required="true"
|
||||
multiple="true">
|
||||
<form>
|
||||
<field
|
||||
name="nametemplate"
|
||||
type="text"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_FIELDSFORM_NAMETEMPLATE"
|
||||
/>
|
||||
<field
|
||||
name="name"
|
||||
type="text"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_FIELDSFORM_NAME"
|
||||
/>
|
||||
<field
|
||||
name="default"
|
||||
type="text"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_FIELDSFORM_DEFAULT"
|
||||
/>
|
||||
<field
|
||||
name="type"
|
||||
type="list"
|
||||
default="text"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_FIELDSFORM_TYPE">
|
||||
<option value="text">Text</option>
|
||||
<option value="number">Number</option>
|
||||
<option value="list">List</option>
|
||||
<option value="color">Color</option>
|
||||
<option value="email">Email</option>
|
||||
<option value="url">Url</option>
|
||||
<option value="date">Date</option>
|
||||
<option value="time">Time</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="forlist"
|
||||
type="textarea"
|
||||
default=""
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_FIELDSFORM_FORLIST"
|
||||
showon="type:list"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="templatelist"
|
||||
type="subform"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_TEMPLATE_LIST"
|
||||
required="true"
|
||||
multiple="true">
|
||||
<form>
|
||||
<field
|
||||
name="templatename"
|
||||
type="text"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_TEMPLATE_NAME"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="templatebefore"
|
||||
type="textarea"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_TEMPLATE_BEFORE"
|
||||
rows="10"
|
||||
cols="10"
|
||||
filter="raw"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="template"
|
||||
type="textarea"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_TEMPLATE_ITEM"
|
||||
rows="10"
|
||||
cols="10"
|
||||
filter="raw"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="templateafter"
|
||||
type="textarea"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_TEMPLATE_AFTER"
|
||||
rows="10"
|
||||
cols="10"
|
||||
filter="raw"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="customscopes"
|
||||
type="subform"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_CUSTOM"
|
||||
multiple="true"
|
||||
>
|
||||
<form>
|
||||
<field
|
||||
name="titleLabel"
|
||||
type="text"
|
||||
default=""
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_TITLE"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="id"
|
||||
type="text"
|
||||
default=""
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_ID"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="title"
|
||||
type="text"
|
||||
default=""
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_TITLE"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="fieldsform"
|
||||
type="subform"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_FIELDSFORM"
|
||||
required="true"
|
||||
multiple="true">
|
||||
<form>
|
||||
<field
|
||||
name="nametemplate"
|
||||
type="text"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_FIELDSFORM_NAMETEMPLATE"
|
||||
/>
|
||||
<field
|
||||
name="name"
|
||||
type="text"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_FIELDSFORM_NAME"
|
||||
/>
|
||||
<field
|
||||
name="default"
|
||||
type="text"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_FIELDSFORM_DEFAULT"
|
||||
/>
|
||||
<field
|
||||
name="type"
|
||||
type="list"
|
||||
default="text"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_FIELDSFORM_TYPE">
|
||||
<option value="text">Text</option>
|
||||
<option value="number">Number</option>
|
||||
<option value="list">List</option>
|
||||
<option value="color">Color</option>
|
||||
<option value="email">Email</option>
|
||||
<option value="url">Url</option>
|
||||
<option value="date">Date</option>
|
||||
<option value="time">Time</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="forlist"
|
||||
type="textarea"
|
||||
default=""
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_FIELDSFORM_FORLIST"
|
||||
showon="type:list"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="templatelist"
|
||||
type="subform"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_TEMPLATE_LIST"
|
||||
required="true"
|
||||
multiple="true">
|
||||
<form>
|
||||
<field
|
||||
name="templatename"
|
||||
type="text"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_TEMPLATE_NAME"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="templatebefore"
|
||||
type="textarea"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_TEMPLATE_BEFORE"
|
||||
rows="10"
|
||||
cols="10"
|
||||
filter="raw"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="template"
|
||||
type="textarea"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_TEMPLATE_ITEM"
|
||||
rows="10"
|
||||
cols="10"
|
||||
filter="raw"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="templateafter"
|
||||
type="textarea"
|
||||
label="PLG_BUTTON_QUANTUMMANAGERBUTTON_CONFIG_SCOPES_TEMPLATE_AFTER"
|
||||
rows="10"
|
||||
cols="10"
|
||||
filter="raw"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
52
plugins/editors-xtd/quantummanagerbutton/script.php
Normal file
52
plugins/editors-xtd/quantummanagerbutton/script.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* @package quantummanagercontent
|
||||
* @author Dmitry Tsymbal <cymbal@delo-design.ru>
|
||||
* @copyright Copyright © 2019 Delo Design & NorrNext. All rights reserved.
|
||||
* @license GNU General Public License version 3 or later; see license.txt
|
||||
* @link https://www.norrnext.com
|
||||
*/
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Installer\InstallerAdapter;
|
||||
|
||||
class plgEditorsXTDQuantummanagerbuttonInstallerScript
|
||||
{
|
||||
/**
|
||||
* Runs right after any installation action.
|
||||
*
|
||||
* @param string $type Type of PostFlight action. Possible values are:
|
||||
* @param InstallerAdapter $parent Parent object calling object.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
function postflight($type, $parent)
|
||||
{
|
||||
// Enable plugin
|
||||
if ($type == 'install')
|
||||
{
|
||||
$this->enablePlugin($parent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable plugin after installation.
|
||||
*
|
||||
* @param InstallerAdapter $parent Parent object calling object.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
protected function enablePlugin($parent)
|
||||
{
|
||||
// Prepare plugin object
|
||||
$plugin = new stdClass();
|
||||
$plugin->type = 'plugin';
|
||||
$plugin->element = $parent->getElement();
|
||||
$plugin->folder = (string) $parent->getParent()->manifest->attributes()['group'];
|
||||
$plugin->enabled = 1;
|
||||
|
||||
// Update record
|
||||
Factory::getDbo()->updateObject('#__extensions', $plugin, array('type', 'element', 'folder'));
|
||||
}
|
||||
}
|
||||
191
plugins/editors-xtd/quantummanagerbutton/tmpl/default.php
Normal file
191
plugins/editors-xtd/quantummanagerbutton/tmpl/default.php
Normal file
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
/**
|
||||
* @package quantummanager
|
||||
* @author Dmitry Tsymbal <cymbal@delo-design.ru>
|
||||
* @copyright Copyright © 2019 Delo Design & NorrNext. All rights reserved.
|
||||
* @license GNU General Public License version 3 or later; see license.txt
|
||||
* @link https://www.norrnext.com
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$folder = $app->input->get('folder', '', 'string');
|
||||
$app->getSession()->clear('quantummanageraddscripts');
|
||||
|
||||
if(!empty($folder))
|
||||
{
|
||||
$app->getSession()->set('quantummanagerroot', 'images/' . $folder);
|
||||
}
|
||||
else
|
||||
{
|
||||
$app->getSession()->clear('quantummanagerroot');
|
||||
}
|
||||
|
||||
HTMLHelper::_('stylesheet', 'com_quantummanager/modal.css', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
|
||||
HTMLHelper::_('stylesheet', 'plg_button_quantummanagerbutton/modal.css', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
|
||||
HTMLHelper::_('jquery.framework');
|
||||
|
||||
HTMLHelper::_('script', 'com_quantummanager/sortable.min.js', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
|
||||
HTMLHelper::_('script', 'plg_button_quantummanagerbutton/modal.js', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
JLoader::register('JFormFieldQuantumCombine', JPATH_ROOT . '/administrator/components/com_quantummanager/fields/quantumcombine.php');
|
||||
JLoader::register('QuantummanagerHelper', JPATH_SITE . '/administrator/components/com_quantummanager/helpers/quantummanager.php');
|
||||
JLoader::register('QuantummanagerbuttonHelper', JPATH_ROOT . '/plugins/editors-xtd/quantummanagerbutton/helper.php');
|
||||
|
||||
QuantummanagerbuttonHelper::loadLang();
|
||||
$fieldsForContentPlugin = QuantummanagerbuttonHelper::getFieldsForScopes();
|
||||
$templatelistForContentPlugin = QuantummanagerbuttonHelper::getTemplateListForScopes();
|
||||
$groups = Factory::getUser()->groups;
|
||||
|
||||
try {
|
||||
|
||||
$folderRoot = 'root';
|
||||
|
||||
$buttonsBun = [];
|
||||
$fields = [
|
||||
'quantumtreecatalogs' => [
|
||||
'label' => '',
|
||||
'directory' => $folderRoot,
|
||||
'position' => 'container-left',
|
||||
],
|
||||
'quantumtoolbar' => [
|
||||
'label' => '',
|
||||
'position' => 'container-center-top',
|
||||
'buttons' => 'all',
|
||||
'buttonsBun' => '',
|
||||
'cssClass' => 'qm-padding-small-left qm-padding-small-right qm-padding-small-top qm-padding-small-bottom',
|
||||
],
|
||||
'quantumupload' => [
|
||||
'label' => '',
|
||||
'position' => 'container-center-top',
|
||||
'maxsize' => QuantummanagerHelper::getParamsComponentValue('maxsize', '10'),
|
||||
'dropAreaHidden' => QuantummanagerHelper::getParamsComponentValue('dropareahidden', '0'),
|
||||
'directory' => $folderRoot,
|
||||
'cssClass' => 'qm-padding-small-left qm-padding-small-right qm-padding-small-bottom',
|
||||
],
|
||||
'quantumviewfiles' => [
|
||||
'label' => '',
|
||||
'position' => 'container-center-center',
|
||||
'directory' => $folderRoot,
|
||||
'view' => 'list-grid',
|
||||
'onlyfiles' => '0',
|
||||
'watermark' => QuantummanagerHelper::getParamsComponentValue('overlay' , 0) > 0 ? '1' : '0',
|
||||
'help' => QuantummanagerHelper::getParamsComponentValue('help' , '1'),
|
||||
'metafile' => QuantummanagerHelper::getParamsComponentValue('metafile' , '1'),
|
||||
],
|
||||
'quantumcropperjs' => [
|
||||
'label' => '',
|
||||
'position' => 'bottom'
|
||||
],
|
||||
];
|
||||
|
||||
/*
|
||||
if((int)QuantummanagerHelper::getParamsComponentValue('unsplash', '1'))
|
||||
{
|
||||
$fields['quantumunsplash'] = [
|
||||
'position' => 'bottom'
|
||||
];
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if ((int) QuantummanagerHelper::getParamsComponentValue('pexels', '1'))
|
||||
{
|
||||
$fields['quantumpexels'] = [
|
||||
'label' => '',
|
||||
'position' => 'bottom'
|
||||
];
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if((int)QuantummanagerHelper::getParamsComponentValue('pixabay', '1'))
|
||||
{
|
||||
$fields['quantumpixabay'] = [
|
||||
'position' => 'bottom'
|
||||
];
|
||||
}
|
||||
*/
|
||||
|
||||
$actions = QuantummanagerHelper::getActions();
|
||||
if (!$actions->get('core.create'))
|
||||
{
|
||||
$buttonsBun[] = 'viewfilesCreateDirectory';
|
||||
unset($fields['quantumupload']);
|
||||
}
|
||||
|
||||
if (!$actions->get('core.delete'))
|
||||
{
|
||||
unset($fields['quantumcropperjs']);
|
||||
}
|
||||
|
||||
if (!$actions->get('core.delete'))
|
||||
{
|
||||
$buttonsBun[] = 'viewfilesDelete';
|
||||
}
|
||||
|
||||
$optionsForField = [
|
||||
'name' => 'filemanager',
|
||||
'label' => '',
|
||||
'fields' => json_encode($fields)
|
||||
];
|
||||
|
||||
$field = new JFormFieldQuantumCombine();
|
||||
foreach ($optionsForField as $name => $value)
|
||||
{
|
||||
$field->__set($name, $value);
|
||||
}
|
||||
echo $field->getInput();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
window.QuantumButtonPlugin = {
|
||||
templatelist: '<?php echo QuantummanagerHelper::escapeJsonString(json_encode($templatelistForContentPlugin)) ?>',
|
||||
fields: '<?php echo QuantummanagerHelper::escapeJsonString(json_encode($fieldsForContentPlugin)) ?>'
|
||||
};
|
||||
|
||||
window.QuantumwindowLang = {
|
||||
'buttonInsert': '<?php echo Text::_('COM_QUANTUMMANAGER_WINDOW_INSERT'); ?>',
|
||||
'inputAlt': '<?php echo Text::_('COM_QUANTUMMANAGER_WINDOW_ALT'); ?>',
|
||||
'inputWidth': '<?php echo Text::_('COM_QUANTUMMANAGER_WINDOW_WIDTH'); ?>',
|
||||
'defaultScope': '<?php echo Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_SCOPES_NAME_DEFAULT'); ?>',
|
||||
'defaultName': '<?php echo Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_SCOPES_DOCS_FIELDSFORM_NAME_NAME'); ?>',
|
||||
'defaultNameValue': '<?php echo Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_SCOPES_IMAGES_FIELDSFORM_DEFAULT_NAME'); ?>',
|
||||
'insertFile': '<?php echo Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON_INSERT_FILE'); ?>',
|
||||
'helpSettings': '<?php echo in_array('2', $groups) || in_array('8', $groups) ? Text::sprintf('PLG_BUTTON_QUANTUMMANAGERBUTTON_HELP_SETTINGS', 'index.php?' . http_build_query(['option' => 'com_plugins', 'view' => 'plugins', (QuantummanagerHelper::isJoomla4() ? 'filter[search]' : 'filter.search') => Text::_('PLG_BUTTON_QUANTUMMANAGERBUTTON')])) : '' ?>',
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
21
plugins/editors-xtd/readmore/readmore.xml
Normal file
21
plugins/editors-xtd/readmore/readmore.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="editors-xtd" method="upgrade">
|
||||
<name>plg_editors-xtd_readmore</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2006-03</creationDate>
|
||||
<copyright>(C) 2006 Open Source Matters, Inc.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>PLG_READMORE_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\EditorsXtd\ReadMore</namespace>
|
||||
<files>
|
||||
<folder plugin="readmore">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_readmore.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_readmore.sys.ini</language>
|
||||
</languages>
|
||||
</extension>
|
||||
48
plugins/editors-xtd/readmore/services/provider.php
Normal file
48
plugins/editors-xtd/readmore/services/provider.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.article
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\Plugin\EditorsXtd\ReadMore\Extension\ReadMore;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$dispatcher = $container->get(DispatcherInterface::class);
|
||||
|
||||
$plugin = new ReadMore(
|
||||
$dispatcher,
|
||||
(array) PluginHelper::getPlugin('editors-xtd', 'readmore')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
70
plugins/editors-xtd/readmore/src/Extension/ReadMore.php
Normal file
70
plugins/editors-xtd/readmore/src/Extension/ReadMore.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.readmore
|
||||
*
|
||||
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\EditorsXtd\ReadMore\Extension;
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Editor Readmore button
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
final class ReadMore extends CMSPlugin
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.1
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Readmore button
|
||||
*
|
||||
* @param string $name The name of the button to add
|
||||
*
|
||||
* @return CMSObject $button A two element array of (imageName, textToInsert)
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public function onDisplay($name)
|
||||
{
|
||||
$doc = $this->getApplication()->getDocument();
|
||||
$doc->getWebAssetManager()
|
||||
->registerAndUseScript('com_content.admin-article-readmore', 'com_content/admin-article-readmore.min.js', [], ['defer' => true], ['core']);
|
||||
|
||||
// Pass some data to javascript
|
||||
$doc->addScriptOptions(
|
||||
'xtd-readmore',
|
||||
[
|
||||
'exists' => Text::_('PLG_READMORE_ALREADY_EXISTS', true),
|
||||
]
|
||||
);
|
||||
|
||||
$button = new CMSObject();
|
||||
$button->modal = false;
|
||||
$button->onclick = 'insertReadmore(\'' . $name . '\');return false;';
|
||||
$button->text = Text::_('PLG_READMORE_BUTTON_READMORE');
|
||||
$button->name = $this->_type . '_' . $this->_name;
|
||||
$button->icon = 'arrow-down';
|
||||
$button->iconSVG = '<svg viewBox="0 0 32 32" width="24" height="24"><path d="M32 12l-6-6-10 10-10-10-6 6 16 16z"></path></svg>';
|
||||
$button->link = '#';
|
||||
|
||||
return $button;
|
||||
}
|
||||
}
|
||||
47
plugins/editors-xtd/sourcerer/forms/popup.xml
Normal file
47
plugins/editors-xtd/sourcerer/forms/popup.xml
Normal 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>
|
||||
@@ -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"
|
||||
@@ -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"
|
||||
@@ -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"
|
||||
@@ -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"
|
||||
59
plugins/editors-xtd/sourcerer/script.install.php
Normal file
59
plugins/editors-xtd/sourcerer/script.install.php
Normal 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',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
67
plugins/editors-xtd/sourcerer/sourcerer.php
Normal file
67
plugins/editors-xtd/sourcerer/sourcerer.php
Normal 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');
|
||||
}
|
||||
}
|
||||
}
|
||||
33
plugins/editors-xtd/sourcerer/sourcerer.xml
Normal file
33
plugins/editors-xtd/sourcerer/sourcerer.xml
Normal 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,<a href="index.php?option=com_plugins&filter[folder]=system&filter[search]=sourcerer" target="_blank">,</a>"/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
37
plugins/editors-xtd/sourcerer/src/Popup.php
Normal file
37
plugins/editors-xtd/sourcerer/src/Popup.php
Normal 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');
|
||||
}
|
||||
}
|
||||
64
plugins/editors-xtd/sourcerer/tmpl/popup.php
Normal file
64
plugins/editors-xtd/sourcerer/tmpl/popup.php
Normal 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>
|
||||
18
plugins/editors-xtd/tabsaccordions/forms/items.xml
Normal file
18
plugins/editors-xtd/tabsaccordions/forms/items.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form addfieldprefix="RegularLabs\Library\Form\Field">
|
||||
<fieldset>
|
||||
<field name="title" type="Text" label="JGLOBAL_TITLE" required="1"/>
|
||||
<field name="settings" type="IconToggle" default="0" icon1="cog" icon2="arrow-up"/>
|
||||
<field name="@showon__settings__a" type="ShowOn" value="settings:1"/>
|
||||
<field name="open" type="Radio" default="0" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RLTA_OPENED_BY_DEFAULT" description="RLTA_OPENED_BY_DEFAULT_DESC">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
<field name="@block_content_a" type="Block" class="form-vertical" no_default_class="1"/>
|
||||
<field name="content" type="Editor" label="RL_CONTENT"/>
|
||||
<field name="@block_content_b" type="Block" end="1"/>
|
||||
<field name="@access" type="OnlyPro" label="JFIELD_ACCESS_LABEL" description="JFIELD_ACCESS_DESC"/>
|
||||
<field name="@usergroup" type="OnlyPro" label="RL_USER_GROUPS" description="RL_USER_GROUPS_DESC"/>
|
||||
<field name="@showon__settings__b" type="ShowOn"/>
|
||||
</fieldset>
|
||||
</form>
|
||||
66
plugins/editors-xtd/tabsaccordions/forms/popup.xml
Normal file
66
plugins/editors-xtd/tabsaccordions/forms/popup.xml
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<config addfieldprefix="RegularLabs\Library\Form\Field">
|
||||
<fieldset name="items" addfieldprefix="RegularLabs\Library\Form\Field">
|
||||
<field name="type" type="Radio" default="tabs" class="btn-group rl-btn-group btn-group-md" label="RL_TYPE">
|
||||
<option value="tabs" class="btn btn-outline-info">RLTA_TABS</option>
|
||||
<option value="accordions" class="btn btn-outline-info">RLTA_ACCORDIONS</option>
|
||||
</field>
|
||||
<field name="items" type="Subform" formsource="plugins/editors-xtd/tabsaccordions/forms/items.xml" multiple="true" buttons="add,remove" class="rl-subform rl-hide-main-buttons" min="1"/>
|
||||
</fieldset>
|
||||
<fieldset name="styling">
|
||||
<field name="theme" type="List" default="" class="w-auto" label="RL_THEME">
|
||||
<option value="">JDEFAULT</option>
|
||||
<option value="neutral">RLTA_THEME_NEUTRAL</option>
|
||||
<option value="custom">RL_CUSTOM</option>
|
||||
<option disabled="disabled" value="-">---</option>
|
||||
<option disabled="disabled" value="-">RL_ONLY_AVAILABLE_IN_PRO_LIST_OPTION</option>
|
||||
<option disabled="disabled" value="-">RLTA_THEME_ACCENT_LINES</option>
|
||||
<option disabled="disabled" value="-">RLTA_THEME_COLORFUL</option>
|
||||
<option disabled="disabled" value="-">RLTA_THEME_DARK</option>
|
||||
<option disabled="disabled" value="-">RLTA_THEME_LIGHT</option>
|
||||
<option disabled="disabled" value="-">RLTA_THEME_LINES</option>
|
||||
<option disabled="disabled" value="-">RLTA_THEME_LINES_COLORFUL</option>
|
||||
<option disabled="disabled" value="-">RLTA_THEME_MINIMAL</option>
|
||||
<option disabled="disabled" value="-">RLTA_THEME_PILLS</option>
|
||||
<option disabled="disabled" value="-">RLTA_THEME_PILLS_COLORFUL</option>
|
||||
<option disabled="disabled" value="-">RLTA_THEME_PILLS_DARK</option>
|
||||
<option disabled="disabled" value="-">RLTA_THEME_PILLS_LIGHT</option>
|
||||
<option disabled="disabled" value="-">RLTA_THEME_PILLS_MINIMAL</option>
|
||||
</field>
|
||||
<field name="@note__dynamic_heights" type="OnlyPro" label="RLTA_DYNAMIC_HEIGHTS" description="RLTA_DYNAMIC_HEIGHTS_DESC"/>
|
||||
<field name="class" type="Text" default="" label="RL_CLASSNAME" description="RLTA_CLASSNAME_DESC"/>
|
||||
<field name="@showon__tab_handles__a" type="ShowOn" value="type:tabs"/>
|
||||
<field name="@block__tab_handles__a" type="Block" start="1" label="RLTA_TAB_HANDLES"/>
|
||||
<field name="dynamic_heights" type="Radio" class="btn-group rl-btn-group btn-group-md btn-group-yesno" default="" label="RLTA_DYNAMIC_HEIGHTS" description="%s<br><br><em>%s</em>,RLTA_DYNAMIC_HEIGHTS_DESC,RLTA_NOT_ALL_THEMES">
|
||||
<option value="">JDEFAULT</option>
|
||||
<option value="false">JNO</option>
|
||||
<option value="true">JYES</option>
|
||||
</field>
|
||||
<field name="@note__positioning" type="Radio" class="btn-group rl-btn-group btn-group-md" default="top" label="RLTA_POSITIONING" description="RLTA_POSITIONING_DESC">
|
||||
<option value="top" class="btn btn-outline-info">%s %s,<span class="icon-arrow-up-4"></span>,RLTA_POSITIONING_TOP</option>
|
||||
<option value="" disabled="disabled">%s %s,<span class="icon-arrow-down-4"></span>,RLTA_POSITIONING_BOTTOM</option>
|
||||
<option value="" disabled="disabled">%s %s,<span class="icon-arrow-left-4"></span>,RLTA_POSITIONING_LEFT</option>
|
||||
<option value="" disabled="disabled">%s %s,<span class="icon-arrow-right-4"></span>,RLTA_POSITIONING_RIGHT</option>
|
||||
</field>
|
||||
<field name="@note__positioning_2" label="---" type="OnlyPro"/>
|
||||
<field name="alignment" type="Radio" class="btn-group rl-btn-group btn-group-md" default="" label="RLTA_ALIGNMENT" description="RLTA_ALIGNMENT_DESC" showon="positioning:[OR]positioning:top[OR]positioning:bottom">
|
||||
<option value="">JDEFAULT</option>
|
||||
<option value="left" class="btn btn-outline-info">%s %s,<span class="icon-paragraph-left"></span>,RLTA_POSITIONING_LEFT</option>
|
||||
<option value="center" class="btn btn-outline-info">%s %s,<span class="icon-paragraph-center"></span>,RLTA_POSITIONING_CENTER</option>
|
||||
<option value="right" class="btn btn-outline-info">%s %s,<span class="icon-paragraph-right"></span>,RLTA_POSITIONING_RIGHT</option>
|
||||
<option value="justify" class="btn btn-outline-info">%s %s,<span class="icon-paragraph-justify"></span>,RLTA_POSITIONING_JUSTIFY</option>
|
||||
</field>
|
||||
<field name="@block__tab_handles__b" type="Block" end="1"/>
|
||||
<field name="@showon__tab_handles__b" type="ShowOn"/>
|
||||
</fieldset>
|
||||
<fieldset name="slideshow">
|
||||
<field name="@note__slideshow" type="OnlyPro" label="RLTA_SLIDESHOW" description="SLIDESHOW_DESC"/>
|
||||
</fieldset>
|
||||
<fieldset name="settings">
|
||||
<field name="nested" type="Radio" default="" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RLTA_NESTED_SET" description="RLTA_NESTED_SET_DESC">
|
||||
<option value="">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
<field name="nested_id" type="Text" default="nested" class="btn-group rl-btn-group btn-group-md btn-group-yesno" label="RLTA_NESTED_SET_ID" description="RLTA_NESTED_SET_ID_DESC" showon="nested:1"/>
|
||||
</fieldset>
|
||||
</config>
|
||||
@@ -0,0 +1,18 @@
|
||||
;; @package Tabs & Accordions
|
||||
;; @version 2.0.0
|
||||
;;
|
||||
;; @author Peter van Westen <info@regularlabs.com>
|
||||
;; @link https://regularlabs.com
|
||||
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
;; @license GNU General Public License version 2 or later
|
||||
;;
|
||||
;; @translate Want to help with translations? See: https://regularlabs.com/translate
|
||||
|
||||
PLG_EDITORS-XTD_TABSACCORDIONS="Button - Regular Labs - Tabs & Accordions"
|
||||
PLG_EDITORS-XTD_TABSACCORDIONS_DESC="Tabs & Accordions - make content tabs and accordions in Joomla!"
|
||||
TABSACCORDIONS="Tabs & Accordions"
|
||||
|
||||
TABSACCORDIONS_DESC="With Tabs & Accordions you can make content tabs and accordions anywhere in Joomla!"
|
||||
|
||||
RLTA_SETTINGS="Please see the [[%1:start link%]]Tabs & Accordions system plugin[[%2:end link%]] for settings."
|
||||
RLTA_THE_SYSTEM_PLUGIN="the Tabs & Accordions system plugin"
|
||||
@@ -0,0 +1,13 @@
|
||||
;; @package Tabs & Accordions
|
||||
;; @version 2.0.0
|
||||
;;
|
||||
;; @author Peter van Westen <info@regularlabs.com>
|
||||
;; @link https://regularlabs.com
|
||||
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
;; @license GNU General Public License version 2 or later
|
||||
;;
|
||||
;; @translate Want to help with translations? See: https://regularlabs.com/translate
|
||||
|
||||
PLG_EDITORS-XTD_TABSACCORDIONS="Button - Regular Labs - Tabs & Accordions"
|
||||
PLG_EDITORS-XTD_TABSACCORDIONS_DESC="Tabs & Accordions - make content tabs and accordions in Joomla!"
|
||||
TABSACCORDIONS="Tabs & Accordions"
|
||||
34
plugins/editors-xtd/tabsaccordions/src/Popup.php
Normal file
34
plugins/editors-xtd/tabsaccordions/src/Popup.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Tabs & Accordions
|
||||
* @version 2.0.0
|
||||
*
|
||||
* @author Peter van Westen <info@regularlabs.com>
|
||||
* @link https://regularlabs.com
|
||||
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
|
||||
namespace RegularLabs\Plugin\EditorButton\TabsAccordions;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use RegularLabs\Library\Document as RL_Document;
|
||||
use RegularLabs\Library\EditorButtonPopup as RL_EditorButtonPopup;
|
||||
|
||||
class Popup extends RL_EditorButtonPopup
|
||||
{
|
||||
protected $extension = 'tabsaccordions';
|
||||
protected $require_core_auth = false;
|
||||
|
||||
protected function loadScripts()
|
||||
{
|
||||
RL_Document::script('regularlabs.regular');
|
||||
RL_Document::script('regularlabs.admin-form');
|
||||
RL_Document::script('regularlabs.admin-form-descriptions');
|
||||
RL_Document::script('tabsaccordions.popup');
|
||||
|
||||
$script = "document.addEventListener('DOMContentLoaded', function(){RegularLabs.TabsAccordionsPopup.init()});";
|
||||
RL_Document::scriptDeclaration($script, 'TabsAccordions Button', true, 'after');
|
||||
}
|
||||
}
|
||||
70
plugins/editors-xtd/tabsaccordions/tabsaccordions.php
Normal file
70
plugins/editors-xtd/tabsaccordions/tabsaccordions.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Tabs & Accordions
|
||||
* @version 2.0.0
|
||||
*
|
||||
* @author Peter van Westen <info@regularlabs.com>
|
||||
* @link https://regularlabs.com
|
||||
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
|
||||
use 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')
|
||||
|| ! class_exists('RegularLabs\Library\Parameters')
|
||||
|| ! class_exists('RegularLabs\Library\DownloadKey')
|
||||
|| ! class_exists('RegularLabs\Library\EditorButtonPlugin')
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! RL_Document::isJoomlaVersion(4))
|
||||
{
|
||||
RL_Extension::disable('tabsaccordions', 'plugin', 'editors-xtd');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (true)
|
||||
{
|
||||
class PlgButtonTabsAccordions 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="M 15 7 L 15 9 L 21 9 L 21 7 C 21 5.9 20.1 5 19 5 L 17 5 C 15.9 5 15 5.9 15 7 ZM 9 7 L 9 9 L 15 9 L 15 7 C 15 5.9 14.1 5 13 5 L 11 5 C 9.9 5 9 5.9 9 7 ZM 3 7 L 3 17 C 3 18.105 3.895 19 5 19 L 19 19 C 20.105 19 21 18.105 21 17 L 21 9 L 9 9 L 9 7 C 9 5.9 8.1 5 7 5 L 5 5 C 3.895 5 3 5.895 3 7 Z" />'
|
||||
. '</svg>';
|
||||
|
||||
protected function getPopupOptions()
|
||||
{
|
||||
$options = parent::getPopupOptions();
|
||||
|
||||
$options['confirmCallback'] = 'RegularLabs.TabsAccordionsButton.insertText(\'' . $this->editor_name . '\');';
|
||||
$options['confirmText'] = JText::_('RL_INSERT');
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
protected function loadScripts()
|
||||
{
|
||||
$params = $this->getParams();
|
||||
|
||||
RL_Document::scriptOptions([
|
||||
'tag_tabs_open' => $params->tag_tabs_open,
|
||||
'tag_tabs_close' => $params->tag_tabs_close,
|
||||
'tag_accordions_open' => $params->tag_accordions_open,
|
||||
'tag_accordions_close' => $params->tag_accordions_close,
|
||||
'tag_characters' => explode('.', $params->tag_characters),
|
||||
'root' => JUri::root(true),
|
||||
], 'tabsaccordions_button');
|
||||
|
||||
RL_Document::script('tabsaccordions.button');
|
||||
}
|
||||
}
|
||||
}
|
||||
33
plugins/editors-xtd/tabsaccordions/tabsaccordions.xml
Normal file
33
plugins/editors-xtd/tabsaccordions/tabsaccordions.xml
Normal 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_TABSACCORDIONS</name>
|
||||
<description>PLG_EDITORS-XTD_TABSACCORDIONS_DESC</description>
|
||||
<version>2.0.0</version>
|
||||
<creationDate>September 2023</creationDate>
|
||||
<author>Regular Labs (Peter van Westen)</author>
|
||||
<authorEmail>info@regularlabs.com</authorEmail>
|
||||
<authorUrl>https://regularlabs.com</authorUrl>
|
||||
<copyright>Copyright © 2023 Regular Labs - All Rights Reserved</copyright>
|
||||
<license>GNU General Public License version 2 or later</license>
|
||||
<namespace path="src">RegularLabs\Plugin\EditorButton\TabsAccordions</namespace>
|
||||
<scriptfile>script.install.php</scriptfile>
|
||||
<files>
|
||||
<file plugin="tabsaccordions">tabsaccordions.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="TABSACCORDIONS"/>
|
||||
<field name="@version" type="Version" extension="TABSACCORDIONS"/>
|
||||
<field name="@dependency" type="Dependency" label="RLTA_THE_SYSTEM_PLUGIN" file="/plugins/system/tabsaccordions/tabsaccordions.xml"/>
|
||||
<field name="@header" type="Header" label="TABSACCORDIONS" description="TABSACCORDIONS_DESC" url="https://regularlabs.com/tabsaccordions"/>
|
||||
<field name="@note__settings" type="Note" class="rl-alert alert alert-info rl-alert-light" text="RLTA_SETTINGS,<a href="index.php?option=com_plugins&filter[folder]=system&filter[search]=tabsaccordions" target="_blank">,</a>"/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
61
plugins/editors-xtd/tabsaccordions/tmpl/popup.php
Normal file
61
plugins/editors-xtd/tabsaccordions/tmpl/popup.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Tabs & Accordions
|
||||
* @version 2.0.0
|
||||
*
|
||||
* @author Peter van Westen <info@regularlabs.com>
|
||||
* @link https://regularlabs.com
|
||||
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\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('tabsaccordions');
|
||||
$form->loadFile($xmlfile, 1, '//config');
|
||||
|
||||
$editor_plugin = JPluginHelper::getPlugin('editors', 'codemirror');
|
||||
|
||||
if (empty($editor_plugin))
|
||||
{
|
||||
JFactory::getApplication()->enqueueMessage(JText::sprintf('RL_ERROR_CODEMIRROR_DISABLED', JText::_('TABSACCORDIONS'), '<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="tabsAccordionsForm" method="post" style="width:99%">
|
||||
<?php echo JHtml::_('uitab.startTabSet', 'main', ['active' => 'items']); ?>
|
||||
|
||||
<?php
|
||||
$tabs = [
|
||||
'items' => 'RLTA_TABS',
|
||||
'styling' => 'RL_STYLING',
|
||||
'slideshow' => 'RLTA_SLIDESHOW',
|
||||
'settings' => 'RL_OTHER_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>
|
||||
Reference in New Issue
Block a user