Export valid XML by escaping the closing CDATA sequence "]]>". Props ceefour. See #15203.
git-svn-id: https://develop.svn.wordpress.org/trunk@19858 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
7cd04da2e6
commit
7efe34d79d
@ -117,13 +117,14 @@ function export_wp( $args = array() ) {
|
|||||||
* @since 2.1.0
|
* @since 2.1.0
|
||||||
*
|
*
|
||||||
* @param string $str String to wrap in XML CDATA tag.
|
* @param string $str String to wrap in XML CDATA tag.
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
function wxr_cdata( $str ) {
|
function wxr_cdata( $str ) {
|
||||||
if ( seems_utf8( $str ) == false )
|
if ( seems_utf8( $str ) == false )
|
||||||
$str = utf8_encode( $str );
|
$str = utf8_encode( $str );
|
||||||
|
|
||||||
// $str = ent2ncr(esc_html($str));
|
// $str = ent2ncr(esc_html($str));
|
||||||
$str = "<![CDATA[$str" . ( ( substr( $str, -1 ) == ']' ) ? ' ' : '' ) . ']]>';
|
$str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>';
|
||||||
|
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user