* License: GPL-2.0+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt * Domain Path: /lang */ // If this file is called directly, abort. if (!defined('WPINC')) { die; } // Load the main plugin class and widget class. require_once plugin_dir_path(__FILE__) . 'class-floating-social-bar.php'; // Register hooks for activation, deactivation and uninstall instances. register_activation_hook(__FILE__, array('floating_social_bar', 'activate')); register_deactivation_hook(__FILE__, array('floating_social_bar', 'deactivate')); register_uninstall_hook(__FILE__, array('floating_social_bar', 'uninstall')); // Initialize the plugin. $floating_social_bar = floating_social_bar::get_instance(); // Generate a template tag for use in template files. if (!function_exists('floating_social_bar')) { /** * Floating Social Bar template tag. * * Allows you to insert a floating social bar anywhere in your template files. * The keys currently available are 'facebook', 'twitter', 'google', * 'linkedin', and 'pinterest'. The value should be set to true if you want to * display that social service in the bar. Services will be output in the order * that you specify in the $args array. * * @package Floating Social Bar * @param array $args Args used for the floating social bar. * @param bool $return Flag for returning or echoing the slider content. */
/** * Fired when the plugin is activated. * * @since 1.0.0 * * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog. */ public static function activate($network_wide) { if (is_multisite()) { global $wpdb; $site_list = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->blogs} ORDER BY blog_id")); foreach ((array) $site_list as $site) { switch_to_blog($site->blog_id); // Ensure default options are set. $option = get_option('fsb_global_option'); if (!$option || empty($option)) { update_option('fsb_global_option', floating_social_bar::default_options()); } restore_current_blog(); } } else { // Ensure default options are set. $option = get_option('fsb_global_option'); if (!$option || empty($option)) { update_option('fsb_global_option', floating_social_bar::default_options()); } } }
/** * Echo the Floating Social Bar in the right place, just before the entry * content (after the header and entry meta) in Genesis child themes. * * As fsb() is really a function for filtering, it requires a single argument * (the content or excerpt), so we fool it by passing in an empty string instead. * * @since 1.0.0 */ function mfsbig_add_floating_social_bar() { if (class_exists('floating_social_bar')) { echo floating_social_bar::get_instance()->fsb(''); } }