- Timestamp:
- Jul 7, 2014, 11:54:15 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/picture_modify.php
r28678 r28981 284 284 $intro_vars = array( 285 285 'file' => l10n('Original file : %s', $row['file']), 286 'add_date' => l10n('Posted %s on %s', time_since($row['date_available'], 'year'), format_date($row['date_available'], false, false)),286 'add_date' => l10n('Posted %s on %s', time_since($row['date_available'], 'year'), format_date($row['date_available'], array('day', 'month', 'year'))), 287 287 'added_by' => l10n('Added by %s', $row['added_by']), 288 288 'size' => $row['width'].'×'.$row['height'].' pixels, '.sprintf('%.2f', $row['filesize']/1024).'MB', -
trunk/include/category_cats.inc.php
r28587 r28981 337 337 if (!empty($from)) 338 338 { 339 $info = ''; 340 341 if (date('Y-m-d', strtotime($from)) == date('Y-m-d', strtotime($to))) 342 { 343 $info = format_date($from); 344 } 345 else 346 { 347 $info = l10n( 348 'from %s to %s', 349 format_date($from), 350 format_date($to) 351 ); 352 } 353 $tpl_var['INFO_DATES'] = $info; 339 $tpl_var['INFO_DATES'] = format_fromto($from, $to); 354 340 } 355 341 } 356 } //fromto342 } 357 343 358 344 $tpl_thumbnails_var[] = $tpl_var; -
trunk/include/functions.inc.php
r28914 r28981 550 550 return false; 551 551 } 552 553 if ($original instanceof DateTime) 554 { 555 return $original; 556 } 552 557 553 558 if (!empty($format) && version_compare(PHP_VERSION, '5.3.0') >= 0)// from known date format … … 589 594 * 590 595 * @param int|string timestamp or datetime string 591 * @param bool $show_time592 * @param bool $show_day_name596 * @param array $show list of components displayed, default is ['day_name', 'day', 'month', 'year'] 597 * THIS PARAMETER IS PLANNED TO CHANGE 593 598 * @param string $format input format respecting date() syntax 594 599 * @return string 595 600 */ 596 function format_date($original, $show _time=false, $show_day_name=true, $format=null)601 function format_date($original, $show=null, $format=null) 597 602 { 598 603 global $lang; … … 605 610 } 606 611 612 if ($show === null) 613 { 614 $show = array('day_name', 'day', 'month', 'year'); 615 } 616 617 // TODO use IntlDateFormatter for proper i18n 618 607 619 $print = ''; 608 if ($show_day_name) 609 { 620 if (in_array('day_name', $show)) 610 621 $print.= $lang['day'][ $date->format('w') ].' '; 611 } 612 613 $print.= $date->format('j'); 614 $print.= ' '.$lang['month'][ $date->format('n') ]; 615 $print.= ' '.$date->format('Y'); 616 617 if ($show_time) 622 623 if (in_array('day', $show)) 624 $print.= $date->format('j').' '; 625 626 if (in_array('month', $show)) 627 $print.= $lang['month'][ $date->format('n') ].' '; 628 629 if (in_array('year', $show)) 630 $print.= $date->format('Y').' '; 631 632 if (in_array('time', $show)) 618 633 { 619 634 $temp = $date->format('H:i'); 620 635 if ($temp != '00:00') 621 636 { 622 $print.= ' '.$temp;637 $print.= $temp.' '; 623 638 } 624 639 } 625 640 626 641 return trim($print); 642 } 643 644 /** 645 * Format a "From ... to ..." string from two dates 646 * @param string $from 647 * @param string $to 648 * @param boolean $full 649 * @return string 650 */ 651 function format_fromto($from, $to, $full=false) 652 { 653 $from = str2DateTime($from); 654 $to = str2DateTime($to); 655 656 if ($from->format('Y-m-d') == $to->format('Y-m-d')) 657 { 658 return format_date($from); 659 } 660 else 661 { 662 if ($full || $from->format('Y') != $to->format('Y')) 663 { 664 $from_str = format_date($from); 665 } 666 else if ($from->format('m') != $to->format('m')) 667 { 668 $from_str = format_date($from, array('day_name', 'day', 'month')); 669 } 670 else 671 { 672 $from_str = format_date($from, array('day_name', 'day')); 673 } 674 $to_str = format_date($to); 675 676 return l10n('from %s to %s', $from_str, $to_str); 677 } 627 678 } 628 679 -
trunk/include/ws_functions/pwg.users.php
r27811 r28981 197 197 foreach ($users as $cur_user) 198 198 { 199 $users[$cur_user['id']]['registration_date_string'] = format_date($cur_user['registration_date'], false, false);199 $users[$cur_user['id']]['registration_date_string'] = format_date($cur_user['registration_date'], array('day', 'month', 'year')); 200 200 } 201 201 } … … 241 241 if (isset($params['display']['last_visit_string'])) 242 242 { 243 $users[ $row['user_id'] ]['last_visit_string'] = format_date($last_visit, false, false);243 $users[ $row['user_id'] ]['last_visit_string'] = format_date($last_visit, array('day', 'month', 'year')); 244 244 } 245 245
Note: See TracChangeset
for help on using the changeset viewer.