• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP human_time_diff函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getTweetTime

 public function getTweetTime($tweet)
 {
     if (!empty($tweet['created_at'])) {
         return human_time_diff(strtotime($tweet['created_at']), current_time('timestamp')) . ' ' . __('ago', 'select-twitter-feed');
     }
     return '';
 }
开发者ID:surreal8,项目名称:wptheme,代码行数:7,代码来源:qode-twitter-helper.php


示例2: widget

    function widget($args, $instance)
    {
        $wpdr = Document_Revisions::$instance;
        extract($args);
        echo $before_widget;
        echo $before_title . 'Recently Revised Documents' . $after_title;
        $query = array('post_type' => 'document', 'orderby' => 'modified', 'order' => 'DESC', 'numberposts' => '5', 'post_status' => array('private', 'publish', 'draft'));
        $documents = get_posts($query);
        echo "<ul>\n";
        foreach ($documents as $document) {
            //use our function to get post data to correct WP's author bug
            $revision = $wpdr->get_latest_revision($document->ID);
            ?>
			<li><a href="<?php 
            echo get_edit_post_link($revision->ID);
            ?>
"><?php 
            echo $revision->post_title;
            ?>
</a><br />
			<?php 
            echo human_time_diff(strtotime($revision->post_modified_gmt));
            ?>
 ago by <?php 
            echo get_the_author_meta('display_name', $revision->post_author);
            ?>
			</li>
		<?php 
        }
        echo "</ul>\n";
        echo $after_widget;
    }
开发者ID:m-e-h,项目名称:WP-Document-Revisions-Code-Cookbook,代码行数:32,代码来源:recently-revised-widget.php


示例3: widget

 function widget($args, $instance)
 {
     if (!$instance['username']) {
         return;
     }
     $options = get_option('fastblog_widgets');
     if (!is_array($options)) {
         $options = array();
     }
     $username_hash = md5($instance['username']);
     if (isset($options['twitter'][$username_hash]) && $options['twitter'][$username_hash]['last_update'] >= $instance['time'] && $options['twitter'][$username_hash]['last_update'] + $instance['interval'] * 60 > time()) {
         $tweets = $options['twitter'][$username_hash]['data'];
     } else {
         if (($tweets = tb_twitter_get_tweets($instance, $instance['username'], $instance['include_retweets'], $instance['exclude_replies'], $instance['count'])) !== false) {
             $options['twitter'][$username_hash] = array('last_update' => time(), 'data' => $tweets);
             update_option('fastblog_widgets', $options);
         } else {
             return;
         }
     }
     extract($args);
     echo $before_widget;
     echo $before_title . '<a href="http://twitter.com/' . $instance['username'] . '/" title="' . __('Follow me!', 'fastblog') . '">' . __('Twitter', 'fastblog') . '</a>' . $after_title;
     if (is_array($tweets)) {
         foreach ($tweets as $tweet) {
             echo '<p>' . $tweet['html'] . '<br />' . '<small>' . sprintf(__('%s ago', 'fastblog'), human_time_diff($tweet['date'])) . '</small>' . '</p>';
         }
     } else {
         echo $tweets;
     }
     echo $after_widget;
 }
开发者ID:carriercomm,项目名称:wordpress-2,代码行数:32,代码来源:widgets.php


