public function form($instance) { $defaults = ESSBSocialFollowersCounterHelper::default_instance_settings(); $instance = wp_parse_args((array) $instance, $defaults); $widget_settings_fields = ESSBSocialFollowersCounterHelper::default_options_structure(true, $instance); foreach ($widget_settings_fields as $field => $options) { $field_type = isset($options['type']) ? $options['type'] : 'textbox'; $field_title = isset($options['title']) ? $options['title'] : ''; $field_description = isset($options['description']) ? $options['description'] : ''; $field_values = isset($options['values']) ? $options['values'] : array(); $field_default_value = isset($options['default_value']) ? $options['default_value'] : ''; if ($field_type == "textbox") { $this->generate_textbox_field($field, $field_title, $field_description, $field_default_value); } if ($field_type == "checkbox") { $this->generate_checkbox_field($field, $field_title, $field_description, $field_default_value); } if ($field_type == "separator") { $this->generate_separator($field_title); } if ($field_type == "select") { $this->generate_select_field($field, $field_title, $field_description, $field_default_value, $field_values); } } }
public function register_plugin_shortcodes($attrs) { $default_options = ESSBSocialFollowersCounterHelper::default_instance_settings(); $attrs = shortcode_atts($default_options, $attrs); //print_r($attrs); ob_start(); ESSBSocialFollowersCounterDraw::draw_followers($attrs, true); $html = ob_get_contents(); ob_end_clean(); return $html; }
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); } }