Created
February 19, 2013 12:59
-
-
Save proweb/4985650 to your computer and use it in GitHub Desktop.
Remoove Mootools for Unregistered users in Joomla
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Removing Mootools | |
$head = $doc->getHeadData(); | |
//Unset Mootools for unregistered users | |
if($user->guest){ | |
$head=$this->getHeadData(); | |
reset($head['scripts']); | |
unset($head['scripts'][$this->baseurl . '/media/system/js/core.js']); | |
unset($head['scripts'][$this->baseurl . '/media/system/js/mootools.js']); | |
unset($head['scripts'][$this->baseurl . '/plugins/system/mtupgrade/mootools.js']); | |
unset($head['scripts'][$this->baseurl . '/media/system/js/mootools-core.js']); | |
unset($head['scripts'][$this->baseurl . '/media/system/js/mootools-more.js']); | |
unset($head['scripts'][$this->baseurl . '/media/system/js/caption.js']); | |
$this->setHeadData($head); | |
// Removing JCaption | |
$this->_script = preg_replace('%window\.addEvent\(\'load\',\s*function\(\)\s*{\s*new\s*JCaption\(\'img.caption\'\);\s*}\);\s*%', '', $this->_script); | |
if (empty($this->_script['text/javascript'])) unset($this->_script['text/javascript']); | |
} else { | |
$head=$this->getHeadData(); | |
reset($head['scripts']); | |
unset($head['scripts'][$this->baseurl . '/media/system/js/mootools-more.js']); | |
$this->setHeadData($head); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment