Yoast\WP\SEO\Bulk_Editor\User_Interface

Bulk_Editor_Integration::get_script_data │ public │ Yoast 1.0

Creates the script data.

Метод класса: Bulk_Editor_Integration{}

Хуков нет.

Возвращает

array<string,. string|array<string, string|bool>|array<array<string, string>>> The script data.

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

$Bulk_Editor_Integration = new Bulk_Editor_Integration();
$Bulk_Editor_Integration->get_script_data();

Код Bulk_Editor_Integration::get_script_data() Yoast 28.9

public function get_script_data() {
	$content_types        = $this->content_types_repository->get_content_types();
	$is_premium           = $this->product_helper->is_premium();
	$is_version_supported = $this->is_premium_version_supported( $is_premium );
	$is_woo_seo_active    = ! $this->woo_seo_inactive_conditional->is_met();
	$is_woo_seo_supported = $this->is_woo_seo_version_supported( $is_woo_seo_active );
	$woo_seo_needs_update = $is_woo_seo_active && ! $is_woo_seo_supported;
	$can_update_plugins   = \current_user_can( 'update_plugins' );

	return [
		'contentTypes'          => $content_types,
		'endpoints'             => $this->endpoints_repository->get_all_endpoints()->to_array(),
		// These must stay server-generated URLs: the bulk editor assigns the dashboard and tools links to
		// window.location.href for its "Back to Tools" / logo navigation (the settings link is rendered as a plain
		// link). If a link ever derives from request input, validate it with wp_validate_redirect() here before
		// exposing it, to avoid an open redirect on the front-end.
		'links'                 => [
			'dashboard' => \admin_url( 'admin.php?page=' . General_Page_Integration::PAGE ),
			'tools'     => \admin_url( 'admin.php?page=wpseo_tools' ),
			'settings'  => \admin_url( 'admin.php?page=' . Settings_Integration::PAGE ),
		],
		'nonce'                 => $this->nonce_repository->get_rest_nonce(),
		'restRoot'              => \esc_url_raw( \rest_url() ),
		'preferences'           => [
			'isPremium'                 => $is_premium,
			'isPremiumVersionSupported' => $is_version_supported,
			'isAiEnabled'               => $this->options_helper->get( 'enable_ai_generator' ) === true,
			// Without Yoast WooCommerce SEO, the products "Image alt text" tab shows the upsell instead; with an
			// active version that predates the tab, it asks for an update.
			'isWooSeoActive'            => $is_woo_seo_active,
			'isWooSeoVersionSupported'  => $is_woo_seo_supported,
			'isRtl'                     => \is_rtl(),
			'pluginUrl'                 => \plugins_url( '', \WPSEO_FILE ),
			'premiumUpdateUrl'          => $this->get_premium_update_url( $can_update_plugins ),
			'wooSeoUpdateUrl'           => $this->get_woo_seo_update_url( $woo_seo_needs_update, $can_update_plugins ),
		],
		'linkParams'            => $this->short_link_helper->get_query_params(),
		'analysis'              => [
			'contentLocale'         => \get_locale(),
			// Re-scoring only runs when SEO analysis is enabled, matching the post editor: on for the site and not
			// turned off in the user's profile.
			'keywordAnalysisActive' => $this->keyphrase_analysis->is_enabled(),
			// Used when collecting the AI prompt content, so shortcode delimiters are stripped from the
			// text while the content they enclose is kept. Not gated on SEO analysis being enabled: the
			// prompt content is collected for AI suggestions, which do not depend on the analysis.
			'shortcodes'            => $this->get_valid_shortcode_tags(),
		],
		'optInNotificationSeen' => [
			'bulk_editor_tour' => $this->is_tour_opt_in_notification_seen(),
		],
		'initialSelection'      => $this->get_initial_selection( $content_types ),
		'myyoastConnection'     => $this->myyoast_connection_data_presenter->present(),
		'replacementVariables'  => $this->get_replacement_variables(),
	];
}