PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
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 13.8.3 13.9.2 14.0.1 All 504 releases
← All changes | modules/scan/class-admin-sidebar-link.php +31 -34 13.7.216.3-a.1 View file →
@@ -6,8 +6,9 @@
6 6 */
7 7
8 8 namespace Automattic\Jetpack\Scan;
9 9
10 +use Automattic\Jetpack\Admin_UI\Admin_Menu;
10 11 use Automattic\Jetpack\My_Jetpack\Products\Backup;
11 12 use Automattic\Jetpack\Redirect;
12 13 use Automattic\Jetpack\Status\Host;
13 14 use Jetpack_Core_Json_Api_Endpoints;
@@ -67,50 +68,46 @@
67 68 return;
68 69 }
69 70
70 71 if ( $this->should_show_scan() ) {
71 - $menu_label = __( 'Scan', 'jetpack' );
72 - $url = Redirect::get_url( 'calypso-scanner' );
73 - add_submenu_page( 'jetpack', $menu_label, esc_html( $menu_label ) . ' <span class="dashicons dashicons-external"></span>', 'manage_options', esc_url( $url ), null, $this->get_link_offset() );
72 + Admin_Menu::add_menu(
73 + /** "Scan" is a product name, do not translate. */
74 + 'Scan',
75 + 'Scan <span aria-hidden="true">↗</span>',
76 + 'manage_options',
77 + esc_url( Redirect::get_url( 'cloud-scan-history-wp-menu' ) ),
78 + null,
79 + Admin_Menu::POSITION_EXTERNAL,
80 + array( 'key' => 'jetpack-scan-cloud' )
81 + );
74 82 }
75 83
76 84 // Add scan item which shows history page only. This is mutally exclusive from the scan item above and is only shown for Atomic sitse.
77 85 if ( $this->should_show_scan_history_only() ) {
78 - $menu_label = __( 'Scan', 'jetpack' );
79 - $url = Redirect::get_url( 'cloud-scan-history-wp-menu' );
80 - add_submenu_page( 'jetpack', $menu_label, esc_html( $menu_label ) . ' <span class="dashicons dashicons-external"></span>', 'manage_options', esc_url( $url ), null, $this->get_link_offset() );
86 + Admin_Menu::add_menu(
87 + /** "Scan" is a product name, do not translate. */
88 + 'Scan',
89 + 'Scan <span aria-hidden="true">↗</span>',
90 + 'manage_options',
91 + esc_url( Redirect::get_url( 'cloud-scan-history-wp-menu' ) ),
92 + null,
93 + Admin_Menu::POSITION_EXTERNAL,
94 + array( 'key' => 'jetpack-scan-cloud' )
95 + );
81 96 }
82 97
83 98 if ( $this->should_show_backup() ) {
84 - $menu_label = __( 'VaultPress', 'jetpack' );
85 - $url = Redirect::get_url( 'calypso-backups' );
86 - add_submenu_page( 'jetpack', $menu_label, esc_html( $menu_label ) . ' <span class="dashicons dashicons-external"></span>', 'manage_options', esc_url( $url ), null, $this->get_link_offset() );
99 + Admin_Menu::add_menu(
100 + /** "VaultPress Backup" is a product name, do not translate. */
101 + 'VaultPress Backup',
102 + 'VaultPress Backup <span aria-hidden="true">↗</span>',
103 + 'manage_options',
104 + esc_url( Redirect::get_url( 'calypso-backups' ) ),
105 + null,
106 + Admin_Menu::POSITION_EXTERNAL,
107 + array( 'key' => 'jetpack-backup-cloud' )
108 + );
87 109 }
88 - }
89 -
90 - /**
91 - * We create a menu offset by counting all the pages that have a jetpack_admin_page set as the capability.
92 - *
93 - * This makes it so that the highlight of the pages works as expected. When you click on the Setting or Dashboard.
94 - *
95 - * @return int Menu offset.
96 - */
97 - private function get_link_offset() {
98 - global $submenu;
99 - $offset = 0;
100 -
101 - if ( ! array_key_exists( 'jetpack', $submenu ) ) {
102 - return $offset;
103 - }
104 -
105 - foreach ( $submenu['jetpack'] as $link ) {
106 - if ( 'jetpack_admin_page' !== $link[1] ) {
107 - break;
108 - }
109 - ++$offset;
110 - }
111 -
112 - return $offset;
113 110 }
114 111
115 112 /**
116 113 * Refreshes the state cache via API call. Called via cron.