diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index d28eeed03..0db6ae613 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -511,6 +511,20 @@ class Get * @var array */ public $libraries = array(); + + /** + * Is Tidy Enabled + * + * @var bool + */ + public $tidy = false; + + /** + * Set Tidy warning once switch + * + * @var bool + */ + public $setTidyWarning = false; /*** * Constructor @@ -520,7 +534,9 @@ class Get if (isset($config) && count($config)) { // load application - $this->app = JFactory::getApplication(); + $this->app = JFactory::getApplication(); + // check if we have Tidy enabled + $this->tidy = extension_loaded('Tidy'); // Set the params $this->params = JComponentHelper::getParams('com_componentbuilder'); // load the compiler path @@ -1712,6 +1728,10 @@ class Get $view->$scripter = $this->setDynamicValues(base64_decode($view->$scripter)); if (2 == $this->uikit || 1 == $this->uikit) { + if (!isset($this->uikitComp[$view->code])) + { + $this->uikitComp[$view->code] = array(); + } // set uikit to views $this->uikitComp[$view->code] = ComponentbuilderHelper::getUikitComp($view->$scripter,$this->uikitComp[$view->code]); } @@ -2835,6 +2855,10 @@ class Get // load UIKIT if needed if (2 == $this->uikit || 1 == $this->uikit) { + if (!isset($this->uikitComp[$view])) + { + $this->uikitComp[$view] = array(); + } // set uikit to views $this->uikitComp[$view] = ComponentbuilderHelper::getUikitComp($contnent,$this->uikitComp[$view]); } diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index d7ec49808..ddd5c0299 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -2380,10 +2380,23 @@ class Fields extends Structure $dom = dom_import_simplexml($xml)->ownerDocument; $dom->formatOutput = true; $xmlString = $dom->saveXML($dom->getElementsByTagName($nodename)->item(0)); - $tidy = new Tidy(); - $tidy->parseString($xmlString,array('indent'=>true,'indent-spaces'=>8,'input-xml'=>true,'output-xml'=>true,'indent-attributes'=>true,'wrap-attributes'=>true,'wrap'=>false)); - $tidy->cleanRepair(); - return $this->xmlIndent((string)$tidy,' ',8,true,false); + // make sure Tidy is enabled + if ($this->tidy) + { + $tidy = new Tidy(); + $tidy->parseString($xmlString,array('indent'=>true,'indent-spaces'=>8,'input-xml'=>true,'output-xml'=>true,'indent-attributes'=>true,'wrap-attributes'=>true,'wrap'=>false)); + $tidy->cleanRepair(); + return $this->xmlIndent((string)$tidy,' ',8,true,false); + } + // set tidy waring atleast once + elseif (!$this->setTidyWarning) + { + // set the warning only once + $this->setTidyWarning = true; + // now set the warning + $this->app->enqueueMessage(JText::_('You must enable the Tidy extension in your php.ini file so we can tidy up your xml! If you need help please start here!'), 'error'); + } + return $xmlString; } /**