Author URI: http://ipublicis.com/ Donate link: http://smsh.me/7kit License: GNU GPL v3 or later Copyright (C) 2009 iPublicis!COM 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 . */ global $wp_version; $exit_msg = 'Author Box plugin requires WordPress 2.7 or higher. Please upgrade!'; if (version_compare($wp_version, "2.7", "<")) { exit($exit_msg); } /** * For backwards compatibility, esc_attr was added in 2.8 */ if (! function_exists('esc_attr')) { function esc_attr( $text ) { return attribute_escape( $text ); } } function authorbox_init_locale(){ //load translation file if any for the current language $plugin_dir = basename(dirname(__FILE__)); load_plugin_textdomain( 'author-box-2', 'wp-content/plugins/' . $plugin_dir . '/i18n', $plugin_dir . '/i18n' ); } add_filter('init', 'authorbox_init_locale'); function add_extra_contactmethod( $contactmethods ) { // Twitter $contactmethods['twitter'] = 'Twitter'; // Identi.ca $contactmethods['identica'] = 'Identi.ca'; // Facebook $contactmethods['facebook'] = 'Facebook'; // Netlog $contactmethods['netlog'] = 'Netlog'; // remove Yahoo IM unset($contactmethods['yim']); // remove AIM unset($contactmethods['aim']); return $contactmethods; } add_filter('user_contactmethods','add_extra_contactmethod',10,1); function authorbox_css() { // This makes sure that the posinioning is also good for right-to-left languages if( get_bloginfo( 'text_direction' ) == 'rtl' ) $rtltr = "rtl"; else $rtltr = "ltr"; $authorboxcss = WP_CONTENT_URL.'/plugins/'.plugin_basename(dirname(__FILE__)).'/authorbox-'.$rtltr.'.css'; echo ''; } add_action('wp_head', 'authorbox_css'); function authorbox_display( $content='' ) { if( is_single() ) { $author = get_the_author(); $content .= '
' .'
' .'

'.__("About the author", "author-box-2").'

' .'

'.get_avatar( get_the_author_email(), '100' ) .' '.get_the_author_meta( 'description' ).'

' .'
'; // Author's external profile site. Ex: LinkedIn $url = get_the_author_meta('url'); if(! empty( $url )) { $abfavicon = WP_CONTENT_URL.'/plugins/'.plugin_basename(dirname(__FILE__)).'/authorbox.ico'; $abprofile = esc_attr( sprintf(__("Visit %s’s public profile", "author-box-2"), $author) ); $socialcontent .= '
  • image
  • '; } // Author's social networks $socialinks = '
  • image
  • '; $author_extra = get_the_author_meta('twitter'); if(!empty($author_extra)) { $socialtitle = esc_attr( sprintf(__("Follow %s on ", "author-box-2").'Twitter', $author) ); $socialurl = "http://twitter.com/" . esc_attr($author_extra); $socialcontent .= sprintf($socialinks, $socialurl, "http://a1.twimg.com/a/1271213136/images/favicon.ico", $socialtitle); } $author_extra = get_the_author_meta('identica'); if(!empty($author_extra)) { $socialtitle = esc_attr( sprintf(__("Follow %s on ", "author-box-2").'Identi.ca', $author) ); $socialurl = "http://identi.ca/" . esc_attr($author_extra); $socialcontent .= sprintf($socialinks, $socialurl, "http://identi.ca/favicon.ico", $socialtitle); } $author_extra = get_the_author_meta('facebook'); if(!empty($author_extra)) { $socialtitle = esc_attr( sprintf(__("Follow %s on ", "author-box-2").'Facebook', $author) ); $socialurl = "http://facebook.com/" . esc_attr($author_extra); $socialcontent .= sprintf($socialinks, $socialurl, "http://static.ak.fbcdn.net/rsrc.php/z9Q0Q/hash/8yhim1ep.ico", $socialtitle); } $author_extra = get_the_author_meta('netlog'); if(!empty($author_extra)) { $socialtitle = esc_attr( sprintf(__("Follow %s on ", "author-box-2").'Netlog', $author) ); $socialurl = "http://netlog.com/" . esc_attr($author_extra); $socialcontent .= sprintf($socialinks, $socialurl, "http://v.netlogstatic.com/v4.00/2678//s/i/common/favicon.ico", $socialtitle); } // Make the External icons section $content .= '
    '; if( !empty($socialcontent)) { $content .= ' '; } $content .= '
    '; } return $content; } add_filter('the_content', 'authorbox_display'); ?>