Expande the compiler to fully build and zip plugins linked to components. Added plugin_updates area. Fixed gh-454 to insure placeholders are build even if no local db placeholders are found. Fixed gh-453 to prevent count error with null return value.

This commit is contained in:
Llewellyn van der Merwe 2019-08-08 17:35:58 +02:00
parent 7d2cc2c9f0
commit ed43b00862
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
87 changed files with 7569 additions and 3584 deletions

View File

@ -12,7 +12,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.9.35) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.9.36) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -146,14 +146,14 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 4th August, 2019
+ *Version*: 2.9.35
+ *Last Build*: 8th August, 2019
+ *Version*: 2.9.36
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **242379**
+ *Field count*: **1302**
+ *File count*: **1566**
+ *Folder count*: **240**
+ *Line count*: **245973**
+ *Field count*: **1319**
+ *File count*: **1594**
+ *Folder count*: **244**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -12,7 +12,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.9.35) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.9.36) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -146,14 +146,14 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 4th August, 2019
+ *Version*: 2.9.35
+ *Last Build*: 8th August, 2019
+ *Version*: 2.9.36
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **242379**
+ *Field count*: **1302**
+ *File count*: **1566**
+ *Folder count*: **240**
+ *Line count*: **245973**
+ *Field count*: **1319**
+ *File count*: **1594**
+ *Folder count*: **244**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -353,6 +353,16 @@
<action name="joomla_plugin_files_folders_urls.edit.state" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_STATE" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_STATE_DESC" />
<action name="joomla_plugin_files_folders_urls.version" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_VERSION_DESC" />
<action name="joomla_plugin.submenu" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_SUBMENU" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_SUBMENU_DESC" />
<action name="joomla_plugin_updates.access" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_ACCESS_DESC" />
<action name="joomla_plugin_updates.batch" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_USE" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_USE_DESC" />
<action name="joomla_plugin_updates.create" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_CREATE" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_CREATE_DESC" />
<action name="joomla_plugin_updates.delete" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_DELETE" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_DELETE_DESC" />
<action name="joomla_plugin_updates.edit" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_DESC" />
<action name="joomla_plugin_updates.edit.created_by" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_CREATED_BY" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_CREATED_BY_DESC" />
<action name="joomla_plugin_updates.edit.created" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_CREATED_DATE" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_CREATED_DATE_DESC" />
<action name="joomla_plugin_updates.edit.own" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_OWN" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_OWN_DESC" />
<action name="joomla_plugin_updates.edit.state" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_STATE" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_STATE_DESC" />
<action name="joomla_plugin_updates.version" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION_DESC" />
<action name="language.build" title="COM_COMPONENTBUILDER_LANGUAGE_BUILD_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_LANGUAGE_BUILD_BUTTON_ACCESS_DESC" />
<action name="language_translation.access" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS_DESC" />
<action name="language_translation.batch" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE_DESC" />
@ -905,6 +915,17 @@
<section name="joomla_plugin_group">
<action name="joomla_plugin_group.version" title="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_EDIT_VERSION_DESC" />
</section>
<section name="joomla_plugin_updates">
<action name="joomla_plugin_updates.edit" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_DESC" />
<action name="joomla_plugin_updates.edit.own" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_OWN" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_OWN_DESC" />
<action name="joomla_plugin_updates.edit.state" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_STATE" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_STATE_DESC" />
<action name="joomla_plugin_updates.edit.created_by" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_CREATED_BY" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_CREATED_BY_DESC" />
<action name="joomla_plugin_updates.edit.created" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_CREATED_DATE" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_CREATED_DATE_DESC" />
<action name="joomla_plugin_updates.create" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_CREATE" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_CREATE_DESC" />
<action name="joomla_plugin_updates.delete" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_DELETE" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_DELETE_DESC" />
<action name="joomla_plugin_updates.access" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_ACCESS_DESC" />
<action name="joomla_plugin_updates.version" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION_DESC" />
</section>
<section name="joomla_plugin_files_folders_urls">
<action name="joomla_plugin_files_folders_urls.edit" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_DESC" />
<action name="joomla_plugin_files_folders_urls.edit.own" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_OWN" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_OWN_DESC" />

View File

@ -0,0 +1,15 @@
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
/* CSS Document */
.mysql_update { width: 100%; height: 392px; }
.version_url { min-width: 100%; }

View File

@ -0,0 +1,13 @@
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
/* CSS Document */

View File

