Editors xtd #871
@ -221,6 +221,13 @@
|
||||
}
|
||||
},
|
||||
"dynamic": {
|
||||
"plugin": {
|
||||
"1.0.0.sql": {
|
||||
"path": "P|uG!n/sql/mysql/updates",
|
||||
"rename": "1.0.0",
|
||||
"type": "sql_update"
|
||||
}
|
||||
},
|
||||
"admin": {
|
||||
"whmcs.php": {
|
||||
"path": "c0mp0n3nt/admin",
|
||||
|
@ -580,7 +580,7 @@ class Compiler extends Infusion
|
||||
{
|
||||
$this->setFileContent(
|
||||
$plugin_file['name'], $plugin_file['path'],
|
||||
$bom, $plugin->key
|
||||
$bom, ['plugin_key' => $plugin->key, 'view' => $plugin_file['view']]
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -633,6 +633,12 @@ class Compiler extends Infusion
|
||||
*/
|
||||
protected function setFileContent(&$name, &$path, &$bom, $view = null)
|
||||
{
|
||||
$main_view= null;
|
||||
if (is_array($view))
|
||||
{
|
||||
$main_view= $view['view'];
|
||||
$view= $view['plugin_key'];
|
||||
}
|
||||
// Trigger Event: jcb_ce_onBeforeSetFileContent
|
||||
$this->triggerEvent(
|
||||
'jcb_ce_onBeforeSetFileContent',
|
||||
@ -667,9 +673,20 @@ class Compiler extends Infusion
|
||||
// set the dynamic answer
|
||||
if ($view)
|
||||
{
|
||||
$answer = $this->setPlaceholders(
|
||||
$answer, $this->fileContentDynamic[$view], 3
|
||||
);
|
||||
if ($main_view)
|
||||
{
|
||||
$answer = $this->setPlaceholders(
|
||||
$answer, $this->fileContentDynamic[$view][$main_view], 3
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$answer = $this->setPlaceholders(
|
||||
$answer, $this->fileContentDynamic[$view], 3
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// check if this file needs extra care :)
|
||||
if (isset($this->updateFileContent[$path]))
|
||||
|
@ -10149,9 +10149,7 @@ class Get
|
||||
// set lang prefix
|
||||
$plugin->lang_prefix = $this->langPrefix;
|
||||
// set plugin class name
|
||||
$plugin->class_name = 'Plg' . ucfirst($plugin->group) . ucfirst(
|
||||
$plugin->code_name
|
||||
);
|
||||
$plugin->class_name = ComponentbuilderHelper::createPluginClassName($plugin->group, $plugin->code_name);
|
||||
// set plugin install class name
|
||||
$plugin->installer_class_name = 'plg' . ucfirst($plugin->group)
|
||||
. ucfirst($plugin->code_name) . 'InstallerScript';
|
||||
@ -10701,6 +10699,15 @@ class Get
|
||||
$plugin->{$server . '_protocol'} = 0;
|
||||
}
|
||||
}
|
||||
$plugin->version_update = (isset($plugin->version_update)
|
||||
&& ComponentbuilderHelper::checkJson($plugin->version_update))
|
||||
? json_decode($plugin->version_update, true) : null;
|
||||
if (ComponentbuilderHelper::checkArray($plugin->version_update))
|
||||
{
|
||||
$plugin->version_update = array_values(
|
||||
$plugin->version_update
|
||||
);
|
||||
}
|
||||
// set the update server stuff (TODO)
|
||||
// update_server_xml_path
|
||||
// update_server_xml_file_name
|
||||
|
@ -1444,7 +1444,8 @@ class Structure extends Get
|
||||
}
|
||||
}
|
||||
// set SQL stuff if needed
|
||||
if ($plugin->add_sql || $plugin->add_sql_uninstall)
|
||||
|
||||
if ($plugin->add_sql || $plugin->add_sql_uninstall || $plugin->version_update)
|
||||
{
|
||||
// create SQL folder
|
||||
$this->createFolder($plugin->folder_path . '/sql');
|
||||
@ -2764,7 +2765,7 @@ class Structure extends Get
|
||||
*
|
||||
*/
|
||||
public function buildDynamique($target, $type, $fileName = false,
|
||||
$config = false
|
||||
$config = false, $plugin= null
|
||||
)
|
||||
{
|
||||
// did we build the files (any number)
|
||||
@ -2803,6 +2804,13 @@ class Structure extends Get
|
||||
'c0mp0n3nt/', $this->componentPath . '/', $path
|
||||
);
|
||||
}
|
||||
elseif (strpos($path, 'P|uG!n') !== false)
|
||||
{
|
||||
$zipPath = str_replace('P|uG!n/', '', $path);
|
||||
$path = str_replace(
|
||||
'P|uG!n/', $plugin->folder_path . '/', $path
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->app->enqueueMessage(
|
||||
@ -2818,7 +2826,10 @@ class Structure extends Get
|
||||
if (!Folder::exists($path))
|
||||
{
|
||||
Folder::create($path);
|
||||
$this->indexHTML($zipPath);
|
||||
if (!empty($plugin))
|
||||
$this->indexHTML($zipPath,'plugin', $plugin);
|
||||
else
|
||||
$this->indexHTML($zipPath);
|
||||
// count the folder created
|
||||
$this->folderCount++;
|
||||
}
|
||||
@ -2865,8 +2876,14 @@ class Structure extends Get
|
||||
{
|
||||
$newFIle['config'] = $config;
|
||||
}
|
||||
// store the new files
|
||||
$this->newFiles['dynamic'][$name][] = $newFIle;
|
||||
// store the new files
|
||||
if (!empty($plugin))
|
||||
$this->newFiles[$plugin->key][$name] = $newFIle;
|
||||
else
|
||||
$this->newFiles['dynamic'][$name][] = $newFIle;
|
||||
|
||||
|
||||
|
||||
// we have build atleast one
|
||||
$build_status = true;
|
||||
}
|
||||
@ -3196,12 +3213,16 @@ class Structure extends Get
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
private function indexHTML($path, $root = 'component')
|
||||
private function indexHTML($path, $root = 'component', $plugin= null)
|
||||
{
|
||||
if ('component' === $root)
|
||||
{
|
||||
$root = $this->componentPath . '/';
|
||||
}
|
||||
if ('plugin' === $root)
|
||||
{
|
||||
$root = $plugin->folder_path . '/';
|
||||
}
|
||||
// use path if exist
|
||||
if (strlen($path) > 0)
|
||||
{
|
||||
|
@ -1095,6 +1095,43 @@ class Interpretation extends Fields
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set plugin Version Controller
|
||||
*/
|
||||
public function setPluginVersionController(&$plugin)
|
||||
{
|
||||
if (ComponentbuilderHelper::checkArray(
|
||||
$plugin->version_update
|
||||
))
|
||||
{
|
||||
$updateXML = array();
|
||||
|
||||
|
||||
// add the dynamic sql switch
|
||||
$addDynamicSQL = true;
|
||||
$addActive = true;
|
||||
if (ComponentbuilderHelper::checkArray(
|
||||
$plugin->version_update
|
||||
))
|
||||
{
|
||||
|
||||
foreach (
|
||||
$plugin->version_update as $nr => &$update
|
||||
)
|
||||
{
|
||||
$this->setPluginUpdateXMLSQL($update, $updateXML, $addDynamicSQL, $plugin);
|
||||
|
||||
if ($update['version']
|
||||
== $plugin->plugin_version)
|
||||
{
|
||||
$addActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* set Version Controller
|
||||
*/
|
||||
@ -1307,6 +1344,40 @@ class Interpretation extends Fields
|
||||
$this->setUpdateXMLSQL($update_, $updateXML, $addDynamicSQL);
|
||||
}
|
||||
|
||||
/**
|
||||
* set plugin Update XML SQL
|
||||
*
|
||||
* @param array $update
|
||||
* @param array $updateXML
|
||||
* @param boolean $addDynamicSQL
|
||||
*/
|
||||
public function setPluginUpdateXMLSQL(&$update, &$updateXML, &$addDynamicSQL, $plugin)
|
||||
{
|
||||
// ensure version naming is correct
|
||||
$update['version'] = preg_replace('/[^0-9.]+/', '', $update['version']);
|
||||
// setup SQL
|
||||
if (ComponentbuilderHelper::checkString($update['mysql']))
|
||||
{
|
||||
$update['mysql'] = $this->setPlaceholders(
|
||||
$update['mysql'], $this->placeholders
|
||||
);
|
||||
}
|
||||
|
||||
// setup import files
|
||||
if ($update['version'] != $plugin->plugin_version)
|
||||
{
|
||||
$name = ComponentbuilderHelper::safeString($update['version']);
|
||||
$target = array('plugin' => $name);
|
||||
$this->buildDynamique($target, 'sql_update', $update['version'], false, $plugin);
|
||||
$this->fileContentDynamic[$plugin->key][$name . '_'
|
||||
. $update['version']][$this->hhh . 'UPDATE_VERSION_MYSQL'
|
||||
. $this->hhh]
|
||||
= $update['mysql'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set Update XML SQL
|
||||
*
|
||||
@ -28853,6 +28924,19 @@ function vdm_dkim() {
|
||||
$xml .= PHP_EOL . $this->_t(2) . '</sql>';
|
||||
$xml .= PHP_EOL . $this->_t(1) . '</uninstall>';
|
||||
}
|
||||
// should the sql update be added
|
||||
if ($plugin->version_update)
|
||||
{
|
||||
$xml .= PHP_EOL . PHP_EOL . $this->_t(1) . '<!--' . $this->setLine(
|
||||
__LINE__
|
||||
) . ' Runs on update; New in Joomla 1.5 -->';
|
||||
$xml .= PHP_EOL . $this->_t(1) . '<update>';
|
||||
$xml .= PHP_EOL . $this->_t(2) . '<schemas>';
|
||||
$xml .= PHP_EOL . $this->_t(3)
|
||||
. '<schemapath type="mysql">sql/mysql/updates/</schemapath>';
|
||||
$xml .= PHP_EOL . $this->_t(2) . '</schemas>';
|
||||
$xml .= PHP_EOL . $this->_t(1) . '</update>';
|
||||
}
|
||||
// should the language xml be added
|
||||
if (ComponentbuilderHelper::checkArray($addLang))
|
||||
{
|
||||
@ -28903,7 +28987,7 @@ function vdm_dkim() {
|
||||
$xml .= PHP_EOL . $this->_t(2) . '<folder>language</folder>';
|
||||
}
|
||||
// add sql folder
|
||||
if ($plugin->add_sql || $plugin->add_sql_uninstall)
|
||||
if ($plugin->add_sql || $plugin->add_sql_uninstall || $plugin->version_update)
|
||||
{
|
||||
$xml .= PHP_EOL . $this->_t(2) . '<folder>sql</folder>';
|
||||
}
|
||||
|
@ -2454,6 +2454,9 @@ class Infusion extends Interpretation
|
||||
. 'INSTALLCLASS' . $this->hhh]
|
||||
= $this->getExtensionInstallClass($plugin);
|
||||
}
|
||||
|
||||
$this->setPluginVersionController($plugin);
|
||||
|
||||
// FIELDSET
|
||||
if (isset($plugin->form_files)
|
||||
&& ComponentbuilderHelper::checkArray(
|
||||
|
@ -6589,6 +6589,20 @@ abstract class ComponentbuilderHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* create plugin class name
|
||||
*/
|
||||
public static function createPluginClassName($group, $code_name)
|
||||
{
|
||||
// editors-xtd group plugins must have a class with plgButton<PluginName> structure
|
||||
if ($group == 'editors-xtd')
|
||||
$group= 'Button';
|
||||
|
||||
return 'Plg' . ucfirst($group) . ucfirst(
|
||||
$code_name
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* get a plugin fields IDs
|
||||
*/
|
||||
|
@ -6624,6 +6624,21 @@ abstract class ComponentbuilderHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* create plugin class name
|
||||
*/
|
||||
public static function createPluginClassName($group, $code_name)
|
||||
{
|
||||
// editors-xtd group plugins must have a class with plgButton<PluginName> structure
|
||||
if ($group == 'editors-xtd')
|
||||
$group= 'Button';
|
||||
|
||||
return 'Plg' . ucfirst($group) . ucfirst(
|
||||
$code_name
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* get an admin view fields IDs
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user