WordPress.org

Make WordPress Core

Changeset 33187


Ignore:
Timestamp:
07/13/2015 03:18:47 AM (6 years ago)
Author:
azaozz
Message:

TinyMCE:

  • Go back to encoding the editor content only when TinyMCE is used.
  • Add check and encode </textarea> if present.

See #32425.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-editor.php

    r33127 r33187  
    252252            'id="' . $editor_id_attr . '">%s</textarea></div>' );
    253253
     254        // Prepare the content for the Visual or Text editor
     255        if ( self::$this_tinymce ) {
     256            add_filter( 'the_editor_content', 'format_for_editor', 10, 2 );
     257        }
     258
    254259        /**
    255260         * Filter the default editor content.
     
    269274            _deprecated_function( 'add_filter( richedit_pre )', '4.3.0', 'add_filter( format_for_editor )' );
    270275            $content = apply_filters( 'richedit_pre', $content );
     276        }
     277
     278        if ( false !== stripos( $content, 'textarea' ) ) {
     279            $content = preg_replace( '%</textarea%i', '&lt;/textarea', $content );
    271280        }
    272281
  • trunk/src/wp-includes/default-filters.php

    r33042 r33187  
    203203
    204204add_filter( 'http_request_host_is_external', 'allowed_http_request_hosts', 10, 2 );
    205 
    206 // Prepare the content for the Visual or Text editor
    207 add_filter( 'the_editor_content', 'format_for_editor', 10, 2 );
    208205
    209206// Actions
  • trunk/src/wp-includes/formatting.php

    r33148 r33187  
    30883088 */
    30893089function format_for_editor( $text, $default_editor = null ) {
    3090     // Back-compat: check if any characters need encoding.
    3091     if ( ! empty( $text ) && ( false !== strpos( $text, '<' ) || false !== strpos( $text, '>' ) ||
    3092         preg_match( '/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', $text ) ) ) {
    3093 
     3090    if ( $text ) {
    30943091        $text = htmlspecialchars( $text, ENT_NOQUOTES, get_option( 'blog_charset' ) );
    30953092    }
Note: See TracChangeset for help on using the changeset viewer.