本文整理汇总了PHP中get_comment_link函数的典型用法代码示例。如果您正苦于以下问题:PHP get_comment_link函数的具体用法?PHP get_comment_link怎么用?PHP get_comment_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_comment_link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: emailSender
/**
* 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);
}
示例2: zws_comment_mail_notify
/**
* 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: reverie_comments
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
}
示例4: widget
/**
* 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);
}
示例5: widget
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"> </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;
}
示例6: widget
/**
* 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: geo_mashup_comment_default
/**
* 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
}
示例8: trigger
/**
* 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: efreetant_comments
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: stormbringer_comments
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: test_default_comments_page_oldest_last_page_should_have_cpage
/**
* @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);
}
示例12: column_comment
/**
* 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: mytheme_comment
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: do_search
/**
* 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: studiofolio_comment
<?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">×</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 } ?>