mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 02:16:41 +02:00
MDL-62792 filter_mathjaxloader: don't use statics for once-only items
This commit is contained in:
parent
8793e120b9
commit
de71bef7cb
1 changed files with 1 additions and 5 deletions
|
@ -79,10 +79,8 @@ class filter_mathjaxloader extends moodle_text_filter {
|
||||||
* @param context $context The current context.
|
* @param context $context The current context.
|
||||||
*/
|
*/
|
||||||
public function setup($page, $context) {
|
public function setup($page, $context) {
|
||||||
// This only requires execution once per request.
|
|
||||||
static $jsinitialised = false;
|
|
||||||
|
|
||||||
if (empty($jsinitialised)) {
|
if ($page->requires->should_create_one_time_item_now('filter_mathjaxloader-scripts')) {
|
||||||
$url = get_config('filter_mathjaxloader', 'httpsurl');
|
$url = get_config('filter_mathjaxloader', 'httpsurl');
|
||||||
$lang = $this->map_language_code(current_language());
|
$lang = $this->map_language_code(current_language());
|
||||||
$url = new moodle_url($url, array('delayStartupUntil' => 'configured'));
|
$url = new moodle_url($url, array('delayStartupUntil' => 'configured'));
|
||||||
|
@ -102,8 +100,6 @@ class filter_mathjaxloader extends moodle_text_filter {
|
||||||
$params = array('mathjaxconfig' => $config, 'lang' => $lang);
|
$params = array('mathjaxconfig' => $config, 'lang' => $lang);
|
||||||
|
|
||||||
$page->requires->yui_module('moodle-filter_mathjaxloader-loader', 'M.filter_mathjaxloader.configure', array($params));
|
$page->requires->yui_module('moodle-filter_mathjaxloader-loader', 'M.filter_mathjaxloader.configure', array($params));
|
||||||
|
|
||||||
$jsinitialised = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue