Support » Plugin: qTranslate X » incompatibility with 'PS Disable Auto Formatting'

  • Resolved side777

    (@side777)



    there’s an incompatibility with ‘PS Disable Auto Formatting’ and probably any other plugin adding filters to ‘the_editor_content’.

    the problem is: calling htmlspecialchars twice. this breaks the language comments.

    the solution: simply call htmlspecialchars with $double_encode = false to prevent double conversion. (http://php.net/htmlspecialchars)

    i just wrote a quick fix: just add this to qtranslate_utils.php and add it instead of ‘wp_htmledit_pre’ to ‘the_editor_content’:

    function qtranxf_htmledit_pre($output) {
    	if ( !empty($output) )
    		$output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ), false ); // convert only < > &
    	return apply_filters( 'htmledit_pre', $output );
    }

    (this is basically the same as core wp_htmledit_pre, just with double_encode off.)

    add the filter with a high priority to ensure it runs after any other filter added by plugins:
    add_filter('the_editor_content', 'qtranxf_htmledit_pre', 99);

    https://wordpress.org/plugins/qtranslate-x/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘incompatibility with 'PS Disable Auto Formatting'’ is closed to new replies.