From: Pascal Deklerck Date: Wed, 13 Jun 2018 19:57:59 +0000 (+0200) Subject: Defensive code for the case when addon_hooks key does not exist X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7ef81f909fc04e261a7c04d4822d79dd7fce6e65;p=friendica-addons.git Defensive code for the case when addon_hooks key does not exist --- diff --git a/mathjax/mathjax.php b/mathjax/mathjax.php index 6f4dd395..91a6a066 100644 --- a/mathjax/mathjax.php +++ b/mathjax/mathjax.php @@ -27,7 +27,12 @@ function mathjax_uninstall() { Addon::unregisterHook('template_vars', 'addon/mathjax/mathjax.php', 'mathjax_template_vars'); } -function mathjax_template_vars($a, &$arr) { +function mathjax_template_vars($a, &$arr) +{ + if (!array_key_exists('addon_hooks',$arr['vars'])) + { + $arr['vars']['addon_hooks'] = array(); + } $arr['vars']['addon_hooks'][] = "mathjax"; }