[wp-trac] [WordPress Trac] #6269: RSS Import Doesn't Properly Strip
CDATA Tags
WordPress Trac
wp-trac at lists.automattic.com
Tue Mar 18 00:58:13 GMT 2008
#6269: RSS Import Doesn't Properly Strip CDATA Tags
-----------------------+----------------------------------------------------
Reporter: sweetdeal | Owner: anonymous
Type: defect | Status: new
Priority: low | Milestone: 2.5
Component: General | Version: 2.3.3
Severity: minor | Keywords: rss, import
-----------------------+----------------------------------------------------
When importing an RSS feed that uses the <description> tag as opposed to
<content:encoded>, I noticed that WP's RSS import doesn't strip the CDATA
tags as it does for the <content:encoded>.
=========Code Lines (83-87)===============
{{{
if (!$post_content) {
// This is for feeds that put content in description
preg_match('|<description>(.*?)</description>|is', $post, $post_content);
$post_content =
$wpdb->escape($this->unhtmlentities(trim($post_content[1])));
}
}}}
=====================================
I tweaked the code to solve the problem (see below)
==========Tweaked Code===============
{{{
if (!$post_content) {
// This is for feeds that put content in description
preg_match('|<description>(.*?)</description>|is', $post, $post_content);
$post_content = str_replace(array ('<![CDATA[', ']]>'),
'',$wpdb->escape($this->unhtmlentities(trim($post_content[1]))));
}
}}}
======================================
I'd be happy to submit a patch, except I'm not quite that savvy yet. It
would be great it someone could incorporate it. Thanks.
--
Ticket URL: <http://trac.wordpress.org/ticket/6269>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list