Gravatar. Developer blog at this site. Version: 2.7.1 Author: Rune Gulbrandsøy Author URI: http://gravatar.bloggs.be */ /* Copyright 2007 - 2008 Rune (http://bloggs.be/rune/) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* The idea for the Favicon parts come from the plugin favatars by Jeff Minard (http://thecodepro.com/). I have used some of his codem and rewritten some of the parts i have used. Thanks to Petter (http://neppe.no) for the tips about a nofollow option! */ function gravatar_admin_menu(){ if (function_exists('add_meta_box')) { add_menu_page('Gravatar', 'Gravatar', 8, 'gravatar', 'gravatar_admin'); } else { add_submenu_page('themes.php', 'Gravatar', 'Gravatar', 8, 'gravatar', 'gravatar_admin'); } } function show_openid(){ echo "This site is using OpenAvatar based on "; } function show_gravatar($s) { $gravatar = get_option('bruk_gravatar'); $openavatar = get_option('bruk_openavatar'); $gravatar_align = get_option('bruk_gravatar_align'); $default = get_option('default_gravatar'); $default_pingback = get_option('default_gravatar_pingback'); $gravatar_use_url = get_option('bruk_gravatar_url'); $gravatar_use_url_follow = get_option('bruk_gravatar_url_follow'); $home_url = get_option('bruk_gravatar_home_url'); $use_favico = get_option('bruk_gravatar_favico'); $use_mbl = get_option('bruk_mbl_ikon'); $gravatar_no_page = get_option('bruk_gravatar_pages'); $gravatar_size = get_option('bruk_gravatar_size'); $gravatar_rating = get_option('bruk_gravatar_rating'); $gravatar_css = get_option('bruk_gravatar_css'); if($gravatar == true && get_option('stylesheet') != 'prologue'){ if (is_page() && $gravatar_no_page == true && !is_single()){ }else{ global $comment, $type; $comment_tekst = $comment->get_comment_text; $kommentar_type = $comment->get_comment_type; if ( !empty( $comment->comment_author_email ) ) { $lowercase = strtolower($comment->comment_author_email); $md5 = md5( $lowercase ); //$default == $default_gravatar; $comment_name = $comment->comment_author; if ( $comment->comment_author_url == 'http://' || $comment->comment_author_url == '') { $comment_link = get_option('home'); }else{ $comment_link = $comment->comment_author_url; if ($use_favico == true){ $favicon_url = getFavicon($comment_link); $default = $favicon_url; if ($default == '') $default = get_option('default_gravatar'); } } //OpenAvatar section if ( $default = get_option('default_gravatar') && $openavatar == true) { if ( $comment->comment_author_url == 'http://' || $comment->comment_author_url == '') { $comment_url = ''; }else{ $comment_url = $comment->comment_author_url; } if (parse_url($comment_url, PHP_URL_PATH)=='') { if ( $comment->comment_author_url == 'http://' || $comment->comment_author_url == '') { $default = get_option('default_gravatar'); }else{ $com_url = $comment->comment_author_url; if (stristr($com_url, 'myopenid') == true) { $default = "http://www.openvatar.com/avatar.php?openvatar_id=".md5($comment->comment_author_url); }else { $default = get_option('default_gravatar'); }}} else { if ( $comment->comment_author_url == 'http://' || $comment->comment_author_url == '') { $default = get_option('default_gravatar'); }else{ $com_url = $comment->comment_author_url; if (stristr($com_url, 'myopenid') == true) { $default = "http://www.openvatar.com/avatar.php?openvatar_id=".md5($comment->comment_author_url); }else { $default = get_option('default_gravatar'); }}} if ($use_mbl == true && $default == get_option('default_gravatar')){ $default = "http://pub.mybloglog.com/coiserv.php?href=mailto:" . $lowercase . "&n=". $lowercase; } } // End of OpenAvatar Section //edit the style to what you want, the standard style looks good on most themes. if($gravatar_use_url_follow == true){ $follow_links = "rel='external nofollow'"; } else { $follow_links = "rel='external'"; } if ($gravatar_size == '' || $gravatar_size == ' ') { $gravatar_size = "40"; }else{ $gravatar_size = $gravatar_size; } if ($gravatar_rating == '' || $gravatar_rating == ' ') { $gravatar_rating = "X"; }else{ $gravatar_rating = $gravatar_rating; } if ($gravatar_css == '' || $gravatar_css == ' '){ $gravatar_css_temp = "style='float: left; margin-right: 10px; border: none; display:inline;'"; }else{ $gravatar_css_temp = "style='"; $gravatar_css_temp .= $gravatar_css; $gravatar_css_temp .= "'"; } if ($default ==' ' || $default ==''){ $default = get_option('default_gravatar'); } if (get_option('bruk_wavatar_default') == true && $default == get_option('default_gravatar')){ $default = 'wavatar'; } if (get_option('bruk_identicon_default') == true && $default == get_option('default_gravatar')){ $default = 'identicon'; } if (get_option('bruk_monsterid_default') == true && $default == get_option('default_gravatar')){ $default = 'monsterid'; } if (get_option('bruk_own_default') == true){ if (stristr($com_url, 'myopenid') == true) { $default = "http://www.openvatar.com/avatar.php?openvatar_id=".md5($comment->comment_author_url); }else { $default = get_option('default_gravatar'); }} if($home_url == true && $comment_link != get_option('home')){ $s = "$comment_nameNo Gravatar"; } else { if ($gravatar_use_url == true){ $s = "$comment_nameNo Gravatar"; }else{ $s = "$comment_nameNo Gravatar"; }} }} return $s; } return $s; } function show_gravatar_post($s) { $gravatar = get_option('bruk_gravatar'); $gravatar_align = get_option('bruk_gravatar_align'); $default = get_option('default_gravatar'); $post_gravatar = get_option('bruk_gravatar_post'); $gravatar_size = get_option('bruk_gravatar_size'); if($post_gravatar == true && get_option('bruk_gravatar_single_post') == false){ global $post; if ($gravatar_size == '' || $gravatar_size == ' ') { $gravatar_size = "20"; }else{ $gravatar_size = $gravatar_size; } $epost = get_the_author_email(); $lowercase = strtolower($epost); $md5 = md5($lowercase); $content=$s; $s= "No Gravatar"; $s=$s."$content"; } return $s; } function prologue_show_gravatar_post($id) { global $post,$wpdb,$user; $default = get_option('default_gravatar'); $gravatar_size = get_option('bruk_gravatar_size'); $epost = $wpdb->get_var("SELECT user_email FROM $wpdb->users WHERE ID=".$id.""); $lowercase = strtolower($epost); $md5 = md5($lowercase); if ($gravatar_size == '' || $gravatar_size == ' ') { $gravatar_size = "48"; }else{ $gravatar_size = $gravatar_size; } return "No Gravatar"; } function gravatar_footer() { $side = get_option('blogname'); echo "

