skipv1_0_0Import_Button

The Facebook Fanpage Import skip v1 0 Import Button class.

Defined (1)

The class is defined in the following location(s).

/includes/skip/elements/forms/import.php  
  1. class Import_Button extends WP_Fileuploader{ 
  2. /** 
  3. * Constructor 
  4. * @package Skip 
  5. * @since 1.0 
  6. *  
  7. * @param string $name Name of colorfield 
  8. * @param array $args Array of [ $id , $extra Extra colorfield code, option_groupOption group to save data, $before_textfield Code before colorfield, $after_textfield Code after colorfield ] 
  9. */ 
  10. function __construct( $name, $args = array() ) { 
  11. global $post, $skip_form_instance_option_group; 
  12.  
  13. $defaults = array( 
  14. 'id' => substr( md5 ( time() * rand() ), 0, 10 ),  
  15. 'extra' => '',  
  16. 'before_element' => '',  
  17. 'uploader' => 'file',  
  18. 'after_element' => '',  
  19. 'option_group' => $skip_form_instance_option_group 
  20. ); 
  21.  
  22. // Adding file actions 
  23. // add_filter( 'sanitize_option_' . $skip_form_instance_option_group . '_values', array( $this , 'validate_actions' ), 9999 ); 
  24.  
  25. $args = wp_parse_args( $args, $defaults ); 
  26. extract( $args , EXTR_SKIP ); 
  27.  
  28. $this->id = $id; 
  29. $this->delete = TRUE; 
  30. $this->insert_attachement = FALSE; 
  31.  
  32. $this->done_import = FALSE; 
  33.  
  34. parent::__construct( $name, $args ); 
  35.  
  36. function validate_actions( $input ) { 
  37. global $skip_form_instance_option_group; 
  38.  
  39. // If error occured 
  40. if( $_FILES[ $skip_form_instance_option_group . '_values' ][ 'error' ][ $this->wp_name ] != 0 ) { 
  41. $input[ $this->wp_name ] = $this->value; 
  42.  
  43. }else{ 
  44. $file[ 'tmp_name' ] = $_FILES[ $skip_form_instance_option_group . '_values' ][ 'tmp_name' ][ $this->wp_name ]; 
  45. $input = import_values( $skip_form_instance_option_group, $file[ 'tmp_name' ] );  
  46.  
  47. return $input; 
  48.  
  49. function get_html() { 
  50. $import_button = form_button( __( 'Import settings', 'skip_framework' ), array( 'name' => 'import_settings' ) );  
  51. $this->after_element = $import_button . $this->after_element; 
  52. $html = parent::get_html(); 
  53.  
  54. return $html;