Skip to:
Content

BuddyPress.org

Changeset 11019


Ignore:
Timestamp:
08/19/2016 06:18:07 PM (8 years ago)
Author:
r-a-y
Message:

Core: Remove redundant strtotime() calls.

See #5781.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-functions.php

    r11008 r11019  
    14431443
    14441444    // Get current time.
    1445     $current_time = bp_core_current_time();
     1445    $current_time = bp_core_current_time( true, 'timestamp' );
    14461446
    14471447    // Use this action to detect the very first activity for a given member.
     
    14611461
    14621462    // If it's been more than 5 minutes, record a newer last-activity time.
    1463     if ( empty( $activity ) || ( strtotime( $current_time ) >= strtotime( '+5 minutes', $activity ) ) ) {
     1463    if ( empty( $activity ) || ( $current_time >= strtotime( '+5 minutes', $activity ) ) ) {
    14641464        bp_update_user_last_activity( $user_id, $current_time );
    14651465    }
  • trunk/src/bp-groups/bp-groups-template.php

    r11008 r11019  
    11181118         * @param object $group Group object.
    11191119         */
    1120         return apply_filters( 'bp_get_group_date_created', bp_core_time_since( strtotime( $group->date_created ) ), $group );
     1120        return apply_filters( 'bp_get_group_date_created', bp_core_time_since( $group->date_created ), $group );
    11211121    }
    11221122
     
    54355435     * @param string $value Formatted time since membership was requested.
    54365436     */
    5437     echo apply_filters( 'bp_group_request_time_since_requested', sprintf( __( 'requested %s', 'buddypress' ), bp_core_time_since( strtotime( $requests_template->request->date_modified ) ) ) );
     5437    echo apply_filters( 'bp_group_request_time_since_requested', sprintf( __( 'requested %s', 'buddypress' ), bp_core_time_since( $requests_template->request->date_modified ) ) );
    54385438}
    54395439
  • trunk/src/bp-members/bp-members-template.php

    r11011 r11019  
    611611
    612612            // Calculate some times.
    613             $current_time  = strtotime( bp_core_current_time() );
     613            $current_time  = bp_core_current_time( true, 'timestamp' );
    614614            $last_activity = strtotime( $members_template->member->last_activity );
    615615            $still_online  = strtotime( '+5 minutes', $last_activity );
  • trunk/src/bp-xprofile/bp-xprofile-activity.php

    r10825 r11019  
    308308        $throttle_period = apply_filters( 'bp_xprofile_updated_profile_activity_throttle_time', HOUR_IN_SECONDS * 2 );
    309309        $then            = strtotime( $existing['activities'][0]->date_recorded );
    310         $now             = strtotime( bp_core_current_time() );
     310        $now             = bp_core_current_time( true, 'timestamp' );
    311311
    312312        // Bail if throttled.
  • trunk/tests/phpunit/testcases/core/functions.php

    r10972 r11019  
    601601
    602602    /**
     603     * @group bp_core_time_since
     604     */
     605    public function test_bp_core_time_since_mysql_and_unix_timestamp_return_same_value() {
     606        $mysql_date   = '2008-03-25 17:13:55';
     607
     608        $ts_mysql     = bp_core_time_since( $mysql_date );
     609        $ts_timestamp = bp_core_time_since( strtotime( $mysql_date ) );
     610
     611        $this->assertSame( $ts_mysql, $ts_timestamp );
     612    }
     613
     614    /**
    603615     * @group bp_attachments
    604616     * @group bp_upload_dir
Note: See TracChangeset for help on using the changeset viewer.