diff --git a/README.md b/README.md index 820592de3..b92d4dcd3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Component Builder (2.2.6) +# Component Builder (2.2.9) 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.2.6) 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.2.9) 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,13 +104,13 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:info@vdm.io) + *Name*: [Component Builder](http://vdm.bz/component-builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 20th January, 2017 -+ *Version*: 2.2.6 ++ *Last Build*: 1st February, 2017 ++ *Version*: 2.2.9 + *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*: **86216** -+ *File count*: **549** -+ *Folder count*: **100** ++ *Line count*: **90719** ++ *File count*: **583** ++ *Folder count*: **104** > This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) diff --git a/admin/README.txt b/admin/README.txt index 820592de3..b92d4dcd3 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -1,4 +1,4 @@ -# Component Builder (2.2.6) +# Component Builder (2.2.9) 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.2.6) 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.2.9) 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,13 +104,13 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:info@vdm.io) + *Name*: [Component Builder](http://vdm.bz/component-builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 20th January, 2017 -+ *Version*: 2.2.6 ++ *Last Build*: 1st February, 2017 ++ *Version*: 2.2.9 + *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*: **86216** -+ *File count*: **549** -+ *Folder count*: **100** ++ *Line count*: **90719** ++ *File count*: **583** ++ *Folder count*: **104** > This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) diff --git a/admin/access.xml b/admin/access.xml index e72d86644..e523483c9 100644 --- a/admin/access.xml +++ b/admin/access.xml @@ -31,6 +31,20 @@ + + + + + + + + + + + + + + @@ -170,6 +184,17 @@ +
+ + + + + + + + + +
diff --git a/admin/assets/css/admin.css b/admin/assets/css/admin.css index ae23e28c6..b8bc0473e 100644 --- a/admin/assets/css/admin.css +++ b/admin/assets/css/admin.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version 2.2.9 + @build 1st February, 2017 @created 30th April, 2015 @package Component Builder @subpackage admin.css diff --git a/admin/assets/css/admin_view.css b/admin/assets/css/admin_view.css index 423aff495..15d9a561c 100644 --- a/admin/assets/css/admin_view.css +++ b/admin/assets/css/admin_view.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version @update number 94 of this MVC + @build 13th January, 2017 @created 30th April, 2015 @package Component Builder @subpackage admin_view.css diff --git a/admin/assets/css/admin_views.css b/admin/assets/css/admin_views.css index 474d145be..374918ad3 100644 --- a/admin/assets/css/admin_views.css +++ b/admin/assets/css/admin_views.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version @update number 94 of this MVC + @build 13th January, 2017 @created 30th April, 2015 @package Component Builder @subpackage admin_views.css diff --git a/admin/assets/css/component.css b/admin/assets/css/component.css index 216e0920d..0d831343f 100644 --- a/admin/assets/css/component.css +++ b/admin/assets/css/component.css @@ -9,9 +9,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 77 of this MVC + @build 26th December, 2016 + @created 6th May, 2015 @package Component Builder @subpackage component.css @author Llewellyn van der Merwe diff --git a/admin/assets/css/components.css b/admin/assets/css/components.css index 10969eee2..5e1e5fec9 100644 --- a/admin/assets/css/components.css +++ b/admin/assets/css/components.css @@ -9,9 +9,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 77 of this MVC + @build 26th December, 2016 + @created 6th May, 2015 @package Component Builder @subpackage components.css @author Llewellyn van der Merwe diff --git a/admin/assets/css/custom_admin_view.css b/admin/assets/css/custom_admin_view.css index 8a709b426..952d3b231 100644 --- a/admin/assets/css/custom_admin_view.css +++ b/admin/assets/css/custom_admin_view.css @@ -9,9 +9,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 18 of this MVC + @build 13th January, 2017 + @created 13th August, 2015 @package Component Builder @subpackage custom_admin_view.css @author Llewellyn van der Merwe diff --git a/admin/assets/css/custom_admin_views.css b/admin/assets/css/custom_admin_views.css index c55f4f8a3..284ca7524 100644 --- a/admin/assets/css/custom_admin_views.css +++ b/admin/assets/css/custom_admin_views.css @@ -9,9 +9,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 18 of this MVC + @build 13th January, 2017 + @created 13th August, 2015 @package Component Builder @subpackage custom_admin_views.css @author Llewellyn van der Merwe diff --git a/admin/assets/css/custom_code.css b/admin/assets/css/custom_code.css new file mode 100644 index 000000000..5b277936e --- /dev/null +++ b/admin/assets/css/custom_code.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version @update number 14 of this MVC + @build 31st January, 2017 + @created 11th October, 2016 + @package Component Builder + @subpackage custom_code.css + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/custom_codes.css b/admin/assets/css/custom_codes.css new file mode 100644 index 000000000..4be7b1f46 --- /dev/null +++ b/admin/assets/css/custom_codes.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version @update number 14 of this MVC + @build 31st January, 2017 + @created 11th October, 2016 + @package Component Builder + @subpackage custom_codes.css + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/dashboard.css b/admin/assets/css/dashboard.css index d991a46d4..ef7f9f540 100644 --- a/admin/assets/css/dashboard.css +++ b/admin/assets/css/dashboard.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version 2.2.9 + @build 1st February, 2017 @created 30th April, 2015 @package Component Builder @subpackage dashboard.css diff --git a/admin/assets/css/dynamic_get.css b/admin/assets/css/dynamic_get.css index 2d4db60f1..d261bc0bd 100644 --- a/admin/assets/css/dynamic_get.css +++ b/admin/assets/css/dynamic_get.css @@ -9,9 +9,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 81 of this MVC + @build 15th January, 2017 + @created 21st May, 2015 @package Component Builder @subpackage dynamic_get.css @author Llewellyn van der Merwe diff --git a/admin/assets/css/dynamic_gets.css b/admin/assets/css/dynamic_gets.css index 4d1ada8d7..eeb65c412 100644 --- a/admin/assets/css/dynamic_gets.css +++ b/admin/assets/css/dynamic_gets.css @@ -9,9 +9,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 81 of this MVC + @build 15th January, 2017 + @created 21st May, 2015 @package Component Builder @subpackage dynamic_gets.css @author Llewellyn van der Merwe diff --git a/admin/assets/css/field.css b/admin/assets/css/field.css index d5da69dc2..736e34a2d 100644 --- a/admin/assets/css/field.css +++ b/admin/assets/css/field.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version @update number 36 of this MVC + @build 12th January, 2017 @created 30th April, 2015 @package Component Builder @subpackage field.css diff --git a/admin/assets/css/fields.css b/admin/assets/css/fields.css index c4708a217..03d3c0f51 100644 --- a/admin/assets/css/fields.css +++ b/admin/assets/css/fields.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version @update number 36 of this MVC + @build 12th January, 2017 @created 30th April, 2015 @package Component Builder @subpackage fields.css diff --git a/admin/assets/css/fieldtype.css b/admin/assets/css/fieldtype.css index 03e81464a..137cade27 100644 --- a/admin/assets/css/fieldtype.css +++ b/admin/assets/css/fieldtype.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version @update number 12 of this MVC + @build 20th October, 2016 @created 30th April, 2015 @package Component Builder @subpackage fieldtype.css diff --git a/admin/assets/css/fieldtypes.css b/admin/assets/css/fieldtypes.css index 17cddc7a1..87961f6ec 100644 --- a/admin/assets/css/fieldtypes.css +++ b/admin/assets/css/fieldtypes.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version @update number 12 of this MVC + @build 20th October, 2016 @created 30th April, 2015 @package Component Builder @subpackage fieldtypes.css diff --git a/admin/assets/css/help_document.css b/admin/assets/css/help_document.css index a6967e4db..982d7a0cd 100644 --- a/admin/assets/css/help_document.css +++ b/admin/assets/css/help_document.css @@ -9,9 +9,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 6 of this MVC + @build 17th October, 2016 + @created 4th March, 2016 @package Component Builder @subpackage help_document.css @author Llewellyn van der Merwe diff --git a/admin/assets/css/help_documents.css b/admin/assets/css/help_documents.css index e4cdab8a7..03e4a4295 100644 --- a/admin/assets/css/help_documents.css +++ b/admin/assets/css/help_documents.css @@ -9,9 +9,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 6 of this MVC + @build 17th October, 2016 + @created 4th March, 2016 @package Component Builder @subpackage help_documents.css @author Llewellyn van der Merwe diff --git a/admin/assets/css/layout.css b/admin/assets/css/layout.css index 23ff53344..4435a8f60 100644 --- a/admin/assets/css/layout.css +++ b/admin/assets/css/layout.css @@ -9,9 +9,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 65 of this MVC + @build 18th October, 2016 + @created 18th May, 2015 @package Component Builder @subpackage layout.css @author Llewellyn van der Merwe diff --git a/admin/assets/css/layouts.css b/admin/assets/css/layouts.css index 7d139d361..d97ef6d1e 100644 --- a/admin/assets/css/layouts.css +++ b/admin/assets/css/layouts.css @@ -9,9 +9,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 65 of this MVC + @build 18th October, 2016 + @created 18th May, 2015 @package Component Builder @subpackage layouts.css @author Llewellyn van der Merwe diff --git a/admin/assets/css/site_view.css b/admin/assets/css/site_view.css index 1d0734d08..7b910499d 100644 --- a/admin/assets/css/site_view.css +++ b/admin/assets/css/site_view.css @@ -9,9 +9,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 44 of this MVC + @build 29th January, 2017 + @created 29th May, 2015 @package Component Builder @subpackage site_view.css @author Llewellyn van der Merwe diff --git a/admin/assets/css/site_views.css b/admin/assets/css/site_views.css index a6988da86..ff1c18eb7 100644 --- a/admin/assets/css/site_views.css +++ b/admin/assets/css/site_views.css @@ -9,9 +9,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 44 of this MVC + @build 29th January, 2017 + @created 29th May, 2015 @package Component Builder @subpackage site_views.css @author Llewellyn van der Merwe diff --git a/admin/assets/css/snippet.css b/admin/assets/css/snippet.css index f1a2c89d2..e01c30d14 100644 --- a/admin/assets/css/snippet.css +++ b/admin/assets/css/snippet.css @@ -9,9 +9,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 16 of this MVC + @build 20th October, 2016 + @created 19th May, 2015 @package Component Builder @subpackage snippet.css @author Llewellyn van der Merwe diff --git a/admin/assets/css/snippets.css b/admin/assets/css/snippets.css index fd91116ce..799e5ba2d 100644 --- a/admin/assets/css/snippets.css +++ b/admin/assets/css/snippets.css @@ -9,9 +9,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 16 of this MVC + @build 20th October, 2016 + @created 19th May, 2015 @package Component Builder @subpackage snippets.css @author Llewellyn van der Merwe diff --git a/admin/assets/css/template.css b/admin/assets/css/template.css index 5258bb680..c369f6583 100644 --- a/admin/assets/css/template.css +++ b/admin/assets/css/template.css @@ -9,9 +9,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 39 of this MVC + @build 18th October, 2016 + @created 26th May, 2015 @package Component Builder @subpackage template.css @author Llewellyn van der Merwe diff --git a/admin/assets/css/templates.css b/admin/assets/css/templates.css index e9293896e..561bae8ef 100644 --- a/admin/assets/css/templates.css +++ b/admin/assets/css/templates.css @@ -9,9 +9,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 39 of this MVC + @build 18th October, 2016 + @created 26th May, 2015 @package Component Builder @subpackage templates.css @author Llewellyn van der Merwe diff --git a/admin/assets/images/icons/custom_codes.png b/admin/assets/images/icons/custom_codes.png new file mode 100644 index 000000000..5276474ea Binary files /dev/null and b/admin/assets/images/icons/custom_codes.png differ diff --git a/admin/compiler/joomla_3/wideimage/Canvas.php b/admin/compiler/joomla_3/wideimage/Canvas.php deleted file mode 100644 index 359ef51bc..000000000 --- a/admin/compiler/joomla_3/wideimage/Canvas.php +++ /dev/null @@ -1,167 +0,0 @@ -handle = $img->getHandle(); - $this->image = $img; - } - - /** - * Sets the active font. Can be an instance of - * WideImage_Font_TTF, WideImage_Font_PS, or WideImage_Font_GDF. - * - * - * - * - * @param object $font Font object to set for writeText() - */ - function setFont($font) - { - $this->font = $font; - } - - /** - * Creates and sets the current font - * - * The supported font types are: TTF/OTF, PS, and GDF. - * Font type is detected from the extension. If the $file parameter doesn't have an extension, TTF font is presumed. - * - * Note: not all parameters are supported by all fonts. - * - * @param string $file Font file name (string) - * @param int $size Font size (supported for TTF/OTF and PS fonts, ignored for GDF) - * @param int $color Text color - * @param int $bgcolor Background color (supported only for PS font, ignored for TTF and PS) - * @return mixed One of the WideImage_Font_* objects - */ - function useFont($file, $size = 12, $color = 0, $bgcolor = null) - { - $p = strrpos($file, '.'); - if ($p === false || $p < strlen($file) - 4) - $ext = 'ttf'; - else - $ext = strtolower(substr($file, $p + 1)); - - if ($ext == 'ttf' || $ext == 'otf') - $font = new WideImage_Font_TTF($file, $size, $color); - elseif ($ext == 'ps') - $font = new WideImage_Font_PS($file, $size, $color, $bgcolor); - elseif ($ext == 'gdf') - $font = new WideImage_Font_GDF($file, $color); - else - throw new WideImage_InvalidFontFileException("'$file' appears to be an invalid font file."); - - $this->setFont($font); - return $font; - } - - /** - * Write text on the image at specified position - * - * You must set a font with a call to WideImage_Canvas::setFont() prior to writing text to the image. - * - * Smart coordinates are supported for $x and $y arguments, but currently only for TTF/OTF fonts. - * - * Example: - * - * $img = WideImage::load('pic.jpg'); - * $canvas = $img->getCanvas(); - * $canvas->useFont('Verdana.ttf', 16, $img->allocateColor(255, 0, 0)); - * $canvas->writeText('right', 'bottom', 'www.website.com'); - * - * - * @param int $x Left - * @param int $y Top - * @param string $text Text to write - * @param int $angle The angle, defaults to 0 - */ - function writeText($x, $y, $text, $angle = 0) - { - if ($this->font === null) - throw new WideImage_NoFontException("Can't write text without a font."); - - $angle = - floatval($angle); - if ($angle < 0) - $angle = 360 + $angle; - $angle = $angle % 360; - - $this->font->writeText($this->image, $x, $y, $text, $angle); - } - - /** - * A magic method that allows you to call any PHP function that starts with "image". - * - * This is a shortcut to call custom functions on the image handle. - * - * Example: - * - * $img = WideImage::load('pic.jpg'); - * $canvas = $img->getCanvas(); - * $canvas->filledRect(10, 10, 20, 30, $img->allocateColor(0, 0, 0)); - * $canvas->line(60, 80, 30, 100, $img->allocateColor(255, 0, 0)); - * - */ - function __call($method, $params) - { - if (function_exists('image' . $method)) - { - array_unshift($params, $this->handle); - call_user_func_array('image' . $method, $params); - } - else - throw new WideImage_InvalidCanvasMethodException("Function doesn't exist: image{$method}."); - } - } diff --git a/admin/compiler/joomla_3/wideimage/Coordinate.php b/admin/compiler/joomla_3/wideimage/Coordinate.php deleted file mode 100644 index a3f6f6373..000000000 --- a/admin/compiler/joomla_3/wideimage/Coordinate.php +++ /dev/null @@ -1,208 +0,0 @@ - 'operand', 'value' => trim($current_operand)); - - $current_operand = ''; - $flush_operand = false; - } - - if ($flush_operator) - { - $tokens[] = array('type' => 'operator', 'value' => $char); - $flush_operator = false; - } - } - return $tokens; - } - - /** - * Evaluates the $coord relatively to $dim - * - * @param string $coord A numeric value or percent string - * @param int $dim Dimension - * @param int $sec_dim Secondary dimension (for align) - * @return int Calculated value - */ - static function evaluate($coord, $dim, $sec_dim = null) - { - $comp_regex = implode('|', self::$coord_align) . '|' . implode('|', self::$coord_numeric); - if (preg_match("/^([+-])?({$comp_regex})$/", $coord, $matches)) - { - $sign = intval($matches[1] . "1"); - $val = $matches[2]; - if (in_array($val, self::$coord_align)) - { - if ($sec_dim === null) - { - switch ($val) - { - case 'left': - case 'top': - return 0; - break; - case 'center': - case 'middle': - return $sign * intval($dim / 2); - break; - case 'right': - case 'bottom': - return $sign * $dim; - break; - default: - return null; - } - } - else - { - switch ($val) - { - case 'left': - case 'top': - return 0; - break; - case 'center': - case 'middle': - return $sign * intval($dim / 2 - $sec_dim / 2); - break; - case 'right': - case 'bottom': - return $sign * ($dim - $sec_dim); - break; - default: - return null; - } - } - } - elseif (substr($val, -1) === '%') - return intval(round($sign * $dim * floatval(str_replace('%', '', $val)) / 100)); - else - return $sign * intval(round($val)); - } - } - - /** - * Calculates and fixes a smart coordinate into a numeric value - * - * @param mixed $value Smart coordinate, relative to $dim - * @param int $dim Coordinate to which $value is relative - * @param int $sec_dim Secondary dimension (for align) - * @return int Calculated value - */ - static function fix($value, $dim, $sec_dim = null) - { - $coord_tokens = self::parse($value); - - if (count($coord_tokens) == 0 || $coord_tokens[count($coord_tokens) - 1]['type'] != 'operand') - throw new WideImage_InvalidCoordinateException("Couldn't parse coordinate '$value' properly."); - - $value = 0; - $operation = 1; - foreach ($coord_tokens as $token) - { - if ($token['type'] == 'operand') - { - $operand_value = self::evaluate($token['value'], $dim, $sec_dim); - if ($operation == 1) - $value = $value + $operand_value; - elseif ($operation == -1) - $value = $value - $operand_value; - else - throw new WideImage_InvalidCoordinateException("Invalid coordinate syntax."); - - $operation = 0; - } - elseif ($token['type'] == 'operator') - { - if ($token['value'] == '-') - { - if ($operation == 0) - $operation = -1; - else - $operation = $operation * -1; - } - elseif ($token['value'] == '+') - { - if ($operation == 0) - $operation = '1'; - } - } - } - return $value; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Exception.php b/admin/compiler/joomla_3/wideimage/Exception.php deleted file mode 100644 index 0aae4f0f9..000000000 --- a/admin/compiler/joomla_3/wideimage/Exception.php +++ /dev/null @@ -1,31 +0,0 @@ -= 1 && $face <= 5) - $this->font = $face; - else - $this->font = imageloadfont($face); - $this->color = $color; - } - - function writeText($image, $x, $y, $text) - { - imagestring($image->getHandle(), $this->font, $x, $y, $text, $this->color); - } - } diff --git a/admin/compiler/joomla_3/wideimage/Font/PS.php b/admin/compiler/joomla_3/wideimage/Font/PS.php deleted file mode 100644 index 9359e2e5c..000000000 --- a/admin/compiler/joomla_3/wideimage/Font/PS.php +++ /dev/null @@ -1,60 +0,0 @@ -handle = imagepsloadfont($file); - $this->size = $size; - $this->color = $color; - if ($bgcolor === null) - $this->bgcolor = $color; - else - $this->color = $color; - } - - function writeText($image, $x, $y, $text, $angle = 0) - { - if ($image->isTrueColor()) - $image->alphaBlending(true); - - imagepstext($image->getHandle(), $text, $this->handle, $this->size, $this->color, $this->bgcolor, $x, $y, 0, 0, $angle, 4); - } - - function __destruct() - { - imagepsfreefont($this->handle); - $this->handle = null; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Font/TTF.php b/admin/compiler/joomla_3/wideimage/Font/TTF.php deleted file mode 100644 index 10877117f..000000000 --- a/admin/compiler/joomla_3/wideimage/Font/TTF.php +++ /dev/null @@ -1,75 +0,0 @@ -face = $face; - $this->size = $size; - $this->color = $color; - } - - /** - * Writes text onto an image - * - * @param WideImage_Image $image - * @param mixed $x smart coordinate - * @param mixed $y smart coordinate - * @param string $text - * @param int $angle Angle in degrees clockwise - */ - function writeText($image, $x, $y, $text, $angle = 0) - { - if ($image->isTrueColor()) - $image->alphaBlending(true); - - $box = imageftbbox($this->size, $angle, $this->face, $text); - $obox = array( - 'left' => min($box[0], $box[2], $box[4], $box[6]), - 'top' => min($box[1], $box[3], $box[5], $box[7]), - 'right' => max($box[0], $box[2], $box[4], $box[6]) - 1, - 'bottom' => max($box[1], $box[3], $box[5], $box[7]) - 1 - ); - $obox['width'] = abs($obox['left']) + abs($obox['right']); - $obox['height'] = abs($obox['top']) + abs($obox['bottom']); - - $x = WideImage_Coordinate::fix($x, $image->getWidth(), $obox['width']); - $y = WideImage_Coordinate::fix($y, $image->getHeight(), $obox['height']); - - $fixed_x = $x - $obox['left']; - $fixed_y = $y - $obox['top']; - - imagettftext($image->getHandle(), $this->size, $angle, $fixed_x, $fixed_y, $this->color, $this->face, $text); - } - } diff --git a/admin/compiler/joomla_3/wideimage/Image.php b/admin/compiler/joomla_3/wideimage/Image.php deleted file mode 100644 index 3a9928000..000000000 --- a/admin/compiler/joomla_3/wideimage/Image.php +++ /dev/null @@ -1,964 +0,0 @@ -handle = $handle; - } - - /** - * Cleanup - * - * Destroys the handle via WideImage_Image::destroy() when called by the GC. - */ - function __destruct() - { - $this->destroy(); - } - - /** - * This method destroy the image handle, and releases the image resource. - * - * After this is called, the object doesn't hold a valid image any more. - * No operation should be called after that. - */ - function destroy() - { - if ($this->isValid() && !$this->handleReleased) - imagedestroy($this->handle); - - $this->handle = null; - } - - /** - * Returns the GD image resource - * - * @return resource GD image resource - */ - function getHandle() - { - return $this->handle; - } - - /** - * @return bool True, if the image object holds a valid GD image, false otherwise - */ - function isValid() - { - return WideImage::isValidImageHandle($this->handle); - } - - /** - * Releases the handle - */ - function releaseHandle() - { - $this->handleReleased = true; - } - - /** - * Saves an image to a file - * - * The file type is recognized from the $uri. If you save to a GIF8, truecolor images - * are automatically converted to palette. - * - * This method supports additional parameters: quality (for jpeg images) and - * compression quality and filters (for png images). See http://www.php.net/imagejpeg and - * http://www.php.net/imagepng for details. - * - * Examples: - * - * // save to a GIF - * $image->saveToFile('image.gif'); - * - * // save to a PNG with compression=7 and no filters - * $image->saveToFile('image.png', 7, PNG_NO_FILTER); - * - * // save to a JPEG with quality=80 - * $image->saveToFile('image.jpg', 80); - * - * // save to a JPEG with default quality=100 - * $image->saveToFile('image.jpg'); - * - * - * @param string $uri File location - */ - function saveToFile($uri) - { - $mapper = WideImage_MapperFactory::selectMapper($uri, null); - $args = func_get_args(); - array_unshift($args, $this->getHandle()); - $res = call_user_func_array(array($mapper, 'save'), $args); - if (!$res) - throw new WideImage_UnknownErrorWhileMappingException(get_class($mapper) . " returned an invalid result while saving to $uri"); - } - - /** - * Returns binary string with image data in format specified by $format - * - * Additional parameters may be passed to the function. See WideImage_Image::saveToFile() for more details. - * - * @param string $format The format of the image - * @return string The binary image data in specified format - */ - function asString($format) - { - ob_start(); - $args = func_get_args(); - $args[0] = null; - array_unshift($args, $this->getHandle()); - - $mapper = WideImage_MapperFactory::selectMapper(null, $format); - $res = call_user_func_array(array($mapper, 'save'), $args); - if (!$res) - throw new WideImage_UnknownErrorWhileMappingException(get_class($mapper) . " returned an invalid result while writing the image data"); - - return ob_get_clean(); - } - - /** - * Output a header to browser. - * - * @param $name Name of the header - * @param $data Data - */ - protected function writeHeader($name, $data) - { - header($name . ": " . $data); - } - - /** - * Outputs the image to browser - * - * Sets headers Content-length and Content-type, and echoes the image in the specified format. - * All other headers (such as Content-disposition) must be added manually. - * - * Example: - * - * WideImage::load('image1.png')->resize(100, 100)->output('gif'); - * - * - * @param string $format Image format - */ - function output($format) - { - $args = func_get_args(); - $data = call_user_func_array(array($this, 'asString'), $args); - - $this->writeHeader('Content-length', strlen($data)); - $this->writeHeader('Content-type', WideImage_MapperFactory::mimeType($format)); - echo $data; - } - - /** - * @return int Image width - */ - function getWidth() - { - return imagesx($this->handle); - } - - /** - * @return int Image height - */ - function getHeight() - { - return imagesy($this->handle); - } - - /** - * Allocate a color by RGB values. - * - * @param mixed $R Red-component value or an RGB array (with red, green, blue keys) - * @param int $G If $R is int, this is the green component - * @param int $B If $R is int, this is the blue component - * @return int Image color index - */ - function allocateColor($R, $G = null, $B = null) - { - if (is_array($R)) - return imageColorAllocate($this->handle, $R['red'], $R['green'], $R['blue']); - else - return imageColorAllocate($this->handle, $R, $G, $B); - } - - /** - * @return bool True if the image is transparent, false otherwise - */ - function isTransparent() - { - return $this->getTransparentColor() >= 0; - } - - /** - * @return int Transparent color index - */ - function getTransparentColor() - { - return imagecolortransparent($this->handle); - } - - /** - * Sets the current transparent color index. Only makes sense for palette images (8-bit). - * - * @param int $color Transparent color index - */ - function setTransparentColor($color) - { - return imagecolortransparent($this->handle, $color); - } - - /** - * Returns a RGB array of the transparent color or null if none. - * - * @return mixed Transparent color RGBA array - */ - function getTransparentColorRGB() - { - $total = imagecolorstotal($this->handle); - $tc = $this->getTransparentColor(); - - if ($tc >= $total && $total > 0) - return null; - else - return $this->getColorRGB($tc); - } - - /** - * Returns a RGBA array for pixel at $x, $y - * - * @param int $x - * @param int $y - * @return array RGB array - */ - function getRGBAt($x, $y) - { - return $this->getColorRGB($this->getColorAt($x, $y)); - } - - /** - * Writes a pixel at the designated coordinates - * - * Takes an associative array of colours and uses getExactColor() to - * retrieve the exact index color to write to the image with. - * - * @param int $x - * @param int $y - * @param array $color - */ - function setRGBAt($x, $y, $color) - { - $this->setColorAt($x, $y, $this->getExactColor($color)); - } - - /** - * Returns a color's RGB - * - * @param int $colorIndex Color index - * @return mixed RGBA array for a color with index $colorIndex - */ - function getColorRGB($colorIndex) - { - return imageColorsForIndex($this->handle, $colorIndex); - } - - /** - * Returns an index of the color at $x, $y - * - * @param int $x - * @param int $y - * @return int Color index for a pixel at $x, $y - */ - function getColorAt($x, $y) - { - return imagecolorat($this->handle, $x, $y); - } - - /** - * Set the color index $color to a pixel at $x, $y - * - * @param int $x - * @param int $y - * @param int $color Color index - */ - function setColorAt($x, $y, $color) - { - return imagesetpixel($this->handle, $x, $y, $color); - } - - /** - * Returns closest color index that matches the given RGB value. Uses - * PHP's imagecolorclosest() - * - * @param mixed $R Red or RGBA array - * @param int $G Green component (or null if $R is an RGB array) - * @param int $B Blue component (or null if $R is an RGB array) - * @return int Color index - */ - function getClosestColor($R, $G = null, $B = null) - { - if (is_array($R)) - return imagecolorclosest($this->handle, $R['red'], $R['green'], $R['blue']); - else - return imagecolorclosest($this->handle, $R, $G, $B); - } - - /** - * Returns the color index that exactly matches the given RGB value. Uses - * PHP's imagecolorexact() - * - * @param mixed $R Red or RGBA array - * @param int $G Green component (or null if $R is an RGB array) - * @param int $B Blue component (or null if $R is an RGB array) - * @return int Color index - */ - function getExactColor($R, $G = null, $B = null) - { - if (is_array($R)) - return imagecolorexact($this->handle, $R['red'], $R['green'], $R['blue']); - else - return imagecolorexact($this->handle, $R, $G, $B); - } - - /** - * Copies transparency information from $sourceImage. Optionally fills - * the image with the transparent color at (0, 0). - * - * @param object $sourceImage - * @param bool $fill True if you want to fill the image with transparent color - */ - function copyTransparencyFrom($sourceImage, $fill = true) - { - if ($sourceImage->isTransparent()) - { - $rgba = $sourceImage->getTransparentColorRGB(); - if ($rgba === null) - return; - - if ($this->isTrueColor()) - { - $rgba['alpha'] = 127; - $color = $this->allocateColorAlpha($rgba); - } - else - $color = $this->allocateColor($rgba); - - $this->setTransparentColor($color); - if ($fill) - $this->fill(0, 0, $color); - } - } - - /** - * Fill the image at ($x, $y) with color index $color - * - * @param int $x - * @param int $y - * @param int $color - */ - function fill($x, $y, $color) - { - return imagefill($this->handle, $x, $y, $color); - } - - /** - * Used internally to create Operation objects - * - * @param string $name - * @return object - */ - protected function getOperation($name) - { - return WideImage_OperationFactory::get($name); - } - - /** - * Returns the image's mask - * - * Mask is a greyscale image where the shade defines the alpha channel (black = transparent, white = opaque). - * - * For opaque images (JPEG), the result will be white. For images with single-color transparency (GIF, 8-bit PNG), - * the areas with the transparent color will be black. For images with alpha channel transparenct, - * the result will be alpha channel. - * - * @return WideImage_Image An image mask - **/ - function getMask() - { - return $this->getOperation('GetMask')->execute($this); - } - - /** - * Resize the image to given dimensions. - * - * $width and $height are both smart coordinates. This means that you can pass any of these values in: - * - positive or negative integer (100, -20, ...) - * - positive or negative percent string (30%, -15%, ...) - * - complex coordinate (50% - 20, 15 + 30%, ...) - * - * If $width is null, it's calculated proportionally from $height, and vice versa. - * - * Example (resize to half-size): - * - * $smaller = $image->resize('50%'); - * - * $smaller = $image->resize('100', '100', 'inside', 'down'); - * is the same as - * $smaller = $image->resizeDown(100, 100, 'inside'); - * - * - * @param mixed $width The new width (smart coordinate), or null. - * @param mixed $height The new height (smart coordinate), or null. - * @param string $fit 'inside', 'outside', 'fill' - * @param string $scale 'down', 'up', 'any' - * @return WideImage_Image The resized image - */ - function resize($width = null, $height = null, $fit = 'inside', $scale = 'any') - { - return $this->getOperation('Resize')->execute($this, $width, $height, $fit, $scale); - } - - /** - * Same as WideImage_Image::resize(), but the image is only applied if it is larger then the given dimensions. - * Otherwise, the resulting image retains the source's dimensions. - * - * @param int $width New width, smart coordinate - * @param int $height New height, smart coordinate - * @param string $fit 'inside', 'outside', 'fill' - * @return WideImage_Image resized image - */ - function resizeDown($width = null, $height = null, $fit = 'inside') - { - return $this->resize($width, $height, $fit, 'down'); - } - - /** - * Same as WideImage_Image::resize(), but the image is only applied if it is smaller then the given dimensions. - * Otherwise, the resulting image retains the source's dimensions. - * - * @param int $width New width, smart coordinate - * @param int $height New height, smart coordinate - * @param string $fit 'inside', 'outside', 'fill' - * @return WideImage_Image resized image - */ - function resizeUp($width = null, $height = null, $fit = 'inside') - { - return $this->resize($width, $height, $fit, 'up'); - } - - /** - * Rotate the image for angle $angle clockwise. - * - * Preserves transparency. Has issues when saving to a BMP. - * - * @param int $angle Angle in degrees, clock-wise - * @param int $bgColor color of the new background - * @param bool $ignoreTransparent - * @return WideImage_Image The rotated image - */ - function rotate($angle, $bgColor = null, $ignoreTransparent = true) - { - return $this->getOperation('Rotate')->execute($this, $angle, $bgColor, $ignoreTransparent); - } - - /** - * This method lays the overlay (watermark) on the image. - * - * Hint: if the overlay is a truecolor image with alpha channel, you should leave $pct at 100. - * - * This operation supports alignment notation in coordinates: - * - * $watermark = WideImage::load('logo.gif'); - * $base = WideImage::load('picture.jpg'); - * $result = $base->merge($watermark, "right - 10", "bottom - 10", 50); - * // applies a logo aligned to bottom-right corner with a 10 pixel margin - * - * - * @param WideImage_Image $overlay The overlay image - * @param mixed $left Left position of the overlay, smart coordinate - * @param mixed $top Top position of the overlay, smart coordinate - * @param int $pct The opacity of the overlay - * @return WideImage_Image The merged image - */ - function merge($overlay, $left = 0, $top = 0, $pct = 100) - { - return $this->getOperation('Merge')->execute($this, $overlay, $left, $top, $pct); - } - - /** - * Resizes the canvas of the image, but doesn't scale the content of the image - * - * This operation creates an empty canvas with dimensions $width x $height, filled with - * background color $bg_color and draws the original image onto it at position [$pos_x, $pos_y]. - * - * Arguments $width, $height, $pos_x and $pos_y are all smart coordinates. $width and $height are - * relative to the current image size, $pos_x and $pos_y are relative to the newly calculated - * canvas size. This can be confusing, but it makes sense. See the example below. - * - * The example below loads a 100x150 image and then resizes its canvas to 200% x 100%+20 - * (which evaluates to 200x170). The image is placed at position [10, center+20], which evaluates to [10, 30]. - * - * $image = WideImage::load('someimage.jpg'); // 100x150 - * $white = $image->allocateColor(255, 255, 255); - * $image->resizeCanvas('200%', '100% + 20', 10, 'center+20', $white); - * - * - * The parameter $merge defines whether the original image should be merged onto the new canvas. - * This means it blends transparent color and alpha colors into the background color. If set to false, - * the original image is just copied over, preserving the transparency/alpha information. - * - * You can set the $scale parameter to limit when to resize the canvas. For example, if you want - * to resize the canvas only if the image is smaller than the new size, but leave the image intact - * if it's larger, set it to 'up'. Likewise, if you want to shrink the canvas, but don't want to - * change images that are already smaller, set it to 'down'. - * - * @param mixed $width Width of the new canvas (smart coordinate, relative to current image width) - * @param mixed $height Height of the new canvas (smart coordinate, relative to current image height) - * @param mixed $pos_x x-position of the image (smart coordinate, relative to the new width) - * @param mixed $pos_y y-position of the image (smart coordinate, relative to the new height) - * @param int $bg_color Background color (created with allocateColor or allocateColorAlpha), defaults to null (tries to use a transparent color) - * @param string $scale Possible values: 'up' (enlarge only), 'down' (downsize only), 'any' (resize precisely to $width x $height). Defaults to 'any'. - * @param bool $merge Merge the original image (flatten alpha channel and transparency) or copy it over (preserve). Defaults to false. - * @return WideImage_Image The resulting image with resized canvas - */ - function resizeCanvas($width, $height, $pos_x, $pos_y, $bg_color = null, $scale = 'any', $merge = false) - { - return $this->getOperation('ResizeCanvas')->execute($this, $width, $height, $pos_x, $pos_y, $bg_color, $scale, $merge); - } - - /** - * Returns an image with round corners - * - * You can either set the corners' color or set them transparent. - * - * Note on $smoothness: 1 means jagged edges, 2 is much better, more than 4 doesn't noticeably improve the quality. - * Rendering becomes increasingly slower if you increase smoothness. - * - * Example: - * - * $nice = $ugly->roundCorners(20, $ugly->allocateColor(255, 0, 0), 2); - * - * - * Use $corners parameter to specify which corners to draw rounded. Possible values are - * WideImage::SIDE_TOP_LEFT, WideImage::SIDE_TOP, - * WideImage::SIDE_TOP_RIGHT, WideImage::SIDE_RIGHT, - * WideImage::SIDE_BOTTOM_RIGHT, WideImage::SIDE_BOTTOM, - * WideImage::SIDE_BOTTOM_LEFT, WideImage::SIDE_LEFT, and WideImage::SIDE_ALL. - * You can specify any combination of corners with a + operation, see example below. - * - * Example: - * - * $white = $image->allocateColor(255, 255, 255); - * $diagonal_corners = $image->roundCorners(15, $white, 2, WideImage::SIDE_TOP_LEFT + WideImage::SIDE_BOTTOM_RIGHT); - * $right_corners = $image->roundCorners(15, $white, 2, WideImage::SIDE_RIGHT); - * - * - * @param int $radius Radius of the corners - * @param int $color The color of corners. If null, corners are rendered transparent (slower than using a solid color). - * @param int $smoothness Specify the level of smoothness. Suggested values from 1 to 4. - * @param int $corners Specify which corners to draw (defaults to WideImage::SIDE_ALL = all corners) - * @return WideImage_Image The resulting image with round corners - */ - function roundCorners($radius, $color = null, $smoothness = 2, $corners = 255) - { - return $this->getOperation('RoundCorners')->execute($this, $radius, $color, $smoothness, $corners); - } - - /** - * Returns an image with applied mask - * - * A mask is a grayscale image, where the shade determines the alpha channel. Black is fully transparent - * and white is fully opaque. - * - * @param WideImage_Image $mask The mask image, greyscale - * @param mixed $left Left coordinate, smart coordinate - * @param mixed $top Top coordinate, smart coordinate - * @return WideImage_Image The resulting image - **/ - function applyMask($mask, $left = 0, $top = 0) - { - return $this->getOperation('ApplyMask')->execute($this, $mask, $left, $top); - } - - /** - * Applies a filter - * - * @param int $filter One of the IMG_FILTER_* constants - * @param int $arg1 - * @param int $arg2 - * @param int $arg3 - * @param int $arg4 - * @return WideImage_Image - */ - function applyFilter($filter, $arg1 = null, $arg2 = null, $arg3 = null, $arg4 = null) - { - return $this->getOperation('ApplyFilter')->execute($this, $filter, $arg1, $arg2, $arg3, $arg4); - } - - /** - * Applies convolution matrix with imageconvolution() - * - * @param array $matrix - * @param float $div - * @param float $offset - * @return WideImage_Image - */ - function applyConvolution($matrix, $div, $offset) - { - return $this->getOperation('ApplyConvolution')->execute($this, $matrix, $div, $offset); - } - - /** - * Returns a cropped rectangular portion of the image - * - * If the rectangle specifies area that is out of bounds, it's limited to the current image bounds. - * - * Examples: - * - * $cropped = $img->crop(10, 10, 150, 200); // crops a 150x200 rect at (10, 10) - * $cropped = $img->crop(-100, -50, 100, 50); // crops a 100x50 rect at the right-bottom of the image - * $cropped = $img->crop('25%', '25%', '50%', '50%'); // crops a 50%x50% rect from the center of the image - * - * - * This operation supports alignment notation in left/top coordinates. - * Example: - * - * $cropped = $img->crop("right", "bottom", 100, 200); // crops a 100x200 rect from right bottom - * $cropped = $img->crop("center", "middle", 50, 30); // crops a 50x30 from the center of the image - * - * - * @param mixed $left Left-coordinate of the crop rect, smart coordinate - * @param mixed $top Top-coordinate of the crop rect, smart coordinate - * @param mixed $width Width of the crop rect, smart coordinate - * @param mixed $height Height of the crop rect, smart coordinate - * @return WideImage_Image The cropped image - **/ - function crop($left = 0, $top = 0, $width = '100%', $height = '100%') - { - return $this->getOperation('Crop')->execute($this, $left, $top, $width, $height); - } - - /** - * Performs an auto-crop on the image - * - * The image is auto-cropped from each of four sides. All sides are - * scanned for pixels that differ from $base_color for more than - * $rgb_threshold in absolute RGB difference. If more than $pixel_cutoff - * differentiating pixels are found, that line is considered to be the crop line for the side. - * If the line isn't different enough, the algorithm procedes to the next line - * towards the other edge of the image. - * - * When the crop rectangle is found, it's enlarged by the $margin value on each of the four sides. - * - * @param int $margin Margin for the crop rectangle, can be negative. - * @param int $rgb_threshold RGB difference which still counts as "same color". - * @param int $pixel_cutoff How many pixels need to be different to mark a cut line. - * @param int $base_color The base color index. If none specified (or null given), left-top pixel is used. - * @return WideImage_Image The cropped image - */ - function autoCrop($margin = 0, $rgb_threshold = 0, $pixel_cutoff = 1, $base_color = null) - { - return $this->getOperation('AutoCrop')->execute($this, $margin, $rgb_threshold, $pixel_cutoff, $base_color); - } - - /** - * Returns a negative of the image - * - * This operation differs from calling WideImage_Image::applyFilter(IMG_FILTER_NEGATIVE), because it's 8-bit and transparency safe. - * This means it will return an 8-bit image, if the source image is 8-bit. If that 8-bit image has a palette transparency, - * the resulting image will keep transparency. - * - * @return WideImage_Image negative of the image - */ - function asNegative() - { - return $this->getOperation('AsNegative')->execute($this); - } - - /** - * Returns a grayscale copy of the image - * - * @return WideImage_Image grayscale copy - **/ - function asGrayscale() - { - return $this->getOperation('AsGrayscale')->execute($this); - } - - /** - * Returns a mirrored copy of the image - * - * @return WideImage_Image Mirrored copy - **/ - function mirror() - { - return $this->getOperation('Mirror')->execute($this); - } - - /** - * Applies the unsharp filter - * - * @param float $amount - * @param float $radius - * @param float $threshold - * @return WideImage_Image Unsharpened copy of the image - **/ - function unsharp($amount, $radius, $threshold) - { - return $this->getOperation('Unsharp')->execute($this, $amount, $radius, $threshold); - } - - /** - * Returns a flipped (mirrored over horizontal line) copy of the image - * - * @return WideImage_Image Flipped copy - **/ - function flip() - { - return $this->getOperation('Flip')->execute($this); - } - - /** - * Corrects gamma on the image - * - * @param float $inputGamma - * @param float $outputGamma - * @return WideImage_Image Image with corrected gamma - **/ - function correctGamma($inputGamma, $outputGamma) - { - return $this->getOperation('CorrectGamma')->execute($this, $inputGamma, $outputGamma); - } - - /** - * Adds noise to the image - * - * @author Tomasz Kapusta - * - * @param int $amount Number of noise pixels to add - * @param string $type Type of noise 'salt&pepper', 'color' or 'mono' - * @return WideImage_Image Image with noise added - **/ - function addNoise($amount, $type) - { - return $this->getOperation('AddNoise')->execute($this, $amount, $type); - } - - /** - * Used internally to execute operations - * - * @param string $name - * @param array $args - * @return WideImage_Image - */ - function __call($name, $args) - { - $op = $this->getOperation($name); - array_unshift($args, $this); - return call_user_func_array(array($op, 'execute'), $args); - } - - /** - * Returns an image in GIF or PNG format - * - * @return string - */ - function __toString() - { - if ($this->isTransparent()) - return $this->asString('gif'); - else - return $this->asString('png'); - } - - /** - * Returns a copy of the image object - * - * @return WideImage_Image The copy - **/ - function copy() - { - $dest = $this->doCreate($this->getWidth(), $this->getHeight()); - $dest->copyTransparencyFrom($this, true); - $this->copyTo($dest, 0, 0); - return $dest; - } - - /** - * Copies this image onto another image - * - * @param WideImage_Image $dest - * @param int $left - * @param int $top - **/ - function copyTo($dest, $left = 0, $top = 0) - { - if (!imagecopy($dest->getHandle(), $this->handle, $left, $top, 0, 0, $this->getWidth(), $this->getHeight())) - throw new WideImage_GDFunctionResultException("imagecopy() returned false"); - } - - /** - * Returns the canvas object - * - * The Canvas object can be used to draw text and shapes on the image - * - * Examples: - * - * $img = WideImage::load('pic.jpg); - * $canvas = $img->getCanvas(); - * $canvas->useFont('arial.ttf', 15, $img->allocateColor(200, 220, 255)); - * $canvas->writeText(10, 50, "Hello world!"); - * - * $canvas->filledRectangle(10, 10, 80, 40, $img->allocateColor(255, 127, 255)); - * $canvas->line(60, 80, 30, 100, $img->allocateColor(255, 0, 0)); - * $img->saveToFile('new.png'); - * - * - * @return WideImage_Canvas The Canvas object - **/ - function getCanvas() - { - if ($this->canvas == null) - $this->canvas = new WideImage_Canvas($this); - return $this->canvas; - } - - /** - * Returns true if the image is true-color, false otherwise - * - * @return bool - **/ - abstract function isTrueColor(); - - /** - * Returns a true-color copy of the image - * - * @return WideImage_TrueColorImage - **/ - abstract function asTrueColor(); - - /** - * Returns a palette copy (8bit) of the image - * - * @param int $nColors Number of colors in the resulting image, more than 0, less or equal to 255 - * @param bool $dither Use dithering or not - * @param bool $matchPalette Set to true to use imagecolormatch() to match the resulting palette more closely to the original image - * @return WideImage_Image - **/ - abstract function asPalette($nColors = 255, $dither = null, $matchPalette = true); - - /** - * Retrieve an image with selected channels - * - * Examples: - * - * $channels = $img->getChannels('red', 'blue'); - * $channels = $img->getChannels('alpha', 'green'); - * $channels = $img->getChannels(array('green', 'blue')); - * - * - * @return WideImage_Image - **/ - abstract function getChannels(); - - /** - * Returns an image without an alpha channel - * - * @return WideImage_Image - **/ - abstract function copyNoAlpha(); - - /** - * Returns an array of serializable protected variables. Called automatically upon serialize(). - * - * @return array - */ - function __sleep() - { - $this->sdata = $this->asString('png'); - return array('sdata', 'handleReleased'); - } - - /** - * Restores an image from serialization. Called automatically upon unserialize(). - */ - function __wakeup() - { - $temp_image = WideImage::loadFromString($this->sdata); - $temp_image->releaseHandle(); - $this->handle = $temp_image->handle; - $temp_image = null; - $this->sdata = null; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Mapper/BMP.php b/admin/compiler/joomla_3/wideimage/Mapper/BMP.php deleted file mode 100644 index 0620f0590..000000000 --- a/admin/compiler/joomla_3/wideimage/Mapper/BMP.php +++ /dev/null @@ -1,51 +0,0 @@ - 'JPEG', - 'image/jpeg' => 'JPEG', - 'image/pjpeg' => 'JPEG', - 'image/gif' => 'GIF', - 'image/png' => 'PNG' - ); - - /** - * Returns a mapper, based on the $uri and $format - * - * @param string $uri File URI - * @param string $format File format (extension or mime-type) or null - * @return WideImage_Mapper - **/ - static function selectMapper($uri, $format = null) - { - $format = self::determineFormat($uri, $format); - - if (array_key_exists($format, self::$mappers)) - return self::$mappers[$format]; - - $mapperClassName = 'WideImage_Mapper_' . $format; - - if (!class_exists($mapperClassName, false)) - { - $mapperFileName = WideImage::path() . 'Mapper/' . $format . '.php'; - if (file_exists($mapperFileName)) - require_once $mapperFileName; - } - - if (class_exists($mapperClassName)) - { - self::$mappers[$format] = new $mapperClassName(); - return self::$mappers[$format]; - } - - throw new WideImage_UnsupportedFormatException("Format '{$format}' is not supported."); - } - - static function registerMapper($mapper_class_name, $mime_type, $extension) - { - self::$customMappers[$mime_type] = $mapper_class_name; - self::$mimeTable[$mime_type] = $extension; - } - - static function getCustomMappers() - { - return self::$customMappers; - } - - static function determineFormat($uri, $format = null) - { - if ($format == null) - $format = self::extractExtension($uri); - - // mime-type match - if (preg_match('~[a-z]*/[a-z-]*~i', $format)) - if (isset(self::$mimeTable[strtolower($format)])) - { - return self::$mimeTable[strtolower($format)]; - } - - // clean the string - $format = strtoupper(preg_replace('/[^a-z0-9_-]/i', '', $format)); - if ($format == 'JPG') - $format = 'JPEG'; - - return $format; - } - - static function mimeType($format) - { - return array_search(strtoupper($format), self::$mimeTable); - } - - static function extractExtension($uri) - { - $p = strrpos($uri, '.'); - if ($p === false) - return ''; - else - return substr($uri, $p + 1); - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/AddNoise.php b/admin/compiler/joomla_3/wideimage/Operation/AddNoise.php deleted file mode 100644 index 5206c3ef3..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/AddNoise.php +++ /dev/null @@ -1,153 +0,0 @@ -asTrueColor(), $fun, $amount); - } - - /** - * Returns image with every pixel changed by specififed function - * - * @param WideImage_Image $image - * @param str $function - * @param int $value - * @return WideImage_Image - */ - function filter($image, $function, $value) - { - for ($y = 0; $y < $image->getHeight(); $y++) - { - for ($x = 0; $x< $image->getWidth(); $x++) - { - $rgb = imagecolorat($image->getHandle(), $x, $y); - - $a = ($rgb >> 24) & 0xFF; - $r = ($rgb >> 16) & 0xFF; - $g = ($rgb >> 8) & 0xFF; - $b = $rgb & 0xFF; - - - self::$function($r, $g, $b, $value); - - $color = imagecolorallocatealpha($image->getHandle(), $r, $g, $b, $a); - imagesetpixel($image->getHandle(), $x, $y, $color); - } - } - return $image; - } - /** - * Adds color noise by altering given R,G,B values using specififed amount - * - * @param int $r - * @param int $g - * @param int $b - * @param int $value - * @return void - */ - function colorNoise_fun(&$r, &$g, &$b, $amount) - { - $r = self::byte($r + mt_rand(0, $amount) - ($amount >> 1) ); - $g = self::byte($g + mt_rand(0, $amount) - ($amount >> 1) ); - $b = self::byte($b + mt_rand(0, $amount) - ($amount >> 1) ); - } - /** - * Adds mono noise by altering given R,G,B values using specififed amount - * - * @param int $r - * @param int $g - * @param int $b - * @param int $value - * @return void - */ - function monoNoise_fun(&$r, &$g, &$b, $amount) - { - $rand = mt_rand(0, $amount) - ($amount >> 1); - - $r = self::byte($r + $rand); - $g = self::byte($g + $rand); - $b = self::byte($b + $rand); - } - /** - * Adds salt&pepper noise by altering given R,G,B values using specififed amount - * - * @param int $r - * @param int $g - * @param int $b - * @param int $value - * @return void - */ - function saltPepperNoise_fun(&$r, &$g, &$b, $amount) - { - if (mt_rand(0, 255 - $amount) != 0) return; - - $rand = mt_rand(0, 1); - switch ($rand) - { - case 0 : $r = $g = $b = 0; - break; - case 1 : $r = $g = $b = 255; - break; - } - } - /** - * Returns value within (0,255) - * - * @param int $b - * @return int - */ - function byte($b) - { - if ($b > 255) return 255; - if ($b < 0) return 0; - return (int) $b; - } - - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/ApplyConvolution.php b/admin/compiler/joomla_3/wideimage/Operation/ApplyConvolution.php deleted file mode 100644 index 9a1c5f74c..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/ApplyConvolution.php +++ /dev/null @@ -1,48 +0,0 @@ -asTrueColor(); - if (!imageconvolution($new->getHandle(), $matrix, $div, $offset)) - throw new WideImage_GDFunctionResultException("imageconvolution() returned false"); - return $new; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/ApplyFilter.php b/admin/compiler/joomla_3/wideimage/Operation/ApplyFilter.php deleted file mode 100644 index ec6d210b2..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/ApplyFilter.php +++ /dev/null @@ -1,67 +0,0 @@ -asTrueColor(); - - if (in_array($filter, self::$one_arg_filters)) - $res = imagefilter($new->getHandle(), $filter, $arg1); - elseif (defined('IMG_FILTER_PIXELATE') && $filter == IMG_FILTER_PIXELATE) - $res = imagefilter($new->getHandle(), $filter, $arg1, $arg2); - elseif ($filter == IMG_FILTER_COLORIZE) - $res = imagefilter($new->getHandle(), $filter, $arg1, $arg2, $arg3, $arg4); - else - $res = imagefilter($new->getHandle(), $filter); - - if (!$res) - throw new WideImage_GDFunctionResultException("imagefilter() returned false"); - - return $new; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/ApplyMask.php b/admin/compiler/joomla_3/wideimage/Operation/ApplyMask.php deleted file mode 100644 index 949213f0c..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/ApplyMask.php +++ /dev/null @@ -1,105 +0,0 @@ -getWidth(), $mask->getWidth()); - $top = WideImage_Coordinate::fix($top, $image->getHeight(), $mask->getHeight()); - - $width = $image->getWidth(); - $mask_width = $mask->getWidth(); - - $height = $image->getHeight(); - $mask_height = $mask->getHeight(); - - $result = $image->asTrueColor(); - - $result->alphaBlending(false); - $result->saveAlpha(true); - - $srcTransparentColor = $result->getTransparentColor(); - if ($srcTransparentColor >= 0) - { - # this was here. works without. - #$trgb = $image->getColorRGB($srcTransparentColor); - #$trgb['alpha'] = 127; - #$destTransparentColor = $result->allocateColorAlpha($trgb); - #$result->setTransparentColor($destTransparentColor); - $destTransparentColor = $srcTransparentColor; - } - else - { - $destTransparentColor = $result->allocateColorAlpha(255, 255, 255, 127); - } - - for ($x = 0; $x < $width; $x++) - for ($y = 0; $y < $height; $y++) - { - $mx = $x - $left; - $my = $y - $top; - if ($mx >= 0 && $mx < $mask_width && $my >= 0 && $my < $mask_height) - { - $srcColor = $image->getColorAt($x, $y); - if ($srcColor == $srcTransparentColor) - $destColor = $destTransparentColor; - else - { - $maskRGB = $mask->getRGBAt($mx, $my); - if ($maskRGB['red'] == 0) - $destColor = $destTransparentColor; - elseif ($srcColor >= 0) - { - $imageRGB = $image->getRGBAt($x, $y); - $level = ($maskRGB['red'] / 255) * (1 - $imageRGB['alpha'] / 127); - $imageRGB['alpha'] = 127 - round($level * 127); - if ($imageRGB['alpha'] == 127) - $destColor = $destTransparentColor; - else - $destColor = $result->allocateColorAlpha($imageRGB); - } - else - $destColor = $destTransparentColor; - } - $result->setColorAt($x, $y, $destColor); - } - } - return $result; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/AsGrayscale.php b/admin/compiler/joomla_3/wideimage/Operation/AsGrayscale.php deleted file mode 100644 index dc72f8554..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/AsGrayscale.php +++ /dev/null @@ -1,49 +0,0 @@ -asTrueColor(); - if (!imagefilter($new->getHandle(), IMG_FILTER_GRAYSCALE)) - throw new WideImage_GDFunctionResultException("imagefilter() returned false"); - - if (!$image->isTrueColor()) - $new = $new->asPalette(); - - return $new; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/AsNegative.php b/admin/compiler/joomla_3/wideimage/Operation/AsNegative.php deleted file mode 100644 index 9a13c4297..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/AsNegative.php +++ /dev/null @@ -1,63 +0,0 @@ -isTrueColor(); - $transparent = $image->isTransparent(); - - if ($palette && $transparent) - $tcrgb = $image->getTransparentColorRGB(); - - $new = $image->asTrueColor(); - if (!imagefilter($new->getHandle(), IMG_FILTER_NEGATE)) - throw new WideImage_GDFunctionResultException("imagefilter() returned false"); - - if ($palette) - { - $new = $new->asPalette(); - if ($transparent) - { - $irgb = array('red' => 255 - $tcrgb['red'], 'green' => 255 - $tcrgb['green'], 'blue' => 255 - $tcrgb['blue'], 'alpha' => 127); - // needs imagecolorexactalpha instead of imagecolorexact, otherwise doesn't work on some transparent GIF images - $new_tci = imagecolorexactalpha($new->getHandle(), $irgb['red'], $irgb['green'], $irgb['blue'], 127); - $new->setTransparentColor($new_tci); - } - } - return $new; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/AutoCrop.php b/admin/compiler/joomla_3/wideimage/Operation/AutoCrop.php deleted file mode 100644 index 2fd0909e6..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/AutoCrop.php +++ /dev/null @@ -1,162 +0,0 @@ -getRGBAt(0, 0); - else - { - if ($base_color < 0) - return $img->copy(); - - $rgb_base = $img->getColorRGB($base_color); - } - - $cut_rect = array('left' => 0, 'top' => 0, 'right' => $img->getWidth() - 1, 'bottom' => $img->getHeight() - 1); - - for ($y = 0; $y <= $cut_rect['bottom']; $y++) - { - $count = 0; - for ($x = 0; $x <= $cut_rect['right']; $x++) - { - $rgb = $img->getRGBAt($x, $y); - $diff = abs($rgb['red'] - $rgb_base['red']) + abs($rgb['green'] - $rgb_base['green']) + abs($rgb['blue'] - $rgb_base['blue']); - if ($diff > $rgb_threshold) - { - $count++; - if ($count >= $pixel_cutoff) - { - $cut_rect['top'] = $y; - break 2; - } - } - } - } - - for ($y = $img->getHeight() - 1; $y >= $cut_rect['top']; $y--) - { - $count = 0; - for ($x = 0; $x <= $cut_rect['right']; $x++) - { - $rgb = $img->getRGBAt($x, $y); - $diff = abs($rgb['red'] - $rgb_base['red']) + abs($rgb['green'] - $rgb_base['green']) + abs($rgb['blue'] - $rgb_base['blue']); - if ($diff > $rgb_threshold) - { - $count++; - if ($count >= $pixel_cutoff) - { - $cut_rect['bottom'] = $y; - break 2; - } - } - } - } - - for ($x = 0; $x <= $cut_rect['right']; $x++) - { - $count = 0; - for ($y = $cut_rect['top']; $y <= $cut_rect['bottom']; $y++) - { - $rgb = $img->getRGBAt($x, $y); - $diff = abs($rgb['red'] - $rgb_base['red']) + abs($rgb['green'] - $rgb_base['green']) + abs($rgb['blue'] - $rgb_base['blue']); - if ($diff > $rgb_threshold) - { - $count++; - if ($count >= $pixel_cutoff) - { - $cut_rect['left'] = $x; - break 2; - } - } - } - } - - for ($x = $cut_rect['right']; $x >= $cut_rect['left']; $x--) - { - $count = 0; - for ($y = $cut_rect['top']; $y <= $cut_rect['bottom']; $y++) - { - $rgb = $img->getRGBAt($x, $y); - $diff = abs($rgb['red'] - $rgb_base['red']) + abs($rgb['green'] - $rgb_base['green']) + abs($rgb['blue'] - $rgb_base['blue']); - if ($diff > $rgb_threshold) - { - $count++; - if ($count >= $pixel_cutoff) - { - $cut_rect['right'] = $x; - break 2; - } - } - } - } - - $cut_rect = array( - 'left' => $cut_rect['left'] - $margin, - 'top' => $cut_rect['top'] - $margin, - 'right' => $cut_rect['right'] + $margin, - 'bottom' => $cut_rect['bottom'] + $margin - ); - - if ($cut_rect['left'] < 0) - $cut_rect['left'] = 0; - - if ($cut_rect['top'] < 0) - $cut_rect['top'] = 0; - - if ($cut_rect['right'] >= $img->getWidth()) - $cut_rect['right'] = $img->getWidth() - 1; - - if ($cut_rect['bottom'] >= $img->getHeight()) - $cut_rect['bottom'] = $img->getHeight() - 1; - - return $img->crop($cut_rect['left'], $cut_rect['top'], $cut_rect['right'] - $cut_rect['left'] + 1, $cut_rect['bottom'] - $cut_rect['top'] + 1); - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/CopyChannelsPalette.php b/admin/compiler/joomla_3/wideimage/Operation/CopyChannelsPalette.php deleted file mode 100644 index 048975005..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/CopyChannelsPalette.php +++ /dev/null @@ -1,90 +0,0 @@ - 0, 'green' => 0, 'blue' => 0); - if (isset($channels['alpha'])) - unset($channels['alpha']); - - $width = $img->getWidth(); - $height = $img->getHeight(); - $copy = WideImage_PaletteImage::create($width, $height); - - if ($img->isTransparent()) - { - $otci = $img->getTransparentColor(); - $TRGB = $img->getColorRGB($otci); - $tci = $copy->allocateColor($TRGB); - } - else - { - $otci = null; - $tci = null; - } - - for ($x = 0; $x < $width; $x++) - for ($y = 0; $y < $height; $y++) - { - $ci = $img->getColorAt($x, $y); - if ($ci === $otci) - { - $copy->setColorAt($x, $y, $tci); - continue; - } - $RGB = $img->getColorRGB($ci); - - $newRGB = $blank; - foreach ($channels as $channel) - $newRGB[$channel] = $RGB[$channel]; - - $color = $copy->getExactColor($newRGB); - if ($color == -1) - $color = $copy->allocateColor($newRGB); - - $copy->setColorAt($x, $y, $color); - } - - if ($img->isTransparent()) - $copy->setTransparentColor($tci); - - return $copy; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/CopyChannelsTrueColor.php b/admin/compiler/joomla_3/wideimage/Operation/CopyChannelsTrueColor.php deleted file mode 100644 index bf39520cd..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/CopyChannelsTrueColor.php +++ /dev/null @@ -1,67 +0,0 @@ - 0, 'green' => 0, 'blue' => 0, 'alpha' => 0); - - $width = $img->getWidth(); - $height = $img->getHeight(); - $copy = WideImage_TrueColorImage::create($width, $height); - - if (count($channels) > 0) - for ($x = 0; $x < $width; $x++) - for ($y = 0; $y < $height; $y++) - { - $RGBA = $img->getRGBAt($x, $y); - $newRGBA = $blank; - foreach ($channels as $channel) - $newRGBA[$channel] = $RGBA[$channel]; - - $color = $copy->getExactColorAlpha($newRGBA); - if ($color == -1) - $color = $copy->allocateColorAlpha($newRGBA); - - $copy->setColorAt($x, $y, $color); - } - - return $copy; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/CorrectGamma.php b/admin/compiler/joomla_3/wideimage/Operation/CorrectGamma.php deleted file mode 100644 index 49562f1d3..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/CorrectGamma.php +++ /dev/null @@ -1,48 +0,0 @@ -copy(); - if (!imagegammacorrect($new->getHandle(), $input_gamma, $output_gamma)) - throw new WideImage_GDFunctionResultException("imagegammacorrect() returned false"); - - return $new; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/Crop.php b/admin/compiler/joomla_3/wideimage/Operation/Crop.php deleted file mode 100644 index 6a9d4f5b3..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/Crop.php +++ /dev/null @@ -1,86 +0,0 @@ -getWidth(), $width); - $height = WideImage_Coordinate::fix($height, $img->getHeight(), $height); - $left = WideImage_Coordinate::fix($left, $img->getWidth(), $width); - $top = WideImage_Coordinate::fix($top, $img->getHeight(), $height); - if ($left < 0) - { - $width = $left + $width; - $left = 0; - } - - if ($width > $img->getWidth() - $left) - $width = $img->getWidth() - $left; - - if ($top < 0) - { - $height = $top + $height; - $top = 0; - } - - if ($height > $img->getHeight() - $top) - $height = $img->getHeight() - $top; - - if ($width <= 0 || $height <= 0) - throw new WideImage_Exception("Can't crop outside of an image."); - - $new = $img->doCreate($width, $height); - - if ($img->isTransparent() || $img instanceof WideImage_PaletteImage) - { - $new->copyTransparencyFrom($img); - if (!imagecopyresized($new->getHandle(), $img->getHandle(), 0, 0, $left, $top, $width, $height, $width, $height)) - throw new WideImage_GDFunctionResultException("imagecopyresized() returned false"); - } - else - { - $new->alphaBlending(false); - $new->saveAlpha(true); - if (!imagecopyresampled($new->getHandle(), $img->getHandle(), 0, 0, $left, $top, $width, $height, $width, $height)) - throw new WideImage_GDFunctionResultException("imagecopyresampled() returned false"); - } - return $new; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/Flip.php b/admin/compiler/joomla_3/wideimage/Operation/Flip.php deleted file mode 100644 index d2f189c7b..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/Flip.php +++ /dev/null @@ -1,54 +0,0 @@ -copy(); - - $width = $image->getWidth(); - $height = $image->getHeight(); - - if ($new->isTransparent()) - imagefilledrectangle($new->getHandle(), 0, 0, $width, $height, $new->getTransparentColor()); - - for ($y = 0; $y < $height; $y++) - if (!imagecopy($new->getHandle(), $image->getHandle(), 0, $y, 0, $height - $y - 1, $width, 1)) - throw new WideImage_GDFunctionResultException("imagecopy() returned false"); - - return $new; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/GetMask.php b/admin/compiler/joomla_3/wideimage/Operation/GetMask.php deleted file mode 100644 index f203a91d6..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/GetMask.php +++ /dev/null @@ -1,67 +0,0 @@ -getWidth(); - $height = $image->getHeight(); - - $mask = WideImage_TrueColorImage::create($width, $height); - $mask->setTransparentColor(-1); - $mask->alphaBlending(false); - $mask->saveAlpha(false); - - for ($i = 0; $i <= 255; $i++) - $greyscale[$i] = ImageColorAllocate($mask->getHandle(), $i, $i, $i); - - imagefilledrectangle($mask->getHandle(), 0, 0, $width, $height, $greyscale[255]); - - $transparentColor = $image->getTransparentColor(); - $alphaToGreyRatio = 255 / 127; - for ($x = 0; $x < $width; $x++) - for ($y = 0; $y < $height; $y++) - { - $color = $image->getColorAt($x, $y); - if ($color == $transparentColor) - $rgba['alpha'] = 127; - else - $rgba = $image->getColorRGB($color); - imagesetpixel($mask->getHandle(), $x, $y, $greyscale[255 - round($rgba['alpha'] * $alphaToGreyRatio)]); - } - return $mask; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/Merge.php b/admin/compiler/joomla_3/wideimage/Operation/Merge.php deleted file mode 100644 index ee897119b..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/Merge.php +++ /dev/null @@ -1,78 +0,0 @@ -getWidth(), $overlay->getWidth()); - $y = WideImage_Coordinate::fix($top, $base->getHeight(), $overlay->getHeight()); - - $result = $base->asTrueColor(); - $result->alphaBlending(true); - $result->saveAlpha(true); - - if ($pct <= 0) - return $result; - - if ($pct < 100) - { - if (!imagecopymerge( - $result->getHandle(), - $overlay->getHandle(), - $x, $y, 0, 0, - $overlay->getWidth(), - $overlay->getHeight(), - $pct)) - throw new WideImage_GDFunctionResultException("imagecopymerge() returned false"); - } - else - { - if (!imagecopy( - $result->getHandle(), - $overlay->getHandle(), - $x, $y, 0, 0, - $overlay->getWidth(), - $overlay->getHeight())) - throw new WideImage_GDFunctionResultException("imagecopy() returned false"); - } - - return $result; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/Mirror.php b/admin/compiler/joomla_3/wideimage/Operation/Mirror.php deleted file mode 100644 index ebefbfc4f..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/Mirror.php +++ /dev/null @@ -1,55 +0,0 @@ -copy(); - - $width = $image->getWidth(); - $height = $image->getHeight(); - - if ($new->isTransparent()) - imagefilledrectangle($new->getHandle(), 0, 0, $width, $height, $new->getTransparentColor()); - - for ($x = 0; $x < $width; $x++) - { - if (!imagecopy($new->getHandle(), $image->getHandle(), $x, 0, $width - $x - 1, 0, 1, $height)) - throw new WideImage_GDFunctionResultException("imagecopy() returned false"); - } - return $new; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/Resize.php b/admin/compiler/joomla_3/wideimage/Operation/Resize.php deleted file mode 100644 index c495b7cd3..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/Resize.php +++ /dev/null @@ -1,157 +0,0 @@ -getWidth(); - $height = $img->getHeight(); - } - - if ($width !== null) - $width = WideImage_Coordinate::fix($width, $img->getWidth()); - - if ($height !== null) - $height = WideImage_Coordinate::fix($height, $img->getHeight()); - - if ($width === null) - $width = floor($img->getWidth() * $height / $img->getHeight()); - - if ($height === null) - $height = floor($img->getHeight() * $width / $img->getWidth()); - - if ($width === 0 || $height === 0) - return array('width' => 0, 'height' => 0); - - if ($fit == null) - $fit = 'inside'; - - $dim = array(); - if ($fit == 'fill') - { - $dim['width'] = $width; - $dim['height'] = $height; - } - elseif ($fit == 'inside' || $fit == 'outside') - { - $rx = $img->getWidth() / $width; - $ry = $img->getHeight() / $height; - - if ($fit == 'inside') - $ratio = ($rx > $ry) ? $rx : $ry; - else - $ratio = ($rx < $ry) ? $rx : $ry; - - $dim['width'] = round($img->getWidth() / $ratio); - $dim['height'] = round($img->getHeight() / $ratio); - } - else - throw new WideImage_Operation_InvalidFitMethodException("{$fit} is not a valid resize-fit method."); - - return $dim; - } - - /** - * Returns a resized image - * - * @param WideImage_Image $img - * @param smart_coordinate $width - * @param smart_coordinate $height - * @param string $fit - * @param string $scale - * @return WideImage_Image - */ - function execute($img, $width, $height, $fit, $scale) - { - $dim = $this->prepareDimensions($img, $width, $height, $fit); - if (($scale === 'down' && ($dim['width'] >= $img->getWidth() && $dim['height'] >= $img->getHeight())) || - ($scale === 'up' && ($dim['width'] <= $img->getWidth() && $dim['height'] <= $img->getHeight()))) - $dim = array('width' => $img->getWidth(), 'height' => $img->getHeight()); - - if ($dim['width'] <= 0 || $dim['height'] <= 0) - throw new WideImage_Operation_InvalidResizeDimensionException("Both dimensions must be larger than 0."); - - if ($img->isTransparent() || $img instanceof WideImage_PaletteImage) - { - $new = WideImage_PaletteImage::create($dim['width'], $dim['height']); - $new->copyTransparencyFrom($img); - if (!imagecopyresized( - $new->getHandle(), - $img->getHandle(), - 0, 0, 0, 0, - $new->getWidth(), - $new->getHeight(), - $img->getWidth(), - $img->getHeight())) - throw new WideImage_GDFunctionResultException("imagecopyresized() returned false"); - } - else - { - $new = WideImage_TrueColorImage::create($dim['width'], $dim['height']); - $new->alphaBlending(false); - $new->saveAlpha(true); - if (!imagecopyresampled( - $new->getHandle(), - $img->getHandle(), - 0, 0, 0, 0, - $new->getWidth(), - $new->getHeight(), - $img->getWidth(), - $img->getHeight())) - throw new WideImage_GDFunctionResultException("imagecopyresampled() returned false"); - $new->alphaBlending(true); - } - return $new; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/ResizeCanvas.php b/admin/compiler/joomla_3/wideimage/Operation/ResizeCanvas.php deleted file mode 100644 index 8262b15ae..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/ResizeCanvas.php +++ /dev/null @@ -1,107 +0,0 @@ -getWidth()); - $new_height = WideImage_Coordinate::fix($height, $img->getHeight()); - - if ($scale == 'down') - { - $new_width = min($new_width, $img->getWidth()); - $new_height = min($new_height, $img->getHeight()); - } - elseif ($scale == 'up') - { - $new_width = max($new_width, $img->getWidth()); - $new_height = max($new_height, $img->getHeight()); - } - - $new = WideImage::createTrueColorImage($new_width, $new_height); - if ($img->isTrueColor()) - { - if ($color === null) - $color = $new->allocateColorAlpha(0, 0, 0, 127); - } - else - { - imagepalettecopy($new->getHandle(), $img->getHandle()); - - if ($img->isTransparent()) - { - $new->copyTransparencyFrom($img); - $tc_rgb = $img->getTransparentColorRGB(); - $t_color = $new->allocateColorAlpha($tc_rgb); - } - - if ($color === null) - { - if ($img->isTransparent()) - $color = $t_color; - else - $color = $new->allocateColorAlpha(255, 0, 127, 127); - - imagecolortransparent($new->getHandle(), $color); - } - } - $new->fill(0, 0, $color); - - - $x = WideImage_Coordinate::fix($left, $new->getWidth(), $img->getWidth()); - $y = WideImage_Coordinate::fix($top, $new->getHeight(), $img->getHeight()); - - // blending for truecolor images - if ($img->isTrueColor()) - $new->alphaBlending($merge); - - // not-blending for palette images - if (!$merge && !$img->isTrueColor() && isset($t_color)) - $new->getCanvas()->filledRectangle($x, $y, $x + $img->getWidth(), $y + $img->getHeight(), $t_color); - - $img->copyTo($new, $x, $y); - return $new; - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/Rotate.php b/admin/compiler/joomla_3/wideimage/Operation/Rotate.php deleted file mode 100644 index 690b04f52..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/Rotate.php +++ /dev/null @@ -1,64 +0,0 @@ -copy(); - - $image = $image->asTrueColor(); - - if ($bgColor === null) - { - $bgColor = $image->getTransparentColor(); - if ($bgColor == -1) - { - $bgColor = $image->allocateColorAlpha(255, 255, 255, 127); - imagecolortransparent($image->getHandle(), $bgColor); - } - } - return new WideImage_TrueColorImage(imagerotate($image->getHandle(), $angle, $bgColor, $ignoreTransparent)); - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/RoundCorners.php b/admin/compiler/joomla_3/wideimage/Operation/RoundCorners.php deleted file mode 100644 index 22eb84991..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/RoundCorners.php +++ /dev/null @@ -1,114 +0,0 @@ - 16) - $sample_ratio = 16; - else - $sample_ratio = $smoothness; - - $corner = WideImage::createTrueColorImage($radius * $sample_ratio, $radius * $sample_ratio); - if ($color === null) - { - imagepalettecopy($corner->getHandle(), $image->getHandle()); - $bg_color = $corner->allocateColor(0, 0, 0); - - $corner->fill(0, 0, $bg_color); - $fg_color = $corner->allocateColor(255, 255, 255); - $corner->getCanvas()->filledEllipse($radius * $sample_ratio, $radius * $sample_ratio, $radius * 2 * $sample_ratio, $radius * 2 * $sample_ratio, $fg_color); - $corner = $corner->resize($radius, $radius); - - $result = $image->asTrueColor(); - - $tc = $result->getTransparentColor(); - if ($tc == -1) - { - $tc = $result->allocateColorAlpha(255, 255, 255, 127); - imagecolortransparent($result->getHandle(), $tc); - $result->setTransparentColor($tc); - } - - if ($corners & WideImage::SIDE_TOP_LEFT || $corners & WideImage::SIDE_LEFT || $corners & WideImage::SIDE_TOP) - $result = $result->applyMask($corner, -1, -1); - - $corner = $corner->rotate(90); - if ($corners & WideImage::SIDE_TOP_RIGHT || $corners & WideImage::SIDE_TOP || $corners & WideImage::SIDE_RIGHT) - $result = $result->applyMask($corner, $result->getWidth() - $corner->getWidth() + 1, -1, 100); - - $corner = $corner->rotate(90); - if ($corners & WideImage::SIDE_BOTTOM_RIGHT || $corners & WideImage::SIDE_RIGHT || $corners & WideImage::SIDE_BOTTOM) - $result = $result->applyMask($corner, $result->getWidth() - $corner->getWidth() + 1, $result->getHeight() - $corner->getHeight() + 1, 100); - - $corner = $corner->rotate(90); - if ($corners & WideImage::SIDE_BOTTOM_LEFT || $corners & WideImage::SIDE_LEFT || $corners & WideImage::SIDE_BOTTOM) - $result = $result->applyMask($corner, -1, $result->getHeight() - $corner->getHeight() + 1, 100); - - return $result; - } - else - { - $bg_color = $color; - - $corner->fill(0, 0, $bg_color); - $fg_color = $corner->allocateColorAlpha(127, 127, 127, 127); - $corner->getCanvas()->filledEllipse($radius * $sample_ratio, $radius * $sample_ratio, $radius * 2 * $sample_ratio, $radius * 2 * $sample_ratio, $fg_color); - $corner = $corner->resize($radius, $radius); - - $result = $image->copy(); - if ($corners & WideImage::SIDE_TOP_LEFT || $corners & WideImage::SIDE_LEFT || $corners & WideImage::SIDE_TOP) - $result = $result->merge($corner, -1, -1, 100); - - $corner = $corner->rotate(90); - if ($corners & WideImage::SIDE_TOP_RIGHT || $corners & WideImage::SIDE_TOP || $corners & WideImage::SIDE_RIGHT) - $result = $result->merge($corner, $result->getWidth() - $corner->getWidth() + 1, -1, 100); - - $corner = $corner->rotate(90); - if ($corners & WideImage::SIDE_BOTTOM_RIGHT || $corners & WideImage::SIDE_RIGHT || $corners & WideImage::SIDE_BOTTOM) - $result = $result->merge($corner, $result->getWidth() - $corner->getWidth() + 1, $result->getHeight() - $corner->getHeight() + 1, 100); - - $corner = $corner->rotate(90); - if ($corners & WideImage::SIDE_BOTTOM_LEFT || $corners & WideImage::SIDE_LEFT || $corners & WideImage::SIDE_BOTTOM) - $result = $result->merge($corner, -1, $result->getHeight() - $corner->getHeight() + 1, 100); - - return $result; - } - } - } diff --git a/admin/compiler/joomla_3/wideimage/Operation/Unsharp.php b/admin/compiler/joomla_3/wideimage/Operation/Unsharp.php deleted file mode 100644 index 4c5087e39..000000000 --- a/admin/compiler/joomla_3/wideimage/Operation/Unsharp.php +++ /dev/null @@ -1,135 +0,0 @@ - 500) $amount = 500; - $amount = $amount * 0.016; - if ($radius > 50) $radius = 50; - $radius = $radius * 2; - if ($threshold > 255) $threshold = 255; - - $radius = abs(round($radius)); // Only integers make sense. - if ($radius == 0) { - return $image; - } - - // Gaussian blur matrix - - $matrix = array( - array(1, 2, 1), - array(2, 4, 2), - array(1, 2, 1) - ); - - $blurred = $image->applyConvolution($matrix, 16, 0); - - if($threshold > 0) { - // Calculate the difference between the blurred pixels and the original - // and set the pixels - for ($x = 0; $x < $image->getWidth(); $x++) { - for ($y = 0; $y < $image->getHeight(); $y++) { - $rgbOrig = $image->getRGBAt($x, $y); - $rOrig = $rgbOrig["red"]; - $gOrig = $rgbOrig["green"]; - $bOrig = $rgbOrig["blue"]; - - $rgbBlur = $blurred->getRGBAt($x, $y); - $rBlur = $rgbBlur["red"]; - $gBlur = $rgbBlur["green"]; - $bBlur = $rgbBlur["blue"]; - - // When the masked pixels differ less from the original - // than the threshold specifies, they are set to their original value. - $rNew = (abs($rOrig - $rBlur) >= $threshold) - ? max(0, min(255, ($amount * ($rOrig - $rBlur)) + $rOrig)) - : $rOrig; - $gNew = (abs($gOrig - $gBlur) >= $threshold) - ? max(0, min(255, ($amount * ($gOrig - $gBlur)) + $gOrig)) - : $gOrig; - $bNew = (abs($bOrig - $bBlur) >= $threshold) - ? max(0, min(255, ($amount * ($bOrig - $bBlur)) + $bOrig)) - : $bOrig; - $rgbNew = array("red" => $rNew, "green" => $gNew, "blue" => $bNew, "alpha" => 0); - - if (($rOrig != $rNew) || ($gOrig != $gNew) || ($bOrig != $bNew)) { - $image->setRGBAt($x, $y, $rgbNew); - } - } - } - } - else { - $w = $image->getWidth(); - $h = $image->getHeight(); - for ($x = 0; $x < $w; $x++) { - for ($y = 0; $y < $h; $y++) { - $rgbOrig = $image->getRGBAt($x, $y); - $rOrig = $rgbOrig["red"]; - $gOrig = $rgbOrig["green"]; - $bOrig = $rgbOrig["blue"]; - - $rgbBlur = $blurred->getRGBAt($x, $y); - $rBlur = $rgbBlur["red"]; - $gBlur = $rgbBlur["green"]; - $bBlur = $rgbBlur["blue"]; - - $rNew = ($amount * ($rOrig - $rBlur)) + $rOrig; - if($rNew>255){$rNew=255;} - elseif($rNew<0){$rNew=0;} - $gNew = ($amount * ($gOrig - $gBlur)) + $gOrig; - if($gNew>255){$gNew=255;} - elseif($gNew<0){$gNew=0;} - $bNew = ($amount * ($bOrig - $bBlur)) + $bOrig; - if($bNew>255){$bNew=255;} - elseif($bNew<0){$bNew=0;} - $rgbNew = array("red" => $rNew, "green" => $gNew, "blue" => $bNew, "alpha" => 0); - - $image->setRGBAt($x, $y, $rgbNew); - } - } - } - - return $image; - } - } diff --git a/admin/compiler/joomla_3/wideimage/OperationFactory.php b/admin/compiler/joomla_3/wideimage/OperationFactory.php deleted file mode 100644 index 3a5f36c49..000000000 --- a/admin/compiler/joomla_3/wideimage/OperationFactory.php +++ /dev/null @@ -1,57 +0,0 @@ -copy(); - } - - /** - * Returns a copy of the image - * - * @param $trueColor True if the new image should be truecolor - * @return WideImage_Image - */ - protected function copyAsNew($trueColor = false) - { - $width = $this->getWidth(); - $height = $this->getHeight(); - - if ($trueColor) - $new = WideImage_TrueColorImage::create($width, $height); - else - $new = WideImage_PaletteImage::create($width, $height); - - // copy transparency of source to target - if ($this->isTransparent()) - { - $rgb = $this->getTransparentColorRGB(); - if (is_array($rgb)) - { - $tci = $new->allocateColor($rgb['red'], $rgb['green'], $rgb['blue']); - $new->fill(0, 0, $tci); - $new->setTransparentColor($tci); - } - } - - imageCopy($new->getHandle(), $this->handle, 0, 0, 0, 0, $width, $height); - return $new; - } - - /** - * (non-PHPdoc) - * @see WideImage_Image#asTrueColor() - */ - function asTrueColor() - { - $width = $this->getWidth(); - $height = $this->getHeight(); - $new = WideImage::createTrueColorImage($width, $height); - if ($this->isTransparent()) - $new->copyTransparencyFrom($this); - if (!imageCopy($new->getHandle(), $this->handle, 0, 0, 0, 0, $width, $height)) - throw new WideImage_GDFunctionResultException("imagecopy() returned false"); - return $new; - } - - /** - * (non-PHPdoc) - * @see WideImage_Image#getChannels() - */ - function getChannels() - { - $args = func_get_args(); - if (count($args) == 1 && is_array($args[0])) - $args = $args[0]; - return WideImage_OperationFactory::get('CopyChannelsPalette')->execute($this, $args); - } - - /** - * (non-PHPdoc) - * @see WideImage_Image#copyNoAlpha() - */ - function copyNoAlpha() - { - return WideImage_Image::loadFromString($this->asString('png')); - } - } diff --git a/admin/compiler/joomla_3/wideimage/TrueColorImage.php b/admin/compiler/joomla_3/wideimage/TrueColorImage.php deleted file mode 100644 index a4addcdfa..000000000 --- a/admin/compiler/joomla_3/wideimage/TrueColorImage.php +++ /dev/null @@ -1,218 +0,0 @@ -alphaBlending(false); - $this->saveAlpha(true); - } - - /** - * Factory method that creates a true-color image object - * - * @param int $width - * @param int $height - * @return WideImage_TrueColorImage - */ - static function create($width, $height) - { - if ($width * $height <= 0 || $width < 0) - throw new WideImage_InvalidImageDimensionException("Can't create an image with dimensions [$width, $height]."); - - return new WideImage_TrueColorImage(imagecreatetruecolor($width, $height)); - } - - function doCreate($width, $height) - { - return self::create($width, $height); - } - - function isTrueColor() - { - return true; - } - - /** - * Sets alpha blending mode via imagealphablending() - * - * @param bool $mode - * @return bool - */ - function alphaBlending($mode) - { - return imagealphablending($this->handle, $mode); - } - - /** - * Toggle if alpha channel should be saved with the image via imagesavealpha() - * - * @param bool $on - * @return bool - */ - function saveAlpha($on) - { - return imagesavealpha($this->handle, $on); - } - - /** - * Allocates a color and returns its index - * - * This method accepts either each component as an integer value, - * or an associative array that holds the color's components in keys - * 'red', 'green', 'blue', 'alpha'. - * - * @param mixed $R - * @param int $G - * @param int $B - * @param int $A - * @return int - */ - function allocateColorAlpha($R, $G = null, $B = null, $A = null) - { - if (is_array($R)) - return imageColorAllocateAlpha($this->handle, $R['red'], $R['green'], $R['blue'], $R['alpha']); - else - return imageColorAllocateAlpha($this->handle, $R, $G, $B, $A); - } - - /** - * @see WideImage_Image#asPalette($nColors, $dither, $matchPalette) - */ - function asPalette($nColors = 255, $dither = null, $matchPalette = true) - { - $nColors = intval($nColors); - if ($nColors < 1) - $nColors = 1; - elseif ($nColors > 255) - $nColors = 255; - - if ($dither === null) - $dither = $this->isTransparent(); - - $temp = $this->copy(); - imagetruecolortopalette($temp->handle, $dither, $nColors); - if ($matchPalette == true && function_exists('imagecolormatch')) - imagecolormatch($this->handle, $temp->handle); - - // The code below isn't working properly; it corrupts transparency on some palette->tc->palette conversions. - // Why is this code here? - /* - if ($this->isTransparent()) - { - $trgb = $this->getTransparentColorRGB(); - $tci = $temp->getClosestColor($trgb); - $temp->setTransparentColor($tci); - } - /**/ - - $temp->releaseHandle(); - return new WideImage_PaletteImage($temp->handle); - } - - /** - * Returns the index of the color that best match the given color components - * - * This method accepts either each component as an integer value, - * or an associative array that holds the color's components in keys - * 'red', 'green', 'blue', 'alpha'. - * - * @param mixed $R Red component value or an associative array - * @param int $G Green component - * @param int $B Blue component - * @param int $A Alpha component - * @return int The color index - */ - function getClosestColorAlpha($R, $G = null, $B = null, $A = null) - { - if (is_array($R)) - return imagecolorclosestalpha($this->handle, $R['red'], $R['green'], $R['blue'], $R['alpha']); - else - return imagecolorclosestalpha($this->handle, $R, $G, $B, $A); - } - - /** - * Returns the index of the color that exactly match the given color components - * - * This method accepts either each component as an integer value, - * or an associative array that holds the color's components in keys - * 'red', 'green', 'blue', 'alpha'. - * - * @param mixed $R Red component value or an associative array - * @param int $G Green component - * @param int $B Blue component - * @param int $A Alpha component - * @return int The color index - */ - function getExactColorAlpha($R, $G = null, $B = null, $A = null) - { - if (is_array($R)) - return imagecolorexactalpha($this->handle, $R['red'], $R['green'], $R['blue'], $R['alpha']); - else - return imagecolorexactalpha($this->handle, $R, $G, $B, $A); - } - - /** - * @see WideImage_Image#getChannels() - */ - function getChannels() - { - $args = func_get_args(); - if (count($args) == 1 && is_array($args[0])) - $args = $args[0]; - return WideImage_OperationFactory::get('CopyChannelsTrueColor')->execute($this, $args); - } - - /** - * (non-PHPdoc) - * @see WideImage_Image#copyNoAlpha() - */ - function copyNoAlpha() - { - $prev = $this->saveAlpha(false); - $result = WideImage_Image::loadFromString($this->asString('png')); - $this->saveAlpha($prev); - //$result->releaseHandle(); - return $result; - } - - /** - * (non-PHPdoc) - * @see WideImage_Image#asTrueColor() - */ - function asTrueColor() - { - return $this->copy(); - } - } diff --git a/admin/compiler/joomla_3/wideimage/WideImage.php b/admin/compiler/joomla_3/wideimage/WideImage.php deleted file mode 100644 index fd5419f5d..000000000 --- a/admin/compiler/joomla_3/wideimage/WideImage.php +++ /dev/null @@ -1,377 +0,0 @@ - - * WideImage::registerCustomMapper('WideImage_Mapper_TGA', 'image/tga', 'tga'); - * - * - * @param string $mapper_class_name - * @param string $mime_type - * @param string $extension - */ - static function registerCustomMapper($mapper_class_name, $mime_type, $extension) - { - WideImage_MapperFactory::registerMapper($mapper_class_name, $mime_type, strtoupper($extension)); - } - - /** - * Loads an image from a file, URL, HTML input file field, binary string, or a valid image handle. - * The image format is auto-detected. - * - * Currently supported formats: PNG, GIF, JPG, BMP, TGA, GD, GD2. - * - * This function analyzes the input and decides whether to use WideImage::loadFromHandle(), - * WideImage::loadFromFile(), WideImage::loadFromUpload() or WideImage::loadFromString(), - * all of which you can also call directly to spare WideImage some guessing. - * - * Arrays are supported for upload fields; it returns an array of loaded images. - * To load only a single image from an array field, use WideImage::loadFromUpload('img', $i), - * where $i is the index of the image you want to load. - * - * - * $img = WideImage::load('http://url/image.png'); // image URL - * $img = WideImage::load('/path/to/image.png'); // local file path - * $img = WideImage::load('img'); // upload field name - * $img = WideImage::load(imagecreatetruecolor(10, 10)); // a GD resource - * $img = WideImage::load($image_data); // binary string containing image data - * - * - * @param mixed $source File name, url, HTML file input field name, binary string, or a GD image resource - * @return WideImage_Image WideImage_PaletteImage or WideImage_TrueColorImage instance - */ - static function load($source) - { - $predictedSourceType = ''; - - if ($source == '') - $predictedSourceType = 'String'; - - // Creating image via a valid resource - if (!$predictedSourceType && self::isValidImageHandle($source)) - $predictedSourceType = 'Handle'; - - // Check for binary string - if (!$predictedSourceType) - { - // search first $binLength bytes (at a maximum) for ord<32 characters (binary image data) - $binLength = 64; - $sourceLength = strlen($source); - $maxlen = ($sourceLength > $binLength) ? $binLength : $sourceLength; - for ($i = 0; $i < $maxlen; $i++) - if (ord($source[$i]) < 32) - { - $predictedSourceType = 'String'; - break; - } - } - - // Uploaded image (array uploads not supported) - if (isset($_FILES[$source]) && isset($_FILES[$source]['tmp_name'])) - $predictedSourceType = 'Upload'; - - // Otherwise, must be a file or an URL - if (!$predictedSourceType) - $predictedSourceType = 'File'; - - return call_user_func(array('WideImage', 'loadFrom' . $predictedSourceType), $source); - } - - /** - * Create and load an image from a file or URL. The image format is auto-detected. - * - * @param string $uri File or url - * @return WideImage_Image WideImage_PaletteImage or WideImage_TrueColorImage instance - */ - static function loadFromFile($uri) - { - $data = file_get_contents($uri); - $handle = @imagecreatefromstring($data); - if (!self::isValidImageHandle($handle)) - { - try - { - // try to find a mapper first - $mapper = WideImage_MapperFactory::selectMapper($uri); - if ($mapper) - $handle = $mapper->load($uri); - } - catch (WideImage_UnsupportedFormatException $e) - { - // mapper not found - } - - // try all custom mappers - if (!self::isValidImageHandle($handle)) - { - $custom_mappers = WideImage_MapperFactory::getCustomMappers(); - foreach ($custom_mappers as $mime_type => $mapper_class) - { - $mapper = WideImage_MapperFactory::selectMapper(null, $mime_type); - $handle = $mapper->loadFromString($data); - if (self::isValidImageHandle($handle)) - break; - } - } - } - - if (!self::isValidImageHandle($handle)) - throw new WideImage_InvalidImageSourceException("File '{$uri}' appears to be an invalid image source."); - - return self::loadFromHandle($handle); - } - - /** - * Create and load an image from a string. Format is auto-detected. - * - * @param string $string Binary data, i.e. from BLOB field in the database - * @return WideImage_Image WideImage_PaletteImage or WideImage_TrueColorImage instance - */ - static function loadFromString($string) - { - if (strlen($string) < 128) - throw new WideImage_InvalidImageSourceException("String doesn't contain image data."); - - $handle = @imagecreatefromstring($string); - if (!self::isValidImageHandle($handle)) - { - $custom_mappers = WideImage_MapperFactory::getCustomMappers(); - foreach ($custom_mappers as $mime_type => $mapper_class) - { - $mapper = WideImage_MapperFactory::selectMapper(null, $mime_type); - $handle = $mapper->loadFromString($string); - if (self::isValidImageHandle($handle)) - break; - } - } - - if (!self::isValidImageHandle($handle)) - throw new WideImage_InvalidImageSourceException("String doesn't contain valid image data."); - - return self::loadFromHandle($handle); - } - - /** - * Create and load an image from an image handle. - * - * Note: the resulting image object takes ownership of the passed - * handle. When the newly-created image object is destroyed, the handle is - * destroyed too, so it's not a valid image handle anymore. In order to - * preserve the handle for use after object destruction, you have to call - * WideImage_Image::releaseHandle() on the created image instance prior to its - * destruction. - * - * - * $handle = imagecreatefrompng('file.png'); - * $image = WideImage::loadFromHandle($handle); - * - * - * @param resource $handle A valid GD image resource - * @return WideImage_Image WideImage_PaletteImage or WideImage_TrueColorImage instance - */ - static function loadFromHandle($handle) - { - if (!self::isValidImageHandle($handle)) - throw new WideImage_InvalidImageSourceException("Handle is not a valid GD image resource."); - - if (imageistruecolor($handle)) - return new WideImage_TrueColorImage($handle); - else - return new WideImage_PaletteImage($handle); - } - - /** - * This method loads a file from the $_FILES array. The image format is auto-detected. - * - * You only have to pass the field name as the parameter. For array fields, this function will - * return an array of image objects, unless you specify the $index parameter, which will - * load the desired image. - * - * @param $field_name Name of the key in $_FILES array - * @param int $index The index of the file to load (if the input field is an array) - * @return WideImage_Image The loaded image - */ - static function loadFromUpload($field_name, $index = null) - { - if (!array_key_exists($field_name, $_FILES)) - throw new WideImage_InvalidImageSourceException("Upload field '{$field_name}' doesn't exist."); - - if (is_array($_FILES[$field_name]['tmp_name'])) - { - if (isset($_FILES[$field_name]['tmp_name'][$index])) - $filename = $_FILES[$field_name]['tmp_name'][$index]; - else - { - $result = array(); - foreach ($_FILES[$field_name]['tmp_name'] as $idx => $tmp_name) - $result[$idx] = self::loadFromFile($tmp_name); - return $result; - } - } - else - $filename = $_FILES[$field_name]['tmp_name']; - - if (!file_exists($filename)) - throw new WideImage_InvalidImageSourceException("Uploaded file doesn't exist."); - return self::loadFromFile($filename); - } - - /** - * Factory method for creating a palette image - * - * @param int $width - * @param int $height - * @return WideImage_PaletteImage - */ - static function createPaletteImage($width, $height) - { - return WideImage_PaletteImage::create($width, $height); - } - - /** - * Factory method for creating a true-color image - * - * @param int $width - * @param int $height - * @return WideImage_TrueColorImage - */ - static function createTrueColorImage($width, $height) - { - return WideImage_TrueColorImage::create($width, $height); - } - - /** - * Check whether the given handle is a valid GD resource - * - * @param mixed $handle The variable to check - * @return bool - */ - static function isValidImageHandle($handle) - { - return (is_resource($handle) && get_resource_type($handle) == 'gd'); - } - - /** - * Throws exception if the handle isn't a valid GD resource - * - * @param mixed $handle The variable to check - */ - static function assertValidImageHandle($handle) - { - if (!self::isValidImageHandle($handle)) - throw new WideImage_InvalidImageHandleException("{$handle} is not a valid image handle."); - } - } - - WideImage::checkGD(); - - WideImage::registerCustomMapper('WideImage_Mapper_BMP', 'image/bmp', 'bmp'); - WideImage::registerCustomMapper('WideImage_Mapper_TGA', 'image/tga', 'tga'); - \ No newline at end of file diff --git a/admin/compiler/joomla_3/wideimage/vendor/de77/index.html b/admin/compiler/joomla_3/wideimage/vendor/de77/index.html deleted file mode 100644 index fa6d84e80..000000000 --- a/admin/compiler/joomla_3/wideimage/vendor/de77/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin/compiler/joomla_3/wideimage/vendor/index.html b/admin/compiler/joomla_3/wideimage/vendor/index.html deleted file mode 100644 index fa6d84e80..000000000 --- a/admin/compiler/joomla_3/wideimage/vendor/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin/componentbuilder.php b/admin/componentbuilder.php index c7ecaec73..db43e39fe 100644 --- a/admin/componentbuilder.php +++ b/admin/componentbuilder.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version 2.2.9 + @build 1st February, 2017 @created 30th April, 2015 @package Component Builder @subpackage componentbuilder.php diff --git a/admin/controller.php b/admin/controller.php index 1945f5c9d..26f25a1f5 100644 --- a/admin/controller.php +++ b/admin/controller.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version 2.2.9 + @build 1st February, 2017 @created 30th April, 2015 @package Component Builder @subpackage controller.php @@ -95,6 +95,7 @@ class ComponentbuilderController extends JControllerLegacy 'template' => 'templates', 'layout' => 'layouts', 'dynamic_get' => 'dynamic_gets', + 'custom_code' => 'custom_codes', 'snippet' => 'snippets', 'field' => 'fields', 'fieldtype' => 'fieldtypes', diff --git a/admin/controllers/admin_view.php b/admin/controllers/admin_view.php index 393cc7340..e615c6136 100644 --- a/admin/controllers/admin_view.php +++ b/admin/controllers/admin_view.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version @update number 94 of this MVC + @build 13th January, 2017 @created 30th April, 2015 @package Component Builder @subpackage admin_view.php diff --git a/admin/controllers/admin_views.php b/admin/controllers/admin_views.php index ae338c812..ac55ad104 100644 --- a/admin/controllers/admin_views.php +++ b/admin/controllers/admin_views.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version @update number 94 of this MVC + @build 13th January, 2017 @created 30th April, 2015 @package Component Builder @subpackage admin_views.php diff --git a/admin/controllers/ajax.json.php b/admin/controllers/ajax.json.php index f62752caf..05b8d2ced 100644 --- a/admin/controllers/ajax.json.php +++ b/admin/controllers/ajax.json.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version 2.2.9 + @build 1st February, 2017 @created 30th April, 2015 @package Component Builder @subpackage ajax.json.php diff --git a/admin/controllers/compiler.php b/admin/controllers/compiler.php index 029049bb5..9ffeca6f7 100644 --- a/admin/controllers/compiler.php +++ b/admin/controllers/compiler.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version 2.2.9 + @build 1st February, 2017 @created 30th April, 2015 @package Component Builder @subpackage compiler.php diff --git a/admin/controllers/component.php b/admin/controllers/component.php index 525e3cd70..df24d3e84 100644 --- a/admin/controllers/component.php +++ b/admin/controllers/component.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 77 of this MVC + @build 26th December, 2016 + @created 6th May, 2015 @package Component Builder @subpackage component.php @author Llewellyn van der Merwe diff --git a/admin/controllers/componentbuilder.php b/admin/controllers/componentbuilder.php index 7c5a28bca..9001a1b20 100644 --- a/admin/controllers/componentbuilder.php +++ b/admin/controllers/componentbuilder.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version 2.2.9 + @build 1st 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 83e7abe31..e6cbaffe7 100644 --- a/admin/controllers/components.php +++ b/admin/controllers/components.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 77 of this MVC + @build 26th December, 2016 + @created 6th May, 2015 @package Component Builder @subpackage components.php @author Llewellyn van der Merwe diff --git a/admin/controllers/custom_admin_view.php b/admin/controllers/custom_admin_view.php index 5dbd19a68..c3e9d8513 100644 --- a/admin/controllers/custom_admin_view.php +++ b/admin/controllers/custom_admin_view.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 18 of this MVC + @build 13th January, 2017 + @created 13th August, 2015 @package Component Builder @subpackage custom_admin_view.php @author Llewellyn van der Merwe diff --git a/admin/controllers/custom_admin_views.php b/admin/controllers/custom_admin_views.php index 796821364..85ade9eab 100644 --- a/admin/controllers/custom_admin_views.php +++ b/admin/controllers/custom_admin_views.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 18 of this MVC + @build 13th January, 2017 + @created 13th August, 2015 @package Component Builder @subpackage custom_admin_views.php @author Llewellyn van der Merwe diff --git a/admin/controllers/custom_code.php b/admin/controllers/custom_code.php new file mode 100644 index 000000000..be53e88e9 --- /dev/null +++ b/admin/controllers/custom_code.php @@ -0,0 +1,326 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla controllerform library +jimport('joomla.application.component.controllerform'); + +/** + * Custom_code Controller + */ +class ComponentbuilderControllerCustom_code extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + public function __construct($config = array()) + { + $this->view_list = 'Custom_codes'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Access check. + $access = JFactory::getUser()->authorise('custom_code.access', 'com_componentbuilder'); + if (!$access) + { + return false; + } + // In the absense of better information, revert to the component permissions. + return JFactory::getUser()->authorise('custom_code.create', $this->option); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + // Access check. + $access = ($user->authorise('custom_code.access', 'com_componentbuilder.custom_code.' . (int) $recordId) && $user->authorise('custom_code.access', 'com_componentbuilder')); + if (!$access) + { + return false; + } + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('custom_code.edit', 'com_componentbuilder.custom_code.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('custom_code.edit.own', 'com_componentbuilder.custom_code.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('custom_code.edit.own', 'com_componentbuilder')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return $user->authorise('custom_code.edit', $this->option); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 12.2 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + $tmpl = $this->input->get('tmpl'); + $layout = $this->input->get('layout', 'edit', 'string'); + + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // Setup redirect info. + + $append = ''; + + if ($refid) + { + $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; + } + elseif ($ref) + { + $append .= '&ref='.(string)$ref; + } + + if ($tmpl) + { + $append .= '&tmpl=' . $tmpl; + } + + if ($layout) + { + $append .= '&layout=' . $layout; + } + + if ($recordId) + { + $append .= '&' . $urlVar . '=' . $recordId; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Custom_code', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=custom_codes' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referal details + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + $cancel = parent::cancel($key); + + if ($cancel) + { + if ($this->refid) + { + $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + } + else + { + // Redirect to the items screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referal details + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + if ($this->refid && $saved) + { + $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref && $saved) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/custom_codes.php b/admin/controllers/custom_codes.php new file mode 100644 index 000000000..81ef93197 --- /dev/null +++ b/admin/controllers/custom_codes.php @@ -0,0 +1,111 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla controlleradmin library +jimport('joomla.application.component.controlleradmin'); + +/** + * Custom_codes Controller + */ +class ComponentbuilderControllerCustom_codes extends JControllerAdmin +{ + protected $text_prefix = 'COM_COMPONENTBUILDER_CUSTOM_CODES'; + /** + * Proxy for getModel. + * @since 2.5 + */ + public function getModel($name = 'Custom_code', $prefix = 'ComponentbuilderModel', $config = array()) + { + $model = parent::getModel($name, $prefix, array('ignore_request' => true)); + + return $model; + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('custom_code.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + JArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Custom_codes'); + // get the data to export + $data = $model->getExportData($pks); + if (ComponentbuilderHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + ComponentbuilderHelper::xls($data,'Custom_codes_'.$date->format('jS_F_Y'),'Custom codes exported ('.$date->format('jS F, Y').')','custom codes'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=custom_codes', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('custom_code.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) + { + // Get the import model + $model = $this->getModel('Custom_codes'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (ComponentbuilderHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('custom_code_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'custom_codes'); + $session->set('dataType_VDM_IMPORTINTO', 'custom_code'); + // Redirect to import view. + $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CUSTOM_CODES'); + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=custom_codes', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/dynamic_get.php b/admin/controllers/dynamic_get.php index d4e26d404..24fbbb635 100644 --- a/admin/controllers/dynamic_get.php +++ b/admin/controllers/dynamic_get.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 81 of this MVC + @build 15th January, 2017 + @created 21st May, 2015 @package Component Builder @subpackage dynamic_get.php @author Llewellyn van der Merwe diff --git a/admin/controllers/dynamic_gets.php b/admin/controllers/dynamic_gets.php index d57506d51..79b97c3ee 100644 --- a/admin/controllers/dynamic_gets.php +++ b/admin/controllers/dynamic_gets.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 81 of this MVC + @build 15th January, 2017 + @created 21st May, 2015 @package Component Builder @subpackage dynamic_gets.php @author Llewellyn van der Merwe diff --git a/admin/controllers/field.php b/admin/controllers/field.php index 41cf0c53b..a40c7431f 100644 --- a/admin/controllers/field.php +++ b/admin/controllers/field.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version @update number 36 of this MVC + @build 12th January, 2017 @created 30th April, 2015 @package Component Builder @subpackage field.php diff --git a/admin/controllers/fields.php b/admin/controllers/fields.php index 9632b8e11..f7d521c4c 100644 --- a/admin/controllers/fields.php +++ b/admin/controllers/fields.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version @update number 36 of this MVC + @build 12th January, 2017 @created 30th April, 2015 @package Component Builder @subpackage fields.php diff --git a/admin/controllers/fieldtype.php b/admin/controllers/fieldtype.php index 952abad38..f888c903e 100644 --- a/admin/controllers/fieldtype.php +++ b/admin/controllers/fieldtype.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version @update number 12 of this MVC + @build 20th October, 2016 @created 30th April, 2015 @package Component Builder @subpackage fieldtype.php diff --git a/admin/controllers/fieldtypes.php b/admin/controllers/fieldtypes.php index faf50d75c..a5b39f987 100644 --- a/admin/controllers/fieldtypes.php +++ b/admin/controllers/fieldtypes.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version @update number 12 of this MVC + @build 20th October, 2016 @created 30th April, 2015 @package Component Builder @subpackage fieldtypes.php diff --git a/admin/controllers/help.php b/admin/controllers/help.php index 9946b1f9d..77d6292b5 100644 --- a/admin/controllers/help.php +++ b/admin/controllers/help.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version 2.2.9 + @build 1st February, 2017 @created 30th April, 2015 @package Component Builder @subpackage help.php diff --git a/admin/controllers/help_document.php b/admin/controllers/help_document.php index 5404eb9d9..e7a5d3383 100644 --- a/admin/controllers/help_document.php +++ b/admin/controllers/help_document.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 6 of this MVC + @build 17th October, 2016 + @created 4th March, 2016 @package Component Builder @subpackage help_document.php @author Llewellyn van der Merwe diff --git a/admin/controllers/help_documents.php b/admin/controllers/help_documents.php index 31c93b0ec..3597a7a7e 100644 --- a/admin/controllers/help_documents.php +++ b/admin/controllers/help_documents.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 6 of this MVC + @build 17th October, 2016 + @created 4th March, 2016 @package Component Builder @subpackage help_documents.php @author Llewellyn van der Merwe diff --git a/admin/controllers/import.php b/admin/controllers/import.php index 7bf5e14b4..fab973fb5 100644 --- a/admin/controllers/import.php +++ b/admin/controllers/import.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version 2.2.9 + @build 1st 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 762b56188..dc6755e4d 100644 --- a/admin/controllers/layout.php +++ b/admin/controllers/layout.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 65 of this MVC + @build 18th October, 2016 + @created 18th May, 2015 @package Component Builder @subpackage layout.php @author Llewellyn van der Merwe diff --git a/admin/controllers/layouts.php b/admin/controllers/layouts.php index 138c89707..3ac5800c5 100644 --- a/admin/controllers/layouts.php +++ b/admin/controllers/layouts.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 65 of this MVC + @build 18th October, 2016 + @created 18th May, 2015 @package Component Builder @subpackage layouts.php @author Llewellyn van der Merwe diff --git a/admin/controllers/site_view.php b/admin/controllers/site_view.php index 18d87f169..f3a6fab17 100644 --- a/admin/controllers/site_view.php +++ b/admin/controllers/site_view.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 44 of this MVC + @build 29th January, 2017 + @created 29th May, 2015 @package Component Builder @subpackage site_view.php @author Llewellyn van der Merwe diff --git a/admin/controllers/site_views.php b/admin/controllers/site_views.php index 112a4ac84..002e3d3ad 100644 --- a/admin/controllers/site_views.php +++ b/admin/controllers/site_views.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 44 of this MVC + @build 29th January, 2017 + @created 29th May, 2015 @package Component Builder @subpackage site_views.php @author Llewellyn van der Merwe diff --git a/admin/controllers/snippet.php b/admin/controllers/snippet.php index 8e3e262ed..efd49dfbc 100644 --- a/admin/controllers/snippet.php +++ b/admin/controllers/snippet.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 16 of this MVC + @build 20th October, 2016 + @created 19th May, 2015 @package Component Builder @subpackage snippet.php @author Llewellyn van der Merwe diff --git a/admin/controllers/snippets.php b/admin/controllers/snippets.php index 73b2b5065..3ad1ef769 100644 --- a/admin/controllers/snippets.php +++ b/admin/controllers/snippets.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 16 of this MVC + @build 20th October, 2016 + @created 19th May, 2015 @package Component Builder @subpackage snippets.php @author Llewellyn van der Merwe diff --git a/admin/controllers/template.php b/admin/controllers/template.php index f5b3e69e8..2cb03f713 100644 --- a/admin/controllers/template.php +++ b/admin/controllers/template.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 39 of this MVC + @build 18th October, 2016 + @created 26th May, 2015 @package Component Builder @subpackage template.php @author Llewellyn van der Merwe diff --git a/admin/controllers/templates.php b/admin/controllers/templates.php index c197348a8..9b03b3a05 100644 --- a/admin/controllers/templates.php +++ b/admin/controllers/templates.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 39 of this MVC + @build 18th October, 2016 + @created 26th May, 2015 @package Component Builder @subpackage templates.php @author Llewellyn van der Merwe diff --git a/admin/helpers/compiler.php b/admin/helpers/compiler.php index c9b2f75bb..7f8f5251e 100644 --- a/admin/helpers/compiler.php +++ b/admin/helpers/compiler.php @@ -68,7 +68,7 @@ class Compiler extends Infusion { $this->gitPath = $this->params->get('git_folder_path', null); } - // remove site folder + // remove site folder if not needed (TODO add check if custom script was moved to site folder then we must do a more complex cleanup here) if ($this->removeSiteFolder) { // first remove the files and folders @@ -82,15 +82,39 @@ class Compiler extends Infusion $this->writeFile($xmlPath,$componentXML); } // now update the files - if ($this->updateFiles()) + if (!$this->updateFiles()) { - // zip the component - if ($this->zipComponent()) - { - // done - return true; - } + 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); + } + // check if we have custom code to add + $this->getCustomCode(); + // now insert into the new files + if (ComponentbuilderHelper::checkArray($this->customCode)) + { + $this->addCustomCode(); + } + // move the update server into place + $this->setUpdateServer(); + // zip the component + if (!$this->zipComponent()) + { + // done + return false; + } + return true; } return false; } @@ -111,7 +135,13 @@ class Compiler extends Infusion } return ''; } - + + /** + * Set the dynamic data to the created fils + * + * @return bool true on success + * + */ protected function updateFiles() { if (isset($this->newFiles['static']) && ComponentbuilderHelper::checkArray($this->newFiles['static']) && isset($this->newFiles['dynamic']) && ComponentbuilderHelper::checkArray($this->newFiles['dynamic'])) @@ -158,6 +188,8 @@ class Compiler extends Infusion if (JFile::exists($file['path'])) { $this->fileContentStatic['###FILENAME###'] = $file['name']; + // do some weird stuff to improve the verion and dates being added to the license + $this->fixLicenseValues($file); $php = ''; if (ComponentbuilderHelper::checkFileType($file['name'],'php')) { @@ -184,7 +216,11 @@ class Compiler extends Infusion } } } + // free up some memory + unset($this->fileContentDynamic[$view]); } + // 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) @@ -199,31 +235,145 @@ class Compiler extends Infusion break; } } - // move the update server to host - if ($this->componentData->add_update_server && $this->componentData->update_server_target == 1 && isset($this->updateServerFileName) && $this->dynamicIntegration) - { - $xml_update_server_path = $this->componentPath.'/'.$this->updateServerFileName.'.xml'; - // make sure we have the correct file - if (JFile::exists($xml_update_server_path) && isset($this->componentData->update_server_ftp)) - { - // Get the basic encription. - $basickey = ComponentbuilderHelper::getCryptKey('basic'); - // Get the encription object. - $basic = new FOFEncryptAes($basickey, 128); - if (!empty($this->componentData->update_server_ftp) && $basickey && !is_numeric($this->componentData->update_server_ftp) && $this->componentData->update_server_ftp === base64_encode(base64_decode($this->componentData->update_server_ftp, true))) - { - // basic decript data update_server_ftp. - $this->componentData->update_server_ftp = rtrim($basic->decryptString($this->componentData->update_server_ftp), "\0"); - } - // now move the file - $this->moveFileToFtpServer($xml_update_server_path,$this->componentData->update_server_ftp); - } - } return true; } return false; } + 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 + * + * @return void + * + */ + protected function setUpdateServer() + { + // move the update server to host + if ($this->componentData->add_update_server && $this->componentData->update_server_target == 1 && isset($this->updateServerFileName) && $this->dynamicIntegration) + { + $xml_update_server_path = $this->componentPath.'/'.$this->updateServerFileName.'.xml'; + // make sure we have the correct file + if (JFile::exists($xml_update_server_path) && isset($this->componentData->update_server_ftp)) + { + // Get the basic encription. + $basickey = ComponentbuilderHelper::getCryptKey('basic'); + // Get the encription object. + $basic = new FOFEncryptAes($basickey, 128); + if (!empty($this->componentData->update_server_ftp) && $basickey && !is_numeric($this->componentData->update_server_ftp) && $this->componentData->update_server_ftp === base64_encode(base64_decode($this->componentData->update_server_ftp, true))) + { + // basic decript data update_server_ftp. + $this->componentData->update_server_ftp = rtrim($basic->decryptString($this->componentData->update_server_ftp), "\0"); + } + // now move the file + $this->moveFileToFtpServer($xml_update_server_path,$this->componentData->update_server_ftp); + } + } + } + + // link canges made to views into the file license + protected function fixLicenseValues($data) + { + // check if these files have its own config data + if (isset($data['config']) && ComponentbuilderHelper::checkArray($data['config'])) + { + foreach ($data['config'] as $key => $value) + { + if ('###VERSION###' == $key) + { + // hmm we sould in some way make it known that this version number + // is not in relation the the project but to the file only... any ideas? + // this is the best for now... + if (1 == $value) + { + $value = '@first version of this MVC'; + } + else + { + $value = '@update number '.$value.' of this MVC'; + } + } + $this->fileContentStatic[$key] = $value; + } + return true; + } + // else insure to reset to global + $this->fileContentStatic['###CREATIONDATE###'] = $this->fileContentStatic['###CREATIONDATE###GLOBAL']; + $this->fileContentStatic['###BUILDDATE###'] = $this->fileContentStatic['###BUILDDATE###GLOBAL']; + $this->fileContentStatic['###VERSION###'] = $this->fileContentStatic['###VERSION###GLOBAL']; + } + private function buildReadMe($path) { // set readme data if not set already @@ -237,8 +387,7 @@ class Compiler extends Infusion $answer = str_replace(array_keys($this->fileContentStatic),array_values($this->fileContentStatic),$string); // add to zip array $this->writeFile($path,$answer); - } - + } private function buildReadMeData() { @@ -439,4 +588,148 @@ class Compiler extends Infusion } return false; } + + protected function addCustomCode() + { + foreach($this->customCode as $nr => $target) + { + // reset each time per custom code + $fingerPrint = array(); + if (isset($target['hashtarget'][0]) && $target['hashtarget'][0] > 3 + && isset($target['path']) && ComponentbuilderHelper::checkString($target['path']) + && isset($target['hashtarget'][1]) && ComponentbuilderHelper::checkString($target['hashtarget'][1])) + { + $file = $this->componentPath . '/'. $target['path']; + $size = (int) $target['hashtarget'][0]; + $hash = $target['hashtarget'][1]; + $cut = $size - 1; + $found = false; + $bites = 0; + $replace = array(); + if ($target['type'] == 1 && isset($target['hashendtarget'][0]) && $target['hashendtarget'][0] > 0) + { + $foundEnd = false; + $sizeEnd = (int) $target['hashendtarget'][0]; + $hashEnd = $target['hashendtarget'][1]; + $cutEnd = $sizeEnd - 1; + } + else + { + // replace to the end of the file + $foundEnd = true; + } + $counter = 0; + // check if file is new structure + if (JFile::exists($file)) + { + foreach (new SplFileObject($file) as $lineNumber => $lineContent) + { + if (!$found) + { + $bites = (int) bcadd(mb_strlen($lineContent, '8bit'), $bites); + } + if ($found && !$foundEnd) + { + $replace[] = (int) mb_strlen($lineContent, '8bit'); + // we musk keep last three lines to dynamic find target entry + $fingerPrint[$lineNumber] = trim($lineContent); + // check lines each time if it fits our target + if (count($fingerPrint) === $sizeEnd && !$foundEnd) + { + $fingerTest = md5(implode('',$fingerPrint)); + if ($fingerTest === $hashEnd) + { + // we are done here + $foundEnd = true; + $replace = array_slice($replace, 0, count($replace)-$sizeEnd); + break; + } + else + { + $fingerPrint = array_slice($fingerPrint, -$cutEnd, $cutEnd, true); + } + } + } + if ($found && $foundEnd) + { + $replace[] = (int) mb_strlen($lineContent, '8bit'); + } + // we musk keep last three lines to dynamic find target entry + $fingerPrint[$lineNumber] = trim($lineContent); + // check lines each time if it fits our target + if (count($fingerPrint) === $size && !$found) + { + $fingerTest = md5(implode('',$fingerPrint)); + if ($fingerTest === $hash) + { + // we are done here + $found = true; + // reset in case + $fingerPrint = array(); + // break if it is insertion + if ($target['type'] == 2) + { + break; + } + } + else + { + $fingerPrint = array_slice($fingerPrint, -$cut, $cut, true); + } + } + } + if ($found) + { + $placeholder = $this->getPlaceHolder($target['type'], $target['id']); + $data = $placeholder['start'] . "\n" . $target['code'] . $placeholder['end'] . "\n"; + if ($target['type'] == 2) + { + // found it now add code from the next line + $this->addDataToFile($file, $data, $bites); + } + elseif ($target['type'] == 1 && $foundEnd) + { + // found it now add code from the next line + $this->addDataToFile($file, $data, $bites, (int) array_sum($replace)); + } + else + { + // TODO give developer a notice that the code could not be added and needs his attention. + } + } + else + { + // TODO give developer a notice that the code could not be added and needs his attention. + } + } + else + { + // TODO give developer a notice that the code could not be added and needs his attention. + } + } + } + } + + // Thanks to http://stackoverflow.com/a/16813550/1429677 + protected function addDataToFile($file, $data, $position, $replace = null) + { + $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 + if ($replace) + { + $position = bcadd($position, $replace); + } + fseek($fpTemp, $position); // move to the position + + fwrite($fpFile, $data); // Add the data + + stream_copy_to_stream($fpTemp, $fpFile); // @Jack + + fclose($fpFile); // close file + fclose($fpTemp); // close tmp + } } diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index 17e21de58..e1fe1f84d 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -52,6 +52,49 @@ class Get */ public $componentData; + /* The custom script placeholders - we use the (xxx) to avoid detection it should be (***) + * + * New Insert Code = /xxx[INSERT<>$$$$]xxx/ /xxx[/INSERT<>$$$$]xxx/ + * New Replace Code = /xxx[REPLACE<>$$$$]xxx/ /xxx[/REPLACE<>$$$$]xxx/ + * + * //////////////////////////// when JCB adds it back /////////////////////////////// + * JCB Add Inserted Code = /xxx[INSERTED$$$$]xxx/ //23 /xxx[/INSERTED$$$$]xxx/ + * JCB Add Replaced Code = /xxx[REPLACED$$$$]xxx/ //25 /xxx[/REPLACED$$$$]xxx/ + * + * ///////////////////////// changeing existing custom code ///////////////////////// + * Update Inserted Code = /xxx[INSERTED<>$$$$]xxx///23 /xxx[/INSERTED<>$$$$]xxx/ + * Update Replaced Code = /xxx[REPLACED<>$$$$]xxx///25 /xxx[/REPLACED<>$$$$]xxx/ + * + * //23 is the ID of the code in the system don't change it!!!!!!!!!!!!!!!!!!!!!!!!!! + * + * @var array + ******************************************************************************************/ + protected $customCodePlaceholders = array(1 => 'REPLACE<>$$$$]', + 2 => 'INSERT<>$$$$]', + 3 => 'REPLACED<>$$$$]', + 4 => 'INSERTED<>$$$$]'); + + /** + * The custom code to be added + * + * @var array + */ + public $customCode; + + /** + * The custom code in local files that aready exist in system + * + * @var array + */ + protected $existingCustomCode = array(); + + /** + * The custom code in local files this are new + * + * @var array + */ + protected $newCustomCode = array(); + /** * The Language prefix * @@ -586,7 +629,7 @@ class Get { $component->config[$nr]['alias'] = 0; $component->config[$nr]['title'] = 0; - if ($option == 'field') + if ($option === 'field') { // load the field data $component->config[$nr]['settings'] = $this->getFieldData($value); @@ -890,7 +933,7 @@ class Get $this->customScriptBuilder['token'][$name_single] = false; $this->customScriptBuilder['token'][$name_list] = false; // load the values form params - $permissions = json_decode($view->addpermissions,true); + $permissions = json_decode($view->addpermissions,true); unset($view->addpermissions); $tabs = json_decode($view->addtabs,true); unset($view->addtabs); @@ -898,9 +941,9 @@ class Get unset($view->addfields); $conditions = json_decode($view->addconditions,true); unset($view->addconditions); - $linked_views = json_decode($view->addlinked_views,true); + $linked_views = json_decode($view->addlinked_views,true); unset($view->addlinked_views); - $tables = json_decode($view->addtables,true); + $tables = json_decode($view->addtables,true); unset($view->addtables); // sort the values if (ComponentbuilderHelper::checkArray($tables)) @@ -972,7 +1015,7 @@ class Get { foreach ($conditionValues as $nr => $conditionValue) { - if ($condition == 'target_field') + if ($condition === 'target_field') { if (ComponentbuilderHelper::checkArray($conditionValue) && ComponentbuilderHelper::checkArray($view->fields)) { @@ -1006,7 +1049,7 @@ class Get } } } - if ($condition == 'match_field') + if ($condition === 'match_field') { foreach ($view->fields as $fieldValue) { @@ -1240,7 +1283,7 @@ class Get // Load the results as a list of stdClass objects (see later for more options on retrieving data). $view = $db->loadObject(); - if ($table == 'site_view') + if ($table === 'site_view') { $this->lang = 'site'; } @@ -1409,7 +1452,7 @@ class Get */ public function getFieldData($id,$name_single = null,$name_list = null) { - if (!isset($this->_fieldData[$id])) + if (!isset($this->_fieldData[$id]) && $id > 0) { // Get a db connection. $db = JFactory::getDbo(); @@ -1462,90 +1505,7 @@ class Get { $this->basicEncryption = true; } - - // check if we should load scripts for single view - if (ComponentbuilderHelper::checkString($name_single) && !isset($this->customFieldScript[$name_single][$id])) - { - // add_javascript_view_footer - if ($field->add_javascript_view_footer == 1) - { - if (!isset($this->customScriptBuilder['view_footer'][$name_single])) - { - if(!isset($this->customScriptBuilder['view_footer'])) - { - $this->customScriptBuilder['view_footer'] = array(); - } - $this->customScriptBuilder['view_footer'][$name_single] = ''; - } - $this->customScriptBuilder['view_footer'][$name_single] .= "\n".$this->setCustomContentLang(base64_decode($field->javascript_view_footer)); - if (strpos($field->javascript_view_footer,"token") !== false && strpos($field->javascript_view_footer,"task=ajax") !== false) - { - if (!isset($this->customScriptBuilder['token'][$name_single]) || !$this->customScriptBuilder['token'][$name_single]) - { - if(!isset($this->customScriptBuilder['token'])) - { - $this->customScriptBuilder['token'] = array(); - } - $this->customScriptBuilder['token'][$name_single] = true; - } - } - unset($field->javascript_view_footer); - } - - // add_css_view - if ($field->add_css_view == 1) - { - if (!isset($this->customScriptBuilder['css_view'][$name_single])) - { - $this->customScriptBuilder['css_view'][$name_single] = ''; - } - $this->customScriptBuilder['css_view'][$name_single] .= "\n".base64_decode($field->css_view); - unset($field->css_view); - } - - // add this only once to view. - $this->customFieldScript[$name_single][$id] = true; - } - else - { - // unset if not needed - unset($field->javascript_view_footer); - unset($field->css_view); - } - // check if we should load scripts for list views - if (ComponentbuilderHelper::checkString($name_list)) - { - // add_javascript_views_footer - if ($field->add_javascript_views_footer == 1) - { - $this->customScriptBuilder['views_footer'][$name_list] .= $this->setCustomContentLang(base64_decode($field->javascript_views_footer)); - if (strpos($field->javascript_views_footer,"token") !== false && strpos($field->javascript_views_footer,"task=ajax") !== false) - { - if (!$this->customScriptBuilder['token'][$name_list]) - { - $this->customScriptBuilder['token'][$name_list] = true; - } - } - unset($field->javascript_views_footer); - } - // add_css_views - if ($field->add_css_views == 1) - { - if (!isset($this->customScriptBuilder['css_views'][$name_list])) - { - $this->customScriptBuilder['css_views'][$name_list] = ''; - } - $this->customScriptBuilder['css_views'][$name_list] .= base64_decode($field->css_views); - unset($field->css_views); - } - } - else - { - // unset if not needed - unset($field->javascript_views_footer); - unset($field->css_views); - - } + $this->_fieldData[$id] = $field; } else @@ -1553,8 +1513,121 @@ class Get return false; } } - // return the found field data - return $this->_fieldData[$id]; + // check if the script should be added to the view each time this field is called + if (isset($this->_fieldData[$id]) && $id > 0) + { + // check if we should load scripts for single view + if (ComponentbuilderHelper::checkString($name_single) && !isset($this->customFieldScript[$name_single][$id])) + { + // add_javascript_view_footer + if ($this->_fieldData[$id]->add_javascript_view_footer == 1) + { + if(!isset($this->customScriptBuilder['view_footer'])) + { + $this->customScriptBuilder['view_footer'] = array(); + } + if (!isset($this->customScriptBuilder['view_footer'][$name_single])) + { + $this->customScriptBuilder['view_footer'][$name_single] = ''; + } + if (!isset($this->_fieldData[$id]->javascript_view_footer_decoded)) + { + $this->_fieldData[$id]->javascript_view_footer = $this->setCustomContentLang(base64_decode($this->_fieldData[$id]->javascript_view_footer)); + $this->_fieldData[$id]->javascript_view_footer_decoded = true; + } + $this->customScriptBuilder['view_footer'][$name_single] .= "\n".$this->_fieldData[$id]->javascript_view_footer; + if (strpos($this->_fieldData[$id]->javascript_view_footer,"token") !== false && strpos($this->_fieldData[$id]->javascript_view_footer,"task=ajax") !== false) + { + if (!isset($this->customScriptBuilder['token'][$name_single]) || !$this->customScriptBuilder['token'][$name_single]) + { + if(!isset($this->customScriptBuilder['token'])) + { + $this->customScriptBuilder['token'] = array(); + } + $this->customScriptBuilder['token'][$name_single] = true; + } + } + } + + // add_css_view + if ($this->_fieldData[$id]->add_css_view == 1) + { + if (!isset($this->customScriptBuilder['css_view'])) + { + $this->customScriptBuilder['css_view'] = array(); + } + if (!isset($this->customScriptBuilder['css_view'][$name_single])) + { + $this->customScriptBuilder['css_view'][$name_single] = ''; + } + if (!isset($this->_fieldData[$id]->css_view_decoded)) + { + $this->_fieldData[$id]->css_view = base64_decode($this->_fieldData[$id]->css_view); + $this->_fieldData[$id]->css_view_decoded = true; + } + $this->customScriptBuilder['css_view'][$name_single] .= "\n".$this->_fieldData[$id]->css_view; + } + + // add this only once to view. + $this->customFieldScript[$name_single][$id] = true; + } + // check if we should load scripts for list views + if (ComponentbuilderHelper::checkString($name_list) && !isset($this->customFieldScript[$name_list][$id])) + { + // add_javascript_views_footer + if ($this->_fieldData[$id]->add_javascript_views_footer == 1) + { + if(!isset($this->customScriptBuilder['views_footer'])) + { + $this->customScriptBuilder['views_footer'] = array(); + } + if (!isset($this->customScriptBuilder['views_footer'][$name_list])) + { + $this->customScriptBuilder['views_footer'][$name_list] = ''; + } + if (!isset($this->_fieldData[$id]->javascript_views_footer_decoded)) + { + $this->_fieldData[$id]->javascript_views_footer = $this->setCustomContentLang(base64_decode($this->_fieldData[$id]->javascript_views_footer)); + $this->_fieldData[$id]->javascript_views_footer_decoded = true; + } + $this->customScriptBuilder['views_footer'][$name_list] .= $this->_fieldData[$id]->javascript_views_footer; + if (strpos($this->_fieldData[$id]->javascript_views_footer,"token") !== false && strpos($this->_fieldData[$id]->javascript_views_footer,"task=ajax") !== false) + { + if (!$this->customScriptBuilder['token'][$name_list]) + { + $this->customScriptBuilder['token'][$name_list] = true; + } + } + } + // add_css_views + if ($this->_fieldData[$id]->add_css_views == 1) + { + if (!isset($this->customScriptBuilder['css_views'])) + { + $this->customScriptBuilder['css_views'] = array(); + } + if (!isset($this->customScriptBuilder['css_views'][$name_list])) + { + $this->customScriptBuilder['css_views'][$name_list] = ''; + } + if (!isset($this->_fieldData[$id]->css_views_decoded)) + { + $this->_fieldData[$id]->css_views = base64_decode($this->_fieldData[$id]->css_views); + $this->_fieldData[$id]->css_views_decoded = true; + } + $this->customScriptBuilder['css_views'][$name_list] .= $this->_fieldData[$id]->css_views; + } + + // add this only once to view. + $this->customFieldScript[$name_list][$id] = true; + } + } + if (isset($this->_fieldData[$id]) && $id > 0) + { + // return the found field data + return $this->_fieldData[$id]; + } + return false; } /** @@ -1685,7 +1758,7 @@ class Get { if (ComponentbuilderHelper::checkString($value)) { - if ($option == 'selection') + if ($option === 'selection') { $on_field_as = ''; $on_field = ''; @@ -1699,7 +1772,7 @@ class Get if ($result->join_view_table[$nr]['row_type'] == 1) { $result->main_get[] = $result->join_view_table[$nr]; - if ($on_field_as == 'a') + if ($on_field_as === 'a') { $this->siteMainGet[$this->target][$view_code][$result->join_view_table[$nr]['as']] = $result->join_view_table[$nr]['as']; } @@ -1720,11 +1793,11 @@ class Get } else { - if ($option == 'type') + if ($option === 'type') { $value = $typeArray[$value]; } - if ($option == 'operator') + if ($option === 'operator') { $value = $operatorArray[$value]; } @@ -1747,7 +1820,7 @@ class Get { if (ComponentbuilderHelper::checkString($value)) { - if ($option == 'selection') + if ($option === 'selection') { $on_field_as = ''; $on_field = ''; @@ -1761,7 +1834,7 @@ class Get if ($result->join_db_table[$nr]['row_type'] == 1) { $result->main_get[] = $result->join_db_table[$nr]; - if ($on_field_as == 'a') + if ($on_field_as === 'a') { $this->siteMainGet[$this->target][$view_code][$result->join_db_table[$nr]['as']] = $result->join_db_table[$nr]['as']; } @@ -1782,11 +1855,11 @@ class Get } else { - if ($option == 'type') + if ($option === 'type') { $value = $typeArray[$value]; } - if ($option == 'operator') + if ($option === 'operator') { $value = $operatorArray[$value]; } @@ -1809,7 +1882,7 @@ class Get { if (ComponentbuilderHelper::checkString($value)) { - if ($option == 'operator') + if ($option === 'operator') { $value = $operatorArray[$value]; $result->filter[$nr]['key'] = $result->key; @@ -1865,7 +1938,7 @@ class Get { if (ComponentbuilderHelper::checkString($value)) { - if ($option == 'operator') + if ($option === 'operator') { $value = $operatorArray[$value]; } @@ -2237,7 +2310,7 @@ class Get $query = $db->getQuery(true); foreach ($tables as $table) { - if ($counter == 'a') + if ($counter === 'a') { // the main table fields if (strpos($table['sourcemap'],PHP_EOL) !== false) @@ -2507,4 +2580,413 @@ class Get } return false; } + + /** + * to unset stuff that are private or protected + * + */ + public function unsetNow($remove) + { + unset($this->$remove); + } + + /** + * get the custom code from the system + * + * @return void + * + */ + public function getCustomCode() + { + // Get a db connection. + $db = JFactory::getDbo(); + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.code','a.component','a.from_line','a.hashtarget','a.hashendtarget','a.path','a.to_line','a.type'))); + $query->from($db->quoteName('#__componentbuilder_custom_code','a')); + $query->where($db->quoteName('a.component') . ' = '. (int) $this->componentData->id); + $query->where($db->quoteName('a.published') . ' >= 1'); + $query->order($db->quoteName('a.from_line') . ' ASC'); // <--- insrue we always add code from top of file + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $this->customCode = $db->loadAssocList(); + // open the code + foreach($this->customCode as $nr => &$customCode) + { + $customCode['code'] = base64_decode($customCode['code']); + $customCode['hashtarget'] = explode("__", $customCode['hashtarget']); + if ($customCode['type'] == 1 && strpos($customCode['hashendtarget'], '__') !== false) + { + $customCode['hashendtarget'] = explode("__", $customCode['hashendtarget']); + } + } + } + return false; + } + + /** + * store the code + * + * @param object $db The database object + * @param int $when To set when to update + * + * @return void + * + */ + protected function setNewCustomCode($db, $when = 1) + { + if (count($this->newCustomCode) >= $when) + { + // Create a new query object. + $query = $db->getQuery(true); + // Insert columns. + $columns = array('path','type','component','published','created','created_by','version','access','hashtarget','from_line','to_line','code','hashendtarget'); + // Prepare the insert query. + $query->insert($db->quoteName('#__componentbuilder_custom_code')); + $query->columns($db->quoteName($columns)); + foreach($this->newCustomCode as $values){ + $query->values(implode(',', $values)); + } + // clear the values array + $this->newCustomCode = array(); + // Set the query using our newly populated query object and execute it. + $db->setQuery($query); + $db->execute(); + } + } + + /** + * store the code + * + * @param object $db The database object + * @param int $when To set when to update + * + * @return void + * + */ + protected function setExistingCustomCode($db, $when = 1) + { + if (count($this->existingCustomCode) >= $when) + { + foreach($this->existingCustomCode as $code) + { + // Create a new query object. + $query = $db->getQuery(true); + // Prepare the update query. + $query->update($db->quoteName('#__componentbuilder_custom_code'))->set($code['fields'])->where($code['conditions']); + // Set the query using our newly populated query object and execute it. + $db->setQuery($query); + $db->execute(); + } + // clear the values array + $this->existingCustomCode = array(); + } + } + + /** + * get the custom code from the local files + * + * @param array $paths The local paths to parse + * @param object $db The database object + * @param int $userId The user id + * @param string $today The date for today + * + * @return void + * + */ + protected function customCodeFactory(&$paths, &$db, &$userId, &$today) + { + // we must first store the current woking directory + $joomla = getcwd(); + $counter = array(1 => 0, 2 => 0); + foreach ($paths as $target => $path) + { + // we are changing the working directory to the componet path + chdir($path); + // get a list of files in the current directory tree (only PHP for now) + $files = JFolder::files('.', '\.php', true, true); + foreach ($files as $file) + { + $this->searchFileContent($counter, $file, $target, $this->customCodePlaceholders, $db, $userId, $today); + // insert new code + if (ComponentbuilderHelper::checkArray($this->newCustomCode)) + { + $this->setNewCustomCode($db, 100); + } + // update existing custom code + if (ComponentbuilderHelper::checkArray($this->existingCustomCode)) + { + $this->setExistingCustomCode($db, 30); + } + } + } + // change back to Joomla working directory + chdir($joomla); + // make sure all code is stored + if (ComponentbuilderHelper::checkArray($this->newCustomCode)) + { + $this->setNewCustomCode($db); + } + // update existing custom code + if (ComponentbuilderHelper::checkArray($this->existingCustomCode)) + { + $this->setExistingCustomCode($db); + } + } + + /** + * search a file for placeholders and store result + * + * @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 object $db The database object + * @param int $userId The user id + * @param string $today The date for today + * + * @return array on success + * + */ + protected function searchFileContent(&$counter, &$file, &$target, &$placeholders, &$db, &$userId, &$today) + { + // reset each time per file + $loadEndFingerPrint = false; + $endFingerPrint = array(); + $fingerPrint = array(); + $codeBucket = array(); + $pointer = array(); + $reading = array(); + $reader = 0; + $path = $target . '/' . str_replace('./', '', $file); + foreach (new SplFileObject($file) as $lineNumber => $lineContent) + { + // we musk keep last few lines to dynamic find target entry later + $fingerPrint[$lineNumber] = trim($lineContent); + // load the end fingerprint + if ($loadEndFingerPrint) + { + $endFingerPrint[$lineNumber] = trim($lineContent); + } + foreach ($placeholders as $type => $placeholder) + { + $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.'***/'; + // check if the ending place holder was found + if(isset($reading[$targetKey]) && $reading[$targetKey] && (trim($lineContent) === $end || strpos($lineContent, $end) !== false)) + { + // deactivate the reader + $reading[$targetKey] = false; + if ($_type == 2) + { + // deactivate search + $reader = 0; + } + else + { + // activate fingerPrint for replacement end target + $loadEndFingerPrint = true; + $backupTargetKey = $targetKey; + } + // all new records we can do a bulk insert + if ($i === 1) + { + // end the bucket info for this code block + $this->newCustomCode[$pointer[$targetKey]][] = $db->quote((int) $lineNumber); // 'toline' + $this->newCustomCode[$pointer[$targetKey]][] = $db->quote(base64_encode(implode('', $codeBucket[$pointer[$targetKey]]))); // 'code' + if ($_type == 2) + { + // load the last value + $this->newCustomCode[$pointer[$targetKey]][] = $db->quote(0); // 'hashendtarget' + } + } + // the record already exist so we must use module to update + elseif ($i === 2) + { + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('to_line') . ' = ' . $db->quote($lineNumber); + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('code') . ' = ' . $db->quote(base64_encode(implode('', $codeBucket[$pointer[$targetKey]]))); + if ($_type == 2) + { + // load the last value + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('hashendtarget') . ' = ' . $db->quote(0); + } + } + } + // check if the endfingerprint is ready to save + if (count($endFingerPrint) === 3) + { + $hashendtarget = '3__'.md5(implode('',$endFingerPrint)); + // all new records we can do a bulk insert + if ($i === 1) + { + // load the last value + $this->newCustomCode[$pointer[$backupTargetKey]][] = $db->quote($hashendtarget); // 'hashendtarget' + } + // the record already exist so we must use module to update + elseif ($i === 2) + { + $this->existingCustomCode[$pointer[$backupTargetKey]]['fields'][] = $db->quoteName('hashendtarget') . ' = ' . $db->quote($hashendtarget); + } + // reset the needed values + $endFingerPrint = array(); + $loadEndFingerPrint = false; + // deactivate reader (to allow other search) + $reader = 0; + } + // then read in the code + if (isset($reading[$targetKey]) && $reading[$targetKey]) + { + $codeBucket[$pointer[$targetKey]][] = $lineContent; + } + // check if the starting place holder was found + if((!isset($reading[$targetKey]) || !$reading[$targetKey]) && (($i === 1 && trim($lineContent) === $start) || strpos($lineContent, $start) !== false)) + { + // set active reader (to lock out other search) + $reader = $i; + // set pointer + $pointer[$targetKey] = $counter[$i]; + // activate the reader + $reading[$targetKey] = true; + // start code bucket + $codeBucket[$pointer[$targetKey]] = array(); + // get the finger print around the custom code + $inFinger = count($fingerPrint); + $getFinger = $inFinger - 1; + $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; + if ($i === 2) + { + $id = $this->getSystemID($lineContent, $start); + } + // all new records we can do a buldk insert + if ($i === 1 || !$id) + { + // start the bucket for this code + $this->newCustomCode[$pointer[$targetKey]] = array(); + $this->newCustomCode[$pointer[$targetKey]][] = $db->quote($path); // 'path' + $this->newCustomCode[$pointer[$targetKey]][] = $db->quote((int) $_type); // 'type' + $this->newCustomCode[$pointer[$targetKey]][] = $db->quote((int) $this->componentData->id); // 'component' + $this->newCustomCode[$pointer[$targetKey]][] = $db->quote(1); // 'published' + $this->newCustomCode[$pointer[$targetKey]][] = $db->quote($today); // 'created' + $this->newCustomCode[$pointer[$targetKey]][] = $db->quote((int) $userId); // 'created_by' + $this->newCustomCode[$pointer[$targetKey]][] = $db->quote(1); // 'version' + $this->newCustomCode[$pointer[$targetKey]][] = $db->quote(1); // 'access' + $this->newCustomCode[$pointer[$targetKey]][] = $db->quote($hashtarget); // 'hashtarget' + $this->newCustomCode[$pointer[$targetKey]][] = $db->quote((int) $lineNumber); // 'fromline' + } + // the record already exist so we must update instead + elseif ($i === 2 && $id > 0) + { + // start the bucket for this code + $this->existingCustomCode[$pointer[$targetKey]] = array(); + $this->existingCustomCode[$pointer[$targetKey]]['id'] = (int) $id; + $this->existingCustomCode[$pointer[$targetKey]]['conditions'] = array(); + $this->existingCustomCode[$pointer[$targetKey]]['conditions'][] = $db->quoteName('id') . ' = ' . $db->quote($id); + $this->existingCustomCode[$pointer[$targetKey]]['fields'] = array(); + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('path') . ' = ' . $db->quote($path); + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('type') . ' = ' . $db->quote($_type); + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('component') . ' = ' . $db->quote($this->componentData->id); + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('from_line') . ' = ' . $db->quote($lineNumber); + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('modified') . ' = ' . $db->quote($today); + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('modified_by') . ' = ' . $db->quote($userId); + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('hashtarget') . ' = ' . $db->quote($hashtarget); + } + // update the counter + $counter[$i]++; + } + } + } + // make sure only a few lines is kept at a time + if (count($fingerPrint) > 10) + { + $fingerPrint = array_slice($fingerPrint, -6, 6, true); + } + } + // if the code is at the end of the page and there were not three more lines + if (count($endFingerPrint) > 0 || $loadEndFingerPrint) + { + if (count($endFingerPrint) > 0) + { + $leng = count($endFingerPrint); + $hashendtarget = $leng . '__' . md5(implode('',$endFingerPrint)); + } + else + { + $hashendtarget = 0; + } + // all new records we can do a buldk insert + if ($i === 1) + { + // load the last value + $this->newCustomCode[$pointer[$backupTargetKey]][] = $db->quote($hashendtarget); // 'hashendtarget' + } + // the record already exist so we must use module to update + elseif ($i === 2) + { + $this->existingCustomCode[$pointer[$backupTargetKey]]['fields'][] = $db->quoteName('hashendtarget') . ' = ' . $db->quote($hashendtarget); + } + } + } + + /** + * search for the system id in the line given + * + * @param string $lineContent The file path to search + * @param string $placeholders The values to search for + * + * @return array on success + * + */ + protected function getSystemID(&$lineContent, $placeholder) + { + // remove place holder from content + $string = trim(str_replace($placeholder.'//', '', $lineContent)); + // now get all numbers + $numbers = array(); + preg_match_all('!\d+!', $string, $numbers); + // return the first number + if (isset($numbers[0]) && ComponentbuilderHelper::checkArray($numbers[0])) + { + return reset($numbers[0]); + } + return false; + } + + /** + * return the placeholders for insered and replaced code + * + * @param int $type The type of placement + * @param int $id The code id in the system + * + * @return array on success + * + */ + public function getPlaceHolder(&$type, &$id) + { + switch ($type) + { + case 1: + //xxx[REPLACED$$$$]xxx///1 + return array( + 'start' => '/***[REPLACED$$$$]***///'.$id, + 'end' => '/***[/REPLACED$$$$]***/'); + break; + case 2: + //xxx[INSERTED$$$$]xxx///1 + return array( + 'start' => '/***[INSERTED$$$$]***///'.$id, + 'end' => '/***[/INSERTED$$$$]***/'); + break; + } + return false; + } } diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php index 7f11f4b79..84f2fafc9 100644 --- a/admin/helpers/compiler/b_Structure.php +++ b/admin/helpers/compiler/b_Structure.php @@ -143,6 +143,13 @@ class Structure extends Get */ public $addCheckin = false; + /** + * The array of last modified dates + * + * @var array + */ + protected $lastModifiedDate = array(); + /** * Constructor */ @@ -367,7 +374,7 @@ class Structure extends Get // do the file renaming if ($details->rename) { - if ($details->rename == 'new') + if ($details->rename === 'new') { $new = $details->newName; } @@ -381,12 +388,12 @@ class Structure extends Get $new = $item; } // if not gnu/gpl license dont add the LICENSE.txt file - if ($item == 'LICENSE.txt' && !$LICENSE) + if ($item === 'LICENSE.txt' && !$LICENSE) { continue; } // if not needed do not add - if (($item == 'README.md' || $item == 'README.txt') && !$README) + if (($item === 'README.md' || $item === 'README.txt') && !$README) { continue; } @@ -396,7 +403,7 @@ class Structure extends Get // set the template folder path $templatePath = (isset($details->custom) && $details->custom) ? $this->templatePathCustom : $this->templatePath; // now mov the file - if ($details->type == 'file') + if ($details->type === 'file') { // move the file to its place JFile::copy($templatePath.'/'.$item, $path.'/'.$new); @@ -408,7 +415,7 @@ class Structure extends Get $this->newFiles['static'][] = array( 'path' => $path.'/'.$new, 'name' => $new, 'zip' => $zipPath.'/'.$new ); } } - elseif ($details->type == 'folder') + elseif ($details->type === 'folder') { // move the folder to its place JFolder::copy($templatePath.'/'.$item, $path.'/'.$new); @@ -441,21 +448,25 @@ class Structure extends Get { if (ComponentbuilderHelper::checkObject($view['settings'])) { + $modified = $this->getLastModifiedDate($view); if ($view['settings']->name_list != 'null') { $target = array('admin' => $view['settings']->name_list); - $this->buildDynamique($target,'list'); + $config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version); + $this->buildDynamique($target,'list', false, $config); } if ($view['settings']->name_single != 'null') { $target = array('admin' => $view['settings']->name_single); - $this->buildDynamique($target,'single'); + $config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version); + $this->buildDynamique($target,'single', false, $config); } if($view['edit_create_site_view']) { // setup the front site edit-view files $target = array('site' => $view['settings']->name_single); - $this->buildDynamique($target,'edit'); + $config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version); + $this->buildDynamique($target,'edit', false, $config); } } // quick set of checkin once @@ -472,17 +483,20 @@ class Structure extends Get foreach ($this->componentData->site_views as $nr => $view) { + $modified = $this->getLastModifiedDate($view); if ($view['settings']->main_get->gettype == 2) { // set list view $target = array('site' => $view['settings']->code); - $this->buildDynamique($target,'list'); + $config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version); + $this->buildDynamique($target,'list', false, $config); } elseif ($view['settings']->main_get->gettype == 1) { // set single view $target = array('site' => $view['settings']->code); - $this->buildDynamique($target,'single'); + $config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version); + $this->buildDynamique($target,'single', false, $config); } } $front = true; @@ -491,17 +505,20 @@ class Structure extends Get { foreach ($this->componentData->custom_admin_views as $nr => $view) { + $modified = $this->getLastModifiedDate($view); if ($view['settings']->main_get->gettype == 2) { // set list view $target = array('custom_admin' => $view['settings']->code); - $this->buildDynamique($target,'list'); + $config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => JFactory::getDate($view['settings']->modified)->format('jS F, Y'),'###VERSION###' => $view['settings']->version); + $this->buildDynamique($target,'list', false, $config); } elseif ($view['settings']->main_get->gettype == 1) { // set single view $target = array('custom_admin' => $view['settings']->code); - $this->buildDynamique($target,'single'); + $config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => JFactory::getDate($view['settings']->modified)->format('jS F, Y'),'###VERSION###' => $view['settings']->version); + $this->buildDynamique($target, 'single', false, $config); } } $back = true; @@ -514,17 +531,98 @@ class Structure extends Get return false; } + /** + * get the last modified date of a MVC (view) + * + * @param array $view The view values + * + * @return string Last Modified Date + * + */ + public function getLastModifiedDate($view) + { + // first set the main date + $date = strtotime($view['settings']->modified); + if (isset($view['adminview'])) + { + $id = $view['adminview'].'admin'; + // now check if value has been set + if (!isset($this->lastModifiedDate[$id])) + { + if (isset($view['settings']->fields) && ComponentbuilderHelper::checkArray($view['settings']->fields)) + { + foreach ($view['settings']->fields as $field) + { + if (isset($field['settings']) && ComponentbuilderHelper::checkObject($field['settings']) && isset($field['settings']->modified)) + { + $anotherDate = strtotime($field['settings']->modified); + if ($anotherDate > $date) + { + $date = $anotherDate; + } + } + } + } + } + } + elseif (isset($view['siteview'])) + { + $id = $view['siteview'].'site'; + // now check if value has been set + if (!isset($this->lastModifiedDate[$id])) + { + if (isset($view['settings']->main_get->modified)) + { + $anotherDate = strtotime($view['settings']->main_get->modified); + if ($anotherDate > $date) + { + $date = $anotherDate; + } + } + } + } + elseif (isset($view['customadminview'])) + { + $id = $view['customadminview'].'customadmin'; + // now check if value has been set + if (!isset($this->lastModifiedDate[$id])) + { + if (isset($view['settings']->main_get->modified)) + { + $anotherDate = strtotime($view['settings']->main_get->modified); + if ($anotherDate > $date) + { + $date = $anotherDate; + } + } + } + } + // check if ID was found + if (!isset($id)) + { + $id = md5($date); + } + // now load the date + if (!isset($this->lastModifiedDate[$id])) + { + $this->lastModifiedDate[$id] = $date; + } + + return JFactory::getDate($this->lastModifiedDate[$id])->format('jS F, Y'); + } + /** * Set the Static File & Folder * * @param array $target The main target and name * @param string $type The type in the target * @param string $fileName The custom file name + * @param array $cofig to add more data to the files info * * @return boolean * */ - public function buildDynamique($target,$type,$fileName = false) + public function buildDynamique($target, $type, $fileName = false, $config = false) { if (ComponentbuilderHelper::checkArray($target)) { @@ -566,7 +664,7 @@ class Structure extends Get $new = str_replace($details->rename, $fileName, $item); $name = $name.'_'.$fileName; } - elseif ($details->rename == 'new') + elseif ($details->rename === 'new') { $new = $details->newName; } @@ -586,8 +684,14 @@ class Structure extends Get // count the file created $this->fileCount++; } + // setup array for new file + $newFIle = array( 'path' => $path.'/'.$new, 'name' => $new , 'view' => $name, 'zip' => $zipPath.'/'.$new); + if (ComponentbuilderHelper::checkArray($config)) + { + $newFIle['config'] = $config; + } // store the new files - $this->newFiles['dynamic'][$name][] = array( 'path' => $path.'/'.$new, 'name' => $new , 'view' => $name, 'zip' => $zipPath.'/'.$new); + $this->newFiles['dynamic'][$name][] = $newFIle; } } } @@ -671,7 +775,7 @@ class Structure extends Get { $this->fileContentStatic['###EXSTRA_MEDIA_FOLDERS###'] = ''; } - if (count($pathArray) == 1 && $firstFolder == 'media') + if (count($pathArray) == 1 && $firstFolder === 'media') { $this->fileContentStatic['###EXSTRA_MEDIA_FOLDERS###'] .= "\n\t\t".$lastFolder.""; } @@ -680,7 +784,7 @@ class Structure extends Get { $this->fileContentStatic['###EXSTRA_SITE_FOLDERS###'] = ''; } - if (count($pathArray) == 1 && $firstFolder == 'site') + if (count($pathArray) == 1 && $firstFolder === 'site') { $this->fileContentStatic['###EXSTRA_SITE_FOLDERS###'] .= "\n\t\t".$lastFolder.""; } @@ -689,7 +793,7 @@ class Structure extends Get { $this->fileContentStatic['###EXSTRA_ADMIN_FOLDERS###'] = ''; } - if (count($pathArray) == 1 && $firstFolder == 'admin') + if (count($pathArray) == 1 && $firstFolder === 'admin') { $this->fileContentStatic['###EXSTRA_ADMIN_FOLDERS###'] .= "\n\t\t\t".$lastFolder.""; } @@ -831,4 +935,38 @@ class Structure extends Get } return false; } + + /** + * get the local installed path of this component + * + * @return array of paths on success + * + */ + public function getLocalInstallPaths() + { + // set the local paths to search + $localPaths = array(); + // the admin path + $localPaths['admin'] = JPATH_ADMINISTRATOR . '/components/com_'. $this->componentCodeName; + // only check for site path if the component has a site area! + if (!$this->removeSiteFolder) + { + $localPaths['site'] = JPATH_ROOT . '/components/com_'. $this->componentCodeName; + } + // TODO later to include the JS and CSS + // $localPaths['media'] = JPATH_ROOT . '/media/com_'. $this->fileContentStatic['###component###']; + // check if the local install is found + foreach ($localPaths as $key => $localPath) + { + if (!JFolder::exists($localPath)) + { + unset($localPaths[$key]); + } + } + if (ComponentbuilderHelper::checkArray($localPaths)) + { + return $localPaths; + } + return false; + } } diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index 5f35649b1..73cde20e0 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -731,7 +731,7 @@ class Fields extends Structure // now add to the field set $fieldSet .= $this->setField('spacer', $taber, $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray); // increment spacer counter - if ($typeName == 'spacer') + if ($typeName === 'spacer') { $spacerCounter++; } @@ -739,7 +739,7 @@ class Fields extends Structure elseif ($this->defaultField($typeName, 'special')) { // set the repeatable field - if ($typeName == 'repeatable') + if ($typeName === 'repeatable') { if ($build) { @@ -794,7 +794,7 @@ class Fields extends Structure private function setField($setType, $taber, &$fieldAttributes, &$name, &$typeName, &$langView, &$viewName, &$listViewName, $placeholders, &$optionArray, $custom = null) { $fieldSet = ''; - if ($setType == 'option') + if ($setType === 'option') { // now add to the field set $fieldSet .= "\n\t" . $taber . "\t"; @@ -806,7 +806,7 @@ class Fields extends Structure { $fieldSet .= "\n\t\t" . $taber . "\t" . $property . '="' . $value . '"'; } - elseif ($property == 'option') + elseif ($property === 'option') { $optionSet = ''; if (strpos($value, ',') !== false) @@ -872,7 +872,7 @@ class Fields extends Structure $fieldSet .= $optionSet; $fieldSet .= "\n\t\t" . $taber . ""; } - elseif ($typeName == 'sql') + elseif ($typeName === 'sql') { $optionArray = false; $fieldSet .= "\n\t\t" . $taber . "/>"; @@ -884,7 +884,7 @@ class Fields extends Structure $fieldSet .= "\n\t\t" . $taber . "/>"; } } - elseif ($setType == 'plain') + elseif ($setType === 'plain') { // now add to the field set $fieldSet .= "\n\t\t" . $taber . ""; @@ -898,7 +898,7 @@ class Fields extends Structure } $fieldSet .= "\n\t\t" . $taber . "/>"; } - elseif ($setType == 'spacer') + elseif ($setType === 'spacer') { // now add to the field set $fieldSet .= "\n\t\t"; @@ -912,10 +912,10 @@ class Fields extends Structure } $fieldSet .= " />"; } - elseif ($setType == 'special') + elseif ($setType === 'special') { // set the repeatable field - if ($typeName == 'repeatable') + if ($typeName === 'repeatable') { // now add to the field set $fieldSet .= "\n\t\t"; @@ -1004,7 +1004,7 @@ class Fields extends Structure $fieldSet .= "\n\t\t"; } } - elseif ($setType == 'custom') + elseif ($setType === 'custom') { // now add to the field set $fieldSet .= "\n\t\t" . $taber . ""; @@ -1063,7 +1063,7 @@ class Fields extends Structure $this->movedPublishingFields[$viewName][$name] = $name; } } - elseif ($tabName == 'publishing') + elseif ($tabName === 'publishing') { if (!in_array($name, $this->defaultFields)) { @@ -1170,9 +1170,9 @@ class Fields extends Structure // reset $xmlValue = ''; $langValue = ''; - if ($property['name'] == 'type') + if ($property['name'] === 'type') { - if ($typeName == 'custom' || $typeName == 'customuser') + if ($typeName === 'custom' || $typeName === 'customuser') { $xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'type="', '"')); } @@ -1212,10 +1212,10 @@ class Fields extends Structure $fieldAttributes['custom']['type'] = $typeName; } } - elseif ($property['name'] == 'name') + elseif ($property['name'] === 'name') { // if category then name must be catid (only one per view) - if ($typeName == 'category') + if ($typeName === 'category') { // quick check if this is a category linked to view page $requeSt_id = ComponentbuilderHelper::getBetween($field['settings']->xml, 'name="', '"'); @@ -1242,7 +1242,7 @@ class Fields extends Structure } } // if tag is set then enable all tag options for this view (only one per view) - elseif ($typeName == 'tag') + elseif ($typeName === 'tag') { $xmlValue = 'tags'; } @@ -1251,7 +1251,7 @@ class Fields extends Structure { $xmlValue = 'alias'; } - elseif ($typeName == 'spacer') + elseif ($typeName === 'spacer') { // make sure the name is unique $xmlValue = $name . '_' . $spacerCounter; @@ -1272,7 +1272,7 @@ class Fields extends Structure $name = $xmlValue; } } - elseif ($property['name'] == 'extension' || $property['name'] == 'directory') + elseif ($property['name'] === 'extension' || $property['name'] === 'directory') { $xmlValue = ComponentbuilderHelper::getBetween($field['settings']->xml, $property['name'] . '="', '"'); // replace the placeholders @@ -1292,61 +1292,61 @@ class Fields extends Structure // load the php for the custom field file $fieldAttributes['custom']['phpx'][$phpLine] = ComponentbuilderHelper::getBetween($field['settings']->xml, $property['name'] . '="', '"'); } - elseif ($property['name'] == 'extends' && $setCustom) + elseif ($property['name'] === 'extends' && $setCustom) { // load the class that is being extended $fieldAttributes['custom']['extends'] = ComponentbuilderHelper::getBetween($field['settings']->xml, 'extends="', '"'); } - elseif ($property['name'] == 'view' && $setCustom) + elseif ($property['name'] === 'view' && $setCustom) { // load the view name $fieldAttributes['custom']['view'] = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'view="', '"')); } - elseif ($property['name'] == 'views' && $setCustom) + elseif ($property['name'] === 'views' && $setCustom) { // load the views name $fieldAttributes['custom']['views'] = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'views="', '"')); } - elseif ($property['name'] == 'component' && $setCustom) + elseif ($property['name'] === 'component' && $setCustom) { // 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']); } - elseif ($property['name'] == 'table' && $setCustom) + 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']); } - elseif ($property['name'] == 'value_field' && $setCustom) + elseif ($property['name'] === 'value_field' && $setCustom) { // load the text key $fieldAttributes['custom']['text'] = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'value_field="', '"')); } - elseif ($property['name'] == 'key_field' && $setCustom) + elseif ($property['name'] === 'key_field' && $setCustom) { // load the id key $fieldAttributes['custom']['id'] = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'key_field="', '"')); } - elseif ($property['name'] == 'button' && $repeatable && $setCustom) + elseif ($property['name'] === 'button' && $repeatable && $setCustom) { // dont load the button to repeatable $xmlValue = 'false'; } - elseif ($property['name'] == 'required' && $repeatable) + elseif ($property['name'] === 'required' && $repeatable) { // dont load the required to repeatable $xmlValue = 'false'; } - elseif ($viewType == 2 && ($property['name'] == 'readonly' || $property['name'] == 'disabled')) + elseif ($viewType == 2 && ($property['name'] === 'readonly' || $property['name'] === 'disabled')) { // set read only $xmlValue = 'true'; } - elseif ($property['name'] == 'multiple') + elseif ($property['name'] === 'multiple') { $xmlValue = (string) ComponentbuilderHelper::getBetween($field['settings']->xml, $property['name'] . '="', '"'); // add the multipal @@ -1356,7 +1356,7 @@ class Fields extends Structure } } // make sure the name is added as a cless name for use in javascript - elseif ($property['name'] == 'class' && ($typeName == 'note' || $typeName == 'spacer')) + elseif ($property['name'] === 'class' && ($typeName === 'note' || $typeName === 'spacer')) { $xmlValue = ComponentbuilderHelper::getBetween($field['settings']->xml, 'class="', '"'); // add the type class @@ -1397,26 +1397,26 @@ class Fields extends Structure } elseif (isset($field['alias']) && $field['alias'] && $property['translatable'] == 1) { - if ($property['name'] == 'label') + if ($property['name'] === 'label') { $xmlValue = 'JFIELD_ALIAS_LABEL'; } - elseif ($property['name'] == 'description') + elseif ($property['name'] === 'description') { $xmlValue = 'JFIELD_ALIAS_DESC'; } - elseif ($property['name'] == 'hint') + elseif ($property['name'] === 'hint') { $xmlValue = 'JFIELD_ALIAS_PLACEHOLDER'; } } elseif (isset($field['title']) && $field['title'] && $property['translatable'] == 1) { - if ($property['name'] == 'label') + if ($property['name'] === 'label') { $xmlValue = 'JGLOBAL_TITLE'; } - elseif ($property['name'] == 'description') + elseif ($property['name'] === 'description') { $xmlValue = 'JFIELD_TITLE_DESC'; } @@ -1436,7 +1436,7 @@ class Fields extends Structure $fieldAttributes[$property['name']] = $xmlValue; // load to langBuilder down the line - if ($property['name'] == 'label') + if ($property['name'] === 'label') { $langLabel = $xmlValue; if ($setCustom) @@ -1481,7 +1481,7 @@ class Fields extends Structure */ public function setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple, $custom = false, $options = false) { - if ($typeName == 'tag') + if ($typeName === 'tag') { // set tags for this view but don't load to DB $this->tagsBuilder[$viewName] = $viewName; @@ -1492,7 +1492,7 @@ class Fields extends Structure $intKeys = array('INT', 'TINYINT', 'BIGINT', 'FLOAT', 'DECIMAL', 'DOUBLE'); if (in_array($field['settings']->datatype, $intKeys)) { - if ($field['settings']->datadefault == 'Other') + if ($field['settings']->datadefault === 'Other') { if (!is_numeric($field['settings']->datadefault_other) || $field['settings']->datadefault_other !== '0000-00-00 00:00:00') { @@ -1526,7 +1526,7 @@ class Fields extends Structure // build unique keys of this view for db $this->dbUniqueKeys[$viewName][] = $name; } - elseif (($field['settings']->indexes == 2 || $field['alias'] || $field['title'] || $typeName == 'category') && !in_array($field['settings']->datatype, $textKeys)) + elseif (($field['settings']->indexes == 2 || $field['alias'] || $field['title'] || $typeName === 'category') && !in_array($field['settings']->datatype, $textKeys)) { // build keys of this view for db $this->dbKeys[$viewName][] = $name; @@ -1548,7 +1548,7 @@ class Fields extends Structure $this->titleBuilder[$viewName] = $name; } // category name fix - if ($typeName == 'category') + if ($typeName === 'category') { if (isset($this->catOtherName[$listViewName]) && ComponentbuilderHelper::checkArray($this->catOtherName[$listViewName])) { @@ -1594,7 +1594,7 @@ class Fields extends Structure $this->customBuilderList[$listViewName][] = $name; } // set the hidden field of this view - if ($typeName == 'hidden') + if ($typeName === 'hidden') { if (!isset($this->hiddenFieldsBuilder[$viewName])) { @@ -1603,7 +1603,7 @@ class Fields extends Structure $this->hiddenFieldsBuilder[$viewName] .= ',"' . $name . '"'; } // set all int fields of this view - if ($field['settings']->datatype == 'INT' || $field['settings']->datatype == 'TINYINT' || $field['settings']->datatype == 'BIGINT') + if ($field['settings']->datatype === 'INT' || $field['settings']->datatype === 'TINYINT' || $field['settings']->datatype === 'BIGINT') { if (!isset($this->intFieldsBuilder[$viewName])) { @@ -1629,7 +1629,7 @@ class Fields extends Structure } // TODO we may need to add a switch instead (since now it uses the first editor field) // set the main(biggest) text field of this view - if ($typeName == 'editor') + if ($typeName === 'editor') { if (!isset($this->maintextBuilder[$viewName]) || !ComponentbuilderHelper::checkString($this->maintextBuilder[$viewName])) { @@ -1651,17 +1651,17 @@ class Fields extends Structure $this->customFieldLinksBuilder[$viewName] .= ',{"sourceColumn": "' . $name . '","targetTable": "' . $custom['table'] . '","targetColumn": "' . $custom['id'] . '","displayColumn": "' . $custom['text'] . '"}'; } // build script switch for user - if ($custom['extends'] == 'user') + if ($custom['extends'] === 'user') { $this->setScriptUserSwitch[$typeName] = $typeName; } } - if ($typeName == 'media') + if ($typeName === 'media') { $this->setScriptMediaSwitch[$typeName] = $typeName; } // setup gategory for this view - if ($typeName == 'category') + if ($typeName === 'category') { if (isset($this->catOtherName[$listViewName]) && ComponentbuilderHelper::checkArray($this->catOtherName[$listViewName])) { @@ -1678,12 +1678,12 @@ class Fields extends Structure $this->catCodeBuilder[$viewName] = array('code' => $name, 'views' => $otherViews, 'view' => $otherView); } // setup checkbox for this view - if ($typeName == 'checkbox' || (ComponentbuilderHelper::checkArray($custom) && isset($custom['extends']) && $custom['extends'] == 'checkboxes')) + if ($typeName === 'checkbox' || (ComponentbuilderHelper::checkArray($custom) && isset($custom['extends']) && $custom['extends'] === 'checkboxes')) { $this->checkboxBuilder[$viewName][] = $name; } // setup checkboxes and other json items for this view - if (($typeName == 'checkboxes' || $multiple || $field['settings']->store != 0) && $typeName != 'tag') + if (($typeName === 'checkboxes' || $multiple || $field['settings']->store != 0) && $typeName != 'tag') { switch ($field['settings']->store) { @@ -1719,7 +1719,7 @@ class Fields extends Structure break; } // just a heads-up for usergroups set to multiple - if ($typeName == 'usergroup') + if ($typeName === 'usergroup') { $this->buildSiteFieldData($viewName, $name, 'json', $typeName); } @@ -1737,8 +1737,8 @@ class Fields extends Structure } } } - // build the data for the export & import methods $typeName == 'repeatable' || - if (($typeName == 'checkboxes' || $multiple || $field['settings']->store != 0) && !ComponentbuilderHelper::checkArray($options)) + // build the data for the export & import methods $typeName === 'repeatable' || + if (($typeName === 'checkboxes' || $multiple || $field['settings']->store != 0) && !ComponentbuilderHelper::checkArray($options)) { $this->getItemsMethodEximportStringFixBuilder[$viewName][] = array('name' => $name, 'type' => $typeName, 'translation' => false, 'custom' => $custom, 'method' => $field['settings']->store); } @@ -1838,7 +1838,7 @@ class Fields extends Structure $phpCode = 'return null;'; } - if ($data['custom']['extends'] == 'user') + if ($data['custom']['extends'] === 'user') { // now load the php xclude script if (ComponentbuilderHelper::checkArray($data['custom']['phpx'])) diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index db5579faa..4f4b1d524 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -826,7 +826,7 @@ class Interpretation extends Fields $exel[] = "\t\t\t\t\t\t\$objPHPExcel->getActiveSheet()->getColumnDimension(\$a)->setAutoSize(true);"; $exel[] = "\t\t\t\t\t\t\$objPHPExcel->getActiveSheet()->getStyle(\$a.\$i)->applyFromArray(\$headerStyles);"; $exel[] = "\t\t\t\t\t\t\$objPHPExcel->getActiveSheet()->getStyle(\$a.\$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);"; - $exel[] = "\t\t\t\t\t} elseif (\$a == 'A'){"; + $exel[] = "\t\t\t\t\t} elseif (\$a === 'A'){"; $exel[] = "\t\t\t\t\t\t\$objPHPExcel->getActiveSheet()->getStyle(\$a.\$i)->applyFromArray(\$sideStyles);"; $exel[] = "\t\t\t\t\t} else {"; $exel[] = "\t\t\t\t\t\t\$objPHPExcel->getActiveSheet()->getStyle(\$a.\$i)->applyFromArray(\$normalStyles);"; @@ -1170,7 +1170,7 @@ class Interpretation extends Fields // set the selection $getItem .= "\n\t".$tab."\t".$the_get['selection']['select']; if (($nr == 0 && (!isset($the_get['join_field']) || !ComponentbuilderHelper::checkString($the_get['join_field'])) && (isset($the_get['selection']['type']) && ComponentbuilderHelper::checkString($the_get['selection']['type']))) || - ($type == 'custom' && (isset($the_get['selection']['type']) && ComponentbuilderHelper::checkString($the_get['selection']['type'])))) + ($type === 'custom' && (isset($the_get['selection']['type']) && ComponentbuilderHelper::checkString($the_get['selection']['type'])))) { $getItem .= "\n\t".$tab."\t".'$query->from('.$the_get['selection']['from'].');'; } @@ -1333,28 +1333,28 @@ class Interpretation extends Fields { if (strpos($get['selection']['select'], $field) !== false) { - if ($array['decode'] == 'json') + if ($array['decode'] === 'json') { $if = "\n\t".$tab."\tif (".$this->fileContentStatic['###Component###']."Helper::checkJson(".$string."->".$field."))\n\t".$tab."\t{"; // json_decode $decoder = $string."->".$field." = json_decode(".$string."->".$field.", true);"; // TODO Use the type of field to prepare it even more for use in the view } - elseif ($array['decode'] == 'base64') + elseif ($array['decode'] === 'base64') { $if = "\n\t".$tab."\tif (!empty(".$string."->".$field.") && ".$string."->".$field." === base64_encode(base64_decode(".$string."->".$field.")))\n\t".$tab."\t{"; // base64_decode $decoder = $string."->".$field." = base64_decode(".$string."->".$field.");"; // TODO Use the type of field to prepare it even more for use in the view } - elseif ($array['decode'] == 'basic_encryption') + elseif ($array['decode'] === 'basic_encryption') { $if = "\n\t".$tab."\tif (!empty(".$string."->".$field.") && \$basickey && !is_numeric(".$string."->".$field.") && ".$string."->".$field." === base64_encode(base64_decode(".$string."->".$field.", true)))\n\t".$tab."\t{"; // basic decryption $decoder = $string."->".$field." = rtrim(\$basic->decryptString(".$string."->".$field."), ".'"\0"'.");"; $this->siteDecrypt['basic'][$code] = true; } - elseif ($array['decode'] == 'advance_encryption') + elseif ($array['decode'] === 'advance_encryption') { $if = "\n\t".$tab."\tif (!empty(".$string."->".$field.") && \$advancedkey && !is_numeric(".$string."->".$field.") && ".$string."->".$field." === base64_encode(base64_decode(".$string."->".$field.", true)))\n\t".$tab."\t{"; // advanced decryption @@ -1467,7 +1467,7 @@ class Interpretation extends Fields case 4: // COM_COMPONENTBUILDER_DYNAMIC_GET_USER_GROUPS $decodeChecker = $this->siteFieldData['decode'][$code][$ter['key']][$as][$field]; - if (ComponentbuilderHelper::checkArray($decodeChecker) || $ter['state_key'] == 'array') + if (ComponentbuilderHelper::checkArray($decodeChecker) || $ter['state_key'] === 'array') { // set needed fields to filter after query $this->siteFieldDecodeFilter[$this->target][$code][$ter['key']][$as][$field] = $ter; @@ -1491,7 +1491,7 @@ class Interpretation extends Fields break; case 8: // COM_COMPONENTBUILDER_DYNAMIC_GET_FUNCTIONVAR - if ($ter['operator'] == 'IN' || $ter['operator'] == 'NOT IN') + if ($ter['operator'] === 'IN' || $ter['operator'] === 'NOT IN') { $string = "\n\t\t".$tab."//".$this->setLine(__LINE__)." Check if " . $ter['state_key'] . " is an array with values."; $string .= "\n\t\t".$tab."\$array = " . $ter['state_key'].";"; @@ -1549,11 +1549,11 @@ class Interpretation extends Fields if (ComponentbuilderHelper::checkString($string)) { // sort where - if ($as == 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) && ComponentbuilderHelper::checkString($this->siteMainGet[$this->target][$code][$as]))) + if ($as === 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) && ComponentbuilderHelper::checkString($this->siteMainGet[$this->target][$code][$as]))) { $filters .= $string; } - elseif($as != 'a') + elseif($as !== 'a') { $this->otherFilter[$this->target][$code][$as][$field] = $string; } @@ -1575,7 +1575,7 @@ class Interpretation extends Fields // set the string $string = "\$query->order('".$or['table_key']." ".$or['direction']."');"; // sort where - if ($as == 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) && ComponentbuilderHelper::checkString($this->siteMainGet[$this->target][$code][$as]))) + if ($as === 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) && ComponentbuilderHelper::checkString($this->siteMainGet[$this->target][$code][$as]))) { $ordering .= "\n\t".$tab."\t".$string; } @@ -1606,7 +1606,7 @@ class Interpretation extends Fields } elseif (strpos($whe['value_key'],'$this->') !== false) { - if ($whe['operator'] == 'IN' || $whe['operator'] == 'NOT IN') + if ($whe['operator'] === 'IN' || $whe['operator'] === 'NOT IN') { $value = " (' . implode(',', " . $whe['value_key'] . ") . ')');"; } @@ -1623,10 +1623,10 @@ class Interpretation extends Fields if (ComponentbuilderHelper::checkString($value)) { // set the string - if ($whe['operator'] == 'IN' || $whe['operator'] == 'NOT IN') + if ($whe['operator'] === 'IN' || $whe['operator'] === 'NOT IN') { $tabe = ''; - if ($as == 'a') + if ($as === 'a') { $tabe = $tab; } @@ -1645,11 +1645,11 @@ class Interpretation extends Fields $string = "\$query->where('".$whe['table_key']." ".$whe['operator'].$value; } // sort where - if ($as == 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) && ComponentbuilderHelper::checkString($this->siteMainGet[$this->target][$code][$as]))) + if ($as === 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) && ComponentbuilderHelper::checkString($this->siteMainGet[$this->target][$code][$as]))) { $wheres .= "\n\t".$tab."\t".$string; } - elseif ($as != 'a') + elseif ($as !== 'a') { $this->otherWhere[$this->target][$code][$as][$field] = "\n\t\t".$string; } @@ -1792,7 +1792,7 @@ class Interpretation extends Fields $getItem .= "\n\t".$tab."\t\$data = \$db->loadObject();"; $getItem .= "\n\n".$tab."\t\tif (empty(\$data))"; $getItem .= "\n\t".$tab."\t{"; - if ($type == 'main') + if ($type === 'main') { $getItem .= "\n\t".$tab."\t\t\$app = JFactory::getApplication();"; $langKeyWord = $this->langPrefix.'_'.ComponentbuilderHelper::safeString('Not found or access denied','U'); @@ -1894,7 +1894,7 @@ class Interpretation extends Fields $get->php_calculation = (array) explode("\n",$get->php_calculation); $getItem .= "\n\t".$tab."\t".implode("\n\t".$tab."\t",$get->php_calculation); } - if ($type == 'custom') + if ($type === 'custom') { // return the object $getItem .= "\n\n\t".$tab."\t//".$this->setLine(__LINE__)." return data object."; @@ -2171,7 +2171,7 @@ class Interpretation extends Fields $methods .= "\n\t\t".$get['selection']['select']; $methods .= "\n\t\t".'$query->from('.$get['selection']['from'].');'; // set the string - if ($get['operator'] == 'IN' || $get['operator'] == 'NOT IN') + if ($get['operator'] === 'IN' || $get['operator'] === 'NOT IN') { $methods .= "\n\n\t\t//".$this->setLine(__LINE__)." Check if \$" . $default['on_field'] . " is an array with values."; $methods .= "\n\t\t\$array = \$" . $default['on_field'] . ";"; @@ -2750,7 +2750,7 @@ class Interpretation extends Fields // set the custom buttons ###CUSTOM_BUTTONS_METHOD### $this->fileContentDynamic[$viewName]['###'.$TARGET.'_CUSTOM_BUTTONS_METHOD###'] = ''; // if site add buttons to view - if ($this->target == 'site') + if ($this->target === 'site') { // set the custom buttons ###SITE_TOP_BUTTON### $this->fileContentDynamic[$viewName]['###SITE_TOP_BUTTON###'] = ''; @@ -2811,7 +2811,7 @@ class Interpretation extends Fields $buttons = array(); foreach ($view['settings']->custom_buttons as $custom_button) { - if ($custom_button['target'] != 2 || $this->target == 'site') + if ($custom_button['target'] != 2 || $this->target === 'site') { // Load to lang $keyLang = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($custom_button['name'],'U'); @@ -3201,7 +3201,7 @@ class Interpretation extends Fields $script = array(); $script[] = "\n + + + diff --git a/admin/compiler/joomla_3/wideimage/Mapper/index.html b/admin/views/custom_code/tmpl/index.html similarity index 100% rename from admin/compiler/joomla_3/wideimage/Mapper/index.html rename to admin/views/custom_code/tmpl/index.html diff --git a/admin/views/custom_code/view.html.php b/admin/views/custom_code/view.html.php new file mode 100644 index 000000000..2b68f2fee --- /dev/null +++ b/admin/views/custom_code/view.html.php @@ -0,0 +1,200 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla view library +jimport('joomla.application.component.view'); + +/** + * Custom_code View class + */ +class ComponentbuilderViewCustom_code extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode('
', $errors)); + return false; + } + + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = ComponentbuilderHelper::getActions('custom_code',$this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $this->referral = ''; + if ($this->refid) + { + // return to the item that refered to this item + $this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that refered to this item + $this->referral = '&ref='.(string)$this->ref; + } + + // Set the toolbar + $this->addToolBar(); + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_COMPONENTBUILDER_CUSTOM_CODE_NEW' : 'COM_COMPONENTBUILDER_CUSTOM_CODE_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if ($this->refid || $this->ref) + { + if ($this->canDo->get('custom_code.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('custom_code.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('custom_code.edit')) + { + // We can save the record. + JToolBarHelper::save('custom_code.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('custom_code.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('custom_code.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('custom_code.create')) + { + JToolBarHelper::apply('custom_code.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('custom_code.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('custom_code.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('custom_code.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('custom_code.edit')) + { + // We can save the new record + JToolBarHelper::apply('custom_code.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('custom_code.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('custom_code.create')) + { + JToolBarHelper::custom('custom_code.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('custom_code.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('custom_code.edit') && $canVersion) + { + JToolbarHelper::versions('com_componentbuilder.custom_code', $this->item->id); + } + if ($this->canDo->get('custom_code.create')) + { + JToolBarHelper::custom('custom_code.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('custom_code.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('custom_code'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $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->addScript(JURI::root() . $this->script); + $document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/custom_code/submitbutton.js"); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/compiler/joomla_3/wideimage/Operation/index.html b/admin/views/custom_codes/index.html similarity index 100% rename from admin/compiler/joomla_3/wideimage/Operation/index.html rename to admin/views/custom_codes/index.html diff --git a/admin/views/custom_codes/tmpl/default.php b/admin/views/custom_codes/tmpl/default.php new file mode 100644 index 000000000..b65c3caff --- /dev/null +++ b/admin/views/custom_codes/tmpl/default.php @@ -0,0 +1,99 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// load tooltip behavior +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', 'select'); + +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=custom_codes.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'custom_codeList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} + +?> + +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ +items)): ?> + loadTemplate('toolbar');?> +
+ +
+ + loadTemplate('toolbar');?> + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_CUSTOM_CODES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + +
+ + + + \ No newline at end of file diff --git a/admin/views/custom_codes/tmpl/default_batch_body.php b/admin/views/custom_codes/tmpl/default_batch_body.php new file mode 100644 index 000000000..1b2a727a1 --- /dev/null +++ b/admin/views/custom_codes/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/custom_codes/tmpl/default_batch_footer.php b/admin/views/custom_codes/tmpl/default_batch_footer.php new file mode 100644 index 000000000..b786fb700 --- /dev/null +++ b/admin/views/custom_codes/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/custom_codes/tmpl/default_body.php b/admin/views/custom_codes/tmpl/default_body.php new file mode 100644 index 000000000..600a5f88a --- /dev/null +++ b/admin/views/custom_codes/tmpl/default_body.php @@ -0,0 +1,114 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +$edit = "index.php?option=com_componentbuilder&view=custom_codes&task=custom_code.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = ComponentbuilderHelper::getActions('custom_code',$item,'custom_codes'); + ?> + + + get('custom_code.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive'; + } + else + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('custom_code.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + + get('custom_code.edit')): ?> +
+ escape($item->component_system_name); ?> + checked_out): ?> + name, $item->checked_out_time, 'custom_codes.', $canCheckin); ?> + +
+ +
escape($item->component_system_name); ?>
+ + + + escape($item->path); ?> + + + type); ?> + + + get('custom_code.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'custom_codes.', true, 'cb'); ?> + + published, $i, 'custom_codes.', false, 'cb'); ?> + + + published, $i, 'custom_codes.', true, 'cb'); ?> + + + published, $i, 'custom_codes.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/custom_codes/tmpl/default_foot.php b/admin/views/custom_codes/tmpl/default_foot.php new file mode 100644 index 000000000..47ff032e6 --- /dev/null +++ b/admin/views/custom_codes/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/custom_codes/tmpl/default_head.php b/admin/views/custom_codes/tmpl/default_head.php new file mode 100644 index 000000000..86db6cd86 --- /dev/null +++ b/admin/views/custom_codes/tmpl/default_head.php @@ -0,0 +1,67 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + canEdit&& $this->canState): ?> + + ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/custom_codes/tmpl/default_toolbar.php b/admin/views/custom_codes/tmpl/default_toolbar.php new file mode 100644 index 000000000..ec9e99d75 --- /dev/null +++ b/admin/views/custom_codes/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/compiler/joomla_3/wideimage/index.html b/admin/views/custom_codes/tmpl/index.html similarity index 100% rename from admin/compiler/joomla_3/wideimage/index.html rename to admin/views/custom_codes/tmpl/index.html diff --git a/admin/views/custom_codes/view.html.php b/admin/views/custom_codes/view.html.php new file mode 100644 index 000000000..4d5086985 --- /dev/null +++ b/admin/views/custom_codes/view.html.php @@ -0,0 +1,332 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla view library +jimport('joomla.application.component.view'); + +/** + * Componentbuilder View class for the Custom_codes + */ +class ComponentbuilderViewCustom_codes extends JViewLegacy +{ + /** + * Custom_codes view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + ComponentbuilderHelper::addSubmenu('custom_codes'); + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode('
', $errors)); + return false; + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + $this->listOrder = $this->escape($this->state->get('list.ordering')); + $this->listDirn = $this->escape($this->state->get('list.direction')); + $this->saveOrder = $this->listOrder == 'ordering'; + // get global action permissions + $this->canDo = ComponentbuilderHelper::getActions('custom_code'); + $this->canEdit = $this->canDo->get('custom_code.edit'); + $this->canState = $this->canDo->get('custom_code.edit.state'); + $this->canCreate = $this->canDo->get('custom_code.create'); + $this->canDelete = $this->canDo->get('custom_code.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_CUSTOM_CODES'), 'shuffle'); + JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=custom_codes'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('custom_code.add'); + } + + // Only load if there are items + if (ComponentbuilderHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('custom_code.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('custom_codes.publish'); + JToolBarHelper::unpublishList('custom_codes.unpublish'); + JToolBarHelper::archiveList('custom_codes.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('custom_codes.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'custom_codes.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('custom_codes.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('custom_code.export')) + { + JToolBarHelper::custom('custom_codes.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('custom_code.import')) + { + JToolBarHelper::custom('custom_codes.importData', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('custom_codes'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_componentbuilder'); + } + + if ($this->canState) + { + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_PUBLISHED'), + 'filter_published', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) + ); + // only load if batch allowed + if ($this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + } + + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_ACCESS'), + 'filter_access', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Set Component System Name Selection + $this->componentSystem_nameOptions = JFormHelper::loadFieldType('Component')->getOptions(); + if ($this->componentSystem_nameOptions) + { + // Component System Name Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_COMPONENT_LABEL').' -', + 'filter_component', + JHtml::_('select.options', $this->componentSystem_nameOptions, 'value', 'text', $this->state->get('filter.component')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Component System Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_COMPONENT_LABEL').' -', + 'batch[component]', + JHtml::_('select.options', $this->componentSystem_nameOptions, 'value', 'text') + ); + } + } + + // Set Type Selection + $this->typeOptions = $this->getTheTypeSelections(); + if ($this->typeOptions) + { + // Type Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_TYPE_LABEL').' -', + 'filter_type', + JHtml::_('select.options', $this->typeOptions, 'value', 'text', $this->state->get('filter.type')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Type Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_TYPE_LABEL').' -', + 'batch[type]', + JHtml::_('select.options', $this->typeOptions, 'value', 'text') + ); + } + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $document = JFactory::getDocument(); + $document->setTitle(JText::_('COM_COMPONENTBUILDER_CUSTOM_CODES')); + $document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/custom_codes.css"); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'g.system_name' => JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_COMPONENT_LABEL'), + 'a.path' => JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_PATH_LABEL'), + 'a.type' => JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_TYPE_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } + + protected function getTheTypeSelections() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('type')); + $query->from($db->quoteName('#__componentbuilder_custom_code')); + $query->order($db->quoteName('type') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + + if ($results) + { + // get model + $model = $this->getModel(); + $results = array_unique($results); + $filter = array(); + foreach ($results as $type) + { + // Translate the type selection + $text = $model->selectionTranslation($type,'type'); + // Now add the type and its text to the options array + $filter[] = JHtml::_('select.option', $type, JText::_($text)); + } + return $filter; + } + return false; + } +} diff --git a/admin/views/dynamic_get/submitbutton.js b/admin/views/dynamic_get/submitbutton.js index 0b39c2009..ad5d11ff9 100644 --- a/admin/views/dynamic_get/submitbutton.js +++ b/admin/views/dynamic_get/submitbutton.js @@ -9,9 +9,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 81 of this MVC + @build 15th January, 2017 + @created 21st May, 2015 @package Component Builder @subpackage submitbutton.js @author Llewellyn van der Merwe diff --git a/admin/views/dynamic_get/tmpl/edit.php b/admin/views/dynamic_get/tmpl/edit.php index 65dfffc7c..914448075 100644 --- a/admin/views/dynamic_get/tmpl/edit.php +++ b/admin/views/dynamic_get/tmpl/edit.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 81 of this MVC + @build 15th January, 2017 + @created 21st May, 2015 @package Component Builder @subpackage edit.php @author Llewellyn van der Merwe diff --git a/admin/views/dynamic_get/view.html.php b/admin/views/dynamic_get/view.html.php index 10af819da..4249c4593 100644 --- a/admin/views/dynamic_get/view.html.php +++ b/admin/views/dynamic_get/view.html.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 81 of this MVC + @build 15th January, 2017 + @created 21st May, 2015 @package Component Builder @subpackage view.html.php @author Llewellyn van der Merwe diff --git a/admin/views/dynamic_gets/tmpl/default.php b/admin/views/dynamic_gets/tmpl/default.php index 97289b830..9e43275d4 100644 --- a/admin/views/dynamic_gets/tmpl/default.php +++ b/admin/views/dynamic_gets/tmpl/default.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 81 of this MVC + @build 15th January, 2017 + @created 21st May, 2015 @package Component Builder @subpackage default.php @author Llewellyn van der Merwe diff --git a/admin/views/dynamic_gets/tmpl/default_batch_body.php b/admin/views/dynamic_gets/tmpl/default_batch_body.php index 85f5a148a..cb3d123f7 100644 --- a/admin/views/dynamic_gets/tmpl/default_batch_body.php +++ b/admin/views/dynamic_gets/tmpl/default_batch_body.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 81 of this MVC + @build 15th January, 2017 + @created 21st May, 2015 @package Component Builder @subpackage default_batch_body.php @author Llewellyn van der Merwe diff --git a/admin/views/dynamic_gets/tmpl/default_batch_footer.php b/admin/views/dynamic_gets/tmpl/default_batch_footer.php index d850f7090..e90ba8061 100644 --- a/admin/views/dynamic_gets/tmpl/default_batch_footer.php +++ b/admin/views/dynamic_gets/tmpl/default_batch_footer.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 81 of this MVC + @build 15th January, 2017 + @created 21st May, 2015 @package Component Builder @subpackage default_batch_footer.php @author Llewellyn van der Merwe diff --git a/admin/views/dynamic_gets/tmpl/default_body.php b/admin/views/dynamic_gets/tmpl/default_body.php index fb740ef16..c8c2a72fb 100644 --- a/admin/views/dynamic_gets/tmpl/default_body.php +++ b/admin/views/dynamic_gets/tmpl/default_body.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 81 of this MVC + @build 15th January, 2017 + @created 21st May, 2015 @package Component Builder @subpackage default_body.php @author Llewellyn van der Merwe diff --git a/admin/views/dynamic_gets/tmpl/default_foot.php b/admin/views/dynamic_gets/tmpl/default_foot.php index 16b8ca0b6..be0e26513 100644 --- a/admin/views/dynamic_gets/tmpl/default_foot.php +++ b/admin/views/dynamic_gets/tmpl/default_foot.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 81 of this MVC + @build 15th January, 2017 + @created 21st May, 2015 @package Component Builder @subpackage default_foot.php @author Llewellyn van der Merwe diff --git a/admin/views/dynamic_gets/tmpl/default_head.php b/admin/views/dynamic_gets/tmpl/default_head.php index 6e807c78b..00988313d 100644 --- a/admin/views/dynamic_gets/tmpl/default_head.php +++ b/admin/views/dynamic_gets/tmpl/default_head.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 81 of this MVC + @build 15th January, 2017 + @created 21st May, 2015 @package Component Builder @subpackage default_head.php @author Llewellyn van der Merwe diff --git a/admin/views/dynamic_gets/tmpl/default_toolbar.php b/admin/views/dynamic_gets/tmpl/default_toolbar.php index 2a1d724cd..03a9a8c30 100644 --- a/admin/views/dynamic_gets/tmpl/default_toolbar.php +++ b/admin/views/dynamic_gets/tmpl/default_toolbar.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 81 of this MVC + @build 15th January, 2017 + @created 21st May, 2015 @package Component Builder @subpackage default_toolbar.php @author Llewellyn van der Merwe diff --git a/admin/views/dynamic_gets/view.html.php b/admin/views/dynamic_gets/view.html.php index 2aa495ea6..21db34cd7 100644 --- a/admin/views/dynamic_gets/view.html.php +++ b/admin/views/dynamic_gets/view.html.php @@ -10,9 +10,9 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 - @created 30th April, 2015 + @version @update number 81 of this MVC + @build 15th January, 2017 + @created 21st May, 2015 @package Component Builder @subpackage view.html.php @author Llewellyn van der Merwe diff --git a/admin/views/field/submitbutton.js b/admin/views/field/submitbutton.js index 735f9b408..1a93393d2 100644 --- a/admin/views/field/submitbutton.js +++ b/admin/views/field/submitbutton.js @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version @update number 36 of this MVC + @build 12th January, 2017 @created 30th April, 2015 @package Component Builder @subpackage submitbutton.js diff --git a/admin/views/field/tmpl/edit.php b/admin/views/field/tmpl/edit.php index 4e3468f37..3039e7787 100644 --- a/admin/views/field/tmpl/edit.php +++ b/admin/views/field/tmpl/edit.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.2.6 - @build 20th January, 2017 + @version @update number 36 of this MVC + @build 12th January, 2017 @created 30th April, 2015 @package Component Builder @subpackage edit.php @@ -125,48 +125,33 @@ $componentParams = JComponentHelper::getParams('com_componentbuilder');