diff options
Diffstat (limited to 'core/Twig.php')
-rw-r--r-- | core/Twig.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/core/Twig.php b/core/Twig.php index ae79b90e89..5f6550512e 100644 --- a/core/Twig.php +++ b/core/Twig.php @@ -34,8 +34,8 @@ use Twig_SimpleFunction; */ class Twig { - const SPARKLINE_TEMPLATE = '<img class="sparkline" alt="" data-src="%s" width="%d" height="%d" /> - <script type="text/javascript">$(document).ready(function () { piwik.initSparklines(); });</script>'; + const SPARKLINE_TEMPLATE = '<img alt="" data-src="%s" width="%d" height="%d" /> + <script type="text/javascript">$(function() { piwik.initSparklines(); });</script>'; /** * @var Twig_Environment @@ -74,6 +74,15 @@ class Twig $this->addFunction_loadJavascriptTranslations(); $this->addFunction_sparkline(); $this->addFunction_postEvent(); + $this->addFunction_isPluginLoaded(); + } + + protected function addFunction_isPluginLoaded() + { + $isPluginLoadedFunction = new Twig_SimpleFunction('isPluginLoaded', function ($pluginName) { + return PluginsManager::getInstance()->isPluginLoaded($pluginName); + }); + $this->twig->addFunction($isPluginLoadedFunction); } protected function addFunction_includeAssets() |