Skip to content

Instantly share code, notes, and snippets.

@hans2103
Created May 31, 2016 09:33
Show Gist options
  • Save hans2103/61d58c41edcc370ef91f93e572aeb7fe to your computer and use it in GitHub Desktop.
Save hans2103/61d58c41edcc370ef91f93e572aeb7fe to your computer and use it in GitHub Desktop.
template function to remove SqueezeBox.
$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