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/views
File: class-yoast-feature-toggles.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WPSEO plugin file.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WPSEO\Admin
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
use Yoast\WP\SEO\Helpers\Language_Helper;
[7] Fix | Delete
use Yoast\WP\SEO\Presenters\Admin\Alert_Presenter;
[8] Fix | Delete
[9] Fix | Delete
/**
[10] Fix | Delete
* Class for managing feature toggles.
[11] Fix | Delete
*/
[12] Fix | Delete
class Yoast_Feature_Toggles {
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* Available feature toggles.
[16] Fix | Delete
*
[17] Fix | Delete
* @var array
[18] Fix | Delete
*/
[19] Fix | Delete
protected $toggles;
[20] Fix | Delete
[21] Fix | Delete
/**
[22] Fix | Delete
* Instance holder.
[23] Fix | Delete
*
[24] Fix | Delete
* @var self|null
[25] Fix | Delete
*/
[26] Fix | Delete
protected static $instance = null;
[27] Fix | Delete
[28] Fix | Delete
/**
[29] Fix | Delete
* Gets the main feature toggles manager instance used.
[30] Fix | Delete
*
[31] Fix | Delete
* This essentially works like a Singleton, but for its drawbacks does not restrict
[32] Fix | Delete
* instantiation otherwise.
[33] Fix | Delete
*
[34] Fix | Delete
* @return self Main instance.
[35] Fix | Delete
*/
[36] Fix | Delete
public static function instance() {
[37] Fix | Delete
if ( self::$instance === null ) {
[38] Fix | Delete
self::$instance = new self();
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
return self::$instance;
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
/**
[45] Fix | Delete
* Gets all available feature toggles.
[46] Fix | Delete
*
[47] Fix | Delete
* @return array List of sorted Yoast_Feature_Toggle instances.
[48] Fix | Delete
*/
[49] Fix | Delete
public function get_all() {
[50] Fix | Delete
if ( $this->toggles === null ) {
[51] Fix | Delete
$this->toggles = $this->load_toggles();
[52] Fix | Delete
}
[53] Fix | Delete
[54] Fix | Delete
return $this->toggles;
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
/**
[58] Fix | Delete
* Loads the available feature toggles.
[59] Fix | Delete
*
[60] Fix | Delete
* Also ensures that the toggles are all Yoast_Feature_Toggle instances and sorted by their order value.
[61] Fix | Delete
*
[62] Fix | Delete
* @return array List of sorted Yoast_Feature_Toggle instances.
[63] Fix | Delete
*/
[64] Fix | Delete
protected function load_toggles() {
[65] Fix | Delete
$xml_sitemap_extra = false;
[66] Fix | Delete
if ( WPSEO_Options::get( 'enable_xml_sitemap' ) ) {
[67] Fix | Delete
$xml_sitemap_extra = '<a href="' . esc_url( WPSEO_Sitemaps_Router::get_base_url( 'sitemap_index.xml' ) )
[68] Fix | Delete
. '" target="_blank">' . esc_html__( 'See the XML sitemap.', 'wordpress-seo' ) . '</a>';
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
$feature_toggles = [
[72] Fix | Delete
(object) [
[73] Fix | Delete
'name' => __( 'SEO analysis', 'wordpress-seo' ),
[74] Fix | Delete
'setting' => 'keyword_analysis_active',
[75] Fix | Delete
'label' => __( 'The SEO analysis offers suggestions to improve the SEO of your text.', 'wordpress-seo' ),
[76] Fix | Delete
'read_more_label' => __( 'Learn how the SEO analysis can help you rank.', 'wordpress-seo' ),
[77] Fix | Delete
'read_more_url' => 'https://yoa.st/2ak',
[78] Fix | Delete
'order' => 10,
[79] Fix | Delete
],
[80] Fix | Delete
(object) [
[81] Fix | Delete
'name' => __( 'Readability analysis', 'wordpress-seo' ),
[82] Fix | Delete
'setting' => 'content_analysis_active',
[83] Fix | Delete
'label' => __( 'The readability analysis offers suggestions to improve the structure and style of your text.', 'wordpress-seo' ),
[84] Fix | Delete
'read_more_label' => __( 'Discover why readability is important for SEO.', 'wordpress-seo' ),
[85] Fix | Delete
'read_more_url' => 'https://yoa.st/2ao',
[86] Fix | Delete
'order' => 20,
[87] Fix | Delete
],
[88] Fix | Delete
(object) [
[89] Fix | Delete
'name' => __( 'Inclusive language analysis', 'wordpress-seo' ),
[90] Fix | Delete
'supported_languages' => Language_Helper::$languages_with_inclusive_language_support,
[91] Fix | Delete
'setting' => 'inclusive_language_analysis_active',
[92] Fix | Delete
'label' => __( 'The inclusive language analysis offers suggestions to write more inclusive copy.', 'wordpress-seo' ),
[93] Fix | Delete
'read_more_label' => __( 'Discover why inclusive language is important for SEO.', 'wordpress-seo' ),
[94] Fix | Delete
'read_more_url' => 'https://yoa.st/inclusive-language-features-free',
[95] Fix | Delete
'order' => 25,
[96] Fix | Delete
],
[97] Fix | Delete
(object) [
[98] Fix | Delete
'name' => __( 'Cornerstone content', 'wordpress-seo' ),
[99] Fix | Delete
'setting' => 'enable_cornerstone_content',
[100] Fix | Delete
'label' => __( 'The cornerstone content feature lets you to mark and filter cornerstone content on your website.', 'wordpress-seo' ),
[101] Fix | Delete
'read_more_label' => __( 'Find out how cornerstone content can help you improve your site structure.', 'wordpress-seo' ),
[102] Fix | Delete
'read_more_url' => 'https://yoa.st/dashboard-help-cornerstone',
[103] Fix | Delete
'order' => 30,
[104] Fix | Delete
],
[105] Fix | Delete
(object) [
[106] Fix | Delete
'name' => __( 'Text link counter', 'wordpress-seo' ),
[107] Fix | Delete
'setting' => 'enable_text_link_counter',
[108] Fix | Delete
'label' => __( 'The text link counter helps you improve your site structure.', 'wordpress-seo' ),
[109] Fix | Delete
'read_more_label' => __( 'Find out how the text link counter can enhance your SEO.', 'wordpress-seo' ),
[110] Fix | Delete
'read_more_url' => 'https://yoa.st/2aj',
[111] Fix | Delete
'order' => 40,
[112] Fix | Delete
],
[113] Fix | Delete
(object) [
[114] Fix | Delete
'name' => __( 'Insights', 'wordpress-seo' ),
[115] Fix | Delete
'setting' => 'enable_metabox_insights',
[116] Fix | Delete
'label' => __( 'Find relevant data about your content right in the Insights section in the Yoast SEO metabox. You’ll see what words you use most often and if they’re a match with your keywords! ', 'wordpress-seo' ),
[117] Fix | Delete
'read_more_label' => __( 'Find out how Insights can help you improve your content.', 'wordpress-seo' ),
[118] Fix | Delete
'read_more_url' => 'https://yoa.st/4ew',
[119] Fix | Delete
'premium_url' => 'https://yoa.st/2ai',
[120] Fix | Delete
'order' => 41,
[121] Fix | Delete
],
[122] Fix | Delete
(object) [
[123] Fix | Delete
'name' => __( 'Link suggestions', 'wordpress-seo' ),
[124] Fix | Delete
'premium' => true,
[125] Fix | Delete
'setting' => 'enable_link_suggestions',
[126] Fix | Delete
'label' => __( 'Get relevant internal linking suggestions — while you’re writing! The link suggestions metabox shows a list of posts on your blog with similar content that might be interesting to link to. ', 'wordpress-seo' ),
[127] Fix | Delete
'read_more_label' => __( 'Read more about how internal linking can improve your site structure.', 'wordpress-seo' ),
[128] Fix | Delete
'read_more_url' => 'https://yoa.st/4ev',
[129] Fix | Delete
'premium_url' => 'https://yoa.st/17g',
[130] Fix | Delete
'premium_upsell_url' => 'https://yoa.st/get-link-suggestions',
[131] Fix | Delete
'order' => 42,
[132] Fix | Delete
],
[133] Fix | Delete
(object) [
[134] Fix | Delete
'name' => __( 'XML sitemaps', 'wordpress-seo' ),
[135] Fix | Delete
'setting' => 'enable_xml_sitemap',
[136] Fix | Delete
/* translators: %s: Yoast SEO */
[137] Fix | Delete
'label' => sprintf( __( 'Enable the XML sitemaps that %s generates.', 'wordpress-seo' ), 'Yoast SEO' ),
[138] Fix | Delete
'read_more_label' => __( 'Read why XML Sitemaps are important for your site.', 'wordpress-seo' ),
[139] Fix | Delete
'read_more_url' => 'https://yoa.st/2a-',
[140] Fix | Delete
'extra' => $xml_sitemap_extra,
[141] Fix | Delete
'after' => $this->sitemaps_toggle_after(),
[142] Fix | Delete
'order' => 60,
[143] Fix | Delete
],
[144] Fix | Delete
(object) [
[145] Fix | Delete
'name' => __( 'Admin bar menu', 'wordpress-seo' ),
[146] Fix | Delete
'setting' => 'enable_admin_bar_menu',
[147] Fix | Delete
/* translators: 1: Yoast SEO */
[148] Fix | Delete
'label' => sprintf( __( 'The %1$s admin bar menu contains useful links to third-party tools for analyzing pages and makes it easy to see if you have new notifications.', 'wordpress-seo' ), 'Yoast SEO' ),
[149] Fix | Delete
'order' => 80,
[150] Fix | Delete
],
[151] Fix | Delete
(object) [
[152] Fix | Delete
'name' => __( 'Security: no advanced or schema settings for authors', 'wordpress-seo' ),
[153] Fix | Delete
'setting' => 'disableadvanced_meta',
[154] Fix | Delete
'label' => sprintf(
[155] Fix | Delete
/* translators: 1: Yoast SEO, 2: translated version of "Off" */
[156] Fix | Delete
__( 'The advanced section of the %1$s meta box allows a user to remove posts from the search results or change the canonical. The settings in the schema tab allows a user to change schema meta data for a post. These are things you might not want any author to do. That\'s why, by default, only editors and administrators can do this. Setting to "%2$s" allows all users to change these settings.', 'wordpress-seo' ),
[157] Fix | Delete
'Yoast SEO',
[158] Fix | Delete
__( 'Off', 'wordpress-seo' )
[159] Fix | Delete
),
[160] Fix | Delete
'order' => 90,
[161] Fix | Delete
],
[162] Fix | Delete
(object) [
[163] Fix | Delete
'name' => __( 'Usage tracking', 'wordpress-seo' ),
[164] Fix | Delete
'label' => __( 'Usage tracking', 'wordpress-seo' ),
[165] Fix | Delete
'setting' => 'tracking',
[166] Fix | Delete
'read_more_label' => sprintf(
[167] Fix | Delete
/* translators: 1: Yoast SEO */
[168] Fix | Delete
__( 'Allow us to track some data about your site to improve our plugin.', 'wordpress-seo' ),
[169] Fix | Delete
'Yoast SEO'
[170] Fix | Delete
),
[171] Fix | Delete
'read_more_url' => 'https://yoa.st/usage-tracking-2',
[172] Fix | Delete
'order' => 95,
[173] Fix | Delete
],
[174] Fix | Delete
(object) [
[175] Fix | Delete
'name' => __( 'REST API: Head endpoint', 'wordpress-seo' ),
[176] Fix | Delete
'setting' => 'enable_headless_rest_endpoints',
[177] Fix | Delete
'label' => sprintf(
[178] Fix | Delete
/* translators: 1: Yoast SEO */
[179] Fix | Delete
__( 'This %1$s REST API endpoint gives you all the metadata you need for a specific URL. This will make it very easy for headless WordPress sites to use %1$s for all their SEO meta output.', 'wordpress-seo' ),
[180] Fix | Delete
'Yoast SEO'
[181] Fix | Delete
),
[182] Fix | Delete
'order' => 100,
[183] Fix | Delete
],
[184] Fix | Delete
(object) [
[185] Fix | Delete
'name' => __( 'Enhanced Slack sharing', 'wordpress-seo' ),
[186] Fix | Delete
'setting' => 'enable_enhanced_slack_sharing',
[187] Fix | Delete
'label' => __( 'This adds an author byline and reading time estimate to the article’s snippet when shared on Slack.', 'wordpress-seo' ),
[188] Fix | Delete
'read_more_label' => __( 'Find out how a rich snippet can improve visibility and click-through-rate.', 'wordpress-seo' ),
[189] Fix | Delete
'read_more_url' => 'https://yoa.st/help-slack-share',
[190] Fix | Delete
'order' => 105,
[191] Fix | Delete
],
[192] Fix | Delete
(object) [
[193] Fix | Delete
'name' => __( 'IndexNow', 'wordpress-seo' ),
[194] Fix | Delete
'premium' => true,
[195] Fix | Delete
'setting' => 'enable_index_now',
[196] Fix | Delete
'label' => __( 'Automatically ping search engines like Bing and Yandex whenever you publish, update or delete a post.', 'wordpress-seo' ),
[197] Fix | Delete
'read_more_label' => __( 'Find out how IndexNow can help your site.', 'wordpress-seo' ),
[198] Fix | Delete
'read_more_url' => 'https://yoa.st/index-now-read-more',
[199] Fix | Delete
'premium_url' => 'https://yoa.st/index-now-feature',
[200] Fix | Delete
'premium_upsell_url' => 'https://yoa.st/get-indexnow',
[201] Fix | Delete
'order' => 110,
[202] Fix | Delete
],
[203] Fix | Delete
(object) [
[204] Fix | Delete
'name' => __( 'AI title & description generator', 'wordpress-seo' ),
[205] Fix | Delete
'premium' => true,
[206] Fix | Delete
'setting' => 'enable_ai_generator',
[207] Fix | Delete
'label' => __( 'Use the power of Yoast AI to automatically generate compelling titles and descriptions for your posts and pages.', 'wordpress-seo' ),
[208] Fix | Delete
'read_more_label' => __( 'Learn more', 'wordpress-seo' ),
[209] Fix | Delete
'read_more_url' => 'https://yoa.st/ai-generator-read-more',
[210] Fix | Delete
'premium_url' => 'https://yoa.st/ai-generator-feature',
[211] Fix | Delete
'premium_upsell_url' => 'https://yoa.st/get-ai-generator',
[212] Fix | Delete
'order' => 115,
[213] Fix | Delete
],
[214] Fix | Delete
];
[215] Fix | Delete
[216] Fix | Delete
/**
[217] Fix | Delete
* Filter to add feature toggles from add-ons.
[218] Fix | Delete
*
[219] Fix | Delete
* @param array $feature_toggles Array with feature toggle objects where each object
[220] Fix | Delete
* should have a `name`, `setting` and `label` property.
[221] Fix | Delete
*/
[222] Fix | Delete
$feature_toggles = apply_filters( 'wpseo_feature_toggles', $feature_toggles );
[223] Fix | Delete
[224] Fix | Delete
$feature_toggles = array_map( [ $this, 'ensure_toggle' ], $feature_toggles );
[225] Fix | Delete
usort( $feature_toggles, [ $this, 'sort_toggles_callback' ] );
[226] Fix | Delete
[227] Fix | Delete
return $feature_toggles;
[228] Fix | Delete
}
[229] Fix | Delete
[230] Fix | Delete
/**
[231] Fix | Delete
* Returns html for a warning that core sitemaps are enabled when yoast seo sitemaps are disabled.
[232] Fix | Delete
*
[233] Fix | Delete
* @return string HTML string for the warning.
[234] Fix | Delete
*/
[235] Fix | Delete
protected function sitemaps_toggle_after() {
[236] Fix | Delete
$out = '<div id="yoast-seo-sitemaps-disabled-warning" style="display:none;">';
[237] Fix | Delete
$alert = new Alert_Presenter(
[238] Fix | Delete
/* translators: %1$s: expands to an opening anchor tag, %2$s: expands to a closing anchor tag */
[239] Fix | Delete
sprintf( esc_html__( 'Disabling Yoast SEO\'s XML sitemaps will not disable WordPress\' core sitemaps. In some cases, this %1$s may result in SEO errors on your site%2$s. These may be reported in Google Search Console and other tools.', 'wordpress-seo' ), '<a target="_blank" href="' . WPSEO_Shortlinker::get( 'https://yoa.st/44z' ) . '">', '</a>' ),
[240] Fix | Delete
'warning'
[241] Fix | Delete
);
[242] Fix | Delete
$out .= $alert->present();
[243] Fix | Delete
$out .= '</div>';
[244] Fix | Delete
[245] Fix | Delete
return $out;
[246] Fix | Delete
}
[247] Fix | Delete
[248] Fix | Delete
/**
[249] Fix | Delete
* Ensures that the passed value is a Yoast_Feature_Toggle.
[250] Fix | Delete
*
[251] Fix | Delete
* @param Yoast_Feature_Toggle|object|array $toggle_data Feature toggle instance, or raw object or array
[252] Fix | Delete
* containing feature toggle data.
[253] Fix | Delete
* @return Yoast_Feature_Toggle Feature toggle instance based on $toggle_data.
[254] Fix | Delete
*/
[255] Fix | Delete
protected function ensure_toggle( $toggle_data ) {
[256] Fix | Delete
if ( $toggle_data instanceof Yoast_Feature_Toggle ) {
[257] Fix | Delete
return $toggle_data;
[258] Fix | Delete
}
[259] Fix | Delete
[260] Fix | Delete
if ( is_object( $toggle_data ) ) {
[261] Fix | Delete
$toggle_data = get_object_vars( $toggle_data );
[262] Fix | Delete
}
[263] Fix | Delete
[264] Fix | Delete
return new Yoast_Feature_Toggle( $toggle_data );
[265] Fix | Delete
}
[266] Fix | Delete
[267] Fix | Delete
/**
[268] Fix | Delete
* Callback for sorting feature toggles by their order.
[269] Fix | Delete
*
[270] Fix | Delete
* {@internal Once the minimum PHP version goes up to PHP 7.0, the logic in the function
[271] Fix | Delete
* can be replaced with the spaceship operator `<=>`.}
[272] Fix | Delete
*
[273] Fix | Delete
* @param Yoast_Feature_Toggle $feature_a Feature A.
[274] Fix | Delete
* @param Yoast_Feature_Toggle $feature_b Feature B.
[275] Fix | Delete
*
[276] Fix | Delete
* @return int An integer less than, equal to, or greater than zero indicating respectively
[277] Fix | Delete
* that feature A is considered to be less than, equal to, or greater than feature B.
[278] Fix | Delete
*/
[279] Fix | Delete
protected function sort_toggles_callback( Yoast_Feature_Toggle $feature_a, Yoast_Feature_Toggle $feature_b ) {
[280] Fix | Delete
return ( $feature_a->order - $feature_b->order );
[281] Fix | Delete
}
[282] Fix | Delete
}
[283] Fix | Delete
[284] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function