xml-sitemap-feed
Last commit date
assets
3 months ago
inc
2 months ago
views
3 months ago
LICENSE
3 years ago
readme.txt
2 months ago
uninstall.php
3 months ago
upgrade.php
3 months ago
xml-sitemap.php
2 months ago
xml-sitemap.php
135 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: XML Sitemap & Google News |
| 4 | * Plugin URI: https://status301.net/wordpress-plugins/xml-sitemap-feed/ |
| 5 | * Description: Feed the hungry spiders in compliance with the XML Sitemap and Google News protocols. |
| 6 | * Version: 5.7.7 |
| 7 | * Text Domain: xml-sitemap-feed |
| 8 | * Requires at least: 4.4 |
| 9 | * Requires PHP: 5.6 |
| 10 | * Author: RavanH |
| 11 | * Author URI: https://status301.net/ |
| 12 | * |
| 13 | * @package XML Sitemap & Google News |
| 14 | */ |
| 15 | |
| 16 | /** |
| 17 | * Copyright 2026 RavanH |
| 18 | * https://status301.net/ |
| 19 | * mailto: ravanhagen@gmail.com |
| 20 | |
| 21 | * This program is free software; you can redistribute it and/or modify |
| 22 | * it under the terms of the GNU General Public License version 3 as |
| 23 | * published by the Free Software Foundation. |
| 24 | |
| 25 | * This program is distributed in the hope that it will be useful, |
| 26 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 28 | * GNU General Public License for more details. |
| 29 | */ |
| 30 | |
| 31 | /** |
| 32 | * -------------------- |
| 33 | * AVAILABLE HOOKS |
| 34 | * -------------------- |
| 35 | * |
| 36 | * Documented on https://premium.status301.com/knowledge-base/xml-sitemap-google-news/action-and-filter-hooks/ |
| 37 | * |
| 38 | * --------------------- |
| 39 | * AVAILABLE FUNCTIONS |
| 40 | * --------------------- |
| 41 | * |
| 42 | * Conditional tags https://premium.status301.com/knowledge-base/xml-sitemap-google-news/conditional-tags/ |
| 43 | * |
| 44 | * Feel free to request, suggest or submit more :) |
| 45 | */ |
| 46 | |
| 47 | defined( 'WPINC' ) || die; |
| 48 | |
| 49 | define( 'XMLSF_VERSION', '5.7.7' ); |
| 50 | define( 'XMLSF_ADV_MIN_VERSION', '1.3' ); |
| 51 | define( 'XMLSF_NEWS_ADV_MIN_VERSION', '1.4.5' ); |
| 52 | define( 'XMLSF_DIR', __DIR__ ); |
| 53 | define( 'XMLSF_BASENAME', plugin_basename( __FILE__ ) ); |
| 54 | |
| 55 | // Pluggable functions. |
| 56 | require_once XMLSF_DIR . '/inc/functions-pluggable.php'; |
| 57 | |
| 58 | // Shared functions. |
| 59 | require_once XMLSF_DIR . '/inc/functions.php'; |
| 60 | |
| 61 | // Prepare hooks for debugging. |
| 62 | WP_DEBUG && require_once XMLSF_DIR . '/inc/functions-debugging.php'; |
| 63 | |
| 64 | // Fire it up at plugins_loaded. |
| 65 | add_action( 'plugins_loaded', 'xmlsf', 9 ); |
| 66 | add_filter( 'robots_txt', 'XMLSF\robots_txt', 11 ); |
| 67 | add_action( 'xmlsf_sitemap_loaded', 'XMLSF\sitemap_loaded' ); |
| 68 | add_action( 'xmlsf_news_sitemap_loaded', 'XMLSF\sitemap_loaded' ); |
| 69 | |
| 70 | // Admin. |
| 71 | add_action( 'admin_menu', array( 'XMLSF\Admin\Main', 'add_options_pages' ) ); |
| 72 | add_action( 'admin_init', array( 'XMLSF\Admin\Main', 'register_settings' ), 7 ); |
| 73 | add_action( 'admin_init', array( 'XMLSF\Admin\Main', 'init' ), 9 ); |
| 74 | add_action( 'admin_init', array( 'XMLSF\Admin\Main', 'compat' ) ); |
| 75 | |
| 76 | register_deactivation_hook( __FILE__, array( 'XMLSF\Admin\Main', 'deactivate' ) ); |
| 77 | register_activation_hook( __FILE__, array( 'XMLSF\Admin\Main', 'activate' ) ); |
| 78 | |
| 79 | /** |
| 80 | * Get sitemap object. |
| 81 | * |
| 82 | * @since 5.0 |
| 83 | * |
| 84 | * @static XMLSF\XMLSitemapFeed $xmlsf |
| 85 | * |
| 86 | * @return XMLSF\XMLSitemapFeed object by reference |
| 87 | */ |
| 88 | function &xmlsf() { |
| 89 | global $xmlsf; |
| 90 | |
| 91 | if ( ! isset( $xmlsf ) ) { |
| 92 | $xmlsf = new XMLSF\XMLSitemapFeed(); |
| 93 | } |
| 94 | |
| 95 | return $xmlsf; |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * Register XMLSF autoloader |
| 100 | * |
| 101 | * @since 5.5 |
| 102 | * |
| 103 | * @param string $class_name Namespaced class name. |
| 104 | */ |
| 105 | spl_autoload_register( |
| 106 | function ( $class_name ) { |
| 107 | // Bail if the class is not in our namespace. |
| 108 | if ( 0 !== strpos( $class_name, 'XMLSF\\' ) ) { |
| 109 | return; |
| 110 | } |
| 111 | |
| 112 | // Build the filename and path. |
| 113 | $class_name = str_replace( 'XMLSF', 'inc', $class_name ); |
| 114 | $class_name = strtolower( $class_name ); |
| 115 | $path_array = explode( '\\', $class_name ); |
| 116 | $class_name = array_pop( $path_array ); |
| 117 | $class_name = str_replace( '_', '-', $class_name ); |
| 118 | $file = realpath( XMLSF_DIR ) . DIRECTORY_SEPARATOR . \implode( DIRECTORY_SEPARATOR, $path_array ) . DIRECTORY_SEPARATOR . 'class-' . $class_name . '.php'; |
| 119 | |
| 120 | // If the file exists for the class name, load it. |
| 121 | if ( file_exists( $file ) ) { |
| 122 | include_once $file; |
| 123 | } |
| 124 | } |
| 125 | ); |
| 126 | |
| 127 | /** |
| 128 | * Deprecated, innit? |
| 129 | * |
| 130 | * Keep for backwards compatibility with Google News Advanced pre 1.3.6 |
| 131 | */ |
| 132 | function xmlsf_init() { |
| 133 | _deprecated_function( __FUNCTION__, '5.5', 'xmlsf' ); |
| 134 | } |
| 135 |