- Go back to encoding the editor content only when TinyMCE is used.
- Add check and encode `</textarea>` if present.
See #32425.
Built from https://develop.svn.wordpress.org/trunk@33187


git-svn-id: http://core.svn.wordpress.org/trunk@33159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2015-07-13 03:19:24 +00:00
parent a5f6dd3ea1
commit 4bd5e2db01
4 changed files with 11 additions and 8 deletions

View File

@ -251,6 +251,11 @@ final class _WP_Editors {
'<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . esc_attr( $set['textarea_name'] ) . '" ' .
'id="' . $editor_id_attr . '">%s</textarea></div>' );
// Prepare the content for the Visual or Text editor
if ( self::$this_tinymce ) {
add_filter( 'the_editor_content', 'format_for_editor', 10, 2 );
}
/**
* Filter the default editor content.
*
@ -270,6 +275,10 @@ final class _WP_Editors {
$content = apply_filters( 'richedit_pre', $content );
}
if ( false !== stripos( $content, 'textarea' ) ) {
$content = preg_replace( '%</textarea%i', '&lt;/textarea', $content );
}
printf( $the_editor, $content );
echo "\n</div>\n\n";

View File

@ -203,9 +203,6 @@ add_filter( 'title_save_pre', 'trim' );
add_filter( 'http_request_host_is_external', 'allowed_http_request_hosts', 10, 2 );
// Prepare the content for the Visual or Text editor
add_filter( 'the_editor_content', 'format_for_editor', 10, 2 );
// Actions
add_action( 'wp_head', '_wp_render_title_tag', 1 );
add_action( 'wp_head', 'wp_enqueue_scripts', 1 );

View File

@ -3087,10 +3087,7 @@ function ent2ncr( $text ) {
* @return string The formatted text after filter is applied.
*/
function format_for_editor( $text, $default_editor = null ) {
// Back-compat: check if any characters need encoding.
if ( ! empty( $text ) && ( false !== strpos( $text, '<' ) || false !== strpos( $text, '>' ) ||
preg_match( '/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', $text ) ) ) {
if ( $text ) {
$text = htmlspecialchars( $text, ENT_NOQUOTES, get_option( 'blog_charset' ) );
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-beta2-33186';
$wp_version = '4.3-beta2-33187';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.