'example.com',
* 2 => 'example.org',
* );
*
* Then '%1$s' in the format string will substitute 'example.com'
* and '%2$s' will substitute 'example.org'.
*
* @access private
* @since 4.8.0
* @link https://php.net/manual/en/function.vsprintf.php Format string documentation.
*
* @param string $format A vsprintf-style format string to be sanitized.
* @param array $url_array The string substitution array to be passed to vsprintf.
*
* @return string The sanitized string.
*/
private static function sanitize_with_links( $format, $url_array ) {
return vsprintf(
wp_kses(
ent2ncr( $format ),
array(
'a' => array(
'href' => true,
'title' => true,
),
)
),
$url_array
);
}
/**
* Returns the xsl of a sitemap xml file as a string.
*
* @access public
* @since 4.8.0
*
* @return string The contents of the xsl file.
*/
public static function sitemap_xsl() {
$title = esc_html( ent2ncr( __( 'XML Sitemap', 'jetpack' ) ) );
$header_url = esc_html( ent2ncr( __( 'URL', 'jetpack' ) ) );
$header_lastmod = esc_html( ent2ncr( __( 'Last Modified', 'jetpack' ) ) );
$description = self::sanitize_with_links(
__(
'This is an XML Sitemap generated by Jetpack, meant to be consumed by search engines like Google or Bing.',
'jetpack'
),
array(
1 => 'https://jetpack.com/',
2 => 'https://www.google.com/',
3 => 'https://www.bing.com/',
)
);
$more_info = self::sanitize_with_links(
__(
'You can find more information on XML sitemaps at sitemaps.org',
'jetpack'
),
array(
1 => 'https://sitemaps.org',
)
);
$generated_by = self::sanitize_with_links(
__(
'Generated by Jetpack for WordPress',
'jetpack'
),
array(
1 => 'https://jetpack.com',
)
);
$css = self::sitemap_xsl_css();
return <<
$title
$title
$description
$more_info
# |
$header_url |
$header_lastmod |
odd
|
|
|
\n
XSL;
}
/**
* Returns the xsl of a sitemap index xml file as a string.
*
* @access public
* @since 4.8.0
*
* @return string The contents of the xsl file.
*/
public static function sitemap_index_xsl() {
$title = esc_html( ent2ncr( __( 'XML Sitemap Index', 'jetpack' ) ) );
$header_url = esc_html( ent2ncr( __( 'Sitemap URL', 'jetpack' ) ) );
$header_lastmod = esc_html( ent2ncr( __( 'Last Modified', 'jetpack' ) ) );
$description = self::sanitize_with_links(
__(
'This is an XML Sitemap Index generated by Jetpack, meant to be consumed by search engines like Google or Bing.',
'jetpack'
),
array(
1 => 'https://jetpack.com/',
2 => 'https://www.google.com/',
3 => 'https://www.bing.com/',
)
);
if ( current_user_can( 'manage_options' ) ) {
$next = human_time_diff( wp_next_scheduled( 'jp_sitemap_cron_hook' ) );
/* translators: %s is a human_time_diff until next sitemap generation. */
$no_nodes_warning = sprintf( __( 'No sitemap found. The system will try to build it again in %s.', 'jetpack' ), $next );
} else {
$no_nodes_warning = '';
}
$more_info = self::sanitize_with_links(
__(
'You can find more information on XML sitemaps at sitemaps.org',
'jetpack'
),
array(
1 => 'https://sitemaps.org',
)
);
$generated_by = self::sanitize_with_links(
__(
'Generated by Jetpack for WordPress',
'jetpack'
),
array(
1 => 'https://jetpack.com',
)
);
$css = self::sitemap_xsl_css();
return <<
$title
$title
$no_nodes_warning
$description
$more_info
# |
$header_url |
$header_lastmod |
odd
|
|
|
\n
XSL;
}
/**
* Returns the xsl of an image sitemap xml file as a string.
*
* @access public
* @since 4.8.0
*
* @return string The contents of the xsl file.
*/
public static function image_sitemap_xsl() {
$title = esc_html( ent2ncr( __( 'XML Image Sitemap', 'jetpack' ) ) );
$header_url = esc_html( ent2ncr( __( 'Page URL', 'jetpack' ) ) );
$header_image_url = esc_html( ent2ncr( __( 'Image URL', 'jetpack' ) ) );
$header_thumbnail = esc_html( ent2ncr( __( 'Thumbnail', 'jetpack' ) ) );
$header_title = esc_html( ent2ncr( __( 'Title', 'jetpack' ) ) );
$header_lastmod = esc_html( ent2ncr( __( 'Last Modified', 'jetpack' ) ) );
$header_caption = esc_html( ent2ncr( __( 'Caption', 'jetpack' ) ) );
$description = self::sanitize_with_links(
__(
'This is an XML Image Sitemap generated by Jetpack, meant to be consumed by search engines like Google or Bing.',
'jetpack'
),
array(
1 => 'https://jetpack.com/',
2 => 'https://www.google.com/',
3 => 'https://www.bing.com/',
)
);
$more_info = self::sanitize_with_links(
__(
'You can find more information on XML sitemaps at sitemaps.org',
'jetpack'
),
array(
1 => 'https://sitemaps.org',
)
);
$generated_by = self::sanitize_with_links(
__(
'Generated by Jetpack for WordPress',
'jetpack'
),
array(
1 => 'https://jetpack.com',
)
);
$css = self::sitemap_xsl_css();
return <<
$title
$title
$description
$more_info
# |
$header_url |
$header_image_url |
$header_title |
$header_caption |
$header_lastmod |
$header_thumbnail |
odd
|
|
|
|
|
|
|
\n
XSL;
}
/**
* Returns the xsl of a video sitemap xml file as a string.
*
* @access public
* @since 4.8.0
*
* @return string The contents of the xsl file.
*/
public static function video_sitemap_xsl() {
$title = esc_html( ent2ncr( __( 'XML Video Sitemap', 'jetpack' ) ) );
$header_url = esc_html( ent2ncr( __( 'Page URL', 'jetpack' ) ) );
$header_image_url = esc_html( ent2ncr( __( 'Video URL', 'jetpack' ) ) );
$header_thumbnail = esc_html( ent2ncr( __( 'Thumbnail', 'jetpack' ) ) );
$header_title = esc_html( ent2ncr( __( 'Title', 'jetpack' ) ) );
$header_lastmod = esc_html( ent2ncr( __( 'Last Modified', 'jetpack' ) ) );
$header_description = esc_html( ent2ncr( __( 'Description', 'jetpack' ) ) );
$description = self::sanitize_with_links(
__(
'This is an XML Video Sitemap generated by Jetpack, meant to be consumed by search engines like Google or Bing.',
'jetpack'
),
array(
1 => 'https://jetpack.com/',
2 => 'https://www.google.com/',
3 => 'https://www.bing.com/',
)
);
$more_info = self::sanitize_with_links(
__(
'You can find more information on XML sitemaps at sitemaps.org',
'jetpack'
),
array(
1 => 'https://sitemaps.org',
)
);
$generated_by = self::sanitize_with_links(
__(
'Generated by Jetpack for WordPress',
'jetpack'
),
array(
1 => 'https://jetpack.com',
)
);
$css = self::sitemap_xsl_css();
return <<
$title
$title
$description
$more_info
# |
$header_url |
$header_image_url |
$header_title |
$header_description |
$header_lastmod |
$header_thumbnail |
odd
|
|
|
|
|
|
|
\n
XSL;
}
/**
* Returns the xsl of a news sitemap xml file as a string.
*
* @access public
* @since 4.8.0
*
* @return string The contents of the xsl file.
*/
public static function news_sitemap_xsl() {
$title = esc_html( ent2ncr( __( 'XML News Sitemap', 'jetpack' ) ) );
$header_url = esc_html( ent2ncr( __( 'Page URL', 'jetpack' ) ) );
$header_title = esc_html( ent2ncr( __( 'Title', 'jetpack' ) ) );
$header_pubdate = esc_html( ent2ncr( __( 'Publication Date', 'jetpack' ) ) );
$description = self::sanitize_with_links(
__(
'This is an XML News Sitemap generated by Jetpack, meant to be consumed by search engines like Google or Bing.',
'jetpack'
),
array(
1 => 'https://jetpack.com/',
2 => 'https://www.google.com/',
3 => 'https://www.bing.com/',
)
);
$more_info = self::sanitize_with_links(
__(
'You can find more information on XML sitemaps at sitemaps.org',
'jetpack'
),
array(
1 => 'https://sitemaps.org',
)
);
$generated_by = self::sanitize_with_links(
__(
'Generated by Jetpack for WordPress',
'jetpack'
),
array(
1 => 'https://jetpack.com',
)
);
$css = self::sitemap_xsl_css();
return <<
$title
$title
$description
$more_info
# |
$header_url |
$header_title |
$header_pubdate |
odd
|
|
|
|
\n
XSL;
}
/**
* The CSS to be included in sitemap xsl stylesheets;
* factored out for uniformity.
*
* @access public
* @since 4.8.0
*
* @return string The CSS.
*/
public static function sitemap_xsl_css() {
return <<