$side is using WP-Gravatar

"; } function show_gravatar_edit($s) { global $comment; $gravatar = get_option('bruk_gravatar'); $default = get_option('default_gravatar'); $use_mbl = get_option('bruk_mbl_ikon'); $openavatar = get_option('bruk_openavatar'); $comment_tekst = $comment->comment_text; if ( !empty( $comment->comment_author_email ) ) { $lowercase = strtolower($comment->comment_author_email); $md5 = md5( $lowercase ); if ($use_mbl == true && $default == get_option('default_gravatar')){ $default = "http://pub.mybloglog.com/coiserv.php?href=mailto:" . $lowercase . "&n=". $lowercase; } //OpenAvatar section if ( $default = get_option('default_gravatar') && $openavatar == true) { if ( $comment->comment_author_url == 'http://' || $comment->comment_author_url == '') { $comment_url = ''; }else{ $comment_url = $comment->comment_author_url; } if (parse_url($comment_url, PHP_URL_PATH)=='') { if ( $comment->comment_author_url == 'http://' || $comment->comment_author_url == '') { $default = get_option('default_gravatar'); }else{ $default = "http://www.openvatar.com/avatar.php?openvatar_id=".md5($comment->comment_author_url.'/'); }} else { if ( $comment->comment_author_url == 'http://' || $comment->comment_author_url == '') { $default = get_option('default_gravatar'); }else{ $default = "http://www.openvatar.com/avatar.php?openvatar_id=".md5($comment->comment_author_url); }} if ($use_mbl == true && $default == get_option('default_gravatar')){ $default = "http://pub.mybloglog.com/coiserv.php?href=mailto:" . $lowercase . "&n=". $lowercase; } } // End of OpenAvatar Section if ($openavatar == false) { $default = get_option('default_gravatar'); } if (get_option('bruk_wavatar_default') == true && $default == get_option('default_gravatar')){ $default = 'wavatar'; } if (get_option('bruk_identicon_default') == true && $default == get_option('default_gravatar')){ $default = 'identicon'; } if (get_option('bruk_monsterid_default') == true && $default == get_option('default_gravatar')){ $default = 'monsterid'; } if (get_option('bruk_own_default') == true){ $default = get_option('default_gravatar'); } $s = "$comment->comment_content"; } return $s; } function gravatar_admin(){ global $userdata; get_currentuserinfo(); $current_user = $userdata->ID; $home_link = get_option('home'); $default_gravatar = get_option('default_gravatar'); if ($default_gravatar != '') { $default_gravatar_temp = $default_gravatar; }else{ $default_gravatar_temp = "http://use.perl.org/images/pix.gif"; } $default_profilepage = get_option('default_profilepage'); if ($default_profilepage != '') { $default_profilepage_temp = $default_profilepage; }else{ $default_profilepage_temp = "about"; } $default_gravatar_size = get_option('bruk_gravatar_size'); if ($default_gravatar_size != '') { $default_gravatar_size_temp = $default_gravatar_size; }else{ $default_gravatar_size_temp = "40"; } $default_gravatar_rating = get_option('bruk_gravatar_rating'); if ($default_gravatar_rating == '' || $default_gravatar_rating == ' ') { $default_gravatar_rating_temp = "X"; }else{ $default_gravatar_rating_temp = $default_gravatar_rating; } $default_gravatar_single_post_pre = get_option('bruk_gravatar_single_post_pre'); if ($default_gravatar_single_post_pre != '') { $default_gravatar_single_post_pre_temp = $default_gravatar_single_post_pre; }else{ $default_gravatar_single_post_pre_temp = "This is some text prior to the author information. You can change this text from the admin section of WP-Gravatar"; } $bruk_gravatar_single_post_color = get_option('bruk_gravatar_single_post_color'); if ($bruk_gravatar_single_post_color != '') { $bruk_gravatar_single_post_color_temp = $bruk_gravatar_single_post_color; }else{ $bruk_gravatar_single_post_color_temp = "c3c5c3"; } $bruk_gravatar_single_img_size = get_option('bruk_gravatar_single_img_size'); if ($bruk_gravatar_single_img_size == '' || $bruk_gravatar_single_img_size == ' ') { $bruk_gravatar_single_img_size_temp = "30"; }else{ $bruk_gravatar_single_img_size_temp = $bruk_gravatar_single_img_size; } $bruk_gravatar_single_img_size_author = get_option('bruk_gravatar_single_img_size_author'); if ($bruk_gravatar_single_img_size_author == '' || $bruk_gravatar_single_img_size_author == ' ') { $bruk_gravatar_single_img_size_author_temp = "20"; }else{ $bruk_gravatar_single_img_size_author_temp = $bruk_gravatar_single_img_size_author; } $bruk_gravatar_single_box_css = get_option('bruk_gravatar_single_box_css'); if ($bruk_gravatar_single_box_css == '' || $bruk_gravatar_single_box_css == ' ') { $bruk_gravatar_single_post_box_css_temp = "font-size:9px; text-align: left;"; }else{ $bruk_gravatar_single_post_box_css_temp = $bruk_gravatar_single_box_css; } $bruk_gravatar_single_img_css = get_option('bruk_gravatar_single_img_css'); if ($bruk_gravatar_single_img_css == '' || $bruk_gravatar_single_img_css == ' ') { $bruk_gravatar_single_post_img_css_temp = "float: right; border: none;"; }else{ $bruk_gravatar_single_post_img_css_temp = $bruk_gravatar_single_img_css; } $bruk_gravatar_author_archive_link = get_option('bruk_gravatar_author_archive_link'); if ($bruk_gravatar_author_archive_link == '' || $bruk_gravatar_author_archive_link == ' ') { $bruk_gravatar_author_archive_link_temp = "Read more from this author"; }else{ $bruk_gravatar_author_archive_link_temp = $bruk_gravatar_author_archive_link; } $bruk_gravatar_css = get_option('bruk_gravatar_css'); if ($bruk_gravatar_css == '' || $bruk_gravatar_css == ' ') { $bruk_gravatar_css_temp = "float: left; margin-right: 10px; border: none; display:inline;"; }else{ $bruk_gravatar_css_temp = $bruk_gravatar_css; } $gravatar = get_option('bruk_gravatar'); $openavatar = get_option('bruk_openavatar'); $openavatar_show = get_option('bruk_openavatar_show'); $gravatar_align = get_option('bruk_gravatar_align'); $gravatar_kudos = get_option('bruk_gravatar_kudos'); $gravatar_profil = get_option('bruk_gravatar_profil'); $gravatar_url = get_option('bruk_gravatar_url'); $gravatar_url_follow = get_option('bruk_gravatar_url_follow'); $gravatar_home_url = get_option('bruk_gravatar_home_url'); $gravatar_favico = get_option('bruk_gravatar_favico'); $gravatar_uid = get_option('bruk_gravatar_uid'); $gravatar_post = get_option('bruk_gravatar_post'); $gravatar_single_post = get_option('bruk_gravatar_single_post'); $gravatar_single_post_top = get_option('bruk_gravatar_single_post_top'); $gravatar_author_archive = get_option('bruk_gravatar_author_archive'); $use_mbl = get_option('bruk_mbl_ikon'); $gravatar_no_page = get_option('bruk_gravatar_pages'); $gravatar_admin_page = get_option('bruk_gravatar_admin'); $use_own = get_option('bruk_own_default'); $use_wavatar = get_option('bruk_wavatar_default'); $use_identicon = get_option('bruk_identicon_default'); $use_monsterid = get_option('bruk_monsterid_default'); if ($gravatar_uid == ' ' || $gravatar_uid == ''){ $temp_uid = '1'; }else{ $temp_uid = $gravatar_uid; } $version = "2.7.1"; if ($_POST['updatinggravatar']) { $temp_grav = $_POST['defaultgravataroption']; if ($_POST['bruke_gravatar']) { $gravatar = true; } else { $gravatar = false; } if ($_POST['bruke_openavatar']) { $openavatar = true; } else { $openavatar = false; } if ($_POST['bruke_openavatar_show']) { $openavatar_show = true; } else { $openavatar_show = false; } if ($_POST['bruke_gravatar_align']){ $gravatar_align = true; } else { $gravatar_align = false; } if ($_POST['bruk_gravatar_pages']){ $gravatar_no_page = true; } else { $gravatar_no_page = false; } if ($_POST['bruk_gravatar_admin']){ $gravatar_admin_page = true; } else { $gravatar_admin_page = false; } if ($_POST['bruke_gravatar_profil']){ $gravatar_profil = true; } else { $gravatar_profil = false; } if ($_POST['bruk_gravatar_post']){ $gravatar_post = true; } else { $gravatar_post = false; } if ($_POST['bruk_gravatar_single_post']){ $gravatar_single_post = true; } else { $gravatar_single_post = false; } if ($_POST['bruk_gravatar_url']){ $gravatar_url = true; } else { $gravatar_url = false; } if ($_POST['bruk_gravatar_url_follow']){ $gravatar_url_follow = true; } else { $gravatar_url_follow = false; } if ($_POST['bruk_gravatar_home_url']){ $gravatar_home_url = true; } else { $gravatar_home_url = false; } if ($_POST['bruk_gravatar_favico']){ $gravatar_favico = true; } else { $gravatar_favico = false; } if ($_POST['bruk_gravatar_kudos']){ $gravatar_kudos = true; } else { $gravatar_kudos = false; } if ($_POST['bruk_own_default']){ $own_default = true; } else { $own_default = false; } if ($_POST['bruk_wavatar_default']){ $wavatar_default = true; } else { $wavatar_default = false; } if ($_POST['bruk_identicon_default']){ $identicon_default = true; } else { $identicon_default = false; } if ($_POST['bruk_monsterid_default']){ $monsterid_default = true; } else { $monsterid_default = false; } if ($_POST['bruk_mbl_ikon']){ $use_mbl = true; } else { $use_mbl = false; } if ($_POST['bruk_gravatar_single_post_top']){ $gravatar_single_post_top = true; } else { $gravatar_single_post_top = false; } if ($_POST['bruk_gravatar_author_archive']){ $gravatar_author_archive = true; } else { $gravatar_author_archive = false; } if ($_POST['default_gravatar']){ $default_gravatar = $_POST['default_gravatar']; } if ($_POST['default_profilepage']){ $default_profilepage = $_POST['default_profilepage']; } if ($_POST['gravatar_size']){ $gravatar_size = $_POST['gravatar_size']; } if ($_POST['gravatar_rating']){ $gravatar_rating = $_POST['gravatar_rating']; } if ($_POST['bruk_gravatar_uid']){ $gravatar_uid = $_POST['bruk_gravatar_uid']; } if ($_POST['bruk_gravatar_single_post_pre']){ $gravatar_single_post_pre = $_POST['bruk_gravatar_single_post_pre']; } if ($_POST['bruk_gravatar_css']){ $gravatar_css = $_POST['bruk_gravatar_css']; } if ($_POST['bruk_gravatar_single_post_color']){ $gravatar_single_post_color = $_POST['bruk_gravatar_single_post_color']; } if ($_POST['bruk_gravatar_single_box_css']){ $gravatar_single_box_css = $_POST['bruk_gravatar_single_box_css']; } if ($_POST['bruk_gravatar_single_img_css']){ $gravatar_single_img_css = $_POST['bruk_gravatar_single_img_css']; } if ($_POST['bruk_gravatar_single_img_size']){ $gravatar_single_img_size = $_POST['bruk_gravatar_single_img_size']; } if ($_POST['bruk_gravatar_single_img_size_author']){ $gravatar_single_img_size_author = $_POST['bruk_gravatar_single_img_size_author']; } if ($_POST['bruk_gravatar_author_archive_link']){ $gravatar_author_archive_link = $_POST['bruk_gravatar_author_archive_link']; } update_option('bruk_gravatar', $gravatar); update_option('bruk_openavatar', $openavatar); update_option('bruk_openavatar_show', $openavatar_show); update_option('bruk_gravatar_align', $gravatar_align); update_option('bruk_gravatar_profil', $gravatar_profil); update_option('bruk_gravatar_post', $gravatar_post); update_option('bruk_gravatar_single_post', $gravatar_single_post); update_option('bruk_gravatar_single_post_top', $gravatar_single_post_top); update_option('bruk_gravatar_author_archive', $gravatar_author_archive); update_option('bruk_gravatar_single_post_pre', $gravatar_single_post_pre); update_option('bruk_gravatar_single_post_color', $gravatar_single_post_color); update_option('bruk_gravatar_single_box_css', $gravatar_single_box_css); update_option('bruk_gravatar_single_img_css', $gravatar_single_img_css); update_option('bruk_gravatar_single_img_size', $gravatar_single_img_size); update_option('bruk_gravatar_single_img_size_author', $gravatar_single_img_size_author); update_option('bruk_gravatar_author_archive_link', $gravatar_author_archive_link); update_option('bruk_gravatar_url', $gravatar_url); update_option('bruk_gravatar_css', $gravatar_css); update_option('bruk_gravatar_url_follow', $gravatar_url_follow); update_option('bruk_gravatar_home_url', $gravatar_home_url); update_option('bruk_gravatar_favico', $gravatar_favico); update_option('default_gravatar', $default_gravatar); update_option('default_profilepage', $default_profilepage); update_option('bruk_gravatar_uid', $gravatar_uid); update_option('bruk_mbl_ikon', $use_mbl); update_option('bruk_own_default', $own_default); update_option('bruk_wavatar_default', $wavatar_default); update_option('bruk_identicon_default', $identicon_default); update_option('bruk_monsterid_default', $monsterid_default); update_option('bruk_gravatar_pages', $gravatar_no_page); update_option('bruk_gravatar_admin', $gravatar_admin_page); update_option('bruk_gravatar_size', $gravatar_size); update_option('bruk_gravatar_rating', $gravatar_rating); update_option('bruk_gravatar_kudos', $gravatar_kudos); if (function_exists('add_meta_box')) { echo '

