Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/27/2018 04:52:27 PM (8 years ago)
Author:
imath
Message:

BP Nouveau: use Moment.js & Livestamp.js to update activity timestamps

Before these two JavaScript libraries were introduced in BuddyPress Core (2.7.0), i added some custom JavaScript code to perform the dynamic activity timestamp update task. Now these two libraries are available and do the job way better, it is about time to say goodbye to this code.

Fixes #7772

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/includes/activity/functions.php

    r11900 r12002  
    426426
    427427        return $classes;
    428 }
    429 
    430 /**
    431  * @since 3.0.0
    432  */
    433 function bp_nouveau_activity_time_since( $time_since, $activity = null ) {
    434         if ( ! isset( $activity->date_recorded ) ) {
    435                 return $time_since;
    436         }
    437 
    438         return apply_filters(
    439                 'bp_nouveau_activity_time_since', sprintf(
    440                         '<time class="time-since" datetime="%1$s" data-bp-timestamp="%2$d">%3$s</time>',
    441                         esc_attr( $activity->date_recorded ),
    442                         esc_attr( strtotime( $activity->date_recorded ) ),
    443                         esc_attr( bp_core_time_since( $activity->date_recorded ) )
    444                 )
    445         );
    446 }
    447 
    448 /**
    449  * @since 3.0.0
    450  */
    451 function bp_nouveau_activity_allowed_tags( $activity_allowedtags = array() ) {
    452         $activity_allowedtags['time']                      = array();
    453         $activity_allowedtags['time']['class']             = array();
    454         $activity_allowedtags['time']['datetime']          = array();
    455         $activity_allowedtags['time']['data-bp-timestamp'] = array();
    456 
    457         return $activity_allowedtags;
    458428}
    459429
Note: See TracChangeset for help on using the changeset viewer.