• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 555722276c5d045f658b7dd88fb5ee08630e1093

12 Nov 2025 11:12AM UTC coverage: 53.328% (-0.06%) from 53.388%
555722276c5d045f658b7dd88fb5ee08630e1093

Pull #22697

github

web-flow
Merge 94d318e70 into 68afd79ba
Pull Request #22697: Show yoast in elements tab in elementor

8497 of 15710 branches covered (54.09%)

Branch coverage included in aggregate %.

0 of 80 new or added lines in 5 files covered. (0.0%)

1 existing line in 1 file now uncovered.

32187 of 60580 relevant lines covered (53.13%)

39422.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

15.22
/admin/class-admin-asset-manager.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO\Admin
6
 */
7

8
/**
9
 * This class registers all the necessary styles and scripts.
10
 *
11
 * Also has methods for the enqueing of scripts and styles.
12
 * It automatically adds a prefix to the handle.
13
 */
14
class WPSEO_Admin_Asset_Manager {
15

16
        /**
17
         * Prefix for naming the assets.
18
         *
19
         * @var string
20
         */
21
        public const PREFIX = 'yoast-seo-';
22

23
        /**
24
         * Class that manages the assets' location.
25
         *
26
         * @var WPSEO_Admin_Asset_Location
27
         */
28
        protected $asset_location;
29

30
        /**
31
         * Prefix for naming the assets.
32
         *
33
         * @var string
34
         */
35
        private $prefix;
36

37
        /**
38
         * Constructs a manager of assets. Needs a location to know where to register assets at.
39
         *
40
         * @param WPSEO_Admin_Asset_Location|null $asset_location The provider of the asset location.
41
         * @param string                          $prefix         The prefix for naming assets.
42
         */
43
        public function __construct( ?WPSEO_Admin_Asset_Location $asset_location = null, $prefix = self::PREFIX ) {
×
44
                if ( $asset_location === null ) {
×
45
                        $asset_location = self::create_default_location();
×
46
                }
47

48
                $this->asset_location = $asset_location;
×
49
                $this->prefix         = $prefix;
×
50
        }
51

52
        /**
53
         * Enqueues scripts.
54
         *
55
         * @param string $script The name of the script to enqueue.
56
         *
57
         * @return void
58
         */
59
        public function enqueue_script( $script ) {
4✔
60
                wp_enqueue_script( $this->prefix . $script );
4✔
61
        }
62

63
        /**
64
         * Enqueues styles.
65
         *
66
         * @param string $style The name of the style to enqueue.
67
         *
68
         * @return void
69
         */
70
        public function enqueue_style( $style ) {
8✔
71
                wp_enqueue_style( $this->prefix . $style );
8✔
72
        }
73

74
        /**
75
         * Enqueues the appropriate language for the user.
76
         *
77
         * @return void
78
         */
79
        public function enqueue_user_language_script() {
×
80
                $this->enqueue_script( 'language-' . YoastSEO()->helpers->language->get_researcher_language() );
×
81
        }
82

83
        /**
84
         * Registers scripts based on it's parameters.
85
         *
86
         * @param WPSEO_Admin_Asset $script The script to register.
87
         *
88
         * @return void
89
         */
90
        public function register_script( WPSEO_Admin_Asset $script ) {
8✔
91
                $url  = $script->get_src() ? $this->get_url( $script, WPSEO_Admin_Asset::TYPE_JS ) : false;
8✔
92
                $args = [
8✔
93
                        'in_footer' => $script->is_in_footer(),
8✔
94
                ];
8✔
95

96
                if ( $script->get_strategy() !== '' ) {
8✔
97
                        $args['strategy'] = $script->get_strategy();
×
98
                }
99

100
                wp_register_script(
8✔
101
                        $this->prefix . $script->get_name(),
8✔
102
                        $url,
8✔
103
                        $script->get_deps(),
8✔
104
                        $script->get_version(),
8✔
105
                        $args
8✔
106
                );
8✔
107

108
                if ( in_array( 'wp-i18n', $script->get_deps(), true ) ) {
8✔
109
                        wp_set_script_translations( $this->prefix . $script->get_name(), 'wordpress-seo' );
×
110
                }
111
        }
112

113
        /**
114
         * Registers styles based on it's parameters.
115
         *
116
         * @param WPSEO_Admin_Asset $style The style to register.
117
         *
118
         * @return void
119
         */
120
        public function register_style( WPSEO_Admin_Asset $style ) {
8✔
121
                wp_register_style(
8✔
122
                        $this->prefix . $style->get_name(),
8✔
123
                        $this->get_url( $style, WPSEO_Admin_Asset::TYPE_CSS ),
8✔
124
                        $style->get_deps(),
8✔
125
                        $style->get_version(),
8✔
126
                        $style->get_media()
8✔
127
                );
8✔
128
        }
129

130
        /**
131
         * Calls the functions that register scripts and styles with the scripts and styles to be registered as arguments.
132
         *
133
         * @return void
134
         */
135
        public function register_assets() {
4✔
136
                $this->register_scripts( $this->scripts_to_be_registered() );
4✔
137
                $this->register_styles( $this->styles_to_be_registered() );
4✔
138
        }
139

140
        /**
141
         * Registers all the scripts passed to it.
142
         *
143
         * @param array $scripts The scripts passed to it.
144
         *
145
         * @return void
146
         */
147
        public function register_scripts( $scripts ) {
4✔
148
                foreach ( $scripts as $script ) {
4✔
149
                        $script = new WPSEO_Admin_Asset( $script );
4✔
150
                        $this->register_script( $script );
4✔
151
                }
152
        }
153

154
        /**
155
         * Registers all the styles it receives.
156
         *
157
         * @param array $styles Styles that need to be registered.
158
         *
159
         * @return void
160
         */
161
        public function register_styles( $styles ) {
4✔
162
                foreach ( $styles as $style ) {
4✔
163
                        $style = new WPSEO_Admin_Asset( $style );
4✔
164
                        $this->register_style( $style );
4✔
165
                }
166
        }
167

168
        /**
169
         * Localizes the script.
170
         *
171
         * @param string $handle      The script handle.
172
         * @param string $object_name The object name.
173
         * @param array  $data        The l10n data.
174
         *
175
         * @return void
176
         */
177
        public function localize_script( $handle, $object_name, $data ) {
×
178
                wp_localize_script( $this->prefix . $handle, $object_name, $data );
×
179
        }
180

181
        /**
182
         * Adds an inline script.
183
         *
184
         * @param string $handle   The script handle.
185
         * @param string $data     The l10n data.
186
         * @param string $position Optional. Whether to add the inline script before the handle or after.
187
         *
188
         * @return void
189
         */
190
        public function add_inline_script( $handle, $data, $position = 'after' ) {
×
191
                wp_add_inline_script( $this->prefix . $handle, $data, $position );
×
192
        }
193

194
        /**
195
         * A list of styles that shouldn't be registered but are needed in other locations in the plugin.
196
         *
197
         * @return array
198
         */
199
        public function special_styles() {
×
200
                $flat_version = $this->flatten_version( WPSEO_VERSION );
×
201
                $asset_args   = [
×
202
                        'name' => 'inside-editor',
×
203
                        'src'  => 'inside-editor-' . $flat_version,
×
204
                ];
×
205

206
                return [ 'inside-editor' => new WPSEO_Admin_Asset( $asset_args ) ];
×
207
        }
208

209
        /**
210
         * Flattens a version number for use in a filename.
211
         *
212
         * @param string $version The original version number.
213
         *
214
         * @return string The flattened version number.
215
         */
216
        public function flatten_version( $version ) {
24✔
217
                $parts = explode( '.', $version );
24✔
218

219
                if ( count( $parts ) === 2 && preg_match( '/^\d+$/', $parts[1] ) === 1 ) {
24✔
220
                        $parts[] = '0';
8✔
221
                }
222

223
                return implode( '', $parts );
24✔
224
        }
225

226
        /**
227
         * Creates a default location object for use in the admin asset manager.
228
         *
229
         * @return WPSEO_Admin_Asset_Location The location to use in the asset manager.
230
         */
231
        public static function create_default_location() {
×
232
                if ( defined( 'YOAST_SEO_DEV_SERVER' ) && YOAST_SEO_DEV_SERVER ) {
×
233
                        $url = defined( 'YOAST_SEO_DEV_SERVER_URL' ) ? YOAST_SEO_DEV_SERVER_URL : WPSEO_Admin_Asset_Dev_Server_Location::DEFAULT_URL;
×
234

235
                        return new WPSEO_Admin_Asset_Dev_Server_Location( $url );
×
236
                }
237

238
                return new WPSEO_Admin_Asset_SEO_Location( WPSEO_FILE, false );
×
239
        }
240

241
        /**
242
         * Checks if the given script is enqueued.
243
         *
244
         * @param string $script The script to check.
245
         *
246
         * @return bool True when the script is enqueued.
247
         */
248
        public function is_script_enqueued( $script ) {
×
249
                return wp_script_is( $this->prefix . $script );
×
250
        }
251

252
        /**
253
         * Gets the list of Elementor dependencies.
254
         *
255
         * @return array The array of elementor dependencies.
256
         */
NEW
257
        protected function get_elementor_dependencies() {
×
NEW
258
                $dependencies = [
×
NEW
259
                        'jquery',
×
NEW
260
                        'underscore',
×
NEW
261
                        'backbone',
×
NEW
262
                        'backbone-radio',
×
NEW
263
                        'backbone-marionette',
×
NEW
264
                        'elementor-editor',
×
NEW
265
                        'elementor-common',
×
NEW
266
                        'elementor-common-modules',
×
NEW
267
                        self::PREFIX . 'api-client',
×
NEW
268
                        self::PREFIX . 'externals-components',
×
NEW
269
                        self::PREFIX . 'externals-contexts',
×
NEW
270
                        self::PREFIX . 'externals-redux',
×
NEW
271
                ];
×
272
                // Conditionally add Elementor v2 dependency if available.
NEW
273
                if ( wp_script_is( 'elementor-v2-editor-app-bar', 'registered' ) ) {
×
NEW
274
                        $dependencies[] = 'elementor-v2-editor-app-bar';
×
275
                }
276
                // Add elementor-editor-modules if available.
NEW
277
                if ( wp_script_is( 'elementor-editor-modules', 'registered' ) ) {
×
NEW
278
                        $dependencies[] = 'elementor-editor-modules';
×
279
                }
280

281
                // Add elementor-editor-document if available.
NEW
282
                if ( wp_script_is( 'elementor-editor-document', 'registered' ) ) {
×
NEW
283
                        $dependencies[] = 'elementor-editor-document';
×
284
                }
NEW
285
                return $dependencies;
×
286
        }
287

288
        /**
289
         * Returns the scripts that need to be registered.
290
         *
291
         * @todo Data format is not self-documenting. Needs explanation inline. R.
292
         *
293
         * @return array The scripts that need to be registered.
294
         */
295
        protected function scripts_to_be_registered() {
×
296
                $header_scripts          = [
×
297
                        'admin-global',
×
298
                        'block-editor',
×
299
                        'classic-editor',
×
300
                        'post-edit',
×
301
                        'help-scout-beacon',
×
302
                        'redirect-old-features-tab',
×
303
                ];
×
NEW
304
                $elementor_dependencies = $this->get_elementor_dependencies();
×
305
                $additional_dependencies = [
×
306
                        'analysis-worker'          => [ self::PREFIX . 'analysis-package' ],
×
307
                        'api-client'               => [ 'wp-api' ],
×
308
                        'crawl-settings'           => [ 'jquery' ],
×
309
                        'dashboard-widget'         => [ self::PREFIX . 'api-client' ],
×
310
                        'wincher-dashboard-widget' => [ self::PREFIX . 'api-client' ],
×
311
                        'editor-modules'           => [ 'jquery' ],
×
NEW
312
                        'elementor'                => $elementor_dependencies,
×
313
                        'indexation'               => [
×
314
                                'jquery-ui-core',
×
315
                                'jquery-ui-progressbar',
×
316
                        ],
×
317
                        'first-time-configuration' => [
×
318
                                self::PREFIX . 'api-client',
×
319
                                self::PREFIX . 'externals-components',
×
320
                                self::PREFIX . 'externals-contexts',
×
321
                                self::PREFIX . 'externals-redux',
×
322
                        ],
×
323
                        'integrations-page'        => [
×
324
                                self::PREFIX . 'api-client',
×
325
                                self::PREFIX . 'externals-components',
×
326
                                self::PREFIX . 'externals-contexts',
×
327
                                self::PREFIX . 'externals-redux',
×
328
                        ],
×
329
                        'post-edit'                => [
×
330
                                self::PREFIX . 'api-client',
×
331
                                self::PREFIX . 'block-editor',
×
332
                                self::PREFIX . 'externals-components',
×
333
                                self::PREFIX . 'externals-contexts',
×
334
                                self::PREFIX . 'externals-redux',
×
335
                        ],
×
336
                        'reindex-links'            => [
×
337
                                'jquery-ui-core',
×
338
                                'jquery-ui-progressbar',
×
339
                        ],
×
340
                        'settings'                 => [
×
341
                                'jquery-ui-core',
×
342
                                'jquery-ui-progressbar',
×
343
                                self::PREFIX . 'api-client',
×
344
                                self::PREFIX . 'externals-components',
×
345
                                self::PREFIX . 'externals-contexts',
×
346
                                self::PREFIX . 'externals-redux',
×
347
                        ],
×
348
                        'term-edit'                => [
×
349
                                self::PREFIX . 'api-client',
×
350
                                self::PREFIX . 'classic-editor',
×
351
                                self::PREFIX . 'externals-components',
×
352
                                self::PREFIX . 'externals-contexts',
×
353
                                self::PREFIX . 'externals-redux',
×
354
                        ],
×
355
                        'general-page'             => [
×
356
                                self::PREFIX . 'api-client',
×
357
                        ],
×
358
                ];
×
359

360
                $plugin_scripts   = $this->load_generated_asset_file(
×
361
                        [
×
362
                                'asset_file'      => __DIR__ . '/../src/generated/assets/plugin.php',
×
363
                                'ext_length'      => 3,
×
364
                                'additional_deps' => $additional_dependencies,
×
365
                                'header_scripts'  => $header_scripts,
×
366
                        ]
×
367
                );
×
368
                $external_scripts = $this->load_generated_asset_file(
×
369
                        [
×
370
                                'asset_file'      => __DIR__ . '/../src/generated/assets/externals.php',
×
371
                                'ext_length'      => 3,
×
372
                                'suffix'          => '-package',
×
373
                                'base_dir'        => 'externals/',
×
374
                                'additional_deps' => $additional_dependencies,
×
375
                                'header_scripts'  => $header_scripts,
×
376
                        ]
×
377
                );
×
378
                $language_scripts = $this->load_generated_asset_file(
×
379
                        [
×
380
                                'asset_file'      => __DIR__ . '/../src/generated/assets/languages.php',
×
381
                                'ext_length'      => 3,
×
382
                                'suffix'          => '-language',
×
383
                                'base_dir'        => 'languages/',
×
384
                                'additional_deps' => $additional_dependencies,
×
385
                                'header_scripts'  => $header_scripts,
×
386
                        ]
×
387
                );
×
388
                $renamed_scripts  = $this->load_renamed_scripts();
×
389

390
                $scripts = array_merge(
×
391
                        $plugin_scripts,
×
392
                        $external_scripts,
×
393
                        $language_scripts,
×
394
                        $renamed_scripts
×
395
                );
×
396

397
                $scripts['installation-success'] = [
×
398
                        'name'    => 'installation-success',
×
399
                        'src'     => 'installation-success.js',
×
400
                        'deps'    => [
×
401
                                'wp-a11y',
×
402
                                'wp-dom-ready',
×
403
                                'wp-components',
×
404
                                'wp-element',
×
405
                                'wp-i18n',
×
406
                                self::PREFIX . 'components-new-package',
×
407
                                self::PREFIX . 'externals-components',
×
408
                        ],
×
409
                        'version' => $scripts['installation-success']['version'],
×
410
                ];
×
411

412
                $scripts['post-edit-classic'] = [
×
413
                        'name'      => 'post-edit-classic',
×
414
                        'src'       => $scripts['post-edit']['src'],
×
415
                        'deps'      => array_map(
×
416
                                static function ( $dep ) {
×
417
                                        if ( $dep === self::PREFIX . 'block-editor' ) {
×
418
                                                return self::PREFIX . 'classic-editor';
419
                                        }
420
                                        return $dep;
×
421
                                },
×
422
                                $scripts['post-edit']['deps']
×
423
                        ),
×
424
                        'in_footer' => ! in_array( 'post-edit-classic', $header_scripts, true ),
×
425
                        'version'   => $scripts['post-edit']['version'],
×
426
                ];
×
427

428
                $scripts['workouts'] = [
×
429
                        'name'    => 'workouts',
×
430
                        'src'     => 'workouts.js',
×
431
                        'deps'    => [
×
432
                                'clipboard',
×
433
                                'lodash',
×
434
                                'wp-api-fetch',
×
435
                                'wp-a11y',
×
436
                                'wp-components',
×
437
                                'wp-compose',
×
438
                                'wp-data',
×
439
                                'wp-dom-ready',
×
440
                                'wp-element',
×
441
                                'wp-i18n',
×
442
                                self::PREFIX . 'externals-components',
×
443
                                self::PREFIX . 'externals-contexts',
×
444
                                self::PREFIX . 'externals-redux',
×
445
                                self::PREFIX . 'analysis',
×
446
                                self::PREFIX . 'components-new-package',
×
447
                        ],
×
448
                        'version' => $scripts['workouts']['version'],
×
449
                ];
×
450

451
                // Add the current language to every script that requires the analysis package.
452
                foreach ( $scripts as $name => $script ) {
×
453
                        if ( substr( $name, -8 ) === 'language' ) {
×
454
                                continue;
455
                        }
456
                        if ( in_array( self::PREFIX . 'analysis-package', $script['deps'], true ) ) {
×
457
                                $scripts[ $name ]['deps'][] = self::PREFIX . YoastSEO()->helpers->language->get_researcher_language() . '-language';
458
                        }
459
                }
460

461
                return $scripts;
462
        }
463

464
        /**
465
         * Loads a generated asset file.
466
         *
467
         * @param array $args {
468
         *     The arguments.
469
         *
470
         *     @type string                  $asset_file      The asset file to load.
471
         *     @type int                     $ext_length      The length of the extension, including suffix, of the filename.
472
         *     @type string                  $suffix          Optional. The suffix of the asset name.
473
         *     @type array<string, string[]> $additional_deps Optional. The additional dependencies assets may have.
474
         *     @type string                  $base_dir        Optional. The base directory of the asset.
475
         *     @type string[]                $header_scripts  Optional. The script names that should be in the header.
476
         * }
477
         *
478
         * @return array {
479
         *     The scripts to be registered.
480
         *
481
         *     @type string   $name      The name of the asset.
482
         *     @type string   $src       The src of the asset.
483
         *     @type string[] $deps      The dependenies of the asset.
484
         *     @type bool     $in_footer Whether or not the asset should be in the footer.
485
         * }
486
         */
487
        protected function load_generated_asset_file( $args ) {
×
488
                $args    = wp_parse_args(
×
489
                        $args,
×
490
                        [
×
491
                                'suffix'          => '',
×
492
                                'additional_deps' => [],
×
493
                                'base_dir'        => '',
×
494
                                'header_scripts'  => [],
×
495
                        ]
×
496
                );
×
497
                $scripts = [];
×
498
                $assets  = require $args['asset_file'];
×
499
                foreach ( $assets as $file => $data ) {
×
500
                        $name  = substr( $file, 0, -$args['ext_length'] );
×
501
                        $name  = strtolower( preg_replace( '/([A-Z])/', '-$1', $name ) );
×
502
                        $name .= $args['suffix'];
503

504
                        $deps = $data['dependencies'];
×
505
                        if ( isset( $args['additional_deps'][ $name ] ) ) {
×
506
                                $deps = array_merge( $deps, $args['additional_deps'][ $name ] );
507
                        }
508

509
                        $scripts[ $name ] = [
×
510
                                'name'      => $name,
×
511
                                'src'       => $args['base_dir'] . $file,
×
512
                                'deps'      => $deps,
×
513
                                'in_footer' => ! in_array( $name, $args['header_scripts'], true ),
×
514
                                'version'   => $data['version'],
×
515
                        ];
×
516
                }
517

518
                return $scripts;
519
        }
520

521
        /**
522
         * Loads the scripts that should be renamed for BC.
523
         *
524
         * @return array {
525
         *     The scripts to be registered.
526
         *
527
         *     @type string   $name      The name of the asset.
528
         *     @type string   $src       The src of the asset.
529
         *     @type string[] $deps      The dependenies of the asset.
530
         *     @type bool     $in_footer Whether or not the asset should be in the footer.
531
         * }
532
         */
533
        protected function load_renamed_scripts() {
×
534
                $scripts         = [];
535
                $renamed_scripts = [
536
                        'admin-global-script'         => 'admin-global',
537
                        'analysis'                    => 'analysis-package',
538
                        'analysis-report'             => 'analysis-report-package',
539
                        'api'                         => 'api-client',
540
                        'commons'                     => 'commons-package',
541
                        'edit-page'                   => 'edit-page-script',
542
                        'draft-js'                    => 'draft-js-package',
543
                        'feature-flag'                => 'feature-flag-package',
544
                        'helpers'                     => 'helpers-package',
545
                        'jed'                         => 'jed-package',
546
                        'chart.js'                    => 'chart.js-package',
547
                        'network-admin-script'        => 'network-admin',
548
                        'redux'                       => 'redux-package',
549
                        'replacement-variable-editor' => 'replacement-variable-editor-package',
550
                        'search-metadata-previews'    => 'search-metadata-previews-package',
551
                        'social-metadata-forms'       => 'social-metadata-forms-package',
552
                        'styled-components'           => 'styled-components-package',
553
                        'style-guide'                 => 'style-guide-package',
554
                        'yoast-components'            => 'components-new-package',
555
                ];
556

557
                foreach ( $renamed_scripts as $original => $replacement ) {
×
558
                        $scripts[] = [
×
559
                                'name' => $original,
×
560
                                'src'  => false,
×
561
                                'deps' => [ self::PREFIX . $replacement ],
×
562
                        ];
×
563
                }
564

565
                return $scripts;
566
        }
567

568
        /**
569
         * Returns the styles that need to be registered.
570
         *
571
         * @todo Data format is not self-documenting. Needs explanation inline. R.
572
         *
573
         * @return array Styles that need to be registered.
574
         */
575
        protected function styles_to_be_registered() {
576
                $flat_version = $this->flatten_version( WPSEO_VERSION );
577

578
                return [
579
                        [
580
                                'name' => 'admin-css',
581
                                'src'  => 'yst_plugin_tools-' . $flat_version,
582
                                'deps' => [ self::PREFIX . 'toggle-switch' ],
583
                        ],
584
                        [
585
                                'name' => 'toggle-switch',
586
                                'src'  => 'toggle-switch-' . $flat_version,
587
                        ],
588
                        [
589
                                'name' => 'dismissible',
590
                                'src'  => 'wpseo-dismissible-' . $flat_version,
591
                        ],
592
                        [
593
                                'name' => 'notifications',
594
                                'src'  => 'notifications-' . $flat_version,
595
                        ],
596
                        [
597
                                'name' => 'alert',
598
                                'src'  => 'alerts-' . $flat_version,
599
                        ],
600
                        [
601
                                'name' => 'edit-page',
602
                                'src'  => 'edit-page-' . $flat_version,
603
                        ],
604
                        [
605
                                'name' => 'featured-image',
606
                                'src'  => 'featured-image-' . $flat_version,
607
                        ],
608
                        [
609
                                'name' => 'metabox-css',
610
                                'src'  => 'metabox-' . $flat_version,
611
                                'deps' => [
612
                                        self::PREFIX . 'admin-css',
613
                                        self::PREFIX . 'tailwind',
614
                                        'wp-components',
615
                                ],
616
                        ],
617
                        [
618
                                'name' => 'block-editor',
619
                                'src'  => 'block-editor-' . $flat_version,
620
                        ],
621
                        [
622
                                'name' => 'ai-generator',
623
                                'src'  => 'ai-generator-' . $flat_version,
624
                                'deps' => [
625
                                        self::PREFIX . 'ai-frontend',
626
                                        self::PREFIX . 'tailwind',
627
                                        self::PREFIX . 'introductions',
628
                                ],
629
                        ],
630
                        [
631
                                'name' => 'ai-fix-assessments',
632
                                'src'  => 'ai-fix-assessments-' . $flat_version,
633
                        ],
634
                        [
635
                                'name' => 'ai-frontend',
636
                                'src'  => 'ai-frontend-' . $flat_version,
637
                        ],
638
                        [
639
                                'name' => 'introductions',
640
                                'src'  => 'introductions-' . $flat_version,
641
                                'deps' => [ self::PREFIX . 'tailwind' ],
642
                        ],
643
                        [
644
                                'name' => 'wp-dashboard',
645
                                'src'  => 'dashboard-' . $flat_version,
646
                        ],
647
                        [
648
                                'name' => 'scoring',
649
                                'src'  => 'yst_seo_score-' . $flat_version,
650
                        ],
651
                        [
652
                                'name' => 'adminbar',
653
                                'src'  => 'adminbar-' . $flat_version,
654
                                'deps' => [
655
                                        'admin-bar',
656
                                ],
657
                        ],
658
                        [
659
                                'name' => 'primary-category',
660
                                'src'  => 'metabox-primary-category-' . $flat_version,
661
                        ],
662
                        [
663
                                'name' => 'admin-global',
664
                                'src'  => 'admin-global-' . $flat_version,
665
                                'deps' => [ self::PREFIX . 'tailwind' ],
666
                        ],
667
                        [
668
                                'name' => 'filter-explanation',
669
                                'src'  => 'filter-explanation-' . $flat_version,
670
                        ],
671
                        [
672
                                'name' => 'monorepo',
673
                                'src'  => 'monorepo-' . $flat_version,
674
                        ],
675
                        [
676
                                'name' => 'structured-data-blocks',
677
                                'src'  => 'structured-data-blocks-' . $flat_version,
678
                                'deps' => [
679
                                        'dashicons',
680
                                        'forms',
681
                                        'wp-edit-blocks',
682
                                ],
683
                        ],
684
                        [
685
                                'name' => 'elementor',
686
                                'src'  => 'elementor-' . $flat_version,
687
                        ],
688
                        [
689
                                'name' => 'tailwind',
690
                                'src'  => 'tailwind-' . $flat_version,
691
                                // Note: The RTL suffix is not added here.
692
                                // Tailwind and our UI library provide styling that should be standalone compatible with RTL.
693
                                // To make it easier we should use the logical properties and values when possible.
694
                                // If there are exceptions, we can use the Tailwind modifier, e.g. `rtl:yst-space-x-reverse`.
695
                                'rtl'  => false,
696
                        ],
697
                        [
698
                                'name' => 'new-settings',
699
                                'src'  => 'new-settings-' . $flat_version,
700
                                'deps' => [ self::PREFIX . 'tailwind' ],
701
                        ],
702
                        [
703
                                'name' => 'redirects',
704
                                'src'  => 'redirects-' . $flat_version,
705
                                'deps' => [ self::PREFIX . 'tailwind' ],
706
                        ],
707
                        [
708
                                'name' => 'black-friday-banner',
709
                                'src'  => 'black-friday-banner-' . $flat_version,
710
                                'deps' => [ self::PREFIX . 'tailwind' ],
711
                        ],
712
                        [
713
                                'name' => 'academy',
714
                                'src'  => 'academy-' . $flat_version,
715
                                'deps' => [ self::PREFIX . 'tailwind' ],
716
                        ],
717
                        [
718
                                'name' => 'general-page',
719
                                'src'  => 'general-page-' . $flat_version,
720
                                'deps' => [ self::PREFIX . 'tailwind' ],
721
                        ],
722
                        [
723
                                'name' => 'installation-success',
724
                                'src'  => 'installation-success-' . $flat_version,
725
                                'deps' => [ self::PREFIX . 'tailwind' ],
726
                        ],
727
                        [
728
                                'name' => 'support',
729
                                'src'  => 'support-' . $flat_version,
730
                                'deps' => [ self::PREFIX . 'tailwind' ],
731
                        ],
732
                        [
733
                                'name' => 'workouts',
734
                                'src'  => 'workouts-' . $flat_version,
735
                                'deps' => [
736
                                        self::PREFIX . 'monorepo',
737
                                ],
738
                        ],
739
                        [
740
                                'name' => 'first-time-configuration',
741
                                'src'  => 'first-time-configuration-' . $flat_version,
742
                                'deps' => [ self::PREFIX . 'tailwind' ],
743
                        ],
744
                        [
745
                                'name' => 'inside-editor',
746
                                'src'  => 'inside-editor-' . $flat_version,
747
                        ],
748
                        [
749
                                'name' => 'plans',
750
                                'src'  => 'plans-' . $flat_version,
751
                                'deps' => [ self::PREFIX . 'tailwind' ],
752
                        ],
753
                ];
754
        }
755

756
        /**
757
         * Determines the URL of the asset.
758
         *
759
         * @param WPSEO_Admin_Asset $asset The asset to determine the URL for.
760
         * @param string            $type  The type of asset. Usually JS or CSS.
761
         *
762
         * @return string The URL of the asset.
763
         */
764
        protected function get_url( WPSEO_Admin_Asset $asset, $type ) {
×
765
                $scheme = wp_parse_url( $asset->get_src(), PHP_URL_SCHEME );
×
766
                if ( in_array( $scheme, [ 'http', 'https' ], true ) ) {
×
767
                        return $asset->get_src();
768
                }
769

770
                return $this->asset_location->get_url( $asset, $type );
771
        }
772
}
773

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc