Skip to content

Commit 9b48a49

Browse files
author
Woo
committed
Updates to 6.1.0
1 parent 128d38e commit 9b48a49

10 files changed

+99
-201
lines changed

admin/WCAdminConnectPages.php

-15
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,6 @@ class WCAdminConnectPages {
2121
*/
2222
const BREADCRUMB_ROOT = 'automatewoo-dashboard';
2323

24-
/**
25-
* Display the page in WooCommerce Admin nav menu, and show WooCommerce Admin bar, breadcrumbs, etc. on the page
26-
*/
27-
const PAGE_DISPLAY_FULL = 'full';
28-
29-
/**
30-
* Hide the page in WC admin nav menu but still show WooCommerce Admin bar, breadcrumbs, etc. on the page
31-
*/
32-
const PAGE_DISPLAY_HIDDEN = 'hidden';
33-
34-
/**
35-
* Hide the page in WC admin nav menu and do not display WooCommerce Admin bar, breadcrumbs, etc. on the page
36-
*/
37-
const PAGE_DISPLAY_STANDALONE = 'standalone';
38-
3924
/**
4025
* Initialize the class and add hook callbacks.
4126
*/

admin/admin.php

+6-85
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
use AutomateWoo\Admin\AssetData;
77
use AutomateWoo\Admin\WCAdminConnectPages;
88
use AutomateWoo\HPOS_Helper;
9-
use Automattic\WooCommerce\Admin\Features\Navigation\Menu;
10-
use Automattic\WooCommerce\Admin\Features\Navigation\Screen;
119
use Automattic\WooCommerce\Admin\PageController;
1210
use Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry;
1311
use Automattic\WooCommerce\Blocks\Package as BlocksPackage;
@@ -139,10 +137,9 @@ public static function handle_save_screen_option( $keep, $option, $value ) {
139137
* Add menu entries.
140138
*/
141139
public static function admin_menu() {
142-
$sub_menu = [];
143-
$position = '55.6324'; // fix for rare position clash bug
144-
$workflows_group = 'automatewoo-workflows-group';
145-
$icon = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgNTEyIDUxMiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PGc+PHBvbHlnb24gZmlsbD0iIzlFQTNBOCIgcG9pbnRzPSIxMTcuNiwyNzIuNyAxNjYuOSwyNzIuNyAxNDIuMywyMDUuNCAiLz48cGF0aCBmaWxsPSIjOUVBM0E4IiBkPSJNNDY0LDU0LjRINDhDMjUuMSw1NC40LDYuNCw3My4xLDYuNCw5NnYzMjBjMCwyMi45LDE4LjcsNDEuNiw0MS42LDQxLjZoNDE2YzIyLjksMCw0MS42LTE4LjcsNDEuNi00MS42Vjk2QzUwNS42LDczLjEsNDg2LjksNTQuNCw0NjQsNTQuNHogTTE5My4zLDM0NS4xbC0xNC45LTQwLjdIMTA2bC0xNC44LDQwLjdINTQuNkwxMjMsMTY2LjloNDAuMkwyMzEsMzQ1LjFIMTkzLjN6IE00MDguMSwzNDUuMWgtMzUuN2wtNDAuNy0xMjYuOUwyOTEsMzQ1LjFoLTM2LjJsLTQ5LjUtMTc4LjJIMjQybDMyLjcsMTIyLjZsMzkuNS0xMjIuNmgzNS45TDM4OS45LDI5MEw0MjIsMTY2LjloMzUuNEw0MDguMSwzNDUuMXoiLz48L2c+PC9zdmc+';
140+
$sub_menu = [];
141+
$position = '55.6324'; // fix for rare position clash bug
142+
$icon = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgNTEyIDUxMiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PGc+PHBvbHlnb24gZmlsbD0iIzlFQTNBOCIgcG9pbnRzPSIxMTcuNiwyNzIuNyAxNjYuOSwyNzIuNyAxNDIuMywyMDUuNCAiLz48cGF0aCBmaWxsPSIjOUVBM0E4IiBkPSJNNDY0LDU0LjRINDhDMjUuMSw1NC40LDYuNCw3My4xLDYuNCw5NnYzMjBjMCwyMi45LDE4LjcsNDEuNiw0MS42LDQxLjZoNDE2YzIyLjksMCw0MS42LTE4LjcsNDEuNi00MS42Vjk2QzUwNS42LDczLjEsNDg2LjksNTQuNCw0NjQsNTQuNHogTTE5My4zLDM0NS4xbC0xNC45LTQwLjdIMTA2bC0xNC44LDQwLjdINTQuNkwxMjMsMTY2LjloNDAuMkwyMzEsMzQ1LjFIMTkzLjN6IE00MDguMSwzNDUuMWgtMzUuN2wtNDAuNy0xMjYuOUwyOTEsMzQ1LjFoLTM2LjJsLTQ5LjUtMTc4LjJIMjQybDMyLjcsMTIyLjZsMzkuNS0xMjIuNmgzNS45TDM4OS45LDI5MEw0MjIsMTY2LjloMzUuNEw0MDguMSwzNDUuMXoiLz48L2c+PC9zdmc+';
146143

147144
add_menu_page(
148145
__( 'AutomateWoo', 'automatewoo' ),
@@ -154,123 +151,67 @@ public static function admin_menu() {
154151
$position
155152
);
156153

157-
if ( class_exists( Menu::class ) ) {
158-
Menu::add_plugin_category(
159-
array(
160-
'id' => 'automatewoo',
161-
'title' => __( 'AutomateWoo', 'automatewoo' ),
162-
'capability' => 'manage_woocommerce',
163-
'url' => 'automatewoo',
164-
)
165-
);
166-
Menu::add_plugin_category(
167-
[
168-
'id' => $workflows_group,
169-
'title' => __( 'Workflows', 'automatewoo' ),
170-
'capability' => 'manage_woocommerce',
171-
'url' => $workflows_group,
172-
'parent' => 'automatewoo',
173-
'order' => 1,
174-
]
175-
);
176-
}
177-
178154
$sub_menu['dashboard'] = [
179155
'title' => __( 'Dashboard', 'automatewoo' ),
180156
'function' => [ __CLASS__, 'load_controller' ],
181-
'order' => 0,
182157
];
183158

184159
// Workflows menu group
185160
$sub_menu['workflows'] = [
186-
'title' => __( 'Workflows', 'automatewoo' ),
187-
'slug' => 'edit.php?post_type=aw_workflow',
188-
// Hide in new nav and use `\Automattic\WooCommerce\Admin\Features\Navigation\Menu::get_post_type_items` instead
189-
'display' => WCAdminConnectPages::PAGE_DISPLAY_HIDDEN,
161+
'title' => __( 'Workflows', 'automatewoo' ),
162+
'slug' => 'edit.php?post_type=aw_workflow',
190163
];
191164

192-
if ( class_exists( Screen::class ) ) {
193-
$menu_post_type_items = Menu::get_post_type_items(
194-
'aw_workflow',
195-
[
196-
'title' => __( 'Workflows', 'automatewoo' ),
197-
'parent' => $workflows_group,
198-
'order' => 0,
199-
]
200-
);
201-
202-
if ( isset( $menu_post_type_items['all'] ) ) {
203-
Menu::add_plugin_item( $menu_post_type_items['all'] );
204-
}
205-
if ( isset( $menu_post_type_items['new'] ) ) {
206-
$menu_post_type_items['new']['title'] = __( 'Add workflow', 'automatewoo' );
207-
$menu_post_type_items['new']['order'] = 1;
208-
Menu::add_plugin_item( $menu_post_type_items['new'] );
209-
}
210-
}
211-
212165
$sub_menu['logs'] = [
213166
'title' => __( 'Logs', 'automatewoo' ),
214167
'function' => [ __CLASS__, 'load_controller' ],
215-
'parent' => $workflows_group,
216-
'order' => 2,
217168
];
218169
$sub_menu['queue'] = [
219170
'title' => __( 'Queue', 'automatewoo' ),
220171
'function' => [ __CLASS__, 'load_controller' ],
221-
'parent' => $workflows_group,
222-
'order' => 3,
223172
];
224173

225174
if ( Options::abandoned_cart_enabled() ) {
226175
$sub_menu['carts'] = [
227176
'title' => __( 'Carts', 'automatewoo' ),
228177
'function' => [ __CLASS__, 'load_controller' ],
229-
'order' => 2,
230178
];
231179
}
232180

233181
$sub_menu['guests'] = [
234182
'title' => __( 'Guests', 'automatewoo' ),
235183
'function' => [ __CLASS__, 'load_controller' ],
236-
'order' => 3,
237184
];
238185

239186
$sub_menu['opt-ins'] = [
240187
'title' => Options::optin_enabled() ? __( 'Opt-ins', 'automatewoo' ) : __( 'Opt-outs', 'automatewoo' ),
241188
'function' => [ __CLASS__, 'load_controller' ],
242-
'order' => 4,
243189
];
244190

245191
$sub_menu['reports'] = [
246192
'title' => __( 'Reports', 'automatewoo' ),
247193
'function' => [ __CLASS__, 'load_controller' ],
248-
'order' => 5,
249194
'enabled' => ! HPOS_Helper::is_HPOS_enabled(),
250195
];
251196

252197
$sub_menu['tools'] = [
253198
'title' => __( 'Tools', 'automatewoo' ),
254199
'function' => [ __CLASS__, 'load_controller' ],
255-
'order' => 6,
256200
];
257201

258202
$sub_menu['settings'] = [
259203
'title' => __( 'Settings', 'automatewoo' ),
260204
'function' => [ __CLASS__, 'load_controller' ],
261-
'order' => 7,
262205
];
263206

264207
$sub_menu['preview'] = [
265208
'title' => __( 'Preview', 'automatewoo' ),
266209
'function' => [ __CLASS__, 'load_controller' ],
267-
'display' => WCAdminConnectPages::PAGE_DISPLAY_STANDALONE,
268210
];
269211

270212
$sub_menu['data-upgrade'] = [
271213
'title' => __( 'AutomateWoo Data Update', 'automatewoo' ),
272214
'function' => [ __CLASS__, 'page_data_upgrade' ],
273-
'display' => WCAdminConnectPages::PAGE_DISPLAY_HIDDEN,
274215
];
275216

276217
foreach ( $sub_menu as $key => $item ) {
@@ -286,31 +227,11 @@ public static function admin_menu() {
286227
if ( empty( $item['page_title'] ) ) {
287228
$item['page_title'] = $item['title'];
288229
}
289-
if ( ! isset( $item['parent'] ) ) {
290-
$item['parent'] = 'automatewoo';
291-
}
292230

293231
$is_enabled = $item['enabled'] ?? true;
294232

295233
add_submenu_page( $is_enabled ? 'automatewoo' : 'automatewoo_disabled', $item['page_title'], $item['title'], $item['capability'], $item['slug'], $item['function'] );
296234

297-
if ( class_exists( Menu::class ) ) {
298-
if ( ! isset( $item['display'] ) || WCAdminConnectPages::PAGE_DISPLAY_FULL === $item['display'] ) {
299-
Menu::add_plugin_item(
300-
array(
301-
'id' => 'automatewoo-' . $key,
302-
'parent' => $item['parent'],
303-
'title' => $item['title'],
304-
'capability' => $item['capability'],
305-
'url' => $item['slug'],
306-
'order' => isset( $item['order'] ) ? $item['order'] : 99,
307-
)
308-
);
309-
} elseif ( WCAdminConnectPages::PAGE_DISPLAY_HIDDEN === $item['display'] ) {
310-
Screen::add_screen( $item['slug'] );
311-
}
312-
}
313-
314235
if ( $key === 'workflows' ) {
315236
do_action( 'automatewoo/admin/submenu_pages', 'automatewoo' );
316237
}
@@ -333,7 +254,7 @@ public static function admin_menu() {
333254
* This is because we need to add .hide-if-js classname in the submenu for hide them in Calypso for wp.com
334255
* The classes are usually loaded in position 4 in the submenu.
335256
*
336-
* @see Menu::migrate_menu_items for a reference of how WC Admin loads this class.
257+
* @see Menu::migrate_menu_items for a reference of how WC Admin loads this class. (https://github.com/woocommerce/woocommerce/blob/47e4d918c91ea980c41f4567e823256acbac4317/plugins/woocommerce/src/Admin/Features/Navigation/Menu.php#L636)
337258
* @param array $menu Menu items
338259
* @return array Menu items
339260
*/

automatewoo.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: AutomateWoo
44
* Plugin URI: https://automatewoo.com
55
* Description: Powerful marketing automation for your WooCommerce store.
6-
* Version: 6.0.33
6+
* Version: 6.1.0
77
* Author: WooCommerce
88
* Author URI: https://woocommerce.com
99
* License: GPLv3
@@ -13,7 +13,7 @@
1313
* Tested up to: 6.6
1414
* Requires Plugins: woocommerce
1515
* WC requires at least: 7.9
16-
* WC tested up to: 9.2.0
16+
* WC tested up to: 9.3.0
1717
* Woo: 4652610:f6f1f8a56a16a3715b30b21fb557e78f
1818
*
1919
* This program is free software: you can redistribute it and/or modify
@@ -37,7 +37,7 @@
3737
defined( 'ABSPATH' ) || exit;
3838

3939
define( 'AUTOMATEWOO_SLUG', 'automatewoo' );
40-
define( 'AUTOMATEWOO_VERSION', '6.0.33' ); // WRCS: DEFINED_VERSION.
40+
define( 'AUTOMATEWOO_VERSION', '6.1.0' ); // WRCS: DEFINED_VERSION.
4141
define( 'AUTOMATEWOO_FILE', __FILE__ );
4242
define( 'AUTOMATEWOO_PATH', __DIR__ );
4343
define( 'AUTOMATEWOO_MIN_PHP_VER', '7.4.0' );

changelog.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
*** AutomateWoo Changelog ***
22

3+
2024-09-05 - version 6.1.0
4+
* Break - Remove WooCommerce Navigation integration.
5+
* Tweak - WC 9.3.0 compatibility.
6+
37
2024-08-28 - version 6.0.33
48
* Bump min WC version to 7.9, reuse upstreamed classes.
59

includes/Post_Types.php

-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
namespace AutomateWoo;
55

66
use Automattic\WooCommerce\Admin\Features\Features as WCAdminFeatures;
7-
use Automattic\WooCommerce\Admin\Features\Navigation\Screen;
87

98
/**
109
* @class Post_Types
@@ -59,10 +58,6 @@ static function register_post_types() {
5958
)
6059
);
6160

62-
if ( class_exists( Screen::class ) ) {
63-
Screen::register_post_type( 'aw_workflow' );
64-
}
65-
6661
do_action('automatewoo_after_register_post_types');
6762
}
6863

0 commit comments

Comments
 (0)