phillord / mathjax-latex

Wordpress Plugin for MathJax mathematics renderer
GNU General Public License v2.0
57 stars 12 forks source link

error activating Mathjax plugin in WordPress #15

Open reakoh opened 7 years ago

reakoh commented 7 years ago

Hello,

I'm new to using Mathjax and I'd like to try it on a wordpress.org webpage. I downloaded the plugin but it gives me an error when I try to activate it:

Plugin could not be activated because it triggered a fatal error. Parse error: syntax error, unexpected T_FUNCTION in /.../wp-content/plugins/mathjax-latex/mathjax-latex.php on line 235

Could somebody help with this please?

Kind Regards

phillord commented 7 years ago

Sorry for slow reply. Did you fix it?

reakoh commented 7 years ago

Yes thank you by replacing a couple of lines of code in the mathjax php file.

public static function filter_br_tags_on_math( $content ) {
    return preg_replace_callback(
        '/(<math.*>.*<\/math>)/isU',
        function ( $matches ) {
            return str_replace( array( '<br/>', '<br />', '<br>' ) , '' , $matches[0] );
        },
        $content
    );
}
paulschreiber commented 7 years ago

@reakoh What version of PHP are you using? What change did you make?