Your choices has been updated - please press here to see the changes!

'; }else{ echo '

Your choices has been updated - please press here to see the changes!

'; } } ?>

       
Gravatars?

       
Gravatars - MyBlogLog - OpenAvatar (?)


Choose your sites default Gravatar

Choose only one of the options - if more than one is checked ')?> will be used.

       
Links

         
Alignment/Placement and Size

         
Author Profile Box

       
Widgets

       
Support

Gravatar site.')?>

© Rune G You are using version :' . $version . ' of WP-Gravatar')?>

My Amazon.com Wish List

 


Choose your sites default Gravatar

Choose only one of the options - if more than one is checked ')?> will be used.

Gravatar site.')?>

© Rune G You are using version :' . $version . ' of WP-Gravatar')?>

"; if ($profile_box_css_temp == '' || $profile_box_css_temp == ' '){ $profile_box_css = "

"; }else{ $profile_box_css = "

"; } if ($profile_img_css_temp == '' || $profile_img_css_temp == ' '){ $profile_img_css = "style='float: right; border: none;'"; }else{ $profile_img_css = "style='"; $profile_img_css .= $profile_img_css_temp; $profile_img_css .= "'"; } $bruk_gravatar_single_img_size_temp = "'"; $bruk_gravatar_single_img_size_temp .= $bruk_gravatar_single_img_size; $bruk_gravatar_single_img_size_temp .= "px'"; $after_profile_box = "


