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 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); }