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.../inc/sitemaps
File: class-sitemaps-admin.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WPSEO plugin file.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WPSEO\Admin\XML Sitemaps
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Class that handles the Admin side of XML sitemaps.
[8] Fix | Delete
*/
[9] Fix | Delete
class WPSEO_Sitemaps_Admin {
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* Post_types that are being imported.
[13] Fix | Delete
*
[14] Fix | Delete
* @var array
[15] Fix | Delete
*/
[16] Fix | Delete
private $importing_post_types = [];
[17] Fix | Delete
[18] Fix | Delete
/**
[19] Fix | Delete
* Class constructor.
[20] Fix | Delete
*/
[21] Fix | Delete
public function __construct() {
[22] Fix | Delete
add_action( 'transition_post_status', [ $this, 'status_transition' ], 10, 3 );
[23] Fix | Delete
add_action( 'admin_footer', [ $this, 'status_transition_bulk_finished' ] );
[24] Fix | Delete
[25] Fix | Delete
WPSEO_Sitemaps_Cache::register_clear_on_option_update( 'wpseo_titles', '' );
[26] Fix | Delete
WPSEO_Sitemaps_Cache::register_clear_on_option_update( 'wpseo', '' );
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
/**
[30] Fix | Delete
* Hooked into transition_post_status. Will initiate search engine pings
[31] Fix | Delete
* if the post is being published, is a post type that a sitemap is built for
[32] Fix | Delete
* and is a post that is included in sitemaps.
[33] Fix | Delete
*
[34] Fix | Delete
* @param string $new_status New post status.
[35] Fix | Delete
* @param string $old_status Old post status.
[36] Fix | Delete
* @param WP_Post $post Post object.
[37] Fix | Delete
*
[38] Fix | Delete
* @return void
[39] Fix | Delete
*/
[40] Fix | Delete
public function status_transition( $new_status, $old_status, $post ) {
[41] Fix | Delete
if ( $new_status !== 'publish' ) {
[42] Fix | Delete
return;
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
if ( defined( 'WP_IMPORTING' ) ) {
[46] Fix | Delete
$this->status_transition_bulk( $new_status, $old_status, $post );
[47] Fix | Delete
[48] Fix | Delete
return;
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
$post_type = get_post_type( $post );
[52] Fix | Delete
[53] Fix | Delete
wp_cache_delete( 'lastpostmodified:gmt:' . $post_type, 'timeinfo' ); // #17455.
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
/**
[57] Fix | Delete
* Notify Google of the updated sitemap.
[58] Fix | Delete
*
[59] Fix | Delete
* @deprecated 22.0
[60] Fix | Delete
* @codeCoverageIgnore
[61] Fix | Delete
*
[62] Fix | Delete
* @return void
[63] Fix | Delete
*/
[64] Fix | Delete
public function ping_search_engines() {
[65] Fix | Delete
_deprecated_function( __METHOD__, 'Yoast SEO 22.0' );
[66] Fix | Delete
}
[67] Fix | Delete
[68] Fix | Delete
/**
[69] Fix | Delete
* While bulk importing, just save unique post_types.
[70] Fix | Delete
*
[71] Fix | Delete
* When importing is done, if we have a post_type that is saved in the sitemap
[72] Fix | Delete
* try to ping the search engines.
[73] Fix | Delete
*
[74] Fix | Delete
* @param string $new_status New post status.
[75] Fix | Delete
* @param string $old_status Old post status.
[76] Fix | Delete
* @param WP_Post $post Post object.
[77] Fix | Delete
*
[78] Fix | Delete
* @return void
[79] Fix | Delete
*/
[80] Fix | Delete
private function status_transition_bulk( $new_status, $old_status, $post ) {
[81] Fix | Delete
$this->importing_post_types[] = get_post_type( $post );
[82] Fix | Delete
$this->importing_post_types = array_unique( $this->importing_post_types );
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
/**
[86] Fix | Delete
* After import finished, walk through imported post_types and update info.
[87] Fix | Delete
*
[88] Fix | Delete
* @return void
[89] Fix | Delete
*/
[90] Fix | Delete
public function status_transition_bulk_finished() {
[91] Fix | Delete
if ( ! defined( 'WP_IMPORTING' ) ) {
[92] Fix | Delete
return;
[93] Fix | Delete
}
[94] Fix | Delete
[95] Fix | Delete
if ( empty( $this->importing_post_types ) ) {
[96] Fix | Delete
return;
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
$ping_search_engines = false;
[100] Fix | Delete
[101] Fix | Delete
foreach ( $this->importing_post_types as $post_type ) {
[102] Fix | Delete
wp_cache_delete( 'lastpostmodified:gmt:' . $post_type, 'timeinfo' ); // #17455.
[103] Fix | Delete
[104] Fix | Delete
// Just have the cache deleted for nav_menu_item.
[105] Fix | Delete
if ( $post_type === 'nav_menu_item' ) {
[106] Fix | Delete
continue;
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
if ( WPSEO_Options::get( 'noindex-' . $post_type, false ) === false ) {
[110] Fix | Delete
$ping_search_engines = true;
[111] Fix | Delete
}
[112] Fix | Delete
}
[113] Fix | Delete
[114] Fix | Delete
// Nothing to do.
[115] Fix | Delete
if ( $ping_search_engines === false ) {
[116] Fix | Delete
return;
[117] Fix | Delete
}
[118] Fix | Delete
[119] Fix | Delete
if ( WP_CACHE ) {
[120] Fix | Delete
do_action( 'wpseo_hit_sitemap_index' );
[121] Fix | Delete
}
[122] Fix | Delete
}
[123] Fix | Delete
}
[124] Fix | Delete
[125] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function