示例#1
0
    function getItems($link, $title, $row)
    {
        global $cfg;
        $enclosures = $this->getEnclosure($row['comment']);
        $row['comment'] = $this->convertEnclosure($row['comment']);
        // Article Content
        $row['comment'] = str_replace('./resources/', 'http://' . $_SERVER['HTTP_HOST'] . $cfg['root_path'] . 'resources/', $row['comment']);
        // Description
        $description = htmlspecialchars(mb_substr(strip_tags($row['comment']), 0, 120, 'UTF-8')) . '...';
        return '<item>
<title>' . $title . '</title>
<link>' . $link . '</link>
<pubDate>' . date('D, d M Y H:i:s ', strtotime($row['date'])) . tz() . '</pubDate>
<description>' . $description . '</description>' . $enclosures . '
<content:encoded>
<![CDATA[' . $row['comment'] . ']]>
</content:encoded>
</item>';
    }
示例#2
0
文件: recent.php 项目: kaz6120/P_BLOG
        // Convert Text to XHTML
        if (file_exists($cd . '/include/user_include/plugins/plg_markdown.inc.php')) {
            include_once $cd . '/include/user_include/plugins/plg_markdown.inc.php';
            $FKMM_markdown = new FKMM_markdown();
            $row['comment'] = $FKMM_markdown->convert($row['comment']);
        }
        // Trim "comment" data for description
        $description = htmlspecialchars(mb_substr(strip_tags($row['comment']), 0, 120, 'UTF-8')) . '...';
        // This is for "content module"
        $content_encoded = '<![CDATA[' . "\n" . $row['comment'] . "\n" . ']]>';
        $tz = tz();
        $item .= '<dc:date>' . $row['date'] . $tz . "</dc:date>\n" . '<description>' . $description . "</description>\n" . '<content:encoded>' . "\n" . $content_encoded . "\n" . '</content:encoded>' . "\n" . "</item>\n";
    }
}
// Generate Date SQL
$tz = tz();
if (!mysql_query(isset($d_sql))) {
    $d_sql = "SELECT DATE_FORMAT(`date`, '%Y-%m-%dT%T') as `date` " . "FROM `{$log_table}` " . "WHERE `draft` = '0' ORDER BY `date` desc LIMIT 1";
    $d_res = mysql_query($d_sql);
    $row = mysql_fetch_array($d_res);
}
// Send XML Header
header("Content-type: application/xml");
//header("Content-type: application/rdf+xml");
echo <<<RSS_FEED
<?xml version="1.0" encoding="{$cfg['charset']}"?>
<?xml-stylesheet href="http://{$_SERVER['HTTP_HOST']}{$cfg['root_path']}rss/style.css" type="text/css"?>
<rdf:RDF xmlns="http://purl.org/rss/1.0/"
         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:content="http://purl.org/rss/1.0/modules/content/"
         xmlns:dc="http://purl.org/dc/elements/1.1/"