Skip to content

Commit

Permalink
Export valid XML by escaping the closing CDATA sequence "]]>". Props …
Browse files Browse the repository at this point in the history
…ceefour. See #15203.

git-svn-id: http://svn.automattic.com/wordpress/trunk@19858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
duck_ committed Feb 7, 2012
1 parent c1f604e commit 6f343f7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion wp-admin/includes/export.php
Expand Up @@ -117,13 +117,14 @@ function export_wp( $args = array() ) {
* @since 2.1.0
*
* @param string $str String to wrap in XML CDATA tag.
* @return string
*/
function wxr_cdata( $str ) {
if ( seems_utf8( $str ) == false )
$str = utf8_encode( $str );

// $str = ent2ncr(esc_html($str));
$str = "<![CDATA[$str" . ( ( substr( $str, -1 ) == ']' ) ? ' ' : '' ) . ']]>';
$str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>';

return $str;
}
Expand Down

0 comments on commit 6f343f7

Please sign in to comment.