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/wp-conte.../plugins/wordpres.../inc
File: class-addon-manager.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WPSEO plugin file.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WPSEO\Inc
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* Represents the addon manager.
[10] Fix | Delete
*/
[11] Fix | Delete
class WPSEO_Addon_Manager {
[12] Fix | Delete
[13] Fix | Delete
/**
[14] Fix | Delete
* Holds the name of the transient.
[15] Fix | Delete
*
[16] Fix | Delete
* @var string
[17] Fix | Delete
*/
[18] Fix | Delete
public const SITE_INFORMATION_TRANSIENT = 'wpseo_site_information';
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* Holds the name of the transient.
[22] Fix | Delete
*
[23] Fix | Delete
* @var string
[24] Fix | Delete
*/
[25] Fix | Delete
public const SITE_INFORMATION_TRANSIENT_QUICK = 'wpseo_site_information_quick';
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* Holds the slug for YoastSEO free.
[29] Fix | Delete
*
[30] Fix | Delete
* @var string
[31] Fix | Delete
*/
[32] Fix | Delete
public const FREE_SLUG = 'yoast-seo-wordpress';
[33] Fix | Delete
[34] Fix | Delete
/**
[35] Fix | Delete
* Holds the slug for YoastSEO Premium.
[36] Fix | Delete
*
[37] Fix | Delete
* @var string
[38] Fix | Delete
*/
[39] Fix | Delete
public const PREMIUM_SLUG = 'yoast-seo-wordpress-premium';
[40] Fix | Delete
[41] Fix | Delete
/**
[42] Fix | Delete
* Holds the slug for Yoast News.
[43] Fix | Delete
*
[44] Fix | Delete
* @var string
[45] Fix | Delete
*/
[46] Fix | Delete
public const NEWS_SLUG = 'yoast-seo-news';
[47] Fix | Delete
[48] Fix | Delete
/**
[49] Fix | Delete
* Holds the slug for Video.
[50] Fix | Delete
*
[51] Fix | Delete
* @var string
[52] Fix | Delete
*/
[53] Fix | Delete
public const VIDEO_SLUG = 'yoast-seo-video';
[54] Fix | Delete
[55] Fix | Delete
/**
[56] Fix | Delete
* Holds the slug for WooCommerce.
[57] Fix | Delete
*
[58] Fix | Delete
* @var string
[59] Fix | Delete
*/
[60] Fix | Delete
public const WOOCOMMERCE_SLUG = 'yoast-seo-woocommerce';
[61] Fix | Delete
[62] Fix | Delete
/**
[63] Fix | Delete
* Holds the slug for Local.
[64] Fix | Delete
*
[65] Fix | Delete
* @var string
[66] Fix | Delete
*/
[67] Fix | Delete
public const LOCAL_SLUG = 'yoast-seo-local';
[68] Fix | Delete
[69] Fix | Delete
/**
[70] Fix | Delete
* The expected addon data.
[71] Fix | Delete
*
[72] Fix | Delete
* @var array
[73] Fix | Delete
*/
[74] Fix | Delete
protected static $addons = [
[75] Fix | Delete
'wp-seo-premium.php' => self::PREMIUM_SLUG,
[76] Fix | Delete
'wpseo-news.php' => self::NEWS_SLUG,
[77] Fix | Delete
'video-seo.php' => self::VIDEO_SLUG,
[78] Fix | Delete
'wpseo-woocommerce.php' => self::WOOCOMMERCE_SLUG,
[79] Fix | Delete
'local-seo.php' => self::LOCAL_SLUG,
[80] Fix | Delete
];
[81] Fix | Delete
[82] Fix | Delete
/**
[83] Fix | Delete
* The addon data for the shortlinks.
[84] Fix | Delete
*
[85] Fix | Delete
* @var array
[86] Fix | Delete
*/
[87] Fix | Delete
private $addon_details = [
[88] Fix | Delete
self::PREMIUM_SLUG => [
[89] Fix | Delete
'name' => 'Yoast SEO Premium',
[90] Fix | Delete
'short_link_activation' => 'https://yoa.st/13j',
[91] Fix | Delete
'short_link_renewal' => 'https://yoa.st/4ey',
[92] Fix | Delete
],
[93] Fix | Delete
self::NEWS_SLUG => [
[94] Fix | Delete
'name' => 'Yoast News SEO',
[95] Fix | Delete
'short_link_activation' => 'https://yoa.st/4xq',
[96] Fix | Delete
'short_link_renewal' => 'https://yoa.st/4xv',
[97] Fix | Delete
],
[98] Fix | Delete
self::WOOCOMMERCE_SLUG => [
[99] Fix | Delete
'name' => 'Yoast WooCommerce SEO',
[100] Fix | Delete
'short_link_activation' => 'https://yoa.st/4xs',
[101] Fix | Delete
'short_link_renewal' => 'https://yoa.st/4xx',
[102] Fix | Delete
],
[103] Fix | Delete
self::VIDEO_SLUG => [
[104] Fix | Delete
'name' => 'Yoast Video SEO',
[105] Fix | Delete
'short_link_activation' => 'https://yoa.st/4xr',
[106] Fix | Delete
'short_link_renewal' => 'https://yoa.st/4xw',
[107] Fix | Delete
],
[108] Fix | Delete
self::LOCAL_SLUG => [
[109] Fix | Delete
'name' => 'Yoast Local SEO',
[110] Fix | Delete
'short_link_activation' => 'https://yoa.st/4xp',
[111] Fix | Delete
'short_link_renewal' => 'https://yoa.st/4xu',
[112] Fix | Delete
],
[113] Fix | Delete
];
[114] Fix | Delete
[115] Fix | Delete
/**
[116] Fix | Delete
* Holds the site information data.
[117] Fix | Delete
*
[118] Fix | Delete
* @var stdClass
[119] Fix | Delete
*/
[120] Fix | Delete
private $site_information;
[121] Fix | Delete
[122] Fix | Delete
/**
[123] Fix | Delete
* Hooks into WordPress.
[124] Fix | Delete
*
[125] Fix | Delete
* @codeCoverageIgnore
[126] Fix | Delete
*
[127] Fix | Delete
* @return void
[128] Fix | Delete
*/
[129] Fix | Delete
public function register_hooks() {
[130] Fix | Delete
add_action( 'admin_init', [ $this, 'validate_addons' ], 15 );
[131] Fix | Delete
add_filter( 'pre_set_site_transient_update_plugins', [ $this, 'check_for_updates' ] );
[132] Fix | Delete
add_filter( 'plugins_api', [ $this, 'get_plugin_information' ], 10, 3 );
[133] Fix | Delete
add_action( 'plugins_loaded', [ $this, 'register_expired_messages' ], 10 );
[134] Fix | Delete
}
[135] Fix | Delete
[136] Fix | Delete
/**
[137] Fix | Delete
* Registers "expired subscription" warnings to the update messages of our addons.
[138] Fix | Delete
*
[139] Fix | Delete
* @return void
[140] Fix | Delete
*/
[141] Fix | Delete
public function register_expired_messages() {
[142] Fix | Delete
foreach ( array_keys( $this->get_installed_addons() ) as $plugin_file ) {
[143] Fix | Delete
add_action( 'in_plugin_update_message-' . $plugin_file, [ $this, 'expired_subscription_warning' ], 10, 2 );
[144] Fix | Delete
}
[145] Fix | Delete
}
[146] Fix | Delete
[147] Fix | Delete
/**
[148] Fix | Delete
* Gets the subscriptions for current site.
[149] Fix | Delete
*
[150] Fix | Delete
* @return stdClass The subscriptions.
[151] Fix | Delete
*/
[152] Fix | Delete
public function get_subscriptions() {
[153] Fix | Delete
return $this->get_site_information()->subscriptions;
[154] Fix | Delete
}
[155] Fix | Delete
[156] Fix | Delete
/**
[157] Fix | Delete
* Provides a list of addon filenames.
[158] Fix | Delete
*
[159] Fix | Delete
* @return string[] List of addon filenames with their slugs.
[160] Fix | Delete
*/
[161] Fix | Delete
public function get_addon_filenames() {
[162] Fix | Delete
return self::$addons;
[163] Fix | Delete
}
[164] Fix | Delete
[165] Fix | Delete
/**
[166] Fix | Delete
* Finds the plugin file.
[167] Fix | Delete
*
[168] Fix | Delete
* @param string $plugin_slug The plugin slug to search.
[169] Fix | Delete
*
[170] Fix | Delete
* @return bool|string Plugin file when installed, False when plugin isn't installed.
[171] Fix | Delete
*/
[172] Fix | Delete
public function get_plugin_file( $plugin_slug ) {
[173] Fix | Delete
$plugins = $this->get_plugins();
[174] Fix | Delete
$plugin_files = array_keys( $plugins );
[175] Fix | Delete
$target_plugin_file = array_search( $plugin_slug, $this->get_addon_filenames(), true );
[176] Fix | Delete
[177] Fix | Delete
if ( ! $target_plugin_file ) {
[178] Fix | Delete
return false;
[179] Fix | Delete
}
[180] Fix | Delete
[181] Fix | Delete
foreach ( $plugin_files as $plugin_file ) {
[182] Fix | Delete
if ( strpos( $plugin_file, $target_plugin_file ) !== false ) {
[183] Fix | Delete
return $plugin_file;
[184] Fix | Delete
}
[185] Fix | Delete
}
[186] Fix | Delete
[187] Fix | Delete
return false;
[188] Fix | Delete
}
[189] Fix | Delete
[190] Fix | Delete
/**
[191] Fix | Delete
* Retrieves the subscription for the given slug.
[192] Fix | Delete
*
[193] Fix | Delete
* @param string $slug The plugin slug to retrieve.
[194] Fix | Delete
*
[195] Fix | Delete
* @return stdClass|false Subscription data when found, false when not found.
[196] Fix | Delete
*/
[197] Fix | Delete
public function get_subscription( $slug ) {
[198] Fix | Delete
foreach ( $this->get_subscriptions() as $subscription ) {
[199] Fix | Delete
if ( $subscription->product->slug === $slug ) {
[200] Fix | Delete
return $subscription;
[201] Fix | Delete
}
[202] Fix | Delete
}
[203] Fix | Delete
[204] Fix | Delete
return false;
[205] Fix | Delete
}
[206] Fix | Delete
[207] Fix | Delete
/**
[208] Fix | Delete
* Retrieves a list of (subscription) slugs by the active addons.
[209] Fix | Delete
*
[210] Fix | Delete
* @return array The slugs.
[211] Fix | Delete
*/
[212] Fix | Delete
public function get_subscriptions_for_active_addons() {
[213] Fix | Delete
$active_addons = array_keys( $this->get_active_addons() );
[214] Fix | Delete
$subscription_slugs = array_map( [ $this, 'get_slug_by_plugin_file' ], $active_addons );
[215] Fix | Delete
$subscriptions = [];
[216] Fix | Delete
foreach ( $subscription_slugs as $subscription_slug ) {
[217] Fix | Delete
$subscriptions[ $subscription_slug ] = $this->get_subscription( $subscription_slug );
[218] Fix | Delete
}
[219] Fix | Delete
[220] Fix | Delete
return $subscriptions;
[221] Fix | Delete
}
[222] Fix | Delete
[223] Fix | Delete
/**
[224] Fix | Delete
* Retrieves a list of versions for each addon.
[225] Fix | Delete
*
[226] Fix | Delete
* @return array The addon versions.
[227] Fix | Delete
*/
[228] Fix | Delete
public function get_installed_addons_versions() {
[229] Fix | Delete
$addon_versions = [];
[230] Fix | Delete
foreach ( $this->get_installed_addons() as $plugin_file => $installed_addon ) {
[231] Fix | Delete
$addon_versions[ $this->get_slug_by_plugin_file( $plugin_file ) ] = $installed_addon['Version'];
[232] Fix | Delete
}
[233] Fix | Delete
[234] Fix | Delete
return $addon_versions;
[235] Fix | Delete
}
[236] Fix | Delete
[237] Fix | Delete
/**
[238] Fix | Delete
* Retrieves the plugin information from the subscriptions.
[239] Fix | Delete
*
[240] Fix | Delete
* @param stdClass|false $data The result object. Default false.
[241] Fix | Delete
* @param string $action The type of information being requested from the Plugin Installation API.
[242] Fix | Delete
* @param stdClass $args Plugin API arguments.
[243] Fix | Delete
*
[244] Fix | Delete
* @return object Extended plugin data.
[245] Fix | Delete
*/
[246] Fix | Delete
public function get_plugin_information( $data, $action, $args ) {
[247] Fix | Delete
if ( $action !== 'plugin_information' ) {
[248] Fix | Delete
return $data;
[249] Fix | Delete
}
[250] Fix | Delete
[251] Fix | Delete
if ( ! isset( $args->slug ) ) {
[252] Fix | Delete
return $data;
[253] Fix | Delete
}
[254] Fix | Delete
[255] Fix | Delete
$subscription = $this->get_subscription( $args->slug );
[256] Fix | Delete
if ( ! $subscription ) {
[257] Fix | Delete
return $data;
[258] Fix | Delete
}
[259] Fix | Delete
[260] Fix | Delete
$data = $this->convert_subscription_to_plugin( $subscription, null, true );
[261] Fix | Delete
[262] Fix | Delete
if ( $this->has_subscription_expired( $subscription ) ) {
[263] Fix | Delete
unset( $data->package, $data->download_link );
[264] Fix | Delete
}
[265] Fix | Delete
[266] Fix | Delete
return $data;
[267] Fix | Delete
}
[268] Fix | Delete
[269] Fix | Delete
/**
[270] Fix | Delete
* Retrieves information from MyYoast about which addons are connected to the current site.
[271] Fix | Delete
*
[272] Fix | Delete
* @return stdClass The list of addons activated for this site.
[273] Fix | Delete
*/
[274] Fix | Delete
public function get_myyoast_site_information() {
[275] Fix | Delete
if ( $this->site_information === null ) {
[276] Fix | Delete
$this->site_information = $this->get_site_information_transient();
[277] Fix | Delete
}
[278] Fix | Delete
[279] Fix | Delete
if ( $this->site_information ) {
[280] Fix | Delete
return $this->site_information;
[281] Fix | Delete
}
[282] Fix | Delete
[283] Fix | Delete
$this->site_information = $this->request_current_sites();
[284] Fix | Delete
if ( $this->site_information ) {
[285] Fix | Delete
$this->site_information = $this->map_site_information( $this->site_information );
[286] Fix | Delete
[287] Fix | Delete
$this->set_site_information_transient( $this->site_information );
[288] Fix | Delete
[289] Fix | Delete
return $this->site_information;
[290] Fix | Delete
}
[291] Fix | Delete
[292] Fix | Delete
return $this->get_site_information_default();
[293] Fix | Delete
}
[294] Fix | Delete
[295] Fix | Delete
/**
[296] Fix | Delete
* Checks if the subscription for the given slug is valid.
[297] Fix | Delete
*
[298] Fix | Delete
* @param string $slug The plugin slug to retrieve.
[299] Fix | Delete
*
[300] Fix | Delete
* @return bool True when the subscription is valid.
[301] Fix | Delete
*/
[302] Fix | Delete
public function has_valid_subscription( $slug ) {
[303] Fix | Delete
$subscription = $this->get_subscription( $slug );
[304] Fix | Delete
[305] Fix | Delete
// An non-existing subscription is never valid.
[306] Fix | Delete
if ( ! $subscription ) {
[307] Fix | Delete
return false;
[308] Fix | Delete
}
[309] Fix | Delete
[310] Fix | Delete
return ! $this->has_subscription_expired( $subscription );
[311] Fix | Delete
}
[312] Fix | Delete
[313] Fix | Delete
/**
[314] Fix | Delete
* Checks if there are addon updates.
[315] Fix | Delete
*
[316] Fix | Delete
* @param stdClass|mixed $data The current data for update_plugins.
[317] Fix | Delete
*
[318] Fix | Delete
* @return stdClass Extended data for update_plugins.
[319] Fix | Delete
*/
[320] Fix | Delete
public function check_for_updates( $data ) {
[321] Fix | Delete
global $wp_version;
[322] Fix | Delete
[323] Fix | Delete
if ( empty( $data ) ) {
[324] Fix | Delete
return $data;
[325] Fix | Delete
}
[326] Fix | Delete
[327] Fix | Delete
// We have to figure out if we're safe to upgrade the add-ons, based on what the latest Yoast Free requirements for the WP version is.
[328] Fix | Delete
$yoast_free_data = $this->extract_yoast_data( $data );
[329] Fix | Delete
[330] Fix | Delete
foreach ( $this->get_installed_addons() as $plugin_file => $installed_plugin ) {
[331] Fix | Delete
$subscription_slug = $this->get_slug_by_plugin_file( $plugin_file );
[332] Fix | Delete
$subscription = $this->get_subscription( $subscription_slug );
[333] Fix | Delete
[334] Fix | Delete
if ( ! $subscription ) {
[335] Fix | Delete
continue;
[336] Fix | Delete
}
[337] Fix | Delete
[338] Fix | Delete
$plugin_data = $this->convert_subscription_to_plugin( $subscription, $yoast_free_data, false, $plugin_file );
[339] Fix | Delete
[340] Fix | Delete
// Let's assume for now that it will get added in the 'no_update' key that we'll return to the WP API.
[341] Fix | Delete
$is_no_update = true;
[342] Fix | Delete
[343] Fix | Delete
// If the add-on's version is the latest, we have to do no further checks.
[344] Fix | Delete
if ( version_compare( $installed_plugin['Version'], $plugin_data->new_version, '<' ) ) {
[345] Fix | Delete
// If we haven't retrieved the Yoast Free requirements for the WP version yet, do nothing. The next run will probably get us that information.
[346] Fix | Delete
if ( is_null( $plugin_data->requires ) ) {
[347] Fix | Delete
continue;
[348] Fix | Delete
}
[349] Fix | Delete
[350] Fix | Delete
if ( version_compare( $plugin_data->requires, $wp_version, '<=' ) ) {
[351] Fix | Delete
// The add-on has an available update *and* the Yoast Free requirements for the WP version are also met, so go ahead and show the upgrade info to the user.
[352] Fix | Delete
$is_no_update = false;
[353] Fix | Delete
$data->response[ $plugin_file ] = $plugin_data;
[354] Fix | Delete
[355] Fix | Delete
if ( $this->has_subscription_expired( $subscription ) ) {
[356] Fix | Delete
unset( $data->response[ $plugin_file ]->package, $data->response[ $plugin_file ]->download_link );
[357] Fix | Delete
}
[358] Fix | Delete
}
[359] Fix | Delete
}
[360] Fix | Delete
[361] Fix | Delete
if ( $is_no_update ) {
[362] Fix | Delete
// Still convert subscription when no updates is available.
[363] Fix | Delete
$data->no_update[ $plugin_file ] = $plugin_data;
[364] Fix | Delete
[365] Fix | Delete
if ( $this->has_subscription_expired( $subscription ) ) {
[366] Fix | Delete
unset( $data->no_update[ $plugin_file ]->package, $data->no_update[ $plugin_file ]->download_link );
[367] Fix | Delete
}
[368] Fix | Delete
}
[369] Fix | Delete
}
[370] Fix | Delete
[371] Fix | Delete
return $data;
[372] Fix | Delete
}
[373] Fix | Delete
[374] Fix | Delete
/**
[375] Fix | Delete
* Extracts Yoast SEO Free's data from the wp.org API response.
[376] Fix | Delete
*
[377] Fix | Delete
* @param object $data The wp.org API response.
[378] Fix | Delete
*
[379] Fix | Delete
* @return object Yoast Free's data from wp.org.
[380] Fix | Delete
*/
[381] Fix | Delete
protected function extract_yoast_data( $data ) {
[382] Fix | Delete
if ( isset( $data->response[ WPSEO_BASENAME ] ) ) {
[383] Fix | Delete
return $data->response[ WPSEO_BASENAME ];
[384] Fix | Delete
}
[385] Fix | Delete
[386] Fix | Delete
if ( isset( $data->no_update[ WPSEO_BASENAME ] ) ) {
[387] Fix | Delete
return $data->no_update[ WPSEO_BASENAME ];
[388] Fix | Delete
}
[389] Fix | Delete
[390] Fix | Delete
return (object) [];
[391] Fix | Delete
}
[392] Fix | Delete
[393] Fix | Delete
/**
[394] Fix | Delete
* If the plugin is lacking an active subscription, throw a warning.
[395] Fix | Delete
*
[396] Fix | Delete
* @param array $plugin_data The data for the plugin in this row.
[397] Fix | Delete
*
[398] Fix | Delete
* @return void
[399] Fix | Delete
*/
[400] Fix | Delete
public function expired_subscription_warning( $plugin_data ) {
[401] Fix | Delete
$subscription = $this->get_subscription( $plugin_data['slug'] );
[402] Fix | Delete
if ( $subscription && $this->has_subscription_expired( $subscription ) ) {
[403] Fix | Delete
$addon_link = ( isset( $this->addon_details[ $plugin_data['slug'] ] ) ) ? $this->addon_details[ $plugin_data['slug'] ]['short_link_renewal'] : $this->addon_details[ self::PREMIUM_SLUG ]['short_link_renewal'];
[404] Fix | Delete
[405] Fix | Delete
$sale_copy = '';
[406] Fix | Delete
if ( YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-2023-promotion' ) ) {
[407] Fix | Delete
$sale_copy = sprintf(
[408] Fix | Delete
/* translators: %1$s is a <br> tag. */
[409] Fix | Delete
esc_html__( '%1$s Now with 30%% Black Friday Discount!', 'wordpress-seo' ),
[410] Fix | Delete
'<br>'
[411] Fix | Delete
);
[412] Fix | Delete
}
[413] Fix | Delete
echo '<br><br>';
[414] Fix | Delete
echo '<strong><span class="yoast-dashicons-notice warning dashicons dashicons-warning"></span> '
[415] Fix | Delete
. sprintf(
[416] Fix | Delete
/* translators: %1$s is the plugin name, %2$s and %3$s are a link. */
[417] Fix | Delete
esc_html__( '%1$s can\'t be updated because your product subscription is expired. %2$sRenew your product subscription%3$s to get updates again and use all the features of %1$s.', 'wordpress-seo' ),
[418] Fix | Delete
esc_html( $plugin_data['name'] ),
[419] Fix | Delete
'<a href="' . esc_url( WPSEO_Shortlinker::get( $addon_link ) ) . '">',
[420] Fix | Delete
'</a>'
[421] Fix | Delete
)
[422] Fix | Delete
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is escaped above.
[423] Fix | Delete
. $sale_copy
[424] Fix | Delete
. '</strong>';
[425] Fix | Delete
}
[426] Fix | Delete
}
[427] Fix | Delete
[428] Fix | Delete
/**
[429] Fix | Delete
* Checks if there are any installed addons.
[430] Fix | Delete
*
[431] Fix | Delete
* @return bool True when there are installed Yoast addons.
[432] Fix | Delete
*/
[433] Fix | Delete
public function has_installed_addons() {
[434] Fix | Delete
$installed_addons = $this->get_installed_addons();
[435] Fix | Delete
[436] Fix | Delete
return ! empty( $installed_addons );
[437] Fix | Delete
}
[438] Fix | Delete
[439] Fix | Delete
/**
[440] Fix | Delete
* Checks if the plugin is installed and activated in WordPress.
[441] Fix | Delete
*
[442] Fix | Delete
* @param string $slug The class' slug.
[443] Fix | Delete
*
[444] Fix | Delete
* @return bool True when installed and activated.
[445] Fix | Delete
*/
[446] Fix | Delete
public function is_installed( $slug ) {
[447] Fix | Delete
$slug_to_class_map = [
[448] Fix | Delete
static::PREMIUM_SLUG => 'WPSEO_Premium',
[449] Fix | Delete
static::NEWS_SLUG => 'WPSEO_News',
[450] Fix | Delete
static::WOOCOMMERCE_SLUG => 'Yoast_WooCommerce_SEO',
[451] Fix | Delete
static::VIDEO_SLUG => 'WPSEO_Video_Sitemap',
[452] Fix | Delete
static::LOCAL_SLUG => 'WPSEO_Local_Core',
[453] Fix | Delete
];
[454] Fix | Delete
[455] Fix | Delete
if ( ! isset( $slug_to_class_map[ $slug ] ) ) {
[456] Fix | Delete
return false;
[457] Fix | Delete
}
[458] Fix | Delete
[459] Fix | Delete
return class_exists( $slug_to_class_map[ $slug ] );
[460] Fix | Delete
}
[461] Fix | Delete
[462] Fix | Delete
/**
[463] Fix | Delete
* Validates the addons and show a notice for the ones that are invalid.
[464] Fix | Delete
*
[465] Fix | Delete
* @return void
[466] Fix | Delete
*/
[467] Fix | Delete
public function validate_addons() {
[468] Fix | Delete
$notification_center = Yoast_Notification_Center::get();
[469] Fix | Delete
[470] Fix | Delete
if ( $notification_center === null ) {
[471] Fix | Delete
return;
[472] Fix | Delete
}
[473] Fix | Delete
[474] Fix | Delete
foreach ( $this->addon_details as $slug => $addon_info ) {
[475] Fix | Delete
$notification = $this->create_notification( $addon_info['name'], $addon_info['short_link_activation'] );
[476] Fix | Delete
[477] Fix | Delete
// Add a notification when the installed plugin isn't activated in My Yoast.
[478] Fix | Delete
if ( $this->is_installed( $slug ) && ! $this->has_valid_subscription( $slug ) ) {
[479] Fix | Delete
$notification_center->add_notification( $notification );
[480] Fix | Delete
[481] Fix | Delete
continue;
[482] Fix | Delete
}
[483] Fix | Delete
[484] Fix | Delete
$notification_center->remove_notification( $notification );
[485] Fix | Delete
}
[486] Fix | Delete
}
[487] Fix | Delete
[488] Fix | Delete
/**
[489] Fix | Delete
* Removes the site information transients.
[490] Fix | Delete
*
[491] Fix | Delete
* @codeCoverageIgnore
[492] Fix | Delete
*
[493] Fix | Delete
* @return void
[494] Fix | Delete
*/
[495] Fix | Delete
public function remove_site_information_transients() {
[496] Fix | Delete
delete_transient( self::SITE_INFORMATION_TRANSIENT );
[497] Fix | Delete
delete_transient( self::SITE_INFORMATION_TRANSIENT_QUICK );
[498] Fix | Delete
}
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function