示例4: widget

 /**
  * Echo the widget content.
  *
  * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
  * @param array $instance The settings for the particular instance of the widget
  */
 function widget($args, $instance)
 {
     extract($args);
     /** Merge with defaults */
     $instance = wp_parse_args((array) $instance, $this->defaults);
     echo $before_widget;
     if ($instance['title']) {
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
     }
     echo '<ul>' . "\n";
     $options['exclude_replies'] = $instance['twitter_hide_replies'];
     $options['include_rts'] = $instance['twitter_include_rts'];
     $rawtweets = wpacc_getTweets($instance['twitter_num'], $instance['twitter_id'], $options);
     /** Build the tweets array */
     $tweets = array();
     foreach ($rawtweets as $tweet) {
         $timeago = sprintf(__('about %s ago', 'wpacc'), human_time_diff(strtotime($tweet['created_at'])));
         $timetweet = sprintf('%s', esc_html($timeago));
         // $timetweet = strtotime( $tweet['created_at'] );
         // $timetweet = date_i18n( 'j F Y', $timetweet, false )
         /** Add tweet to array */
         $tweets[] = '<li>' . wpacc_tweet_linkify($tweet['text']) . ' - <span class="wpacc-tweet-time">' . $timetweet . '</span></li>' . "\n";
     }
     /** Just in case */
     // $tweets = array_slice( (array) $tweets, 0, (int) $instance['twitter_num'] );
     if ($instance['follow_link_show'] && $instance['follow_link_text']) {
         $tweets[] = '<li class="last"><a href="' . esc_url('http://twitter.com/' . $instance['twitter_id']) . '"  class="ext">' . esc_html($instance['follow_link_text']) . '</a></li>';
     }
     $time = absint($instance['twitter_duration']) * 60;
     foreach ($tweets as $tweet) {
         echo $tweet;
     }
     echo '</ul>' . "\n";
     echo $after_widget;
 }
开发者ID:RRWD,项目名称:WP-Accessible-Twitter-feed,代码行数:41,代码来源:wpacc-accessible-twitter-feed-widget.php


示例5: woo_add_order_notes_to_email

function woo_add_order_notes_to_email()
{
    global $woocommerce, $post;
    $args = array('post_id' => $post->ID, 'approve' => 'approve', 'type' => 'order_note');
    $notes = get_comments($args);
    echo '<h2>' . __('Order Notes', 'woocommerce') . '</h2>';
    echo '<ul class="order_notes">';
    if ($notes) {
        foreach ($notes as $note) {
            $note_classes = get_comment_meta($note->comment_ID, 'is_customer_note', true) ? array('customer-note', 'note') : array('note');
            ?>
			<li rel="<?php 
            echo absint($note->comment_ID);
            ?>
" class="<?php 
            echo implode(' ', $note_classes);
            ?>
">
				<div class="note_content">
					(<?php 
            printf(__('added %s ago', 'woocommerce'), human_time_diff(strtotime($note->comment_date_gmt), current_time('timestamp', 1)));
            ?>
) <?php 
            echo wpautop(wptexturize(wp_kses_post($note->comment_content)));
            ?>
				</div>
			</li>
			<?php 
        }
    } else {
        echo '<li>' . __('There are no notes for this order yet.', 'woocommerce') . '</li>';
    }
    echo '</ul>';
}
开发者ID:douglaswebdesigns,项目名称:woocommerce-get-card-fields,代码行数:34,代码来源:woocommerce-order-notes-card-fields-master.php


示例6: storikaze_tag_until

 function storikaze_tag_until($atts, $content = null)
 {
     $allofem = explode("/", $content);
     $waiting = true;
     $timecode = strtotime($GLOBALS["storikaze_time_now"]);
     foreach ($allofem as $eachofem) {
         $eachraw = strtotime($eachofem);
         $sowait = $waiting;
         if (!$sowait) {
             $sowait = $eachraw < $reigning;
         }
         if ($sowait) {
             $sowait = $eachraw > $timecode;
         }
         if ($sowait) {
             $reigning = $eachraw;
             $waiting = false;
             $difren = human_time_diff($eachraw, $timecode);
         }
     }
     if ($waiting) {
         return "--";
     }
     return $difren;
 }
开发者ID:sophiaphillyqueen,项目名称:storikaze-wp-plugin-postmortem,代码行数:25,代码来源:code_storikaze_until.php


