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.../src/integrat.../watchers
File: indexable-date-archive-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\Conditionals\Migrations_Conditional;
[5] Fix | Delete
use Yoast\WP\SEO\Integrations\Integration_Interface;
[6] Fix | Delete
use Yoast\WP\SEO\Repositories\Indexable_Repository;
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* Date archive watcher to save the meta data to an indexable.
[10] Fix | Delete
*
[11] Fix | Delete
* Watches the date archive options to save the meta information when updated.
[12] Fix | Delete
*/
[13] Fix | Delete
class Indexable_Date_Archive_Watcher implements Integration_Interface {
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* The indexable repository.
[17] Fix | Delete
*
[18] Fix | Delete
* @var Indexable_Repository
[19] Fix | Delete
*/
[20] Fix | Delete
protected $repository;
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* The indexable builder.
[24] Fix | Delete
*
[25] Fix | Delete
* @var Indexable_Builder
[26] Fix | Delete
*/
[27] Fix | Delete
protected $builder;
[28] Fix | Delete
[29] Fix | Delete
/**
[30] Fix | Delete
* Returns the conditionals based on which this loadable should be active.
[31] Fix | Delete
*
[32] Fix | Delete
* @return array
[33] Fix | Delete
*/
[34] Fix | Delete
public static function get_conditionals() {
[35] Fix | Delete
return [ Migrations_Conditional::class ];
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
/**
[39] Fix | Delete
* Indexable_Date_Archive_Watcher constructor.
[40] Fix | Delete
*
[41] Fix | Delete
* @param Indexable_Repository $repository The repository to use.
[42] Fix | Delete
* @param Indexable_Builder $builder The date archive builder to use.
[43] Fix | Delete
*/
[44] Fix | Delete
public function __construct( Indexable_Repository $repository, Indexable_Builder $builder ) {
[45] Fix | Delete
$this->repository = $repository;
[46] Fix | Delete
$this->builder = $builder;
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
/**
[50] Fix | Delete
* Initializes the integration.
[51] Fix | Delete
*
[52] Fix | Delete
* This is the place to register hooks and filters.
[53] Fix | Delete
*
[54] Fix | Delete
* @return void
[55] Fix | Delete
*/
[56] Fix | Delete
public function register_hooks() {
[57] Fix | Delete
\add_action( 'update_option_wpseo_titles', [ $this, 'check_option' ], 10, 2 );
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
/**
[61] Fix | Delete
* Checks if the date archive indexable needs to be rebuild based on option values.
[62] Fix | Delete
*
[63] Fix | Delete
* @param array $old_value The old value of the option.
[64] Fix | Delete
* @param array $new_value The new value of the option.
[65] Fix | Delete
*
[66] Fix | Delete
* @return void
[67] Fix | Delete
*/
[68] Fix | Delete
public function check_option( $old_value, $new_value ) {
[69] Fix | Delete
$relevant_keys = [ 'title-archive-wpseo', 'breadcrumbs-archiveprefix', 'metadesc-archive-wpseo', 'noindex-archive-wpseo' ];
[70] Fix | Delete
[71] Fix | Delete
foreach ( $relevant_keys as $key ) {
[72] Fix | Delete
// If both values aren't set they haven't changed.
[73] Fix | Delete
if ( ! isset( $old_value[ $key ] ) && ! isset( $new_value[ $key ] ) ) {
[74] Fix | Delete
continue;
[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 ( ! isset( $old_value[ $key ] ) || ! isset( $new_value[ $key ] ) || $old_value[ $key ] !== $new_value[ $key ] ) {
[79] Fix | Delete
$this->build_indexable();
[80] Fix | Delete
return;
[81] Fix | Delete
}
[82] Fix | Delete
}
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
/**
[86] Fix | Delete
* Saves the date archive.
[87] Fix | Delete
*
[88] Fix | Delete
* @return void
[89] Fix | Delete
*/
[90] Fix | Delete
public function build_indexable() {
[91] Fix | Delete
$indexable = $this->repository->find_for_date_archive( false );
[92] Fix | Delete
$this->builder->build_for_date_archive( $indexable );
[93] Fix | Delete
}
[94] Fix | Delete
}
[95] Fix | Delete
[96] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function