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

Yoast / wordpress-seo / dd6e866a9e6d253114633104d9e3858d807178ba

19 Jun 2024 10:03AM UTC coverage: 48.628% (-4.3%) from 52.936%
dd6e866a9e6d253114633104d9e3858d807178ba

push

github

web-flow
Merge pull request #21431 from Yoast/21429-update-copy-in-the-introduction-and-consent-modals

Updates the copy for the introduction and consent modals

7441 of 13454 branches covered (55.31%)

Branch coverage included in aggregate %.

0 of 3 new or added lines in 2 files covered. (0.0%)

3718 existing lines in 107 files now uncovered.

25100 of 53464 relevant lines covered (46.95%)

62392.47 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
                ];
317

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

348
                $scripts = array_merge(
×
349
                        $plugin_scripts,
×
350
                        $external_scripts,
×
351
                        $language_scripts,
×
352
                        $renamed_scripts
×
353
                );
354

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

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

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

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

420
                return $scripts;
421
        }
422

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

463
                        $deps = $data['dependencies'];
×
464
                        if ( isset( $args['additional_deps'][ $name ] ) ) {
×
465
                                $deps = array_merge( $deps, $args['additional_deps'][ $name ] );
466
                        }
467

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

477
                return $scripts;
478
        }
479

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

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

524
                return $scripts;
525
        }
526

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

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

683
        /**
684
         * Determines the URL of the asset.
685
         *
686
         * @param WPSEO_Admin_Asset $asset The asset to determine the URL for.
687
         * @param string            $type  The type of asset. Usually JS or CSS.
688
         *
689
         * @return string The URL of the asset.
690
         */
691
        protected function get_url( WPSEO_Admin_Asset $asset, $type ) {
×
692
                $scheme = wp_parse_url( $asset->get_src(), PHP_URL_SCHEME );
×
693
                if ( in_array( $scheme, [ 'http', 'https' ], true ) ) {
×
694
                        return $asset->get_src();
695
                }
696

697
                return $this->asset_location->get_url( $asset, $type );
698
        }
699
}
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