Author URI: http://ipublicis.com/ Donate link: http://smsh.me/7kit License: GNU GPL v3 or later Copyright (C) 2010-2012 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 . */ /** * Check if the framework plugin is active */ if( is_admin() ) { $required_plugin = 'wordpress-plugin-framework-reloaded/wordpress-plugin-framework-reloaded.php'; include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); if ( ! is_plugin_active( $required_plugin ) ) { deactivate_plugins( plugin_basename( __FILE__ ) ); $wpfr = 'Wordpress Plugin Framework Reloaded'; $dieMessage = sprintf( __( 'The %s plugin must be installed and active, so this plugin was also deactivated.', 'author-box-2' ), $wpfr ); $notice = "

Author Box Reloaded

\n". "

".$dieMessage."

\n

\n"; add_action( 'admin_notices', create_function( '', "echo '$notice';" ) ); return; } } /** * Load the framework file */ require_once( WP_PLUGIN_DIR . '/wordpress-plugin-framework-reloaded/wordpress-plugin-framework-reloaded.php' ); /** * Where you put all your class code */ class authorBox extends WordpressPluginFrameworkReloaded { /** * @var authorBox - Static property to hold our singleton instance */ static $instance = false; /** * @array _known_sites - Author's social links defined by external plugins. Incl. plugins are for Twitter, Identi.ca, Facebook and Netlog */ protected function _init() { include_once('authorbox-init.php'); } protected function _postSettingsInit() { if ( $this->_settings['ab2']['auto_insert'] == 'yes' ) { add_filter('the_content', array( $this, 'authorbox_auto_display' ) ); } else { add_shortcode( $this->_slug, array( $this, 'authorbox_display' ) ); } } public function addOptionsMetaBoxes() { add_meta_box( $this->_slug . '-general-settings', __('General Settings', $this->_slug), array($this, 'generalSettingsMetaBox'), $this->_slug, 'main'); add_meta_box( $this->_slug . '-other-settings', __('Other Ways to Use It', $this->_slug), array($this, 'otherSettingsMetaBox'), $this->_slug, 'main'); add_meta_box( $this->_slug . '-visual-settings', __('Visual Settings', $this->_slug), array($this, 'visualSettingsMetaBox'), $this->_slug, 'main'); add_meta_box( $this->_slug . '-personal-settings', __('Personal Settings', $this->_slug), array($this, 'personalSettingsMetaBox'), $this->_slug, 'main'); } public function generalSettingsMetaBox() { ?>
_slug); ?> _settings['ab2']['auto_insert']) ?>>

_slug);?>

_slug);?> _settings['ab2']['photo_align']) ?>>

_slug);?>

_slug);?>

don't support your modifications.", $this->_slug);?>
_slug);?>

_slug);?>

_slug);?>

  1. _slug); ?><?php if (function_exists('wp_authorbox')) echo wp_authorbox(); ?>
  2. _slug); ?>[_slug; ?>]
