### Eclipse Workspace Patch 1.0
#P wordpress-trunk
Index: wp-admin/import/blogware.php
===================================================================
--- wp-admin/import/blogware.php	(revision 12551)
+++ wp-admin/import/blogware.php	(working copy)
@@ -8,6 +8,8 @@
  * @link http://www.theshayne.com/
  */
 
+include_once( dirname( __FILE__ ) . '/base.php' );
+
 /**
  * Blogware XML Importer class
  *
@@ -15,7 +17,7 @@
  *
  * @since unknown
  */
-class BW_Import {
+class BW_Import extends Base_Import {
 
 	var $file;
 
@@ -25,16 +27,6 @@
 		echo '<h2>'.__('Import Blogware').'</h2>';
 	}
 
-	function footer() {
-		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>';
@@ -42,10 +34,6 @@
 		echo '</div>';
 	}
 
-	function _normalize_tag( $matches ) {
-		return '<' . strtolower( $matches[1] );
-	}
-
 	function import_posts() {
 		global $wpdb, $current_user;
 
Index: wp-admin/import/wordpress.php
===================================================================
--- wp-admin/import/wordpress.php	(revision 12551)
+++ wp-admin/import/wordpress.php	(working copy)
@@ -6,6 +6,8 @@
  * @subpackage Importer
  */
 
+include_once( dirname( __FILE__ ) . '/base.php' );
+
 /**
  * WordPress Importer
  *
@@ -14,7 +16,7 @@
  *
  * @since unknown
  */
-class WP_Import {
+class WP_Import extends Base_Import {
 
 	var $post_ids_processed = array ();
 	var $orphans = array ();
@@ -39,16 +41,6 @@
 		echo '<h2>'.__('Import WordPress').'</h2>';
 	}
 
-	function footer() {
-		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>';
@@ -406,10 +398,6 @@
 		echo '<h3>'.sprintf(__('All done.').' <a href="%s">'.__('Have fun!').'</a>', get_option('home')).'</h3>';
 	}
 
-	function _normalize_tag( $matches ) {
-		return '<' . strtolower( $matches[1] );
-	}
-
 	function process_post($post) {
 		global $wpdb;
 
Index: wp-admin/import/base.php
===================================================================
--- wp-admin/import/base.php	(revision 0)
+++ wp-admin/import/base.php	(revision 0)
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Base Importer class
+ *
+ * @package WordPress
+ * @subpackage Importer
+ * @author Hakre
+ * @link http://codex.wordpress.org/User:Hakre 
+ */
+
+/**
+ * Base Importer class
+ *
+ * This is an 'abstract' class, intended to be 
+ * used for extension.
+ *
+ * @since 3.0
+ */
+class Base_Import {
+
+	/**
+	 * unhtmlentities
+	 * 
+	 * @param  string $string string containing html entities
+	 * @return string string the htmlentities replaced
+	 */
+	function unhtmlentities( $string ) {				
+		$string    = wp_kses_decode_entities( $string );
+		
+		$trans_tbl = get_html_translation_table( HTML_ENTITIES );				
+		$trans_tbl = array_flip( $trans_tbl );
+
+		return strtr( $string, $trans_tbl );
+	}
+
+	/**
+	 * footer
+	 * 
+	 * @return string
+	 */
+	function footer(  ) {		
+		echo( '</div>' );		
+	}
+	
+	/**
+	 * normalize tag
+	 * 
+	 * usage:
+	 * preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_excerpt);
+	 * 
+	 * @param  array  $matches
+	 * @return string
+	 */
+	function _normalize_tag( $matches ) {		
+		return '<' . strtolower( $matches[1] );		
+	}
+
+} // class Base_Import
\ No newline at end of file
Index: wp-admin/import/rss.php
===================================================================
--- wp-admin/import/rss.php	(revision 12551)
+++ wp-admin/import/rss.php	(working copy)
@@ -6,6 +6,8 @@
  * @subpackage Importer
  */
 
+include_once( dirname( __FILE__ ) . '/base.php' );
+
 /**
  * RSS Importer
  *
@@ -15,7 +17,7 @@
  *
  * @since unknown
  */
-class RSS_Import {
+class RSS_Import extends Base_Import {
 
 	var $posts = array ();
 	var $file;
@@ -26,16 +28,6 @@
 		echo '<h2>'.__('Import RSS').'</h2>';
 	}
 
-	function footer() {
-		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>';
@@ -43,10 +35,6 @@
 		echo '</div>';
 	}
 
-	function _normalize_tag( $matches ) {
-		return '<' . strtolower( $matches[1] );
-	}
-
 	function get_posts() {
 		global $wpdb;
 
