AllaerdWoocsvOptions

Class woocsv_options.

Defined (1)

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

/include/Options.php  
  1. class Options 
  2. /** 
  3. * @var array 
  4. */ 
  5. public $options = array ( 
  6. 'woocsv_add_to_categories' => 1,  
  7. 'woocsv_blocksize' => 'auto',  
  8. 'woocsv_convert_to_utf8' => 0,  
  9. 'woocsv_debug' => 0,  
  10. 'woocsv_match_author_by' => 'email',  
  11. 'woocsv_match_by' => 'sku',  
  12. 'woocsv_merge_products' => 1,  
  13. 'woocsv_roles' => array ( 'shop_manager' ),  
  14. 'woocsv_separator' => ';',  
  15. 'woocsv_skip_first_line' => 1,  
  16. 'woocsv_curl_followlocation' => 0,  
  17. ); 
  18.  
  19. /** 
  20. * @param $name 
  21. * @return bool|mixed|void 
  22. */ 
  23. public function get ( $name ) 
  24. if ( !key_exists ( $name, $this->options ) ) 
  25. return false; 
  26.  
  27. return get_option ( $name ); 
  28.  
  29. /** 
  30. * @param $name 
  31. * @param $value 
  32. * @return bool 
  33. */ 
  34. public function saveOption ( $name, $value ) 
  35. if ( in_array ( $name, $this->options ) ) 
  36. return false; 
  37.  
  38. return update_option ( $name, $value ); 
  39.  
  40. /** 
  41. */ 
  42. public function saveDefaultOptionsAndValues () 
  43. foreach ( $this->options as $key => $value ) 
  44. add_option ( $key, $value ); 
  45.