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

Yoast / wordpress-seo / dec7c853399f4bc278ee30e5e85eb0d44b269b0f

15 Oct 2024 12:07PM UTC coverage: 49.393% (-5.2%) from 54.558%
dec7c853399f4bc278ee30e5e85eb0d44b269b0f

push

github

web-flow
Merge pull request #21707 from Yoast/1909-minor-237-new-dash-ftc-notice-should-not-be-shown-on-ftc-page

Remove notices on FTC tab

7539 of 13559 branches covered (55.6%)

Branch coverage included in aggregate %.

0 of 1 new or added line in 1 file covered. (0.0%)

4291 existing lines in 144 files now uncovered.

25662 of 53659 relevant lines covered (47.82%)

42477.44 hits per line

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

0.0
/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
         */
UNCOV
59
        public function enqueue_script( $script ) {
×
UNCOV
60
                wp_enqueue_script( $this->prefix . $script );
×
61
        }
62

63
        /**
64
         * Enqueues styles.
65
         *
66
         * @param string $style The name of the style to enqueue.
67
         *
68
         * @return void
69
         */
UNCOV
70
        public function enqueue_style( $style ) {
×
UNCOV
71
                wp_enqueue_style( $this->prefix . $style );
×
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
         */
UNCOV
90
        public function register_script( WPSEO_Admin_Asset $script ) {
×
UNCOV
91
                $url = $script->get_src() ? $this->get_url( $script, WPSEO_Admin_Asset::TYPE_JS ) : false;
×
92

UNCOV
93
                wp_register_script(
×
UNCOV
94
                        $this->prefix . $script->get_name(),
×
UNCOV
95
                        $url,
×
UNCOV
96
                        $script->get_deps(),
×
UNCOV
97
                        $script->get_version(),
×
UNCOV
98
                        $script->is_in_footer()
×
99
                );
100

UNCOV
101
                if ( in_array( 'wp-i18n', $script->get_deps(), true ) ) {
×
102
                        wp_set_script_translations( $this->prefix . $script->get_name(), 'wordpress-seo' );
×
103
                }
104
        }
105

106
        /**
107
         * Registers styles based on it's parameters.
108
         *
109
         * @param WPSEO_Admin_Asset $style The style to register.
110
         *
111
         * @return void
112
         */
UNCOV
113
        public function register_style( WPSEO_Admin_Asset $style ) {
×
UNCOV
114
                wp_register_style(
×
UNCOV
115
                        $this->prefix . $style->get_name(),
×
UNCOV
116
                        $this->get_url( $style, WPSEO_Admin_Asset::TYPE_CSS ),
×
UNCOV
117
                        $style->get_deps(),
×
UNCOV
118
                        $style->get_version(),
×
UNCOV
119
                        $style->get_media()
×
120
                );
121
        }
122

123
        /**
124
         * Calls the functions that register scripts and styles with the scripts and styles to be registered as arguments.
125
         *
126
         * @return void
127
         */
UNCOV
128
        public function register_assets() {
×
UNCOV
129
                $this->register_scripts( $this->scripts_to_be_registered() );
×
UNCOV
130
                $this->register_styles( $this->styles_to_be_registered() );
×
131
        }
132

133
        /**
134
         * Registers all the scripts passed to it.
135
         *
136
         * @param array $scripts The scripts passed to it.
137
         *
138
         * @return void
139
         */
UNCOV
140
        public function register_scripts( $scripts ) {
×
UNCOV
141
                foreach ( $scripts as $script ) {
×
UNCOV
142
                        $script = new WPSEO_Admin_Asset( $script );
×
UNCOV
143
                        $this->register_script( $script );
×
144
                }
145
        }
146

147
        /**
148
         * Registers all the styles it receives.
149
         *
150
         * @param array $styles Styles that need to be registered.
151
         *
152
         * @return void
153
         */
UNCOV
154
        public function register_styles( $styles ) {
×
UNCOV
155
                foreach ( $styles as $style ) {
×
UNCOV
156
                        $style = new WPSEO_Admin_Asset( $style );
×
UNCOV
157
                        $this->register_style( $style );
×
158
                }
159
        }
160

161
        /**
162
         * Localizes the script.
163
         *
164
         * @param string $handle      The script handle.
165
         * @param string $object_name The object name.
166
         * @param array  $data        The l10n data.
167
         *
168
         * @return void
169
         */
170
        public function localize_script( $handle, $object_name, $data ) {
×
171
                wp_localize_script( $this->prefix . $handle, $object_name, $data );
×
172
        }
173

174
        /**
175
         * Adds an inline script.
176
         *
177
         * @param string $handle   The script handle.
178
         * @param string $data     The l10n data.
179
         * @param string $position Optional. Whether to add the inline script before the handle or after.
180
         *
181
         * @return void
182
         */
183
        public function add_inline_script( $handle, $data, $position = 'after' ) {
×
184
                wp_add_inline_script( $this->prefix . $handle, $data, $position );
×
185
        }
186

187
        /**
188
         * A list of styles that shouldn't be registered but are needed in other locations in the plugin.
189
         *
190
         * @return array
191
         */
192
        public function special_styles() {
×
193
                $flat_version = $this->flatten_version( WPSEO_VERSION );
×
194
                $asset_args   = [
195
                        'name' => 'inside-editor',
×
196
                        'src'  => 'inside-editor-' . $flat_version,
×
197
                ];
198

199
                return [ 'inside-editor' => new WPSEO_Admin_Asset( $asset_args ) ];
×
200
        }
201

202
        /**
203
         * Flattens a version number for use in a filename.
204
         *
205
         * @param string $version The original version number.
206
         *
207
         * @return string The flattened version number.
208
         */
UNCOV
209
        public function flatten_version( $version ) {
×
UNCOV
210
                $parts = explode( '.', $version );
×
211

UNCOV
212
                if ( count( $parts ) === 2 && preg_match( '/^\d+$/', $parts[1] ) === 1 ) {
×
UNCOV
213
                        $parts[] = '0';
×
214
                }
215

UNCOV
216
                return implode( '', $parts );
×
217
        }
218

219
        /**
220
         * Creates a default location object for use in the admin asset manager.
221
         *
222
         * @return WPSEO_Admin_Asset_Location The location to use in the asset manager.
223
         */
224
        public static function create_default_location() {
×
225
                if ( defined( 'YOAST_SEO_DEV_SERVER' ) && YOAST_SEO_DEV_SERVER ) {
×
226
                        $url = defined( 'YOAST_SEO_DEV_SERVER_URL' ) ? YOAST_SEO_DEV_SERVER_URL : WPSEO_Admin_Asset_Dev_Server_Location::DEFAULT_URL;
×
227

228
                        return new WPSEO_Admin_Asset_Dev_Server_Location( $url );
×
229
                }
230

231
                return new WPSEO_Admin_Asset_SEO_Location( WPSEO_FILE, false );
×
232
        }
233

234
        /**
235
         * Checks if the given script is enqueued.
236
         *
237
         * @param string $script The script to check.
238
         *
239
         * @return bool True when the script is enqueued.
240
         */
241
        public function is_script_enqueued( $script ) {
×
242
                return wp_script_is( $this->prefix . $script );
×
243
        }
244

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

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

351
                $scripts = array_merge(
×
352
                        $plugin_scripts,
×
353
                        $external_scripts,
×
354
                        $language_scripts,
×
355
                        $renamed_scripts
×
356
                );
357

358
                $scripts['installation-success'] = [
×
359
                        'name'    => 'installation-success',
×
360
                        'src'     => 'installation-success.js',
×
361
                        'deps'    => [
362
                                'wp-a11y',
363
                                'wp-dom-ready',
364
                                'wp-components',
365
                                'wp-element',
366
                                'wp-i18n',
367
                                self::PREFIX . 'components-new-package',
368
                                self::PREFIX . 'externals-components',
369
                        ],
370
                        'version' => $scripts['installation-success']['version'],
×
371
                ];
372

373
                $scripts['post-edit-classic'] = [
×
374
                        'name'      => 'post-edit-classic',
×
375
                        'src'       => $scripts['post-edit']['src'],
×
376
                        'deps'      => array_map(
×
377
                                static function ( $dep ) {
378
                                        if ( $dep === self::PREFIX . 'block-editor' ) {
×
379
                                                return self::PREFIX . 'classic-editor';
380
                                        }
381
                                        return $dep;
×
382
                                },
×
383
                                $scripts['post-edit']['deps']
UNCOV
384
                        ),
×
385
                        'in_footer' => ! in_array( 'post-edit-classic', $header_scripts, true ),
×
386
                        'version'   => $scripts['post-edit']['version'],
387
                ];
388

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

413
                // Add the current language to every script that requires the analysis package.
414
                foreach ( $scripts as $name => $script ) {
×
415
                        if ( substr( $name, -8 ) === 'language' ) {
×
416
                                continue;
417
                        }
418
                        if ( in_array( self::PREFIX . 'analysis-package', $script['deps'], true ) ) {
×
419
                                $scripts[ $name ]['deps'][] = self::PREFIX . YoastSEO()->helpers->language->get_researcher_language() . '-language';
420
                        }
421
                }
422

423
                return $scripts;
424
        }
