/**
  * get field setting
  * @return array
  */
 public function get_field_definition()
 {
     //select widgets setting data
     $widgets_settings = array();
     if (is_array($this->saved_widgets_settings)) {
         foreach ($this->saved_widgets_settings as $item) {
             $widgets_settings[$item->id] = $item->id . '-' . $item->name;
         }
     }
     //$sidebars =  hwawc_get_all_active_sidebars();   //get all registered sidebars
     if (function_exists('hwawc_get_active_sidebars_select')) {
         $sidebars_field_data = hwawc_get_active_sidebars_select();
     } else {
         global $wp_registered_sidebars;
         $sidebars_field_data = array();
         foreach ($wp_registered_sidebars as $sidebar) {
             $sidebars_field_data[$sidebar['id']] = $sidebar['name'];
         }
     }
     //get sidebar wiget skins
     $sidebar_skins_data = array();
     if (class_exists('HW_AWC_Sidebar_Settings')) {
         $sidebar_skins = HW_AWC_Sidebar_Settings::available_widget_skins();
         //other way: just call HW_AWC_Sidebar_Settings::available_widget_skins(true)
         foreach ($sidebar_skins as $theme_name => $opt) {
             $sidebar_skins_data[$theme_name] = $opt['title'];
         }
     } else {
         $tip = 'Không tìm thấy HW Any Widget class plugin.';
     }
     return array('field_id' => 'main_loop_content_style', 'type' => 'hw_table_fields', 'title' => 'Lặp nội dung chính', 'description' => 'Áp dụng cho template sử dụng lặp nội dung.' . (!empty($tip) ? 'Chú ý: ' . $tip : ''), 'repeatable' => true, 'show_root_field' => false, 'attributes' => array('hw_table_fields' => array()), 'fields' => array('col1' => array('name' => 'layout', 'type' => 'select', 'options' => $this->layouts, 'description' => ''), 'col2' => array('name' => 'widget_config', 'type' => 'select', 'options' => $widgets_settings, 'description' => ''), 'col3' => array('name' => 'sidebar', 'type' => 'select', 'options' => $sidebars_field_data), 'col4' => array('name' => 'sidebar_widget_skin', 'type' => "select", 'options' => $sidebar_skins_data)), 'table_header' => array('col1' => 'Layout', 'col2' => 'Cấu hình nội dung + hiển thị', 'col3' => 'Box', 'col4' => 'Chọn một giao diện'));
 }
 /**
  * prepare widget skins fields
  */
 public static function available_widget_skins($pure = false)
 {
     self::$widget_skins = array('skin_default' => array('title' => 'Chọn skin mặc định.', 'description' => __('Chọn skin cho widget box')), 'skin1' => array('title' => 'Widget style 1', 'description' => 'Chọn skin cho widget box'), 'skin2' => array('title' => 'Widget style 2'), 'skin3' => array('title' => 'Widget style 3'));
     //return purely data for select options
     if ($pure) {
         $widget_skins_data = array();
         foreach (self::$widget_skins as $theme_name => $opt) {
             $widget_skins_data[$theme_name] = $opt['title'];
         }
         return $widget_skins_data;
     }
     return self::$widget_skins;
 }
 /**
  * load option grid posts
  * @param WP_Widget $t: widget object
  * @param array $instance: widget data
  */
 function do_widget_feature($t, $instance = array())
 {
     $this->widget_instance = $instance;
     //maybe update widget instance
     //$wf_name = $this->get_widget_feature_name('');
     //list registered sidebars
     $sidebars = hwawc_get_active_sidebars_select();
     $sidebar_skins = HW_AWC_Sidebar_Settings::available_widget_skins(true);
     //sidebar skins
     //saved widget configs by specifying group
     $widgetconfig_groups = AWC_WidgetFeature_saveconfig::get_widgets_settings_select(' WHERE _group="' . self::WIDGET_CONFIG_GROUP . '"');
     //HW_UI_Component::build_select_tag($sidebars, '', '');
     echo '<div class="form-wf-shortcode-params" id="' . $this->get_field_id('wfshortcode_container') . '"><fieldset><legend>Tạo shortcode widget</legend>';
     echo '<input type="hidden" class="widget_class" name="' . $this->get_field_name('widget_class') . '" id="' . $this->get_field_id('widget_class') . '" value="' . get_class($t) . '"/>';
     echo '<input type="hidden" class="widget_instance" name="' . $this->get_field_name('widget_instance') . '" id=" ' . $this->get_field_id('widget_instance') . ' " value="' . base64_encode(serialize($instance)) . '"/>';
     //apply widget to sidebar
     echo '<p><label for="' . $this->get_field_id('sidebar') . '">Chọn Sidebar</label><br/>';
     echo '<select class="hw-select sidebar" name="' . $this->get_field_name('sidebar') . '" id="' . $this->get_field_id('sidebar') . '">';
     foreach ($sidebars as $id => $name) {
         $selected = selected($this->get_field_value('sidebar'), $id, false);
         printf('<option value="%s" %s>%s</option>', $id, $selected, $name);
     }
     echo '</select></p>';
     //choose sidebar skin
     echo '<p><label for="' . $this->get_field_id('sidebar_skin') . '">Chọn giao diện Sidebar</label><br/>';
     echo HW_UI_Component::build_select_tag($sidebar_skins, null, array('name' => $this->get_field_name('sidebar_skin'), 'id' => $this->get_field_id('sidebar_skin'), 'class' => 'sidebar_skin'));
     echo '</select></p>';
     //widget config group
     echo '<p><label for="' . $this->get_field_id('config_group') . '">Chọn widget config</label><br/>';
     echo '<select class="config_group" name=" ' . $this->get_field_name('config_group') . ' " id="' . $this->get_field_id('config_group') . '">';
     foreach ($widgetconfig_groups as $id => $text) {
         $selected = selected($this->get_field_value('config_group'), $id, false);
         printf('<option value="%s" %s>%s</option>', $id, $selected, $text);
     }
     echo '</select>';
     echo '<a href="javascript:void(0)" onclick="__awc_feature_shortcode_params.refresh_saved_widgetsconfig(this,\'' . $this->get_field_id('config_group') . '\')">Refresh</a>';
     //you also should be active saveconfig feature
     if (!HW_AWC_WidgetFeatures::check_widget_feature($t, 'saveconfig')) {
         echo '<div>Bạn cũng cần kích hoạt feature "<a href="' . admin_url('options-general.php?page=' . HW_HOANGWEB_Settings::HW_SETTINGS_PAGE) . '" target="_blank">saveconfig</a>" cho widget này.</div>';
     }
     echo '</p>';
     echo '<a href="javascript:void(0)" onclick="__awc_feature_shortcode_params.generate_shortcode(this,jQuery(\'#' . $this->get_field_id('wfshortcode_container') . '\'))" class="button">Tạo shortcode</a>';
     echo '<div></div>';
     echo '<p><em>Hướng dẫn</em>: Sử dụng tính năng "Lưu cài đặt" ở tại widget này để lưu cấu hình của widget (chọn nhóm "Shortcode Widget")</p>';
     echo '</fieldset></div>';
 }
 /**
  * since yarpp v4.2.5
  * @param $posts: related posts result
  * @param array $args: keys 'function','args','related_ID'
  */
 public function _yarpp_results($posts, $args)
 {
     global $wp_query;
     $wp_query->posts = $posts;
     /*$cat_posts = $wp_query;
       $arrExlpodeFields = array('title');*/
     /*if(isset($args['args']['compatible_vars']) && is_array($args['args']['compatible_vars'])){
           $this->compatible_vars = array_merge($this->compatible_vars, $args['args']['compatible_vars']);
       }
       $this->compatible_vars = array_merge($this->compatible_vars, $args['args']['skin']->instance->get_migrate());
       foreach($this->compatible_vars as $var => $val){
           $$var = is_string($val) && isset($$val)? $$val : $val;
       }
       */
     //default sidebar params
     $sidebar_params = array('before_widget' => '<div id="%1$s" class="hw-widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>');
     //valid posts
     if (!isset($args['args']['skin'])) {
         return $posts;
     }
     $hwrp = $skin = $args['args']['skin'];
     if (isset($args['args']['hwrp_current'])) {
         $hwrp = (object) $args['args']['hwrp_current'];
         //get current post type related data
     }
     //migrate vars
     $migrate_data = $skin->instance->get_migrate();
     extract($migrate_data);
     //get sidebar wrapper
     if (isset($skin->box_skin)) {
         global $wp_registered_sidebars;
         $sidebar = $args['args']['skin']->box_skin;
         $sidebar_widget_skin = $args['args']['skin']->box_widget_skin;
         //override sidebar skin box with other
         $sidebar_params = array();
         //extract($sidebar_params);   //extract sidebar param
         if ($sidebar_widget_skin) {
             //get change default sidebar skin, here we create 4 holder: sidebar_default, skin1,skin2,skin3
             $skin_data = HW_AWC_Sidebar_Settings::get_sidebar_setting($sidebar_widget_skin, $sidebar);
             HW_SKIN::apply_skin_data($skin_data, array($this, '_hw_skin_resume_skin_data'), array('sidebar' => $sidebar, 'sidebar_widget_skin' => $sidebar_widget_skin, 'sidebar_params' => &$sidebar_params));
             $sidebar_params = HW_AWC::format_widget_sidebar_params(null, $sidebar, array('classname' => 'hw-related-posts hw-awc-override', 'sidebar_params' => $sidebar_params));
         }
     }
     //check related content from widget config
     if (!empty($skin->widget_config)) {
         $widget_instance = AWC_WidgetFeature_saveconfig::get_widget_setting_instance($skin->widget_config, array('widget' => 'hw_taxonomy_post_list_widget', 'group' => 'main_loop'));
         //valid data
         if (!isset($widget_instance['query_data'])) {
             $widget_instance['query_data'] = 'current_context';
         }
         //get global $wp_query
         //override sidebar params from awc feature assign to widget
         if (isset($sidebar_params) && isset($sidebar)) {
             $sidebar_params = HW_AWC::format_sidebar_params($sidebar, $sidebar_params, $widget_instance);
         }
     }
     /**
      * display related content
      */
     if (!isset($widget_instance)) {
         extract($sidebar_params);
     }
     //extract sidebar param if not use HWTPL config
     if (isset($before_widget)) {
         echo $before_widget;
     }
     //widget title
     if (isset($before_title)) {
         echo $before_title;
     }
     echo apply_filters('hw_related_posts_title', $hwrp->title);
     if (isset($after_title)) {
         echo $after_title;
     }
     //do action before
     do_action('hoangweb_before_loop');
     do_action('hw_yarpp_results_before', $hwrp);
     if (isset($widget_instance)) {
         /**
          * output widget, when using the_widget to show widget content,
          * note that you set up & enable sidebar skin at /admin.php?page=hw_sidebar_widgets_settings this mean sidebar apply to yarpp it work for that skin
          * And no related to active sidebar that using on website, which call by function 'dynamic_sidebar' /hw_dynamic_sidebar
          */
         the_widget('HW_Taxonomy_Post_List_widget', $widget_instance, $sidebar_params);
     } else {
         if (isset($args['args']['template'])) {
             include $args['args']['template'];
         }
     }
     //do action after
     do_action('hw_yarpp_results_after', $hwrp);
     do_action('hoangweb_after_loop');
     if (isset($after_widget)) {
         echo $after_widget;
     }
     return false;
     //disable behavior as default $yarpp->display_related do
 }
Example #5
0
 /**
  * @param $aField
  * @return string
  */
 public function list_registers_sidebars($aField)
 {
     global $wp_registered_sidebars;
     $html = '<table border="1px" cellpadding="0px" cellspacing="0px">';
     $html .= '<tr>
         <th><strong>Tên</strong></th>
         <th><strong>Mô tả</strong></th>
         <th></th>
     </tr>';
     //HW_URL::curPageURL(['a'=>'A']);
     foreach ($wp_registered_sidebars as $sidebar) {
         if (!isset($sidebar['description'])) {
             $sidebar['description'] = '';
         }
         $edit_link = $this->get_setting_page_url('edit=' . $sidebar['id']);
         //edit sidebar
         $sidebar_customize_link = HW_AWC_Sidebar_Settings::get_edit_sidebar_setting_page_link($sidebar['id']);
         if (isset($sidebar['hw_can_delete'])) {
             $del_link = $this->get_setting_page_url('del_sidebar=' . $sidebar['id']);
             //hw_current_url();
         } else {
             $del_link = '';
         }
         $html .= '<tr>';
         if (isset($sidebar['hw_can_delete'])) {
             $html .= '<td><span style="color:green">' . $sidebar['name'] . '</span></td>';
         } else {
             $html .= '<td>' . $sidebar['name'] . '</td>';
         }
         $html .= '<td>' . $sidebar['description'] . '</td>';
         $html .= '<td>';
         //edit sidebar link
         $html .= '(<a href="' . $edit_link . '">Sửa</a>)';
         //customize sidebar link
         $html .= '(<a href="' . $sidebar_customize_link . '" target="_blank">Cấu hình</a>)';
         //unregister sidebar link
         if ($del_link) {
             $html .= '(<a href="javascript:void(0)" onclick="if(confirm(\'Bạn có chắc chắn ?\')) window.location.href=\'' . $del_link . '\'" >Xóa</a>)';
         }
         $html .= '</td>';
         $html .= '</tr>';
     }
     $html .= '</table>';
     return $html;
 }
  */
 echo '<td>';
 echo HW_UI_Component::build_select_tag($widgets_settings, $current_widgetconfig, array('name' => $aSkin_field_name . '[widget_config]', 'id' => $post_type . '_widget_config'));
 echo '</td>';
 /**
  * box sidebar
  */
 echo '<td>';
 echo HW_UI_Component::build_select_tag($sidebars, $current_box, array('name' => $aSkin_field_name . '[box_skin]', 'id' => $post_type . '_box_skin'));
 echo '</td>';
 /**
  * sidebar skins
  */
 echo '<td>';
 $sidebar_skins_data = array();
 $sidebar_skins = HW_AWC_Sidebar_Settings::available_widget_skins();
 foreach ($sidebar_skins as $theme_name => $opt) {
     $sidebar_skins_data[$theme_name] = $opt['title'];
 }
 echo HW_UI_Component::build_select_tag($sidebar_skins_data, $current_box_skin, array('name' => $aSkin_field_name . '[box_widget_skin]', 'id' => $post_type . '_box_widget_skin'));
 echo '</td>';
 /**
  * title
  */
 echo '<td><input type="text" name="' . $aSkin_field_name . '[title]" value="' . (isset($skins[$post_type]['title']) ? $skins[$post_type]['title'] : '') . '"/></td>';
 /**
  * get taxonomies terms assign to post type
  */
 echo '<td>';
 //echo '';
 foreach ($terms as $t) {
Example #7
0
 /**
  * main loop
  */
 public static function hw_theme_get_main()
 {
     //init
     //hw_taxonomy_post_list_widget widget setting
     $setting = array();
     //default sidebar params
     $sidebar_params = array('before_widget' => '<div id="%1$s" class="hw-widget %2$s *1" >', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title %1$s {css_title}">', 'after_title' => '</h3>');
     //override loop template base context
     $loop_temp = HW__Template::get_current_context_loop_template();
     global $wp_registered_sidebars;
     global $wp_registered_widgets;
     if (!empty($loop_temp)) {
         //$widg = AWC_WidgetFeature_saveconfig::get_widget_setting($loop_temp['widget_config']);
         $setting = AWC_WidgetFeature_saveconfig::get_widget_setting_instance($loop_temp['widget_config'], array('widget' => 'hw_taxonomy_post_list_widget', 'group' => 'main_loop'));
         //valid data
         if (!isset($setting['query_data'])) {
             $setting['query_data'] = 'current_context';
         }
         //get global $wp_query
         //$setting['widget_title'] = 'sdfgdg';  //set widget title by skin
         //get sidebar box
         if ($loop_temp['sidebar'] && isset($wp_registered_sidebars[$loop_temp['sidebar']])) {
             $sidebar = $loop_temp['sidebar'];
             //sidebar id
             $sidebar_params = $wp_registered_sidebars[$sidebar];
             if (isset($loop_temp['sidebar_widget_skin'])) {
                 $sidebar_widget_skin = $loop_temp['sidebar_widget_skin'];
                 //get change default sidebar skin, here we create 4 holder: sidebar_default, skin1,skin2,skin3
                 $skin_data = HW_AWC_Sidebar_Settings::get_sidebar_setting($sidebar_widget_skin, $sidebar);
                 HW_SKIN::apply_skin_data($skin_data, 'HW__Template::_hw_skin_resume_skin_data', array('sidebar' => $sidebar, 'sidebar_widget_skin' => $sidebar_widget_skin, 'sidebar_params' => &$sidebar_params));
             }
         }
         list($widget_id, $t) = each($wp_registered_widgets);
         //get first widget as demo
         $sidebar_params = HW_AWC::format_widget_sidebar_params($widget_id, $sidebar_params, array('classname' => 'main-content hw-awc-override', 'widget_id' => 'hw-main-loop-content'));
         //override sidebar params from awc feature assign to widget
         if (isset($sidebar_params) && isset($sidebar)) {
             $sidebar_params = HW_AWC::format_sidebar_params($sidebar, $sidebar_params, $setting);
         }
         //important: since any sidebar skin use wrapper class 'hw-awc-override'
         //$sidebar_params['before_widget'] = sprintf($sidebar_params['before_widget'], /*$widget_id, $classname*/'hw-main-loop-content','main-content hw-awc-override');
         do_action('hw_before_loop');
         /**
          * output widget, when using the_widget to show widget content,
          *
          * note that you set up & enable sidebar skin at /admin.php?page=hw_sidebar_widgets_settings this mean sidebar apply to yarpp it work for that skin
          * And no related to active sidebar that using on website, which call by function 'dynamic_sidebar' /hw_dynamic_sidebar
          */
         if (class_exists('HW_Taxonomy_Post_List_widget')) {
             the_widget('HW_Taxonomy_Post_List_widget', $setting, $sidebar_params);
         }
         do_action('hw_after_loop');
     } elseif (APF_Page_Templates::get_instance()->hw_loop_template()) {
         //do nothing
     } else {
         $context = HW__Template::get_current_template_file();
         //determine current template
         $current = self::get_current_template();
         if ($current && method_exists($current, 'Main')) {
             $current->Main();
             //display main content of current template
         }
         //filter default template
         do_action('hw_theme_get_main_default', $context);
     }
 }
 /**
  * check you theme exists function bind to this hook 'dynamic_sidebar_params' before use this.
  * @param array $params: sidebar widgets params
  */
 public function _hw_awc_widget_change_params($params)
 {
     global $wp_registered_widgets;
     global $wp_registered_sidebars;
     $this_id = $params[0]['id'];
     // Get the id for the current sidebar we're processing
     $widget_id = $params[0]['widget_id'];
     $widget_obj = $wp_registered_widgets[$widget_id];
     $widget_opt = get_option($widget_obj['callback'][0]->option_name);
     $widget_num = $widget_obj['params'][0]['number'];
     $arr_registered_widgets = wp_get_sidebars_widgets();
     // Get an array of ALL registered widgets
     if (!isset($arr_registered_widgets[$this_id]) || !is_array($arr_registered_widgets[$this_id])) {
         // Check if the current sidebar has no widgets
         return $params;
         // No widgets in this sidebar... bail early.
     }
     if (!is_active_sidebar($this_id)) {
         return $params;
     }
     //this sidebar should be actived
     $current_widget = $widget_opt[$widget_num];
     //get current widget
     //check if this sidebar have any modified from user setting
     $enable_override_sidebar = HW_AWC_Sidebar_Settings::get_sidebar_setting('enable_override_sidebar', $this_id);
     //parse settings
     if (isset($current_widget['bgcolor_widget'])) {
         $color_widget = self::valid_hex_color($current_widget['bgcolor_widget']);
     }
     //callback
     if (!is_admin()) {
         $wp_registered_widgets[$widget_id]['original_callback'] = $wp_registered_widgets[$widget_id]['callback'];
         $wp_registered_widgets[$widget_id]['callback'] = array($this, '_hw_custom_widget_callback_function');
     }
     /**
      * apply skin for specific widget
      */
     if ($enable_override_sidebar && isset($current_widget['widget_skin'])) {
         //get widget skin
         $skin_data = HW_AWC_Sidebar_Settings::get_sidebar_setting($current_widget['widget_skin'], $this_id);
         if (isset($skin_data['hash_skin'])) {
             $hash_skin = $skin_data['hash_skin'];
         }
         if (isset($skin_data['hwskin_config'])) {
             $skin_config = $skin_data['hwskin_config'];
         }
         if (isset($skin_config) && $skin_config && isset($hash_skin)) {
             $skin = HW_SKIN::resume_skin($skin_config);
             //resume HW_SKIN with given config
             if (method_exists($skin, 'get_skin_file')) {
                 $file = $skin->get_skin_file($hash_skin);
             }
             if (isset($file) && file_exists($file)) {
                 $theme = array();
                 //valid
                 include $file;
                 //don't use include_one or require_once, and don't create function in skin file because will cause duplicate function
                 $wp_registered_sidebars[$this_id]['skin'] = $skin;
                 //bring skin object into params
                 /**
                  * override sidebar param
                  */
                 if (isset($theme['params']) && is_array($theme['params'])) {
                     $params[0] = array_merge($params[0], $theme['params']);
                 }
                 /**
                  * this snipet from WP Core (wp-includes/widgets.php) - since version 4.0
                  * Substitute HTML id and class attributes into before_widget
                  */
                 $classname_ = self::format_widget_sidebar_params($widget_id);
                 $params[0]['before_widget'] = sprintf($params[0]['before_widget'], $widget_id, $classname_);
                 /**
                  * enqueue css & js -> depricated
                  */
                 /*if(!isset($theme['styles'])) $theme['styles'] = array();
                                     if(!isset($theme['scripts'])) $theme['scripts'] = array();
                 
                                     if(count($theme['styles']) || count($theme['scripts'])) {
                                         $skin->enqueue_files_from_skin($theme['styles'], $theme['scripts']);
                                     }*/
             }
         }
     }
     $params[0] = self::format_sidebar_params($this_id, $params[0], $current_widget);
     //$params[0] = array_merge($params[0], $new_params);
     /*clear widget title*/
     if (isset($current_widget['awc_clear_widget_title']) && $current_widget['awc_clear_widget_title']) {
         //clear before_title & after_title
         $params[0]['before_title'] = '';
         $params[0]['after_title'] = '';
         //valid HTML combine from before_widget + after_widget
         $tidyconfig = array('indent' => false, 'show-body-only' => true, 'clean' => false, 'output-xhtml' => true, 'input-xml' => true);
         $sign_str = '_______';
         $html = $params[0]['before_widget'] . $sign_str . $params[0]['after_widget'];
         $html = HW_String::tidy_cleaning($html, $tidyconfig, 'body');
         //hwawc_tidy_cleaning($html,$tidyconfig,'body');
         $t = explode($sign_str, $html);
         if (count($t) == 2) {
             $params[0]['before_widget'] = $t[0];
             //get new before widget
             $params[0]['after_widget'] = $t[1];
             //get new after_widget param
         }
     }
     /**
      * show widgets with order number
      */
     if ($enable_override_sidebar && HW_AWC_Sidebar_Settings::get_sidebar_setting('alphabe_widgets', $this_id)) {
         global $hwawc_widget_num;
         // Global a counter array
         if (!$hwawc_widget_num) {
             // If the counter array doesn't exist, create it
             $hwawc_widget_num = array();
         }
         if (isset($hwawc_widget_num[$this_id])) {
             // See if the counter array has an entry for this sidebar
             $hwawc_widget_num[$this_id]++;
         } else {
             // If not, create it starting with 1
             $hwawc_widget_num[$this_id] = 1;
         }
         $class_id = 'widget-' . $hwawc_widget_num[$this_id];
         $class = 'class="';
         // Add a widget number class for additional styling options
         //if(!$this->exists_class($class_id, $params[0]['before_widget'])) {
         $class .= $class_id . ' ';
         //}
         if ($hwawc_widget_num[$this_id] == 1) {
             // If this is the first widget
             //if(!$this->exists_class('widget-first', $params[0]['before_widget']))
             $class .= 'widget-first ';
         } elseif ($hwawc_widget_num[$this_id] == count($arr_registered_widgets[$this_id])) {
             // If this is the last widget
             //if(!$this->exists_class('widget-last', $params[0]['before_widget']))
             $class .= 'widget-last ';
         }
         $params[0]['before_widget'] = str_replace('class="', $class, $params[0]['before_widget']);
         // Insert our new classes into "before widget"
     }
     //finally
     if ($enable_override_sidebar) {
         //mark modify before_widget class by adding new class for this plugin to prevent conflict other css in your theme
         $params[0]['before_widget'] = str_replace('class="', 'class="hw-awc-override ', $params[0]['before_widget']);
     }
     return $params;
 }
 /**
  * The pre-defined validation callback method.
  *
  * The following hooks are available:
  *	- validation_{instantiated class name}_{field id} – [3.0.0+] receives the form submission value of the field that does not have a section. The first parameter: ( string|array ) submitted input value. The second parameter: ( string|array ) the old value stored in the database.
  *	- validation_{instantiated class name}_{section_id}_{field id} – [3.0.0+] receives the form submission value of the field that has a section. The first parameter: ( string|array ) submitted input value. The second parameter: ( string|array ) the old value stored in the database.
  *	- validation_{instantiated class name}_{section id} – [3.0.0+] receives the form submission values that belongs to the section.. The first parameter: ( array ) the array of submitted input values that belong to the section. The second parameter: ( array ) the array of the old values stored in the database.
  *	- validation_{page slug}_{tab slug} – receives the form submission values as array. The first parameter: submitted input array. The second parameter: the original array stored in the database.
  *	- validation_{page slug} – receives the form submission values as array. The first parameter: submitted input array. The second parameter: the original array stored in the database.
  *	- validation_{instantiated class name} – receives the form submission values as array. The first parameter: submitted input array. The second parameter: the original array stored in the database.
  */
 public function validation_HW_Sidebar_Settings($aInput, $aOldInput)
 {
     $enable_override_sidebar = HW_AWC_Sidebar_Settings::create_fieldname4sidebar('enable_override_sidebar', true);
     $status = isset($aInput[$enable_override_sidebar]) && $aInput[$enable_override_sidebar] ? '1' : '0';
     //disable preload stuff for skin
     //save current skin for enqueue
     //more skins
     $widget_skins = HW_AWC_Sidebar_Settings::available_widget_skins();
     foreach ($widget_skins as $name => $field) {
         $skin_field = HW_AWC_Sidebar_Settings::create_fieldname4sidebar($name, true);
         //also fixed sidebar name
         if (!empty($aInput[$skin_field])) {
             if (isset($aInput[$skin_field]['hash_skin']) && isset($aInput[$skin_field]['hwskin_config'])) {
                 $skin = APF_hw_skin_Selector_hwskin::resume_hwskin_instance($aInput[$skin_field]);
                 //
                 $skin->instance->save_skin_assets(array('skin' => $aInput[$skin_field], 'object' => 'sidebar-setting-' . $skin_field, 'status' => $status));
             }
         }
     }
     return $aInput;
 }