cation 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 );
}
/**
* 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() {
$select2_language = 'en';
$user_locale = WPSEO_Language_Utils::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;
}
$flat_version = $this->flatten_version( WPSEO_VERSION );
return [
[
'name' => 'commons',
// Load webpack-commons for bundle support.
'src' => 'commons-' . $flat_version,
'in_footer' => false,
'deps' => [
'lodash',
'wp-polyfill',
],
],
[
'name' => 'search-appearance',
'src' => 'search-appearance-' . $flat_version,
'deps' => [
'wp-api',
self::PREFIX . 'components',
self::PREFIX . 'commons',
],
],
[
'name' => 'yoast-modal',
'src' => 'wp-seo-modal-' . $flat_version,
'deps' => [
'jquery',
'wp-element',
'wp-i18n',
self::PREFIX . 'components',
self::PREFIX . 'commons',
],
],
[
'name' => 'admin-script',
'src' => 'wp-seo-admin-' . $flat_version,
'deps' => [
'lodash',
'jquery',
'jquery-ui-core',
'jquery-ui-progressbar',
self::PREFIX . 'select2',
self::PREFIX . 'select2-translations',
self::PREFIX . 'commons',
],
],
[
'name' => 'admin-media',
'src' => 'wp-seo-admin-media-' . $flat_version,
'deps' => [
'jquery',
'jquery-ui-core',
self::PREFIX . 'commons',
],
],
[
'name' => 'network-admin-script',
'src' => 'wp-seo-network-admin-' . $flat_version,
'deps' => [
'jquery',
self::PREFIX . 'commons',
],
],
[
'name' => 'bulk-editor',
'src' => 'wp-seo-bulk-editor-' . $flat_version,
'deps' => [
'jquery',
self::PREFIX . 'commons',
],
],
[
'name' => 'admin-global-script',
'src' => 'wp-seo-admin-global-' . $flat_version,
'deps' => [
'jquery',
self::PREFIX . 'commons',
],
],
[
'name' => 'metabox',
'src' => 'wp-seo-metabox-' . $flat_version,
'deps' => [
'jquery',
'wp-element',
'wp-i18n',
'wp-data',
'wp-components',
self::PREFIX . 'select2',
self::PREFIX . 'select2-translations',
self::PREFIX . 'commons',
],
'in_footer' => false,
],
[
'name' => 'featured-image',
'src' => 'wp-seo-featured-image-' . $flat_version,
'deps' => [
'jquery',
self::PREFIX . 'commons',
],
],
[
'name' => 'admin-gsc',
'src' => 'wp-seo-admin-gsc-' . $flat_version,
'deps' => [
'wp-element',
'wp-i18n',
self::PREFIX . 'styled-components',
self::PREFIX . 'components',
self::PREFIX . 'commons',
],
'in_footer' => false,
],
[
'name' => 'post-scraper',
'src' => 'wp-seo-post-scraper-' . $flat_version,
'deps' => [
'wp-util',
'wp-api',
'wp-sanitize',
'wp-element',
'wp-i18n',
'wp-data',
'wp-api-fetch',
'wp-annotations',
'wp-compose',
'wp-is-shallow-equal',
self::PREFIX . 'redux',
self::PREFIX . 'replacevar-plugin',
self::PREFIX . 'shortcode-plugin',
self::PREFIX . 'analysis',
self::PREFIX . 'components',
self::PREFIX . 'commons',
],
],
[
'name' => 'term-scraper',
'src' => 'wp-seo-term-scraper-' . $flat_version,
'deps' => [
'wp-sanitize',
'wp-element',
'wp-i18n',
'wp-data',
'wp-api-fetch',
'wp-compose',
'wp-is-shallow-equal',
self::PREFIX . 'redux',
self::PREFIX . 'replacevar-plugin',
self::PREFIX . 'analysis',
self::PREFIX . 'components',
self::PREFIX . 'commons',
],
],
[
'name' => 'replacevar-plugin',
'src' => 'wp-seo-replacevar-plugin-' . $flat_version,
'deps' => [
self::PREFIX . 'analysis',
self::PREFIX . 'components',
self::PREFIX . 'commons',
],
],
[
'name' => 'shortcode-plugin',
'src' => 'wp-seo-shortcode-plugin-' . $flat_version,
'deps' => [
self::PREFIX . 'analysis',
self::PREFIX . 'commons',
],
],
[
'name' => 'recalculate',
'src' => 'wp-seo-recalculate-' . $flat_version,
'deps' => [
'jquery',
'jquery-ui-core',
'jquery-ui-progressbar',
self::PREFIX . 'jed',
self::PREFIX . 'analysis',
self::PREFIX . 'commons',
],
],
[
'name' => 'primary-category',
'src' => 'wp-seo-metabox-category-' . $flat_version,
'deps' => [
'jquery',
'wp-url',
'wp-util',
'wp-element',
'wp-i18n',
'wp-components',
'wp-data',
'wp-url',
self::PREFIX . 'analysis',
self::PREFIX . 'components',
self::PREFIX . 'commons',
],
],
[
'name' => 'select2',
'src' => 'select2/select2.full',
'suffix' => '.min',
'deps' => [
'jquery',
],
'version' => '4.0.3',
],
[
'name' => 'select2-translations',
'src' => 'select2/i18n/' . $select2_language,
'deps' => [
'jquery',
self::PREFIX . 'select2',
],
'version' => '4.0.3',
'suffix' => '',
],
[
'name' => 'configuration-wizard',
'src' => 'configuration-wizard-' . $flat_version,
'deps' => [
'jquery',
'wp-element',
'wp-i18n',
'wp-api',
self::PREFIX . 'components',
self::PREFIX . 'commons',
],
],
[
'name' => 'reindex-links',
'src' => 'wp-seo-reindex-links-' . $flat_version,
'deps' => [
'jquery',
'jquery-ui-core',
'jquery-ui-progressbar',
self::PREFIX . 'commons',
],
],
[
'name' => 'edit-page-script',
'src' => 'wp-seo-edit-page-' . $flat_version,
'deps' => [
'jquery',
self::PREFIX . 'commons',
],
],
[
'name' => 'quick-edit-handler',
'src' => 'wp-seo-quick-edit-handler-' . $flat_version,
'deps' => [
'jquery',
self::PREFIX . 'commons',
],
'in_footer' => true,
],
[
'name' => 'api',
'src' => 'wp-seo-api-' . $flat_version,
'deps' => [
'wp-api',
'jquery',
self::PREFIX . 'commons',
],
],
[
'name' => 'dashboard-widget',
'src' => 'wp-seo-dashboard-widget-' . $flat_version,
'deps' => [
self::PREFIX . 'api',
'jquery',
'wp-element',
'wp-i18n',
self::PREFIX . 'components',
self::PREFIX . 'commons',
],
],
[
'name' => 'filter-explanation',
'src' => 'wp-seo-filter-explanation-' . $flat_version,
'deps' => [
'jquery',
self::PREFIX . 'commons',
],
],
[
'name' => 'analysis',
'src' => 'analysis-' . $flat_version,
'deps' => [
'lodash',
self::PREFIX . 'commons',
],
],
[
'name' => 'components',
'src' => 'components-' . $flat_version,
'deps' => [
self::PREFIX . 'jed',
self::PREFIX . 'redux',
self::PREFIX . 'analysis',
self::PREFIX . 'styled-components',
self::PREFIX . 'commons',
],
],
[
'name' => 'structured-data-blocks',
'src' => 'wp-seo-structured-data-blocks-' . $flat_version,
'deps' => [
'wp-blocks',
'wp-i18n',
'wp-element',
'wp-is-shallow-equal',
self::PREFIX . 'styled-components',
self::PREFIX . 'commons',
],
],
[
'name' => 'styled-components',
'src' => 'styled-components-' . $flat_version,
'deps' => [
'wp-element',
],
],
[
'name' => 'redux',
'src' => 'redux-' . $flat_version,
],
[
'name' => 'jed',
'src' => 'jed-' . $flat_version,
],
[
'name' => 'help-scout-beacon',
'src' => 'help-scout-beacon-' . $flat_version,
'in_footer' => false,
'deps' => [
self::PREFIX . 'styled-components',
'wp-element',
'wp-i18n',
],
],
];
}
/**
* 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' => 'alerts',
'src' => 'alerts-' . $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',
],
],
[
'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,
],
[
'name' => 'filter-explanation',
'src' => 'filter-explanation-' . $flat_version,
],
[
'name' => 'search-appearance',
'src' => 'search-appearance-' . $flat_version,
],
[
'name' => 'structured-data-blocks',
'src' => 'structured-data-blocks-' . $flat_version,
'deps' => [ 'wp-edit-blocks' ],
],
];
}
/**
* 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 );
}
/* ********************* DEPRECATED METHODS ********************* */
/**
* This function is needed for backwards compatibility with Local SEO 12.5.
*
* @deprecated 12.8
* @codeCoverageIgnore
*
* @return void
*/
public function register_wp_assets() {
}
}
Fatal error: Uncaught Error: Class "WPSEO_Admin_Asset_Manager" not found in /htdocs/wp-content/plugins/wordpress-seo-premium/inc/class-wpseo-admin-bar-menu.php:64
Stack trace:
#0 /htdocs/wp-content/plugins/wordpress-seo-premium/inc/wpseo-non-ajax-functions.php(20): WPSEO_Admin_Bar_Menu->__construct()
#1 /htdocs/wp-includes/class-wp-hook.php(324): wpseo_initialize_admin_bar('')
#2 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#3 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#4 /htdocs/wp-settings.php(726): do_action('wp_loaded')
#5 /htdocs/wp-config.php(90): require_once('/htdocs/wp-sett...')
#6 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...')
#7 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...')
#8 /htdocs/index.php(17): require('/htdocs/wp-blog...')
#9 {main}
thrown in /htdocs/wp-content/plugins/wordpress-seo-premium/inc/class-wpseo-admin-bar-menu.php on line 64