diff --git wp-includes/pomo/po.php wp-includes/pomo/po.php
index 65d65ff..6f06148 100644
|
|
|
class PO extends Gettext_Translations { |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | /** |
| | 283 | * Helper function for read_entry |
| | 284 | * @param string $context |
| | 285 | * @return bool |
| | 286 | */ |
| | 287 | private static function isMsgStr($context) { |
| | 288 | return ($context === 'msgstr') || ($context === 'msgstr_plural'); |
| | 289 | } |
| | 290 | |
| | 291 | /** |
| 283 | 292 | * @param resource $f |
| 284 | 293 | * @param int $lineno |
| 285 | 294 | * @return null|false|array |
| … |
… |
class PO extends Gettext_Translations { |
| 290 | 299 | // can be: comment, msgctxt, msgid, msgid_plural, msgstr, msgstr_plural |
| 291 | 300 | $context = ''; |
| 292 | 301 | $msgstr_index = 0; |
| 293 | | $is_final = create_function('$context', 'return $context == "msgstr" || $context == "msgstr_plural";'); |
| 294 | 302 | while (true) { |
| 295 | 303 | $lineno++; |
| 296 | 304 | $line = PO::read_line($f); |
| 297 | 305 | if (!$line) { |
| 298 | 306 | if (feof($f)) { |
| 299 | | if ($is_final($context)) |
| | 307 | if (self::isMsgStr($context)) |
| 300 | 308 | break; |
| 301 | 309 | elseif (!$context) // we haven't read a line and eof came |
| 302 | 310 | return null; |
| … |
… |
class PO extends Gettext_Translations { |
| 310 | 318 | $line = trim($line); |
| 311 | 319 | if (preg_match('/^#/', $line, $m)) { |
| 312 | 320 | // the comment is the start of a new entry |
| 313 | | if ($is_final($context)) { |
| | 321 | if (self::isMsgStr($context)) { |
| 314 | 322 | PO::read_line($f, 'put-back'); |
| 315 | 323 | $lineno--; |
| 316 | 324 | break; |
| … |
… |
class PO extends Gettext_Translations { |
| 322 | 330 | // add comment |
| 323 | 331 | $this->add_comment_to_entry($entry, $line); |
| 324 | 332 | } elseif (preg_match('/^msgctxt\s+(".*")/', $line, $m)) { |
| 325 | | if ($is_final($context)) { |
| | 333 | if (self::isMsgStr($context)) { |
| 326 | 334 | PO::read_line($f, 'put-back'); |
| 327 | 335 | $lineno--; |
| 328 | 336 | break; |
| … |
… |
class PO extends Gettext_Translations { |
| 333 | 341 | $context = 'msgctxt'; |
| 334 | 342 | $entry->context .= PO::unpoify($m[1]); |
| 335 | 343 | } elseif (preg_match('/^msgid\s+(".*")/', $line, $m)) { |
| 336 | | if ($is_final($context)) { |
| | 344 | if (self::isMsgStr($context)) { |
| 337 | 345 | PO::read_line($f, 'put-back'); |
| 338 | 346 | $lineno--; |
| 339 | 347 | break; |