• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_comment_type函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了get_comment_type函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: omega_comments_callback

/**
 * Uses the $comment_type to determine which comment template should be used. Once the 
 * template is located, it is loaded for use. Child themes can create custom templates based off
 * the $comment_type. The comment template hierarchy is comment-$comment_type.php, 
 * comment.php.
 *
 * The templates are saved in $omega->comment_template[$comment_type], so each comment template
 * is only located once if it is needed. Following comments will use the saved template.
 *
 * @since  0.2.3
 * @access public
 * @param  $comment The comment object.
 * @param  $args    Array of arguments passed from wp_list_comments().
 * @param  $depth   What level the particular comment is.
 * @return void
 */
function omega_comments_callback($comment, $args, $depth)
{
    global $omega;
    /* Get the comment type of the current comment. */
    $comment_type = get_comment_type($comment->comment_ID);
    /* Create an empty array if the comment template array is not set. */
    if (!isset($omega->comment_template) || !is_array($omega->comment_template)) {
        $omega->comment_template = array();
    }
    /* Check if a template has been provided for the specific comment type.  If not, get the template. */
    if (!isset($omega->comment_template[$comment_type])) {
        /* Create an array of template files to look for. */
        $templates = array("comment-{$comment_type}.php", "comment/{$comment_type}.php");
        /* If the comment type is a 'pingback' or 'trackback', allow the use of 'comment-ping.php'. */
        if ('pingback' == $comment_type || 'trackback' == $comment_type) {
            $templates[] = 'comment-ping.php';
            $templates[] = 'comment/ping.php';
        }
        /* Add the fallback 'comment.php' template. */
        $templates[] = 'comment/comment.php';
        $templates[] = 'comment.php';
        /* Allow devs to filter the template hierarchy. */
        $templates = apply_filters('omega_comment_template_hierarchy', $templates, $comment_type);
        /* Locate the comment template. */
        $template = locate_template($templates);
        /* Set the template in the comment template array. */
        $omega->comment_template[$comment_type] = $template;
    }
    /* If a template was found, load the template. */
    if (!empty($omega->comment_template[$comment_type])) {
        require $omega->comment_template[$comment_type];
    }
}
开发者ID:traviswright,项目名称:matterandspirit,代码行数:49,代码来源:template-comments.php


示例2: sf_custom_comments

    function sf_custom_comments($comment, $args, $depth)
    {
        $GLOBALS['comment'] = $comment;
        $GLOBALS['comment_depth'] = $depth;
        ?>
		    <li id="comment-<?php 
        comment_ID();
        ?>
" <?php 
        comment_class('clearfix');
        ?>
>
		        <div class="comment-wrap clearfix">
		            <div class="comment-avatar">
		            	<?php 
        if (function_exists('get_avatar')) {
            echo get_avatar($comment, '100');
        }
        ?>
		            	<?php 
        if ($comment->comment_author_email == get_the_author_meta('email')) {
            ?>
		            	<span class="tooltip"><?php 
            _e("Author", "swiftframework");
            ?>
<span class="arrow"></span></span>
		            	<?php 
        }
        ?>
		            </div>
		    		<div class="comment-content">
		            	<div class="comment-meta">
	            			<?php 
        printf('<span class="comment-author">%1$s</span> <span class="comment-date">%2$s</span>', get_comment_author_link(), human_time_diff(get_comment_time('U'), current_time('timestamp')) . ' ' . __("ago", "swiftframework"));
        ?>
			            	<div class="comment-meta-actions">
		            			<?php 
        edit_comment_link(__('Edit', 'swiftframework'), '<span class="edit-link">', '</span><span class="meta-sep"> |</span>');
        ?>
		                        <?php 
        if ($args['type'] == 'all' || get_comment_type() == 'comment') {
            comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'swiftframework'), 'login_text' => __('Log in to reply.', 'swiftframework'), 'depth' => $depth, 'before' => '<span class="comment-reply">', 'after' => '</span>')));
        }
        ?>
			                </div>
						</div>
		      			<?php 
        if ($comment->comment_approved == '0') {
            _e("\t\t\t\t\t<span class='unapproved'>Your comment is awaiting moderation.</span>\n", 'swiftframework');
        }
        ?>
		            	<div class="comment-body">
		                	<?php 
        comment_text();
        ?>
		            	</div>
		    		</div>
		        </div>
	<?php 
    }
