34
0

Release of v1.2.0

This commit is contained in:
Robot 2024-03-02 22:10:30 +02:00
parent daf136c395
commit 1b3219b661
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
7 changed files with 39 additions and 26 deletions

View File

@ -12,6 +12,8 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Registry\Registry;
@ -25,7 +27,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
* Extension - Componentbuilder Powers Autoloader Compiler plugin.
*
* @package ComponentbuilderPowersAutoloaderCompiler
* @since 1.1.1
* @since 1.2.0
*/
class PlgExtensionComponentbuilderPowersAutoloaderCompiler extends CMSPlugin
{
@ -44,10 +46,10 @@ class PlgExtensionComponentbuilderPowersAutoloaderCompiler extends CMSPlugin
*
* @since 1.0
*/
public function jcb_ce_onAfterGet(&$context, $compiler)
public function jcb_ce_onAfterGet()
{
// check if this component needs a power autoloader plugin loaded
if ($compiler->addPower && $this->componentActive($context) && ComponentbuilderHelper::checkArray($compiler->linkedPowers))
if (CFactory::_('Config')->add_power && $this->componentActive())
{
// now get the plugin ID if set
if (($id = (int) $this->params->get('plugin', 0)) !== 0)
@ -59,7 +61,7 @@ class PlgExtensionComponentbuilderPowersAutoloaderCompiler extends CMSPlugin
}
else
{
JFactory::getApplication()->enqueueMessage(JText::_('PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_POWER_PLUGIN_SETUP_SO_THE_POWERS_PLUGIN_AUTOLOADER_COULD_NOT_BE_ADDED'), 'Error');
Factory::getApplication()->enqueueMessage(Text::_('PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_POWER_PLUGIN_SETUP_SO_THE_POWERS_PLUGIN_AUTOLOADER_COULD_NOT_BE_ADDED'), 'Error');
}
}
}
@ -81,12 +83,10 @@ class PlgExtensionComponentbuilderPowersAutoloaderCompiler extends CMSPlugin
/**
* Set the line number in comments
*
* @param string $context The context of the current executing component
*
* @return bool
*
*/
protected function componentActive(&$context)
protected function componentActive()
{
// check the active option
if (!$this->activateOption)
@ -106,7 +106,7 @@ class PlgExtensionComponentbuilderPowersAutoloaderCompiler extends CMSPlugin
// only check if there are active
if (ArrayHelper::check($this->componentsActive))
{
return in_array((int) filter_var($context, FILTER_SANITIZE_NUMBER_INT), $this->componentsActive);
return in_array((int) CFactory::_('Config')->component_id, $this->componentsActive);
}
return false;
}

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="4" group="extension" method="upgrade">
<extension type="plugin" version="3.10" group="extension" method="upgrade">
<name>PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER</name>
<creationDate>24th October, 2023</creationDate>
<creationDate>2nd March, 2024</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>1.1.1</version>
<version>1.2.0</version>
<description>PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_XML_DESCRIPTION</description>
<!-- Scripts to run on installation -->

View File

