Wordpressで作成されたブログのRSSを表示したいのですが、
記事内容の文字数を100文字に設定しても54文字までしか表示がされません。
54文字以上は表示出来ないような制限があるのでしょうか?
もしくはどこかの設定が間違っているのでしょうか?
ご教授の程宜しくお願いいたします。
「blogrss.php」
/*------------------------------------------------------------------------ 名称 :ブログRSS情報取得(blogrss.php) 説明 :ブログRSS情報を取得し、整形出力する。 : ※1 RSS1.0/RSS2.0 対応 : パラメータ :$u RSSフィードURL(設定時、環境設定より優先) :$n 表示記事数(0の場合、すべて表示) :$o 出力データ[D/T/S](D:記事投稿日 T:記事タイトル S:記事内容) :$w ウインドウサイズ[横/縦](0の場合、親ウインドウに表示) :$bc ブログ名称表示文字数(0の場合、すべて表示) :$tc タイトル表示文字数(0の場合、すべて表示) :$ec 記事内容表示文字数(0の場合、すべて表示) :$f 環境設定ファイル(config_XX.phpのXXを指定) : 履歴 :2008/03/19 新規作成 :2008/10/15 修正(環境設定ファイルパラメータ/複数ブログ複数記事読込み) : ------------------------------------------------------------------------*/ /*------------------------------------------------------------------------ パラメータ取得 ------------------------------------------------------------------------*/ // RSSフィードURL $inRss_url = $_GET['u']; // SereneBach-カテゴリ別RSSフィードURL対応 if ($_GET['cid']) { $inRss_url .= '&cid=' . $_GET['cid']; } // 表示記事数(0の場合、すべて表示) $inNum = $_GET['n']; // 出力データ[D/T/S](D:記事投稿日 T:記事タイトル S:記事内容) $inOutData = $_GET['o']; // ウインドウサイズ[横/縦](0の場合、親ウインドウに表示) $inWindowSize = $_GET['0']; // ブログ名称表示文字数(0の場合、すべて表示) $inBlogNmCharCount = $_GET['bc']; // タイトル表示文字数(0の場合、すべて表示) $inTitleCharCount = $_GET['tc']; // 記事内容表示文字数(0の場合、すべて表示) $inEntryCharCount = $_GET['ec']; // RSS設定読込み require_once("./Lib/RSS.php"); // 環境設定読込み $inConfigId = $_GET['f']; if (!empty($inConfigId)) { $inConfigFile = './config_' . $inConfigId . '.php'; } else { $inConfigFile = './config_01.php'; } require_once($inConfigFile); /*------------------------------------------------------------------------ 関数 ------------------------------------------------------------------------*/ // 日付ソート function cmp ($a, $b) { $a = (isset($a['pubdate'])) ? strtotime($a['pubdate']) : strtotime(str_replace("T", " ", substr($a['dc:date'], 0, 19))); $b = (isset($b['pubdate'])) ? strtotime($b['pubdate']) : strtotime(str_replace("T", " ", substr($b['dc:date'], 0, 19))); if ($a == $b) return 0; return ($a > $b) ? -1 : 1; } /*------------------------------------------------------------------------ 処理 ------------------------------------------------------------------------*/ // パラメータ(RSSフィードURL)に値がある場合、優先する if (!empty($inRss_url)) { $RSS_URL = array(); $RSS_URL[] = $inRss_url; } // RSSフィードURL数取得(0:単一 1:複数) if( count($RSS_URL) > 1 ) { $rss_Flg = 1; } else { $rss_Flg = 0; } // RSS取得・解析 $ch = array(); $items = array(); $Rss_Count = 0; foreach ($RSS_URL as $k=>$url) { $r =& new XML_RSS($url); if (PEAR::isError($r)) continue; $r->parse(); if ($r->getChannelInfo()) $ch[$k] = $r->getChannelInfo(); $ch[$k]['items'] = $r->getItems(); // RSS操作 if (( $rss_Flg == 0 ) || ( $RSS_TYPE == 1 )) { $items = array_merge($items, $ch[$k]['items']); } else { $items = array_merge($items, array_slice($ch[$k]['items'], 0, 1)); } for ($j=$Rss_Count; $j<count($items); $j++) { $items[$j]['btitle'] = $ch[$k]['title']; $items[$j]['bdescription'] = $ch[$k]['description']; $items[$j]['blink'] = $ch[$k]['link']; $Rss_Count = $Rss_Count + 1; } } // 日付ソート・記事数取得 $entry_Count = count($items); if( $rss_Flg == 1 ) { usort($items, "cmp"); } // マーク画像タグ設定 if( $MARKIMG != "" ) { $markimg_Tag = '<img src="' . $MARKIMG . '" class="rss_markimg">'; } else { $markimg_Tag = ""; } // 出力データ設定(全体)-Start $str = "\n" . '<div class="blogrss_data">' . "\n"; for ($i=0; $i<$inNum; $i++) { // ブログ名称 $v = strip_tags($items[$i]['btitle']); $blog_Title = mb_convert_encoding($v, $CODE, "UTF-8,EUC-JP,SJIS"); if(( mb_strlen($blog_Title, $CODE) > $inBlogNmCharCount ) && ( $inBlogNmCharCount != 0 )) { $blog_Title = mb_substr($blog_Title, 0, $inBlogNmCharCount, $CODE); $blog_Title .= "..."; } // ブログ説明 $v = strip_tags($items[$i]['bdescription']); $blog_Desc = mb_convert_encoding($v, $CODE, "UTF-8,EUC-JP,SJIS"); // ブログURL $blog_Url = htmlspecialchars($items[$i]['blink']); // 記事タイトル $v = strip_tags($items[$i]['title']); $entry_Title = mb_convert_encoding($v, $CODE, "UTF-8,EUC-JP,SJIS"); if(( mb_strlen($entry_Title, $CODE) > $inTitleCharCount ) && ( $inTitleCharCount != 0 )) { $entry_Title = mb_substr($entry_Title, 0, $inTitleCharCount, $CODE); $entry_Title .= "..."; } // 記事内容 $v = strip_tags($items[$i]['description']); $entry_Desc = mb_convert_encoding($v, $CODE, "UTF-8,EUC-JP,SJIS"); $delList = array(" ", " ", "\n",); $entry_Desc = str_replace($delList, "", $entry_Desc); if(( mb_strlen($entry_Desc, $CODE) > $inEntryCharCount ) && ( $inEntryCharCount != 0 )) { $delList = array("..."); $entry_Desc = str_replace($delList, "", $entry_Desc); $entry_Desc = mb_substr($entry_Desc, 0, $inEntryCharCount, $CODE); $entry_Desc .= "..."; } // 記事URL $entry_Url = htmlspecialchars($items[$i]['link']); // 記事投稿日 $v = (isset($items[$i]['pubdate'])) ? strtotime($items[$i]['pubdate']) : strtotime(str_replace("T", " ", substr($items[$i]['dc:date'], 0, 19))); $entry_Chk_Date = date("Ymd", $v); $entry_Date = date($DATETYPE, $v); // NEW画像タグ設定 if(( $VISDAY <= $entry_Chk_Date ) && ( $NEWVISPERIOD != "" ) && ( $NEWIMG != "" )) { $newimg_Tag = '<img src="' . $NEWIMG . '" class="rss_newimg">'; } else { $newimg_Tag = ""; } // ウインドウサイズ設定 if( $inWindowSize == 0 ) { $windowsize1_Tag = ""; $windowsize2_Tag = ""; } else { $matches = explode( "/", $inWindowSize ); $windowsize1_Tag = "target=\"_blank\" "; $windowsize2_Tag = "target=\"_blank\" onclick=\"window.open('" . $blog_Url . "', '', 'width=" . $matches[0] . ",height=" . $matches[1] . ",scrollbars=yes,menubar=yes,status=yes,titlebar=yes,toolbar=yes,location=yes,resizable=yes');return false;\""; } // 記事数が表示記事数に満たない場合 if( $entry_Count > $i ) { // 出力データ設定(アイテム)-Start $str .= '<div class="rss_items">' . "\n"; // 出力データ設定1(D:記事投稿日 T:記事タイトル) $str .= '<div class="rss_items_box">' . "\n" . $markimg_Tag . "\n"; $matches = explode( "/", $inOutData ); foreach( $matches as $entry_Data ) { switch( $entry_Data ) { case "D": $str .= '<div class="rss_items_date">' . $entry_Date . '</div>' . "\n"; break; case "T": if (( $rss_Flg == 1 ) && ( $VISBLOG == 1 )) { $str .= '<h2 class="rss_items_title"><a href="' . $entry_Url . '" title="' . $entry_Desc . '" ' . $windowsize1_Tag . ' >' . $entry_Title . '</a></h2><p class="rss_blog_title"> - <a href="' . $blog_Url . '" title="' . $blog_Desc . '" ' . $windowsize2_Tag . ' >' . $blog_Title . '</a></p>'. $newimg_Tag . "\n"; } else { $str .= '<h2 class="rss_items_title"><a href="' . $entry_Url . '" title="' . $entry_Desc . '" ' . $windowsize1_Tag . ' >' . $entry_Title . '</a></h2>'. $newimg_Tag . "\n"; } break; } } $str .= '</div>' . "\n"; // 出力データ設定2(S:記事内容) $matches = explode( "/", $inOutData ); foreach( $matches as $entry_Data ) { switch( $entry_Data ) { case "S": $str .= '<p class="rss_items_desc">' . $entry_Desc . '</p>' . "\n"; break; } } // 出力データ設定(アイテム)-End $str .= '</div>' . "\n"; } } // 出力データ設定(全体)-End $str .= '</div>' . "\n"; // データ出力 echo mb_convert_encoding($str, $CODE, "UTF-8,EUC-JP,SJIS"); ?>
回答1件
あなたの回答
tips
プレビュー