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: indexable-homeurl-watcher.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Integrations\Watchers;
[2] Fix | Delete
[3] Fix | Delete
use WP_CLI;
[4] Fix | Delete
use Yoast\WP\SEO\Conditionals\Migrations_Conditional;
[5] Fix | Delete
use Yoast\WP\SEO\Config\Indexing_Reasons;
[6] Fix | Delete
use Yoast\WP\SEO\Helpers\Indexable_Helper;
[7] Fix | Delete
use Yoast\WP\SEO\Helpers\Options_Helper;
[8] Fix | Delete
use Yoast\WP\SEO\Helpers\Post_Type_Helper;
[9] Fix | Delete
use Yoast\WP\SEO\Integrations\Integration_Interface;
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* Home url option watcher.
[13] Fix | Delete
*
[14] Fix | Delete
* Handles updates to the home URL option for the Indexables table.
[15] Fix | Delete
*/
[16] Fix | Delete
class Indexable_HomeUrl_Watcher implements Integration_Interface {
[17] Fix | Delete
[18] Fix | Delete
/**
[19] Fix | Delete
* Represents the options helper.
[20] Fix | Delete
*
[21] Fix | Delete
* @var Options_Helper
[22] Fix | Delete
*/
[23] Fix | Delete
protected $options_helper;
[24] Fix | Delete
[25] Fix | Delete
/**
[26] Fix | Delete
* The post type helper.
[27] Fix | Delete
*
[28] Fix | Delete
* @var Post_Type_Helper
[29] Fix | Delete
*/
[30] Fix | Delete
private $post_type;
[31] Fix | Delete
[32] Fix | Delete
/**
[33] Fix | Delete
* The indexable helper.
[34] Fix | Delete
*
[35] Fix | Delete
* @var Indexable_Helper
[36] Fix | Delete
*/
[37] Fix | Delete
protected $indexable_helper;
[38] Fix | Delete
[39] Fix | Delete
/**
[40] Fix | Delete
* Returns the conditionals based on which this loadable should be active.
[41] Fix | Delete
*
[42] Fix | Delete
* @return array
[43] Fix | Delete
*/
[44] Fix | Delete
public static function get_conditionals() {
[45] Fix | Delete
return [ Migrations_Conditional::class ];
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
/**
[49] Fix | Delete
* Indexable_HomeUrl_Watcher constructor.
[50] Fix | Delete
*
[51] Fix | Delete
* @param Post_Type_Helper $post_type The post type helper.
[52] Fix | Delete
* @param Options_Helper $options The options helper.
[53] Fix | Delete
* @param Indexable_Helper $indexable The indexable helper.
[54] Fix | Delete
*/
[55] Fix | Delete
public function __construct( Post_Type_Helper $post_type, Options_Helper $options, Indexable_Helper $indexable ) {
[56] Fix | Delete
$this->post_type = $post_type;
[57] Fix | Delete
$this->options_helper = $options;
[58] Fix | Delete
$this->indexable_helper = $indexable;
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
/**
[62] Fix | Delete
* Initializes the integration.
[63] Fix | Delete
*
[64] Fix | Delete
* This is the place to register hooks and filters.
[65] Fix | Delete
*
[66] Fix | Delete
* @return void
[67] Fix | Delete
*/
[68] Fix | Delete
public function register_hooks() {
[69] Fix | Delete
\add_action( 'update_option_home', [ $this, 'reset_permalinks' ] );
[70] Fix | Delete
\add_action( 'wpseo_permalink_structure_check', [ $this, 'force_reset_permalinks' ] );
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
/**
[74] Fix | Delete
* Resets the permalinks for everything that is related to the permalink structure.
[75] Fix | Delete
*
[76] Fix | Delete
* @return void
[77] Fix | Delete
*/
[78] Fix | Delete
public function reset_permalinks() {
[79] Fix | Delete
$this->indexable_helper->reset_permalink_indexables( null, null, Indexing_Reasons::REASON_HOME_URL_OPTION );
[80] Fix | Delete
[81] Fix | Delete
// Reset the home_url option.
[82] Fix | Delete
$this->options_helper->set( 'home_url', \get_home_url() );
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
/**
[86] Fix | Delete
* Resets the permalink indexables automatically, if necessary.
[87] Fix | Delete
*
[88] Fix | Delete
* @return bool Whether the request ran.
[89] Fix | Delete
*/
[90] Fix | Delete
public function force_reset_permalinks() {
[91] Fix | Delete
if ( $this->should_reset_permalinks() ) {
[92] Fix | Delete
$this->reset_permalinks();
[93] Fix | Delete
[94] Fix | Delete
if ( \defined( 'WP_CLI' ) && \WP_CLI ) {
[95] Fix | Delete
WP_CLI::success( \__( 'All permalinks were successfully reset', 'wordpress-seo' ) );
[96] Fix | Delete
}
[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 whether permalinks should be reset.
[106] Fix | Delete
*
[107] Fix | Delete
* @return bool Whether the permalinks should be reset.
[108] Fix | Delete
*/
[109] Fix | Delete
public function should_reset_permalinks() {
[110] Fix | Delete
return \get_home_url() !== $this->options_helper->get( 'home_url' );
[111] Fix | Delete
}
[112] Fix | Delete
}
[113] Fix | Delete
[114] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function