Fixed missing placeholder strings for views in compiler

This commit is contained in:
2018-01-19 12:27:47 +02:00
parent a310efaf61
commit e6466474b1
12 changed files with 814 additions and 1524 deletions

View File

@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com)
+ *First Build*: 30th April, 2015
+ *Last Build*: 17th January, 2018
+ *Last Build*: 19th January, 2018
+ *Version*: 2.6.12
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **181174**
+ *Line count*: **180462**
+ *Field count*: **1573**
+ *File count*: **1160**
+ *Folder count*: **186**

View File

@ -261,8 +261,6 @@
<action name="joomla_component.edit.own" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_OWN" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_OWN_DESC" />
<action name="joomla_component.edit.state" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_STATE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_STATE_DESC" />
<action name="joomla_component.version" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION_DESC" />
<action name="joomla_component.export" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EXPORT" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EXPORT_DESC" />
<action name="joomla_component.import" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_IMPORT" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_IMPORT_DESC" />
<action name="joomla_component.submenu" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU_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" />

View File

@ -65,7 +65,7 @@ class Compiler extends Infusion
{
// to check the compiler speed
$this->time_start = microtime(true);
// first we run the perent constructor
// first we run the perent constructors
if (parent::__construct($config))
{
// set temp directory

View File

@ -375,33 +375,19 @@ class Fields extends Structure
/**
* set the Field set of a view
*
* @param array $view The view data
* @param string $component The component name
* @param array $view The view data
* @param string $component The component name
* @param string $viewName The single view name
* @param string $listViewName The list view name
*
* @return string The fields set in xml
*
*/
public function setFieldSet($view, $component)
public function setFieldSet($view, $component, $viewName, $listViewName)
{
// setup the fieldset of this view
if (isset($view['settings']->fields) && ComponentbuilderHelper::checkArray($view['settings']->fields))
{
// setup the list view and single view name
$listViewName = ComponentbuilderHelper::safeString($view['settings']->name_list);
$viewName = ComponentbuilderHelper::safeString($view['settings']->name_single);
// set some place holder for this view
$this->placeholders['###view###'] = $viewName;
$this->placeholders['###VIEW###'] = strtoupper($viewName);
$this->placeholders['###View###'] = ucfirst($viewName);
$this->placeholders['[[[view]]]'] = $this->placeholders['###view###'];
$this->placeholders['[[[VIEW]]]'] = $this->placeholders['###VIEW###'];
$this->placeholders['[[[View]]]'] = $this->placeholders['###View###'];
$this->placeholders['###views###'] = $listViewName;
$this->placeholders['###VIEWS###'] = strtoupper($listViewName);
$this->placeholders['###Views###'] = ucfirst($listViewName);
$this->placeholders['[[[views]]]'] = $this->placeholders['###views###'];
$this->placeholders['[[[VIEWS]]]'] = $this->placeholders['###VIEWS###'];
$this->placeholders['[[[Views]]]'] = $this->placeholders['###Views###'];
// add metadata to the view
if (isset($view['metadata']) && $view['metadata'])
{
@ -753,8 +739,6 @@ class Fields extends Structure
// count the static field created
$this->fieldCount++;
}
// just to be safe, lets clear the view placeholders
$this->clearFromPlaceHolders('view');
// return the set
return $this->xmlPrettyPrint($XML, 'fieldset');
}

View File

@ -3339,8 +3339,7 @@ class Interpretation extends Fields
$path = '/administrator/components/com_' . $this->fileContentStatic['###component###'] . '/assets/js/' . $view['settings']->code . '.js';
}
// add script to file
$this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_JAVASCRIPT_FILE###']
= $this->setPlaceholders($view['settings']->javascript_file, $this->placeholders);
$this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_JAVASCRIPT_FILE###'] = $this->setPlaceholders($view['settings']->javascript_file, $this->placeholders);
// add script to view
return PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Add View JavaScript File" . PHP_EOL . "\t\t" . $this->setIncludeLibScript($path);
}
@ -8104,36 +8103,10 @@ class Interpretation extends Fields
$query .= PHP_EOL . "\t\treturn false;";
$query .= PHP_EOL . "\t}";
// set some placeholders just incase
if (!isset($this->placeholders['###view###']) && !isset($this->placeholders['[[[view]]]']))
{
$this->placeholders['###view###'] = $viewName_single;
$this->placeholders['[[[view]]]'] = $viewName_single;
$_viewSet = true;
}
if (!isset($this->placeholders['###views###']) && !isset($this->placeholders['[[[views]]]']))
{
$this->placeholders['###views###'] = $viewName_list;
$this->placeholders['[[[views]]]'] = $viewName_list;
$_viewsSet = true;
}
// add getExImPortHeaders
$query .= $this->getCustomScriptBuilder('php_import_headers', 'import_' . $viewName_list, PHP_EOL . PHP_EOL, null, true,
$query .= $this->getCustomScriptBuilder('php_import_headers', 'import_' . $viewName_list, PHP_EOL . PHP_EOL, null, true,
// set a default script for those with no custom script
PHP_EOL . PHP_EOL . $this->setPlaceholders(ComponentbuilderHelper::getImportScripts('headers'), $this->placeholders));
// remove place holders if not needed (to not be suprized)
if (isset($_viewSet))
{
unset($this->placeholders['###view###']);
unset($this->placeholders['[[[view]]]']);
}
if (isset($_viewsSet))
{
unset($this->placeholders['###views###']);
unset($this->placeholders['[[[views]]]']);
}
}
return $query;
}

