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 3 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, see . */ function has_gravatar($email) { // Craft a potential url and test its headers $hash = md5($email); $uri = 'http://www.gravatar.com/avatar/' . $hash . '?d=404'; $headers = @get_headers($uri); if (!preg_match("|200|", $headers[0])) { $has_valid_avatar = FALSE; } else { $has_valid_avatar = TRUE; } return $has_valid_avatar; } function authorbio_content($content) { if (is_single() && authorbio_includeBio()) { $label = get_option('authorbio_label'); require_once(ABSPATH . WPINC . '/author-template.php'); $authorBio = get_the_author_description(); $includeAuthorUrl = get_option('authorbio_link_author_name'); $authorUrl = get_the_author_url(); $includeGravatar = get_option('authorbio_gravatar'); $authorEmail = get_the_author_email(); if ($includeGravatar) { require_once(ABSPATH . WPINC . '/pluggable.php'); } $bio = "\n\n"; if ($authorBio && authorbio_category_satisfied()) { $bio .= "\n"; $bio .= "\n"; $bio .= "
\n"; $bio .= "".$label." "; if ($includeAuthorUrl && $authorUrl) { $bio .= ""; } $bio .= get_the_author_firstname(); if ($includeAuthorUrl && $authorUrl) { $bio .= ""; } $bio .= ':
'; if ($includeGravatar && $authorEmail && has_gravatar($authorEmail)) { $gravatarSize = get_option('authorbio_gravatar_size'); $bio .= "\n\n"; $bio .= ""; $bio .= get_avatar($authorEmail, $gravatarSize); $bio .= "\n"; } $author_description= get_the_author_description(); $textlimit=get_option('authorbio_textlimit'); if ($textlimit > 0) { $bio .= substr($author_description,0,$textlimit); } else { $bio .= $author_description; } $bio .= "\n
\n"; if (authorbio_includeMeta()) { $bio .= authorbio_getMetadataTable(); } $bio .= "
\n"; } else { $bio .= "\n"; } $bio .= "\n"; $content .= $bio; } return $content; } function authorbio_category_satisfied() { $categoryList = get_option('authorbio_category_list'); $categoryInclude = (get_option('authorbio_category_mode') == 'include'); if ($categoryList) { $categories_to_consider = explode(',',get_option('authorbio_category_list')); } else { $categories_to_consider = array(); } if (count($categories_to_consider) == 0) { $found = !$categoryInclude; // error_log("no categories to consider"); } else { $found = false; foreach((get_the_category()) as $category) { error_log("Considering $category->cat_name"); if (in_array($category->cat_name,$categories_to_consider)) { $found = $categoryInclude; break; } } } return $found; } function authorbio_getMetadataTable() { $website=get_the_author_meta('user_url'); $jabberId=get_the_author_meta('jabber'); $aimId=get_the_author_meta('aim'); $yahooId=get_the_author_meta('yim'); $infoBox=''."\n"; if ($website) { $infoBox .= '\n"; } if ($jabberId) { $infoBox .= '\n"; } if ($aimId) { $infoBox .= '\n"; } if ($yahooId) { $infoBox .= '\n"; } $infoBox .= "
'.__('Website').":$website
'.__('Jabber').":$jabberId
'.__('AIM').":$aimId
'.__('Yahoo').":$yahooId
\n"; return $infoBox; } function authorbio_includeMeta() { return get_option('authorbio_include_website') || get_option('authorbio_include_jabber') || get_option('authorbio_include_aim') || get_option('authorbio_include_yahoo'); } function authorbio_includeBio() { global $page, $numpages; $includeOnAllPages = get_option('authorbio_allpages'); if ($includeOnAllPages || ($page == $numpages)) { $result = true; } else { $result = false; } return $result; } function authorbio_header() { ?>

:
:

/>

/>

/>

/>

/>
:
:
/>
onclick="return authorbio_gravatar_toggled();" />
: