diff --git a/README.md b/README.md
index d8e9834aa..814d3ee16 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Component Builder (2.3.2)
+# Component Builder (2.3.4)
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.2) 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.4) 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*: 11th February, 2017
-+ *Version*: 2.3.2
++ *Last Build*: 13th February, 2017
++ *Version*: 2.3.4
+ *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*: **91443**
-+ *File count*: **592**
++ *Line count*: **91942**
++ *File count*: **594**
+ *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 d8e9834aa..814d3ee16 100644
--- a/admin/README.txt
+++ b/admin/README.txt
@@ -1,4 +1,4 @@
-# Component Builder (2.3.2)
+# Component Builder (2.3.4)
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.2) 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.4) 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*: 11th February, 2017
-+ *Version*: 2.3.2
++ *Last Build*: 13th February, 2017
++ *Version*: 2.3.4
+ *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*: **91443**
-+ *File count*: **592**
++ *Line count*: **91942**
++ *File count*: **594**
+ *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 b5692c326..bfa88fe59 100644
--- a/admin/assets/css/admin.css
+++ b/admin/assets/css/admin.css
@@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage admin.css
diff --git a/admin/assets/css/compiler.css b/admin/assets/css/compiler.css
index 3cdb642db..1ae2c36c8 100644
--- a/admin/assets/css/compiler.css
+++ b/admin/assets/css/compiler.css
@@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version @update number 11 of this MVC
- @build 2nd February, 2017
+ @version @update number 17 of this MVC
+ @build 13th February, 2017
@created 1st February, 2017
@package Component Builder
@subpackage compiler.css
diff --git a/admin/assets/css/component.css b/admin/assets/css/component.css
index 27f2d309e..6f33f61a3 100644
--- a/admin/assets/css/component.css
+++ b/admin/assets/css/component.css
@@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 81 of this MVC
- @build 3rd February, 2017
+ @build 13th February, 2017
@created 6th May, 2015
@package Component Builder
@subpackage component.css
diff --git a/admin/assets/css/components.css b/admin/assets/css/components.css
index 92baa64d6..208b1c53b 100644
--- a/admin/assets/css/components.css
+++ b/admin/assets/css/components.css
@@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 81 of this MVC
- @build 3rd February, 2017
+ @build 13th February, 2017
@created 6th May, 2015
@package Component Builder
@subpackage components.css
diff --git a/admin/assets/css/custom_code.css b/admin/assets/css/custom_code.css
index b84a4c6fd..9c8b41597 100644
--- a/admin/assets/css/custom_code.css
+++ b/admin/assets/css/custom_code.css
@@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version @update number 35 of this MVC
- @build 10th February, 2017
+ @version @update number 55 of this MVC
+ @build 13th 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 4f9565b31..63d6ff2fa 100644
--- a/admin/assets/css/custom_codes.css
+++ b/admin/assets/css/custom_codes.css
@@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version @update number 35 of this MVC
- @build 10th February, 2017
+ @version @update number 55 of this MVC
+ @build 13th 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 24c26cc5c..64d9964ca 100644
--- a/admin/assets/css/dashboard.css
+++ b/admin/assets/css/dashboard.css
@@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage dashboard.css
diff --git a/admin/assets/css/layout.css b/admin/assets/css/layout.css
index 4645a1ea3..402b78a22 100644
--- a/admin/assets/css/layout.css
+++ b/admin/assets/css/layout.css
@@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version @update number 66 of this MVC
- @build 3rd February, 2017
+ @version @update number 67 of this MVC
+ @build 11th February, 2017
@created 18th May, 2015
@package Component Builder
@subpackage layout.css
diff --git a/admin/assets/css/layouts.css b/admin/assets/css/layouts.css
index d3f0017b1..1a2536fec 100644
--- a/admin/assets/css/layouts.css
+++ b/admin/assets/css/layouts.css
@@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version @update number 66 of this MVC
- @build 3rd February, 2017
+ @version @update number 67 of this MVC
+ @build 11th February, 2017
@created 18th May, 2015
@package Component Builder
@subpackage layouts.css
diff --git a/admin/compiler/joomla_3/Helper.php b/admin/compiler/joomla_3/Helper.php
index aa6de8d60..b86e63b08 100644
--- a/admin/compiler/joomla_3/Helper.php
+++ b/admin/compiler/joomla_3/Helper.php
@@ -683,55 +683,67 @@ abstract class ###Component###Helper
public static function safeString($string, $type = 'L', $spacer = '_')
{
- // remove all numbers and replace with english text version (works well only up to a thousand)
+ // remove all numbers and replace with english text version (works well only up to millions)
$string = self::replaceNumbers($string);
-
+ // 0nly continue if we have a string
if (self::checkString($string))
{
- // remove all other characters
- $string = trim($string);
- $string = preg_replace('/'.$spacer.'+/', ' ', $string);
- $string = preg_replace('/\s+/', ' ', $string);
- $string = preg_replace("/[^A-Za-z ]/", '', $string);
- // return a string with all first letter of each word uppercase(no undersocre)
- if ($type == 'W')
- {
- return ucwords(strtolower($string));
- }
- elseif ($type == 'w')
- {
- return strtolower($string);
- }
- elseif ($type == 'Ww')
- {
- return ucfirst(strtolower($string));
- }
- elseif ($type == 'WW')
- {
- return strtoupper($string);
- }
- elseif ($type == 'U')
- {
- // replace white space with underscore
- $string = preg_replace('/\s+/', $spacer, $string);
- // return all upper
- return strtoupper($string);
- }
- elseif ($type == 'F')
- {
- // replace white space with underscore
- $string = preg_replace('/\s+/', $spacer, $string);
- // return with first caracter to upper
- return ucfirst(strtolower($string));
- }
- elseif ($type == 'L')
+ // remove all other characters
+ $string = trim($string);
+ $string = preg_replace('/'.$spacer.'+/', ' ', $string);
+ $string = preg_replace('/\s+/', ' ', $string);
+ $string = preg_replace("/[^A-Za-z ]/", '', $string);
+ // select final adaptations
+ if ($type === 'L' || $type === 'strtolower')
{
// replace white space with underscore
$string = preg_replace('/\s+/', $spacer, $string);
// default is to return lower
return strtolower($string);
}
-
+ elseif ($type === 'W')
+ {
+ // return a string with all first letter of each word uppercase(no undersocre)
+ return ucwords(strtolower($string));
+ }
+ elseif ($type === 'w' || $type === 'word')
+ {
+ // return a string with all lowercase(no undersocre)
+ return strtolower($string);
+ }
+ elseif ($type === 'Ww' || $type === 'Word')
+ {
+ // return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre)
+ return ucfirst(strtolower($string));
+ }
+ elseif ($type === 'WW' || $type === 'WORD')
+ {
+ // return a string with all the uppercase(no undersocre)
+ return strtoupper($string);
+ }
+ elseif ($type === 'U' || $type === 'strtoupper')
+ {
+ // replace white space with underscore
+ $string = preg_replace('/\s+/', $spacer, $string);
+ // return all upper
+ return strtoupper($string);
+ }
+ elseif ($type === 'F' || $type === 'ucfirst')
+ {
+ // replace white space with underscore
+ $string = preg_replace('/\s+/', $spacer, $string);
+ // return with first caracter to upper
+ return ucfirst(strtolower($string));
+ }
+ elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase')
+ {
+ // convert all words to first letter uppercase
+ $string = ucwords(strtolower($string));
+ // remove white space
+ $string = preg_replace('/\s+/', '', $string);
+ // now return first letter lowercase
+ return lcfirst($string);
+ }
// return string
return $string;
}
diff --git a/admin/compiler/joomla_3/Helper_site.php b/admin/compiler/joomla_3/Helper_site.php
index b700b2e32..e6c143921 100644
--- a/admin/compiler/joomla_3/Helper_site.php
+++ b/admin/compiler/joomla_3/Helper_site.php
@@ -675,60 +675,72 @@ abstract class ###Component###Helper
public static function safeString($string, $type = 'L', $spacer = '_')
{
- // remove all numbers and replace with english text version (works well only up to a thousand)
- $string = self::replaceNumbers($string);
-
- if (self::checkString($string))
- {
+ // remove all numbers and replace with english text version (works well only up to millions)
+ $string = self::replaceNumbers($string);
+ // 0nly continue if we have a string
+ if (self::checkString($string))
+ {
// remove all other characters
$string = trim($string);
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
$string = preg_replace('/\s+/', ' ', $string);
$string = preg_replace("/[^A-Za-z ]/", '', $string);
- // return a string with all first letter of each word uppercase(no undersocre)
- if ($type == 'W')
- {
- return ucwords(strtolower($string));
- }
- elseif ($type == 'w')
- {
- return strtolower($string);
- }
- elseif ($type == 'Ww')
- {
- return ucfirst(strtolower($string));
- }
- elseif ($type == 'WW')
- {
- return strtoupper($string);
- }
- elseif ($type == 'U')
+ // select final adaptations
+ if ($type === 'L' || $type === 'strtolower')
+ {
+ // replace white space with underscore
+ $string = preg_replace('/\s+/', $spacer, $string);
+ // default is to return lower
+ return strtolower($string);
+ }
+ elseif ($type === 'W')
{
- // replace white space with underscore
- $string = preg_replace('/\s+/', $spacer, $string);
- // return all upper
- return strtoupper($string);
+ // return a string with all first letter of each word uppercase(no undersocre)
+ return ucwords(strtolower($string));
}
- elseif ($type == 'F')
+ elseif ($type === 'w' || $type === 'word')
{
- // replace white space with underscore
- $string = preg_replace('/\s+/', $spacer, $string);
- // return with first caracter to upper
+ // return a string with all lowercase(no undersocre)
+ return strtolower($string);
+ }
+ elseif ($type === 'Ww' || $type === 'Word')
+ {
+ // return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre)
return ucfirst(strtolower($string));
}
- elseif ($type == 'L')
+ elseif ($type === 'WW' || $type === 'WORD')
{
- // replace white space with underscore
- $string = preg_replace('/\s+/', $spacer, $string);
- // default is to return lower
- return strtolower($string);
+ // return a string with all the uppercase(no undersocre)
+ return strtoupper($string);
}
-
- // return string
- return $string;
- }
- // not a string
- return '';
+ elseif ($type === 'U' || $type === 'strtoupper')
+ {
+ // replace white space with underscore
+ $string = preg_replace('/\s+/', $spacer, $string);
+ // return all upper
+ return strtoupper($string);
+ }
+ elseif ($type === 'F' || $type === 'ucfirst')
+ {
+ // replace white space with underscore
+ $string = preg_replace('/\s+/', $spacer, $string);
+ // return with first caracter to upper
+ return ucfirst(strtolower($string));
+ }
+ elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase')
+ {
+ // convert all words to first letter uppercase
+ $string = ucwords(strtolower($string));
+ // remove white space
+ $string = preg_replace('/\s+/', '', $string);
+ // now return first letter lowercase
+ return lcfirst($string);
+ }
+ // return string
+ return $string;
+ }
+ // not a string
+ return '';
}
public static function htmlEscape($var, $charset = 'UTF-8', $sorten = false, $length = 40)
diff --git a/admin/componentbuilder.php b/admin/componentbuilder.php
index 27fc706d1..ebf4861f7 100644
--- a/admin/componentbuilder.php
+++ b/admin/componentbuilder.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage componentbuilder.php
diff --git a/admin/controller.php b/admin/controller.php
index 3505d4c34..98837c8d1 100644
--- a/admin/controller.php
+++ b/admin/controller.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th 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 ef084e6e8..a6301013f 100644
--- a/admin/controllers/ajax.json.php
+++ b/admin/controllers/ajax.json.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage ajax.json.php
@@ -54,6 +54,8 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
$this->registerTask('dynamicFormDetails', 'ajax');
$this->registerTask('dbTableColumns', 'ajax');
$this->registerTask('viewTableColumns', 'ajax');
+ $this->registerTask('checkFunctionName', 'ajax');
+ $this->registerTask('usedin', 'ajax');
$this->registerTask('fieldOptions', 'ajax');
}
@@ -530,6 +532,84 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
}
}
break;
+ case 'checkFunctionName':
+ try
+ {
+ $returnRaw = $jinput->get('raw', false, 'BOOLEAN');
+ $functioNameValue = $jinput->get('functioName', NULL, 'STRING');
+ $idValue = $jinput->get('id', NULL, 'INT');
+ if($functioNameValue && $idValue && $user->id != 0)
+ {
+ $result = $this->getModel('ajax')->checkFunctionName($functioNameValue, $idValue);
+ }
+ else
+ {
+ $result = false;
+ }
+ if($callback = $jinput->get('callback', null, 'CMD'))
+ {
+ echo $callback . "(".json_encode($result).");";
+ }
+ elseif($returnRaw)
+ {
+ echo json_encode($result);
+ }
+ else
+ {
+ echo "(".json_encode($result).");";
+ }
+ }
+ catch(Exception $e)
+ {
+ if($callback = $jinput->get('callback', null, 'CMD'))
+ {
+ echo $callback."(".json_encode($e).");";
+ }
+ else
+ {
+ echo "(".json_encode($e).");";
+ }
+ }
+ break;
+ case 'usedin':
+ try
+ {
+ $returnRaw = $jinput->get('raw', false, 'BOOLEAN');
+ $functioNameValue = $jinput->get('functioName', NULL, 'WORD');
+ $idValue = $jinput->get('id', NULL, 'INT');
+ if($functioNameValue && $idValue && $user->id != 0)
+ {
+ $result = $this->getModel('ajax')->usedin($functioNameValue, $idValue);
+ }
+ else
+ {
+ $result = false;
+ }
+ if($callback = $jinput->get('callback', null, 'CMD'))
+ {
+ echo $callback . "(".json_encode($result).");";
+ }
+ elseif($returnRaw)
+ {
+ echo json_encode($result);
+ }
+ else
+ {
+ echo "(".json_encode($result).");";
+ }
+ }
+ catch(Exception $e)
+ {
+ if($callback = $jinput->get('callback', null, 'CMD'))
+ {
+ echo $callback."(".json_encode($e).");";
+ }
+ else
+ {
+ echo "(".json_encode($e).");";
+ }
+ }
+ break;
case 'fieldOptions':
try
{
diff --git a/admin/controllers/compiler.php b/admin/controllers/compiler.php
index 39c3153f1..5ef040ea3 100644
--- a/admin/controllers/compiler.php
+++ b/admin/controllers/compiler.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version @update number 11 of this MVC
- @build 2nd February, 2017
+ @version @update number 17 of this MVC
+ @build 13th February, 2017
@created 1st February, 2017
@package Component Builder
@subpackage compiler.php
@@ -66,15 +66,17 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
if($user->authorise('core.admin', 'com_componentbuilder'))
{
// get the post values
- $jinput = JFactory::getApplication()->input;
- $componentId = $jinput->post->get('component', 0, 'INT');
- $version = $jinput->post->get('version', 0, 'INT');
- $addBackup = $jinput->post->get('backup', 0, 'INT');
- $addGit = $jinput->post->get('git', 0, 'INT');
+ $jinput = JFactory::getApplication()->input;
+ $componentId = $jinput->post->get('component', 0, 'INT');
+ $version = $jinput->post->get('version', 0, 'INT');
+ $addBackup = $jinput->post->get('backup', 0, 'INT');
+ $addGit = $jinput->post->get('git', 0, 'INT');
+ $addPlaceholders = $jinput->post->get('placeholders', 2, 'INT');
+ $debugLinenr = $jinput->post->get('debuglinenr', 2, 'INT');
// include component compiler
require_once JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/compiler.php';
$model = $this->getModel('compiler');
- if ($model->builder($version,$componentId,$addBackup,$addGit))
+ if ($model->builder($version,$componentId,$addBackup,$addGit,$addPlaceholders,$debugLinenr))
{
$cache = JFactory::getCache('mod_menu');
$cache->clean();
@@ -143,6 +145,7 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
$message .= 'URL: '.$url.'
';
$message .= 'Hey! you can also download the file right now!
Download
Remember! This file is in your tmp folder and therefore publicly accessible untill you click [Clear tmp]!
'; + $message .= 'Compilation took '.$counter['time'].' seconds to complete.
'; // set redirect $this->setRedirect($redirect_url,$message,'message'); $app->setUserState('com_componentbuilder.extension_name', $counter['filename']); diff --git a/admin/controllers/component.php b/admin/controllers/component.php index fb632e2b9..088e10162 100644 --- a/admin/controllers/component.php +++ b/admin/controllers/component.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version @update number 81 of this MVC - @build 3rd February, 2017 + @build 13th February, 2017 @created 6th May, 2015 @package Component Builder @subpackage component.php diff --git a/admin/controllers/componentbuilder.php b/admin/controllers/componentbuilder.php index c21f1c522..be36f9921 100644 --- a/admin/controllers/componentbuilder.php +++ b/admin/controllers/componentbuilder.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.3.2 - @build 11th February, 2017 + @version 2.3.4 + @build 13th February, 2017 @created 30th April, 2015 @package Component Builder @subpackage componentbuilder.php diff --git a/admin/controllers/components.php b/admin/controllers/components.php index cffcd9d40..51d6df591 100644 --- a/admin/controllers/components.php +++ b/admin/controllers/components.php @@ -11,7 +11,7 @@ /-------------------------------------------------------------------------------------------------------------------------------/ @version @update number 81 of this MVC - @build 3rd February, 2017 + @build 13th February, 2017 @created 6th May, 2015 @package Component Builder @subpackage components.php diff --git a/admin/controllers/custom_code.php b/admin/controllers/custom_code.php index 45c2f6750..aaf6d71b4 100644 --- a/admin/controllers/custom_code.php +++ b/admin/controllers/custom_code.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 35 of this MVC - @build 10th February, 2017 + @version @update number 55 of this MVC + @build 13th 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 666957e22..a282dd7d2 100644 --- a/admin/controllers/custom_codes.php +++ b/admin/controllers/custom_codes.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 35 of this MVC - @build 10th February, 2017 + @version @update number 55 of this MVC + @build 13th 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 9ee2b2d75..8849df99d 100644 --- a/admin/controllers/help.php +++ b/admin/controllers/help.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.3.2 - @build 11th February, 2017 + @version 2.3.4 + @build 13th 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 785a77acb..d8755bc30 100644 --- a/admin/controllers/import.php +++ b/admin/controllers/import.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.3.2 - @build 11th February, 2017 + @version 2.3.4 + @build 13th February, 2017 @created 30th April, 2015 @package Component Builder @subpackage import.php diff --git a/admin/controllers/layout.php b/admin/controllers/layout.php index e828070f1..87a9a2045 100644 --- a/admin/controllers/layout.php +++ b/admin/controllers/layout.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 66 of this MVC - @build 3rd February, 2017 + @version @update number 67 of this MVC + @build 11th February, 2017 @created 18th May, 2015 @package Component Builder @subpackage layout.php diff --git a/admin/controllers/layouts.php b/admin/controllers/layouts.php index b9433afef..248bf5008 100644 --- a/admin/controllers/layouts.php +++ b/admin/controllers/layouts.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 66 of this MVC - @build 3rd February, 2017 + @version @update number 67 of this MVC + @build 11th February, 2017 @created 18th May, 2015 @package Component Builder @subpackage layouts.php diff --git a/admin/helpers/compiler.php b/admin/helpers/compiler.php index fccc06561..c59314724 100644 --- a/admin/helpers/compiler.php +++ b/admin/helpers/compiler.php @@ -41,6 +41,15 @@ class Compiler extends Infusion */ private $tempPath; + /* + * The timer + * + * @var string + */ + private $time_start; + private $time_end; + public $secondsCompiled; + public $filepath = ''; // fixed pathes protected $dynamicIntegration = false; @@ -53,7 +62,8 @@ class Compiler extends Infusion */ public function __construct($config = array ()) { -// $time_start = microtime(true); + // to check the compiler speed + $this->time_start = microtime(true); // first we run the perent constructor if (parent::__construct($config)) { @@ -88,46 +98,27 @@ class Compiler extends Infusion { return false; } - // we can remove all undeeded data - $this->freeMemory(); - // check if this component is install on the current website - if ($paths = $this->getLocalInstallPaths()) - { - // start Automatic import of custom code - $userId = JFactory::getUser()->id; - $today = JFactory::getDate()->toSql(); - // Get a db connection. - $db = JFactory::getDbo(); - // get the custom code from installed files - $this->customCodeFactory($paths, $db, $userId, $today); - } - // now add the other custom code by placeholder - if (ComponentbuilderHelper::checkArray($this->addCustomCodeAt)) - { - // load error messages incase code can not be added - $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)) - { - // load error messages incase code can not be added - $app = JFactory::getApplication(); - $this->addCustomCode($app); + if ($this->getCustomCode()) + { + $this->addCustomCode(); } + // set the lang data now + $this->setLangFileData(); // move the update server into place $this->setUpdateServer(); + // build read me + $this->buildReadMe(); // zip the component if (!$this->zipComponent()) { - // done + // done with error return false; } -// $time_end = microtime(true); -// $time = $time_end - $time_start; -// var_dump("Did Test in ($time seconds)");die; + // end the timer here + $this->time_end = microtime(true); + $this->secondsCompiled = $this->time_end - $this->time_start; + // completed the compilation return true; } return false; @@ -159,7 +150,9 @@ class Compiler extends Infusion protected function updateFiles() { if (isset($this->newFiles['static']) && ComponentbuilderHelper::checkArray($this->newFiles['static']) && isset($this->newFiles['dynamic']) && ComponentbuilderHelper::checkArray($this->newFiles['dynamic'])) - { + { + // we don't update lang now since we will still posible add custom code + $langCheck = 'en-GB.com_'.$this->fileContentStatic['###component###'].'.'; // get the bom file $bom = JFile::read($this->bomPath); // first we do the static files @@ -167,6 +160,12 @@ class Compiler extends Infusion { if (JFile::exists($static['path'])) { + // skip lang files and store for later + if (strpos($static['path'], $langCheck)) + { + $this->langFiles[] = $static; + continue; + } $this->fileContentStatic['###FILENAME###'] = $static['name']; $php = ''; if (ComponentbuilderHelper::checkFileType($static['name'],'php')) @@ -179,16 +178,12 @@ class Compiler extends Infusion list($wast,$code) = explode('###BOM###',$string); $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 $this->writeFile($static['path'],$answer); } else { $answer = $this->setPlaceholders($string, $this->fileContentStatic, 3); - // add custom Code by placeholder if found - $this->getPlaceHolderKeys($static['path'], $answer); // add to zip array $this->writeFile($static['path'],$answer); } @@ -221,8 +216,6 @@ class Compiler extends Infusion $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 $this->writeFile($file['path'],$answer); } @@ -230,8 +223,6 @@ class Compiler extends Infusion { $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 $this->writeFile($file['path'],$answer); } @@ -245,155 +236,10 @@ class Compiler extends Infusion } // free up some memory unset($this->newFiles['dynamic']); - // do a final run to update the readme file - $two = 0; - foreach ($this->newFiles['static'] as $static) - { - if (('README.md' === $static['name'] || 'README.txt' === $static['name']) && $this->componentData->addreadme && JFile::exists($static['path'])) - { - $this->buildReadMe($static['path']); - $two++; - } - if ($two == 2) - { - break; - } - } return true; } return false; } - - protected function getPlaceHolderKeys(&$file, &$content, &$view = '') - { - // check if line has custom code place holder - if (strpos($content, '[CUSTO'.'MCODE=') !== false) - { - if (!isset($this->addCustomCodeAt[$file])) - { - $this->addCustomCodeAt[$file] = array(); - $this->addCustomCodeAt[$file]['ids'] = array(); - $this->addCustomCodeAt[$file]['args'] = array(); - $this->addCustomCodeAt[$file]['view'] = $view; - } - $found = ComponentbuilderHelper::getAllBetween($content, '[CUSTO'.'MCODE=', ']'); - if (ComponentbuilderHelper::checkArray($found)) - { - 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; - } - } - } - } - - protected function freeMemory() - { - // free up some memory - unset($this->newFiles['static']); - unset($this->customScriptBuilder); - unset($this->permissionCore); - unset($this->permissionDashboard); - unset($this->componentData->admin_views); - unset($this->componentData->site_views); - unset($this->componentData->custom_admin_views); - unset($this->componentData->config); - unset($this->joomlaVersionData); - // unset($this->langContent); - unset($this->dbKeys); - unset($this->permissionBuilder); - unset($this->layoutBuilder); - unset($this->historyBuilder); - unset($this->aliasBuilder); - unset($this->titleBuilder); - unset($this->customBuilderList); - unset($this->hiddenFieldsBuilder); - unset($this->intFieldsBuilder); - unset($this->dynamicfieldsBuilder); - unset($this->maintextBuilder); - unset($this->customFieldLinksBuilder); - unset($this->setScriptUserSwitch); - unset($this->categoryBuilder); - unset($this->catCodeBuilder); - unset($this->checkboxBuilder); - unset($this->jsonItemBuilder); - unset($this->base64Builder); - unset($this->basicEncryptionBuilder); - unset($this->advancedEncryptionBuilder); - unset($this->getItemsMethodListStringFixBuilder); - unset($this->getItemsMethodEximportStringFixBuilder); - unset($this->selectionTranslationFixBuilder); - unset($this->listBuilder); - unset($this->customBuilder); - unset($this->editBodyViewScriptBuilder); - unset($this->queryBuilder); - unset($this->sortBuilder); - unset($this->searchBuilder); - unset($this->filterBuilder); - unset($this->fieldsNames); - unset($this->siteFields); - unset($this->siteFieldData); - unset($this->customFieldScript); - unset($this->configFieldSets); - unset($this->jsonStringBuilder); - unset($this->importCustomScripts); - unset($this->eximportView); - unset($this->uninstallBuilder); - unset($this->listColnrBuilder); - unset($this->customFieldBuilder); - unset($this->permissionFields); - unset($this->getAsLookup); - unset($this->secondRunAdmin); - unset($this->uninstallScriptBuilder); - unset($this->buildCategories); - unset($this->iconBuilder); - unset($this->validationFixBuilder); - unset($this->targetRelationControl); - unset($this->targetControlsScriptChecker); - unset($this->accessBuilder); - unset($this->tabCounter); - unset($this->linkedAdminViews); - unset($this->uniquekeys); - unset($this->uniquecodes); - $this->unsetNow('_adminViewData'); - $this->unsetNow('_fieldData'); - } /** * move the local update server xml file to a remote ftp server @@ -457,7 +303,26 @@ class Compiler extends Infusion $this->fileContentStatic['###VERSION###'] = $this->fileContentStatic['###VERSION###GLOBAL']; } - private function buildReadMe($path) + private function buildReadMe() + { + // do a final run to update the readme file + $two = 0; + foreach ($this->newFiles['static'] as $static) + { + if (('README.md' === $static['name'] || 'README.txt' === $static['name']) && $this->componentData->addreadme && JFile::exists($static['path'])) + { + $this->setReadMe($static['path']); + $two++; + } + if ($two == 2) + { + break; + } + } + unset($this->newFiles['static']); + } + + private function setReadMe($path) { // set readme data if not set already if (!isset($this->fileContentStatic['###LINE_COUNT###']) || $this->fileContentStatic['###LINE_COUNT###'] != $this->lineCount) @@ -672,98 +537,10 @@ class Compiler extends Infusion return false; } - protected function addCustomCodeViaPlaceholders($app) - { - // reset all these - $this->clearFromPlaceHolders('view'); - foreach ($this->addCustomCodeAt as $path => $item) - { - if (ComponentbuilderHelper::checkString($item['view'])) - { - $this->placeholders['[[[view]]]'] = $item['view']; - } - elseif (isset($this->placeholders['[[[view]]]'])) - { - unset($this->placeholders['[[[view]]]']); - } - if ($this->getCustomCode($item['ids'])) - { - $code = array(); - foreach($this->customCode as $dbitem) - { - $this->buildCustomCodeForPlaceholders($item, $dbitem, $code); - } - // now update the file - $string = JFile::read($path); - $answer = $this->setPlaceholders($string, $code); - $this->writeFile($path,$answer); - } - else - { - $app->enqueueMessage(JText::sprintf('Custom code could not be added to %s[save to see placeholder]
[save to see placeholder trick]
New Insert Code = /***[INSERT<>$$$$]***/
<YOUR CODE HERE> /***[/INSERT<>$$$$]***/
+
New Replace Codec= /***[REPLACE<>$$$$]***/
<YOUR CODE HERE> /***[/REPLACE<>$$$$]***/
JCB Add Inserted Code = /***[INSERTED$$$$]***//*x*/
<YOUR CODE HERE> /***[/INSERTED$$$$]***/
+
JCB Add Replaced Code = /***[REPLACED$$$$]***//*x*/
<YOUR CODE HERE> /***[/REPLACED$$$$]***/
Update Inserted Code = /***[INSERTED<>$$$$]***//*x*/
<YOUR CODE HERE> /***[/INSERTED<>$$$$]***/
+
Update Replaced Code = /***[REPLACED<>$$$$]***//*x*/
<YOUR CODE HERE> /***[/REPLACED<>$$$$]***/
New Insert Code = <!--[INSERT<>$$$$]-->
<YOUR CODE HERE> <!--[/INSERT<>$$$$]-->
+
New Replace Code = <!--[REPLACE<>$$$$]-->
<YOUR CODE HERE> <!--[/REPLACE<>$$$$]-->
JCB Add Inserted Code = <!--[INSERTED$$$$]--><!--x-->
<YOUR CODE HERE> <!--[/INSERTED$$$$]-->
+
JCB Add Replaced Code = <!--[REPLACED$$$$]--><!--x-->
<YOUR CODE HERE> <!--[/REPLACED$$$$]-->
Update Inserted Code = <!--[INSERTED<>$$$$]--><!--x-->
<YOUR CODE HERE> <!--[/INSERTED<>$$$$]-->
+
Update Replaced Code = <!--[REPLACED<>$$$$]--><!--x-->
<YOUR CODE HERE> <!--[/REPLACED<>$$$$]-->
x is the ID of the code in the system don't change it when you edit the code in your IDE outside of JCB!
[CUSTO'.'MCODE='.$item->id.']
'; // so it is not detected
+ if (ComponentbuilderHelper::checkString($item->function_name))
+ {
+ $item->path = '[CUSTO'.'MCODE='.$item->function_name.']
'; // so it is not detected
+ }
$item->type = 2;
}
}
@@ -154,6 +162,8 @@ class ComponentbuilderModelCustom_codes extends JModelList
$item->target = $this->selectionTranslation($item->target, 'target');
// convert type
$item->type = $this->selectionTranslation($item->type, 'type');
+ // convert comment_type
+ $item->comment_type = $this->selectionTranslation($item->comment_type, 'comment_type');
}
}
@@ -173,8 +183,8 @@ class ComponentbuilderModelCustom_codes extends JModelList
if ($name === 'target')
{
$targetArray = array(
- 1 => 'COM_COMPONENTBUILDER_CUSTOM_CODE_HASH_AUTOMATION',
- 2 => 'COM_COMPONENTBUILDER_CUSTOM_CODE_JCB_MANUAL'
+ 2 => 'COM_COMPONENTBUILDER_CUSTOM_CODE_JCB_MANUAL',
+ 1 => 'COM_COMPONENTBUILDER_CUSTOM_CODE_HASH_AUTOMATION'
);
// Now check if value is found in this array
if (isset($targetArray[$value]) && ComponentbuilderHelper::checkString($targetArray[$value]))
@@ -195,6 +205,19 @@ class ComponentbuilderModelCustom_codes extends JModelList
return $typeArray[$value];
}
}
+ // Array of comment_type language strings
+ if ($name === 'comment_type')
+ {
+ $comment_typeArray = array(
+ 1 => 'COM_COMPONENTBUILDER_CUSTOM_CODE_PHPJS',
+ 2 => 'COM_COMPONENTBUILDER_CUSTOM_CODE_HTML'
+ );
+ // Now check if value is found in this array
+ if (isset($comment_typeArray[$value]) && ComponentbuilderHelper::checkString($comment_typeArray[$value]))
+ {
+ return $comment_typeArray[$value];
+ }
+ }
return $value;
}
@@ -257,7 +280,7 @@ class ComponentbuilderModelCustom_codes extends JModelList
else
{
$search = $db->quote('%' . $db->escape($search) . '%');
- $query->where('(a.component LIKE '.$search.' OR g.system_name LIKE '.$search.')');
+ $query->where('(a.component LIKE '.$search.' OR g.system_name LIKE '.$search.' OR a.comment_type LIKE '.$search.')');
}
}
@@ -276,6 +299,11 @@ class ComponentbuilderModelCustom_codes extends JModelList
{
$query->where('a.type = ' . $db->quote($db->escape($type)));
}
+ // Filter by Comment_type.
+ if ($comment_type = $this->getState('filter.comment_type'))
+ {
+ $query->where('a.comment_type = ' . $db->quote($db->escape($comment_type)));
+ }
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id');
@@ -366,6 +394,10 @@ class ComponentbuilderModelCustom_codes extends JModelList
{
$item->component_system_name = $item->system_name;
$item->path = '[CUSTO'.'MCODE='.$item->id.']
'; // so it is not detected
+ if (ComponentbuilderHelper::checkString($item->function_name))
+ {
+ $item->path = '[CUSTO'.'MCODE='.$item->function_name.']
'; // so it is not detected
+ }
$item->type = 2;
}
}
@@ -421,7 +453,8 @@ class ComponentbuilderModelCustom_codes extends JModelList
$id .= ':' . $this->getState('filter.component');
$id .= ':' . $this->getState('filter.path');
$id .= ':' . $this->getState('filter.target');
- $id .= ':' . $this->getState('filter.type');
+ $id .= ':' . $this->getState('filter.type');
+ $id .= ':' . $this->getState('filter.comment_type');
return parent::getStoreId($id);
}
diff --git a/admin/models/field.php b/admin/models/field.php
index 34ad25213..2073c0ca4 100644
--- a/admin/models/field.php
+++ b/admin/models/field.php
@@ -141,7 +141,7 @@ class ComponentbuilderModelField extends JModelAdmin
*
* @return mixed An array of data items on success, false on failure.
*/
- public function getVzvlinked_admin_views()
+ public function getVzwlinked_admin_views()
{
// Get the user object.
$user = JFactory::getUser();
diff --git a/admin/models/fields/adminviewfolderlist.php b/admin/models/fields/adminviewfolderlist.php
index 3410565e6..1df5bef37 100644
--- a/admin/models/fields/adminviewfolderlist.php
+++ b/admin/models/fields/adminviewfolderlist.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage adminviewfolderlist.php
diff --git a/admin/models/fields/adminviews.php b/admin/models/fields/adminviews.php
index 55e28550d..ba1debf5c 100644
--- a/admin/models/fields/adminviews.php
+++ b/admin/models/fields/adminviews.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage adminviews.php
diff --git a/admin/models/fields/articles.php b/admin/models/fields/articles.php
index 332ad58f2..e299325cd 100644
--- a/admin/models/fields/articles.php
+++ b/admin/models/fields/articles.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage articles.php
diff --git a/admin/models/fields/component.php b/admin/models/fields/component.php
index fa3309cf0..590d08701 100644
--- a/admin/models/fields/component.php
+++ b/admin/models/fields/component.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage component.php
diff --git a/admin/models/fields/customadminviews.php b/admin/models/fields/customadminviews.php
index c52dd6dcb..2661d04a2 100644
--- a/admin/models/fields/customadminviews.php
+++ b/admin/models/fields/customadminviews.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage customadminviews.php
diff --git a/admin/models/fields/customfilelist.php b/admin/models/fields/customfilelist.php
index 77111dc8c..ba517b07d 100644
--- a/admin/models/fields/customfilelist.php
+++ b/admin/models/fields/customfilelist.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage customfilelist.php
diff --git a/admin/models/fields/customfolderlist.php b/admin/models/fields/customfolderlist.php
index 37eb0ec95..5f5087041 100644
--- a/admin/models/fields/customfolderlist.php
+++ b/admin/models/fields/customfolderlist.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage customfolderlist.php
diff --git a/admin/models/fields/customgets.php b/admin/models/fields/customgets.php
index 48e68ca02..bcdc7d181 100644
--- a/admin/models/fields/customgets.php
+++ b/admin/models/fields/customgets.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage customgets.php
diff --git a/admin/models/fields/dbtables.php b/admin/models/fields/dbtables.php
index 3594846e9..f96bc7907 100644
--- a/admin/models/fields/dbtables.php
+++ b/admin/models/fields/dbtables.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage dbtables.php
diff --git a/admin/models/fields/dynamicgets.php b/admin/models/fields/dynamicgets.php
index 4c4344253..a44e088ba 100644
--- a/admin/models/fields/dynamicgets.php
+++ b/admin/models/fields/dynamicgets.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage dynamicgets.php
diff --git a/admin/models/fields/fields.php b/admin/models/fields/fields.php
index 7f2e735d6..93c8dbd6c 100644
--- a/admin/models/fields/fields.php
+++ b/admin/models/fields/fields.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage fields.php
diff --git a/admin/models/fields/fieldsmulti.php b/admin/models/fields/fieldsmulti.php
index 1a0db769b..beb248898 100644
--- a/admin/models/fields/fieldsmulti.php
+++ b/admin/models/fields/fieldsmulti.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage fieldsmulti.php
diff --git a/admin/models/fields/fieldtypes.php b/admin/models/fields/fieldtypes.php
index d0a3a098a..becec8481 100644
--- a/admin/models/fields/fieldtypes.php
+++ b/admin/models/fields/fieldtypes.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage fieldtypes.php
diff --git a/admin/models/fields/maingets.php b/admin/models/fields/maingets.php
index 5cc0774ce..b995840fa 100644
--- a/admin/models/fields/maingets.php
+++ b/admin/models/fields/maingets.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage maingets.php
diff --git a/admin/models/fields/siteviewfolderlist.php b/admin/models/fields/siteviewfolderlist.php
index 8da2d59f1..d42d521d7 100644
--- a/admin/models/fields/siteviewfolderlist.php
+++ b/admin/models/fields/siteviewfolderlist.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage siteviewfolderlist.php
diff --git a/admin/models/fields/siteviews.php b/admin/models/fields/siteviews.php
index 1d33bcd81..34928d07b 100644
--- a/admin/models/fields/siteviews.php
+++ b/admin/models/fields/siteviews.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage siteviews.php
diff --git a/admin/models/fields/snippets.php b/admin/models/fields/snippets.php
index 2e4986d5f..dcbcf9723 100644
--- a/admin/models/fields/snippets.php
+++ b/admin/models/fields/snippets.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version 2.3.2
- @build 11th February, 2017
+ @version 2.3.4
+ @build 13th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage snippets.php
diff --git a/admin/models/fieldtype.php b/admin/models/fieldtype.php
index 53ea80cd8..2de6f33fb 100644
--- a/admin/models/fieldtype.php
+++ b/admin/models/fieldtype.php
@@ -111,7 +111,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
*
* @return mixed An array of data items on success, false on failure.
*/
- public function getVzwfields()
+ public function getVzxfields()
{
// Get the user object.
$user = JFactory::getUser();
@@ -195,13 +195,13 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
foreach ($items as $nr => &$item)
{
// convert datatype
- $item->datatype = $this->selectionTranslationVzwfields($item->datatype, 'datatype');
+ $item->datatype = $this->selectionTranslationVzxfields($item->datatype, 'datatype');
// convert indexes
- $item->indexes = $this->selectionTranslationVzwfields($item->indexes, 'indexes');
+ $item->indexes = $this->selectionTranslationVzxfields($item->indexes, 'indexes');
// convert null_switch
- $item->null_switch = $this->selectionTranslationVzwfields($item->null_switch, 'null_switch');
+ $item->null_switch = $this->selectionTranslationVzxfields($item->null_switch, 'null_switch');
// convert store
- $item->store = $this->selectionTranslationVzwfields($item->store, 'store');
+ $item->store = $this->selectionTranslationVzxfields($item->store, 'store');
}
}
@@ -215,7 +215,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
*
* @return translatable string
*/
- public function selectionTranslationVzwfields($value,$name)
+ public function selectionTranslationVzxfields($value,$name)
{
// Array of datatype language strings
if ($name === 'datatype')
diff --git a/admin/models/forms/component.js b/admin/models/forms/component.js
index 241be45ee..fdaa76277 100644
--- a/admin/models/forms/component.js
+++ b/admin/models/forms/component.js
@@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 81 of this MVC
- @build 3rd February, 2017
+ @build 13th February, 2017
@created 6th May, 2015
@package Component Builder
@subpackage component.js
diff --git a/admin/models/forms/custom_code.js b/admin/models/forms/custom_code.js
index a289e956a..a6f53f5d0 100644
--- a/admin/models/forms/custom_code.js
+++ b/admin/models/forms/custom_code.js
@@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version @update number 35 of this MVC
- @build 10th February, 2017
+ @version @update number 55 of this MVC
+ @build 13th February, 2017
@created 11th October, 2016
@package Component Builder
@subpackage custom_code.js
@@ -23,9 +23,10 @@
/-----------------------------------------------------------------------------------------------------------------------------*/
// Some Global Values
-jform_vvvvvzpvzk_required = false;
+jform_vvvvvzovzk_required = false;
jform_vvvvvzpvzl_required = false;
jform_vvvvvzpvzm_required = false;
+jform_vvvvvzpvzn_required = false;
// Initial Script
jQuery(document).ready(function()
@@ -51,11 +52,30 @@ function vvvvvzo(target_vvvvvzo)
// set the function logic
if (target_vvvvvzo == 2)
{
+ jQuery('#jform_function_name').closest('.control-group').show();
+ if (jform_vvvvvzovzk_required)
+ {
+ updateFieldRequired('function_name',0);
+ jQuery('#jform_function_name').prop('required','required');
+ jQuery('#jform_function_name').attr('aria-required',true);
+ jQuery('#jform_function_name').addClass('required');
+ jform_vvvvvzovzk_required = false;
+ }
+
jQuery('.note_jcb_placeholder').closest('.control-group').show();
jQuery('#jform_system_name').closest('.control-group').show();
}
else
{
+ jQuery('#jform_function_name').closest('.control-group').hide();
+ if (!jform_vvvvvzovzk_required)
+ {
+ updateFieldRequired('function_name',1);
+ jQuery('#jform_function_name').removeAttr('required');
+ jQuery('#jform_function_name').removeAttr('aria-required');
+ jQuery('#jform_function_name').removeClass('required');
+ jform_vvvvvzovzk_required = true;
+ }
jQuery('.note_jcb_placeholder').closest('.control-group').hide();
jQuery('#jform_system_name').closest('.control-group').hide();
}
@@ -68,70 +88,70 @@ function vvvvvzp(target_vvvvvzp)
if (target_vvvvvzp == 1)
{
jQuery('#jform_component').closest('.control-group').show();
- if (jform_vvvvvzpvzk_required)
+ if (jform_vvvvvzpvzl_required)
{
updateFieldRequired('component',0);
jQuery('#jform_component').prop('required','required');
jQuery('#jform_component').attr('aria-required',true);
jQuery('#jform_component').addClass('required');
- jform_vvvvvzpvzk_required = false;
+ jform_vvvvvzpvzl_required = false;
}
jQuery('#jform_path').closest('.control-group').show();
- if (jform_vvvvvzpvzl_required)
+ if (jform_vvvvvzpvzm_required)
{
updateFieldRequired('path',0);
jQuery('#jform_path').prop('required','required');
jQuery('#jform_path').attr('aria-required',true);
jQuery('#jform_path').addClass('required');
- jform_vvvvvzpvzl_required = false;
+ jform_vvvvvzpvzm_required = false;
}
jQuery('#jform_from_line').closest('.control-group').show();
jQuery('#jform_hashtarget').closest('.control-group').show();
jQuery('#jform_to_line').closest('.control-group').show();
jQuery('#jform_type').closest('.control-group').show();
- if (jform_vvvvvzpvzm_required)
+ if (jform_vvvvvzpvzn_required)
{
updateFieldRequired('type',0);
jQuery('#jform_type').prop('required','required');
jQuery('#jform_type').attr('aria-required',true);
jQuery('#jform_type').addClass('required');
- jform_vvvvvzpvzm_required = false;
+ jform_vvvvvzpvzn_required = false;
}
}
else
{
jQuery('#jform_component').closest('.control-group').hide();
- if (!jform_vvvvvzpvzk_required)
+ if (!jform_vvvvvzpvzl_required)
{
updateFieldRequired('component',1);
jQuery('#jform_component').removeAttr('required');
jQuery('#jform_component').removeAttr('aria-required');
jQuery('#jform_component').removeClass('required');
- jform_vvvvvzpvzk_required = true;
+ jform_vvvvvzpvzl_required = true;
}
jQuery('#jform_path').closest('.control-group').hide();
- if (!jform_vvvvvzpvzl_required)
+ if (!jform_vvvvvzpvzm_required)
{
updateFieldRequired('path',1);
jQuery('#jform_path').removeAttr('required');
jQuery('#jform_path').removeAttr('aria-required');
jQuery('#jform_path').removeClass('required');
- jform_vvvvvzpvzl_required = true;
+ jform_vvvvvzpvzm_required = true;
}
jQuery('#jform_from_line').closest('.control-group').hide();
jQuery('#jform_hashtarget').closest('.control-group').hide();
jQuery('#jform_to_line').closest('.control-group').hide();
jQuery('#jform_type').closest('.control-group').hide();
- if (!jform_vvvvvzpvzm_required)
+ if (!jform_vvvvvzpvzn_required)
{
updateFieldRequired('type',1);
jQuery('#jform_type').removeAttr('required');
jQuery('#jform_type').removeAttr('aria-required');
jQuery('#jform_type').removeClass('required');
- jform_vvvvvzpvzm_required = true;
+ jform_vvvvvzpvzn_required = true;
}
}
}
@@ -202,4 +222,103 @@ function isSet(val)
return true;
}
return false;
+}
+
+jQuery(document).ready(function()
+{
+ var target = jQuery("#jform_target input[type='radio']:checked").val();
+ if (target == 2) {
+ var functioName = jQuery('#jform_function_name').val();
+ // check if this function name is taken
+ checkFunctionName(functioName);
+ }
+});
+function setCustomCodePlaceholder() {
+ var ide = jQuery('#jform_id').val();
+ var functioName = jQuery('#jform_function_name').val();
+ if (ide > 0 && functioName.length > 2) {
+ jQuery('#jcb-placeholder').html('[CUSTO'+'MCODE='+ide+']
or [CUSTO'+'MCODE='+functioName+']
');
+ jQuery('#jcb-placeholder-arg').html('[CUSTO'+'MCODE='+ide+'+value1,value2]
or [CUSTO'+'MCODE='+functioName+'+value1,value2]
');
+ } else if (ide > 0){
+ jQuery('#jcb-placeholder').html('[CUSTO'+'MCODE='+ide+']
or [not ready]
');
+ jQuery('#jcb-placeholder-arg').html('[CUSTO'+'MCODE='+ide+'+value1,value2]
or [not ready]
');
+ } else if (functioName.length > 2) {
+ jQuery('#jcb-placeholder').html('[save to see]
or [CUSTO'+'MCODE='+functioName+']
');
+ jQuery('#jcb-placeholder-arg').html('[save to see]
or [CUSTO'+'MCODE='+functioName+'+value1,value2]
');
+ } else {
+ jQuery('#jcb-placeholder').html('[save to see]
');
+ jQuery('#jcb-placeholder-arg').html('[save to see]
');
+ }
+ // update the notes
+ if (ide > 0) {
+ jQuery('.placeholder-key-id').text(ide);
+ }
+}
+function checkFunctionName(functioName) {
+ if (functioName.length > 2) {
+ var ide = jQuery('#jform_id').val();
+ if (ide == 0) {
+ ide = -1;
+ }
+ checkFunctionName_server(functioName, ide).done(function(result) {
+ if(result.name && result.message){
+ // show notice that functioName is okay
+ jQuery.UIkit.notify({message: result.message, timeout: 5000, status: result.status, pos: 'top-right'});
+ jQuery('#jform_function_name').val(result.name);
+ // now start search for where the function is used
+ usedin(result.name, ide);
+ } else if(result.message){
+ // show notice that functioName is not okay
+ jQuery.UIkit.notify({message: result.message, timeout: 5000, status: result.status, pos: 'top-right'});
+ jQuery('#jform_function_name').val('');
+ } else {
+ // set an error that message was not send
+ jQuery.UIkit.notify({message: 'Function name already taken, please try again.', timeout: 5000, status: 'danger', pos: 'top-right'});
+ jQuery('#jform_function_name').val('');
+ }
+ // set custom code placeholder
+ setCustomCodePlaceholder();
+ });
+ } else {
+ // set an error that message was not send
+ jQuery.UIkit.notify({message: 'You must add an unique function name.', timeout: 5000, status: 'danger', pos: 'top-right'});
+ jQuery('#jform_function_name').val('');
+ // set custom code placeholder
+ setCustomCodePlaceholder();
+ }
+}
+// check Function Name
+function checkFunctionName_server(functioName, ide){
+ var getUrl = "index.php?option=com_componentbuilder&task=ajax.checkFunctionName&format=json";
+ if(token.length > 0){
+ var request = 'token='+token+'&functioName='+functioName+'&id='+ide;
+ }
+ return jQuery.ajax({
+ type: 'POST',
+ url: getUrl,
+ dataType: 'jsonp',
+ data: request,
+ jsonp: 'callback'
+ });
+}
+// check where this Function is used
+function usedin(functioName, ide) {
+ usedin_server(functioName, ide).done(function(used) {
+ if (used.in) {
+ jQuery('#usedin').html(used.in);
+ }
+ });
+}
+function usedin_server(functioName, ide){
+ var getUrl = "index.php?option=com_componentbuilder&task=ajax.usedin&format=json";
+ if(token.length > 0){
+ var request = 'token='+token+'&functioName='+functioName+'&id='+ide;
+ }
+ return jQuery.ajax({
+ type: 'POST',
+ url: getUrl,
+ dataType: 'jsonp',
+ data: request,
+ jsonp: 'callback'
+ });
}
diff --git a/admin/models/forms/custom_code.xml b/admin/models/forms/custom_code.xml
index 72bf031c0..2a5d09d77 100644
--- a/admin/models/forms/custom_code.xml
+++ b/admin/models/forms/custom_code.xml
@@ -123,12 +123,12 @@
label="COM_COMPONENTBUILDER_CUSTOM_CODE_TARGET_LABEL"
description="COM_COMPONENTBUILDER_CUSTOM_CODE_TARGET_DESCRIPTION"
class="btn-group btn-group-yesno"
- default="1">
+ default="2">
-
+
[CUSTO'+'MCODE='+ide+']
');
- jQuery('#jcb-placeholder-arg').html(' [CUSTO'+'MCODE='+ide+'+value1,value2]
');
-}
+jQuery('#adminForm').on('change', '#jform_function_name',function (e)
+{
+ e.preventDefault();
+ var target = jQuery("#jform_target input[type='radio']:checked").val();
+ if (target == 2) {
+ var functioName = jQuery('#jform_function_name').val();
+ // check if this function name is taken
+ checkFunctionName(functioName);
+ }
+});
+jQuery('#adminForm').on('change', '#jform_target',function (e)
+{
+ e.preventDefault();
+ var target = jQuery("#jform_target input[type='radio']:checked").val();
+ if (target == 2) {
+ var functioName = jQuery('#jform_function_name').val();
+ // check if this function name is taken
+ checkFunctionName(functioName);
+ }
+});
diff --git a/admin/views/custom_code/view.html.php b/admin/views/custom_code/view.html.php
index 3e08760af..eee230771 100644
--- a/admin/views/custom_code/view.html.php
+++ b/admin/views/custom_code/view.html.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version @update number 35 of this MVC
- @build 10th February, 2017
+ @version @update number 55 of this MVC
+ @build 13th February, 2017
@created 11th October, 2016
@package Component Builder
@subpackage view.html.php
@@ -192,9 +192,17 @@ class ComponentbuilderViewCustom_code extends JViewLegacy
$isNew = ($this->item->id < 1);
$document = JFactory::getDocument();
$document->setTitle(JText::_($isNew ? 'COM_COMPONENTBUILDER_CUSTOM_CODE_NEW' : 'COM_COMPONENTBUILDER_CUSTOM_CODE_EDIT'));
- $document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/custom_code.css");
+ $document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/custom_code.css");
+ // Add Ajax Token
+ $document->addScriptDeclaration("var token = '".JSession::getFormToken()."';");
$document->addScript(JURI::root() . $this->script);
- $document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/custom_code/submitbutton.js");
+ $document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/custom_code/submitbutton.js");
+ // add JavaScripts
+ $document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit/js/uikit.min.js' );
+ $document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit/js/components/notify.min.js', 'text/javascript', true);
+ // add the style sheets
+ $document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit/css/uikit.gradient.min.css' );
+ $document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit/css/components/notify.gradient.min.css' );
JText::script('view not acceptable. Error');
}
}
diff --git a/admin/views/custom_codes/tmpl/default.php b/admin/views/custom_codes/tmpl/default.php
index 9b48284ef..52a810615 100644
--- a/admin/views/custom_codes/tmpl/default.php
+++ b/admin/views/custom_codes/tmpl/default.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version @update number 35 of this MVC
- @build 10th February, 2017
+ @version @update number 55 of this MVC
+ @build 13th February, 2017
@created 11th October, 2016
@package Component Builder
@subpackage default.php
diff --git a/admin/views/custom_codes/tmpl/default_batch_body.php b/admin/views/custom_codes/tmpl/default_batch_body.php
index 2879a118d..a4123f2d0 100644
--- a/admin/views/custom_codes/tmpl/default_batch_body.php
+++ b/admin/views/custom_codes/tmpl/default_batch_body.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version @update number 35 of this MVC
- @build 10th February, 2017
+ @version @update number 55 of this MVC
+ @build 13th February, 2017
@created 11th October, 2016
@package Component Builder
@subpackage default_batch_body.php
diff --git a/admin/views/custom_codes/tmpl/default_batch_footer.php b/admin/views/custom_codes/tmpl/default_batch_footer.php
index 50ec44b32..93753e5fb 100644
--- a/admin/views/custom_codes/tmpl/default_batch_footer.php
+++ b/admin/views/custom_codes/tmpl/default_batch_footer.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version @update number 35 of this MVC
- @build 10th February, 2017
+ @version @update number 55 of this MVC
+ @build 13th February, 2017
@created 11th October, 2016
@package Component Builder
@subpackage default_batch_footer.php
diff --git a/admin/views/custom_codes/tmpl/default_body.php b/admin/views/custom_codes/tmpl/default_body.php
index 1ce511ea0..40d366f3a 100644
--- a/admin/views/custom_codes/tmpl/default_body.php
+++ b/admin/views/custom_codes/tmpl/default_body.php
@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
- @version @update number 35 of this MVC
- @build 10th February, 2017
+ @version @update number 55 of this MVC
+ @build 13th February, 2017
@created 11th October, 2016
@package Component Builder
@subpackage default_body.php
@@ -95,6 +95,9 @@ $edit = "index.php?option=com_componentbuilder&view=custom_codes&task=custom_cod
The Component Builder for [Joomla](http://www.joomla.org/) that is highly advanced, truly able to build extremely complex components in a fraction of the time.
diff --git a/componentbuilder_update_server.xml b/componentbuilder_update_server.xml
index 2721df734..fc9e91eaf 100644
--- a/componentbuilder_update_server.xml
+++ b/componentbuilder_update_server.xml
@@ -611,4 +611,38 @@