function display_profiles()
 {
     global $essb_options;
     if (ESSBCoreHelper::is_module_deactivate_on('profiles')) {
         return "";
     }
     $profiles_display_position = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_display_position');
     $profiles_button_type = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_button_type');
     $profiles_button_size = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_button_size');
     $profiles_nospace = ESSBOptionValuesHelper::options_bool_value($essb_options, 'profiles_nospace');
     $profiles_button_fill = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_button_fill');
     $profiles_order = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_order');
     // @new version 3.0.4
     $profiles_allowtext = ESSBOptionValuesHelper::options_bool_value($essb_options, 'profiles_allowtext');
     $profiles_width = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_width');
     if (!is_array($profiles_order)) {
         $profiles_order = array();
         foreach (essb_available_social_profiles() as $network => $text) {
             $profiles_order[] = $network;
         }
     }
     $profiles = array();
     foreach ($profiles_order as $network) {
         $value_address = ESSBOptionValuesHelper::options_value($essb_options, 'profile_' . $network);
         if (!empty($value_address)) {
             $profiles[$network] = $value_address;
         }
     }
     $profiles_texts = array();
     if ($profiles_allowtext) {
         foreach ($profiles_order as $network) {
             $value_address = ESSBOptionValuesHelper::options_value($essb_options, 'profile_text_' . $network);
             if (!empty($value_address)) {
                 $profiles_texts[$network] = $value_address;
             }
         }
     }
     echo $this->generate_social_profile_icons($profiles, $profiles_button_type, $profiles_button_size, $profiles_button_fill, $profiles_nospace, $profiles_display_position, $profiles_allowtext, $profiles_texts, $profiles_width);
 }
Example #2
0
 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);
 }
function essb_prepare_social_profiles_fields($tab_id, $menu_id)
{
    foreach (essb_available_social_profiles() as $key => $text) {
        ESSBOptionsStructureHelper::field_section_start($tab_id, $menu_id, $text, 'Social profile details');
        ESSBOptionsStructureHelper::field_textbox_stretched($tab_id, $menu_id, 'profile_' . $key, __('Full address to profile', ESSB3_TEXT_DOMAIN), __('Enter address to your profile in social network', ESSB3_TEXT_DOMAIN));
        ESSBOptionsStructureHelper::field_textbox_stretched($tab_id, $menu_id, 'profile_text_' . $key, __('Display text with icon', ESSB3_TEXT_DOMAIN), __('Enter custom text that will be displayed with link to your social profile. Example: Follow us on ' . $text, ESSB3_TEXT_DOMAIN));
        ESSBOptionsStructureHelper::field_section_end($tab_id, $menu_id);
    }
}
 public function widget($args, $instance)
 {
     global $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';
         essb_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;
     }
 }
 private function includeOptionsForEasyProfiles()
 {
     $this->shortcode = 'easy-profiles';
     $this->shortcodeTitle = '[easy-profiles] Shortcode';
     $listOfType = array("square" => "Square buttons", "round" => "Round buttons", "edge" => "Round edges");
     $listOfFill = array("fill" => "White icons on colored background", "colored" => "Colored icons");
     $listOfSize = array("small" => "Small", "medium" => "Medium", "large" => "Large");
     $this->register("type", array("type" => "dropdown", "text" => "Button style:", "comment" => "", "sourceOptions" => $listOfType));
     $this->register("size", array("type" => "dropdown", "text" => "Button size:", "comment" => "", "sourceOptions" => $listOfSize));
     $this->register("style", array("type" => "dropdown", "text" => "Button color fill:", "comment" => "", "sourceOptions" => $listOfFill));
     $this->register("nospace", array("type" => "checkbox", "text" => "Remove space between buttons:", "comment" => "", "value" => "true"));
     $this->register('networks', array("type" => "networks_sp", "text" => "Select Social Networks:", "comment" => "Provide list of networks that will be included"));
     foreach (essb_available_social_profiles() as $key => $value) {
         $this->register("profile_" . $key, array("type" => "textbox", "text" => $value, "comment" => "", "value" => "", "fullwidth" => "true"));
     }
 }