@@ 177-204 (lines=28) @@ | ||
174 | /** |
|
175 | * Adds Jetpack menu. |
|
176 | */ |
|
177 | public function add_jetpack_menu() { |
|
178 | global $menu; |
|
179 | ||
180 | $position = 50; |
|
181 | while ( isset( $menu[ $position ] ) ) { |
|
182 | $position++; |
|
183 | } |
|
184 | ||
185 | // TODO: Replace with proper SVG data url. |
|
186 | $jetpack_icon = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 32 32' %3E%3Cpath fill='%23a0a5aa' d='M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z'%3E%3C/path%3E%3Cpolygon fill='%23fff' points='15,19 7,19 15,3 '%3E%3C/polygon%3E%3Cpolygon fill='%23fff' points='17,29 17,13 25,13 '%3E%3C/polygon%3E%3C/svg%3E"; |
|
187 | $jetpack_slug = 'https://wordpress.com/activity-log/' . $this->domain; |
|
188 | ||
189 | $this->add_admin_menu_separator( $position++, 'manage_options' ); |
|
190 | add_menu_page( esc_attr__( 'Jetpack', 'jetpack' ), __( 'Jetpack', 'jetpack' ), 'manage_options', $jetpack_slug, null, $jetpack_icon, $position ); |
|
191 | ||
192 | // Maintain id for jQuery selector. |
|
193 | $menu[ $position ][5] = 'toplevel_page_jetpack'; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
|
194 | ||
195 | remove_menu_page( 'jetpack' ); |
|
196 | remove_submenu_page( 'jetpack', 'stats' ); |
|
197 | ||
198 | $this->migrate_submenus( 'jetpack', $jetpack_slug ); |
|
199 | ||
200 | add_submenu_page( $jetpack_slug, esc_attr__( 'Activity Log', 'jetpack' ), __( 'Activity Log', 'jetpack' ), 'manage_options', $jetpack_slug, null, 5 ); |
|
201 | add_submenu_page( $jetpack_slug, esc_attr__( 'Backup', 'jetpack' ), __( 'Backup', 'jetpack' ), 'manage_options', 'https://wordpress.com/backup/' . $this->domain, null, 10 ); |
|
202 | ||
203 | add_filter( 'parent_file', array( $this, 'jetpack_parent_file' ) ); |
|
204 | } |
|
205 | ||
206 | /** |
|
207 | * Filters the parent file of an admin menu sub-menu item. |
@@ 196-221 (lines=26) @@ | ||
193 | /** |
|
194 | * Adds Jetpack menu. |
|
195 | */ |
|
196 | public function add_jetpack_menu() { |
|
197 | global $menu; |
|
198 | ||
199 | $position = 50; |
|
200 | while ( isset( $menu[ $position ] ) ) { |
|
201 | $position++; |
|
202 | } |
|
203 | ||
204 | // TODO: Replace with proper SVG data url. |
|
205 | $jetpack_icon = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 32 32' %3E%3Cpath fill='%23a0a5aa' d='M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z'%3E%3C/path%3E%3Cpolygon fill='%23fff' points='15,19 7,19 15,3 '%3E%3C/polygon%3E%3Cpolygon fill='%23fff' points='17,29 17,13 25,13 '%3E%3C/polygon%3E%3C/svg%3E"; |
|
206 | $jetpack_slug = 'https://wordpress.com/activity-log/' . $this->domain; |
|
207 | ||
208 | $this->add_admin_menu_separator( $position++, 'manage_options' ); |
|
209 | add_menu_page( esc_attr__( 'Jetpack', 'jetpack' ), __( 'Jetpack', 'jetpack' ), 'manage_options', $jetpack_slug, null, $jetpack_icon, $position ); |
|
210 | ||
211 | // Maintain id for jQuery selector. |
|
212 | $menu[ $position ][5] = 'toplevel_page_jetpack'; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
|
213 | ||
214 | remove_menu_page( 'jetpack' ); |
|
215 | $this->migrate_submenus( 'jetpack', $jetpack_slug ); |
|
216 | ||
217 | add_submenu_page( $jetpack_slug, esc_attr__( 'Activity Log', 'jetpack' ), __( 'Activity Log', 'jetpack' ), 'manage_options', $jetpack_slug, null, 5 ); |
|
218 | add_submenu_page( $jetpack_slug, esc_attr__( 'Backup', 'jetpack' ), __( 'Backup', 'jetpack' ), 'manage_options', 'https://wordpress.com/backup/' . $this->domain, null, 10 ); |
|
219 | ||
220 | add_filter( 'parent_file', array( $this, 'jetpack_parent_file' ) ); |
|
221 | } |
|
222 | ||
223 | /** |
|
224 | * Filters the parent file of an admin menu sub-menu item. |