WooCommerce_simply_order_export

The WooCommerce Simply Order Export WooCommerce simply order export class.

Defined (1)

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

/main.php  
  1. class WooCommerce_simply_order_export { 
  2.  
  3. /** 
  4. * @var string 
  5. */ 
  6. public $version = '2.0.7'; 
  7.  
  8. /** 
  9. * Constructor 
  10. */ 
  11. function __construct() { 
  12.  
  13. /** 
  14. * Fires this function when plugin gets activated. 
  15. */ 
  16. register_activation_hook( __FILE__, array( __CLASS__, 'install' ) ); 
  17. $this->define_constants(); 
  18. $this->includes(); 
  19. add_action( 'init', array($this, 'init') ); 
  20.  
  21. /** 
  22. * Fires at 'init' hook 
  23. */ 
  24. function init() { 
  25.  
  26. $this->load_plugin_textdomain(); 
  27. $this->set_variables(); 
  28. $this->instantiate(); 
  29.  
  30. /** 
  31. * Call notice function, only if this is the first time plugin has been installed. 
  32. */ 
  33. wsoe_call_notices_func(); 
  34.  
  35. /** 
  36. * Load locale 
  37. */ 
  38. function load_plugin_textdomain() { 
  39.  
  40. load_plugin_textdomain( 'woocommerce-simply-order-export', false, plugin_basename( dirname( __FILE__ ) ) . "/languages" ); 
  41.  
  42. /** 
  43. * Sets the variables 
  44. */ 
  45. function __set( $name, $value ) { 
  46.  
  47. /** 
  48. * Check for valid names 
  49. */ 
  50. if( in_array( $name, array( 'wpg_order_export', 'wpg_order_columns' ) ) ) {  
  51. $GLOBALS[$name] = $value; 
  52.  
  53. /** 
  54. * Define all constants 
  55. */ 
  56. function define_constants() { 
  57.  
  58. define( 'OE_URL', plugins_url('', __FILE__) ); /** plugin url */ 
  59. define( 'OE_CSS', OE_URL. "/assets/css/" ); /** Define all necessary variables first */ 
  60. define( 'OE_JS', OE_URL. "/assets/js/" ); 
  61. define( 'OE_IMG', OE_URL. "/assets/img/" ); 
  62.  
  63. /** 
  64. * Set necessary variables. 
  65. */ 
  66. function set_variables() { 
  67.  
  68. $this->wpg_order_columns = apply_filters( 'wpg_order_columns', array( 
  69. 'wc_settings_tab_order_id'=>__( 'Order ID', 'woocommerce-simply-order-export' ),  
  70. 'wc_settings_tab_customer_name'=>__( 'Customer Name', 'woocommerce-simply-order-export' ),  
  71. 'wc_settings_tab_product_name'=>__( 'Product Name', 'woocommerce-simply-order-export' ),  
  72. 'wc_settings_tab_product_quantity'=>__( 'Product Quantity', 'woocommerce-simply-order-export' ),  
  73. 'wc_settings_tab_product_variation'=>__( 'Variation details', 'woocommerce-simply-order-export' ),  
  74. 'wc_settings_tab_amount'=> __( 'Order Amount', 'woocommerce-simply-order-export' ),  
  75. 'wc_settings_tab_customer_email'=> __( 'Customer Email', 'woocommerce-simply-order-export' ),  
  76. 'wc_settings_tab_customer_phone'=>__( 'Phone Number', 'woocommerce-simply-order-export' ),  
  77. 'wc_settings_tab_order_status'=>__( 'Order Status', 'woocommerce-simply-order-export' ) 
  78. ); 
  79.  
  80. /** 
  81. * Include helper classes 
  82. */ 
  83. function includes() { 
  84. // Includes PHP files located in 'lib' and 'classes' folder 
  85. foreach( array_merge( glob ( dirname(__FILE__). "/lib/*.php" ), glob ( dirname(__FILE__). "/classes/*.php" ) ) as $lib_filename ) { 
  86. require_once( $lib_filename ); 
  87.   
  88. /** 
  89. * Runs when plugin is activated. 
  90. */ 
  91. function install() { 
  92.  
  93. ob_start(); 
  94.  
  95. global $wpg_order_columns; 
  96.  
  97. $wpg_order_columns = is_array($wpg_order_columns) ? $wpg_order_columns : array(); 
  98.  
  99. foreach( $wpg_order_columns as $key=>$val ) { 
  100.  
  101. $option = get_option( $key, null ); 
  102. if( empty( $option ) ) { 
  103. update_option($key, 'yes'); 
  104.  
  105. ob_end_clean(); 
  106.  
  107. /** 
  108. * Instantiate necessary classes. 
  109. */ 
  110. function instantiate() { 
  111.  
  112. $this->wpg_order_export = new wpg_order_export(); 
  113.