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;
 }
 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);
     }
 }