@ -5,7 +5,7 @@
* @created 30th April, 2015
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
* @copyright Copyright (C) 2015 - 2018 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
*/
@ -25,21 +25,27 @@ JHTML::_('behavior.modal');
class com_###component###InstallerScript
{
/**
* method to install the component
* Constructor
*
* @return void
* @param JAdapterInstance $parent The object responsible for running this script
*/
function install($parent)
{
}
public function __construct(JAdapterInstance $parent) {}
/**
* method to uninstall the component
* Called on installation
*
* @return void
* @param JAdapterInstance $parent The object responsible for running this script
*
* @return boolean True on success
*/
function uninstall($parent)
public function install(JAdapterInstance $parent) {}
/**
* Called on uninstallation
*
* @param JAdapterInstance $parent The object responsible for running this script
*/
public function uninstall(JAdapterInstance $parent)
{###UNINSTALLSCRIPT###
// little notice as after service, in case of bad experience with component.
echo '<h2>Did something go wrong? Are you disappointed?</h2>
@ -50,62 +56,69 @@ class com_###component###InstallerScript
}
/**
* method to update the component
* Called on update
*
* @return void
* @param JAdapterInstance $parent The object responsible for running this script
*
* @return boolean True on success
*/
function update($parent)
{
}
public function update(JAdapterInstance $parent){}
/**
* method to run before an install/update/uninstall method
* Called before any type of action
*
* @return void
* @param string $type Which action is happening (install|uninstall|discover_install|update)
* @param JAdapterInstance $parent The object responsible for running this script
*
* @return boolean True on success
*/
function preflight($type, $parent)
public function preflight($type, JAdapterInstance $parent)
{
// get application
$app = JFactory::getApplication();
// is redundant ...hmmm
if ($type == 'uninstall')
// is redundant or so it seems ...hmmm let me know if it works again
if ($type === 'uninstall')
{
return true;
}
// the default for both install and update
$jversion = new JVersion();
if (!$jversion->isCompatible('3.6.0'))
if (!$jversion->isCompatible('3.8.0'))
{
$app->enqueueMessage('Please upgrade to at least Joomla! 3.6.0 before continuing!', 'error');
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');
return false;
}
// do any updates needed
if ($type == 'update')
if ($type === 'update')
{###PREUPDATESCRIPT###
}
// do any install needed
if ($type == 'install')
if ($type === 'install')
{###PREINSTALLSCRIPT###
}
return true;
}
/**
* method to run after an install/update/uninstall method
* Called after any type of action
*
* @return void
* @param string $type Which action is happening (install|uninstall|discover_install|update)
* @param JAdapterInstance $parent The object responsible for running this script
*
* @return boolean True on success
*/
function postflight($type, $parent)
public function postflight($type, JAdapterInstance $parent)
{
// get application
$app = JFactory::getApplication();###MOVEFOLDERSSCRIPT###
// set the default component settings
if ($type == 'install')
if ($type === 'install')
{###POSTINSTALLSCRIPT###
}
// do any updates needed
if ($type == 'update')
if ($type === 'update')
{###POSTUPDATESCRIPT###
}
return true;
}###MOVEFOLDERSMETHOD###
}

View File

@ -0,0 +1,32 @@
<?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

@ -131,6 +131,7 @@ class ComponentbuilderController extends JControllerLegacy
'library_files_folders_urls' => 'libraries_files_folders_urls',
'class_extends' => 'class_extendings',
'joomla_plugin_group' => 'joomla_plugin_groups',
'joomla_plugin_updates' => 'joomla_plugins_updates',
'joomla_plugin_files_folders_urls' => 'joomla_plugins_files_folders_urls'
);
// check if this is a list view

View File

@ -77,9 +77,9 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
if (empty($redirect_url) && $componentId > 0)
{
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false);
if (($pos = strpos($model->compiler->filepath, "/tmp/")) !== FALSE)
if (($pos = strpos($model->compiler->filepath['component'], "/tmp/")) !== FALSE)
{
$url = JURI::root() . substr($model->compiler->filepath, $pos + 1);
$url = JURI::root() . substr($model->compiler->filepath['component'], $pos + 1);
}
// Message of successful build
$message = '<h1>The ('.$model->compiler->componentFolderName.') Was Successfully Compiled!</h1>';
@ -101,7 +101,7 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
$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 .= '<h2>Path to Zip File</h2>';
$message .= '<p><b>Path:</b> <code>'.$model->compiler->filepath.'</code><br />';
$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 file right now!</small><br /><a class="btn btn-success" href="'.$url.'" ><span class="icon-download icon-white"></span>Download</a></p>';
$message .= '<p><small><b>Remember!</b> This file is in your tmp folder and therefore publicly accessible untill you click [Clear tmp]!</small> </p>';

View File

@ -315,6 +315,32 @@ class ComponentbuilderControllerJoomla_plugin extends JControllerForm
*/
protected function postSaveHook(JModelLegacy $model, $validData = array())
{
// get the state object (Joomla\CMS\Object\CMSObject)
$state = $model->get('state');
// if we save2copy we need to also copy linked tables found!
if ($state->task === 'save2copy' && $state->{'joomla_plugin.new'})
{
// get new ID
$newID = $state->{'joomla_plugin.id'};
// get old ID
$oldID = $this->input->get('id', 0, 'INT');
// linked tables to update
$_tablesArray = array(
'joomla_plugin_updates' => 'joomla_plugin',
'joomla_plugin_files_folders_urls' => 'joomla_plugin'
);
foreach($_tablesArray as $_updateTable => $_key)
{
// get the linked ID
if ($_value = ComponentbuilderHelper::getVar($_updateTable, $oldID, $_key, 'id'))
{
// copy fields to new linked table
ComponentbuilderHelper::copyItem(/*id->*/ $_value, /*table->*/ $_updateTable, /*change->*/ array($_key => $newID));
}
}
}
return;
}

