diff --git a/README.md b/README.md index 94d01b472..3678ff75a 100644 --- a/README.md +++ b/README.md @@ -143,11 +143,11 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 16th May, 2022 ++ *Last Build*: 19th May, 2022 + *Version*: 2.12.17 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **286766** ++ *Line count*: **286780** + *Field count*: **1581** + *File count*: **1853** + *Folder count*: **261** diff --git a/admin/README.txt b/admin/README.txt index 94d01b472..3678ff75a 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -143,11 +143,11 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 16th May, 2022 ++ *Last Build*: 19th May, 2022 + *Version*: 2.12.17 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **286766** ++ *Line count*: **286780** + *Field count*: **1581** + *File count*: **1853** + *Folder count*: **261** diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index d3196dc04..b2323aba4 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -8621,11 +8621,11 @@ class Get */ protected function getPowers($guids) { - if (ArrayHelper::check($guids, true)) + if (ArrayHelper::check($guids)) { - foreach ($guids as $guid) + foreach ($guids as $guid => $build) { - $this->getPower($guid); + $this->getPower($guid, $build); } } } @@ -8636,9 +8636,9 @@ class Get * @return mixed * */ - public function getPower($guid) + public function getPower($guid, $build = 0) { - if ($this->addPower && $this->setPower($guid)) + if (($this->addPower || $build == 1) && $this->setPower($guid)) { return $this->powers[$guid]; } @@ -8805,6 +8805,7 @@ class Get } // load use ids $use = array(); + $as = array(); // check if we have use selection $power->use_selection = (isset($power->use_selection) && JsonHelper::check( @@ -8812,7 +8813,10 @@ class Get )) ? json_decode($power->use_selection, true) : null; if ($power->use_selection) { - $use = array_values(array_map(function ($u) { + $use = array_values(array_map(function ($u) use(&$as) { + // track the AS options + $as[$u['use']] = (string) $u['as']; + // return the guid return $u['use']; }, $power->use_selection)); } @@ -8857,7 +8861,7 @@ class Get if ($this->setPower($implement)) { // get the name - $power->implement_names[] = $this->getPower($implement)->class_name; + $power->implement_names[] = $this->getPower($implement, 1)->class_name; // add to use $use[] = $implement; } @@ -8884,7 +8888,7 @@ class Get if ($this->setPower($power->extends)) { // get the name - $power->extends_name = $this->getPower($power->extends)->class_name; + $power->extends_name = $this->getPower($power->extends, 1)->class_name; // add to use $use[] = $power->extends; } @@ -8915,11 +8919,19 @@ class Get { if ($this->setPower($u)) { - $add_use = $this->getPower($u)->namespace; + $add_use = $this->getPower($u, 1)->namespace; // check if it is already added manually, you know how some people are if (strpos($power->head, $add_use) === false) { - $power->head .= 'use ' . $add_use . ';' . PHP_EOL; + // check if it has an AS option + if (isset($as[$u]) && StringHelper::check($as[$u]) && $as[$u] !== 'default') + { + $power->head .= 'use ' . $add_use . ' as ' . $as[$u] . ';' . PHP_EOL; + } + else + { + $power->head .= 'use ' . $add_use . ';' . PHP_EOL; + } } } } diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 2853aa926..58387435b 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -6217,21 +6217,12 @@ class Interpretation extends Fields $chart[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " load the google chart js."; $chart[] = $this->_t(2) - . "\$this->document->addScript(JURI::root(true) .'/media/com_" - . $this->componentCodeName . "/js/google.jsapi.js', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');"; + . "JHtml::_('script', 'com_" + . $this->componentCodeName . "/js/google.jsapi.js', ['version' => 'auto']);"; $chart[] = $this->_t(2) - . "\$this->document->addScript('https://canvg.googlecode.com/svn/trunk/rgbcolor.js', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');"; + . "\$this->document->addScript('https://canvg.googlecode.com/svn/trunk/rgbcolor.js', ['version' => 'auto']);"; $chart[] = $this->_t(2) - . "\$this->document->addScript('https://canvg.googlecode.com/svn/trunk/canvg.js', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');"; + . "\$this->document->addScript('https://canvg.googlecode.com/svn/trunk/canvg.js', ['version' => 'auto']);"; return implode(PHP_EOL, $chart); } @@ -6635,12 +6626,9 @@ class Interpretation extends Fields . "if ((!\$HeaderCheck->css_loaded('uikit.min') || \$uikit == 1) && \$uikit != 2 && \$uikit != 3)"; $setter .= PHP_EOL . $tabV . $this->_t(2) . "{"; $setter .= PHP_EOL . $tabV . $this->_t(3) - . "\$this->document->addStyleSheet(JURI::root(true) .'/media/com_" + . "JHtml::_('stylesheet', 'com_" . $this->componentCodeName - . "/uikit-v2/css/uikit'.\$style.\$size.'.css', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');"; + . "/uikit-v2/css/uikit'.\$style.\$size.'.css', ['version' => 'auto']);"; $setter .= PHP_EOL . $tabV . $this->_t(2) . "}"; $setter .= PHP_EOL . $tabV . $this->_t(2) . "//" . $this->setLine( __LINE__ @@ -6649,12 +6637,9 @@ class Interpretation extends Fields . "if ((!\$HeaderCheck->js_loaded('uikit.min') || \$uikit == 1) && \$uikit != 2 && \$uikit != 3)"; $setter .= PHP_EOL . $tabV . $this->_t(2) . "{"; $setter .= PHP_EOL . $tabV . $this->_t(3) - . "\$this->document->addScript(JURI::root(true) .'/media/com_" + . "JHtml::_('script', 'com_" . $this->componentCodeName - . "/uikit-v2/js/uikit'.\$size.'.js', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');"; + . "/uikit-v2/js/uikit'.\$size.'.js', ['version' => 'auto']);"; $setter .= PHP_EOL . $tabV . $this->_t(2) . "}"; } // load the components need @@ -6748,12 +6733,9 @@ class Interpretation extends Fields __LINE__ ) . " load the css."; $setter .= PHP_EOL . $tabV . $this->_t(6) - . "\$this->document->addStyleSheet(JURI::root(true) .'/media/com_" + . "JHtml::_('stylesheet', 'com_" . $this->componentCodeName - . "/uikit-v2/css/components/'.\$name.\$style.\$size.'.css', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');"; + . "/uikit-v2/css/components/'.\$name.\$style.\$size.'.css', ['version' => 'auto']);"; $setter .= PHP_EOL . $tabV . $this->_t(5) . "}"; $setter .= PHP_EOL . $tabV . $this->_t(5) . "//" . $this->setLine( __LINE__ @@ -6767,15 +6749,9 @@ class Interpretation extends Fields __LINE__ ) . " load the js."; $setter .= PHP_EOL . $tabV . $this->_t(6) - . "\$this->document->addScript(JURI::root(true) .'/media/com_" + . "JHtml::_('script', 'com_" . $this->componentCodeName - . "/uikit-v2/js/components/'.\$name.\$size.'.js', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);"; + . "/uikit-v2/js/components/'.\$name.\$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']);"; $setter .= PHP_EOL . $tabV . $this->_t(5) . "}"; $setter .= PHP_EOL . $tabV . $this->_t(4) . "}"; $setter .= PHP_EOL . $tabV . $this->_t(3) . "}"; @@ -6819,12 +6795,9 @@ class Interpretation extends Fields __LINE__ ) . " load the css."; $setter .= PHP_EOL . $tabV . $this->_t(6) - . "\$this->document->addStyleSheet(JURI::root(true) .'/media/com_" + . "JHtml::_('stylesheet', 'com_" . $this->componentCodeName - . "/uikit-v2/css/components/'.\$name.\$style.\$size.'.css', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');"; + . "/uikit-v2/css/components/'.\$name.\$style.\$size.'.css', ['version' => 'auto']);"; $setter .= PHP_EOL . $tabV . $this->_t(5) . "}"; $setter .= PHP_EOL . $tabV . $this->_t(5) . "//" . $this->setLine( __LINE__ @@ -6838,7 +6811,7 @@ class Interpretation extends Fields __LINE__ ) . " load the js."; $setter .= PHP_EOL . $tabV . $this->_t(6) - . "\$this->document->addScript(JURI::root(true) .'/media/com_" + . "JHtml::_('script', JURI::root(true) .'/media/com_" . $this->componentCodeName . "/uikit-v2/js/components/'.\$name.\$size.'.js', (" . $this->fileContentStatic[$this->hhh . 'Component' @@ -6873,12 +6846,9 @@ class Interpretation extends Fields . "if ((!\$HeaderCheck->css_loaded('uikit.min') || \$uikit == 1) && \$uikit != 2 && \$uikit != 3)"; $setter .= PHP_EOL . $tabV . $this->_t(2) . "{"; $setter .= PHP_EOL . $tabV . $this->_t(3) - . "\$this->document->addStyleSheet(JURI::root(true) .'/media/com_" + . "JHtml::_('stylesheet', 'com_" . $this->componentCodeName - . "/uikit-v3/css/uikit'.\$size.'.css', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');"; + . "/uikit-v3/css/uikit'.\$size.'.css', ['version' => 'auto']);"; $setter .= PHP_EOL . $tabV . $this->_t(2) . "}"; $setter .= PHP_EOL . $tabV . $this->_t(2) . "//" . $this->setLine( __LINE__ @@ -6887,19 +6857,13 @@ class Interpretation extends Fields . "if ((!\$HeaderCheck->js_loaded('uikit.min') || \$uikit == 1) && \$uikit != 2 && \$uikit != 3)"; $setter .= PHP_EOL . $tabV . $this->_t(2) . "{"; $setter .= PHP_EOL . $tabV . $this->_t(3) - . "\$this->document->addScript(JURI::root(true) .'/media/com_" + . "JHtml::_('script', 'com_" . $this->componentCodeName - . "/uikit-v3/js/uikit'.\$size.'.js', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');"; + . "/uikit-v3/js/uikit'.\$size.'.js', ['version' => 'auto']);"; $setter .= PHP_EOL . $tabV . $this->_t(3) - . "\$this->document->addScript(JURI::root(true) .'/media/com_" + . "JHtml::_('script', 'com_" . $this->componentCodeName - . "/uikit-v3/js/uikit-icons'.\$size.'.js', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');"; + . "/uikit-v3/js/uikit-icons'.\$size.'.js', ['version' => 'auto']);"; $setter .= PHP_EOL . $tabV . $this->_t(2) . "}"; if (2 == $this->uikit) { @@ -14146,12 +14110,9 @@ class Interpretation extends Fields __LINE__ ) . " Add the CSS for Footable."; $foo .= PHP_EOL . $this->_t(2) - . "\$this->document->addStyleSheet(JURI::root() .'media/com_" + . "JHtml::_('stylesheet', 'com_" . $this->componentCodeName - . "/footable-v2/css/footable.core.min.css', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');"; + . "/footable-v2/css/footable.core.min.css', ['version' => 'auto']);"; $foo .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine( __LINE__ ) . " Use the Metro Style"; @@ -14159,12 +14120,9 @@ class Interpretation extends Fields . "if (!isset(\$this->fooTableStyle) || 0 == \$this->fooTableStyle)"; $foo .= PHP_EOL . $this->_t(2) . "{"; $foo .= PHP_EOL . $this->_t(3) - . "\$this->document->addStyleSheet(JURI::root() .'media/com_" + . "JHtml::_('stylesheet', 'com_" . $this->componentCodeName - . "/footable-v2/css/footable.metro.min.css', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');"; + . "/footable-v2/css/footable.metro.min.css', ['version' => 'auto']);"; $foo .= PHP_EOL . $this->_t(2) . "}"; $foo .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Use the Legacy Style."; @@ -14172,43 +14130,28 @@ class Interpretation extends Fields . "elseif (isset(\$this->fooTableStyle) && 1 == \$this->fooTableStyle)"; $foo .= PHP_EOL . $this->_t(2) . "{"; $foo .= PHP_EOL . $this->_t(3) - . "\$this->document->addStyleSheet(JURI::root() .'media/com_" + . "JHtml::_('stylesheet', 'com_" . $this->componentCodeName - . "/footable-v2/css/footable.standalone.min.css', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');"; + . "/footable-v2/css/footable.standalone.min.css', ['version' => 'auto']);"; $foo .= PHP_EOL . $this->_t(2) . "}"; $foo .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine( __LINE__ ) . " Add the JavaScript for Footable"; $foo .= PHP_EOL . $this->_t(2) - . "\$this->document->addScript(JURI::root() .'media/com_" - . $this->componentCodeName . "/footable-v2/js/footable.js', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');"; + . "JHtml::_('script', 'com_" + . $this->componentCodeName . "/footable-v2/js/footable.js', ['version' => 'auto']);"; $foo .= PHP_EOL . $this->_t(2) - . "\$this->document->addScript(JURI::root() .'media/com_" + . "JHtml::_('script', 'com_" . $this->componentCodeName - . "/footable-v2/js/footable.sort.js', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');"; + . "/footable-v2/js/footable.sort.js', ['version' => 'auto']);"; $foo .= PHP_EOL . $this->_t(2) - . "\$this->document->addScript(JURI::root() .'media/com_" + . "JHtml::_('script', 'com_" . $this->componentCodeName - . "/footable-v2/js/footable.filter.js', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');"; + . "/footable-v2/js/footable.filter.js', ['version' => 'auto']);"; $foo .= PHP_EOL . $this->_t(2) - . "\$this->document->addScript(JURI::root() .'media/com_" + . "JHtml::_('script', 'com_" . $this->componentCodeName - . "/footable-v2/js/footable.paginate.js', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');"; + . "/footable-v2/js/footable.paginate.js', ['version' => 'auto']);"; if ($init) { $foo .= PHP_EOL . PHP_EOL . $this->_t(2) @@ -14232,21 +14175,15 @@ class Interpretation extends Fields $foo .= PHP_EOL . $this->_t(2) . "\$this->document->addStyleSheet('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css');"; $foo .= PHP_EOL . $this->_t(2) - . "\$this->document->addStyleSheet(JURI::root() .'media/com_" + . "JHtml::_('stylesheet', 'com_" . $this->componentCodeName - . "/footable-v3/css/footable.standalone.min.css', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');"; + . "/footable-v3/css/footable.standalone.min.css', ['version' => 'auto']);"; $foo .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) - . " Add the JavaScript for Footable (adding all funtions)"; + . " Add the JavaScript for Footable (adding all functions)"; $foo .= PHP_EOL . $this->_t(2) - . "\$this->document->addScript(JURI::root() .'media/com_" + . "JHtml::_('script', 'com_" . $this->componentCodeName - . "/footable-v3/js/footable.min.js', (" - . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] - . "Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');"; + . "/footable-v3/js/footable.min.js', ['version' => 'auto']);"; if ($init) { $foo .= PHP_EOL . PHP_EOL . $this->_t(2) diff --git a/admin/models/ajax.php b/admin/models/ajax.php index ec80402fe..f5f00d6c2 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -1398,8 +1398,22 @@ class ComponentbuilderModelAjax extends JModelList return false; } + /** + * The view persistence details + * + * @var array + * @since 3.0.13 + */ protected $viewid = array(); + /** + * Get the view details via the session + * + * @input string $call The persistence key + * + * @return mixed + * @since 3.0.13 + */ protected function getViewID($call = 'table') { if (!isset($this->viewid[$call])) @@ -1422,7 +1436,7 @@ class ComponentbuilderModelAjax extends JModelList ); } } - // set GUID if found (TODO we will later move over to GUID) + // set GUID if found if (($guid = ComponentbuilderHelper::get($vdm . '__guid')) !== false && method_exists('ComponentbuilderHelper', 'validGUID')) { if (ComponentbuilderHelper::validGUID($guid)) diff --git a/admin/views/compiler/view.html.php b/admin/views/compiler/view.html.php index ec76ff35c..9da3b235a 100644 --- a/admin/views/compiler/view.html.php +++ b/admin/views/compiler/view.html.php @@ -235,12 +235,12 @@ class ComponentbuilderViewCompiler extends JViewLegacy // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - $this->document->addStyleSheet(JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/uikit'.$style.$size.'.css', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + JHtml::_('stylesheet', 'com_componentbuilder/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - $this->document->addScript(JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit'.$size.'.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JHtml::_('script', 'com_componentbuilder/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); } // Load the script to find all uikit components needed. @@ -280,13 +280,13 @@ class ComponentbuilderViewCompiler extends JViewLegacy if (File::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. - $this->document->addStyleSheet(JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + JHtml::_('stylesheet', 'com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']); } // check if the JavaScript file exists. if (File::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. - $this->document->addScript(JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); + JHtml::_('script', 'com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']); } } } diff --git a/admin/views/fieldtype/view.html.php b/admin/views/fieldtype/view.html.php index c7ff7b428..aa211d8d5 100644 --- a/admin/views/fieldtype/view.html.php +++ b/admin/views/fieldtype/view.html.php @@ -197,9 +197,9 @@ class ComponentbuilderViewFieldtype extends JViewLegacy // Add the CSS for Footable $this->document->addStyleSheet('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css'); - $this->document->addStyleSheet(JURI::root() .'media/com_componentbuilder/footable-v3/css/footable.standalone.min.css', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - // Add the JavaScript for Footable (adding all funtions) - $this->document->addScript(JURI::root() .'media/com_componentbuilder/footable-v3/js/footable.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JHtml::_('stylesheet', 'com_componentbuilder/footable-v3/css/footable.standalone.min.css', ['version' => 'auto']); + // Add the JavaScript for Footable (adding all functions) + JHtml::_('script', 'com_componentbuilder/footable-v3/js/footable.min.js', ['version' => 'auto']); $footable = "jQuery(document).ready(function() { jQuery(function () { jQuery('.footable').footable();});});"; $this->document->addScriptDeclaration($footable); diff --git a/admin/views/get_snippets/view.html.php b/admin/views/get_snippets/view.html.php index 9d237e45b..ea36c1bc8 100644 --- a/admin/views/get_snippets/view.html.php +++ b/admin/views/get_snippets/view.html.php @@ -79,12 +79,12 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - $this->document->addStyleSheet(JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/uikit'.$style.$size.'.css', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + JHtml::_('stylesheet', 'com_componentbuilder/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - $this->document->addScript(JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit'.$size.'.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JHtml::_('script', 'com_componentbuilder/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); } // Load the script to find all uikit components needed. @@ -110,13 +110,13 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy if (File::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. - $this->document->addStyleSheet(JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + JHtml::_('stylesheet', 'com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']); } // check if the JavaScript file exists. if (File::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. - $this->document->addScript(JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); + JHtml::_('script', 'com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']); } } } diff --git a/admin/views/server/view.html.php b/admin/views/server/view.html.php index 8ea315579..82a0d1472 100644 --- a/admin/views/server/view.html.php +++ b/admin/views/server/view.html.php @@ -195,9 +195,9 @@ class ComponentbuilderViewServer extends JViewLegacy // Add the CSS for Footable $this->document->addStyleSheet('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css'); - $this->document->addStyleSheet(JURI::root() .'media/com_componentbuilder/footable-v3/css/footable.standalone.min.css', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - // Add the JavaScript for Footable (adding all funtions) - $this->document->addScript(JURI::root() .'media/com_componentbuilder/footable-v3/js/footable.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JHtml::_('stylesheet', 'com_componentbuilder/footable-v3/css/footable.standalone.min.css', ['version' => 'auto']); + // Add the JavaScript for Footable (adding all functions) + JHtml::_('script', 'com_componentbuilder/footable-v3/js/footable.min.js', ['version' => 'auto']); $footable = "jQuery(document).ready(function() { jQuery(function () { jQuery('.footable').footable();});});"; $this->document->addScriptDeclaration($footable); diff --git a/componentbuilder.xml b/componentbuilder.xml index 41b927581..306de3b62 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 16th May, 2022 + 19th May, 2022 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com diff --git a/site/views/api/view.html.php b/site/views/api/view.html.php index d5dd20094..7c27dd8a3 100644 --- a/site/views/api/view.html.php +++ b/site/views/api/view.html.php @@ -70,12 +70,12 @@ class ComponentbuilderViewApi extends JViewLegacy // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - $this->document->addStyleSheet(JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/uikit'.$style.$size.'.css', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + JHtml::_('stylesheet', 'com_componentbuilder/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - $this->document->addScript(JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit'.$size.'.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JHtml::_('script', 'com_componentbuilder/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); } // add the document default css file $this->document->addStyleSheet(JURI::root(true) .'/components/com_componentbuilder/assets/css/api.css', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');