13693261870
2022-09-16 354b3dbfbffb3df45212a2a44dbbf48b4acc2594
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
// this is an example server-side proxy to load feeds
$feed = $_REQUEST['feed'];
if ($feed != '' && strpos($feed, 'http') === 0) {
    header('Content-Type: text/xml');
    $xml = file_get_contents($feed);
 
    // Clean up our own RSS feeds
    if (strPos($feed, 'feeds.feedburner.com/extblog') || strPos($feed, 'sencha.com/forum')) {
        // Cut out extraneous whitespace to aid in checking for existing CDATA tags below
        $xml = preg_replace('/[\\n\\r]/', '', $xml);
        $xml = preg_replace('/>\s+</', '><', $xml);
 
        // Make textual items XML safe by enclosing them with CDATA sections unless it's already been done
        $xml = preg_replace('/<title>(?!<\\!\\[CDATA\\[)/',         '<title><![CDATA[', $xml);
        $xml = preg_replace('/([^\\]][^\\]][^>])<\\/title>/',       '$1]]></title>', $xml);
        $xml = preg_replace('/<author>(?!<\\!\\[CDATA\\[)/',        '<author><![CDATA[', $xml);
        $xml = preg_replace('/([^\\]][^\\]][^>])<\\/author>/',      '$1]]></author>', $xml);
        $xml = preg_replace('/<description>(?!<\\!\\[CDATA\\[)/',   '<description><![CDATA[', $xml);
        $xml = preg_replace('/([^\\]][^\\]][^>])<\\/description>/', '$1]]></description>', $xml);
        $xml = preg_replace('/<link>(?!<\\!\\[CDATA\\[)/',          '<link><![CDATA[', $xml);
        $xml = preg_replace('/([^\\]][^\\]][^>])<\\/link>/',        '$1]]></link>', $xml);
    }
 
    $xml = str_replace('<content:encoded>', '<content>', $xml);
    $xml = str_replace('</content:encoded>', '</content>', $xml);
    $xml = str_replace('</dc:creator>', '</author>', $xml);
    echo str_replace('<dc:creator', '<author', $xml);
    return;
}