1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
require_once dirname( __FILE__ ) . '/rtl-admin-bar.php'; |
4
|
|
|
|
5
|
|
|
class A8C_WPCOM_Masterbar { |
6
|
|
|
private $locale; |
7
|
|
|
|
8
|
|
|
private $user_id; |
9
|
|
|
private $user_data; |
10
|
|
|
private $user_login; |
11
|
|
|
private $user_email; |
12
|
|
|
private $display_name; |
13
|
|
|
private $primary_site_slug; |
14
|
|
|
private $user_text_direction; |
15
|
|
|
|
16
|
|
|
function __construct() { |
17
|
|
|
$this->locale = $this->get_locale(); |
18
|
|
|
$this->user_id = get_current_user_id(); |
19
|
|
|
|
20
|
|
|
// Limit the masterbar to be shown only to connected Jetpack users. |
21
|
|
|
if ( ! Jetpack::is_user_connected( $this->user_id ) ) { |
22
|
|
|
return; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
$this->user_data = Jetpack::get_connected_user_data( $this->user_id ); |
26
|
|
|
$this->user_login = $this->user_data['login']; |
27
|
|
|
$this->user_email = $this->user_data['email']; |
28
|
|
|
$this->display_name = $this->user_data['display_name']; |
29
|
|
|
$this->primary_site_slug = Jetpack::build_raw_urls( get_home_url() ); |
30
|
|
|
// We need to use user's setting here, instead of relying on current blog's text direction |
31
|
|
|
$this->user_text_direction = $this->user_data['text_direction']; |
32
|
|
|
|
33
|
|
|
if ( $this->is_rtl() ) { |
34
|
|
|
// Extend core WP_Admin_Bar class in order to add rtl styles |
35
|
|
|
add_filter( 'wp_admin_bar_class', array( $this, 'get_rtl_admin_bar_class' ) ); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
add_action( 'wp_before_admin_bar_render', array( $this, 'replace_core_masterbar' ), 99999 ); |
39
|
|
|
|
40
|
|
|
add_action( 'wp_enqueue_scripts', array( $this, 'add_styles_and_scripts' ) ); |
41
|
|
|
add_action( 'admin_enqueue_scripts', array( $this, 'add_styles_and_scripts' ) ); |
42
|
|
|
|
43
|
|
|
add_action( 'wp_enqueue_scripts', array( $this, 'remove_core_styles' ) ); |
44
|
|
|
add_action( 'admin_enqueue_scripts', array( $this, 'remove_core_styles' ) ); |
45
|
|
|
|
46
|
|
|
if ( Jetpack::is_module_active( 'notes' ) && $this->is_rtl() ) { |
47
|
|
|
// Override Notification module to include RTL styles |
48
|
|
|
add_action( 'a8c_wpcom_masterbar_enqueue_rtl_notification_styles', '__return_true' ); |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function is_automated_transfer_site() { |
53
|
|
|
$at_options = get_option( 'at_options', array() ); |
54
|
|
|
|
55
|
|
|
if ( ! empty( $at_options ) ) { |
56
|
|
|
return true; |
57
|
|
|
} |
58
|
|
|
// As fallback, check for presence of wpcomsh plugin to determine if a current site has undergone AT. |
59
|
|
|
if ( defined( 'WPCOMSH__PLUGIN_FILE' ) ) { |
60
|
|
|
return true; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
return false; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function get_rtl_admin_bar_class() { |
67
|
|
|
return 'RTL_Admin_Bar'; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function remove_core_styles() { |
71
|
|
|
wp_dequeue_style( 'admin-bar' ); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function is_rtl() { |
75
|
|
|
return $this->user_text_direction === 'rtl' ? true : false; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function add_styles_and_scripts() { |
79
|
|
|
|
80
|
|
|
if ( $this->is_rtl() ) { |
81
|
|
|
wp_enqueue_style( 'a8c-wpcom-masterbar-rtl', $this->wpcom_static_url( '/wp-content/mu-plugins/admin-bar/rtl/wpcom-admin-bar-rtl.css' ) ); |
82
|
|
|
wp_enqueue_style( 'a8c-wpcom-masterbar-overrides-rtl', $this->wpcom_static_url( '/wp-content/mu-plugins/admin-bar/masterbar-overrides/rtl/masterbar-rtl.css' ) ); |
83
|
|
|
} else { |
84
|
|
|
wp_enqueue_style( 'a8c-wpcom-masterbar', $this->wpcom_static_url( '/wp-content/mu-plugins/admin-bar/wpcom-admin-bar.css' ) ); |
85
|
|
|
wp_enqueue_style( 'a8c-wpcom-masterbar-overrides', $this->wpcom_static_url( '/wp-content/mu-plugins/admin-bar/masterbar-overrides/masterbar.css' ) ); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
// Local overrides |
89
|
|
|
wp_enqueue_style( 'a8c_wpcom_css_override', plugins_url( 'overrides.css', __FILE__ ) ); |
90
|
|
|
|
91
|
|
|
if ( ! Jetpack::is_module_active( 'notes ' ) ) { |
92
|
|
|
// Masterbar is relying on some icons from noticons.css |
93
|
|
|
wp_enqueue_style( 'noticons', $this->wpcom_static_url( '/i/noticons/noticons.css' ), array(), JETPACK__VERSION . '-' . gmdate( 'oW' ) ); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
wp_enqueue_script( 'jetpack-accessible-focus', plugins_url( '_inc/accessible-focus.js', JETPACK__PLUGIN_FILE ), array(), JETPACK__VERSION ); |
97
|
|
|
wp_enqueue_script( 'a8c_wpcom_masterbar_overrides', $this->wpcom_static_url( '/wp-content/mu-plugins/admin-bar/masterbar-overrides/masterbar.js' ) ); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
function wpcom_static_url( $file ) { |
101
|
|
|
$i = hexdec( substr( md5( $file ), - 1 ) ) % 2; |
102
|
|
|
$url = 'https://s' . $i . '.wp.com' . $file; |
103
|
|
|
|
104
|
|
|
return set_url_scheme( $url, 'https'); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
public function replace_core_masterbar() { |
108
|
|
|
global $wp_admin_bar; |
109
|
|
|
|
110
|
|
|
if ( ! is_object( $wp_admin_bar ) ) { |
111
|
|
|
return false; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
$this->clear_core_masterbar( $wp_admin_bar ); |
115
|
|
|
$this->build_wpcom_masterbar( $wp_admin_bar ); |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
// Remove all existing toolbar entries from core Masterbar |
119
|
|
|
public function clear_core_masterbar( $wp_admin_bar ) { |
120
|
|
|
foreach ( $wp_admin_bar->get_nodes() as $node ) { |
121
|
|
|
$wp_admin_bar->remove_node( $node->id ); |
122
|
|
|
} |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
// Add entries corresponding to WordPress.com Masterbar |
126
|
|
|
public function build_wpcom_masterbar( $wp_admin_bar ) { |
127
|
|
|
// Menu groups |
128
|
|
|
$this->wpcom_adminbar_add_secondary_groups( $wp_admin_bar ); |
129
|
|
|
|
130
|
|
|
// Left part |
131
|
|
|
$this->add_my_sites_submenu( $wp_admin_bar ); |
132
|
|
|
$this->add_reader_submenu( $wp_admin_bar ); |
133
|
|
|
|
134
|
|
|
// Right part |
135
|
|
|
if ( Jetpack::is_module_active( 'notes' ) ) { |
136
|
|
|
$this->add_notifications( $wp_admin_bar ); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
$this->add_me_submenu( $wp_admin_bar ); |
140
|
|
|
$this->add_write_button( $wp_admin_bar ); |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
public function get_locale() { |
144
|
|
|
$wpcom_locale = get_locale(); |
145
|
|
|
|
146
|
|
|
if ( ! class_exists( 'GP_Locales' ) ) { |
147
|
|
|
if ( defined( 'JETPACK__GLOTPRESS_LOCALES_PATH' ) && file_exists( JETPACK__GLOTPRESS_LOCALES_PATH ) ) { |
148
|
|
|
require JETPACK__GLOTPRESS_LOCALES_PATH; |
149
|
|
|
} |
150
|
|
|
} |
151
|
|
|
|
152
|
|
View Code Duplication |
if ( class_exists( 'GP_Locales' ) ) { |
153
|
|
|
$wpcom_locale_object = GP_Locales::by_field( 'wp_locale', get_locale() ); |
154
|
|
|
if ( $wpcom_locale_object instanceof GP_Locale ) { |
155
|
|
|
$wpcom_locale = $wpcom_locale_object->slug; |
156
|
|
|
} |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
return $wpcom_locale; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
public function add_notifications( $wp_admin_bar ) { |
163
|
|
|
$wp_admin_bar->add_node( array( |
164
|
|
|
'id' => 'notes', |
165
|
|
|
'title' => '<span id="wpnt-notes-unread-count" class="wpnt-loading wpn-read"></span> |
166
|
|
|
<span class="screen-reader-text">' . __( 'Notifications', 'jetpack' ) . '</span> |
167
|
|
|
<span class="noticon noticon-bell"></span>', |
168
|
|
|
'meta' => array( |
169
|
|
|
'html' => '<div id="wpnt-notes-panel2" style="display:none" lang="'. esc_attr( $this->locale ) . '" dir="' . ( $this->is_rtl() ? 'rtl' : 'ltr' ) . '">' . |
170
|
|
|
'<div class="wpnt-notes-panel-header">' . |
171
|
|
|
'<span class="wpnt-notes-header">' . |
172
|
|
|
__( 'Notifications', 'jetpack' ) . |
173
|
|
|
'</span>' . |
174
|
|
|
'<span class="wpnt-notes-panel-link">' . |
175
|
|
|
'</span>' . |
176
|
|
|
'</div>' . |
177
|
|
|
'</div>', |
178
|
|
|
'class' => 'menupop', |
179
|
|
|
), |
180
|
|
|
'parent' => 'top-secondary', |
181
|
|
|
) ); |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
public function add_reader_submenu( $wp_admin_bar ) { |
185
|
|
|
$wp_admin_bar->add_menu( array( |
186
|
|
|
'parent' => 'root-default', |
187
|
|
|
'id' => 'newdash', |
188
|
|
|
'title' => __( 'Reader', 'jetpack' ), |
189
|
|
|
'href' => '#', |
190
|
|
|
) ); |
191
|
|
|
|
192
|
|
|
$wp_admin_bar->add_menu( array( |
193
|
|
|
'parent' => 'newdash', |
194
|
|
|
'id' => 'streams-header', |
195
|
|
|
'title' => _x( |
196
|
|
|
'Streams', |
197
|
|
|
'Title for Reader sub-menu that contains followed sites, likes, and recommendations', |
198
|
|
|
'jetpack' |
199
|
|
|
), |
200
|
|
|
'meta' => array( |
201
|
|
|
'class' => 'ab-submenu-header', |
202
|
|
|
) |
203
|
|
|
) ); |
204
|
|
|
|
205
|
|
|
$following_title = $this->create_menu_item_pair( |
206
|
|
|
array( |
207
|
|
|
'url' => 'https://wordpress.com/', |
208
|
|
|
'id' => 'wp-admin-bar-followed-sites', |
209
|
|
|
'label' => __( 'Followed Sites', 'jetpack' ), |
210
|
|
|
), |
211
|
|
|
array( |
212
|
|
|
'url' => 'https://wordpress.com/following/edit', |
213
|
|
|
'id' => 'wp-admin-bar-reader-followed-sites-manage', |
214
|
|
|
'label' => __( 'Manage', 'jetpack' ), |
215
|
|
|
) |
216
|
|
|
); |
217
|
|
|
|
218
|
|
|
$wp_admin_bar->add_menu( array( |
219
|
|
|
'parent' => 'newdash', |
220
|
|
|
'id' => 'following', |
221
|
|
|
'title' => $following_title, |
222
|
|
|
'meta' => array( 'class' => 'inline-action' ) |
223
|
|
|
) ); |
224
|
|
|
|
225
|
|
|
$wp_admin_bar->add_menu( array( |
226
|
|
|
'parent' => 'newdash', |
227
|
|
|
'id' => 'discover-discover', |
228
|
|
|
'title' => __( 'Discover', 'jetpack' ), |
229
|
|
|
'href' => 'https://wordpress.com/discover', |
230
|
|
|
'meta' => array( |
231
|
|
|
'class' => 'mb-icon-spacer', |
232
|
|
|
) |
233
|
|
|
) ); |
234
|
|
|
|
235
|
|
|
$wp_admin_bar->add_menu( array( |
236
|
|
|
'parent' => 'newdash', |
237
|
|
|
'id' => 'discover-search', |
238
|
|
|
'title' => __( 'Search', 'jetpack' ), |
239
|
|
|
'href' => 'https://wordpress.com/read/search', |
240
|
|
|
'meta' => array( |
241
|
|
|
'class' => 'mb-icon-spacer', |
242
|
|
|
) |
243
|
|
|
) ); |
244
|
|
|
|
245
|
|
|
$wp_admin_bar->add_menu( array( |
246
|
|
|
'parent' => 'newdash', |
247
|
|
|
'id' => 'discover-recommended-blogs', |
248
|
|
|
'title' => __( 'Recommendations', 'jetpack' ), |
249
|
|
|
'href' => 'https://wordpress.com/recommendations', |
250
|
|
|
'meta' => array( |
251
|
|
|
'class' => 'mb-icon-spacer', |
252
|
|
|
) |
253
|
|
|
) ); |
254
|
|
|
|
255
|
|
|
$wp_admin_bar->add_menu( array( |
256
|
|
|
'parent' => 'newdash', |
257
|
|
|
'id' => 'my-activity-my-likes', |
258
|
|
|
'title' => __( 'My Likes', 'jetpack' ), |
259
|
|
|
'href' => 'https://wordpress.com/activities/likes', |
260
|
|
|
'meta' => array( |
261
|
|
|
'class' => 'mb-icon-spacer', |
262
|
|
|
) |
263
|
|
|
) ); |
264
|
|
|
|
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
public function create_menu_item_pair( $primary, $secondary ) { |
268
|
|
|
$primary_class = 'ab-item ab-primary mb-icon'; |
269
|
|
|
$secondary_class = 'ab-secondary'; |
270
|
|
|
|
271
|
|
|
$primary_anchor = $this->create_menu_item_anchor( $primary_class, $primary['url'], $primary['label'], $primary['id'] ); |
272
|
|
|
$secondary_anchor = $this->create_menu_item_anchor( $secondary_class, $secondary['url'], $secondary['label'], $secondary['id'] ); |
273
|
|
|
|
274
|
|
|
return $primary_anchor . $secondary_anchor; |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
public function create_menu_item_anchor( $class, $url, $label, $id ) { |
278
|
|
|
return '<a href="' . $url . '" class="' . $class . '" id="' . $id . '">' . $label . '</a>'; |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
public function wpcom_adminbar_add_secondary_groups( $wp_admin_bar ) { |
282
|
|
|
$wp_admin_bar->add_group( array( |
283
|
|
|
'id' => 'root-default', |
284
|
|
|
'meta' => array( |
285
|
|
|
'class' => 'ab-top-menu', |
286
|
|
|
), |
287
|
|
|
) ); |
288
|
|
|
|
289
|
|
|
$wp_admin_bar->add_group( array( |
290
|
|
|
'parent' => 'blog', |
291
|
|
|
'id' => 'blog-secondary', |
292
|
|
|
'meta' => array( |
293
|
|
|
'class' => 'ab-sub-secondary', |
294
|
|
|
), |
295
|
|
|
) ); |
296
|
|
|
|
297
|
|
|
$wp_admin_bar->add_group( array( |
298
|
|
|
'id' => 'top-secondary', |
299
|
|
|
'meta' => array( |
300
|
|
|
'class' => 'ab-top-secondary', |
301
|
|
|
), |
302
|
|
|
) ); |
303
|
|
|
} |
304
|
|
|
|
305
|
|
|
public function add_me_submenu( $wp_admin_bar ) { |
306
|
|
|
$user_id = get_current_user_id(); |
307
|
|
|
if ( empty( $user_id ) ) { |
308
|
|
|
return; |
309
|
|
|
} |
310
|
|
|
|
311
|
|
|
$avatar = get_avatar( $this->user_email, 32, 'mm', '', array( 'force_display' => true ) ); |
312
|
|
|
$class = empty( $avatar ) ? '' : 'with-avatar'; |
313
|
|
|
|
314
|
|
|
// Add the 'Me' menu |
315
|
|
|
$wp_admin_bar->add_menu( array( |
316
|
|
|
'id' => 'my-account', |
317
|
|
|
'parent' => 'top-secondary', |
318
|
|
|
'title' => $avatar . '<span class="ab-text">' . __( 'Me', 'jetpack' ) . '</span>', |
319
|
|
|
'href' => '#', |
320
|
|
|
'meta' => array( |
321
|
|
|
'class' => $class, |
322
|
|
|
), |
323
|
|
|
) ); |
324
|
|
|
|
325
|
|
|
$id = 'user-actions'; |
326
|
|
|
$wp_admin_bar->add_group( array( |
327
|
|
|
'parent' => 'my-account', |
328
|
|
|
'id' => $id, |
329
|
|
|
) ); |
330
|
|
|
|
331
|
|
|
$settings_url = 'https://wordpress.com/me/account'; |
332
|
|
|
|
333
|
|
|
$logout_url = wp_logout_url(); |
334
|
|
|
|
335
|
|
|
$user_info = get_avatar( $this->user_email, 128, 'mm', '', array( 'force_display' => true ) ); |
336
|
|
|
$user_info .= '<span class="display-name">' . $this->display_name . '</span>'; |
337
|
|
|
$user_info .= '<a class="username" href="http://gravatar.com/' . $this->user_login . '">@' . $this->user_login . '</a>'; |
338
|
|
|
$user_info .= '<form action="' . $logout_url . '" method="post"><button class="ab-sign-out" type="submit">' . __( 'Sign Out', 'jetpack' ) . '</button></form>'; |
339
|
|
|
|
340
|
|
|
$wp_admin_bar->add_menu( array( |
341
|
|
|
'parent' => $id, |
342
|
|
|
'id' => 'user-info', |
343
|
|
|
'title' => $user_info, |
344
|
|
|
'meta' => array( |
345
|
|
|
'class' => 'user-info user-info-item', |
346
|
|
|
'tabindex' => -1, |
347
|
|
|
), |
348
|
|
|
) ); |
349
|
|
|
|
350
|
|
|
$wp_admin_bar->add_menu( array( |
351
|
|
|
'parent' => $id, |
352
|
|
|
'id' => 'profile-header', |
353
|
|
|
'title' => __( 'Profile', 'jetpack' ), |
354
|
|
|
'meta' => array( |
355
|
|
|
'class' => 'ab-submenu-header', |
356
|
|
|
), |
357
|
|
|
) ); |
358
|
|
|
|
359
|
|
|
$wp_admin_bar->add_menu( array( |
360
|
|
|
'parent' => $id, |
361
|
|
|
'id' => 'my-profile', |
362
|
|
|
'title' => __( 'My Profile', 'jetpack' ), |
363
|
|
|
'href' => 'https://wordpress.com/me', |
364
|
|
|
'meta' => array( |
365
|
|
|
'class' => 'mb-icon', |
366
|
|
|
), |
367
|
|
|
) ); |
368
|
|
|
|
369
|
|
|
$wp_admin_bar->add_menu( array( |
370
|
|
|
'parent' => $id, |
371
|
|
|
'id' => 'account-settings', |
372
|
|
|
'title' => __( 'Account Settings', 'jetpack' ), |
373
|
|
|
'href' => $settings_url, |
374
|
|
|
'meta' => array( |
375
|
|
|
'class' => 'mb-icon', |
376
|
|
|
), |
377
|
|
|
) ); |
378
|
|
|
|
379
|
|
|
$wp_admin_bar->add_menu( array( |
380
|
|
|
'parent' => $id, |
381
|
|
|
'id' => 'billing', |
382
|
|
|
'title' => __( 'Manage Purchases', 'jetpack' ), |
383
|
|
|
'href' => 'https://wordpress.com/me/purchases', |
384
|
|
|
'meta' => array( |
385
|
|
|
'class' => 'mb-icon', |
386
|
|
|
), |
387
|
|
|
) ); |
388
|
|
|
|
389
|
|
|
$wp_admin_bar->add_menu( array( |
390
|
|
|
'parent' => $id, |
391
|
|
|
'id' => 'security', |
392
|
|
|
'title' => __( 'Security', 'jetpack' ), |
393
|
|
|
'href' => 'https://wordpress.com/me/security', |
394
|
|
|
'meta' => array( |
395
|
|
|
'class' => 'mb-icon', |
396
|
|
|
), |
397
|
|
|
) ); |
398
|
|
|
|
399
|
|
|
$wp_admin_bar->add_menu( array( |
400
|
|
|
'parent' => $id, |
401
|
|
|
'id' => 'notifications', |
402
|
|
|
'title' => __( 'Notifications', 'jetpack' ), |
403
|
|
|
'href' => 'https://wordpress.com/me/notifications', |
404
|
|
|
'meta' => array( |
405
|
|
|
'class' => 'mb-icon', |
406
|
|
|
), |
407
|
|
|
) ); |
408
|
|
|
|
409
|
|
|
$wp_admin_bar->add_menu( array( |
410
|
|
|
'parent' => $id, |
411
|
|
|
'id' => 'special-header', |
412
|
|
|
'title' => _x( |
413
|
|
|
'Special', |
414
|
|
|
'Title for Me sub-menu that contains Get Apps, Next Steps, and Help options', |
415
|
|
|
'jetpack' |
416
|
|
|
), |
417
|
|
|
'meta' => array( |
418
|
|
|
'class' => 'ab-submenu-header', |
419
|
|
|
), |
420
|
|
|
) ); |
421
|
|
|
|
422
|
|
|
$wp_admin_bar->add_menu( array( |
423
|
|
|
'parent' => $id, |
424
|
|
|
'id' => 'get-apps', |
425
|
|
|
'title' => __( 'Get Apps', 'jetpack' ), |
426
|
|
|
'href' => 'https://wordpress.com/me/get-apps', |
427
|
|
|
'meta' => array( |
428
|
|
|
'class' => 'user-info-item', |
429
|
|
|
), |
430
|
|
|
'meta' => array( |
431
|
|
|
'class' => 'mb-icon', |
432
|
|
|
), |
433
|
|
|
) ); |
434
|
|
|
|
435
|
|
|
$wp_admin_bar->add_menu( array( |
436
|
|
|
'parent' => $id, |
437
|
|
|
'id' => 'next-steps', |
438
|
|
|
'title' => __( 'Next Steps', 'jetpack' ), |
439
|
|
|
'href' => 'https://wordpress.com/me/next', |
440
|
|
|
'meta' => array( |
441
|
|
|
'class' => 'user-info-item', |
442
|
|
|
), |
443
|
|
|
'meta' => array( |
444
|
|
|
'class' => 'mb-icon', |
445
|
|
|
), |
446
|
|
|
) ); |
447
|
|
|
|
448
|
|
|
$help_link = 'https://jetpack.com/support/'; |
449
|
|
|
|
450
|
|
|
if ( $this->is_automated_transfer_site() ) { |
451
|
|
|
$help_link = 'https://wordpress.com/help'; |
452
|
|
|
} |
453
|
|
|
|
454
|
|
|
$wp_admin_bar->add_menu( array( |
455
|
|
|
'parent' => $id, |
456
|
|
|
'id' => 'help', |
457
|
|
|
'title' => __( 'Help', 'jetpack' ), |
458
|
|
|
'href' => $help_link, |
459
|
|
|
'meta' => array( |
460
|
|
|
'class' => 'user-info-item', |
461
|
|
|
), |
462
|
|
|
'meta' => array( |
463
|
|
|
'class' => 'mb-icon', |
464
|
|
|
), |
465
|
|
|
) ); |
466
|
|
|
} |
467
|
|
|
|
468
|
|
|
public function add_write_button( $wp_admin_bar ) { |
469
|
|
|
$current_user = wp_get_current_user(); |
470
|
|
|
|
471
|
|
|
$posting_blog_id = get_current_blog_id(); |
472
|
|
|
if ( ! is_user_member_of_blog( get_current_user_id(), get_current_blog_id() ) ) { |
473
|
|
|
$posting_blog_id = $current_user->primary_blog; |
474
|
|
|
} |
475
|
|
|
|
476
|
|
|
$user_can_post = current_user_can_for_blog( $posting_blog_id, 'publish_posts' ); |
477
|
|
|
|
478
|
|
|
if ( ! $posting_blog_id || ! $user_can_post ) { |
479
|
|
|
return; |
480
|
|
|
} |
481
|
|
|
|
482
|
|
|
$blog_post_page = 'https://wordpress.com/post/' . esc_attr( $this->primary_site_slug ); |
483
|
|
|
|
484
|
|
|
$wp_admin_bar->add_menu( array( |
485
|
|
|
'parent' => 'top-secondary', |
486
|
|
|
'id' => 'ab-new-post', |
487
|
|
|
'href' => $blog_post_page, |
488
|
|
|
'title' => '<span>' . __( 'Write', 'jetpack' ) . '</span>', |
489
|
|
|
) ); |
490
|
|
|
} |
491
|
|
|
|
492
|
|
|
public function add_my_sites_submenu( $wp_admin_bar ) { |
493
|
|
|
$current_user = wp_get_current_user(); |
494
|
|
|
|
495
|
|
|
$blog_name = get_bloginfo( 'name' ); |
496
|
|
|
if ( empty( $blog_name ) ) { |
497
|
|
|
$blog_name = $this->primary_site_slug; |
498
|
|
|
} |
499
|
|
|
|
500
|
|
|
if ( mb_strlen( $blog_name ) > 20 ) { |
501
|
|
|
$blog_name = mb_substr( html_entity_decode( $blog_name, ENT_QUOTES ), 0, 20 ) . '…'; |
502
|
|
|
} |
503
|
|
|
|
504
|
|
|
$wp_admin_bar->add_menu( array( |
505
|
|
|
'parent' => 'root-default', |
506
|
|
|
'id' => 'blog', |
507
|
|
|
'title' => __( 'My Sites', 'jetpack' ), |
508
|
|
|
'href' => '#', |
509
|
|
|
'meta' => array( |
510
|
|
|
'class' => 'my-sites', |
511
|
|
|
), |
512
|
|
|
) ); |
513
|
|
|
|
514
|
|
|
$wp_admin_bar->add_menu( array( |
515
|
|
|
'parent' => 'blog', |
516
|
|
|
'id' => 'switch-site', |
517
|
|
|
'title' => __( 'Switch Site', 'jetpack' ), |
518
|
|
|
'href' => 'https://wordpress.com/sites', |
519
|
|
|
) ); |
520
|
|
|
|
521
|
|
|
if ( is_user_member_of_blog( $current_user->ID ) ) { |
522
|
|
|
$blavatar = ''; |
523
|
|
|
$class = 'current-site'; |
524
|
|
|
|
525
|
|
|
if ( has_site_icon() ) { |
526
|
|
|
$src = get_site_icon_url(); |
527
|
|
|
$blavatar = '<img class="avatar" src="'. esc_attr( $src ) . '" alt="Current site avatar">'; |
528
|
|
|
$class = 'has-blavatar'; |
529
|
|
|
} |
530
|
|
|
|
531
|
|
|
$site_link = str_replace( '::', '/', $this->primary_site_slug ); |
532
|
|
|
$blog_info = '<div class="ab-site-icon">' . $blavatar . '</div>'; |
533
|
|
|
$blog_info .= '<span class="ab-site-title">' . esc_html( $blog_name ) . '</span>'; |
534
|
|
|
$blog_info .= '<span class="ab-site-description">' . esc_html( $site_link ) . '</span>'; |
535
|
|
|
|
536
|
|
|
$wp_admin_bar->add_menu( array( |
537
|
|
|
'parent' => 'blog', |
538
|
|
|
'id' => 'blog-info', |
539
|
|
|
'title' => $blog_info, |
540
|
|
|
'href' => esc_url( trailingslashit( $this->primary_site_slug ) ), |
541
|
|
|
'meta' => array( |
542
|
|
|
'class' => $class, |
543
|
|
|
), |
544
|
|
|
) ); |
545
|
|
|
|
546
|
|
|
} |
547
|
|
|
|
548
|
|
|
// Stats |
549
|
|
View Code Duplication |
if ( Jetpack::is_module_active( 'stats' ) ) { |
550
|
|
|
$wp_admin_bar->add_menu( array( |
551
|
|
|
'parent' => 'blog', |
552
|
|
|
'id' => 'blog-stats', |
553
|
|
|
'title' => __( 'Stats', 'jetpack' ), |
554
|
|
|
'href' => 'https://wordpress.com/stats/' . esc_attr( $this->primary_site_slug ), |
555
|
|
|
'meta' => array( |
556
|
|
|
'class' => 'mb-icon', |
557
|
|
|
), |
558
|
|
|
) ); |
559
|
|
|
} |
560
|
|
|
|
561
|
|
|
// Add Calypso plans link and plan type indicator |
562
|
|
|
if ( is_user_member_of_blog( $current_user->ID ) ) { |
563
|
|
|
$plans_url = 'https://wordpress.com/plans/' . esc_attr( $this->primary_site_slug ); |
564
|
|
|
$label = __( 'Plan', 'jetpack' ); |
565
|
|
|
$plan = Jetpack::get_active_plan(); |
566
|
|
|
|
567
|
|
|
$plan_title = $this->create_menu_item_pair( |
568
|
|
|
array( |
569
|
|
|
'url' => $plans_url, |
570
|
|
|
'id' => 'wp-admin-bar-plan', |
571
|
|
|
'label' => $label, |
572
|
|
|
), |
573
|
|
|
array( |
574
|
|
|
'url' => $plans_url, |
575
|
|
|
'id' => 'wp-admin-bar-plan-badge', |
576
|
|
|
'label' => $plan['product_name_short'] |
577
|
|
|
) |
578
|
|
|
); |
579
|
|
|
|
580
|
|
|
$wp_admin_bar->add_menu( array( |
581
|
|
|
'parent' => 'blog', |
582
|
|
|
'id' => 'plan', |
583
|
|
|
'title' => $plan_title, |
584
|
|
|
'meta' => array( |
585
|
|
|
'class' => 'inline-action', |
586
|
|
|
), |
587
|
|
|
) ); |
588
|
|
|
} |
589
|
|
|
|
590
|
|
|
// Publish group |
591
|
|
|
$wp_admin_bar->add_group( array( |
592
|
|
|
'parent' => 'blog', |
593
|
|
|
'id' => 'publish', |
594
|
|
|
) ); |
595
|
|
|
|
596
|
|
|
// Publish header |
597
|
|
|
$wp_admin_bar->add_menu( array( |
598
|
|
|
'parent' => 'publish', |
599
|
|
|
'id' => 'publish-header', |
600
|
|
|
'title' => _x( 'Publish', 'admin bar menu group label', 'jetpack' ), |
601
|
|
|
'meta' => array( |
602
|
|
|
'class' => 'ab-submenu-header', |
603
|
|
|
), |
604
|
|
|
) ); |
605
|
|
|
|
606
|
|
|
// Blog Posts |
607
|
|
|
$posts_title = $this->create_menu_item_pair( |
608
|
|
|
array( |
609
|
|
|
'url' => 'https://wordpress.com/posts/' . esc_attr( $this->primary_site_slug ), |
610
|
|
|
'id' => 'wp-admin-bar-edit-post', |
611
|
|
|
'label' => __( 'Blog Posts', 'jetpack' ), |
612
|
|
|
), |
613
|
|
|
array( |
614
|
|
|
'url' => 'https://wordpress.com/post/' . esc_attr( $this->primary_site_slug ), |
615
|
|
|
'id' => 'wp-admin-bar-new-post', |
616
|
|
|
'label' => _x( 'Add', 'admin bar menu new item label', 'jetpack' ), |
617
|
|
|
) |
618
|
|
|
); |
619
|
|
|
|
620
|
|
|
if ( ! current_user_can( 'edit_posts' ) ) { |
621
|
|
|
$posts_title = $this->create_menu_item_anchor( |
622
|
|
|
'ab-item ab-primary mb-icon', |
623
|
|
|
'https://wordpress.com/posts/' . esc_attr( $this->primary_site_slug ), |
624
|
|
|
__( 'Blog Posts', 'jetpack' ), |
625
|
|
|
'wp-admin-bar-edit-post' |
626
|
|
|
); |
627
|
|
|
} |
628
|
|
|
|
629
|
|
|
$wp_admin_bar->add_menu( array( |
630
|
|
|
'parent' => 'publish', |
631
|
|
|
'id' => 'new-post', |
632
|
|
|
'title' => $posts_title, |
633
|
|
|
'meta' => array( |
634
|
|
|
'class' => 'inline-action', |
635
|
|
|
), |
636
|
|
|
) ); |
637
|
|
|
|
638
|
|
|
// Pages |
639
|
|
|
$pages_title = $this->create_menu_item_pair( |
640
|
|
|
array( |
641
|
|
|
'url' => 'https://wordpress.com/pages/' . esc_attr( $this->primary_site_slug ), |
642
|
|
|
'id' => 'wp-admin-bar-edit-page', |
643
|
|
|
'label' => __( 'Pages', 'jetpack' ), |
644
|
|
|
), |
645
|
|
|
array( |
646
|
|
|
'url' => 'https://wordpress.com/page/' . esc_attr( $this->primary_site_slug ), |
647
|
|
|
'id' => 'wp-admin-bar-new-page', |
648
|
|
|
'label' => _x( 'Add', 'admin bar menu new item label', 'jetpack' ), |
649
|
|
|
) |
650
|
|
|
); |
651
|
|
|
|
652
|
|
|
if ( ! current_user_can( 'edit_pages' ) ) { |
653
|
|
|
$pages_title = $this->create_menu_item_anchor( |
654
|
|
|
'ab-item ab-primary mb-icon', |
655
|
|
|
'https://wordpress.com/pages/' . esc_attr( $this->primary_site_slug ), |
656
|
|
|
__( 'Pages', 'jetpack' ), |
657
|
|
|
'wp-admin-bar-edit-page' |
658
|
|
|
); |
659
|
|
|
} |
660
|
|
|
|
661
|
|
|
$wp_admin_bar->add_menu( array( |
662
|
|
|
'parent' => 'publish', |
663
|
|
|
'id' => 'new-page', |
664
|
|
|
'title' => $pages_title, |
665
|
|
|
'meta' => array( |
666
|
|
|
'class' => 'inline-action', |
667
|
|
|
), |
668
|
|
|
) ); |
669
|
|
|
|
670
|
|
|
// Testimonials |
671
|
|
View Code Duplication |
if ( Jetpack::is_module_active( 'custom-content-types' ) && get_option( 'jetpack_testimonial' ) ) { |
672
|
|
|
$testimonials_title = $this->create_menu_item_pair( |
673
|
|
|
array( |
674
|
|
|
'url' => 'https://wordpress.com/types/jetpack-testimonial/' . esc_attr( $this->primary_site_slug ), |
675
|
|
|
'id' => 'wp-admin-bar-edit-testimonial', |
676
|
|
|
'label' => __( 'Testimonials', 'jetpack' ), |
677
|
|
|
), |
678
|
|
|
array( |
679
|
|
|
'url' => 'https://wordpress.com/edit/jetpack-testimonial/' . esc_attr( $this->primary_site_slug ), |
680
|
|
|
'id' => 'wp-admin-bar-new-testimonial', |
681
|
|
|
'label' => _x( 'Add', 'admin bar menu new item label', 'jetpack' ), |
682
|
|
|
) |
683
|
|
|
); |
684
|
|
|
|
685
|
|
|
if ( ! current_user_can( 'edit_pages' ) ) { |
686
|
|
|
$testimonials_title = $this->create_menu_item_anchor( |
687
|
|
|
'ab-item ab-primary mb-icon', |
688
|
|
|
'https://wordpress.com/types/jetpack-testimonial/' . esc_attr( $this->primary_site_slug ), |
689
|
|
|
__( 'Testimonials', 'jetpack' ), |
690
|
|
|
'wp-admin-bar-edit-testimonial' |
691
|
|
|
); |
692
|
|
|
} |
693
|
|
|
|
694
|
|
|
$wp_admin_bar->add_menu( array( |
695
|
|
|
'parent' => 'publish', |
696
|
|
|
'id' => 'new-jetpack-testimonial', |
697
|
|
|
'title' => $testimonials_title, |
698
|
|
|
'meta' => array( |
699
|
|
|
'class' => 'inline-action', |
700
|
|
|
), |
701
|
|
|
) ); |
702
|
|
|
} |
703
|
|
|
|
704
|
|
|
// Portfolio |
705
|
|
View Code Duplication |
if ( Jetpack::is_module_active( 'custom-content-types' ) && get_option( 'jetpack_portfolio' ) ) { |
706
|
|
|
$portfolios_title = $this->create_menu_item_pair( |
707
|
|
|
array( |
708
|
|
|
'url' => 'https://wordpress.com/types/jetpack-portfolio/' . esc_attr( $this->primary_site_slug ), |
709
|
|
|
'id' => 'wp-admin-bar-edit-portfolio', |
710
|
|
|
'label' => __( 'Portfolio', 'jetpack' ), |
711
|
|
|
), |
712
|
|
|
array( |
713
|
|
|
'url' => 'https://wordpress.com/edit/jetpack-portfolio/' . esc_attr( $this->primary_site_slug ), |
714
|
|
|
'id' => 'wp-admin-bar-new-portfolio', |
715
|
|
|
'label' => _x( 'Add', 'admin bar menu new item label', 'jetpack' ), |
716
|
|
|
) |
717
|
|
|
); |
718
|
|
|
|
719
|
|
|
if ( ! current_user_can( 'edit_pages' ) ) { |
720
|
|
|
$portfolios_title = $this->create_menu_item_anchor( |
721
|
|
|
'ab-item ab-primary mb-icon', |
722
|
|
|
'https://wordpress.com/types/jetpack-portfolio/' . esc_attr( $this->primary_site_slug ), |
723
|
|
|
__( 'Portfolio', 'jetpack' ), |
724
|
|
|
'wp-admin-bar-edit-portfolio' |
725
|
|
|
); |
726
|
|
|
} |
727
|
|
|
|
728
|
|
|
$wp_admin_bar->add_menu( array( |
729
|
|
|
'parent' => 'publish', |
730
|
|
|
'id' => 'new-jetpack-portfolio', |
731
|
|
|
'title' => $portfolios_title, |
732
|
|
|
'meta' => array( |
733
|
|
|
'class' => 'inline-action', |
734
|
|
|
), |
735
|
|
|
) ); |
736
|
|
|
} |
737
|
|
|
|
738
|
|
|
if ( current_user_can( 'edit_theme_options' ) ) { |
739
|
|
|
// Look and Feel group |
740
|
|
|
$wp_admin_bar->add_group( array( |
741
|
|
|
'parent' => 'blog', |
742
|
|
|
'id' => 'look-and-feel', |
743
|
|
|
) ); |
744
|
|
|
|
745
|
|
|
// Look and Feel header |
746
|
|
|
$wp_admin_bar->add_menu( array( |
747
|
|
|
'parent' => 'look-and-feel', |
748
|
|
|
'id' => 'look-and-feel-header', |
749
|
|
|
'title' => _x( 'Personalize', 'admin bar menu group label', 'jetpack' ), |
750
|
|
|
'meta' => array( |
751
|
|
|
'class' => 'ab-submenu-header', |
752
|
|
|
), |
753
|
|
|
) ); |
754
|
|
|
|
755
|
|
|
if ( is_admin() ) { |
756
|
|
|
// In wp-admin the `return` query arg will return to that page after closing the Customizer |
757
|
|
|
$customizer_url = add_query_arg( array( 'return' => urlencode( site_url( $_SERVER['REQUEST_URI'] ) ) ), wp_customize_url() ); |
758
|
|
|
} else { |
759
|
|
|
// On the frontend the `url` query arg will load that page in the Customizer and also return to it after closing |
760
|
|
|
// non-home URLs won't work unless we undo domain mapping since the Customizer preview is unmapped to always have HTTPS |
761
|
|
|
$current_page = '//' . $this->primary_site_slug . $_SERVER['REQUEST_URI']; |
762
|
|
|
$customizer_url = add_query_arg( array( 'url' => urlencode( $current_page ) ), wp_customize_url() ); |
763
|
|
|
} |
764
|
|
|
|
765
|
|
|
$theme_title = $this->create_menu_item_pair( |
766
|
|
|
array( |
767
|
|
|
'url' => 'https://wordpress.com/design/' . esc_attr( $this->primary_site_slug ), |
768
|
|
|
'id' => 'wp-admin-bar-themes', |
769
|
|
|
'label' => __( 'Themes', 'jetpack' ), |
770
|
|
|
), |
771
|
|
|
array( |
772
|
|
|
'url' => $customizer_url, |
773
|
|
|
'id' => 'wp-admin-bar-cmz', |
774
|
|
|
'label' => _x( 'Customize', 'admin bar customize item label', 'jetpack' ), |
775
|
|
|
) |
776
|
|
|
); |
777
|
|
|
$meta = array( 'class' => 'mb-icon', 'class' => 'inline-action' ); |
778
|
|
|
$href = false; |
779
|
|
|
|
780
|
|
|
$wp_admin_bar->add_menu( array( |
781
|
|
|
'parent' => 'look-and-feel', |
782
|
|
|
'id' => 'themes', |
783
|
|
|
'title' => $theme_title, |
784
|
|
|
'href' => $href, |
785
|
|
|
'meta' => $meta |
786
|
|
|
) ); |
787
|
|
|
|
788
|
|
View Code Duplication |
if ( current_theme_supports( 'menus' ) ) { |
789
|
|
|
$wp_admin_bar->add_menu( array( |
790
|
|
|
'parent' => 'look-and-feel', |
791
|
|
|
'id' => 'menus', |
792
|
|
|
'title' => __( 'Menus', 'jetpack' ), |
793
|
|
|
'href' => 'https://wordpress.com/menus/' . esc_attr( $this->primary_site_slug ), |
794
|
|
|
'meta' => array( |
795
|
|
|
'class' => 'mb-icon', |
796
|
|
|
), |
797
|
|
|
) ); |
798
|
|
|
} |
799
|
|
|
} |
800
|
|
|
|
801
|
|
|
if ( current_user_can( 'manage_options' ) ) { |
802
|
|
|
// Configuration group |
803
|
|
|
$wp_admin_bar->add_group( array( |
804
|
|
|
'parent' => 'blog', |
805
|
|
|
'id' => 'configuration', |
806
|
|
|
) ); |
807
|
|
|
|
808
|
|
|
// Configuration header |
809
|
|
|
$wp_admin_bar->add_menu( array( |
810
|
|
|
'parent' => 'configuration', |
811
|
|
|
'id' => 'configuration-header', |
812
|
|
|
'title' => __( 'Configure', 'admin bar menu group label', 'jetpack' ), |
813
|
|
|
'meta' => array( |
814
|
|
|
'class' => 'ab-submenu-header', |
815
|
|
|
), |
816
|
|
|
) ); |
817
|
|
|
|
818
|
|
View Code Duplication |
if ( Jetpack::is_module_active( 'publicize' ) || Jetpack::is_module_active( 'sharedaddy' ) ) { |
819
|
|
|
$wp_admin_bar->add_menu( array( |
820
|
|
|
'parent' => 'configuration', |
821
|
|
|
'id' => 'sharing', |
822
|
|
|
'title' => __( 'Sharing', 'jetpack' ), |
823
|
|
|
'href' => 'https://wordpress.com/sharing/' . esc_attr( $this->primary_site_slug ), |
824
|
|
|
'meta' => array( |
825
|
|
|
'class' => 'mb-icon', |
826
|
|
|
), |
827
|
|
|
) ); |
828
|
|
|
} |
829
|
|
|
|
830
|
|
|
$people_title = $this->create_menu_item_pair( |
831
|
|
|
array( |
832
|
|
|
'url' => 'https://wordpress.com/people/team/' . esc_attr( $this->primary_site_slug ), |
833
|
|
|
'id' => 'wp-admin-bar-people', |
834
|
|
|
'label' => __( 'People', 'jetpack' ), |
835
|
|
|
), |
836
|
|
|
array( |
837
|
|
|
'url' => '//' . esc_attr( $this->primary_site_slug ) . '/wp-admin/user-new.php', |
838
|
|
|
'id' => 'wp-admin-bar-people-add', |
839
|
|
|
'label' => _x( 'Add', 'admin bar people item label', 'jetpack' ), |
840
|
|
|
) |
841
|
|
|
); |
842
|
|
|
|
843
|
|
|
$wp_admin_bar->add_menu( array( |
844
|
|
|
'parent' => 'configuration', |
845
|
|
|
'id' => 'users-toolbar', |
846
|
|
|
'title' => $people_title, |
847
|
|
|
'href' => false, |
848
|
|
|
'meta' => array( |
849
|
|
|
'class' => 'inline-action', |
850
|
|
|
), |
851
|
|
|
) ); |
852
|
|
|
|
853
|
|
|
$plugins_title = $this->create_menu_item_pair( |
854
|
|
|
array( |
855
|
|
|
'url' => 'https://wordpress.com/plugins/' . esc_attr( $this->primary_site_slug ), |
856
|
|
|
'id' => 'wp-admin-bar-plugins', |
857
|
|
|
'label' => __( 'Plugins', 'jetpack' ), |
858
|
|
|
), |
859
|
|
|
array( |
860
|
|
|
'url' => 'https://wordpress.com/plugins/browse/' . esc_attr( $this->primary_site_slug ), |
861
|
|
|
'id' => 'wp-admin-bar-plugins-add', |
862
|
|
|
'label' => _x( 'Add', 'Label for the button on the Masterbar to add a new plugin', 'jetpack' ), |
863
|
|
|
) |
864
|
|
|
); |
865
|
|
|
|
866
|
|
|
$wp_admin_bar->add_menu( array( |
867
|
|
|
'parent' => 'configuration', |
868
|
|
|
'id' => 'plugins', |
869
|
|
|
'title' => $plugins_title, |
870
|
|
|
'href' => false, |
871
|
|
|
'meta' => array( |
872
|
|
|
'class' => 'inline-action', |
873
|
|
|
), |
874
|
|
|
) ); |
875
|
|
|
|
876
|
|
|
if ( $this->is_automated_transfer_site() ) { |
877
|
|
|
$domain_title = $this->create_menu_item_pair( |
878
|
|
|
array( |
879
|
|
|
'url' => 'https://wordpress.com/domains/' . esc_attr( $this->primary_site_slug ), |
880
|
|
|
'id' => 'wp-admin-bar-domains', |
881
|
|
|
'label' => __( 'Domains', 'jetpack' ), |
882
|
|
|
), |
883
|
|
|
array( |
884
|
|
|
'url' => 'https://wordpress.com/domains/add/' . esc_attr( $this->primary_site_slug ), |
885
|
|
|
'id' => 'wp-admin-bar-domains-add', |
886
|
|
|
'label' => _x( 'Add', 'Label for the button on the Masterbar to add a new domain', 'jetpack' ), |
887
|
|
|
) |
888
|
|
|
); |
889
|
|
|
$wp_admin_bar->add_menu( array( |
890
|
|
|
'parent' => 'configuration', |
891
|
|
|
'id' => 'domains', |
892
|
|
|
'title' => $domain_title, |
893
|
|
|
'href' => false, |
894
|
|
|
'meta' => array( |
895
|
|
|
'class' => 'inline-action', |
896
|
|
|
), |
897
|
|
|
) ); |
898
|
|
|
} |
899
|
|
|
|
900
|
|
|
|
901
|
|
|
$wp_admin_bar->add_menu( array( |
902
|
|
|
'parent' => 'configuration', |
903
|
|
|
'id' => 'blog-settings', |
904
|
|
|
'title' => __( 'Settings', 'jetpack' ), |
905
|
|
|
'href' => 'https://wordpress.com/settings/general/' . esc_attr( $this->primary_site_slug ), |
906
|
|
|
'meta' => array( |
907
|
|
|
'class' => 'mb-icon', |
908
|
|
|
), |
909
|
|
|
) ); |
910
|
|
|
|
911
|
|
View Code Duplication |
if ( $this->is_automated_transfer_site() ) { |
912
|
|
|
$wp_admin_bar->add_menu( array( |
913
|
|
|
'parent' => 'configuration', |
914
|
|
|
'id' => 'legacy-dashboard', |
915
|
|
|
'title' => __( 'WP Admin', 'jetpack' ), |
916
|
|
|
'href' => '//' . esc_attr( $this->primary_site_slug ) . '/wp-admin/', |
917
|
|
|
'meta' => array( |
918
|
|
|
'class' => 'mb-icon', |
919
|
|
|
), |
920
|
|
|
) ); |
921
|
|
|
} |
922
|
|
|
} |
923
|
|
|
} |
924
|
|
|
} |
925
|
|
|
|