View File

@ -236,14 +236,25 @@ class Infusion extends Interpretation
// start dynamic build
foreach ($this->componentData->admin_views as $view)
{
// just to be safe, lets clear the view placeholders
$this->clearFromPlaceHolders('view');
// set the target
$this->target = 'admin';
$this->lang = 'admin';
// set main keys
$viewName_single = ComponentbuilderHelper::safeString($view['settings']->name_single);
$viewName_list = ComponentbuilderHelper::safeString($view['settings']->name_list);
// set single view
if (isset($view['settings']->name_single))
{
$viewName_single = ComponentbuilderHelper::safeString($view['settings']->name_single);
}
// set list view
if (isset($view['settings']->name_list))
{
$viewName_list = ComponentbuilderHelper::safeString($view['settings']->name_list);
}
// set the view placeholders
$this->setViewPlaceholders($view['settings']);
// set site edit view array
if (isset($view['edit_create_site_view']) && $view['edit_create_site_view'])
{
@ -258,36 +269,14 @@ class Infusion extends Interpretation
// set view array
$viewarray[] = "\t\t\t\t'" . $viewName_single . "' => '" . $viewName_list . "'";
// set the view names
if ($view['settings']->name_single != 'null')
if (isset($view['settings']->name_single) && $view['settings']->name_single != 'null')
{
// ###VIEW### <<<DYNAMIC>>>
$viewName_u = ComponentbuilderHelper::safeString($view['settings']->name_single, 'U');
$this->fileContentDynamic[$viewName_single]['###VIEW###'] = $viewName_u;
$this->fileContentDynamic[$viewName_list]['###VIEW###'] = $viewName_u;
// ###View### <<<DYNAMIC>>>
$viewName_f = ComponentbuilderHelper::safeString($view['settings']->name_single, 'F');
$this->fileContentDynamic[$viewName_single]['###View###'] = $viewName_f;
$this->fileContentDynamic[$viewName_list]['###View###'] = $viewName_f;
// ###view### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single]['###view###'] = $viewName_single;
$this->fileContentDynamic[$viewName_list]['###view###'] = $viewName_single;
// set some place holder for the views
$this->placeholders['###view###'] = $viewName_single;
$this->placeholders['###View###'] = $viewName_f;
$this->placeholders['###VIEW###'] = $viewName_u;
$this->placeholders['[[[view]]]'] = $viewName_single;
$this->placeholders['[[[View]]]'] = $viewName_f;
$this->placeholders['[[[VIEW]]]'] = $viewName_u;
// set license per view if needed
$this->setLockLicensePer($viewName_single, $this->target);
$this->setLockLicensePer($viewName_list, $this->target);
// ###FIELDSETS### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single]['###FIELDSETS###'] = $this->setFieldSet($view, $this->fileContentStatic['###component###']);
$this->fileContentDynamic[$viewName_single]['###FIELDSETS###'] = $this->setFieldSet($view, $this->fileContentStatic['###component###'], $viewName_single, $viewName_list);
// ###ACCESSCONTROL### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single]['###ACCESSCONTROL###'] = $this->setFieldSetAccessControl($viewName_single);
@ -391,35 +380,15 @@ class Infusion extends Interpretation
}
}
// set the views names
if ($view['settings']->name_list != 'null')
if (isset($view['settings']->name_list) && $view['settings']->name_list != 'null')
{
$this->lang = 'admin';
// ###VIEWS### <<<DYNAMIC>>>
$viewsName_u = ComponentbuilderHelper::safeString($view['settings']->name_list, 'U');
$this->fileContentDynamic[$viewName_list]['###VIEWS###'] = $viewsName_u;
$this->fileContentDynamic[$viewName_single]['###VIEWS###'] = $viewsName_u;
// ###Views### <<<DYNAMIC>>>
$viewsName_f = ComponentbuilderHelper::safeString($view['settings']->name_list, 'F');
$this->fileContentDynamic[$viewName_list]['###Views###'] = $viewsName_f;
$this->fileContentDynamic[$viewName_single]['###Views###'] = $viewsName_f;
// ###views### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_list]['###views###'] = $viewName_list;
$this->fileContentDynamic[$viewName_single]['###views###'] = $viewName_list;
// ###ICOMOON### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_list]['###ICOMOON###'] = $view['icomoon'];
// set some place holder for the views
$this->placeholders['###views###'] = $viewName_list;
$this->placeholders['###Views###'] = $viewsName_f;
$this->placeholders['###VIEWS###'] = $viewsName_u;
$this->placeholders['[[[views]]]'] = $viewName_list;
$this->placeholders['[[[Views]]]'] = $viewsName_f;
$this->placeholders['[[[VIEWS]]]'] = $viewsName_u;
// set the export/import option
if (isset($view['port']) && $view['port'])
if (isset($view['port']) && $view['port'] || 1 == $view['settings']->add_custom_import)
{
$this->eximportView[$viewName_list] = true;
if (1 == $view['settings']->add_custom_import)
@ -1083,6 +1052,82 @@ class Infusion extends Interpretation
return false;
}
/**
* Set the view place holders to global scope
*
* @param object $view The view settings
*
* @ return void
*/
protected function setViewPlaceholders(&$view)
{
// just to be safe, lets clear previous view placeholders
$this->clearFromPlaceHolders('view');
// ###VIEW### <<<DYNAMIC>>>
if (isset($view->name_single))
{
// set main keys
$viewName_single = ComponentbuilderHelper::safeString($view->name_single);
$viewName_u = ComponentbuilderHelper::safeString($view->name_single, 'U');
$viewName_f = ComponentbuilderHelper::safeString($view->name_single, 'F');
// set some place holder for the views
$this->placeholders['###view###'] = $viewName_single;
$this->placeholders['###View###'] = $viewName_f;
$this->placeholders['###VIEW###'] = $viewName_u;
$this->placeholders['[[[view]]]'] = $viewName_single;
$this->placeholders['[[[View]]]'] = $viewName_f;
$this->placeholders['[[[VIEW]]]'] = $viewName_u;
}
// ###VIEWS### <<<DYNAMIC>>>
if (isset($view->name_list))
{
$viewName_list = ComponentbuilderHelper::safeString($view->name_list);
$viewsName_u = ComponentbuilderHelper::safeString($view->name_list, 'U');
$viewsName_f = ComponentbuilderHelper::safeString($view->name_list, 'F');
// set some place holder for the views
$this->placeholders['###views###'] = $viewName_list;
$this->placeholders['###Views###'] = $viewsName_f;
$this->placeholders['###VIEWS###'] = $viewsName_u;
$this->placeholders['[[[views]]]'] = $viewName_list;
$this->placeholders['[[[Views]]]'] = $viewsName_f;
$this->placeholders['[[[VIEWS]]]'] = $viewsName_u;
}
// ###view### <<<DYNAMIC>>>
if (isset($viewName_single))
{
$this->fileContentDynamic[$viewName_single]['###view###'] = $viewName_single;
$this->fileContentDynamic[$viewName_single]['###VIEW###'] = $viewName_u;
$this->fileContentDynamic[$viewName_single]['###View###'] = $viewName_f;
if (isset($viewName_list))
{
$this->fileContentDynamic[$viewName_list]['###view###'] = $viewName_single;
$this->fileContentDynamic[$viewName_list]['###VIEW###'] = $viewName_u;
$this->fileContentDynamic[$viewName_list]['###View###'] = $viewName_f;
}
}
// ###views### <<<DYNAMIC>>>
if (isset($viewName_list))
{
$this->fileContentDynamic[$viewName_list]['###views###'] = $viewName_list;
$this->fileContentDynamic[$viewName_list]['###VIEWS###'] = $viewsName_u;
$this->fileContentDynamic[$viewName_list]['###Views###'] = $viewsName_f;
if (isset($viewName_single))
{
$this->fileContentDynamic[$viewName_single]['###views###'] = $viewName_list;
$this->fileContentDynamic[$viewName_single]['###VIEWS###'] = $viewsName_u;
$this->fileContentDynamic[$viewName_single]['###Views###'] = $viewsName_f;
}
}
}
/**
* Build the lang values and insert to fiel
*

File diff suppressed because it is too large Load Diff

View File

@ -4119,10 +4119,6 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_STATE="Joomla Components Edit State"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla component"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION="Joomla Components Edit Version"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla components"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EXPORT="Joomla Components Export"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EXPORT_DESC="Allows the users in this group to export export joomla components"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_IMPORT="Joomla Components Import"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_IMPORT_DESC="Allows the users in this group to import import joomla components"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_N_ITEMS_ARCHIVED="%s Joomla Components archived."
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_N_ITEMS_ARCHIVED_1="%s Joomla Component archived."
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_N_ITEMS_CHECKED_IN_0="No Joomla Component successfully checked in."

View File

@ -506,10 +506,6 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_STATE="Joomla Components Edit State"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla component"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION="Joomla Components Edit Version"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla components"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EXPORT="Joomla Components Export"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EXPORT_DESC="Allows the users in this group to export export joomla components"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_IMPORT="Joomla Components Import"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_IMPORT_DESC="Allows the users in this group to import import joomla components"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU="Joomla Components Submenu"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU_DESC="Allows the users in this group to update the submenu of the joomla component"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_BUTTON_ACCESS="Joomla Component Backup Button Access"