Permalink
Browse files

MDL-53572 mathjax: always load mathjax using https

It's considered an anti-pattern now to use protocol relative urls and
reduces a setting.

(Also fixed an incorrectly placed 3.1.0 upgrade marker)
  • Loading branch information...
danpoltawski committed Jul 8, 2016
1 parent d1a3ea6 commit 8ce58c99f090c2a9046b0c481f7abbfecc2a615b
@@ -111,9 +111,6 @@ function xmldb_filter_mathjaxloader_upgrade($oldversion) {
// 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 @@ function xmldb_filter_mathjaxloader_upgrade($oldversion) {
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;
}
@@ -99,11 +99,7 @@ public function setup($page, $context) {
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'));
@@ -27,10 +27,8 @@
$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.
@@ -30,13 +30,6 @@
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'),
@@ -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';

0 comments on commit 8ce58c9

Please sign in to comment.