当前位置: 首页>>代码示例>>PHP>>正文


PHP get_comment_author函数代码示例

本文整理汇总了PHP中get_comment_author函数的典型用法代码示例。如果您正苦于以下问题:PHP get_comment_author函数的具体用法?PHP get_comment_author怎么用?PHP get_comment_author使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_comment_author函数的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";
     // закрываем див
 }
开发者ID:Ivan26ru,项目名称:gp-wp,代码行数:30,代码来源:functions.php

示例2: 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);
 }
开发者ID:bitoncoin,项目名称:woocommerce,代码行数:38,代码来源:class-wc-widget-recent-reviews.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;
 }
开发者ID:Hevix,项目名称:hevix,代码行数:32,代码来源:wp-noexternallinks-parser.php

示例4: mysiteapp_get_member_for_comment

function mysiteapp_get_member_for_comment()
{
    $need_g_avatar = true;
    $user = array();
    $user['author'] = get_comment_author();
    $user['link'] = get_comment_author_url();
    $options = get_option('uppsite_options');
    if (isset($options['disqus'])) {
        $user['avatar'] = mysiteapp_get_pic_from_fb_profile($user['link']);
        if ($user['avatar']) {
            $need_g_avatar = false;
        }
    }
    if ($need_g_avatar) {
        if (function_exists('get_avatar') && function_exists('htmlspecialchars_decode')) {
            $user['avatar'] = htmlspecialchars_decode(uppsite_extract_src_url(get_avatar(get_comment_author_email())));
        }
    }
    ?>
<member>
    <name><![CDATA[<?php 
    echo $user['author'];
    ?>
]]></name>
    <member_link><![CDATA[<?php 
    echo $user['link'];
    ?>
]]></member_link>
    <avatar><![CDATA[<?php 
    echo $user['avatar'];
    ?>
]]></avatar>
</member><?php 
}
开发者ID:alpual,项目名称:Caitlin-Sabo,代码行数:34,代码来源:functions.php

示例5: 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);
 }
开发者ID:chhavinav,项目名称:fr.ilovejuice,代码行数:44,代码来源:class-wc-widget-recent-reviews.php

示例6: 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;
 }
开发者ID:Artgorae,项目名称:wp-artgorae,代码行数:34,代码来源:search_comments.class.php

示例7: 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
 }
开发者ID:seredniy,项目名称:clean-wp-template,代码行数:31,代码来源:functions.php

示例8: my_custom_comments

function my_custom_comments($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    ?>
	<li <?php 
    comment_class();
    ?>
 id="li-comment-<?php 
    comment_ID();
    ?>
">
	<?php 
    if ($comment->comment_approved == '0') {
        ?>
		<em><?php 
        _e('Your comment is awaiting moderation.');
        ?>
</em>
	<?php 
    }
    ?>
	<?php 
    echo '<div class="pull-left"><div class="commentor-avatar" style="height: 90px; width: 90px; background: url(' . get_avatar_url($comment) . ') no-repeat center center; background-size: cover;"><div class="commentor-name">' . get_comment_author() . '</div></div></div>';
    comment_text();
    echo '<div class="clearfix"></div>';
}
开发者ID:codysaylor,项目名称:wordpress-barebones-boilerplate,代码行数:26,代码来源:functions.php

示例9: comment_author_profile_link

/**
 * Set the content width based on the theme's design and stylesheet.
 *
 * Used to set the width of images and content. Should be equal to the width the theme
 * is designed for, generally via the style.css stylesheet.
 */
function comment_author_profile_link()
{
    /* Get the comment author information */
    global $comment;
    $comment_ID = $comment->user_id;
    $author = get_comment_author($comment_ID);
    $url = get_comment_author_url($comment_ID);
    /* Check if commenter is registered or not */
    /* Registered Commenter */
    $registeredID = get_userdata($comment_ID);
    $authorName = $registeredID->display_name;
    $authorLevel = $registeredID->user_level;
    $authorURL = $registeredID->user_url;
    $authorID = $registeredID->ID;
    /* Check if they have edit posts capabilities & is author or higher */
    if ($authorLevel > 1 && user_can($authorID, 'edit_posts') == true && count_user_posts($authorID) > 0) {
        /* Author+ with Posts */
        $return = '<a href="' . home_url() . '/?author=' . $authorID . '">' . $authorName . '</a>';
    } else {
        /* Below Author */
        if (empty($authorURL) || 'http://' == $authorURL) {
            $return = $authorName;
        } else {
            $return = "<a href='{$authorURL}' rel='external nofollow' class='url' target='_blank'>{$authorName}</a>";
        }
    }
    return $return;
}
开发者ID:swena,项目名称:Online-Magazine-Website,代码行数:34,代码来源:functions.php

示例10: 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 
}
开发者ID:nashinomi,项目名称:kukuru,代码行数:60,代码来源:functions.php

