Changeset 9358 for trunk/wp-admin/import/mt.php
- Timestamp:
- 10/26/2008 05:08:40 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/import/mt.php
r8645 r9358 70 70 <?php 71 71 72 73 } 72 } 73 74 function has_gzip() { 75 return is_callable('gzopen'); 76 } 77 78 function fopen($filename, $mode='r') { 79 if ( $this->has_gzip() ) 80 return gzopen($filename, $mode); 81 return fopen($filename, $mode); 82 } 83 84 function feof($fp) { 85 if ( $this->has_gzip() ) 86 return gzeof($fp); 87 return feof($fp); 88 } 89 90 function fgets($fp, $len=8192) { 91 if ( $this->has_gzip() ) 92 return gzgets($fp, $len); 93 return fgets($fp, $len); 94 } 95 96 function fclose($fp) { 97 if ( $this->has_gzip() ) 98 return gzclose($fp); 99 return fclose($fp); 100 } 74 101 75 102 //function to check the authorname and do the mapping … … 104 131 $authors = array(); 105 132 106 $handle = fopen($this->file, 'r');133 $handle = $this->fopen($this->file, 'r'); 107 134 if ( $handle == null ) 108 135 return false; 109 136 110 137 $in_comment = false; 111 while ( $line = fgets($handle) ) {138 while ( $line = $this->fgets($handle) ) { 112 139 $line = trim($line); 113 140 … … 132 159 } 133 160 134 fclose($handle);161 $this->fclose($handle); 135 162 136 163 return $authors; … … 287 314 global $wpdb; 288 315 289 $handle = fopen($this->file, 'r');316 $handle = $this->fopen($this->file, 'r'); 290 317 if ( $handle == null ) 291 318 return false; … … 300 327 echo "<div class='wrap'><ol>"; 301 328 302 while ( $line = fgets($handle) ) {329 while ( $line = $this->fgets($handle) ) { 303 330 $line = trim($line); 304 331 … … 429 456 } 430 457 458 $this->fclose($handle); 459 431 460 echo '</ol>'; 432 461
Note: See TracChangeset
for help on using the changeset viewer.