PluginProbe ʕ •ᴥ•ʔ
XML Sitemap & Google News / 3.4
XML Sitemap & Google News v3.4
5.7.7 5.7.5 5.7.6 5.7.4 trunk 1.0 2.0 2.1 3.0 3.2 3.3 3.4 3.5 3.6.1 3.7.4 3.8.8 3.9.3 4.0.1 4.1.4 4.2.3 4.3.2 4.4.1 4.5.1 4.6.3 4.7.5 4.8.3 4.9.4 5.0.7 5.1.2 5.2.7 5.3.6 5.4.6 5.4.9 5.5.1 5.5.2 5.5.3 5.5.4 5.5.5 5.5.6 5.5.7 5.5.8 5.5.9 5.6 5.6.1 5.6.2 5.6.3 5.7 5.7.1 5.7.2 5.7.3
xml-sitemap-feed / xml-sitemap.php
xml-sitemap-feed Last commit date
feed-sitemap.xml.php 16 years ago feed-sitemap.xsl.php 16 years ago readme.txt 16 years ago xml-sitemap.php 16 years ago
xml-sitemap.php
110 lines
1 <?php
2 /*
3 Plugin Name: XML Sitemap Feed
4 Plugin URI: http://4visions.nl/en/index.php?section=57
5 Description: Creates a dynamic XML feed that complies with the XML Sitemap protocol to aid Google, Yahoo, MSN, Ask.com indexing your blog. Based on the Standard XML Sitemap Generator by Patrick Chia.
6 Version: 3.4
7 Author: RavanH
8 Author URI: http://4visions.nl/
9 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravanhagen%40gmail%2ecom&item_name=XML%20Sitemap%20Feed&item_number=2%2e6%2e2%2e9&no_shipping=0&tax=0&bn=PP%2dDonationsBF&charset=UTF%2d8
10 */
11
12 /* Copyright 2009 RavanH (http://4visions.nl/ email : ravanhagen@gmail.com)
13
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 2 of the License, or
17 (at your option) any later version.
18
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 */
28
29 /* --------------------
30 VALUES
31 -------------------- */
32
33 // set version
34 define('XMLSFVERSION','3.4');
35
36 // dir
37 $xmlsf_dir = dirname(__FILE__);
38
39 // check if xml-sitemap.php is moved one dir up like in WPMU's /mu-plugins/
40 if (file_exists($xmlsf_dir.'/xml-sitemap-feed'))
41 $xmlsf_dir = $xmlsf_dir . '/xml-sitemap-feed';
42
43 /* --------------------
44 FUNCTIONS
45 -------------------- */
46
47 // FEEDS //
48 // set the XML feeds up
49 function xml_sitemap_add_feeds() {
50 add_feed('sitemap.xml','do_feed_sitemapxml');
51 add_feed('sitemap.xsl','do_feed_sitemapxsl');
52 }
53 // load XML template
54 if ( !function_exists(do_feed_sitemapxml) ) {
55 function do_feed_sitemapxml() {
56 global $xmlsf_dir;
57 load_template( $xmlsf_dir . '/feed-sitemap.xml.php' );
58 }
59 }
60 // load XSL (style) template
61 if ( !function_exists(do_feed_sitemapxsl) ) {
62 function do_feed_sitemapxsl() {
63 global $xmlsf_dir;
64 load_template( $xmlsf_dir . '/feed-sitemap.xsl.php' );
65 }
66 }
67 // add the rewrite rules
68 function xml_sitemap_feed_rewrite($wp_rewrite) {
69 $feed_rules = array(
70 '^sitemap.xml$' => 'index.php?feed=sitemap.xml',
71 '^sitemap.xsl$' => 'index.php?feed=sitemap.xsl'
72 );
73 $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
74 }
75 // recreate rewrite rules (only needed upon plugin activation)
76 function xml_sitemap_activate() {
77 global $wp_rewrite;
78 $wp_rewrite->flush_rules();
79 }
80
81 // ROBOTSTXT //
82 // get sitemap location in robots.txt generated by WP
83 function xml_sitemap_robots() {
84 echo "Sitemap: ".get_option('home')."/sitemap.xml\n\n";
85 }
86
87 /* --------------------
88 HOOKS
89 -------------------- */
90
91 if ( $wpdb->blogid && function_exists('get_site_option') && get_site_option('tags_blog_id') == $wpdb->blogid ) {
92 // we are on wpmu and this is a tags blog!
93 // create NO sitemap since it will be full
94 // of links outside the blogs own domain...
95 return;
96 } else {
97 // FEEDS
98 add_action('init', 'xml_sitemap_add_feeds');
99
100 // REWRITES
101 add_filter('generate_rewrite_rules', 'xml_sitemap_feed_rewrite');
102
103 // ROBOTSTXT
104 add_action('do_robotstxt', 'xml_sitemap_robots');
105 }
106
107 // ACTIVATION
108 register_activation_hook( __FILE__, 'xml_sitemap_activate' );
109 ?>
110