Changeset 22349 for trunk/wp-includes/pomo/po.php
- Timestamp:
- 10/31/2012 10:13:51 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/pomo/po.php
r18528 r22349 3 3 * Class for working with PO files 4 4 * 5 * @version $Id: po.php 589 2010-12-18 01:40:57Z nbachiyski $5 * @version $Id: po.php 718 2012-10-31 00:32:02Z nbachiyski $ 6 6 * @package pomo 7 7 * @subpackage po … … 19 19 if ( !class_exists( 'PO' ) ): 20 20 class PO extends Gettext_Translations { 21 21 22 22 var $comments_before_headers = ''; 23 23 … … 81 81 return fclose($fh); 82 82 } 83 83 84 84 /** 85 85 * Text to include as a comment before the start of the PO contents 86 * 86 * 87 87 * Doesn't need to include # in the beginning of lines, these are added automatically 88 88 */ … … 121 121 return $po; 122 122 } 123 123 124 124 /** 125 125 * Gives back the original string from a PO-formatted string 126 * 126 * 127 127 * @static 128 128 * @param string $string PO-formatted string … … 154 154 155 155 /** 156 * Inserts $with in the beginning of every new line of $string and 156 * Inserts $with in the beginning of every new line of $string and 157 157 * returns the modified string 158 158 * … … 230 230 } 231 231 PO::read_line($f, 'clear'); 232 return $res !== false; 233 } 234 232 if ( false === $res ) { 233 return false; 234 } 235 if ( ! $this->headers && ! $this->entries ) { 236 return false; 237 } 238 return true; 239 } 240 235 241 function read_entry($f, $lineno = 0) { 236 242 $entry = new Translation_Entry(); … … 337 343 return array('entry' => $entry, 'lineno' => $lineno); 338 344 } 339 345 340 346 function read_line($f, $action = 'read') { 341 347 static $last_line = ''; … … 350 356 } 351 357 $line = $use_last_line? $last_line : fgets($f); 358 $line = gp_endswith( $line, "\r\n" )? rtrim( $line, "\r\n" ) . "\n" : $line; 352 359 $last_line = $line; 353 360 $use_last_line = false; 354 361 return $line; 355 362 } 356 363 357 364 function add_comment_to_entry(&$entry, $po_comment_line) { 358 365 $first_two = substr($po_comment_line, 0, 2); … … 368 375 } 369 376 } 370 377 371 378 function trim_quotes($s) { 372 379 if ( substr($s, 0, 1) == '"') $s = substr($s, 1);
Note: See TracChangeset
for help on using the changeset viewer.