diff --git a/filter/mathjaxloader/db/upgrade.php b/filter/mathjaxloader/db/upgrade.php index 336208c53b4..77fc2d9c6dc 100644 --- a/filter/mathjaxloader/db/upgrade.php +++ b/filter/mathjaxloader/db/upgrade.php @@ -111,9 +111,6 @@ MathJax.Hub.Config({ // Moodle v3.0.0 release upgrade line. // Put any upgrade step following this. - // Moodle v3.1.0 release upgrade line. - // Put any upgrade step following this. - if ($oldversion < 2016032200) { $httpurl = get_config('filter_mathjaxloader', 'httpurl'); @@ -131,5 +128,25 @@ MathJax.Hub.Config({ upgrade_plugin_savepoint(true, 2016032200, 'filter', 'mathjaxloader'); } + // Moodle v3.1.0 release upgrade line. + // Put any upgrade step following this. + + if ($oldversion < 2016080200) { + // We are consolodating the two settings for http and https url into only the https + // setting. Since it is preferably to always load the secure resource. + + $httpurl = get_config('filter_mathjaxloader', 'httpurl'); + if ($httpurl !== 'http://cdn.mathjax.org/mathjax/2.6-latest/MathJax.js') { + // If the http setting has been changed, we make the admin choose the https setting because + // it indicates some sort of custom setup. This will be supported by the release notes. + unset_config('httpsurl', 'filter_mathjaxloader'); + } + + // The seperate http setting has been removed. We always use the secure resource. + unset_config('httpurl', 'filter_mathjaxloader'); + + upgrade_plugin_savepoint(true, 2016080200, 'filter', 'mathjaxloader'); + } + return true; } diff --git a/filter/mathjaxloader/filter.php b/filter/mathjaxloader/filter.php index c5428c804eb..40d49ddcab7 100644 --- a/filter/mathjaxloader/filter.php +++ b/filter/mathjaxloader/filter.php @@ -99,11 +99,7 @@ class filter_mathjaxloader extends moodle_text_filter { static $jsinitialised = false; if (empty($jsinitialised)) { - if (is_https()) { - $url = get_config('filter_mathjaxloader', 'httpsurl'); - } else { - $url = get_config('filter_mathjaxloader', 'httpurl'); - } + $url = get_config('filter_mathjaxloader', 'httpsurl'); $lang = $this->map_language_code(current_language()); $url = new moodle_url($url, array('delayStartupUntil' => 'configured')); diff --git a/filter/mathjaxloader/lang/en/filter_mathjaxloader.php b/filter/mathjaxloader/lang/en/filter_mathjaxloader.php index 175b023c84f..53378657cd3 100644 --- a/filter/mathjaxloader/lang/en/filter_mathjaxloader.php +++ b/filter/mathjaxloader/lang/en/filter_mathjaxloader.php @@ -27,10 +27,8 @@ $string['additionaldelimiters'] = 'Additional equation delimiters'; $string['additionaldelimiters_help'] = 'MathJax filter parses text for equations contained within delimiter characters. The list of recognised delimiter characters can be added to here (e.g. AsciiMath uses `). Delimiters can contain multiple characters and multiple delimiters can be separated with commas.'; -$string['httpurl'] = 'HTTP MathJax URL'; -$string['httpurl_help'] = 'Full URL to MathJax library. Used when the page is loaded via http.'; -$string['httpsurl'] = 'HTTPS MathJax URL'; -$string['httpsurl_help'] = 'Full URL to MathJax library. Used when the page is loaded via https (secure). '; +$string['httpsurl'] = 'MathJax URL'; +$string['httpsurl_help'] = 'Full URL to MathJax library.'; $string['texfiltercompatibility'] = 'TeX filter compatibility'; $string['texfiltercompatibility_help'] = 'The MathJax filter can be used as a replacement for the TeX notation filter. diff --git a/filter/mathjaxloader/settings.php b/filter/mathjaxloader/settings.php index 481e9022fb2..0453a47a764 100644 --- a/filter/mathjaxloader/settings.php +++ b/filter/mathjaxloader/settings.php @@ -30,13 +30,6 @@ if ($ADMIN->fulltree) { new lang_string('localinstall_help', 'filter_mathjaxloader')); $settings->add($item); - $item = new admin_setting_configtext('filter_mathjaxloader/httpurl', - new lang_string('httpurl', 'filter_mathjaxloader'), - new lang_string('httpurl_help', 'filter_mathjaxloader'), - 'http://cdn.mathjax.org/mathjax/2.6-latest/MathJax.js', - PARAM_RAW); - $settings->add($item); - $item = new admin_setting_configtext('filter_mathjaxloader/httpsurl', new lang_string('httpsurl', 'filter_mathjaxloader'), new lang_string('httpsurl_help', 'filter_mathjaxloader'), diff --git a/filter/mathjaxloader/version.php b/filter/mathjaxloader/version.php index 8e64d3a7b24..60bf5177f75 100644 --- a/filter/mathjaxloader/version.php +++ b/filter/mathjaxloader/version.php @@ -24,6 +24,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2016052300; +$plugin->version = 2016080200; $plugin->requires = 2016051900; // Requires this Moodle version. $plugin->component= 'filter_mathjaxloader';