本文整理汇总了PHP中ap_human_time函数的典型用法代码示例。如果您正苦于以下问题:PHP ap_human_time函数的具体用法?PHP ap_human_time怎么用?PHP ap_human_time使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ap_human_time函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: answers_meta_box_content
/**
* Render Meta Box content.
*/
public function answers_meta_box_content()
{
$ans_args = array('post_type' => 'answer', 'post_status' => 'publish', 'post_parent' => get_the_ID(), 'showposts' => 10, 'orderby' => 'date', 'order' => 'DESC');
$ans_args = apply_filters('ap_meta_box_answers_query_args', $ans_args);
$answers = get_posts($ans_args);
if (!empty($answers)) {
foreach ($answers as $ans) {
?>
<div class="answer clearfix">
<div class="author">
<span><?php
echo get_avatar($ans->post_author, 30);
?>
</span>
<strong><?php
echo ap_user_display_name($ans->post_author);
?>
</strong>
</div>
<div class="answer-content">
<div class="submitted-on">
<?php
printf(__('%sAnswered about %s ago%s', 'ap'), '<span class="when">', '</span>', ap_human_time(get_the_time('U', $ans)));
?>
</div>
<p><?php
echo $ans->post_content;
?>
</p>
<div class="row-actions">
<span><a href="<?php
echo get_edit_post_link($ans->ID);
?>
"><?php
_e('Edit', 'ap');
?>
</a></span>
<span> | <a href="#"><?php
_e('Hide', 'ap');
?>
</a></span>
<span class="delete vim-d vim-destructive"> | <a href="<?php
echo get_delete_post_link($ans->ID);
?>
"><?php
_e('Trash', 'ap');
?>
</a></span>
</div>
</div>
</div>
<?php
}
} else {
_e('No answers yet', 'ap');
}
wp_reset_postdata();
}
示例2: widget
public function widget($args, $instance)
{
$title = apply_filters('widget_title', @$instance['title']);
echo $args['before_widget'];
if (!empty($title)) {
echo $args['before_title'] . $title . $args['after_title'];
}
$ans_count = ap_question_get_the_answer_count();
$last_active = ap_question_get_the_active_ago();
$total_subs = ap_question_get_the_subscriber_count();
$view_count = ap_question_get_the_view_count();
echo '<div class="ap-widget-inner">';
if (is_question()) {
echo '<ul class="ap-stats-widget">';
echo '<li><span class="stat-label apicon-pulse">' . __('Active', 'ap') . '</span><span class="stat-value"><time class="published updated" itemprop="dateModified" datetime="' . mysql2date('c', $last_active) . '">' . ap_human_time(mysql2date('U', $last_active)) . '</time></span></li>';
echo '<li><span class="stat-label apicon-eye">' . __('Views', 'ap') . '</span><span class="stat-value">' . sprintf(_n('One time', '%d times', $view_count, 'ap'), $view_count) . '</span></li>';
echo '<li><span class="stat-label apicon-answer">' . __('Answers', 'ap') . '</span><span class="stat-value">' . sprintf(_n('%2$s1%3$s answer', '%2$s%1$d%3$s answers', $ans_count, 'ap'), $ans_count, '<span data-view="answer_count">', '</span>') . '</span></li>';
echo '<li><span class="stat-label apicon-mail">' . __('Followers', 'ap') . '</span><span class="stat-value">' . sprintf(_n('1 follower', '%d followers', $total_subs, 'ap'), $total_subs) . '</span></li>';
echo '</ul>';
} else {
_e('This widget can only be used in single question page', 'ap');
}
echo '</div>';
echo $args['after_widget'];
}
示例3: ap_comment
function ap_comment($comment)
{
$GLOBALS['comment'] = $comment;
?>
<li <?php
comment_class();
?>
id="li-comment-<?php
comment_ID();
?>
">
<!-- comment #<?php
comment_ID();
?>
-->
<article id="comment-<?php
comment_ID();
?>
" class="comment">
<div class="ap-avatar">
<a href="<?php
echo ap_user_link($comment->user_id);
?>
">
<?php
echo get_avatar($comment, ap_opt('avatar_size_qcomment'));
?>
</a>
</div>
<div class="comment-content">
<?php
if ('0' == $comment->comment_approved) {
?>
<p class="comment-awaiting-moderation"><?php
_e('Your comment is awaiting moderation.', 'ap');
?>
</p>
<?php
}
?>
<p class="ap-comment-texts">
<?php
echo get_comment_text();
?>
<?php
printf(' - <time datetime="%1$s">%2$s %3$s</time>', get_comment_time('c'), ap_human_time(get_comment_time('U')), __('ago', 'ap'));
?>
</p>
<div class="comment-meta">
<?php
if (ap_user_can_edit_comment(get_comment_ID())) {
echo '<a class="comment-edit-btn" href="#" data-button="ap-edit-comment" data-args="' . get_comment_ID() . '-' . wp_create_nonce('comment-' . get_comment_ID()) . '"><i class="aicon-pencil"></i> ' . __('Edit', 'ap') . '</a>';
}
if (ap_user_can_delete_comment(get_comment_ID())) {
echo '<a class="comment-delete-btn" href="#" data-button="ap-delete-comment" data-confirm="' . __('Are you sure? It cannot be undone!', 'ap') . '" data-args="' . get_comment_ID() . '-' . wp_create_nonce('delete-comment-' . get_comment_ID()) . '"><i class="aicon-close"></i> ' . __('Delete', 'ap') . '</a>';
}
?>
</div>
</div>
</article>
<?php
}
示例4: ap_get_latest_history_html
function ap_get_latest_history_html($post_id, $avatar = false, $icon = false)
{
$history = ap_get_latest_history($post_id);
$html = '';
if ($history) {
if ($avatar) {
$html .= '<a class="ap-savatar" href="' . ap_user_link($history['user_id']) . '">' . get_avatar($history['user_id'], 20) . '</a>';
}
if ($icon) {
$html .= '<span class="' . ap_history_icon($history['type']) . ' ap-tlicon"></span>';
}
$html .= '<span class="ap-post-history">' . sprintf(__('%s %s about %s ago', 'ap'), ap_user_display_name($history['user_id']), ap_history_name($history['type']), ap_human_time(mysql2date('U', $history['date']))) . '</span>';
} elseif (!$icon) {
$html = '<span class="ap-post-history">' . sprintf(__('Asked by %s', 'ap'), ap_user_display_name()) . '</span>';
}
if ($html) {
return apply_filters('ap_latest_history_html', $html);
}
return false;
}
示例5: _e
<li class="ap-tip ap-ansslable" title="<?php
_e('Answer is accepted', 'ap');
?>
">
<i class="ap-icon-answer"></i>
</li>
<?php
}
?>
<li class="list-meta ap-tip" title="<?php
_e('Last activity', 'ap');
?>
">
<i class="ap-icon-clock ap-meta-icon"></i>
<?php
printf('<span class="when">%s %s ago</span>', ap_get_latest_history_html(get_the_ID()), ap_human_time(mysql2date('U', ap_last_active(get_question_id()))));
ap_user_display_name();
?>
</li>
<li class="ap-tip" title="<?php
_e('Question category', 'ap');
?>
"><?php
ap_question_categories_html(false, false);
?>
</li>
<li class="ap-tip" title="<?php
_e('Question tagged', 'ap');
?>
"><?php
ap_question_tags_html(false, false);
示例6: ap_reputation_get_the_date
function ap_reputation_get_the_date()
{
printf(__('%s ago', 'ap'), ap_human_time(ap_reputation_get_date(), false));
}
示例7: ap_user_link
</div><!-- close .ap-avatar -->
<div class="ap-comment-content no-overflow">
<div class="ap-comment-header">
<a href="<?php
echo ap_user_link($comment->user_id);
?>
" class="ap-comment-author"><?php
echo ap_user_display_name($comment->user_id);
?>
</a>
<?php
$a = ' e ';
$b = ' ';
$time = get_option('date_format') . $b . get_option('time_format') . $a . get_option('gmt_offset');
printf(' - <a title="%3$s" href="#li-comment-%4$s" class="ap-comment-time"><time datetime="%1$s">%2$s</time></a>', get_comment_time('c'), ap_human_time(get_comment_time('U')), get_comment_time($time), get_comment_ID());
// Comment actions
ap_comment_actions_buttons();
?>
</div><!-- close .ap-comment-header -->
<div class="ap-comment-texts">
<?php
comment_text();
?>
</div>
<?php
/**
* ACTION: ap_after_comment_content
* Action called after comment content.
*
* @since 2.0.1
示例8: flag_meta_box_content
public function flag_meta_box_content($post)
{
// get all flag message
$flag_note = ap_opt('flag_note');
$results = ap_get_all_meta(array('apmeta_type' => 'flag', 'apmeta_actionid' => $post->ID), 10);
if (!empty($results)) {
foreach ($results as $r) {
?>
<div class="flag-item clearfix">
<div class="flagger">
<?php
echo get_avatar($r->apmeta_userid, 30);
?>
<strong><?php
echo ap_user_display_name($r->apmeta_userid);
?>
</strong>
</div>
<div class="flag-message">
<div class="submitted-on">
<?php
printf(__('<span class="when">Flagged about %s ago</span>', 'ap'), ap_human_time($r->unix_date));
?>
</div>
<strong><?php
echo $r->apmeta_value !== NULL ? $flag_note[$r->apmeta_value]['title'] : __('Flagged with custom message', 'ap');
?>
</strong>
<span><?php
echo $r->apmeta_value !== NULL ? $flag_note[$r->apmeta_value]['description'] : $r->apmeta_param;
?>
</span>
</div>
</div>
<?php
}
} else {
_e('No flag yet', 'ap');
}
}
示例9: ap_icon
</div>
</li>
<li>
<div class="ap-about-stats-item">
<?php
echo ap_icon('eye', true);
printf(__('%d profile views', 'ap'), ap_user_get_the_meta('__profile_views'));
?>
</div>
</li>
<li>
<div class="ap-about-stats-item">
<?php
echo ap_icon('clock', true);
if (ap_user_get_the_meta('__last_active') != 0) {
printf(__('Last seen %s ago', 'ap'), ap_human_time(ap_user_get_the_meta('__last_active'), false));
} else {
_e('Never logged in', 'ap');
}
?>
</div>
</li>
</ul><!-- close .ap-about-stats -->
</div><!-- close .ap-about-block-c -->
</div><!-- close .ap-about-block.user-stats -->
<div class="ap-about-block">
<h3><?php
echo ap_icon('reputation', true);
示例10: ap_get_message_html
function ap_get_message_html($message, $return = true)
{
$link = ap_user_link($message->message_sender);
$o = '<li class="ap-message clearfix">
<div class="ap-avatar">' . ap_user_avatar($message->message_sender, true) . '</div>
<div class="no-overflow">
<div class="ap-message-head clearfix">
<strong><a href="' . $link . '">' . ap_user_display_name($message->message_sender, true) . '</a></strong>
';
if ($message->message_sender == get_current_user_id()) {
$o .= '<div class="ap-message-btns ap-dropdown">
<a href="#" class="btn ap-btn ap-dropdown-toggle ap-icon-arrow-down"></a>
<ul class="ap-dropdown-menu">
' . ap_message_actions_buttons($message) . '
</ul>
</div>';
}
$o .= '<time>' . sprintf(__('%s ago', 'ap'), ap_human_time($message->message_date, false)) . '</time>
</div>
<div class="ap-message no-overflow" data-view="ap-message-content">
' . apply_filters('the_content', stripslashes_deep($message->message_content)) . '
</div>
</div>
</li>';
$o = apply_filters('ap_get_message_html', $o);
if ($return) {
return $o;
}
echo $o;
}
示例11: ap_get_latest_history_html
function ap_get_latest_history_html($post_id, $initial = false, $avatar = false, $icon = false)
{
$post = get_post($post_id);
$history = get_post_meta($post_id, '__ap_history', true);
if (!$history && $initial) {
$history['date'] = get_the_time('c', $post_id);
$history['user_id'] = $post->post_author;
$history['type'] = 'new_' . $post->post_type;
}
$html = '';
if ($history) {
if ($icon) {
$html .= '<span class="' . ap_icon($history['type']) . ' ap-tlicon"></span>';
}
if ($avatar) {
$html .= '<a class="ap-avatar" href="' . ap_user_link($history['user_id']) . '">' . get_avatar($history['user_id'], 22) . '</a>';
}
$title = ap_history_title($history['type']);
$html .= '<span class="ap-post-history">' . ap_icon('history', true) . sprintf(__(' %s %s %s ago', 'ap'), ap_user_display_name($history['user_id']), $title, '<time datetime="' . mysql2date('c', $history['date']) . '">' . ap_human_time($history['date'], false) . '</time>') . '</span>';
}
if ($html) {
return apply_filters('ap_latest_history_html', $html);
}
return false;
}
示例12: get_avatar
echo get_avatar($comment->user_id, 30);
?>
</a>
</div><!-- close .ap-avatar -->
<div class="ap-comment-content no-overflow">
<div class="ap-comment-header">
<a href="<?php
echo ap_user_link($comment->user_id);
?>
" class="ap-comment-author"><?php
echo ap_user_display_name($comment->user_id);
?>
</a>
<?php
printf(' - <a href="#li-comment-%3$s" class="ap-comment-time"><time datetime="%1$s">%2$s</time></a>', get_comment_time('c', true), ap_human_time(get_comment_time('U', true)), get_comment_ID());
// Comment actions.
ap_comment_actions_buttons();
?>
</div><!-- close .ap-comment-header -->
<div class="ap-comment-texts">
<?php
comment_text();
?>
</div>
<?php
/**
* ACTION: ap_after_comment_content
* Action called after comment content.
*
* @since 2.0.1
示例13: get_the_ID
?>
" data-id="<?php
echo get_the_ID();
?>
">
<div class="ap-content clearfix">
<div class="ap-content-inner">
<div class="ap-user-meta">
<div class="ap-avatar">
<?php
echo get_avatar(get_the_author_meta('user_email'), ap_opt('avatar_size_question'));
?>
</div>
<div class="ap-meta">
<?php
printf(__('<span class="when">answered about %s ago</span>', 'ap'), ap_human_time(get_the_time('U')));
?>
</div>
</div>
<div class="answer-content">
<strong class="ap-answer-title"><?php
echo get_the_title($answer->post->post_parent);
?>
</strong>
<?php
echo ap_truncate_chars(strip_tags(get_the_content()), 100);
?>
<div class="ap-ans-action">
<a href="<?php
echo ap_answer_edit_link();
示例14: ap_activity_the_date
/**
* Activity date
*/
function ap_activity_the_date()
{
echo ap_human_time(ap_activity_date(), false);
}
示例15: ap_comment
function ap_comment($comment)
{
$GLOBALS['comment'] = $comment;
$class = '0' == $comment->comment_approved ? ' pending' : '';
?>
<li <?php
comment_class('clearfix' . $class);
?>
id="li-comment-<?php
comment_ID();
?>
">
<!-- comment #<?php
comment_ID();
?>
-->
<div id="comment-<?php
comment_ID();
?>
" class="clearfix">
<div class="ap-avatar ap-pull-left">
<a href="<?php
echo ap_user_link($comment->user_id);
?>
">
<!-- TODO: OPTION - Avatar size -->
<?php
echo get_avatar($comment->user_id, 30);
?>
</a>
</div>
<div class="ap-comment-content no-overflow">
<div class="ap-comment-header">
<a href="<?php
echo ap_user_link($comment->user_id);
?>
" class="ap-comment-author"><?php
echo ap_user_display_name($comment->user_id);
?>
</a>
<?php
$a = " e ";
$b = " ";
$time = get_option('date_format') . $b . get_option('time_format') . $a . get_option('gmt_offset');
printf(' - <a title="%4$s" href="#li-comment-%5$s" class="ap-comment-time"><time datetime="%1$s">%2$s %3$s</time></a>', get_comment_time('c'), ap_human_time(get_comment_time('U')), __('ago', 'ap'), get_comment_time($time), $comment_id = get_comment_ID());
// Comment actions
ap_comment_actions_buttons();
?>
</div>
<div class="ap-comment-texts">
<?php
comment_text();
?>
</div>
<?php
/**
* ACTION: ap_after_comment_content
* Action called after comment content
* @since 2.0.1
*/
do_action('ap_after_comment_content', $comment);
?>
<?php
if ('0' == $comment->comment_approved) {
?>
<p class="comment-awaiting-moderation"><?php
_e('Your comment is awaiting moderation.', 'ap');
?>
</p>
<?php
}
?>
</div>
</div>
<?php
}