Skip to content

Instantly share code, notes, and snippets.

@proweb proweb/gist:4985650
Created Feb 19, 2013

Embed
What would you like to do?
Remoove Mootools for Unregistered users in Joomla
//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
You can’t perform that action at this time.