/**
  * send email
  */
 public function emailSender($email_data, $wc_new_comment_id, $subject, $message)
 {
     global $wp_rewrite;
     $comment = get_comment($wc_new_comment_id);
     $curr_post = get_post($comment->comment_post_ID);
     $curr_post_author = get_userdata($curr_post->post_author);
     if ($email_data['email'] == $curr_post_author->user_email) {
         if (get_option('moderation_notify') && !$comment->comment_approved) {
             return;
         } else {
             if (get_option('comments_notify') && $comment->comment_approved) {
                 return;
             }
         }
     }
     $wc_new_comment_content = $comment->comment_content;
     $permalink = get_comment_link($wc_new_comment_id);
     $unsubscribe_url = !$wp_rewrite->using_permalinks() ? get_permalink($comment->comment_post_ID) . "&" : get_permalink($comment->comment_post_ID) . "?";
     $unsubscribe_url .= "subscribeAnchor&wpdiscuzSubscribeID=" . $email_data['id'] . "&key=" . $email_data['activation_key'] . '&#wc_unsubscribe_message';
     $message .= "<br/><br/><a href='{$permalink}'>{$permalink}</a>";
     $message .= "<br/><br/>{$wc_new_comment_content}";
     $message .= "<br/><br/><a href='{$unsubscribe_url}'>" . $this->optionsSerialized->phrases['wc_unsubscribe'] . "</a>";
     $headers = array();
     $content_type = apply_filters('wp_mail_content_type', 'text/html');
     $from_name = apply_filters('wp_mail_from_name', get_option('blogname'));
     $from_email = apply_filters('wp_mail_from', get_option('admin_email'));
     $headers[] = "Content-Type:  {$content_type}; charset=UTF-8";
     $headers[] = "From: " . $from_name . " <" . $from_email . "> \r\n";
     wp_mail($email_data['email'], $subject, $message, $headers);
 }
/**
 * WordPress评论回复邮件提醒防垃圾评论版
 * 作者:露兜
 * 博客:http://www.ludou.org/
 */
