Resolved gh-436 so that the new Joomla plugin builder/feature is fully active, and part of the import and export of JCB packages.

This commit is contained in:
Llewellyn van der Merwe 2019-08-12 23:30:31 +02:00
parent ed43b00862
commit 7fed9d7a1c
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
16 changed files with 519 additions and 127 deletions

View File

@ -146,13 +146,13 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 8th August, 2019 + *Last Build*: 13th August, 2019
+ *Version*: 2.9.36 + *Version*: 2.9.36
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **245973** + *Line count*: **246440**
+ *Field count*: **1319** + *Field count*: **1319**
+ *File count*: **1594** + *File count*: **1595**
+ *Folder count*: **244** + *Folder count*: **244**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).

View File

@ -146,13 +146,13 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 8th August, 2019 + *Last Build*: 13th August, 2019
+ *Version*: 2.9.36 + *Version*: 2.9.36
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **245973** + *Line count*: **246440**
+ *Field count*: **1319** + *Field count*: **1319**
+ *File count*: **1594** + *File count*: **1595**
+ *Folder count*: **244** + *Folder count*: **244**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).

View File

@ -1,32 +0,0 @@
<?php
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@package Component Builder
@subpackage componentbuilder.php
@author Llewellyn van der Merwe <https://www.vdm.io/joomla-component-builder>
@my wife Roline van der Merwe <http://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
###BOM###
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
###VDM_ENCRYPTION_BODY###

View File

