Merge branch 'MDL-53572-master' of git://github.com/danpoltawski/moodle

This commit is contained in:
Andrew Nicols 2016-08-09 12:52:13 +08:00
commit 6c19db54f9
5 changed files with 24 additions and 20 deletions

View File

@ -111,9 +111,6 @@ MathJax.Hub.Config({
// Moodle v3.0.0 release upgrade line. // Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this. // Put any upgrade step following this.
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2016032200) { if ($oldversion < 2016032200) {
$httpurl = get_config('filter_mathjaxloader', 'httpurl'); $httpurl = get_config('filter_mathjaxloader', 'httpurl');
@ -131,5 +128,25 @@ MathJax.Hub.Config({
upgrade_plugin_savepoint(true, 2016032200, 'filter', 'mathjaxloader'); 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; return true;
} }

View File

@ -99,11 +99,7 @@ class filter_mathjaxloader extends moodle_text_filter {
static $jsinitialised = false; static $jsinitialised = false;
if (empty($jsinitialised)) { if (empty($jsinitialised)) {
if (is_https()) { $url = get_config('filter_mathjaxloader', 'httpsurl');
$url = get_config('filter_mathjaxloader', 'httpsurl');
} else {
$url = get_config('filter_mathjaxloader', 'httpurl');
}
$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'));

View File

@ -27,10 +27,8 @@ $string['additionaldelimiters'] = 'Additional equation delimiters';
$string['additionaldelimiters_help'] = 'MathJax filter parses text for equations contained within delimiter characters. $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.'; 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['httpsurl'] = 'MathJax URL';
$string['httpurl_help'] = 'Full URL to MathJax library. Used when the page is loaded via http.'; $string['httpsurl_help'] = 'Full URL to MathJax library.';
$string['httpsurl'] = 'HTTPS MathJax URL';
$string['httpsurl_help'] = 'Full URL to MathJax library. Used when the page is loaded via https (secure). ';
$string['texfiltercompatibility'] = 'TeX filter compatibility'; $string['texfiltercompatibility'] = 'TeX filter compatibility';
$string['texfiltercompatibility_help'] = 'The MathJax filter can be used as a replacement for the TeX notation filter. $string['texfiltercompatibility_help'] = 'The MathJax filter can be used as a replacement for the TeX notation filter.

View File

@ -30,13 +30,6 @@ if ($ADMIN->fulltree) {
new lang_string('localinstall_help', 'filter_mathjaxloader')); new lang_string('localinstall_help', 'filter_mathjaxloader'));
$settings->add($item); $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', $item = new admin_setting_configtext('filter_mathjaxloader/httpsurl',
new lang_string('httpsurl', 'filter_mathjaxloader'), new lang_string('httpsurl', 'filter_mathjaxloader'),
new lang_string('httpsurl_help', 'filter_mathjaxloader'), new lang_string('httpsurl_help', 'filter_mathjaxloader'),

View File

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$plugin->version = 2016052300; $plugin->version = 2016080200;
$plugin->requires = 2016051900; // Requires this Moodle version. $plugin->requires = 2016051900; // Requires this Moodle version.
$plugin->component= 'filter_mathjaxloader'; $plugin->component= 'filter_mathjaxloader';