Browse Source

Redirecting RSS

vbracco 16 years ago
parent
commit
4a309e8faf
2 changed files with 15 additions and 2 deletions
  1. 12 1
      plugins/feedreplacement.php
  2. 3 1
      rss.php

+ 12 - 1
plugins/feedreplacement.php View File

1
 <?php
1
 <?php
2
 /*
2
 /*
3
 Plugin Name: FeedReplacement
3
 Plugin Name: FeedReplacement
4
-Plugin URI: http://www.gelatocms.com/plugins/feedreplacement/
4
+Plugin URI:  http://plugins.gelatocms.com/feedreplacement/
5
 Description: 
5
 Description: 
6
 Author: Victor Bracco
6
 Author: Victor Bracco
7
 Author URI: http://www.vbracco.com.ar/
7
 Author URI: http://www.vbracco.com.ar/
24
 		//lo mismo pero con el que esta en el header
24
 		//lo mismo pero con el que esta en el header
25
 		$this->addAction('gelato_includes', 'feedreplacement_includeFeed');
25
 		$this->addAction('gelato_includes', 'feedreplacement_includeFeed');
26
 		
26
 		
27
+		//redirecting all trafic
28
+		$this->addAction('feed_header', 'feedreplacement_redirect');
27
 		
29
 		
28
 		//guarda la opcion si viene por POST
30
 		//guarda la opcion si viene por POST
29
 		if ($user->isAdmin()) {
31
 		if ($user->isAdmin()) {
64
 		}
66
 		}
65
 	}
67
 	}
66
 	
68
 	
69
+	function feedreplacement_redirect(){
70
+		global $conf;
71
+		$feedreplacement_url = $conf->get_option('feedreplacement_url');
72
+		if (!preg_match("/feedburner|feedvalidator/i", $_SERVER['HTTP_USER_AGENT'])) {
73
+			header("Location: ".$feedreplacement_url);
74
+			header("HTTP/1.1 302 Temporary Redirect");
75
+			exit();
76
+		}
77
+	}
67
 }
78
 }
68
 
79
 
69
 ?>
80
 ?>

+ 3 - 1
rss.php View File

12
   =========================== */
12
   =========================== */
13
 ?>
13
 ?>
14
 <?php
14
 <?php
15
+	require('entry.php');
16
+	$trigger->call('feed_header');
17
+	
15
 	header("Content-type: text/xml; charset=utf-8");
18
 	header("Content-type: text/xml; charset=utf-8");
16
 	$isFeed = true;
19
 	$isFeed = true;
17
 	
20
 	
18
-	require('entry.php');
19
 	global $conf, $tumble;
21
 	global $conf, $tumble;
20
 	
22
 	
21
 	
23