@ -60,7 +60,7 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
// include component compiler // include component compiler
require_once JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/compiler.php'; require_once JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/compiler.php';
$model = $this->getModel('compiler'); $model = $this->getModel('compiler');
if ($model->builder($version,$componentId,$addBackup,$addRepo,$addPlaceholders,$debugLinenr, $minify)) if ($model->builder($version, $componentId, $addBackup, $addRepo, $addPlaceholders, $debugLinenr, $minify))
{ {
$cache = JFactory::getCache('mod_menu'); $cache = JFactory::getCache('mod_menu');
$cache->clean(); $cache->clean();
@ -81,10 +81,32 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
{ {
$url = JURI::root() . substr($model->compiler->filepath['component'], $pos + 1); $url = JURI::root() . substr($model->compiler->filepath['component'], $pos + 1);
} }
// Message of successful build // check if we have plugins
$message = '<h1>The ('.$model->compiler->componentFolderName.') Was Successfully Compiled!</h1>'; if (ComponentbuilderHelper::checkArray($model->compiler->filepath['plugins']))
$message .= '<p><button class="btn btn-small btn-success" onclick="Joomla.submitbutton(\'compiler.installExtention\')">'; {
$message .= 'Install '.$model->compiler->componentFolderName.' on this <span class="icon-joomla icon-white"></span>Joomla website.</button></p>'; // Message of successful build
$message = '<h1>The Extensions were Successfully Compiled!</h1>';
$message .= '<h4>You can install any one of the following extensions!</h4>';
}
else
{
// Message of successful build
$message = '<h1>The (' . $model->compiler->filepath['component-folder'] . ') was Successfully Compiled!</h1>';
}
$message .= '<p><button class="btn btn-small btn-success" onclick="Joomla.submitbutton(\'compiler.installCompiledComponent\')">';
$message .= 'Install ' . $model->compiler->filepath['component-folder'] . ' on this <span class="icon-joomla icon-white"></span>Joomla website. (component)</button></p>';
// check if we have plugins
if (ComponentbuilderHelper::checkArray($model->compiler->filepath['plugins']))
{
foreach ($model->compiler->filepath['plugins-folder'] as $plugin_id => $plugin_folder)
{
$message .= '<p><button class="btn btn-small btn-success" onclick="Joomla.submitbutton(\'compiler.installCompiledPlugin\', ' . (int) $plugin_id . ')">';
$message .= 'Install ' . $plugin_folder . ' on this <span class="icon-joomla icon-white"></span>Joomla website. (plugin)</button></p>';
}
$message .= '<h4>You can install all compiled extensions!</h4>';
$message .= '<p><button class="btn btn-small btn-success" onclick="Joomla.submitbutton(\'compiler.installCompiledExtensions\')">';
$message .= 'Install all above extensions on this <span class="icon-joomla icon-white"></span>Joomla website.</button></p>';
}
$message .= '<h2>Total time saved</h2>'; $message .= '<h2>Total time saved</h2>';
$message .= '<ul>'; $message .= '<ul>';
$message .= '<li>Total folders created: <b>'.$model->compiler->folderCount.'</b></li>'; $message .= '<li>Total folders created: <b>'.$model->compiler->folderCount.'</b></li>';
@ -100,15 +122,53 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
$message .= '<p><b>'.$model->compiler->actualTotalHours.' Hours</b> or <b>'.$model->compiler->actualTotalDays.' Eight Hour Days</b> <em>(a total of the realistic time frame for this project)</em><br />'; $message .= '<p><b>'.$model->compiler->actualTotalHours.' Hours</b> or <b>'.$model->compiler->actualTotalDays.' Eight Hour Days</b> <em>(a total of the realistic time frame for this project)</em><br />';
$message .= '<small>(if creating a folder and file took <b>5 seconds</b> and writing one line of code took <b>10 seconds</b>, with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)</small></p>'; $message .= '<small>(if creating a folder and file took <b>5 seconds</b> and writing one line of code took <b>10 seconds</b>, with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)</small></p>';
$message .= '<p>Project duration: <b>'.$model->compiler->projectWeekTime. ' weeks</b> or <b>'.$model->compiler->projectMonthTime.' months</b></p>'; $message .= '<p>Project duration: <b>'.$model->compiler->projectWeekTime. ' weeks</b> or <b>'.$model->compiler->projectMonthTime.' months</b></p>';
$message .= '<h2>Path to Zip File</h2>'; // check if we have plugins
$message .= '<p><b>Path:</b> <code>'.$model->compiler->filepath['component'].'</code><br />'; if (ComponentbuilderHelper::checkArray($model->compiler->filepath['plugins']))
$message .= '<b>URL:</b> <code>'.$url.'</code><br /><br />'; {
$message .= '<small>Hey! you can also download the file right now!</small><br /><a class="btn btn-success" href="'.$url.'" ><span class="icon-download icon-white"></span>Download</a></p>'; $plugin_url = array();
$message .= '<p><small><b>Remember!</b> This file is in your tmp folder and therefore publicly accessible untill you click [Clear tmp]!</small> </p>'; $message .= '<h2>Path to Zip Files</h2>';
$message .= '<p><b>Component Path:</b> <code>' . $model->compiler->filepath['component'] . '</code><br />';
$message .= '<b>Component URL:</b> <code>' . $url . '</code><br /><br />';
// load the plugins path/url
foreach ($model->compiler->filepath['plugins'] as $plugin_id => $plugin_path)
{
// set plugin path
$message .= '<b>Plugin Path:</b> <code>' . $plugin_path . '</code><br />';
if (($pos = strpos($plugin_path, "/tmp/")) !== FALSE)
{
$plugin_urls[$plugin_id] = JURI::root() . substr($plugin_path, $pos + 1);
$message .= '<b>Plugin URL:</b> <code>' . $plugin_urls[$plugin_id] . '</code><br />';
}
}
$message .= '<br /><small>Hey! you can also download these zip files right now!</small><br />';
$message .= '<a class="btn btn-success" href="' . $url . '" ><span class="icon-download icon-white"></span>Download Component</a>&nbsp;&nbsp;';
// load the plugin download URL's
foreach ($plugin_urls as $plugin_id => $plugin_url)
{
$message .= ' <a class="btn btn-success" href="' . $plugin_url . '" >';
$message .= '<span class="icon-download icon-white"></span>Download ' . $model->compiler->filepath['plugins-folder'][$plugin_id] . '</a>&nbsp;&nbsp;';
}
$message .= '</p>';
$message .= '<p><small><b>Remember!</b> These zip files are in your tmp folder and therefore publicly accessible until you click [Clear tmp]!</small></p>';
}
else
{
$message .= '<h2>Path to Zip File</h2>';
$message .= '<p><b>Path:</b> <code>' . $model->compiler->filepath['component'] . '</code><br />';
$message .= '<b>URL:</b> <code>' . $url . '</code><br /><br />';
$message .= '<small>Hey! you can also download the zip file right now!</small><br />';
$message .= '<a class="btn btn-success" href="' . $url . '" ><span class="icon-download icon-white"></span>Download</a></p>';
$message .= '<p><small><b>Remember!</b> This zip file is in your tmp folder and therefore publicly accessible until you click [Clear tmp]!</small> </p>';
}
$message .= '<p><small>Compilation took <b>'.$model->compiler->secondsCompiled.'</b> seconds to complete.</small> </p>'; $message .= '<p><small>Compilation took <b>'.$model->compiler->secondsCompiled.'</b> seconds to complete.</small> </p>';
// set redirect // set redirect
$this->setRedirect($redirect_url,$message,'message'); $this->setRedirect($redirect_url, $message, 'message');
$app->setUserState('com_componentbuilder.extension_name', $model->compiler->componentFolderName); $app->setUserState('com_componentbuilder.component_folder_name', $model->compiler->filepath['component-folder']);
// check if we have plugins
if (ComponentbuilderHelper::checkArray($model->compiler->filepath['plugins']))
{
$app->setUserState('com_componentbuilder.plugins_folder_name', $model->compiler->filepath['plugins-folder']);
}
} }
else else
{ {
@ -116,9 +176,10 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
$app->setUserState('com_componentbuilder.redirect_url', ''); $app->setUserState('com_componentbuilder.redirect_url', '');
$app->setUserState('com_componentbuilder.message', ''); $app->setUserState('com_componentbuilder.message', '');
$app->setUserState('com_componentbuilder.extension_message', ''); $app->setUserState('com_componentbuilder.extension_message', '');
$app->setUserState('com_componentbuilder.extension_name', ''); $app->setUserState('com_componentbuilder.component_folder_name', '');
$app->setUserState('com_componentbuilder.plugins_folder_name', '');
// set redirect // set redirect
$this->setRedirect($redirect_url,$message); $this->setRedirect($redirect_url, $message);
} }
return true; return true;
} }
@ -126,11 +187,11 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
} }
/** /**
* Install Compiled Extension * Install All Compiled Extensions
* *
* @return true on success * @return true on success
*/ */
public function installExtention() public function installCompiledExtensions()
{ {
// Check for request forgeries // Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
@ -138,27 +199,133 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
$user = JFactory::getUser(); $user = JFactory::getUser();
// set page redirect // set page redirect
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false);
$message = 'Could not install component!'; $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THESE_EXTENSIONS');
if($user->authorise('core.admin')) if($user->authorise('core.admin'))
{ {
// get the model $message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_EXTENTIONS');
$model = $this->getModel('compiler'); $_message = array('success' => array(), 'error' => array());
$app = JFactory::getApplication(); $app = JFactory::getApplication();
$fileName = $app->getUserState('com_componentbuilder.extension_name'); $fileNames = $app->getUserState('com_componentbuilder.plugins_folder_name', array());
if (ComponentbuilderHelper::checkString($fileName)) $fileNames[] = $app->getUserState('com_componentbuilder.component_folder_name', null);
foreach ($fileNames as $fileName)
{ {
$lang = JFactory::getLanguage(); if ($this->installExtension($fileName))
$extension = 'com_installer'; {
$base_dir = JPATH_ADMINISTRATOR; $_message['success'][] = JText::sprintf('COM_COMPONENTBUILDER_SZIP_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileName);
$language_tag = 'en-GB'; }
$reload = true; else
$lang->load($extension, $base_dir, $language_tag, $reload); {
$message = '('.$fileName.'.zip) file was also removed from tmp!'; $_message['error'][] = JText::sprintf('COM_COMPONENTBUILDER_SZIP_COULD_NOT_BE_INSTALLED', $fileName);
$this->setRedirect($redirect_url,$message,'message'); }
return $model->install($fileName.'.zip'); }
// catch errors
if (ComponentbuilderHelper::checkArray($_message['error']))
{
$app->enqueueMessage(implode('<br />', $_message['error']), 'Error');
}
// build success message
if (ComponentbuilderHelper::checkArray($_message['success']))
{
$this->setRedirect($redirect_url, implode('<br />', $_message['success']), 'message');
return true;
} }
} }
$this->setRedirect($redirect_url,$message,'error'); $this->setRedirect($redirect_url, $message, 'error');
return false;
}
/**
* Install Compiled Component
*
* @return true on success
*/
public function installCompiledComponent()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// check if user has the right
$user = JFactory::getUser();
// set page redirect
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false);
$message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_COMPONENT');
if($user->authorise('core.admin'))
{
$message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_COMPONENT');
$fileName = JFactory::getApplication()->getUserState('com_componentbuilder.component_folder_name');
if ($this->installExtension($fileName))
{
$message = JText::sprintf('COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileName);
$this->setRedirect($redirect_url, $message, 'message');
return true;
}
}
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
/**
* Install Compiled Plugin
*
* @return true on success
*/
public function installCompiledPlugin()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// check if user has the right
$user = JFactory::getUser();
// set page redirect
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false);
$message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_PLUGIN');
if($user->authorise('core.admin'))
{
$message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_PLUGIN');
$app = JFactory::getApplication();
$fileNames = $app->getUserState('com_componentbuilder.plugins_folder_name');
if (ComponentbuilderHelper::checkArray($fileNames))
{
$jinput = JFactory::getApplication()->input;
$pluginId = $jinput->post->get('install_item_id', 0, 'INT');
if ($pluginId > 0 && isset($fileNames[$pluginId]) && $this->installExtension($fileNames[$pluginId]))
{
$message = JText::sprintf('COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileName);
$this->setRedirect($redirect_url, $message, 'message');
return true;
}
}
}
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
/**
* Install Extension
*
* @return true on success
*/
protected function installExtension($fileName)
{
// check that the model is set
if (!isset($this->_compiler_model))
{
// get the compiler model
$this->_compiler_model = $this->getModel('compiler');
}
// set the language if not set
if (!isset($this->_installer_lang))
{
$this->_installer_lang = JFactory::getLanguage();
$extension = 'com_installer';
$base_dir = JPATH_ADMINISTRATOR;
$language_tag = 'en-GB';
$reload = true;
$this->_installer_lang->load($extension, $base_dir, $language_tag, $reload);
}
// make sure we have a string
if (ComponentbuilderHelper::checkString($fileName))
{
return $this->_compiler_model->install($fileName.'.zip');
}
return false; return false;
} }

View File

