public function update($new_instance, $old_instance)
 {
     $instance = $old_instance;
     $widget_settings_fields = ESSBSocialFollowersCounterHelper::default_options_structure();
     foreach ($widget_settings_fields as $field => $options) {
         $instance[$field] = $new_instance[$field];
     }
     return $instance;
 }
    $default_options = 'eyJidXR0b25fc3R5bGUiOiJidXR0b24iLCJzdHlsZSI6IjIyIiwiY3NzX2FuaW1hdGlvbnMiOiJubyIsImZ1bGx3aWR0aF9zaGFyZV9idXR0b25zX2NvbHVtbnMiOiIxIiwibmV0d29ya3MiOlsiZmFjZWJvb2siLCJ0d2l0dGVyIiwiZ29vZ2xlIiwicGludGVyZXN0IiwibGlua2VkaW4iXSwibmV0d29ya3Nfb3JkZXIiOlsiZmFjZWJvb2siLCJ0d2l0dGVyIiwiZ29vZ2xlIiwicGludGVyZXN0IiwibGlua2VkaW4iLCJkaWdnIiwiZGVsIiwic3R1bWJsZXVwb24iLCJ0dW1ibHIiLCJ2ayIsInByaW50IiwibWFpbCIsImZsYXR0ciIsInJlZGRpdCIsImJ1ZmZlciIsImxvdmUiLCJ3ZWlibyIsInBvY2tldCIsInhpbmciLCJvayIsIm13cCIsIm1vcmUiLCJ3aGF0c2FwcCIsIm1lbmVhbWUiLCJibG9nZ2VyIiwiYW1hem9uIiwieWFob29tYWlsIiwiZ21haWwiLCJhb2wiLCJuZXdzdmluZSIsImhhY2tlcm5ld3MiLCJldmVybm90ZSIsIm15c3BhY2UiLCJtYWlscnUiLCJ2aWFkZW8iLCJsaW5lIiwiZmxpcGJvYXJkIiwiY29tbWVudHMiLCJ5dW1tbHkiXSwibW9yZV9idXR0b25fZnVuYyI6IjEiLCJtb3JlX2J1dHRvbl9pY29uIjoicGx1cyIsInR3aXR0ZXJfc2hhcmVzaG9ydF9zZXJ2aWNlIjoid3AiLCJtYWlsX2Z1bmN0aW9uIjoiZm9ybSIsIndoYXRzYXBwX3NoYXJlc2hvcnRfc2VydmljZSI6IndwIiwiZmxhdHRyX2xhbmciOiJzcV9BTCIsImNvdW50ZXJ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iLCJlc3NiX2NhY2hlX21vZGUiOiJmdWxsIiwidHVybm9mZl9lc3NiX2FkdmFuY2VkX2JveCI6InRydWUiLCJlc3NiX2FjY2VzcyI6Im1hbmFnZV9vcHRpb25zIiwiYXBwbHlfY2xlYW5fYnV0dG9uc19tZXRob2QiOiJkZWZhdWx0IiwibWFpbF9zdWJqZWN0IjoiVmlzaXQgdGhpcyBzaXRlICUlc2l0ZXVybCUlIiwibWFpbF9ib2R5IjoiSGksIHRoaXMgbWF5IGJlIGludGVyZXN0aW5nIHlvdTogJSV0aXRsZSUlISBUaGlzIGlzIHRoZSBsaW5rOiAlJXBlcm1hbGluayUlIiwiZmFjZWJvb2t0b3RhbCI6InRydWUiLCJhY3RpdmF0ZV90b3RhbF9jb3VudGVyX3RleHQiOiJzaGFyZXMifQ==';
    $options_base = ESSB_Manager::convert_ready_made_option($default_options);
    // print_r($options_base);
    if ($options_base) {
        $essb_options = $options_base;
        $essb_admin_options = $options_base;
    }
    update_option(ESSB3_OPTIONS_NAME, $essb_admin_options);
}
global $essb_admin_options_fanscounter;
$essb_admin_options_fanscounter = get_option(ESSB3_OPTIONS_NAME_FANSCOUNTER);
if (!is_array($essb_admin_options_fanscounter)) {
    if (!class_exists('ESSBSocialFollowersCounterHelper')) {
        include_once ESSB3_PLUGIN_ROOT . 'lib/modules/social-followers-counter/essb-social-followers-counter-helper.php';
    }
    $essb_admin_options_fanscounter = ESSBSocialFollowersCounterHelper::create_default_options_from_structure(ESSBSocialFollowersCounterHelper::options_structure());
    update_option(ESSB3_OPTIONS_NAME_FANSCOUNTER, $essb_admin_options_fanscounter);
}
// print "options are:";
// print_r($essb_admin_options);
if (count($essb_navigation_tabs) > 0) {
    $tab_1 = key($essb_navigation_tabs);
}
if ($tab_1 == '') {
    $tab_1 = "social";
}
global $current_tab;
$current_tab = empty($_GET['tab']) ? $tab_1 : sanitize_text_field(urldecode($_GET['tab']));
$purge_cache = isset($_REQUEST['purge-cache']) ? $_REQUEST['purge-cache'] : '';
$rebuild_resource = isset($_REQUEST['rebuild-resource']) ? $_REQUEST['rebuild-resource'] : '';
$dismiss_addon = isset($_REQUEST['dismiss']) ? $_REQUEST['dismiss'] : '';
Ejemplo n.º 3
0
 public function import_fanscounter()
 {
     $previous_options = get_option('essb-fans-options');
     $essb_previous_supported_items = array('facebook', 'twitter', 'google', 'youtube', 'vimeo', 'dribbble', 'github', 'envato', 'soundcloud', 'behance', 'delicious', 'instagram', 'pinterest', 'love', 'vk', 'rss', 'posts', 'comments', 'users', 'mailchimp', 'linkedin', 'tumblr', 'steam', 'flickr', 'total');
     $defaults = ESSBSocialFollowersCounterHelper::options_structure();
     $facebook_id = $previous_options['social']['facebook']['id'];
     $facebook_token = $previous_options['social']['facebook']['token'];
     $defaults['facebook']['id'] = $facebook_id;
     $defaults['facebook']['access_token'] = $facebook_token;
     $twitter_id = $previous_options['social']['twitter']['id'];
     $twitter_key = $previous_options['social']['twitter']['key'];
     $twitter_secret = $previous_options['social']['twitter']['secret'];
     $twitter_token = $previous_options['social']['twitter']['token'];
     $twitter_tokensecret = $previous_options['social']['twitter']['tokensecret'];
     $defaults['twitter']['id'] = $twitter_id;
     $defaults['twitter']['consumer_key'] = $twitter_key;
     $defaults['twitter']['consumer_secret'] = $twitter_secret;
     $defaults['twitter']['access_token'] = $twitter_token;
     $defaults['twitter']['access_token_secret'] = $twitter_tokensecret;
     $google_id = $previous_options['social']['google']['id'];
     $google_type = $previous_options['social']['google']['type'];
     $google_api = $previous_options['social']['google']['api'];
     $defaults['google']['id'] = $google_id;
     $defaults['google']['api_key'] = $google_api;
     $defaults['youtube']['id'] = $previous_options['social']['youtube']['id'];
     $defaults['vimeo']['id'] = $previous_options['social']['vimeo']['id'];
     $defaults['pinterest']['id'] = $previous_options['social']['pinterest']['id'];
     $defaults['vk']['id'] = $previous_options['social']['vk']['id'];
     $defaults['instgram']['id'] = $previous_options['social']['instagram']['id'];
     $defaults['instgram']['api_key'] = $previous_options['social']['instagram']['api'];
     $defaults['mailchimp']['list_id'] = $previous_options['social']['mailchimp']['id'];
     $defaults['mailchimp']['api_key'] = $previous_options['social']['mailchimp']['api'];
     $defaults['mailchimp']['list_url'] = $previous_options['social']['mailchimp']['url'];
     $defaults['tumblr']['id'] = $previous_options['social']['tumblr']['id'];
     $defaults['tumblr']['api_key'] = $previous_options['social']['tumblr']['key'];
     $defaults['tumblr']['api_secret'] = $previous_options['social']['tumblr']['secret'];
     $defaults['tumblr']['access_token'] = $previous_options['social']['tumblr']['token'];
     $defaults['tumblr']['access_token_secret'] = $previous_options['social']['tumblr']['tokensecret'];
     $new_options = array();
     foreach ($defaults as $network => $options) {
         foreach ($options as $key => $value) {
             $settings_key = "essb3fans_" . $network . "_" . $key;
             $new_options[$settings_key] = $value;
         }
     }
     update_option(ESSB3_OPTIONS_NAME_FANSCOUNTER, $new_options);
 }
 public static function css_build_followerscounter_customizer()
 {
     global $essb_options;
     $is_active = ESSBOptionValuesHelper::options_bool_value($essb_options, 'activate_fanscounter_customizer');
     if (!$is_active) {
         return '';
     }
     self::snippet_start();
     $network_list = ESSBSocialFollowersCounterHelper::available_social_networks();
     foreach ($network_list as $network => $title) {
         $color_isset = ESSBOptionValuesHelper::options_value($essb_options, 'fanscustomizer_' . $network);
         if ($color_isset != '') {
             self::snippet_add('.essbfc-template-color .essbfc-icon-' . $network . ', .essbfc-template-grey .essbfc-icon-' . $network . ' { color: ' . $color_isset . ' !important; }');
             self::snippet_add('.essbfc-template-roundcolor .essbfc-icon-' . $network . ', .essbfc-template-roundgrey .essbfc-icon-' . $network . ' { background-color: ' . $color_isset . ' !important; } ');
             self::snippet_add('.essbfc-template-outlinecolor .essbfc-icon-' . $network . ', .essbfc-template-outlinegrey .essbfc-icon-' . $network . '  { color: ' . $color_isset . ' !important; border-color: ' . $color_isset . ' !important; }');
             self::snippet_add('.essbfc-template-outlinecolor li:hover .essbfc-icon-' . $network . ', .essbfc-template-outlinegrey li:hover .essbfc-icon-' . $network . ' { background-color: ' . $color_isset . ' !important; }');
             self::snippet_add('.essbfc-template-metro .essbfc-' . $network . ' .essbfc-network { background-color: ' . $color_isset . ' !important; }');
             self::snippet_add('.essbfc-template-flat .essbfc-' . $network . ' .essbfc-network { background-color: ' . $color_isset . ' !important; }');
             self::snippet_add('.essbfc-template-dark .essbfc-' . $network . ' .essbfc-network { background-color: ' . $color_isset . ' !important; }');
             self::snippet_add('.essbfc-template-modern .essbfc-' . $network . ' .essbfc-network i { color: ' . $color_isset . ' !important; }');
             self::snippet_add('.essbfc-template-modern .essbfc-' . $network . ' .essbfc-network { border-bottom: 3px solid ' . $color_isset . ' !important }');
             self::snippet_add('.essbfc-template-modern .essbfc-' . $network . ':hover .essbfc-network { background-color: ' . $color_isset . ' !important }');
         }
     }
     return self::snippet_end();
 }
 /**
  * draw_followers
  *
  * Display instance of generated followers counter
  *
  * @param $options array       	
  * @param $draw_title boolean       	
  * @since 3.4
  */
 public static function draw_followers($options, $draw_title = false)
 {
     $hide_title = isset($options['hide_title']) ? $options['hide_title'] : 0;
     if (intval($hide_title) == 1) {
         $draw_title = false;
     }
     $instance_title = isset($options['title']) ? $options['title'] : '';
     $instance_new_window = isset($options['new_window']) ? $options['new_window'] : 0;
     $instance_nofollow = isset($options['nofollow']) ? $options['nofollow'] : 0;
     $instance_show_total = isset($options['show_total']) ? $options['show_total'] : 0;
     $instance_total_type = isset($options['total_type']) ? $options['total_type'] : 'button_single';
     $instance_columns = isset($options['columns']) ? $options['columns'] : 3;
     $instance_template = isset($options['template']) ? $options['template'] : 'flat';
     $instance_animation = isset($options['animation']) ? $options['animation'] : '';
     $instance_bgcolor = isset($options['bgcolor']) ? $options['bgcolor'] : '';
     $instance_nospace = isset($options['nospace']) ? $options['nospace'] : 0;
     // compatibility with previous template slugs
     if (!empty($instance_template)) {
         if ($instance_template == "lite") {
             $instance_template = "light";
         }
         if ($instance_template == "grey-transparent") {
             $instance_template = "grey";
         }
         if ($instance_template == "color-transparent") {
             $instance_template = "color";
         }
     }
     $class_template = !empty($instance_template) ? " essbfc-template-" . $instance_template : '';
     $class_animation = !empty($instance_animation) ? " essbfc-icon-" . $instance_animation : '';
     $class_columns = !empty($instance_columns) ? " essbfc-col-" . $instance_columns : '';
     $class_nospace = intval($instance_nospace) == 1 ? " essbfc-nospace" : "";
     $style_bgcolor = !empty($instance_bgcolor) ? ' style="background-color:' . $instance_bgcolor . ';"' : '';
     $link_nofollow = intval($instance_nofollow) == 1 ? ' rel="nofollow"' : '';
     $link_newwindow = intval($instance_new_window) == 1 ? ' target="_blank"' : '';
     // loading animations
     if (!empty($class_animation)) {
         essb_resource_builder()->add_static_footer_css(ESSB3_PLUGIN_URL . '/lib/modules/social-followers-counter/assets/css/hover.css', 'essb-social-followers-counter-animations', 'css');
     }
     // followers main element
     printf('<div class="essbfc-container%1$s%2$s%3$s%5$s"%4$s>', '', $class_columns, $class_template, $style_bgcolor, $class_nospace);
     if ($draw_title && !empty($instance_title)) {
         printf('<h3>%1$s</h3>', $instance_title);
     }
     // get current state of followers counter
     $followers_count = essb_followers_counter()->get_followers();
     $display_total = intval($instance_show_total) == 1 ? true : false;
     $total_followers = 0;
     if ($display_total) {
         foreach ($followers_count as $network => $count) {
             if (intval($count) > 0) {
                 $total_followers += intval($count);
             }
         }
     }
     if ($display_total && $instance_total_type == "text_before") {
         printf('<div class="essbfc-totalastext">%1$s %2$s</div>', self::followers_number($total_followers), ESSBSocialFollowersCounterHelper::get_option('total_text'));
     }
     echo '<ul>';
     foreach (essb_followers_counter()->active_social_networks() as $social) {
         $social_followers_text = ESSBSocialFollowersCounterHelper::get_option($social . '_text');
         $social_followers_counter = isset($followers_count[$social]) ? $followers_count[$social] : 0;
         $social_display = $social;
         if ($social_display == "instgram") {
             $social_display = "instagram";
         }
         printf('<li class="essbfc-%1$s">', $social_display);
         $follow_url = essb_followers_counter()->create_follow_address($social);
         if (!empty($follow_url)) {
             printf('<a href="%1$s"%2$s%3$s>', $follow_url, $link_newwindow, $link_nofollow);
         }
         echo '<div class="essbfc-network">';
         printf('<i class="essbfc-icon essbfc-icon-%1$s%2$s"></i>', $social_display, $class_animation);
         printf('<span class="essbfc-followers-count">%1$s</span>', self::followers_number($social_followers_counter));
         printf('<span class="essbfc-followers-text">%1$s</span>', $social_followers_text);
         echo '</div>';
         if (!empty($follow_url)) {
             echo '</a>';
         }
         echo '</li>';
     }
     if ($display_total && $instance_total_type == "button_single") {
         $social = 'total';
         printf('<li class="essbfc-%1$s">', $social);
         echo '<div class="essbfc-network">';
         printf('<i class="essbfc-icon  essbfc-icon-%1$s%2$s"></i>', $social, $class_animation);
         printf('<span class="essbfc-followers-count">%1$s</span>', self::followers_number($total_followers));
         printf('<span class="essbfc-followers-text">%1$s</span>', ESSBSocialFollowersCounterHelper::get_option('total_text'));
         echo '</div>';
         echo '</li>';
     }
     echo '</ul>';
     if ($display_total && $instance_total_type == "text_after") {
         printf('<div class="essbfc-totalastext">%1$s %2$s</div>', self::followers_number($total_followers), ESSBSocialFollowersCounterHelper::get_option('total_text'));
     }
     echo '</div>';
     // followers: end
 }
 public function update_mailpoet()
 {
     $result = 0;
     $list = ESSBSocialFollowersCounterHelper::get_option('mailpoet_id');
     if (!empty($list)) {
         if ($list == 'all') {
             $result = ESSBSocialFollowersCounterHelper::mailpoet_total_subscribers();
         } else {
             $result = ESSBSocialFollowersCounterHelper::mailpoet_get_list_users($list);
         }
     }
     return $result;
 }
