Redirecting RSS

master
vbracco 2008-11-01 21:40:01 +00:00
parent 7f28472b77
commit 4a309e8faf
2 changed files with 15 additions and 2 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
/* /*
Plugin Name: FeedReplacement Plugin Name: FeedReplacement
Plugin URI: http://www.gelatocms.com/plugins/feedreplacement/ Plugin URI: http://plugins.gelatocms.com/feedreplacement/
Description: Description:
Author: Victor Bracco Author: Victor Bracco
Author URI: http://www.vbracco.com.ar/ Author URI: http://www.vbracco.com.ar/
@ -24,6 +24,8 @@ class feedreplacement extends plugins {
//lo mismo pero con el que esta en el header //lo mismo pero con el que esta en el header
$this->addAction('gelato_includes', 'feedreplacement_includeFeed'); $this->addAction('gelato_includes', 'feedreplacement_includeFeed');
//redirecting all trafic
$this->addAction('feed_header', 'feedreplacement_redirect');
//guarda la opcion si viene por POST //guarda la opcion si viene por POST
if ($user->isAdmin()) { if ($user->isAdmin()) {
@ -64,6 +66,15 @@ class feedreplacement extends plugins {
} }
} }
function feedreplacement_redirect(){
global $conf;
$feedreplacement_url = $conf->get_option('feedreplacement_url');
if (!preg_match("/feedburner|feedvalidator/i", $_SERVER['HTTP_USER_AGENT'])) {
header("Location: ".$feedreplacement_url);
header("HTTP/1.1 302 Temporary Redirect");
exit();
}
}
} }
?> ?>

View File

@ -12,10 +12,12 @@ if(!defined('entry')) define('entry',true);
=========================== */ =========================== */
?> ?>
<?php <?php
require('entry.php');
$trigger->call('feed_header');
header("Content-type: text/xml; charset=utf-8"); header("Content-type: text/xml; charset=utf-8");
$isFeed = true; $isFeed = true;
require('entry.php');
global $conf, $tumble; global $conf, $tumble;