WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WPSEO_Admin_Asset_Manager::scripts_to_be_registered() protected Yoast 1.0

Returns the scripts that need to be registered.

Ищем WP-разработчика! Фулл-тайм, удаленка, хорошая зарплата, соц. пакет. Подробности.
Компания Boosta.

{} Это метод класса: WPSEO_Admin_Asset_Manager{}

Хуков нет.

Возвращает

Массив. The scripts that need to be registered.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->scripts_to_be_registered();

Код WPSEO_Admin_Asset_Manager::scripts_to_be_registered() Yoast 17.6

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(
			static 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;
}