Adding the the new plugin builder to the compiler. gh-436

This commit is contained in:
Llewellyn van der Merwe 2019-08-05 00:38:53 +02:00
parent e6eada11a9
commit 7d2cc2c9f0
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
11 changed files with 730 additions and 80 deletions

View File

@ -146,14 +146,14 @@ 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*: 29th July, 2019 + *Last Build*: 4th August, 2019
+ *Version*: 2.9.35 + *Version*: 2.9.35
+ *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*: **242165** + *Line count*: **242379**
+ *Field count*: **1302** + *Field count*: **1302**
+ *File count*: **1562** + *File count*: **1566**
+ *Folder count*: **237** + *Folder count*: **240**
> 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).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -146,14 +146,14 @@ 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*: 29th July, 2019 + *Last Build*: 4th August, 2019
+ *Version*: 2.9.35 + *Version*: 2.9.35
+ *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*: **242165** + *Line count*: **242379**
+ *Field count*: **1302** + *Field count*: **1302**
+ *File count*: **1562** + *File count*: **1566**
+ *Folder count*: **237** + *Folder count*: **240**
> 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).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -240,6 +240,26 @@ class Compiler extends Infusion
} }
// free up some memory // free up some memory
unset($this->newFiles['dynamic']); unset($this->newFiles['dynamic']);
// do plugins if found
if (ComponentbuilderHelper::checkArray($this->componentData->joomla_plugins))
{
foreach ($this->componentData->joomla_plugins as $plugin)
{
if (ComponentbuilderHelper::checkObject($plugin) && isset($this->newFiles[$plugin->key]) && ComponentbuilderHelper::checkArray($this->newFiles[$plugin->key]))
{
foreach ($this->newFiles[$plugin->key] as $plugin_file)
{
if (JFile::exists($plugin_file['path']))
{
$this->setFileContent($plugin_file['name'], $plugin_file['path'], $bom, $plugin->key);
}
}
// free up some memory
unset($this->newFiles[$plugin->key]);
unset($this->fileContentDynamic[$plugin->key]);
}
}
}
return true; return true;
} }
return false; return false;

View File

