| @@ -69,14 +69,16 @@ | ||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | if ( $this->should_show_scan() ) { |
| 72 | 72 | Admin_Menu::add_menu( |
| 73 | - __( 'Scan', 'jetpack' ), | |
| 74 | - __( 'Scan', 'jetpack' ) . ' <span class="dashicons dashicons-external"></span>', | |
| 73 | + /** "Scan" is a product name, do not translate. */ | |
| 74 | + 'Scan', | |
| 75 | + 'Scan <span aria-hidden="true">↗</span>', | |
| 75 | 76 | 'manage_options', |
| 76 | 77 | esc_url( Redirect::get_url( 'cloud-scan-history-wp-menu' ) ), |
| 77 | 78 | null, |
| 78 | - $this->get_link_offset() | |
| 79 | + Admin_Menu::POSITION_EXTERNAL, | |
| 80 | + array( 'key' => 'jetpack-scan-cloud' ) | |
| 79 | 81 | ); |
| 80 | 82 | } |
| 81 | 83 | |
| 82 | 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. |
| @@ -81,52 +83,31 @@ | ||
| 81 | 83 | |
| 82 | 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. |
| 83 | 85 | if ( $this->should_show_scan_history_only() ) { |
| 84 | 86 | Admin_Menu::add_menu( |
| 85 | - __( 'Scan', 'jetpack' ), | |
| 86 | - __( 'Scan', 'jetpack' ) . ' <span class="dashicons dashicons-external"></span>', | |
| 87 | + /** "Scan" is a product name, do not translate. */ | |
| 88 | + 'Scan', | |
| 89 | + 'Scan <span aria-hidden="true">↗</span>', | |
| 87 | 90 | 'manage_options', |
| 88 | 91 | esc_url( Redirect::get_url( 'cloud-scan-history-wp-menu' ) ), |
| 89 | 92 | null, |
| 90 | - $this->get_link_offset() | |
| 93 | + Admin_Menu::POSITION_EXTERNAL, | |
| 94 | + array( 'key' => 'jetpack-scan-cloud' ) | |
| 91 | 95 | ); |
| 92 | 96 | } |
| 93 | 97 | |
| 94 | 98 | if ( $this->should_show_backup() ) { |
| 95 | 99 | Admin_Menu::add_menu( |
| 96 | - __( 'VaultPress Backup', 'jetpack' ), | |
| 97 | - __( 'VaultPress Backup', 'jetpack' ) . ' <span class="dashicons dashicons-external"></span>', | |
| 100 | + /** "VaultPress Backup" is a product name, do not translate. */ | |
| 101 | + 'VaultPress Backup', | |
| 102 | + 'VaultPress Backup <span aria-hidden="true">↗</span>', | |
| 98 | 103 | 'manage_options', |
| 99 | 104 | esc_url( Redirect::get_url( 'calypso-backups' ) ), |
| 100 | 105 | null, |
| 101 | - $this->get_link_offset() | |
| 106 | + Admin_Menu::POSITION_EXTERNAL, | |
| 107 | + array( 'key' => 'jetpack-backup-cloud' ) | |
| 102 | 108 | ); |
| 103 | 109 | } |
| 104 | - } | |
| 105 | - | |
| 106 | - /** | |
| 107 | - * We create a menu offset by counting all the pages that have a jetpack_admin_page set as the capability. | |
| 108 | - * | |
| 109 | - * This makes it so that the highlight of the pages works as expected. When you click on the Setting or Dashboard. | |
| 110 | - * | |
| 111 | - * @return int Menu offset. | |
| 112 | - */ | |
| 113 | - private function get_link_offset() { | |
| 114 | - global $submenu; | |
| 115 | - $offset = 9; | |
| 116 | - | |
| 117 | - if ( ! array_key_exists( 'jetpack', $submenu ) ) { | |
| 118 | - return $offset; | |
| 119 | - } | |
| 120 | - | |
| 121 | - foreach ( $submenu['jetpack'] as $link ) { | |
| 122 | - if ( 'jetpack_admin_page' !== $link[1] ) { | |
| 123 | - break; | |
| 124 | - } | |
| 125 | - ++$offset; | |
| 126 | - } | |
| 127 | - | |
| 128 | - return $offset; | |
| 129 | 110 | } |
| 130 | 111 | |
| 131 | 112 | /** |
| 132 | 113 | * Refreshes the state cache via API call. Called via cron. |