Changeset 3364232
- Timestamp:
- 09/18/2025 09:36:31 PM (3 months ago)
- Location:
- xml-sitemaps-manager/trunk
- Files:
-
- 16 added
- 1 deleted
- 3 edited
-
includes (added)
-
includes/class-admin.php (added)
-
includes/class-load.php (added)
-
includes/compat (added)
-
includes/compat/class-plugin.php (added)
-
includes/compat/class-polylang.php (added)
-
includes/debugging.php (added)
-
includes/modules (added)
-
includes/modules/class-core.php (added)
-
includes/modules/class-fixes.php (added)
-
includes/modules/class-lastmod.php (added)
-
includes/pluggable.php (added)
-
includes/upgrade.php (added)
-
includes/views (added)
-
includes/views/admin-fields.php (added)
-
includes/views/admin-help-tab.php (added)
-
readme.txt (modified) (2 diffs)
-
src (deleted)
-
uninstall.php (modified) (4 diffs)
-
xml-sitemaps-manager.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
xml-sitemaps-manager/trunk/readme.txt
r3061149 r3364232 5 5 Requires at least: 5.5 6 6 Requires PHP: 5.6 7 Tested up to: 6. 58 Stable tag: 0. 67 Tested up to: 6.8 8 Stable tag: 0.7 9 9 License: GPLv3 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 72 72 == Upgrade Notice == 73 73 74 = 0. 6=74 = 0.7 = 75 75 76 Lastmod for tax term and Polylang compatibility improvements, stylesheet, bugfixes.76 Improved multisite compatibility. 77 77 78 78 == Changelog == 79 80 = 0.7 = 81 * Improved multisite compatibility 79 82 80 83 = 0.6 = -
xml-sitemaps-manager/trunk/uninstall.php
r3061149 r3364232 11 11 12 12 // Exit if uninstall not called from WordPress. 13 defined( ' \WP_UNINSTALL_PLUGIN' ) || exit();13 defined( 'WP_UNINSTALL_PLUGIN' ) || exit(); 14 14 15 15 // Check if it is a multisite and not a large one. 16 16 if ( \is_multisite() ) { 17 if ( \defined( 'WP_DEBUG' ) && WP_DEBUG ) {17 if ( WP_DEBUG && WP_DEBUG_LOG ) { 18 18 \error_log( 'Clearing XML Sitemaps Manager settings from each site before uninstall:' ); 19 19 } 20 20 21 if ( wp_is_large_network() ) {22 if ( \defined( 'WP_DEBUG' ) && WP_DEBUG ) {21 if ( \wp_is_large_network() ) { 22 if ( WP_DEBUG && WP_DEBUG_LOG ) { 23 23 \error_log( 'Aborting multisite uninstall. Too many sites in your network.' ); 24 24 } … … 56 56 * Remove metadata. 57 57 */ 58 // Terms meta. 59 delete_metadata( 'term', 0, 'term_modified_gmt', '', true ); 60 // User meta. 61 delete_metadata( 'user', 0, 'user_modified_gmt', '', true ); 62 // TODO: add Polylang metadata removal. 58 // Already done on plugin deactivation. 63 59 64 60 /** … … 66 62 */ 67 63 \delete_option( 'xmlsm_version' ); 68 \delete_option( 'xmlsm_sitemaps_enabled' );69 64 \delete_option( 'xmlsm_sitemaps_fixes' ); 70 65 \delete_option( 'xmlsm_max_urls' ); … … 74 69 75 70 // Kilroy was here. 76 if ( \defined( 'WP_DEBUG' ) && WP_DEBUG ) {71 if ( WP_DEBUG && WP_DEBUG_LOG ) { 77 72 if ( $_id ) { 78 73 \error_log( 'XML Sitemaps Manager settings cleared for blog ID:' . $_id ); -
xml-sitemaps-manager/trunk/xml-sitemaps-manager.php
r3061149 r3364232 7 7 * Description: Fix some bugs and add new options to manage the WordPress core XML Sitemaps. Happy with the results? Please leave me a <strong><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravanhagen%40gmail%2ecom&item_name=XML%20Sitemaps%20Manager">tip</a></strong> for continued development and support. Thanks :) 8 8 * Text Domain: xml-sitemaps-manager 9 * Version: 0. 69 * Version: 0.7 10 10 * Requires at least: 5.5 11 11 * Requires PHP: 5.6 … … 18 18 defined( 'WPINC' ) || die; 19 19 20 define( 'XMLSM_VERSION', '0. 6' );20 define( 'XMLSM_VERSION', '0.7' ); 21 21 define( 'XMLSM_BASENAME', plugin_basename( __FILE__ ) ); 22 22 23 /** 24 * Plugin intitialization. 25 * 26 * Must run before priority 10 for the wp_sitemaps_add_provider filter to work. 27 * Can be disabled with remove_action('init','xmlsm_init',9). 28 * 29 * @since 0.3 30 */ 31 function xmlsm_init() { 32 global $wp_version; 23 add_action( 'init', array( 'XMLSitemapsManager\Load', 'front' ), 9 ); 24 add_action( 'admin_init', array( 'XMLSitemapsManager\Load', 'admin' ) ); 33 25 34 // Skip this if we're in the admin. 35 if ( is_admin() ) { 36 return; 37 } 38 39 if ( ! get_option( 'xmlsm_sitemaps_enabled', true ) ) { 40 // Disable all sitemaps. 41 add_action( 'wp_sitemaps_enabled', '__return_false' ); 42 43 // And skip the rest. 44 return; 45 } 46 47 /** 48 * XML Sitemaps Manager: Fixes 49 * 50 * Patch bugs: 51 * - 404 response code on certain sitemaps. @see https://core.trac.wordpress.org/ticket/51912 52 * - don't set is_home() true. @see https://core.trac.wordpress.org/ticket/51542 53 * - don't execute main query. @see https://core.trac.wordpress.org/ticket/51117 54 * - ignore stickyness. @see https://core.trac.wordpress.org/ticket/55633 (pre-6.1) 55 * 56 * Add features: 57 * - is_sitemap() conditional tag. @see https://core.trac.wordpress.org/ticket/51543 58 * - is_sitemap_stylesheet() conditional tag for good measure. 59 * 60 * Improve performance: 61 * - Shave off 4 database queries from post type sitemap requests. 62 * - Shave off 5 database queries from the sitemap index request. 63 * - Shave off N database queries from taxonomy sitemap requests, where N is the number of terms in that taxonomy. 64 * See https://core.trac.wordpress.org/ticket/55239 (pre-6.0) 65 * - Shave off 12 database queries from user sitemap requests. 66 * 67 * @package XML Sitemaps Manager 68 * @since 1.0 69 */ 70 if ( get_option( 'xmlsm_sitemaps_fixes', true ) ) { 71 // Include pluggable functions. 72 include __DIR__ . '/src/pluggable.php'; 73 74 add_action( 'parse_request', 'wp_sitemaps_loaded' ); 75 76 if ( version_compare( $wp_version, '6.1', '<' ) ) { 77 add_filter( 'wp_sitemaps_posts_query_args', array( 'XMLSitemapsManager\Fixes', 'posts_query_args' ) ); 78 } 79 if ( version_compare( $wp_version, '6.0', '<' ) ) { 80 add_filter( 'wp_sitemaps_taxonomies_query_args', array( 'XMLSitemapsManager\Fixes', 'taxonomies_query_args' ) ); 81 } 82 } 83 84 // Maximum URLs per sitemap. 85 add_filter( 'wp_sitemaps_max_urls', array( 'XMLSitemapsManager\Core', 'max_urls' ), 10, 2 ); 86 // Exclude sitemap providers. 87 add_filter( 'wp_sitemaps_add_provider', array( 'XMLSitemapsManager\Core', 'exclude_providers' ), 10, 2 ); 88 // Exclude post types. TODO Fix. 89 add_filter( 'wp_sitemaps_post_types', array( 'XMLSitemapsManager\Core', 'exclude_post_types' ) ); 90 // Exclude taxonomies. TODO Fix. 91 add_filter( 'wp_sitemaps_taxonomies', array( 'XMLSitemapsManager\Core', 'exclude_taxonomies' ) ); 92 // Filter stylesheet. 93 add_filter( 'wp_sitemaps_stylesheet_css', array( 'XMLSitemapsManager\Core', 'stylesheet' ) ); 94 95 // Usage info for debugging. 96 if ( WP_DEBUG ) { 97 include_once __DIR__ . '/src/debugging.php'; 98 } 99 100 /** 101 * Add sitemaps. 102 */ 103 104 // TODO. 105 106 /** 107 * Add lastmod. 108 */ 109 if ( get_option( 'xmlsm_lastmod' ) ) { 110 // Add lastmod to the index. 111 add_filter( 'wp_sitemaps_index_entry', array( 'XMLSitemapsManager\Lastmod', 'index_entry' ), 10, 4 ); 112 add_filter( 'wp_sitemaps_posts_query_args', array( 'XMLSitemapsManager\Lastmod', 'posts_query_args' ) ); 113 // To post entries. 114 add_filter( 'wp_sitemaps_posts_entry', array( 'XMLSitemapsManager\Lastmod', 'posts_entry' ), 10, 3 ); 115 add_filter( 'wp_sitemaps_posts_show_on_front_entry', array( 'XMLSitemapsManager\Lastmod', 'posts_show_on_front_entry' ) ); 116 // To term entries. 117 add_filter( 'wp_sitemaps_taxonomies_entry', array( 'XMLSitemapsManager\Lastmod', 'taxonomies_entry' ), 10, 4 ); 118 add_action( 'transition_post_status', array( 'XMLSitemapsManager\Lastmod', 'update_term_modified_meta' ), 10, 3 ); 119 add_filter( 'wp_sitemaps_taxonomies_query_args', array( 'XMLSitemapsManager\Lastmod', 'taxonomies_query_args' ) ); 120 // To user entries. 121 add_filter( 'wp_sitemaps_users_entry', array( 'XMLSitemapsManager\Lastmod', 'users_entry' ), 10, 2 ); 122 add_action( 'transition_post_status', array( 'XMLSitemapsManager\Lastmod', 'update_user_modified_meta' ), 10, 3 ); 123 add_filter( 'wp_sitemaps_users_query_args', array( 'XMLSitemapsManager\Lastmod', 'users_query_args' ) ); 124 // Compatibility. 125 if ( function_exists( 'pll_languages_list' ) ) { 126 add_filter( 'xmlsm_index_entry_subtype', array( 'XMLSitemapsManager\Compat\Polylang', 'index_entry_subtype' ) ); 127 add_filter( 'xmlsm_lastmod_user_meta_key', array( 'XMLSitemapsManager\Compat\Polylang', 'lastmod_meta_key' ), 10, 2 ); 128 add_filter( 'xmlsm_lastmod_index_entry', array( 'XMLSitemapsManager\Compat\Polylang', 'lastmod_index_entry' ), 10, 3 ); 129 } 130 } 131 } 132 133 add_action( 'init', 'xmlsm_init', 9 ); 134 135 /** 136 * Plugin admin intitialization. 137 * 138 * Can be disabled with remove_action('admin_init','xmlsm_admin_init'). 139 * 140 * @since 0.3 141 */ 142 function xmlsm_admin_init() { 143 /** 144 * Register settings. 145 */ 146 XMLSitemapsManager\Admin::register_settings(); 147 148 /** 149 * Tools actions. 150 */ 151 // Compatibility. 152 if ( function_exists( 'pll_languages_list' ) ) { 153 add_action( 'xmlsm_clear_lastmod_meta', array( 'XMLSitemapsManager\Compat\Polylang', 'clear_lastmod_meta' ) ); 154 } 155 XMLSitemapsManager\Admin::tools_actions(); 156 157 /** 158 * Plugin action links. 159 */ 160 add_filter( 'plugin_action_links_' . XMLSM_BASENAME, array( 'XMLSitemapsManager\Admin', 'add_action_link' ) ); 161 add_filter( 'plugin_row_meta', array( 'XMLSitemapsManager\Admin', 'plugin_meta_links' ), 10, 2 ); 162 } 163 164 add_action( 'admin_init', 'xmlsm_admin_init' ); 165 166 /** 167 * Plugin updater. 168 * 169 * @since 0.3 170 */ 171 function xmlsm_maybe_upgrade() { 172 // Maybe upgrade or install. 173 $db_version = get_option( 'xmlsm_version', '0' ); 174 if ( 0 !== version_compare( XMLSM_VERSION, $db_version ) ) { 175 include_once __DIR__ . '/upgrade.php'; 176 } 177 } 178 179 add_action( 'init', 'xmlsm_maybe_upgrade', 8 ); 26 register_deactivation_hook( __FILE__, array( 'XMLSitemapsManager\Admin', 'deactivate' ) ); 180 27 181 28 /** … … 188 35 * @return void 189 36 */ 190 function xmlsm_autoloader( $class_name ) { 191 // Skip this if not in our namespace. 192 if ( 0 !== strpos( $class_name, 'XMLSitemapsManager' ) ) { 193 return; 194 } 37 \spl_autoload_register( 38 function ( $class_name ) { 39 // Skip this if not in our namespace. 40 if ( 0 !== \strpos( $class_name, 'XMLSitemapsManager\\' ) ) { 41 return; 42 } 195 43 196 // Replace namespace separators with directory separators in the relative 197 // class name, prepend with class-, append with .php, build our file path. 198 $class_name = str_replace( 'XMLSitemapsManager', 'src', $class_name ); 199 $class_name = strtolower( $class_name ); 200 $path_array = explode( '\\', $class_name ); 201 $file_name = array_pop( $path_array ); 202 $file_name = 'class-' . $file_name . '.php'; 203 $file = __DIR__ . DIRECTORY_SEPARATOR . implode( DIRECTORY_SEPARATOR, $path_array ) . DIRECTORY_SEPARATOR . $file_name; 44 // Replace namespace separators with directory separators in the relative 45 // class name, prepend with class-, append with .php, build our file path. 46 $class_name = \str_replace( 'XMLSitemapsManager', 'includes', $class_name ); 47 $class_name = \strtolower( $class_name ); 48 $path_array = \explode( '\\', $class_name ); 49 $file_name = 'class-' . \array_pop( $path_array ) . '.php'; 50 $file = __DIR__ .\DIRECTORY_SEPARATOR . \implode( \DIRECTORY_SEPARATOR, $path_array ) . \DIRECTORY_SEPARATOR . $file_name; 204 51 205 // If the file exists, inlcude it. 206 if ( file_exists( $file ) ) { 207 include $file; 208 } 209 } 210 211 spl_autoload_register( 'xmlsm_autoloader' ); 52 // If the file exists, inlcude it. 53 if ( \file_exists( $file ) ) { 54 include $file; 55 } 56 } 57 );
Note: See TracChangeset
for help on using the changeset viewer.