示例7: widget

 public function widget($args, $instance)
 {
     global $asgarosforum;
     if (!isset($args['widget_id'])) {
         $args['widget_id'] = $this->id;
     }
     $title = !empty($instance['title']) ? $instance['title'] : __('Recent forum posts', 'asgaros-forum');
     $title = apply_filters('widget_title', $title, $instance, $this->id_base);
     $number = !empty($instance['number']) ? absint($instance['number']) : 3;
     if (!$number) {
         $number = 3;
     }
     $target = !empty($instance['target']) ? $instance['target'] : '';
     $posts = $asgarosforum->get_last_posts($number);
     if (!empty($posts)) {
         echo $args['before_widget'];
         if ($title) {
             echo $args['before_title'] . $title . $args['after_title'];
         }
         echo '<ul class="asgarosforum-widget">';
         foreach ($posts as $post) {
             echo '<li>';
             echo '<span class="post-link"><a href="' . $asgarosforum->get_widget_link($post->parent_id, $post->id, get_the_permalink($target)) . '">' . $asgarosforum->cut_string($post->name) . '</a></span>';
             echo '<span class="post-author">' . __('by', 'asgaros-forum') . '&nbsp;<b>' . $asgarosforum->get_username($post->author_id, false, true) . '</b></span>';
             echo '<span class="post-date">' . sprintf(__('%s ago', 'asgaros-forum'), human_time_diff(strtotime($post->date), current_time('timestamp'))) . '</span>';
             echo '</li>';
         }
         echo '</ul>';
         echo $args['after_widget'];
     }
 }
开发者ID:QuqurUxcho,项目名称:asgaros-forum,代码行数:31,代码来源:forum-widgets.php


示例8: apm_get_page_date

/**
 * Retrieves page date the same way it is retrieved in native panel :
 * see /wp-admin/includes/class-wp-posts-list-table.php
 */
function apm_get_page_date($node)
{
    global $mode;
    $post_date = $node->publication_date;
    $post_date_gmt = $node->publication_date_gmt;
    //For legacy, because APM didn't set the gmt date at page creation before :
    if ($node->status == 2 && '0000-00-00 00:00:00' == $post_date_gmt) {
        $post_date_gmt = date('Y-m-d H:i:s', strtotime($post_date) - get_option('gmt_offset') * 3600);
    }
    if ('0000-00-00 00:00:00' == $post_date) {
        $t_time = $h_time = __('Unpublished');
        $time_diff = 0;
    } else {
        $t_time = mysql2date(__('Y/m/d g:i:s A'), $post_date, true);
        $m_time = $post_date;
        $time = mysql2date('G', $post_date_gmt, false);
        $time_diff = time() - $time;
        if ($time_diff > 0 && $time_diff < DAY_IN_SECONDS) {
            $h_time = sprintf(__('%s ago'), human_time_diff($time));
        } else {
            $h_time = mysql2date(__('Y/m/d'), $m_time);
        }
    }
    $page_date = '<abbr title="' . $t_time . '">' . apply_filters('apm_post_date_column_time', $h_time, $node, 'apm-date', $mode) . '</abbr>';
    return $page_date;
}
开发者ID:erkmen,项目名称:wpstartersetup,代码行数:30,代码来源:functions.php


示例9: sf_custom_comments

    function sf_custom_comments($comment, $args, $depth)
    {
        $GLOBALS['comment'] = $comment;
        $GLOBALS['comment_depth'] = $depth;
        ?>
		    <li id="comment-<?php 
        comment_ID();
        ?>
" <?php 
        comment_class('clearfix');
        ?>
>
		        <div class="comment-wrap clearfix">
		            <div class="comment-avatar">
		            	<?php 
        if (function_exists('get_avatar')) {
            echo get_avatar($comment, '100');
        }
        ?>
		            	<?php 
        if ($comment->comment_author_email == get_the_author_meta('email')) {
            ?>
		            	<span class="tooltip"><?php 
            _e("Author", "swiftframework");
            ?>
<span class="arrow"></span></span>
		            	<?php 
        }
        ?>
		            </div>
		    		<div class="comment-content">
		            	<div class="comment-meta">
	            			<?php 
        printf('<span class="comment-author">%1$s</span> <span class="comment-date">%2$s</span>', get_comment_author_link(), human_time_diff(get_comment_time('U'), current_time('timestamp')) . ' ' . __("ago", "swiftframework"));
        ?>
			            	<div class="comment-meta-actions">
		            			<?php 
        edit_comment_link(__('Edit', 'swiftframework'), '<span class="edit-link">', '</span><span class="meta-sep"> |</span>');
        ?>
		                        <?php 
        if ($args['type'] == 'all' || get_comment_type() == 'comment') {
            comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'swiftframework'), 'login_text' => __('Log in to reply.', 'swiftframework'), 'depth' => $depth, 'before' => '<span class="comment-reply">', 'after' => '</span>')));
        }
        ?>
			                </div>
						</div>
		      			<?php 
        if ($comment->comment_approved == '0') {
            _e("\t\t\t\t\t<span class='unapproved'>Your comment is awaiting moderation.</span>\n", 'swiftframework');
        }
        ?>
		            	<div class="comment-body">
		                	<?php 
        comment_text();
        ?>
		            	</div>
		    		</div>
		        </div>
	<?php 
    }