开发者ID:roycocup,项目名称:enclothed,代码行数:60,代码来源:sf-comments.php


示例3: carelib_comments_callback

/**
 * Uses the $comment_type to determine which comment template should be used.
 * Once the template is located, it is loaded for use.
 *
 * Child themes can create custom templates based off the $comment_type. The
 * comment template hierarchy is comment-$comment_type.php, comment.php.
 *
 * Templates are saved in CareLib_Template_Comments::comment_template[$comment_type],
 * so each comment template is only located once if it is needed. The
 * following comments will use the saved template.
 *
 * @since  1.0.0
 * @access public
 * @param  object  $comment the comment object.
 * @param  array   $args list of arguments passed from wp_list_comments().
 * @param  integer $depth What level the particular comment is.
 * @return void
 */
function carelib_comments_callback($comment, $args, $depth)
{
    static $comment_template = array();
    // Get the comment type of the current comment.
    $comment_type = get_comment_type($comment->comment_ID);
    // Check if a template has been provided for the specific comment type. If not, get the template.
    if (!isset($comment_template[$comment_type])) {
        // Create an array of template files to look for.
        $templates = array("template-parts/comment/{$comment_type}.php", "comment-{$comment_type}.php");
        // If the comment type is a 'pingback' or 'trackback', allow the use of 'comment-ping.php'.
        if ('pingback' === $comment_type || 'trackback' === $comment_type) {
            $templates[] = 'template-parts/comment/ping.php';
            $templates[] = 'comment-ping.php';
        }
        // Add the fallback 'comment.php' template.
        $templates[] = 'template-parts/comment/comment.php';
        $templates[] = 'comment.php';
        // Allow devs to filter the template hierarchy.
        $templates = apply_filters("{$GLOBALS['carelib_prefix']}_comment_template_hierarchy", $templates, $comment_type);
        // Locate the comment template.
        $template = locate_template($templates);
        // Set the template in the comment template array.
        $comment_template[$comment_type] = $template;
    }
    // If a template was found, load the template.
    if (!empty($comment_template[$comment_type])) {
        require $comment_template[$comment_type];
    }
}
开发者ID:wpsitecare,项目名称:carelib,代码行数:47,代码来源:template-comments.php


示例4: hybrid_comments_callback

/**
 * Uses the `$comment_type` to determine which comment template should be used. Once the
 * template is located, it is loaded for use. Child themes can create custom templates based off
 * the `$comment_type`. The comment template hierarchy is `comment-$comment_type.php`,
 * `comment.php`.
 *
 * The templates are saved in `$hybrid->comment_template[$comment_type]`, so each comment template
 * is only located once if it is needed. Following comments will use the saved template.
 *
 * @since  0.2.3
 * @access public
 * @global object  $hybrid
 * @param  object  $comment
 * @return void
 */
function hybrid_comments_callback($comment)
{
    global $hybrid;
    // Get the comment type of the current comment.
    $comment_type = get_comment_type($comment->comment_ID);
    // Create an empty array if the comment template array is not set.
    if (!isset($hybrid->comment_template) || !is_array($hybrid->comment_template)) {
        $hybrid->comment_template = array();
    }
    // Check if a template has been provided for the specific comment type.  If not, get the template.
    if (!isset($hybrid->comment_template[$comment_type])) {
        // Create an array of template files to look for.
        $templates = array("comment-{$comment_type}.php", "comment/{$comment_type}.php");
        // If the comment type is a 'pingback' or 'trackback', allow the use of 'comment-ping.php'.
        if ('pingback' == $comment_type || 'trackback' == $comment_type) {
            $templates[] = 'comment-ping.php';
            $templates[] = 'comment/ping.php';
        }
        // Add the fallback 'comment.php' template.
        $templates[] = 'comment/comment.php';
        $templates[] = 'comment.php';
        // Allow devs to filter the template hierarchy.
        $templates = apply_filters('hybrid_comment_template_hierarchy', $templates, $comment_type);
        // Locate the comment template.
        $template = locate_template($templates);
        // Set the template in the comment template array.
        $hybrid->comment_template[$comment_type] = $template;
    }
    // If a template was found, load the template.
    if (!empty($hybrid->comment_template[$comment_type])) {
        require $hybrid->comment_template[$comment_type];
    }
}
开发者ID:KL-Kim,项目名称:my-theme,代码行数:48,代码来源:template-comments.php


