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 '';
 }
    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;
    }
Exemple #3
0
 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;
 }
 /**
  * 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;
 }
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>';
}
 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;
 }
 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'];
     }
 }
Exemple #8
0
/**
 * 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;
}
Exemple #9
0
    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 
    }
Exemple #10
0
    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;
    }
Exemple #11
0
/**
 * 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>";
}
 /**
  * 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;
 }
 /**
  * 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);
     }
 }
 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');
     }
 }
Exemple #15
0
 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
     }
 }
 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;
 }
Exemple #17
0
    /**
     * 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;
    }
Exemple #18
0
/**
 * 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);
}
 /**
  * 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;
 }
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 
}
Exemple #21
0
/**
 * Creates the RSS metabox
 *
 * @access      public
 * @since       1.0 
 * @return      void
*/
function rss_box($rss)
{
    // Get RSS Feed(s)
    include_once ABSPATH . WPINC . '/feed.php';
    // My feeds list (add your own RSS feeds urls)
    $my_feeds = array('http://agora.xtec.cat/nodes/categoria/portada/feed');
    // Loop through Feeds
    foreach ($my_feeds as $feed) {
        // Get a SimplePie feed object from the specified feed source.
        $rss = fetch_feed($feed);
        if (!is_wp_error($rss)) {
            // Checks that the object is created correctly
            // Figure out how many total items there are, and choose a limit
            $maxitems = $rss->get_item_quantity(20);
            // Build an array of all the items, starting with element 0 (first element).
            $rss_items = $rss->get_items(0, $maxitems);
            // Get RSS title
            $rss_title = '<a href="' . $rss->get_permalink() . '" target="_blank">' . strtoupper($rss->get_title()) . '</a>';
        }
        // Display the container
        echo '<div class="rss-widget">';
        echo '<strong>' . $rss_title . '</strong>';
        echo '<hr style="border: 0; background-color: #DFDFDF; height: 1px;">';
        // Starts items listing within <ul> tag
        echo '<ul>';
        // Check items
        if ($maxitems == 0) {
            echo '<li>' . __('No item', 'rc_mdm') . '.</li>';
        } else {
            // Loop through each feed item and display each item as a hyperlink.
            foreach ($rss_items as $item) {
                // Uncomment line below to display non human date
                //$item_date = $item->get_date( get_option('date_format').' @ '.get_option('time_format') );
                // Get human date (comment if you want to use non human date)
                $item_date = human_time_diff($item->get_date('U'), current_time('timestamp')) . ' ' . __('ago', 'rc_mdm');
                // Start displaying item content within a <li> tag
                echo '<li>';
                // create item link
                echo '<a href="' . esc_url($item->get_permalink()) . '" title="' . $item_date . '">';
                // Get item title
                echo esc_html($item->get_title());
                echo '</a>';
                // Display date
                echo ' <span class="rss-date">' . $item_date . '</span><br />';
                // Get item content
                $content = $item->get_content();
                // Shorten content
                $content = wp_html_excerpt($content, 120) . ' [...]';
                // Display content
                echo $content;
                // End <li> tag
                echo '</li>';
            }
        }
        // End <ul> tag
        echo '</ul></div>';
    }
    // End foreach feed
}
Exemple #22
0
    public function widget($args, $instance)
    {
        query_posts(array('post_type' => 'resource', 'posts_per_page' => 10));
        ?>

                    <ul>
                    <?php 
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                //Grab postmeta
                $post_meta = get_post_meta(get_the_ID());
                //print_r($post_meta); die();
                if ($post_meta[type][0] == 'External link') {
                    ?>

                    <li>
                    	<i class="fa fa-external-link" title="active"></i>
                        <h5><a href="<?php 
                    echo $post_meta[link_to_resource][0];
                    ?>
" target="_blank"><?php 
                    the_title();
                    ?>
</a></h5>
                        <p><span class="updated">Last updated <?php 
                    echo human_time_diff(get_post_modified_time('U', $post->ID), current_time('timestamp'));
                    ?>
 ago</span></p>
                    </li>
		    <?php 
                } else {
                    ?>

		    <li>
                    	<i class="fa fa-file" title="active"></i>
                        <h5><a href="<?php 
                    echo $post_meta[link_to_production_brief][0];
                    ?>
" target="_blank"><?php 
                    the_title();
                    ?>
</a></h5>
                        <p><span class="updated">Last updated <?php 
                    echo human_time_diff(get_post_modified_time('U', $post->ID), current_time('timestamp'));
                    ?>
 ago</span></p>
                    </li>
                    <?php 
                }
            }
            ?>

			</ul>