开发者ID:roycocup,项目名称:enclothed,代码行数:60,代码来源:sf-comments.php


示例10: widget

    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $instance = wp_parse_args($instance, array('title' => __('Latest Questions', 'dwqa'), 'number' => 5));
        echo $before_widget;
        echo $before_title;
        echo $instance['title'];
        echo $after_title;
        $args = array('posts_per_page' => $instance['number'], 'order' => 'DESC', 'orderby' => 'post_date', 'post_type' => 'dwqa-question', 'suppress_filters' => false);
        $questions = new WP_Query($args);
        if ($questions->have_posts()) {
            echo '<div class="dwqa-popular-questions">';
            echo '<ul>';
            while ($questions->have_posts()) {
                $questions->the_post();
                echo '
				<li><a href="' . get_permalink() . '" class="question-title">' . get_the_title() . '</a> ' . __('asked by', 'dwqa') . ' ' . (dwqa_is_anonymous(get_the_ID()) ? __('Anonymous', 'dwqa') : get_the_author_link()) . ', ' . human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago';
                '</li>';
            }
            echo '</ul>';
            echo '</div>';
        }
        wp_reset_query();
        wp_reset_postdata();
        echo $after_widget;
    }
开发者ID:blogfor,项目名称:king,代码行数:26,代码来源:Latest_Question.php


示例11: rssmi_show_last_feed_update

/**
 * Displays the last time the feed was updated and controls to update now
 *
 * @return string
 */
function rssmi_show_last_feed_update()
{
    $wprssmi_admin_options = get_option('rss_admin_options');
    // admin settings
    $last_db_update = $wprssmi_admin_options['last_db_update'];
    return "\n\t<h3>Last Update of the Feed Database: <em>" . get_date_from_gmt(date('Y-m-d H:i:s', $last_db_update), 'M j, Y @ g:i a') . "; " . human_time_diff($last_db_update, time()) . " ago</em></h3>\n\t<p><button type='button' name='getFeedsNow' id='getFeeds-Now' class='button button-primary' value=''>Update the feed Database</button></p>\n\n\t<div id='gfnote'>\n\t\t<em>(note: this could take several minutes)</em>\n\t</div>\n\t<div id='rssmi-ajax-loader-center'></div>\n\t<p>Think there is a scheduling problem? <a href='http://www.wprssimporter.com/faqs/the-cron-scheduler-isnt-working-whats-happening/' target='_blank'>Read this</a>.</p>";
}
开发者ID:scottnkerr,项目名称:eeco,代码行数:12,代码来源:admin_functions.php


示例12: get_time_until_expiration

 /**
  * Returns human-readable time until an active license expires
  *
  * @return string
  */
 function get_time_until_expiration()
 {
     // license expiration is stored as a timestamp
     $license_expiration = absint(trim(get_option(SEARCHWP_PREFIX . 'license_expiration')));
     $license_expiration_readable = $license_expiration ? human_time_diff(current_time('timestamp'), $license_expiration) : __('License not active', 'searchwp');
     return $license_expiration_readable;
 }
开发者ID:acutedeveloper,项目名称:havering-intranet-development,代码行数:12,代码来源:settings-impl-license.php


