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;
     }
 }
ESSBOptionsStructureHelper::field_switch('social', 'profiles-1', 'profiles_nospace', __('Remove spacing between buttons', ESSB3_TEXT_DOMAIN), __('Activate this option to remove default space between share buttons.', ESSB3_TEXT_DOMAIN), '', __('Yes', ESSB3_TEXT_DOMAIN), __('No', ESSB3_TEXT_DOMAIN));
$listOfOptions = array("small" => "Small", "medium" => "Medium", "large" => "Large");
ESSBOptionsStructureHelper::field_select('social', 'profiles-1', 'profiles_button_size', __('Button size', ESSB3_TEXT_DOMAIN), __('Choose your button size', ESSB3_TEXT_DOMAIN), $listOfOptions);
ESSBOptionsStructureHelper::field_section_end('social', 'profiles-1');
ESSBOptionsStructureHelper::field_section_start('social', 'profiles-1', __('Automatic display of social profiles', ESSB3_TEXT_DOMAIN), __('Activate automatic display of social profiles', ESSB3_TEXT_DOMAIN));
ESSBOptionsStructureHelper::field_switch('social', 'profiles-1', 'profiles_display', __('Automatic display of profiles', ESSB3_TEXT_DOMAIN), __('Activate this option to display automatically social profiles at selected position of screen', ESSB3_TEXT_DOMAIN), '', __('Yes', ESSB3_TEXT_DOMAIN), __('No', ESSB3_TEXT_DOMAIN));
$listOfOptions = array("left" => "Left", "right" => "Right", "topleft" => "Top left", "topright" => "Top right", "bottomleft" => "Bottom left", "bottomright" => "Bottom right");
ESSBOptionsStructureHelper::field_select('social', 'profiles-1', 'profiles_display_position', __('Position of social profiles', ESSB3_TEXT_DOMAIN), __('Choose your social profiles position', ESSB3_TEXT_DOMAIN), $listOfOptions);
ESSBOptionsStructureHelper::field_switch('social', 'profiles-1', 'profiles_mobile_deactivate', __('Deactivate social profiles on mobile', ESSB3_TEXT_DOMAIN), __('Activate this option to turn off display on mobile devices.', ESSB3_TEXT_DOMAIN), 'recommended', __('Yes', ESSB3_TEXT_DOMAIN), __('No', ESSB3_TEXT_DOMAIN));
ESSBOptionsStructureHelper::field_section_end('social', 'profiles-1');
ESSBOptionsStructureHelper::field_section_start('social', 'profiles-1', __('Text display', ESSB3_TEXT_DOMAIN), __('Activate display of custom text with the icons to social profiles', ESSB3_TEXT_DOMAIN));
ESSBOptionsStructureHelper::field_switch('social', 'profiles-1', 'profiles_allowtext', __('Display texts', ESSB3_TEXT_DOMAIN), __('Activate this option to display custom texts you enter in settings for each social network.', ESSB3_TEXT_DOMAIN), '', __('Yes', ESSB3_TEXT_DOMAIN), __('No', ESSB3_TEXT_DOMAIN));
ESSBOptionsStructureHelper::field_textbox('social', 'profiles-1', 'profiles_width', __('Customize width of button when text is used', ESSB3_TEXT_DOMAIN), __('Provide custom width of buttons for social profiles when text is used (example: 150px or 50%). Leave blank for automatic width.', ESSB3_TEXT_DOMAIN));
ESSBOptionsStructureHelper::field_section_end('social', 'profiles-1');
ESSBOptionsStructureHelper::field_heading('social', 'profiles-1', 'heading2', __('Change the order of social profiles', ESSB3_TEXT_DOMAIN));
ESSBOptionsStructureHelper::field_simplesort('social', 'profiles-1', 'profiles_order', __('Social networks', ESSB3_TEXT_DOMAIN), '', ESSBOptionValuesHelper::advanced_array_to_simple_array($essb_available_social_profiles));
ESSBOptionsStructureHelper::field_heading('social', 'profiles-2', 'heading1', __('Configure social profile addresses', ESSB3_TEXT_DOMAIN));
essb_prepare_social_profiles_fields('social', 'profiles-2');
// after share actions
ESSBOptionsStructureHelper::field_heading('social', 'after-share-1', 'heading1', __('After Social Share Actions', ESSB3_TEXT_DOMAIN));
ESSBOptionsStructureHelper::field_switch('social', 'after-share-1', 'afterclose_active', __('Activate after social share action', ESSB3_TEXT_DOMAIN), __('Activate this option to start display message after share dialog is closed.', ESSB3_TEXT_DOMAIN), '', __('Yes', ESSB3_TEXT_DOMAIN), __('No', ESSB3_TEXT_DOMAIN));
ESSBOptionsStructureHelper::field_switch('social', 'after-share-1', 'afterclose_deactive_mobile', __('Do not display after social share action for mobile devices', ESSB3_TEXT_DOMAIN), __('Avoid display after share actions on mobile devices', ESSB3_TEXT_DOMAIN), '', __('Yes', ESSB3_TEXT_DOMAIN), __('No', ESSB3_TEXT_DOMAIN));
ESSBOptionsStructureHelper::field_switch('social', 'after-share-1', 'afterclose_deactive_sharedisable', __('Do not include after share actions code on pages where buttons are deactivated', ESSB3_TEXT_DOMAIN), __('Activate this option if you do not wish code for after share module to be added on pages where buttons are set to be off into settings (via on post/page options or from Display Settings).', ESSB3_TEXT_DOMAIN), '', __('Yes', ESSB3_TEXT_DOMAIN), __('No', ESSB3_TEXT_DOMAIN));
$action_types = array("follow" => "Like/Follow Box", "message" => "Custom html message (for example subscribe form)", "code" => "Custom user code");
ESSBOptionsStructureHelper::field_select('social', 'after-share-1', 'afterclose_type', __('After close action type', ESSB3_TEXT_DOMAIN), __('Choose your after close action.', ESSB3_TEXT_DOMAIN), $action_types);
ESSBOptionsStructureHelper::field_section_start('social', 'after-share-1', __('Pop up message settings', ESSB3_TEXT_DOMAIN), __('', ESSB3_TEXT_DOMAIN), '');
ESSBOptionsStructureHelper::field_textbox('social', 'after-share-1', 'afterclose_popup_width', __('Pop up message width', ESSB3_TEXT_DOMAIN), __('Provide custom width in pixels for pop up window (number value with px in it. Example: 400). Default pop up width is 400.', ESSB3_TEXT_DOMAIN), '', 'input60', 'fa-arrows-h', 'right');
ESSBOptionsStructureHelper::field_switch('social', 'after-share-1', 'afterclose_singledisplay', __('Display pop up message once for selected time', ESSB3_TEXT_DOMAIN), __('Activate this option to prevent pop up window display on every page load. This option will make it display once for selected period of days.', ESSB3_TEXT_DOMAIN), '', __('Yes', ESSB3_TEXT_DOMAIN), __('No', ESSB3_TEXT_DOMAIN));
ESSBOptionsStructureHelper::field_textbox('social', 'after-share-1', 'afterclose_singledisplay_days', __('Days between pop up message display', ESSB3_TEXT_DOMAIN), __('Provide the value of days when pop up message will appear again. Leave blank for default value of 7 days.', ESSB3_TEXT_DOMAIN), '', 'input60', 'fa-calendar', 'right');
ESSBOptionsStructureHelper::field_section_end('social', 'after-share-1');
ESSBOptionsStructureHelper::field_heading('social', 'after-share-2', 'heading1', __('Action type: Like/Follow Box', ESSB3_TEXT_DOMAIN));
Ejemplo n.º 3
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);
 }