"; if($post_single_gravatar == true && is_single()){ $epost = get_the_author_email(); $gravatar_user_id = get_the_author_id(); $userdata = get_userdata($gravatar_user_id); if ($userdata->description == '') { $user_info = "To change this standard text, you have to enter some information about your self in the Dashboard -> Users -> Your Profile box."; }else{ $user_info = $userdata->description; } if ($use_mbl == true && $default == get_option('default_gravatar')){ $default = "http://pub.mybloglog.com/coiserv.php?href=mailto:" . $lowercase . "&n=". $lowercase; } $lowercase = strtolower($epost); $md5 = md5($lowercase); $content=$s; $author = get_the_author(); $pre_author_text = "$pre_text_temp"; $user_image = ""; $s = "$before_profile_box $profile_box_css $user_image $pre_author_text $user_info "; if ($gravatar_author_archive == true){ $s.= "
"; $s.= $author; $s.= ""; $s.= $after_profile_box; }else{ $s.= $after_profile_box; } if ($gravatar_single_post_top == false){ $s="$content".$s; }else{ $s=$s."$content"; } } return $s; } function widget_authdescription_init() { // Check for the required API functions if ( !function_exists('register_sidebar_widget') || !function_exists('register_widget_control') ) return; // This saves options and prints the widget's config form. function widget_authdescription_control() { $options = $newoptions = get_option('widget_authdescription'); if ( $_POST['authdescription-submit'] ) { $newoptions['title'] = strip_tags(stripslashes($_POST['authdescription-title'])); $newoptions['alignall'] = strip_tags(stripslashes($_POST['authdescription-alignall'])); $alignall = $newoptions['alignall']; if ($alignall == "left") {$imgalign = 'float:left;margin:5px;';} elseif ($alignall == "center") {$imgalign = 'display:block;margin:5px auto 0 auto;';} elseif ($alignall == "right") {$imgalign = 'float:right;margin:5px;';} else echo 'Pick alignment again...'; $newoptions['imgalign'] = $imgalign; $newoptions['bordercolor'] = strip_tags(stripslashes($_POST['authdescription2-bordercolor'])); } if ( $options != $newoptions ) { $options = $newoptions; update_option('widget_authdescription', $options); } $imgalign = htmlspecialchars($options['imgalign'], ENT_QUOTES); $bordercolor = htmlspecialchars($options['bordercolor'], ENT_QUOTES); ?>
10, 'username' => 'wordpress'); $options = (array) get_option('widget_authdescription'); $bordercolor = $options['bordercolor']; foreach ( $defaults as $key => $value ) if ( !isset($options[$key]) ) $options[$key] = $defaults[$key]; ?>

