WordPress.org

Make WordPress Core

Changeset 19858


Ignore:
Timestamp:
02/07/12 21:48:45 (2 years ago)
Author:
duck_
Message:

Export valid XML by escaping the closing CDATA sequence "]]>". Props ceefour. See #15203.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/export.php

    r19784 r19858  
    118118     * 
    119119     * @param string $str String to wrap in XML CDATA tag. 
     120     * @return string 
    120121     */ 
    121122    function wxr_cdata( $str ) { 
     
    124125 
    125126        // $str = ent2ncr(esc_html($str)); 
    126         $str = "<![CDATA[$str" . ( ( substr( $str, -1 ) == ']' ) ? ' ' : '' ) . ']]>'; 
     127        $str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>'; 
    127128 
    128129        return $str; 
Note: See TracChangeset for help on using the changeset viewer.