diff --git a/jscssmanipulate.php b/jscssmanipulate.php index 30c4f6f..16d669c 100644 --- a/jscssmanipulate.php +++ b/jscssmanipulate.php @@ -27,7 +27,7 @@ function onBeforeCompileHead() { $app = JFactory::getApplication(); if ($app->isAdmin()) { - return; + return true; } $doc = JFactory::getDocument(); @@ -55,14 +55,9 @@ function onBeforeCompileHead() $debug && $debugInfo .= '
  • ' . $searchUrl . ' ==> '; - if (!empty($params->remove)) { - if($this->checkExceptions($params->remove_exceptions)){ - $debug && $debugInfo .= 'EXCEPTIONS'; - } - else{ - $debug && $debugInfo .= 'REMOVED'; - unset($doc->_scripts[$searchUrl]); - } + if (!empty($params->remove) && !$this->checkExceptions($params->remove_exceptions, $debug, $debugInfo)) { + $debug && $debugInfo .= 'REMOVED'; + unset($doc->_scripts[$searchUrl]); } else { if (!empty($params->defer)) { $debug && $debugInfo .= 'DEFER'; @@ -99,14 +94,9 @@ function onBeforeCompileHead() $debug && $debugInfo .= '
  • ' . $searchUrl . ' ==> '; - if (!empty($params->remove)) { - if($this->checkExceptions($params->remove_exceptions)){ - $debug && $debugInfo .= 'EXCEPTIONS'; - } - else{ - $debug && $debugInfo .= 'REMOVED'; - unset($doc->_styleSheets[$searchUrl]); - } + if (!empty($params->remove) && !$this->checkExceptions($params->remove_exceptions, $debug, $debugInfo)) { + $debug && $debugInfo .= 'REMOVED'; + unset($doc->_styleSheets[$searchUrl]); } else if (!empty($params->foother)) { $debug && $debugInfo .= 'MOVED TO FOOTHER'; $this->footherCss[$searchUrl] = $doc->_styleSheets[$searchUrl]; @@ -222,8 +212,7 @@ private function prepareConfig() return $config; } - private function checkExceptions($removeExceptions){ - $return = false; + private function checkExceptions($removeExceptions, $debug, &$debugInfo){ $removeExceptions = trim($removeExceptions); if(empty($removeExceptions)){ return false; @@ -244,6 +233,12 @@ private function checkExceptions($removeExceptions){ $aCheck[] = (int)in_array($input->getString($removeException[0], ''), $values); } - return !in_array(0, $aCheck); + $exception = !in_array(0, $aCheck); + + if($exception){ + $debug && $debugInfo .= 'EXCEPTION'; + } + + return $exception; } } \ No newline at end of file