public static function get_instance() { if (null == self::$instance) { self::$instance = new self(); } return self::$instance; }
public function widget($args, $instance) { global $essb_available_social_profiles, $essb_options; if (ESSBCoreHelper::is_module_deactivate_on('profiles')) { return ""; } extract($args); $before_widget = $args['before_widget']; $before_title = $args['before_title']; $after_title = $args['after_title']; $after_widget = $args['after_widget']; $show_title = $instance['show_title']; $title = $instance['title']; $sc_button_type = isset($instance['type']) ? $instance['type'] : 'square'; $sc_button_size = isset($instance['size']) ? $instance['size'] : 'small'; $sc_button_fill = isset($instance['style']) ? $instance['style'] : 'fill'; $sc_nospace = $instance['nospace']; if (!empty($sc_nospace) && $sc_nospace != '0') { $sc_nospace = "true"; } else { $sc_nospace = "false"; } $sc_nospace = ESSBOptionValuesHelper::unified_true($sc_nospace); $sc_allowtext = isset($instance['allowtext']) ? $instance['allowtext'] : '0'; if (!empty($sc_allowtext) && $sc_allowtext != '0') { $sc_allowtext = "true"; } else { $sc_allowtext = "false"; } $sc_allowtext = ESSBOptionValuesHelper::unified_true($sc_allowtext); $sc_width = isset($instance['width']) ? $instance['width'] : ''; $profile_networks = array(); $profile_networks = ESSBOptionValuesHelper::advanced_array_to_simple_array($essb_available_social_profiles); $profiles_order = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_order'); if (is_array($profiles_order)) { $profile_networks = $profiles_order; } $sc_network_address = array(); foreach ($profile_networks as $network) { $value = $instance['profile_' . $network]; if (!empty($value)) { $sc_network_address[$network] = $value; } } $sc_network_texts = array(); foreach ($profile_networks as $network) { $value = $instance['profile_text_' . $network]; if (!empty($value)) { $sc_network_texts[$network] = $value; } } if (!empty($show_title)) { echo $before_widget . $before_title . $title . $after_title; } // if module is not activated include the code if (!defined('ESSB3_SOCIALPROFILES_ACTIVE')) { include_once ESSB3_PLUGIN_ROOT . 'lib/modules/social-profiles/essb-social-profiles.php'; define('ESSB3_SOCIALPROFILES_ACTIVE', 'true'); $resource_builder = ESSBResourceBuilder::get_instance(); $template_url = ESSB3_PLUGIN_URL . '/assets/css/essb-profiles.css'; $resource_builder->add_static_footer_css($template_url, 'easy-social-share-buttons-profiles'); } echo ESSBSocialProfiles::generate_social_profile_icons($sc_network_address, $sc_button_type, $sc_button_size, $sc_button_fill, $sc_nospace, '', $sc_allowtext, $sc_network_texts, $sc_width); if (!empty($show_title)) { echo $after_widget; } }
function __construct() { include_once ESSB3_PLUGIN_ROOT . 'lib/essb-core-includes.php'; // begin plugin front end code execution $this->essb_resource_builder = ESSBResourceBuilder::get_instance(); $this->essb = ESSBCore::get_instance(); // loading social share optimization only when it is active if (defined('ESSB3_SSO_ACTIVE')) { ESSBSocialShareOptimization::get_instance(); } if (defined('ESSB3_SSA_ACTIVE')) { $tracker = ESSBSocialShareAnalytics::get_instance(); $this->essb_resource_builder->add_js($tracker->generate_tracker_code(), true, 'essb-stats-tracker'); } if (defined('ESSB3_AFTERSHARE_ACTIVE')) { $essb_asc = ESSBAfterCloseShare3::get_instance(); foreach ($essb_asc->resource_files as $key => $object) { $this->essb_resource_builder->add_static_resource($object["file"], $object["key"], $object["type"]); } foreach ($essb_asc->js_code as $key => $code) { $this->essb_resource_builder->add_js($code, false, 'essbasc_custom' . $key); } foreach ($essb_asc->social_apis as $key => $code) { $this->essb_resource_builder->add_social_api($key); } } if (defined('ESSB3_LOVEYOU_ACTIVE')) { $essb_loveyou = ESSBNetworks_LoveThis::get_instance(); $this->essb_resource_builder->add_js($essb_loveyou->generate_js_code(), true, 'essb-loveyou-code'); } if (defined('ESSB3_IMAGESHARE_ACTIVE')) { ESSBSocialImageShare::get_instance(); $this->essb_resource_builder->add_css(ESSBResourceBuilderSnippets::css_build_imageshare_customizer(), 'essb-imageshare-customizer', 'footer'); } if (defined('ESSB3_SOCIALPROFILES_ACTIVE')) { ESSBSocialProfiles::get_instance(); $this->essb_resource_builder->add_static_resource(ESSB3_PLUGIN_URL . '/assets/css/essb-profiles.css', 'easy-social-share-buttons-profles', 'css'); } if (defined('ESSB3_SOCIALFANS_ACTIVE')) { ESSBSocialFansCounter::get_instance(); $this->essb_resource_builder->add_css(ESSBResourceBuilderSnippets::css_build_fanscounter_customizer(), 'essb-fanscounter-customizer', 'footer'); } if (defined('ESSB3_NATIVE_ACTIVE')) { // Social Privacy Buttons when active include resources $essb_spb = ESSBSocialPrivacyNativeButtons::get_instance(); ESSBNativeButtonsHelper::$essb_spb = $essb_spb; foreach ($essb_spb->resource_files as $key => $object) { $this->essb_resource_builder->add_static_resource($object["file"], $object["key"], $object["type"]); } foreach (ESSBSkinnedNativeButtons::get_assets() as $key => $object) { $this->essb_resource_builder->add_static_resource($object["file"], $object["key"], $object["type"]); } $this->essb_resource_builder->add_css(ESSBSkinnedNativeButtons::generate_skinned_custom_css(), 'essb-skinned-native-buttons'); // asign instance of native buttons privacy class to helper // register active social network apis foreach (ESSBNativeButtonsHelper::get_list_of_social_apis() as $key => $code) { $this->essb_resource_builder->add_social_api($key); } } if (is_admin()) { include_once ESSB3_PLUGIN_ROOT . 'lib/admin/essb-admin-includes.php'; ESSBAdminControler::get_instance(); $exist_user_purchase_code = ESSBOptionValuesHelper::options_value($essb_options, 'purchase_code'); if (!empty($exist_user_purchase_code) || defined('ESSB3_THEME_INTEGRATED')) { include ESSB3_PLUGIN_ROOT . 'lib/external/autoupdate/plugin-update-checker.php'; // @since 1.3.3 // autoupdate // activating autoupdate option $essb_autoupdate = PucFactory::buildUpdateChecker('http://update.creoworx.com/essb3/', __FILE__, 'easy-social-share-buttons3'); // @since 1.3.7.2 - update to avoid issues with other plugins that uses same // method function addSecretKeyESSB3($query) { global $exist_user_purchase_code; $query['license'] = $exist_user_purchase_code; return $query; } $essb_autoupdate->addQueryArgFilter('addSecretKeyESSB3'); } } }
function essb_shortcode_profiles($atts) { $sc_networks = isset($atts['networks']) ? $atts['networks'] : ''; $sc_button_type = isset($atts['type']) ? $atts['type'] : 'square'; $sc_button_size = isset($atts['size']) ? $atts['size'] : 'small'; $sc_button_fill = isset($atts['style']) ? $atts['style'] : 'fill'; $sc_nospace = isset($atts['nospace']) ? $atts['nospace'] : 'false'; $sc_usetexts = isset($atts['allowtext']) ? $atts['allowtext'] : 'false'; $sc_width = isset($atts['width']) ? $atts['width'] : ''; $sc_nospace = ESSBOptionValuesHelper::unified_true($sc_nospace); $sc_usetexts = ESSBOptionValuesHelper::unified_true($sc_usetexts); $profile_networks = array(); if ($sc_networks != '') { $profile_networks = explode(',', $sc_networks); } else { $profile_networks = ESSBOptionValuesHelper::advanced_array_to_simple_array(essb_available_social_profiles()); } // prepare network values $sc_network_address = array(); foreach ($profile_networks as $network) { $value = isset($atts[$network]) ? $atts[$network] : ''; if (empty($value)) { $value = isset($atts['profile_' . $network]) ? $atts['profile_' . $network] : ''; } if (empty($value)) { $value = ESSBOptionValuesHelper::options_value($this->options, 'profile_' . $network); } if (!empty($value)) { $sc_network_address[$network] = $value; } } $sc_network_texts = array(); if ($sc_usetexts) { foreach ($profile_networks as $network) { $value = isset($atts[$network]) ? $atts[$network] : ''; if (empty($value)) { $value = isset($atts['profile_text_' . $network]) ? $atts['profile_text_' . $network] : ''; } if (empty($value)) { $value = ESSBOptionValuesHelper::options_value($this->options, 'profile_text_' . $network); } if (!empty($value)) { $sc_network_texts[$network] = $value; } } } // check if module is not activated yet if (!defined('ESSB3_SOCIALPROFILES_ACTIVE')) { include_once ESSB3_PLUGIN_ROOT . 'lib/modules/social-profiles/essb-social-profiles.php'; define('ESSB3_SOCIALPROFILES_ACTIVE', 'true'); $template_url = ESSB3_PLUGIN_URL . '/assets/css/essb-profiles.css'; essb_resource_builder()->add_static_footer_css($template_url, 'easy-social-share-buttons-profiles'); } return ESSBSocialProfiles::generate_social_profile_icons($sc_network_address, $sc_button_type, $sc_button_size, $sc_button_fill, $sc_nospace, '', $sc_usetexts, $sc_network_texts, $sc_width); }