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

Yoast / wordpress-seo / 59517635615d055f783a2be92e52a1e2637df1be

17 Feb 2025 11:08AM UTC coverage: 53.377% (-1.3%) from 54.636%
59517635615d055f783a2be92e52a1e2637df1be

Pull #22048

github

web-flow
Merge e41dbb150 into 711656c23
Pull Request #22048: Update Dashboard page description

7808 of 13867 branches covered (56.31%)

Branch coverage included in aggregate %.

4 of 5 new or added lines in 2 files covered. (80.0%)

1554 existing lines in 42 files now uncovered.

30279 of 57488 relevant lines covered (52.67%)

40022.22 hits per line

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

30.66
/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 ) {
2✔
60
                wp_enqueue_script( $this->prefix . $script );
2✔
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 ) {
4✔
71
                wp_enqueue_style( $this->prefix . $style );
4✔
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 ) {
4✔
91
                $url  = $script->get_src() ? $this->get_url( $script, WPSEO_Admin_Asset::TYPE_JS ) : false;
4✔
92
                $args = [
4✔
93
                        'in_footer' => $script->is_in_footer(),
4✔
94
                ];
4✔
95

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

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

108
                if ( in_array( 'wp-i18n', $script->get_deps(), true ) ) {
4✔
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 ) {
4✔
121
                wp_register_style(
4✔
122
                        $this->prefix . $style->get_name(),
4✔
123
                        $this->get_url( $style, WPSEO_Admin_Asset::TYPE_CSS ),
4✔
124
                        $style->get_deps(),
4✔
125
                        $style->get_version(),
4✔
126
                        $style->get_media()
4✔
127
                );
4✔
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() {
2✔
136
                $this->register_scripts( $this->scripts_to_be_registered() );
2✔
137
                $this->register_styles( $this->styles_to_be_registered() );
2✔
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 ) {
2✔
148
                foreach ( $scripts as $script ) {
2✔
149
                        $script = new WPSEO_Admin_Asset( $script );
2✔
150
                        $this->register_script( $script );
2✔
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 ) {
2✔
162
                foreach ( $styles as $style ) {
2✔
163
                        $style = new WPSEO_Admin_Asset( $style );
2✔
164
                        $this->register_style( $style );
2✔
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 ) {
12✔
217
                $parts = explode( '.', $version );
12✔
218

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

223
                return implode( '', $parts );
12✔
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
         * Returns the scripts that need to be registered.
254
         *
255
         * @todo Data format is not self-documenting. Needs explanation inline. R.
256
         *
257
         * @return array The scripts that need to be registered.
258
         */
259
        protected function scripts_to_be_registered() {
×
260
                $header_scripts          = [
261
                        'admin-global',
×
262
                        'block-editor',
263
                        'classic-editor',
264
                        'post-edit',
265
                        'help-scout-beacon',
266
                        'redirect-old-features-tab',
267
                ];
268
                $additional_dependencies = [
269
                        'analysis-worker'          => [ self::PREFIX . 'analysis-package' ],
×
270
                        'api-client'               => [ 'wp-api' ],
271
                        'crawl-settings'           => [ 'jquery' ],
272
                        'dashboard-widget'         => [ self::PREFIX . 'api-client' ],
273
                        'wincher-dashboard-widget' => [ self::PREFIX . 'api-client' ],
274
                        'editor-modules'           => [ 'jquery' ],
275
                        'elementor'                => [
276
                                self::PREFIX . 'api-client',
277
                                self::PREFIX . 'externals-components',
278
                                self::PREFIX . 'externals-contexts',
279
                                self::PREFIX . 'externals-redux',
280
                        ],
281
                        'indexation'               => [
282
                                'jquery-ui-core',
283
                                'jquery-ui-progressbar',
284
                        ],
285
                        'first-time-configuration' => [
286
                                self::PREFIX . 'api-client',
287
                                self::PREFIX . 'externals-components',
288
                                self::PREFIX . 'externals-contexts',
289
                                self::PREFIX . 'externals-redux',
290
                        ],
291
                        'integrations-page'        => [
292
                                self::PREFIX . 'api-client',
293
                                self::PREFIX . 'externals-components',
294
                                self::PREFIX . 'externals-contexts',
295
                                self::PREFIX . 'externals-redux',
296
                        ],
297
                        'post-edit'                => [
298
                                self::PREFIX . 'api-client',
299
                                self::PREFIX . 'block-editor',
300
                                self::PREFIX . 'externals-components',
301
                                self::PREFIX . 'externals-contexts',
302
                                self::PREFIX . 'externals-redux',
303
                        ],
304
                        'reindex-links'            => [
305
                                'jquery-ui-core',
306
                                'jquery-ui-progressbar',
307
                        ],
308
                        'settings'                 => [
309
                                'jquery-ui-core',
310
                                'jquery-ui-progressbar',
311
                                self::PREFIX . 'api-client',
312
                                self::PREFIX . 'externals-components',
313
                                self::PREFIX . 'externals-contexts',
314
                                self::PREFIX . 'externals-redux',
315
                        ],
316
                        'term-edit'                => [
317
                                self::PREFIX . 'api-client',
318
                                self::PREFIX . 'classic-editor',
319
                                self::PREFIX . 'externals-components',
320
                                self::PREFIX . 'externals-contexts',
321
                                self::PREFIX . 'externals-redux',
322
                        ],
323
                        'general-page'             => [
324
                                self::PREFIX . 'api-client',
325
                        ],
326
                ];
327

328
                $plugin_scripts   = $this->load_generated_asset_file(
×
329
                        [
330
                                'asset_file'      => __DIR__ . '/../src/generated/assets/plugin.php',
×
331
                                'ext_length'      => 3,
×
332
                                'additional_deps' => $additional_dependencies,
×
333
                                'header_scripts'  => $header_scripts,
×
334
                        ]
335
                );
336
                $external_scripts = $this->load_generated_asset_file(
×
337
                        [
338
                                'asset_file'      => __DIR__ . '/../src/generated/assets/externals.php',
×
339
                                'ext_length'      => 3,
×
340
                                'suffix'          => '-package',
×
341
                                'base_dir'        => 'externals/',
×
342
                                'additional_deps' => $additional_dependencies,
×
343
                                'header_scripts'  => $header_scripts,
×
344
                        ]
345
                );
346
                $language_scripts = $this->load_generated_asset_file(
×
347
                        [
348
                                'asset_file'      => __DIR__ . '/../src/generated/assets/languages.php',
×
349
                                'ext_length'      => 3,
×
350
                                'suffix'          => '-language',
×
351
                                'base_dir'        => 'languages/',
×
352
                                'additional_deps' => $additional_dependencies,
×
353
                                'header_scripts'  => $header_scripts,
×
354
                        ]
355
                );
356
                $renamed_scripts  = $this->load_renamed_scripts();
×
357

358
                $scripts = array_merge(
×
359
                        $plugin_scripts,
×
360
                        $external_scripts,
×
361
                        $language_scripts,
×
362
                        $renamed_scripts
×
363
                );
364

365
                $scripts['installation-success'] = [
×
366
                        'name'    => 'installation-success',
×
367
                        'src'     => 'installation-success.js',
×
368
                        'deps'    => [
369
                                'wp-a11y',
370
                                'wp-dom-ready',
371
                                'wp-components',
372
                                'wp-element',
373
                                'wp-i18n',
374
                                self::PREFIX . 'components-new-package',
375
                                self::PREFIX . 'externals-components',
376
                        ],
377
                        'version' => $scripts['installation-success']['version'],
×
378
                ];
379

380
                $scripts['post-edit-classic'] = [
×
381
                        'name'      => 'post-edit-classic',
×
382
                        'src'       => $scripts['post-edit']['src'],
×
383
                        'deps'      => array_map(
×
384
                                static function ( $dep ) {
385
                                        if ( $dep === self::PREFIX . 'block-editor' ) {
×
386
                                                return self::PREFIX . 'classic-editor';
387
                                        }
388
                                        return $dep;
×
389
                                },
×
390
                                $scripts['post-edit']['deps']
UNCOV
391
                        ),
×
392
                        'in_footer' => ! in_array( 'post-edit-classic', $header_scripts, true ),
×
393
                        'version'   => $scripts['post-edit']['version'],
394
                ];
395

396
                $scripts['workouts'] = [
×
397
                        'name'    => 'workouts',
×
398
                        'src'     => 'workouts.js',
399
                        'deps'    => [
400
                                'clipboard',
401
                                'lodash',
402
                                'wp-api-fetch',
403
                                'wp-a11y',
404
                                'wp-components',
405
                                'wp-compose',
406
                                'wp-data',
407
                                'wp-dom-ready',
408
                                'wp-element',
409
                                'wp-i18n',
410
                                self::PREFIX . 'externals-components',
411
                                self::PREFIX . 'externals-contexts',
412
                                self::PREFIX . 'externals-redux',
413
                                self::PREFIX . 'analysis',
414
                                self::PREFIX . 'react-select',
415
                                self::PREFIX . 'components-new-package',
UNCOV
416
                        ],
×
417
                        'version' => $scripts['workouts']['version'],
418
                ];
419

420
                // Add the current language to every script that requires the analysis package.
421
                foreach ( $scripts as $name => $script ) {
×
422
                        if ( substr( $name, -8 ) === 'language' ) {
×
423
                                continue;
424
                        }
425
                        if ( in_array( self::PREFIX . 'analysis-package', $script['deps'], true ) ) {
×
426
                                $scripts[ $name ]['deps'][] = self::PREFIX . YoastSEO()->helpers->language->get_researcher_language() . '-language';
427
                        }
428
                }
429

430
                return $scripts;
431
        }
432

433
        /**
434
         * Loads a generated asset file.
435
         *
436
         * @param array $args {
437
         *     The arguments.
438
         *
439
         *     @type string                  $asset_file      The asset file to load.
440
         *     @type int                     $ext_length      The length of the extension, including suffix, of the filename.
441
         *     @type string                  $suffix          Optional. The suffix of the asset name.
442
         *     @type array<string, string[]> $additional_deps Optional. The additional dependencies assets may have.
443
         *     @type string                  $base_dir        Optional. The base directory of the asset.
444
         *     @type string[]                $header_scripts  Optional. The script names that should be in the header.
445
         * }
446
         *
447
         * @return array {
448
         *     The scripts to be registered.
449
         *
450
         *     @type string   $name      The name of the asset.
451
         *     @type string   $src       The src of the asset.
452
         *     @type string[] $deps      The dependenies of the asset.
453
         *     @type bool     $in_footer Whether or not the asset should be in the footer.
454
         * }
455
         */
456
        protected function load_generated_asset_file( $args ) {
×
457
                $args    = wp_parse_args(
×
458
                        $args,
UNCOV
459
                        [
×
460
                                'suffix'          => '',
461
                                'additional_deps' => [],
462
                                'base_dir'        => '',
463
                                'header_scripts'  => [],
464
                        ]
UNCOV
465
                );
×
466
                $scripts = [];
×
467
                $assets  = require $args['asset_file'];
×
468
                foreach ( $assets as $file => $data ) {
×
469
                        $name  = substr( $file, 0, -$args['ext_length'] );
×
470
                        $name  = strtolower( preg_replace( '/([A-Z])/', '-$1', $name ) );
×
471
                        $name .= $args['suffix'];
472

473
                        $deps = $data['dependencies'];
×
474
                        if ( isset( $args['additional_deps'][ $name ] ) ) {
×
475
                                $deps = array_merge( $deps, $args['additional_deps'][ $name ] );
476
                        }
477

478
                        $scripts[ $name ] = [
×
479
                                'name'      => $name,
×
480
                                'src'       => $args['base_dir'] . $file,
×
481
                                'deps'      => $deps,
×
482
                                'in_footer' => ! in_array( $name, $args['header_scripts'], true ),
×
483
                                'version'   => $data['version'],
484
                        ];
485
                }
486

487
                return $scripts;
488
        }
489

490
        /**
491
         * Loads the scripts that should be renamed for BC.
492
         *
493
         * @return array {
494
         *     The scripts to be registered.
495
         *
496
         *     @type string   $name      The name of the asset.
497
         *     @type string   $src       The src of the asset.
498
         *     @type string[] $deps      The dependenies of the asset.
499
         *     @type bool     $in_footer Whether or not the asset should be in the footer.
500
         * }
501
         */
502
        protected function load_renamed_scripts() {
×
503
                $scripts         = [];
504
                $renamed_scripts = [
505
                        'admin-global-script'         => 'admin-global',
506
                        'analysis'                    => 'analysis-package',
507
                        'analysis-report'             => 'analysis-report-package',
508
                        'api'                         => 'api-client',
509
                        'commons'                     => 'commons-package',
510
                        'edit-page'                   => 'edit-page-script',
511
                        'draft-js'                    => 'draft-js-package',
512
                        'feature-flag'                => 'feature-flag-package',
513
                        'helpers'                     => 'helpers-package',
514
                        'jed'                         => 'jed-package',
515
                        'chart.js'                    => 'chart.js-package',
516
                        'network-admin-script'        => 'network-admin',
517
                        'redux'                       => 'redux-package',
518
                        'replacement-variable-editor' => 'replacement-variable-editor-package',
519
                        'search-metadata-previews'    => 'search-metadata-previews-package',
520
                        'social-metadata-forms'       => 'social-metadata-forms-package',
521
                        'styled-components'           => 'styled-components-package',
522
                        'style-guide'                 => 'style-guide-package',
523
                        'yoast-components'            => 'components-new-package',
524
                ];
525

526
                foreach ( $renamed_scripts as $original => $replacement ) {
×
527
                        $scripts[] = [
×
528
                                'name' => $original,
UNCOV
529
                                'src'  => false,
×
530
                                'deps' => [ self::PREFIX . $replacement ],
531
                        ];
532
                }
533

534
                return $scripts;
535
        }
536

537
        /**
538
         * Returns the styles that need to be registered.
539
         *
540
         * @todo Data format is not self-documenting. Needs explanation inline. R.
541
         *
542
         * @return array Styles that need to be registered.
543
         */
544
        protected function styles_to_be_registered() {
545
                $flat_version = $this->flatten_version( WPSEO_VERSION );
546

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

711
        /**
712
         * Determines the URL of the asset.
713
         *
714
         * @param WPSEO_Admin_Asset $asset The asset to determine the URL for.
715
         * @param string            $type  The type of asset. Usually JS or CSS.
716
         *
717
         * @return string The URL of the asset.
718
         */
719
        protected function get_url( WPSEO_Admin_Asset $asset, $type ) {
×
720
                $scheme = wp_parse_url( $asset->get_src(), PHP_URL_SCHEME );
×
721
                if ( in_array( $scheme, [ 'http', 'https' ], true ) ) {
×
722
                        return $asset->get_src();
723
                }
724

725
                return $this->asset_location->get_url( $asset, $type );
726
        }
727
}
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

© 2025 Coveralls, Inc