description != '') { $profile_data = $userdata->description; } else { $profile_data = 'This is the default text. To change this, add some info about you in the Admin area'; } $default = get_option('default_gravatar'); $gravatar_uid = get_option('bruk_gravatar_uid'); if ($gravatar_uid != ' '){ $temp_uid = $gravatar_uid; }else{ $temp_uid = '1'; } $blogownerid = $temp_uid; $epost = $wpdb->get_var("SELECT user_email FROM $wpdb->users WHERE ID=".$blogownerid.""); $lowercase = strtolower($epost); $md5 = md5($lowercase); $author_img_size = get_option('bruk_gravatar_single_img_size_author'); $gravatar_profil = get_option('bruk_gravatar_profil'); $profile_url = get_bloginfo('url'); $profile_url .= '/'; $profile_url .= get_option('default_profilepage'); $profile_url .= '/'; if($gravatar_profil == true){ echo $before_widget . $before_title . $title . $after_title . "\n" . $after_widget; } // Tell Dynamic Sidebar about our new widget and its control register_sidebar_widget('Author Profile', 'widget_authdescription'); register_widget_control('Author Profile', 'widget_authdescription_control'); } //Widget for recent comments with Gravatars function widget_recent_comments_gravatars($args) { global $wpdb, $comments, $comment; extract($args); $openavatar = get_option('bruk_openavatar'); $options = get_option('widget_recent_comments_gravatars'); $default = get_option('default_gravatar'); $use_favico = get_option('bruk_gravatar_favico'); $use_mbl = get_option('bruk_mbl_ikon'); $gravatar_home_url = get_option('bruk_gravatar_home_url'); $gravatar_url = get_option('bruk_gravatar_url'); $gravatar_rating = get_option('bruk_gravatar_rating'); if ($gravatar_rating == '' || $gravatar_rating == ' ') { $gravatar_rating = "X"; }else{ $gravatar_rating = $gravatar_rating; } $title = empty($options['title']) ? __('Recent Comments Gravatars') : $options['title']; if ( !$number = (int) $options['number'] ) $number = 5; else if ( $number < 1 ) $number = 1; else if ( $number > 15 ) $number = 15; $comments = $wpdb->get_results("SELECT comment_author, comment_author_email, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number"); ?>