@ -12,6 +12,10 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
@ -31,7 +35,7 @@ class JFormFieldJoomlacomponents extends JFormFieldList
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
* @return array An array of Html options.
*/
protected function getOptions()
{

View File

@ -12,6 +12,10 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
@ -48,7 +52,7 @@ class JFormFieldJoomlaplugins extends JFormFieldList
$script = array();
$button_code_name = $this->getAttribute('name');
// get the input from url
$app = JFactory::getApplication();
$app = Factory::getApplication();
$jinput = $app->input;
// get the view name & id
$values = $jinput->getArray(array(
@ -64,7 +68,7 @@ class JFormFieldJoomlaplugins extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) JUri::getInstance();
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;
@ -77,20 +81,20 @@ class JFormFieldJoomlaplugins extends JFormFieldList
$button_label = preg_replace("/[^A-Za-z ]/", '', $button_label);
$button_label = ucfirst(strtolower($button_label));
// get user object
$user = JFactory::getUser();
$user = Factory::getUser();
// only add if user allowed to create joomla_plugin
if ($user->authorise('joomla_plugin.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
if ($user->authorise('joomla_plugin.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build Create button
$button[] = '<a id="'.$button_code_name.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_CREATE_NEW_S', $button_label).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
$button[] = '<a id="'.$button_code_name.'Create" class="btn btn-small btn-success hasTooltip" title="'.Text::sprintf('PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_CREATE_NEW_S', $button_label).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
href="index.php?option=com_componentbuilder&amp;view=joomla_plugin&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span></a>';
}
// only add if user allowed to edit joomla_plugin
if ($user->authorise('joomla_plugin.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
if ($user->authorise('joomla_plugin.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_EDIT_S', $button_label).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_EDIT_S', $button_label).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "
@ -123,7 +127,7 @@ class JFormFieldJoomlaplugins extends JFormFieldList
if (is_array($button) && count($button) > 0)
{
// Load the needed script.
$document = JFactory::getDocument();
$document = Factory::getDocument();
$document->addScriptDeclaration(implode(' ',$script));
// return the button attached to input field.
return '<div class="input-append">' .$html . implode('',$button).'</div>';
@ -135,7 +139,7 @@ class JFormFieldJoomlaplugins extends JFormFieldList
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
* @return array An array of Html options.
*/
protected function getOptions()
{

View File

@ -1,6 +1,6 @@
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER="Extension - Componentbuilder Powers Autoloader Compiler"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_DESCRIPTION="This plugin is used to build the power autoloader plugin for your component during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field."
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Powers Autoloader Compiler (v.1.1.1)</h1> <div style='clear: both;'></div><p>This plugin is used to build the power autoloader plugin for your component during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 13th November, 2021</small></p>"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Powers Autoloader Compiler (v.1.2.0)</h1> <div style='clear: both;'></div><p>This plugin is used to build the power autoloader plugin for your component during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 13th November, 2021</small></p>"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_POWER_PLUGIN_SETUP_SO_THE_POWERS_PLUGIN_AUTOLOADER_COULD_NOT_BE_ADDED="You do not have a global power plugin setup, so the powers plugin autoloader could not be added."
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_GLOBAL_AUTOLOADER="Global Autoloader"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_NOTE_SELECT_POWER_PLUGIN_LABEL="Select your power autoloader plugin here."

View File

@ -1,6 +1,6 @@
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER="Extension - Componentbuilder Powers Autoloader Compiler"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_DESCRIPTION="This plugin is used to build the power autoloader plugin for your component during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field."
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Powers Autoloader Compiler (v.1.1.1)</h1> <div style='clear: both;'></div><p>This plugin is used to build the power autoloader plugin for your component during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 13th November, 2021</small></p>"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Powers Autoloader Compiler (v.1.2.0)</h1> <div style='clear: both;'></div><p>This plugin is used to build the power autoloader plugin for your component during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 13th November, 2021</small></p>"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_POWER_PLUGIN_SETUP_SO_THE_POWERS_PLUGIN_AUTOLOADER_COULD_NOT_BE_ADDED="You do not have a global power plugin setup, so the powers plugin autoloader could not be added."
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_GLOBAL_AUTOLOADER="Global Autoloader"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_NOTE_SELECT_POWER_PLUGIN_LABEL="Select your power autoloader plugin here."

View File

@ -12,6 +12,11 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
/**
* Extension - Componentbuilder Powers Autoloader Compiler script file.
*
@ -31,7 +36,7 @@ class plgExtensionComponentbuilderPowersAutoloaderCompilerInstallerScript
public function preflight($route, $adapter)
{
// get application
$app = JFactory::getApplication();
$app = Factory::getApplication();
// the default for both install and update
$jversion = new JVersion();