示例13: widget

 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  *
  * @param array $args     Widget arguments.
  * @param array $instance Saved values from database.
  */
 public function widget($args, $instance)
 {
     $default = array('title' => 'recent tweet', 'number_tweet' => 5, 'user_id' => 'evanto');
     $instance = wp_parse_args($instance, $default);
     extract($instance);
     echo balanceTags($args['before_widget']);
     if (!empty($title)) {
         echo balanceTags($args['before_title'] . $title . $args['after_title']);
     }
     if ($user_id) {
         $credentials = array('consumer_key' => '18ihEuNsfOJokCLb8SAgA', 'consumer_secret' => '7vTYnLYYiP4BhXvkMWtD3bGnysgiGqYlsPFfwXhGk');
         $twitter_api = new Wp_Twitter_Api($credentials);
         $query = 'count=' . $number_tweet . '&include_entities=true&include_rts=true&screen_name=' . $user_id;
         $args = array('type' => 'statuses/user_timeline');
         $twitters = $twitter_api->query($query);
         $output = array();
         $output[] = '<div class="twitter">';
         $output[] = '<ul class="tweet-list list-unstyled">';
         if (!isset($twitters['errors']) && count($twitters) > 0 and is_array($twitters)) {
             foreach ($twitters as $twitter) {
                 $twitter = (array) $twitter;
                 $output[] = '<li class="tweet">';
                 $output[] = "<span class='tweet-text'><a href='http://twitter.com/" . $user_id . "/status/" . $twitter['id'] . "'>" . human_time_diff(strtotime($twitter['created_at'])) . ' ago</a></span>';
                 $output[] = "<span class='tweet-time'>" . $twitter['text'] . "</span>";
                 $output[] = '</li>';
             }
         }
         $output[] = '</ul>';
         $output[] = '</div>';
         echo implode("\n", $output);
     }
 }
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:40,代码来源:twitter_widget.php


示例14: column_date

 function column_date($post)
 {
     if ('0000-00-00 00:00:00' == $post->post_date) {
         $t_time = $h_time = __('Unpublished');
         $time_diff = 0;
     } else {
         $t_time = get_the_time(__('Y/m/d g:i:s A'));
         $m_time = $post->post_date;
         $time = get_post_time('G', true, $post);
         $time_diff = time() - $time;
         if ($time_diff > 0 && $time_diff < DAY_IN_SECONDS) {
             $h_time = sprintf(__('%s ago'), human_time_diff($time));
         } else {
             $h_time = mysql2date(__('Y/m/d'), $m_time);
         }
     }
     if ('excerpt' == $mode) {
         echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode);
     } else {
         echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>';
     }
     echo '<br />';
     if ('publish' == $post->post_status) {
         _e('Published');
     } elseif ('future' == $post->post_status) {
         if ($time_diff > 0) {
             echo '<strong class="attention">' . __('Missed schedule') . '</strong>';
         } else {
             _e('Scheduled');
         }
     } else {
         _e('Last Modified');
     }
 }
开发者ID:uoyknaht,项目名称:kc,代码行数:34,代码来源:film-register-film-list-table.class.php


示例15: column_default

 function column_default($item, $column_name)
 {
     global $mspdb;
     switch ($column_name) {
         case 'shortcode':
             return sprintf('[masterslider id="%s"]', $item['ID']);
         case 'date_modified':
             $orig_time = isset($item['date_modified']) ? strtotime($item['date_modified']) : '';
             $time = date_i18n('Y/m/d @ g:i:s A', $orig_time);
             $human = human_time_diff($orig_time);
             return sprintf('<abbr title="%s">%s</abbr>', $time, $human . __(' ago', 'master-slider'));
         case 'date_created':
             $orig_time = isset($item['date_created']) ? strtotime($item['date_created']) : '';
             $date = date_i18n('Y/m/d', $orig_time);
             $time = date_i18n('Y/m/d @ g:i:s A', $orig_time);
             return sprintf('<abbr title="%s">%s</abbr>', $time, $date);
         case 'slides_num':
             global $mspdb;
             return $mspdb->get_slider_field_val($item['ID'], 'slides_num');
         case 'ID':
         case 'title':
             return $item[$column_name];
         default:
             return;
             //return print_r( $item, true ) ; //Show the whole array for troubleshooting purposes
     }
 }
开发者ID:blogfor,项目名称:king,代码行数:27,代码来源:class-msp-list-table.php


