PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.5
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.5
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 13.8.3 All 506 releases
← All changes | modules/scan/class-admin-sidebar-link.php +8 -28 16.2-beta → 16.3-a.5 View file →
@@ -67,8 +67,10 @@
67 67 if ( ! $this->should_show_link() ) {
68 68 return;
69 69 }
70 70
71 + $position = defined( Admin_Menu::class . '::POSITION_EXTERNAL' ) ? Admin_Menu::POSITION_EXTERNAL : 100;
72 +
71 73 if ( $this->should_show_scan() ) {
72 74 Admin_Menu::add_menu(
73 75 /** "Scan" is a product name, do not translate. */
74 76 'Scan',
@@ -75,9 +77,10 @@
75 77 'Scan <span aria-hidden="true">↗</span>',
76 78 'manage_options',
77 79 esc_url( Redirect::get_url( 'cloud-scan-history-wp-menu' ) ),
78 80 null,
79 - $this->get_link_offset()
81 + $position,
82 + array( 'key' => 'jetpack-scan-cloud' )
80 83 );
81 84 }
82 85
83 86 // Add scan item which shows history page only. This is mutally exclusive from the scan item above and is only shown for Atomic sitse.
@@ -88,9 +91,10 @@
88 91 'Scan <span aria-hidden="true">↗</span>',
89 92 'manage_options',
90 93 esc_url( Redirect::get_url( 'cloud-scan-history-wp-menu' ) ),
91 94 null,
92 - $this->get_link_offset()
95 + $position,
96 + array( 'key' => 'jetpack-scan-cloud' )
93 97 );
94 98 }
95 99
96 100 if ( $this->should_show_backup() ) {
@@ -100,36 +104,12 @@
100 104 'VaultPress Backup <span aria-hidden="true">↗</span>',
101 105 'manage_options',
102 106 esc_url( Redirect::get_url( 'calypso-backups' ) ),
103 107 null,
104 - $this->get_link_offset()
108 + $position,
109 + array( 'key' => 'jetpack-backup-cloud' )
105 110 );
106 111 }
107 - }
108 -
109 - /**
110 - * We create a menu offset by counting all the pages that have a jetpack_admin_page set as the capability.
111 - *
112 - * This makes it so that the highlight of the pages works as expected. When you click on the Setting or Dashboard.
113 - *
114 - * @return int Menu offset.
115 - */
116 - private function get_link_offset() {
117 - global $submenu;
118 - $offset = 17;
119 -
120 - if ( ! array_key_exists( 'jetpack', $submenu ) ) {
121 - return $offset;
122 - }
123 -
124 - foreach ( $submenu['jetpack'] as $link ) {
125 - if ( 'jetpack_admin_page' !== $link[1] ) {
126 - break;
127 - }
128 - ++$offset;
129 - }
130 -
131 - return $offset;
132 112 }
133 113
134 114 /**
135 115 * Refreshes the state cache via API call. Called via cron.