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.../src/integrat.../watchers
File: option-wpseo-watcher.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Integrations\Watchers;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\SEO\Conditionals\No_Conditionals;
[4] Fix | Delete
use Yoast\WP\SEO\Integrations\Integration_Interface;
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Watcher for the wpseo option.
[8] Fix | Delete
*
[9] Fix | Delete
* Represents the option wpseo watcher.
[10] Fix | Delete
*/
[11] Fix | Delete
class Option_Wpseo_Watcher implements Integration_Interface {
[12] Fix | Delete
[13] Fix | Delete
use No_Conditionals;
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* Initializes the integration.
[17] Fix | Delete
*
[18] Fix | Delete
* This is the place to register hooks and filters.
[19] Fix | Delete
*
[20] Fix | Delete
* @return void
[21] Fix | Delete
*/
[22] Fix | Delete
public function register_hooks() {
[23] Fix | Delete
\add_action( 'update_option_wpseo', [ $this, 'check_semrush_option_disabled' ], 10, 2 );
[24] Fix | Delete
\add_action( 'update_option_wpseo', [ $this, 'check_wincher_option_disabled' ], 10, 2 );
[25] Fix | Delete
\add_action( 'update_option_wpseo', [ $this, 'check_toggle_usage_tracking' ], 10, 2 );
[26] Fix | Delete
}
[27] Fix | Delete
[28] Fix | Delete
/**
[29] Fix | Delete
* Checks if the SEMrush integration is disabled; if so, deletes the tokens.
[30] Fix | Delete
*
[31] Fix | Delete
* We delete the tokens if the SEMrush integration is disabled, no matter if
[32] Fix | Delete
* the value has actually changed or not.
[33] Fix | Delete
*
[34] Fix | Delete
* @param array $old_value The old value of the option.
[35] Fix | Delete
* @param array $new_value The new value of the option.
[36] Fix | Delete
*
[37] Fix | Delete
* @return bool Whether the SEMrush tokens have been deleted or not.
[38] Fix | Delete
*/
[39] Fix | Delete
public function check_semrush_option_disabled( $old_value, $new_value ) {
[40] Fix | Delete
return $this->check_token_option_disabled( 'semrush_integration_active', 'semrush_tokens', $new_value );
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
/**
[44] Fix | Delete
* Checks if the Wincher integration is disabled; if so, deletes the tokens
[45] Fix | Delete
* and website id.
[46] Fix | Delete
*
[47] Fix | Delete
* We delete them if the Wincher integration is disabled, no matter if the
[48] Fix | Delete
* value has actually changed or not.
[49] Fix | Delete
*
[50] Fix | Delete
* @param array $old_value The old value of the option.
[51] Fix | Delete
* @param array $new_value The new value of the option.
[52] Fix | Delete
*
[53] Fix | Delete
* @return bool Whether the Wincher tokens have been deleted or not.
[54] Fix | Delete
*/
[55] Fix | Delete
public function check_wincher_option_disabled( $old_value, $new_value ) {
[56] Fix | Delete
$disabled = $this->check_token_option_disabled( 'wincher_integration_active', 'wincher_tokens', $new_value );
[57] Fix | Delete
if ( $disabled ) {
[58] Fix | Delete
\YoastSEO()->helpers->options->set( 'wincher_website_id', '' );
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
return $disabled;
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
/**
[65] Fix | Delete
* Checks if the WordProof integration is disabled; if so, deletes the tokens
[66] Fix | Delete
*
[67] Fix | Delete
* We delete them if the WordProof integration is disabled, no matter if the
[68] Fix | Delete
* value has actually changed or not.
[69] Fix | Delete
*
[70] Fix | Delete
* @deprecated 22.10
[71] Fix | Delete
* @codeCoverageIgnore
[72] Fix | Delete
*
[73] Fix | Delete
* @param array $old_value The old value of the option.
[74] Fix | Delete
* @param array $new_value The new value of the option.
[75] Fix | Delete
*
[76] Fix | Delete
* @return bool Whether the WordProof tokens have been deleted or not.
[77] Fix | Delete
*/
[78] Fix | Delete
public function check_wordproof_option_disabled( $old_value, $new_value ) {
[79] Fix | Delete
\_deprecated_function( __METHOD__, 'Yoast SEO 22.10' );
[80] Fix | Delete
[81] Fix | Delete
return true;
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
/**
[85] Fix | Delete
* Checks if the usage tracking feature is toggled; if so, set an option to stop us from messing with it.
[86] Fix | Delete
*
[87] Fix | Delete
* @param array $old_value The old value of the option.
[88] Fix | Delete
* @param array $new_value The new value of the option.
[89] Fix | Delete
*
[90] Fix | Delete
* @return bool Whether the option is set.
[91] Fix | Delete
*/
[92] Fix | Delete
public function check_toggle_usage_tracking( $old_value, $new_value ) {
[93] Fix | Delete
$option_name = 'tracking';
[94] Fix | Delete
[95] Fix | Delete
if ( \array_key_exists( $option_name, $old_value ) && \array_key_exists( $option_name, $new_value ) && $old_value[ $option_name ] !== $new_value[ $option_name ] && $old_value['toggled_tracking'] === false ) {
[96] Fix | Delete
\YoastSEO()->helpers->options->set( 'toggled_tracking', true );
[97] Fix | Delete
[98] Fix | Delete
return true;
[99] Fix | Delete
}
[100] Fix | Delete
[101] Fix | Delete
return false;
[102] Fix | Delete
}
[103] Fix | Delete
[104] Fix | Delete
/**
[105] Fix | Delete
* Checks if the passed integration is disabled; if so, deletes the tokens.
[106] Fix | Delete
*
[107] Fix | Delete
* We delete the tokens if the integration is disabled, no matter if
[108] Fix | Delete
* the value has actually changed or not.
[109] Fix | Delete
*
[110] Fix | Delete
* @param string $integration_option The intergration option name.
[111] Fix | Delete
* @param string $target_option The target option to remove the tokens from.
[112] Fix | Delete
* @param array $new_value The new value of the option.
[113] Fix | Delete
*
[114] Fix | Delete
* @return bool Whether the tokens have been deleted or not.
[115] Fix | Delete
*/
[116] Fix | Delete
protected function check_token_option_disabled( $integration_option, $target_option, $new_value ) {
[117] Fix | Delete
if ( \array_key_exists( $integration_option, $new_value ) && $new_value[ $integration_option ] === false ) {
[118] Fix | Delete
\YoastSEO()->helpers->options->set( $target_option, [] );
[119] Fix | Delete
[120] Fix | Delete
return true;
[121] Fix | Delete
}
[122] Fix | Delete
[123] Fix | Delete
return false;
[124] Fix | Delete
}
[125] Fix | Delete
}
[126] Fix | Delete
[127] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function