From 96578ed6b87c41985b6f493b42bdf1698c4ec293 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sat, 6 Feb 2010 07:19:25 +0000 Subject: [PATCH] Remove < PHP 4.3 compat functions from importers. Props nacin. Fixes #11636 git-svn-id: https://develop.svn.wordpress.org/trunk@12985 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/import/blogware.php | 18 ++++++------------ wp-admin/import/rss.php | 10 ++-------- wp-admin/import/wordpress.php | 10 ++-------- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/wp-admin/import/blogware.php b/wp-admin/import/blogware.php index 5497bfb6d4..319c4fbec1 100644 --- a/wp-admin/import/blogware.php +++ b/wp-admin/import/blogware.php @@ -29,12 +29,6 @@ class BW_Import { echo ''; } - 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 '
'; echo '

'.__('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.').'

'; @@ -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('|(.*?)|is', $post, $post_content); $post_content = ''; - $post_content = $this->unhtmlentities($post_content); + $post_content = html_entity_decode( $post_content ); } else { preg_match('|(.*?)|is', $post, $post_content); $post_content = str_replace(array (''), '', 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 ''; 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('|(.*?)|is', $comment, $comment_content); $comment_content = str_replace(array (''), '', 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); diff --git a/wp-admin/import/rss.php b/wp-admin/import/rss.php index 214b5ff3b7..95261a615a 100644 --- a/wp-admin/import/rss.php +++ b/wp-admin/import/rss.php @@ -30,12 +30,6 @@ class RSS_Import { echo '
'; } - 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 '
'; echo '

'.__('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.').'

'; @@ -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('|(.*?)|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 diff --git a/wp-admin/import/wordpress.php b/wp-admin/import/wordpress.php index d1f4b8adcf..4c12c0003c 100644 --- a/wp-admin/import/wordpress.php +++ b/wp-admin/import/wordpress.php @@ -43,12 +43,6 @@ class WP_Import { echo '
'; } - 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 '
'; echo '

'.__('Howdy! Upload your WordPress eXtended RSS (WXR) file and we’ll import the posts, pages, comments, custom fields, categories, and tags into this blog.').'

'; @@ -450,7 +444,7 @@ class WP_Import { $tag_index = 0; foreach ($tags as $tag) { - $tags[$tag_index] = $wpdb->escape($this->unhtmlentities(str_replace(array (''), '', $tag))); + $tags[$tag_index] = $wpdb->escape( html_entity_decode( str_replace(array( '' ), '', $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 (''), '', $category))); + $categories[$cat_index] = $wpdb->escape( html_entity_decode( str_replace( array( '' ), '', $category ) ) ); $cat_index++; }