Submit
Path:
~
/
home
/
bfxleof
/
www
/
wp-content
/
plugins
/
wordpress-seo
/
admin
/
File Content:
class-admin-asset-manager.php
<?php /** * WPSEO plugin file. * * @package WPSEO\Admin */ /** * This class registers all the necessary styles and scripts. * * Also has methods for the enqueing of scripts and styles. * It automatically adds a prefix to the handle. */ class WPSEO_Admin_Asset_Manager { /** * Prefix for naming the assets. * * @var string */ const PREFIX = 'yoast-seo-'; /** * Class that manages the assets' location. * * @var WPSEO_Admin_Asset_Location */ protected $asset_location; /** * Prefix for naming the assets. * * @var string */ private $prefix; /** * Constructs a manager of assets. Needs a location to know where to register assets at. * * @param WPSEO_Admin_Asset_Location|null $asset_location The provider of the asset location. * @param string $prefix The prefix for naming assets. */ public function __construct( WPSEO_Admin_Asset_Location $asset_location = null, $prefix = self::PREFIX ) { if ( $asset_location === null ) { $asset_location = self::create_default_location(); } $this->asset_location = $asset_location; $this->prefix = $prefix; } /** * Enqueues scripts. * * @param string $script The name of the script to enqueue. */ public function enqueue_script( $script ) { wp_enqueue_script( $this->prefix . $script ); } /** * Enqueues styles. * * @param string $style The name of the style to enqueue. */ public function enqueue_style( $style ) { wp_enqueue_style( $this->prefix . $style ); } /** * Enqueues the appropriate language for the user. */ public function enqueue_user_language_script() { $this->enqueue_script( 'language-' . YoastSEO()->helpers->language->get_researcher_language() ); } /** * Registers scripts based on it's parameters. * * @param WPSEO_Admin_Asset $script The script to register. */ public function register_script( WPSEO_Admin_Asset $script ) { $url = $script->get_src() ? $this->get_url( $script, WPSEO_Admin_Asset::TYPE_JS ) : false; wp_register_script( $this->prefix . $script->get_name(), $url, $script->get_deps(), $script->get_version(), $script->is_in_footer() ); } /** * Registers styles based on it's parameters. * * @param WPSEO_Admin_Asset $style The style to register. */ public function register_style( WPSEO_Admin_Asset $style ) { wp_register_style( $this->prefix . $style->get_name(), $this->get_url( $style, WPSEO_Admin_Asset::TYPE_CSS ), $style->get_deps(), $style->get_version(), $style->get_media() ); } /** * Calls the functions that register scripts and styles with the scripts and styles to be registered as arguments. */ public function register_assets() { $this->register_scripts( $this->scripts_to_be_registered() ); $this->register_styles( $this->styles_to_be_registered() ); } /** * Registers all the scripts passed to it. * * @param array $scripts The scripts passed to it. */ public function register_scripts( $scripts ) { foreach ( $scripts as $script ) { $script = new WPSEO_Admin_Asset( $script ); $this->register_script( $script ); } } /** * Registers all the styles it receives. * * @param array $styles Styles that need to be registered. */ public function register_styles( $styles ) { foreach ( $styles as $style ) { $style = new WPSEO_Admin_Asset( $style ); $this->register_style( $style ); } } /** * Localizes the script. * * @param string $handle The script handle. * @param string $object_name The object name. * @param array $data The l10n data. */ public function localize_script( $handle, $object_name, $data ) { \wp_localize_script( $this->prefix . $handle, $object_name, $data ); } /** * A list of styles that shouldn't be registered but are needed in other locations in the plugin. * * @return array */ public function special_styles() { $flat_version = $this->flatten_version( WPSEO_VERSION ); $asset_args = [ 'name' => 'inside-editor', 'src' => 'inside-editor-' . $flat_version, ]; return [ 'inside-editor' => new WPSEO_Admin_Asset( $asset_args ) ]; } /** * Flattens a version number for use in a filename. * * @param string $version The original version number. * * @return string The flattened version number. */ public function flatten_version( $version ) { $parts = explode( '.', $version ); if ( count( $parts ) === 2 && preg_match( '/^\d+$/', $parts[1] ) === 1 ) { $parts[] = '0'; } return implode( '', $parts ); } /** * Creates a default location object for use in the admin asset manager. * * @return WPSEO_Admin_Asset_Location The location to use in the asset manager. */ public static function create_default_location() { if ( defined( 'YOAST_SEO_DEV_SERVER' ) && YOAST_SEO_DEV_SERVER ) { $url = defined( 'YOAST_SEO_DEV_SERVER_URL' ) ? YOAST_SEO_DEV_SERVER_URL : WPSEO_Admin_Asset_Dev_Server_Location::DEFAULT_URL; return new WPSEO_Admin_Asset_Dev_Server_Location( $url ); } return new WPSEO_Admin_Asset_SEO_Location( WPSEO_FILE, false ); } /** * Checks if the given script is enqueued. * * @param string $script The script to check. * * @return bool True when the script is enqueued. */ public function is_script_enqueued( $script ) { return \wp_script_is( $this->prefix . $script ); } /** * Returns the scripts that need to be registered. * * @todo Data format is not self-documenting. Needs explanation inline. R. * * @return array The scripts that need to be registered. */ protected function scripts_to_be_registered() { $flat_version = $this->flatten_version( WPSEO_VERSION ); $ext_length = ( strlen( $flat_version ) + 4 ); $header_scripts = [ 'admin-global', 'block-editor', 'classic-editor', 'post-edit', 'help-scout-beacon', ]; $additional_dependencies = [ 'analysis-worker' => [ self::PREFIX . 'analysis-package' ], 'api-client' => [ 'wp-api' ], 'dashboard-widget' => [ self::PREFIX . 'api-client' ], 'elementor' => [ self::PREFIX . 'api-client' ], 'indexation' => [ 'jquery-ui-core', 'jquery-ui-progressbar', ], 'post-edit' => [ self::PREFIX . 'api-client', self::PREFIX . 'block-editor', self::PREFIX . 'select2', ], 'reindex-links' => [ 'jquery-ui-core', 'jquery-ui-progressbar', ], 'settings' => [ 'jquery-ui-core', 'jquery-ui-progressbar', self::PREFIX . 'api-client', self::PREFIX . 'select2', ], 'term-edit' => [ self::PREFIX . 'api-client', self::PREFIX . 'classic-editor', self::PREFIX . 'select2', ], ]; $plugin_scripts = $this->load_generated_asset_file( [ 'asset_file' => __DIR__ . '/../src/generated/assets/plugin.php', 'ext_length' => $ext_length, 'additional_deps' => $additional_dependencies, 'header_scripts' => $header_scripts, ] ); $external_scripts = $this->load_generated_asset_file( [ 'asset_file' => __DIR__ . '/../src/generated/assets/externals.php', 'ext_length' => $ext_length, 'suffix' => '-package', 'base_dir' => 'externals/', 'additional_deps' => $additional_dependencies, 'header_scripts' => $header_scripts, ] ); $language_scripts = $this->load_generated_asset_file( [ 'asset_file' => __DIR__ . '/../src/generated/assets/languages.php', 'ext_length' => $ext_length, 'suffix' => '-language', 'base_dir' => 'languages/', 'additional_deps' => $additional_dependencies, 'header_scripts' => $header_scripts, ] ); $select2_scripts = $this->load_select2_scripts(); $renamed_scripts = $this->load_renamed_scripts(); $scripts = array_merge( $plugin_scripts, $external_scripts, $language_scripts, $select2_scripts, $renamed_scripts ); $scripts['post-edit-classic'] = [ 'name' => 'post-edit-classic', 'src' => $scripts['post-edit']['src'], 'deps' => array_map( function( $dep ) { if ( $dep === self::PREFIX . 'block-editor' ) { return self::PREFIX . 'classic-editor'; } return $dep; }, $scripts['post-edit']['deps'] ), 'in_footer' => ! in_array( 'post-edit-classic', $header_scripts, true ), ]; // Add the current language to every script that requires the analysis package. foreach ( $scripts as $name => $script ) { if ( substr( $name, -8 ) === 'language' ) { continue; } if ( in_array( self::PREFIX . 'analysis-package', $script['deps'], true ) ) { $scripts[ $name ]['deps'][] = self::PREFIX . YoastSEO()->helpers->language->get_researcher_language() . '-language'; } } return $scripts; } /** * Loads a generated asset file. * * @param array $args { * The arguments. * * @type string $asset_file The asset file to load. * @type int $ext_length The length of the extension, including suffix, of the filename. * @type string $suffix Optional. The suffix of the asset name. * @type array<string, string[]> $additional_deps Optional. The additional dependencies assets may have. * @type string $base_dir Optional. The base directory of the asset. * @type string[] $header_scripts Optional. The script names that should be in the header. * } * * @return array { * The scripts to be registered. * * @type string $name The name of the asset. * @type string $src The src of the asset. * @type string[] $deps The dependenies of the asset. * @type bool $in_footer Whether or not the asset should be in the footer. * } */ protected function load_generated_asset_file( $args ) { $args = wp_parse_args( $args, [ 'suffix' => '', 'additional_deps' => [], 'base_dir' => '', 'header_scripts' => [], ] ); $scripts = []; $assets = require $args['asset_file']; foreach ( $assets as $file => $data ) { $name = substr( $file, 0, -$args['ext_length'] ); $name = strtolower( preg_replace( '/([A-Z])/', '-$1', $name ) ); $name = $name . $args['suffix']; $deps = $data['dependencies']; if ( isset( $args['additional_deps'][ $name ] ) ) { $deps = array_merge( $deps, $args['additional_deps'][ $name ] ); } $scripts[ $name ] = [ 'name' => $name, 'src' => $args['base_dir'] . $file, 'deps' => $deps, 'in_footer' => ! in_array( $name, $args['header_scripts'], true ), ]; } return $scripts; } /** * Loads the select2 scripts. * * @return array { * The scripts to be registered. * * @type string $name The name of the asset. * @type string $src The src of the asset. * @type string[] $deps The dependenies of the asset. * @type bool $in_footer Whether or not the asset should be in the footer. * } */ protected function load_select2_scripts() { $scripts = []; $select2_language = 'en'; $user_locale = \get_user_locale(); $language = WPSEO_Language_Utils::get_language( $user_locale ); if ( file_exists( WPSEO_PATH . "js/dist/select2/i18n/{$user_locale}.js" ) ) { $select2_language = $user_locale; // Chinese and some others use full locale. } elseif ( file_exists( WPSEO_PATH . "js/dist/select2/i18n/{$language}.js" ) ) { $select2_language = $language; } $scripts['select2'] = [ 'name' => 'select2', 'src' => false, 'deps' => [ self::PREFIX . 'select2-translations', self::PREFIX . 'select2-core', ], ]; $scripts['select2-core'] = [ 'name' => 'select2-core', 'src' => 'select2/select2.full.min.js', 'deps' => [ 'jquery', ], 'version' => '4.0.3', ]; $scripts['select2-translations'] = [ 'name' => 'select2-translations', 'src' => 'select2/i18n/' . $select2_language . '.js', 'deps' => [ 'jquery', self::PREFIX . 'select2-core', ], 'version' => '4.0.3', ]; return $scripts; } /** * Loads the scripts that should be renamed for BC. * * @return array { * The scripts to be registered. * * @type string $name The name of the asset. * @type string $src The src of the asset. * @type string[] $deps The dependenies of the asset. * @type bool $in_footer Whether or not the asset should be in the footer. * } */ protected function load_renamed_scripts() { $scripts = []; $renamed_scripts = [ 'admin-global-script' => 'admin-global', 'analysis' => 'analysis-package', 'analysis-report' => 'analysis-report-package', 'api' => 'api-client', 'commons' => 'commons-package', 'edit-page' => 'edit-page-script', 'draft-js' => 'draft-js-package', 'feature-flag' => 'feature-flag-package', 'helpers' => 'helpers-package', 'jed' => 'jed-package', 'legacy-components' => 'components-package', 'network-admin-script' => 'network-admin', 'redux' => 'redux-package', 'replacement-variable-editor' => 'replacement-variable-editor-package', 'search-metadata-previews' => 'search-metadata-previews-package', 'social-metadata-forms' => 'social-metadata-forms-package', 'styled-components' => 'styled-components-package', 'style-guide' => 'style-guide-package', 'yoast-components' => 'components-new-package', ]; foreach ( $renamed_scripts as $original => $replacement ) { $scripts[] = [ 'name' => $original, 'src' => false, 'deps' => [ self::PREFIX . $replacement ], ]; } return $scripts; } /** * Returns the styles that need to be registered. * * @todo Data format is not self-documenting. Needs explanation inline. R. * * @return array Styles that need to be registered. */ protected function styles_to_be_registered() { $flat_version = $this->flatten_version( WPSEO_VERSION ); return [ [ 'name' => 'admin-css', 'src' => 'yst_plugin_tools-' . $flat_version, 'deps' => [ self::PREFIX . 'toggle-switch' ], ], [ 'name' => 'toggle-switch', 'src' => 'toggle-switch-' . $flat_version, ], [ 'name' => 'dismissible', 'src' => 'wpseo-dismissible-' . $flat_version, ], [ 'name' => 'notifications', 'src' => 'notifications-' . $flat_version, ], [ 'name' => 'alert', 'src' => 'alerts-' . $flat_version, ], [ 'name' => 'badge', 'src' => 'badge-' . $flat_version, ], [ 'name' => 'edit-page', 'src' => 'edit-page-' . $flat_version, ], [ 'name' => 'featured-image', 'src' => 'featured-image-' . $flat_version, ], [ 'name' => 'metabox-css', 'src' => 'metabox-' . $flat_version, 'deps' => [ self::PREFIX . 'select2', self::PREFIX . 'admin-css', 'wp-components', ], ], [ 'name' => 'wp-dashboard', 'src' => 'dashboard-' . $flat_version, ], [ 'name' => 'scoring', 'src' => 'yst_seo_score-' . $flat_version, ], [ 'name' => 'adminbar', 'src' => 'adminbar-' . $flat_version, 'deps' => [ 'admin-bar', ], ], [ 'name' => 'primary-category', 'src' => 'metabox-primary-category-' . $flat_version, ], [ 'name' => 'select2', 'src' => 'select2/select2', 'suffix' => '.min', 'version' => '4.0.1', 'rtl' => false, ], [ 'name' => 'admin-global', 'src' => 'admin-global-' . $flat_version, ], [ 'name' => 'yoast-components', 'src' => 'yoast-components-' . $flat_version, ], [ 'name' => 'extensions', 'src' => 'yoast-extensions-' . $flat_version, 'deps' => [ 'wp-components', ], ], [ 'name' => 'filter-explanation', 'src' => 'filter-explanation-' . $flat_version, ], [ 'name' => 'search-appearance', 'src' => 'search-appearance-' . $flat_version, 'deps' => [ self::PREFIX . 'monorepo', ], ], [ 'name' => 'monorepo', 'src' => 'monorepo-' . $flat_version, ], [ 'name' => 'structured-data-blocks', 'src' => 'structured-data-blocks-' . $flat_version, 'deps' => [ 'wp-edit-blocks' ], ], [ 'name' => 'schema-blocks', 'src' => 'schema-blocks-' . $flat_version, ], [ 'name' => 'elementor', 'src' => 'elementor-' . $flat_version, ], ]; } /** * Determines the URL of the asset. * * @param WPSEO_Admin_Asset $asset The asset to determine the URL for. * @param string $type The type of asset. Usually JS or CSS. * * @return string The URL of the asset. */ protected function get_url( WPSEO_Admin_Asset $asset, $type ) { $scheme = wp_parse_url( $asset->get_src(), PHP_URL_SCHEME ); if ( in_array( $scheme, [ 'http', 'https' ], true ) ) { return $asset->get_src(); } return $this->asset_location->get_url( $asset, $type ); } }
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
ajax
---
0755
capabilities
---
0755
config-ui
---
0755
endpoints
---
0755
exceptions
---
0755
filters
---
0755
formatter
---
0755
google_search_console
---
0755
import
---
0755
listeners
---
0755
menu
---
0755
metabox
---
0755
notifiers
---
0755
pages
---
0755
roles
---
0755
ryte
---
0755
services
---
0755
statistics
---
0755
taxonomy
---
0755
tracking
---
0755
views
---
0755
watchers
---
0755
.DS_Store
10234 bytes
0644
20200616130143_ReplacePermalinkHashIndex-20260705090100.php
2293 bytes
0644
20200616130143_ReplacePermalinkHashIndex.php
2293 bytes
0644
AjaxController.php
2162 bytes
0644
DownloadConfController-20260706051531.php
945 bytes
0644
DownloadConfController.php
945 bytes
0644
JsonSerializable-20260705095652.php
577 bytes
0644
JsonSerializable-20260705181353.php
577 bytes
0644
JsonSerializable.php
577 bytes
0644
LimitStream.php
4209 bytes
0644
MessageInterface.php
6950 bytes
0644
README.md
2555 bytes
0644
admin-network-it_IT.l10n.php
42133 bytes
0644
admin-settings-changed-listener.php
2403 bytes
0644
ajax.php
9095 bytes
0644
base-20260707183508.php
2793 bytes
0644
base.php
2793 bytes
0644
bing-presenter.php
638 bytes
0644
class-abstract-capability-manager.php
2265 bytes
0644
class-abstract-plugin-importer.php
8466 bytes
0644
class-admin-asset-analysis-worker-location.php
1849 bytes
0644
class-admin-asset-location.php
488 bytes
0644
class-admin-asset-manager-20260623075208.php
17386 bytes
0644
class-admin-asset-manager.php
17386 bytes
0644
class-admin-asset-seo-location.php
2147 bytes
0644
class-admin-asset-yoast-components-l10n.php
1679 bytes
0644
class-admin-media-purge-notification.php
3300 bytes
0644
class-admin-menu-20260623023741.php
4046 bytes
0644
class-admin-utils-20260622095013.php
2147 bytes
0644
class-admin-utils.php
2147 bytes
0644
class-asset.php
4016 bytes
0644
class-bulk-description-editor-list-table.php
2100 bytes
0644
class-bulk-editor-list-table.php
28411 bytes
0644
class-bulk-title-editor-list-table.php
2286 bytes
0644
class-collector.php
984 bytes
0644
class-config-20260622104031.php
5976 bytes
0644
class-endpoint.php
471 bytes
0644
class-expose-shortlinks-20260622052420.php
4996 bytes
0644
class-expose-shortlinks.php
4996 bytes
0644
class-gutenberg-compatibility-20260622104351.php
2510 bytes
0644
class-helpscout-20260623075312.php
6972 bytes
0644
class-helpscout.php
6972 bytes
0644
class-import-detector.php
728 bytes
0644
class-meta-columns.php
22386 bytes
0644
class-metabox-formatter.php
12602 bytes
0644
class-metabox-null-tab-20260705060522.php
425 bytes
0644
class-metabox-null-tab.php
425 bytes
0644
class-my-yoast-proxy.php
5373 bytes
0644
class-option-tab-20260622044109.php
1784 bytes
0644
class-option-tabs-formatter-20260622034247.php
2321 bytes
0644
class-option-tabs-formatter.php
2321 bytes
0644
class-option-tabs.php
2097 bytes
0644
class-paper-presenter.php
3600 bytes
0644
class-plugin-availability-20260622071513.php
8440 bytes
0644
class-plugin-availability.php
8440 bytes
0644
class-plugin-conflict-20260622015355.php
8640 bytes
0644
class-premium-popup.php
2833 bytes
0644
class-premium-upsell-admin-block.php
3631 bytes
0644
class-product-upsell-notice.php
5216 bytes
0644
class-schema-person-upgrade-notification.php
2133 bytes
0644
class-sitemaps-admin-20260703023908.php
3665 bytes
0644
class-sitemaps-admin-20260705122758.php
3665 bytes
0644
class-sitemaps-admin.php
3665 bytes
0644
class-tracking-server-data.php
1989 bytes
0644
class-tracking-settings-data-20260623041512.php
5203 bytes
0644
class-tracking-settings-data.php
5203 bytes
0644
class-wpseo-statistics.php
1443 bytes
0644
class-yoast-columns.php
3281 bytes
0644
class-yoast-dashboard-widget.php
4033 bytes
0644
class-yoast-form-20260622052325.php
31520 bytes
0644
class-yoast-form.php
31520 bytes
0644
class-yoast-notification-20260622071615.php
9611 bytes
0644
class-yoast-notification-center.php
23601 bytes
0644
class-yoast-notification.php
9611 bytes
0644
class-yoast-notifications.php
8784 bytes
0644
class-yoast-plugin-conflict.php
10390 bytes
0644
class.archive.config.php
1364 bytes
0644
class.pack.database.php
30838 bytes
0644
ctrl.package.php
17073 bytes
0644
dashboard-1650-rtl.css
1634 bytes
0644
define.php
4567 bytes
0644
description-presenter-20260623011438.php
1026 bytes
0644
duplicator-20260623154449.php
1781 bytes
0644
duplicator-en_US.mo
582 bytes
0644
duplicator-main-20260623011502.php
26907 bytes
0644
duplicator.php
1781 bytes
0644
elFinderPlugin-20260705182242.php
3331 bytes
0644
elFinderPlugin.php
3331 bytes
0644
elFinderVolumeLocalFileSystem.class-20260623050500-20260705194237.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class-20260623050500-20260706065003.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class-20260623050500.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class.php
48544 bytes
0644
environment-helper.php
596 bytes
0644
exceptions.php
708 bytes
0644
flexible-widget.php
11167 bytes
0644
image-helper.php
10231 bytes
0644
image-presenter.php
2093 bytes
0644
inc.data.php
5121 bytes
0644
inc.validator-20260705162141.php
5401 bytes
0644
inc.validator.php
5401 bytes
0644
index.php
157663 bytes
0644
interface-sitemap-cache-data.php
1208 bytes
0644
loco-20260705162115-20260707054756.php
5626 bytes
0644
loco-20260705162115.php
5626 bytes
0644
loco.php
5626 bytes
0644
loco.xml
657 bytes
0644
manager.php
14659 bytes
0644
meta-fields-presenter.php
1600 bytes
0644
module-20260706041630-20260707074326.php
1297 bytes
0644
module-20260706041630.php
1297 bytes
0644
module.php
1297 bytes
0644
partial-notifications-errors-20260623074505.php
1139 bytes
0644
partial-notifications-errors.php
1139 bytes
0644
quick-edit-handler-1650-20260707001148.js
1848 bytes
0644
quick-edit-handler-1650.js
1848 bytes
0644
recovery.php
1146 bytes
0644
request-methods-header.php
1127 bytes
0644
root.php
1951 bytes
0644
setup.php
2699 bytes
0644
social.php
725 bytes
0644
uninstall.php
4401 bytes
0644
wordpress-seo-es_ES.json
25583 bytes
0644
wordpress-seojs-ar-20260705091659.json
25925 bytes
0644
wordpress-seojs-ar.json
25925 bytes
0644
wordpress-seojs-bs_BA.json
13790 bytes
0644
wordpress-seojs-gl_ES.json
20143 bytes
0644
wordpress-seojs-ja.json
21424 bytes
0644
wordpress-seojs-uk.json
26506 bytes
0644
wp-seo-main.php
17504 bytes
0644
N4ST4R_ID | Naxtarrr