Remove < PHP 4.3 compat functions from importers. Props nacin. Fixes #11636

git-svn-id: http://svn.automattic.com/wordpress/trunk@12985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2010-02-06 07:19:25 +00:00
parent 08e12373a5
commit 9961d7bf1b
3 changed files with 10 additions and 28 deletions

View File

@ -29,12 +29,6 @@ class BW_Import {
echo '</div>';
}
function unhtmlentities($string) { // From php.net for < 4.3 compat
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
function greet() {
echo '<div class="narrow">';
echo '<p>'.__('Howdy! This importer allows you to extract posts from Blogware XML export file into your blog. Pick a Blogware file to upload and click Import.').'</p>';
@ -78,18 +72,18 @@ class BW_Import {
$cat_index = 0;
foreach ($categories as $category) {
$categories[$cat_index] = $wpdb->escape($this->unhtmlentities($category));
$categories[$cat_index] = $wpdb->escape( html_entity_decode($category) );
$cat_index++;
}
if (strcasecmp($post_type, "photo") === 0) {
if ( strcasecmp($post_type, "photo") === 0 ) {
preg_match('|<sizedPhotoUrl>(.*?)</sizedPhotoUrl>|is', $post, $post_content);
$post_content = '<img src="'.trim($post_content[1]).'" />';
$post_content = $this->unhtmlentities($post_content);
$post_content = html_entity_decode( $post_content );
} else {
preg_match('|<body>(.*?)</body>|is', $post, $post_content);
$post_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($post_content[1]));
$post_content = $this->unhtmlentities($post_content);
$post_content = html_entity_decode( $post_content );
}
// Clean up content
@ -117,7 +111,7 @@ class BW_Import {
echo '</li>';
break;
}
if (0 != count($categories))
if ( 0 != count($categories) )
wp_create_categories($categories, $post_id);
}
@ -130,7 +124,7 @@ class BW_Import {
foreach ($comments as $comment) {
preg_match('|<body>(.*?)</body>|is', $comment, $comment_content);
$comment_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($comment_content[1]));
$comment_content = $this->unhtmlentities($comment_content);
$comment_content = html_entity_decode( $comment_content );
// Clean up content
$comment_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $comment_content);

View File

@ -30,12 +30,6 @@ class RSS_Import {
echo '</div>';
}
function unhtmlentities($string) { // From php.net for < 4.3 compat
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
function greet() {
echo '<div class="narrow">';
echo '<p>'.__('Howdy! This importer allows you to extract posts from an RSS 2.0 file into your blog. This is useful if you want to import your posts from a system that is not handled by a custom import tool. Pick an RSS file to upload and click Import.').'</p>';
@ -87,7 +81,7 @@ class RSS_Import {
$cat_index = 0;
foreach ($categories as $category) {
$categories[$cat_index] = $wpdb->escape($this->unhtmlentities($category));
$categories[$cat_index] = $wpdb->escape( html_entity_decode( $category ) );
$cat_index++;
}
@ -103,7 +97,7 @@ class RSS_Import {
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])));
$post_content = $wpdb->escape( html_entity_decode( trim( $post_content[1] ) ) );
}
// Clean up content

View File

@ -43,12 +43,6 @@ class WP_Import {
echo '</div>';
}
function unhtmlentities($string) { // From php.net for < 4.3 compat
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
function greet() {
echo '<div class="narrow">';
echo '<p>'.__('Howdy! Upload your WordPress eXtended RSS (WXR) file and we&#8217;ll import the posts, pages, comments, custom fields, categories, and tags into this blog.').'</p>';
@ -450,7 +444,7 @@ class WP_Import {
$tag_index = 0;
foreach ($tags as $tag) {
$tags[$tag_index] = $wpdb->escape($this->unhtmlentities(str_replace(array ('<![CDATA[', ']]>'), '', $tag)));
$tags[$tag_index] = $wpdb->escape( html_entity_decode( str_replace(array( '<![CDATA[', ']]>' ), '', $tag ) ) );
$tag_index++;
}
@ -459,7 +453,7 @@ class WP_Import {
$cat_index = 0;
foreach ($categories as $category) {
$categories[$cat_index] = $wpdb->escape($this->unhtmlentities(str_replace(array ('<![CDATA[', ']]>'), '', $category)));
$categories[$cat_index] = $wpdb->escape( html_entity_decode( str_replace( array( '<![CDATA[', ']]>' ), '', $category ) ) );
$cat_index++;
}