function essb3_draw_fanscounter_settings($tab_id, $menu_id)
{
    $setting_fields = ESSBSocialFollowersCounterHelper::options_structure();
    $network_list = ESSBSocialFollowersCounterHelper::available_social_networks();
    $networks_same_authentication = array();
    // @since 3.2.2 Integration with Social Followers Counter Extended
    if (defined('ESSB3_SFCE_OPTIONS_NAME')) {
        $fanscounter_extended_options = get_option(ESSB3_SFCE_OPTIONS_NAME);
        $extended_list = array();
        foreach ($network_list as $network => $title) {
            $is_active_extended = ESSBOptionValuesHelper::options_bool_value($fanscounter_extended_options, 'activate_' . $network);
            $use_same_api = ESSBOptionValuesHelper::options_bool_value($fanscounter_extended_options, 'same_access_' . $network);
            $count_extended = ESSBOptionValuesHelper::options_value($fanscounter_extended_options, 'profile_count_' . $network);
            $count_extended = intval($count_extended);
            $extended_list[$network] = $title;
            if ($is_active_extended) {
                if ($use_same_api) {
                    $networks_same_authentication[$network] = "yes";
                }
                for ($i = 1; $i <= $count_extended; $i++) {
                    $extended_list[$network . "_" . $i] = $title . " Additional Profile " . $i;
                }
            }
        }
        $network_list = array();
        foreach ($extended_list as $network => $title) {
            $network_list[$network] = $title;
        }
        //asort($network_list);
    }
    foreach ($network_list as $network => $title) {
        ESSBOptionsStructureHelper::field_heading($tab_id, $menu_id, 'heading2', $title);
        $default_options_key = $network;
        $is_extended_key = false;
        if (strpos($default_options_key, '_') !== false && $default_options_key != 'wp_posts' && $default_options_key != 'wp_comments' && $default_options_key != 'wp_users') {
            $key_array = explode('_', $default_options_key);
            $default_options_key = $key_array[0];
            $is_extended_key = true;
        }
        $single_network_options = isset($setting_fields[$default_options_key]) ? $setting_fields[$default_options_key] : array();
        foreach ($single_network_options as $field => $options) {
            $field_id = "essb3fans_" . $network . "_" . $field;
            $field_type = isset($options['type']) ? $options['type'] : 'textbox';
            $field_text = isset($options['text']) ? $options['text'] : '';
            $field_description = isset($options['description']) ? $options['description'] : '';
            $field_values = isset($options['values']) ? $options['values'] : array();
            $is_authfield = isset($options['authfield']) ? $options['authfield'] : false;
            if ($is_extended_key && $is_authfield) {
                if (isset($networks_same_authentication[$default_options_key])) {
                    continue;
                }
            }
            if ($field_type == "textbox") {
                ESSBOptionsStructureHelper::field_textbox_stretched($tab_id, $menu_id, $field_id, $field_text, $field_description);
            }
            if ($field_type == "select") {
                ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $field_id, $field_text, $field_description, $field_values);
            }
        }
    }
}
 /**
  * create_follow_address
  * 
  * Generate social follow address based on user settings
  * 
  * @param string $social
  * @return string
  * @since 3.4
  */
 public static function create_follow_address($social)
 {
     switch ($social) {
         case 'facebook':
             return 'https://www.facebook.com/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             break;
         case 'twitter':
             return 'https://www.twitter.com/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             break;
         case 'google':
             return 'https://plus.google.com/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             break;
         case 'pinterest':
             return 'https://www.pinterest.com/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             break;
         case 'linkedin':
             return ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             break;
         case 'github':
             return 'http://github.com/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             break;
         case 'vimeo':
             if (ESSBSocialFollowersCounterHelper::get_option($social . '_account_type', 'channel') == 'user') {
                 $vimeo_id = trim(ESSBSocialFollowersCounterHelper::get_option($social . '_id'));
                 if (preg_match('/^[0-9]+$/', $vimeo_id)) {
                     return 'http://vimeo.com/user' . $vimeo_id;
                 } else {
                     return 'http://vimeo.com/' . $vimeo_id;
                 }
             } else {
                 return 'http://vimeo.com/channels/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             }
             break;
         case 'dribbble':
             return 'http://dribbble.com/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             break;
         case 'soundcloud':
             return 'https://soundcloud.com/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             break;
         case 'behance':
             return 'http://www.behance.net/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             break;
         case 'foursquare':
             if (intval(ESSBSocialFollowersCounterHelper::get_option($social . '_id')) && intval(ESSBSocialFollowersCounterHelper::get_option($social . '_id')) == ESSBSocialFollowersCounterHelper::get_option($social . '_id')) {
                 return 'https://foursquare.com/user/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             } else {
                 return 'https://foursquare.com/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             }
             break;
         case 'forrst':
             return 'http://forrst.com/people/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             break;
         case 'mailchimp':
             return ESSBSocialFollowersCounterHelper::get_option($social . '_list_url');
             break;
         case 'delicious':
             return 'https://delicious.com/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             break;
         case 'instgram':
         case 'instagram':
             return 'http://instagram.com/' . ESSBSocialFollowersCounterHelper::get_option($social . '_username');
             break;
         case 'youtube':
             return 'https://www.youtube.com/' . ESSBSocialFollowersCounterHelper::get_option($social . '_account_type') . '/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             break;
         case 'envato':
             $ref = '';
             if (ESSBSocialFollowersCounterHelper::get_option($social . '_ref')) {
                 $ref = '?ref=' . ESSBSocialFollowersCounterHelper::get_option($social . '_ref');
             }
             return 'http://www.' . ESSBSocialFollowersCounterHelper::get_option($social . '_site') . '.net/user/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id') . $ref;
             break;
         case 'vk':
             $account_type = ESSBSocialFollowersCounterHelper::get_option($social . '_account_type');
             if ($account_type == "community") {
                 return 'http://www.vk.com/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             } else {
                 return 'http://www.vk.com/id' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             }
             break;
         case 'rss':
             return ESSBSocialFollowersCounterHelper::get_option($social . '_link');
             break;
         case 'vine':
             return 'https://vine.co/' . ESSBSocialFollowersCounterHelper::get_option($social . '_username');
             break;
         case 'tumblr':
             $basename2arr = explode('.', ESSBSocialFollowersCounterHelper::get_option($social . '_basename'));
             if ($basename2arr == 'www') {
                 return 'http://' . ESSBSocialFollowersCounterHelper::get_option($social . '_basename');
             } else {
                 return 'http://www.tumblr.com/follow/' . @$basename2arr[0];
             }
             break;
         case 'slideshare':
             return 'http://www.slideshare.net/' . ESSBSocialFollowersCounterHelper::get_option($social . '_username');
             break;
         case '500px':
             return 'http://500px.com/' . ESSBSocialFollowersCounterHelper::get_option($social . '_username');
             break;
         case 'flickr':
             return 'https://www.flickr.com/photos/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             break;
         case 'wp_posts':
         case 'wp_users':
         case 'wp_comments':
             return ESSBSocialFollowersCounterHelper::get_option($social . '_url');
             break;
         case 'audioboo':
             return 'https://audioboo.fm/users/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             break;
         case 'steamcommunity':
             return 'http://steamcommunity.com/groups/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             break;
         case 'weheartit':
             return 'http://weheartit.com/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             break;
         case 'love':
             return ESSBSocialFollowersCounterHelper::get_option($social . '_url');
             break;
         case 'total':
             return ESSBSocialFollowersCounterHelper::get_option($social . '_url');
             break;
         case 'feedly':
             return 'http://feedly.com/i/subscription/feed' . urlencode('/' . ESSBSocialFollowersCounterHelper::get_option($social . '_url'));
             break;
         case 'mymail':
             return ESSBSocialFollowersCounterHelper::get_option($social . '_url');
             break;
         case 'mailpoet':
             return ESSBSocialFollowersCounterHelper::get_option($social . '_url');
             break;
         case 'twitch':
             return 'http://www.twitch.tv/' . ESSBSocialFollowersCounterHelper::get_option($social . '_id') . '/profile';
             break;
         case 'spotify':
             return ESSBSocialFollowersCounterHelper::get_option($social . '_id');
             break;
     }
 }
    }
    // Social Profiles Widget is always available
    include_once ESSB3_PLUGIN_ROOT . 'lib/modules/social-profiles/essb-social-profiles-widget.php';
}
if (ESSBOptionValuesHelper::is_active_module('socialfans')) {
    define('ESSB3_SOCIALFANS_ACTIVE', 'true');
    global $essb_socialfans_options;
    $essb_socialfans_options = get_option(ESSB3_OPTIONS_NAME_FANSCOUNTER);
    include_once ESSB3_PLUGIN_ROOT . 'lib/modules/social-followers-counter/essb-social-followers-counter-helper.php';
    // if options does not exist we intialize the default settings
    if (!is_array($essb_socialfans_options)) {
        $essb_socialfans_options = array();
        $essb_socialfans_options['expire'] = 1400;
        $essb_socialfans_options['format'] = 'short';
        // apply default values from structure helper
        $essb_socialfans_options = ESSBSocialFollowersCounterHelper::create_default_options_from_structure($essb_socialfans_options);
    }
    // include widget class
    include_once ESSB3_PLUGIN_ROOT . 'lib/modules/social-followers-counter/essb-social-followers-counter-widget.php';
    include_once ESSB3_PLUGIN_ROOT . 'lib/modules/social-followers-counter/essb-social-followers-counter.php';
}
if (!defined('ESSB3_LIGHTMODE')) {
    if (ESSBOptionValuesHelper::is_active_module('metricslite')) {
        define('ESSB3_ESML_ACTIVE', 'true');
        include_once ESSB3_PLUGIN_ROOT . 'lib/modules/social-metrics-lite/easy-social-metrics-lite.php';
    }
    if (ESSBOptionValuesHelper::is_active_module('topsocialposts')) {
        define('ESSB3_ESML_TOPPOSTS_ACTIVE', 'true');
        include_once ESSB3_PLUGIN_ROOT . 'lib/modules/top-posts-widget/essb-top-posts-widget.php';
    }
}
 private function includeOptionsForEasyFans()
 {
     $this->shortcode = 'easy-followers';
     $this->shortcodeTitle = '[easy-followers] Shortcode';
     if (!class_exists('ESSBSocialFollowersCounterHelper')) {
         include_once ESSB3_PLUGIN_ROOT . 'lib/modules/social-followers-counter/essb-social-followers-counter-helper.php';
     }
     $default_shortcode_setup = ESSBSocialFollowersCounterHelper::default_instance_settings();
     $shortcode_settings = ESSBSocialFollowersCounterHelper::default_options_structure(true, $default_shortcode_setup);
     foreach ($shortcode_settings as $field => $options) {
         $description = isset($options['description']) ? $options['description'] : '';
         $options['comment'] = $description;
         $title = isset($options['title']) ? $options['title'] : '';
         $options['text'] = $title;
         $type = isset($options['type']) ? $options['type'] : '';
         if ($type == "textbox") {
             $options['fullwidth'] = 'true';
         }
         if ($type == "separator") {
             $options['type'] = "subsection";
         }
         $values = isset($options['values']) ? $options['values'] : array();
         if ($type == "select") {
             $options['type'] = "dropdown";
             $options['sourceOptions'] = $values;
         }
         $default_value = isset($options['default_value']) ? $options['default_value'] : '';
         if (!empty($default_value) && $type != 'checkbox') {
             $options['value'] = $default_value;
         } else {
             if ($type == 'checkbox') {
                 $options['value'] = '1';
             }
         }
         $this->register($field, $options);
     }
 }