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 | admin/classes/class-merchant-admin-menu.php +19 -47 2.2.82.3.2 View file →
@@ -33,16 +33,18 @@
33 33 * Constructor.
34 34 *
35 35 */
36 36 public function __construct() {
37 - if ( defined( 'MERCHANT_AWL_ACTIVE' ) ) {
37 + if ( function_exists( 'merchant_white_label_is_applied' ) && merchant_white_label_is_applied() ) {
38 + // Register the pages, then drop their menu entries. The settings URL
39 + // keeps working for the admin who turned White Label on, who would
40 + // otherwise have no way back to the switch.
41 + add_action( 'admin_menu', array( $this, 'add_admin_menu' ) );
42 + add_action( 'admin_menu', array( $this, 'hide_branded_menu' ), 99999 );
43 +
38 44 return;
39 45 }
40 46
41 - if( $this->is_patcher_page() ) {
42 - add_action('admin_enqueue_scripts', array( $this, 'enqueue_patcher_scripts' ));
43 - }
44 -
45 47 add_action( 'admin_menu', array( $this, 'add_admin_menu' ) );
46 48 add_action( 'admin_bar_menu', array( $this, 'add_admin_bar_menu' ), 100 );
47 49 add_action( 'admin_enqueue_scripts', array( $this, 'analytics_assets' ) );
48 50 add_action( 'wp_dashboard_setup', array( $this, 'dashboard_analytics_widget' ) );
@@ -49,8 +51,20 @@
49 51 add_action( 'wp_ajax_merchant_notifications_read', array( $this, 'ajax_notifications_read' ) );
50 52 add_action('admin_footer', array( $this, 'footer_internal_scripts' ));
51 53 }
52 54
55 + /**
56 + * Hide Merchant's menu entries while White Label is applied.
57 + *
58 + * Removing the entries leaves the registered pages callable, so a direct
59 + * URL still works — the same approach the aThemes White Label plugin uses.
60 + *
61 + * @return void
62 + */
63 + public function hide_branded_menu() {
64 + remove_menu_page( $this->plugin_slug );
65 + }
66 +
53 67 /**
54 68 * Add dashboard widget.
55 69 *
56 70 * @return void
@@ -190,29 +204,8 @@
190 204 }
191 205 }
192 206
193 207 /**
194 - * Is aThemes Patcher page.
195 - *
196 - * @return bool
197 - */
198 - public function is_patcher_page() {
199 - global $pagenow;
200 -
201 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended
202 - return $pagenow === 'admin.php' && ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'athemes-patcher-preview-mp' );
203 - }
204 -
205 - /**
206 - * Enqueue aThemes Patcher preview scripts and styles.
207 - *
208 - * @return void
209 - */
210 - public function enqueue_patcher_scripts() {
211 - wp_enqueue_style( 'wp-components' );
212 - }
213 -
214 - /**
215 208 * Include required classes.
216 209 *
217 210 * @return void
218 211 */
@@ -286,20 +279,8 @@
286 279 '',
287 280 5
288 281 );
289 282
290 - // Add 'aThemes Patcher' link
291 - add_submenu_page( // phpcs:ignore WPThemeReview.PluginTerritory.NoAddAdminPages.add_menu_pages_add_submenu_page
292 - 'merchant',
293 - esc_html__('Patcher', 'merchant'),
294 - esc_html__('Patcher', 'merchant'),
295 - $this->capability,
296 - 'athemes-patcher-preview-mp',
297 - array( $this, 'html_patcher' ),
298 - 6
299 - );
300 -
301 -
302 283 // Add 'Upgrade' link.
303 284 if ( ! defined( 'MERCHANT_PRO_VERSION' ) ) {
304 285 $url = merchant_admin_upgrade_link(
305 286 'https://athemes.com/merchant-upgrade',
@@ -565,17 +546,8 @@
565 546 }
566 547 });
567 548 </script>
568 549 <?php
569 - }
570 -
571 - /**
572 - * HTML aThemes Patcher.
573 - *
574 - * @return void
575 - */
576 - public function html_patcher() {
577 - require_once MERCHANT_DIR . 'admin/pages/page-patcher.php';
578 550 }
579 551 }
580 552
581 553 Merchant_Admin_Menu::instance();