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/analytic.../applicat...
File: to-be-cleaned-indexables-collector.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Analytics\Application;
[2] Fix | Delete
[3] Fix | Delete
use WPSEO_Collection;
[4] Fix | Delete
use Yoast\WP\SEO\Analytics\Domain\To_Be_Cleaned_Indexable_Bucket;
[5] Fix | Delete
use Yoast\WP\SEO\Analytics\Domain\To_Be_Cleaned_Indexable_Count;
[6] Fix | Delete
use Yoast\WP\SEO\Repositories\Indexable_Cleanup_Repository;
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* Collects data about to-be-cleaned indexables.
[10] Fix | Delete
*
[11] Fix | Delete
* @makePublic
[12] Fix | Delete
*/
[13] Fix | Delete
class To_Be_Cleaned_Indexables_Collector implements WPSEO_Collection {
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* The cleanup query repository.
[17] Fix | Delete
*
[18] Fix | Delete
* @var Indexable_Cleanup_Repository
[19] Fix | Delete
*/
[20] Fix | Delete
private $indexable_cleanup_repository;
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* The constructor.
[24] Fix | Delete
*
[25] Fix | Delete
* @param Indexable_Cleanup_Repository $indexable_cleanup_repository The Indexable cleanup repository.
[26] Fix | Delete
*/
[27] Fix | Delete
public function __construct( Indexable_Cleanup_Repository $indexable_cleanup_repository ) {
[28] Fix | Delete
$this->indexable_cleanup_repository = $indexable_cleanup_repository;
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
/**
[32] Fix | Delete
* Gets the data for the collector.
[33] Fix | Delete
*
[34] Fix | Delete
* @return array
[35] Fix | Delete
*/
[36] Fix | Delete
public function get() {
[37] Fix | Delete
$to_be_cleaned_indexable_bucket = new To_Be_Cleaned_Indexable_Bucket();
[38] Fix | Delete
$cleanup_tasks = [
[39] Fix | Delete
'indexables_with_post_object_type_and_shop_order_object_sub_type' => $this->indexable_cleanup_repository->count_indexables_with_object_type_and_object_sub_type( 'post', 'shop_order' ),
[40] Fix | Delete
'indexables_with_auto-draft_post_status' => $this->indexable_cleanup_repository->count_indexables_with_post_status( 'auto-draft' ),
[41] Fix | Delete
'indexables_for_non_publicly_viewable_post' => $this->indexable_cleanup_repository->count_indexables_for_non_publicly_viewable_post(),
[42] Fix | Delete
'indexables_for_non_publicly_viewable_taxonomies' => $this->indexable_cleanup_repository->count_indexables_for_non_publicly_viewable_taxonomies(),
[43] Fix | Delete
'indexables_for_non_publicly_viewable_post_type_archive_pages' => $this->indexable_cleanup_repository->count_indexables_for_non_publicly_post_type_archive_pages(),
[44] Fix | Delete
'indexables_for_authors_archive_disabled' => $this->indexable_cleanup_repository->count_indexables_for_authors_archive_disabled(),
[45] Fix | Delete
'indexables_for_authors_without_archive' => $this->indexable_cleanup_repository->count_indexables_for_authors_without_archive(),
[46] Fix | Delete
'indexables_for_object_type_and_source_table_users' => $this->indexable_cleanup_repository->count_indexables_for_orphaned_users(),
[47] Fix | Delete
'indexables_for_object_type_and_source_table_posts' => $this->indexable_cleanup_repository->count_indexables_for_object_type_and_source_table( 'posts', 'ID', 'post' ),
[48] Fix | Delete
'indexables_for_object_type_and_source_table_terms' => $this->indexable_cleanup_repository->count_indexables_for_object_type_and_source_table( 'terms', 'term_id', 'term' ),
[49] Fix | Delete
'orphaned_from_table_indexable_hierarchy' => $this->indexable_cleanup_repository->count_orphaned_from_table( 'Indexable_Hierarchy', 'indexable_id' ),
[50] Fix | Delete
'orphaned_from_table_indexable_id' => $this->indexable_cleanup_repository->count_orphaned_from_table( 'SEO_Links', 'indexable_id' ),
[51] Fix | Delete
'orphaned_from_table_target_indexable_id' => $this->indexable_cleanup_repository->count_orphaned_from_table( 'SEO_Links', 'target_indexable_id' ),
[52] Fix | Delete
];
[53] Fix | Delete
[54] Fix | Delete
foreach ( $cleanup_tasks as $name => $count ) {
[55] Fix | Delete
if ( $count !== null ) {
[56] Fix | Delete
$count_object = new To_Be_Cleaned_Indexable_Count( $name, $count );
[57] Fix | Delete
$to_be_cleaned_indexable_bucket->add_to_be_cleaned_indexable_count( $count_object );
[58] Fix | Delete
}
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
$this->add_additional_counts( $to_be_cleaned_indexable_bucket );
[62] Fix | Delete
[63] Fix | Delete
return [ 'to_be_cleaned_indexables' => $to_be_cleaned_indexable_bucket->to_array() ];
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
/**
[67] Fix | Delete
* Allows additional tasks to be added via the 'wpseo_add_cleanup_counts_to_indexable_bucket' action.
[68] Fix | Delete
*
[69] Fix | Delete
* @param To_Be_Cleaned_Indexable_Bucket $to_be_cleaned_indexable_bucket The current bucket with data.
[70] Fix | Delete
*
[71] Fix | Delete
* @return void
[72] Fix | Delete
*/
[73] Fix | Delete
private function add_additional_counts( $to_be_cleaned_indexable_bucket ) {
[74] Fix | Delete
/**
[75] Fix | Delete
* Action: Adds the possibility to add additional to be cleaned objects.
[76] Fix | Delete
*
[77] Fix | Delete
* @internal
[78] Fix | Delete
* @param To_Be_Cleaned_Indexable_Bucket $bucket An indexable cleanup bucket. New values are instances of To_Be_Cleaned_Indexable_Count.
[79] Fix | Delete
*/
[80] Fix | Delete
\do_action( 'wpseo_add_cleanup_counts_to_indexable_bucket', $to_be_cleaned_indexable_bucket );
[81] Fix | Delete
}
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function