425

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

466
                        $deps = $data['dependencies'];
×
467
                        if ( isset( $args['additional_deps'][ $name ] ) ) {
×
468
                                $deps = array_merge( $deps, $args['additional_deps'][ $name ] );
469
                        }
470

471
                        $scripts[ $name ] = [
×
472
                                'name'      => $name,
×
473
                                'src'       => $args['base_dir'] . $file,
×
474
                                'deps'      => $deps,
×
475
                                'in_footer' => ! in_array( $name, $args['header_scripts'], true ),
×
476
                                'version'   => $data['version'],
477
                        ];
478
                }
479

480
                return $scripts;
481
        }
482

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

519
                foreach ( $renamed_scripts as $original => $replacement ) {
×
520
                        $scripts[] = [
×
521
                                'name' => $original,
UNCOV
522
                                'src'  => false,
×
523
                                'deps' => [ self::PREFIX . $replacement ],
524
                        ];
525
                }
526

527
                return $scripts;
528
        }
529

530
        /**
531
         * Returns the styles that need to be registered.
532
         *
533
         * @todo Data format is not self-documenting. Needs explanation inline. R.
534
         *
535
         * @return array Styles that need to be registered.
536
         */
537
        protected function styles_to_be_registered() {
538
                $flat_version = $this->flatten_version( WPSEO_VERSION );
539

540
                return [
541
                        [
542
                                'name' => 'admin-css',
543
                                'src'  => 'yst_plugin_tools-' . $flat_version,
544
                                'deps' => [ self::PREFIX . 'toggle-switch' ],
545
                        ],
546
                        [
547
                                'name' => 'toggle-switch',
548
                                'src'  => 'toggle-switch-' . $flat_version,
549
                        ],
550
                        [
551
                                'name' => 'dismissible',
552
                                'src'  => 'wpseo-dismissible-' . $flat_version,
553
                        ],
554
                        [
555
                                'name' => 'notifications',
556
                                'src'  => 'notifications-' . $flat_version,
557
                        ],
558
                        [
559
                                'name' => 'alert',
560
                                'src'  => 'alerts-' . $flat_version,
561
                        ],
562
                        [
563
                                'name' => 'edit-page',
564
                                'src'  => 'edit-page-' . $flat_version,
565
                        ],
566
                        [
567
                                'name' => 'featured-image',
568
                                'src'  => 'featured-image-' . $flat_version,
569
                        ],
570
                        [
571
                                'name' => 'metabox-css',
572
                                'src'  => 'metabox-' . $flat_version,
573
                                'deps' => [
574
                                        self::PREFIX . 'admin-css',
575
                                        self::PREFIX . 'tailwind',
576
                                        'wp-components',
577
                                ],
578
                        ],
579
                        [
580
                                'name' => 'ai-generator',
581
                                'src'  => 'ai-generator-' . $flat_version,
582
                                'deps' => [
583
                                        self::PREFIX . 'tailwind',
584
                                        self::PREFIX . 'introductions',
585
                                ],
586
                        ],
587
                        [
588
                                'name' => 'ai-fix-assessments',
589
                                'src'  => 'ai-fix-assessments-' . $flat_version,
590
                        ],
591
                        [
592
                                'name' => 'introductions',
593
                                'src'  => 'introductions-' . $flat_version,
594
                                'deps' => [ self::PREFIX . 'tailwind' ],
595
                        ],
596
                        [
597
                                'name' => 'wp-dashboard',
598
                                'src'  => 'dashboard-' . $flat_version,
599
                        ],
600
                        [
601
                                'name' => 'scoring',
602
                                'src'  => 'yst_seo_score-' . $flat_version,
603
                        ],
604
                        [
605
                                'name' => 'adminbar',
606
                                'src'  => 'adminbar-' . $flat_version,
607
                                'deps' => [
608
                                        'admin-bar',
609
                                ],
610
                        ],
611
                        [
612
                                'name' => 'primary-category',
613
                                'src'  => 'metabox-primary-category-' . $flat_version,
614
                        ],
615
                        [
616
                                'name' => 'admin-global',
617
                                'src'  => 'admin-global-' . $flat_version,
618
                        ],
619
                        [
620
                                'name' => 'extensions',
621
                                'src'  => 'yoast-extensions-' . $flat_version,
622
                                'deps' => [
623
                                        'wp-components',
624
                                ],
625
                        ],
626
                        [
627
                                'name' => 'filter-explanation',
628
                                'src'  => 'filter-explanation-' . $flat_version,
629
                        ],
630
                        [
631
                                'name' => 'monorepo',
632
                                'src'  => 'monorepo-' . $flat_version,
633
                        ],
634
                        [
635
                                'name' => 'structured-data-blocks',
636
                                'src'  => 'structured-data-blocks-' . $flat_version,
637
                                'deps' => [
638
                                        'dashicons',
639
                                        'forms',
640
                                        'wp-edit-blocks',
641
                                ],
642
                        ],
643
                        [
644
                                'name' => 'elementor',
645
                                'src'  => 'elementor-' . $flat_version,
646
                        ],
647
                        [
648
                                'name' => 'tailwind',
649
                                'src'  => 'tailwind-' . $flat_version,
650
                        ],
651
                        [
652
                                'name' => 'new-settings',
653
                                'src'  => 'new-settings-' . $flat_version,
654
                                'deps' => [ self::PREFIX . 'tailwind' ],
655
                        ],
656
                        [
657
                                'name' => 'black-friday-banner',
658
                                'src'  => 'black-friday-banner-' . $flat_version,
659
                                'deps' => [ self::PREFIX . 'tailwind' ],
660
                        ],
661
                        [
662
                                'name' => 'academy',
663
                                'src'  => 'academy-' . $flat_version,
664
                                'deps' => [ self::PREFIX . 'tailwind' ],
665
                        ],
666
                        [
667
                                'name' => 'new-dashboard',
668
                                'src'  => 'new-dashboard-' . $flat_version,
669
                                'deps' => [ self::PREFIX . 'tailwind' ],
670
                        ],
671
                        [
672
                                'name' => 'support',
673
                                'src'  => 'support-' . $flat_version,
674
                                'deps' => [ self::PREFIX . 'tailwind' ],
675
                        ],
676
                        [
677
                                'name' => 'workouts',
678
                                'src'  => 'workouts-' . $flat_version,
679
                                'deps' => [
680
                                        self::PREFIX . 'monorepo',
681
                                ],
682
                        ],
683
                        [
684
                                'name' => 'first-time-configuration',
685
                                'src'  => 'first-time-configuration-' . $flat_version,
686
                                'deps' => [ self::PREFIX . 'tailwind' ],
687
                        ],
688
                        [
689
                                'name' => 'inside-editor',
690
                                'src'  => 'inside-editor-' . $flat_version,
691
                        ],
692
                ];
693
        }
694

695
        /**
696
         * Determines the URL of the asset.
697
         *
698
         * @param WPSEO_Admin_Asset $asset The asset to determine the URL for.
699
         * @param string            $type  The type of asset. Usually JS or CSS.
700
         *
701
         * @return string The URL of the asset.
702
         */
703
        protected function get_url( WPSEO_Admin_Asset $asset, $type ) {
×
704
                $scheme = wp_parse_url( $asset->get_src(), PHP_URL_SCHEME );
×
705
                if ( in_array( $scheme, [ 'http', 'https' ], true ) ) {
×
706
                        return $asset->get_src();
707
                }
708

709
                return $this->asset_location->get_url( $asset, $type );
710
        }
711
}
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