Release of v2.0.0
This commit is contained in:
parent
076e720d86
commit
977e5a43b2
@ -13,23 +13,22 @@
|
|||||||
defined('_JEXEC') or die('Restricted access');
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
use Joomla\CMS\Application\CMSApplication;
|
use Joomla\CMS\Application\CMSApplication;
|
||||||
use Joomla\CMS\Plugin\CMSPlugin;
|
use Joomla\CMS\Plugin\CMSPlugin;
|
||||||
|
use Joomla\CMS\Filesystem\Folder;
|
||||||
use VDM\Joomla\Utilities\JsonHelper;
|
use VDM\Joomla\Utilities\JsonHelper;
|
||||||
use VDM\Joomla\Utilities\ArrayHelper;
|
use VDM\Joomla\Utilities\ArrayHelper;
|
||||||
|
use VDM\Joomla\Componentbuilder\Compiler\Factory;
|
||||||
use VDM\Joomla\Utilities\StringHelper;
|
use VDM\Joomla\Utilities\StringHelper;
|
||||||
use VDM\Joomla\Utilities\GetHelper;
|
use VDM\Joomla\Utilities\FileHelper;
|
||||||
|
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||||
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
|
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
|
||||||
|
use VDM\Joomla\Utilities\GetHelper;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
|
use VDM\Joomla\Utilities\MathHelper;
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
|
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension - Componentbuilder Language Packaging plugin.
|
* Extension - Componentbuilder Language Packaging plugin.
|
||||||
*
|
*
|
||||||
* @package ComponentbuilderLanguagePackaging
|
* @package ComponentbuilderLanguagePackaging
|
||||||
* @since 1.2.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
||||||
{
|
{
|
||||||
@ -232,7 +231,7 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
isset($component->params['language_options']['activate']) && $component->params['language_options']['activate'] == 1)
|
isset($component->params['language_options']['activate']) && $component->params['language_options']['activate'] == 1)
|
||||||
{
|
{
|
||||||
// load the admin component details
|
// load the admin component details
|
||||||
$this->activeComponents[$component->id] = CFactory::_('Config')->component_context;
|
$this->activeComponents[$component->id] = Factory::_('Config')->component_context;
|
||||||
$this->activeComponentsNames[$component->id] = StringHelper::safe($component->name_code);
|
$this->activeComponentsNames[$component->id] = StringHelper::safe($component->name_code);
|
||||||
$this->activeComponentsRealNames[$component->id] = $component->name;
|
$this->activeComponentsRealNames[$component->id] = $component->name;
|
||||||
// add excluded list of languages
|
// add excluded list of languages
|
||||||
@ -262,12 +261,12 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
public function jcb_ce_onAfterGet()
|
public function jcb_ce_onAfterGet()
|
||||||
{
|
{
|
||||||
// get component id
|
// get component id
|
||||||
$id = (int) CFactory::_('Config')->component_id;
|
$id = (int) Factory::_('Config')->component_id;
|
||||||
// check if there is active
|
// check if there is active
|
||||||
if (ArrayHelper::check($this->activeComponents)
|
if (ArrayHelper::check($this->activeComponents)
|
||||||
&& isset($this->activeComponents[$id]) && $this->percentageLanguageAddOveride != 200)
|
&& isset($this->activeComponents[$id]) && $this->percentageLanguageAddOveride != 200)
|
||||||
{
|
{
|
||||||
CFactory::_('Config')->set('percentage_language_add', $this->percentageLanguageAddOveride);
|
Factory::_('Config')->set('percentage_language_add', $this->percentageLanguageAddOveride);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,17 +280,17 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
public function jcb_ce_onBeforeSetLangFileData()
|
public function jcb_ce_onBeforeSetLangFileData()
|
||||||
{
|
{
|
||||||
// lets map some arrays to the plugin for later use
|
// lets map some arrays to the plugin for later use
|
||||||
$this->compilerPath = CFactory::_('Config')->compiler_path;
|
$this->compilerPath = Factory::_('Config')->compiler_path;
|
||||||
$this->tempPath = CFactory::_('Config')->tmp_path;
|
$this->tempPath = Factory::_('Config')->tmp_path;
|
||||||
$this->langTag = CFactory::_('Config')->lang_tag;
|
$this->langTag = Factory::_('Config')->lang_tag;
|
||||||
$this->debugLinenr = CFactory::_('Config')->get('debug_line_nr', false);
|
$this->debugLinenr = Factory::_('Config')->get('debug_line_nr', false);
|
||||||
$this->component_version = CFactory::_('Config')->get('component_version', '1.0.0');
|
$this->component_version = Factory::_('Config')->get('component_version', '1.0.0');
|
||||||
$this->joomlaVersion = CFactory::_('Config')->joomla_version;
|
$this->joomlaVersion = Factory::_('Config')->joomla_version;
|
||||||
$this->percentageLanguageAdd = CFactory::_('Config')->percentage_language_add;
|
$this->percentageLanguageAdd = Factory::_('Config')->percentage_language_add;
|
||||||
$this->removeSiteFolder = CFactory::_('Config')->remove_site_folder;
|
$this->removeSiteFolder = Factory::_('Config')->remove_site_folder;
|
||||||
$this->removeSiteEditFolder = CFactory::_('Config')->remove_site_edit_folder;
|
$this->removeSiteEditFolder = Factory::_('Config')->remove_site_edit_folder;
|
||||||
$this->componentPath = CFactory::_('Utilities.Paths')->component_path;
|
$this->componentPath = Factory::_('Utilities.Paths')->component_path;
|
||||||
$this->componentCodeName = CFactory::_('Config')->component_code_name;
|
$this->componentCodeName = Factory::_('Config')->component_code_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -304,14 +303,14 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
public function jcb_ce_onBeforeBuildPluginLangFiles(&$plugin, &$languages)
|
public function jcb_ce_onBeforeBuildPluginLangFiles(&$plugin, &$languages)
|
||||||
{
|
{
|
||||||
// get component id
|
// get component id
|
||||||
$id = (int) CFactory::_('Config')->component_id;
|
$id = (int) Factory::_('Config')->component_id;
|
||||||
// check if there is active
|
// check if there is active
|
||||||
if (ArrayHelper::check($this->activeComponents) && isset($this->activeComponents[$id]))
|
if (ArrayHelper::check($this->activeComponents) && isset($this->activeComponents[$id]))
|
||||||
{
|
{
|
||||||
// set file name
|
// set file name
|
||||||
$file_name = 'plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->code_name);
|
$file_name = 'plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->code_name);
|
||||||
// extrude the languages that should not remain in the plugin
|
// extrude the languages that should not remain in the plugin
|
||||||
$this->extrudeLanguages($id, $languages, CFactory::_('Config')->lang_tag, $file_name, 'admin');
|
$this->extrudeLanguages($id, $languages, Factory::_('Config')->lang_tag, $file_name, 'admin');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,12 +324,12 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
public function jcb_ce_onBeforeBuildModuleLangFiles(&$module, &$languages)
|
public function jcb_ce_onBeforeBuildModuleLangFiles(&$module, &$languages)
|
||||||
{
|
{
|
||||||
// get component id
|
// get component id
|
||||||
$id = (int) CFactory::_('Config')->component_id;
|
$id = (int) Factory::_('Config')->component_id;
|
||||||
// check if there is active
|
// check if there is active
|
||||||
if (ArrayHelper::check($this->activeComponents) && isset($this->activeComponents[$id]))
|
if (ArrayHelper::check($this->activeComponents) && isset($this->activeComponents[$id]))
|
||||||
{
|
{
|
||||||
// extrude the languages that should not remain in the module
|
// extrude the languages that should not remain in the module
|
||||||
$this->extrudeLanguages($id, $languages, CFactory::_('Config')->lang_tag, $module->file_name, $module->target_client);
|
$this->extrudeLanguages($id, $languages, Factory::_('Config')->lang_tag, $module->file_name, $module->target_client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,17 +343,17 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
public function jcb_ce_onBeforeBuildAllLangFiles(&$languages)
|
public function jcb_ce_onBeforeBuildAllLangFiles(&$languages)
|
||||||
{
|
{
|
||||||
// get component id
|
// get component id
|
||||||
$id = (int) CFactory::_('Config')->component_id;
|
$id = (int) Factory::_('Config')->component_id;
|
||||||
// check if there is active
|
// check if there is active
|
||||||
if (ArrayHelper::check($this->activeComponents) && isset($this->activeComponents[$id]))
|
if (ArrayHelper::check($this->activeComponents) && isset($this->activeComponents[$id]))
|
||||||
{
|
{
|
||||||
// set file name
|
// set file name
|
||||||
$file_name = 'com_' . $this->activeComponentsNames[$id];
|
$file_name = 'com_' . $this->activeComponentsNames[$id];
|
||||||
// extrude the languages that should not remain in the module
|
// extrude the languages that should not remain in the module
|
||||||
$this->extrudeLanguages($id, $languages, CFactory::_('Config')->lang_tag, $file_name);
|
$this->extrudeLanguages($id, $languages, Factory::_('Config')->lang_tag, $file_name);
|
||||||
}
|
}
|
||||||
// build the language packages
|
// build the language packages
|
||||||
$this->buildLanguages($id, CFactory::_('Config')->lang_tag);
|
$this->buildLanguages($id, Factory::_('Config')->lang_tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -444,19 +443,19 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
// set the lang xml name for later
|
// set the lang xml name for later
|
||||||
$langXMLNames[$main_path] = $langCodeName . '_' . $this->activeComponentsNames[$id] ;
|
$langXMLNames[$main_path] = $langCodeName . '_' . $this->activeComponentsNames[$id] ;
|
||||||
// we must check if old folder is found and remove it
|
// we must check if old folder is found and remove it
|
||||||
if (!isset($this->languageTracker[$main_path]) && JFolder::exists($main_path))
|
if (!isset($this->languageTracker[$main_path]) && Folder::exists($main_path))
|
||||||
{
|
{
|
||||||
// remove the main folder
|
// remove the main folder
|
||||||
ComponentbuilderHelper::removeFolder($main_path);
|
Factory::_('Utilities.Folder')->remove($main_path);
|
||||||
// do not remove it again
|
// do not remove it again
|
||||||
$this->languageTracker[$main_path] = true;
|
$this->languageTracker[$main_path] = true;
|
||||||
}
|
}
|
||||||
// check if exist and create if not
|
// check if exist and create if not
|
||||||
if (!JFolder::exists($main_path))
|
if (!Folder::exists($main_path))
|
||||||
{
|
{
|
||||||
JFolder::create($main_path);
|
Folder::create($main_path);
|
||||||
// count the folder created
|
// count the folder created
|
||||||
CFactory::_('Utilities.Counter')->folder++;
|
Factory::_('Utilities.Counter')->folder++;
|
||||||
}
|
}
|
||||||
foreach ($areas as $area => $languageStrings)
|
foreach ($areas as $area => $languageStrings)
|
||||||
{
|
{
|
||||||
@ -473,7 +472,7 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
array_keys($languageStrings)
|
array_keys($languageStrings)
|
||||||
);
|
);
|
||||||
// set the line counter
|
// set the line counter
|
||||||
CFactory::_('Utilities.Counter')->line += count(
|
Factory::_('Utilities.Counter')->line += count(
|
||||||
(array) $lang
|
(array) $lang
|
||||||
);
|
);
|
||||||
// check that the main folder exist
|
// check that the main folder exist
|
||||||
@ -481,18 +480,18 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
{
|
{
|
||||||
$client_path = $main_path . $act['target_client'] . '/';
|
$client_path = $main_path . $act['target_client'] . '/';
|
||||||
// check if exist and create if not
|
// check if exist and create if not
|
||||||
if (!JFolder::exists($client_path))
|
if (!Folder::exists($client_path))
|
||||||
{
|
{
|
||||||
JFolder::create($client_path);
|
Folder::create($client_path);
|
||||||
// count the folder created
|
// count the folder created
|
||||||
$this->folderCount++;
|
$this->folderCount++;
|
||||||
}
|
}
|
||||||
// write the language data to a file
|
// write the language data to a file
|
||||||
ComponentbuilderHelper::writeFile(
|
FileHelper::write(
|
||||||
$client_path . $act['file_name'], implode(PHP_EOL, $lang)
|
$client_path . $act['file_name'], implode(PHP_EOL, $lang)
|
||||||
);
|
);
|
||||||
// count the file created
|
// count the file created
|
||||||
CFactory::_('Utilities.Counter')->line++;
|
Factory::_('Utilities.Counter')->line++;
|
||||||
// build xml strings
|
// build xml strings
|
||||||
if (!isset($langXML[$main_path]))
|
if (!isset($langXML[$main_path]))
|
||||||
{
|
{
|
||||||
@ -522,25 +521,25 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
{
|
{
|
||||||
// get the XML
|
// get the XML
|
||||||
$xml = str_replace(
|
$xml = str_replace(
|
||||||
array_keys(CFactory::_('Compiler.Builder.Content.One')->allActive()),
|
array_keys(Factory::_('Compiler.Builder.Content.One')->allActive()),
|
||||||
array_values(CFactory::_('Compiler.Builder.Content.One')->allActive()),
|
array_values(Factory::_('Compiler.Builder.Content.One')->allActive()),
|
||||||
$this->getLanguageXML($target_clients, $langPackages[$main_path], $langNames[$main_path])
|
$this->getLanguageXML($target_clients, $langPackages[$main_path], $langNames[$main_path])
|
||||||
);
|
);
|
||||||
// get the XML File Name
|
// get the XML File Name
|
||||||
$xmlFileName = $langXMLNames[$main_path] . '.xml';
|
$xmlFileName = $langXMLNames[$main_path] . '.xml';
|
||||||
// write the language data to a file
|
// write the language data to a file
|
||||||
ComponentbuilderHelper::writeFile(
|
FileHelper::write(
|
||||||
$main_path . $xmlFileName, $xml
|
$main_path . $xmlFileName, $xml
|
||||||
);
|
);
|
||||||
// set the zip full path
|
// set the zip full path
|
||||||
$zipPath = $this->tempPath . '/' . $langZIPNames[$main_path] . '.zip';
|
$zipPath = $this->tempPath . '/' . $langZIPNames[$main_path] . '.zip';
|
||||||
// now zip the package
|
// now zip the package
|
||||||
if (ComponentbuilderHelper::zip(
|
if (FileHelper::zip(
|
||||||
$main_path, $zipPath
|
$main_path, $zipPath
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
// now remove the package
|
// now remove the package
|
||||||
ComponentbuilderHelper::removeFolder($main_path);
|
Factory::_('Utilities.Folder')->remove($main_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -679,17 +678,16 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function shouldLanguageBeAdded(&$tag, &$languageStrings, &$total,
|
protected function shouldLanguageBeAdded(&$tag, &$languageStrings, &$total, &$file_name)
|
||||||
&$file_name
|
{
|
||||||
) {
|
|
||||||
// only log messages for none $this->langTag translations
|
// only log messages for none $this->langTag translations
|
||||||
if ($this->langTag !== $tag)
|
if ($this->langTag !== $tag)
|
||||||
{
|
{
|
||||||
$langStringNr = count($languageStrings);
|
$langStringNr = count($languageStrings);
|
||||||
$langStringSum = ComponentbuilderHelper::bcmath(
|
$langStringSum = MathHelper::bc(
|
||||||
'mul', $langStringNr, 100
|
'mul', $langStringNr, 100
|
||||||
);
|
);
|
||||||
$percentage = ComponentbuilderHelper::bcmath(
|
$percentage = MathHelper::bc(
|
||||||
'div', $langStringSum, $total
|
'div', $langStringSum, $total
|
||||||
);
|
);
|
||||||
$stringNAme = ($langStringNr == 1) ? '(string '
|
$stringNAme = ($langStringNr == 1) ? '(string '
|
||||||
@ -703,7 +701,7 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
if ($percentage < $this->percentageLanguageAdd)
|
if ($percentage < $this->percentageLanguageAdd)
|
||||||
{
|
{
|
||||||
// dont add
|
// dont add
|
||||||
CFactory::_('Compiler.Builder.Language.Messages')->set("exclude.$file_name",
|
Factory::_('Compiler.Builder.Language.Messages')->set("exclude.$file_name",
|
||||||
'<b>' . $total . '</b>(total '
|
'<b>' . $total . '</b>(total '
|
||||||
. $this->langTag . ' strings) only <b>'
|
. $this->langTag . ' strings) only <b>'
|
||||||
. $langStringNr . '</b>' . $stringNAme
|
. $langStringNr . '</b>' . $stringNAme
|
||||||
@ -715,7 +713,7 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// show if it was added as well
|
// show if it was added as well
|
||||||
CFactory::_('Compiler.Builder.Language.Messages')->set("include.$file_name",
|
Factory::_('Compiler.Builder.Language.Messages')->set("include.$file_name",
|
||||||
'<b>' . $total . '</b>(total '
|
'<b>' . $total . '</b>(total '
|
||||||
. $this->langTag . ' strings) and <b>'
|
. $this->langTag . ' strings) and <b>'
|
||||||
. $langStringNr . '</b>' . $stringNAme . ' = '
|
. $langStringNr . '</b>' . $stringNAme . ' = '
|
||||||
@ -724,6 +722,5 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<extension type="plugin" version="3.10" group="extension" method="upgrade">
|
<extension type="plugin" version="5.0" group="extension" method="upgrade">
|
||||||
<name>PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING</name>
|
<name>PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING</name>
|
||||||
<creationDate>9th March, 2024</creationDate>
|
<creationDate>11th March, 2024</creationDate>
|
||||||
<author>Llewellyn van der Merwe</author>
|
<author>Llewellyn van der Merwe</author>
|
||||||
<authorEmail>joomla@vdm.io</authorEmail>
|
<authorEmail>joomla@vdm.io</authorEmail>
|
||||||
<authorUrl>https://dev.vdm.io</authorUrl>
|
<authorUrl>https://dev.vdm.io</authorUrl>
|
||||||
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
||||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||||
<version>1.2.0</version>
|
<version>2.0.0</version>
|
||||||
<description>PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION</description>
|
<description>PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION</description>
|
||||||
|
|
||||||
<!-- Scripts to run on installation -->
|
<!-- Scripts to run on installation -->
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING="Extension - Componentbuilder Language Packaging"
|
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING="Extension - Componentbuilder Language Packaging"
|
||||||
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_DESCRIPTION="This plugin is used to add language packaging to JCB. 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_COMPONENTBUILDERLANGUAGEPACKAGING_DESCRIPTION="This plugin is used to add language packaging to JCB. 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_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION="<h1>Extension - Componentbuilder Language Packaging (v.1.2.0)</h1> <div style='clear: both;'></div><p>This plugin is used to add language packaging to JCB. 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 12th October, 2019</small></p>"
|
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION="<h1>Extension - Componentbuilder Language Packaging (v.2.0.0)</h1> <div style='clear: both;'></div><p>This plugin is used to add language packaging to JCB. 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 10th March, 2024</small></p>"
|
@ -1,3 +1,3 @@
|
|||||||
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING="Extension - Componentbuilder Language Packaging"
|
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING="Extension - Componentbuilder Language Packaging"
|
||||||
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_DESCRIPTION="This plugin is used to add language packaging to JCB. 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_COMPONENTBUILDERLANGUAGEPACKAGING_DESCRIPTION="This plugin is used to add language packaging to JCB. 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_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION="<h1>Extension - Componentbuilder Language Packaging (v.1.2.0)</h1> <div style='clear: both;'></div><p>This plugin is used to add language packaging to JCB. 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 12th October, 2019</small></p>"
|
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION="<h1>Extension - Componentbuilder Language Packaging (v.2.0.0)</h1> <div style='clear: both;'></div><p>This plugin is used to add language packaging to JCB. 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 10th March, 2024</small></p>"
|
100
script.php
100
script.php
@ -24,104 +24,4 @@ use Joomla\CMS\Filesystem\Folder;
|
|||||||
*/
|
*/
|
||||||
class plgExtensionComponentbuilderLanguagePackagingInstallerScript
|
class plgExtensionComponentbuilderLanguagePackagingInstallerScript
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Called before any type of action
|
|
||||||
*
|
|
||||||
* @param string $route Which action is happening (install|uninstall|discover_install|update)
|
|
||||||
* @param Joomla\CMS\Installer\InstallerAdapter $adapter The object responsible for running this script
|
|
||||||
*
|
|
||||||
* @return boolean True on success
|
|
||||||
*/
|
|
||||||
public function preflight($route, $adapter)
|
|
||||||
{
|
|
||||||
// get application
|
|
||||||
$app = Factory::getApplication();
|
|
||||||
|
|
||||||
// the default for both install and update
|
|
||||||
$jversion = new JVersion();
|
|
||||||
if (!$jversion->isCompatible('3.8.0'))
|
|
||||||
{
|
|
||||||
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('install' === $route)
|
|
||||||
{
|
|
||||||
// needs fix
|
|
||||||
|
|
||||||
|
|
||||||
// check that componentbuilder is installed
|
|
||||||
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
|
|
||||||
if (!JFile::exists($pathToCore))
|
|
||||||
{
|
|
||||||
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// load the helper class
|
|
||||||
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
|
|
||||||
|
|
||||||
// block install
|
|
||||||
$blockInstall = true;
|
|
||||||
|
|
||||||
// check the version of JCB
|
|
||||||
$manifest = ComponentbuilderHelper::manifest();
|
|
||||||
if (isset($manifest->version) && strpos($manifest->version, '.') !== false)
|
|
||||||
{
|
|
||||||
// get the version
|
|
||||||
$jcbVersion = explode('.', $manifest->version);
|
|
||||||
// check that we have JCB 3.0.0 or higher installed
|
|
||||||
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 &&
|
|
||||||
(
|
|
||||||
($jcbVersion[0] == 3 && $jcbVersion[1] == 0 && $jcbVersion[2] >= 0) ||
|
|
||||||
($jcbVersion[0] == 3 && $jcbVersion[1] > 0) ||
|
|
||||||
$jcbVersion[0] > 3)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
$blockInstall = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// allow install if all conditions are met
|
|
||||||
if ($blockInstall)
|
|
||||||
{
|
|
||||||
$app->enqueueMessage('Please upgrade to JCB v3.0.0 or higher before installing this plugin.', 'error');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// check that componentbuilder is installed
|
|
||||||
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
|
|
||||||
if (!JFile::exists($pathToCore))
|
|
||||||
{
|
|
||||||
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// load the helper class
|
|
||||||
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
|
|
||||||
// block install
|
|
||||||
$blockInstall = true;
|
|
||||||
// check the version of JCB
|
|
||||||
$manifest = ComponentbuilderHelper::manifest();
|
|
||||||
if (isset($manifest->version) && strpos($manifest->version, '.') !== false)
|
|
||||||
{
|
|
||||||
// get the version
|
|
||||||
$jcbVersion = explode('.', $manifest->version);
|
|
||||||
// check that we have JCB 2.10.13 or higher installed
|
|
||||||
if (count($jcbVersion) == 3 && (($jcbVersion[0] == 2 && $jcbVersion[1] >= 10 && (($jcbVersion[1] == 10 && $jcbVersion[2] >= 13) || ($jcbVersion[1] > 10))) || $jcbVersion[0] >= 3))
|
|
||||||
{
|
|
||||||
$blockInstall = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// allow install if all conditions are met
|
|
||||||
if ($blockInstall)
|
|
||||||
{
|
|
||||||
$app->enqueueMessage('Please upgrade to JCB 2.10.13 or higher before installing this plugin.', 'error');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user