PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 All 507 releases
← All changes | jetpack_vendor/automattic/jetpack-premium-analytics/src/class-analytics.php +28 -16 16.2-beta → 16.3-beta View file →
@@ -6,8 +6,9 @@
6 6 */
7 7
8 8 namespace Automattic\Jetpack\PremiumAnalytics;
9 9
10 +use Automattic\Jetpack\Admin_UI\Admin_Menu;
10 11 use Automattic\Jetpack\Connection\Manager as Connection_Manager;
11 12 use Automattic\Jetpack\PremiumAnalytics\Reports\Export\Export;
12 13 use Automattic\Jetpack\PremiumAnalytics\REST\Api_Proxy_Controller;
13 14 use Automattic\Jetpack\PremiumAnalytics\REST\Notices_Controller;
@@ -22,9 +23,9 @@
22 23 * Loads the wp-build output and registers the dashboard's admin page.
23 24 */
24 25 class Analytics {
25 26
26 - const PACKAGE_VERSION = '0.6.0';
27 + const PACKAGE_VERSION = '0.11.0';
27 28
28 29 /**
29 30 * Whether the class has been initialized.
30 31 *
@@ -283,10 +284,9 @@
283 284 Connection_Configuration::configure();
284 285
285 286 Sync_Status_Tracker::configure();
286 287
287 - // TEMPORARY (WOOA7S-1550): register the interim woocommerce_analytics sync module so
288 - // Sync_Status_Tracker has a full sync to observe. Remove when the shared sync-modules package lands.
288 + // Opts in to the shared woocommerce_analytics sync module so Sync_Status_Tracker has a full sync to observe.
289 289 Sync_Configuration::register();
290 290 }
291 291
292 292 /**
@@ -328,18 +328,24 @@
328 328 if ( ! function_exists( __NAMESPACE__ . '\\register_widget_modules_rest_route' ) ) {
329 329 require_once __DIR__ . '/widget-modules.php';
330 330 }
331 331
332 - // Default layout's first-load preference injection.
333 - if ( ! function_exists( __NAMESPACE__ . '\\register_dashboard_default_layout_route' ) ) {
332 + // Default layout primitives and the bundled defaults' seed.
333 + if ( ! function_exists( __NAMESPACE__ . '\\get_dashboard_default_widget_instance' ) ) {
334 334 require_once __DIR__ . '/dashboard-layout.php';
335 335 }
336 336
337 - // Dashboard sections and their default layout seeding.
337 + // Dashboard section API, then the package's own sections registered through it.
338 338 if ( ! function_exists( __NAMESPACE__ . '\\register_dashboard_section' ) ) {
339 339 require_once __DIR__ . '/dashboard-sections.php';
340 340 }
341 - configure_dashboard_preview_scope();
341 + if ( ! function_exists( __NAMESPACE__ . '\\register_default_dashboard_sections' ) ) {
342 + require_once __DIR__ . '/default-dashboard-sections.php';
343 + }
344 + // An older copy of the package may have loaded dashboard-sections.php under the previous name.
345 + if ( function_exists( __NAMESPACE__ . '\\configure_dashboard_sections_script_data' ) ) {
346 + configure_dashboard_sections_script_data();
347 + }
342 348
343 349 // Default-on CSV export settings and server-side disable filter.
344 350 if ( ! function_exists( __NAMESPACE__ . '\\configure_csv_exports' ) ) {
345 351 require_once __DIR__ . '/csv-exports.php';
@@ -379,8 +385,9 @@
379 385 private static function load_build() {
380 386 $build_entry = self::$build_entry ?? __DIR__ . '/../build/build.php';
381 387 if ( file_exists( $build_entry ) ) {
382 388 require_once $build_entry;
389 + require_once __DIR__ . '/sdk-module.php';
383 390 }
384 391 }
385 392
386 393 /**
@@ -483,8 +490,11 @@
483 490 *
484 491 * Uses wp-build's `-wp-admin` variant so Core applies the menu capability check. Reports the
485 492 * page and widget artifacts independently since the build loader includes each conditionally.
486 493 *
494 + * Queued through Admin_Menu rather than registered here, so the entry is reachable by the
495 + * `jetpack_admin_menu_visibility` filter.
496 + *
487 497 * @return void
488 498 */
489 499 public static function register_admin_menu() {
490 500 $can_render = function_exists( 'jpa_jetpack_premium_analytics_wp_admin_render_page' );
@@ -517,17 +527,19 @@
517 527 : array( __CLASS__, 'render_missing_build_notice' );
518 528
519 529 $menu_title = self::menu_title();
520 530
521 - add_menu_page(
522 - esc_html( $menu_title ),
523 - esc_html( $menu_title ),
524 - Capabilities::VIEW_ANALYTICS,
525 - self::MENU_PAGE_SLUG,
526 - $render_callback,
527 - 'dashicons-chart-bar',
528 - 2
529 - );
531 + $menu_title = esc_html( $menu_title );
532 +
533 + // An older admin-ui, loaded first by another plugin, may predate add_top_level_menu().
534 + if ( ! method_exists( Admin_Menu::class, 'add_top_level_menu' ) ) {
535 + add_menu_page( $menu_title, $menu_title, Capabilities::VIEW_ANALYTICS, self::MENU_PAGE_SLUG, $render_callback, 'dashicons-chart-bar', 2 );
536 + return;
537 + }
538 +
539 + // A fixed key rather than the slug, which carries a build-specific suffix. No gate:
540 + // the dashboard has no My Jetpack product class and no module to name.
541 + Admin_Menu::add_top_level_menu( $menu_title, $menu_title, Capabilities::VIEW_ANALYTICS, self::MENU_PAGE_SLUG, $render_callback, 'dashicons-chart-bar', 2, array( 'key' => 'jetpack-premium-analytics' ) );
530 542 }
531 543
532 544 /**
533 545 * Stand-in for the generated render callback when the build output is absent.