function zws_comment_mail_notify($comment_id, $comment_status)
{
    // 评论必须经过审核才会发送通知邮件
    if ($comment_status !== 'approve' && $comment_status !== 1) {
        return;
    }
    $comment = get_comment($comment_id);
    if ($comment->comment_parent != '0') {
        $parent_comment = get_comment($comment->comment_parent);
        // 邮件接收者email
        $to = trim($parent_comment->comment_author_email);
        // 邮件标题
        $subject = '您收到来自[' . get_option("blogname") . ']的动态消息';
        // 邮件内容,自行修改,支持HTML
        $message = '
<div style="border:1px solid #AAAAAA;background:#f5f5f5;line-height:35px;padding:20px;border-radius:8px;font-size: 14px;width:600px;margin:0 auto;">
      <h2 style="background:#52b8cb;color:#f5f5f5;font-size:16px;line-height:20px;text-shadow:1px 1px 5px #b1b1b1;font-weight:normal;padding:10px;">您在 <font style="font-weight:700;"> ' . get_option('blogname') . '</font> 的评论有新回复啦!</h2>
      <p><font color="#52b8cb">' . $parent_comment->comment_author . '</font> 童鞋,你曾经在《' . get_the_title($comment->comment_post_ID) . '》留言说:</p> 
      <p style="background-color: #DDD;padding:5px 8px;margin:5px 15px;text-indent:2em;">' . $parent_comment->comment_content . '</p> 
      <p><font color="#52b8cb">' . $comment->comment_author . '</font> 给你的回应是:</p> 
      <p style="background-color: #DDD;padding:5px 8px;margin:5px 15px;text-indent:2em;">' . $comment->comment_content . '</p> 
      <p>猛击这里:<a href="' . htmlspecialchars(get_comment_link($comment->comment_parent)) . '"><font color="#52b8cb">查看完整评论</font></a>, 欢迎再次访问<a href="' . home_url() . '"><font color="#52b8cb">' . get_option('blogname') . '</font></a></p>
      <p>(此邮件由系统自动发送,请勿回复)</p> 
    </div>';
        $message_headers = "Content-Type: text/html; charset=\"" . get_option('blog_charset') . "\"\n";
        // 不用给不填email的评论者和管理员发提醒邮件
        if ($to != '' && $to != get_bloginfo('admin_email')) {
            @wp_mail($to, $subject, $message, $message_headers);
        }
    }
}
예제 #3
0
function reverie_comments($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    ?>
	<li <?php 
    comment_class();
    ?>
>
		<article id="comment-<?php 
    comment_ID();
    ?>
">
			<header class="comment-author vcard">
				<?php 
    echo get_avatar($comment, $size = '40');
    ?>
				<?php 
    printf(__('<cite class="fn">%s</cite>', 'reverie'), get_comment_author_link());
    ?>
				<time datetime="<?php 
    echo comment_date('c');
    ?>
"><a href="<?php 
    echo htmlspecialchars(get_comment_link($comment->comment_ID));
    ?>
"><?php 
    printf(__('%1$s', 'reverie'), get_comment_date(), get_comment_time());
    ?>
</a></time>
				<?php 
    edit_comment_link(__('(Edit)', 'reverie'), '', '');
    ?>
			</header>
			
			<?php 
    if ($comment->comment_approved == '0') {
        ?>
       			<div class="notice">
					<p class="bottom"><?php 
        _e('Your comment is awaiting moderation.', 'reverie');
        ?>
</p>
          		</div>
			<?php 
    }
    ?>
			
			<section class="comment">
				<?php 
    comment_text();
    ?>
			</section>
			
			<?php 
    comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
    ?>
			
		</article>
<?php 
}
 /**
  * widget function.
  *
  * @see WP_Widget
  *
  * @param array $args
  * @param array $instance
  */
 public function widget($args, $instance)
 {
     global $comments, $comment;
     if ($this->get_cached_widget($args)) {
         return;
     }
     ob_start();
     $number = !empty($instance['number']) ? absint($instance['number']) : $this->settings['number']['std'];
     $comments = get_comments(array('number' => $number, 'status' => 'approve', 'post_status' => 'publish', 'post_type' => 'product'));
     if ($comments) {
         $this->widget_start($args, $instance);
         echo '<ul class="product_list_widget">';
         foreach ((array) $comments as $comment) {
             $_product = wc_get_product($comment->comment_post_ID);
             $rating = intval(get_comment_meta($comment->comment_ID, 'rating', true));
             $rating_html = $_product->get_rating_html($rating);
             echo '<li><a href="' . esc_url(get_comment_link($comment->comment_ID)) . '">';
             echo $_product->get_image();
             echo $_product->get_title() . '</a>';
             echo $rating_html;
             printf('<span class="reviewer">' . _x('by %1$s', 'by comment author', 'woocommerce') . '</span>', get_comment_author());
             echo '</li>';
         }
         echo '</ul>';
         $this->widget_end($args);
     }
     $content = ob_get_clean();
     echo $content;
     $this->cache_widget($args, $content);
 }
 function widget($args, $instance)
 {
     if (!isset($args['widget_id'])) {
         $args['widget_id'] = $this->id;
     }
     $output = '';
     $title = !empty($instance['title']) ? $instance['title'] : __('Recent Comments');
     $title = apply_filters('widget_title', $title, $instance, $this->id_base);
     $number = !empty($instance['number']) ? absint($instance['number']) : 5;
     if (!$number) {
         $number = 5;
     }
     $comments = get_comments(apply_filters('widget_comments_args', array('number' => $number, 'status' => 'approve', 'post_status' => 'publish')));
     $output .= $args['before_widget'];
     if ($title) {
         $output .= $args['before_title'] . $title . $args['after_title'];
     }
     $output .= '<ul id="recentcomments">';
     if (is_array($comments) && $comments) {
         $post_ids = array_unique(wp_list_pluck($comments, 'comment_post_ID'));
         _prime_post_caches($post_ids, strpos(get_option('permalink_structure'), '%category%'), false);
         foreach ((array) $comments as $comment) {
             $title = get_the_title($comment->comment_post_ID);
             $output .= '<li class="recentcomments"><i class="fa fa-comments">&nbsp;</i> ';
             $output .= sprintf(_x('%1$s on %2$s', 'widgets'), '<span class="comment-author-link"><strong> ' . get_comment_author_link($comment) . '</strong></span>', '<br><a href="' . esc_url(get_comment_link($comment)) . '">' . $title . '</a>');
             $output .= '</li>';
         }
     }
     $output .= '</ul>';
     $output .= $args['after_widget'];
     echo $output;
 }
 /**
  * widget function.
  *
  * @see WP_Widget
  * @access public
  * @param array $args
  * @param array $instance
  * @return void
  */
 public function widget($args, $instance)
 {
     global $comments, $comment, $woocommerce;
     if ($this->get_cached_widget($args)) {
         return;
     }
     ob_start();
     extract($args);
     $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     $number = absint($instance['number']);
     $comments = get_comments(array('number' => $number, 'status' => 'approve', 'post_status' => 'publish', 'post_type' => 'product'));
     if ($comments) {
         echo $before_widget;
         if ($title) {
             echo $before_title . $title . $after_title;
         }
         echo '<ul class="product_list_widget">';
         foreach ((array) $comments as $comment) {
             $_product = get_product($comment->comment_post_ID);
             $rating = intval(get_comment_meta($comment->comment_ID, 'rating', true));
             $rating_html = $_product->get_rating_html($rating);
             echo '<li><a href="' . esc_url(get_comment_link($comment->comment_ID)) . '">';
             echo $_product->get_image();
             echo $_product->get_title() . '</a>';
             echo $rating_html;
             printf('<span class="reviewer">' . _x('by %1$s', 'by comment author', 'woocommerce') . '</span>', get_comment_author());
             echo '</li>';
         }
         echo '</ul>';
         echo $after_widget;
     }
     $content = ob_get_clean();
     echo $content;
     $this->cache_widget($args, $content);
 }
예제 #7
0
/**
 * Template callback for GeoMashupQuery::list_comments()
 *
 * Use the newer form of template, where the individual comment template goes in 
 * a function that matches the callback argument to list_comments
 *
 * @since 1.3
 * @access public
 * @package GeoMashup
 *
 * @param object $comment The comment to display
 * @param array $args Arguments from wp_list_comments
 * @param mixed $depth Nested depth
 */
function geo_mashup_comment_default($comment, $args, $depth)
{
    // Enable the WordPress comment functions
    GeoMashupQuery::set_the_comment($comment);
    // From here to the closing curly brace should look like a familiar template
    ?>
	<div id="div-comment-<?php 
    comment_ID();
    ?>
" class="<?php 
    comment_class('');
    ?>
">
		<div class="comment-author vcard">
		<?php 
    printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link());
    ?>
		</div>
		<div class="comment-meta commentmetadata">
			<a href="<?php 
    echo esc_html(get_comment_link($comment->comment_ID));
    ?>
"><?php 
    printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time());
    ?>
</a>
		</div>
		<?php 
    comment_text();
    ?>

	</div>
