Skip to content
Snippets Groups Projects
Commit 72681b68 authored by lucha's avatar lucha Committed by agata
Browse files

removing unneeded options for mathjax-latex

parent bd316b16
No related branches found
No related tags found
No related merge requests found
......@@ -105,6 +105,8 @@ EOT;
'kblog_mathjax_use_wplatex_syntax'
);
// AI patch: do not use cloudfare CDN
/*
$use_cdn = get_option( 'kblog_mathjax_use_cdn', true ) ? 'checked="true"' : '';
$this->admin_table_row(
......@@ -123,7 +125,7 @@ EOT;
"<input type='textbox' name='kblog_mathjax_custom_location' id='kblog_mathjax_custom_location' $custom_location $custom_location_disabled>",
'kblog_mathjax_custom_location'
);
*/
$options = $this->config_options();
$select_string = "<select name='kblog_mathjax_config' id='kblog_mathjax_config'>\n";
......
......@@ -150,13 +150,15 @@ class MathJax_Latex {
return;
}
// AI patch: remove the use of the cloudfare CDN!
// initialise option for existing MathJax-LaTeX users
/*
if ( get_option( 'kblog_mathjax_use_cdn' ) || ! get_option( 'kblog_mathjax_custom_location' ) ) {
$mathjax_location = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js';
} else {
$mathjax_location = get_option( 'kblog_mathjax_custom_location' );
}
*/
$mathjax_url = $mathjax_location . '?config=' . get_option( 'kblog_mathjax_config' );
wp_enqueue_script( 'mathjax', $mathjax_url, false, MATHJAX_VERSION, false );
......
......@@ -105,25 +105,6 @@ EOT;
'kblog_mathjax_use_wplatex_syntax'
);
$use_cdn = get_option( 'kblog_mathjax_use_cdn', true ) ? 'checked="true"' : '';
$this->admin_table_row(
'Use MathJax CDN Service?',
'Allows use of the MathJax hosted content delivery network. By using this, you are agreeing to the <a href="http://www.mathjax.org/download/mathjax-cdn-terms-of-service/">MathJax CDN Terms of Service</a>.',
"<input type='checkbox' name='kblog_mathjax_use_cdn' id='use_cdn' value='1' $use_cdn/>",
'use_cdn'
);
$custom_location_disabled = get_option( 'kblog_mathjax_use_cdn', true ) ? 'disabled="disabled"' : '';
$custom_location = "value='" . esc_attr( get_option( 'kblog_mathjax_custom_location', '' ) ) . "'";
$this->admin_table_row(
'Custom MathJax location?',
'If you are not using the MathJax CDN enter the location of your MathJax script.',
"<input type='textbox' name='kblog_mathjax_custom_location' id='kblog_mathjax_custom_location' $custom_location $custom_location_disabled>",
'kblog_mathjax_custom_location'
);
$options = $this->config_options();
$select_string = "<select name='kblog_mathjax_config' id='kblog_mathjax_config'>\n";
......@@ -148,9 +129,6 @@ EOT;
public function config_options() {
$options = array(
'default',
'Accessible',
'TeX-AMS_HTML',
'TeX-AMS-MML_HTMLorMML',
);
return $options;
......@@ -169,25 +147,12 @@ EOT;
update_option( 'kblog_mathjax_latex_inline', sanitize_text_field( wp_unslash( $_POST['kblog_mathjax_latex_inline'] ) ) ); // input var okay
}
update_option( 'kblog_mathjax_use_wplatex_syntax', array_key_exists( 'kblog_mathjax_use_wplatex_syntax', $_POST ) ); // input var okay
update_option( 'kblog_mathjax_use_cdn', array_key_exists( 'kblog_mathjax_use_cdn', $_POST ) ); // input var okay
if ( array_key_exists( 'kblog_mathjax_custom_location', $_POST ) && isset( $_POST['kblog_mathjax_custom_location'] ) ) { // input var okay
update_option( 'kblog_mathjax_custom_location', esc_url_raw( wp_unslash( $_POST['kblog_mathjax_custom_location'] ) ) ); // input var okay
}
if ( array_key_exists( 'kblog_mathjax_config', $_POST ) && isset( $_POST['kblog_mathjax_config'] ) && // input var okay
in_array( sanitize_text_field( wp_unslash( $_POST['kblog_mathjax_config'] ) ), $this->config_options(), true ) // input var okay
) {
update_option( 'kblog_mathjax_config', sanitize_text_field( wp_unslash( $_POST['kblog_mathjax_config'] ) ) ); // input var okay
}
}
public function table_head() {
?>
<div class='wrap' id='mathjax-latex-options'>
<h2>Mathjax-Latex by Kblog</h2>
<h2>Mathjax-Latex</h2>
<form id='mathjaxlatex' name='mathjaxlatex' action='' method='POST'>
<?php wp_nonce_field( 'kblog_mathjax_latex_save_action', 'kblog_mathjax_latex_save_field', true ); ?>
<table class='form-table'>
......@@ -203,21 +168,6 @@ EOT;
</form>
</div>
<script type="text/javascript">
jQuery(function($) {
if (typeof($.fn.prop) !== 'function') {
return; // ignore this for sites with jquery < 1.6
}
// enable or disable the cdn input field when checking/unchuecking the "use cdn" checkbox
var cdn_check = $('#use_cdn'),
cdn_location = $('#kblog_mathjax_custom_location');
cdn_check.change(function() {
var checked = cdn_check.is(':checked');
cdn_location.prop('disabled', checked);
});
});
</script>
<?php
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment