<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12985] trunk/wp-admin/import: Remove &lt; PHP 4.
 3 compat functions from importers.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12985">12985</a></dd>
<dt>Author</dt> <dd>dd32</dd>
<dt>Date</dt> <dd>2010-02-06 07:19:25 +0000 (Sat, 06 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove &lt; PHP 4.3 compat functions from importers. Props nacin. Fixes <a href="http://trac.wordpress.org/ticket/11636">#11636</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminimportblogwarephp">trunk/wp-admin/import/blogware.php</a></li>
<li><a href="#trunkwpadminimportrssphp">trunk/wp-admin/import/rss.php</a></li>
<li><a href="#trunkwpadminimportwordpressphp">trunk/wp-admin/import/wordpress.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminimportblogwarephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/import/blogware.php (12984 => 12985)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/import/blogware.php        2010-02-06 06:49:11 UTC (rev 12984)
+++ trunk/wp-admin/import/blogware.php        2010-02-06 07:19:25 UTC (rev 12985)
</span><span class="lines">@@ -29,12 +29,6 @@
</span><span class="cx">                 echo '&lt;/div&gt;';
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function unhtmlentities($string) { // From php.net for &lt; 4.3 compat
-                $trans_tbl = get_html_translation_table(HTML_ENTITIES);
-                $trans_tbl = array_flip($trans_tbl);
-                return strtr($string, $trans_tbl);
-        }
-
</del><span class="cx">         function greet() {
</span><span class="cx">                 echo '&lt;div class=&quot;narrow&quot;&gt;';
</span><span class="cx">                 echo '&lt;p&gt;'.__('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.').'&lt;/p&gt;';
</span><span class="lines">@@ -78,18 +72,18 @@
</span><span class="cx"> 
</span><span class="cx">                         $cat_index = 0;
</span><span class="cx">                         foreach ($categories as $category) {
</span><del>-                                $categories[$cat_index] = $wpdb-&gt;escape($this-&gt;unhtmlentities($category));
</del><ins>+                                $categories[$cat_index] = $wpdb-&gt;escape( html_entity_decode($category) );
</ins><span class="cx">                                 $cat_index++;
</span><span class="cx">                         }
</span><span class="cx"> 
</span><del>-                        if (strcasecmp($post_type, &quot;photo&quot;) === 0) {
</del><ins>+                        if ( strcasecmp($post_type, &quot;photo&quot;) === 0 ) {
</ins><span class="cx">                                 preg_match('|&lt;sizedPhotoUrl&gt;(.*?)&lt;/sizedPhotoUrl&gt;|is', $post, $post_content);
</span><span class="cx">                                 $post_content = '&lt;img src=&quot;'.trim($post_content[1]).'&quot; /&gt;';
</span><del>-                                $post_content = $this-&gt;unhtmlentities($post_content);
</del><ins>+                                $post_content = html_entity_decode( $post_content );
</ins><span class="cx">                         } else {
</span><span class="cx">                                 preg_match('|&lt;body&gt;(.*?)&lt;/body&gt;|is', $post, $post_content);
</span><span class="cx">                                 $post_content = str_replace(array ('&lt;![CDATA[', ']]&gt;'), '', trim($post_content[1]));
</span><del>-                                $post_content = $this-&gt;unhtmlentities($post_content);
</del><ins>+                                $post_content = html_entity_decode( $post_content );
</ins><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         // Clean up content
</span><span class="lines">@@ -117,7 +111,7 @@
</span><span class="cx">                                         echo '&lt;/li&gt;';
</span><span class="cx">                                         break;
</span><span class="cx">                                 }
</span><del>-                                if (0 != count($categories))
</del><ins>+                                if ( 0 != count($categories) )
</ins><span class="cx">                                         wp_create_categories($categories, $post_id);
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="lines">@@ -130,7 +124,7 @@
</span><span class="cx">                                 foreach ($comments as $comment) {
</span><span class="cx">                                         preg_match('|&lt;body&gt;(.*?)&lt;/body&gt;|is', $comment, $comment_content);
</span><span class="cx">                                         $comment_content = str_replace(array ('&lt;![CDATA[', ']]&gt;'), '', trim($comment_content[1]));
</span><del>-                                        $comment_content = $this-&gt;unhtmlentities($comment_content);
</del><ins>+                                        $comment_content = html_entity_decode( $comment_content );
</ins><span class="cx"> 
</span><span class="cx">                                         // Clean up content
</span><span class="cx">                                         $comment_content = preg_replace_callback('|&lt;(/?[A-Z]+)|', array( &amp;$this, '_normalize_tag' ), $comment_content);
</span></span></pre></div>
<a id="trunkwpadminimportrssphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/import/rss.php (12984 => 12985)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/import/rss.php        2010-02-06 06:49:11 UTC (rev 12984)
+++ trunk/wp-admin/import/rss.php        2010-02-06 07:19:25 UTC (rev 12985)
</span><span class="lines">@@ -30,12 +30,6 @@
</span><span class="cx">                 echo '&lt;/div&gt;';
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function unhtmlentities($string) { // From php.net for &lt; 4.3 compat
-                $trans_tbl = get_html_translation_table(HTML_ENTITIES);
-                $trans_tbl = array_flip($trans_tbl);
-                return strtr($string, $trans_tbl);
-        }
-
</del><span class="cx">         function greet() {
</span><span class="cx">                 echo '&lt;div class=&quot;narrow&quot;&gt;';
</span><span class="cx">                 echo '&lt;p&gt;'.__('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.').'&lt;/p&gt;';
</span><span class="lines">@@ -87,7 +81,7 @@
</span><span class="cx"> 
</span><span class="cx">                         $cat_index = 0;
</span><span class="cx">                         foreach ($categories as $category) {
</span><del>-                                $categories[$cat_index] = $wpdb-&gt;escape($this-&gt;unhtmlentities($category));
</del><ins>+                                $categories[$cat_index] = $wpdb-&gt;escape( html_entity_decode( $category ) );
</ins><span class="cx">                                 $cat_index++;
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="lines">@@ -103,7 +97,7 @@
</span><span class="cx">                         if (!$post_content) {
</span><span class="cx">                                 // This is for feeds that put content in description
</span><span class="cx">                                 preg_match('|&lt;description&gt;(.*?)&lt;/description&gt;|is', $post, $post_content);
</span><del>-                                $post_content = $wpdb-&gt;escape($this-&gt;unhtmlentities(trim($post_content[1])));
</del><ins>+                                $post_content = $wpdb-&gt;escape( html_entity_decode( trim( $post_content[1] ) ) );
</ins><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         // Clean up content
</span></span></pre></div>
<a id="trunkwpadminimportwordpressphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/import/wordpress.php (12984 => 12985)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/import/wordpress.php        2010-02-06 06:49:11 UTC (rev 12984)
+++ trunk/wp-admin/import/wordpress.php        2010-02-06 07:19:25 UTC (rev 12985)
</span><span class="lines">@@ -43,12 +43,6 @@
</span><span class="cx">                 echo '&lt;/div&gt;';
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function unhtmlentities($string) { // From php.net for &lt; 4.3 compat
-                $trans_tbl = get_html_translation_table(HTML_ENTITIES);
-                $trans_tbl = array_flip($trans_tbl);
-                return strtr($string, $trans_tbl);
-        }
-
</del><span class="cx">         function greet() {
</span><span class="cx">                 echo '&lt;div class=&quot;narrow&quot;&gt;';
</span><span class="cx">                 echo '&lt;p&gt;'.__('Howdy! Upload your WordPress eXtended RSS (WXR) file and we&amp;#8217;ll import the posts, pages, comments, custom fields, categories, and tags into this blog.').'&lt;/p&gt;';
</span><span class="lines">@@ -450,7 +444,7 @@
</span><span class="cx"> 
</span><span class="cx">                 $tag_index = 0;
</span><span class="cx">                 foreach ($tags as $tag) {
</span><del>-                        $tags[$tag_index] = $wpdb-&gt;escape($this-&gt;unhtmlentities(str_replace(array ('&lt;![CDATA[', ']]&gt;'), '', $tag)));
</del><ins>+                        $tags[$tag_index] = $wpdb-&gt;escape( html_entity_decode( str_replace(array( '&lt;![CDATA[', ']]&gt;' ), '', $tag ) ) );
</ins><span class="cx">                         $tag_index++;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -459,7 +453,7 @@
</span><span class="cx"> 
</span><span class="cx">                 $cat_index = 0;
</span><span class="cx">                 foreach ($categories as $category) {
</span><del>-                        $categories[$cat_index] = $wpdb-&gt;escape($this-&gt;unhtmlentities(str_replace(array ('&lt;![CDATA[', ']]&gt;'), '', $category)));
</del><ins>+                        $categories[$cat_index] = $wpdb-&gt;escape( html_entity_decode( str_replace( array( '&lt;![CDATA[', ']]&gt;' ), '', $category ) ) );
</ins><span class="cx">                         $cat_index++;
</span><span class="cx">                 }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>