<?php 
        }
        wp_reset_query();
    }
Exemple #23
0
 public static function insta_image($image_data)
 {
     $output = '';
     $domen = 'https://www.instagram.com/';
     //<a href="/explore/locations/365542000/" title="Crossroad RC &amp; SB" class="place">Crossroad RC &amp; SB</a>
     $output .= "\n        <div class=\"insta-block\" data-id=\"{$image_data->id}\">\n                    <div class=\"insta-block-header\">\n                        <img src=\"{$image_data->user->profile_picture}\" class=\"autor-ava\">\n                        <div class=\"info\">\n                            <a href=\"{$domen}{$image_data->user->username}/\" title=\"{$image_data->user->username}\" class=\"autor\" target='_blank'>{$image_data->user->username}</a>\n                        </div>\n\n                        <a href=\"{$image_data->link}\" class=\"time\" target='_blank'>" . human_time_diff($image_data->created_time) . "</a>\n                    </div>\n                    <div class=\"insta-block-body\">\n                        <img src=\"{$image_data->images->standard_resolution->url}\" alt=\"\">\n                    </div>\n                    <div class=\"insta-block-footer\">\n                        <div class=\"likes\">{$image_data->likes->count} " . NumberEnd($image_data->likes->count, array('отметка', 'отметки', 'отметок')) . " «Нравится»</div>\n                        <div class=\"title\">\n                            {$image_data->caption->text}\n                       </div>\n                        <div class=\"comments\">\n                            {$image_data->comments->count} " . NumberEnd($image_data->comments->count, array('комментарий', 'комментария', 'комментариев')) . "\n                        </div>\n                    </div>\n                </div>\n        ";
     return $output;
 }
    /**
     * Output job_application_notes
     * @param  object $application
     */
    function job_application_notes($application)
    {
        if ('job_application' === $application->post_type) {
            $args = array('post_id' => $application->ID, 'approve' => 'approve', 'type' => 'job_application_note', 'order' => 'asc');
            remove_filter('comments_clauses', array('WP_Job_Manager_Applications_Dashboard', 'exclude_application_comments'), 10, 1);
            $notes = get_comments($args);
            add_filter('comments_clauses', array('WP_Job_Manager_Applications_Dashboard', 'exclude_application_comments'), 10, 1);
            echo '<ul class="job-application-notes-list">';
            if ($notes) {
                foreach ($notes as $note) {
                    ?>
					<li rel="<?php 
                    echo absint($note->comment_ID);
                    ?>
" class="job-application-note">
						<div class="job-application-note-content">
							<?php 
                    echo wpautop(wptexturize(wp_kses_post($note->comment_content)));
                    ?>
						</div>
						<p class="job-application-note-meta">
							<abbr class="exact-date" title="<?php 
                    echo $note->comment_date_gmt;
                    ?>
 GMT"><?php 
                    printf(__('added %s ago', 'wp-job-manager-applications'), human_time_diff(strtotime($note->comment_date_gmt), current_time('timestamp', 1)));
                    ?>
</abbr>
							<?php 
                    printf(' ' . __('by %s', 'wp-job-manager-applications'), $note->comment_author);
                    ?>
							<a href="#" class="delete_note"><?php 
                    _e('Delete note', 'wp-job-manager-applications');
                    ?>
</a>
						</p>
					</li>
					<?php 
                }
            }
            echo '</ul>';
            ?>
			<div class="job-application-note-add">
				<p><textarea type="text" name="job_application_note" class="input-text" cols="20" rows="5" placeholder="<?php 
            esc_attr_e('Private note regarding this application', 'wp-job-manager-applications');
            ?>
"></textarea></p>
				<p><input type="button" data-application_id="<?php 
            echo absint($application->ID);
            ?>
" class="button" value="<?php 
            esc_attr_e('Add note', 'wp-job-manager-applications');
            ?>
" /></p>
			</div>
			<?php 
        }
    }
Exemple #25
0
/**
 * Display or retrieve the Twitter like time ago text for post.
 *
 * @sice 0.0.1
 *
 * @param bool $display If display or return the output. Default is display.
 * @use BUild in human_time_diff()
 */
function vp_time_ago($display = true)
{
    $output = sprintf(__('%s ago', 'v2press'), human_time_diff(get_the_time('U'), current_time('timestamp')));
    if ($display) {
        echo $output;
    } else {
        return $output;
    }
}
 function jmfe_old_php_notice()
 {
     $user_id = get_current_user_id();
     if (!get_option('jmfe_old_php_notice')) {
         echo '<div class="error"><p>';
         printf(__('Your server is using a <strong>VERY OLD</strong> and unsupported version of PHP, version 5.2 or older. <a href="%1$s" target="_blank">EOL (End of Life)</a> for PHP 5.2 was about <strong>%2$s ago</strong>!!<br /><br />It is <strong>strongly</strong> recommended that you upgrade to PHP 5.3 or newer...you can upgrade PHP or <a href="%3$s">Hide this Notice Forever!</a><br/><br />Did you know im also the Founder and CEO of Host Tornado?<br/><a href="%4$s" target="_blank">Contact me</a> for an exclusive sMyles Plugins customer promo code discount for any shared <strong>SSD (Solid State Drive)</strong> hosting packages!  Data centers in Florida USA, Arizona USA, Montreal Canada, and France.  Your site will run faster than it ever has, or your money back!', 'wp-job-manager-field-editor'), 'http://php.net/eol.php', human_time_diff('1294272000', current_time('timestamp')), '?jmfe_old_php_notice=0', 'https://plugins.smyl.es/contact');
         echo "</p></div>";
     }
 }
Exemple #27
0
function maxitheme_relative_date()
{
    $reverse_dates = get_option('maxitheme_reverse_dates');
    if ($reverse_dates) {
        echo '<span class="updated"><time itemprop="date" datetime="' . esc_attr(get_the_time('c')) . '">' . esc_html__('ago', 'maxitheme') . ' ' . human_time_diff(get_the_time('U'), current_time('timestamp')) . '</time></span>';
    } else {
        echo '<span class="updated"><time itemprop="date" datetime="' . esc_attr(get_the_time('c')) . '">' . human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ' . esc_html__('ago ', 'maxitheme') . '' . '</time></span>';
    }
}
function so_topic_closes_in()
{
    global $post;
    if ($post->comment_status == 'open') {
        $close_comments_days_old = get_option('close_comments_days_old');
        $expires = strtotime("{$post->post_date_gmt} GMT") + $close_comments_days_old * DAY_IN_SECONDS;
        printf(__('(This topic will automatically close in %s. )', 'textdomain'), human_time_diff($expires));
    }
}
Exemple #29
0
/**
 * Callback to show quick stats
 *
 * @since 1.0.0
 *
 * @param array  $data
 * @param array $request
 *
 * @return string
 */
