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

Yoast / wordpress-seo / a1c7ed2f8ec1c6d0c8c9fab3a13765c5183df19f

18 Nov 2025 08:40AM UTC coverage: 53.381% (-0.08%) from 53.458%
a1c7ed2f8ec1c6d0c8c9fab3a13765c5183df19f

push

github

marinakoleva
Merge branch 'trunk' of https://github.com/Yoast/wordpress-seo into feature/off-the-bat-analysis

8607 of 15888 branches covered (54.17%)

Branch coverage included in aggregate %.

0 of 99 new or added lines in 6 files covered. (0.0%)

5 existing lines in 2 files now uncovered.

32310 of 60763 relevant lines covered (53.17%)

47453.76 hits per line

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

15.79
/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<string> The array of elementor dependencies.
256
         */
NEW
257
        protected function get_elementor_dependencies() {
×
NEW
258
                $dependencies = [
×
NEW
259
                        'backbone-marionette',
×
NEW
260
                        'elementor-common-modules',
×
NEW
261
                        self::PREFIX . 'api-client',
×
NEW
262
                        self::PREFIX . 'externals-components',
×
NEW
263
                        self::PREFIX . 'externals-contexts',
×
NEW
264
                        self::PREFIX . 'externals-redux',
×
NEW
265
                ];
×
266
                // Conditionally add Elementor v2 dependency if available.
NEW
267
                if ( wp_script_is( 'elementor-v2-editor-app-bar', 'registered' ) ) {
×
NEW
268
                        $dependencies[] = 'elementor-v2-editor-app-bar';
×
269
                }
NEW
270
                return $dependencies;
×
271
        }
272

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

345
                $plugin_scripts   = $this->load_generated_asset_file(
×
346
                        [
×
347
                                'asset_file'      => __DIR__ . '/../src/generated/assets/plugin.php',
×
348
                                'ext_length'      => 3,
×
349
                                'additional_deps' => $additional_dependencies,
×
350
                                'header_scripts'  => $header_scripts,
×
351
                        ]
×
352
                );
×
353
                $external_scripts = $this->load_generated_asset_file(
×
354
                        [
×
355
                                'asset_file'      => __DIR__ . '/../src/generated/assets/externals.php',
×
356
                                'ext_length'      => 3,
×
357
                                'suffix'          => '-package',
×
358
                                'base_dir'        => 'externals/',
×
359
                                'additional_deps' => $additional_dependencies,
×
360
                                'header_scripts'  => $header_scripts,
×
361
                        ]
×
362
                );
×
363
                $language_scripts = $this->load_generated_asset_file(
×
364
                        [
×
365
                                'asset_file'      => __DIR__ . '/../src/generated/assets/languages.php',
×
366
                                'ext_length'      => 3,
×
367
                                'suffix'          => '-language',
×
368
                                'base_dir'        => 'languages/',
×
369
                                'additional_deps' => $additional_dependencies,
×
370
                                'header_scripts'  => $header_scripts,
×
371
                        ]
×
372
                );
×
373
                $renamed_scripts  = $this->load_renamed_scripts();
×
374

375
                $scripts = array_merge(
×
376
                        $plugin_scripts,
×
377
                        $external_scripts,
×
378
                        $language_scripts,
×
379
                        $renamed_scripts
×
380
                );
×
381

382
                $scripts['installation-success'] = [
×
383
                        'name'    => 'installation-success',
×
384
                        'src'     => 'installation-success.js',
×
385
                        'deps'    => [
×
386
                                'wp-a11y',
×
387
                                'wp-dom-ready',
×
388
                                'wp-components',
×
389
                                'wp-element',
×
390
                                'wp-i18n',
×
391
                                self::PREFIX . 'components-new-package',
×
392
                                self::PREFIX . 'externals-components',
×
393
                        ],
×
394
                        'version' => $scripts['installation-success']['version'],
×
395
                ];
×
396

397
                $scripts['post-edit-classic'] = [
×
398
                        'name'      => 'post-edit-classic',
×
399
                        'src'       => $scripts['post-edit']['src'],
×
400
                        'deps'      => array_map(
×
401
                                static function ( $dep ) {
×
402
                                        if ( $dep === self::PREFIX . 'block-editor' ) {
×
403
                                                return self::PREFIX . 'classic-editor';
404
                                        }
405
                                        return $dep;
×
406
                                },
×
407
                                $scripts['post-edit']['deps']
×
408
                        ),
×
409
                        'in_footer' => ! in_array( 'post-edit-classic', $header_scripts, true ),
×
410
                        'version'   => $scripts['post-edit']['version'],
×
411
                ];
×
412

413
                $scripts['workouts'] = [
×
414
                        'name'    => 'workouts',
×
415
                        'src'     => 'workouts.js',
×
416
                        'deps'    => [
×
417
                                'clipboard',
×
418
                                'lodash',
×
419
                                'wp-api-fetch',
×
420
                                'wp-a11y',
×
421
                                'wp-components',
×
422
                                'wp-compose',
×
423
                                'wp-data',
×
424
                                'wp-dom-ready',
×
425
                                'wp-element',
×
426
                                'wp-i18n',
×
427
                                self::PREFIX . 'externals-components',
×
428
                                self::PREFIX . 'externals-contexts',
×
429
                                self::PREFIX . 'externals-redux',
×
430
                                self::PREFIX . 'analysis',
×
431
                                self::PREFIX . 'components-new-package',
×
432
                        ],
×
433
                        'version' => $scripts['workouts']['version'],
×
434
                ];
×
435

436
                // Add the current language to every script that requires the analysis package.
