diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php index 57fc06657e..dacc6f6a45 100644 --- a/wp-admin/import/blogger.php +++ b/wp-admin/import/blogger.php @@ -529,6 +529,10 @@ class Blogger_Import { return preg_replace( '|\s+|', ' ', $string ); } + function _normalize_tag( $matches ) { + return '<' . strtolower( $match[1] ); + } + function import_post( $entry ) { global $importing_blog; @@ -551,7 +555,7 @@ class Blogger_Import { $post_status = isset( $entry->draft ) ? 'draft' : 'publish'; // Clean up content - $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content); + $post_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content); $post_content = str_replace('
', '
', $post_content); $post_content = str_replace('
', '
', $post_content); @@ -604,7 +608,7 @@ class Blogger_Import { $comment_content = addslashes( $this->no_apos( @html_entity_decode( $entry->content, ENT_COMPAT, get_option('blog_charset') ) ) ); // Clean up content - $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $comment_content); + $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $comment_content); $comment_content = str_replace('
', '
', $comment_content); $comment_content = str_replace('
', '
', $comment_content); @@ -905,10 +909,19 @@ class AtomParser { var $entry; function AtomParser() { - $this->entry = new AtomEntry(); - $this->map_attrs_func = create_function('$k,$v', 'return "$k=\"$v\"";'); - $this->map_xmlns_func = create_function('$p,$n', '$xd = "xmlns"; if(strlen($n[0])>0) $xd .= ":{$n[0]}"; return "{$xd}=\"{$n[1]}\"";'); + } + + function _map_attrs_func( $k, $v ) { + return "$k=\"$v\""; + } + + function _map_xmlns_func( $p, $n ) { + $xd = "xmlns"; + if ( strlen( $n[0] ) > 0 ) + $xd .= ":{$n[0]}"; + + return "{$xd}=\"{$n[1]}\""; } function parse($xml) { @@ -950,12 +963,12 @@ class AtomParser { foreach($attrs as $key => $value) { $attrs_prefix[$this->ns_to_prefix($key)] = $this->xml_escape($value); } - $attrs_str = join(' ', array_map($this->map_attrs_func, array_keys($attrs_prefix), array_values($attrs_prefix))); + $attrs_str = join(' ', array_map( array( &$this, '_map_attrs_func' ), array_keys($attrs_prefix), array_values($attrs_prefix))); if(strlen($attrs_str) > 0) { $attrs_str = " " . $attrs_str; } - $xmlns_str = join(' ', array_map($this->map_xmlns_func, array_keys($this->ns_contexts[0]), array_values($this->ns_contexts[0]))); + $xmlns_str = join(' ', array_map( array( &$this, '_map_xmlns_func' ), array_keys($this->ns_contexts[0]), array_values($this->ns_contexts[0]))); if(strlen($xmlns_str) > 0) { $xmlns_str = " " . $xmlns_str; } diff --git a/wp-admin/import/blogware.php b/wp-admin/import/blogware.php index 500a08ba24..369d03d41c 100644 --- a/wp-admin/import/blogware.php +++ b/wp-admin/import/blogware.php @@ -42,6 +42,10 @@ class BW_Import { echo ''; } + function _normalize_tag( $matches ) { + return '<' . strtolower( $match[1] ); + } + function import_posts() { global $wpdb, $current_user; @@ -89,7 +93,7 @@ class BW_Import { } // Clean up content - $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content); + $post_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content); $post_content = str_replace('
', '
', $post_content); $post_content = str_replace('
', '
', $post_content); $post_content = $wpdb->escape($post_content); @@ -129,7 +133,7 @@ class BW_Import { $comment_content = $this->unhtmlentities($comment_content); // Clean up content - $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $comment_content); + $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $comment_content); $comment_content = str_replace('
', '
', $comment_content); $comment_content = str_replace('
', '
', $comment_content); $comment_content = $wpdb->escape($comment_content); diff --git a/wp-admin/import/livejournal.php b/wp-admin/import/livejournal.php index bfebe718b9..d51bfc71f6 100644 --- a/wp-admin/import/livejournal.php +++ b/wp-admin/import/livejournal.php @@ -324,6 +324,10 @@ class LJ_API_Import { echo ''; } + function _normalize_tag( $matches ) { + return '<' . strtolower( $match[1] ); + } + function import_post( $post ) { global $wpdb; @@ -350,7 +354,7 @@ class LJ_API_Import { // Clean up content $post_content = $post['event']; - $post_content = preg_replace_callback( '|<(/?[A-Z]+)|', create_function( '$match', 'return "<" . strtolower( $match[1] );' ), $post_content ); + $post_content = preg_replace_callback( '|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content ); // XHTMLize some tags $post_content = str_replace( '
', '
', $post_content ); $post_content = str_replace( '
', '
', $post_content ); @@ -581,7 +585,7 @@ class LJ_API_Import { $comment_content = wpautop( $comment_content ); $comment_content = str_replace( '
', '
', $comment_content ); $comment_content = str_replace( '
', '
', $comment_content ); - $comment_content = preg_replace_callback( '|<(/?[A-Z]+)|', create_function( '$match', 'return "<" . strtolower( $match[1] );' ), $comment_content ); + $comment_content = preg_replace_callback( '|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $comment_content ); $comment_content = $wpdb->escape( trim( $comment_content ) ); // Get and convert the date diff --git a/wp-admin/import/rss.php b/wp-admin/import/rss.php index 9a85df36b4..3b427296bb 100644 --- a/wp-admin/import/rss.php +++ b/wp-admin/import/rss.php @@ -43,6 +43,10 @@ class RSS_Import { echo ''; } + function _normalize_tag( $matches ) { + return '<' . strtolower( $match[1] ); + } + function get_posts() { global $wpdb; @@ -103,7 +107,7 @@ class RSS_Import { } // Clean up content - $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content); + $post_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content); $post_content = str_replace('
', '
', $post_content); $post_content = str_replace('
', '
', $post_content); diff --git a/wp-admin/import/wordpress.php b/wp-admin/import/wordpress.php index ddc2004f57..168b71bd12 100644 --- a/wp-admin/import/wordpress.php +++ b/wp-admin/import/wordpress.php @@ -357,6 +357,10 @@ class WP_Import { echo '

'.sprintf(__('All done.').' '.__('Have fun!').'', get_option('home')).'

'; } + function _normalize_tag( $matches ) { + return '<' . strtolower( $match[1] ); + } + function process_post($post) { global $wpdb; @@ -383,12 +387,12 @@ class WP_Import { $post_author = $this->get_tag( $post, 'dc:creator' ); $post_excerpt = $this->get_tag( $post, 'excerpt:encoded' ); - $post_excerpt = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_excerpt); + $post_excerpt = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_excerpt); $post_excerpt = str_replace('
', '
', $post_excerpt); $post_excerpt = str_replace('
', '
', $post_excerpt); $post_content = $this->get_tag( $post, 'content:encoded' ); - $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content); + $post_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content); $post_content = str_replace('
', '
', $post_content); $post_content = str_replace('
', '
', $post_content);