<?php 
}
 /**
  * trigger function.
  *
  * @access public
  * @return void
  */
 function trigger($comment, $message)
 {
     global $woothemes_sensei, $sensei_email_data;
     $this->comment = $comment;
     $this->message = $message;
     $this->commenter = get_userdata($comment->user_id);
     $original_sender = get_post_meta($this->message->ID, '_sender', true);
     $this->original_sender = get_user_by('login', $original_sender);
     $original_receiver = get_post_meta($this->message->ID, '_receiver', true);
     $this->original_receiver = get_user_by('login', $original_receiver);
     $content_type = get_post_meta($this->message->ID, '_posttype', true);
     $content_id = get_post_meta($this->message->ID, '_post', true);
     $content_title = get_the_title($content_id);
     $comment_link = get_comment_link($comment);
     // Construct data array
     $sensei_email_data = apply_filters('sensei_email_data', array('template' => $this->template, 'heading' => $this->heading, 'commenter_name' => $this->commenter->display_name, 'message' => $this->comment->comment_content, 'comment_link' => $comment_link, 'content_title' => $content_title, 'content_type' => $content_type), $this->template);
     // Set recipient
     if ($this->commenter->user_login == $original_sender) {
         $this->recipient = stripslashes($this->original_receiver->user_email);
     } else {
         $this->recipient = stripslashes($this->original_sender->user_email);
     }
     // Send mail
     $woothemes_sensei->emails->send($this->recipient, $this->subject, $woothemes_sensei->emails->get_content($this->template));
 }
예제 #9
0
function efreetant_comments($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    ?>
  <div id="comment-<?php 
    comment_ID();
    ?>
" <?php 
    comment_class('comment');
    ?>
>
    <article  class="comment">
      <header class="comment-author">
        <?php 
    $bgauthemail = get_comment_author_email();
    ?>
        <img data-gravatar="http://www.gravatar.com/avatar/<?php 
    echo md5($bgauthemail);
    ?>
?s=40" class="avatar" height="40" width="40" src="<?php 
    echo get_template_directory_uri();
    ?>
/images/nothing.gif" />
        <?php 
    printf(__('<cite class="fn">%1$s</cite> %2$s', 'efreetanttheme'), get_comment_author_link(), edit_comment_link(__('(Edit)', 'efreetanttheme'), '  ', ''));
    ?>
        <time datetime="<?php 
    echo comment_time('Y-m-j');
    ?>
"><a href="<?php 
    echo htmlspecialchars(get_comment_link($comment->comment_ID));
    ?>
"><?php 
    comment_time(__('F jS, Y', 'efreetanttheme'));
    ?>
 </a></time>
     </header>
      <?php 
    if ($comment->comment_approved == '0') {
        ?>
        <div class="alert alert-info">
          <p><?php 
        _e('Your comment is awaiting moderation.', 'efreetanttheme');
        ?>
</p>
        </div>
      <?php 
    }
    ?>
      <section class="comment_content">
        <?php 
    comment_text();
    ?>
      </section>
      <?php 
    comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
    ?>
    </article>
<?php 
}
예제 #10
0
function stormbringer_comments($comment, $args, $depth) {
  $GLOBALS['comment'] = $comment; ?>
	<li <?php comment_class('media'); ?>>
    <div class="pull-left">
      <div class="comment-avatar vcard">
        <?php echo get_avatar($comment,apply_filters('stormbringer_author_bio_avatar_size', 100) ); ?>
      </div>
    </div>
    <!-- /.comment-avatar -->
    <div class="media-body">
      <div class="comment-message">
        <?php printf(__('<h4 class="media-heading">%s</h4>','stormbringer'), get_comment_author_link()) ?>
        <?php edit_comment_link(__('Edit','stormbringer'),'<span class="edit-comment btn btn-info"><span class="glyphicon glyphicon-pencil"></span>','</span>') ?>

        <?php if ($comment->comment_approved == '0') : ?>
          <div class="alert-message success">
            <p><?php _e('Your comment is awaiting moderation.','stormbringer') ?></p>
          </div>
        <?php endif; ?>

        <?php comment_text() ?>

        <time datetime="<?php echo comment_time('c'); ?>"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php comment_time(esc_attr__( 'F j, Y', 'stormbringer' )); ?> <?php _e('at', 'stormbringer'); ?> <?php comment_time(esc_attr__( 'H:i', 'stormbringer' )); ?> </a></time>

      </div>
    </div>
    <!-- /.comment-message	-->

    <!-- </li> is added by wordpress automatically -->
<?php
}
예제 #11
0
 /**
  * @ticket 34068
  */
 public function test_default_comments_page_oldest_last_page_should_have_cpage()
 {
     update_option('default_comments_page', 'oldest');
     update_option('comments_per_page', 2);
     $found = get_comment_link($this->comments[1]);
     $this->assertContains('cpage=3', $found);
 }
    /**
     * Custom column to output info on the comment the feedback is attached to
     *
     * @param Object $comment Current comment
     */
    public function column_comment($comment)
    {
        global $comment_status;
        $post = get_post();
        // Feedback comments aren't displayed on the front end individually but as counts on the actual comments so we link to the parent
        $comment_url = esc_url(get_comment_link($comment->comment_parent));
        if ($this->user_can) {
            $del_nonce = esc_html('_wpnonce=' . wp_create_nonce("delete-comment_{$comment->comment_ID}"));
            $approve_nonce = esc_html('_wpnonce=' . wp_create_nonce("approve-comment_{$comment->comment_ID}"));
            $url = "comment.php?c={$comment->comment_ID}";
            $trash_url = esc_url($url . "&action=trashcomment&{$del_nonce}");
        }
        // END if
        echo '<div class="submitted-on">';
        /* translators: 2: comment date, 3: comment time */
        printf(__('Submitted on <a href="%1$s">%2$s at %3$s</a>'), $comment_url, get_comment_date(__('Y/m/d')), get_comment_date(get_option('time_format')));
        echo '</div>';
        comment_text();
        if ($this->user_can) {
            // There's only one valid action for feedback comments
            ?>
			<div class="row-actions">
				<span class="trash">
					<a href="<?php 
            echo esc_url($trash_url);
            ?>
" class="delete vim-d vim-destructive" title="Move this comment to the trash">Trash</a>
				</span>
			</div>
			<?php 
        }
    }