示例5: sandbox_trackbacks

function sandbox_trackbacks($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    extract($args, EXTR_SKIP);
    global $sandbox_comment_alt;
    ?>
	<?php 
    if (get_comment_type() != "comment") {
        ?>
    <li id="comment-<?php 
        comment_ID();
        ?>
" class="<?php 
        sandbox_comment_class();
        ?>
">
    	<div class="comment-author"><?php 
        printf(__('By %1$s on %2$s at %3$s', 'sandbox'), get_comment_author_link(), get_comment_date(), get_comment_time());
        edit_comment_link(__('Edit', 'sandbox'), ' <span class="meta-sep">|</span> <span class="edit-link">', '</span>');
        ?>
</div>
    	<?php 
        if ($comment->comment_approved == '0') {
            _e('\\t\\t\\t\\t\\t<span class="unapproved">Your trackback is awaiting moderation.</span>\\n', 'sandbox');
        }
        ?>
    	<?php 
        comment_text();
        ?>
    </li>
    <?php 
    }
}
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:33,代码来源:comments.php


示例6: momtaz_comments_callback

/**
 * Uses the $comment_type to determine which comment template should be used. Once the
 * template is located, it is loaded for use.
 *
 * @since 1.0
 * @param $comment The comment variable
 * @param $args Array of arguments passed from wp_list_comments()
 * @param $depth What level the particular comment is
 */
function momtaz_comments_callback($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    $GLOBALS['comment_depth'] = $depth;
    $GLOBALS['max_depth'] = $args['max_depth'];
    // Locate the template based on the $comment_type. Default to 'comment.php'.
    momtaz_template_part('comment', get_comment_type($comment->comment_ID));
}
开发者ID:mastinoz,项目名称:Momtaz-Framework,代码行数:17,代码来源:comments.php


示例7: thematic_comments

/**
 * Custom callback function to list comments in the Thematic style. 
 * 
 * If you want to use your own comments callback for wp_list_comments, filter list_comments_arg
 *
 * @param object $comment 
 * @param array $args 
 * @param int $depth 
 */
function thematic_comments($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    $GLOBALS['comment_depth'] = $depth;
    ?>
    
       	<li id="comment-<?php 
    comment_ID();
    ?>
" <?php 
    comment_class();
    ?>
>
    	
    		<?php 
    // action hook for inserting content above #comment
    thematic_abovecomment();
    ?>
    		
    		<div class="comment-author vcard"><?php 
    thematic_commenter_link();
    ?>
</div>
    		
    			<?php 
    thematic_commentmeta(TRUE);
    ?>
    		
    			<?php 
    if ($comment->comment_approved == '0') {
        echo "\t\t\t\t\t" . '<span class="unapproved">';
        _e('Your comment is awaiting moderation', 'thematic');
        echo ".</span>\n";
    }
    ?>
    			
            <div class="comment-content">
            
        		<?php 
    comment_text();
    ?>
        		
    		</div>
    		
			<?php 
    // echo the comment reply link with help from Justin Tadlock http://justintadlock.com/ and Will Norris http://willnorris.com/
    if ($args['type'] == 'all' || get_comment_type() == 'comment') {
        comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'thematic'), 'login_text' => __('Log in to reply.', 'thematic'), 'depth' => $depth, 'before' => '<div class="comment-reply-link">', 'after' => '</div>')));
    }
    ?>
			
			<?php 
    // action hook for inserting content above #comment
    thematic_belowcomment();
    ?>

<?php 
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:67,代码来源:discussion.php


示例8: get_comment_type_label

 public static function get_comment_type_label($comment_id)
 {
     $comment_type = get_comment_type($comment_id);
     if (empty($comment_type)) {
         $comment_type = 'comment';
     }
     $comment_type_labels = self::get_comment_type_labels();
     $label = isset($comment_type_labels[$comment_type]) ? $comment_type_labels[$comment_type] : $comment_type;
     return $label;
 }
开发者ID:HasClass0,项目名称:mainwp-child-reports,代码行数:10,代码来源:comments.php


示例9: wpi_get_comment_text_filter

