Fix add combinedFiles to clear logic

This commit is contained in:
Christopher Joe 2017-08-29 10:24:41 +12:00 committed by Damian Mooyman
parent 2a0805dda7
commit e4b506cbe7
No known key found for this signature in database
GPG Key ID: 78B823A10DE27D1A

View File

@ -704,25 +704,24 @@ class Requirements_Backend
*/
public function clear($fileOrID = null)
{
if ($fileOrID) {
foreach (array('javascript', 'css', 'customScript', 'customCSS', 'customHeadTags') as $type) {
$types = [
'javascript',
'css',
'customScript',
'customCSS',
'customHeadTags',
'combinedFiles',
];
foreach ($types as $type) {
if ($fileOrID) {
if (isset($this->{$type}[$fileOrID])) {
$this->disabled[$type][$fileOrID] = $this->{$type}[$fileOrID];
unset($this->{$type}[$fileOrID]);
}
} else {
$this->disabled[$type] = $this->{$type};
$this->{$type} = [];
}
} else {
$this->disabled['javascript'] = $this->javascript;
$this->disabled['css'] = $this->css;
$this->disabled['customScript'] = $this->customScript;
$this->disabled['customCSS'] = $this->customCSS;
$this->disabled['customHeadTags'] = $this->customHeadTags;
$this->javascript = array();
$this->css = array();
$this->customScript = array();
$this->customCSS = array();
$this->customHeadTags = array();
}
}
@ -731,11 +730,17 @@ class Requirements_Backend
*/
public function restore()
{
$this->javascript = $this->disabled['javascript'];
$this->css = $this->disabled['css'];
$this->customScript = $this->disabled['customScript'];
$this->customCSS = $this->disabled['customCSS'];
$this->customHeadTags = $this->disabled['customHeadTags'];
$types = [
'javascript',
'css',
'customScript',
'customCSS',
'customHeadTags',
'combinedFiles',
];
foreach ($types as $type) {
$this->{$type} = $this->disabled[$type];
}
}
/**