示例16: column_date

 function column_date($post)
 {
     $html = '';
     if ('0000-00-00 00:00:00' == $post->post_date) {
         $t_time = $h_time = __('Unpublished', 'jetpack');
         $time_diff = 0;
     } else {
         $t_time = date(__('Y/m/d g:i:s A', 'jetpack'), mysql2date('G', $post->post_date));
         $m_time = $post->post_date;
         $time = get_post_time('G', true, $post);
         $time_diff = time() - $time;
         if ($time_diff > 0 && $time_diff < DAY_IN_SECONDS) {
             $h_time = sprintf(__('%s ago', 'jetpack'), human_time_diff($time));
         } else {
             $h_time = mysql2date(__('Y/m/d', 'jetpack'), $m_time);
         }
     }
     $html .= '<abbr title="' . esc_attr($t_time) . '">' . esc_html($h_time) . '</abbr>';
     $html .= '<br />';
     if ('publish' == $post->post_status) {
         $html .= esc_html__('Published', 'jetpack');
     } elseif ('future' == $post->post_status) {
         if ($time_diff > 0) {
             $html .= '<strong class="attention">' . esc_html__('Missed schedule', 'jetpack') . '</strong>';
         } else {
             $html .= esc_html__('Scheduled', 'jetpack');
         }
     } else {
         $html .= esc_html__('Last Modified', 'jetpack');
     }
     return $html;
 }
开发者ID:moushegh,项目名称:blog-source-configs,代码行数:32,代码来源:omnisearch-posts.php


示例17: mars_video_meta

    /**
     * Display Video Meta as Viewed, Liked
     */
    function mars_video_meta()
    {
        global $post, $videotube;
        $viewed = get_post_meta($post->ID, 'count_viewed', true) ? get_post_meta($post->ID, 'count_viewed', true) : 1;
        $datetime_format = isset($videotube['datetime_format']) ? $videotube['datetime_format'] : 'videotube';
        $comments = wp_count_comments($post->ID);
        $block = '
			<div class="meta">';
        if ($datetime_format != 'videotube') {
            $block .= '<span class="date">' . the_date('', '', '', false) . '</span>';
        } else {
            $block .= '<span class="date">il y a ' . human_time_diff(get_the_time('U'), current_time('timestamp')) . '</span>';
        }
        $block .= '
				<span class="views"><i class="fa fa-eye"></i>' . $viewed . '</span>';
        if (function_exists('mars_get_like_count')) {
            $block .= '<span class="heart"><i class="fa fa-heart"></i>' . mars_get_like_count($post->ID) . '</span>';
        }
        $block .= '
					<span class="fcomments"><i class="fa fa-comments"></i>' . $comments->approved . '</span>
				';
        $block .= '
			</div>
		';
        return $block;
    }
开发者ID:chypriote,项目名称:wp-video,代码行数:29,代码来源:hooks.php


示例18: cherry_get_the_post_date

/**
 * Retrieve the post date.
 *
 * @since  4.0.0
 * @param  array $args Arguments.
 * @return string      Post date.
 */
function cherry_get_the_post_date($args)
{
    $post_id = get_the_ID();
    $post_type = get_post_type($post_id);
    /**
     * Filter the default arguments used to display a post date.
     *
     * @since 4.0.0
     * @param array  $args      Array of arguments.
     * @param int    $post_id   The post ID.
     * @param string $post_type The post type of the current post.
     */
    $defaults = apply_filters('cherry_get_the_post_date_defaults', array('before' => '', 'after' => '', 'format' => get_option('date_format'), 'human_time' => ''), $post_id, $post_type);
    $args = wp_parse_args($args, $defaults);
    // If $human_time is passed in, allow for '%s ago' where '%s' is the return value of human_time_diff().
    if (!empty($args['human_time'])) {
        $time = sprintf($args['human_time'], human_time_diff(get_the_time('U'), current_time('timestamp')));
    } else {
        // Else, just grab the time based on the format.
        $time = get_the_time($args['format']);
    }
    $output = '<span class="posted-on">' . $args['before'] . '<time class="entry-date published" datetime="' . get_the_time('Y-m-d\\TH:i:sP') . '">' . $time . '</time>' . $args['after'] . '</span>';
    /**
     * Filter a post date.
     *
     * @since 4.0.0
     * @param string $output Post date.
     * @param array  $args   Arguments.
     */
    return apply_filters('cherry_get_the_post_date', $output, $args);
}
开发者ID:xav335,项目名称:sfnettoyage,代码行数:38,代码来源:template-meta.php


