Created
May 31, 2016 09:33
-
-
Save hans2103/61d58c41edcc370ef91f93e572aeb7fe to your computer and use it in GitHub Desktop.
template function to remove SqueezeBox.
This file contains 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
$helper = new ThisTemplateHelper(); | |
$helper->unsetSqueezeBox(); | |
class ThisTemplateHelper | |
{ | |
public function __construct() | |
{ | |
$this->doc = JFactory::getDocument(); | |
} | |
public function unsetSqueezeBox() | |
{ | |
if (isset($this->doc->_script['text/javascript'])) | |
{ | |
$this->doc->_script['text/javascript'] = preg_replace('%jQuery\(function\(\$\) {\s*SqueezeBox.initialize\(\{\}\);\s*SqueezeBox.assign\(\$\(\'a.modal\'\).get\(\), \{\s*parse: \'rel\'\s*\}\);\s*\}\);\s*function jModalClose\(\) \{\s*SqueezeBox.close\(\);\s*\}%', '', $this->doc->_script['text/javascript']); | |
// Unset completly if empty | |
if (empty($this->doc->_script['text/javascript'])) | |
{ | |
unset($this->doc->_script['text/javascript']); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment