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 -98 1.19.00.2.0 View file →
@@ -2,14 +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.19.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: 9.9
11 - * Requires PHP: 7.4
10 + * WC tested up to: 5.7.1
12 11 */
13 12
14 13 defined( 'ABSPATH' ) || exit;
15 14
@@ -19,14 +18,14 @@
19 18 class Orderable {
20 19 /**
21 20 * @var string Plugin version.
22 21 */
23 - public static $version = '1.19.0';
22 + public static $version = '0.2.0';
24 23
25 24 /**
26 25 * @var string Required pro version.
27 26 */
28 - public static $required_pro_version = '1.17.0';
27 + public static $required_pro_version = '0.2.0';
29 28
30 29 /**
31 30 * Construct the plugin.
32 31 */
@@ -34,23 +33,8 @@
34 33 $this->define_constants();
35 34
36 35 add_action( 'init', array( $this, 'load_textdomain' ), 0 );
37 36 add_action( 'plugins_loaded', array( $this, 'run' ), 20 );
38 -
39 - // Redirect to settings page on activate.
40 - add_action( 'activated_plugin', array( $this, 'activate' ), 20 );
41 -
42 - // Declare compatibility with High-Performance Order Storage (HPOS).
43 - add_action(
44 - 'before_woocommerce_init',
45 - function() {
46 - if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
47 - \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
48 - }
49 - }
50 - );
51 -
52 - add_action( 'woocommerce_blocks_loaded', array( $this, 'load_woocommerce_blocks' ) );
53 37 }
54 38
55 39 /**
56 40 * Load Textdomain.
@@ -62,18 +46,17 @@
62 46 /**
63 47 * Run.
64 48 */
65 49 public function run() {
66 - 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 ) ) ) {
67 52 add_action( 'admin_notices', array( __CLASS__, 'orderable_notice_woocommerce' ) );
68 53
69 - // If Woo is not active, don't run Orderable.
70 54 return;
71 55 }
72 56
73 57 $this->load_classes();
74 58 $this->update_check();
75 - Orderable_Database::run();
76 59
77 60 if ( ! $this->validate_pro_version() ) {
78 61 add_action( 'admin_notices', array( __CLASS__, 'orderable_notice_pro_version' ) );
79 62
@@ -83,35 +66,8 @@
83 66 do_action( 'orderable_init' );
84 67 }
85 68
86 69 /**
87 - * Run when plugin activated.
88 - *
89 - * @param $plugin
90 - *
91 - * @return void
92 - */
93 - public function activate( $plugin ) {
94 - if ( ! self::is_woo_active() ) {
95 - return;
96 - }
97 -
98 - $checked = isset( $_REQUEST['checked'] ) ? $_REQUEST['checked'] : array();
99 -
100 - // Ensure we are not doing a bulk activation.
101 - if ( is_array( $checked ) && count( $checked ) > 1 ) {
102 - return;
103 - }
104 -
105 - if ( ORDERABLE_BASENAME !== $plugin ) {
106 - return;
107 - }
108 -
109 - wp_redirect( admin_url( 'admin.php?page=orderable-settings' ) );
110 - exit;
111 - }
112 -
113 - /**
114 70 * Run script sif plugin version has changed.
115 71 */
116 72 private function update_check() {
117 73 if ( ORDERABLE_VERSION === get_site_option( 'orderable_version' ) ) {
@@ -163,9 +119,8 @@
163 119 $this->define( 'ORDERABLE_TPL_PATH', ORDERABLE_PATH . 'templates/' );
164 120 $this->define( 'ORDERABLE_BASENAME', plugin_basename( __FILE__ ) );
165 121 $this->define( 'ORDERABLE_LANGUAGES_PATH', dirname( ORDERABLE_BASENAME ) . '/languages/' );
166 122 $this->define( 'ORDERABLE_VERSION', self::$version );
167 - $this->define( 'ORDERABLE_CACHE_EXPIRATION_TIME', 5 * MINUTE_IN_SECONDS );
168 123 }
169 124
170 125 /**
171 126 * Define constant if not already set.
@@ -182,9 +137,8 @@
182 137 /**
183 138 * Load classes.
184 139 */
185 140 private function load_classes() {
186 - require_once ORDERABLE_INC_PATH . 'database/class-database.php';
187 141 require_once ORDERABLE_INC_PATH . 'class-helpers.php';
188 142 require_once ORDERABLE_INC_PATH . 'class-settings.php';
189 143 require_once ORDERABLE_INC_PATH . 'class-modules.php';
190 144 require_once ORDERABLE_INC_PATH . 'class-assets.php';
@@ -191,13 +145,8 @@
191 145 require_once ORDERABLE_INC_PATH . 'class-products.php';
192 146 require_once ORDERABLE_INC_PATH . 'class-ajax.php';
193 147 require_once ORDERABLE_INC_PATH . 'class-orders.php';
194 148 require_once ORDERABLE_INC_PATH . 'class-admin-notices.php';
195 - require_once ORDERABLE_INC_PATH . 'class-webhooks.php';
196 - require_once ORDERABLE_INC_PATH . 'class-shortcodes.php';
197 - require_once ORDERABLE_INC_PATH . 'class-ask-review.php';
198 - require_once ORDERABLE_INC_PATH . 'class-integrations.php';
199 - require_once ORDERABLE_INC_PATH . 'class-compat-flux-checkout.php';
200 149
201 150 Orderable_Settings::run();
202 151 Orderable_Assets::run();
203 152 Orderable_Modules::run();
@@ -202,12 +151,9 @@
202 151 Orderable_Assets::run();
203 152 Orderable_Modules::run();
204 153 Orderable_Products::run();
205 154 Orderable_Ajax::run();
206 - Orderable_Shortcodes::run();
207 - Orderable_Ask_Review::run();
208 - Orderable_Integrations::run();
209 - Orderable_Compat_Flux_Checkout::run();
155 + Orderable_Admin_Notices::run();
210 156 }
211 157
212 158 /**
213 159 * Validate the Orderable core version number.
@@ -222,45 +168,8 @@
222 168
223 169 $pro_version = explode( '-', ORDERABLE_PRO_VERSION );
224 170
225 171 return version_compare( $pro_version[0], self::$required_pro_version, '>=' );
226 - }
227 -
228 - /**
229 - * Is Woo active.
230 - *
231 - * @return bool
232 - */
233 - public static function is_woo_active() {
234 - return in_array( 'woocommerce/woocommerce.php', (array) apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ) ||
235 - in_array( 'woocommerce/woocommerce.php', array_keys( (array) get_site_option( 'active_sitewide_plugins' ), true ) );
236 - }
237 -
238 - /**
239 - * Load WooCommerce blocks.
240 - *
241 - * @return void
242 - */
243 - public function load_woocommerce_blocks() {
244 - require_once ORDERABLE_MODULES_PATH . 'checkout/blocks/order-date/class-checkout-order-date-blocks-integration.php';
245 - require_once ORDERABLE_MODULES_PATH . 'checkout/blocks/order-date/class-checkout-order-date-extend-store-api.php';
246 -
247 - add_action(
248 - 'woocommerce_blocks_checkout_block_registration',
249 - function( $integration_registry ) {
250 - $integration_registry->register( new Checkout_Order_Date_Blocks_Integration() );
251 - }
252 - );
253 -
254 - woocommerce_store_api_register_endpoint_data( Checkout_Order_Date_Extend_Store_API::extend_cart_schema() );
255 - woocommerce_store_api_register_endpoint_data( Checkout_Order_Date_Extend_Store_API::extend_checkout_schema() );
256 -
257 - add_action(
258 - 'woocommerce_store_api_checkout_update_order_from_request',
259 - array( 'Checkout_Order_Date_Blocks_Integration', 'save_order_service_date_fields' ),
260 - 10,
261 - 2
262 - );
263 172 }
264 173 }
265 174
266 175 $orderable = new Orderable();