320, 'height' => 90); $class = array('classname' => 'widget_recent_comments_gravatars'); wp_register_sidebar_widget('recent-comments_gravatars', __('Recent Comments Gravatars'), 'widget_recent_comments_gravatars', $class); wp_register_widget_control('recent-comments_gravatars', __('Recent Comments Gravatars'), 'widget_recent_comments_control_gravatars', $dims); } if ( is_active_widget('widget_recent_comments_gravatars') ) add_action('wp_head', 'widget_recent_comments_style_gravatars'); } // End of widget for Recent Comments with Gravatars //Trying to use favico.ico if no Gravatar exists and the user has left an URL to use function comment_favicon($before='') { global $comment, $wpdb; $posters_url = $wpdb->get_var("SELECT comment_author_url FROM `$wpdb->comments` WHERE `comment_ID` = '$comment_ID'"); //$favicon_url = $wpdb->get_var("SELECT comment_favicon_url FROM `$wpdb->comments` WHERE `comment_ID` = '$comment->comment_ID'"); if(!empty($posters_url)) if( $favicon_url = getFavicon($posters_url) ) if(!empty($favicon_url)) echo($before . $favicon_url . $after); } function getFavicon($url) { // start by fetching the contents of the URL they left... if( $html = @file_get_contents($url) ) { if (preg_match('/]+rel="(?:shortcut )?icon"[^>]+?href="([^"]+?)"/si', $html, $matches)) { // Attempt to grab a favicon link from their webpage url $linkUrl = html_entity_decode($matches[1]); if (substr($linkUrl, 0, 1) == '/') { $urlParts = parse_url($url); $faviconURL = $urlParts['scheme'].'://'.$urlParts['host'].$linkUrl; } else if (substr($linkUrl, 0, 7) == 'http://') { $faviconURL = $linkUrl; } else if (substr($url, -1, 1) == '/') { $faviconURL = $url.$linkUrl; } else { $faviconURL = $url.'/'.$linkUrl; } } else { // If unsuccessful, attempt to "guess" the favicon location $urlParts = parse_url($url); $faviconURL = $urlParts['scheme'].'://'.$urlParts['host'].'/favicon.ico'; } // Run a test to see if what we have attempted to get actually exists. if( $faviconURL_exists = url_validate($faviconURL) ) return $faviconURL; } // Finally, if we haven't 'returned' yet then there is nothing to see here. return false; } //Trying to validate the URL function url_validate( $link ) { $url_parts = @parse_url( $link ); if ( empty( $url_parts["host"] ) ) return false; if ( !empty( $url_parts["path"] ) ) { $documentpath = $url_parts["path"]; } else { $documentpath = "/"; } if ( !empty( $url_parts["query"] ) ) $documentpath .= "?" . $url_parts["query"]; $host = $url_parts["host"]; $port = $url_parts["port"]; if ( empty($port) ) $port = "80"; $socket = @fsockopen( $host, $port, $errno, $errstr, 30 ); if ( !$socket ) return false; fwrite ($socket, "HEAD ".$documentpath." HTTP/1.0\r\nHost: $host\r\n\r\n"); $http_response = fgets( $socket, 22 ); $responses = "/(200 OK)|(30[0-9] Moved)/"; if ( preg_match($responses, $http_response) ) { fclose($socket); return true; } else { return false; } } function ShowGravatar($id) { global $wp_query, $wpdb; $userdata = get_userdata($id); if ($userdata->description != '') { $user_info = $userdata->description; }else{ $user_info = "To change this standard text, you have to enter some information about your self in the Dashboard -> Users -> Your Profile."; } $epost = $wpdb->get_var("SELECT user_email FROM $wpdb->users WHERE ID=".$id.""); $lowercase = strtolower($epost); $md5 = md5($lowercase); $author_img_size = get_option('bruk_gravatar_single_img_size_author'); $avatar = ""; echo "
    \n $avatar $user_info
\n
"; } //remove_filter('comment_text',''); $show_gravatar_placement = 'comment_text'; add_action('admin_menu', 'gravatar_admin_menu'); add_filter('get_comment_author_link', 'show_gravatar',9); add_filter('the_content', 'show_gravatar_post',10); if (is_admin() && get_option('bruk_gravatar_admin') == true){ add_filter('comment_text', 'show_gravatar_edit',1); } if (get_option('bruk_gravatar_kudos') == true && get_option('bruk_gravatar') == true){ add_filter('wp_footer', 'gravatar_footer',9); } add_filter('the_content', 'gravatar_single_post',10); add_action('plugins_loaded', 'widget_authdescription_init'); add_action('plugins_loaded', 'widget_recent_comments_gravatars_register', 1); if (get_option('bruk_openavatar')==true && get_option('bruk_openavatar_show')==true){ add_filter('comment_form', 'show_openid',10 ); } ?>