Index: trunk/phase3/languages/Language.php |
— | — | @@ -535,9 +535,10 @@ |
536 | 536 | * internationalisation, a reduced set of format characters, and a better |
537 | 537 | * escaping format. |
538 | 538 | * |
539 | | - * Supported format characters are dDjlNwzWFmMntLYyaAgGhHiscrU. See the |
540 | | - * PHP manual for definitions. There are a number of extensions, which |
541 | | - * start with "x": |
| 539 | + * Supported format characters are dDjlNwzWFmMntLoYyaAgGhHiscrU. See the |
| 540 | + * PHP manual for definitions. "o" format character is supported since |
| 541 | + * PHP 5.1.0, previous versions return literal o. |
| 542 | + * There are a number of extensions, which start with "x": |
542 | 543 | * |
543 | 544 | * xn Do not translate digits of the next numeric format character |
544 | 545 | * xN Toggle raw digit (xn) flag, stays set until explicitly unset |
— | — | @@ -558,10 +559,10 @@ |
559 | 560 | * xjn n (month number) in Hebrew calendar |
560 | 561 | * xjY Y (full year) in Hebrew calendar |
561 | 562 | * |
562 | | - * xmj j (day number) in Hijri calendar |
563 | | - * xmF F (month name) in Hijri calendar |
564 | | - * xmn n (month number) in Hijri calendar |
565 | | - * xmY Y (full year) in Hijri calendar |
| 563 | + * xmj j (day number) in Hijri calendar |
| 564 | + * xmF F (month name) in Hijri calendar |
| 565 | + * xmn n (month number) in Hijri calendar |
| 566 | + * xmY Y (full year) in Hijri calendar |
566 | 567 | * |
567 | 568 | * xkY Y (full year) in Thai solar calendar. Months and days are |
568 | 569 | * identical to the Gregorian calendar |
— | — | @@ -582,6 +583,8 @@ |
583 | 584 | * @param $ts String: 14-character timestamp |
584 | 585 | * YYYYMMDDHHMMSS |
585 | 586 | * 01234567890123 |
| 587 | + * @todo emulation of "o" format character for PHP pre 5.1.0 |
| 588 | + * @todo handling of "o" format character for Iranian, Hebrew, Hijri & Thai? |
586 | 589 | */ |
587 | 590 | function sprintfDate( $format, $ts ) { |
588 | 591 | $s = ''; |
— | — | @@ -719,6 +722,16 @@ |
720 | 723 | if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts ); |
721 | 724 | $num = gmdate( 'L', $unix ); |
722 | 725 | break; |
| 726 | + # 'o' is supported since PHP 5.1.0 |
| 727 | + # return literal if not supported |
| 728 | + # TODO: emulation for pre 5.1.0 versions |
| 729 | + case 'o': |
| 730 | + if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts ); |
| 731 | + if ( version_compare(PHP_VERSION, '5.1.0') === 1 ) |
| 732 | + $num = date( 'o', $unix ); |
| 733 | + else |
| 734 | + $s .= 'o'; |
| 735 | + break; |
723 | 736 | case 'Y': |
724 | 737 | $num = substr( $ts, 0, 4 ); |
725 | 738 | break; |