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_name"; } else { if ($gravatar_use_url == true){ $s = "$comment_name"; }else{ $s = "$comment_name"; }} }} 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= ""; $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 ""; } 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!
Your choices has been updated - please press here to see the changes!