-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbreakdance-quicknav.php
643 lines (563 loc) · 26.3 KB
/
breakdance-quicknav.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
<?php
/**
* Forked from "Breakdance Navigator" by Peter Kulcsár
* License: GPL v2 or later
* GitHub Repository: https://github.com/beamkiller/breakdance-navigator
*/
/**
* Plugin Name: Breakdance QuickNav
* Plugin URI: https://github.com/deckerweb/breakdance-quicknav
* Description: Adds a quick-access navigator (aka QuickNav) to the WordPress Admin Bar (Toolbar). It allows easy access to Breakdance Templates, Headers, Footers, Global Blocks, Popups, and Pages edited with Breakdance, along with some other essential settings.
* Version: 1.0.0
* Author: David Decker – DECKERWEB
* Author URI: https://deckerweb.de/
* Text Domain: breakdance-quicknav
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Requires WP: 6.7
* Requires PHP: 7.4
*
* Original Copyright (c) 2024 Peter Kulcsár
* Copyright (c) 2025 David Decker – DECKERWEB
*/
/** Prevent direct access */
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! class_exists( 'DDW_Breakdance_QuickNav' ) ) {
class DDW_Breakdance_QuickNav {
public function __construct() {
add_action( 'admin_bar_menu', array( $this, 'add_admin_bar_menu' ), 999 );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_bar_styles' ) ); // for Admin
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_admin_bar_styles' ) ); // for front-end
}
/**
* Enqueue custom styles for the admin bar.
*/
public function enqueue_admin_bar_styles() {
$inline_css = sprintf(
'
/* Style for the separator */
#wp-admin-bar-ddw-breakdance-quicknav > .ab-sub-wrapper #wp-admin-bar-bdqn-settings {
border-bottom: 1px dashed rgba(255, 255, 255, 0.33);
padding-bottom: 5px;
}
'
);
if ( is_admin_bar_showing() ) {
wp_add_inline_style( 'admin-bar', $inline_css );
}
}
/**
* Adds the main Breakdance menu and its submenus to the Admin Bar.
*
* @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
*/
public function add_admin_bar_menu( $wp_admin_bar ) {
/** Don't do anything if Breakdance Builder plugin is NOT active */
if ( ! defined( '__BREAKDANCE_VERSION' ) ) {
return;
}
$bdqn_permission = ( defined( 'BDQN_VIEW_CAPABILITY' ) ) ? BDQN_VIEW_CAPABILITY : 'activate_plugins';
if ( ! current_user_can( sanitize_key( $bdqn_permission ) ) ) {
return;
}
$bdqn_name = ( defined( 'BDQN_NAME_IN_ADMINBAR' ) ) ? esc_html( BDQN_NAME_IN_ADMINBAR ) : esc_html__( 'BD', 'breakdance-quicknav' );
/**
* Add the parent menu item with an icon (main node)
*/
$bd_builder_icon = 'breakdance/builder/dist/favicon-dark.svg';
$bd_packaged_icon = plugin_dir_url( __FILE__ ) . 'images/breakdance-icon.png';
$icon_path = trailingslashit( WP_PLUGIN_DIR ) . $bd_builder_icon;
$icon_url = file_exists( $icon_path ) ? plugins_url( $bd_builder_icon, dirname( __FILE__ ) ) : $bd_packaged_icon;
$icon_url = ( defined( 'BDQN_ICON' ) && 'yellow' === BDQN_ICON ) ? $bd_packaged_icon : $icon_url;
$title_html = '<img src="' . esc_url( $icon_url ) . '" style="display:inline-block;padding-right:6px;vertical-align:middle;width:16px;height:16px;" alt="" />' . $bdqn_name;
$title_html = wp_kses( $title_html, array(
'img' => array(
'src' => array(),
'style' => array(),
'alt' => array(),
),
) );
/** Main menu item */
$wp_admin_bar->add_node( array(
'id' => 'ddw-breakdance-quicknav',
'title' => $title_html,
'href' => '#',
) );
/** Add submenus */
$this->add_pages_submenu( $wp_admin_bar );
$this->add_templates_submenu( $wp_admin_bar );
$this->add_headers_submenu( $wp_admin_bar );
$this->add_footers_submenu( $wp_admin_bar );
$this->add_global_blocks_submenu( $wp_admin_bar );
$this->add_popups_submenu( $wp_admin_bar );
$this->add_form_submissions_submenu( $wp_admin_bar );
$this->add_design_library_submenu( $wp_admin_bar );
$this->add_settings_submenu( $wp_admin_bar );
$this->add_plugin_support_group( $wp_admin_bar ); // group node
$this->add_headspin_submenu( $wp_admin_bar );
$this->add_yabe_webfont_submenu( $wp_admin_bar );
$this->add_wpsix_exporter_submenu( $wp_admin_bar );
$this->add_footer_group( $wp_admin_bar ); // group node
$this->add_links_submenu( $wp_admin_bar );
$this->add_about_submenu( $wp_admin_bar );
}
/**
* Add Pages submenu (just regular WordPress Pages)
* NOTE: This sets the parent item; no Breakdance related stuff here, yet.
*/
private function add_pages_submenu( $wp_admin_bar ) {
$wp_admin_bar->add_node( array(
'id' => 'bdqn-pages',
'title' => esc_html__( 'Pages', 'breakdance-quicknav' ),
'href' => esc_url( admin_url( 'edit.php?post_type=page' ) ),
'parent' => 'ddw-breakdance-quicknav',
) );
$this->add_breakdance_pages_to_admin_bar( $wp_admin_bar );
}
/**
* Add up to 10 Breakdance-edited Pages
*/
private function add_breakdance_pages_to_admin_bar( $wp_admin_bar ) {
$bd_pages = $this->get_breakdance_pages();
if ( $bd_pages ) {
foreach ( $bd_pages as $bd_page ) {
$edit_link = site_url( '/?breakdance=builder&id=' . intval( $bd_page->ID ) );
$wp_admin_bar->add_node( array(
'id' => 'bdqn-page-' . intval( $bd_page->ID ),
'title' => esc_html( $bd_page->post_title ),
'href' => esc_url( $edit_link ),
'parent' => 'bdqn-pages',
) );
} // end foreach
} // end if
}
/**
* Get all Breakdance-edited Pages. Helper function.
*/
private function get_breakdance_pages() {
$args = array(
'post_type' => 'page',
'posts_per_page' => 10,
'post_status' => 'publish',
'orderby' => 'modified',
'order' => 'DESC',
'meta_query' => array(
array(
'key' => '_breakdance_data', // only BD-edited pages have that
'compare' => 'EXISTS',
),
),
);
return get_posts( $args );
}
/**
* Get items of a Breakdance template type. Helper function.
*
* @uses get_posts()
*
* @param string $post_type Slug of post type to query for.
*/
private function get_breakdance_template_type( $post_type ) {
$args = array(
'post_type' => sanitize_key( $post_type ),
'posts_per_page' => 10,
'post_status' => 'publish',
'orderby' => 'modified',
'order' => 'DESC',
);
apply_filters( 'ddw/quicknav/bd_get_template_type', $args, $post_type );
return get_posts( $args );
}
/**
* Add Breakdance Templates submenu (parent node)
*/
private function add_templates_submenu( $wp_admin_bar ) {
$wp_admin_bar->add_node( array(
'id' => 'bdqn-templates',
'title' => esc_html__( 'Templates', 'breakdance-quicknav' ),
'href' => esc_url( admin_url( 'admin.php?page=breakdance_template' ) ),
'parent' => 'ddw-breakdance-quicknav',
) );
$this->add_templates_to_admin_bar( $wp_admin_bar );
}
/**
* Add up to 10 Breakdance Templates (child nodes)
*/
private function add_templates_to_admin_bar( $wp_admin_bar ) {
$templates = $this->get_breakdance_template_type( 'breakdance_template' );
if ( $templates ) {
foreach ( $templates as $template ) {
/** Skip the internal BD Fallback templates */
if ( strpos( $template->post_title, 'Fallback: ' ) === 0 ) {
continue;
}
$edit_link = site_url( '/?breakdance=builder&id=' . intval( $template->ID ) );
$wp_admin_bar->add_node( array(
'id' => 'bdqn-template-' . intval( $template->ID ),
'title' => esc_html( $template->post_title ),
'href' => esc_url( $edit_link ),
'parent' => 'bdqn-templates',
) );
} // end foreach
} // end if
}
/**
* Add Breakdance Headers submenu (parent node)
*/
private function add_headers_submenu( $wp_admin_bar ) {
$wp_admin_bar->add_node( array(
'id' => 'bdqn-headers',
'title' => esc_html__( 'Headers', 'breakdance-quicknav' ),
'href' => esc_url( admin_url( 'admin.php?page=breakdance_header' ) ),
'parent' => 'ddw-breakdance-quicknav',
) );
$this->add_headers_to_admin_bar( $wp_admin_bar );
}
/**
* Add up to 10 Breakdance Header templates (child nodes)
*/
private function add_headers_to_admin_bar( $wp_admin_bar ) {
$headers = $this->get_breakdance_template_type( 'breakdance_header' );
if ( $headers ) {
foreach ( $headers as $header ) {
$edit_link = site_url( '/?breakdance=builder&id=' . intval( $header->ID ) );
$wp_admin_bar->add_node( array(
'id' => 'bdqn-header-' . intval( $header->ID ),
'title' => esc_html( $header->post_title ),
'href' => esc_url( $edit_link ),
'parent' => 'bdqn-headers',
) );
} // end foreach
} // end if
}
/**
* Add Breakdance Footers submenu (parent node)
*/
private function add_footers_submenu( $wp_admin_bar ) {
$wp_admin_bar->add_node( array(
'id' => 'bdqn-footers',
'title' => esc_html__( 'Footers', 'breakdance-quicknav' ),
'href' => esc_url( admin_url( 'admin.php?page=breakdance_footer' ) ),
'parent' => 'ddw-breakdance-quicknav',
) );
$this->add_footers_to_admin_bar( $wp_admin_bar );
}
/**
* Add up to 10 Breakdance Footer templates (child nodes)
*/
private function add_footers_to_admin_bar( $wp_admin_bar ) {
$footers = $this->get_breakdance_template_type( 'breakdance_footer' );
if ( $footers ) {
foreach ( $footers as $footer ) {
$edit_link = site_url( '/?breakdance=builder&id=' . intval( $footer->ID ) );
$wp_admin_bar->add_node( array(
'id' => 'bdn-footer-' . intval( $footer->ID ),
'title' => esc_html( $footer->post_title ),
'href' => esc_url( $edit_link ),
'parent' => 'bdqn-footers',
) );
} // end foreach
} // end if
}
/**
* Add Breakdance Global Blocks submenu (parent node)
*/
private function add_global_blocks_submenu( $wp_admin_bar ) {
$wp_admin_bar->add_node( array(
'id' => 'bdqn-global-blocks',
'title' => esc_html__( 'Global Blocks', 'breakdance-quicknav' ),
'href' => esc_url( admin_url( 'admin.php?page=breakdance_block' ) ),
'parent' => 'ddw-breakdance-quicknav',
) );
$this->add_global_blocks_to_admin_bar( $wp_admin_bar );
}
/**
* Add up to 10 Breakdance Global Block templates (child nodes)
*/
private function add_global_blocks_to_admin_bar( $wp_admin_bar ) {
$blocks = $this->get_breakdance_template_type( 'breakdance_block' );
if ( $blocks ) {
foreach ( $blocks as $block ) {
$edit_link = site_url( '/?breakdance=builder&id=' . intval( $block->ID ) );
$wp_admin_bar->add_node( array(
'id' => 'bdqn-block-' . intval( $block->ID ),
'title' => esc_html( $block->post_title ),
'href' => esc_url( $edit_link ),
'parent' => 'bdqn-global-blocks',
) );
} // end foreach
} // end if
}
/**
* Add Breakdance Popups submenu (parent node)
*/
private function add_popups_submenu( $wp_admin_bar ) {
$wp_admin_bar->add_node( array(
'id' => 'bdqn-popups',
'title' => esc_html__( 'Popups', 'breakdance-quicknav' ),
'href' => esc_url( admin_url( 'admin.php?page=breakdance_popup' ) ),
'parent' => 'ddw-breakdance-quicknav',
) );
$this->add_popups_to_admin_bar( $wp_admin_bar );
}
/**
* Add up to 10 Breakdance Popup templates (child nodes)
*/
private function add_popups_to_admin_bar( $wp_admin_bar ) {
$popups = $this->get_breakdance_template_type( 'breakdance_popup' );
if ( $popups ) {
foreach ( $popups as $popup ) {
$edit_link = site_url( '/?breakdance=builder&id=' . intval( $popup->ID ) );
$wp_admin_bar->add_node( array(
'id' => 'bdqn-popup-' . intval( $popup->ID ),
'title' => esc_html( $popup->post_title ),
'href' => esc_url( $edit_link ),
'parent' => 'bdqn-popups',
) );
} // end foreach
} // end if
}
/**
* Add Form Submissions submenu (for Breakdance Forms)
*/
private function add_form_submissions_submenu( $wp_admin_bar ) {
$wp_admin_bar->add_node( array(
'id' => 'bdqn-form-submissions',
'title' => esc_html__( 'Form Submissions', 'breakdance-quicknav' ),
'href' => esc_url( admin_url( 'edit.php?post_type=breakdance_form_res' ) ),
'parent' => 'ddw-breakdance-quicknav',
) );
}
/**
* Add Breakdance Design Library submenu
*/
private function add_design_library_submenu( $wp_admin_bar ) {
$wp_admin_bar->add_node( array(
'id' => 'bdqn-design-library',
'title' => esc_html__( 'Design Library', 'breakdance-quicknav' ),
'href' => esc_url( admin_url( 'admin.php?page=breakdance_design_library' ) ),
'parent' => 'ddw-breakdance-quicknav',
) );
}
/**
* Add Breakdance Settings submenu (parent node)
*/
private function add_settings_submenu( $wp_admin_bar ) {
$wp_admin_bar->add_node( array(
'id' => 'bdqn-settings',
'title' => esc_html__( 'Settings', 'breakdance-quicknav' ),
'href' => esc_url( admin_url( 'admin.php?page=breakdance_settings' ) ),
'parent' => 'ddw-breakdance-quicknav',
'meta' => array( 'class' => 'bdn-settings-separator' ),
) );
$settings_submenus = array(
'global_styles' => __( 'Global Styles', 'breakdance-quicknav' ),
'theme_disabler' => __( 'Theme', 'breakdance-quicknav' ),
'permissions' => __( 'User Access', 'breakdance-quicknav' ),
'maintenance-mode' => __( 'Maintenance', 'breakdance-quicknav' ),
'bloat_eliminator' => __( 'Performance', 'breakdance-quicknav' ),
'api_keys' => __( 'API Keys', 'breakdance-quicknav' ),
'post_types' => __( 'Post Types', 'breakdance-quicknav' ),
'advanced' => __( 'Advanced', 'breakdance-quicknav' ),
'privacy' => __( 'Privacy', 'breakdance-quicknav' ),
'design_library' => __( 'Design Library', 'breakdance-quicknav' ),
'header_footer' => __( 'Custom Code', 'breakdance-quicknav' ),
'tools' => __( 'Tools', 'breakdance-quicknav' ),
);
/** Official extension */
if ( defined( 'BREAKDANCE_AI_VERSION' ) ) {
$settings_submenus[ 'ai' ] = __( 'AI Assistant', 'breakdance-quicknav' );
}
/** Official extension */
if ( function_exists( 'Breakdance\MigrationMode\saveActivatingUserIp' ) ) {
$settings_submenus[ 'migration-mode' ] = __( 'Migration Mode', 'breakdance-quicknav' );
}
/** Only if WooCommerce plugin is active */
if ( class_exists( 'WooCommerce' ) ) {
$settinngs_submenus[ 'woocommerce' ] = __( 'WooCommerce', 'breakdance-quicknav' );
}
/** License always at the bottom, before filter */
$settings_submenus[ 'license' ] = __( 'License', 'breakdance-quicknav' );
/** Make settings array filterable */
apply_filters( 'ddw/quicknav/bd_settings', $settings_submenus );
foreach ( $settings_submenus as $tab => $title ) {
$wp_admin_bar->add_node( array(
'id' => 'bdqn-settings-' . sanitize_key( $tab ),
'title' => esc_html( $title ),
'href' => esc_url( admin_url( 'admin.php?page=breakdance_settings&tab=' . urlencode( $tab ) ) ),
'parent' => 'bdqn-settings',
) );
}
}
/**
* Add group node for plugin support
*/
private function add_plugin_support_group( $wp_admin_bar ) {
$wp_admin_bar->add_group( array(
'id' => 'bdqn-plugins',
'parent' => 'ddw-breakdance-quicknav',
) );
}
/**
* Add Headspin Copilot submenu if the plugin is active
*/
private function add_headspin_submenu( $wp_admin_bar ) {
if ( defined( 'HSF_VERSION' ) ) {
$wp_admin_bar->add_node( array(
'id' => 'bdqn-headspin',
'title' => esc_html__( 'Headspin Copilot', 'breakdance-quicknav' ),
'href' => esc_url( admin_url( 'admin.php?page=headspin' ) ),
'parent' => 'bdqn-plugins',
) );
}
}
/**
* Add Yabe Webfont (free & Pro) submenu if the plugin is active
*/
private function add_yabe_webfont_submenu( $wp_admin_bar ) {
if ( class_exists( '\Yabe\Webfont\Plugin' ) ) {
$wp_admin_bar->add_node( array(
'id' => 'bdqn-yabe-webfont',
'title' => esc_html__( 'Yabe Webfont', 'breakdance-quicknav' ),
'href' => esc_url( admin_url( 'themes.php?page=yabe_webfont' ) ),
'parent' => 'bdqn-plugins',
) );
}
}
/**
* Add WPSix Exporter submenu if the plugin is active
*/
private function add_wpsix_exporter_submenu( $wp_admin_bar ) {
if ( defined( 'WPSIX_EXPORTER_URL' ) ) {
$wp_admin_bar->add_node( array(
'id' => 'bdqn-wpsix-exporter',
'title' => esc_html__( 'WPSix Exporter', 'breakdance-quicknav' ),
'href' => esc_url( admin_url( 'admin.php?page=wpsix_exporter' ) ),
'parent' => 'bdqn-plugins',
) );
}
}
/**
* Add group node for footer items (Links & About)
*/
private function add_footer_group( $wp_admin_bar ) {
if ( defined( 'BDQN_DISABLE_FOOTER' ) && 'yes' === BDQN_DISABLE_FOOTER ) {
return;
}
$wp_admin_bar->add_group( array(
'id' => 'bdqn-footer',
'parent' => 'ddw-breakdance-quicknav',
) );
}
/**
* Add Links submenu
*/
private function add_links_submenu( $wp_admin_bar ) {
$wp_admin_bar->add_node( array(
'id' => 'bdqn-links',
'title' => esc_html__( 'Links', 'breakdance-quicknav' ),
'href' => '#',
'parent' => 'bdqn-footer',
) );
$links = array(
'breakdance' => array(
'title' => __( 'Breakdance HQ', 'breakdance-quicknav' ),
'url' => 'https://breakdance.com/',
),
'breakdance-learn' => array(
'title' => __( 'Learn Breakdance (Tutorials)', 'breakdance-quicknav' ),
'url' => 'https://breakdance.com/learn/',
),
'breakdance-docs' => array(
'title' => __( 'Breakdance Documentation', 'breakdance-quicknav' ),
'url' => 'https://breakdance.com/documentation/',
),
'breakdance-youtube' => array(
'title' => __( 'Breakdance YouTube Channel', 'breakdance-quicknav' ),
'url' => 'https://www.youtube.com/@OfficialBreakdance/featured',
),
'breakdance-fb-group' => array(
'title' => __( 'Breakdance FB Group', 'breakdance-quicknav' ),
'url' => 'https://www.facebook.com/groups/breakdanceofficial',
),
'breakdance4fun' => array(
'title' => __( 'breakdance4fun (Tutorials, Tips, Resources)', 'breakdance-quicknav' ),
'url' => 'https://breakdance4fun.supadezign.com/',
),
'bd-discord-unofficial' => array(
'title' => __( 'Breakdance Unofficial Discord', 'breakdance-quicknav' ),
'url' => 'https://discord.com/channels/523286444283002890/530617461775532042',
),
'headspin' => array(
'title' => __( 'Headspin', 'breakdance-quicknav' ),
'url' => 'https://headspinui.com/',
),
'moreblocks' => array(
'title' => __( 'Moreblocks', 'breakdance-quicknav' ),
'url' => 'https://moreblocks.com/',
),
'breakerblocks' => array(
'title' => __( 'Breakerblocks', 'breakdance-quicknav' ),
'url' => 'https://breakerblocks.com/',
),
'bdlibraryawesome' => array(
'title' => __( 'BD Library Awesome', 'breakdance-quicknav' ),
'url' => 'https://bdlibraryawesome.com/',
),
'bdblox' => array(
'title' => __( 'Bdblox', 'breakdance-quicknav' ),
'url' => 'https://bdblox.com/',
),
);
foreach ( $links as $id => $info ) {
$wp_admin_bar->add_node( array(
'id' => 'bdqn-link-' . sanitize_key( $id ),
'title' => esc_html( $info[ 'title' ] ),
'href' => esc_url( $info[ 'url' ] ),
'parent' => 'bdqn-links',
'meta' => array( 'target' => '_blank' ),
) );
} // end foreach
}
/**
* Add About submenu
*/
private function add_about_submenu( $wp_admin_bar ) {
$wp_admin_bar->add_node( array(
'id' => 'bdqn-about',
'title' => esc_html__( 'About', 'breakdance-quicknav' ),
'href' => '#',
'parent' => 'bdqn-footer',
) );
$about_links = array(
'author' => array(
'title' => __( 'Author: David Decker', 'breakdance-quicknav' ),
'url' => 'https://deckerweb.de/',
),
'github' => array(
'title' => __( 'Plugin on GitHub', 'breakdance-quicknav' ),
'url' => 'https://github.com/deckerweb/breakdance-quicknav',
),
'kofi' => array(
'title' => __( 'Buy Me a Coffee', 'breakdance-quicknav' ),
'url' => 'https://ko-fi.com/deckerweb',
),
);
foreach ( $about_links as $id => $info ) {
$wp_admin_bar->add_node( array(
'id' => 'bdqn-about-' . sanitize_key( $id ),
'title' => esc_html( $info[ 'title' ] ),
'href' => esc_url( $info[ 'url' ] ),
'parent' => 'bdqn-about',
'meta' => array( 'target' => '_blank' ),
) );
} // end foreach
}
} // end of class
/** Don't do anything if Breakdance Navigator plugin is already active */
if ( ! class_exists( 'Breakdance_Navigator' ) ) {
new DDW_Breakdance_QuickNav();
}
} // end if