function formworks_get_quick_stats($data, $request)
{
    global $wpdb;
    $form_id = $request['form'];
    // set the types for the quick stats
    $types = array("submission" => __('Submissions', 'formworks'), "loaded" => __('Loads', 'formworks'), "view" => __('Views', 'formworks'), "engage" => __('Engagements', 'formworks'));
    $meta_keys = implode("','", array_keys($types));
    $query = $wpdb->prepare("\n\tSELECT\n\t`meta_key`,\n\tCOUNT( DISTINCT( `user_key` ) ) AS `users`,\n\tCOUNT( DISTINCT( `user_id` ) ) AS `logged`,\n\tCOUNT( `meta_value` ) AS `total`,\n\tSUM( `meta_value` ) AS `sum_total`,\n\t`datestamp`\n\tFROM\n\t`{$wpdb->prefix}formworks_tracker`\n\tWHERE\n\t`meta_key` IN ( '{$meta_keys}' ) &&\n\t`user_id` NOT IN (" . implode(',', $request['filters']['admins']) . " ) &&\n\t`prefix` = %s &&\n\t`form_id` = %s &&\n\t`meta_value` != ''\n\tGROUP BY `meta_key`\n\t;", $request['prefix'], $form_id);
    $results = $wpdb->get_results($query, ARRAY_A);
    $quick_stats = array();
    $current_timestamp = current_time('timestamp', true);
    // resetup
    foreach ($types as $type_key => $type) {
        $quick_stats[$type_key] = array('name' => $type, 'users' => 0, 'total' => 0, 'sum_total' => 0);
    }
    foreach ($results as $result) {
        if ($result['meta_key'] == 'partial') {
            // check time - ignore todays stuff
            if (strtotime($result['datestamp']) > strtotime('-24 hours')) {
                continue;
            }
        }
        $quick_stats[$result['meta_key']]['users'] = $result['users'];
        $quick_stats[$result['meta_key']]['total'] = $result['total'];
        $quick_stats[$result['meta_key']]['sum_total'] = $result['sum_total'];
        $quick_stats[$result['meta_key']]['n'] = _n('user', 'users', $result['users'], 'formworks');
    }
    // get_conversions
    foreach ($types as $type_key => $type) {
        if ($type_key == "submission") {
            $average = 0;
            if ($quick_stats["submission"]['total'] > 0) {
                $average = $quick_stats["submission"]['sum_total'] / $quick_stats["submission"]['total'];
            }
            $quick_stats[$type_key]['average_time'] = human_time_diff($current_timestamp - $average, $current_timestamp);
            continue;
        }
        if ($type_key == "partial") {
            if (!empty($quick_stats[$type_key]['users'])) {
                $quick_stats[$type_key]['conversion'] = round($quick_stats[$type_key]['users'] / $quick_stats["engage"]['total'] * 100, 1) . '%';
            } else {
                $quick_stats[$type_key]['conversion'] = '0%';
            }
            unset($quick_stats[$type_key]['total']);
            $quick_stats[$type_key]['rate_type'] = __('Abandonment', 'formworks');
            continue;
        }
        $quick_stats[$type_key]['rate_type'] = __('Conversion', 'formworks');
        if (!empty($quick_stats[$type_key]['total'])) {
            $quick_stats[$type_key]['conversion'] = round($quick_stats["submission"]['total'] / $quick_stats[$type_key]['sum_total'] * 100, 1) . '%';
        } else {
            $quick_stats[$type_key]['conversion'] = '0%';
        }
    }
    return $quick_stats;
}
function custom_comments($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    ?>
    <?php 
    switch ($comment->comment_type) {
        case 'pingback':
        case 'trackback':
            ?>
            <li <?php 
            comment_class('comments-item');
            ?>
 id="comment<?php 
            comment_ID();
            ?>
">
            <div class="back-link">< ?php comment_author_link(); ?></div>
            <?php 
            break;
        default:
            ?>
            <li <?php 
            comment_class('comments-item');
            ?>
 id="comment-<?php 
            comment_ID();
            ?>
">
                <div class="comments-item-pic">
                    <?php 
            echo get_avatar($comment, 60);
            ?>
                </div>
                <div class="comments-item-comment">
                    <p class="info"><span class="name"><?php 
            comment_author();
            ?>
</span> <span class="timestamp"><?php 
            echo human_time_diff(strtotime($comment->comment_date_gmt), current_time('timestamp')) . ' ago';
            ?>
</span>
                    <?php 
            comment_reply_link(array_merge($args, array('reply_text' => 'Reply', 'after' => '', 'depth' => $depth, 'max_depth' => $args['max_depth'])));
            ?>
                    </p>
                    <p><?php 
            echo $comment->comment_content;
            ?>
</p>
                </div>
                <hr ?>
            <?php 
            // End the default styling of comment
            break;
    }
}