[wp-trac] Re: [WordPress Trac] #3670: Removing CDATA close tag (
]]> ) unbalances the CDATA block
WordPress Trac
wp-trac at lists.automattic.com
Mon Feb 12 07:23:00 GMT 2007
#3670: Removing CDATA close tag ( ]]> ) unbalances the CDATA block
----------------------------+-----------------------------------------------
Reporter: scenic | Owner: anonymous
Type: defect | Status: new
Priority: low | Milestone: 2.1.1
Component: Administration | Version: 2.1
Severity: normal | Resolution:
Keywords: dev-feedback |
----------------------------+-----------------------------------------------
Comment (by andy):
{{{
function wp_cdata($data) {
// Maybe test for conditions necessitating
// CDATA markers and return if no need
$data = str_replace('<![CDATA[', '', $data);
$data = str_replace(']]>', '', $data);
// Sometimes a trailing square bracket
// can mess up XML parsers:
if ( substr($data, -1) == ']' )
$data .= ' ';
return "<![CDATA[$data]]>';
}
}}}
--
Ticket URL: <http://trac.wordpress.org/ticket/3670#comment:7>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list