_appIcon ) ) { $authorboxcss = plugin_dir_url( __FILE__ ) . 'authorbox-admin.css'; $version = uniqid (rand (),true); echo ""; // wp_enqueue_style( 'authorbox-admin', $authorboxcss, array (), $version, 'screen' ); } } public function authorbox_css() { if( !empty( $this->_settings['ab2']['personal_css'] ) ) { ?> "; // wp_enqueue_style( 'authorbox-reloaded', $authorboxcss, array (), $version, 'screen' ); if ( $this->_settings['ab2']['photo_align'] == 'reverse' ) { echo ""; if ( $rtltr == 'ltr' ) { ?> authorbox_display(); } return $content; } public function authorbox_display() { global $author; $author_name = get_the_author_meta( 'display_name', $author ); $author_photo = get_avatar( get_the_author_meta( 'user_email', $author ), '100', '', $author_name ); $author_photo = str_replace( '' .'

' . __( "About the author", $this->_slug ) . '

' .'

' . $author_photo .' ' . get_the_author_meta( 'description', $author ) . '

' .' '; // Author's external links $socialinks = '
  • logo image
  • '; // Author's external profile site. Ex: Main Website $profileurl = get_the_author_meta( 'user_url', $author ); if( !empty( $profileurl ) ) { $profiletitle = esc_attr( sprintf(__("Visit %s’s website", $this->_slug), $author_name) ); $profileicon = plugin_dir_url( __FILE__ ) . 'images/globe.png'; $socialcontent .= sprintf($socialinks, $profileurl, $profileicon, $profiletitle); } // Author's social networks $this->_known_sites = apply_filters( 'authorbox_known_sites', $this->_known_sites ); if( is_array( $this->_known_sites ) && ( @array_count_values( $this->_known_sites ) > 0 ) ) { foreach( array_keys( $this->_known_sites ) as $key ) { $replace = array( ' ' => '_', '/' => '_', '.' => '' ); $cKey = strtolower( $this->_hook . '_' . str_replace( array_keys($replace), $replace, $key ) ); $author_extra = get_the_author_meta( $cKey, $author ); if( !empty( $author_extra ) ) { $socialtitle = esc_attr( sprintf(__("Follow %s on ", $this->_slug).$key, $author_name) ); $socialurl = str_replace( "USERNAME", esc_attr($author_extra), $this->_known_sites[$key]['url'] ); $socialicon = $this->_known_sites[$key]['favicon']; $socialcontent .= sprintf($socialinks, $socialurl, $socialicon, $socialtitle); } } } // Make the External icons section if( !empty($socialcontent)) { $box .= ' '; } $box .= ' '; return $box; } public function add_extra_contactmethod( $contactmethods ) { $this->_known_sites = apply_filters( 'authorbox_known_sites', $this->_known_sites ); // Check to see if any External Contacts are active if( !is_array( $this->_known_sites ) || ( @array_count_values( $this->_known_sites ) == 0 ) ) { $notice = "

    Author Box Reloaded

    ". __( 'At least one External Contact plugin must be active.', $this->_slug )."

    \n"; add_action('admin_notices', create_function( '', "echo '$notice';" ) ); } else { // Add installed Social Link plugins foreach( array_keys( $this->_known_sites ) as $key ) { $replace = array( ' ' => '_', '/' => '_', '.' => '' ); $cKey = strtolower( $this->_hook . '_' . str_replace( array_keys($replace), $replace, $key ) ); $contactmethods[$cKey] = $key; } // remove Yahoo IM & AIM unset($contactmethods['yim']); unset($contactmethods['aim']); } return $contactmethods; } public function remove_extra_contactmethod( $contactmethods ) { $this->_known_sites = apply_filters( 'authorbox_known_sites', $this->_known_sites ); remove_filter( 'user_contactmethods', array( $this, 'add_extra_contactmethod' ), 10, 1); // Remove installed Social Link plugins foreach( array_keys( $this->_known_sites ) as $key ) { $replace = array( ' ' => '_', '/' => '_', '.' => '' ); $cKey = strtolower( $this->_hook . '_' . str_replace( array_keys($replace), $replace, $key ) ); unset($contactmethods[$cKey]); $filter_function = $cKey.'_authorbox_add_sites'; remove_filter('authorbox_known_sites', $filter_function, 10, 1); } // Add Yahoo IM & AIM $contactmethods['yim'] = 'Yahoo IM'; $contactmethods['aim'] = 'AIM'; return $contactmethods; } public function activate() { $this->_settings['ab2']['auto_insert'] = 'yes'; $this->_settings['ab2']['photo_align'] = ''; $this->_settings['ab2']['personal_css'] = ''; $this->registerOptions(); } public function deactivate() { add_filter( 'user_contactmethods', array( $this, 'remove_extra_contactmethod' ), 10, 1); $this->_getSettings(); $this->unregisterOptions(); } } /* END OF CLASS */ /** * Helper functions */ include_once('authorbox-helper.php'); // Instantiate our class $authorBox = authorBox::getInstance();