function wpi_get_comment_text_filter($content)
{
    global $comment;
    $type = get_comment_type();
    if ($type != 'comment') {
        $htm = call_user_func_array('wpi_' . $type . '_footer', array($comment));
        if (!empty($htm)) {
            $content .= _t('span', $htm, array('class' => 'db cb cf comment-footer'));
        }
    }
    return $content;
}
开发者ID:Creativebq,项目名称:wp-istalker,代码行数:12,代码来源:comments.php


示例10: get_ping_type

function get_ping_type($trackbacktxt = 'Trackback', $pingbacktxt = 'Pingback')
{
    $type = get_comment_type();
    switch ($type) {
        case 'trackback':
            return $trackbacktxt;
            break;
        case 'pingback':
            return $pingbacktxt;
            break;
    }
    return false;
}
开发者ID:Burick,项目名称:interjc,代码行数:13,代码来源:functions.php


示例11: constructent_comment_callback

/**
 * Template for comments and pingbacks.
 * Used as a callback by wp_list_comments() for displaying the comments.
 *
 * @param string $comment
 * @param array  $args
 * @param int    $depth
 *
 * @see wp_list_comments()
 *
 * @return void
 */
function constructent_comment_callback($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    $comment_type = get_comment_type($comment->comment_ID);
    $templates = array("comment-{$comment_type}.php");
    // If the comment type is a 'pingback' or 'trackback', allow the use of 'comment-ping.php'
    if ('pingback' == $comment_type || 'trackback' == $comment_type) {
        $templates[] = 'comment-ping.php';
    }
    // Add the fallback 'comment.php' template
    $templates[] = 'comment.php';
    if ($template = locate_template($templates)) {
        include $template;
    }
}
开发者ID:GTACSolutions,项目名称:Telios,代码行数:27,代码来源:frontend.php


示例12: pl_recent_comments

function pl_recent_comments($number = 3)
{
    $comments = get_comments(array('number' => $number, 'status' => 'approve'));
    if ($comments) {
        foreach ((array) $comments as $comment) {
            if ('comment' != get_comment_type($comment)) {
                continue;
            }
            $post = get_post($comment->comment_post_ID);
            $link = get_comment_link($comment->comment_ID);
            $avatar = pl_get_avatar_url(get_avatar($comment));
            $img = $avatar ? sprintf('<div class="img rtimg"><a class="the-media" href="%s" style="background-image: url(%s)"></a></div>', $link, $avatar) : '';
            printf('<li class="media fix">%s<div class="bd"><div class="the-quote pl-contrast"><div class="title" >"%s"</div><div class="excerpt">on <a href="%s">%s</a></div></div></div></li>', $img, stripslashes(substr(wp_filter_nohtml_kses($comment->comment_content), 0, 50)), $link, custom_trim_excerpt($post->post_title, 3));
        }
    }
}
开发者ID:benpeck,项目名称:experticity-fools,代码行数:16,代码来源:lib.theming.php


示例13: custom_comments

function custom_comments($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    $GLOBALS['comment_depth'] = $depth;
    ?>
        <li id="comment-<?php 
    comment_ID();
    ?>
" <?php 
    comment_class();
    ?>
>
                <div class="comment-author vcard"><?php 
    commenter_link();
    ?>
</div>
                <div class="comment-meta"><?php 
    printf(__('Posted %1$s at %2$s <span class="meta-sep">|</span> <a href="%3$s" title="Permalink to this comment">Permalink</a>', 'your-theme'), get_comment_date(), get_comment_time(), '#comment-' . get_comment_ID());
    edit_comment_link(__('Edit', 'your-theme'), ' <span class="meta-sep">|</span> <span class="edit-link">', '</span>');
    ?>
</div>

	       		<div class="comment-content">
	                	<?php 
    comment_text();
    ?>
	                </div>

                <?php 
    // echo the comment reply link
    if ($args['type'] == 'all' || get_comment_type() == 'comment') {
        comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'your-theme'), 'login_text' => __('Log in to reply.', 'your-theme'), 'depth' => $depth, 'before' => '<div class="comment-reply-link">', 'after' => '</div>')));
    }
    ?>

  				<?php 
    if ($comment->comment_approved == '0') {
        _e("\t\t\t\t\t<span class='info'>Your comment is awaiting moderation.</span>\n", 'your-theme');
    }
    ?>



<?php 
}
开发者ID:blacksnotling,项目名称:hdwsbbl,代码行数:45,代码来源:functions.php


