Export valid XML by escaping the closing CDATA sequence "]]>". Props ceefour. See #15203.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c1f604e78e
commit
6f343f700f
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue