/**
  * fields values validation
  * @param $values
  * @return mixed|void
  */
 public function validation_tab_filter($values)
 {
     //var_dump($values);
     //var_dump($this->create_field_name('upload'));
     APF_hw_upload_field::do_form_action($values, $this->create_field_name('uploader'));
     //return array(); //not save any fields value
     //exit(); //the way allow ajax upload work, no any output allow here, if you not specific upload handle
     if (hw__post('s')) {
         $_REQUEST['s'] = hw__post('s');
         HW_SESSION::save_session('search_module', hw__post('s'));
     }
     return $values;
     //allow to save fields value
 }
 /**
  * get addition data  in segment
  * @param $task
  */
 public static function get_option($key)
 {
     $data = hw__post('addition_data');
     if (is_array($data) && isset($data[$key])) {
         return $data[$key];
     }
     return false;
 }
 /**
  * Process a settings export that generates a .json file of the shop settings
  * @hook admin_init
  */
 public function _wxr_process_settings_export()
 {
     if (empty($_POST['hw_wxr_action']) || 'export_settings' != $_POST['hw_wxr_action']) {
         return;
     }
     if (!wp_verify_nonce($_POST['hw_wxr_export_nonce'], 'hw_wxr_export_nonce')) {
         return;
     }
     if (!current_user_can('manage_options')) {
         return;
     }
     //module to export
     $module_slug = hw__post('module');
     if ($module_slug) {
         $module = $this->get_module($module_slug);
         //get module options
         if ($module) {
             $settings = $module->export();
         }
     }
     if (empty($settings)) {
         $settings = array();
     }
     //output data to file
     ignore_user_abort(true);
     nocache_headers();
     $this->exporter->export();
     /*header( 'Content-Type: application/json; charset=utf-8' );
       header( 'Content-Disposition: attachment; filename=hw-settings-export-'.$module_slug.'-' . date( 'm-d-Y' ) . '.json' );
       header( "Expires: 0" );
       echo json_encode( $settings );*/
     exit;
 }
 /**
  * return num of files to upload
  * @return string
  */
 public static function get_files_num()
 {
     return hw__post(__CLASS__ . '_files_num', 0);
 }