Make WordPress Core

Changeset 12985


Ignore:
Timestamp:
02/06/2010 07:19:25 AM (16 years ago)
Author:
dd32
Message:

Remove < PHP 4.3 compat functions from importers. Props nacin. Fixes #11636

Location:
trunk/wp-admin/import
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/import/blogware.php

    r12752 r12985  
    2828    function footer() {
    2929        echo '</div>';
    30     }
    31 
    32     function unhtmlentities($string) { // From php.net for < 4.3 compat
    33         $trans_tbl = get_html_translation_table(HTML_ENTITIES);
    34         $trans_tbl = array_flip($trans_tbl);
    35         return strtr($string, $trans_tbl);
    3630    }
    3731
     
    7973            $cat_index = 0;
    8074            foreach ($categories as $category) {
    81                 $categories[$cat_index] = $wpdb->escape($this->unhtmlentities($category));
     75                $categories[$cat_index] = $wpdb->escape( html_entity_decode($category) );
    8276                $cat_index++;
    8377            }
    8478
    85             if (strcasecmp($post_type, "photo") === 0) {
     79            if ( strcasecmp($post_type, "photo") === 0 ) {
    8680                preg_match('|<sizedPhotoUrl>(.*?)</sizedPhotoUrl>|is', $post, $post_content);
    8781                $post_content = '<img src="'.trim($post_content[1]).'" />';
    88                 $post_content = $this->unhtmlentities($post_content);
     82                $post_content = html_entity_decode( $post_content );
    8983            } else {
    9084                preg_match('|<body>(.*?)</body>|is', $post, $post_content);
    9185                $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 );
    9387            }
    9488
     
    118112                    break;
    119113                }
    120                 if (0 != count($categories))
     114                if ( 0 != count($categories) )
    121115                    wp_create_categories($categories, $post_id);
    122116            }
     
    131125                    preg_match('|<body>(.*?)</body>|is', $comment, $comment_content);
    132126                    $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 );
    134128
    135129                    // Clean up content
  • trunk/wp-admin/import/rss.php

    r12789 r12985  
    2929    function footer() {
    3030        echo '</div>';
    31     }
    32 
    33     function unhtmlentities($string) { // From php.net for < 4.3 compat
    34         $trans_tbl = get_html_translation_table(HTML_ENTITIES);
    35         $trans_tbl = array_flip($trans_tbl);
    36         return strtr($string, $trans_tbl);
    3731    }
    3832
     
    8882            $cat_index = 0;
    8983            foreach ($categories as $category) {
    90                 $categories[$cat_index] = $wpdb->escape($this->unhtmlentities($category));
     84                $categories[$cat_index] = $wpdb->escape( html_entity_decode( $category ) );
    9185                $cat_index++;
    9286            }
     
    10498                // This is for feeds that put content in description
    10599                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] ) ) );
    107101            }
    108102
  • trunk/wp-admin/import/wordpress.php

    r12657 r12985  
    4242    function footer() {
    4343        echo '</div>';
    44     }
    45 
    46     function unhtmlentities($string) { // From php.net for < 4.3 compat
    47         $trans_tbl = get_html_translation_table(HTML_ENTITIES);
    48         $trans_tbl = array_flip($trans_tbl);
    49         return strtr($string, $trans_tbl);
    5044    }
    5145
     
    451445        $tag_index = 0;
    452446        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 ) ) );
    454448            $tag_index++;
    455449        }
     
    460454        $cat_index = 0;
    461455        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 ) ) );
    463457            $cat_index++;
    464458        }
Note: See TracChangeset for help on using the changeset viewer.