|
13 | 13 | * WC tested up to: 3.2.6 |
14 | 14 | */ |
15 | 15 |
|
16 | | -define('WC_CUSTOM_ORDER_TABLE_URL', plugin_dir_url(__FILE__)); |
17 | | -define('WC_CUSTOM_ORDER_TABLE_PATH', plugin_dir_path(__FILE__)); |
| 16 | +/* Define constants to use throughout the plugin. */ |
| 17 | +define( 'WC_CUSTOM_ORDER_TABLE_URL', plugin_dir_url( __FILE__ ) ); |
| 18 | +define( 'WC_CUSTOM_ORDER_TABLE_PATH', plugin_dir_path( __FILE__ ) ); |
18 | 19 |
|
| 20 | +/* Load includes via a PHP 5.2-compatible autoloader. */ |
19 | 21 | if ( file_exists( WC_CUSTOM_ORDER_TABLE_PATH . 'vendor/autoload_52.php' ) ) { |
20 | | - require( WC_CUSTOM_ORDER_TABLE_PATH . 'vendor/autoload_52.php' ); |
| 22 | + require( WC_CUSTOM_ORDER_TABLE_PATH . 'vendor/autoload_52.php' ); |
21 | 23 | } |
22 | 24 |
|
| 25 | +/** |
| 26 | + * Installation procedure for the plugin. |
| 27 | + * |
| 28 | + * This function is responsible for creating the new plugin database tables. |
| 29 | + */ |
23 | 30 | function wc_custom_order_table_install() { |
24 | | - $installer = new WC_Custom_Order_Table_Install(); |
25 | | - register_activation_hook( __FILE__, array( $installer, 'activate' ) ); |
| 31 | + $installer = new WC_Custom_Order_Table_Install(); |
| 32 | + register_activation_hook( __FILE__, array( $installer, 'activate' ) ); |
26 | 33 | } |
27 | 34 |
|
28 | 35 | register_activation_hook( __FILE__, 'wc_custom_order_table_install' ); |
29 | 36 |
|
30 | 37 | /** |
31 | | - * @return WC_Custom_Order_Table |
| 38 | + * Retrieve an instance of the WC_Custom_Order_Table class. |
| 39 | + * |
| 40 | + * If one has not yet been instantiated, it will be created. |
| 41 | + * |
| 42 | + * @global $wc_custom_order_table |
| 43 | + * |
| 44 | + * @return WC_Custom_Order_Table The global WC_Custom_Order_Table instance. |
32 | 45 | */ |
33 | 46 | function wc_custom_order_table() { |
34 | 47 | global $wc_custom_order_table; |
35 | 48 |
|
36 | | - if( ! $wc_custom_order_table instanceof WC_Custom_Order_Table ) { |
| 49 | + if ( ! $wc_custom_order_table instanceof WC_Custom_Order_Table ) { |
37 | 50 | $wc_custom_order_table = new WC_Custom_Order_Table; |
38 | 51 | $wc_custom_order_table->setup(); |
39 | 52 | } |
|
0 commit comments