Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
noblogs-wp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
39
Issues
39
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ai
noblogs-wp
Commits
109d028b
Commit
109d028b
authored
Apr 18, 2017
by
lucha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[auto] plugin: mathjax-latex 1.3.5
parent
118732e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
19 deletions
+40
-19
wp-content/plugins/mathjax-latex/mathjax-latex-admin.php
wp-content/plugins/mathjax-latex/mathjax-latex-admin.php
+4
-0
wp-content/plugins/mathjax-latex/mathjax-latex.php
wp-content/plugins/mathjax-latex/mathjax-latex.php
+30
-17
wp-content/plugins/mathjax-latex/readme.txt
wp-content/plugins/mathjax-latex/readme.txt
+6
-2
No files found.
wp-content/plugins/mathjax-latex/mathjax-latex-admin.php
View file @
109d028b
...
...
@@ -151,6 +151,10 @@ EOT;
}
function
admin_save
()
{
if
(
defined
(
'DOING_AJAX'
)
&&
DOING_AJAX
)
{
check_ajax_referer
(
'kblog_mathjax_latex_save_field'
,
'security'
);
}
update_option
(
'kblog_mathjax_force_load'
,
array_key_exists
(
'kblog_mathjax_force_load'
,
$_POST
)
);
// input var okay
if
(
array_key_exists
(
'kblog_mathjax_latex_inline'
,
$_POST
)
&&
isset
(
$_POST
[
'kblog_mathjax_latex_inline'
]
)
&&
// input var okay
...
...
wp-content/plugins/mathjax-latex/mathjax-latex.php
View file @
109d028b
...
...
@@ -2,7 +2,7 @@
/*
Plugin Name: MathJax-LaTeX
Description: Transform latex equations in JavaScript using mathjax
Version: 1.3.
4
Version: 1.3.
5
Author: Phillip Lord, Simon Cockell, Paul Schreiber
Author URI: http://knowledgeblog.org
...
...
@@ -32,6 +32,8 @@
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
define
(
'MATHJAX_VERSION'
,
'1.3.5'
);
require_once
(
dirname
(
__FILE__
)
.
'/mathjax-latex-admin.php'
);
class
MathJax
{
...
...
@@ -94,7 +96,7 @@ class MathJax {
add_shortcode
(
'nomathjax'
,
array
(
__CLASS__
,
'nomathjax_shortcode'
)
);
add_shortcode
(
'latex'
,
array
(
__CLASS__
,
'latex_shortcode'
)
);
add_action
(
'wp_footer'
,
array
(
__CLASS__
,
'add_script'
)
);
add_
action
(
'wp_footer'
,
array
(
__CLASS__
,
'unconditional'
)
);
add_
filter
(
'script_loader_tag'
,
array
(
__CLASS__
,
'script_loader_tag'
),
10
,
3
);
if
(
get_option
(
'kblog_mathjax_use_wplatex_syntax'
)
)
{
add_filter
(
'the_content'
,
array
(
__CLASS__
,
'inline_to_shortcode'
)
);
...
...
@@ -127,19 +129,6 @@ class MathJax {
delete_option
(
'kblog_mathjax_config'
);
}
public
static
function
unconditional
()
{
echo
'<!-- MathJax Latex Plugin installed'
;
if
(
!
self
::
$add_script
)
{
echo
': Disabled as no shortcodes on this page'
;
}
if
(
self
::
$block_script
)
{
echo
': Disabled by nomathjax shortcode'
;
}
echo
' -->'
;
}
public
static
function
mathjax_shortcode
(
$atts
,
$content
)
{
self
::
$add_script
=
true
;
}
...
...
@@ -156,7 +145,7 @@ class MathJax {
if
(
'inline'
===
$shortcode_atts
[
'syntax'
]
)
{
return
'\('
.
$content
.
'\)'
;
}
else
if
(
'display'
===
$shortcode_atts
[
'syntax'
]
)
{
}
elseif
(
'display'
===
$shortcode_atts
[
'syntax'
]
)
{
return
'\['
.
$content
.
'\]'
;
}
}
...
...
@@ -179,7 +168,31 @@ class MathJax {
$mathjax_url
=
$mathjax_location
.
'?config='
.
get_option
(
'kblog_mathjax_config'
);
wp_enqueue_script
(
'mathjax'
,
$mathjax_url
,
false
,
'1.2.1'
,
false
);
wp_enqueue_script
(
'mathjax'
,
$mathjax_url
,
false
,
MATHJAX_VERSION
,
false
);
$mathjax_config
=
apply_filters
(
'mathjax_config'
,
array
()
);
if
(
$mathjax_config
)
{
wp_add_inline_script
(
'mathjax'
,
'MathJax.Hub.Config('
.
wp_json_encode
(
$mathjax_config
)
.
');'
);
}
}
/**
* Set the script tag to have type text/x-mathjax-config
*
* @param string $tag The `<script>` tag for the enqueued script.
* @param string $handle The script's registered handle.
* @param string $src The script's source URL.
*
* @return string $tag
*/
public
static
function
script_loader_tag
(
$tag
,
$handle
=
null
,
$src
=
null
)
{
if
(
'mathjax'
===
$handle
)
{
// replace the <script> tag for the inline script, but not for the <script> tag with src=""
return
str_replace
(
"<script type='text/javascript'>"
,
"<script type='text/x-mathjax-config'>"
,
$tag
);
}
return
$tag
;
}
public
static
function
inline_to_shortcode
(
$content
)
{
...
...
wp-content/plugins/mathjax-latex/readme.txt
View file @
109d028b
...
...
@@ -3,8 +3,8 @@
Contributors: philliplord, sjcockell, knowledgeblog, d_swan, paulschreiber, jwenerd
Tags: mathematics, math, latex, mathml, mathjax, science, res-comms, scholar, academic
Requires at least: 3.0
Tested up to: 4.
5
Stable tag: 1.3.
4
Tested up to: 4.
7.3
Stable tag: 1.3.
5
License: GPLv3
This plugin enables mathjax (http://www.mathjax.org) functionality for
...
...
@@ -60,6 +60,10 @@ MathJax-LaTeX is developed on
== Changelog ==
= 1.3.5 =
1. Add support for MathJax config via filter
= 1.3.4 =
1. PHP code cleanup
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment