当前位置: 首页>>代码示例>>PHP>>正文


PHP bp_core_time_since函数代码示例

本文整理汇总了PHP中bp_core_time_since函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_core_time_since函数的具体用法?PHP bp_core_time_since怎么用?PHP bp_core_time_since使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bp_core_time_since函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bp_get_the_notification_time_since

/**
 * Return the timestamp of the current notification.
 *
 * @since BuddyPress (1.9.0)
 *
 * @return string Timestamp of the current notification.
 */
function bp_get_the_notification_time_since()
{
    // Get the notified date
    $date_notified = bp_get_the_notification_date_notified();
    // Notified date has legitimate data
    if ('0000-00-00 00:00:00' !== $date_notified) {
        $retval = bp_core_time_since($date_notified);
        // Notified date is empty, so return a fun string
    } else {
        $retval = __('Date not found', 'buddypress');
    }
    /**
     * Filters the time since value of the current notification.
     *
     * @since BuddyPress (1.9.0)
     *
     * @param string $retval Time since value for current notification.
     */
    return apply_filters('bp_get_the_notification_time_since', $retval);
}
开发者ID:AceMedia,项目名称:BuddyPress,代码行数:27,代码来源:bp-notifications-template.php

示例2: test_bp_get_blog_last_active_active_format_false

 /**
  * @group bp_get_blog_last_active
  */
 public function test_bp_get_blog_last_active_active_format_false()
 {
     // Fake the global
     global $blogs_template;
     $time = date('Y-m-d h:i:s', time() - 24 * 60 * 60);
     $blogs_template = new stdClass();
     $blogs_template->blog = new stdClass();
     $blogs_template->blog->last_activity = $time;
     $this->assertEquals(bp_core_time_since($time), bp_get_blog_last_active(array('active_format' => false)));
     $blogs_template->blog = null;
 }
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:14,代码来源:template.php

示例3: dpa_get_achievement_unlocked_ago

/**
 * Returns a Human-readable representation of when this Achievement was unlocked, i.e. "four days ago"
 *
 * @since 2.0
 * @global DPA_Achievement_Template $achievements_template Achievements template tag object
 * @return string
 */