예제 #13
0
function mytheme_comment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    ?>
<li <?php 
    comment_class();
    ?>
 id="li-comment-<?php 
    comment_ID();
    ?>
">
	<div id="comment-<?php 
    comment_ID();
    ?>
">
		<div class="comment-author vcard">
			<?php 
    echo get_avatar($comment, $size = '40');
    ?>
			<?php 
    /* printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) */
    ?>
			<cite class="fn"><?php 
    comment_author_link();
    ?>
</cite>
			<span class="comment-meta commentmetadata"><a href="<?php 
    echo htmlspecialchars(get_comment_link($comment->comment_ID));
    ?>
"><?php 
    printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time());
    ?>
</a><?php 
    edit_comment_link(__('(Edit)'), '  ', '');
    ?>
</span>
			
		</div>
		<?php 
    if ($comment->comment_approved == '0') {
        ?>
		<em class="approved"><?php 
        _e('Your comment is awaiting moderation.');
        ?>
</em>
		<br />
		<?php 
    }
    ?>
		<?php 
    comment_text();
    ?>
		<div class="reply">
			<?php 
    comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
    ?>
		</div>
	</div>
<?php 
}
예제 #14
0
 /**
  * The search function
  *
  * @return array of results
  */
 protected function do_search()
 {
     global $wpdb;
     $commentsresults = array();
     if (isset($wpdb->base_prefix)) {
         $_prefix = $wpdb->base_prefix;
     } else {
         $_prefix = $wpdb->prefix;
     }
     $options = $this->options;
     $searchData = $this->searchData;
     $s = $this->s;
     $_s = $this->_s;
     if ($options['set_incomments'] && count($_s) > 0) {
         $like = "lower({$wpdb->comments}.comment_content) REGEXP '" . implode('|', $_s) . "'";
         $querystr = "\r\n      \t\tSELECT \r\n            {$wpdb->comments}.comment_ID as id,\r\n            {$wpdb->comments}.comment_post_ID as post_id,\r\n            {$wpdb->comments}.user_id as user_id,\r\n            {$wpdb->comments}.comment_content as content,\r\n            'comment' as content_type,\r\n            {$wpdb->comments}.comment_date as date\r\n      \t\tFROM {$wpdb->comments}\r\n      \t\tWHERE\r\n          ({$wpdb->comments}.comment_approved=1)\r\n          AND\r\n          (" . $like . ")\r\n      \t\tORDER BY {$wpdb->comments}.comment_ID DESC\r\n      \t\tLIMIT " . $searchData['maxresults'];
         //var_dump($querystr);
         $commentsresults = $wpdb->get_results($querystr, OBJECT);
         if (is_array($commentsresults)) {
             foreach ($commentsresults as $k => $v) {
                 $commentsresults[$k]->link = get_comment_link($v->id);
                 $commentsresults[$k]->author = get_comment_author($v->id);
                 $commentsresults[$k]->title = wd_substr_at_word($commentsresults[$k]->content, 40) . "...";
             }
         }
     }
     $this->results = $commentsresults;
     return $commentsresults;
 }
예제 #15
0
<?php function studiofolio_comment($comment, $args, $depth) {
  $GLOBALS['comment'] = $comment; ?>
  <li <?php comment_class(); ?>>
    <article id="comment-<?php comment_ID(); ?>">
      <header class="comment-author vcard">
        <?php echo get_avatar($comment, $size = '32'); ?>
        <?php printf(__('<cite class="fn">%s</cite>', 'studiofolio'), get_comment_author_link()); ?>
        <time datetime="<?php echo comment_date('c'); ?>"><a href="<?php echo htmlspecialchars(get_comment_link($comment->comment_ID)); ?>"><?php printf(__('%1$s', 'studiofolio'), get_comment_date(),  get_comment_time()); ?></a></time>
        <?php edit_comment_link(__('(Edit)', 'studiofolio'), '', ''); ?>
      </header>

      <?php if ($comment->comment_approved == '0') : ?>
        <div class="alert alert-block fade in">
          <a class="close" data-dismiss="alert">&times;</a>
          <p><?php _e('Your comment is awaiting moderation.', 'studiofolio'); ?></p>
        </div>
      <?php endif; ?>

      <section class="comment">
        <?php comment_text() ?>
      </section>

      <?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))); ?>

    </article>
