'widget_mfn_recent_comments', 'description' => __('The most recent comments.', 'mfn-opts') ); parent::__construct('widget_mfn_recent_comments', __('Muffin Recent Comments', 'mfn-opts'), $widget_ops); $this->alt_option_name = 'widget_mfn_recent_comments'; } /** * Outputs the HTML for this widget. */ public function widget($args, $instance) { $translate['translate-commented-on'] = mfn_opts_get('translate') ? mfn_opts_get('translate-commented-on', 'commented on') : __('commented on', 'betheme'); if (! isset($args['widget_id'])) { $args['widget_id'] = null; } extract($args, EXTR_SKIP); echo wp_kses_post($before_widget); $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); if ($title) { echo wp_kses($before_title, array('h3'=>array(),'h4'=>array())); echo wp_kses($title, mfn_allowed_html()); echo wp_kses($after_title, array('h3'=>array(),'h4'=>array())); } $comments = get_comments(apply_filters('widget_comments_args', array( 'number' => intval($instance['count']), 'status' => 'approve', 'post_status' => 'publish', 'post_type' => 'post' ))); if (is_array($comments)) { echo '
'; foreach ($comments as $comment) { $url = get_permalink($comment->comment_post_ID) .'#comment-'. $comment->comment_ID; echo '- ';
echo ''. date_i18n(get_option('date_format'), strtotime($comment->comment_date)) .'';
echo '
';
}
echo '
'; echo ''. esc_attr($comment->comment_author) .' '. esc_html($translate['translate-commented-on']) .' '. wp_kses(get_the_title($comment->comment_post_ID), mfn_allowed_html()) .'
'; echo '