<?php function plugin_my_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"; // RSSサイトURL(複数可) //$rdf[] = "http://www.nikkeibp.co.jp/news/rss/it/index.rdf"; //$rdf[] = "http://arena.nikkeibp.co.jp/index.rdf"; //$rdf[] = "http://pc.nikkeibp.co.jp/pc/rss/pc_news.rdf"; //$rdf[] = "http://www3.asahi.com/rss/index.rdf"; if(func_num_args()>0) { $pnum = func_num_args(); $array = func_get_args(); for ($i = 0; $i < $pnum - 1 ; $i++){ $rdf[] = htmlspecialchars($array[$i]); } $num = htmlspecialchars($array[$pnum - 1]); } // 記事表示件数 // $num = 2; // 文字コード SJIS or EUC-JP or UTF-8 ・・サイトに合わせて変更してん $code = "EUC-JP"; $outstr ="<Br><table border=0 bordercolor=\"black\" cellspacing=0>"; foreach ($rdf as $rssurl) { $r =& new XML_RSS($rssurl); $r->parse(); if ($ch = $r->getChannelInfo()){ $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><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 = 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 . "<tr><td><small>・<a href=\"$link\" target=_new>$title</a></small>"; $outstr = $outstr . "</td></tr>"; } }else{ $outstr = $outstr . "<tr><th align=\"left\" bgcolor=\"#ff8080\"><small>RSS 読み取りエラー</small></th></tr>"; $outstr = $outstr . "<tr><td><small>$rssurl のRSSのデータが取得できませ ん</small></tr></td>"; $outstr = $outstr . "<tr><td><small>$rssurl のRSSのデータが取得できません</small></tr></td>"; } //echo $outstr; //フッタ //echo $outstr; $outstr2 = $outstr . "</table>"; } return $outstr2; } ?>