function dpa_get_achievement_unlocked_ago()
{
    global $achievements_template;
    return apply_filters('dpa_get_achievement_unlocked_date', sprintf(__(' %s ago', 'dpa'), bp_core_time_since($achievements_template->achievement->achieved_at)));
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:12,代码来源:achievements-templatetags.php

示例4: bp_group_request_time_since_requested

function bp_group_request_time_since_requested()
{
    global $requests_template;
    echo apply_filters('bp_group_request_time_since_requested', sprintf(__('requested %s', 'buddypress'), bp_core_time_since(strtotime($requests_template->request->date_modified))));
}
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:5,代码来源:bp-groups-template.php

示例5: bp_group_request_time_since_requested

/**
 * @since 1.0.0
 */
function bp_group_request_time_since_requested()
{
    global $requests_template;
    /**
     * Filters the formatted time since membership was requested.
     *
     * @since 1.0.0
     *
     * @param string $value Formatted time since membership was requested.
     */
    echo apply_filters('bp_group_request_time_since_requested', sprintf(__('requested %s', 'buddypress'), bp_core_time_since(strtotime($requests_template->request->date_modified))));
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:15,代码来源:bp-groups-template.php

示例6: build_html

    function build_html()
    {
        // Store everything in an output buffer
        ob_start();
        ?>
	
		<div class="widget showcase-widget">
			<header class="widget-header">
				<h3 class="widget-title">Recent Discussion</h3>
			</header>
			<ul class="recent-discussion-list">		
	
			<?php 
        // Iterate topics
        while (bp_activities()) {
            bp_the_activity();
            // Get the activity user
            $user = new Apoc_User(bp_get_activity_user_id(), 'directory', 40);
            // Get the activity type
            $type = bp_get_activity_type();
            // Format activity based on context
            switch ($type) {
                case 'bbp_topic_create':
                    $topic_id = bp_get_activity_item_id();
                    $link = '<a href="' . bbp_get_topic_permalink($topic_id) . '" title="Read topic" target="_blank">' . bbp_get_topic_title($topic_id) . '</a>';
                    $verb = 'created topic';
                    break;
                case 'bbp_reply_create':
                    $reply_id = bp_get_activity_secondary_item_id();
                    $link = '<a href="' . bbp_get_topic_last_reply_url($reply_id) . '" title="Read reply" target="_blank">' . bbp_get_topic_title($reply_id) . '</a>';
                    $verb = 'replied to';
                    break;
                case 'new_blog_comment':
                    $comment_id = bp_get_activity_secondary_item_id();
                    $comment = get_comment($comment_id);
                    $link = '<a href="' . get_comment_link($comment_id) . '" title="Read reply" target="_blank">' . get_the_title($comment->comment_post_ID) . '</a>';
                    $verb = 'commented on';
                    break;
            }
            // Get the activity time
            $time = bp_core_time_since(bp_get_activity_date_recorded());
            // Output the HTML
            ?>
				<li class="recent-discussion double-border">			
					<?php 
            echo $user->avatar;
            ?>
					<div class="recent-discussion-content">
						<span class="recent-discussion-title"><?php 
            echo $user->link . ' ' . $verb . ' ' . $link;
            ?>
</span>
						<span class="recent-discussion-time"><?php 
            echo $time;
            ?>
					</div>
				</li>
			
			<?php 
        }
        ?>
			</ul>
		</div><?php 
        // Get the contents of the buffer
        $html = ob_get_contents();
        ob_end_clean();
        // Return the html to the class
        return $html;
    }
开发者ID:tamriel-foundry,项目名称:apoc2,代码行数:69,代码来源:widgets.php

示例7: bp_dtheme_ajax_messages_send_reply

/**
 * Send a private message reply to a thread via a POST request.
 *
 * @return string HTML
 * @since BuddyPress (1.2)
 */
function bp_dtheme_ajax_messages_send_reply()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    check_ajax_referer('messages_send_message');
    $result = messages_new_message(array('thread_id' => $_REQUEST['thread_id'], 'content' => $_REQUEST['content']));
    if ($result) {
        ?>
		<div class="message-box new-message">
			<div class="message-metadata">
				<?php 
        do_action('bp_before_message_meta');
        ?>
				<?php 
        echo bp_loggedin_user_avatar('type=thumb&width=30&height=30');
        ?>

				<strong><a href="<?php 
        echo bp_loggedin_user_domain();
        ?>
"><?php 
        bp_loggedin_user_fullname();
        ?>
</a> <span class="activity"><?php 
        printf(__('Sent %s', 'logicalboneshug'), bp_core_time_since(bp_core_current_time()));
        ?>
</span></strong>

				<?php 
        do_action('bp_after_message_meta');
        ?>
			</div>

			<?php 
        do_action('bp_before_message_content');
        ?>

			<div class="message-content">
				<?php 
        echo stripslashes(apply_filters('bp_get_the_thread_message_content', $_REQUEST['content']));
        ?>
			</div>

			<?php 
        do_action('bp_after_message_content');
        ?>

			<div class="clear"></div>
		</div>
	<?php 
    } else {
        echo "-1<div id='message' class='error'><p>" . __('There was a problem sending that reply. Please try again.', 'logicalboneshug') . '</p></div>';
    }
    exit;
}
开发者ID:raminjan,项目名称:logicalbones_hug,代码行数:63,代码来源:ajax.php

示例8: gtags_activity_for_item


//.........这里部分代码省略.........
    $filter = array('user_id' => false, 'object' => 'groups', 'action' => false, 'primary_id' => implode(',', (array) $group_ids));
    $activity = bp_activity_get(array('max' => 1000, 'per_page' => 1000, 'filter' => $filter, 'show_hidden' => $show_hidden));
    //$type_skip = apply_filters( 'gtags_type_skip', array( 'joined_group' ) ); // array of activity types to skip
    // generate a cleaned array of content
    foreach ($activity['activities'] as $item) {
        if (in_array($item->type, (array) $type_skip)) {
            continue;
        }
        $action = preg_replace('/:$/', '', $item->action);
        // remove trailing colon in activity
        $action = apply_filters('gtags_action', $action);
        $content = strip_tags(stripslashes($item->content));
        if ($truncate && strlen($content) > $truncate) {
            $content = substr($content, 0, $truncate) . '... ';
        }
        if ($content) {
            $content .= ' &nbsp;<a href="' . $item->primary_link . '">view</a>';
        }
        $activity_list[$item->date_recorded] = array('action' => $action, 'group_id' => $item->item_id, 'content' => $content, 'primary_link' => $item->primary_link, 'user_id' => $item->user_id);
    }
    if (empty($activity_list)) {
        echo __("Sorry, there was no activity found.", 'gtags');
        echo "</div>";
        //close the div
        return;
    }
    // sort them by date (regardless of group)
    ksort($activity_list);
    $activity_list = array_reverse($activity_list);
    // output pretty html for recent activity for groups
    foreach ((array) $activity_list as $date => $item) {
        $i++;
        $group_id = $item['group_id'];
        $action = $item['action'];
        // show only a certain amount, after that make a 'show more' link and show the rest in a hidden div
        if ($i == $show + 1 && $show_more) {
            ?>
<a href="#" class="gtags-more-activity"><?php 
            _e('show more +', 'gtags');
            ?>
</a>
			<div class="gtags-more-content"><?php 
            $more_link = true;
        }
        if ($i > $show + $show_more + 1) {
            break;
        }
        // for repeating group content, remove group link and shrink group avatar
        if ($prev_group_id == $group_id) {
            $action = preg_replace('/ in the group(.*)$/i', '', $action);
            $dup_class = ' duplicate-group';
        } else {
            $dup_class = '';
        }
        $prev_group_id = $group_id;
        // group avatar
        echo '<a href="' . $the_groups[$group_id]['permalink'] . '" title="' . $the_groups[$group_id]['name'] . '" class="gtags-item-group-avatar' . $dup_class . '">' . $the_groups[$group_id]['avatar'] . '</a>';
        // the actual content
        ?>
<div class="gtags-item-recent group">
			<div class="gtags-item-avatar">
				<a href="<?php 
        echo bp_core_get_user_domain($item['user_id']);
        ?>
">
					<?php 
        echo bp_core_fetch_avatar('object=user&type=full&width=50&height=50&item_id=' . $item['user_id']);
        ?>
				</a>
			</div>
			<div class="gtags-item-action">
				<?php 
        echo $action;
        ?>
 
				<span class="gtags-time-ago"><?php 
        echo bp_core_time_since($date);
        ?>
 <?php 
        _e('ago', 'gtags');
        ?>
</span>
			</div>
			<div class="gtags-item-content">
				<?php 
        echo convert_smilies($item['content']);
        ?>
			</div>
		</div><?php 
    }
    if ($more_link) {
        echo '<div class="gtags-recent-groups"> ' . __('Continue reading in:', 'gtags') . ' ' . $group_output . '</div>';
        echo '</div>';
        // close the more div
    }
    ?>
</div><?php 
    // end recent
    return ob_get_clean();
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:101,代码来源:bp-group-tags.php

示例9: __

								<h5 class="title">
									<?php 
__('Friend resquest', 'dln-theme-hc');
?>
								</h5>
								<ul class="dropdown-list user-list">
									<?php 
if ($notifications['friends']['nof_arr']) {
    ?>
									<?php 
    foreach ($notifications['friends']['nof_arr'] as $nof) {
        if ($nof) {
            $user = get_userdata($nof->item_id);
            $link = bp_core_get_user_domain($nof->item_id);
            $avatar = get_avatar($nof->item_id, '36', '', $user->display_name);
            $since_time = bp_core_time_since($nof->date_notified);
            ?>
										<li class="new">
											<div class="thumb">
												<a href="<?php 
            echo $link;
            ?>
"><?php 
            echo $avatar;
            ?>
 </a>
											</div>
											<div class="desc">
												<h5>
													<a href="<?php 
            echo $link;
开发者ID:httvncoder,项目名称:151722441,代码行数:31,代码来源:header.php

示例10: history_metabox

 /**
  * History meta box for the Activity admin edit screen
  *
  * @param object $item Activity item
  * @since BuddyPress (1.6)
  * @todo Update activity meta to allow >1 record with the same key (iterate through $history).
  * @see http://buddypress.trac.wordpress.org/ticket/3907
  */
 function history_metabox($item)
 {
     $history = BP_Akismet::get_activity_history($item->id);
     if (empty($history)) {
         return;
     }
     echo '<div class="akismet-history"><div>';
     printf(_x('<span>%1$s</span> &mdash; %2$s', 'x hours ago - akismet cleared this item', 'buddypress'), bp_core_time_since($history[2]), esc_html($history[1]));
     echo '</div></div>';
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:18,代码来源:bp-activity-akismet.php

示例11: manage_users_custom_column

 public function manage_users_custom_column($empty, $column_name, $user_id)
 {
     if ('timestamps' != $column_name) {
         return $empty;
     }
     global $gMemberNetwork;
     $html = '';
     $mode = empty($_REQUEST['mode']) ? 'list' : $_REQUEST['mode'];
     $user = get_user_by('id', $user_id);
     $lastlogin = get_user_meta($user_id, $this->constants['meta_lastlogin'], TRUE);
     $register_ip = get_user_meta($user_id, $this->constants['meta_register_ip'], TRUE);
     $registered = strtotime(get_date_from_gmt($user->user_registered));
     $lastlogged = $lastlogin ? strtotime(get_date_from_gmt($lastlogin)) : NULL;
     $html .= '<table></tbody>';
     $html .= '<tr><td>' . __('Registered', GMEMBER_TEXTDOMAIN) . '</td><td><code title="' . $gMemberNetwork->getDate($registered, 'timeampm') . '">' . $gMemberNetwork->getDate($registered) . '</code></td></tr>';
     $html .= '<tr><td>' . __('Last Login', GMEMBER_TEXTDOMAIN) . '</td><td>' . ($lastlogin ? '<code title="' . $gMemberNetwork->getDate($lastlogged, 'timeampm') . '">' . $gMemberNetwork->getDate($lastlogged) . '</code>' : '<code>' . __('N/A', GMEMBER_TEXTDOMAIN)) . '</code></td></tr>';
     if (function_exists('bp_get_user_last_activity')) {
         if ($lastactivity = bp_get_user_last_activity($user_id)) {
             $lastactive = strtotime(get_date_from_gmt($lastactivity));
         }
         $html .= '<tr><td>' . __('Last Activity', GMEMBER_TEXTDOMAIN) . '</td><td>' . ($lastactivity ? '<code title="' . bp_core_time_since($lastactivity) . '">' . $gMemberNetwork->getDate($lastactive) : '<code>' . __('N/A', GMEMBER_TEXTDOMAIN)) . '</code></td></tr>';
     }
     $html .= '<tr><td>' . __('Register IP', GMEMBER_TEXTDOMAIN) . '</td><td><code>' . ($register_ip ? $gMemberNetwork->getIPLookup($register_ip) : __('N/A', GMEMBER_TEXTDOMAIN)) . '</code></td></tr>';
     $html .= '</tbody></table>';
     echo $html;
 }
开发者ID:geminorum,项目名称:gmember,代码行数:26,代码来源:admin.class.php

示例12: bp_get_the_thread_message_time_since

function bp_get_the_thread_message_time_since()
{
    global $thread_template;
    return apply_filters('bp_get_the_thread_message_time_since', sprintf(__('Sent %s', 'buddypress'), bp_core_time_since(strtotime($thread_template->message->date_sent))));
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:5,代码来源:bp-messages-template.php

示例13: bp_get_activity_comment_date_recorded

/**
 * Gets the date_recorded for the activity comment currently being displayed
 *
 * @since 1.5.0
 *
 * @global object $activities_template {@link BP_Activity_Template}
 * @uses bp_core_time_since()
 * @uses apply_filters() To call the 'bp_activity_comment_date_recorded' hook
 *
 * @return string|bool $date_recorded Time since the activity was recorded, of the form "%s ago". False on failure
 */
function bp_get_activity_comment_date_recorded()
{
    global $activities_template;
    if (empty($activities_template->activity->current_comment->date_recorded)) {
        return false;
    }
    $date_recorded = bp_core_time_since($activities_template->activity->current_comment->date_recorded);
    return apply_filters('bp_activity_comment_date_recorded', $date_recorded);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:20,代码来源:bp-activity-template.php

示例14: dwqa_replace_activity_meta

function dwqa_replace_activity_meta()
{
    global $activities_template;
    $blog_url = bp_blogs_get_blogmeta($activity->item_id, 'url');
    $blog_name = bp_blogs_get_blogmeta($activity->item_id, 'name');
    if (empty($blog_url) || empty($blog_name)) {
        $blog_url = get_home_url($activity->item_id);
        $blog_name = get_blog_option($activity->item_id, 'blogname');
        bp_blogs_update_blogmeta($activity->item_id, 'url', $blog_url);
        bp_blogs_update_blogmeta($activity->item_id, 'name', $blog_name);
    }
    $post_url = add_query_arg('p', $activities_template->activity->secondary_item_id, trailingslashit($blog_url));
    $post_title = bp_activity_get_meta($activities_template->activity->id, 'post_title');
    if (empty($post_title)) {
        $post = get_post($activities_template->activity->secondary_item_id);
        if (is_a($post, 'WP_Post')) {
            $post_title = $post->post_title;
            bp_activity_update_meta($activities_template->activity->id, 'post_title', $post_title);
        }
    }
    $post_link = '<a href="' . $post_url . '">' . $post_title . '</a>';
    $user_link = bp_core_get_userlink($activities_template->activity->user_id);
    if ($activities_template->activity->type == 'new_question') {
        $action = sprintf(__('%1$s asked a new question: %2$s', 'dwqa'), $user_link, $post_link);
    } elseif ($activities_template->activity->type == 'new_answer') {
        $action = sprintf(__('%1$s answered the question: %2$s', 'dwqa'), $user_link, $post_link);
    } elseif ($activities_template->activity->type == 'comment_question') {
        $action = sprintf(__('%1$s commented on the question: %2$s', 'dwqa'), $user_link, $post_link);
    } elseif ($activities_template->activity->type == 'comment_answer') {
        $action = sprintf(__('%1$s commented on the answer at: %2$s', 'dwqa'), $user_link, $post_link);
    } else {
        $action = $activities_template->activity->action;
    }
    // Strip any legacy time since placeholders from BP 1.0-1.1
    $content = str_replace('<span class="time-since">%s</span>', '', $content);
    // Insert the time since.
    $time_since = apply_filters_ref_array('bp_activity_time_since', array('<span class="time-since">' . bp_core_time_since($activities_template->activity->date_recorded) . '</span>', &$activities_template->activity));
    // Insert the permalink
    if (!bp_is_single_activity()) {
        $content = apply_filters_ref_array('bp_activity_permalink', array(sprintf('%1$s <a href="%2$s" class="view activity-time-since" title="%3$s">%4$s</a>', $content, bp_activity_get_permalink($activities_template->activity->id, $activities_template->activity), esc_attr__('View Discussion', 'buddypress'), $time_since), &$activities_template->activity));
    } else {
        $content .= str_pad($time_since, strlen($time_since) + 2, ' ', STR_PAD_BOTH);
    }
    echo $action . ' ' . $content;
    // echo 'abc';
    // echo $activities_template->activity->content;
}
开发者ID:linkinf88k,项目名称:dw-question-answer,代码行数:47,代码来源:buddypress.php

示例15: rendez_vous_get_last_modified

/**
 * Return the date of the Rendez Vous.
 *
 * @since Rendez Vous (1.0.0)
 */
function rendez_vous_get_last_modified()
{
    $last_modified = bp_core_time_since(rendez_vous()->query_loop->rendez_vous->post_modified_gmt);
    return apply_filters('rendez_vous_get_last_modified', sprintf(__('Modified %s', 'rendez-vous'), $last_modified));
}
开发者ID:socialray,项目名称:surfied-2-0,代码行数:10,代码来源:rendez-vous-template.php


注:本文中的bp_core_time_since函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。