Skip to content

Commit

Permalink
Fix add combinedFiles to clear logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Joe committed Aug 29, 2017
1 parent 9d2503c commit 7b200a2
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions view/Requirements.php
Original file line number Diff line number Diff line change
Expand Up @@ -744,37 +744,42 @@ public function get_css() {
* @param string|int $fileOrID
*/
public function clear($fileOrID = null) {
if($fileOrID) {
foreach(array('javascript','css', 'customScript', 'customCSS', 'customHeadTags') as $type) {
if(isset($this->{$type}[$fileOrID])) {
$types = array(
'javascript',
'css',
'customScript',
'customCSS',
'customHeadTags',
'combine_files',
);
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} = array();
}
} 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();
}
}

/**
* Restore requirements cleared by call to Requirements::clear
*/
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 = array(
'javascript',
'css',
'customScript',
'customCSS',
'customHeadTags',
'combine_files',
);
foreach ($types as $type) {
$this->{$type} = $this->disabled[$type];
}
}
/**
* Block inclusion of a specific file
Expand Down

0 comments on commit 7b200a2

Please sign in to comment.