diff --git a/code/site/components/com_pages/template/helper/behavior.php b/code/site/components/com_pages/template/helper/behavior.php
index 83140932..d6cba33c 100644
--- a/code/site/components/com_pages/template/helper/behavior.php
+++ b/code/site/components/com_pages/template/helper/behavior.php
@@ -21,7 +21,7 @@ public function prefetcher($config = array())
));
$html = '';
- if (!static::isLoaded('prefetcher'))
+ if (!static::isLoaded())
{
$html .= '';
$html .= <<
PREFETCHER;
- static::setLoaded('prefetcher');
}
return $html;
@@ -48,10 +47,8 @@ public function alpine($config = [])
$html = '';
- if (!static::isLoaded('alpine'))
- {
+ if (!static::isLoaded()) {
$html .= '';
- static::setLoaded('alpine');
}
return $html;
@@ -82,7 +79,7 @@ public function highlight($config = array())
}
$html = '';
- if (!static::isLoaded('highlight'))
+ if (!static::isLoaded())
{
$style_url = 'https://unpkg.com/@highlightjs/cdn-assets@'.$config->version.'/styles/'.$config->style.'.min.css';
$hljs_url = 'https://unpkg.com/@highlightjs/cdn-assets@'.$config->version.'/highlight.' . (!$config->debug ? 'min.js' : 'js');
@@ -166,9 +163,23 @@ public function highlight($config = array())
HIGHLIGHT;
- static::setLoaded('highlight');
}
return $html;
}
+
+ public static function isLoaded($key = null)
+ {
+ if(!$key)
+ {
+ $method = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS,2);
+ $key = $method[1]['function'];
+ }
+
+ if(!$result = !empty(static::$_loaded[$key])) {
+ self::setLoaded($key);
+ }
+
+ return $result;
+ }
}
\ No newline at end of file