View File

@ -0,0 +1,339 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Joomla_plugin_updates Controller
*/
class ComponentbuilderControllerJoomla_plugin_updates extends JControllerForm
{
/**
* Current or most recently performed task.
*
* @var string
* @since 12.2
* @note Replaces _task.
*/
protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array())
{
$this->view_list = 'Joomla_plugins_updates'; // safeguard for setting the return view listing to the main view.
parent::__construct($config);
}
/**
* Method override to check if you can add a new record.
*
* @param array $data An array of input data.
*
* @return boolean
*
* @since 1.6
*/
protected function allowAdd($data = array())
{
// Get user object.
$user = JFactory::getUser();
// Access check.
$access = $user->authorise('joomla_plugin_updates.access', 'com_componentbuilder');
if (!$access)
{
return false;
}
// In the absense of better information, revert to the component permissions.
return $user->authorise('joomla_plugin_updates.create', $this->option);
}
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
*
* @since 1.6
*/
protected function allowEdit($data = array(), $key = 'id')
{
// get user object.
$user = JFactory::getUser();
// get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
// Access check.
$access = ($user->authorise('joomla_plugin_updates.access', 'com_componentbuilder.joomla_plugin_updates.' . (int) $recordId) && $user->authorise('joomla_plugin_updates.access', 'com_componentbuilder'));
if (!$access)
{
return false;
}
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('joomla_plugin_updates.edit', 'com_componentbuilder.joomla_plugin_updates.' . (int) $recordId);
if (!$permission)
{
if ($user->authorise('joomla_plugin_updates.edit.own', 'com_componentbuilder.joomla_plugin_updates.' . $recordId))
{
// Now test the owner is the user.
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
if (empty($ownerId))
{
// Need to do a lookup from the model.
$record = $this->getModel()->getItem($recordId);
if (empty($record))
{
return false;
}
$ownerId = $record->created_by;
}
// If the owner matches 'me' then allow.
if ($ownerId == $user->id)
{
if ($user->authorise('joomla_plugin_updates.edit.own', 'com_componentbuilder'))
{
return true;
}
}
}
return false;
}
}
// Since there is no permission, revert to the component permissions.
return $user->authorise('joomla_plugin_updates.edit', $this->option);
}
/**
* Gets the URL arguments to append to an item redirect.
*
* @param integer $recordId The primary key id for the item.
* @param string $urlVar The name of the URL variable for the id.
*
* @return string The arguments to append to the redirect URL.
*
* @since 1.6
*/
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{
// get the referral options (old method use return instead see parent)
$ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
// get redirect info.
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
// set the referral options
if ($refid && $ref)
{
$append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
}
elseif ($ref)
{
$append = '&ref='. (string)$ref . $append;
}
return $append;
}
/**
* Method to run batch operations.
*
* @param object $model The model.
*
* @return boolean True if successful, false otherwise and internal error is set.
*
* @since 2.5
*/
public function batch($model = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Set the model
$model = $this->getModel('Joomla_plugin_updates', '', array());
// Preset the redirect
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_plugins_updates' . $this->getRedirectToListAppend(), false));
return parent::batch($model);
}
/**
* Method to cancel an edit.
*
* @param string $key The name of the primary key of the URL variable.
*
* @return boolean True if access level checks pass, false otherwise.
*
* @since 12.2
*/
public function cancel($key = null)
{
// get the referral options
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key);
if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{
$redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
JRoute::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
elseif ($this->ref)
{
$redirect = '&view='.(string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
return $cancel;
}
/**
* Method to save a record.
*
* @param string $key The name of the primary key of the URL variable.
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
*
* @return boolean True if successful, false otherwise.
*
* @since 12.2
*/
public function save($key = null, $urlVar = null)
{
// get the referral options
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{
// to make sure the item is checkedin on redirect
$this->task = 'save';
}
$saved = parent::save($key, $urlVar);
// This is not needed since parent save already does this
// Due to the ref and refid implementation we need to add this
if ($canReturn)
{
$redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
JRoute::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
elseif ($this->ref)
{
$redirect = '&view=' . (string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
return $saved;
}
/**
* Function that allows child controller access to model data
* after the data has been saved.
*
* @param JModel &$model The data model object.
* @param array $validData The validated data.
*
* @return void
*
* @since 11.1
*/
protected function postSaveHook(JModelLegacy $model, $validData = array())
{
// update the component version to match the updated last version
if (isset($validData['joomla_plugin']) && is_numeric($validData['joomla_plugin']) && $validData['joomla_plugin'] > 0)
{
$objectUpdate = new stdClass();
$objectUpdate->id = (int) $validData['joomla_plugin'];
if (isset($validData['version_update']) && ComponentbuilderHelper::checkArray($validData['version_update'])
&& ($plugin_version = end($validData['version_update'])['version'])
&& ComponentbuilderHelper::checkString($plugin_version))
{
$objectUpdate->plugin_version = $plugin_version;
}
// be sure to update the table if we have a value
if (isset($objectUpdate->plugin_version))
{
JFactory::getDbo()->updateObject('#__componentbuilder_joomla_plugin', $objectUpdate, 'id');
}
}
return;
}
}

View File

@ -0,0 +1,43 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Joomla_plugins_updates Controller
*/
class ComponentbuilderControllerJoomla_plugins_updates extends JControllerAdmin
{
/**
* The prefix to use with controller messages.
*
* @var string
* @since 1.6
*/
protected $text_prefix = 'COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Joomla_plugin_updates', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
}
}

View File

@ -35,7 +35,7 @@ class Compiler extends Infusion
private $time_start;
private $time_end;
public $secondsCompiled;
public $filepath = '';
public $filepath = array('component' => '', 'package' => '', 'plugins' => array(), 'modules' => array());
// fixed pathes
protected $dynamicIntegration = false;
protected $backupPath = false;
@ -61,6 +61,7 @@ class Compiler extends Infusion
$this->backupPath = $this->params->get('backup_folder_path', $this->tempPath) . '/' . $this->componentBackupName . '.zip';
$this->dynamicIntegration = true;
}
// set local repos switch
if ($config['repository'])
{
$this->repoPath = $this->params->get('git_folder_path', null);
@ -125,12 +126,16 @@ class Compiler extends Infusion
$this->setCountingStuff();
// build read me
$this->buildReadMe();
// set local repos
$this->setLocalRepos();
// zip the component
if (!$this->zipComponent())
{
// done with error
return false;
}
// if there are plugins zip them
$this->zipPlugins();
// do lang mismatch check
if (ComponentbuilderHelper::checkArray($this->langMismatch))
{
@ -321,17 +326,37 @@ class Compiler extends Infusion
*/
protected function setUpdateServer()
{
// move the update server to host
if ($this->componentData->add_update_server == 1 && $this->componentData->update_server_target == 1 && isset($this->updateServerFileName) && $this->dynamicIntegration)
// move the component update server to host
if ($this->componentData->add_update_server == 1 && $this->componentData->update_server_target == 1
&& isset($this->updateServerFileName) && $this->dynamicIntegration)
{
$xml_update_server_path = $this->componentPath . '/' . $this->updateServerFileName . '.xml';
$update_server_xml_path = $this->componentPath . '/' . $this->updateServerFileName . '.xml';
// make sure we have the correct file
if (JFile::exists($xml_update_server_path) && isset($this->componentData->update_server))
if (JFile::exists($update_server_xml_path) && isset($this->componentData->update_server))
{
// move to server
ComponentbuilderHelper::moveToServer($xml_update_server_path, $this->updateServerFileName . '.xml', (int) $this->componentData->update_server, $this->componentData->update_server_protocol);
ComponentbuilderHelper::moveToServer($update_server_xml_path, $this->updateServerFileName . '.xml', (int) $this->componentData->update_server, $this->componentData->update_server_protocol);
// remove the local file
JFile::delete($xml_update_server_path);
JFile::delete($update_server_xml_path);
}
}
// move the plugins update server to host
if (ComponentbuilderHelper::checkArray($this->componentData->joomla_plugins))
{
foreach ($this->componentData->joomla_plugins as $plugin)
{
if (ComponentbuilderHelper::checkObject($plugin)
&& isset($plugin->add_update_server) && $plugin->add_update_server == 1
&& isset($plugin->update_server_target) && $plugin->update_server_target == 1
&& isset($plugin->update_server) && is_numeric($plugin->update_server) && $plugin->update_server > 0
&& isset($plugin->update_server_xml_path) && JFile::exists($plugin->update_server_xml_path)
&& isset($plugin->update_server_xml_file_name) && ComponentbuilderHelper::checkString($plugin->update_server_xml_file_name))
{
// move to server
ComponentbuilderHelper::moveToServer($plugin->update_server_xml_path, $plugin->update_server_xml_file_name, (int) $plugin->update_server, $plugin->update_server_protocol);
// remove the local file
JFile::delete($plugin->update_server_xml_path);
}
}
}
}
@ -472,10 +497,10 @@ class Compiler extends Infusion
$this->fileContentStatic[$this->hhh . 'projectMonthTime' . $this->hhh] = $this->projectMonthTime;
}
private function zipComponent()
private function setLocalRepos()
{
// before we zip the component we first need to move it to the repo folder if set
if (ComponentbuilderHelper::checkString($this->repoPath))
// move it to the repo folder if set
if (isset($this->repoPath) && ComponentbuilderHelper::checkString($this->repoPath))
{
// set the repo path
$repoFullPath = $this->repoPath . '/com_' . $this->componentData->sales_name . '__joomla_' . $this->joomlaVersion;
@ -487,21 +512,47 @@ class Compiler extends Infusion
JFolder::copy($this->componentPath, $repoFullPath, '', true);
// Trigger Event: jcb_ce_onAfterUpdateRepo
$this->triggerEvent('jcb_ce_onAfterUpdateRepo', array(&$this->componentContext, &$this->componentPath, &$repoFullPath, &$this->componentData));
// move the plugins to local folder repos
if (ComponentbuilderHelper::checkArray($this->componentData->joomla_plugins))
{
foreach ($this->componentData->joomla_plugins as $plugin)
{
if (ComponentbuilderHelper::checkObject($plugin) && isset($plugin->file_name))
{
$plugin_context = 'plugin.' . $plugin->file_name . '.' . $plugin->id;
// set the repo path
$repoFullPath = $this->repoPath . '/' . $plugin->folder_name . '__joomla_' . $this->joomlaVersion;
// Trigger Event: jcb_ce_onBeforeUpdateRepo
$this->triggerEvent('jcb_ce_onBeforeUpdateRepo', array(&$plugin_context, &$plugin->folder_path, &$repoFullPath, &$plugin));
// remove old data
$this->removeFolder($repoFullPath, $this->componentData->toignore);
// set the new data
JFolder::copy($plugin->folder_path, $repoFullPath, '', true);
// Trigger Event: jcb_ce_onAfterUpdateRepo
$this->triggerEvent('jcb_ce_onAfterUpdateRepo', array(&$plugin_context, &$plugin->folder_path, &$repoFullPath, &$plugin));
}
}
}
}
}
private function zipComponent()
{
// the name of the zip file to create
$this->filepath = $this->tempPath . '/' . $this->componentFolderName . '.zip';
$this->filepath['component'] = $this->tempPath . '/' . $this->componentFolderName . '.zip';
// Trigger Event: jcb_ce_onBeforeZipComponent
$this->triggerEvent('jcb_ce_onBeforeZipComponent', array(&$this->componentContext, &$this->componentPath, &$this->filepath, &$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
if (ComponentbuilderHelper::zip($this->componentPath, $this->filepath))
if (ComponentbuilderHelper::zip($this->componentPath, $this->filepath['component']))
{
// now move to backup if zip was made and backup is required
if ($this->backupPath && $this->dynamicIntegration)
{
// Trigger Event: jcb_ce_onBeforeBackupZip
$this->triggerEvent('jcb_ce_onBeforeBackupZip', array(&$this->componentContext, &$this->filepath, &$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
JFile::copy($this->filepath, $this->backupPath);
JFile::copy($this->filepath['component'], $this->backupPath);
}
// move to sales server host
@ -511,13 +562,13 @@ class Compiler extends Infusion
if (isset($this->componentData->sales_server))
{
// Trigger Event: jcb_ce_onBeforeMoveToServer
$this->triggerEvent('jcb_ce_onBeforeMoveToServer', array(&$this->componentContext, &$this->filepath, &$this->tempPath, &$this->componentSalesName, &$this->componentData));
$this->triggerEvent('jcb_ce_onBeforeMoveToServer', array(&$this->componentContext, &$this->filepath['component'], &$this->tempPath, &$this->componentSalesName, &$this->componentData));
// move to server
ComponentbuilderHelper::moveToServer($this->filepath, $this->componentSalesName . '.zip', (int) $this->componentData->sales_server, $this->componentData->sales_server_protocol);
ComponentbuilderHelper::moveToServer($this->filepath['component'], $this->componentSalesName . '.zip', (int) $this->componentData->sales_server, $this->componentData->sales_server_protocol);
}
}
// Trigger Event: jcb_ce_onAfterZipComponent
$this->triggerEvent('jcb_ce_onAfterZipComponent', array(&$this->componentContext, &$this->filepath, &$this->tempPath, &$this->componentFolderName, &$this->componentData));
$this->triggerEvent('jcb_ce_onAfterZipComponent', array(&$this->componentContext, &$this->filepath['component'], &$this->tempPath, &$this->componentFolderName, &$this->componentData));
// remove the component folder since we are done
if ($this->removeFolder($this->componentPath))
{
@ -527,6 +578,58 @@ class Compiler extends Infusion
return false;
}
private function zipPlugins()
{
if (ComponentbuilderHelper::checkArray($this->componentData->joomla_plugins))
{
foreach ($this->componentData->joomla_plugins as $plugin)
{
if (ComponentbuilderHelper::checkObject($plugin) && isset($plugin->zip_name)
&& ComponentbuilderHelper::checkString($plugin->zip_name)
&& isset($plugin->folder_path)
&& ComponentbuilderHelper::checkString($plugin->folder_path))
{
// set plugin context
$plugin_context = $plugin->file_name . '.' . $plugin->id;
// the name of the zip file to create
$this->filepath['plugins'][$plugin->id] = $this->tempPath . '/' . $plugin->zip_name . '.zip';
// Trigger Event: jcb_ce_onBeforeZipPlugin
$this->triggerEvent('jcb_ce_onBeforeZipPlugin', array(&$plugin_context, &$plugin->folder_path, &$this->filepath['plugins'][$plugin->id], &$this->tempPath, &$plugin->zip_name, &$plugin));
//create the zip file
if (ComponentbuilderHelper::zip($plugin->folder_path, $this->filepath['plugins'][$plugin->id]))
{
// now move to backup if zip was made and backup is required
if ($this->backupPath)
{
$__plugin_context = 'plugin.' . $plugin_context;
// Trigger Event: jcb_ce_onBeforeBackupZip
$this->triggerEvent('jcb_ce_onBeforeBackupZip', array(&$__plugin_context, &$this->filepath['plugins'][$plugin->id], &$this->tempPath, &$this->backupPath, &$plugin));
// copy the zip to backup path
JFile::copy($this->filepath['plugins'][$plugin->id], $this->backupPath);
}
// move to sales server host
if ($plugin->add_sales_server == 1)
{
// make sure we have the correct file
if (isset($plugin->sales_server))
{
// Trigger Event: jcb_ce_onBeforeMoveToServer
$this->triggerEvent('jcb_ce_onBeforeMoveToServer', array(&$__plugin_context, &$this->filepath['plugins'][$plugin->id], &$this->tempPath, &$plugin->zip_name, &$plugin));
// move to server
ComponentbuilderHelper::moveToServer($this->filepath['plugins'][$plugin->id], $plugin->zip_name . '.zip', (int) $plugin->sales_server, $plugin->sales_server_protocol);
}
}
// Trigger Event: jcb_ce_onAfterZipPlugin
$this->triggerEvent('jcb_ce_onAfterZipPlugin', array(&$plugin_context, &$this->filepath['plugins'][$plugin->id], &$this->tempPath, &$plugin->zip_name, &$plugin));
// remove the plugin folder since we are done
$this->removeFolder($plugin->folder_path);
}
}
}
}
}
protected function addCustomCode()
{
// reset all these

View File

@ -18,6 +18,13 @@ defined('_JEXEC') or die('Restricted access');
class Get
{
/**
* The Joomla Version
*
* @var string
*/
public $joomlaVersion;
/**
* The hash placeholder
*
@ -769,6 +776,8 @@ class Get
}
}
}
// set the Joomla version
$this->joomlaVersion = $config['version'];
// set the minfy switch of the JavaScript
$this->minify = (isset($config['minify']) && $config['minify'] != 2) ? $config['minify'] : $this->params->get('minify', 0);
// set the global language
@ -950,24 +959,24 @@ class Get
{
$code = base64_decode($code);
}
// set component place holders
$bucket[$this->hhh . 'component' . $this->hhh] = $this->componentCodeName;
$bucket[$this->hhh . 'Component' . $this->hhh] = ComponentbuilderHelper::safeString($this->componentCodeName, 'F');
$bucket[$this->hhh . 'COMPONENT' . $this->hhh] = ComponentbuilderHelper::safeString($this->componentCodeName, 'U');
$bucket[$this->bbb . 'component' . $this->ddd] = $bucket[$this->hhh . 'component' . $this->hhh];
$bucket[$this->bbb . 'Component' . $this->ddd] = $bucket[$this->hhh . 'Component' . $this->hhh];
$bucket[$this->bbb . 'COMPONENT' . $this->ddd] = $bucket[$this->hhh . 'COMPONENT' . $this->hhh];
// get the current components overides
if (($_placeholders = ComponentbuilderHelper::getVar('component_placeholders', $this->componentID, 'joomla_component', 'addplaceholders')) !== false
&& ComponentbuilderHelper::checkJson($_placeholders))
}
// set component place holders
$bucket[$this->hhh . 'component' . $this->hhh] = $this->componentCodeName;
$bucket[$this->hhh . 'Component' . $this->hhh] = ComponentbuilderHelper::safeString($this->componentCodeName, 'F');
$bucket[$this->hhh . 'COMPONENT' . $this->hhh] = ComponentbuilderHelper::safeString($this->componentCodeName, 'U');
$bucket[$this->bbb . 'component' . $this->ddd] = $bucket[$this->hhh . 'component' . $this->hhh];
$bucket[$this->bbb . 'Component' . $this->ddd] = $bucket[$this->hhh . 'Component' . $this->hhh];
$bucket[$this->bbb . 'COMPONENT' . $this->ddd] = $bucket[$this->hhh . 'COMPONENT' . $this->hhh];
// get the current components overides
if (($_placeholders = ComponentbuilderHelper::getVar('component_placeholders', $this->componentID, 'joomla_component', 'addplaceholders')) !== false
&& ComponentbuilderHelper::checkJson($_placeholders))
{
$_placeholders = json_decode($_placeholders, true);
if (ComponentbuilderHelper::checkArray($_placeholders))
{
$_placeholders = json_decode($_placeholders, true);
if (ComponentbuilderHelper::checkArray($_placeholders))
foreach($_placeholders as $row)
{
foreach($_placeholders as $row)
{
$bucket[$row['target']] = $row['value'];
}
$bucket[$row['target']] = $row['value'];
}
}
}
@ -6165,25 +6174,32 @@ class Get
$query->select(
$this->db->quoteName(
array(
'g.name',
'e.name',
'e.head',
'e.comment',
'e.id',
'j.addfiles',
'j.addfolders',
'j.addfilesfullpath',
'j.addfoldersfullpath'
'g.name',
'e.name',
'e.head',
'e.comment',
'e.id',
'f.addfiles',
'f.addfolders',
'f.addfilesfullpath',
'f.addfoldersfullpath',
'f.addurls',
'u.version_update',
'u.id'
), array(
'group',
'extends',
'class_head',
'comment',
'class_id',
'addfiles',
'addfolders',
'addfilesfullpath',
'addfoldersfullpath'
'group',
'extends',
'class_head',
'comment',
'class_id',
'addfiles',
'addfolders',
'addfilesfullpath',
'addfoldersfullpath',
'addurls',
'version_update',
'version_update_id'
)
)
);
@ -6191,7 +6207,8 @@ class Get
$query->from('#__componentbuilder_joomla_plugin AS a');
$query->join('LEFT', $this->db->quoteName('#__componentbuilder_joomla_plugin_group', 'g') . ' ON (' . $this->db->quoteName('a.joomla_plugin_group') . ' = ' . $this->db->quoteName('g.id') . ')');
$query->join('LEFT', $this->db->quoteName('#__componentbuilder_class_extends', 'e') . ' ON (' . $this->db->quoteName('a.class_extends') . ' = ' . $this->db->quoteName('e.id') . ')');
$query->join('LEFT', $this->db->quoteName('#__componentbuilder_joomla_plugin_files_folders_urls', 'j') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('j.joomla_plugin') . ')');
$query->join('LEFT', $this->db->quoteName('#__componentbuilder_joomla_plugin_updates', 'u') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('u.joomla_plugin') . ')');
$query->join('LEFT', $this->db->quoteName('#__componentbuilder_joomla_plugin_files_folders_urls', 'f') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('f.joomla_plugin') . ')');
$query->where($this->db->quoteName('a.id') . ' = ' . (int) $id);
$query->where($this->db->quoteName('a.published') . ' >= 1');
$this->db->setQuery($query);
@ -6210,8 +6227,11 @@ class Get
// update to point to plugin
$this->target = $plugin->key;
$this->lang = $plugin->key;
// set version
$plugin->version = '1.0.' . (int) $plugin->version; // (TODO) add versioning to plugin
// set version if not set
if (empty($plugin->plugin_version))
{
$plugin->plugin_version = '1.0.0';
}
// set GUI mapper
$guiMapper = array( 'table' => 'joomla_plugin', 'id' => (int) $id, 'type' => 'php');
// update the name if it has dynamic values
@ -6228,6 +6248,8 @@ class Get
$plugin->installer_class_name = 'plg' . ucfirst($plugin->group) . ucfirst($plugin->name) . 'InstallerScript';
// set plugin folder name
$plugin->folder_name = 'plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->name);
// set the zip name
$plugin->zip_name = $plugin->folder_name . '_v' . str_replace('.', '_', $plugin->plugin_version). '__J' . $this->joomlaVersion;
// set plugin file name
$plugin->file_name = strtolower($plugin->name);
// set official_name lang strings
@ -6242,7 +6264,7 @@ class Get
$this->setLangContent($plugin->key, $plugin->lang_prefix . '_DESCRIPTION', $plugin->description);
$plugin->description = '<p>' . $plugin->description . '</p>';
}
$plugin->xml_description = "<h1>" . $plugin->official_name . " (v." . $plugin->version . ")</h1> <div style='clear: both;'></div>" . $plugin->description . "<p>Created by <a href='" . trim($component->website) . "' target='_blank'>" . trim(JFilterOutput::cleanText($component->author)) . "</a><br /><small>Development started " . JFactory::getDate($plugin->created)->format("jS F, Y") . "</small></p>";
$plugin->xml_description = "<h1>" . $plugin->official_name . " (v." . $plugin->plugin_version . ")</h1> <div style='clear: both;'></div>" . $plugin->description . "<p>Created by <a href='" . trim($component->website) . "' target='_blank'>" . trim(JFilterOutput::cleanText($component->author)) . "</a><br /><small>Development started " . JFactory::getDate($plugin->created)->format("jS F, Y") . "</small></p>";
// set xml discription
$this->setLangContent($plugin->key, $plugin->lang_prefix . '_XML_DESCRIPTION', $plugin->xml_description);
// update the readme if set
@ -6307,14 +6329,15 @@ class Get
$plugin->fields = (isset($plugin->fields) && ComponentbuilderHelper::checkJson($plugin->fields)) ? json_decode($plugin->fields, true) : null;
if (ComponentbuilderHelper::checkArray($plugin->fields))
{
$plugin->config_fields = array_map(function($field) use ($id){
$key = $plugin->key;
$plugin->config_fields = array_map(function($field) use ($key){
// make sure the alias and title is 0
$field['alias'] = 0;
$field['title'] = 0;
// set the field details
$this->setFieldDetails($field, '_plugin_' . $id);
$this->setFieldDetails($field, $key);
// set unique name counter
$this->setUniqueNameCounter($field['base_name'], '_plugins_' . $id);
$this->setUniqueNameCounter($field['base_name'], $key);
// return field
return $field;
}, array_values($plugin->fields));
@ -6323,7 +6346,7 @@ class Get
foreach ($plugin->config_fields as $field)
{
// so first we lock the field name in
$this->getFieldName($field, '_plugins_' . $id);
$this->getFieldName($field, $plugin->key);
}
// unset original value
unset($plugin->fields);
@ -6420,6 +6443,10 @@ class Get
$plugin->{$server . '_protocol'} = 0;
}
}
// set the update server stuff (TODO)
// update_server_xml_path
// update_server_xml_file_name
// rest globals
$this->target = $_backup_target;
$this->lang = $_backup_lang;
@ -6447,10 +6474,11 @@ class Get
$xml .= PHP_EOL . $this->_t(1) . '<authorUrl>' . $this->hhh . 'AUTHORWEBSITE' . $this->hhh . '</authorUrl>';
$xml .= PHP_EOL . $this->_t(1) . '<copyright>' . $this->hhh . 'COPYRIGHT' . $this->hhh . '</copyright>';
$xml .= PHP_EOL . $this->_t(1) . '<license>' . $this->hhh . 'LICENSE' . $this->hhh . '</license>';
$xml .= PHP_EOL . $this->_t(1) . '<version>' . $plugin->version . '</version>';
$xml .= PHP_EOL . $this->_t(1) . '<version>' . $plugin->plugin_version . '</version>';
$xml .= PHP_EOL . $this->_t(1) . '<description>' . $plugin->lang_prefix . '_XML_DESCRIPTION</description>';
$xml .= $this->hhh . 'MAINXML' . $this->hhh;
$xml .= PHP_EOL . '</extension>';
$dates = array();
return $xml;
}

View File

@ -200,13 +200,6 @@ class Structure extends Get
*/
public $projectMonthTime = 0;
/**
* The Joomla Version
*
* @var string
*/
public $joomlaVersion;
/**
* The template path
*
@ -242,6 +235,13 @@ class Structure extends Get
*/
public $stdFolders = array('site', 'admin', 'media');
/**
* The standard root files
*
* @var array
*/
public $stdRootFiles = array('access.xml', 'config.xml', 'controller.php', 'index.html', 'README.txt');
/**
* Dynamic File Content
*
@ -341,6 +341,8 @@ class Structure extends Get
// first we run the perent constructor
if (parent::__construct($config))
{
// set the standard admin file
$this->stdRootFiles[] = $this->componentData->name_code . '.php';
// set incase no extra admin folder are loaded
$this->fileContentStatic[$this->hhh . 'EXSTRA_ADMIN_FOLDERS' . $this->hhh] = '';
// set incase no extra site folder are loaded
@ -355,8 +357,6 @@ class Structure extends Get
$this->fileContentStatic[$this->hhh . 'EXSTRA_MEDIA_FILES' . $this->hhh] = '';
// run global updater
ComponentbuilderHelper::runGlobalUpdater();
// set the Joomla version
$this->joomlaVersion = $config['version'];
// set the template path
$this->templatePath = $this->compilerPath . '/joomla_' . $config['version'];
// set some default names
@ -430,7 +430,8 @@ class Structure extends Get
$this->triggerEvent('jcb_ce_onBeforeSetPlugins', array(&$this->componentContext, &$this->componentData->joomla_plugins));
foreach ($this->componentData->joomla_plugins as $plugin)
{
if (ComponentbuilderHelper::checkObject($plugin) && isset($plugin->folder_name) && ComponentbuilderHelper::checkString($plugin->folder_name))
if (ComponentbuilderHelper::checkObject($plugin) && isset($plugin->folder_name)
&& ComponentbuilderHelper::checkString($plugin->folder_name))
{
// plugin path
$plugin->folder_path = $this->compilerPath . '/' . $plugin->folder_name;
@ -447,13 +448,20 @@ class Structure extends Get
$this->indexHTML($plugin->folder_name, $this->compilerPath);
}
// set main class file
$fileDetails = array('path' => $plugin->folder_path . '/' . $plugin->file_name . '.php', 'name' => $plugin->file_name . '.php', 'zip' => $plugin->file_name . '.php');
$this->writeFile($fileDetails['path'], '<?php' . PHP_EOL . '// Plugin main class template' . PHP_EOL . $this->hhh . 'BOM' . $this->hhh . PHP_EOL . $this->hhh . 'MAINCLASS' . $this->hhh);
$fileDetails = array('path' => $plugin->folder_path . '/' . $plugin->file_name . '.php',
'name' => $plugin->file_name . '.php', 'zip' => $plugin->file_name . '.php');
$this->writeFile($fileDetails['path'],
'<?php' . PHP_EOL . '// Plugin main class template' .
PHP_EOL . $this->hhh . 'BOM' . $this->hhh . PHP_EOL .
PHP_EOL . '// No direct access to this file' . PHP_EOL .
"defined('_JEXEC') or die('Restricted access');" . PHP_EOL .
$this->hhh . 'MAINCLASS' . $this->hhh);
$this->newFiles[$plugin->key][] = $fileDetails;
// count the file created
$this->fileCount++;
// set main xml file
$fileDetails = array('path' => $plugin->folder_path . '/' . $plugin->file_name . '.xml', 'name' => $plugin->file_name . '.xml', 'zip' => $plugin->file_name . '.xml');
$fileDetails = array('path' => $plugin->folder_path . '/' . $plugin->file_name . '.xml',
'name' => $plugin->file_name . '.xml', 'zip' => $plugin->file_name . '.xml');
$this->writeFile($fileDetails['path'], $this->getPluginXMLTemplate($plugin));
$this->newFiles[$plugin->key][] = $fileDetails;
// count the file created
@ -461,8 +469,14 @@ class Structure extends Get