MathJax support
- added MathJax support - removed google charts
This commit is contained in:
parent
dc6ac4f694
commit
aeb9afda34
7 changed files with 78 additions and 50 deletions
|
@ -491,20 +491,15 @@ function do_bbcode_img($action, $attributes, $content, $params, $node_object) {
|
|||
}
|
||||
|
||||
/**
|
||||
* processes BBCode tex
|
||||
* processes BBCode latex
|
||||
*/
|
||||
function do_bbcode_tex($action, $attributes, $content, $params, $node_object)
|
||||
{
|
||||
global $settings;
|
||||
if ($action == 'validate')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return '<img src="'.str_replace('&','&',$settings['bbcode_tex']).urlencode($content).'" alt="'.htmlspecialchars($content).'" />';
|
||||
}
|
||||
}
|
||||
function do_bbcode_tex($action, $attributes, $content, $params, $node_object) {
|
||||
//global $settings;
|
||||
if ($action == 'validate')
|
||||
return true;
|
||||
else
|
||||
return '<span class="tex2jax_process">$' . $content . '$</span>';
|
||||
}
|
||||
|
||||
/**
|
||||
* processes BBCode flash
|
||||
|
@ -1025,7 +1020,7 @@ function html_format($string)
|
|||
$bbcode->addCode ('flash', 'usecontent', 'do_bbcode_flash', array (), 'flash', array ('block', 'quote'), array ());
|
||||
#$bbcode->setCodeFlag ('flash', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT);
|
||||
}
|
||||
if($settings['bbcode_tex'])
|
||||
if($settings['bbcode_latex']==1 && !empty($settings['bbcode_latex_uri']))
|
||||
{
|
||||
$bbcode->addCode ('tex', 'usecontent', 'do_bbcode_tex', array (), 'tex', array ('listitem', 'block', 'inline', 'link', 'quote'), array ());
|
||||
}
|
||||
|
@ -1117,7 +1112,7 @@ function email_format($string)
|
|||
$bbcode->addCode ('inlinecode', 'simple_replace', null, array ('start_tag' => '', 'end_tag' => ''), 'inline', array ('listitem', 'block', 'inline', 'link', 'quote'), array ());
|
||||
$bbcode->addCode ('monospace', 'simple_replace', null, array ('start_tag' => '', 'end_tag' => ''), 'inline', array ('listitem', 'block', 'inline', 'link', 'quote'), array ());
|
||||
}
|
||||
if($settings['bbcode_tex'])
|
||||
if($settings['bbcode_latex']==1 && !empty($settings['bbcode_latex_uri']))
|
||||
{
|
||||
$bbcode->addCode ('tex', 'usecontent', 'do_bbcode_tex_email', array (), 'tex', array ('listitem', 'block', 'inline', 'link', 'quote'), array ());
|
||||
}
|
||||
|
|
|
@ -30,10 +30,10 @@ header('Content-type: application/javascript');
|
|||
|
||||
?>var lang = new Array();
|
||||
<?php if ($settings['ajax_preview']): ?>
|
||||
lang["ajax_preview_title"] = "<?php echo addslashes($lang['ajax_preview_title']); ?>";
|
||||
lang["close"] = "<?php echo addslashes($lang['close']); ?>";
|
||||
lang["no_text"] = "<?php echo addslashes($lang['no_text']); ?>";
|
||||
lang["reply_link"] = "<?php echo addslashes($lang['reply_link']); ?>";
|
||||
lang["ajax_preview_title"] = "<?php echo addslashes($lang['ajax_preview_title']); ?>";
|
||||
lang["close"] = "<?php echo addslashes($lang['close']); ?>";
|
||||
lang["no_text"] = "<?php echo addslashes($lang['no_text']); ?>";
|
||||
lang["reply_link"] = "<?php echo addslashes($lang['reply_link']); ?>";
|
||||
<?php endif; ?>
|
||||
lang["fold_threads"] = "<?php echo addslashes($lang['fold_threads']); ?>";
|
||||
lang["fold_threads_linktitle"] = "<?php echo addslashes($lang['fold_threads_linktitle']); ?>";
|
||||
|
@ -44,42 +44,42 @@ lang["fold_posting_title"] = "<?php echo addslashes($lang['fold_po
|
|||
lang["fold_postings"] = "<?php echo addslashes($lang['fold_postings']); ?>";
|
||||
lang["fold_postings_title"] = "<?php echo addslashes($lang['fold_postings_title']); ?>";
|
||||
<?php if(isset($user_type) && $user_type >= 0): ?>
|
||||
lang["drag_and_drop_title"] = "<?php echo addslashes($lang['drag_and_drop_title']); ?>";
|
||||
lang["drag_and_drop_title"] = "<?php echo addslashes($lang['drag_and_drop_title']); ?>";
|
||||
<?php endif; ?>
|
||||
<?php if($settings['entries_by_users_only']==0 || isset($user_type)): ?>
|
||||
lang["quote_label"] = "<?php echo addslashes($lang['quote_label']); ?>";
|
||||
lang["quote_title"] = "<?php echo addslashes($lang['quote_title']); ?>";
|
||||
<?php if($settings['bbcode']): ?>
|
||||
lang["bbcode_link_text"] = "<?php echo addslashes($lang['bbcode_link_text']); ?>";
|
||||
lang["bbcode_link_url"] = "<?php echo addslashes($lang['bbcode_link_url']); ?>";
|
||||
lang["bbcode_image_url"] = "<?php echo addslashes($lang['bbcode_image_url']); ?>";
|
||||
<?php if($settings['bbcode_tex']): ?>
|
||||
<?php endif; ?>
|
||||
lang["bbcode_tex_code"] = "<?php echo addslashes($lang['bbcode_tex_code']); ?>";
|
||||
<?php endif; ?>
|
||||
<?php if($settings['smilies']): ?>
|
||||
lang["more_smilies_label"] = "<?php echo addslashes($lang['more_smilies_label']); ?>";
|
||||
lang["more_smilies_title"] = "<?php echo addslashes($lang['more_smilies_title']); ?>";
|
||||
<?php endif; ?>
|
||||
lang["error_no_name"] = "<?php echo addslashes($lang['error_no_name']); ?>";
|
||||
lang["error_no_subject"] = "<?php echo addslashes($lang['error_no_subject']); ?>";
|
||||
lang["error_no_text"] = "<?php echo addslashes($lang['error_no_text']); ?>";
|
||||
lang["terms_of_use_error_posting"] = "<?php echo addslashes($lang['terms_of_use_error_posting']); ?>";
|
||||
lang["quote_label"] = "<?php echo addslashes($lang['quote_label']); ?>";
|
||||
lang["quote_title"] = "<?php echo addslashes($lang['quote_title']); ?>";
|
||||
<?php if($settings['bbcode']): ?>
|
||||
lang["bbcode_link_text"] = "<?php echo addslashes($lang['bbcode_link_text']); ?>";
|
||||
lang["bbcode_link_url"] = "<?php echo addslashes($lang['bbcode_link_url']); ?>";
|
||||
lang["bbcode_image_url"] = "<?php echo addslashes($lang['bbcode_image_url']); ?>";
|
||||
<?php endif; ?>
|
||||
<?php if($settings['bbcode_latex'] && !empty($settings['bbcode_latex_uri'])): ?>
|
||||
lang["bbcode_tex_code"] = "<?php echo addslashes($lang['bbcode_tex_code']); ?>";
|
||||
<?php endif; ?>
|
||||
<?php if($settings['smilies']): ?>
|
||||
lang["more_smilies_label"] = "<?php echo addslashes($lang['more_smilies_label']); ?>";
|
||||
lang["more_smilies_title"] = "<?php echo addslashes($lang['more_smilies_title']); ?>";
|
||||
<?php endif; ?>
|
||||
lang["error_no_name"] = "<?php echo addslashes($lang['error_no_name']); ?>";
|
||||
lang["error_no_subject"] = "<?php echo addslashes($lang['error_no_subject']); ?>";
|
||||
lang["error_no_text"] = "<?php echo addslashes($lang['error_no_text']); ?>";
|
||||
lang["terms_of_use_error_posting"] = "<?php echo addslashes($lang['terms_of_use_error_posting']); ?>";
|
||||
<?php endif; ?>
|
||||
<?php if(isset($user_type) && $user_type==0 && $settings['user_edit']>0 || !isset($user_type) && $settings['user_edit']==2): ?>
|
||||
lang["delete_posting_confirm"] = "<?php echo addslashes($lang['delete_posting_confirm']); ?>";
|
||||
lang["delete_posting_confirm"] = "<?php echo addslashes($lang['delete_posting_confirm']); ?>";
|
||||
<?php elseif(isset($user_type) && $user_type>0): ?>
|
||||
lang["delete_posting_confirm"] = "<?php echo addslashes($lang['delete_posting_replies_confirm']); ?>";
|
||||
lang["delete_posting_confirm"] = "<?php echo addslashes($lang['delete_posting_replies_confirm']); ?>";
|
||||
<?php endif; ?>
|
||||
<?php if(isset($user_type) && $user_type>0): ?>
|
||||
lang["mark_linktitle"] = "<?php echo addslashes($lang['mark_linktitle']); ?>";
|
||||
lang["unmark_linktitle"] = "<?php echo addslashes($lang['unmark_linktitle']); ?>";
|
||||
lang["mark_linktitle"] = "<?php echo addslashes($lang['mark_linktitle']); ?>";
|
||||
lang["unmark_linktitle"] = "<?php echo addslashes($lang['unmark_linktitle']); ?>";
|
||||
<?php endif; ?>
|
||||
<?php if(isset($user_type) && $user_type==2): ?>
|
||||
lang["check_all"] = "<?php echo addslashes($lang['check_all']); ?>";
|
||||
lang["uncheck_all"] = "<?php echo addslashes($lang['uncheck_all']); ?>";
|
||||
lang["delete_backup_confirm"] = "<?php echo addslashes($lang['delete_backup_confirm']); ?>";
|
||||
lang["delete_sel_backup_confirm"] = "<?php echo addslashes($lang['delete_sel_backup_confirm']); ?>";
|
||||
lang["check_all"] = "<?php echo addslashes($lang['check_all']); ?>";
|
||||
lang["uncheck_all"] = "<?php echo addslashes($lang['uncheck_all']); ?>";
|
||||
lang["delete_backup_confirm"] = "<?php echo addslashes($lang['delete_backup_confirm']); ?>";
|
||||
lang["delete_sel_backup_confirm"] = "<?php echo addslashes($lang['delete_sel_backup_confirm']); ?>";
|
||||
<?php endif; ?>
|
||||
|
||||
var settings = new Array();
|
||||
|
|
|
@ -56,7 +56,6 @@ INSERT INTO mlf2_settings VALUES ('bbcode_img', '1');
|
|||
INSERT INTO mlf2_settings VALUES ('bbcode_color', '1');
|
||||
INSERT INTO mlf2_settings VALUES ('bbcode_size', '1');
|
||||
INSERT INTO mlf2_settings VALUES ('bbcode_code', '0');
|
||||
INSERT INTO mlf2_settings VALUES ('bbcode_tex', '0');
|
||||
INSERT INTO mlf2_settings VALUES ('bbcode_flash', '0');
|
||||
INSERT INTO mlf2_settings VALUES ('flash_default_width', '425');
|
||||
INSERT INTO mlf2_settings VALUES ('flash_default_height', '344');
|
||||
|
@ -139,6 +138,9 @@ INSERT INTO mlf2_settings VALUES ('ajax_preview', '1');
|
|||
INSERT INTO mlf2_settings VALUES ('read_state_expiration_value', '500');
|
||||
INSERT INTO mlf2_settings VALUES ('read_state_expiration_method', '0');
|
||||
INSERT INTO mlf2_settings VALUES ('uploads_per_page', '20');
|
||||
INSERT INTO mlf2_settings VALUES ('bbcode_latex', '0');
|
||||
INSERT INTO mlf2_settings VALUES ('bbcode_latex_uri', 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_CHTML.js');
|
||||
|
||||
|
||||
INSERT INTO mlf2_smilies VALUES (1, 1, 'smile.png', ':-)', '', '', '', '', '');
|
||||
INSERT INTO mlf2_smilies VALUES (2, 2, 'wink.png', ';-)', '', '', '', '', '');
|
||||
|
|
|
@ -39,9 +39,26 @@
|
|||
{if $mode=='admin'}
|
||||
<script src="{$FORUM_ADDRESS}/js/admin.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
{/if}
|
||||
{if $settings.bbcode_latex && $settings.bbcode_latex_uri}
|
||||
<script type="text/javascript" async src="{$settings.bbcode_latex_uri}"></script>
|
||||
<script type="text/x-mathjax-config">/*<![CDATA[*/MathJax.Hub.Config({
|
||||
tex2jax: {
|
||||
inlineMath: [ ["$","$"], ["\\(","\\)"] ],
|
||||
displayMath: [ ["$$","$$"], ["\\[","\\]"] ],
|
||||
ignoreClass: "tex2jax_ignore",
|
||||
processClass: "tex2jax_process",
|
||||
processEscapes: true
|
||||
},
|
||||
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "AMS" }
|
||||
}
|
||||
});
|
||||
/*!]]>*/</script>
|
||||
{/if}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body class="tex2jax_ignore">
|
||||
<!--[if IE]><div id="ie"><![endif]-->
|
||||
|
||||
<div id="top">
|
||||
|
|
|
@ -200,7 +200,7 @@ JavaScript isn't available.
|
|||
<dt id="flash" title="{#bbcode_flash_label#}">{#bbcode_flash_title#}</dt>
|
||||
<dd>{#bbcode_flash_instruction#}</dd>
|
||||
{/if}
|
||||
{if $settings.bbcode_tex}
|
||||
{if $settings.bbcode_latex}
|
||||
<dt id="tex" title="{#bbcode_tex_label#}">{#bbcode_tex_title#}</dt>
|
||||
<dd>{#bbcode_tex_instruction#}</dd>
|
||||
{/if}
|
||||
|
|
|
@ -364,7 +364,12 @@ CREATE TABLE mlf2_tags (`id` int(11) NOT NULL AUTO_INCREMENT, `tag` varchar(255)
|
|||
|
||||
*/
|
||||
--------------------------------------------------------------------------------
|
||||
-- 2.4.8 to 2.5
|
||||
-- 2.4.8 to 2.4.9
|
||||
/*
|
||||
INSERT INTO mlf2_settings (`name`, `value`) VALUES ('uploads_per_page', '20');
|
||||
*/
|
||||
--------------------------------------------------------------------------------
|
||||
-- 2.4.9 to 2.5
|
||||
/*
|
||||
INSERT INTO `mlf2_settings` (`name`, `value`) VALUES ('bbcode_latex', '0'), ('bbcode_latex_uri', 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_CHTML.js');
|
||||
*/
|
||||
|
|
|
@ -96,6 +96,15 @@ if (empty($update['errors']) && in_array($settings['version'], array('2.4.8')))
|
|||
}
|
||||
}
|
||||
|
||||
if (empty($update['errors']) && in_array($settings['version'], array('2.4.9'))) {
|
||||
if(!@mysqli_query($connid, "INSERT INTO `".$db_settings['settings_table']."` (`name`, `value`) ('bbcode_latex', '0'), ('bbcode_latex_uri', 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_CHTML.js');")) {
|
||||
$update['errors'][] = 'Database error in line '.__LINE__.': ' . mysqli_error($connid);
|
||||
}
|
||||
if(!@mysqli_query($connid, "DELETE FROM `".$db_settings['settings_table']."` WHERE name = 'bbcode_tex';")) {
|
||||
$update['errors'][] = 'Database error in line '.__LINE__.': ' . mysqli_error($connid);
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($update['errors'])) {
|
||||
if(!@mysqli_query($connid, "UPDATE ".$db_settings['settings_table']." SET value='". mysqli_real_escape_string($connid, $newVersion) ."' WHERE name = 'version'")) {
|
||||
$update['errors'][] = 'Database error in line '.__LINE__.': ' . mysqli_error($connid);
|
||||
|
|
Loading…
Add table
Reference in a new issue