示例11: framework_comment_avatar

 function framework_comment_avatar($avatar = true, $gravatar_size = 50)
 {
     $author = get_comment_author();
     $url = get_comment_author_url();
     if (!empty($url) || 'http://' == !$url) {
         $uri = ' href="' . $url . '" ';
     } else {
         $uri = NULL;
     }
     if ($avatar) {
         // Get author's gavatar
         $gravatar_email = get_comment_author_email();
         $gravatar_size = apply_filters('framework_gravatar_size', (int) $gravatar_size);
         // Available filter: framework_gravatar_size
         $gravatar = get_avatar($gravatar_email, $gravatar_size);
         // get the $src data from $gavatar
         if (preg_match('/src=\'(.*?)\'/i', $gravatar, $matches)) {
             $src = $matches[1];
         }
         // Rebuild Gravatar link because get_avatar() produces invalid code :/ (P.S. adds "gravatar" class)
         $output = "<a class=\"avatar-link\"{$uri}><img class=\"avatar gravatar gravatar-{$gravatar_size}\" alt=\"{$author}'s Gravatar\" src=\"{$src}\" width=\"{$gravatar_size}\" height=\"{$gravatar_size}\" /></a>";
         return apply_filters('framework_comment_avatar', (string) $output);
         // Available filter: framework_comment_avatar
     }
 }
开发者ID:sandesh247,项目名称:sandesh247.com,代码行数:25,代码来源:pluggable.php

示例12: tokopress_comments

function tokopress_comments($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    ?>
    <li itemprop="reviews" itemscope="" itemtype="http://schema.org/Review" class="comment even thread-even depth-1" id="li-comment-105">
        <div id="comment-105" class="comment_container">
            <?php 
    echo get_avatar($comment, $size = '60');
    ?>
            <div class="comment-text">
                <div class="entry-meta">
                    <span class="author vcard"><a class="url fn n" rel="author" href="<?php 
    echo get_comment_author_url();
    ?>
" title="<?php 
    echo get_comment_author();
    ?>
 <?php 
    _e('Says', 'tokopress');
    ?>
"><?php 
    echo get_comment_author();
    ?>
</a></span>
                    <time class="published" datetime="<?php 
    echo get_comment_date('c');
    ?>
" title="<?php 
    echo get_comment_date('l, F jS, Y, g:i a');
    ?>
"><?php 
    echo get_comment_date();
    ?>
</time> <?php 
    comment_reply_link(array_merge($args, array('reply_text' => __('. Reply', 'tokopress'), 'after' => '', 'depth' => $depth, 'max_depth' => $args['max_depth'])));
    ?>
                </div>
                <div itemprop="description" class="description">
                    <?php 
    if ($comment->comment_approved == '0') {
        ?>
                        <div class="alert alert-moderation">
                            <p><em><?php 
        _e('Your comment is awaiting moderation.', 'tokopress');
        ?>
</em></p>
                        </div>
                    <?php 
    }
    ?>
                    <?php 
    comment_text();
    ?>
                </div>
            </div>
        </div>
    </li><!-- #comment-## -->
    <?php 
}
开发者ID:Artgorae,项目名称:wp-artgorae,代码行数:59,代码来源:comments.php

示例13: comment

    /**
     * @param object $comment
     * @param int    $depth
     * @param array  $args
     */
    protected function comment($comment, $depth, $args)
    {
        ?>
		<li <?php 
        comment_class($this->has_children ? 'parent' : '', $comment->comment_ID);
        ?>
 id="comment-<?php 
        comment_ID();
        ?>
">
			<?php 
        if (1 === $depth) {
            ?>
<div class="row"><?php 
        }
        ?>
				<div class="media media--nofloat">
					<div class="img">
						<?php 
        $avatar_size = 1 === $depth ? 100 : 70;
        echo get_avatar($comment, $avatar_size, '', get_comment_author());
        ?>
					</div>
					<div class="bd">
						<div class="comment-author">
							<?php 
        printf(__('By&nbsp;<cite class="fn">%s</cite> <span class="date">on %s</span>', 'yoast-theme'), get_comment_author_link(), get_comment_date());
        ?>
						</div>

						<div class="comment-content">
							<?php 
        if ($comment->comment_approved == '0') {
            ?>
								<p class="alert"><?php 
            echo apply_filters('genesis_comment_awaiting_moderation', __('Your comment is awaiting moderation.', 'genesis'));
            ?>
</p>
							<?php 
        }
        ?>

							<?php 
        comment_text();
        ?>
						</div>
					</div>
				</div>

				<div class="reply">
					<?php 
        comment_reply_link(array_merge($args, array('add_below' => 'comment', 'depth' => $depth, 'max_depth' => $args['max_depth'])));
        ?>
					<?php 
        edit_comment_link('edit', ' | ', '');
        ?>
				</div>
		<?php 
    }
开发者ID:apsolut,项目名称:Yoast-theme-public,代码行数:64,代码来源:class-comment-walker.php

示例14: 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 
    }
开发者ID:humanmade,项目名称:vip-mu-plugins-public,代码行数:59,代码来源:comments.php

示例15: gasp_get_comment_author

/**
* strip the link off the name if comment is in moderation
* @param string $authorlink
* @return string
*/
function gasp_get_comment_author($authorlink)
{
    global $comment;
    if ($comment->comment_approved == '0') {
        return get_comment_author();
    }
    return $authorlink;
}
开发者ID:AdamFreemer,项目名称:xfx-site,代码行数:13,代码来源:growmap-anti-spambot-plugin.php


注:本文中的get_comment_author函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。