<?php } ?>
예제 #16
0
function get_recent_comments($args)
{
    global $wpdb, $comments, $comment;
    extract($args, EXTR_SKIP);
    $themePath = get_bloginfo('template_url');
    $imageLink = '<h2>Популярные записи</h2>';
    $options = get_option('widget_recent_comments');
    $title = empty($options['title']) ? __($imageLink) : apply_filters('widget_title', $options['title']);
    if (!($number = (int) $options['number'])) {
        $number = 5;
    } else {
        if ($number < 1) {
            $number = 1;
        } else {
            if ($number > 15) {
                $number = 15;
            }
        }
    }
    if (!($comments = wp_cache_get('recent_comments', 'widget'))) {
        $comments = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT {$number}");
        wp_cache_add('recent_comments', $comments, 'widget');
    }
    echo $before_widget;
    echo $before_title . $title . $after_title;
    echo '<ul id="recentcomments">';
    if ($comments) {
        foreach ((array) $comments as $comment) {
            echo '<li class="recentcomments">' . sprintf(__('%2$s'), get_comment_author_link(), '<a href="' . get_comment_link($comment->comment_ID) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
        }
    }
    echo '</ul>';
    echo $after_widget;
}
예제 #17
0
/**
 * Custom comments template.
 *
 * @package Impact WordPress Theme
 * @since 1.0
 * @author AJ Clarke : http://wpexplorer.com
 * @copyright Copyright (c) 2012, AJ Clarke
 * @link http://wpexplorer.com
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
function bro_comment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    ?>
    <li <?php 
    comment_class();
    ?>
 id="li-comment-<?php 
    comment_ID();
    ?>
">
        <div id="comment-<?php 
    comment_ID();
    ?>
" class="comment-body <?php 
    if ($comment->comment_approved == '0') {
        echo 'pending-comment';
    }
    ?>
 bro-cf">
            <div class="comment-details">
                <?php 
    if (get_avatar($comment)) {
        ?>
                <div class="comment-avatar">
                    <?php 
        echo get_avatar($comment, $size = '50');
        ?>
                </div>
                <?php 
    }
    ?>
                <section class="comment-author vcard">
                    <?php 
    printf(__('<cite class="author">%s</cite>'), get_comment_author_link());
    ?>
                    <span class="comment-date"><a href="<?php 
    echo htmlspecialchars(get_comment_link($comment->comment_ID));
    ?>
"> &middot; <?php 
    echo get_comment_date();
    ?>
</a></span>
                    <span class="reply"><?php 
    comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'bromine'), 'depth' => $depth, 'max_depth' => $args['max_depth'])));
    ?>
</span>
                </section>
                <section class="comment-content">
                    <div class="comment-text">
                        <?php 
    comment_text();
    ?>
                    </div>
                </section>
            </div>
        </div>
<?php 
}
예제 #18
0
    function widget($args, $instance)
    {
        global $wpdb, $comments, $comment;
        extract($args, EXTR_SKIP);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('My Recent Comments', 'my_framework') : $instance['title']);
        if (!($number = (int) $instance['number'])) {
            $number = 5;
        } else {
            if ($number < 1) {
                $number = 1;
            } else {
                if ($number > 15) {
                    $number = 15;
                }
            }
        }
        $comment_len = 100;
        if (!($comments = wp_cache_get('recent_comments', 'widget'))) {
            $comments = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE comment_approved = '1' and comment_type not in ('pingback','trackback') ORDER BY comment_date_gmt DESC LIMIT 15");
            wp_cache_add('recent_comments', $comments, 'widget');
        }
        $comments = array_slice((array) $comments, 0, $number);
        ?>
		<?php 
        echo $before_widget;
        ?>
			<?php 
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>
			<ul id="recentcomments"><?php 
        if ($comments) {
            foreach ((array) $comments as $comment) {
                ?>
			<li class="recentcomments">
			<?php 
                echo strip_tags(substr(apply_filters('get_comment_text', $comment->comment_content), 0, $comment_len));
                if (strlen($comment->comment_content) > $comment_len) {
                    echo '...';
                }
                ?>
			<br />
			<?php 
                echo __('by', 'my_framework') . '&nbsp;' . sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url(get_comment_link($comment->comment_ID)) . '">' . get_the_title($comment->comment_post_ID) . '</a>');
                ?>
            
            
		
			</li>
            
            <?php 
            }
        }
        ?>
</ul>
		<?php 
        echo $after_widget;
    }
예제 #19
0
function py_comments($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    ?>
  <li <?php 
    comment_class();
    ?>
>
    <article class="callout" id="comment-<?php 
    comment_ID();
    ?>
">
      <header class="comment-author">
        <?php 
    echo get_avatar($comment, $size = '96', $default = get_template_directory_uri() . ' /img/yeti-avatar.png');
    ?>
        <div class="author-meta">
          <?php 
    printf(__('<cite class="fn">%s</cite>', 'projectyeti'), get_comment_author_link());
    ?>
          <time datetime="<?php 
    echo comment_date('c');
    ?>
"><a href="<?php 
    echo esc_url(get_comment_link($comment->comment_ID));
    ?>
"><?php 
    printf(__('%1$s', 'projectyeti'), get_comment_date(), get_comment_time());
    ?>
</a></time>
          <?php 
    edit_comment_link(__('(Edit)', 'projectyeti'), '', '');
    ?>
        </div>
      </header>
      <?php 
    if ($comment->comment_approved == '0') {
        ?>
        <div class="notice">
        <p class="bottom"><?php 
        _e('Your comment is awaiting moderation.', 'projectyeti');
        ?>
</p>
          </div>
      <?php 
    }
    ?>
      <div class="comment">
        <?php 
    comment_text();
    ?>
      </div>
      <footer><?php 
    comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
    ?>
</footer>
    </article>
<?php 
}
예제 #20
0
function joints_comments($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    ?>
	<li <?php 
    comment_class('panel');
    ?>
>
		<article id="comment-<?php 
    comment_ID();
    ?>
" class="clearfix large-12 columns">
			<header class="comment-author">
				<?php 
    // create variable
    $bgauthemail = get_comment_author_email();
    ?>
				<?php 
    printf(__('<cite class="fn">%s</cite>', 'jointstheme'), get_comment_author_link());
    ?>
 on
				<time datetime="<?php 
    echo comment_time('Y-m-j');
    ?>
"><a href="<?php 
    echo htmlspecialchars(get_comment_link($comment->comment_ID));
    ?>
"><?php 
    comment_time(__(' F jS, Y - g:ia', 'jointstheme'));
    ?>
 </a></time>
				<?php 
    edit_comment_link(__('(Edit)', 'jointstheme'), '  ', '');
    ?>
			</header>
			<?php 
    if ($comment->comment_approved == '0') {
        ?>
				<div class="alert alert-info">
					<p><?php 
        _e('Your comment is awaiting moderation.', 'jointstheme');
        ?>
</p>
				</div>
			<?php 
    }
    ?>
			<section class="comment_content clearfix">
				<?php 
    comment_text();
    ?>
			</section>
			<?php 
    comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
    ?>
		</article>
	<!-- </li> is added by WordPress automatically -->
<?php 
}
예제 #21
0
파일: comments.php 프로젝트: sanin25/word
    function mytheme_comment($comment, $args, $depth)
    {
        $GLOBALS['comment'] = $comment;
        ?>
   <li <?php 
        comment_class();
        ?>
 id="li-comment-<?php 
        comment_ID();
        ?>
">
     <div class="comment_wrap" id="comment-<?php 
        comment_ID();
        ?>
">
         <div class="comearea">
        <div class="comall">
                <a href="<?php 
        echo htmlspecialchars(get_comment_link($comment->comment_ID));
        ?>
"><?php 
        printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time());
        ?>
</a>
               <?php 
        echo get_avatar($comment, $size = '64', $default = 'http://1.gravatar.com/avatar/df570c18646109a825ae4acc8d13712d?s=64&d=&r=G');
        ?>
               <?php 
        printf(__('<p class="author">%s</p>'), get_comment_author_link());
        ?>
               <div class="reply">
                   <?php 
        comment_reply_link(array_merge($args, array('reply_text' => 'Ответить', 'depth' => $depth, 'max_depth' => $args['max_depth'])));
        ?>
 <br/>  <?php 
        edit_comment_link(__('(Edit)'), '  ', '');
        ?>
               </div>
        </div>
            <div class="comtxt">
                   <?php 
        if ($comment->comment_approved == '0') {
            ?>
               <em><?php 
            _e('Your comment is awaiting moderation.');
            ?>
</em>
               <br />
               <?php 
        } else {
            comment_text();
        }
        ?>
            </div>
         </div>
     </div>
<?php 
    }
예제 #22
0
function html5_comment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    ?>
   <article <?php 
    comment_class();
    ?>
 id="comment-<?php 
    comment_ID();
    ?>
">
      
      <header class="comment-author vcard">
         <?php 
    echo get_avatar($comment, $size = '48', $default = '<path_to_url>');
    ?>

         <?php 
    printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link());
    ?>
      
      </header>
      
      <?php 
    if ($comment->comment_approved == '0') {
        ?>
         <em><?php 
        _e('Your comment is awaiting moderation.');
        ?>
</em>
      <?php 
    }
    ?>

      <div class="comment-meta commentmetadata"><time datetime="<?php 
    the_time('Y-m-d');
    ?>
" pubdate><a href="<?php 
    echo htmlspecialchars(get_comment_link($comment->comment_ID));
    ?>
"><?php 
    printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time());
    ?>
</a></time><?php 
    edit_comment_link(__('(Edit)'), '  ', '');
    ?>
</div>

      <?php 
    comment_text();
    ?>

      <div class="reply"> <?php 
    comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
    ?>
 </div>
<?php 
}
예제 #23
0
    /**
     * Template for comments and pingbacks.
     * Used as a callback by wp_list_comments() for displaying the comments.
     */
    function orbit_comment($comment, $args, $depth)
    {
        $GLOBALS['comment'] = $comment;
        switch ($comment->comment_type) {
            case 'pingback':
            case 'trackback':
                ?>
	<li>
		<?php 
                _e('Pingback:', 'orbit');
                ?>
 <?php 
                comment_author_link();
                edit_comment_link(__('Edit', 'orbit'), '', '');
                ?>
	<?php 
                break;
            default:
                ?>
	<li>
		<?php 
                $avatar_size = 68;
                if ('0' != $comment->comment_parent) {
                    $avatar_size = 39;
                }
                echo get_avatar($comment, $avatar_size);
                // translators: 1: comment author, 2: date and time
                printf(__('%1$s on %2$s said:', 'orbit'), sprintf('%s', get_comment_author_link()), sprintf('<a href="%1$s"><time pubdate datetime="%2$s">%3$s</time></a>', esc_url(get_comment_link($comment->comment_ID)), get_comment_time('c'), sprintf(__('%1$s at %2$s', 'orbit'), get_comment_date(), get_comment_time())));
                ?>

		<?php 
                edit_comment_link(__('Edit', 'orbit'), '', '');
                ?>
				
		<?php 
                if ($comment->comment_approved == '0') {
                    ?>
		
			<?php 
                    _e('Your comment is awaiting moderation.', 'orbit');
                    ?>
					
		<?php 
                }
                ?>

		<?php 
                comment_text();
                ?>

		<?php 
                comment_reply_link(array_merge($args, array('reply_text' => __('Reply &darr;', 'orbit'), 'depth' => $depth, 'max_depth' => $args['max_depth'])));
                ?>
	
		<?php 
                break;
        }
    }
예제 #24
0
    function start_el(&$output, $comment, $depth, $args, $id = 0)
    {
        $depth++;
        $GLOBALS['comment_depth'] = $depth;
        $GLOBALS['comment'] = $comment;
        if (!empty($args['callback'])) {
            call_user_func($args['callback'], $comment, $args, $depth);
            return;
        }
        extract($args, EXTR_SKIP);
        ?>

  <li <?php 
        comment_class('media comment-' . get_comment_ID());
        ?>
>
    <?php 
        echo get_avatar($comment, $size = '64');
        ?>
    <div class="media-body">
      <h4 class="media-heading"><?php 
        echo get_comment_author_link();
        ?>
</h4>
      <time datetime="<?php 
        echo comment_date('c');
        ?>
"><a href="<?php 
        echo htmlspecialchars(get_comment_link($comment->comment_ID));
        ?>
"><?php 
        printf(__('%1$s', 'roots'), get_comment_date(), get_comment_time());
        ?>
</a></time>
      <?php 
        edit_comment_link(__('(Edit)', 'roots'), '', '');
        ?>

      <?php 
        if ($comment->comment_approved == '0') {
            ?>
        <div class="alert">
          <?php 
            _e('Your comment is awaiting moderation.', 'roots');
            ?>
        </div>
      <?php 
        }
        ?>

      <?php 
        comment_text();
        ?>
      <?php 
        comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
        ?>
  <?php 
    }
    function widget($args, $instance)
    {
        extract($args);
        //Our variables from the widget settings.
        $title = apply_filters('widget_title', $instance['title']);
        $num_of_comments = $instance['num_of_comments'];
        $show_avatar = $instance['show_avatar'];
        if (empty($num_of_comments)) {
            $num_of_comments = 5;
        }
        echo $before_widget;
        // Display the widget title
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        $comments = get_comments(array('number' => $num_of_comments, 'status' => 'approve', 'post_status' => 'publish'));
        $avatar = "";
        //Loop comments
        if ($comments) {
            ?>
			<ul>
		<?php 
            foreach ((array) $comments as $comment) {
                ?>
				<li>
					<?php 
                if ($show_avatar && '1' == $show_avatar) {
                    ?>
					<?php 
                    echo get_avatar($comment, 30);
                    ?>
					<?php 
                }
                ?>
					<div class="grve-comment-content">
						<div class="grve-author">
							<?php 
                echo sprintf(_x('%1$s on %2$s', GRVE_THEME_TRANSLATE), get_comment_author_link($comment->comment_ID), '<a href="' . esc_url(get_comment_link($comment->comment_ID)) . '">' . get_the_title($comment->comment_post_ID) . '</a>');
                ?>
						</div>
						<div class="grve-comment-date"><?php 
                echo get_the_date();
                ?>
</div>

					</div>
				</li>
		<?php 
            }
            ?>
			</ul>
		<?php 
        } else {
            _e('No Comments Found!', GRVE_THEME_TRANSLATE);
        }
        echo $after_widget;
    }
예제 #26
0
function bones_comments($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    ?>
	<li <?php 
    comment_class();
    ?>
>
		<article id="comment-<?php 
    comment_ID();
    ?>
" class="clearfix">
			<header class="comment-author vcard">
				<?php 
    echo get_avatar($comment, $size = '32', $default = '<path_to_url>');
    ?>
				<?php 
    printf(__('<cite class="fn">%s</cite>'), get_comment_author_link());
    ?>
				<time datetime="<?php 
    echo comment_time('Y-m-j');
    ?>
"><a href="<?php 
    echo htmlspecialchars(get_comment_link($comment->comment_ID));
    ?>
"><?php 
    comment_time('F jS, Y');
    ?>
 </a></time>
				<?php 
    edit_comment_link(__('(Edit)'), '  ', '');
    ?>
			</header>
			<?php 
    if ($comment->comment_approved == '0') {
        ?>
       			<div class="help">
          			<p><?php 
        _e('Your comment is awaiting moderation.');
        ?>
</p>
          		</div>
			<?php 
    }
    ?>
			<section class="comment_content clearfix">
				<?php 
    comment_text();
    ?>
			</section>
			<?php 
    comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
    ?>
		</article>
    <!-- </li> is added by wordpress automatically -->
<?php 
}
예제 #27
0
function custom_comments($lang_comment, $args, $depth)
{
    $GLOBALS['comment'] = $lang_comment;
    ?>
	<li id="comment-<?php 
    comment_ID();
    ?>
">
		<div  <?php 
    comment_class('comment-wrap');
    ?>
 >
			<div class="comment-avatar"><?php 
    echo get_avatar($lang_comment, 45);
    ?>
</div>
			<div class="author-comment">
				<?php 
    printf(__('%s ', 'sith'), sprintf('<cite class="fn">%s</cite>', get_comment_author_link()));
    ?>
				<div class="comment-meta commentmetadata"><a href="<?php 
    echo esc_url(get_comment_link($lang_comment->comment_ID));
    ?>
">	<?php 
    printf(__('%1$s at %2$s', 'sith'), get_comment_date(), get_comment_time());
    ?>
</a><?php 
    edit_comment_link(__('(Edit)', 'sith'), ' ');
    ?>
</div><!-- .comment-meta .commentmetadata -->
			</div>
			<div class="clear"></div>
			<div class="comment-content">
				<?php 
    if ($lang_comment->comment_approved == '0') {
        ?>
					<em class="comment-awaiting-moderation"><?php 
        _e('Your comment is awaiting moderation.', 'sith');
        ?>
</em>
					<br />
				<?php 
    }
    ?>
					
				<?php 
    comment_text();
    ?>
			</div>
			<div class="reply"><?php 
    comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
    ?>
</div><!-- .reply -->
		</div><!-- #comment-##  -->

	<?php 
}
예제 #28
0
 function widget($args, $instance)
 {
     global $comments, $comment;
     $cache = array();
     if (!$this->is_preview()) {
         $cache = wp_cache_get('alizee_recent_comments', 'widget');
     }
     if (!is_array($cache)) {
         $cache = array();
     }
     if (!isset($args['widget_id'])) {
         $args['widget_id'] = $this->id;
     }
     if (isset($cache[$args['widget_id']])) {
         echo $cache[$args['widget_id']];
         return;
     }
     extract($args, EXTR_SKIP);
     $output = '';
     $title = !empty($instance['title']) ? $instance['title'] : __('Recent Comments', 'alizee');
     /** This filter is documented in wp-includes/default-widgets.php */
     $title = apply_filters('widget_title', $title, $instance, $this->id_base);
     $number = !empty($instance['number']) ? absint($instance['number']) : 5;
     if (!$number) {
         $number = 5;
     }
     $show_date = isset($instance['show_date']) ? $instance['show_date'] : false;
     /**
      * Filter the arguments for the Recent Comments widget.
      *
      * @since 3.4.0
      *
      * @see get_comments()
      *
      * @param array $comment_args An array of arguments used to retrieve the recent comments.
      */
     $comments = get_comments(apply_filters('widget_comments_args', array('number' => $number, 'status' => 'approve', 'post_status' => 'publish')));
     $output .= $before_widget;
     if ($title) {
         $output .= $before_title . $title . $after_title;
     }
     $output .= '<ul class="list-group">';
     if ($comments) {
         $post_ids = array_unique(wp_list_pluck($comments, 'comment_post_ID'));
         _prime_post_caches($post_ids, strpos(get_option('permalink_structure'), '%category%'), false);
         foreach ((array) $comments as $comment) {
             $output .= '<li class="list-group-item"><div class="recent-comment clearfix">' . get_avatar($comment, 60) . '<div class="recent-comment-meta"><span>' . sprintf(__('%1$s on %2$s', 'alizee'), get_comment_author_link(), '</span><a class="post-title" href="' . esc_url(get_comment_link($comment->comment_ID)) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</div></li>';
         }
     }
     $output .= '</ul>';
     $output .= $after_widget;
     echo $output;
     if (!$this->is_preview()) {
         $cache[$args['widget_id']] = $output;
         wp_cache_set('alizee_recent_comments', $cache, 'widget');
     }
 }
예제 #29
0
 /**
  * Add extra fields we need in the front-end.
  *
  * @since 0.0.4
  *
  * @param array|object $comment Comment as array
  * @param bool $flatten Optional. If true, will remove all hierarchy. Default is false.
  *
  * @return array Comment as array with extra fields.
  */
 public static function add_data_to_comment($comment, $flatten = false)
 {
     if (is_object($comment)) {
         $comment = (array) $comment;
     }
     $key = __FUNCTION__ . $comment['comment_post_ID'] . $comment['comment_ID'];
     if (false != ($_comment = wp_cache_get($key, self::$cache_group))) {
         return $_comment;
     }
     $max_depth = (int) get_option('thread_comments_depth', 5);
     $date_format = get_option('date_format');
     $time_format = get_option('time_format');
     $time = strtotime($comment['comment_date']);
     //filter content (make_clickable, wpautop, etc)
     $comment['comment_content'] = apply_filters('comment_text', $comment['comment_content']);
     //use display name for comment
     $comment['comment_author'] = self::find_user_display_name($comment);
     //add avatar markup as a string
     $comment['author_avatar'] = get_avatar($comment['comment_author_email'], 48);
     //format date according to WordPress settings
     /* translators: 1: date, 2: time */
     $comment['comment_date'] = sprintf(__('%1$s at %2$s', 'epoch'), date($date_format, $time), date($time_format, $time));
     //get comment link
     $comment['comment_link'] = get_comment_link($comment['comment_ID']);
     //are comments replies allowed
     $comment['reply_allowed'] = comments_open($comment['comment_post_ID']);
     //remove parent_id if $flatten
     if ($flatten) {
         $comment['comment_parent'] = "0";
     } else {
         $parents = self::find_parents($comment['comment_ID']);
         if (empty($parents)) {
             $comment['depth'] = 1;
         } else {
             $count = count($parents);
             if ($count > $max_depth) {
                 $comment['comment_parent'] = $parents[$max_depth - 1];
                 $count = $max_depth;
             }
             $comment['depth'] = $count;
         }
     }
     //if has no children add that key as false.
     if ($flatten || !isset($comment['children'])) {
         $comment['children'] = false;
     }
     $comment['list_class'] = $comment['comment_parent'] == '0' ? '' : 'children';
     if (!$flatten) {
         //get reply link
         $reply_link_args = array('add_below' => 'comment', 'max_depth' => $max_depth, 'depth' => (int) $comment['depth']);
         $comment['reply_link'] = get_comment_reply_link($reply_link_args, (int) $comment['comment_ID']);
     } else {
         $comment['reply_link'] = '';
     }
     wp_cache_set($key, $comment, self::$cache_group, HOUR_IN_SECONDS);
     return $comment;
 }
예제 #30
0
 function evolve_comment_link()
 {
     $link = '<span class="comment-permalink">';
     $link .= '<a rel="bookmark" title="' . __('Permalink to this comment', 'evolve') . '" href="' . htmlspecialchars(get_comment_link()) . '">';
     $link .= apply_filters('evolve_comment_link_text', (string) '<i class="t4p-icon-link"></i>');
     $link .= '</a></span>' . "\n";
     return apply_filters('evolve_comment_link', (string) $link);
     // Available filter: evolve_comment_link
 }