PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / admin / class-admin-asset-manager.php

class-admin-asset-manager.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI trunk, at admin/class-admin-asset-manager.php

767 lines 21.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 $asset_location ??= self::create_default_location();
45
46 $this->asset_location = $asset_location;
47 $this->prefix = $prefix;
48 }
49
50 /**
51 * Enqueues scripts.
52 *
53 * @param string $script The name of the script to enqueue.
54 *
55 * @return void
56 */
57 public function enqueue_script( $script ) {
58 wp_enqueue_script( $this->prefix . $script );
59 }
60
61 /**
62 * Enqueues styles.
63 *
64 * @param string $style The name of the style to enqueue.
65 *
66 * @return void
67 */
68 public function enqueue_style( $style ) {
69 wp_enqueue_style( $this->prefix . $style );
70 }
71
72 /**
73 * Enqueues the appropriate language for the user.
74 *
75 * @return void
76 */
77 public function enqueue_user_language_script() {
78 $this->enqueue_script( 'language-' . YoastSEO()->helpers->language->get_researcher_language() );
79 }
80
81 /**
82 * Registers scripts based on it's parameters.
83 *
84 * @param WPSEO_Admin_Asset $script The script to register.
85 *
86 * @return void
87 */
88 public function register_script( WPSEO_Admin_Asset $script ) {
89 $url = $script->get_src() ? $this->get_url( $script, WPSEO_Admin_Asset::TYPE_JS ) : false;
90 $args = [
91 'in_footer' => $script->is_in_footer(),
92 ];
93
94 if ( $script->get_strategy() !== '' ) {
95 $args['strategy'] = $script->get_strategy();
96 }
97
98 wp_register_script(
99 $this->prefix . $script->get_name(),
100 $url,
101 $script->get_deps(),
102 $script->get_version(),
103 $args,
104 );
105
106 if ( in_array( 'wp-i18n', $script->get_deps(), true ) ) {
107 wp_set_script_translations( $this->prefix . $script->get_name(), 'wordpress-seo' );
108 }
109 }
110
111 /**
112 * Registers styles based on it's parameters.
113 *
114 * @param WPSEO_Admin_Asset $style The style to register.
115 *
116 * @return void
117 */
118 public function register_style( WPSEO_Admin_Asset $style ) {
119 wp_register_style(
120 $this->prefix . $style->get_name(),
121 $this->get_url( $style, WPSEO_Admin_Asset::TYPE_CSS ),
122 $style->get_deps(),
123 $style->get_version(),
124 $style->get_media(),
125 );
126 }
127
128 /**
129 * Calls the functions that register scripts and styles with the scripts and styles to be registered as arguments.
130 *
131 * @return void
132 */
133 public function register_assets() {
134 $this->register_scripts( $this->scripts_to_be_registered() );
135 $this->register_styles( $this->styles_to_be_registered() );
136 }
137
138 /**
139 * Registers all the scripts passed to it.
140 *
141 * @param array $scripts The scripts passed to it.
142 *
143 * @return void
144 */
145 public function register_scripts( $scripts ) {
146 foreach ( $scripts as $script ) {
147 $script = new WPSEO_Admin_Asset( $script );
148 $this->register_script( $script );
149 }
150 }
151
152 /**
153 * Registers all the styles it receives.
154 *
155 * @param array $styles Styles that need to be registered.
156 *
157 * @return void
158 */
159 public function register_styles( $styles ) {
160 foreach ( $styles as $style ) {
161 $style = new WPSEO_Admin_Asset( $style );
162 $this->register_style( $style );
163 }
164 }
165
166 /**
167 * Localizes the script.
168 *
169 * @param string $handle The script handle.
170 * @param string $object_name The object name.
171 * @param array $data The l10n data.
172 *
173 * @return void
174 */
175 public function localize_script( $handle, $object_name, $data ) {
176 wp_localize_script( $this->prefix . $handle, $object_name, $data );
177 }
178
179 /**
180 * Adds an inline script.
181 *
182 * @param string $handle The script handle.
183 * @param string $data The l10n data.
184 * @param string $position Optional. Whether to add the inline script before the handle or after.
185 *
186 * @return void
187 */
188 public function add_inline_script( $handle, $data, $position = 'after' ) {
189 wp_add_inline_script( $this->prefix . $handle, $data, $position );
190 }
191
192 /**
193 * A list of styles that shouldn't be registered but are needed in other locations in the plugin.
194 *
195 * @return array
196 */
197 public function special_styles() {
198 $flat_version = $this->flatten_version( WPSEO_VERSION );
199 $asset_args = [
200 'name' => 'inside-editor',
201 'src' => 'inside-editor-' . $flat_version,
202 ];
203
204 return [ 'inside-editor' => new WPSEO_Admin_Asset( $asset_args ) ];
205 }
206
207 /**
208 * Flattens a version number for use in a filename.
209 *
210 * @param string $version The original version number.
211 *
212 * @return string The flattened version number.
213 */
214 public function flatten_version( $version ) {
215 $parts = explode( '.', $version );
216
217 if ( count( $parts ) === 2 && preg_match( '/^\d+$/', $parts[1] ) === 1 ) {
218 $parts[] = '0';
219 }
220
221 return implode( '', $parts );
222 }
223
224 /**
225 * Creates a default location object for use in the admin asset manager.
226 *
227 * @return WPSEO_Admin_Asset_Location The location to use in the asset manager.
228 */
229 public static function create_default_location() {
230 if ( defined( 'YOAST_SEO_DEV_SERVER' ) && YOAST_SEO_DEV_SERVER ) {
231 $url = defined( 'YOAST_SEO_DEV_SERVER_URL' ) ? YOAST_SEO_DEV_SERVER_URL : WPSEO_Admin_Asset_Dev_Server_Location::DEFAULT_URL;
232
233 return new WPSEO_Admin_Asset_Dev_Server_Location( $url );
234 }
235
236 return new WPSEO_Admin_Asset_SEO_Location( WPSEO_FILE, false );
237 }
238
239 /**
240 * Checks if the given script is enqueued.
241 *
242 * @param string $script The script to check.
243 *
244 * @return bool True when the script is enqueued.
245 */
246 public function is_script_enqueued( $script ) {
247 return wp_script_is( $this->prefix . $script );
248 }
249
250 /**
251 * Gets the list of Elementor dependencies.
252 *
253 * @return array<string> The array of elementor dependencies.
254 */
255 protected function get_elementor_dependencies() {
256 $dependencies = [
257 'backbone-marionette',
258 'elementor-common-modules',
259 self::PREFIX . 'api-client',
260 self::PREFIX . 'externals-components',
261 self::PREFIX . 'externals-contexts',
262 self::PREFIX . 'externals-redux',
263 ];
264 // Conditionally add Elementor v2 dependency if available.
265 if ( wp_script_is( 'elementor-v2-editor-app-bar', 'registered' ) ) {
266 $dependencies[] = 'elementor-v2-editor-app-bar';
267 }
268 return $dependencies;
269 }
270
271 /**
272 * Returns the scripts that need to be registered.
273 *
274 * @todo Data format is not self-documenting. Needs explanation inline. R.
275 *
276 * @return array The scripts that need to be registered.
277 */
278 protected function scripts_to_be_registered() {
279 $header_scripts = [
280 'admin-global',
281 'block-editor',
282 'classic-editor',
283 'post-edit',
284 'help-scout-beacon',
285 'redirect-old-features-tab',
286 ];
287 $elementor_dependencies = $this->get_elementor_dependencies();
288 $additional_dependencies = [
289 'analysis-worker' => [ self::PREFIX . 'analysis-package' ],
290 'api-client' => [ 'wp-api' ],
291 'crawl-settings' => [ 'jquery' ],
292 'dashboard-widget' => [ self::PREFIX . 'api-client' ],
293 'wincher-dashboard-widget' => [ self::PREFIX . 'api-client' ],
294 'editor-modules' => [ 'jquery' ],
295 'elementor' => $elementor_dependencies,
296 'elementor-v4' => array_merge( [ self::PREFIX . 'elementor' ], $elementor_dependencies ),
297 'indexation' => [
298 'jquery-ui-core',
299 'jquery-ui-progressbar',
300 ],
301 'first-time-configuration' => [
302 self::PREFIX . 'api-client',
303 self::PREFIX . 'externals-components',
304 self::PREFIX . 'externals-contexts',
305 self::PREFIX . 'externals-redux',
306 ],
307 'integrations-page' => [
308 self::PREFIX . 'api-client',
309 self::PREFIX . 'externals-components',
310 self::PREFIX . 'externals-contexts',
311 self::PREFIX . 'externals-redux',
312 ],
313 'post-edit' => [
314 self::PREFIX . 'api-client',
315 self::PREFIX . 'block-editor',
316 self::PREFIX . 'externals-components',
317 self::PREFIX . 'externals-contexts',
318 self::PREFIX . 'externals-redux',
319 ],
320 'reindex-links' => [
321 'jquery-ui-core',
322 'jquery-ui-progressbar',
323 ],
324 'settings' => [
325 'jquery-ui-core',
326 'jquery-ui-progressbar',
327 self::PREFIX . 'api-client',
328 self::PREFIX . 'externals-components',
329 self::PREFIX . 'externals-contexts',
330 self::PREFIX . 'externals-redux',
331 ],
332 'term-edit' => [
333 self::PREFIX . 'api-client',
334 self::PREFIX . 'classic-editor',
335 self::PREFIX . 'externals-components',
336 self::PREFIX . 'externals-contexts',
337 self::PREFIX . 'externals-redux',
338 ],
339 'general-page' => [
340 self::PREFIX . 'api-client',
341 ],
342 ];
343
344 $plugin_scripts = $this->load_generated_asset_file(
345 [
346 'asset_file' => __DIR__ . '/../src/generated/assets/plugin.php',
347 'ext_length' => 3,
348 'additional_deps' => $additional_dependencies,
349 'header_scripts' => $header_scripts,
350 ],
351 );
352 $external_scripts = $this->load_generated_asset_file(
353 [
354 'asset_file' => __DIR__ . '/../src/generated/assets/externals.php',
355 'ext_length' => 3,
356 'suffix' => '-package',
357 'base_dir' => 'externals/',
358 'additional_deps' => $additional_dependencies,
359 'header_scripts' => $header_scripts,
360 ],
361 );
362 $language_scripts = $this->load_generated_asset_file(
363 [
364 'asset_file' => __DIR__ . '/../src/generated/assets/languages.php',
365 'ext_length' => 3,
366 'suffix' => '-language',
367 'base_dir' => 'languages/',
368 'additional_deps' => $additional_dependencies,
369 'header_scripts' => $header_scripts,
370 ],
371 );
372 $renamed_scripts = $this->load_renamed_scripts();
373
374 $scripts = array_merge(
375 $plugin_scripts,
376 $external_scripts,
377 $language_scripts,
378 $renamed_scripts,
379 );
380
381 $scripts['installation-success'] = [
382 'name' => 'installation-success',
383 'src' => 'installation-success.js',
384 'deps' => [
385 'wp-a11y',
386 'wp-dom-ready',
387 'wp-components',
388 'wp-element',
389 'wp-i18n',
390 self::PREFIX . 'components-new-package',
391 self::PREFIX . 'externals-components',
392 ],
393 'version' => $scripts['installation-success']['version'],
394 ];
395
396 $scripts['post-edit-classic'] = [
397 'name' => 'post-edit-classic',
398 'src' => $scripts['post-edit']['src'],
399 'deps' => array_map(
400 static function ( $dep ) {
401 if ( $dep === self::PREFIX . 'block-editor' ) {
402 return self::PREFIX . 'classic-editor';
403 }
404 return $dep;
405 },
406 $scripts['post-edit']['deps'],
407 ),
408 'in_footer' => ! in_array( 'post-edit-classic', $header_scripts, true ),
409 'version' => $scripts['post-edit']['version'],
410 ];
411
412 $scripts['workouts'] = [
413 'name' => 'workouts',
414 'src' => 'workouts.js',
415 'deps' => [
416 'clipboard',
417 'lodash',
418 'wp-api-fetch',
419 'wp-a11y',
420 'wp-components',
421 'wp-compose',
422 'wp-data',
423 'wp-dom-ready',
424 'wp-element',
425 'wp-i18n',
426 self::PREFIX . 'externals-components',
427 self::PREFIX . 'externals-contexts',
428 self::PREFIX . 'externals-redux',
429 self::PREFIX . 'analysis',
430 self::PREFIX . 'components-new-package',
431 ],
432 'version' => $scripts['workouts']['version'],
433 ];
434
435 // Add the current language to every script that requires the analysis package.
436 foreach ( $scripts as $name => $script ) {
437 if ( substr( $name, -8 ) === 'language' ) {
438 continue;
439 }
440 if ( in_array( self::PREFIX . 'analysis-package', $script['deps'], true ) ) {
441 $scripts[ $name ]['deps'][] = self::PREFIX . YoastSEO()->helpers->language->get_researcher_language() . '-language';
442 }
443 }
444
445 return $scripts;
446 }
447
448 /**
449 * Loads a generated asset file.
450 *
451 * @param array $args {
452 * The arguments.
453 *
454 * @type string $asset_file The asset file to load.
455 * @type int $ext_length The length of the extension, including suffix, of the filename.
456 * @type string $suffix Optional. The suffix of the asset name.
457 * @type array<string, string[]> $additional_deps Optional. The additional dependencies assets may have.
458 * @type string $base_dir Optional. The base directory of the asset.
459 * @type string[] $header_scripts Optional. The script names that should be in the header.
460 * }
461 *
462 * @return array {
463 * The scripts to be registered.
464 *
465 * @type string $name The name of the asset.
466 * @type string $src The src of the asset.
467 * @type string[] $deps The dependenies of the asset.
468 * @type bool $in_footer Whether or not the asset should be in the footer.
469 * }
470 */
471 protected function load_generated_asset_file( $args ) {
472 $args = wp_parse_args(
473 $args,
474 [
475 'suffix' => '',
476 'additional_deps' => [],
477 'base_dir' => '',
478 'header_scripts' => [],
479 ],
480 );
481 $scripts = [];
482 $assets = require $args['asset_file'];
483 foreach ( $assets as $file => $data ) {
484 $name = substr( $file, 0, -$args['ext_length'] );
485 $name = strtolower( preg_replace( '/([A-Z])/', '-$1', $name ) );
486 $name .= $args['suffix'];
487
488 $deps = $data['dependencies'];
489 if ( isset( $args['additional_deps'][ $name ] ) ) {
490 $deps = array_merge( $deps, $args['additional_deps'][ $name ] );
491 }
492
493 $scripts[ $name ] = [
494 'name' => $name,
495 'src' => $args['base_dir'] . $file,
496 'deps' => $deps,
497 'in_footer' => ! in_array( $name, $args['header_scripts'], true ),
498 'version' => $data['version'],
499 ];
500 }
501
502 return $scripts;
503 }
504
505 /**
506 * Loads the scripts that should be renamed for BC.
507 *
508 * @return array {
509 * The scripts to be registered.
510 *
511 * @type string $name The name of the asset.
512 * @type string $src The src of the asset.
513 * @type string[] $deps The dependenies of the asset.
514 * @type bool $in_footer Whether or not the asset should be in the footer.
515 * }
516 */
517 protected function load_renamed_scripts() {
518 $scripts = [];
519 $renamed_scripts = [
520 'admin-global-script' => 'admin-global',
521 'analysis' => 'analysis-package',
522 'analysis-report' => 'analysis-report-package',
523 'api' => 'api-client',
524 'commons' => 'commons-package',
525 'edit-page' => 'edit-page-script',
526 'draft-js' => 'draft-js-package',
527 'feature-flag' => 'feature-flag-package',
528 'helpers' => 'helpers-package',
529 'jed' => 'jed-package',
530 'chart.js' => 'chart.js-package',
531 'network-admin-script' => 'network-admin',
532 'redux' => 'redux-package',
533 'replacement-variable-editor' => 'replacement-variable-editor-package',
534 'search-metadata-previews' => 'search-metadata-previews-package',
535 'social-metadata-forms' => 'social-metadata-forms-package',
536 'styled-components' => 'styled-components-package',
537 'style-guide' => 'style-guide-package',
538 'yoast-components' => 'components-new-package',
539 ];
540
541 foreach ( $renamed_scripts as $original => $replacement ) {
542 $scripts[] = [
543 'name' => $original,
544 'src' => false,
545 'deps' => [ self::PREFIX . $replacement ],
546 ];
547 }
548
549 return $scripts;
550 }
551
552 /**
553 * Returns the styles that need to be registered.
554 *
555 * @todo Data format is not self-documenting. Needs explanation inline. R.
556 *
557 * @return array Styles that need to be registered.
558 */
559 protected function styles_to_be_registered() {
560 $flat_version = $this->flatten_version( WPSEO_VERSION );
561
562 return [
563 [
564 'name' => 'admin-css',
565 'src' => 'yst_plugin_tools-' . $flat_version,
566 'deps' => [ self::PREFIX . 'toggle-switch' ],
567 ],
568 [
569 'name' => 'toggle-switch',
570 'src' => 'toggle-switch-' . $flat_version,
571 ],
572 [
573 'name' => 'dismissible',
574 'src' => 'wpseo-dismissible-' . $flat_version,
575 ],
576 [
577 'name' => 'notifications',
578 'src' => 'notifications-' . $flat_version,
579 ],
580 [
581 'name' => 'alert',
582 'src' => 'alerts-' . $flat_version,
583 ],
584 [
585 'name' => 'edit-page',
586 'src' => 'edit-page-' . $flat_version,
587 ],
588 [
589 'name' => 'featured-image',
590 'src' => 'featured-image-' . $flat_version,
591 ],
592 [
593 'name' => 'metabox-css',
594 'src' => 'metabox-' . $flat_version,
595 'deps' => [
596 self::PREFIX . 'admin-css',
597 self::PREFIX . 'tailwind',
598 'wp-components',
599 ],
600 ],
601 [
602 'name' => 'block-editor',
603 'src' => 'block-editor-' . $flat_version,
604 ],
605 [
606 'name' => 'ai-generator',
607 'src' => 'ai-generator-' . $flat_version,
608 'deps' => [
609 self::PREFIX . 'ai-frontend',
610 self::PREFIX . 'tailwind',
611 self::PREFIX . 'introductions',
612 ],
613 ],
614 [
615 'name' => 'ai-fix-assessments',
616 'src' => 'ai-fix-assessments-' . $flat_version,
617 ],
618 [
619 'name' => 'ai-frontend',
620 'src' => 'ai-frontend-' . $flat_version,
621 ],
622 [
623 'name' => 'introductions',
624 'src' => 'introductions-' . $flat_version,
625 'deps' => [ self::PREFIX . 'tailwind' ],
626 ],
627 [
628 'name' => 'wp-dashboard',
629 'src' => 'dashboard-' . $flat_version,
630 ],
631 [
632 'name' => 'scoring',
633 'src' => 'yst_seo_score-' . $flat_version,
634 ],
635 [
636 'name' => 'adminbar',
637 'src' => 'adminbar-' . $flat_version,
638 'deps' => [
639 'admin-bar',
640 ],
641 ],
642 [
643 'name' => 'primary-category',
644 'src' => 'metabox-primary-category-' . $flat_version,
645 ],
646 [
647 'name' => 'admin-global',
648 'src' => 'admin-global-' . $flat_version,
649 'deps' => [ self::PREFIX . 'tailwind' ],
650 ],
651 [
652 'name' => 'filter-explanation',
653 'src' => 'filter-explanation-' . $flat_version,
654 ],
655 [
656 'name' => 'monorepo',
657 'src' => 'monorepo-' . $flat_version,
658 ],
659 [
660 'name' => 'structured-data-blocks',
661 'src' => 'structured-data-blocks-' . $flat_version,
662 'deps' => [
663 'dashicons',
664 'forms',
665 'wp-edit-blocks',
666 ],
667 ],
668 [
669 'name' => 'elementor',
670 'src' => 'elementor-' . $flat_version,
671 ],
672 [
673 'name' => 'tailwind',
674 'src' => 'tailwind-' . $flat_version,
675 // Note: The RTL suffix is not added here.
676 // Tailwind and our UI library provide styling that should be standalone compatible with RTL.
677 // To make it easier we should use the logical properties and values when possible.
678 // If there are exceptions, we can use the Tailwind modifier, e.g. `rtl:yst-space-x-reverse`.
679 'rtl' => false,
680 ],
681 [
682 'name' => 'new-settings',
683 'src' => 'new-settings-' . $flat_version,
684 'deps' => [ self::PREFIX . 'tailwind' ],
685 ],
686 [
687 'name' => 'redirects',
688 'src' => 'redirects-' . $flat_version,
689 'deps' => [ self::PREFIX . 'tailwind' ],
690 ],
691 [
692 'name' => 'black-friday-banner',
693 'src' => 'black-friday-banner-' . $flat_version,
694 'deps' => [ self::PREFIX . 'tailwind' ],
695 ],
696 [
697 'name' => 'academy',
698 'src' => 'academy-' . $flat_version,
699 'deps' => [ self::PREFIX . 'tailwind' ],
700 ],
701 [
702 'name' => 'bulk-editor-page',
703 'src' => 'bulk-editor-page-' . $flat_version,
704 'deps' => [ self::PREFIX . 'tailwind' ],
705 ],
706 [
707 'name' => 'general-page',
708 'src' => 'general-page-' . $flat_version,
709 'deps' => [ self::PREFIX . 'tailwind' ],
710 ],
711 [
712 'name' => 'integrations-page',
713 'src' => 'integrations-page-' . $flat_version,
714 'deps' => [ self::PREFIX . 'tailwind' ],
715 ],
716 [
717 'name' => 'installation-success',
718 'src' => 'installation-success-' . $flat_version,
719 'deps' => [ self::PREFIX . 'tailwind' ],
720 ],
721 [
722 'name' => 'support',
723 'src' => 'support-' . $flat_version,
724 'deps' => [ self::PREFIX . 'tailwind' ],
725 ],
726 [
727 'name' => 'workouts',
728 'src' => 'workouts-' . $flat_version,
729 'deps' => [
730 self::PREFIX . 'monorepo',
731 ],
732 ],
733 [
734 'name' => 'first-time-configuration',
735 'src' => 'first-time-configuration-' . $flat_version,
736 'deps' => [ self::PREFIX . 'tailwind' ],
737 ],
738 [
739 'name' => 'inside-editor',
740 'src' => 'inside-editor-' . $flat_version,
741 ],
742 [
743 'name' => 'plans',
744 'src' => 'plans-' . $flat_version,
745 'deps' => [ self::PREFIX . 'tailwind' ],
746 ],
747 ];
748 }
749
750 /**
751 * Determines the URL of the asset.
752 *
753 * @param WPSEO_Admin_Asset $asset The asset to determine the URL for.
754 * @param string $type The type of asset. Usually JS or CSS.
755 *
756 * @return string The URL of the asset.
757 */
758 protected function get_url( WPSEO_Admin_Asset $asset, $type ) {
759 $scheme = wp_parse_url( $asset->get_src(), PHP_URL_SCHEME );
760 if ( in_array( $scheme, [ 'http', 'https' ], true ) ) {
761 return $asset->get_src();
762 }
763
764 return $this->asset_location->get_url( $asset, $type );
765 }
766 }
767