WPSEO_Metabox_Formatter::get_defaults()privateYoast 1.0

Returns array with all the values always needed by a scraper object.

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

Хуки из метода

Возвращает

Массив<Строку,Строку|Массив<Строку|int|true|false>|true|false|int>. Default settings for the metabox.

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

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

Код WPSEO_Metabox_Formatter::get_defaults() Yoast 22.4

private function get_defaults() {
	$schema_types      = new Schema_Types();
	$is_wincher_active = YoastSEO()->helpers->wincher->is_active();
	$host              = YoastSEO()->helpers->url->get_url_host( get_site_url() );

	$defaults = [
		'author_name'                        => get_the_author_meta( 'display_name' ),
		'site_name'                          => YoastSEO()->meta->for_current_page()->site_name,
		'sitewide_social_image'              => WPSEO_Options::get( 'og_default_image' ),
		'search_url'                         => '',
		'post_edit_url'                      => '',
		'base_url'                           => '',
		'contentTab'                         => __( 'Readability', 'wordpress-seo' ),
		'keywordTab'                         => __( 'Keyphrase:', 'wordpress-seo' ),
		'removeKeyword'                      => __( 'Remove keyphrase', 'wordpress-seo' ),
		'contentLocale'                      => get_locale(),
		'userLocale'                         => get_user_locale(),
		'translations'                       => $this->get_translations(),
		'keyword_usage'                      => [],
		'title_template'                     => '',
		'metadesc_template'                  => '',
		'semrushIntegrationActive'           => WPSEO_Options::get( 'semrush_integration_active', true ) ? 1 : 0,
		'intl'                               => $this->get_content_analysis_component_translations(),
		'isRtl'                              => is_rtl(),
		'isPremium'                          => YoastSEO()->helpers->product->is_premium(),
		'siteIconUrl'                        => get_site_icon_url(),
		'countryCode'                        => WPSEO_Options::get( 'semrush_country_code', false ),
		'SEMrushLoginStatus'                 => WPSEO_Options::get( 'semrush_integration_active', true ) ? $this->get_semrush_login_status() : false,
		'showSocial'                         => [
			'facebook' => WPSEO_Options::get( 'opengraph', false ),
			'twitter'  => WPSEO_Options::get( 'twitter', false ),
		],
		'schema'                             => [
			'displayFooter'      => WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' ),
			'pageTypeOptions'    => $schema_types->get_page_type_options(),
			'articleTypeOptions' => $schema_types->get_article_type_options(),
		],
		'twitterCardType'                    => 'summary_large_image',
		'publish_box'                        => [
			'labels' => [
				'keyword'            => [
					'na'   => sprintf(
						/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the SEO score. */
						__( '%1$sSEO%2$s: %3$s', 'wordpress-seo' ),
						'<a href="#yoast-seo-analysis-collapsible-metabox">',
						'</a>',
						'<strong>' . __( 'Not available', 'wordpress-seo' ) . '</strong>'
					),
					'bad'  => sprintf(
						/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the SEO score. */
						__( '%1$sSEO%2$s: %3$s', 'wordpress-seo' ),
						'<a href="#yoast-seo-analysis-collapsible-metabox">',
						'</a>',
						'<strong>' . __( 'Needs improvement', 'wordpress-seo' ) . '</strong>'
					),
					'ok'   => sprintf(
						/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the SEO score. */
						__( '%1$sSEO%2$s: %3$s', 'wordpress-seo' ),
						'<a href="#yoast-seo-analysis-collapsible-metabox">',
						'</a>',
						'<strong>' . __( 'OK', 'wordpress-seo' ) . '</strong>'
					),
					'good' => sprintf(
						/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the SEO score. */
						__( '%1$sSEO%2$s: %3$s', 'wordpress-seo' ),
						'<a href="#yoast-seo-analysis-collapsible-metabox">',
						'</a>',
						'<strong>' . __( 'Good', 'wordpress-seo' ) . '</strong>'
					),
				],
				'content'            => [
					'na'   => sprintf(
					/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the readability score. */
						__( '%1$sReadability%2$s: %3$s', 'wordpress-seo' ),
						'<a href="#yoast-readability-analysis-collapsible-metabox">',
						'</a>',
						'<strong>' . __( 'Not available', 'wordpress-seo' ) . '</strong>'
					),
					'bad'  => sprintf(
					/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the readability score. */
						__( '%1$sReadability%2$s: %3$s', 'wordpress-seo' ),
						'<a href="#yoast-readability-analysis-collapsible-metabox">',
						'</a>',
						'<strong>' . __( 'Needs improvement', 'wordpress-seo' ) . '</strong>'
					),
					'ok'   => sprintf(
					/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the readability score. */
						__( '%1$sReadability%2$s: %3$s', 'wordpress-seo' ),
						'<a href="#yoast-readability-analysis-collapsible-metabox">',
						'</a>',
						'<strong>' . __( 'OK', 'wordpress-seo' ) . '</strong>'
					),
					'good' => sprintf(
					/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the readability score. */
						__( '%1$sReadability%2$s: %3$s', 'wordpress-seo' ),
						'<a href="#yoast-readability-analysis-collapsible-metabox">',
						'</a>',
						'<strong>' . __( 'Good', 'wordpress-seo' ) . '</strong>'
					),
				],
				'inclusive-language' => [
					'na'   => sprintf(
					/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the inclusive language score. */
						__( '%1$sInclusive language%2$s: %3$s', 'wordpress-seo' ),
						'<a href="#yoast-inclusive-language-analysis-collapsible-metabox">',
						'</a>',
						'<strong>' . __( 'Not available', 'wordpress-seo' ) . '</strong>'
					),
					'bad'  => sprintf(
					/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the inclusive language score. */
						__( '%1$sInclusive language%2$s: %3$s', 'wordpress-seo' ),
						'<a href="#yoast-inclusive-language-analysis-collapsible-metabox">',
						'</a>',
						'<strong>' . __( 'Needs improvement', 'wordpress-seo' ) . '</strong>'
					),
					'ok'   => sprintf(
					/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the inclusive language score. */
						__( '%1$sInclusive language%2$s: %3$s', 'wordpress-seo' ),
						'<a href="#yoast-inclusive-language-analysis-collapsible-metabox">',
						'</a>',
						'<strong>' . __( 'Potentially non-inclusive', 'wordpress-seo' ) . '</strong>'
					),
					'good' => sprintf(
					/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the inclusive language score. */
						__( '%1$sInclusive language%2$s: %3$s', 'wordpress-seo' ),
						'<a href="#yoast-inclusive-language-analysis-collapsible-metabox">',
						'</a>',
						'<strong>' . __( 'Good', 'wordpress-seo' ) . '</strong>'
					),
				],
			],
		],
		/**
		 * Filter to determine if the markers should be enabled or not.
		 *
		 * @param bool $showMarkers Should the markers being enabled. Default = true.
		 */
		'show_markers'                       => apply_filters( 'wpseo_enable_assessment_markers', true ),
		'markdownEnabled'                    => $this->is_markdown_enabled(),
		'analysisHeadingTitle'               => __( 'Analysis', 'wordpress-seo' ),
		'zapierIntegrationActive'            => WPSEO_Options::get( 'zapier_integration_active', false ) ? 1 : 0,
		'zapierConnectedStatus'              => ! empty( WPSEO_Options::get( 'zapier_subscription', [] ) ) ? 1 : 0,
		'wincherIntegrationActive'           => ( $is_wincher_active ) ? 1 : 0,
		'wincherLoginStatus'                 => ( $is_wincher_active ) ? YoastSEO()->helpers->wincher->login_status() : false,
		'wincherWebsiteId'                   => WPSEO_Options::get( 'wincher_website_id', '' ),
		'wincherAutoAddKeyphrases'           => WPSEO_Options::get( 'wincher_automatically_add_keyphrases', false ),
		'wordproofIntegrationActive'         => YoastSEO()->helpers->wordproof->is_active() ? 1 : 0,
		'multilingualPluginActive'           => $this->multilingual_plugin_active(),
		'getJetpackBoostPrePublishLink'      => WPSEO_Shortlinker::get( 'https://yoa.st/jetpack-boost-get-prepublish?domain=' . $host ),
		'upgradeJetpackBoostPrePublishLink'  => WPSEO_Shortlinker::get( 'https://yoa.st/jetpack-boost-upgrade-prepublish?domain=' . $host ),
		'woocommerceUpsellSchemaLink'        => WPSEO_Shortlinker::get( 'https://yoa.st/product-schema-metabox' ),
		'woocommerceUpsellGooglePreviewLink' => WPSEO_Shortlinker::get( 'https://yoa.st/product-google-preview-metabox' ),
	];

	$enabled_features_repo = YoastSEO()->classes->get( Enabled_Analysis_Features_Repository::class );

	$enabled_features = $enabled_features_repo->get_enabled_features()->parse_to_legacy_array();

	return array_merge( $defaults, $enabled_features );
}