PluginProbe
Orderable – Restaurant & Food Ordering System / 0.2.0
Orderable – Restaurant & Food Ordering System v0.2.0
0.1.4 0.1.5 0.2.0 1.0.0 1.1.0 1.1.1 1.10.0 1.10.1 1.11.0 1.12.0 1.12.1 1.12.2 1.13.0 1.14.0 1.15.0 1.16.0 1.17.0 1.17.1 1.18.0 1.19.0 1.19.1 1.19.2 1.2.0 1.20.0 1.20.1 All 44 releases
← All changes | orderable.php +7 -94 1.14.00.2.0 View file →
@@ -2,13 +2,13 @@
2 2 /**
3 3 * Plugin Name: Orderable - Local Ordering System
4 4 * Author URI: https://orderable.com
5 5 * Description: Take local online ordering to a whole new level with Orderable.
6 - * Version: 1.14.0
6 + * Version: 0.2.0
7 7 * Author: Orderable
8 8 * Text Domain: orderable
9 9 * WC requires at least: 5.4.0
10 - * WC tested up to: 8.9
10 + * WC tested up to: 5.7.1
11 11 */
12 12
13 13 defined( 'ABSPATH' ) || exit;
14 14
@@ -18,14 +18,14 @@
18 18 class Orderable {
19 19 /**
20 20 * @var string Plugin version.
21 21 */
22 - public static $version = '1.14.0';
22 + public static $version = '0.2.0';
23 23
24 24 /**
25 25 * @var string Required pro version.
26 26 */
27 - public static $required_pro_version = '1.14.0';
27 + public static $required_pro_version = '0.2.0';
28 28
29 29 /**
30 30 * Construct the plugin.
31 31 */
@@ -33,23 +33,8 @@
33 33 $this->define_constants();
34 34
35 35 add_action( 'init', array( $this, 'load_textdomain' ), 0 );
36 36 add_action( 'plugins_loaded', array( $this, 'run' ), 20 );
37 -
38 - // Redirect to settings page on activate.
39 - add_action( 'activated_plugin', array( $this, 'activate' ), 20 );
40 -
41 - // Declare compatibility with High-Performance Order Storage (HPOS).
42 - add_action(
43 - 'before_woocommerce_init',
44 - function() {
45 - if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
46 - \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
47 - }
48 - }
49 - );
50 -
51 - add_action( 'woocommerce_blocks_loaded', array( $this, 'load_woocommerce_blocks' ) );
52 37 }
53 38
54 39 /**
55 40 * Load Textdomain.
@@ -61,18 +46,17 @@
61 46 /**
62 47 * Run.
63 48 */
64 49 public function run() {
65 - if ( ! self::is_woo_active() ) {
50 + if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true )
51 + && ! in_array( 'woocommerce/woocommerce.php', array_keys( get_site_option( 'active_sitewide_plugins' ), true ) ) ) {
66 52 add_action( 'admin_notices', array( __CLASS__, 'orderable_notice_woocommerce' ) );
67 53
68 - // If Woo is not active, don't run Orderable.
69 54 return;
70 55 }
71 56
72 57 $this->load_classes();
73 58 $this->update_check();
74 - Orderable_Database::run();
75 59
76 60 if ( ! $this->validate_pro_version() ) {
77 61 add_action( 'admin_notices', array( __CLASS__, 'orderable_notice_pro_version' ) );
78 62
@@ -82,35 +66,8 @@
82 66 do_action( 'orderable_init' );
83 67 }
84 68
85 69 /**
86 - * Run when plugin activated.
87 - *
88 - * @param $plugin
89 - *
90 - * @return void
91 - */
92 - public function activate( $plugin ) {
93 - if ( ! self::is_woo_active() ) {
94 - return;
95 - }
96 -
97 - $checked = isset( $_REQUEST['checked'] ) ? $_REQUEST['checked'] : array();
98 -
99 - // Ensure we are not doing a bulk activation.
100 - if ( is_array( $checked ) && count( $checked ) > 1 ) {
101 - return;
102 - }
103 -
104 - if ( ORDERABLE_BASENAME !== $plugin ) {
105 - return;
106 - }
107 -
108 - wp_redirect( admin_url( 'admin.php?page=orderable-settings' ) );
109 - exit;
110 - }
111 -
112 - /**
113 70 * Run script sif plugin version has changed.
114 71 */
115 72 private function update_check() {
116 73 if ( ORDERABLE_VERSION === get_site_option( 'orderable_version' ) ) {
@@ -180,9 +137,8 @@
180 137 /**
181 138 * Load classes.
182 139 */
183 140 private function load_classes() {
184 - require_once ORDERABLE_INC_PATH . 'database/class-database.php';
185 141 require_once ORDERABLE_INC_PATH . 'class-helpers.php';
186 142 require_once ORDERABLE_INC_PATH . 'class-settings.php';
187 143 require_once ORDERABLE_INC_PATH . 'class-modules.php';
188 144 require_once ORDERABLE_INC_PATH . 'class-assets.php';
@@ -189,12 +145,8 @@
189 145 require_once ORDERABLE_INC_PATH . 'class-products.php';
190 146 require_once ORDERABLE_INC_PATH . 'class-ajax.php';
191 147 require_once ORDERABLE_INC_PATH . 'class-orders.php';
192 148 require_once ORDERABLE_INC_PATH . 'class-admin-notices.php';
193 - require_once ORDERABLE_INC_PATH . 'class-webhooks.php';
194 - require_once ORDERABLE_INC_PATH . 'class-shortcodes.php';
195 - require_once ORDERABLE_INC_PATH . 'class-ask-review.php';
196 - require_once ORDERABLE_INC_PATH . 'class-integrations.php';
197 149
198 150 Orderable_Settings::run();
199 151 Orderable_Assets::run();
200 152 Orderable_Modules::run();
@@ -199,11 +151,9 @@
199 151 Orderable_Assets::run();
200 152 Orderable_Modules::run();
201 153 Orderable_Products::run();
202 154 Orderable_Ajax::run();
203 - Orderable_Shortcodes::run();
204 - Orderable_Ask_Review::run();
205 - Orderable_Integrations::run();
155 + Orderable_Admin_Notices::run();
206 156 }
207 157
208 158 /**
209 159 * Validate the Orderable core version number.
@@ -218,45 +168,8 @@
218 168
219 169 $pro_version = explode( '-', ORDERABLE_PRO_VERSION );
220 170
221 171 return version_compare( $pro_version[0], self::$required_pro_version, '>=' );
222 - }
223 -
224 - /**
225 - * Is Woo active.
226 - *
227 - * @return bool
228 - */
229 - public static function is_woo_active() {
230 - return in_array( 'woocommerce/woocommerce.php', (array) apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ) ||
231 - in_array( 'woocommerce/woocommerce.php', array_keys( (array) get_site_option( 'active_sitewide_plugins' ), true ) );
232 - }
233 -
234 - /**
235 - * Load WooCommerce blocks.
236 - *
237 - * @return void
238 - */
239 - public function load_woocommerce_blocks() {
240 - require_once ORDERABLE_MODULES_PATH . 'checkout/blocks/order-date/class-checkout-order-date-blocks-integration.php';
241 - require_once ORDERABLE_MODULES_PATH . 'checkout/blocks/order-date/class-checkout-order-date-extend-store-api.php';
242 -
243 - add_action(
244 - 'woocommerce_blocks_checkout_block_registration',
245 - function( $integration_registry ) {
246 - $integration_registry->register( new Checkout_Order_Date_Blocks_Integration() );
247 - }
248 - );
249 -
250 - woocommerce_store_api_register_endpoint_data( Checkout_Order_Date_Extend_Store_API::extend_cart_schema() );
251 - woocommerce_store_api_register_endpoint_data( Checkout_Order_Date_Extend_Store_API::extend_checkout_schema() );
252 -
253 - add_action(
254 - 'woocommerce_store_api_checkout_update_order_from_request',
255 - array( 'Checkout_Order_Date_Blocks_Integration', 'save_order_service_date_fields' ),
256 - 10,
257 - 2
258 - );
259 172 }
260 173 }
261 174
262 175 $orderable = new Orderable();