Ticket #5781: 5781.02.patch
| File 5781.02.patch, 14.2 KB (added by , 12 years ago) |
|---|
-
src/bp-activity/bp-activity-admin.php
666 666 <div class="misc-pub-section curtime misc-pub-section-last"> 667 667 <?php 668 668 // translators: Publish box date format, see http://php.net/date 669 $datef = __( 'M j, Y @ G:i ', 'buddypress' );670 $date = date_i18n( $datef, strtotime( $item->date_recorded ) );669 $datef = __( 'M j, Y @ G:i \U\T\C', 'buddypress' ); 670 $date = date_i18n( $datef, bp_core_strtotime( $item->date_recorded ) ); 671 671 ?> 672 672 <span id="timestamp"><?php printf( __( 'Submitted on: <strong>%1$s</strong>', 'buddypress' ), $date ); ?></span> <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e( 'Edit', 'buddypress' ); ?></a> 673 673 … … 1427 1427 $actions = apply_filters( 'bp_activity_admin_comment_row_actions', array_filter( $actions ), $item ); 1428 1428 1429 1429 /* translators: 2: activity admin ui date/time */ 1430 printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>', 'buddypress' ), bp_activity_get_permalink( $item['id'] ), get_date_from_gmt( $item['date_recorded'], get_option( 'date_format' ) ), get_date_from_gmt( $item['date_recorded'], get_option( 'time_format') ) );1430 printf( __( 'Submitted on <a href="%1$s">%2$s</a>', 'buddypress' ), bp_activity_get_permalink( $item['id'] ), bp_format_time( bp_core_strtotime( $item['date_recorded'] ) ) ); 1431 1431 1432 1432 // End timestamp 1433 1433 echo '</div>'; -
src/bp-activity/bp-activity-classes.php
1277 1277 if ( ! empty( $filter_array['since'] ) ) { 1278 1278 // Validate that this is a proper Y-m-d H:i:s date 1279 1279 // Trick: parse to UNIX date then translate back 1280 $translated_date = date( 'Y-m-d H:i:s',strtotime( $filter_array['since'] ) );1280 $translated_date = gmdate( 'Y-m-d H:i:s', bp_core_strtotime( $filter_array['since'] ) ); 1281 1281 if ( $translated_date === $filter_array['since'] ) { 1282 1282 $filter_sql[] = "a.date_recorded > '{$translated_date}'"; 1283 1283 } -
src/bp-activity/bp-activity-filters.php
457 457 return $classes; 458 458 } 459 459 460 $classes .= ' date-recorded-' . strtotime( $activity_date );460 $classes .= ' date-recorded-' . bp_core_strtotime( $activity_date ); 461 461 462 462 return $classes; 463 463 } -
src/bp-core/bp-core-functions.php
802 802 * 803 803 * @param int|string $older_date The earlier time from which you're calculating 804 804 * the time elapsed. Enter either as an integer Unix timestamp, or as a 805 * date string of the format 'Y-m-d h:i:s'.805 * GMT date string of the format 'Y-m-d h:i:s'. 806 806 * @param int $newer_date Optional. Unix timestamp of date to compare older 807 807 * date to. Default: false (current time). 808 808 * @return string String representing the time since the older date, eg … … 951 951 return apply_filters( 'bp_core_time_since', $output, $older_date, $newer_date ); 952 952 } 953 953 954 /** 955 * UTC-safe version of strtotime(). 956 * 957 * strtotime() is dependent on the server's timezone. If the server isn't set 958 * to UTC, the UNIX timestamp can be calculated differently and cause 959 * incorrect times to be returned. 960 * 961 * @since BuddyPress (2.1.0) 962 * 963 * @param $date The date string to convert to a UNIX timestamp. 964 * @return int 965 */ 966 function bp_core_strtotime( $date = '' ) { 967 // back up the existing timezone 968 $tz_backup = date_default_timezone_get(); 969 970 // override timezone to UTC 971 date_default_timezone_set( 'UTC' ); 972 973 // use strtotime() as usual 974 $time = strtotime( $date ); 975 976 // revert timezone if needed 977 if ( $tz_backup ) { 978 date_default_timezone_set( $tz_backup ); 979 } 980 981 return $time; 982 } 983 954 984 /** Messages ******************************************************************/ 955 985 956 986 /** … … 1075 1105 $activity = bp_get_user_last_activity( $user_id ); 1076 1106 1077 1107 if ( !is_numeric( $activity ) ) 1078 $activity = strtotime( $activity );1108 $activity = bp_core_strtotime( $activity ); 1079 1109 1080 1110 // Get current time 1081 $current_time = bp_core_current_time( );1111 $current_time = bp_core_current_time( true, 'timestamp' ); 1082 1112 1083 1113 // Use this action to detect the very first activity for a given member 1084 1114 if ( empty( $activity ) ) { 1085 1115 do_action( 'bp_first_activity_for_member', $user_id ); 1086 1116 } 1087 1117 1088 if ( empty( $activity ) || strtotime( $current_time )>= strtotime( '+5 minutes', $activity ) ) {1118 if ( empty( $activity ) || $current_time >= strtotime( '+5 minutes', $activity ) ) { 1089 1119 bp_update_user_last_activity( $user_id, $current_time ); 1090 1120 } 1091 1121 } -
src/bp-forums/bp-forums-template.php
1189 1189 function bp_get_the_topic_time_since_created() { 1190 1190 global $forum_template; 1191 1191 1192 return apply_filters( 'bp_get_the_topic_time_since_created', bp_core_time_since( strtotime( $forum_template->topic->topic_start_time )) );1192 return apply_filters( 'bp_get_the_topic_time_since_created', bp_core_time_since( $forum_template->topic->topic_start_time ) ); 1193 1193 } 1194 1194 1195 1195 /** … … 1238 1238 function bp_get_the_topic_time_since_last_post() { 1239 1239 global $forum_template; 1240 1240 1241 return apply_filters( 'bp_get_the_topic_time_since_last_post', bp_core_time_since( strtotime( $forum_template->topic->topic_time )) );1241 return apply_filters( 'bp_get_the_topic_time_since_last_post', bp_core_time_since( $forum_template->topic->topic_time ) ); 1242 1242 } 1243 1243 1244 1244 /** … … 2050 2050 function bp_get_the_topic_post_time_since() { 2051 2051 global $topic_template; 2052 2052 2053 return apply_filters( 'bp_get_the_topic_post_time_since', bp_core_time_since( strtotime( $topic_template->post->post_time )) );2053 return apply_filters( 'bp_get_the_topic_post_time_since', bp_core_time_since( $topic_template->post->post_time ) ); 2054 2054 } 2055 2055 2056 2056 /** -
src/bp-friends/bp-friends-classes.php
382 382 return 0; 383 383 } 384 384 385 return ( strtotime( $a["date_recorded"] ) <strtotime( $b["date_recorded"] ) ) ? 1 : -1;385 return ( bp_core_strtotime( $a["date_recorded"] ) < bp_core_strtotime( $b["date_recorded"] ) ) ? 1 : -1; 386 386 ' ) ); 387 387 388 388 $retval = array(); -
src/bp-groups/bp-groups-admin.php
1479 1479 * @param array Information about the current row. 1480 1480 */ 1481 1481 public function column_last_active( $item = array() ) { 1482 $last_active = g roups_get_groupmeta( $item['id'], 'last_activity');1482 $last_active = get_date_from_gmt( groups_get_groupmeta( $item['id'], 'last_activity' ) ); 1483 1483 echo apply_filters_ref_array( 'bp_groups_admin_get_group_last_active', array( $last_active, $item ) ); 1484 1484 } 1485 1485 -
src/bp-groups/bp-groups-template.php
733 733 if ( empty( $group ) ) 734 734 $group =& $groups_template->group; 735 735 736 return apply_filters( 'bp_get_group_date_created', bp_core_time_since( strtotime( $group->date_created )) );736 return apply_filters( 'bp_get_group_date_created', bp_core_time_since( $group->date_created ) ); 737 737 } 738 738 739 739 function bp_group_creator_username( $group = false ) { … … 1329 1329 1330 1330 <h5><?php echo bp_core_get_userlink( $admin->user_id ) ?></h5> 1331 1331 <span class="activity"> 1332 <?php echo bp_core_get_last_activity( strtotime( $admin->date_modified ), __( 'joined %s', 'buddypress') ); ?>1332 <?php echo bp_core_get_last_activity( bp_core_strtotime( $admin->date_modified ), __( 'joined %s', 'buddypress') ); ?> 1333 1333 </span> 1334 1334 1335 1335 <?php if ( bp_is_active( 'friends' ) ) : ?> … … 1394 1394 1395 1395 <h5><?php echo bp_core_get_userlink( $mod->user_id ) ?></h5> 1396 1396 1397 <span class="activity"><?php echo bp_core_get_last_activity( strtotime( $mod->date_modified ), __( 'joined %s', 'buddypress') ); ?></span>1397 <span class="activity"><?php echo bp_core_get_last_activity( bp_core_strtotime( $mod->date_modified ), __( 'joined %s', 'buddypress') ); ?></span> 1398 1398 1399 1399 <?php if ( bp_is_active( 'friends' ) ) : ?> 1400 1400 … … 3277 3277 function bp_group_request_time_since_requested() { 3278 3278 global $requests_template; 3279 3279 3280 echo apply_filters( 'bp_group_request_time_since_requested', sprintf( __( 'requested %s', 'buddypress' ), bp_core_time_since( strtotime( $requests_template->request->date_modified )) ) );3280 echo apply_filters( 'bp_group_request_time_since_requested', sprintf( __( 'requested %s', 'buddypress' ), bp_core_time_since( $requests_template->request->date_modified ) ) ); 3281 3281 } 3282 3282 3283 3283 function bp_group_request_comment() { -
src/bp-members/bp-members-admin.php
915 915 <?php 916 916 917 917 // translators: Publish box date format, see http://php.net/date 918 $datef = __( 'M j, Y @ G:i ', 'buddypress' );919 $date = date_i18n( $datef, strtotime( $user->user_registered ) );918 $datef = __( 'M j, Y @ G:i \U\T\C', 'buddypress' ); 919 $date = date_i18n( $datef, bp_core_strtotime( $user->user_registered ) ); 920 920 ?> 921 921 <span id="timestamp"><?php printf( __( 'Registered on: <strong>%1$s</strong>', 'buddypress' ), $date ); ?></span> 922 922 </div> … … 978 978 } 979 979 980 980 $datef = __( 'M j, Y @ G:i', 'buddypress' ); 981 $date = date_i18n( $datef, strtotime( $last_active ) ); ?>981 $date = date_i18n( $datef, bp_core_strtotime( $last_active ) ); ?> 982 982 983 983 <ul> 984 984 <li class="bp-members-profile-stats"><?php printf( __( 'Last active: %1$s', 'buddypress' ), '<strong>' . $date . '</strong>' ); ?></li> -
src/bp-members/bp-members-template.php
579 579 global $members_template; 580 580 581 581 $classes = array(); 582 $current_time = bp_core_current_time( );582 $current_time = bp_core_current_time( true, 'timestamp' ); 583 583 $pos_in_loop = (int) $members_template->current_member; 584 584 585 585 // If we've only one group in the loop, don't both with odd and even. … … 590 590 591 591 // Has the user been active recently? 592 592 if ( ! empty( $members_template->member->last_activity ) ) { 593 if ( strtotime( $current_time ) <= strtotime( '+5 minutes',strtotime( $members_template->member->last_activity ) ) )593 if ( $current_time <= bp_core_strtotime( '+5 minutes', bp_core_strtotime( $members_template->member->last_activity ) ) ) 594 594 $classes[] = 'is-online'; 595 595 } 596 596 -
src/bp-messages/bp-messages-template.php
614 614 function bp_get_message_thread_last_post_date() { 615 615 global $messages_template; 616 616 617 return apply_filters( 'bp_get_message_thread_last_post_date', bp_format_time( strtotime( $messages_template->thread->last_message_date ) ) );617 return apply_filters( 'bp_get_message_thread_last_post_date', bp_format_time( bp_core_strtotime( $messages_template->thread->last_message_date ) ) ); 618 618 } 619 619 620 620 /** … … 917 917 */ 918 918 function bp_get_message_notice_post_date() { 919 919 global $messages_template; 920 return apply_filters( 'bp_get_message_notice_post_date', bp_format_time( strtotime($messages_template->thread->date_sent) ) );920 return apply_filters( 'bp_get_message_notice_post_date', bp_format_time( bp_core_strtotime($messages_template->thread->date_sent) ) ); 921 921 } 922 922 923 923 /** … … 1722 1722 function bp_get_the_thread_message_date_sent() { 1723 1723 global $thread_template; 1724 1724 1725 return apply_filters( 'bp_get_the_thread_message_date_sent', strtotime( $thread_template->message->date_sent ));1725 return apply_filters( 'bp_get_the_thread_message_date_sent', $thread_template->message->date_sent ); 1726 1726 } 1727 1727 1728 1728 /** -
src/bp-xprofile/bp-xprofile-activity.php
285 285 } else { 286 286 // Default throttle time is 2 hours. Filter to change (in seconds) 287 287 $throttle_period = apply_filters( 'bp_xprofile_updated_profile_activity_throttle_time', 60 * 60 * 2 ); 288 $then = strtotime( $existing['activities'][0]->date_recorded );289 $now = strtotime( bp_core_current_time());288 $then = bp_core_strtotime( $existing['activities'][0]->date_recorded ); 289 $now = bp_core_current_time( true, 'timestamp' ); 290 290 291 291 $throttle = ( $now - $then ) < $throttle_period; 292 292 } -
src/bp-xprofile/bp-xprofile-classes.php
1714 1714 1715 1715 // If Unix timestamp 1716 1716 if ( ! is_numeric( $field_value ) ) { 1717 $field_value = strtotime( $field_value );1717 $field_value = bp_core_strtotime( $field_value ); 1718 1718 } 1719 1719 1720 1720 return bp_format_time( $field_value, true, false ); -
src/bp-xprofile/bp-xprofile-template.php
698 698 $last_updated = bp_get_user_meta( bp_displayed_user_id(), 'profile_last_updated', true ); 699 699 700 700 if ( $last_updated ) 701 return apply_filters( 'bp_get_profile_last_updated', sprintf( __('Profile updated %s', 'buddypress'), bp_core_time_since( strtotime( $last_updated ) ) ) );701 return apply_filters( 'bp_get_profile_last_updated', sprintf( __('Profile updated %s', 'buddypress'), bp_core_time_since( bp_core_strtotime( $last_updated ) ) ) ); 702 702 703 703 return false; 704 704 }
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)