示例14: gplus_custom_pings

function gplus_custom_pings($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    if ('pingback' == get_comment_type()) {
        $pingtype = 'Pingback';
    } else {
        $pingtype = 'Trackback';
    }
    ?>
 <li> <?php 
    comment_author_link();
    ?>
 - <?php 
    echo $pingtype;
    ?>
 on <?php 
    echo mysql2date('Y/m/d/ H:i', $comment->comment_date);
}
开发者ID:jiangxianliang,项目名称:gplus,代码行数:18,代码来源:functions.php


示例15: highlight_comment

function highlight_comment()
{
    global $comment, $user_email, $comment_author_email, $posts;
    $authordata = get_userdata($posts[0]->post_author);
    get_currentuserinfo();
    if ($comment->comment_author_email and get_comment_type() == 'comment') {
        if ($comment->comment_author_email == $authordata->user_email) {
            //highlight author
            echo 'class="author-comment"';
        } elseif ($comment->comment_author_email == $user_email) {
            //highlight user if not author
            echo 'class="user-comment"';
        } elseif ($comment->comment_author_email == $comment_author_email) {
            //highlight commenter if not user
            echo 'class="user-comment"';
        }
    }
    if (get_comment_type() != 'comment') {
        echo 'class="ping-comment"';
    }
}
开发者ID:joefearnley,项目名称:couch,代码行数:21,代码来源:additional.php


示例16: apoc_comments_template

/**
 * Callback function for choosing the comment template
 * @version 2
 */
function apoc_comments_template($comment, $args, $depth)
{
    // Determine the post type for this comment
    $apoc = apoc();
    $post_type = isset($apoc->post_type) ? $apoc->post_type : 'post';
    $comment_type = get_comment_type($comment->comment_ID);
    // Is the comment count already set?
    if (isset($apoc->counts['comment'])) {
        $count = ++$apoc->counts['comment'];
    } else {
        // Get comment page
        $apoc->counts['cpage'] = '' == $args['page'] ? get_query_var('cpage') : $args['page'];
        // Adjust the count
        $adj = ($apoc->counts['cpage'] - 1) * $args['per_page'];
        $count = $adj + 1;
        // Update the object
        $apoc->counts['comment'] = $count;
    }
    // Load the comment template
    include THEME_DIR . '/library/templates/comment.php';
}
开发者ID:tamriel-foundry,项目名称:apoc2,代码行数:25,代码来源:comments.php


示例17: cfct_banner

// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// **********************************************************************
if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) {
    die;
}
if (CFCT_DEBUG) {
    cfct_banner(__FILE__);
}
global $comments, $comment;
?>
	<ol class="pings-list hfeed">
<?php 
foreach ($comments as $comment) {
    if (get_comment_type() != 'comment') {
        ?>
		<li class="hentry <?php 
        cfct_comment_list_class();
        ?>
">
<?php 
        cfct_comment();
        ?>
		</li><!--.hentry-->
<?php 
    }
}
?>
	</ol><!--/#pings-list-->
开发者ID:rascoop,项目名称:carrington,代码行数:30,代码来源:pings-loop.php


示例18: hybrid_comment_class

/**
 * Sets a class for each comment. Sets alt, odd/even, and author/user classes. Adds author, user, 
 * and reader classes. Needs more work because WP, by default, assigns even/odd backwards 
 * (Odd should come first, even second).
 *
 * @since 0.2.0
 * @global $wpdb WordPress DB access object.
 * @global $comment The current comment's DB object.
 */
function hybrid_comment_class( $class = '' ) {
	global $post, $comment, $hybrid;

	/* Gets default WP comment classes. */
	$classes = get_comment_class( $class );

	/* Get the comment type. */
	$classes[] = get_comment_type();

	/* User classes to match user role and user. */
	if ( $comment->user_id > 0 ) {

		/* Create new user object. */
		$user = new WP_User( $comment->user_id );

		/* Set a class with the user's role. */
		if ( is_array( $user->roles ) ) {
			foreach ( $user->roles as $role )
				$classes[] = "role-{$role}";
		}

		/* Set a class with the user's name. */
		$classes[] = 'user-' . sanitize_html_class( $user->user_nicename, $user->ID );
	}

	/* If not a registered user */
	else {
		$classes[] = 'reader';
	}

	/* Comment by the entry/post author. */
	if ( $post = get_post( $post_id ) ) {
		if ( $comment->user_id === $post->post_author )
			$classes[] = 'entry-author';
	}

	/* Join all the classes into one string and echo them. */
	$class = join( ' ', $classes );

	echo apply_filters( "{$hybrid->prefix}_comment_class", $class );
}
开发者ID:nerdfiles,项目名称:mabrylaw.com,代码行数:50,代码来源:context.php


