Changeset 11964
- Timestamp:
- 09/23/2009 10:03:39 PM (15 years ago)
- Location:
- trunk/wp-admin/import
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/import/blogger.php
r11245 r11964 530 530 } 531 531 532 function _normalize_tag( $matches ) { 533 return '<' . strtolower( $match[1] ); 534 } 535 532 536 function import_post( $entry ) { 533 537 global $importing_blog; … … 552 556 553 557 // Clean up content 554 $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content);558 $post_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content); 555 559 $post_content = str_replace('<br>', '<br />', $post_content); 556 560 $post_content = str_replace('<hr>', '<hr />', $post_content); … … 605 609 606 610 // Clean up content 607 $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $comment_content);611 $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $comment_content); 608 612 $comment_content = str_replace('<br>', '<br />', $comment_content); 609 613 $comment_content = str_replace('<hr>', '<hr />', $comment_content); … … 906 910 907 911 function AtomParser() { 908 909 912 $this->entry = new AtomEntry(); 910 $this->map_attrs_func = create_function('$k,$v', 'return "$k=\"$v\"";'); 911 $this->map_xmlns_func = create_function('$p,$n', '$xd = "xmlns"; if(strlen($n[0])>0) $xd .= ":{$n[0]}"; return "{$xd}=\"{$n[1]}\"";'); 913 } 914 915 function _map_attrs_func( $k, $v ) { 916 return "$k=\"$v\""; 917 } 918 919 function _map_xmlns_func( $p, $n ) { 920 $xd = "xmlns"; 921 if ( strlen( $n[0] ) > 0 ) 922 $xd .= ":{$n[0]}"; 923 924 return "{$xd}=\"{$n[1]}\""; 912 925 } 913 926 … … 951 964 $attrs_prefix[$this->ns_to_prefix($key)] = $this->xml_escape($value); 952 965 } 953 $attrs_str = join(' ', array_map( $this->map_attrs_func, array_keys($attrs_prefix), array_values($attrs_prefix)));966 $attrs_str = join(' ', array_map( array( &$this, '_map_attrs_func' ), array_keys($attrs_prefix), array_values($attrs_prefix))); 954 967 if(strlen($attrs_str) > 0) { 955 968 $attrs_str = " " . $attrs_str; 956 969 } 957 970 958 $xmlns_str = join(' ', array_map( $this->map_xmlns_func, array_keys($this->ns_contexts[0]), array_values($this->ns_contexts[0])));971 $xmlns_str = join(' ', array_map( array( &$this, '_map_xmlns_func' ), array_keys($this->ns_contexts[0]), array_values($this->ns_contexts[0]))); 959 972 if(strlen($xmlns_str) > 0) { 960 973 $xmlns_str = " " . $xmlns_str; -
trunk/wp-admin/import/blogware.php
r11190 r11964 41 41 wp_import_upload_form("admin.php?import=blogware&step=1"); 42 42 echo '</div>'; 43 } 44 45 function _normalize_tag( $matches ) { 46 return '<' . strtolower( $match[1] ); 43 47 } 44 48 … … 90 94 91 95 // Clean up content 92 $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content);96 $post_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content); 93 97 $post_content = str_replace('<br>', '<br />', $post_content); 94 98 $post_content = str_replace('<hr>', '<hr />', $post_content); … … 130 134 131 135 // Clean up content 132 $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $comment_content);136 $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $comment_content); 133 137 $comment_content = str_replace('<br>', '<br />', $comment_content); 134 138 $comment_content = str_replace('<hr>', '<hr />', $comment_content); -
trunk/wp-admin/import/livejournal.php
r11383 r11964 325 325 } 326 326 327 function _normalize_tag( $matches ) { 328 return '<' . strtolower( $match[1] ); 329 } 330 327 331 function import_post( $post ) { 328 332 global $wpdb; … … 351 355 // Clean up content 352 356 $post_content = $post['event']; 353 $post_content = preg_replace_callback( '|<(/?[A-Z]+)|', create_function( '$match', 'return "<" . strtolower( $match[1] );' ), $post_content );357 $post_content = preg_replace_callback( '|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content ); 354 358 // XHTMLize some tags 355 359 $post_content = str_replace( '<br>', '<br />', $post_content ); … … 582 586 $comment_content = str_replace( '<br>', '<br />', $comment_content ); 583 587 $comment_content = str_replace( '<hr>', '<hr />', $comment_content ); 584 $comment_content = preg_replace_callback( '|<(/?[A-Z]+)|', create_function( '$match', 'return "<" . strtolower( $match[1] );' ), $comment_content );588 $comment_content = preg_replace_callback( '|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $comment_content ); 585 589 $comment_content = $wpdb->escape( trim( $comment_content ) ); 586 590 -
trunk/wp-admin/import/rss.php
r11190 r11964 44 44 } 45 45 46 function _normalize_tag( $matches ) { 47 return '<' . strtolower( $match[1] ); 48 } 49 46 50 function get_posts() { 47 51 global $wpdb; … … 104 108 105 109 // Clean up content 106 $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content);110 $post_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content); 107 111 $post_content = str_replace('<br>', '<br />', $post_content); 108 112 $post_content = str_replace('<hr>', '<hr />', $post_content); -
trunk/wp-admin/import/wordpress.php
r11842 r11964 356 356 357 357 echo '<h3>'.sprintf(__('All done.').' <a href="%s">'.__('Have fun!').'</a>', get_option('home')).'</h3>'; 358 } 359 360 function _normalize_tag( $matches ) { 361 return '<' . strtolower( $match[1] ); 358 362 } 359 363 … … 384 388 385 389 $post_excerpt = $this->get_tag( $post, 'excerpt:encoded' ); 386 $post_excerpt = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_excerpt);390 $post_excerpt = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_excerpt); 387 391 $post_excerpt = str_replace('<br>', '<br />', $post_excerpt); 388 392 $post_excerpt = str_replace('<hr>', '<hr />', $post_excerpt); 389 393 390 394 $post_content = $this->get_tag( $post, 'content:encoded' ); 391 $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content);395 $post_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content); 392 396 $post_content = str_replace('<br>', '<br />', $post_content); 393 397 $post_content = str_replace('<hr>', '<hr />', $post_content);
Note: See TracChangeset
for help on using the changeset viewer.