示例19: get_local_status

 /**
  * checks for error logs posts for lift and uses intervals with count
  * thresholds. returns the overall stoplight color and an array of data
  * for the error count, threshold, and light color if met.
  *
  * @global int $lift_health_interval
  * @static
  * @return array
  */
 public static function get_local_status()
 {
     if (!Lift_Search::error_logging_enabled()) {
         return array('severity' => 0, 'reason' => '', 'errors' => false, 'status' => 0);
     }
     $intervals = array(60 * 60 => array('severity' => 2, 'threshold' => 5), 60 * 30 => array('severity' => 1, 'threshold' => 2));
     $intervals = apply_filters('lift_search_health_checkup_intervals', $intervals);
     $severity = 0;
     $reason = '';
     $errors = false;
     foreach ($intervals as $interval => $data) {
         global $lift_health_interval;
         $lift_health_interval = $interval;
         add_filter('posts_where', array(__CLASS__, 'filter_posts_where'));
         $q = new WP_Query(array('posts_per_page' => 1, 'post_type' => Voce_Error_Logging::POST_TYPE, 'tax_query' => array(array('taxonomy' => Voce_Error_Logging::TAXONOMY, 'field' => 'slug', 'terms' => array('error', 'lift-search'), 'operator' => 'AND'))));
         remove_filter('posts_where', array(__CLASS__, 'filter_posts_where'));
         $post_count = $q->found_posts;
         if ($post_count >= $data['threshold']) {
             $errors = true;
             $severity = $data['severity'];
             $reason = sprintf('%d or more errors in the last %s', $data['threshold'], human_time_diff(time() - $interval));
         }
         $error_counts[] = array('threshold' => $data['threshold'], 'count' => $post_count, 'interval' => $interval, 'severity' => $severity);
     }
     $results = array('errors' => $errors, 'severity' => $severity, 'reason' => $reason, 'status' => $error_counts);
     return $results;
 }
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:36,代码来源:lift-health.php


示例20: kindel_comment

function kindel_comment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    extract($args, EXTR_SKIP);
    $classes = array('clearfix');
    if (!empty($args['has_children'])) {
        $classes[] = 'parent';
    }
    ?>
	<div <?php 
    comment_class($classes);
    ?>
 id="comment-<?php 
    comment_ID();
    ?>
" itemscope itemtype="http://schema.org/UserComments">
		<div class="comment-author clearfix">
			<div class="author-avatar">
				<?php 
    if ($args['avatar_size'] != 0) {
        echo get_avatar($comment, $args['avatar_size']);
    }
    ?>
			</div>
			<div class="author-meta">
				<span class="fn author-name" itemprop="creator"><?php 
    echo get_comment_author_link();
    ?>
</span>
				<time itemprop="commentTime" datetime="<?php 
    echo get_comment_time('c');
    ?>
" class="comment-time"><?php 
    printf(__('%s ago', 'kindel'), human_time_diff(get_comment_time('U'), current_time('timestamp')));
    ?>
</time>
			</div>
		</div>
		<div class="comment-body" itemprop="commentText">
		  <?php 
    if ($comment->comment_approved == '0') {
        ?>
		    <p><em class="comment-awaiting-moderation"><?php 
        _e('Your comment is awaiting moderation.', 'kindel');
        ?>
</em></p>
		  <?php 
    } else {
        comment_text();
        comment_reply_link(array_merge($args, array('add_below' => 'comment', 'depth' => $depth, 'max_depth' => $args['max_depth'])));
    }
    ?>
		</div>
		<?php 
    edit_comment_link(__('edit', 'kindel'));
    ?>

<?php 
}
开发者ID:patrickedqvist,项目名称:kindel,代码行数:59,代码来源:comment-template.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP human_to_unix函数代码示例发布时间:2022-05-15
下一篇:
PHP human_time_comparation函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap