芝麻web文件管理V1.00
编辑当前文件:/home/freeclou/optimyar/wp-content/plugins/mathjax-latex/class-mathjax-latex.php
[ 'class', 'id', 'style', 'dir', 'href', 'mathbackground', 'mathcolor', 'display', 'overflow', 'xmlns' ], 'maction' => [ 'actiontype', 'class', 'id', 'style', 'href', 'mathbackground', 'mathcolor', 'selection' ], 'maligngroup' => [], 'malignmark' => [], 'menclose' => [ 'class', 'id', 'style', 'href', 'mathbackground', 'mathcolor', 'notation' ], 'merror' => [ 'class', 'id', 'style', 'href', 'mathbackground', 'mathcolor' ], 'mfenced' => [ 'class', 'id', 'style', 'close', 'href', 'mathbackground', 'mathcolor', 'open', 'separators' ], 'mfrac' => [ 'bevelled', 'class', 'id', 'style', 'denomalign', 'href', 'linethickness', 'mathbackground', 'mathcolor', 'numalign' ], 'mglyph' => [ 'alt', 'class', 'id', 'style', 'height', 'href', 'mathbackground', 'src', 'valign', 'width' ], 'mi' => [ 'class', 'id', 'style', 'href', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant' ], 'mlabeledtr' => [ 'class', 'id', 'style', 'columnalign', 'groupalign', 'href', 'mathbackground', 'mathcolor', 'rowalign' ], 'mlongdiv' => [], 'mmultiscripts' => [ 'class', 'id', 'style', 'href', 'mathbackground', 'mathcolor', 'subscriptshift', 'superscriptshift' ], 'mn' => [ 'class', 'id', 'style', 'dir', 'href', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant' ], 'mo' => [ 'accent', 'class', 'id', 'style', 'dir', 'fence', 'form', 'href', 'largeop', 'lspace', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'moveablelimits', 'rspace', 'separator', 'stretchy', 'symmetric' ], 'mover' => [ 'accent', 'align', 'class', 'id', 'style', 'href', 'mathbackground', 'mathcolor' ], 'mpadded' => [ 'class', 'id', 'style', 'depth', 'height', 'href', 'lspace', 'mathbackground', 'mathcolor', 'voffset', 'width' ], 'mphantom' => [ 'class', 'id', 'style', 'mathbackground' ], 'mroot' => [ 'class', 'id', 'style', 'href', 'mathbackground', 'mathcolor' ], 'mrow' => [ 'class', 'id', 'style', 'dir', 'href', 'mathbackground', 'mathcolor' ], 'ms' => [ 'class', 'id', 'style', 'dir', 'lquote', 'href', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'rquote' ], 'mscarries' => [], 'mscarry' => [], 'msgroup' => [], 'msline' => [], 'mspace' => [ 'class', 'id', 'style', 'depth', 'height', 'linebreak', 'mathbackground', 'width' ], 'msqrt' => [ 'class', 'id', 'style', 'href', 'mathbackground', 'mathcolor' ], 'msrow' => [], 'mstack' => [], 'mstyle' => [ 'dir', 'decimalpoint', 'displaystyle', 'infixlinebreakstyle', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier' ], 'msub' => [ 'class', 'id', 'style', 'mathbackground', 'mathcolor', 'subscriptshift' ], 'msubsup' => [ 'class', 'id', 'style', 'href', 'mathbackground', 'mathcolor', 'subscriptshift', 'superscriptshift' ], 'msup' => [ 'class', 'id', 'style', 'href', 'mathbackground', 'mathcolor', 'superscriptshift' ], 'mtable' => [ 'class', 'id', 'style', 'align', 'alignmentscope', 'columnalign', 'columnlines', 'columnspacing', 'columnwidth', 'displaystyle', 'equalcolumns', 'equalrows', 'frame', 'framespacing', 'groupalign', 'href', 'mathbackground', 'mathcolor', 'minlabelspacing', 'rowalign', 'rowlines', 'rowspacing', 'side', 'width' ], 'mtd' => [ 'class', 'id', 'style', 'columnalign', 'columnspan', 'groupalign', 'href', 'mathbackground', 'mathcolor', 'rowalign', 'rowspan' ], 'mtext' => [ 'class', 'id', 'style', 'dir', 'href', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant' ], 'mtr' => [ 'class', 'id', 'style', 'columnalign', 'groupalign', 'href', 'mathbackground', 'mathcolor', 'rowalign' ], 'munder' => [ 'accentunder', 'align', 'class', 'id', 'style', 'mathbackground', 'mathcolor' ], 'munderover' => [ 'accent', 'accentunder', 'align', 'class', 'id', 'style', 'href', 'mathbackground', 'mathcolor' ], 'semantics' => [ 'definitionURL', 'encoding', 'cd', 'name', 'src' ], 'annotation' => [ 'definitionURL', 'encoding', 'cd', 'name', 'src' ], 'annotation-xml' => [ 'definitionURL', 'encoding', 'cd', 'name', 'src' ], ]; /** * Register actions and filters. */ public static function init() { register_activation_hook( __FILE__, [ __CLASS__, 'mathjax_install' ] ); register_deactivation_hook( __FILE__, [ __CLASS__, 'mathjax_uninstall' ] ); if ( get_option( 'kblog_mathjax_force_load' ) ) { self::$add_script = true; } add_shortcode( 'mathjax', [ __CLASS__, 'mathjax_shortcode' ] ); add_shortcode( 'nomathjax', [ __CLASS__, 'nomathjax_shortcode' ] ); add_shortcode( 'latex', [ __CLASS__, 'latex_shortcode' ] ); add_action( 'wp_footer', [ __CLASS__, 'add_script' ] ); add_filter( 'script_loader_tag', [ __CLASS__, 'script_loader_tag' ], 10, 3 ); if ( get_option( 'kblog_mathjax_use_wplatex_syntax' ) ) { add_filter( 'the_content', [ __CLASS__, 'inline_to_shortcode' ] ); } add_filter( 'plugin_action_links', [ __CLASS__, 'mathjax_settings_link' ], 9, 2 ); add_filter( 'the_content', [ __CLASS__, 'filter_br_tags_on_math' ] ); add_action( 'init', [ __CLASS__, 'allow_mathml_tags' ] ); add_filter( 'tiny_mce_before_init', [ __CLASS__, 'allow_mathml_tags_in_tinymce' ] ); } /** * Registers default options. */ public static function mathjax_install() { add_option( 'kblog_mathjax_force_load', false ); add_option( 'kblog_mathjax_latex_inline', 'inline' ); add_option( 'kblog_mathjax_use_wplatex_syntax', false ); add_option( 'kblog_mathjax_use_cdn', true ); add_option( 'kblog_mathjax_custom_location', false ); add_option( 'kblog_mathjax_config', 'default' ); } /** * Removes default options. */ public static function mathjax_uninstall() { delete_option( 'kblog_mathjax_force_load' ); delete_option( 'kblog_mathjax_latex_inline' ); delete_option( 'kblog_mathjax_use_wplatex_syntax' ); delete_option( 'kblog_mathjax_use_cdn' ); delete_option( 'kblog_mathjax_custom_location' ); delete_option( 'kblog_mathjax_config' ); } /** * Set flag to load [mathjax] shortcode. * * @param array $atts Shortcode attributes. * @param string $content Shortcode content. */ public static function mathjax_shortcode( $atts, $content ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed self::$add_script = true; } /** * Set flag to load [nomathjax] shortcode. * * @param array $atts Shortcode attributes. * @param string $content Shortcode content. */ public static function nomathjax_shortcode( $atts, $content ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed self::$block_script = true; } /** * Enable [latex] shortcode. * * @param array $atts Shortcode attributes. * @param string $content Shortcode content. */ public static function latex_shortcode( $atts, $content ) { self::$add_script = true; // This gives us an optional "syntax" attribute, which defaults to "inline", but can also be "display". $shortcode_atts = shortcode_atts( [ 'syntax' => get_option( 'kblog_mathjax_latex_inline' ), ], $atts ); if ( 'inline' === $shortcode_atts['syntax'] ) { return '\(' . $content . '\)'; } elseif ( 'display' === $shortcode_atts['syntax'] ) { return '\[' . $content . '\]'; } } /** * Enqueue/add the JavaScript to the tag. */ public static function add_script() { if ( ! self::$add_script ) { return; } if ( self::$block_script ) { return; } // 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/' . MATHJAX_JS_VERSION . '/MathJax.js'; } else { $mathjax_location = get_option( 'kblog_mathjax_custom_location' ); } $config = get_option( 'kblog_mathjax_config' ); if ( ! $config ) { $config = 'default'; } $mathjax_url = add_query_arg( 'config', $config, $mathjax_location ); wp_enqueue_script( 'mathjax', $mathjax_url, false, MATHJAX_PLUGIN_VERSION, false ); $mathjax_config = apply_filters( 'mathjax_config', [] ); 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 `