forked from joomla/Component-Builder
Added Tidy warning to compiler and workaround so that the compiler can still work without the Tidy extension Resolved gh-197
This commit is contained in:
parent
258f7441d7
commit
d37b0d367a
@ -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]);
|
||||
}
|
||||
|
@ -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 <b>Tidy</b> extension in your php.ini file so we can tidy up your xml! If you need help please <a href="https://github.com/vdm-io/Joomla-Component-Builder/issues/197#issuecomment-351181754" target="_blank">start here</a>!'), 'error');
|
||||
}
|
||||
return $xmlString;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user