PluginProbe ʕ •ᴥ•ʔ
XML Sitemap & Google News / 3.2
XML Sitemap & Google News v3.2
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-xml.php 16 years ago feed-xsl.php 16 years ago readme.txt 16 years ago xml-sitemap.php 16 years ago
xml-sitemap.php
91 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.2
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.2');
35
36 // check if xml-sitemap.php was moved one dir up to mu-plugins in wpmu
37 $xmlsf_dir = dirname(__FILE__);
38 if (file_exists($xmlsf_dir.'/xml-sitemap-feed'))
39 $xmlsf_dir = $xmlsf_dir . '/xml-sitemap-feed';
40
41 /* --------------------
42 FUNCTIONS
43 -------------------- */
44
45 // FEEDS //
46 // set the XML feeds up
47 function xml_sitemap_add_feeds() {
48 global $wp_rewrite;
49 add_feed('sitemap.xml','xml_sitemap_do_feed');
50 add_feed('sitemap.xsl','xml_sitemap_xsl_do_feed');
51 add_action('generate_rewrite_rules', 'xml_sitemap_feed_rewrite');
52 $wp_rewrite->flush_rules();
53 }
54 // load XML template
55 function xml_sitemap_do_feed() {
56 global $xmlsf_dir;
57 load_template( $xmlsf_dir . '/feed-xml.php' );
58 }
59 // load XSL (style) template
60 function xml_sitemap_xsl_do_feed() {
61 global $xmlsf_dir;
62 load_template( $xmlsf_dir . '/feed-xsl.php' );
63 }
64 // add the rewrite rules
65 function xml_sitemap_feed_rewrite($wp_rewrite) {
66 $feed_rules = array(
67 //'feed/(.+)' => 'index.php?feed='.$wp_rewrite->preg_index(1),
68 //'^feed/sitemap$' => 'index.php?feed=sitemap',
69 '^sitemap.xml$' => 'index.php?feed=sitemap.xml',
70 '^sitemap.xsl$' => 'index.php?feed=sitemap.xsl'
71 );
72 $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
73 }
74
75 // ROBOTSTXT //
76 // get sitemap location in robots.txt generated by WP
77 function xml_sitemap_robots() {
78 echo "\nSitemap: ".get_option('siteurl')."/sitemap.xml\n\n";
79 }
80
81 /* --------------------
82 HOOKS
83 -------------------- */
84
85 // FEEDS
86 add_action('init', 'xml_sitemap_add_feeds');
87
88 // ROBOTSTXT
89 add_action('do_robotstxt', 'xml_sitemap_robots');
90 ?>
91