本文整理汇总了PHP中get_comment_ID函数的典型用法代码示例。如果您正苦于以下问题:PHP get_comment_ID函数的具体用法?PHP get_comment_ID怎么用?PHP get_comment_ID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_comment_ID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: comment
protected function comment($comment, $depth, $args)
{
// разметка каждого комментария, без закрывающего </li>!
$classes = implode(' ', get_comment_class()) . ($comment->comment_author_email == get_the_author_meta('email') ? ' author-comment' : '');
// берем стандартные классы комментария и если коммент пренадлежит автору поста добавляем класс author-comment
echo '<li id="li-comment-' . get_comment_ID() . '" class="' . $classes . '">' . "\n";
// родительский тэг комментария с классами выше и уникальным id
echo '<div id="comment-' . get_comment_ID() . '">' . "\n";
// элемент с таким id нужен для якорных ссылок на коммент
echo get_avatar($comment, 64) . "\n";
// покажем аватар с размером 64х64
echo '<p class="meta">Автор: ' . get_comment_author() . "\n";
// имя автора коммента
//echo ' '.get_comment_author_email(); // email автора коммента
echo ' ' . get_comment_author_url();
// url автора коммента
echo ' <br>Добавлено ' . get_comment_date('F j, Y') . ' в ' . get_comment_time() . "\n";
// дата и время комментирования
if ('0' == $comment->comment_approved) {
echo '<em class="comment-awaiting-moderation">Ваш комментарий будет опубликован после проверки модератором.</em>' . "\n";
}
// если комментарий должен пройти проверку
comment_text() . "\n";
// текст коммента
$reply_link_args = array('depth' => $depth, 'reply_text' => 'Ответить', 'login_text' => 'Вы должны быть залогинены');
echo get_comment_reply_link(array_merge($args, $reply_link_args));
// выводим ссылку ответить
echo '</div>' . "\n";
// закрываем див
}
示例2: start_el
function start_el(&$output, $comment, $depth = 0, $args = array(), $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 id="comment-<?php
comment_ID();
?>
" <?php
comment_class('media comment-' . get_comment_ID());
?>
>
<?php
//include(locate_template('view/loop/comment.php'));
?>
<?php
include locate_template('comment.php');
?>
<?php
}
示例3: check_follow
function check_follow($matches)
{
#support of "meta=follow" option for admins. disabled by default to minify processing.
if (!$this->options['dont_mask_admin_follow']) {
return false;
}
$id = array(get_comment_ID(), get_the_ID());
//it is either page or post
if ($id[0]) {
$this->debug_info('It is a comment. id ' . $id[0]);
} elseif ($id[1]) {
$this->debug_info('It is a page. id ' . $id[1]);
}
$author = false;
if ($id[0]) {
$author = get_comment_author($id[0]);
} else {
if ($id[1]) {
$author = get_the_author_meta('ID');
}
}
if (!$author) {
$this->debug_info('it is neither post or page, applying usual rules');
} elseif (user_can($author, 'manage_options') && (stripos($matches[0], 'rel="follow"') !== FALSE || stripos($matches[0], "rel='follow'") !== FALSE)) {
$this->debug_info('This link has a follow atribute and is posted by admin, not masking it.');
#wordpress adds rel="nofollow" by itself when posting new link in comments. get rid of it! Also, remove our follow attibute - it is unneccesary.
return str_ireplace(array('rel="follow"', "rel='follow'", 'rel="nofollow"'), '', $matches[0]);
} else {
$this->debug_info('it does not have rel follow or is not posted by admin, masking it');
}
return false;
}
示例4: comment
protected function comment($comment, $depth, $args)
{
// each comment markup, without </li>!
$classes = implode(' ', get_comment_class()) . ($comment->comment_author_email == get_the_author_meta('email') ? ' author-comment' : '');
// get typical wp comment classes and if comment belong post autor add "author-comment" class
echo '<li id="li-comment-' . get_comment_ID() . '" class="' . $classes . '">' . "\n";
// parent tag with classes and uniq id
echo '<div id="comment-' . get_comment_ID() . '">' . "\n";
// anchor element with this id need to anchor links on comments works
echo get_avatar($comment, 64) . "\n";
// show avatar with size 64x64 px
echo '<p class="meta">Posted by: ' . get_comment_author() . "\n";
// comment autor name
echo ' ' . get_comment_author_email();
// comment autor email
echo ' ' . get_comment_author_url();
// comment autor url
echo ' On ' . get_comment_date('F j, Y') . ' at ' . get_comment_time() . '</p>' . "\n";
// date and time of comment creating
if ('0' == $comment->comment_approved) {
echo '<em class="comment-awaiting-moderation">Your comment is awaiting moderation</em>' . "\n";
}
// if comment is not approved notify of it
comment_text() . "\n";
// display comment text
$reply_link_args = array('depth' => $depth, 'reply_text' => 'Reply on it', 'login_text' => 'You must be logged to post comments');
echo get_comment_reply_link(array_merge($args, $reply_link_args));
// display reply link
echo '</div>' . "\n";
// anchor element end
}
示例5: dsq_render_single_comment
function dsq_render_single_comment($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
?>
<li id="dsq-comment-<?php
echo (int) get_comment_ID();
?>
">
<div id="dsq-comment-header-<?php
echo (int) get_comment_ID();
?>
" class="dsq-comment-header">
<cite id="dsq-cite-<?php
echo (int) get_comment_ID();
?>
">
<?php
if (comment_author_url()) {
?>
<a id="dsq-author-user-<?php
echo (int) get_comment_ID();
?>
" href="<?php
echo esc_url(get_comment_author_url());
?>
" target="_blank" rel="nofollow"><?php
echo esc_html(get_comment_author());
?>
</a>
<?php
} else {
?>
<span id="dsq-author-user-<?php
echo (int) get_comment_ID();
?>
"><?php
echo esc_html(get_comment_author());
?>
</span>
<?php
}
?>
</cite>
</div>
<div id="dsq-comment-body-<?php
echo (int) get_comment_ID();
?>
" class="dsq-comment-body">
<div id="dsq-comment-message-<?php
echo (int) get_comment_ID();
?>
" class="dsq-comment-message"><?php
wp_filter_kses(comment_text());
?>
</div>
</div>
</li>
<?php
}
示例6: render_comment_meta_box
function render_comment_meta_box($post)
{
// create a nonce field
wp_nonce_field('my_comment_meta_box_nonce', 'comment_meta_box_nonce');
$comment_id = get_comment_ID();
?>
<style>
#namediv h3 label {
vertical-align: baseline;
}
#comments-meta table {
width: 100%;
}
#comments-meta td.first {
white-space: nowrap;
width: 10px;
}
#comments-meta input {
width: 98%;
}
#comments-meta p {
margin: 10px 0;
}
</style>
<div class="inside">
<table class="form-table editcomment" id="comments-meta">
<tbody>
<tr>
<td class="first">Párrafo Index:</td>
<td><input type="text" id="parrafo_index" value="<?php
echo comment_get_custom_field('parrafo_index', $comment_id);
?>
" size="30" name="parrafo_index"></td>
</tr>
<tr>
<td class="first">
Tipo de Comentario:</td>
<td><input type="text" id="tipo_comentario" value="<?php
echo comment_get_custom_field('tipo_comentario', $comment_id);
?>
" size="30" name="tipo_comentario"></td>
</tr>
<tr>
<td class="first">
Texto Seleccionado:</td>
<td><input type="text" id="tipo_comentario" value='<?php
echo comment_get_custom_field('highlight_span_info', $comment_id);
?>
' size="30" name="tipo_comentario"></td>
</tr>
</tbody>
</table>
</div>
<?php
}
示例7: start_el
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
}
示例8: thematic_commentmeta
function thematic_commentmeta($print = TRUE)
{
$content = '<div class="comment-meta">' . sprintf(__('Posted %1$s at %2$s <span class="meta-sep">|</span> <a href="%3$s" title="Permalink to this comment">Permalink</a>', 'thematic'), get_comment_date(), get_comment_time(), '#comment-' . get_comment_ID());
if (get_edit_comment_link()) {
$content .= sprintf(' <span class="meta-sep">|</span><span class="edit-link"> <a class="comment-edit-link" href="%1$s" title="%2$s">%3$s</a></span>', get_edit_comment_link(), __('Edit comment'), __('Edit', 'thematic'));
}
$content .= '</div>' . "\n";
return $print ? print apply_filters('thematic_commentmeta', $content) : apply_filters('thematic_commentmeta', $content);
}
示例9: parse_lists_in_comment
public function parse_lists_in_comment($content, $comment = null)
{
$this->post_ID = '';
$this->comment_ID = get_comment_ID();
$content = wp_kses_post($content);
// we need to this this here because we removed the wp_kses_post filter in o2_Comment_List_Creator __construct
$this->user_can_edit_object = $this->current_user_can_edit_checklist('comment', $this->comment_ID);
return $this->parse_lists($content);
}
示例10: ldc_dislike_counter_c
function ldc_dislike_counter_c($text = "dislikes: ", $post_id = NULL)
{
global $comment;
if (empty($post_id)) {
$post_id = get_comment_ID();
}
$ldc_return = "<span class='ldc-ul_cont' onclick=\"alter_ul_post_values(this,'{$post_id}','c_dislike')\" >" . $text . "<img src=\"" . plugins_url('images/down.png', __FILE__) . "\" />(<span>" . get_post_ul_meta($post_id, "c_dislike") . "</span>)</span>";
return $ldc_return;
}
示例11: chaostheory_comment
function chaostheory_comment($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
?>
<li id="comment-<?php
comment_ID();
?>
" <?php
comment_class();
?>
>
<div id="div-comment-<?php
comment_ID();
?>
">
<ul class="comment-meta">
<li class="comment-author vcard">
<div class="comment-avatar"><?php
if ($args['avatar_size'] != 0) {
echo get_avatar($comment, $args['avatar_size']);
}
?>
</div>
<span class="fn"><?php
comment_author_link();
?>
</span></li>
<?php
printf(__('<li>Posted %1$s at %2$s</li> <li><a href="%3$s" title="Permalink to this comment">Permalink</a></li>', 'chaostheory'), get_comment_date(), get_comment_time(), '#comment-' . get_comment_ID());
?>
<li><?php
edit_comment_link(__('(Edit)', 'chaostheory'), ' ', '');
?>
<?php
comment_reply_link(array_merge($args, array('add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'])));
?>
</li>
</ul>
<div class="comment-content">
<?php
if ($comment->comment_approved == '0') {
?>
<span class="unapproved"><?php
_e('Your comment is awaiting moderation.', 'chaostheory');
?>
</span><?php
}
?>
<?php
comment_text();
?>
</div>
</div>
<?php
}
示例12: start_lvl
function start_lvl(&$output, $depth = 0, $args = array())
{
$GLOBALS['comment_depth'] = $depth + 1;
?>
<!-- <ul <?php
comment_class('media unstyled comment-' . get_comment_ID());
?>
> -->
<?php
}
示例13: hmn_cp_the_comment_author_karma
/**
* Displays the author karma.
*/
function hmn_cp_the_comment_author_karma()
{
if (class_exists('CommentPopularity\\HMN_Comment_Popularity')) {
$hmn_cp_obj = CommentPopularity\HMN_Comment_Popularity::get_instance();
$author_karma = $hmn_cp_obj->get_comment_author_karma(get_comment_author_email(get_comment_ID()));
if (isset($author_karma)) {
echo '<small class="user-karma">(User Karma: ' . esc_html($author_karma) . ')</small>';
}
}
}
示例14: cleanyetibasic_commentmeta
/**
* Create comment meta
*
* Located in discussion.php
*
* Override: childtheme_override_commentmeta <br>
* Filter: cleanyetibasic_commentmeta
*/
function cleanyetibasic_commentmeta($print = TRUE)
{
$content = '<div class="comment-meta">' . sprintf(_x('Posted %s at %s', 'Posted {$date} at {$time}', 'cleanyetibasic'), get_comment_date(), get_comment_time());
$content .= ' <span class="meta-sep">|</span> ' . sprintf('<a href="%1$s" title="%2$s">%3$s</a>', '#comment-' . get_comment_ID(), __('Permalink to this comment', 'cleanyetibasic'), __('Permalink', 'cleanyetibasic'));
if (get_edit_comment_link()) {
$content .= sprintf(' <span class="meta-sep">|</span><span class="edit-link"> <a class="comment-edit-link" href="%1$s" title="%2$s">%3$s</a></span>', get_edit_comment_link(), __('Edit comment', 'cleanyetibasic'), __('Edit', 'cleanyetibasic'));
}
$content .= '</div>' . "\n";
return $print ? print apply_filters('cleanyetibasic_commentmeta', $content) : apply_filters('cleanyetibasic_commentmeta', $content);
}
示例15: remove_post_author_weburl
/**
* Remove post author URL
*
* @since 1.0.0
* @access public
* @return string remove the author's url from comment post
*/
function remove_post_author_weburl($return)
{
global $comment, $post;
if (!is_admin()) {
$author = get_comment_author(get_comment_ID());
return $author;
} else {
return $return;
}
}