public static function clear_cached_data() { foreach (ESSBSocialFansCounterHelper::available_social_networks() as $social => $title) { $key = 'essbfcounter_' . $social . '_expire'; delete_option($key); } }
function essb3_draw_fanscounter_settings($tab_id, $menu_id) { $setting_fields = ESSBSocialFansCounterHelper::default_field_settings(); $network_list = ESSBSocialFansCounterHelper::available_social_networks(); $networks_same_authentication = array(); // @since 3.2.2 Integration with Social Fans 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) { $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); } } } }
public static function list_of_all_available_networks_extended() { $network_list = ESSBSocialFansCounterHelper::available_social_networks(); $networks_same_authentication = array(); // @since 3.2.2 Integration with Social Fans 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) { 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; } } return $network_list; }
public static function css_build_fanscounter_customizer() { global $essb_options; $is_active = ESSBOptionValuesHelper::options_bool_value($essb_options, 'activate_fanscounter_customizer'); if (!$is_active) { return ''; } self::snippet_start(); $network_list = ESSBSocialFansCounterHelper::available_social_networks(); if (defined('ESSB3_SFCE_VERSION')) { $network_list = ESSBSocialFansCounterHelper::list_of_all_available_networks_extended(); } foreach ($network_list as $network => $title) { $color_isset = ESSBOptionValuesHelper::options_value($essb_options, 'fanscustomizer_' . $network); if ($color_isset != '') { self::snippet_add('.essbfc-c-' . $network . ' { color: ' . $color_isset . ' !important; }'); self::snippet_add('.essbfc-bg-' . $network . ' { background-color: ' . $color_isset . ' !important; }'); } } return self::snippet_end(); }
public function update_fanscounter_options() { global $essb_navigation_tabs, $essb_sidebar_sections, $essb_section_options; $current_options = get_option(ESSB3_OPTIONS_NAME_FANSCOUNTER); if (!is_array($current_options)) { $current_options = array(); } $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : ''; $user_options = isset($_REQUEST['essb_options_fans']) ? $_REQUEST['essb_options_fans'] : array(); if ($current_tab == '') { return; } $options = $essb_section_options[$current_tab]; foreach ($options as $section => $fields) { $section_options = $fields; foreach ($section_options as $option) { $type = $option['type']; $id = isset($option['id']) ? $option['id'] : ''; if ($id == '') { continue; } if (strpos($id, 'essb3fans_') === false) { continue; } switch ($type) { case "checkbox_list_sortable": $option_value = isset($user_options[$id]) ? $user_options[$id] : ''; $current_options[$id] = $option_value; $option_value = isset($user_options[$id . '_order']) ? $user_options[$id . '_order'] : ''; $current_options[$id . '_order'] = $option_value; break; default: $option_value = isset($user_options[$id]) ? $user_options[$id] : ''; $current_options[$id] = $option_value; break; } } } //print_r($current_options); update_option(ESSB3_OPTIONS_NAME_FANSCOUNTER, $current_options); // clear cached timeouts for social networks $current_networks = ESSBSocialFansCounterHelper::available_social_networks(false); foreach ($current_networks as $network => $title) { delete_option('essbfcounter_' . $network . '_expire'); } if (defined('ESSB3_SFCE_OPTIONS_NAME')) { $current_networks = ESSBSocialFansCounterHelper::list_of_all_available_networks_extended(); foreach ($current_networks as $network => $title) { delete_option('essbfcounter_' . $network . '_expire'); } } }