From 24147be64ff9e6a0f8411e65ad5b7ffda0f52681 Mon Sep 17 00:00:00 2001 From: lucha <lucha@paranoici.org> Date: Sat, 14 Jan 2017 16:55:47 +0100 Subject: [PATCH] removing unneeded options for mathjax-latex --- .../class-mathjax-latex-admin.php | 4 +- .../mathjax-latex/class-mathjax-latex.php | 4 +- .../mathjax-latex/mathjax-latex-admin.php | 52 +------------------ 3 files changed, 7 insertions(+), 53 deletions(-) diff --git a/wp-content/plugins/mathjax-latex/class-mathjax-latex-admin.php b/wp-content/plugins/mathjax-latex/class-mathjax-latex-admin.php index 75746393a..5c41e0833 100644 --- a/wp-content/plugins/mathjax-latex/class-mathjax-latex-admin.php +++ b/wp-content/plugins/mathjax-latex/class-mathjax-latex-admin.php @@ -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"; diff --git a/wp-content/plugins/mathjax-latex/class-mathjax-latex.php b/wp-content/plugins/mathjax-latex/class-mathjax-latex.php index 7dc638f78..f4d838049 100644 --- a/wp-content/plugins/mathjax-latex/class-mathjax-latex.php +++ b/wp-content/plugins/mathjax-latex/class-mathjax-latex.php @@ -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 ); diff --git a/wp-content/plugins/mathjax-latex/mathjax-latex-admin.php b/wp-content/plugins/mathjax-latex/mathjax-latex-admin.php index 4fc0156f2..32089608f 100644 --- a/wp-content/plugins/mathjax-latex/mathjax-latex-admin.php +++ b/wp-content/plugins/mathjax-latex/mathjax-latex-admin.php @@ -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 } -- GitLab