@ -35,7 +35,21 @@ class Compiler extends Infusion
private $time_start; private $time_start;
private $time_end; private $time_end;
public $secondsCompiled; public $secondsCompiled;
public $filepath = array('component' => '', 'package' => '', 'plugins' => array(), 'modules' => array());
/*
* The file path array
*
* @var string
*/
public $filepath = array(
'component' => '',
'component-folder' => '',
'package' => '',
'plugins' => array(),
'plugins-folders' => array(),
'modules' => array()
);
// fixed pathes // fixed pathes
protected $dynamicIntegration = false; protected $dynamicIntegration = false;
protected $backupPath = false; protected $backupPath = false;
@ -58,7 +72,7 @@ class Compiler extends Infusion
// set some folder paths in relation to distribution // set some folder paths in relation to distribution
if ($config['backup']) if ($config['backup'])
{ {
$this->backupPath = $this->params->get('backup_folder_path', $this->tempPath) . '/' . $this->componentBackupName . '.zip'; $this->backupPath = $this->params->get('backup_folder_path', $this->tempPath);
$this->dynamicIntegration = true; $this->dynamicIntegration = true;
} }
// set local repos switch // set local repos switch
@ -539,8 +553,10 @@ class Compiler extends Infusion
private function zipComponent() private function zipComponent()
{ {
// Component Folder Name
$this->filepath['component-folder'] = $this->componentFolderName;
// the name of the zip file to create // the name of the zip file to create
$this->filepath['component'] = $this->tempPath . '/' . $this->componentFolderName . '.zip'; $this->filepath['component'] = $this->tempPath . '/' . $this->filepath['component-folder'] . '.zip';
// Trigger Event: jcb_ce_onBeforeZipComponent // Trigger Event: jcb_ce_onBeforeZipComponent
$this->triggerEvent('jcb_ce_onBeforeZipComponent', array(&$this->componentContext, &$this->componentPath, &$this->filepath['component'], &$this->tempPath, &$this->componentFolderName, &$this->componentData)); $this->triggerEvent('jcb_ce_onBeforeZipComponent', array(&$this->componentContext, &$this->componentPath, &$this->filepath['component'], &$this->tempPath, &$this->componentFolderName, &$this->componentData));
//create the zip file //create the zip file
@ -552,7 +568,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onBeforeBackupZip // Trigger Event: jcb_ce_onBeforeBackupZip
$this->triggerEvent('jcb_ce_onBeforeBackupZip', array(&$this->componentContext, &$this->filepath['component'], &$this->tempPath, &$this->backupPath, &$this->componentData)); $this->triggerEvent('jcb_ce_onBeforeBackupZip', array(&$this->componentContext, &$this->filepath['component'], &$this->tempPath, &$this->backupPath, &$this->componentData));
// copy the zip to backup path // copy the zip to backup path
JFile::copy($this->filepath['component'], $this->backupPath); JFile::copy($this->filepath['component'], $this->backupPath . '/' . $this->componentBackupName . '.zip');
} }
// move to sales server host // move to sales server host
@ -591,6 +607,8 @@ class Compiler extends Infusion
{ {
// set plugin context // set plugin context
$plugin_context = $plugin->file_name . '.' . $plugin->id; $plugin_context = $plugin->file_name . '.' . $plugin->id;
// Component Folder Name
$this->filepath['plugins-folder'][$plugin->id] = $plugin->zip_name;
// the name of the zip file to create // the name of the zip file to create
$this->filepath['plugins'][$plugin->id] = $this->tempPath . '/' . $plugin->zip_name . '.zip'; $this->filepath['plugins'][$plugin->id] = $this->tempPath . '/' . $plugin->zip_name . '.zip';
// Trigger Event: jcb_ce_onBeforeZipPlugin // Trigger Event: jcb_ce_onBeforeZipPlugin
@ -605,7 +623,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onBeforeBackupZip // Trigger Event: jcb_ce_onBeforeBackupZip
$this->triggerEvent('jcb_ce_onBeforeBackupZip', array(&$__plugin_context, &$this->filepath['plugins'][$plugin->id], &$this->tempPath, &$this->backupPath, &$plugin)); $this->triggerEvent('jcb_ce_onBeforeBackupZip', array(&$__plugin_context, &$this->filepath['plugins'][$plugin->id], &$this->tempPath, &$this->backupPath, &$plugin));
// copy the zip to backup path // copy the zip to backup path
JFile::copy($this->filepath['plugins'][$plugin->id], $this->backupPath); JFile::copy($this->filepath['plugins'][$plugin->id], $this->backupPath . '/' . $plugin->zip_name . '.zip');
} }
// move to sales server host // move to sales server host

View File