@ -1598,7 +1598,7 @@ class Get
array( array(
'table' => 'component_dashboard', 'table' => 'component_dashboard',
'field' => 'php_dashboard_methods', 'field' => 'php_dashboard_methods',
'id' => (int) $this->component_dashboard_id, 'id' => (int) $component->component_dashboard_id,
'type' => 'php') 'type' => 'php')
); );
} }
@ -1650,9 +1650,9 @@ class Get
$component->addjoomla_plugins = (isset($component->addjoomla_plugins) && ComponentbuilderHelper::checkJson($component->addjoomla_plugins)) ? json_decode($component->addjoomla_plugins, true) : null; $component->addjoomla_plugins = (isset($component->addjoomla_plugins) && ComponentbuilderHelper::checkJson($component->addjoomla_plugins)) ? json_decode($component->addjoomla_plugins, true) : null;
if (ComponentbuilderHelper::checkArray($component->addjoomla_plugins)) if (ComponentbuilderHelper::checkArray($component->addjoomla_plugins))
{ {
$component->joomla_plugins = array_map(function($array) $component->joomla_plugins = array_map(function($array) use(&$component)
{ {
return $this->getPlugins($array['plugin']); return $this->getPlugins($array['plugin'], $component);
}, array_values($component->addjoomla_plugins)); }, array_values($component->addjoomla_plugins));
} }
else else
@ -3355,12 +3355,14 @@ class Get
$results = $this->db->loadObjectList(); $results = $this->db->loadObjectList();
$typeArray = array(1 => 'LEFT', 2 => 'LEFT OUTER', 3 => 'INNER', 4 => 'RIGHT', 5 => 'RIGHT OUTER'); $typeArray = array(1 => 'LEFT', 2 => 'LEFT OUTER', 3 => 'INNER', 4 => 'RIGHT', 5 => 'RIGHT OUTER');
$operatorArray = array(1 => '=', 2 => '!=', 3 => '<>', 4 => '>', 5 => '<', 6 => '>=', 7 => '<=', 8 => '!<', 9 => '!>', 10 => 'IN', 11 => 'NOT IN'); $operatorArray = array(1 => '=', 2 => '!=', 3 => '<>', 4 => '>', 5 => '<', 6 => '>=', 7 => '<=', 8 => '!<', 9 => '!>', 10 => 'IN', 11 => 'NOT IN');
$guiMapper = array( 'table' => 'dynamic_get', 'id' => (int) $result->id, 'type' => 'php'); $guiMapper = array( 'table' => 'dynamic_get', 'type' => 'php');
foreach ($results as $_nr => &$result) foreach ($results as $_nr => &$result)
{ {
// set GUI mapper id
$guiMapper['id'] = (int) $result->id;
// add calculations if set // add calculations if set
if ($result->addcalculation == 1 && ComponentbuilderHelper::checkString($result->php_calculation)) if ($result->addcalculation == 1 && ComponentbuilderHelper::checkString($result->php_calculation))
{ {
// set GUI mapper field // set GUI mapper field
$guiMapper['field'] = 'php_calculation'; $guiMapper['field'] = 'php_calculation';
$result->php_calculation = $this->setGuiCodePlaceholder( $result->php_calculation = $this->setGuiCodePlaceholder(
@ -6154,7 +6156,7 @@ class Get
* @return void * @return void
* *
*/ */
public function getPlugins($id) protected function getPlugins($id, &$component)
{ {
// Create a new query object. // Create a new query object.
$query = $this->db->getQuery(true); $query = $this->db->getQuery(true);
@ -6202,15 +6204,57 @@ class Get
$_backup_target = $this->target; $_backup_target = $this->target;
$_backup_lang = $this->lang; $_backup_lang = $this->lang;
$_backup_langPrefix = $this->langPrefix; $_backup_langPrefix = $this->langPrefix;
$this->target = 'plugin'.$id; // set some keys
$this->lang = 'plugin'.$id; $plugin->target_type = 'P|uG!n';
$this->langPrefix = 'PLUGIN_PREFIX___'; $plugin->key = $plugin->id . '_' . $plugin->target_type;
// 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 GUI mapper // set GUI mapper
$guiMapper = array( 'table' => 'joomla_plugin', 'id' => (int) $id, 'type' => 'php'); $guiMapper = array( 'table' => 'joomla_plugin', 'id' => (int) $id, 'type' => 'php');
// 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);
// prepare plugin placeholders (TODO) // set official name
$plugin->official_name = $plugin->name . ' ' . $plugin->group;
// set langPrefix
$this->langPrefix = 'PLG_' . strtoupper($plugin->group) . '_' . strtoupper($plugin->name);
// set lang prefix
$plugin->lang_prefix = $this->langPrefix;
// set plugin class name
$plugin->class_name = 'Plg' . ucfirst($plugin->group) . ucfirst($plugin->name);
// set plugin install class name
$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 plugin file name
$plugin->file_name = strtolower($plugin->name);
// set official_name lang strings
$this->setLangContent($plugin->key, $this->langPrefix, $plugin->official_name);
// set description (TODO) add description field to plugin
if (!isset($plugin->description) || !ComponentbuilderHelper::checkString($plugin->description))
{
$plugin->description = '';
}
else
{
$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>";
// set xml discription
$this->setLangContent($plugin->key, $plugin->lang_prefix . '_XML_DESCRIPTION', $plugin->xml_description);
// update the readme if set
if ($plugin->addreadme == 1 && !empty($plugin->readme))
{
$plugin->readme = $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->readme)), $this->placeholders);
}
else
{
$plugin->addreadme = 0;
unset($plugin->readme);
}
// open some base64 strings // open some base64 strings
if (!empty($plugin->main_class_code)) if (!empty($plugin->main_class_code))
{ {
@ -6306,15 +6350,111 @@ class Get
} }
unset($plugin->{'add' . $addTarget}); unset($plugin->{'add' . $addTarget});
} }
// add PHP in plugin install
$plugin->add_install_script = false;
$addScriptMethods = array('php_preflight', 'php_postflight', 'php_method');
$addScriptTypes = array('install', 'update', 'uninstall');
foreach ($addScriptMethods as $scriptMethod)
{
foreach ($addScriptTypes as $scriptType)
{
if (isset($plugin->{'add_' . $scriptMethod . '_' . $scriptType}) && $plugin->{'add_' . $scriptMethod . '_' . $scriptType} == 1 && ComponentbuilderHelper::checkString($plugin->{$scriptMethod . '_' . $scriptType}))
{
// set GUI mapper field
$guiMapper['field'] = $scriptMethod . '_' . $scriptType;
$plugin->{$scriptMethod . '_' . $scriptType} = $this->setGuiCodePlaceholder(
$this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->{$scriptMethod . '_' . $scriptType})), $this->placeholders),
$guiMapper
);
$plugin->add_install_script = true;
}
else
{
unset($plugin->{$scriptMethod . '_' . $scriptType});
$plugin->{'add_' . $scriptMethod . '_' . $scriptType} = 0;
}
}
}
// add_sql
if ($plugin->add_sql == 1 && ComponentbuilderHelper::checkString($plugin->sql))
{
$plugin->sql = $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->sql)), $this->placeholders);
}
else
{
unset($plugin->sql);
$plugin->add_sql = 0;
}
// add_sql_uninstall
if ($plugin->add_sql_uninstall == 1 && ComponentbuilderHelper::checkString($plugin->sql_uninstall))
{
$plugin->sql_uninstall = $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->sql_uninstall)), $this->placeholders);
}
else
{
unset($plugin->sql_uninstall);
$plugin->add_sql_uninstall = 0;
}
// update the URL of the update_server if set
if ($plugin->add_update_server == 1 && ComponentbuilderHelper::checkString($plugin->update_server_url))
{
$plugin->update_server_url = $this->setPlaceholders($this->setDynamicValues($plugin->update_server_url), $this->placeholders);
}
// add the update/sales server FTP details if that is the expected protocol
$serverArray = array('update_server', 'sales_server');
foreach ($serverArray as $server)
{
if ($plugin->{'add_' . $server} == 1 && is_numeric($plugin->{$server}) && $plugin->{$server} > 0)
{
// get the server protocol
$plugin->{$server . '_protocol'} = ComponentbuilderHelper::getVar('server', (int) $plugin->{$server}, 'id', 'protocol');
}
else
{
$plugin->{$server} = 0;
// only change this for sales server (update server can be added loacaly to the zip file)
if ('sales_server' === $server)
{
$plugin->{'add_' . $server} = 0;
}
$plugin->{$server . '_protocol'} = 0;
}
}
// rest globals // rest globals
$this->target = $_backup_target; $this->target = $_backup_target;
$this->lang = $_backup_lang; $this->lang = $_backup_lang;
$this->langPrefix = $_backup_langPrefix; $this->langPrefix = $_backup_langPrefix;
return $plugin; return $plugin;
} }
return false; return false;
} }
/**
* get the plugin xml template
*
* @return string
*
*/
public function getPluginXMLTemplate(&$plugin)
{
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= PHP_EOL . '<extension type="plugin" version="3.8" group="' . strtolower($plugin->group) . '" method="upgrade">';
$xml .= PHP_EOL . $this->_t(1) . '<name>' . $plugin->lang_prefix . '</name>';
$xml .= PHP_EOL . $this->_t(1) . '<creationDate>' . $this->hhh . 'BUILDDATE' . $this->hhh . '</creationDate>';
$xml .= PHP_EOL . $this->_t(1) . '<author>' . $this->hhh . 'AUTHOR' . $this->hhh . '</author>';
$xml .= PHP_EOL . $this->_t(1) . '<authorEmail>' . $this->hhh . 'AUTHOREMAIL' . $this->hhh . '</authorEmail>';
$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) . '<description>' . $plugin->lang_prefix . '_XML_DESCRIPTION</description>';
$xml .= $this->hhh . 'MAINXML' . $this->hhh;
$xml .= PHP_EOL . '</extension>';
return $xml;
}
/** /**
* check if we already have these ids in local memory * check if we already have these ids in local memory
* *

View File

@ -277,6 +277,13 @@ class Structure extends Get
*/ */
public $componentPath; public $componentPath;
/**
* The Dynamic paths
*
* @var array
*/
public $dynamicPaths = array();
/** /**
* The not new static items * The not new static items
* *
@ -356,7 +363,6 @@ class Structure extends Get
$this->componentSalesName = 'com_' . $this->componentData->sales_name . '__J' . $this->joomlaVersion; $this->componentSalesName = 'com_' . $this->componentData->sales_name . '__J' . $this->joomlaVersion;
$this->componentBackupName = 'com_' . $this->componentData->sales_name . '_v' . str_replace('.', '_', $this->componentData->component_version) . '__J' . $this->joomlaVersion; $this->componentBackupName = 'com_' . $this->componentData->sales_name . '_v' . str_replace('.', '_', $this->componentData->component_version) . '__J' . $this->joomlaVersion;
$this->componentFolderName = 'com_' . $this->componentData->name_code . '_v' . str_replace('.', '_', $this->componentData->component_version) . '__J' . $this->joomlaVersion; $this->componentFolderName = 'com_' . $this->componentData->name_code . '_v' . str_replace('.', '_', $this->componentData->component_version) . '__J' . $this->joomlaVersion;
// set component folder path // set component folder path
$this->componentPath = $this->compilerPath . '/' . $this->componentFolderName; $this->componentPath = $this->compilerPath . '/' . $this->componentFolderName;
// set the template path for custom // set the template path for custom
@ -364,7 +370,9 @@ class Structure extends Get
// make sure there is no old build // make sure there is no old build
$this->removeFolder($this->componentPath); $this->removeFolder($this->componentPath);
// load the libraries files/folders and url's // load the libraries files/folders and url's
$this->setLibaries(); $this->setLibraries();
// load the plugin files/folders and url's
$this->setPlugins();
// set the Joomla Version Data // set the Joomla Version Data
$this->joomlaVersionData = $this->setJoomlaVersionData(); $this->joomlaVersionData = $this->setJoomlaVersionData();
// Trigger Event: jcb_ce_onAfterSetJoomlaVersionData // Trigger Event: jcb_ce_onAfterSetJoomlaVersionData
@ -408,18 +416,198 @@ class Structure extends Get
return ''; return '';
} }
/**
* Build the Plugins files, folders, url's and config
*
* @return void
*
*/
private function setPlugins()
{
if (ComponentbuilderHelper::checkArray($this->componentData->joomla_plugins))
{
// Trigger Event: jcb_ce_onBeforeSetPlugins
$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))
{
// plugin path
$plugin->folder_path = $this->compilerPath . '/' . $plugin->folder_name;
// set the plugin paths
$this->dynamicPaths[$plugin->key] = $plugin->folder_path;
// make sure there is no old build
$this->removeFolder($plugin->folder_path);
// creat the main component folder
if (!JFolder::exists($plugin->folder_path))
{
JFolder::create($plugin->folder_path);
// count the folder created
$this->folderCount++;
$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);
$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');
$this->writeFile($fileDetails['path'], $this->getPluginXMLTemplate($plugin));
$this->newFiles[$plugin->key][] = $fileDetails;
// count the file created
$this->fileCount++;
// set install script if needed
if ($plugin->add_install_script)
{
$fileDetails = array('path' => $plugin->folder_path . '/script.php', 'name' => 'script.php', 'zip' => 'script.php');
$this->writeFile($fileDetails['path'], '<?php' . PHP_EOL . '// Script template' . PHP_EOL . $this->hhh . 'BOM' . $this->hhh . PHP_EOL . $this->hhh . 'INSTALLCLASS' . $this->hhh);
$this->newFiles[$plugin->key][] = $fileDetails;
// count the file created
$this->fileCount++;
}
// set readme if found
if ($plugin->addreadme)
{
$fileDetails = array('path' => $plugin->folder_path . '/README.md', 'name' => 'README.md', 'zip' => 'README.md');
$this->writeFile($fileDetails['path'], $plugin->readme);
$this->newFiles[$plugin->key][] = $fileDetails;
// count the file created
$this->fileCount++;
}
// set SQL stuff if needed
if ($plugin->add_sql || $plugin->add_sql_uninstall)
{
// create SQL folder
if (!JFolder::exists($plugin->folder_path . '/sql'))
{
JFolder::create($plugin->folder_path . '/sql');
// count the folder created
$this->folderCount++;
$this->indexHTML($plugin->folder_name . '/sql', $this->compilerPath);
}
// create mysql folder
if (!JFolder::exists($plugin->folder_path . '/sql/mysql'))
{
JFolder::create($plugin->folder_path . '/sql/mysql');
// count the folder created
$this->folderCount++;
$this->indexHTML($plugin->folder_name . '/sql/mysql', $this->compilerPath);
}
// now set the install file
if ($plugin->add_sql)
{
$this->writeFile($plugin->folder_path . '/sql/mysql/install.sql', $plugin->sql);
// count the file created
$this->fileCount++;
}
// now set the uninstall file
if ($plugin->add_sql_uninstall)
{
$this->writeFile($plugin->folder_path . '/sql/mysql/uninstall.sql', $plugin->sql_uninstall);
// count the file created
$this->fileCount++;
}
}
// creat the language folder
if (!JFolder::exists($plugin->folder_path . '/language'))
{
JFolder::create($plugin->folder_path . '/language');
// count the folder created
$this->folderCount++;
// also the lang tag
if (!JFolder::exists($plugin->folder_path . '/language/' . $this->langTag))
{
JFolder::create($plugin->folder_path . '/language/' . $this->langTag);
// count the folder created
$this->folderCount++;
}
}
// check if this lib has files
if (isset($plugin->files) && ComponentbuilderHelper::checkArray($plugin->files))
{
// add to component files
foreach ($plugin->files as $file)
{
// set the path finder
$file['target_type'] = $plugin->target_type;
$file['target_id'] = $plugin->id;
$this->componentData->files[] = $file;
}
}
// check if this lib has folders
if (isset($plugin->folders) && ComponentbuilderHelper::checkArray($plugin->folders))
{
// add to component folders
foreach ($plugin->folders as $folder)
{
// set the path finder
$folder['target_type'] = $plugin->target_type;
$folder['target_id'] = $plugin->id;
$this->componentData->folders[] = $folder;
}
}
// check if this plugin has urls
if (isset($plugin->urls) && ComponentbuilderHelper::checkArray($plugin->urls))
{
// add to component urls
foreach ($plugin->urls as $n => &$url)
{
// should we add the local folder
if (isset($url['type']) && $url['type'] > 1 && isset($url['url']) && ComponentbuilderHelper::checkString($url['url']))
{
// set file name
$fileName = basename($url['url']);
// get the file contents
$data = ComponentbuilderHelper::getFileContents($url['url']);
// build sub path
if (strpos($fileName, '.js') !== false)
{
$path = '/js';
}
elseif (strpos($fileName, '.css') !== false)
{
$path = '/css';
}
else
{
$path = '';
}
// create sub media path if not set
if (!JFolder::exists($plugin->folder_path .$path))
{
JFolder::create($plugin->folder_path . $path);
// count the folder created
$this->folderCount++;
$this->indexHTML($plugin->folder_name . $path, $this->compilerPath);
}
// set the path to plugin file
$url['path'] = $plugin->folder_path . $path . '/' . $fileName; // we need this for later
// write data to path
$this->writeFile($url['path'], $data);
// count the file created
$this->fileCount++;
}
}
}
}
}
}
}
/** /**
* Build the Libraries files, folders, url's and config * Build the Libraries files, folders, url's and config
* *
* @return void * @return void
* *
*/ */
private function setLibaries() private function setLibraries()
{ {
if (ComponentbuilderHelper::checkArray($this->libraries)) if (ComponentbuilderHelper::checkArray($this->libraries))
{ {
// Trigger Event: jcb_ce_onBeforeSetLibaries // Trigger Event: jcb_ce_onBeforeSetLibraries
$this->triggerEvent('jcb_ce_onBeforeSetLibaries', array(&$this->componentContext, &$this->libraries)); $this->triggerEvent('jcb_ce_onBeforeSetLibraries', array(&$this->componentContext, &$this->libraries));
// creat the main component folder // creat the main component folder
if (!JFolder::exists($this->componentPath)) if (!JFolder::exists($this->componentPath))
{ {
@ -519,7 +707,7 @@ class Structure extends Get
// only add if local // only add if local
if ($addLocalFolder) if ($addLocalFolder)
{ {
// add folder to ml of media folders // add folder to xml of media folders
$this->fileContentStatic[$this->hhh . 'EXSTRA_MEDIA_FOLDERS' . $this->hhh] .= PHP_EOL . $this->_t(2) . "<folder>" . $libFolder . "</folder>"; $this->fileContentStatic[$this->hhh . 'EXSTRA_MEDIA_FOLDERS' . $this->hhh] .= PHP_EOL . $this->_t(2) . "<folder>" . $libFolder . "</folder>";
} }
} }
@ -828,9 +1016,19 @@ class Structure extends Get
{ {
continue; continue;
} }
// set destination path // check if we have a target value set
$zipPath = str_replace('c0mp0n3nt/', '', $details->path); if (isset($details->_target))
$path = str_replace('c0mp0n3nt/', $this->componentPath . '/', $details->path); {
// set destination path
$zipPath = str_replace($details->_target['type'] . '/', '', $details->path);
$path = str_replace($details->_target['type'] . '/', $this->dynamicPaths[$details->_target['key']] . '/', $details->path);
}
else
{
// set destination path
$zipPath = str_replace('c0mp0n3nt/', '', $details->path);
$path = str_replace('c0mp0n3nt/', $this->componentPath . '/', $details->path);
}
// set the template folder path // set the template folder path
$templatePath = (isset($details->custom) && $details->custom) ? (($details->custom !== 'full') ? $this->templatePathCustom . '/' : '') : $this->templatePath . '/'; $templatePath = (isset($details->custom) && $details->custom) ? (($details->custom !== 'full') ? $this->templatePathCustom . '/' : '') : $this->templatePath . '/';
// set the final paths // set the final paths
@ -862,7 +1060,14 @@ class Structure extends Get
// store the new files // store the new files
if (!in_array($ftem, $this->notNew)) if (!in_array($ftem, $this->notNew))
{ {
$this->newFiles['static'][] = array('path' => $packageFullPath, 'name' => $new, 'zip' => $zipFullPath); if (isset($details->_target))
{
$this->newFiles[$details->_target['key']][] = array('path' => $packageFullPath, 'name' => $new, 'zip' => $zipFullPath);
}
else
{
$this->newFiles['static'][] = array('path' => $packageFullPath, 'name' => $new, 'zip' => $zipFullPath);
}
} }
// ensure we update this file if needed // ensure we update this file if needed
if (isset($this->updateFileContent[$ftem]) && $this->updateFileContent[$ftem]) if (isset($this->updateFileContent[$ftem]) && $this->updateFileContent[$ftem])
@ -889,40 +1094,44 @@ class Structure extends Get
$this->folderCount++; $this->folderCount++;
} }
} }
// check if we should add the dynamic folder moving script to the installer script // only add if no target found
$checker = array_values((array) explode('/', $zipFullPath)); if (!isset($details->_target))
// TODO <-- this may not be the best way, will keep an eye on this.
// We basicly only want to check if a folder is added that is not in the stdFolders array
if (isset($checker[0]) && ComponentbuilderHelper::checkString($checker[0]) && !in_array($checker[0], $this->stdFolders))
{ {
// check if we should add the dynamic folder moving script to the installer script // check if we should add the dynamic folder moving script to the installer script
if (!$this->setMoveFolders) $checker = array_values((array) explode('/', $zipFullPath));
// TODO <-- this may not be the best way, will keep an eye on this.
// We basicly only want to check if a folder is added that is not in the stdFolders array
if (isset($checker[0]) && ComponentbuilderHelper::checkString($checker[0]) && !in_array($checker[0], $this->stdFolders))
{ {
// add the setDynamicF0ld3rs() method to the install scipt.php file // check if we should add the dynamic folder moving script to the installer script
$this->setMoveFolders = true; if (!$this->setMoveFolders)
// set message that this was done (will still add a tutorial link later) {
$this->app->enqueueMessage(JText::_('<hr /><h3>Dynamic folder/s were detected.</h3>'), 'Notice'); // add the setDynamicF0ld3rs() method to the install scipt.php file
$this->app->enqueueMessage(JText::sprintf('A method (setDynamicF0ld3rs) was added to the install <b>script.php</b> of this package to insure that the folder/s are copied into the correct place when this componet is installed!'), 'Notice'); $this->setMoveFolders = true;
// set message that this was done (will still add a tutorial link later)
$this->app->enqueueMessage(JText::_('<hr /><h3>Dynamic folder/s were detected.</h3>'), 'Notice');
$this->app->enqueueMessage(JText::sprintf('A method (setDynamicF0ld3rs) was added to the install <b>script.php</b> of this package to insure that the folder/s are copied into the correct place when this componet is installed!'), 'Notice');
}
} }
} elseif (count($checker) == 2 && ComponentbuilderHelper::checkString($checker[0]) && in_array($checker[0], $this->stdFolders))
elseif (count($checker) == 2 && ComponentbuilderHelper::checkString($checker[0]) && in_array($checker[0], $this->stdFolders))
{
// set the target
$eNAME = 'FILES';
$ename = 'filename';
if ($details->type === 'folder')
{ {
$eNAME = 'FOLDERS'; // set the target
$ename = 'folder'; $eNAME = 'FILES';
$ename = 'filename';
if ($details->type === 'folder')
{
$eNAME = 'FOLDERS';
$ename = 'folder';
}
// set the tab
$eTab = $this->_t(2);
if ('admin' === $checker[0])
{
$eTab = $this->_t(3);
}
// set the xml file
$this->fileContentStatic[$this->hhh . 'EXSTRA_' . ComponentbuilderHelper::safeString($checker[0], 'U') . '_' . $eNAME . $this->hhh] .= PHP_EOL . $eTab . "<" . $ename . ">" . $checker[1] . "</" . $ename . ">";
} }
// set the tab
$eTab = $this->_t(2);
if ('admin' === $checker[0])
{
$eTab = $this->_t(3);
}
// set the xml file
$this->fileContentStatic[$this->hhh . 'EXSTRA_' . ComponentbuilderHelper::safeString($checker[0], 'U') . '_' . $eNAME . $this->hhh] .= PHP_EOL . $eTab . "<" . $ename . ">" . $checker[1] . "</" . $ename . ">";
} }
} }
return true; return true;
@ -1297,6 +1506,12 @@ class Structure extends Get
$pointer_tracker = 'h'; $pointer_tracker = 'h';
foreach ($this->componentData->folders as $custom) foreach ($this->componentData->folders as $custom)
{ {
// check type of target type
$_target_type = 'c0mp0n3nt';
if (isset($custom['target_type']))
{
$_target_type = $custom['target_type'];
}
// for good practice // for good practice
ComponentbuilderHelper::fixPath($custom, array('path', 'folder', 'folderpath')); ComponentbuilderHelper::fixPath($custom, array('path', 'folder', 'folderpath'));
// fix custom path // fix custom path
@ -1353,11 +1568,16 @@ class Structure extends Get
// set new folder to object // set new folder to object
$versionData->move->static->{$key_pointer} = new stdClass(); $versionData->move->static->{$key_pointer} = new stdClass();
$versionData->move->static->{$key_pointer}->naam = str_replace('//','/', $custom['folder']); $versionData->move->static->{$key_pointer}->naam = str_replace('//','/', $custom['folder']);
$versionData->move->static->{$key_pointer}->path = 'c0mp0n3nt/' . $custom['path']; $versionData->move->static->{$key_pointer}->path = $_target_type. '/' . $custom['path'];
$versionData->move->static->{$key_pointer}->rename = $rename; $versionData->move->static->{$key_pointer}->rename = $rename;
$versionData->move->static->{$key_pointer}->newName = $newname; $versionData->move->static->{$key_pointer}->newName = $newname;
$versionData->move->static->{$key_pointer}->type = 'folder'; $versionData->move->static->{$key_pointer}->type = 'folder';
$versionData->move->static->{$key_pointer}->custom = $customPath; $versionData->move->static->{$key_pointer}->custom = $customPath;
// set the target if type and id is found
if (isset($custom['target_id']) && isset($custom['target_type']))
{
$versionData->move->static->{$key_pointer}->_target = array('key' => $custom['target_id'] . '_' . $custom['target_type'], 'type' => $custom['target_type']);
}
} }
unset($this->componentData->folders); unset($this->componentData->folders);
unset($custom); unset($custom);
@ -1384,6 +1604,12 @@ class Structure extends Get
$pointer_tracker = 'h'; $pointer_tracker = 'h';
foreach ($this->componentData->files as $custom) foreach ($this->componentData->files as $custom)
{ {
// check type of target type
$_target_type = 'c0mp0n3nt';
if (isset($custom['target_type']))
{
$_target_type = $custom['target_type'];
}
// for good practice // for good practice
ComponentbuilderHelper::fixPath($custom, array('path', 'file', 'filepath')); ComponentbuilderHelper::fixPath($custom, array('path', 'file', 'filepath'));
// by default custom path is true // by default custom path is true
@ -1402,7 +1628,7 @@ class Structure extends Get
// triget fullpath // triget fullpath
$customPath = 'full'; $customPath = 'full';
} }
// make we have not duplicates // make sure we have not duplicates
$key_pointer = ComponentbuilderHelper::safeString($custom['file']) . '_g' . $pointer_tracker; $key_pointer = ComponentbuilderHelper::safeString($custom['file']) . '_g' . $pointer_tracker;
$pointer_tracker++; $pointer_tracker++;
// set new file to object // set new file to object
@ -1416,7 +1642,7 @@ class Structure extends Get
{ {
$pathInfo['dirname'] = trim($pathInfo['dirname'], '/'); $pathInfo['dirname'] = trim($pathInfo['dirname'], '/');
// set the info // set the info
$versionData->move->static->{$key_pointer}->path = 'c0mp0n3nt/' . $pathInfo['dirname']; $versionData->move->static->{$key_pointer}->path = $_target_type . '/' . $pathInfo['dirname'];
$versionData->move->static->{$key_pointer}->rename = 'new'; $versionData->move->static->{$key_pointer}->rename = 'new';
$versionData->move->static->{$key_pointer}->newName = $pathInfo['basename']; $versionData->move->static->{$key_pointer}->newName = $pathInfo['basename'];
} }
@ -1427,7 +1653,7 @@ class Structure extends Get
// get file array // get file array
$fileArray = (array) explode('/', $custom['file']); $fileArray = (array) explode('/', $custom['file']);
// set the info // set the info
$versionData->move->static->{$key_pointer}->path = 'c0mp0n3nt/' . $custom['path']; $versionData->move->static->{$key_pointer}->path = $_target_type . '/' . $custom['path'];
$versionData->move->static->{$key_pointer}->rename = 'new'; $versionData->move->static->{$key_pointer}->rename = 'new';
$versionData->move->static->{$key_pointer}->newName = end($fileArray); $versionData->move->static->{$key_pointer}->newName = end($fileArray);
} }
@ -1436,11 +1662,16 @@ class Structure extends Get
// fix custom path // fix custom path
$custom['path'] = ltrim($custom['path'], '/'); $custom['path'] = ltrim($custom['path'], '/');
// set the info // set the info
$versionData->move->static->{$key_pointer}->path = 'c0mp0n3nt/' . $custom['path']; $versionData->move->static->{$key_pointer}->path = $_target_type . '/' . $custom['path'];
$versionData->move->static->{$key_pointer}->rename = false; $versionData->move->static->{$key_pointer}->rename = false;
} }
$versionData->move->static->{$key_pointer}->type = 'file'; $versionData->move->static->{$key_pointer}->type = 'file';
$versionData->move->static->{$key_pointer}->custom = $customPath; $versionData->move->static->{$key_pointer}->custom = $customPath;
// set the target if type and id is found
if (isset($custom['target_id']) && isset($custom['target_type']))
{
$versionData->move->static->{$key_pointer}->_target = array('key' => $custom['target_id'] . '_' . $custom['target_type'], 'type' => $custom['target_type']);
}
// check if file should be updated // check if file should be updated
if (!isset($custom['notnew']) || $custom['notnew'] == 0 || $custom['notnew'] != 1) if (!isset($custom['notnew']) || $custom['notnew'] == 0 || $custom['notnew'] != 1)
{ {
@ -1466,17 +1697,22 @@ class Structure extends Get
* @return void * @return void
* *
*/ */
private function indexHTML($path) private function indexHTML($path, $root = 'component')
{ {
if ('component' === $root)
{
$root = $this->componentPath;
}
// use path if exist
if (strlen($path) > 0) if (strlen($path) > 0)
{ {
JFile::copy($this->templatePath . '/index.html', $this->componentPath . '/' . $path . '/index.html'); JFile::copy($this->templatePath . '/index.html', $root . '/' . $path . '/index.html');
// count the file created // count the file created
$this->fileCount++; $this->fileCount++;
} }
else else
{ {
JFile::copy($this->templatePath . '/index.html', $this->componentPath . '/index.html'); JFile::copy($this->templatePath . '/index.html', $root . '/index.html');
// count the file created // count the file created
$this->fileCount++; $this->fileCount++;
} }

View File

@ -14040,7 +14040,7 @@ class Interpretation extends Fields
if (isset($newxmlField->fieldXML)) if (isset($newxmlField->fieldXML))
{ {
$xmlField = dom_import_simplexml($newxmlField->fieldXML); $xmlField = dom_import_simplexml($newxmlField->fieldXML);
$xmlField = PHP_EOL . $this->_t(1) . "<!-- " . $newxmlField->comment . ' -->' . PHP_EOL . $this->_t(1) . $this->xmlPrettyPrint($xmlField, 'field'); $xmlField = PHP_EOL . $this->_t(1) . "<!--" . $this->setLine(__LINE__) . " " . $newxmlField->comment . ' -->' . PHP_EOL . $this->_t(1) . $this->xmlPrettyPrint($xmlField, 'field');
} }
} }
// make sure the xml is set and a string // make sure the xml is set and a string
@ -16293,4 +16293,209 @@ function vdm_dkim() {
return $matches[1]; return $matches[1];
} }
public function getPluginMainClass(&$plugin)
{
return
PHP_EOL . $plugin->head . PHP_EOL .
$plugin->comment . PHP_EOL . 'class ' .
$plugin->class_name . ' extends ' .
$plugin->extends . PHP_EOL . '{' . PHP_EOL .
$plugin->main_class_code . PHP_EOL .
"}" . PHP_EOL;
}
public function getPluginMainXML(&$plugin)
{
// tweak system to set stuff to the plugin domain
$_backup_target = $this->target;
$_backup_lang = $this->lang;
$_backup_langPrefix = $this->langPrefix;
$this->target = $plugin->key;
$this->lang = $plugin->key;
$this->langPrefix = $plugin->lang_prefix;
$view = '';
$viewType = 0;
// set the custom table key
$dbkey = 'yy';
// build the xml
$xml = '';
// build the config fields
$config_field = '';
foreach ($plugin->config_fields as $field)
{
// check the field builder type
if ($this->fieldBuilderType == 1)
{
// string manipulation
$xmlField = $this->setDynamicField($field, $view, $viewType, $plugin->lang_prefix, $plugin->key, $plugin->key, $this->globalPlaceholders, $dbkey, false);
}
else
{
// simpleXMLElement class
$newxmlField = $this->setDynamicField($field, $view, $viewType, $plugin->lang_prefix, $plugin->key, $plugin->key, $this->globalPlaceholders, $dbkey, false);
if (isset($newxmlField->fieldXML))
{
$xmlField = dom_import_simplexml($newxmlField->fieldXML);
$xmlField = PHP_EOL . $this->_t(2) . "<!--" . $this->setLine(__LINE__) . " " . $newxmlField->comment . ' -->' . PHP_EOL . $this->_t(1) . $this->xmlPrettyPrint($xmlField, 'field');
}
}
// make sure the xml is set and a string
if (isset($xmlField) && ComponentbuilderHelper::checkString($xmlField))
{
$config_field .= $xmlField;
}
}
// switch to add the xml
$addLang = false;
// now build the language files
if (isset($this->langContent[$plugin->key]))
{
$lang = array_map(function ($langstring, $placeholder)
{
return $placeholder . '="' . $langstring . '"';
}, $this->langContent[$plugin->key], array_keys($this->langContent[$plugin->key]));
// add to language file
$this->writeFile($plugin->folder_path . '/language/' . $this->langTag . '/' . $this->langTag . '.plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->name) . '.ini', implode(PHP_EOL, $lang));
$this->writeFile($plugin->folder_path . '/language/' . $this->langTag . '/' . $this->langTag . '.plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->name) . '.sys.ini', implode(PHP_EOL, $lang));
// set the line counter
$this->lineCount = $this->lineCount + count((array) $lang);
unset($lang);
// trigger the xml
$addLang = true;
}
// get all files and folders in plugin folder
$files = JFolder::files($plugin->folder_path);
$folders = JFolder::folders($plugin->folder_path);
// the files/folders to ignore
$ignore = array('sql', 'language', 'script.php', $plugin->file_name . '.xml', $plugin->file_name . '.php');
// should the scriptfile be added
if ($plugin->add_install_script)
{
$xml .= PHP_EOL . PHP_EOL . $this->_t(1) . '<!--' . $this->setLine(__LINE__) . ' Scripts to run on installation -->';
$xml .= PHP_EOL . $this->_t(1) . '<scriptfile>script.php</scriptfile>';
}
// should the sql install be added
if ($plugin->add_sql)
{
$xml .= PHP_EOL . PHP_EOL . $this->_t(1) . '<!--' . $this->setLine(__LINE__) . ' Runs on install; New in Joomla 1.5 -->';
$xml .= PHP_EOL . $this->_t(1) . '<install>';
$xml .= PHP_EOL . $this->_t(2) . '<sql>';
$xml .= PHP_EOL . $this->_t(3) . '<file driver="mysql" charset="utf8">sql/mysql/install.sql</file>';
$xml .= PHP_EOL . $this->_t(2) . '<sql>';
$xml .= PHP_EOL . $this->_t(1) . '</install>';
}
// should the sql uninstall be added
if ($plugin->add_sql_uninstall)
{
$xml .= PHP_EOL . PHP_EOL . $this->_t(1) . '<!--' . $this->setLine(__LINE__) . ' Runs on uninstall; New in Joomla 1.5 -->';
$xml .= PHP_EOL . $this->_t(1) . '<uninstall>';
$xml .= PHP_EOL . $this->_t(2) . '<sql>';
$xml .= PHP_EOL . $this->_t(3) . '<file driver="mysql" charset="utf8">sql/mysql/uninstall.sql</file>';
$xml .= PHP_EOL . $this->_t(2) . '<sql>';
$xml .= PHP_EOL . $this->_t(1) . '</uninstall>';
}
// should the language xml be added
if ($addLang)
{
$xml .= PHP_EOL . PHP_EOL . $this->_t(1) . '<!--' . $this->setLine(__LINE__) . ' Language files -->';
$xml .= PHP_EOL . $this->_t(1) . '<languages folder="language">';
$xml .= PHP_EOL . $this->_t(2) . '<language tag="en-GB">' . $this->langTag . '/' . $this->langTag . '.plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->name) . '.ini</language>';
$xml .= PHP_EOL . $this->_t(2) . '<language tag="en-GB">' . $this->langTag . '/' . $this->langTag . '.plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->name) . '.sys.ini</language>';
$xml .= PHP_EOL . $this->_t(1) . '</languages>';
}
// add the plugin files
$xml .= PHP_EOL . PHP_EOL . $this->_t(1) . '<!--' . $this->setLine(__LINE__) . ' Plugin files -->';
$xml .= PHP_EOL . $this->_t(1) . '<files>';
$xml .= PHP_EOL . $this->_t(2) . '<filename plugin="' . $plugin->file_name . '">' . $plugin->file_name . '.php</filename>';
// add other files found
if (ComponentbuilderHelper::checkArray($files))
{
foreach ($files as $file)
{
// only add what is not ignored
if (!in_array($file, $ignore))
{
$xml .= PHP_EOL . $this->_t(2) . '<filename>' . $file . '</filename>';
}
}
}
// add language folder
if ($addLang)
{
$xml .= PHP_EOL . $this->_t(2) . '<folder>language</folder>';
}
// add sql folder
if ($plugin->add_sql || $plugin->add_sql_uninstall)
{
$xml .= PHP_EOL . $this->_t(2) . '<folder>sql</folder>';
}
// add other files found
if (ComponentbuilderHelper::checkArray($folders))
{
foreach ($folders as $folder)
{
// only add what is not ignored
if (!in_array($folder, $ignore))
{
$xml .= PHP_EOL . $this->_t(2) . '<folder>' . $folder . '</folder>';
}
}
}
$xml .= PHP_EOL . $this->_t(1) . '</files>';
// now add the Config Params if needed
if (ComponentbuilderHelper::checkString($config_field))
{
$xml .= PHP_EOL . PHP_EOL . $this->_t(1) . '<!--' . $this->setLine(__LINE__) . ' Config parameter -->';
$xml .= PHP_EOL . $this->_t(1) . '<config>';
$xml .= PHP_EOL . $this->_t(1) . '<fields name="params">';
$xml .= PHP_EOL . $this->_t(1) . '<fieldset name="basic">';
$xml .= $config_field;
$xml .= PHP_EOL . $this->_t(1) . '</fieldset>';
$xml .= PHP_EOL . $this->_t(1) . '</fields>';
$xml .= PHP_EOL . $this->_t(1) . '</config>';
}
// set update server if found
if ($plugin->add_update_server)
{
$xml .= PHP_EOL . PHP_EOL . $this->_t(1) . '<!--' . $this->setLine(__LINE__) . ' Update servers -->';
$xml .= PHP_EOL . $this->_t(1) . '<updateservers>';
$xml .= PHP_EOL . $this->_t(2) . '<server type="extension" priority="1" name="' . $plugin->official_name . '">' . $plugin->update_server_url . '</server>';
$xml .= PHP_EOL . $this->_t(1) . '</updateservers>';
}
// rest globals
$this->target = $_backup_target;
$this->lang = $_backup_lang;
$this->langPrefix = $_backup_langPrefix;
return $xml;
}
public function getPluginInstallClass(&$plugin)
{
// yes we are adding it
$script = PHP_EOL . '/**';
$script .= PHP_EOL . ' * ' . $plugin->name . ' script file.';
$script .= PHP_EOL . ' *';
$script .= PHP_EOL . ' * @package ' . $plugin->class_name;
$script .= PHP_EOL . ' */';
$script .= PHP_EOL . 'class ' . $plugin->installer_class_name;
$script .= PHP_EOL . '{';
// add PHP in plugin install
$addScriptMethods = array('php_preflight', 'php_postflight', 'php_method');
$addScriptTypes = array('install', 'update', 'uninstall');
foreach ($addScriptMethods as $scriptMethod)
{
foreach ($addScriptTypes as $scriptType)
{
if (isset($plugin->{'add_' . $scriptMethod . '_' . $scriptType}) && $plugin->{'add_' . $scriptMethod . '_' . $scriptType} == 1 && ComponentbuilderHelper::checkString($plugin->{$scriptMethod . '_' . $scriptType}))
{
// (TODO) must still finish
$script .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' This part of the new plugin area is not ready yet, soon!';
}
}
}
$script .= PHP_EOL . '}' . PHP_EOL;
return $script;
}
} }

View File

@ -1033,7 +1033,28 @@ class Infusion extends Interpretation
} }
// Trigger Event: jcb_ce_onAfterBuildFilesContent // Trigger Event: jcb_ce_onAfterBuildFilesContent
$this->triggerEvent('jcb_ce_onAfterBuildFilesContent', array(&$this->componentContext, &$this->componentData, &$this->fileContentStatic, &$this->fileContentDynamic, &$this->placeholders, &$this->hhh)); $this->triggerEvent('jcb_ce_onAfterBuildFilesContent', array(&$this->componentContext, &$this->componentData, &$this->fileContentStatic, &$this->fileContentDynamic, &$this->placeholders, &$this->hhh));// Trigger Event: jcb_ce_onBeforeSetPlugins
// infuze plugin data if set
if (ComponentbuilderHelper::checkArray($this->componentData->joomla_plugins))
{
foreach ($this->componentData->joomla_plugins as $plugin)
{
if (ComponentbuilderHelper::checkObject($plugin))
{
// MAINCLASS
$this->fileContentDynamic[$plugin->key][$this->hhh . 'MAINCLASS' . $this->hhh] = $this->getPluginMainClass($plugin);
// only add install script if needed
if ($plugin->add_install_script)
{
// INSTALLCLASS
$this->fileContentDynamic[$plugin->key][$this->hhh . 'INSTALLCLASS' . $this->hhh] = $this->getPluginInstallClass($plugin);
}
// MAINXML
$this->fileContentDynamic[$plugin->key][$this->hhh . 'MAINXML' . $this->hhh] = $this->getPluginMainXML($plugin);
}
}
}
return true; return true;
} }

