Changeset 342553
- Timestamp:
- 02/08/2011 05:25:50 PM (15 years ago)
- Location:
- mathjax-latex/trunk
- Files:
-
- 2 edited
-
mathjax-latex.php (modified) (7 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mathjax-latex/trunk/mathjax-latex.php
r302211 r342553 2 2 /* 3 3 Plugin Name: Mathjax Latex 4 Plugin URI: http://knowledgeblog.org/mathjax-latex-wordpress-plugin/ 5 Description: Transform latex equations in javascript using MathJax 6 Version: 0.1 4 Description: Transform latex equations in javascript using mathjax 5 Version: 0.2 7 6 Author: Phillip Lord 8 7 Author URI: http://knowledgeblog.org 9 License: GPL2 10 8 11 9 Copyright 2010. Phillip Lord (phillip.lord@newcastle.ac.uk) 12 10 Newcastle University. 13 14 This program is free software; you can redistribute it and/or modify 15 it under the terms of the GNU General Public License, version 2, as 16 published by the Free Software Foundation. 17 18 This program is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 GNU General Public License for more details. 22 23 You should have received a copy of the GNU General Public License 24 along with this program; if not, write to the Free Software 25 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 11 26 12 */ 27 13 … … 72 58 add_option('force_load', FALSE); 73 59 add_option('latex_syntax', 'inline'); 60 add_option('mathjax_location', plugins_url("MathJax/MathJax.js",__FILE__)); 74 61 //test for wp-latex here 75 62 if (method_exists('WP_LaTeX', 'init')) { … … 119 106 } 120 107 121 function add_script(){108 function add_script(){ 122 109 if( !self::$add_script ) 123 110 return; … … 125 112 if( self::$block_script ) 126 113 return; 114 115 $mathjax_location = get_option('mathjax_location'); 127 116 128 117 wp_register_script( 'mathjax', 129 plugins_url('MathJax/MathJax.js',__FILE__),118 $mathjax_location, 130 119 false, null, true ); 131 120 … … 185 174 if (!current_user_can('manage_options')) { 186 175 wp_die( __('You do not have sufficient permissions to access this page.') ); 176 } 177 //initialise option for existing MathJax-LaTeX users 178 if (!get_option('mathjax_location')) { 179 add_option('mathjax_location', plugins_url("MathJax/MathJax.js",__FILE__)); 187 180 } 188 181 echo '<div class="wrap" id="mathjax-latex-options"> … … 206 199 update_option('latex_syntax', $_POST['latex_syntax']); 207 200 } 201 if ($_POST['default_disabled']) { 202 update_option('default_disabled', true); 203 if ($_POST['mathjax_location'] != get_option('mathjax_location')) { 204 update_option('mathjax_location', $_POST['mathjax_location']); 205 } 206 } 207 else { 208 update_option('default_disabled', false); 209 update_option('mathjax_location', plugins_url("MathJax/MathJax.js",__FILE__)); 210 } 211 //$url = plugins_url($_POST['mathjax_location']."/MathJax.js",__FILE__); 212 //$handle = @fopen($url,'r'); 213 //if($handle !== false){ 214 //update_option('mathjax_location', $_POST['mathjax_location']); 215 //$exists = true; 216 //} 217 //else{ 218 //$exists = false; 219 //} 220 //} 221 //else { 222 //$exists = true; 223 //} 208 224 echo '<p><i>Options updated</i></p>'; 209 225 } 210 226 ?> 211 <form id="mathjax -latex" name="mathjax-latex" action="" method='POST'>227 <form id="mathjaxlatex" name="mathjaxlatex" action="" method='POST'> 212 228 <input type="hidden" name="mathjax_hidden" value="Y"> 213 229 <table class="form-table"> … … 249 265 </td> 250 266 </tr> 267 <tr> 268 <th>Override default MathJax location?</th> 269 <td><input type="checkbox" name="default_disabled" value="1"<?php 270 if (get_option('default_disabled')) { 271 echo 'CHECKED'; 272 } 273 ?>/> 274 </td> 275 </tr> 276 <tr> 277 <th scope="row">MathJax Javascript location<br/><font size="-2">Changes will be ignored unless above is checked.</font></th> 278 <td><input type='textbox' name='mathjax_location' class='regular-text code' value='<?php echo get_option('mathjax_location'); ?>'/></td> 279 </tr> 251 280 </table> 252 281 <p class="submit"> -
mathjax-latex/trunk/readme.txt
r302643 r342553 1 1 === MathJax-LaTeX === 2 2 3 Contributors: knowledgeblog, sjcockell, philliplord, d_swan4 Tags: mathematics, math, latex, mathml, mathjax 3 Contributors: philliplord, sjcockell, knowledgeblog, d_swan 4 Tags: mathematics, math, latex, mathml, mathjax, science 5 5 Requires at least: 3.0 6 Tested up to: 3.0. 17 Stable tag: 0. 16 Tested up to: 3.0.5 7 Stable tag: 0.2 8 8 9 9 This plugin enables mathjax (http://www.mathjax.org) functionality for WordPress (http://www.wordpress.org). … … 32 32 33 33 You can also specify [nomathjax] -- this will block mathjax on the 34 current page, regardless of other tags. 34 current page, regardless of other tags. 35 36 The MathJax library is included in the plugin zip. 35 37 36 38 == Installation == 37 39 38 40 1. Unzip the downloaded .zip archive to the `/wp-content/plugins/` directory 39 1. Download the MathJax Javascript library (http://www.mathjax.org/download/)40 1. Place the Javascript library in the mathjax-latex directory (`/wp-content/plugins/mathjax-latex/**MathJax**`)41 41 1. Activate the plugin through the 'Plugins' menu in WordPress 42 1. You can configure the plugin to load MathJax from a different URL to the default. See the options page. 43 44 == Changelog == 45 46 1. MathJax.js can be loaded form a configurable URL. Defaults to $PLUGIN/MathJax/MathJax.js 47 1. MathJax is now included in the plugin distribution. 42 48 43 49 == Copyright ==
Note: See TracChangeset
for help on using the changeset viewer.