← All changes
|
jetpack_vendor/automattic/jetpack-masterbar/src/admin-menu/class-atomic-admin-menu.php
+0
-41
16.2
→
16.3-beta
View file →
| @@ -72,50 +72,9 @@ | ||
| 72 | 72 | if ( ! $this->is_api_request ) { |
| 73 | 73 | $this->add_new_site_link(); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - $this->relabel_woocommerce_menu(); | |
| 77 | - | |
| 78 | 76 | ksort( $GLOBALS['menu'] ); |
| 79 | - } | |
| 80 | - | |
| 81 | - /** | |
| 82 | - * Relabels the WooCommerce menu item to "Store setup" on Commerce-plan sites. | |
| 83 | - * | |
| 84 | - * Only the sidebar label is changed; the page title is left untouched. On Atomic sites | |
| 85 | - * using the classic wp-admin interface this class doesn't load and jetpack-mu-wpcom | |
| 86 | - * relabels instead; on the nav-unified interface both run (harmless, both idempotently | |
| 87 | - * set "Store setup") — see wpcom_relabel_woocommerce_menu() in jetpack-mu-wpcom. | |
| 88 | - */ | |
| 89 | - public function relabel_woocommerce_menu() { | |
| 90 | - global $menu; | |
| 91 | - | |
| 92 | - if ( ! Store_Plan::purchases_include_commerce_plan( $this->get_site_purchases() ) ) { | |
| 93 | - return; | |
| 94 | - } | |
| 95 | - | |
| 96 | - foreach ( $menu as $position => $item ) { | |
| 97 | - if ( isset( $item[2] ) && 'woocommerce' === $item[2] ) { | |
| 98 | - // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited | |
| 99 | - $menu[ $position ][0] = __( 'Store setup', 'jetpack-masterbar' ); | |
| 100 | - break; | |
| 101 | - } | |
| 102 | - } | |
| 103 | - } | |
| 104 | - | |
| 105 | - /** | |
| 106 | - * The site's purchases, or an empty array when the WoA helper is unavailable. | |
| 107 | - * | |
| 108 | - * Exists as an overridable seam so tests can inject purchases without the WoA helper. | |
| 109 | - * | |
| 110 | - * @return array Product objects, each with at least a product_slug property. | |
| 111 | - */ | |
| 112 | - protected function get_site_purchases() { | |
| 113 | - if ( ! function_exists( 'wpcom_get_site_purchases' ) ) { | |
| 114 | - return array(); | |
| 115 | - } | |
| 116 | - | |
| 117 | - return wpcom_get_site_purchases(); | |
| 118 | 77 | } |
| 119 | 78 | |
| 120 | 79 | /** |
| 121 | 80 | * Get the preferred view for the given screen. |