<?php function plugin_rssv2_convert() { //Modify By JE2ISM //RSSサイトの表示を行うプラグイン // Use #rssv2([RSS_URL],[RSS_URL],...,[1リクエストページの表示件数]) // e.g #rssv2(http://www.nikkeibp.co.jp/news/rss/it/index.rdfhttp://pc.nikkeibp. co.jp/pc/rss/pc_news.rdf,3) //require "RSS.php"; //PEAR導入済みの場合↓ require "XML/RSS.php"; if(func_num_args()>0) { $pnum = func_num_args(); $array = func_get_args(); for ($i = 0; $i < $pnum - 1 ; $i++){ $rdf[] = $array[$i]; } $num = $array[$pnum - 1]; } // 文字コード SJIS or EUC-JP or UTF-8 ・・サイトに合わせて変更してん $code = "EUC-JP"; $outstr ="<Br><table border=1 bordercolor=\"black\" cellspacing=0>"; foreach ($rdf as $rssurl) { $r =& new XML_RSS($rssurl); $r->parse(); if (!$ch = $r->getChannelInfo()) echo "データが取得できません"; $site_title = mb_convert_encoding($ch['title'], $code, "UTF-8,EUC-JP,SJIS"); $site_title = htmlspecialchars($site_title); $site_link = $ch['link']; // ヘッダ $outstr = $outstr . "<tr> <th align=\"left\" bgcolor=\"#80ffff\">"; $outstr = $outstr ."<small>[[ <a href=\"$site_link\"target=_blank>$site_title</a> ]]</small>"; $outstr = $outstr ."</th> </tr>"; $outstr = $outstr . "<tr bgcolor = \"red\"><td>"; //echo $outstr; //$num = count($r->getItems()); for ($i=0; $i<$num; $i++) { $val = $r->getItems(); $title = mb_convert_encoding(strip_tags($val[$i]['title']), $code, "UTF-8,EUC-JP,SJIS"); $desc = mb_convert_encoding(strip_tags($val[$i]['description']), $code, "UTF-8,EUC-JP,SJIS"); $desc =""; //内容の消去 $link = htmlspecialchars($val[$i]['link']); $date = $val[$i]['dc:date']; // 内容 $outstr = $outstr . "<small><a href=\"$link\" target=_new>$title</a></small> </br>"; } $outstr = $outstr . "</td></tr>"; //echo $outstr; //フッタ //echo $outstr; $outstr2 = $outstr . "</table>"; } return $outstr2; } ?>