Changeset 1443

Show
Ignore:
Timestamp:
04/17/06 18:13:40 (2 years ago)
Author:
sdcosta
Message:

Fix for the rss view plugin to not show the RSS link and alternate link when we are in admin, plugins and other wierd locations.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/rss/plugins/rssview.php

    r1303 r1443  
    3030/// Author: Marco Bonetti 
    3131/// Description: Adds a RSS link to the header and the footer of each page 
    32 /// Version: 0.5 
     32/// Version: 0.6 
    3333 
    3434/** 
     
    3636 * 0.4 - Properly escape the RSS url's entities. 
    3737 * 0.5 - Adapted to the new theme model 
     38 * 0.6 - Don't put a link in admin and other locations 
    3839 */ 
    3940 
     
    4142    $url    = guessTransportProto() . $_SERVER['HTTP_HOST']; 
    4243    $url .= $_SERVER["REQUEST_URI"]; 
    43      
     44 
    4445    if (strstr($_SERVER['REQUEST_URI'],"?") !== FALSE) { 
    45         $url .= "&media=rss"; 
     46        $url .= "&media=rss"; 
    4647    } else { 
    47             $url .= "?media=rss"; 
    48         } 
    49         $url .= __rss_view_post2get(); 
    50         $url = str_replace('&','&',$url); 
     48        $url .= "?media=rss"; 
     49    } 
     50    $url .= __rss_view_post2get(); 
     51    $url = str_replace('&','&',$url); 
    5152    return str_replace('&','&',$url); 
    5253} 
     
    5657 */ 
    5758function __rss_view_post2get() { 
    58     $ret = ""; 
    59     foreach($_POST as $key => $val) { 
    60         if (substr($key,0,4) == 'rss_') { 
    61             $ret .= "&" ."$key=" . $_POST[$key]; 
    62         } 
    63     } 
    64     return $ret; 
     59    $ret = ""; 
     60    foreach($_POST as $key => $val) { 
     61        if (substr($key,0,4) == 'rss_') { 
     62            $ret .= "&" ."$key=" . $_POST[$key]; 
     63        } 
     64    } 
     65    return $ret; 
    6566} 
    6667 
    6768function __rss_view_footerlink($dummy) { 
    68     echo "<span><a href=\"".__rss_view_url()."\">RSS</a></span>\n"; 
     69    if (!defined('RSS_FILE_LOCATION')) { 
     70        echo "<span><a href=\"".__rss_view_url()."\">RSS</a></span>\n"; 
     71    } 
    6972    return $dummy; 
    7073} 
    7174 
    7275function __rss_view_headerlink($dummy) { 
    73     echo "\t<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"".__rss_view_url()."\" />\n"; 
     76    if (!defined('RSS_FILE_LOCATION')) { 
     77        echo "\t<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"".__rss_view_url()."\" />\n"; 
     78    } 
    7479    return $dummy; 
    7580}