Ticket #11636: html_entity_decode.diff
| File html_entity_decode.diff, 4.6 KB (added by , 16 years ago) |
|---|
-
blogware.php
29 29 echo '</div>'; 30 30 } 31 31 32 function unhtmlentities($string) { // From php.net for < 4.3 compat33 $trans_tbl = get_html_translation_table(HTML_ENTITIES);34 $trans_tbl = array_flip($trans_tbl);35 return strtr($string, $trans_tbl);36 }37 38 32 function greet() { 39 33 echo '<div class="narrow">'; 40 34 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 72 79 73 $cat_index = 0; 80 74 foreach ($categories as $category) { 81 $categories[$cat_index] = $wpdb->escape( $this->unhtmlentities($category));75 $categories[$cat_index] = $wpdb->escape( html_entity_decode($category) ); 82 76 $cat_index++; 83 77 } 84 78 85 79 if(strcasecmp($post_type, "photo") === 0) { 86 80 preg_match('|<sizedPhotoUrl>(.*?)</sizedPhotoUrl>|is', $post, $post_content); 87 81 $post_content = '<img src="'.trim($post_content[1]).'" />'; 88 $post_content = $this->unhtmlentities($post_content);82 $post_content = html_entity_decode( $post_content ); 89 83 } else { 90 84 preg_match('|<body>(.*?)</body>|is', $post, $post_content); 91 85 $post_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($post_content[1])); 92 $post_content = $this->unhtmlentities($post_content);86 $post_content = html_entity_decode( $post_content ); 93 87 } 94 88 95 89 // Clean up content … … 130 124 foreach ($comments as $comment) { 131 125 preg_match('|<body>(.*?)</body>|is', $comment, $comment_content); 132 126 $comment_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($comment_content[1])); 133 $comment_content = $this->unhtmlentities($comment_content);127 $comment_content = html_entity_decode( $comment_content ); 134 128 135 129 // Clean up content 136 130 $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $comment_content); -
rss.php
30 30 echo '</div>'; 31 31 } 32 32 33 function unhtmlentities($string) { // From php.net for < 4.3 compat34 $trans_tbl = get_html_translation_table(HTML_ENTITIES);35 $trans_tbl = array_flip($trans_tbl);36 return strtr($string, $trans_tbl);37 }38 39 33 function greet() { 40 34 echo '<div class="narrow">'; 41 35 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 81 88 82 $cat_index = 0; 89 83 foreach ($categories as $category) { 90 $categories[$cat_index] = $wpdb->escape( $this->unhtmlentities($category));84 $categories[$cat_index] = $wpdb->escape( html_entity_decode( $category ) ); 91 85 $cat_index++; 92 86 } 93 87 … … 103 97 if (!$post_content) { 104 98 // This is for feeds that put content in description 105 99 preg_match('|<description>(.*?)</description>|is', $post, $post_content); 106 $post_content = $wpdb->escape( $this->unhtmlentities(trim($post_content[1])));100 $post_content = $wpdb->escape( html_entity_decode( trim( $post_content[1] ) ) ); 107 101 } 108 102 109 103 // Clean up content -
wordpress.php
43 43 echo '</div>'; 44 44 } 45 45 46 function unhtmlentities($string) { // From php.net for < 4.3 compat47 $trans_tbl = get_html_translation_table(HTML_ENTITIES);48 $trans_tbl = array_flip($trans_tbl);49 return strtr($string, $trans_tbl);50 }51 52 46 function greet() { 53 47 echo '<div class="narrow">'; 54 48 echo '<p>'.__('Howdy! Upload your WordPress eXtended RSS (WXR) file and we’ll import the posts, pages, comments, custom fields, categories, and tags into this blog.').'</p>'; … … 450 444 451 445 $tag_index = 0; 452 446 foreach ($tags as $tag) { 453 $tags[$tag_index] = $wpdb->escape( $this->unhtmlentities(str_replace(array ('<![CDATA[', ']]>'), '', $tag)));447 $tags[$tag_index] = $wpdb->escape( html_entity_decode( str_replace(array( '<![CDATA[', ']]>' ), '', $tag ) ) ); 454 448 $tag_index++; 455 449 } 456 450 … … 459 453 460 454 $cat_index = 0; 461 455 foreach ($categories as $category) { 462 $categories[$cat_index] = $wpdb->escape( $this->unhtmlentities(str_replace(array ('<![CDATA[', ']]>'), '', $category)));456 $categories[$cat_index] = $wpdb->escape( html_entity_decode( str_replace( array( '<![CDATA[', ']]>' ), '', $category ) ) ); 463 457 $cat_index++; 464 458 } 465 459