diff options
Diffstat (limited to 'plugins/jetpack/modules/sitemaps')
-rw-r--r-- | plugins/jetpack/modules/sitemaps/sitemap-builder.php | 12 | ||||
-rw-r--r-- | plugins/jetpack/modules/sitemaps/sitemap-constants.php | 22 | ||||
-rw-r--r-- | plugins/jetpack/modules/sitemaps/sitemap-stylist.php | 26 | ||||
-rw-r--r-- | plugins/jetpack/modules/sitemaps/sitemaps.php | 40 |
4 files changed, 69 insertions, 31 deletions
diff --git a/plugins/jetpack/modules/sitemaps/sitemap-builder.php b/plugins/jetpack/modules/sitemaps/sitemap-builder.php index e04f58d5..d6077c0f 100644 --- a/plugins/jetpack/modules/sitemaps/sitemap-builder.php +++ b/plugins/jetpack/modules/sitemaps/sitemap-builder.php @@ -998,7 +998,7 @@ class Jetpack_Sitemap_Builder { /** * Construct the sitemap index url entry for a sitemap row. * - * @link http://www.sitemaps.org/protocol.html#sitemapIndex_sitemap + * @link https://www.sitemaps.org/protocol.html#sitemapIndex_sitemap * * @access private * @since 4.8.0 @@ -1104,7 +1104,7 @@ class Jetpack_Sitemap_Builder { /** * Construct the sitemap url entry for a WP_Post. * - * @link http://www.sitemaps.org/protocol.html#urldef + * @link https://www.sitemaps.org/protocol.html#urldef * @access private * @since 4.8.0 * @@ -1182,7 +1182,7 @@ class Jetpack_Sitemap_Builder { /** * Construct the image sitemap url entry for a WP_Post of image type. * - * @link http://www.sitemaps.org/protocol.html#urldef + * @link https://www.sitemaps.org/protocol.html#urldef * * @access private * @since 4.8.0 @@ -1267,7 +1267,7 @@ class Jetpack_Sitemap_Builder { /** * Construct the video sitemap url entry for a WP_Post of video type. * - * @link http://www.sitemaps.org/protocol.html#urldef + * @link https://www.sitemaps.org/protocol.html#urldef * @link https://developers.google.com/webmasters/videosearch/sitemaps * * @access private @@ -1377,7 +1377,7 @@ class Jetpack_Sitemap_Builder { /** * Construct the news sitemap url entry for a WP_Post. * - * @link http://www.sitemaps.org/protocol.html#urldef + * @link https://www.sitemaps.org/protocol.html#urldef * * @access private * @since 4.8.0 @@ -1417,7 +1417,7 @@ class Jetpack_Sitemap_Builder { /* * Trim the locale to an ISO 639 language code as required by Google. * Special cases are zh-cn (Simplified Chinese) and zh-tw (Traditional Chinese). - * @link http://www.loc.gov/standards/iso639-2/php/code_list.php + * @link https://www.loc.gov/standards/iso639-2/php/code_list.php */ $language = strtolower( get_locale() ); diff --git a/plugins/jetpack/modules/sitemaps/sitemap-constants.php b/plugins/jetpack/modules/sitemaps/sitemap-constants.php index e91a3341..ed0ccad0 100644 --- a/plugins/jetpack/modules/sitemaps/sitemap-constants.php +++ b/plugins/jetpack/modules/sitemaps/sitemap-constants.php @@ -8,10 +8,26 @@ */ /** + * Number of seconds between sitemap and news sitemap updates in development code. + * In production, sitemaps are cached for 12 hours. + * In development, sitemaps are cache for 1 minute. + * + * @since 7.7.0 + */ +if ( defined( 'JETPACK_DEV_DEBUG' ) && JETPACK_DEV_DEBUG ) { + if ( ! defined( 'JP_SITEMAP_INTERVAL') ) { + define( 'JP_SITEMAP_INTERVAL', 60 ); + } + if ( ! defined( 'JP_NEWS_SITEMAP_INTERVAL') ) { + define( 'JP_NEWS_SITEMAP_INTERVAL', 60 ); + } +} + +/** * Maximum size (in bytes) of a sitemap xml file. * Max is 716800 = 700kb to avoid potential failures for default memcached limits (1MB) * - * @link http://www.sitemaps.org/ + * @link https://www.sitemaps.org/ * @since 4.8.0 */ if ( ! defined( 'JP_SITEMAP_MAX_BYTES' ) ) { @@ -22,7 +38,7 @@ if ( ! defined( 'JP_SITEMAP_MAX_BYTES' ) ) { * Maximum size (in url nodes) of a sitemap xml file. * Per the spec, max value is 50000. * - * @link http://www.sitemaps.org/ + * @link https://www.sitemaps.org/ * @since 4.8.0 */ if ( ! defined( 'JP_SITEMAP_MAX_ITEMS' ) ) { @@ -77,7 +93,7 @@ if ( ! defined( 'JP_SITEMAP_LOCK_INTERVAL' ) ) { } /** - * Cache lifetime of news sitemap (in seconds). + * Number of seconds between news sitemap updates. * * @since 4.8.0 */ diff --git a/plugins/jetpack/modules/sitemaps/sitemap-stylist.php b/plugins/jetpack/modules/sitemaps/sitemap-stylist.php index ce883d7f..117e9bf5 100644 --- a/plugins/jetpack/modules/sitemaps/sitemap-stylist.php +++ b/plugins/jetpack/modules/sitemaps/sitemap-stylist.php @@ -33,7 +33,7 @@ class Jetpack_Sitemap_Stylist { * * @access private * @since 4.8.0 - * @link http://php.net/manual/en/function.vsprintf.php Format string documentation. + * @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. @@ -74,7 +74,7 @@ class Jetpack_Sitemap_Stylist { 'jetpack' ), array( - 1 => 'http://jetpack.com/', + 1 => 'https://jetpack.com/', 2 => 'https://www.google.com/', 3 => 'https://www.bing.com/', ) @@ -86,7 +86,7 @@ class Jetpack_Sitemap_Stylist { 'jetpack' ), array( - 1 => 'http://sitemaps.org', + 1 => 'https://sitemaps.org', ) ); @@ -186,7 +186,7 @@ XSL; 'jetpack' ), array( - 1 => 'http://jetpack.com/', + 1 => 'https://jetpack.com/', 2 => 'https://www.google.com/', 3 => 'https://www.bing.com/', ) @@ -206,7 +206,7 @@ XSL; 'jetpack' ), array( - 1 => 'http://sitemaps.org', + 1 => 'https://sitemaps.org', ) ); @@ -314,7 +314,7 @@ XSL; 'jetpack' ), array( - 1 => 'http://jetpack.com/', + 1 => 'https://jetpack.com/', 2 => 'https://www.google.com/', 3 => 'https://www.bing.com/', ) @@ -326,7 +326,7 @@ XSL; 'jetpack' ), array( - 1 => 'http://sitemaps.org', + 1 => 'https://sitemaps.org', ) ); @@ -454,7 +454,7 @@ XSL; 'jetpack' ), array( - 1 => 'http://jetpack.com/', + 1 => 'https://jetpack.com/', 2 => 'https://www.google.com/', 3 => 'https://www.bing.com/', ) @@ -466,7 +466,7 @@ XSL; 'jetpack' ), array( - 1 => 'http://sitemaps.org', + 1 => 'https://sitemaps.org', ) ); @@ -547,7 +547,7 @@ $css <xsl:value-of select='video:video/video:title'/> </td> <td> - <xsl:value-of select='video:video/video:description'/> + <xsl:value-of select='video:video/video:description' disable-output-escaping='yes'/> </td> <td> <xsl:value-of select='sitemap:lastmod'/> @@ -594,7 +594,7 @@ XSL; 'jetpack' ), array( - 1 => 'http://jetpack.com/', + 1 => 'https://jetpack.com/', 2 => 'https://www.google.com/', 3 => 'https://www.bing.com/', ) @@ -606,7 +606,7 @@ XSL; 'jetpack' ), array( - 1 => 'http://sitemaps.org', + 1 => 'https://sitemaps.org', ) ); @@ -773,7 +773,7 @@ XSL; border-bottom: none; } - img.thumbnail { + img { max-height: 100px; max-width: 100px; } diff --git a/plugins/jetpack/modules/sitemaps/sitemaps.php b/plugins/jetpack/modules/sitemaps/sitemaps.php index 7078fb8a..9fcd0529 100644 --- a/plugins/jetpack/modules/sitemaps/sitemaps.php +++ b/plugins/jetpack/modules/sitemaps/sitemaps.php @@ -1,4 +1,4 @@ -<?php +<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Generate sitemap files in base XML as well as some namespace extensions. * @@ -14,7 +14,7 @@ * well as the home url. To include other post types use the 'jetpack_sitemap_post_types' * filter. * - * @link http://sitemaps.org/protocol.php Base sitemaps protocol. + * @link https://www.sitemaps.org/protocol.html Base sitemaps protocol. * @link https://support.google.com/webmasters/answer/178636 Image sitemap extension. * @link https://developers.google.com/webmasters/videosearch/sitemaps Video sitemap extension. * @@ -23,7 +23,7 @@ * completeness, instead including at most 1000 of the most recent published posts * from the previous 2 days, per the news-sitemap spec. * - * @link http://www.google.com/support/webmasters/bin/answer.py?answer=74288 News sitemap extension. + * @link https://support.google.com/webmasters/answer/74288 News sitemap extension. * * @package Jetpack * @since 3.9.0 @@ -170,7 +170,7 @@ class Jetpack_Sitemap_Manager { ); } - echo $the_content; + echo $the_content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- All content created by Jetpack. die(); } @@ -230,9 +230,9 @@ class Jetpack_Sitemap_Manager { JP_MASTER_SITEMAP_TYPE ); - // if there is no master sitemap yet, let's just return an empty sitemap with a short TTL instead of a 404 + // if there is no master sitemap yet, let's just return an empty sitemap with a short TTL instead of a 404. if ( empty( $sitemap_content ) ) { - $builder = new Jetpack_Sitemap_Builder(); + $builder = new Jetpack_Sitemap_Builder(); $sitemap_content = $builder->empty_sitemap_xml(); } @@ -437,10 +437,21 @@ class Jetpack_Sitemap_Manager { * * @module sitemaps * @since 3.9.0 + * @deprecated 7.4.0 * * @param bool $discover_sitemap Make default sitemap discoverable to robots. */ - $discover_sitemap = apply_filters( 'jetpack_sitemap_generate', true ); + $discover_sitemap = apply_filters_deprecated( 'jetpack_sitemap_generate', array( true ), 'jetpack-7.4.0', 'jetpack_sitemap_include_in_robotstxt' ); + + /** + * Filter whether to make the default sitemap discoverable to robots or not. Default true. + * + * @module sitemaps + * @since 7.4.0 + * + * @param bool $discover_sitemap Make default sitemap discoverable to robots. + */ + $discover_sitemap = apply_filters( 'jetpack_sitemap_include_in_robotstxt', $discover_sitemap ); if ( true === $discover_sitemap ) { $sitemap_url = $this->finder->construct_sitemap_url( 'sitemap.xml' ); @@ -452,10 +463,21 @@ class Jetpack_Sitemap_Manager { * * @module sitemaps * @since 3.9.0 + * @deprecated 7.4.0 + * + * @param bool $discover_news_sitemap Make default news sitemap discoverable to robots. + */ + $discover_news_sitemap = apply_filters_deprecated( 'jetpack_news_sitemap_generate', array( true ), 'jetpack-7.4.0', 'jetpack_news_sitemap_include_in_robotstxt' ); + + /** + * Filter whether to make the news sitemap discoverable to robots or not. Default true. + * + * @module sitemaps + * @since 7.4.0 * * @param bool $discover_news_sitemap Make default news sitemap discoverable to robots. */ - $discover_news_sitemap = apply_filters( 'jetpack_news_sitemap_generate', true ); + $discover_news_sitemap = apply_filters( 'jetpack_news_sitemap_include_in_robotstxt', $discover_news_sitemap ); if ( true === $discover_news_sitemap ) { $news_sitemap_url = $this->finder->construct_sitemap_url( 'news-sitemap.xml' ); @@ -524,7 +546,7 @@ class Jetpack_Sitemap_Manager { * This way we don't have to wait for init to finish before building sitemaps. * * @link https://tools.ietf.org/html/rfc3986#section-3.3 RFC 3986 - * @link http://www.sitemaps.org/ The sitemap protocol + * @link https://www.sitemaps.org/ The sitemap protocol * * @since 4.8.0 */ |