View File

@ -1081,7 +1081,7 @@ abstract class ComponentbuilderHelper
* @return void * @return void
* *
*/ */
public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less')) public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true)
{ {
if (JFolder::exists($folder)) if (JFolder::exists($folder))
{ {
@ -1089,11 +1089,25 @@ abstract class ComponentbuilderHelper
$joomla = getcwd(); $joomla = getcwd();
// we are changing the working directory to the componet path // we are changing the working directory to the componet path
chdir($folder); chdir($folder);
// get the files // make sure we have file type filter
foreach ($fileTypes as $type) if (self::checkArray($fileTypes))
{
// get the files
foreach ($fileTypes as $type)
{
// get a list of files in the current directory tree
$files[] = JFolder::files('.', $type, $recurse, $full);
}
}
elseif (self::checkString($fileTypes))
{ {
// get a list of files in the current directory tree // get a list of files in the current directory tree
$files[] = JFolder::files('.', $type, true, true); $files[] = JFolder::files('.', $fileTypes, $recurse, $full);
}
else
{
// get a list of files in the current directory tree
$files[] = JFolder::files('.', '.', $recurse, $full);
} }
// change back to Joomla working directory // change back to Joomla working directory
chdir($joomla); chdir($joomla);

View File

@ -6098,8 +6098,8 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_SAVE_WARNING="Alias alread
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_STATUS="Status" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_STATUS="Status"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_TYPE_DESCRIPTION="way url is used" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_TYPE_DESCRIPTION="way url is used"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_TYPE_LABEL="Type" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_TYPE_LABEL="Type"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_URL_DESCRIPTION="Enter URL to library <b>file</b>." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_URL_DESCRIPTION="Enter URL to <b>file</b>."
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_URL_HINT="http://www.example.com/lib.js" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_URL_HINT="http://www.example.com/file.js"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_URL_LABEL="URL" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_URL_LABEL="URL"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_URL_MESSAGE="Error! Please add url here." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_URL_MESSAGE="Error! Please add url here."
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_VERSION_DESC="A count of the number of times this Joomla Plugin Files, Folders & URLs has been revised." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_VERSION_DESC="A count of the number of times this Joomla Plugin Files, Folders & URLs has been revised."
@ -6846,8 +6846,8 @@ COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_SAVE_WARNING="Alias already exis
COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_STATUS="Status" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_STATUS="Status"
COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_TYPE_DESCRIPTION="way url is used" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_TYPE_DESCRIPTION="way url is used"
COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_TYPE_LABEL="Type" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_TYPE_LABEL="Type"
COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_DESCRIPTION="Enter URL to library <b>file</b>." COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_DESCRIPTION="Enter URL to <b>file</b>."
COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_HINT="http://www.example.com/lib.js" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_HINT="http://www.example.com/file.js"
COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_LABEL="URL" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_LABEL="URL"
COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_MESSAGE="Error! Please add url here." COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_MESSAGE="Error! Please add url here."
COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_VERSION_DESC="A count of the number of times this Library Files, Folders & URLs has been revised." COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_VERSION_DESC="A count of the number of times this Library Files, Folders & URLs has been revised."

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>29th July, 2019</creationDate> <creationDate>4th 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>

View File

@ -1081,7 +1081,7 @@ abstract class ComponentbuilderHelper
* @return void * @return void
* *
*/ */
public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less')) public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true)
{ {
if (JFolder::exists($folder)) if (JFolder::exists($folder))
{ {
@ -1089,11 +1089,25 @@ abstract class ComponentbuilderHelper
$joomla = getcwd(); $joomla = getcwd();
// we are changing the working directory to the componet path // we are changing the working directory to the componet path
chdir($folder); chdir($folder);
// get the files // make sure we have file type filter
foreach ($fileTypes as $type) if (self::checkArray($fileTypes))
{
// get the files
foreach ($fileTypes as $type)
{
// get a list of files in the current directory tree
$files[] = JFolder::files('.', $type, $recurse, $full);
}
}
elseif (self::checkString($fileTypes))
{ {
// get a list of files in the current directory tree // get a list of files in the current directory tree
$files[] = JFolder::files('.', $type, true, true); $files[] = JFolder::files('.', $fileTypes, $recurse, $full);
}
else
{
// get a list of files in the current directory tree
$files[] = JFolder::files('.', '.', $recurse, $full);
} }
// change back to Joomla working directory // change back to Joomla working directory
chdir($joomla); chdir($joomla);