本文整理汇总了PHP中get_comment_text函数的典型用法代码示例。如果您正苦于以下问题:PHP get_comment_text函数的具体用法?PHP get_comment_text怎么用?PHP get_comment_text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_comment_text函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_dados
public function get_dados($postID = false, $tipo_data = false)
{
$pautas = '';
$comments = '';
if ($postID === false) {
$pautas = delibera_get_pautas_em();
$comments = delibera_wp_get_comments();
} else {
$pautas = array(get_post($postID));
$comments = delibera_wp_get_comments(array('post_id' => $postID));
}
$events = array();
foreach ($pautas as $pauta) {
$data = strtotime($pauta->post_date_gmt);
if (!array_key_exists($data, $events)) {
$events[$data] = array();
}
$events[$data][] = array('type' => 'pauta', 'title' => get_the_title($postID), 'body' => apply_filters('the_content', $pauta->post_content), 'date_event' => $data);
}
foreach ($comments as $comment) {
$data = strtotime($comment->comment_date_gmt);
if (!array_key_exists($data, $events)) {
$events[$data] = array();
}
$events[$data][] = array('type' => 'comment-' . get_comment_meta($comment->comment_ID, "delibera_comment_tipo", true), 'title' => "@" . $comment->comment_author, 'body' => apply_filters('comment_text', get_comment_text($comment->comment_ID)), 'date_event' => $data);
}
ksort($events, SORT_NUMERIC);
return $this->filtrar($events, $tipo_data);
}
示例2: mydesign
function mydesign($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
$users = get_users();
?>
<li id="comment-<?php
echo comment_id();
?>
" class="compost">
<?php
// ユーザーIDを引っ張る
foreach ($users as $user) {
//echo $user->display_name.'<br />';
//echo get_comment_author();
if ($user->display_name == get_comment_author()) {
break;
}
}
?>
<span class="trick_rounded-img icon_image" style="background: url(<?php
echo ps_get_user_profile_image_src($user->ID, 'standard');
?>
) no-repeat center center; width: 50px; height: 50px;></span>
<span class="trick_thumbnail_Image">
<?php
ps_user_profile_image($user->ID, 'thumbnail');
?>
</span>
<?php
?>
<div class="commentarea">
<?php
//改行表示
$commentstr = '<p>' . get_comment_text() . '</p>';
$commentstr = preg_replace("/\n/", "<br />", $commentstr);
echo $commentstr;
//comment_text();
?>
</div>
<p class="cominfo">
<?php
comment_date();
?>
<?php
comment_time();
?>
|
<?php
comment_author_link();
?>
<?php
comment_reply_link(array_merge($args, array('depth' => $depth, 'reply_text' => '返信', 'before' => ' | ', 'after' => '')));
?>
</p>
</li>
<?php
}
示例3: ap_comment
function ap_comment($comment)
{
$GLOBALS['comment'] = $comment;
?>
<li <?php
comment_class();
?>
id="li-comment-<?php
comment_ID();
?>
">
<article id="comment-<?php
comment_ID();
?>
" class="comment">
<div class="ap-avatar">
<a href="<?php
echo ap_user_link($comment->user_id);
?>
">
<?php
echo get_avatar($comment, ap_opt('avatar_size_qcomment'));
?>
</a>
</div>
<div class="comment-content">
<?php
if ('0' == $comment->comment_approved) {
?>
<p class="comment-awaiting-moderation"><?php
_e('Your comment is awaiting moderation.', 'ap');
?>
</p>
<?php
}
?>
<p class="ap-comment-texts">
<?php
echo get_comment_text();
?>
<?php
printf(' - <time datetime="%1$s">%2$s %3$s</time>', get_comment_time('c'), ap_human_time(get_comment_time('U')), __('ago', 'ap'));
?>
</p>
<div class="comment-meta">
<?php
if (ap_user_can_edit_comment(get_comment_ID())) {
echo '<a class="comment-edit-btn" href="#" data-button="ap-edit-comment" data-args="' . get_comment_ID() . '-' . wp_create_nonce('comment-' . get_comment_ID()) . '"><i class="aicon-pencil"></i> ' . __('Edit', 'ap') . '</a>';
}
if (ap_user_can_delete_comment(get_comment_ID())) {
echo '<a class="comment-delete-btn" href="#" data-button="ap-delete-comment" data-confirm="' . __('Are you sure? It cannot be undone!', 'ap') . '" data-args="' . get_comment_ID() . '-' . wp_create_nonce('delete-comment-' . get_comment_ID()) . '"><i class="aicon-close"></i> ' . __('Delete', 'ap') . '</a>';
}
?>
</div>
</div>
</article>
<?php
}
示例4: codeless_custom_comment
function codeless_custom_comment($comment, $args, $depth)
{
?>
<div class="comment <?php
if ($depth == 1) {
echo 'span12';
} else {
echo 'span11 offset1';
}
?>
">
<dl class="dl-horizontal">
<dt>
<?php
echo get_avatar($comment, '64');
?>
</dt>
<dd>
<span class="author"><a href=""><?php
echo get_comment_author_link($comment);
?>
</a></span>
<ul>
<li><span><?php
comment_date('M j Y', $comment);
?>
</span></li>
<li><span><?php
comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
?>
</span></li>
<li><span> <?php
edit_comment_link();
?>
</span></li>
</ul>
<div class="comment_text">
<?php
echo get_comment_text($comment);
?>
<?php
if ($comment->comment_approved == '0') {
?>
<span>Your comment is awaiting moderation.</span>
<?php
}
?>
</div>
</dd>
</dl>
</div>
<?php
}
示例5: get_fields_for_render
public function get_fields_for_render()
{
$entry_id = $this->comment->comment_ID;
$post_id = $this->comment->comment_post_ID;
$avatar_size = apply_filters('liveblog_entry_avatar_size', self::default_avatar_size);
$comment_text = get_comment_text($entry_id);
$css_classes = implode(' ', get_comment_class('', $entry_id, $post_id));
$entry = array('entry_id' => $entry_id, 'post_id' => $post_id, 'css_classes' => $css_classes, 'content' => self::render_content($comment_text, $this->comment), 'original_content' => apply_filters('liveblog_before_edit_entry', $comment_text), 'avatar_size' => $avatar_size, 'avatar_img' => get_avatar($this->comment->comment_author_email, $avatar_size), 'author_link' => get_comment_author_link($entry_id), 'entry_date' => get_comment_date(get_option('date_format'), $entry_id), 'entry_time' => get_comment_date(get_option('time_format'), $entry_id), 'timestamp' => $this->get_timestamp(), 'is_liveblog_editable' => WPCOM_Liveblog::is_liveblog_editable());
return $entry;
}
示例6: st_comment
function st_comment($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
switch ($comment->comment_type) {
case 'comment':
global $st_Settings;
?>
<li id="comment-<?php
comment_ID();
?>
" class="comment">
<?php
$avatar_size = '0' != $comment->comment_parent ? 50 : 75;
$comment_author = get_the_author_meta('user_email') == $comment->comment_author_email ? ' bypostauthor' : '';
$comment_level = '0' == $comment->comment_parent ? ' class="comment-holder comment-top-level' . $comment_author . '"' : ' class="comment-holder comment-low-level' . $comment_author . '"';
$out = '<div' . $comment_level . '>';
// Gravatar
$out .= '<div class="avatar-box">' . get_avatar($comment, $avatar_size) . '</div>';
$out .= '<div class="comment-box">';
// Author name
$out .= '<div class="comment-author" id="author-' . get_comment_ID() . '">' . get_comment_author_link() . '</div>';
// Date
$out .= '<div class="comment-date">';
if (!empty($st_Settings['nice_time']) && $st_Settings['nice_time'] == 'yes' && function_exists('st_niceTime')) {
$out .= st_niceTime(get_comment_date('c', get_comment_ID()));
} else {
$out .= get_comment_date() . ' ' . __('at', 'strictthemes') . ' ' . get_comment_time();
}
$out .= '</div>';
// Comment
$out .= wpautop(get_comment_text());
if (comments_open()) {
// Reply/Cancel links
$out .= '<span class="reply non-selectable">' . '<a title="' . get_comment_ID() . '" class="quick-reply" href="' . get_permalink() . '?replytocom=' . get_comment_ID() . '#respond">' . __('Reply', 'strictthemes') . '</a>' . '<a class="quick-reply-cancel none" href="#">' . __('Cancel', 'strictthemes') . '</a>' . '</span>';
}
// Edit link
if (current_user_can('manage_options')) {
$out .= ' - <a href="' . get_edit_comment_link() . '">' . __('Edit', 'strictthemes') . '</a>';
}
// Pre-moderation
if ($comment->comment_approved == '0') {
$out .= '<p><em class="comment-awaiting-moderation">' . __('Your comment is awaiting moderation.', 'strictthemes') . '</em></p>';
}
$out .= '<div class="quick-holder" id="quick-holder-' . get_comment_ID() . '"></div></div><div class="clear"><!-- --></div>';
// .comment-box
$out .= '</div>';
// .$comment_level
$out .= '<div class="clear"><!-- --></div>';
echo $out;
break;
}
}
示例7: render
public static function render($comment, $args, $depth)
{
self::set_context($comment);
// Note that WordPress closes the div for you, do not close it here!
// https://codex.wordpress.org/Function_Reference/wp_list_comments
printf('<div class="%s">', implode(' ', get_comment_class(self::base_classes($comment), $comment, $comment->comment_post_ID)));
$comment_actions = '';
if (comments_open($comment->comment_post_ID)) {
$comment_actions = html('a', array('class' => 'reply-link', 'href' => sprintf('mailto:{{{reply_to_comment_%s}}}?subject=%s', $comment->comment_ID, rawurlencode(sprintf(__('Reply to %s', 'Postmatic'), $comment->comment_author)))), html('img', array('src' => 'https://s3-us-west-2.amazonaws.com/postmatic/assets/icons/reply.png', 'width' => '13', 'height' => '8')), __('Reply', 'Postmatic'));
}
echo html('div class="comment-header"', get_avatar($comment), html('div class="author-name"', get_comment_author_link($comment->comment_ID)), html('div class="comment-body"', apply_filters('comment_text', get_comment_text($comment->comment_ID), $comment), $comment_actions));
}
示例8: wordpress_plugin_comments
function wordpress_plugin_comments($comments)
{
wp_enqueue_script('newscript', plugins_url('wp_jquery.js', __FILE__));
$comments = get_comment_text();
if (strlen($comments) > get_option('option1')) {
$comment_court = substr($comments, get_option('option1'), strlen($comments));
$comment_court = "<span id='texte'>" . ($comment_court .= "</span>");
$comment = substr($comments, 0, get_option('option1'));
return "<span id='text'>" . $comment . "</span>" . ($comment_court .= ' <a href="" id="cacher">(Hide)</a> <a href="" id="montrer">(Read More)</a>');
} else {
return $comments;
}
}
示例9: skillcrush_comments
function skillcrush_comments($comment, $args, $depth)
{
$comment = '<li class="comment">';
$comment .= '<header class="comment-head">';
$comment .= '<span class="comment-author">' . get_comment_author() . '</span>';
$comment .= '<span class="comment-meta">' . get_comment_date('m/d/Y') . ' | ' . get_comment_reply_link(array('depth' => $depth, 'max_depth' => 5)) . '</span>';
$comment .= '</header>';
$comment .= '<div class="comment-body">';
$comment .= '<p>' . get_comment_text() . '</p>';
$comment .= '</div>';
$comment .= '</li>';
echo $comment;
}
示例10: widget
function widget($args, $instance)
{
global $comments, $comment;
$cache = wp_cache_get('tm_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;
}
$d = get_option('date_format');
extract($args, EXTR_SKIP);
$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;
$number_char = !empty($instance['number_char']) ? absint($instance['number_char']) : 50;
if (!$number) {
$number = 5;
}
$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 id="tm_recentcomments">';
if ($comments) {
// Prime cache for associated posts. (Prime post term cache if we need it for permalinks.)
$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) {
$num_char = get_comment_text($comment->comment_ID);
$len = strlen($num_char);
if ($len > $number_char) {
$num_char = substr($num_char, 0, $number_char) . '...';
}
$output .= '<li class="tm_recentcomments"><a class="cm-avatar" href="' . esc_url(get_comment_link($comment->comment_ID)) . '">' . get_avatar($comment, 60, '', get_the_author()) . '</a>' . sprintf(_x('%1$s %2$s', 'widgets'), '<div class="info_rc"><a href="' . esc_url(get_comment_link($comment->comment_ID)) . '">' . $num_char . '</a>', '<p><span>' . get_comment_author_link()) . '</span>' . get_comment_date($d, $comment->comment_ID) . '' . __(' at ', 'cactusthemes') . '' . get_comment_time() . '</p></div></li>';
}
}
$output .= '</ul>';
$output .= $after_widget;
echo $output;
$cache[$args['widget_id']] = $output;
wp_cache_set('tm_recent_comments', $cache, 'widget');
}
示例11: getComments
public static function getComments($postId, $args = array())
{
$args['post_id'] = $postId;
$comments = get_comments($args);
if (is_array($comments)) {
$result = array();
foreach ($comments as $comment) {
$params = array('comment_content' => get_comment_text($comment), 'comment_author' => get_comment_author($comment), 'avatar' => self::getAvatar($comment), 'authorLink' => get_comment_author_link($comment));
$comment_object_var = get_object_vars($comment);
$comment_params = $params + $comment_object_var;
$result[] = new Comment($comment_params);
}
return CommentDataHelper::buildCommentTree($result);
} else {
return null;
}
}
示例12: thema_comment
function thema_comment($comment)
{
$reactie = '';
$reactie .= '<div class="reactie-item clearfix" id="reactie-' . get_comment_ID() . '">';
$reactie .= '<div class="reactie-meta clearfix">';
$reactie .= '<span class="reactie-door">';
$reactie .= get_comment_author();
$reactie .= '</span>';
$reactie .= '<span class="reactie-datum">';
$reactie .= get_comment_date("j F Y") . ' om ' . get_comment_date("G:i") . '</span>';
$reactie .= '</div>';
$reactie .= '<div class="reactie-inhoud">';
$reactie .= get_avatar($comment, 80);
$reactie .= get_comment_text();
$reactie .= '</div>';
$reactie .= '</div>';
print $reactie;
}
示例13: cws_comments
function cws_comments($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
?>
<li class="comment" id="div-comment-<?php
comment_ID();
?>
">
<div class="comment-body">
<?php
echo get_avatar($comment, '47');
?>
<div class="comment-text">
<div class="comment-author"><?php
printf(__('%s', 'happykids'), get_comment_author_link());
?>
</div>
<div class="comment-entry"><?php
echo strip_tags(get_comment_text());
?>
</div>
<div class="comment-meta">
<?php
comment_reply_link(array_merge($args, array('depth' => $depth, 'reply_text' => '<span class="color_accent">' . multitranslate(__('Reply', 'happykids'), "_comments_reply", false) . '</span>', 'max_depth' => $args['max_depth'])));
?>
<?php
edit_comment_link('<span class="comment_edit_span">' . multitranslate(__('Edit', 'happykids'), "_comments_edit", false) . '</span>');
?>
<?php
printf(__('%1$s at %2$s', 'happykids'), get_comment_date(), get_comment_time());
?>
</div><!--/ comment-meta -->
</div><!--/ comment-text -->
<div class="kids_clear"></div>
</div>
<?php
}
示例14: get_events
/**
* Get list of events. There's filter `slack_get_events`
* to extend available events that can be notified to
* Slack.
*/
public function get_events()
{
return apply_filters('slack_get_events', array('post_published' => array('action' => 'transition_post_status', 'description' => __('When a post is published', 'slack'), 'default' => true, 'message' => function ($new_status, $old_status, $post) {
$notified_post_types = apply_filters('slack_event_transition_post_status_post_types', array('post'));
if (!in_array($post->post_type, $notified_post_types)) {
return false;
}
if ('publish' !== $old_status && 'publish' === $new_status) {
$excerpt = has_excerpt($post->ID) ? apply_filters('get_the_excerpt', $post->post_excerpt) : wp_trim_words(strip_shortcodes($post->post_content), 55, '…');
return sprintf('New post published: *<%1$s|%2$s>* by *%3$s*' . "\n" . '> %4$s', get_permalink($post->ID), get_the_title($post->ID), get_the_author_meta('display_name', $post->post_author), $excerpt);
}
}), 'post_pending_review' => array('action' => 'transition_post_status', 'description' => __('When a post needs review', 'slack'), 'default' => false, 'message' => function ($new_status, $old_status, $post) {
$notified_post_types = apply_filters('slack_event_transition_post_status_post_types', array('post'));
if (!in_array($post->post_type, $notified_post_types)) {
return false;
}
if ('pending' !== $old_status && 'pending' === $new_status) {
$excerpt = has_excerpt($post->ID) ? apply_filters('get_the_excerpt', $post->post_excerpt) : wp_trim_words(strip_shortcodes($post->post_content), 55, '…');
return sprintf('New post needs review: *<%1$s|%2$s>* by *%3$s*' . "\n" . '> %4$s', admin_url(sprintf('post.php?post=%d&action=edit', $post->ID)), get_the_title($post->ID), get_the_author_meta('display_name', $post->post_author), $excerpt);
}
}), 'new_comment' => array('action' => 'wp_insert_comment', 'priority' => 999, 'description' => __('When there is a new comment', 'slack'), 'default' => false, 'message' => function ($comment_id, $comment) {
$comment = is_object($comment) ? $comment : get_comment(absint($comment));
$post_id = $comment->comment_post_ID;
$notified_post_types = apply_filters('slack_event_wp_insert_comment_post_types', array('post'));
if (!in_array(get_post_type($post_id), $notified_post_types)) {
return false;
}
$post_title = get_the_title($post_id);
$comment_status = wp_get_comment_status($comment_id);
// Ignore spam.
if ('spam' === $comment_status) {
return false;
}
return sprintf('<%1$s|New comment> by *%2$s* on *<%3$s|%4$s>* (_%5$s_)' . "\n" . '>%6$s', admin_url("comment.php?c={$comment_id}&action=editcomment"), $comment->comment_author, get_permalink($post_id), $post_title, $comment_status, preg_replace("/\n/", "\n>", get_comment_text($comment_id)));
})));
}
示例15: comment_text
function comment_text()
{
echo apply_filters('comment_text', get_comment_text());
}