function comment_text_rss($with_html = false)
{
    global $blog_charset;
    global $comment;
    $comment_text = stripslashes($comment->comment_content);
    $comment_text = str_replace('<trackback />', '', $comment_text);
    $comment_text = str_replace('<pingback />', '', $comment_text);
    $comment_text = convert_chars($comment_text);
    $comment_text = convert_bbcode($comment_text);
    $comment_text = convert_gmcode($comment_text);
    $comment_text = convert_smilies($comment_text);
    $comment_text = apply_filters('comment_text', $comment_text);
    if (!$with_html) {
        $comment_text = strip_tags($comment_text);
        $comment_text = htmlspecialchars($comment_text);
    }
    $rss_charset = wp_get_rss_charset();
    if ($blog_charset != $rss_charset) {
        echo mb_convert_encoding($comment_text, $rss_charset, $blog_charset);
    } else {
        echo $comment_text;
    }
}
Пример #2
0
// enter your blog's ID
$doing_rss = 1;
header("Content-type: application/xml");
include_once dirname(__FILE__) . "/../../mainfile.php";
error_reporting(E_ERROR);
if ($_GET['num']) {
    $showposts = $_GET['num'];
}
require 'wp-blog-header.php';
if (isset($showposts) && $showposts) {
    $showposts = (int) $showposts;
    $posts_per_page = $showposts;
} else {
    $posts_per_page = get_settings('posts_per_rss');
}
$rss_charset = wp_get_rss_charset();
echo '<?xml version="1.0" encoding="' . $rss_charset . '"?' . '>';
?>
<!-- generator="wordpress/<?php 
echo $wp_version;
?>
" -->
<rss version="0.92">
    <channel>
        <title><?php 
bloginfo_rss("name");
?>
</title>
        <link><?php 
bloginfo_rss("url");
?>
 function wp_convert_rss_charset($srcstr)
 {
     return mb_conv($srcstr, wp_get_rss_charset(), $GLOBALS['blog_charset']);
 }
<?php

$GLOBALS['blog'] = 1;
$GLOBALS['doing_rss'] = 1;
require_once dirname(__FILE__) . '/wp-config.php';
error_reporting(E_ERROR);
init_param('GET', 'num', 'integer');
if (test_param('num')) {
    $GLOBALS['showposts'] = get_param('num');
}
require_once 'wp-blog-header.php';
header('Content-type: application/xml');
echo '<?xml version="1.0" encoding="' . wp_get_rss_charset() . '"?' . '>';
?>
<!-- generator="wordpress/<?php 
echo $GLOBALS['wp_version'];
?>
" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">

<channel>
	<title><?php 
bloginfo_rss('name');
?>
</title>
	<link><?php 
bloginfo_rss('url');
?>
</link>
	<description><?php 
function wp_convert_rss_charset($srcstr)
{
    global $blog_charset;
    $rss_charset = wp_get_rss_charset();
    if ($blog_charset != $rss_charset) {
        return mb_convert_encoding($srcstr, $rss_charset, $blog_charset);
    } else {
        return $srcstr;
    }
}
function wp_convert_rss_charset($srcstr)
{
    $rss_charset = wp_get_rss_charset();
    if ($GLOBALS['blog_charset'] != $rss_charset) {
        if (strtolower($GLOBALS['blog_charset']) == 'euc-jp' && strtolower($rss_charset) == 'utf-8') {
            return mb_convert_encoding(mb_convert_encoding($srcstr, "SJIS", "EUC-JP"), "UTF-8", "SJIS-win");
        }
        return mb_convert_encoding($srcstr, $rss_charset, $GLOBALS['blog_charset']);
    } else {
        return $srcstr;
    }
}