Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wordpres.../admin/formatte...
File: class-metabox-formatter.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WPSEO plugin file.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WPSEO\Admin\Formatter
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
use Yoast\WP\SEO\Config\Schema_Types;
[7] Fix | Delete
use Yoast\WP\SEO\Editors\Application\Analysis_Features\Enabled_Analysis_Features_Repository;
[8] Fix | Delete
use Yoast\WP\SEO\Editors\Application\Integrations\Integration_Information_Repository;
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* This class forces needed methods for the metabox localization.
[12] Fix | Delete
*/
[13] Fix | Delete
class WPSEO_Metabox_Formatter {
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* Object that provides formatted values.
[17] Fix | Delete
*
[18] Fix | Delete
* @var WPSEO_Metabox_Formatter_Interface
[19] Fix | Delete
*/
[20] Fix | Delete
private $formatter;
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Setting the formatter property.
[24] Fix | Delete
*
[25] Fix | Delete
* @param WPSEO_Metabox_Formatter_Interface $formatter Object that provides the formatted values.
[26] Fix | Delete
*/
[27] Fix | Delete
public function __construct( WPSEO_Metabox_Formatter_Interface $formatter ) {
[28] Fix | Delete
$this->formatter = $formatter;
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
/**
[32] Fix | Delete
* Returns the values.
[33] Fix | Delete
*
[34] Fix | Delete
* @return array<string,string|array<string|int|bool>|bool|int>
[35] Fix | Delete
*/
[36] Fix | Delete
public function get_values() {
[37] Fix | Delete
$defaults = $this->get_defaults();
[38] Fix | Delete
$values = $this->formatter->get_values();
[39] Fix | Delete
[40] Fix | Delete
return ( $values + $defaults );
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
/**
[44] Fix | Delete
* Returns array with all the values always needed by a scraper object.
[45] Fix | Delete
*
[46] Fix | Delete
* @return array<string,string|array<string|int|bool>|bool|int> Default settings for the metabox.
[47] Fix | Delete
*/
[48] Fix | Delete
private function get_defaults() {
[49] Fix | Delete
$schema_types = new Schema_Types();
[50] Fix | Delete
$host = YoastSEO()->helpers->url->get_url_host( get_site_url() );
[51] Fix | Delete
[52] Fix | Delete
$defaults = [
[53] Fix | Delete
'author_name' => get_the_author_meta( 'display_name' ),
[54] Fix | Delete
'site_name' => YoastSEO()->meta->for_current_page()->site_name,
[55] Fix | Delete
'sitewide_social_image' => WPSEO_Options::get( 'og_default_image' ),
[56] Fix | Delete
'search_url' => '',
[57] Fix | Delete
'post_edit_url' => '',
[58] Fix | Delete
'base_url' => '',
[59] Fix | Delete
'contentLocale' => get_locale(),
[60] Fix | Delete
'userLocale' => get_user_locale(),
[61] Fix | Delete
'translations' => $this->get_translations(),
[62] Fix | Delete
'keyword_usage' => [],
[63] Fix | Delete
'title_template' => '',
[64] Fix | Delete
'metadesc_template' => '',
[65] Fix | Delete
'isRtl' => is_rtl(),
[66] Fix | Delete
'isPremium' => YoastSEO()->helpers->product->is_premium(),
[67] Fix | Delete
'siteIconUrl' => get_site_icon_url(),
[68] Fix | Delete
'showSocial' => [
[69] Fix | Delete
'facebook' => WPSEO_Options::get( 'opengraph', false ),
[70] Fix | Delete
'twitter' => WPSEO_Options::get( 'twitter', false ),
[71] Fix | Delete
],
[72] Fix | Delete
'schema' => [
[73] Fix | Delete
'displayFooter' => WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' ),
[74] Fix | Delete
'pageTypeOptions' => $schema_types->get_page_type_options(),
[75] Fix | Delete
'articleTypeOptions' => $schema_types->get_article_type_options(),
[76] Fix | Delete
],
[77] Fix | Delete
'twitterCardType' => 'summary_large_image',
[78] Fix | Delete
'publish_box' => [
[79] Fix | Delete
'labels' => [
[80] Fix | Delete
'keyword' => [
[81] Fix | Delete
'na' => sprintf(
[82] Fix | Delete
/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the SEO score. */
[83] Fix | Delete
__( '%1$sSEO%2$s: %3$s', 'wordpress-seo' ),
[84] Fix | Delete
'<a href="#yoast-seo-analysis-collapsible-metabox">',
[85] Fix | Delete
'</a>',
[86] Fix | Delete
'<strong>' . __( 'Not available', 'wordpress-seo' ) . '</strong>'
[87] Fix | Delete
),
[88] Fix | Delete
'bad' => sprintf(
[89] Fix | Delete
/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the SEO score. */
[90] Fix | Delete
__( '%1$sSEO%2$s: %3$s', 'wordpress-seo' ),
[91] Fix | Delete
'<a href="#yoast-seo-analysis-collapsible-metabox">',
[92] Fix | Delete
'</a>',
[93] Fix | Delete
'<strong>' . __( 'Needs improvement', 'wordpress-seo' ) . '</strong>'
[94] Fix | Delete
),
[95] Fix | Delete
'ok' => sprintf(
[96] Fix | Delete
/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the SEO score. */
[97] Fix | Delete
__( '%1$sSEO%2$s: %3$s', 'wordpress-seo' ),
[98] Fix | Delete
'<a href="#yoast-seo-analysis-collapsible-metabox">',
[99] Fix | Delete
'</a>',
[100] Fix | Delete
'<strong>' . __( 'OK', 'wordpress-seo' ) . '</strong>'
[101] Fix | Delete
),
[102] Fix | Delete
'good' => sprintf(
[103] Fix | Delete
/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the SEO score. */
[104] Fix | Delete
__( '%1$sSEO%2$s: %3$s', 'wordpress-seo' ),
[105] Fix | Delete
'<a href="#yoast-seo-analysis-collapsible-metabox">',
[106] Fix | Delete
'</a>',
[107] Fix | Delete
'<strong>' . __( 'Good', 'wordpress-seo' ) . '</strong>'
[108] Fix | Delete
),
[109] Fix | Delete
],
[110] Fix | Delete
'content' => [
[111] Fix | Delete
'na' => sprintf(
[112] Fix | Delete
/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the readability score. */
[113] Fix | Delete
__( '%1$sReadability%2$s: %3$s', 'wordpress-seo' ),
[114] Fix | Delete
'<a href="#yoast-readability-analysis-collapsible-metabox">',
[115] Fix | Delete
'</a>',
[116] Fix | Delete
'<strong>' . __( 'Not available', 'wordpress-seo' ) . '</strong>'
[117] Fix | Delete
),
[118] Fix | Delete
'bad' => sprintf(
[119] Fix | Delete
/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the readability score. */
[120] Fix | Delete
__( '%1$sReadability%2$s: %3$s', 'wordpress-seo' ),
[121] Fix | Delete
'<a href="#yoast-readability-analysis-collapsible-metabox">',
[122] Fix | Delete
'</a>',
[123] Fix | Delete
'<strong>' . __( 'Needs improvement', 'wordpress-seo' ) . '</strong>'
[124] Fix | Delete
),
[125] Fix | Delete
'ok' => sprintf(
[126] Fix | Delete
/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the readability score. */
[127] Fix | Delete
__( '%1$sReadability%2$s: %3$s', 'wordpress-seo' ),
[128] Fix | Delete
'<a href="#yoast-readability-analysis-collapsible-metabox">',
[129] Fix | Delete
'</a>',
[130] Fix | Delete
'<strong>' . __( 'OK', 'wordpress-seo' ) . '</strong>'
[131] Fix | Delete
),
[132] Fix | Delete
'good' => sprintf(
[133] Fix | Delete
/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the readability score. */
[134] Fix | Delete
__( '%1$sReadability%2$s: %3$s', 'wordpress-seo' ),
[135] Fix | Delete
'<a href="#yoast-readability-analysis-collapsible-metabox">',
[136] Fix | Delete
'</a>',
[137] Fix | Delete
'<strong>' . __( 'Good', 'wordpress-seo' ) . '</strong>'
[138] Fix | Delete
),
[139] Fix | Delete
],
[140] Fix | Delete
'inclusive-language' => [
[141] Fix | Delete
'na' => sprintf(
[142] Fix | Delete
/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the inclusive language score. */
[143] Fix | Delete
__( '%1$sInclusive language%2$s: %3$s', 'wordpress-seo' ),
[144] Fix | Delete
'<a href="#yoast-inclusive-language-analysis-collapsible-metabox">',
[145] Fix | Delete
'</a>',
[146] Fix | Delete
'<strong>' . __( 'Not available', 'wordpress-seo' ) . '</strong>'
[147] Fix | Delete
),
[148] Fix | Delete
'bad' => sprintf(
[149] Fix | Delete
/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the inclusive language score. */
[150] Fix | Delete
__( '%1$sInclusive language%2$s: %3$s', 'wordpress-seo' ),
[151] Fix | Delete
'<a href="#yoast-inclusive-language-analysis-collapsible-metabox">',
[152] Fix | Delete
'</a>',
[153] Fix | Delete
'<strong>' . __( 'Needs improvement', 'wordpress-seo' ) . '</strong>'
[154] Fix | Delete
),
[155] Fix | Delete
'ok' => sprintf(
[156] Fix | Delete
/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the inclusive language score. */
[157] Fix | Delete
__( '%1$sInclusive language%2$s: %3$s', 'wordpress-seo' ),
[158] Fix | Delete
'<a href="#yoast-inclusive-language-analysis-collapsible-metabox">',
[159] Fix | Delete
'</a>',
[160] Fix | Delete
'<strong>' . __( 'Potentially non-inclusive', 'wordpress-seo' ) . '</strong>'
[161] Fix | Delete
),
[162] Fix | Delete
'good' => sprintf(
[163] Fix | Delete
/* translators: %1$s expands to the opening anchor tag, %2$s to the closing anchor tag, %3$s to the inclusive language score. */
[164] Fix | Delete
__( '%1$sInclusive language%2$s: %3$s', 'wordpress-seo' ),
[165] Fix | Delete
'<a href="#yoast-inclusive-language-analysis-collapsible-metabox">',
[166] Fix | Delete
'</a>',
[167] Fix | Delete
'<strong>' . __( 'Good', 'wordpress-seo' ) . '</strong>'
[168] Fix | Delete
),
[169] Fix | Delete
],
[170] Fix | Delete
],
[171] Fix | Delete
],
[172] Fix | Delete
/**
[173] Fix | Delete
* Filter to determine if the markers should be enabled or not.
[174] Fix | Delete
*
[175] Fix | Delete
* @param bool $showMarkers Should the markers being enabled. Default = true.
[176] Fix | Delete
*/
[177] Fix | Delete
'show_markers' => apply_filters( 'wpseo_enable_assessment_markers', true ),
[178] Fix | Delete
'zapierIntegrationActive' => WPSEO_Options::get( 'zapier_integration_active', false ) ? 1 : 0,
[179] Fix | Delete
'zapierConnectedStatus' => ! empty( WPSEO_Options::get( 'zapier_subscription', [] ) ) ? 1 : 0,
[180] Fix | Delete
'getJetpackBoostPrePublishLink' => WPSEO_Shortlinker::get( 'https://yoa.st/jetpack-boost-get-prepublish?domain=' . $host ),
[181] Fix | Delete
'upgradeJetpackBoostPrePublishLink' => WPSEO_Shortlinker::get( 'https://yoa.st/jetpack-boost-upgrade-prepublish?domain=' . $host ),
[182] Fix | Delete
'woocommerceUpsellSchemaLink' => WPSEO_Shortlinker::get( 'https://yoa.st/product-schema-metabox' ),
[183] Fix | Delete
'woocommerceUpsellGooglePreviewLink' => WPSEO_Shortlinker::get( 'https://yoa.st/product-google-preview-metabox' ),
[184] Fix | Delete
];
[185] Fix | Delete
[186] Fix | Delete
$integration_information_repo = YoastSEO()->classes->get( Integration_Information_Repository::class );
[187] Fix | Delete
[188] Fix | Delete
$enabled_integrations = $integration_information_repo->get_integration_information();
[189] Fix | Delete
$defaults = array_merge( $defaults, $enabled_integrations );
[190] Fix | Delete
$enabled_features_repo = YoastSEO()->classes->get( Enabled_Analysis_Features_Repository::class );
[191] Fix | Delete
[192] Fix | Delete
$enabled_features = $enabled_features_repo->get_enabled_features()->parse_to_legacy_array();
[193] Fix | Delete
return array_merge( $defaults, $enabled_features );
[194] Fix | Delete
}
[195] Fix | Delete
[196] Fix | Delete
/**
[197] Fix | Delete
* Returns Jed compatible YoastSEO.js translations.
[198] Fix | Delete
*
[199] Fix | Delete
* @return string[]
[200] Fix | Delete
*/
[201] Fix | Delete
private function get_translations() {
[202] Fix | Delete
$locale = get_user_locale();
[203] Fix | Delete
[204] Fix | Delete
$file = WPSEO_PATH . 'languages/wordpress-seo-' . $locale . '.json';
[205] Fix | Delete
if ( file_exists( $file ) ) {
[206] Fix | Delete
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Retrieving a local file.
[207] Fix | Delete
$file = file_get_contents( $file );
[208] Fix | Delete
if ( is_string( $file ) && $file !== '' ) {
[209] Fix | Delete
return json_decode( $file, true );
[210] Fix | Delete
}
[211] Fix | Delete
}
[212] Fix | Delete
[213] Fix | Delete
return [];
[214] Fix | Delete
}
[215] Fix | Delete
}
[216] Fix | Delete
[217] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function