437
                foreach ( $scripts as $name => $script ) {
×
438
                        if ( substr( $name, -8 ) === 'language' ) {
×
439
                                continue;
440
                        }
441
                        if ( in_array( self::PREFIX . 'analysis-package', $script['deps'], true ) ) {
×
442
                                $scripts[ $name ]['deps'][] = self::PREFIX . YoastSEO()->helpers->language->get_researcher_language() . '-language';
443
                        }
444
                }
445

446
                return $scripts;
447
        }
448

449
        /**
450
         * Loads a generated asset file.
451
         *
452
         * @param array $args {
453
         *     The arguments.
454
         *
455
         *     @type string                  $asset_file      The asset file to load.
456
         *     @type int                     $ext_length      The length of the extension, including suffix, of the filename.
457
         *     @type string                  $suffix          Optional. The suffix of the asset name.
458
         *     @type array<string, string[]> $additional_deps Optional. The additional dependencies assets may have.
459
         *     @type string                  $base_dir        Optional. The base directory of the asset.
460
         *     @type string[]                $header_scripts  Optional. The script names that should be in the header.
461
         * }
462
         *
463
         * @return array {
464
         *     The scripts to be registered.
465
         *
466
         *     @type string   $name      The name of the asset.
467
         *     @type string   $src       The src of the asset.
468
         *     @type string[] $deps      The dependenies of the asset.
469
         *     @type bool     $in_footer Whether or not the asset should be in the footer.
470
         * }
471
         */
472
        protected function load_generated_asset_file( $args ) {
×
473
                $args    = wp_parse_args(
×
474
                        $args,
×
475
                        [
×
476
                                'suffix'          => '',
×
477
                                'additional_deps' => [],
×
478
                                'base_dir'        => '',
×
479
                                'header_scripts'  => [],
×
480
                        ]
×
481
                );
×
482
                $scripts = [];
×
483
                $assets  = require $args['asset_file'];
×
484
                foreach ( $assets as $file => $data ) {
×
485
                        $name  = substr( $file, 0, -$args['ext_length'] );
×
486
                        $name  = strtolower( preg_replace( '/([A-Z])/', '-$1', $name ) );
×
487
                        $name .= $args['suffix'];
488

489
                        $deps = $data['dependencies'];
×
490
                        if ( isset( $args['additional_deps'][ $name ] ) ) {
×
491
                                $deps = array_merge( $deps, $args['additional_deps'][ $name ] );
492
                        }
493

494
                        $scripts[ $name ] = [
×
495
                                'name'      => $name,
×
496
                                'src'       => $args['base_dir'] . $file,
×
497
                                'deps'      => $deps,
×
498
                                'in_footer' => ! in_array( $name, $args['header_scripts'], true ),
×
499
                                'version'   => $data['version'],
×
500
                        ];
×
501
                }
502

503
                return $scripts;
504
        }
505

506
        /**
507
         * Loads the scripts that should be renamed for BC.
508
         *
509
         * @return array {
510
         *     The scripts to be registered.
511
         *
512
         *     @type string   $name      The name of the asset.
513
         *     @type string   $src       The src of the asset.
514
         *     @type string[] $deps      The dependenies of the asset.
515
         *     @type bool     $in_footer Whether or not the asset should be in the footer.
516
         * }
517
         */
518
        protected function load_renamed_scripts() {
×
519
                $scripts         = [];
520
                $renamed_scripts = [
521
                        'admin-global-script'         => 'admin-global',
522
                        'analysis'                    => 'analysis-package',
523
                        'analysis-report'             => 'analysis-report-package',
524
                        'api'                         => 'api-client',
525
                        'commons'                     => 'commons-package',
526
                        'edit-page'                   => 'edit-page-script',
527
                        'draft-js'                    => 'draft-js-package',
528
                        'feature-flag'                => 'feature-flag-package',
529
                        'helpers'                     => 'helpers-package',
530
                        'jed'                         => 'jed-package',
531
                        'chart.js'                    => 'chart.js-package',
532
                        'network-admin-script'        => 'network-admin',
533
                        'redux'                       => 'redux-package',
534
                        'replacement-variable-editor' => 'replacement-variable-editor-package',
535
                        'search-metadata-previews'    => 'search-metadata-previews-package',
536
                        'social-metadata-forms'       => 'social-metadata-forms-package',
537
                        'styled-components'           => 'styled-components-package',
538
                        'style-guide'                 => 'style-guide-package',
539
                        'yoast-components'            => 'components-new-package',
540
                ];
541

542
                foreach ( $renamed_scripts as $original => $replacement ) {
×
543
                        $scripts[] = [
×
544
                                'name' => $original,
×
545
                                'src'  => false,
×
546
                                'deps' => [ self::PREFIX . $replacement ],
×
547
                        ];
×
548
                }
549

550
                return $scripts;
551
        }
552

553
        /**
554
         * Returns the styles that need to be registered.
555
         *
556
         * @todo Data format is not self-documenting. Needs explanation inline. R.
557
         *
558
         * @return array Styles that need to be registered.
559
         */
560
        protected function styles_to_be_registered() {
561
                $flat_version = $this->flatten_version( WPSEO_VERSION );
562

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

741
        /**
742
         * Determines the URL of the asset.
743
         *
744
         * @param WPSEO_Admin_Asset $asset The asset to determine the URL for.
745
         * @param string            $type  The type of asset. Usually JS or CSS.
746
         *
747
         * @return string The URL of the asset.
748
         */
749
        protected function get_url( WPSEO_Admin_Asset $asset, $type ) {
×
750
                $scheme = wp_parse_url( $asset->get_src(), PHP_URL_SCHEME );
×
751
                if ( in_array( $scheme, [ 'http', 'https' ], true ) ) {
×
752
                        return $asset->get_src();
753
                }
754

755
                return $this->asset_location->get_url( $asset, $type );
756
        }
757
}
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