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-system-page-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\Builders\Indexable_Builder;
[4] Fix | Delete
use Yoast\WP\SEO\Builders\Indexable_System_Page_Builder;
[5] Fix | Delete
use Yoast\WP\SEO\Conditionals\Migrations_Conditional;
[6] Fix | Delete
use Yoast\WP\SEO\Integrations\Integration_Interface;
[7] Fix | Delete
use Yoast\WP\SEO\Repositories\Indexable_Repository;
[8] Fix | Delete
[9] Fix | Delete
/**
[10] Fix | Delete
* Search result watcher to save the meta data to an Indexable.
[11] Fix | Delete
*
[12] Fix | Delete
* Watches the search result options to save the meta information when updated.
[13] Fix | Delete
*/
[14] Fix | Delete
class Indexable_System_Page_Watcher implements Integration_Interface {
[15] Fix | Delete
[16] Fix | Delete
/**
[17] Fix | Delete
* The indexable repository.
[18] Fix | Delete
*
[19] Fix | Delete
* @var Indexable_Repository
[20] Fix | Delete
*/
[21] Fix | Delete
protected $repository;
[22] Fix | Delete
[23] Fix | Delete
/**
[24] Fix | Delete
* The indexable builder.
[25] Fix | Delete
*
[26] Fix | Delete
* @var Indexable_Builder
[27] Fix | Delete
*/
[28] Fix | Delete
protected $builder;
[29] Fix | Delete
[30] Fix | Delete
/**
[31] Fix | Delete
* Returns the conditionals based on which this loadable should be active.
[32] Fix | Delete
*
[33] Fix | Delete
* @return array
[34] Fix | Delete
*/
[35] Fix | Delete
public static function get_conditionals() {
[36] Fix | Delete
return [ Migrations_Conditional::class ];
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
/**
[40] Fix | Delete
* Indexable_System_Page_Watcher constructor.
[41] Fix | Delete
*
[42] Fix | Delete
* @param Indexable_Repository $repository The repository to use.
[43] Fix | Delete
* @param Indexable_Builder $builder The post builder to use.
[44] Fix | Delete
*/
[45] Fix | Delete
public function __construct( Indexable_Repository $repository, Indexable_Builder $builder ) {
[46] Fix | Delete
$this->repository = $repository;
[47] Fix | Delete
$this->builder = $builder;
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
/**
[51] Fix | Delete
* Initializes the integration.
[52] Fix | Delete
*
[53] Fix | Delete
* This is the place to register hooks and filters.
[54] Fix | Delete
*
[55] Fix | Delete
* @return void
[56] Fix | Delete
*/
[57] Fix | Delete
public function register_hooks() {
[58] Fix | Delete
\add_action( 'update_option_wpseo_titles', [ $this, 'check_option' ], 10, 2 );
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
/**
[62] Fix | Delete
* Checks if the home page indexable needs to be rebuild based on option values.
[63] Fix | Delete
*
[64] Fix | Delete
* @param array $old_value The old value of the option.
[65] Fix | Delete
* @param array $new_value The new value of the option.
[66] Fix | Delete
*
[67] Fix | Delete
* @return void
[68] Fix | Delete
*/
[69] Fix | Delete
public function check_option( $old_value, $new_value ) {
[70] Fix | Delete
foreach ( Indexable_System_Page_Builder::OPTION_MAPPING as $type => $options ) {
[71] Fix | Delete
foreach ( $options as $option ) {
[72] Fix | Delete
// If both values aren't set they haven't changed.
[73] Fix | Delete
if ( ! isset( $old_value[ $option ] ) && ! isset( $new_value[ $option ] ) ) {
[74] Fix | Delete
return;
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
// If the value was set but now isn't, is set but wasn't or is not the same it has changed.
[78] Fix | Delete
if (
[79] Fix | Delete
! isset( $old_value[ $option ] )
[80] Fix | Delete
|| ! isset( $new_value[ $option ] )
[81] Fix | Delete
|| $old_value[ $option ] !== $new_value[ $option ]
[82] Fix | Delete
) {
[83] Fix | Delete
$this->build_indexable( $type );
[84] Fix | Delete
}
[85] Fix | Delete
}
[86] Fix | Delete
}
[87] Fix | Delete
}
[88] Fix | Delete
[89] Fix | Delete
/**
[90] Fix | Delete
* Saves the search result.
[91] Fix | Delete
*
[92] Fix | Delete
* @param string $type The type of no index page.
[93] Fix | Delete
*
[94] Fix | Delete
* @return void
[95] Fix | Delete
*/
[96] Fix | Delete
public function build_indexable( $type ) {
[97] Fix | Delete
$indexable = $this->repository->find_for_system_page( $type, false );
[98] Fix | Delete
$this->builder->build_for_system_page( $type, $indexable );
[99] Fix | Delete
}
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function