@ -6199,7 +6199,6 @@ class Get
'addurls', 'addurls',
'version_update', 'version_update',
'version_update_id' 'version_update_id'
) )
) )
); );
@ -6237,7 +6236,7 @@ class Get
// update the name if it has dynamic values // update the name if it has dynamic values
$plugin->name = $this->setPlaceholders($this->setDynamicValues($plugin->name), $this->placeholders); $plugin->name = $this->setPlaceholders($this->setDynamicValues($plugin->name), $this->placeholders);
// set official name // set official name
$plugin->official_name = $plugin->name . ' ' . $plugin->group; $plugin->official_name = ucwords($plugin->group . ' - ' . $plugin->name);
// set langPrefix // set langPrefix
$this->langPrefix = 'PLG_' . strtoupper($plugin->group) . '_' . strtoupper($plugin->name); $this->langPrefix = 'PLG_' . strtoupper($plugin->group) . '_' . strtoupper($plugin->name);
// set lang prefix // set lang prefix
@ -6261,6 +6260,7 @@ class Get
} }
else else
{ {
$plugin->description = $this->setPlaceholders($this->setDynamicValues($plugin->description), $this->placeholders);
$this->setLangContent($plugin->key, $plugin->lang_prefix . '_DESCRIPTION', $plugin->description); $this->setLangContent($plugin->key, $plugin->lang_prefix . '_DESCRIPTION', $plugin->description);
$plugin->description = '<p>' . $plugin->description . '</p>'; $plugin->description = '<p>' . $plugin->description . '</p>';
} }
@ -7410,6 +7410,8 @@ class Get
$localPaths['site'] = JPATH_ROOT . '/components/com_' . $this->componentCodeName; $localPaths['site'] = JPATH_ROOT . '/components/com_' . $this->componentCodeName;
// TODO later to include the JS and CSS // TODO later to include the JS and CSS
$localPaths['media'] = JPATH_ROOT . '/media/com_' . $this->componentCodeName; $localPaths['media'] = JPATH_ROOT . '/media/com_' . $this->componentCodeName;
// TODO plugin paths (just those linked to this component)
// $localPaths['plugin'] = JPATH_ROOT . '/plugins';
// check if the local install is found // check if the local install is found
foreach ($localPaths as $key => $localPath) foreach ($localPaths as $key => $localPath)
{ {

View File

@ -1140,12 +1140,9 @@ class Structure extends Get
if ($details->type === 'folder') if ($details->type === 'folder')
{ {
// only folders outside the standard folder are added // only folders outside the standard folder are added
if (!in_array($checker[0], $this->stdFolders)) $eNAME = 'FOLDERS';
{ $ename = 'folder';
$eNAME = 'FOLDERS'; $add_to_extra = true;
$ename = 'folder';
$add_to_extra = true;
}
} }
// if this is a file, it can only be added to the admin/site/media folders // if this is a file, it can only be added to the admin/site/media folders
// all other folders are moved as a whole so their files do not need to be declared // all other folders are moved as a whole so their files do not need to be declared

View File

@ -3529,6 +3529,9 @@ COM_COMPONENTBUILDER_CONTRIBUTORS="Contributors"
COM_COMPONENTBUILDER_COPYRIGHT="Copyright" COM_COMPONENTBUILDER_COPYRIGHT="Copyright"
COM_COMPONENTBUILDER_COPYRIGHT_S="Copyright: %s" COM_COMPONENTBUILDER_COPYRIGHT_S="Copyright: %s"
COM_COMPONENTBUILDER_COULD_NOT_CLEAR_THE_TMP_FOLDER="Could not clear the tmp folder!" COM_COMPONENTBUILDER_COULD_NOT_CLEAR_THE_TMP_FOLDER="Could not clear the tmp folder!"
COM_COMPONENTBUILDER_COULD_NOT_INSTALL_COMPONENT="Could not install component!"
COM_COMPONENTBUILDER_COULD_NOT_INSTALL_EXTENTIONS="Could not install extentions!"
COM_COMPONENTBUILDER_COULD_NOT_INSTALL_PLUGIN="Could not install plugin!"
COM_COMPONENTBUILDER_CREATE="Create" COM_COMPONENTBUILDER_CREATE="Create"
COM_COMPONENTBUILDER_CREATE_A_SNIPPET="create a snippet" COM_COMPONENTBUILDER_CREATE_A_SNIPPET="create a snippet"
COM_COMPONENTBUILDER_CREATE_NEW_S="Create new %s" COM_COMPONENTBUILDER_CREATE_NEW_S="Create new %s"
@ -7080,6 +7083,7 @@ COM_COMPONENTBUILDER_NO_TYPE="No Type"
COM_COMPONENTBUILDER_NO_VALIDATION_RULES_FOUND="No validation rules found." COM_COMPONENTBUILDER_NO_VALIDATION_RULES_FOUND="No validation rules found."
COM_COMPONENTBUILDER_OFFICIAL_VDM_PACKAGES="Official VDM Packages" COM_COMPONENTBUILDER_OFFICIAL_VDM_PACKAGES="Official VDM Packages"
COM_COMPONENTBUILDER_ONLY_ONE_COMPONENT_CAN_BE_CLONED_AT_A_TIME_PLEASE_SELECT_ONE_AND_TRY_AGAIN="Only one component can be cloned at a time, please select one and try again!" COM_COMPONENTBUILDER_ONLY_ONE_COMPONENT_CAN_BE_CLONED_AT_A_TIME_PLEASE_SELECT_ONE_AND_TRY_AGAIN="Only one component can be cloned at a time, please select one and try again!"
COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION="Only (%s.zip) file was removed the from tmp folder during installation!"
COM_COMPONENTBUILDER_ONLY_USE_THE_BNONE_DBB_OPTION_IF_YOU_ARE_PLANNING_ON_TARGETING_THIS_FIELD_WITH_JAVASCRIPTCUSTOM_PHP_TO_MOVE_ITS_VALUE_INTO_ANOTHER_FIELD_THAT_DOES_GET_SAVED_TO_THE_DATABASE="Only use the <b>None DB</b> option if you are planning on targeting this field with JavaScript/Custom PHP to move its value into another field that does get saved to the database." COM_COMPONENTBUILDER_ONLY_USE_THE_BNONE_DBB_OPTION_IF_YOU_ARE_PLANNING_ON_TARGETING_THIS_FIELD_WITH_JAVASCRIPTCUSTOM_PHP_TO_MOVE_ITS_VALUE_INTO_ANOTHER_FIELD_THAT_DOES_GET_SAVED_TO_THE_DATABASE="Only use the <b>None DB</b> option if you are planning on targeting this field with JavaScript/Custom PHP to move its value into another field that does get saved to the database."
COM_COMPONENTBUILDER_ON_GITHUB="on Github" COM_COMPONENTBUILDER_ON_GITHUB="on Github"
COM_COMPONENTBUILDER_OPEN="Open" COM_COMPONENTBUILDER_OPEN="Open"
@ -7410,7 +7414,7 @@ COM_COMPONENTBUILDER_SHOULD_THE_ZIPPED_PACKAGE_OF_THE_COMPONENT_BE_MOVED_TO_THE_
COM_COMPONENTBUILDER_SHOULD_THIS_FIELD_BE_ESCAPED_IN_THE_LIST_VIEW="Should this field be escaped in the list view." COM_COMPONENTBUILDER_SHOULD_THIS_FIELD_BE_ESCAPED_IN_THE_LIST_VIEW="Should this field be escaped in the list view."
COM_COMPONENTBUILDER_SHOULD_WE_BE_SHOWING_MORE_ELABORATE_INFORMATION_DURING_IMPORT="Should we be showing more elaborate information during import." COM_COMPONENTBUILDER_SHOULD_WE_BE_SHOWING_MORE_ELABORATE_INFORMATION_DURING_IMPORT="Should we be showing more elaborate information during import."
COM_COMPONENTBUILDER_SHOULD_WE_FORCE_THE_UPDATE_OF_ALL_LOCAL_DATA_EVEN_IF_IT_IS_NEWER_THEN_THE_DATA_BEING_IMPORTED="Should we force the update of all local data, even if it is newer then the data being imported." COM_COMPONENTBUILDER_SHOULD_WE_FORCE_THE_UPDATE_OF_ALL_LOCAL_DATA_EVEN_IF_IT_IS_NEWER_THEN_THE_DATA_BEING_IMPORTED="Should we force the update of all local data, even if it is newer then the data being imported."
COM_COMPONENTBUILDER_SHOULD_WE_MERGE_THE_COMPONENTS_WITH_SIMILAR_LOCAL_COMPONENTS_MERGING_THE_COMPONENTS_USE_TO_BE_THE_DEFAULT_BEHAVIOUR_BUT_NOW_YOU_CAN_IMPORT_THE_COMPONENTS_AND_FORCE_IT_NOT_TO_MERGE_THE_FOLLOWING_AREAS_VALIDATION_RULE_FIELDTYPE_SNIPPET_LANGUAGE_LANGUAGE_TRANSLATION_BMUST_AND_WILL_STILLB_MERGE_EVEN_OF_YOUR_SELECTION_IS_BNOB_BECAUSE_OF_THE_SINGULAR_NATURE_OF_THOSE_AREAS="Should we merge the component/s with similar local component/s. Merging the component/s use to be the default behaviour, but now you can import the component/s and force it not to merge. The following areas (validation_rule, fieldtype, snippet, language, language_translation) <b>must and will still</b> merge even of your selection is <b>No</b>, because of the singular nature of those areas." COM_COMPONENTBUILDER_SHOULD_WE_MERGE_THE_COMPONENTS_WITH_SIMILAR_LOCAL_COMPONENTS_MERGING_THE_COMPONENTS_USE_TO_BE_THE_DEFAULT_BEHAVIOUR_BUT_NOW_YOU_CAN_IMPORT_THE_COMPONENTS_AND_FORCE_IT_NOT_TO_MERGE_THE_FOLLOWING_AREAS_VALIDATION_RULE_FIELDTYPE_SNIPPET_LANGUAGE_LANGUAGE_TRANSLATION_JOOMLA_PLUGIN_GROUP_CLASS_EXTENDS_CLASS_PROPERTY_CLASS_METHOD_BMUST_AND_WILL_STILLB_MERGE_EVEN_OF_YOUR_SELECTION_IS_BNOB_BECAUSE_OF_THE_SINGULAR_NATURE_OF_THOSE_AREAS="Should we merge the component/s with similar local component/s. Merging the component/s use to be the default behaviour, but now you can import the component/s and force it not to merge. The following areas (validation_rule, fieldtype, snippet, language, language_translation, joomla_plugin_group, class_extends, class_property, class_method) <b>must and will still</b> merge even of your selection is <b>No</b>, because of the singular nature of those areas."
COM_COMPONENTBUILDER_SHOW_IN_LIST_VIEW="Show in list view" COM_COMPONENTBUILDER_SHOW_IN_LIST_VIEW="Show in list view"
COM_COMPONENTBUILDER_SHOW_ONLY="Show Only" COM_COMPONENTBUILDER_SHOW_ONLY="Show Only"
COM_COMPONENTBUILDER_SHOW_TOGGLE="Show Toggle" COM_COMPONENTBUILDER_SHOW_TOGGLE="Show Toggle"
@ -8102,6 +8106,8 @@ COM_COMPONENTBUILDER_SUBMENU_VALIDATION_RULES="Validation Rules"
COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED="Success! The snippet was saved." COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED="Success! The snippet was saved."
COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED_BUT_THE_MODIFIED_DATE_COULD_NOT_BE_ADJUSTED_BR_BR_BTHIS_MEANS_THE_SNIPPETS_WILL_CONTINUE_TO_APPEAR_OUT_OF_DATEB="Success! The snippet was saved. But the modified date could not be adjusted. <br /><br /><b>This means the snippets will continue to appear out of date.</b>" COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED_BUT_THE_MODIFIED_DATE_COULD_NOT_BE_ADJUSTED_BR_BR_BTHIS_MEANS_THE_SNIPPETS_WILL_CONTINUE_TO_APPEAR_OUT_OF_DATEB="Success! The snippet was saved. But the modified date could not be adjusted. <br /><br /><b>This means the snippets will continue to appear out of date.</b>"
COM_COMPONENTBUILDER_SZDEQZDMVSMHBTRWFIFTYTSQFLVVXJTMTHREEJTWOIXM="%szdEQzdmVsMHBtRW50T%sQFlvVXJTM3J2IXM=" COM_COMPONENTBUILDER_SZDEQZDMVSMHBTRWFIFTYTSQFLVVXJTMTHREEJTWOIXM="%szdEQzdmVsMHBtRW50T%sQFlvVXJTM3J2IXM="
COM_COMPONENTBUILDER_SZIP_COULD_NOT_BE_INSTALLED="%s.zip could not be installed!"
COM_COMPONENTBUILDER_SZIP_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION="%s.zip was removed the from tmp folder during installation!"
COM_COMPONENTBUILDER_S_BEING_IMPORTED="%s Being Imported" COM_COMPONENTBUILDER_S_BEING_IMPORTED="%s Being Imported"
COM_COMPONENTBUILDER_S_NOT_LINKED="%s Not Linked" COM_COMPONENTBUILDER_S_NOT_LINKED="%s Not Linked"
COM_COMPONENTBUILDER_S_PLEASE_WAIT_THE_COMPONENT_IS_BEING_COMPILED="%s, please wait! The component is being compiled" COM_COMPONENTBUILDER_S_PLEASE_WAIT_THE_COMPONENT_IS_BEING_COMPILED="%s, please wait! The component is being compiled"
@ -8437,6 +8443,9 @@ COM_COMPONENTBUILDER_YOU_CAN_NOW_SELECT_THE_COMPONENT_BZIPB_PACKAGE_YOU_WOULD_LI
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_ACCESS_THE_SERVER_DETAILS_BS_DENIEDB_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="You do not have permission to access the server details (<b>%s - denied</b>), please contact your system administrator for more info." COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_ACCESS_THE_SERVER_DETAILS_BS_DENIEDB_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="You do not have permission to access the server details (<b>%s - denied</b>), please contact your system administrator for more info."
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_CLONE_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP="You do not have permission to clone a component, please contact your system administrator for more help." COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_CLONE_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP="You do not have permission to clone a component, please contact your system administrator for more help."
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_IMPORT_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP="You do not have permission to import a component, please contact your system administrator for more help." COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_IMPORT_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP="You do not have permission to import a component, please contact your system administrator for more help."
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THESE_EXTENSIONS="You do not have permission to install these extensions!"
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_COMPONENT="You do not have permission to install the component!"
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_PLUGIN="You do not have permission to install the plugin!"
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE="You do not have permission to run the expansion module!" COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE="You do not have permission to run the expansion module!"
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_GET_BOILERPLATE_MODULE="You do not have permission to run the get boilerplate module!" COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_GET_BOILERPLATE_MODULE="You do not have permission to run the get boilerplate module!"
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_TRANSLATOR_MODULE="You do not have permission to run the translator module!" COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_TRANSLATOR_MODULE="You do not have permission to run the translator module!"

View File

@ -2413,10 +2413,11 @@ class ComponentbuilderModelAjax extends JModelList
), ),
// #__componentbuilder_joomla_plugin (q) // #__componentbuilder_joomla_plugin (q)
'joomla_plugin' => array( 'joomla_plugin' => array(
'search' => array('id', 'name', 'main_class_code'), 'search' => array('id', 'system_name', 'name', 'main_class_code', 'description', 'php_script_construct', 'php_preflight_install', 'php_preflight_update',
'php_preflight_uninstall', 'php_postflight_install', 'php_postflight_update', 'php_method_uninstall'),
'views' => 'joomla_plugins', 'views' => 'joomla_plugins',
'not_base64' => array(), 'not_base64' => array('description' => 'string'),
'name' => 'name' 'name' => 'system_name'
), ),
// #__componentbuilder_class_extends (r) // #__componentbuilder_class_extends (r)
'class_extends' => array( 'class_extends' => array(

View File

@ -163,15 +163,15 @@ class ComponentbuilderModelCompiler extends JModelList
$set['placeholders'] = $addPlaceholders; $set['placeholders'] = $addPlaceholders;
$set['debuglinenr'] = $debugLinenr; $set['debuglinenr'] = $debugLinenr;
$set['minify'] = $minify; $set['minify'] = $minify;
// start up Compiler // run compiler
$this->compiler = new Compiler($set); $this->compiler = new Compiler($set);
if($this->compiler) if($this->compiler)
{ {
return true; return true;
} }
return false; return false;
} }
public function emptyFolder($dir, $removeDir = false) public function emptyFolder($dir, $removeDir = false)
{ {
jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.folder');
@ -210,7 +210,7 @@ class ComponentbuilderModelCompiler extends JModelList
} }
return false; return false;
} }
public function install($p_file) public function install($p_file)
{ {
$this->setState('action', 'install'); $this->setState('action', 'install');
@ -238,7 +238,7 @@ class ComponentbuilderModelCompiler extends JModelList
{ {
return false; return false;
} }
$config = JFactory::getConfig(); $config = JFactory::getConfig();
$tmp_dest = $config->get('tmp_path'); $tmp_dest = $config->get('tmp_path');
@ -259,7 +259,7 @@ class ComponentbuilderModelCompiler extends JModelList
{ {
return false; return false;
} }
// Was the package unpacked? // Was the package unpacked?
if (!$package || !$package['type']) if (!$package || !$package['type'])
{ {
@ -280,7 +280,7 @@ class ComponentbuilderModelCompiler extends JModelList
} }
else else
{ {
// Package installed sucessfully. // Package installed successfully.
$msg = JText::sprintf('COM_INSTALLER_INSTALL_SUCCESS', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type']))); $msg = JText::sprintf('COM_INSTALLER_INSTALL_SUCCESS', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type'])));
$result = true; $result = true;
$msgType = 'message'; $msgType = 'message';

View File

@ -86,7 +86,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
protected $specialValue = false; protected $specialValue = false;
protected $checksum = null; protected $checksum = null;
protected $checksumURLs = array('vdm' => 'https://raw.githubusercontent.com/vdm-io/JCB-Packages/master/', 'jcb' => 'https://raw.githubusercontent.com/vdm-io/JCB-Community-Packages/master/'); protected $checksumURLs = array('vdm' => 'https://raw.githubusercontent.com/vdm-io/JCB-Packages/master/', 'jcb' => 'https://raw.githubusercontent.com/vdm-io/JCB-Community-Packages/master/');
protected $mustMerge = array('validation_rule', 'fieldtype', 'snippet', 'language', 'language_translation'); protected $mustMerge = array('validation_rule', 'fieldtype', 'snippet', 'language', 'language_translation', 'class_extends', 'class_property', 'class_method', 'joomla_plugin_group');
/** /**
* Import an spreadsheet from either folder, url or upload. * Import an spreadsheet from either folder, url or upload.
@ -698,12 +698,13 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
} }
// the array of tables to store // the array of tables to store
$tables = array( $tables = array(
'validation_rule','class_extends', 'fieldtype', 'field', 'admin_view', 'snippet', 'dynamic_get', 'custom_admin_view', 'site_view','joomla_plugin_group', 'validation_rule', 'fieldtype', 'field', 'admin_view', 'snippet', 'dynamic_get', 'custom_admin_view', 'site_view',
'template', 'layout', 'joomla_component', 'language', 'language_translation', 'custom_code', 'placeholder','class_property','class_method','joomla_plugin', 'template', 'layout', 'joomla_component', 'language', 'language_translation', 'custom_code', 'placeholder', 'class_extends',
'joomla_plugin_group', 'class_property', 'class_method', 'joomla_plugin', 'joomla_plugin_files_folders_urls', 'joomla_plugin_updates',
'admin_fields', 'admin_fields_conditions', 'admin_fields_relations', 'admin_custom_tabs', 'component_admin_views', 'admin_fields', 'admin_fields_conditions', 'admin_fields_relations', 'admin_custom_tabs', 'component_admin_views',
'component_site_views', 'component_custom_admin_views', 'component_updates', 'component_mysql_tweaks', 'component_site_views', 'component_custom_admin_views', 'component_updates', 'component_mysql_tweaks',
'component_custom_admin_menus', 'component_config', 'component_dashboard', 'component_files_folders', 'component_custom_admin_menus', 'component_config', 'component_dashboard', 'component_files_folders',
'component_placeholders','component_plugins' 'component_placeholders', 'component_plugins'
); );
// get prefix // get prefix
$prefix = $this->_db->getPrefix(); $prefix = $this->_db->getPrefix();
@ -2096,6 +2097,56 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// update the repeatable fields // update the repeatable fields
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR); $item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
break; break;
case 'joomla_plugin_group':
// diverged id already updated
if (!$diverged)
{
// update the class_extends ID where needed
$item = $this->setNewID($item, 'class_extends', 'class_extends', $type);
}
break;
case 'class_method':
case 'class_property':
// diverged id already updated
if (!$diverged)
{
// update the joomla_plugin_group ID where needed
$item = $this->setNewID($item, 'joomla_plugin_group', 'joomla_plugin_group', $type);
}
break;
case 'joomla_plugin':
// diverged id already updated
if (!$diverged)
{
// update the class_extends ID where needed
$item = $this->setNewID($item, 'class_extends', 'class_extends', $type);
// update the joomla_plugin_group ID where needed
$item = $this->setNewID($item, 'joomla_plugin_group', 'joomla_plugin_group', $type);
}
// if we can't merge add postfix to name
if ($this->postfix)
{
$item->system_name = $item->system_name.$this->postfix;
}
// subform fields to target
$updaterT = array(
// subformfield => array( field => type_value )
'fields' => array('field' => 'field'),
'property_selection' => array('property' => 'class_property'),
'method_selection' => array('method' => 'class_method')
);
// update the subform ids
$this->updateSubformsIDs($item, 'joomla_plugin', $updaterT);
break;
case 'joomla_plugin_files_folders_urls':
case 'joomla_plugin_updates':
// diverged id already updated
if (!$diverged)
{
// update the joomla_plugin ID where needed
$item = $this->setNewID($item, 'joomla_plugin', 'joomla_plugin', $type);
}
break;
case 'custom_code': case 'custom_code':
// update the component ID where needed // update the component ID where needed
$item = $this->setNewID($item, 'component', 'joomla_component', $type); $item = $this->setNewID($item, 'component', 'joomla_component', $type);
@ -2874,8 +2925,8 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
case 'component_config': case 'component_config':
case 'component_dashboard': case 'component_dashboard':
case 'component_placeholders': case 'component_placeholders':
case 'component_plugins':
case 'component_files_folders': case 'component_files_folders':
case 'component_plugins':
// get by joomla_component (since there should only be one of each component) // get by joomla_component (since there should only be one of each component)
$getter = array('joomla_component'); $getter = array('joomla_component');
$this->specialValue = array(); $this->specialValue = array();
@ -2903,8 +2954,109 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
} }
break; break;
case 'language': case 'language':
// get by language tag since there should just be one // get by language tag since there should just be one
$getter = 'langtag'; $getter = 'langtag';
break;
case 'joomla_plugin':
// get
if ($retry == 3)
{
// get by names, exteneded and group only
$getter = array('name', 'system_name', 'class_extends', 'joomla_plugin_group');
}
elseif ($retry == 2)
{
// get by description
$getter = array('name', 'system_name', 'class_extends', 'joomla_plugin_group', 'description');
$retryAgain = 3;
}
else
{
// get by id
$getter = array('id', 'name', 'system_name', 'class_extends', 'joomla_plugin_group');
$retryAgain = 2;
}
$this->specialValue = array();
// Yet if diverged it makes sense that the ID is updated.
if ($diverged)
{
$this->specialValue['class_extends'] = (int) $item->class_extends;
$this->specialValue['joomla_plugin_group'] = (int) $item->joomla_plugin_group;
}
elseif (isset($this->newID['class_extends'][(int) $item->class_extends]) && isset($this->newID['joomla_plugin_group'][(int) $item->joomla_plugin_group]))
{
$this->specialValue['class_extends'] = $this->newID['class_extends'][(int) $item->class_extends];
$this->specialValue['joomla_plugin_group'] = $this->newID['joomla_plugin_group'][(int) $item->joomla_plugin_group];
}
// (TODO) I have seen this happen, seems dangerous!
else
{
return false;
}
break;
case 'joomla_plugin_files_folders_urls':
case 'joomla_plugin_updates':
// get by admin_view (since there should only be one of each name)
$getter = array('joomla_plugin');
$this->specialValue = array();
// Yet if diverged it makes sense that the ID is updated.
if ($diverged)
{
$this->specialValue['joomla_plugin'] = (int) $item->joomla_plugin;
}
elseif (isset($this->newID['joomla_plugin'][(int) $item->joomla_plugin]))
{
$this->specialValue['joomla_plugin'] = $this->newID['joomla_plugin'][(int) $item->joomla_plugin];
}
// (TODO) I have seen this happen, seems dangerous!
else
{
return false;
}
break;
case 'joomla_plugin_group':
// get by name since there should just be one
$getter = array('name', 'class_extends');
$this->specialValue = array();
// Yet if diverged it makes sense that the ID is updated.
if ($diverged)
{
$this->specialValue['class_extends'] = (int) $item->class_extends;
}
elseif (isset($this->newID['class_extends'][(int) $item->class_extends]))
{
$this->specialValue['class_extends'] = $this->newID['class_extends'][(int) $item->class_extends];
}
// (TODO) I have seen this happen, seems dangerous!
else
{
return false;
}
break;
case 'class_extends':
case 'class_method':
case 'class_property':
// get by name since there should just be one
$getter = array('name', 'extension_type');
// Yet if diverged it makes sense that the ID is updated.
if ('plugins' === $item->extension_type && isset($item->joomla_plugin_group))
{
$getter[] = 'joomla_plugin_group';
$this->specialValue = array();
if ($diverged)
{
$this->specialValue['joomla_plugin_group'] = (int) $item->joomla_plugin_group;
}
elseif (isset($this->newID['joomla_plugin_group'][(int) $item->joomla_plugin_group]))
{
$this->specialValue['joomla_plugin_group'] = $this->newID['joomla_plugin_group'][(int) $item->joomla_plugin_group];
}
// (TODO) I have seen this happen, seems dangerous!
else
{
return false;
}
}
break; break;
default: default:
// can't be found so return false // can't be found so return false

View File

@ -303,7 +303,8 @@ class ComponentbuilderModelJoomla_components extends JModelList
'component_mysql_tweaks' => 'joomla_component', 'component_mysql_tweaks' => 'joomla_component',
'component_custom_admin_menus' => 'joomla_component', 'component_custom_admin_menus' => 'joomla_component',
'component_dashboard' => 'joomla_component', 'component_dashboard' => 'joomla_component',
'component_placeholders' => 'joomla_component' ); 'component_placeholders' => 'joomla_component',
'component_plugins' => 'joomla_component');
// load all tables linked to joomla_component // load all tables linked to joomla_component
foreach($linkedTables as $table => $field) foreach($linkedTables as $table => $field)
{ {
@ -317,6 +318,13 @@ class ComponentbuilderModelJoomla_components extends JModelList
$this->setData('admin_fields_relations', array_values($this->smartIDs['admin_view']), 'admin_view'); $this->setData('admin_fields_relations', array_values($this->smartIDs['admin_view']), 'admin_view');
$this->setData('admin_custom_tabs', array_values($this->smartIDs['admin_view']), 'admin_view'); $this->setData('admin_custom_tabs', array_values($this->smartIDs['admin_view']), 'admin_view');
} }
// add joomla plugin
if (isset($this->smartIDs['joomla_plugin']) && ComponentbuilderHelper::checkArray($this->smartIDs['joomla_plugin']))
{
$this->setData('joomla_plugin', array_values($this->smartIDs['joomla_plugin']), 'id');
$this->setData('joomla_plugin_updates', array_values($this->smartIDs['joomla_plugin']), 'joomla_plugin');
$this->setData('joomla_plugin_files_folders_urls', array_values($this->smartIDs['joomla_plugin']), 'joomla_plugin');
}
// add validation rules // add validation rules
if (isset($this->smartIDs['validation_rule']) && ComponentbuilderHelper::checkArray($this->smartIDs['validation_rule'])) if (isset($this->smartIDs['validation_rule']) && ComponentbuilderHelper::checkArray($this->smartIDs['validation_rule']))
{ {
@ -345,6 +353,26 @@ class ComponentbuilderModelJoomla_components extends JModelList
// only if exporting // only if exporting
if ('clone' !== $this->activeType) if ('clone' !== $this->activeType)
{ {
// add class_property
if (isset($this->smartIDs['class_property']) && ComponentbuilderHelper::checkArray($this->smartIDs['class_property']))
{
$this->setData('class_property', array_values($this->smartIDs['class_property']), 'id');
}
// add class_method
if (isset($this->smartIDs['class_method']) && ComponentbuilderHelper::checkArray($this->smartIDs['class_method']))
{
$this->setData('class_method', array_values($this->smartIDs['class_method']), 'id');
}
// add joomla_plugin_group
if (isset($this->smartIDs['joomla_plugin_group']) && ComponentbuilderHelper::checkArray($this->smartIDs['joomla_plugin_group']))
{
$this->setData('joomla_plugin_group', array_values($this->smartIDs['joomla_plugin_group']), 'id');
}
// add class_extends
if (isset($this->smartIDs['class_extends']) && ComponentbuilderHelper::checkArray($this->smartIDs['class_extends']))
{
$this->setData('class_extends', array_values($this->smartIDs['class_extends']), 'id');
}
// add snippets // add snippets
if (isset($this->smartIDs['snippet']) && ComponentbuilderHelper::checkArray($this->smartIDs['snippet'])) if (isset($this->smartIDs['snippet']) && ComponentbuilderHelper::checkArray($this->smartIDs['snippet']))
{ {
@ -612,7 +640,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
// set search array // set search array
if ('site_view' === $table || 'custom_admin_view' === $table) if ('site_view' === $table || 'custom_admin_view' === $table)
{ {
$searchArray = array('php_view','php_jview','php_jview_display','php_document','js_document','css_document','css'); $searchArray = array('php_view', 'php_jview', 'php_jview_display', 'php_document', 'js_document', 'css_document', 'css');
} }
// reset the global array // reset the global array
if ('template' === $table) if ('template' === $table)
@ -683,7 +711,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
// set the placeholder ID's // set the placeholder ID's
$this->setCodePlaceholdersIds($item, $table, 'placeholder'); $this->setCodePlaceholdersIds($item, $table, 'placeholder');
// actions to take if table is component_files_folders // actions to take if table is component_files_folders
if ('component_files_folders' === $table && 'clone' !== $this->activeType) if (('component_files_folders' === $table || 'joomla_plugin_files_folders_urls' === $table) && 'clone' !== $this->activeType)
{ {
// build files // build files
$this->moveIt($this->getValues($item->addfiles, 'subform', 'file', null), 'file'); $this->moveIt($this->getValues($item->addfiles, 'subform', 'file', null), 'file');
@ -718,6 +746,12 @@ class ComponentbuilderModelJoomla_components extends JModelList
// add custom admin views // add custom admin views
$this->setData('custom_admin_view', $this->getValues($item->addcustom_admin_views, 'subform', 'customadminview'), 'id'); $this->setData('custom_admin_view', $this->getValues($item->addcustom_admin_views, 'subform', 'customadminview'), 'id');
} }
// actions to take if table is component_plugins
if ('component_plugins' === $table)
{
// add custom admin views
$this->setData('joomla_plugin', $this->getValues($item->addjoomla_plugins, 'subform', 'plugin'), 'id');
}
// actions to take if table is admin_view // actions to take if table is admin_view
if ('admin_view' === $table) if ('admin_view' === $table)
{ {
@ -845,6 +879,34 @@ class ComponentbuilderModelJoomla_components extends JModelList
// add dynamic gets // add dynamic gets
$this->setSmartIDs((int) $item->dynamic_get, 'dynamic_get'); $this->setSmartIDs((int) $item->dynamic_get, 'dynamic_get');
} }
// actions to take if table is joomla_plugin
if ('joomla_plugin' === $table)
{
// add the updates and folder stuff
$this->setSmartIDs($item->id, 'joomla_plugin');
// add class_extends
$this->setSmartIDs((int) $item->class_extends, 'class_extends');
// add joomla_plugin_group
$this->setSmartIDs((int) $item->joomla_plugin_group, 'joomla_plugin_group');
// add fields
$this->setData('field', $this->getValues($item->fields, 'subform', 'field'), 'id');
// add property_selection
$this->setData('class_property', $this->getValues($item->property_selection, 'subform', 'property'), 'id');
// add class_method
$this->setData('class_method', $this->getValues($item->method_selection, 'subform', 'method'), 'id');
}
// actions to take if table is joomla_plugin_group
if ('joomla_plugin_group' === $table)
{
// add class_extends
$this->setSmartIDs((int) $item->class_extends, 'class_extends');
}
// actions to take if table is class_method or
if ('class_method' === $table || 'class_property' === $table )
{
// add joomla_plugin_group
$this->setSmartIDs((int) $item->joomla_plugin_group, 'joomla_plugin_group');
}
} }
} }
} }
@ -882,10 +944,11 @@ class ComponentbuilderModelJoomla_components extends JModelList
$tables = array( $tables = array(
'fieldtype', 'field', 'admin_view', 'snippet', 'dynamic_get', 'custom_admin_view', 'site_view', 'fieldtype', 'field', 'admin_view', 'snippet', 'dynamic_get', 'custom_admin_view', 'site_view',
'template', 'layout', 'joomla_component', 'language', 'language_translation', 'custom_code', 'placeholder', 'template', 'layout', 'joomla_component', 'language', 'language_translation', 'custom_code', 'placeholder',
'joomla_plugin', 'joomla_plugin_files_folders_urls', 'joomla_plugin_updates',
'admin_fields', 'admin_fields_conditions', 'admin_fields_relations', 'admin_custom_tabs', 'component_admin_views', 'admin_fields', 'admin_fields_conditions', 'admin_fields_relations', 'admin_custom_tabs', 'component_admin_views',
'component_site_views', 'component_custom_admin_views', 'component_updates', 'component_mysql_tweaks', 'component_site_views', 'component_custom_admin_views', 'component_updates', 'component_mysql_tweaks',
'component_custom_admin_menus', 'component_config', 'component_dashboard', 'component_files_folders', 'component_custom_admin_menus', 'component_config', 'component_dashboard', 'component_files_folders',
'component_placeholders' 'component_placeholders', 'component_plugins'
); );
// smart table loop // smart table loop
foreach ($tables as $table) foreach ($tables as $table)
@ -1824,10 +1887,11 @@ class ComponentbuilderModelJoomla_components extends JModelList
), ),
// #__componentbuilder_joomla_plugin (q) // #__componentbuilder_joomla_plugin (q)
'joomla_plugin' => array( 'joomla_plugin' => array(
'search' => array('id', 'name', 'main_class_code'), 'search' => array('id', 'system_name', 'name', 'main_class_code', 'description', 'php_script_construct', 'php_preflight_install', 'php_preflight_update',
'php_preflight_uninstall', 'php_postflight_install', 'php_postflight_update', 'php_method_uninstall'),
'views' => 'joomla_plugins', 'views' => 'joomla_plugins',
'not_base64' => array(), 'not_base64' => array('description' => 'string'),
'name' => 'name' 'name' => 'system_name'
), ),
// #__componentbuilder_class_extends (r) // #__componentbuilder_class_extends (r)
'class_extends' => array( 'class_extends' => array(

View File

@ -136,17 +136,13 @@ class ComponentbuilderModelJoomla_plugins extends JModelList
// extract the boilerplate class property and methods // extract the boilerplate class property and methods
if (($classProperiesMethods = ComponentbuilderHelper::extractBoilerplateClassPropertiesMethods($fooClass, $classExtends, 'plugins', $pluginGroupID)) !== false) if (($classProperiesMethods = ComponentbuilderHelper::extractBoilerplateClassPropertiesMethods($fooClass, $classExtends, 'plugins', $pluginGroupID)) !== false)
{ {
// create the properties found (TODO just create for now but we could later add a force update) // create the properties found
if (isset($classProperiesMethods['property']) && ComponentbuilderHelper::checkArray($classProperiesMethods['property'])) if (isset($classProperiesMethods['property']) && ComponentbuilderHelper::checkArray($classProperiesMethods['property']))
{ {
foreach ($classProperiesMethods['property'] as $_property) foreach ($classProperiesMethods['property'] as $_property)
{ {
// does not exist, so create // force update by default
if ($_property['id'] == 0) $this->storePluginBoilerplate($tables['p'], $models['p'], $_property, $app);
{
// store the property
$this->storePluginBoilerplate($tables['p'], $models['p'], $_property, $app);
}
} }
} }
// create the method found (TODO just create for now but we could later add a force update) // create the method found (TODO just create for now but we could later add a force update)
@ -154,12 +150,8 @@ class ComponentbuilderModelJoomla_plugins extends JModelList
{ {
foreach ($classProperiesMethods['method'] as $_method) foreach ($classProperiesMethods['method'] as $_method)
{ {
// does not exist, so create // force update by default
if ($_method['id'] == 0) $this->storePluginBoilerplate($tables['m'], $models['m'], $_method, $app);
{
// store the method
$this->storePluginBoilerplate($tables['m'], $models['m'], $_method, $app);
}
} }
} }
} }

View File

@ -22,13 +22,25 @@ JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select'); JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive'); JHtml::_('behavior.keepalive');
?> ?>
<?php if ($this->canDo->get('compiler.access')): ?> <?php if ($this->canDo->get('compiler.access')): ?>
<script type="text/javascript">
Joomla.submitbutton = function(task) {
if (task === 'compiler.back') {
parent.history.back();
return false;
} else {
var form = document.getElementById('adminForm');
form.task.value = task;
form.submit();
}
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&view=compiler'); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data"> <form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&view=compiler'); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<input type="hidden" name="task" value="" /> <input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?> <?php echo JHtml::_('form.token'); ?>
</form> </form>
<script type="text/javascript"> <script type="text/javascript">
Joomla.submitbutton = function(task) Joomla.submitbutton = function(task, key)
{ {
if (task == ''){ if (task == ''){
return false; return false;
@ -42,11 +54,16 @@ Joomla.submitbutton = function(task)
if (isValid){ if (isValid){
jQuery('#form').hide(); jQuery('#form').hide();
// get correct form based on task // get correct form based on task
if (task == 'compiler.compiler') { if (task == 'compiler.compiler' || task == 'compiler.installCompiledPlugin') {
var form = document.getElementById('compilerForm'); var form = document.getElementById('compilerForm');
} else { } else {
var form = document.getElementById('adminForm'); var form = document.getElementById('adminForm');
} }
// set the plugin id
if (task == 'compiler.installCompiledPlugin') {
form.install_item_id.value = key;
}
// set the task value
form.task.value = task; form.task.value = task;
form.submit(); form.submit();
// some ui movements // some ui movements
@ -112,6 +129,7 @@ jQuery('<div id="loading"></div>')
<button class="btn btn-small btn-success" onclick="Joomla.submitbutton('compiler.compiler')"><span class="icon-cog icon-white"></span> <button class="btn btn-small btn-success" onclick="Joomla.submitbutton('compiler.compiler')"><span class="icon-cog icon-white"></span>
<?php echo JText::_('COM_COMPONENTBUILDER_COMPILE_COMPONENT'); ?> <?php echo JText::_('COM_COMPONENTBUILDER_COMPILE_COMPONENT'); ?>
</button> </button>
<input type="hidden" name="install_item_id" value="0">
<input type="hidden" name="version" value="3" /> <input type="hidden" name="version" value="3" />
<input type="hidden" name="task" value="compiler.compiler" /> <input type="hidden" name="task" value="compiler.compiler" />
<?php echo JHtml::_('form.token'); ?> <?php echo JHtml::_('form.token'); ?>

View File

@ -231,7 +231,7 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy
'name' => 'canmerge', 'name' => 'canmerge',
'label' => 'COM_COMPONENTBUILDER_MERGE', 'label' => 'COM_COMPONENTBUILDER_MERGE',
'class' => 'btn-group btn-group-yesno', 'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_SHOULD_WE_MERGE_THE_COMPONENTS_WITH_SIMILAR_LOCAL_COMPONENTS_MERGING_THE_COMPONENTS_USE_TO_BE_THE_DEFAULT_BEHAVIOUR_BUT_NOW_YOU_CAN_IMPORT_THE_COMPONENTS_AND_FORCE_IT_NOT_TO_MERGE_THE_FOLLOWING_AREAS_VALIDATION_RULE_FIELDTYPE_SNIPPET_LANGUAGE_LANGUAGE_TRANSLATION_BMUST_AND_WILL_STILLB_MERGE_EVEN_OF_YOUR_SELECTION_IS_BNOB_BECAUSE_OF_THE_SINGULAR_NATURE_OF_THOSE_AREAS', 'description' => 'COM_COMPONENTBUILDER_SHOULD_WE_MERGE_THE_COMPONENTS_WITH_SIMILAR_LOCAL_COMPONENTS_MERGING_THE_COMPONENTS_USE_TO_BE_THE_DEFAULT_BEHAVIOUR_BUT_NOW_YOU_CAN_IMPORT_THE_COMPONENTS_AND_FORCE_IT_NOT_TO_MERGE_THE_FOLLOWING_AREAS_VALIDATION_RULE_FIELDTYPE_SNIPPET_LANGUAGE_LANGUAGE_TRANSLATION_JOOMLA_PLUGIN_GROUP_CLASS_EXTENDS_CLASS_PROPERTY_CLASS_METHOD_BMUST_AND_WILL_STILLB_MERGE_EVEN_OF_YOUR_SELECTION_IS_BNOB_BECAUSE_OF_THE_SINGULAR_NATURE_OF_THOSE_AREAS',
'default' => '1'); 'default' => '1');
// load the merge attributes // load the merge attributes
ComponentbuilderHelper::xmlAddAttributes($mergeXML, $mergeAttributes); ComponentbuilderHelper::xmlAddAttributes($mergeXML, $mergeAttributes);

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade"> <extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>8th August, 2019</creationDate> <creationDate>13th August, 2019</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail> <authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl> <authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
@ -38,7 +38,9 @@ Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/compo
<filename>index.html</filename> <filename>index.html</filename>
<folder>js</folder> <folder>js</folder>
<folder>css</folder> <folder>css</folder>
<folder>images</folder> <folder>images</folder>
<folder>uikit-v2</folder>
<folder>footable-v3</folder>
</media> </media>
<!-- Update Schema; New in Joomla 2.5 --> <!-- Update Schema; New in Joomla 2.5 -->
@ -104,7 +106,9 @@ Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/compo
<folder>sql</folder> <folder>sql</folder>
<folder>tables</folder> <folder>tables</folder>
<folder>views</folder> <folder>views</folder>
<folder>layouts</folder> <folder>layouts</folder>
<folder>custom</folder>
<folder>compiler</folder>
</files> </files>
<languages folder="admin"> <languages folder="admin">