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

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wordpres.../inc/sitemaps
File: class-sitemaps.php
*
[500] Fix | Delete
* @return string|array|false
[501] Fix | Delete
*/
[502] Fix | Delete
public static function get_last_modified_gmt( $post_types, $return_all = false ) {
[503] Fix | Delete
[504] Fix | Delete
global $wpdb;
[505] Fix | Delete
[506] Fix | Delete
static $post_type_dates = null;
[507] Fix | Delete
[508] Fix | Delete
if ( ! is_array( $post_types ) ) {
[509] Fix | Delete
$post_types = [ $post_types ];
[510] Fix | Delete
}
[511] Fix | Delete
[512] Fix | Delete
foreach ( $post_types as $post_type ) {
[513] Fix | Delete
if ( ! isset( $post_type_dates[ $post_type ] ) ) { // If we hadn't seen post type before. R.
[514] Fix | Delete
$post_type_dates = null;
[515] Fix | Delete
break;
[516] Fix | Delete
}
[517] Fix | Delete
}
[518] Fix | Delete
[519] Fix | Delete
if ( is_null( $post_type_dates ) ) {
[520] Fix | Delete
[521] Fix | Delete
$post_type_dates = [];
[522] Fix | Delete
$post_type_names = WPSEO_Post_Type::get_accessible_post_types();
[523] Fix | Delete
[524] Fix | Delete
if ( ! empty( $post_type_names ) ) {
[525] Fix | Delete
$post_statuses = array_map( 'esc_sql', self::get_post_statuses() );
[526] Fix | Delete
$replacements = array_merge(
[527] Fix | Delete
[
[528] Fix | Delete
'post_type',
[529] Fix | Delete
'post_modified_gmt',
[530] Fix | Delete
'date',
[531] Fix | Delete
$wpdb->posts,
[532] Fix | Delete
'post_status',
[533] Fix | Delete
],
[534] Fix | Delete
$post_statuses,
[535] Fix | Delete
[ 'post_type' ],
[536] Fix | Delete
array_keys( $post_type_names ),
[537] Fix | Delete
[
[538] Fix | Delete
'post_type',
[539] Fix | Delete
'date',
[540] Fix | Delete
]
[541] Fix | Delete
);
[542] Fix | Delete
[543] Fix | Delete
//phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- We need to use a direct query here.
[544] Fix | Delete
//phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
[545] Fix | Delete
$dates = $wpdb->get_results(
[546] Fix | Delete
//phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized.
[547] Fix | Delete
$wpdb->prepare(
[548] Fix | Delete
'
[549] Fix | Delete
SELECT %i, MAX(%i) AS %i
[550] Fix | Delete
FROM %i
[551] Fix | Delete
WHERE %i IN (' . implode( ', ', array_fill( 0, count( $post_statuses ), '%s' ) ) . ')
[552] Fix | Delete
AND %i IN (' . implode( ', ', array_fill( 0, count( $post_type_names ), '%s' ) ) . ')
[553] Fix | Delete
GROUP BY %i
[554] Fix | Delete
ORDER BY %i DESC
[555] Fix | Delete
',
[556] Fix | Delete
$replacements
[557] Fix | Delete
)
[558] Fix | Delete
);
[559] Fix | Delete
[560] Fix | Delete
foreach ( $dates as $obj ) {
[561] Fix | Delete
$post_type_dates[ $obj->post_type ] = $obj->date;
[562] Fix | Delete
}
[563] Fix | Delete
}
[564] Fix | Delete
}
[565] Fix | Delete
[566] Fix | Delete
$dates = array_intersect_key( $post_type_dates, array_flip( $post_types ) );
[567] Fix | Delete
[568] Fix | Delete
if ( count( $dates ) > 0 ) {
[569] Fix | Delete
if ( $return_all ) {
[570] Fix | Delete
return $dates;
[571] Fix | Delete
}
[572] Fix | Delete
[573] Fix | Delete
return max( $dates );
[574] Fix | Delete
}
[575] Fix | Delete
[576] Fix | Delete
return false;
[577] Fix | Delete
}
[578] Fix | Delete
[579] Fix | Delete
/**
[580] Fix | Delete
* Get the modification date for the last modified post in the post type.
[581] Fix | Delete
*
[582] Fix | Delete
* @param array $post_types Post types to get the last modification date for.
[583] Fix | Delete
*
[584] Fix | Delete
* @return string
[585] Fix | Delete
*/
[586] Fix | Delete
public function get_last_modified( $post_types ) {
[587] Fix | Delete
return YoastSEO()->helpers->date->format( self::get_last_modified_gmt( $post_types ) );
[588] Fix | Delete
}
[589] Fix | Delete
[590] Fix | Delete
/**
[591] Fix | Delete
* Get the maximum number of entries per XML sitemap.
[592] Fix | Delete
*
[593] Fix | Delete
* @return int The maximum number of entries.
[594] Fix | Delete
*/
[595] Fix | Delete
protected function get_entries_per_page() {
[596] Fix | Delete
/**
[597] Fix | Delete
* Filter the maximum number of entries per XML sitemap.
[598] Fix | Delete
*
[599] Fix | Delete
* After changing the output of the filter, make sure that you disable and enable the
[600] Fix | Delete
* sitemaps to make sure the value is picked up for the sitemap cache.
[601] Fix | Delete
*
[602] Fix | Delete
* @param int $entries The maximum number of entries per XML sitemap.
[603] Fix | Delete
*/
[604] Fix | Delete
$entries = (int) apply_filters( 'wpseo_sitemap_entries_per_page', 1000 );
[605] Fix | Delete
[606] Fix | Delete
return $entries;
[607] Fix | Delete
}
[608] Fix | Delete
[609] Fix | Delete
/**
[610] Fix | Delete
* Get post statuses for post_type or the root sitemap.
[611] Fix | Delete
*
[612] Fix | Delete
* @since 10.2
[613] Fix | Delete
*
[614] Fix | Delete
* @param string $type Provide a type for a post_type sitemap, SITEMAP_INDEX_TYPE for the root sitemap.
[615] Fix | Delete
*
[616] Fix | Delete
* @return array List of post statuses.
[617] Fix | Delete
*/
[618] Fix | Delete
public static function get_post_statuses( $type = self::SITEMAP_INDEX_TYPE ) {
[619] Fix | Delete
/**
[620] Fix | Delete
* Filter post status list for sitemap query for the post type.
[621] Fix | Delete
*
[622] Fix | Delete
* @param array $post_statuses Post status list, defaults to array( 'publish' ).
[623] Fix | Delete
* @param string $type Post type or SITEMAP_INDEX_TYPE.
[624] Fix | Delete
*/
[625] Fix | Delete
$post_statuses = apply_filters( 'wpseo_sitemap_post_statuses', [ 'publish' ], $type );
[626] Fix | Delete
[627] Fix | Delete
if ( ! is_array( $post_statuses ) || empty( $post_statuses ) ) {
[628] Fix | Delete
$post_statuses = [ 'publish' ];
[629] Fix | Delete
}
[630] Fix | Delete
[631] Fix | Delete
if ( ( $type === self::SITEMAP_INDEX_TYPE || $type === 'attachment' )
[632] Fix | Delete
&& ! in_array( 'inherit', $post_statuses, true )
[633] Fix | Delete
) {
[634] Fix | Delete
$post_statuses[] = 'inherit';
[635] Fix | Delete
}
[636] Fix | Delete
[637] Fix | Delete
return $post_statuses;
[638] Fix | Delete
}
[639] Fix | Delete
[640] Fix | Delete
/**
[641] Fix | Delete
* Sends all the required HTTP Headers.
[642] Fix | Delete
*
[643] Fix | Delete
* @return void
[644] Fix | Delete
*/
[645] Fix | Delete
private function send_headers() {
[646] Fix | Delete
if ( headers_sent() ) {
[647] Fix | Delete
return;
[648] Fix | Delete
}
[649] Fix | Delete
[650] Fix | Delete
$headers = [
[651] Fix | Delete
$this->http_protocol . ' 200 OK' => 200,
[652] Fix | Delete
// Prevent the search engines from indexing the XML Sitemap.
[653] Fix | Delete
'X-Robots-Tag: noindex, follow' => '',
[654] Fix | Delete
'Content-Type: text/xml; charset=' . esc_attr( $this->renderer->get_output_charset() ) => '',
[655] Fix | Delete
];
[656] Fix | Delete
[657] Fix | Delete
/**
[658] Fix | Delete
* Filter the HTTP headers we send before an XML sitemap.
[659] Fix | Delete
*
[660] Fix | Delete
* @param array $headers The HTTP headers we're going to send out.
[661] Fix | Delete
*/
[662] Fix | Delete
$headers = apply_filters( 'wpseo_sitemap_http_headers', $headers );
[663] Fix | Delete
[664] Fix | Delete
foreach ( $headers as $header => $status ) {
[665] Fix | Delete
if ( is_numeric( $status ) ) {
[666] Fix | Delete
header( $header, true, $status );
[667] Fix | Delete
continue;
[668] Fix | Delete
}
[669] Fix | Delete
header( $header, true );
[670] Fix | Delete
}
[671] Fix | Delete
}
[672] Fix | Delete
}
[673] Fix | Delete
[674] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function