From de008d5907751ba92600c9f9c637aa4b6266eeee Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sat, 11 Feb 2017 04:24:26 +0200 Subject: [PATCH] Stable release of the automatic import of custom code, and the JCB manual placeholder implementation resolves #37 please view https://youtu.be/KiAtJawZ3oo --- README.md | 12 +- admin/README.txt | 12 +- admin/assets/css/admin.css | 4 +- admin/assets/css/custom_code.css | 4 +- admin/assets/css/custom_codes.css | 4 +- admin/assets/css/dashboard.css | 4 +- admin/componentbuilder.php | 4 +- admin/controller.php | 4 +- admin/controllers/ajax.json.php | 4 +- admin/controllers/componentbuilder.php | 4 +- admin/controllers/custom_code.php | 4 +- admin/controllers/custom_codes.php | 4 +- admin/controllers/help.php | 4 +- admin/controllers/import.php | 4 +- admin/helpers/compiler.php | 192 +++++++++++++----- admin/helpers/compiler/a_Get.php | 134 ++++++++++-- admin/helpers/compiler/c_Fields.php | 20 +- admin/helpers/compiler/e_Interpretation.php | 64 +++--- admin/helpers/compiler/f_Infusion.php | 38 ++-- admin/helpers/componentbuilder.php | 4 +- admin/helpers/headercheck.php | 4 +- admin/helpers/html/batch_.php | 4 +- admin/helpers/indenter.php | 4 +- admin/helpers/js.php | 4 +- admin/helpers/minify.php | 4 +- .../en-GB/en-GB.com_componentbuilder.ini | 8 +- admin/layouts/admin_view/css_fullwidth.php | 4 +- .../admin_view/custom_buttons_fullwidth.php | 4 +- .../admin_view/custom_buttons_left.php | 4 +- .../admin_view/custom_import_fullwidth.php | 4 +- admin/layouts/admin_view/fields_fullwidth.php | 4 +- .../admin_view/javascript_fullwidth.php | 4 +- .../linked_components_fullwidth.php | 4 +- admin/layouts/admin_view/mysql_fullwidth.php | 4 +- admin/layouts/admin_view/mysql_left.php | 4 +- admin/layouts/admin_view/php_fullwidth.php | 4 +- admin/layouts/admin_view/publishing.php | 4 +- admin/layouts/admin_view/publlshing.php | 4 +- admin/layouts/admin_view/settings_above.php | 4 +- admin/layouts/admin_view/settings_left.php | 4 +- admin/layouts/admin_view/settings_right.php | 4 +- admin/layouts/admin_view/settings_under.php | 4 +- admin/layouts/batchselection.php | 4 +- .../component/admin_views_fullwidth.php | 4 +- .../custom_admin_views_fullwidth.php | 4 +- admin/layouts/component/details_above.php | 4 +- admin/layouts/component/details_left.php | 4 +- admin/layouts/component/details_right.php | 4 +- admin/layouts/component/details_under.php | 4 +- .../dynamic_build_beta_fullwidth.php | 4 +- .../dynamic_integration_fullwidth.php | 4 +- .../component/libs_helpers_fullwidth.php | 4 +- admin/layouts/component/mysql_fullwidth.php | 4 +- admin/layouts/component/php_fullwidth.php | 4 +- admin/layouts/component/publishing.php | 4 +- admin/layouts/component/publlshing.php | 4 +- admin/layouts/component/readme_left.php | 4 +- admin/layouts/component/readme_right.php | 4 +- admin/layouts/component/settings_left.php | 4 +- admin/layouts/component/settings_right.php | 4 +- .../component/site_views_fullwidth.php | 4 +- .../custom_buttons_fullwidth.php | 4 +- .../custom_admin_view/custom_buttons_left.php | 4 +- .../custom_script_fullwidth.php | 4 +- .../custom_admin_view/details_above.php | 4 +- .../custom_admin_view/details_fullwidth.php | 4 +- .../custom_admin_view/details_left.php | 4 +- .../custom_admin_view/details_right.php | 4 +- .../custom_admin_view/details_rightside.php | 4 +- .../custom_admin_view/details_under.php | 4 +- .../linked_components_fullwidth.php | 4 +- .../layouts/custom_admin_view/publishing.php | 4 +- .../layouts/custom_admin_view/publlshing.php | 4 +- admin/layouts/custom_code/details_above.php | 7 +- .../layouts/custom_code/details_fullwidth.php | 5 +- admin/layouts/custom_code/details_left.php | 7 +- admin/layouts/custom_code/details_right.php | 4 +- admin/layouts/custom_code/details_under.php | 4 +- admin/layouts/custom_code/publishing.php | 4 +- admin/layouts/custom_code/publlshing.php | 4 +- .../layouts/dynamic_get/abacus_fullwidth.php | 4 +- admin/layouts/dynamic_get/abacus_left.php | 4 +- .../dynamic_get/custom_script_fullwidth.php | 4 +- admin/layouts/dynamic_get/gettable_above.php | 4 +- .../dynamic_get/gettable_fullwidth.php | 4 +- admin/layouts/dynamic_get/gettable_left.php | 4 +- admin/layouts/dynamic_get/gettable_right.php | 4 +- admin/layouts/dynamic_get/gettable_under.php | 4 +- admin/layouts/dynamic_get/publishing.php | 4 +- admin/layouts/dynamic_get/publlshing.php | 4 +- admin/layouts/field/details_fullwidth.php | 4 +- admin/layouts/field/details_left.php | 4 +- admin/layouts/field/details_right.php | 4 +- admin/layouts/field/details_under.php | 4 +- .../field/linked_admin_views_fullwidth.php | 4 +- admin/layouts/field/publishing.php | 4 +- admin/layouts/field/publlshing.php | 4 +- admin/layouts/field/scripts_left.php | 4 +- admin/layouts/field/scripts_right.php | 4 +- admin/layouts/fieldtype/details_left.php | 4 +- admin/layouts/fieldtype/details_right.php | 4 +- admin/layouts/fieldtype/fields_fullwidth.php | 4 +- admin/layouts/fieldtype/publishing.php | 4 +- admin/layouts/fieldtype/publlshing.php | 4 +- admin/layouts/help_document/details_above.php | 4 +- .../help_document/details_fullwidth.php | 4 +- admin/layouts/help_document/details_left.php | 4 +- admin/layouts/help_document/details_right.php | 4 +- admin/layouts/help_document/details_under.php | 4 +- admin/layouts/help_document/publishing.php | 4 +- admin/layouts/help_document/publlshing.php | 4 +- .../layout/custom_script_fullwidth.php | 4 +- admin/layouts/layout/details_fullwidth.php | 4 +- admin/layouts/layout/details_left.php | 4 +- admin/layouts/layout/details_right.php | 4 +- admin/layouts/layout/details_rightside.php | 4 +- admin/layouts/layout/details_under.php | 4 +- admin/layouts/layout/publishing.php | 4 +- admin/layouts/layout/publlshing.php | 4 +- .../site_view/custom_buttons_fullwidth.php | 4 +- admin/layouts/site_view/details_above.php | 4 +- admin/layouts/site_view/details_fullwidth.php | 4 +- admin/layouts/site_view/details_left.php | 4 +- admin/layouts/site_view/details_right.php | 4 +- admin/layouts/site_view/details_rightside.php | 4 +- admin/layouts/site_view/details_under.php | 4 +- .../site_view/javascript_css_fullwidth.php | 4 +- .../site_view/linked_components_fullwidth.php | 4 +- admin/layouts/site_view/php_fullwidth.php | 4 +- admin/layouts/site_view/publishing.php | 4 +- admin/layouts/site_view/publlshing.php | 4 +- admin/layouts/snippet/details_above.php | 4 +- admin/layouts/snippet/details_left.php | 4 +- admin/layouts/snippet/details_right.php | 4 +- admin/layouts/snippet/publishing.php | 4 +- admin/layouts/snippet/publlshing.php | 4 +- .../template/custom_script_fullwidth.php | 4 +- admin/layouts/template/details_fullwidth.php | 4 +- admin/layouts/template/details_left.php | 4 +- admin/layouts/template/details_right.php | 4 +- admin/layouts/template/details_rightside.php | 4 +- admin/layouts/template/details_under.php | 4 +- admin/layouts/template/publishing.php | 4 +- admin/layouts/template/publlshing.php | 4 +- admin/models/ajax.php | 4 +- admin/models/componentbuilder.php | 4 +- admin/models/custom_code.php | 4 +- admin/models/custom_codes.php | 16 +- admin/models/fields/adminviewfolderlist.php | 4 +- admin/models/fields/adminviews.php | 4 +- admin/models/fields/articles.php | 4 +- admin/models/fields/component.php | 4 +- admin/models/fields/customadminviews.php | 4 +- admin/models/fields/customfilelist.php | 4 +- admin/models/fields/customfolderlist.php | 4 +- admin/models/fields/customgets.php | 4 +- admin/models/fields/dbtables.php | 4 +- admin/models/fields/dynamicgets.php | 4 +- admin/models/fields/fields.php | 4 +- admin/models/fields/fieldsmulti.php | 4 +- admin/models/fields/fieldtypes.php | 4 +- admin/models/fields/maingets.php | 4 +- admin/models/fields/siteviewfolderlist.php | 4 +- admin/models/fields/siteviews.php | 4 +- admin/models/fields/snippets.php | 4 +- admin/models/forms/custom_code.js | 6 +- admin/models/forms/custom_code.xml | 67 +++--- admin/models/import.php | 4 +- admin/sql/install.mysql.utf8.sql | 1 + admin/sql/updates/mysql/2.3.1.sql | 1 + admin/tables/custom_code.php | 4 +- admin/views/componentbuilder/tmpl/default.php | 4 +- ...sed_issues_the_closed_issues_on_github.php | 4 +- .../componentbuilder/tmpl/default_main.php | 4 +- ..._open_issues_the_open_issues_on_github.php | 4 +- .../tmpl/default_readme_information.php | 4 +- ...t_vast_development_method_notice_board.php | 4 +- .../componentbuilder/tmpl/default_vdm.php | 4 +- admin/views/componentbuilder/view.html.php | 4 +- admin/views/components/view.html.php | 12 +- admin/views/custom_code/submitbutton.js | 4 +- admin/views/custom_code/tmpl/edit.php | 8 +- admin/views/custom_code/view.html.php | 4 +- admin/views/custom_codes/tmpl/default.php | 4 +- .../custom_codes/tmpl/default_batch_body.php | 4 +- .../tmpl/default_batch_footer.php | 4 +- .../views/custom_codes/tmpl/default_body.php | 4 +- .../views/custom_codes/tmpl/default_foot.php | 4 +- .../views/custom_codes/tmpl/default_head.php | 4 +- .../custom_codes/tmpl/default_toolbar.php | 4 +- admin/views/custom_codes/view.html.php | 16 +- admin/views/dynamic_gets/view.html.php | 12 +- admin/views/fields/view.html.php | 24 +-- admin/views/help_documents/view.html.php | 12 +- admin/views/import/tmpl/default.php | 4 +- admin/views/import/view.html.php | 4 +- admin/views/snippets/view.html.php | 6 +- componentbuilder.xml | 6 +- componentbuilder_update_server.xml | 17 ++ script.php | 10 +- 200 files changed, 818 insertions(+), 591 deletions(-) create mode 100644 admin/sql/updates/mysql/2.3.1.sql diff --git a/README.md b/README.md index 64f469832..d8e9834aa 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Component Builder (2.3.1) +# Component Builder (2.3.2) This is a [Joomla 3.x](http://www.joomla.org/) component. @@ -8,7 +8,7 @@ The Component Builder for [Joomla](http://www.joomla.org/) that is highly advanc Whether you're a seasoned [Joomla](http://www.joomla.org/) 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.3.1) 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.3.2) with **ALL** its features and **ALL** concepts totally open-source and free! Once installed upgrades are quick and easy via the default Joomla upgrade area. @@ -104,12 +104,12 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Component Builder](http://vdm.bz/component-builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 9th February, 2017 -+ *Version*: 2.3.1 ++ *Last Build*: 11th February, 2017 ++ *Version*: 2.3.2 + *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*: **91404** -+ *File count*: **591** ++ *Line count*: **91443** ++ *File count*: **592** + *Folder count*: **105** > This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder). diff --git a/admin/README.txt b/admin/README.txt index 64f469832..d8e9834aa 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -1,4 +1,4 @@ -# Component Builder (2.3.1) +# Component Builder (2.3.2) This is a [Joomla 3.x](http://www.joomla.org/) component. @@ -8,7 +8,7 @@ The Component Builder for [Joomla](http://www.joomla.org/) that is highly advanc Whether you're a seasoned [Joomla](http://www.joomla.org/) 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.3.1) 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.3.2) with **ALL** its features and **ALL** concepts totally open-source and free! Once installed upgrades are quick and easy via the default Joomla upgrade area. @@ -104,12 +104,12 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Component Builder](http://vdm.bz/component-builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 9th February, 2017 -+ *Version*: 2.3.1 ++ *Last Build*: 11th February, 2017 ++ *Version*: 2.3.2 + *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*: **91404** -+ *File count*: **591** ++ *Line count*: **91443** ++ *File count*: **592** + *Folder count*: **105** > This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder). diff --git a/admin/assets/css/admin.css b/admin/assets/css/admin.css index 4d154ba36..b5692c326 100644 --- a/admin/assets/css/admin.css +++ b/admin/assets/css/admin.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.3.1 - @build 9th February, 2017 + @version 2.3.2 + @build 11th February, 2017 @created 30th April, 2015 @package Component Builder @subpackage admin.css diff --git a/admin/assets/css/custom_code.css b/admin/assets/css/custom_code.css index 2b102ef38..b84a4c6fd 100644 --- a/admin/assets/css/custom_code.css +++ b/admin/assets/css/custom_code.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 28 of this MVC - @build 9th February, 2017 + @version @update number 35 of this MVC + @build 10th February, 2017 @created 11th October, 2016 @package Component Builder @subpackage custom_code.css diff --git a/admin/assets/css/custom_codes.css b/admin/assets/css/custom_codes.css index addc9a537..4f9565b31 100644 --- a/admin/assets/css/custom_codes.css +++ b/admin/assets/css/custom_codes.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 28 of this MVC - @build 9th February, 2017 + @version @update number 35 of this MVC + @build 10th February, 2017 @created 11th October, 2016 @package Component Builder @subpackage custom_codes.css diff --git a/admin/assets/css/dashboard.css b/admin/assets/css/dashboard.css index 0608d1b92..24c26cc5c 100644 --- a/admin/assets/css/dashboard.css +++ b/admin/assets/css/dashboard.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.3.1 - @build 9th February, 2017 + @version 2.3.2 + @build 11th February, 2017 @created 30th April, 2015 @package Component Builder @subpackage dashboard.css diff --git a/admin/componentbuilder.php b/admin/componentbuilder.php index f129ed3fe..27fc706d1 100644 --- a/admin/componentbuilder.php +++ b/admin/componentbuilder.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.3.1 - @build 9th February, 2017 + @version 2.3.2 + @build 11th February, 2017 @created 30th April, 2015 @package Component Builder @subpackage componentbuilder.php diff --git a/admin/controller.php b/admin/controller.php index 53db5fa81..3505d4c34 100644 --- a/admin/controller.php +++ b/admin/controller.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.3.1 - @build 9th February, 2017 + @version 2.3.2 + @build 11th February, 2017 @created 30th April, 2015 @package Component Builder @subpackage controller.php diff --git a/admin/controllers/ajax.json.php b/admin/controllers/ajax.json.php index c383f3ffa..ef084e6e8 100644 --- a/admin/controllers/ajax.json.php +++ b/admin/controllers/ajax.json.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.3.1 - @build 9th February, 2017 + @version 2.3.2 + @build 11th February, 2017 @created 30th April, 2015 @package Component Builder @subpackage ajax.json.php diff --git a/admin/controllers/componentbuilder.php b/admin/controllers/componentbuilder.php index ab393d25c..c21f1c522 100644 --- a/admin/controllers/componentbuilder.php +++ b/admin/controllers/componentbuilder.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.3.1 - @build 9th February, 2017 + @version 2.3.2 + @build 11th February, 2017 @created 30th April, 2015 @package Component Builder @subpackage componentbuilder.php diff --git a/admin/controllers/custom_code.php b/admin/controllers/custom_code.php index a628efa15..45c2f6750 100644 --- a/admin/controllers/custom_code.php +++ b/admin/controllers/custom_code.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 28 of this MVC - @build 9th February, 2017 + @version @update number 35 of this MVC + @build 10th February, 2017 @created 11th October, 2016 @package Component Builder @subpackage custom_code.php diff --git a/admin/controllers/custom_codes.php b/admin/controllers/custom_codes.php index f20623526..666957e22 100644 --- a/admin/controllers/custom_codes.php +++ b/admin/controllers/custom_codes.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 28 of this MVC - @build 9th February, 2017 + @version @update number 35 of this MVC + @build 10th February, 2017 @created 11th October, 2016 @package Component Builder @subpackage custom_codes.php diff --git a/admin/controllers/help.php b/admin/controllers/help.php index 1b7f771a8..9ee2b2d75 100644 --- a/admin/controllers/help.php +++ b/admin/controllers/help.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.3.1 - @build 9th February, 2017 + @version 2.3.2 + @build 11th February, 2017 @created 30th April, 2015 @package Component Builder @subpackage help.php diff --git a/admin/controllers/import.php b/admin/controllers/import.php index 94f5a6e24..785a77acb 100644 --- a/admin/controllers/import.php +++ b/admin/controllers/import.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.3.1 - @build 9th February, 2017 + @version 2.3.2 + @build 11th February, 2017 @created 30th April, 2015 @package Component Builder @subpackage import.php diff --git a/admin/helpers/compiler.php b/admin/helpers/compiler.php index f744c298b..fccc06561 100644 --- a/admin/helpers/compiler.php +++ b/admin/helpers/compiler.php @@ -53,6 +53,7 @@ class Compiler extends Infusion */ public function __construct($config = array ()) { +// $time_start = microtime(true); // first we run the perent constructor if (parent::__construct($config)) { @@ -100,8 +101,6 @@ class Compiler extends Infusion // get the custom code from installed files $this->customCodeFactory($paths, $db, $userId, $today); } - // check if we have custom code to add - $this->getCustomCode(); // now add the other custom code by placeholder if (ComponentbuilderHelper::checkArray($this->addCustomCodeAt)) { @@ -109,6 +108,8 @@ class Compiler extends Infusion $app = JFactory::getApplication(); $this->addCustomCodeViaPlaceholders($app); } + // check if we have custom code to add + $this->getCustomCode(); // now insert into the new files if (ComponentbuilderHelper::checkArray($this->customCode)) { @@ -124,6 +125,9 @@ class Compiler extends Infusion // done return false; } +// $time_end = microtime(true); +// $time = $time_end - $time_start; +// var_dump("Did Test in ($time seconds)");die; return true; } return false; @@ -173,7 +177,8 @@ class Compiler extends Infusion if (strpos($string,'###BOM###') !== false) { list($wast,$code) = explode('###BOM###',$string); - $answer = str_replace(array_keys($this->fileContentStatic),array_values($this->fileContentStatic),$php.$bom.$code); + $string = $php.$bom.$code; + $answer = $this->setPlaceholders($string, $this->fileContentStatic, 3); // add custom Code by placeholder if found $this->getPlaceHolderKeys($static['path'], $answer); // add to zip array @@ -181,7 +186,7 @@ class Compiler extends Infusion } else { - $answer = str_replace(array_keys($this->fileContentStatic),array_values($this->fileContentStatic),$string); + $answer = $this->setPlaceholders($string, $this->fileContentStatic, 3); // add custom Code by placeholder if found $this->getPlaceHolderKeys($static['path'], $answer); // add to zip array @@ -213,8 +218,9 @@ class Compiler extends Infusion if (strpos($string,'###BOM###') !== false) { list($bin,$code) = explode('###BOM###',$string); - $answer = str_replace(array_keys($this->fileContentStatic),array_values($this->fileContentStatic),$php.$bom.$code); - $answer = str_replace(array_keys($this->fileContentDynamic[$view]),array_values($this->fileContentDynamic[$view]),$answer); + $string = $php.$bom.$code; + $answer = $this->setPlaceholders($string, $this->fileContentStatic, 3); + $answer = $this->setPlaceholders($answer, $this->fileContentDynamic[$view], 3); // add custom Code by placeholder if found $this->getPlaceHolderKeys($file['path'], $answer, $view); // add to zip array @@ -222,8 +228,8 @@ class Compiler extends Infusion } else { - $answer = str_replace(array_keys($this->fileContentStatic),array_values($this->fileContentStatic),$string); - $answer = str_replace(array_keys($this->fileContentDynamic[$view]),array_values($this->fileContentDynamic[$view]),$answer); + $answer = $this->setPlaceholders($string, $this->fileContentStatic, 3); + $answer = $this->setPlaceholders($answer, $this->fileContentDynamic[$view], 3); // add custom Code by placeholder if found $this->getPlaceHolderKeys($file['path'], $answer, $view); // add to zip array @@ -267,14 +273,50 @@ class Compiler extends Infusion { $this->addCustomCodeAt[$file] = array(); $this->addCustomCodeAt[$file]['ids'] = array(); - $this->addCustomCodeAt[$file]['replace'] = array(); + $this->addCustomCodeAt[$file]['args'] = array(); $this->addCustomCodeAt[$file]['view'] = $view; } $found = ComponentbuilderHelper::getAllBetween($content, '[CUSTO'.'MCODE=', ']'); if (ComponentbuilderHelper::checkArray($found)) { - foreach ($found as $id) + foreach ($found as $key) { + // check if we have args + if (is_numeric($key)) + { + $id = (int) $key; + } + elseif (strpos($key, '+') !== false) + { + $array = explode('+', $key); + // set ID + $id = (int) $array[0]; + // load args for this ID + if (isset($array[1])) + { + if (!isset($this->addCustomCodeAt[$file]['args'][$id])) + { + $this->addCustomCodeAt[$file]['args'][$id] = array(); + } + // only load if not already loaded + if (!isset($this->addCustomCodeAt[$file]['args'][$id][$key])) + { + if (strpos($array[1], ',') !== false) + { + $this->addCustomCodeAt[$file]['args'][$id][$key] = array_map('trim', explode(',', $array[1])); + } + elseif (ComponentbuilderHelper::checkString($array[1])) + { + $this->addCustomCodeAt[$file]['args'][$id][$key] = array(); + $this->addCustomCodeAt[$file]['args'][$id][$key][] = trim($array[1]); + } + } + } + } + else + { + continue; + } $this->addCustomCodeAt[$file]['ids'][$id] = $id; } } @@ -293,7 +335,7 @@ class Compiler extends Infusion unset($this->componentData->custom_admin_views); unset($this->componentData->config); unset($this->joomlaVersionData); - unset($this->langContent); + // unset($this->langContent); unset($this->dbKeys); unset($this->permissionBuilder); unset($this->layoutBuilder); @@ -425,7 +467,7 @@ class Compiler extends Infusion // get the file $string = JFile::read($path); // update the file - $answer = str_replace(array_keys($this->fileContentStatic),array_values($this->fileContentStatic),$string); + $answer = $this->setPlaceholders($string, $this->fileContentStatic); // add to zip array $this->writeFile($path,$answer); } @@ -633,30 +675,7 @@ class Compiler extends Infusion protected function addCustomCodeViaPlaceholders($app) { // reset all these - unset($this->placeholders['###view###']); - unset($this->placeholders['###VIEW###']); - unset($this->placeholders['###View###']); - unset($this->placeholders['[[[view]]]']); - unset($this->placeholders['[[[VIEW]]]']); - unset($this->placeholders['[[[View]]]']); - unset($this->placeholders['###views###']); - unset($this->placeholders['###VIEWS###']); - unset($this->placeholders['###Views###']); - unset($this->placeholders['[[[views]]]']); - unset($this->placeholders['[[[VIEWS]]]']); - unset($this->placeholders['[[[Views]]]']); - unset($this->placeholders['###SView###']); - unset($this->placeholders['###sview###']); - unset($this->placeholders['###SVIEW###']); - unset($this->placeholders['[[[SView]]]']); - unset($this->placeholders['[[[sview]]]']); - unset($this->placeholders['[[[SVIEW]]]']); - unset($this->placeholders['###SViews###']); - unset($this->placeholders['###sviews###']); - unset($this->placeholders['###SVIEWS###']); - unset($this->placeholders['[[[SViews]]]']); - unset($this->placeholders['[[[sviews]]]']); - unset($this->placeholders['[[[SVIEWS]]]']); + $this->clearFromPlaceHolders('view'); foreach ($this->addCustomCodeAt as $path => $item) { if (ComponentbuilderHelper::checkString($item['view'])) @@ -670,14 +689,13 @@ class Compiler extends Infusion if ($this->getCustomCode($item['ids'])) { $code = array(); - foreach($this->customCode as $item) + foreach($this->customCode as $dbitem) { - $placeholder = $this->getPlaceHolder(2, $item['id']); - $code['[CUSTOM'.'CODE='.$item['id'].']'] = $placeholder['start'] . PHP_EOL . str_replace(array_keys($this->placeholders),array_values($this->placeholders),$item['code']) . $placeholder['end']; + $this->buildCustomCodeForPlaceholders($item, $dbitem, $code); } // now update the file $string = JFile::read($path); - $answer = str_replace(array_keys($code),array_values($code),$string); + $answer = $this->setPlaceholders($string, $code); $this->writeFile($path,$answer); } else @@ -687,8 +705,68 @@ class Compiler extends Infusion } } + protected function buildCustomCodeForPlaceholders(&$at, &$item, &$code) + { + // check if there is args for this code + if (isset($at['args'][$item['id']]) && ComponentbuilderHelper::checkArray($at['args'][$item['id']])) + { + // since we have args we cant update this code via editor (TODO) + $placeholder = $this->getPlaceHolder(3, null); + // we have args and so need to load each + foreach ($at['args'][$item['id']] as $key => $args) + { + $this->setThesePlaceHolders('arg', $args); + $code['[CUSTOM'.'CODE='.$key.']'] = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($item['code'], $this->placeholders). $placeholder['end']; + } + } + else + { + // check what type of place holders we should load here (if view is being updated then we can't use inserted) + $placeholderType = 2; + if (strpos($item['code'], '[[[view]]]') !== false) + { + // since we have views we can't update this code via editor (TODO) + $placeholderType = 3; + } + // if now ars were found, clear it + $this->clearFromPlaceHolders('arg'); + // load args for this code + $placeholder = $this->getPlaceHolder($placeholderType, $item['id']); + $code['[CUSTOM'.'CODE='.$item['id'].']'] = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($item['code'], $this->placeholders). $placeholder['end']; + } + } + + protected function setThesePlaceHolders($key, $values) + { + // aways fist reset these + $this->clearFromPlaceHolders($key); + if (ComponentbuilderHelper::checkArray($values)) + { + $number = 0; + foreach ($values as $value) + { + $this->placeholders['[[['.$key.$number.']]]'] = $value; + $number++; + } + } + } + + protected function clearFromPlaceHolders($like) + { + foreach ($this->placeholders as $something => $value) + { + if (stripos($something, $like) !== false) + { + unset($this->placeholders[$something]); + } + } + } + protected function addCustomCode($app) { + // reset all these + $this->clearFromPlaceHolders('view'); + $this->clearFromPlaceHolders('arg'); foreach($this->customCode as $nr => $target) { // reset each time per custom code @@ -718,7 +796,7 @@ class Compiler extends Infusion $foundEnd = true; } $counter = 0; - // check if file is new structure + // check if file exist if (JFile::exists($file)) { foreach (new SplFileObject($file) as $lineNumber => $lineContent) @@ -783,7 +861,7 @@ class Compiler extends Infusion if ($found) { $placeholder = $this->getPlaceHolder($target['type'], $target['id']); - $data = $placeholder['start'] . PHP_EOL . $target['code'] . $placeholder['end']; + $data = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($target['code'], $this->placeholders). $placeholder['end']; if ($target['type'] == 2) { // found it now add code from the next line @@ -842,23 +920,31 @@ class Compiler extends Infusion // Thanks to http://stackoverflow.com/a/16813550/1429677 protected function addDataToFile($file, $data, $position, $replace = null) { + // start the process $fpFile = fopen($file, "rw+"); $fpTemp = fopen('php://temp', "rw+"); - - $len = stream_copy_to_stream($fpFile, $fpTemp); // make a copy - - fseek($fpFile, $position); // move to the position + // make a copy of the file + stream_copy_to_stream($fpFile, $fpTemp); + // move to the position where we should add the data + fseek($fpFile, $position); + // Add the data + fwrite($fpFile, $data); + // truncate file at the end of the data that was added + $remove = bcadd($position, mb_strlen($data, '8bit')); + ftruncate($fpFile, $remove); + // check if this was a replacement of data if ($replace) { $position = bcadd($position, $replace); } - fseek($fpTemp, $position); // move to the position - - fwrite($fpFile, $data); // Add the data - + // move to the position of the data that should remain below the new data + fseek($fpTemp, $position); + // copy that remaining data to the file stream_copy_to_stream($fpTemp, $fpFile); // @Jack - - fclose($fpFile); // close file - fclose($fpTemp); // close tmp + // done close both files + fclose($fpFile); + fclose($fpTemp); + + // any help to improve this is welcome... } } diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index 571d93424..9915aeac6 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -54,7 +54,7 @@ class Get /* The custom script placeholders - we use the (xxx) to avoid detection it should be (***) * - * New Insert Code = /xxx[INSERT<>$$$$]xxx/ /xxx[/INSERT<>$$$$]xxx/ + * New Insert Code = /xxx[INSERT<>$$$$]xxx/ /xxx[/INSERT<>$$$$]xxx/ * New Replace Code = /xxx[REPLACE<>$$$$]xxx/ /xxx[/REPLACE<>$$$$]xxx/ * * //////////////////////////// when JCB adds it back /////////////////////////////// @@ -2177,7 +2177,7 @@ class Get $langHolders["JText::sprintf('".$string."',"] = "JText::sprintf('".$keyLang."',"; $langHolders['JText::sprintf("'.$string.'",'] = 'JText::sprintf("'.$keyLang.'",'; } - $content = str_replace(array_keys($langHolders),array_values($langHolders),$content); + $content = $this->setPlaceholders($content, $langHolders); } return $content; } @@ -2662,6 +2662,7 @@ class Get { // Create a new query object. $query = $db->getQuery(true); + $continue = false; // Insert columns. $columns = array('path','type','target','component','published','created','created_by','version','access','hashtarget','from_line','to_line','code','hashendtarget'); // Prepare the insert query. @@ -2672,6 +2673,7 @@ class Get if (count($values) == 14) { $query->values(implode(',', $values)); + $continue = true; } else { @@ -2680,6 +2682,10 @@ class Get } // clear the values array $this->newCustomCode = array(); + if (!$continue) + { + return false; // insure we dont continue if no values were loaded + } // Set the query using our newly populated query object and execute it. $db->setQuery($query); $db->execute(); @@ -2729,7 +2735,12 @@ class Get { // we must first store the current woking directory $joomla = getcwd(); - $counter = array(1 => 0, 2 => 0); + $counter = array(1 => 0, 2 => 0); + // set some local placeholders + $placeholders = array(); + $placeholders[$this->fileContentStatic['###Component###'].'Helper::'] = '[[[Component]]]Helper::'; + $placeholders['com_'.$this->fileContentStatic['###component###']] = 'com_[[[component]]]'; + $placeholders['COM_'.$this->fileContentStatic['###COMPONENT###']] = 'COM_[[[COMPONENT]]]'; foreach ($paths as $target => $path) { // we are changing the working directory to the componet path @@ -2738,7 +2749,7 @@ class Get $files = JFolder::files('.', '\.php', true, true); foreach ($files as $file) { - $this->searchFileContent($counter, $file, $target, $this->customCodePlaceholders, $db, $userId, $today); + $this->searchFileContent($counter, $file, $target, $this->customCodePlaceholders, $placeholders, $db, $userId, $today); // insert new code if (ComponentbuilderHelper::checkArray($this->newCustomCode)) { @@ -2770,7 +2781,8 @@ class Get * * @param array $counter The counter for the arrays * @param string $file The file path to search - * @param array $placeholders The values to search for + * @param array $searchArray The values to search for + * @param array $placeholders The values to replace in the code being stored * @param object $db The database object * @param int $userId The user id * @param string $today The date for today @@ -2778,7 +2790,7 @@ class Get * @return array on success * */ - protected function searchFileContent(&$counter, &$file, &$target, &$placeholders, &$db, &$userId, &$today) + protected function searchFileContent(&$counter, &$file, &$target, &$searchArray, &$placeholders, &$db, &$userId, &$today) { // reset each time per file $loadEndFingerPrint = false; @@ -2798,7 +2810,7 @@ class Get else { $path = $file; - } + } foreach (new SplFileObject($file) as $lineNumber => $lineContent) { // we musk keep last few lines to dynamic find target entry later @@ -2808,15 +2820,15 @@ class Get { $endFingerPrint[$lineNumber] = trim($lineContent); } - foreach ($placeholders as $type => $placeholder) + foreach ($searchArray as $type => $search) { $i = (int) ($type == 3 ||$type == 4) ? 2 : 1; $_type = (int) ($type == 1 || $type == 3) ? 1 : 2; if ($reader === 0 || $reader === $i) { $targetKey = $type; - $start = '/***['.$placeholder.'***/'; - $end = '/***[/'.$placeholder.'***/'; + $start = '/***['.$search.'***/'; + $end = '/***[/'.$search.'***/'; // check if the ending place holder was found if(isset($reading[$targetKey]) && $reading[$targetKey] && (trim($lineContent) === $end || strpos($lineContent, $end) !== false)) { @@ -2882,11 +2894,13 @@ class Get // then read in the code if (isset($reading[$targetKey]) && $reading[$targetKey]) { - $codeBucket[$pointer[$targetKey]][] = $lineContent; + $codeBucket[$pointer[$targetKey]][] = $this->setPlaceholders($lineContent, $placeholders, 2, 2); // <-- this could solve our placholder issue } // check if the starting place holder was found if((!isset($reading[$targetKey]) || !$reading[$targetKey]) && (($i === 1 && trim($lineContent) === $start) || strpos($lineContent, $start) !== false)) { + // do a quick check to insure we have an id + $id = false; if ($i === 2) { $id = $this->getSystemID($lineContent, $start); @@ -2915,8 +2929,6 @@ class Get $hasharray = array_slice($fingerPrint, -$inFinger, $getFinger, true); $hasleng = count($hasharray); $hashtarget = $hasleng.'__'.md5(implode('',$hasharray)); - // do a quick check to insure we have an id - $id = false; // all new records we can do a buldk insert if ($i === 1 || !$id) { @@ -3019,6 +3031,87 @@ class Get return false; } + /** + * Update the data with the placeholders + * + * @param string $data The actual date + * @param array $placeholder The placeholders + * + * @return string + * + */ + public function setPlaceholders(&$data, &$placeholder, $action = 1, $langSwitch = 0) + { + // check if we should reverse the lang strings <-- for custom coding + if (2 == $langSwitch) + { + $langArray1 = ComponentbuilderHelper::getAllBetween($data,'JText::_("','")'); + $langArray2 = ComponentbuilderHelper::getAllBetween($data,"JText::_('","')"); + $langArray = ComponentbuilderHelper::mergeArrays(array($langArray1,$langArray2)); + if (ComponentbuilderHelper::checkArray($langArray)) + { + $_tmp = array(); + $targets = array('admin','site','','sitesys','adminsys'); + foreach ($langArray as $lang) + { + $found = false; + foreach ($targets as $in) + { + if (!$found && isset($this->langContent[$in][$lang])) + { + $_tmp[$lang] = $this->langContent[$in][$lang]; + $found = true; + } + } + } + // now update + if (ComponentbuilderHelper::checkArray($_tmp)) + { + $data = str_replace(array_keys($_tmp),array_values($_tmp),$data); + } + } + } + if (1 == $action) // <-- just replace (default) + { + return str_replace(array_keys($placeholder),array_values($placeholder),$data); + } + elseif (2 == $action) // <-- check if data string has placeholders + { + $replace = false; + foreach ($placeholder as $key => $val) + { + if (strpos($data, $key) !== FALSE) + { + $replace = true; + break; + } + } + // only replace if the data has these placeholder values + if ($replace === true) + { + + return str_replace(array_keys($placeholder),array_values($placeholder),$data); + } + } + elseif (3 == $action) // <-- remove placeholders not in data string + { + $replace = $placeholder; + foreach ($replace as $key => $val) + { + if (strpos($data, $key) === FALSE) + { + unset($replace[$key]); + } + } + // only replace if the data has these placeholder values + if (ComponentbuilderHelper::checkArray($replace)) + { + return str_replace(array_keys($replace),array_values($replace),$data); + } + } + return $data; + } + /** * return the placeholders for insered and replaced code * @@ -3028,7 +3121,7 @@ class Get * @return array on success * */ - public function getPlaceHolder($type, &$id) + public function getPlaceHolder($type, $id) { switch ($type) { @@ -3043,8 +3136,8 @@ class Get else { return array( - 'start' => "/*////////////////////////////////////////*/", - 'end' => "/*////////////////////////////////////////*/"); + 'start' => "\t\t\t", + 'end' => "\t\t\t"); } break; case 2: @@ -3058,10 +3151,15 @@ class Get else { return array( - 'start' => "/*////////////////////////////////////////*/", - 'end' => "/*////////////////////////////////////////*/"); + 'start' => "\t\t\t", + 'end' => "\t\t\t"); } break; + case 3: + return array( + 'start' => "\t\t\t", + 'end' => "\t\t\t"); + break; } return false; } diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index fc2ef7844..3d00fbf65 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -1276,7 +1276,7 @@ class Fields extends Structure { $xmlValue = ComponentbuilderHelper::getBetween($field['settings']->xml, $property['name'] . '="', '"'); // replace the placeholders - $xmlValue = str_replace(array_keys($placeholders), array_values($placeholders), $xmlValue); + $xmlValue = $this->setPlaceholders($xmlValue, $placeholders); } elseif (strpos($property['name'], 'type_php_') !== false && $setCustom) { @@ -1312,14 +1312,14 @@ class Fields extends Structure // load the component name $fieldAttributes['custom']['component'] = ComponentbuilderHelper::getBetween($field['settings']->xml, 'component="', '"'); // replace the placeholders - $fieldAttributes['custom']['component'] = str_replace(array_keys($placeholders), array_values($placeholders), $fieldAttributes['custom']['component']); + $fieldAttributes['custom']['component'] = $this->setPlaceholders($fieldAttributes['custom']['component'], $placeholders); } elseif ($property['name'] === 'table' && $setCustom) { // load the main table that is queried $fieldAttributes['custom']['table'] = ComponentbuilderHelper::getBetween($field['settings']->xml, 'table="', '"'); // replace the placeholders - $fieldAttributes['custom']['table'] = str_replace(array_keys($placeholders), array_values($placeholders), $fieldAttributes['custom']['table']); + $fieldAttributes['custom']['table'] = $this->setPlaceholders($fieldAttributes['custom']['table'], $placeholders); } elseif ($property['name'] === 'value_field' && $setCustom) { @@ -1382,7 +1382,7 @@ class Fields extends Structure if (ComponentbuilderHelper::checkString($xmlValue) && $property['translatable'] == 1) { // replace placeholders - $xmlValue = str_replace(array_keys($placeholders), array_values($placeholders), $xmlValue); + $xmlValue = $this->setPlaceholders($xmlValue, $placeholders); // insure custom lables dont get messed up if ($setCustom) { @@ -1818,16 +1818,16 @@ class Fields extends Structure { if ($line == 1) { - $phpCode .= str_replace(array_keys($tabBreak),array_values($tabBreak),$code); + $phpCode .= $this->setPlaceholders($code, $tabBreak); } else { - $phpCode .= PHP_EOL."\t\t".str_replace(array_keys($tabBreak),array_values($tabBreak),$code); + $phpCode .= PHP_EOL."\t\t".$this->setPlaceholders($code, $tabBreak); } } } // replace the placholders - $phpCode = str_replace(array_keys($replace),array_values($replace),$phpCode); + $phpCode = $this->setPlaceholders($phpCode, $replace); } else { @@ -1851,16 +1851,16 @@ class Fields extends Structure { if ($line == 1) { - $phpxCode .= str_replace(array_keys($tabBreak),array_values($tabBreak),$code); + $phpxCode .= $this->setPlaceholders($code, $tabBreak); } else { - $phpxCode .= PHP_EOL."\t\t".str_replace(array_keys($tabBreak),array_values($tabBreak),$code); + $phpxCode .= PHP_EOL."\t\t".$this->setPlaceholders($code, $tabBreak); } } } // replace the placholders - $phpxCode = str_replace(array_keys($replace),array_values($replace),$phpxCode); + $phpxCode = $this->setPlaceholders($phpxCode, $replace); } else { diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index b1dbb5d04..e6f3e601f 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -2271,7 +2271,7 @@ class Interpretation extends Fields { foreach ($joinedChecker as $joinedString) { - $joine .= str_replace(array_keys($placeholders),array_values($placeholders),$joinedString); + $joine .= $this->setPlaceholders($joinedString, $placeholders); } } if (ComponentbuilderHelper::checkString($decoder) || ComponentbuilderHelper::checkString($uikit) || ComponentbuilderHelper::checkString($decoder_filter) || ComponentbuilderHelper::checkString($joine)) @@ -2484,7 +2484,8 @@ class Interpretation extends Fields $get->php_calculation = (array) explode(PHP_EOL,$get->php_calculation); if (ComponentbuilderHelper::checkArray($get->php_calculation)) { - $getItem .= str_replace(array_keys($this->placeholders),array_values($this->placeholders),PHP_EOL."\t\t\t\t".implode(PHP_EOL."\t\t\t\t",$get->php_calculation)); + $_tmp = PHP_EOL."\t\t\t\t".implode(PHP_EOL."\t\t\t\t",$get->php_calculation); + $getItem .= $this->setPlaceholders($_tmp, $this->placeholders); } } $getItem .= PHP_EOL."\t\t\t}"; @@ -2573,7 +2574,8 @@ class Interpretation extends Fields $view['settings']->php_jview_display = (array) explode(PHP_EOL,$view['settings']->php_jview_display); if (ComponentbuilderHelper::checkArray($view['settings']->php_jview_display)) { - $method .= str_replace(array_keys($this->placeholders),array_values($this->placeholders),PHP_EOL."\t\t".implode(PHP_EOL."\t\t",$view['settings']->php_jview_display)); + $_tmp = PHP_EOL."\t\t".implode(PHP_EOL."\t\t",$view['settings']->php_jview_display); + $method .= $this->setPlaceholders($_tmp, $this->placeholders); } } if ('site' === $this->target) @@ -2727,7 +2729,8 @@ class Interpretation extends Fields $view['settings']->php_document = (array) explode(PHP_EOL,$view['settings']->php_document); if (ComponentbuilderHelper::checkArray($view['settings']->php_document)) { - return str_replace(array_keys($this->placeholders),array_values($this->placeholders),PHP_EOL."\t\t".implode(PHP_EOL."\t\t",$view['settings']->php_document)); + $_tmp = PHP_EOL."\t\t".implode(PHP_EOL."\t\t",$view['settings']->php_document); + return $this->setPlaceholders($_tmp, $this->placeholders); } } return ''; @@ -2790,7 +2793,7 @@ class Interpretation extends Fields { // set the custom buttons ###CUSTOM_BUTTONS_CONTROLLER### $this->fileContentDynamic[$viewName]['###'.$TARGET.'_CUSTOM_BUTTONS_CONTROLLER###'] = - PHP_EOL.PHP_EOL.str_replace(array_keys($this->placeholders),array_values($this->placeholders),$view['settings']->php_controller); + PHP_EOL.PHP_EOL.$this->setPlaceholders($view['settings']->php_controller, $this->placeholders); if ('site' === $this->target) { // add the controller for this view @@ -2804,7 +2807,7 @@ class Interpretation extends Fields { // set the custom buttons ###CUSTOM_BUTTONS_METHOD### $this->fileContentDynamic[$viewName]['###'.$TARGET.'_CUSTOM_BUTTONS_METHOD###'] = - PHP_EOL.PHP_EOL.str_replace(array_keys($this->placeholders),array_values($this->placeholders),$view['settings']->php_model); + PHP_EOL.PHP_EOL.$this->setPlaceholders($view['settings']->php_model, $this->placeholders); } if (isset($view['settings']->custom_buttons) && ComponentbuilderHelper::checkArray($view['settings']->custom_buttons)) { @@ -2840,7 +2843,7 @@ class Interpretation extends Fields { if (ComponentbuilderHelper::checkString($view['settings']->css)) { - return str_replace(array_keys($this->placeholders),array_values($this->placeholders),$view['settings']->css); + return $this->setPlaceholders($view['settings']->css, $this->placeholders); } } return ''; @@ -2854,8 +2857,8 @@ class Interpretation extends Fields if (ComponentbuilderHelper::checkArray($view['settings']->css_document)) { $script = PHP_EOL."\t\t//".$this->setLine(__LINE__)." Set the Custom CSS script to view".PHP_EOL."\t\t".'$this->document->addStyleDeclaration("'; - $cssDocument = str_replace('"', '\"', implode(PHP_EOL."\t\t\t",$view['settings']->css_document)); - return $script.str_replace(array_keys($this->placeholders),array_values($this->placeholders),PHP_EOL."\t\t\t".$cssDocument).PHP_EOL."\t\t".'");'; + $cssDocument = PHP_EOL."\t\t\t".str_replace('"', '\"', implode(PHP_EOL."\t\t\t",$view['settings']->css_document)); + return $script.$this->setPlaceholders($cssDocument, $this->placeholders).PHP_EOL."\t\t".'");'; } } return ''; @@ -2869,8 +2872,8 @@ class Interpretation extends Fields if (ComponentbuilderHelper::checkArray($view['settings']->js_document)) { $script = PHP_EOL."\t\t//".$this->setLine(__LINE__)." Set the Custom JS script to view".PHP_EOL."\t\t".'$this->document->addScriptDeclaration("'; - $jsDocument = str_replace('"', '\"', implode(PHP_EOL."\t\t\t",$view['settings']->js_document)); - return $script.str_replace(array_keys($this->placeholders),array_values($this->placeholders),PHP_EOL."\t\t\t".$jsDocument).PHP_EOL."\t\t".'");'; + $jsDocument = PHP_EOL."\t\t\t".str_replace('"', '\"', implode(PHP_EOL."\t\t\t",$view['settings']->js_document)); + return $script.$this->setPlaceholders($jsDocument, $this->placeholders).PHP_EOL."\t\t".'");'; } } return ''; @@ -3149,7 +3152,7 @@ class Interpretation extends Fields { if ($view['settings']->add_php_jview == 1) { - return str_replace(array_keys($this->placeholders),array_values($this->placeholders),PHP_EOL.PHP_EOL.$view['settings']->php_jview); + return PHP_EOL.PHP_EOL.$this->setPlaceholders($view['settings']->php_jview, $this->placeholders); } return ''; } @@ -3167,7 +3170,7 @@ class Interpretation extends Fields { $this->placeholders['[[[LIMITBOX]]]'] = 'pagination->getLimitBox(); ?>'; } - $body[] = str_replace(array_keys($this->placeholders),array_values($this->placeholders),$view['settings']->default); + $body[] = $this->setPlaceholders($view['settings']->default, $this->placeholders); $body[] = PHP_EOL.'items) && '.$this->fileContentStatic['###component###'].'Helper::checkArray($this->items) && count($this->items) > 4): ?>'; $body[] = '
'; $body[] = "\t".'