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
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
|
<?php
namespace StellarWP\Assets;
class Assets { /** * @var ?Assets */ protected static $instance;
/** * @var ?Controller */ protected ?Controller $controller;
/** * @var array Array of memoized key value pairs. */ protected array $memoized = [];
/** * @var string */ protected string $base_path;
/** * @var string */ protected string $assets_url;
/** * @var string */ protected string $version;
/** * Stores all the Assets and it's configurations. * * @var array */ protected $assets = [];
/** * Stores the localized scripts for reference. * * @var array */ protected $localized = [];
/** * Constructor. * * @param string|null $base_path Base path to the directory. * @param string|null $assets_url Directory to the assets. * * @since 1.0.0 * */ public function __construct( ?string $base_path = null, ?string $assets_url = null ) { $this->base_path = $base_path ?: Config::get_path(); $this->assets_url = $assets_url ?: trailingslashit( get_site_url() . $this->base_path ); $this->version = Config::get_version(); $this->controller = new Controller( $this ); $this->controller->register(); }
/** * Helper method to get the instance object. Alias of ::init(). * * @return Assets * @since 1.0.0 * */ public static function instance(): Assets { return static::init(); }
/** * Singleton instance. * * @return Assets * @since 1.0.0 * */ public static function init(): Assets { if ( ! isset( static::$instance ) ) { static::$instance = new self(); }
return static::$instance; }
/** * Create an asset. * * @param string $slug The asset slug. * @param string $file The asset file path. * @param string|null $version The asset version. * @param string|null $plugin_path The path to the root of the plugin. */ public static function asset( string $slug, string $file, string $version = null, string $plugin_path = null ) { return static::init()->add( new Asset( $slug, $file, $version, $plugin_path ) ); }
/** * Register an Asset and attach a callback to the required action to display it correctly. * * @param Asset $asset Register an asset. * * @return Asset|false The registered object or false on error. * @since 1.0.0 * */ public function add( Asset $asset ) { // Prevent weird stuff here. $slug = $asset->get_slug();
if ( $this->exists( $slug ) ) { return $this->get( $slug ); }
// Set the Asset on the array of notices. $this->assets[ $slug ] = $asset;
// Return the Slug because it might be modified. return $asset; }
/** * Checks if an Asset exists. * * @param string|array $slug Slug of the Asset. * * @return bool * @since 1.0.0 * */ public function exists( $slug ) { $slug = sanitize_key( $slug );
return isset( $this->assets[ $slug ] ); }
/** * Depending on how certain scripts are loaded and how much cross-compatibility is required we need to be able to * create noConflict backups and restore other scripts, which normally need to be printed directly on the scripts. * * @param string $tag Tag we are filtering. * @param string $handle Which is the ID/Handle of the tag we are about to print. * * @return string Script tag with the before and after strings attached to it. * @since 1.0.0 * */ public function filter_print_before_after_script( $tag, $handle ): string { // Only filter for our own filters. if ( ! $asset = $this->get( $handle ) ) { return (string) $tag; }
// Bail when not dealing with JS assets. if ( 'js' !== $asset->get_type() ) { return (string) $tag; }
// Only go forward if there is any print before or after. if ( empty( $asset->get_print_before() ) && empty( $asset->get_print_after() ) ) { return (string) $tag; }
$before = ''; $print_before = $asset->get_print_before(); if ( ! empty( $print_before ) ) { $before = (string) ( is_callable( $print_before ) ? call_user_func( $print_before, $asset ) : $print_before ); }
$after = ''; $print_after = $asset->get_print_after(); if ( ! empty( $print_after ) ) { $after = (string) ( is_callable( $print_after ) ? call_user_func( $print_after, $asset ) : $print_after ); }
$tag = $before . (string) $tag . $after;
return $tag; }
/** * Get the Asset Object configuration. * * @param string|array $slug Slug of the Asset. * @param boolean $sort If we should do any sorting before returning. * * @return array|Asset Array of asset objects, single asset object, or null if looking for a single asset but * it was not in the array of objects. * @since 1.0.0 * */ public function get( $slug = null, $sort = true ) { $obj = $this;
if ( is_null( $slug ) ) { if ( $sort ) { $cache_key_count = __METHOD__ . ':count'; // Sorts by priority. $cache_count = $this->get_var( $cache_key_count, 0 ); $count = count( $this->assets );
if ( $count !== $cache_count ) { uasort( $this->assets, static function ( $a, $b ) use ( $obj ) { return $obj->sort_by_priority( $a, $b, 'get_priority' ); } ); $this->set_var( $cache_key_count, $count ); } }
return $this->assets; }
// If slug is an array we return all of those. if ( is_array( $slug ) ) { $assets = []; foreach ( $slug as $asset_slug ) { $asset_slug = sanitize_key( $asset_slug ); // Skip empty assets. if ( empty( $this->assets[ $asset_slug ] ) ) { continue; }
$assets[ $asset_slug ] = $this->assets[ $asset_slug ]; }
if ( empty( $assets ) ) { return []; }
if ( $sort ) { // Sorts by priority. uasort( $assets, static function ( $a, $b ) use ( $obj ) { return $obj->sort_by_priority( $a, $b, 'get_priority' ); } ); }
return $assets; }
// Prevent weird stuff here. $slug = sanitize_key( $slug );
if ( ! empty( $this->assets[ $slug ] ) ) { return $this->assets[ $slug ]; }
return []; }
/** * Gets a memoized value. * * @param string $var Var name. * @param mixed|null $default Default value. * * @return mixed|null */ public function get_var( string $var, $default = null ) { return $this->memoized[ $var ] ?? $default; }
/** * Sorting function based on Priority * * @param object|array $b Second subject to compare. * @param object|array $a First Subject to compare. * @param string $method Method to use for sorting. * * @return int * @since 1.0.0 * */ public function sort_by_priority( $a, $b, $method = null ) { if ( is_array( $a ) ) { $a_priority = $a['priority']; } else { $a_priority = $method ? $a->$method() : $a->priority; }
if ( is_array( $b ) ) { $b_priority = $b['priority']; } else { $b_priority = $method ? $b->$method() : $b->priority; }
if ( (int) $a_priority === (int) $b_priority ) { return 0; }
return (int) $a_priority > (int) $b_priority ? 1 : - 1; }
/** * Sets a memoized value. * * @param string $var Var name. * @param mixed|null $value The value. */ public function set_var( string $var, $value = null ) { $this->memoized[ $var ] = $value; }
/** * Handles adding localization data, when attached to `script_loader_tag` which allows dependencies to load in their * localization data as well. * * @param string $tag Tag we are filtering. * @param string $handle Which is the ID/Handle of the tag we are about to print. * * @return string Script tag with the localization variable HTML attached to it. * @since 1.0.0 * */ public function filter_add_localization_data( $tag, $handle ) { // Only filter for own filters. if ( ! $asset = $this->get( $handle ) ) { return $tag; }
// Bail when not dealing with JS assets. if ( 'js' !== $asset->get_type() ) { return $tag; }
$localize_scripts = $asset->get_localize_scripts(); $custom_localize_scripts = $asset->get_custom_localize_scripts();
// Only localize on JS and if we have data. if ( empty( $localize_scripts ) && empty( $custom_localize_scripts ) ) { return $tag; }
$localization_html = '';
if ( count( $localize_scripts ) ) { global $wp_scripts;
$localization = $localize_scripts;
/** * Check to ensure we haven't already localized it before. * * @since 1.0.0 */ foreach ( $localization as $key => $localize ) {
if ( in_array( $key, $this->localized ) ) { continue; }
// If we have a Callable as the Localize data we execute it. if ( is_callable( $localize ) ) { $localize = $localize( $asset ); }
wp_localize_script( $asset->get_slug(), $key, $localize );
$this->localized[] = $key; }
// Fetch the HTML for all the localized data. ob_start(); $wp_scripts->print_extra_script( $asset->get_slug(), true ); $localization_html = ob_get_clean();
// After printing it remove data;| $wp_scripts->add_data( $asset->get_slug(), 'data', '' ); }
/* * Print the dot.notation namespaced objects for the asset. */ foreach ( $custom_localize_scripts as [$object_name, $data] ) { // If we have a Callable as the Localize data we execute it. if ( is_callable( $data ) ) { $data = $data( $asset ); }
$localized_key = "{$asset->get_slug()}::{$object_name}";
if ( in_array( $localized_key, $this->localized, true ) ) { continue; }
$frags = explode( '.', $object_name ); $js_data = ''; $var_name = ''; foreach ( $frags as $i => $frag ) { $var_name = ltrim( $var_name . '.' . $frag, '.' ); if ( isset( $frags[ $i + 1 ] ) ) { $js_data .= PHP_EOL . sprintf( 'window.%1$s = window.%1$s || {};', $var_name ); } else { $json_data = wp_json_encode( $data ); $js_data .= PHP_EOL . sprintf( 'window.%1$s = Object.assign(window.%1$s || {}, %2$s);', $var_name, $json_data ); } }
$localization_html .= sprintf( '<script id="%s-ns-extra">%s' . PHP_EOL . '</script>', $asset->get_slug(), $js_data );
$this->localized[] = $localized_key; }
return $localization_html . $tag; }
/** * Filters the Script tags to attach Async and/or Defer based on the rules we set in our Asset class. * * @param string $tag Tag we are filtering. * @param string $handle Which is the ID/Handle of the tag we are about to print. * * @return string Script tag with the defer and/or async attached. * @since 1.0.0 * */ public function filter_tag_async_defer( $tag, $handle ) { // Only filter for our own filters. if ( ! $asset = $this->get( $handle ) ) { return $tag; }
// Bail when not dealing with JS assets. if ( 'js' !== $asset->get_type() ) { return $tag; }
// When async and defer are false we bail with the tag. if ( ! $asset->is_deferred() && ! $asset->is_async() ) { return $tag; }
$tag_has_async = false !== strpos( $tag, ' async ' ); $tag_has_defer = false !== strpos( $tag, ' defer ' ); $replacement = '<script ';
if ( $asset->is_async() && ! $tag_has_async ) { $replacement .= 'async '; }
if ( $asset->is_deferred() && ! $tag_has_defer ) { $replacement .= 'defer '; }
return str_replace( '<script ', $replacement, $tag ); }
/** * Filters the Script tags to attach type=module based on the rules we set in our Asset class. * * @since 1.0.0 * @since 1.2.6 * * @param string $tag Tag we are filtering. * @param string $handle Which is the ID/Handle of the tag we are about to print. * * @return string Script tag with the type=module */ public function filter_modify_to_module( $tag, $handle ) { $asset = $this->get( $handle ); // Only filter for our own filters. if ( ! $asset ) { return $tag; }
// Bail when not dealing with JS assets. if ( 'js' !== $asset->get_type() ) { return $tag; }
// When not module we bail with the tag. if ( ! $asset->is_module() ) { return $tag; }
// Remove the type attribute if it exists. preg_match( "/ *type=['\"]{0,1}[^'\"]+['\"]{0,1}/i", $tag, $matches ); if ( ! empty( $matches ) ) { $tag = str_replace( $matches[0], '', $tag ); }
$replacement = '<script type="module" ';
return str_replace( '<script', $replacement, $tag ); }
/** * Enqueues registered assets based on their groups. * * @param string|array $groups Which groups will be enqueued. * @param bool $should_enqueue_no_matter_what Whether to ignore conditional requirements when enqueuing. * * @since 1.0.0 * * @uses Assets::enqueue() * */ public function enqueue_group( $groups, bool $should_enqueue_no_matter_what = false ) { $assets = $this->get( null, false ); $enqueue = [];
foreach ( $assets as $asset ) { if ( empty( $asset->get_groups() ) ) { continue; }
$intersect = array_intersect( (array) $groups, $asset->get_groups() );
if ( empty( $intersect ) ) { continue; } $enqueue[] = $asset->get_slug(); }
$this->enqueue( $enqueue, $should_enqueue_no_matter_what ); }
/** * Enqueues registered assets. * * This method is called on whichever action (if any) was declared during registration. * * It can also be called directly with a list of asset slugs to forcibly enqueue, which may be * useful where an asset is required in a situation not anticipated when it was originally * registered. * * @param string|array $assets_to_enqueue Which assets will be enqueued. * @param bool $should_enqueue_no_matter_what Whether to ignore conditional requirements when enqueuing. * * @since 1.0.0 * */ public function enqueue( $assets_to_enqueue = null, bool $should_enqueue_no_matter_what = false ) { $assets_to_enqueue = array_filter( (array) $assets_to_enqueue ); if ( ! empty( $assets_to_enqueue ) ) { $assets = (array) $this->get( $assets_to_enqueue ); } else { $assets = $this->get(); }
foreach ( $assets as $asset ) { $slug = $asset->get_slug();
// Should this asset be enqueued regardless of the current filter/any conditional requirements? $must_enqueue = in_array( $slug, $assets_to_enqueue ); $actions = $asset->get_action();
if ( empty( $actions ) && $must_enqueue ) { $this->do_enqueue( $asset, $must_enqueue ); }
foreach ( $asset->get_action() as $action ) { $in_filter = current_filter() === $action; $did_action = did_action( $action ) > 0;
// Skip if we are not on the correct filter (unless we are forcibly enqueuing). if ( ! $in_filter && ! $must_enqueue && ! $did_action ) { continue; }
// If any single conditional returns true, then we need to enqueue the asset. if ( empty( $action ) && ! $must_enqueue ) { continue; }
$this->do_enqueue( $asset, $should_enqueue_no_matter_what ); } } }
/** * Enqueues registered assets. * * This method is called on whichever action (if any) was declared during registration. * * It can also be called directly with a list of asset slugs to forcibly enqueue, which may be * useful where an asset is required in a situation not anticipated when it was originally * registered. * * @param Asset $asset Asset to enqueue. * @param bool $force_enqueue Whether to ignore conditional requirements when enqueuing. * * @since 1.0.0 * */ protected function do_enqueue( Asset $asset, bool $force_enqueue = false ): void { $hook_prefix = Config::get_hook_prefix(); $slug = $asset->get_slug();
// If this asset was late called if ( ! $asset->is_registered() ) { $this->register_in_wp( $asset ); }
if ( $asset->is_enqueued() ) { return; }
// Default to enqueuing the asset if there are no conditionals, // and default to not enqueuing it if there *are* conditionals. $condition = $asset->get_condition(); $has_condition = ! empty( $condition ); $enqueue = ! $has_condition;
if ( $has_condition ) { $enqueue = (bool) call_user_func( $condition ); }
/** * Allows developers to hook-in and prevent an asset from being loaded. * * @param bool $enqueue If we should enqueue or not a given asset. * @param object $asset Which asset we are dealing with. * * @since 1.0.0 * */ $enqueue = (bool) apply_filters( "stellarwp/assets/{$hook_prefix}/enqueue", $enqueue, $asset );
/** * Allows developers to hook-in and prevent an asset from being loaded. * * @param bool $enqueue If we should enqueue or not a given asset. * @param object $asset Which asset we are dealing with. * * @since 1.0.0 * */ $enqueue = (bool) apply_filters( "stellarwp/assets/{$hook_prefix}/enqueue_{$slug}", $enqueue, $asset );
if ( ! $enqueue && ! $force_enqueue ) { return; }
if ( 'js' === $asset->get_type() ) { if ( $asset->should_print() && ! $asset->is_printed() ) { $asset->set_as_printed(); wp_print_scripts( [ $slug ] ); } // We print first, and tell the system it was enqueued, WP is smart not to do it twice. wp_enqueue_script( $slug ); } else { if ( $asset->should_print() && ! $asset->is_printed() ) { $asset->set_as_printed(); wp_print_styles( [ $slug ] ); }
// We print first, and tell the system it was enqueued, WP is smart not to do it twice. wp_enqueue_style( $slug );
$style_data = $asset->get_style_data(); foreach ( $style_data as $key => $value ) { wp_style_add_data( $slug, $key, $value ); } }
if ( ! empty( $asset->get_after_enqueue() ) && is_callable( $asset->get_after_enqueue() ) ) { call_user_func_array( $asset->get_after_enqueue(), [ $asset ] ); }
$asset->set_as_enqueued(); }
/** * Register the Assets on the correct hooks. * * @since 1.0.0 * * @param array|Asset|null $assets Array of asset objects, single asset object, or null. * * @return void */ public function register_in_wp( $assets = null ) { if ( ! ( did_action( 'init' ) || did_action( 'wp_enqueue_scripts' ) || did_action( 'admin_enqueue_scripts' ) || did_action( 'login_enqueue_scripts' ) ) ) { // Registering the asset now would trigger a doing_it_wrong notice: queue the assets to be registered later.
if ( ! is_array( $assets ) ) { $assets = [ $assets ]; }
// Register later, avoid the doing_it_wrong notice. $this->assets = array_merge( $this->assets, $assets );
return; }
if ( is_null( $assets ) ) { $assets = $this->get(); }
if ( ! is_array( $assets ) ) { $assets = [ $assets ]; }
foreach ( $assets as $asset ) { // Asset is already registered. if ( $asset->is_registered() ) { continue; }
$asset_slug = $asset->get_slug();
if ( 'js' === $asset->get_type() ) { // Script is already registered. if ( wp_script_is( $asset_slug, 'registered' ) ) { continue; }
wp_register_script( $asset_slug, $asset->get_url(), $asset->get_dependencies(), $asset->get_version(), $asset->is_in_footer() );
// Register that this asset is actually registered on the WP methods. // @phpstan-ignore-next-line if ( wp_script_is( $asset_slug, 'registered' ) ) { $asset->set_as_registered(); }
if ( ! empty( $asset->get_translation_path() ) && ! empty( $asset->get_textdomain() ) ) { wp_set_script_translations( $asset_slug, $asset->get_textdomain(), $asset->get_translation_path() ); } } else { // Style is already registered. if ( wp_style_is( $asset_slug, 'registered' ) ) { continue; }
wp_register_style( $asset_slug, $asset->get_url(), $asset->get_dependencies(), $asset->get_version(), $asset->get_media() );
// Register that this asset is actually registered on the WP methods. // @phpstan-ignore-next-line if ( wp_style_is( $asset_slug, 'registered' ) ) { $asset->set_as_registered(); }
$style_data = $asset->get_style_data(); if ( $style_data ) { foreach ( $style_data as $datum_key => $datum_value ) { wp_style_add_data( $asset_slug, $datum_key, $datum_value ); } } }
// If we don't have an action we don't even register the action to enqueue. if ( empty( $asset->get_action() ) ) { continue; }
// Now add an action to enqueue the registered assets. foreach ( (array) $asset->get_action() as $action ) { // Enqueue the registered assets at the appropriate time. if ( did_action( $action ) > 0 ) { $this->enqueue(); } else { add_action( $action, [ $this, 'enqueue' ], $asset->get_priority(), 0 ); } } } }
/** * Removes an Asset from been registered and enqueue. * * @since 1.0.0 * * @param string $slug Slug of the Asset. * * @return bool */ public function remove( $slug ) { if ( ! $this->exists( $slug ) ) { return false; }
$type = $this->get( $slug )->get_type();
if ( $type === 'css' ) { wp_dequeue_style( $slug ); wp_deregister_style( $slug ); } else { wp_dequeue_script( $slug ); wp_deregister_script( $slug ); }
unset( $this->assets[ $slug ] );
return true; }
/** * Prints the `script` (JS) and `link` (CSS) HTML tags associated with one or more assets groups. * * The method will force the scripts and styles to print overriding their registration and conditional. * * @since 1.0.0 * * @param string|array $group Which group(s) should be enqueued. * @param bool $echo Whether to print the group(s) tag(s) to the page or not; default to `true` to * print the HTML `script` (JS) and `link` (CSS) tags to the page. * * @return string The `script` and `link` HTML tags produced for the group(s). */ public function print_group( $group, $echo = true ) { $all_assets = $this->get(); $groups = (array) $group; $to_print = array_filter( $all_assets, static function ( Asset $asset ) use ( $groups ) { $asset_groups = $asset->get_groups();
return ! empty( $asset_groups ) && array_intersect( $asset_groups, $groups ); } ); $by_type = array_reduce( $to_print, static function ( array $acc, Asset $asset ) { $acc[ $asset->get_type() ][] = $asset->get_slug();
return $acc; }, [ 'css' => [], 'js' => [] ] );
// Make sure each script is registered. foreach ( $to_print as $slug => $asset ) { if ( $asset->is_registered() ) { continue; } 'js' === $asset->get_type() ? wp_register_script( $slug, $asset->get_file(), $asset->get_dependencies(), $asset->get_version() ) : wp_register_style( $slug, $asset->get_file(), $asset->get_dependencies(), $asset->get_version() ); }
ob_start(); wp_scripts()->do_items( $by_type['js'] ); wp_styles()->do_items( $by_type['css'] ); $tags = ob_get_clean();
if ( $echo ) { echo $tags; }
return $tags; }
}
|