' . __( 'Some themes won\'t resize your image to fit, so it\'s best to use an image that\'s already the right size.', 'anda' );
echo ' ';
echo sprintf( __( 'However if your image accepts a size argument, you can use %1$s. Example: %2$s', 'anda' ), '%size%', 'http://colorto.me/png/%size%/row2/purple/yellow/orange/blue/' ) . '
';
}
function validate( $input ) {
$input[ 'name' ] = esc_attr( $input[ 'name' ] );
$input[ 'url' ] = esc_url( $input[ 'url' ] );
return $input;
}
function addavatar ( $avatar_defaults ) {
if ( $opts = get_option( 'kl_addnewdefaultavatar' ) ) {
$av = html_entity_decode( $opts['url'] );
$avatar_defaults[ $av ] = $opts['name'];
}
return $avatar_defaults;
}
function insert_img_correctly( $avatar, $id_or_email, $size, $default, $alt ) {
//determine email address
if ( is_numeric($id_or_email) )
$email = get_userdata( $id_or_email )->user_email;
elseif ( is_object($id_or_email) )
$email = $id_or_email->comment_author_email;
else
$email = $id_or_email;
//since we're hooking directly into get_avatar,
//we need to make sure another avatar hasn't been selected
$direct = get_option('avatar_default');
if ( strpos( $default, $direct ) !== false ) {
$email = empty( $email ) ? 'nobody' : md5( $email );
//in rare cases were there is no email associated with the comment (like Mr WordPress)
//we have to work around a bit to insert the custom avatar
// 'www' version for WP2.9 and older
if ( strpos( $default, 'http://0.gravatar.com/avatar/') === 0 || strpos( $default, 'http://www.gravatar.com/avatar/') === 0 )
$avatar = str_replace( $default, $direct, $avatar );
}
//hack the correct size parameter back in, if necessary
$avatar = str_replace( '%size%', $size, $avatar );
$avatar = str_replace( urlencode('%size%'), $size, $avatar );
return $avatar;
}
}