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


PHP get_avatar函数代码示例

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


在下文中一共展示了get_avatar函数的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: user_menu

 /**
  * 
  *  Woo User Menu
  */
 function user_menu()
 {
     $_Twoot_Woo = new Twoot_Woo();
     $url = $_Twoot_Woo->shop_urls();
     $user_data = get_userdata(get_current_user_id());
     $avatar = get_option('show_avatars') ? '<span class="avatar">' . get_avatar(get_current_user_id(), 20) . '</span>' : '';
     $tag = get_option('permalink_structure') == false ? '&' : '?';
     $html = '<nav id="woo-user-menu">';
     $html .= '<ul class="sf-menu clearfix">';
     if (is_user_logged_in()) {
         $html .= '<li class="my-account"><a href="' . $url['account_overview'] . '">' . $avatar . esc_attr__('Howdy, ', 'Twoot') . $user_data->display_name . '</a>';
         $html .= '<ul>';
         $html .= '<li class="account-change-pw"><a href="' . $url['account_change_pw'] . '">' . esc_attr__('Change Password', 'Twoot') . '</a></li>';
         $html .= '<li class="account-edit-adress"><a href="' . $url['account_edit_adress'] . '">' . esc_attr__('Edit Address', 'Twoot') . '</a></li>';
         $html .= '<li class="account-view-order"><a href="' . $url['account_view_order'] . '">' . esc_attr__('View Order', 'Twoot') . '</a></li>';
         $html .= '<li class="cart"><a href="' . $url['cart'] . '">' . esc_attr__('Shopping Cart', 'Twoot') . '</a></li>';
         $html .= '<li class="checkout"><a href="' . $url['checkout'] . '">' . esc_attr__('Checkout', 'Twoot') . '</a></li>';
         $html .= '</ul>';
         $html .= '</li>';
         $html .= '<li class="logout last"><a href="' . $url['logout'] . '">' . esc_attr__('Sign Out', 'Twoot') . '</a></li>';
     } else {
         if (get_option('users_can_register') && get_option('woocommerce_enable_myaccount_registration') == 'yes') {
             $html .= '<li class="register"><a href="' . $url['register'] . $tag . 'user_account=register">' . esc_attr__('Create Account', 'Twoot') . '</a></li>';
         }
         $html .= '<li class="login last"><a href="' . $url['account_overview'] . $tag . 'user_account=login">' . esc_attr__('Sign In', 'Twoot') . '</a></li>';
     }
     $html .= '</ul>';
     $html .= '</nav>';
     return $html;
 }
开发者ID:sniezekjp,项目名称:prod-fs,代码行数:34,代码来源:woo-generator.php

示例3: garland_comment

function garland_comment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    extract($args, EXTR_SKIP);
    ?>
<li <?php 
    comment_class(empty($args['has_children']) ? '' : 'parent');
    ?>
id="comment-<?php 
    comment_ID();
    ?>
">
	<div id="div-comment-<?php 
    comment_ID();
    ?>
">
	<span class="comment-author vcard">
	<?php 
    if ($args['avatar_size'] != 0) {
        echo get_avatar($comment, $args['avatar_size']);
    }
    ?>
	<?php 
    printf(__('<cite class="fn">%s</cite> Says:', 'kubrick'), get_comment_author_link());
    ?>
	</span>
	<?php 
    if ($comment->comment_approved == '0') {
        ?>
	<em><?php 
        _e('Your comment is awaiting moderation.', 'kubrick');
        ?>
</em>
	<?php 
    }
    ?>
	<br />

	<small class="comment-meta commentmetadata"><a href="#comment-<?php 
    comment_ID();
    ?>
" title=""><?php 
    printf(__('%1$s at %2$s', 'kubrick'), get_comment_date(), get_comment_time());
    ?>
</a> <?php 
    edit_comment_link(__('edit', 'kubrick'), '&nbsp;&nbsp;', '');
    ?>
</small>

	<?php 
    comment_text();
    ?>
	<div class="reply">
		<?php 
    comment_reply_link(array_merge($args, array('add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'])));
    ?>
	</div>
	</div>
<?php 
}
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:60,代码来源:comments.php

