Skip to:
Content

BuddyPress.org

Changeset 9824


Ignore:
Timestamp:
04/30/2015 06:42:58 PM (10 years ago)
Author:
johnjamesjacoby
Message:

Activity: Introduce comment_date_recorded_raw() functions for retrieving an unformatted date_recorded value for an activity stream comment. Adjusts phpdoc for existing date_recorded() functions to note that they are formatted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-template.php

    r9819 r9824  
    24802480
    24812481/**
    2482  * Output the date_recorded of the activity comment currently being displayed.
     2482 * Output the formatted date_recorded of the activity comment currently being displayed.
    24832483 *
    24842484 * @since BuddyPress (1.5.0)
     
    24912491
    24922492    /**
     2493     * Return the formatted date_recorded for the activity comment currently being displayed.
     2494     *
     2495     * @since BuddyPress (1.5.0)
     2496     *
     2497     * @uses bp_core_time_since()
     2498     * @uses apply_filters() To call the 'bp_activity_comment_date_recorded' hook
     2499     *
     2500     * @return string|bool $date_recorded Time since the activity was recorded,
     2501     *         in the form "%s ago". False on failure.
     2502     */
     2503    function bp_get_activity_comment_date_recorded() {
     2504
     2505        /**
     2506         * Filters the recorded date of the activity comment currently being displayed.
     2507         *
     2508         * @since BuddyPress (1.5.0)
     2509         *
     2510         * @param string|bool Date for the activity comment currently being displayed.
     2511         */
     2512        return apply_filters( 'bp_activity_comment_date_recorded', bp_core_time_since( bp_get_activity_comment_date_recorded_raw() ) );
     2513    }
     2514
     2515/**
     2516 * Output the date_recorded of the activity comment currently being displayed.
     2517 *
     2518 * @since BuddyPress (2.3.0)
     2519 *
     2520 * @uses bp_get_activity_comment_date_recorded()
     2521 */
     2522function bp_activity_comment_date_recorded_raw() {
     2523    echo bp_get_activity_comment_date_recorded_raw();
     2524}
     2525
     2526    /**
    24932527     * Return the date_recorded for the activity comment currently being displayed.
    24942528     *
    2495      * @since BuddyPress (1.5.0)
     2529     * @since BuddyPress (2.3.0)
    24962530     *
    24972531     * @global object $activities_template {@link BP_Activity_Template}
     
    25022536     *         in the form "%s ago". False on failure.
    25032537     */
    2504     function bp_get_activity_comment_date_recorded() {
     2538    function bp_get_activity_comment_date_recorded_raw() {
    25052539        global $activities_template;
    25062540
    2507         if ( empty( $activities_template->activity->current_comment->date_recorded ) ) {
    2508             return false;
    2509         }
    2510 
    2511         $date_recorded = bp_core_time_since( $activities_template->activity->current_comment->date_recorded );
    2512 
    2513         /**
    2514          * Filters the recorded date of the activity comment currently being displayed.
    2515          *
    2516          * @since BuddyPress (1.5.0)
    2517          *
    2518          * @param string|bool Date for the activity comment currently being displayed.
    2519          */
    2520         return apply_filters( 'bp_activity_comment_date_recorded', $date_recorded );
     2541        /**
     2542         * Filters the raw recorded date of the activity comment currently being displayed.
     2543         *
     2544         * @since BuddyPress (2.3.0)
     2545         *
     2546         * @param string|bool Raw date for the activity comment currently being displayed.
     2547         */
     2548        return apply_filters( 'bp_activity_comment_date_recorded', $activities_template->activity->current_comment->date_recorded );
    25212549    }
    25222550
Note: See TracChangeset for help on using the changeset viewer.