PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 2.3.2
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v2.3.2
2.3.2 2.3.1 2.3.0 2.2.8 2.2.7 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.11.1 1.11.2 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 1.9.10 1.9.11 All 60 releases
← All changes | inc/class-merchant-loader.php +37 -0 2.2.72.3.2 View file →
@@ -32,8 +32,10 @@
32 32 public function __construct() {
33 33 // Includes.
34 34 $this->includes();
35 35
36 + add_action( 'plugins_loaded', array( $this, 'maybe_define_awl_constant' ), 5 );
37 +
36 38 // Register scripts.
37 39 add_action( 'wp_enqueue_scripts', array( $this, 'register_global_js_and_css' ) );
38 40
39 41 // Enqueue scripts.
@@ -46,8 +48,11 @@
46 48 add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
47 49
48 50 // Add settings link to the plugin screen.
49 51 add_filter( 'plugin_action_links_' . plugin_basename( MERCHANT_DIR . 'merchant.php' ), array( $this, 'settings_link' ) );
52 +
53 + // WP Abilities API integration.
54 + add_action( 'plugins_loaded', array( $this, 'load_abilities_bootstrap' ), 20 );
50 55 }
51 56
52 57 /**
53 58 * Include required classes.
@@ -156,8 +161,23 @@
156 161 do_action( 'merchant_admin_after_include_modules_classes' );
157 162 }
158 163
159 164 /**
165 + * Define MERCHANT_AWL_ACTIVE when White Label is applied.
166 + *
167 + * @return void
168 + */
169 + public function maybe_define_awl_constant() {
170 + if ( defined( 'MERCHANT_AWL_ACTIVE' ) ) {
171 + return;
172 + }
173 +
174 + if ( merchant_white_label_is_applied() ) {
175 + define( 'MERCHANT_AWL_ACTIVE', true );
176 + }
177 + }
178 +
179 + /**
160 180 * Add to body class.
161 181 */
162 182 public function add_body_class( $classes ) {
163 183 $theme = wp_get_theme();
@@ -166,8 +186,25 @@
166 186
167 187 $classes[] = 'merchant-theme-' . strtolower( esc_attr( $theme_name ) );
168 188
169 189 return $classes;
190 + }
191 +
192 + /**
193 + * Bootstrap the WP Abilities API integration.
194 + *
195 + * Only loads on WordPress 6.9+ where the Abilities API exists.
196 + * Zero overhead on older WordPress versions.
197 + *
198 + * @since 2.3.0
199 + */
200 + public function load_abilities_bootstrap() {
201 + if ( ! function_exists( 'wp_register_ability' ) ) {
202 + return;
203 + }
204 +
205 + require_once MERCHANT_DIR . 'inc/abilities/class-merchant-abilities-bootstrap.php';
206 + Merchant_Abilities_Bootstrap::init();
170 207 }
171 208
172 209 /**
173 210 * Show row meta on the plugin screen.