/**
 * Output an ISO-8601 date from a date string.
 *
 * @since 2.7.0
 *
 * @param string String of date to convert. Timezone should be UTC before using this.
 * @return string
 */
function bp_core_iso8601_date($timestamp = '')
{
    echo bp_core_get_iso8601_date($timestamp);
}
Пример #2
0
">
	<div class="acomment-avatar">
		<a href="<?php 
bp_activity_comment_user_link();
?>
">
			<?php 
bp_activity_avatar('type=thumb&user_id=' . bp_get_activity_comment_user_id());
?>
		</a>
	</div>

	<div class="acomment-meta">
		<?php 
/* translators: 1: user profile link, 2: user name, 3: activity permalink, 4: ISO8601 timestamp, 5: activity relative timestamp */
printf(__('<a href="%1$s">%2$s</a> replied <a href="%3$s" class="activity-time-since"><span class="time-since" data-livestamp="%4$s">%5$s</span></a>', 'buddypress'), bp_get_activity_comment_user_link(), bp_get_activity_comment_name(), bp_get_activity_comment_permalink(), bp_core_get_iso8601_date(bp_get_activity_comment_date_recorded()), bp_get_activity_comment_date_recorded());
?>
	</div>

	<div class="acomment-content"><?php 
bp_activity_comment_content();
?>
</div>

	<div class="acomment-options">

		<?php 
if (is_user_logged_in() && bp_activity_can_comment_reply(bp_activity_current_comment())) {
    ?>

			<a href="#acomment-<?php 
/**
 * Attach metadata about an activity item to the activity content.
 *
 * This metadata includes the time since the item was posted (which will appear
 * as a link to the item's permalink).
 *
 * @since 1.2.0
 *
 * @global object $activities_template {@link BP_Activity_Template}
 *
 * @param string $content The activity content.
 * @return string The activity content with the metadata string attached.
 */
function bp_insert_activity_meta($content = '')
{
    global $activities_template;
    // Strip any legacy time since placeholders from BP 1.0-1.1.
    $new_content = str_replace('<span class="time-since">%s</span>', '', $content);
    // Get the time since this activity was recorded.
    $date_recorded = bp_core_time_since($activities_template->activity->date_recorded);
    // Set up 'time-since' <span>.
    $time_since = sprintf('<span class="time-since" data-livestamp="%1$s">%2$s</span>', bp_core_get_iso8601_date($activities_template->activity->date_recorded), $date_recorded);
    /**
     * Filters the activity item time since markup.
     *
     * @since 1.2.0
     *
     * @param array $value Array containing the time since markup and the current activity component.
     */
    $time_since = apply_filters_ref_array('bp_activity_time_since', array($time_since, &$activities_template->activity));
    // Insert the permalink.
    if (!bp_is_single_activity()) {
        // Setup variables for activity meta.
        $activity_permalink = bp_activity_get_permalink($activities_template->activity->id, $activities_template->activity);
        $activity_meta = sprintf('%1$s <a href="%2$s" class="view activity-time-since" title="%3$s">%4$s</a>', $new_content, $activity_permalink, esc_attr__('View Discussion', 'buddypress'), $time_since);
        /**
         * Filters the activity permalink to be added to the activity content.
         *
         * @since 1.2.0
         *
         * @param array $value Array containing the html markup for the activity permalink, after being parsed by
         *                     sprintf and current activity component.
         */
        $new_content = apply_filters_ref_array('bp_activity_permalink', array($activity_meta, &$activities_template->activity));
    } else {
        $new_content .= str_pad($time_since, strlen($time_since) + 2, ' ', STR_PAD_BOTH);
    }
    /**
     * Filters the activity content after activity metadata has been attached.
     *
     * @since 1.2.0
     *
     * @param string $content Activity content with the activity metadata added.
     */
    return apply_filters('bp_insert_activity_meta', $new_content, $content);
}
Пример #4
0
 /**
  * @group bp_core_get_iso8601_date
  */
 public function test_bp_core_get_iso8601_date_invalid_date()
 {
     $this->assertEquals('', bp_core_get_iso8601_date('Not a date'));
 }