示例4: widget

 /**
  * Echo the widget content.
  *
  * @param array $args     Display arguments including `before_title`, `after_title`,
  *                        `before_widget`, and `after_widget`.
  * @param array $instance The settings for the particular instance of the widget.
  */
 function widget($args, $instance)
 {
     // Merge with defaults.
     $instance = wp_parse_args((array) $instance, $this->defaults);
     echo $args['before_widget'];
     if (!empty($instance['title'])) {
         echo $args['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $args['after_title'];
     }
     $text = '';
     if (!empty($instance['alignment'])) {
         $text .= '<span class="align' . esc_attr($instance['alignment']) . '">';
     }
     $text .= get_avatar($instance['user'], $instance['size']);
     if (!empty($instance['alignment'])) {
         $text .= '</span>';
     }
     if ('text' === $instance['author_info']) {
         $text .= $instance['bio_text'];
     } else {
         $text .= get_the_author_meta('description', $instance['user']);
     }
     $text .= $instance['page'] ? sprintf(' <a class="pagelink" href="%s">%s</a>', get_page_link($instance['page']), $instance['page_link_text']) : '';
     echo wpautop($text);
     // If posts link option checked, add posts link to output.
     $display_name = get_the_author_meta('display_name', $instance['user']);
     $user_name = !empty($display_name) && genesis_a11y('screen-reader-text') ? '<span class="screen-reader-text">' . $display_name . ': </span>' : '';
     if ($instance['posts_link']) {
         printf('<div class="posts_link posts-link"><a href="%s">%s%s</a></div>', get_author_posts_url($instance['user']), $user_name, __('View My Blog Posts', 'genesis'));
     }
     echo $args['after_widget'];
 }
开发者ID:netmagik,项目名称:netmagik,代码行数:38,代码来源:user-profile-widget.php

示例5: 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

示例6: grofiles_setting_callback

/**
 * HTML for Gravatar Hovercard setting
 */
function grofiles_setting_callback() {
	global $current_user;

	$checked = 'disabled' == get_option( 'gravatar_disable_hovercards' ) ? '' : 'checked="checked" ';
 
 	echo "<label id='gravatar-hovercard-options'><input {$checked}name='gravatar_disable_hovercards' id='gravatar_disable_hovercards' type='checkbox' value='enabled' class='code' /> " . __( "View people's profiles when you mouse over their Gravatars", 'jetpack' ) . "</label>";
?>
<style type="text/css">
#grav-profile-example img {
	float: left;
}
#grav-profile-example span {
	padding: 0 1em;
}
</style>
<script type="text/javascript">
// <![CDATA[
jQuery( function($) {
	var tr = $( '#gravatar_disable_hovercards' ).change( function() {
		if ( $( this ).is( ':checked' ) ) {
			$( '#grav-profile-example' ).slideDown( 'fast' );
		} else {
			$( '#grav-profile-example' ).slideUp( 'fast' );
		}
	} ).parents( 'tr' );
	var ftr = tr.parents( 'table' ).find( 'tr:first' );
	if ( ftr.size() && !ftr.find( '#gravatar_disable_hovercards' ).size() ) {
		ftr.after( tr );
	}
} );
// ]]>
</script>
	<p id="grav-profile-example" class="hide-if-no-js"<?php if ( !$checked ) echo ' style="display:none"'; ?>><?php echo get_avatar( $current_user->ID, 64 ); ?> <span><?php _e( 'Put your mouse over your Gravatar to check out your profile.', 'jetpack' ); ?> <br class="clear" /></span></p>
<?php
}
开发者ID:kevinreilly,项目名称:mendelements.com,代码行数:38,代码来源:gravatar-hovercards.php

示例7: revert_to_default_wp_avatar

function revert_to_default_wp_avatar($img, $params, $item_id)
{
    // we are concerned only with users
    if ($params['object'] != 'user') {
        return $img;
    }
    //check if user has uploaded an avatar
    //if not then revert back to wordpress core get_avatar method
    //remove the filter first, or else it will go in infinite loop
    remove_filter('bp_core_fetch_avatar', 'revert_to_default_wp_avatar', 80, 3);
    if (!userpro_user_has_avatar($item_id)) {
        $width = $params['width'];
        // Set image width
        if (false !== $width) {
            $img_width = $width;
        } elseif ('thumb' == $type) {
            $img_width = bp_core_avatar_thumb_width();
        } else {
            $img_width = bp_core_avatar_full_width();
        }
        $img = get_avatar($item_id, $img_width);
    }
    //add the filter back again
    add_filter('bp_core_fetch_avatar', 'revert_to_default_wp_avatar', 80, 3);
    return $img;
}
开发者ID:ingridlima,项目名称:userpro-custom,代码行数:26,代码来源:buddypress.php

示例8: widget

 /**
  * Widget Output.
  * @see WP_Widget::widget()
  */
 public function widget($args, $instance)
 {
     global $wpdb;
     extract($args, EXTR_SKIP);
     $number = (int) $instance['number'];
     if (1 > $number) {
         $number = 5;
     } elseif (20 < $number) {
         $number = 20;
     }
     echo $before_widget;
     if (!empty($instance['title'])) {
         echo $before_title . $instance['title'] . $after_title;
     }
     echo '<ul>';
     $subquery = aoc_roles_subquery();
     $query = "SELECT ID, user_login, display_name FROM ( {$subquery} ) AS usr " . "ORDER BY user_registered DESC " . "LIMIT 0,{$number};";
     $users = $wpdb->get_results($query);
     foreach ($users as $user) {
         echo '<li>';
         if ($instance['avatar']) {
             echo get_avatar($user->ID, $instance['avatar-size']);
         }
         echo '<a href="' . aoc_profile_link(urlencode($user->user_login)) . '">' . $user->display_name . '</a></li>';
     }
     echo '</ul>';
     echo $after_widget;
 }
开发者ID:JerryXie96,项目名称:PBSMUNC2013WebSite,代码行数:32,代码来源:newusers.php

示例9: widget

 function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     $instance = wp_parse_args((array) $instance, array('title' => __('Blog Authors', 'academy'), 'number' => '6', 'order' => 'registered'));
     $orderdir = 'DESC';
     if ($instance['order'] == 'display_name') {
         $orderdir = 'ASC';
     }
     $title = apply_filters('widget_title', empty($instance['title']) ? __('Blog Authors', 'academy') : $instance['title'], $instance, $this->id_base);
     $out = $before_widget;
     $out .= $before_title . $title . $after_title;
     $counter = 0;
     $users = get_users(array('number' => $instance['number'], 'orderby' => $instance['order'], 'order' => $orderdir));
     $out .= '<div class="users-listing">';
     foreach ($users as $user) {
         $name = trim($user->first_name . ' ' . $user->last_name);
         $counter++;
         $out .= '<div class="user-image ';
         if ($counter == 3) {
             $out .= 'last';
         }
         $out .= '"><div class="bordered-image">';
         $out .= '<a title="' . $name . '" href="' . get_author_posts_url($user->ID) . '">' . get_avatar($user->ID) . '</a>';
         $out .= '</div></div>';
         if ($counter == 3) {
             $out .= '<div class="clear"></div>';
             $counter = 0;
         }
     }
     $out .= '</div>';
     $out .= $after_widget;
     echo $out;
 }
开发者ID:rinodung,项目名称:wordpress-demo,代码行数:33,代码来源:themex.authors.php

示例10: format_comment

function format_comment($comment, $args, $depth)
{
    echo '<div ';
    comment_class();
    echo ' id="li-comment-';
    comment_ID();
    echo '">
        <div class="row-fluid">
            <div class="span9">
                <p>';
    comment_text();
    echo '</p>
            </div>

            <div class="span3">';
    echo get_avatar($comment->comment_author_email, 60);
    echo '<h6>
        <a href="';
    comment_author_url();
    echo '">';
    comment_author();
    echo '</a>											
                </h6>
                <small>';
    printf(__('%1$s', DOMAIN), get_comment_date(), get_comment_time());
    echo '</small>
            </div>
        </div>
    </div>';
}
开发者ID:ravenvn,项目名称:sandau,代码行数:30,代码来源:functions.php

示例11: listItem

 function listItem($email)
 {
     global $DOPBSP;
     $html = array();
     $user = get_userdata($email->user_id);
     // Get data about the user who created the emails.
     array_push($html, '<li class="item" id="DOPBSP-email-ID-' . $email->id . '" onclick="DOPBSPEmail.display(' . $email->id . ')">');
     array_push($html, ' <div class="header">');
     /*
      * Display email ID.
      */
     array_push($html, '     <span class="id">ID: ' . $email->id . '</span>');
     /*
      * Display data about the user who created the email.
      */
     if ($email->user_id > 0) {
         array_push($html, '     <span class="header-item avatar">' . get_avatar($email->user_id, 17));
         array_push($html, '         <span class="info">' . $DOPBSP->text('EMAILS_CREATED_BY') . ': ' . $user->data->display_name . '</span>');
         array_push($html, '         <br class="DOPBSP-clear" />');
         array_push($html, '     </span>');
     }
     array_push($html, '     <br class="DOPBSP-clear" />');
     array_push($html, ' </div>');
     array_push($html, ' <div class="name">' . $email->name . '</div>');
     array_push($html, '</li>');
     return implode('', $html);
 }
开发者ID:ConceptHaus,项目名称:jolie,代码行数:27,代码来源:class-backend-emails.php

示例12: 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

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

示例14: listItem

 function listItem($extra)
 {
     global $DOPBSP;
     $html = array();
     $user = get_userdata($extra->user_id);
     // Get data about the user who created the extras.
     array_push($html, '<li class="dopbsp-item" id="DOPBSP-extra-ID-' . $extra->id . '" onclick="DOPBSPBackEndExtra.display(' . $extra->id . ')">');
     array_push($html, ' <div class="dopbsp-header">');
     /*
      * Display extra ID.
      */
     array_push($html, '     <span class="dopbsp-id">ID: ' . $extra->id . '</span>');
     /*
      * Display data about the user who created the extra.
      */
     if ($extra->user_id > 0) {
         array_push($html, '     <span class="dopbsp-header-item dopbsp-avatar">' . get_avatar($extra->user_id, 17));
         array_push($html, '         <span class="dopbsp-info">' . $DOPBSP->text('EXTRAS_CREATED_BY') . ': ' . $user->data->display_name . '</span>');
         array_push($html, '         <br class="dopbsp-clear" />');
         array_push($html, '     </span>');
     }
     array_push($html, '     <br class="dopbsp-clear" />');
     array_push($html, ' </div>');
     array_push($html, ' <div class="dopbsp-name">' . ($extra->name == '' ? '&nbsp;' : $extra->name) . '</div>');
     array_push($html, '</li>');
     return implode('', $html);
 }
开发者ID:iq007,项目名称:MadScape,代码行数:27,代码来源:class-backend-extras.php

示例15: widget

    function widget($args, $instance)
    {
        $title = $instance['title'];
        $bio = $instance['bio'];
        $custom_email = $instance['custom_email'];
        $avatar_size = preg_replace("/[^0-9]/", "", $instance['avatar_size']);
        if (!$avatar_size) {
            $avatar_size = 48;
        }
        $avatar_align = $instance['avatar_align'];
        if (!$avatar_align) {
            $avatar_align = 'left';
        }
        $read_more_text = $instance['read_more_text'] ? $instance['read_more_text'] : 'Read more';
        $read_more_url = $instance['read_more_url'];
        echo ts_essentials_escape($args['before_widget']);
        if (!empty($title)) {
            echo ts_essentials_escape($args['before_title'] . apply_filters('widget_title', $title) . $args['after_title']);
        }
        echo '<div class="blog-author clearfix">';
        $avatar = $custom_email ? '<span class="align' . esc_attr($avatar_align) . '">' . get_avatar($custom_email, $avatar_size) . '</span>' : '';
        ?>
        <p><?php 
        echo wp_kses_post($avatar . $bio);
        ?>
</p>
		<?php 
        if ($read_more_url) {
            echo '<div class="mimic-smaller read-more uppercase"><a href="' . esc_url($read_more_url) . '">' . esc_html($read_more_text) . '</a></div>';
        }
        echo '</div>';
        echo ts_essentials_escape($args['after_widget']);
    }
开发者ID:dqishmirian,项目名称:jrrny,代码行数:33,代码来源:blog-author.php


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