示例19: _e

		if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password ) :
?>
				<div class="nopassword"><?php _e('This post is password protected. Enter the password to view any comments.', 'uthili') ?></div>
			</div><!-- .comments -->
<?php
		return;
	endif;
endif;
?>

<?php if ( have_comments() ) : ?>

<?php /* numbers of pings and comments */
$ping_count = $comment_count = 0;
foreach ( $comments as $comment )
	get_comment_type() == "comment" ? ++$comment_count : ++$ping_count;
?>

<?php if ( ! empty($comments_by_type['comment']) ) : ?>

				<div id="comments-list" class="comments">
					<h3><?php printf($comment_count > 1 ? __('<span>%d</span> Comments', 'uthili') : __('<span>One</span> Comment', 'uthili'), $comment_count) ?></h3>
					
<?php $total_pages = get_comment_pages_count(); if ( $total_pages > 1 ) : ?>					
					<div id="comments-nav-above" class="comments-navigation">
								<div class="paginated-comments-links"><?php paginate_comments_links(); ?></div>
					</div><!-- #comments-nav-above -->					
<?php endif; ?>					
				
					<ol>
<?php wp_list_comments('type=comment&callback=custom_comments'); ?>
开发者ID:noorul,项目名称:uthili,代码行数:31,代码来源:comments.php


示例20: hybrid_avatar

/**
 * Displays the avatar for the comment author and wraps it in the comment author's URL if it is
 * available.  Adds a call to HYBRID_IMAGES . "/{$comment_type}.png" for the default avatars for
 * trackbacks and pingbacks.
 *
 * @since 0.2.0
 * @access public
 * @global $comment The current comment's DB object.
 * @global $hybrid The global Hybrid object.
 * @return void
 */
function hybrid_avatar()
{
    global $comment, $hybrid;
    /* Make sure avatars are allowed before proceeding. */
    if (!get_option('show_avatars')) {
        return false;
    }
    /* Get/set some comment variables. */
    $comment_type = get_comment_type($comment->comment_ID);
    $author = get_comment_author($comment->comment_ID);
    $url = get_comment_author_url($comment->comment_ID);
    $avatar = '';
    $default_avatar = '';
    /* Get comment types that are allowed to have an avatar. */
    $avatar_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
    /* If comment type is in the allowed list, check if it's a pingback or trackback. */
    if (in_array($comment_type, $avatar_comment_types)) {
        /* Set a default avatar for pingbacks and trackbacks. */
        $default_avatar = 'pingback' == $comment_type || 'trackback' == $comment_type ? trailingslashit(HYBRID_IMAGES) . "{$comment_type}.png" : '';
        /* Allow the default avatar to be filtered by comment type. */
        $default_avatar = apply_filters("{$hybrid->prefix}_{$comment_type}_avatar", $default_avatar);
    }
    /* Set up the avatar size. */
    $comment_list_args = hybrid_list_comments_args();
    $size = $comment_list_args['avatar_size'] ? $comment_list_args['avatar_size'] : 80;
    /* Get the avatar provided by the get_avatar() function. */
    $avatar = get_avatar($comment, absint($size), $default_avatar, $author);
    /* If URL input, wrap avatar in hyperlink. */
    if (!empty($url) && !empty($avatar)) {
        $avatar = '<a href="' . esc_url($url) . '" rel="external nofollow" title="' . esc_attr($author) . '">' . $avatar . '</a>';
    }
    /* Display the avatar and allow it to be filtered. Note: Use the get_avatar filter hook where possible. */
    echo apply_filters("{$hybrid->prefix}_avatar", $avatar);
}
开发者ID:nukulb,项目名称:bugsbounty-blog,代码行数:45,代码来源:comments.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_commentdata函数代码示例发布时间:2022-05-15
下一篇:
PHP get_comment_to_edit函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap