ニュース一覧

$rss_url) { $rss = @fetch_rss($rss_url); if ($rss != NULL) { for ($i=0; $iitems); $i++) { $rss->items[$i]["site_title"] = $rss->channel["title"]; $rss->items[$i]["site_link"] = $rss->channel["link"]; } $rssItemsArray[] = $rss->items; } }//--▲foreach-- $concatArray = array(); for($i=0;$i $values) { //RSSの種類によって日付を取得 if($values['published']){$date = $values['published'];}//Atom1.0 elseif($values['dc']['date']){$date = $values['dc']['date'];}//RSS1.0 elseif($values['pubdate']){$date = $values['pubdate'];}//RSS2.0 $date=date("Y-m-d H:i:s",strtotime($date));//形式を揃える //Filter $nowtime = date("Y-m-d H:i:s",strtotime( "now" ));//現在時刻の取得 if($date > $nowtime){//未来記事の排除 }elseif(preg_match("/AD/", $values["title"])){//広告記事の排除 }elseif(preg_match("/PR/", $values["title"])){ }else{ //値の定義 $title=$values["title"]; $link=$values["link"]; $site_title=$values["site_title"]; $site_link=$values["site_link"]; $desc = $values["description"]; if($values["thumb"]){ $img = $values["thumb"]; }else if($values["images_url"]){ $img = $values["images_url"]; }else{ $img = ""; } //画像取得 $content=$values["content"]["encoded"]; preg_match('//i', $content, $img_all); if(empty($img_all[0])) { $content = $values['description']; preg_match('//i', $content, $img_all); } preg_match('/http.*?(\.gif|\.png|\.jpg|\.jpeg$|\.bmp)/i', $img_all[0], $gazo); if(empty($gazo[0])) {$gazo = "http://azaz.clouver.jp/antenna/noimage.png";} else{$gazo = $gazo[0];} //配列 $rssArray[]=array($date, $title, $link, $site_title, $site_link,$gazo,$desc,$img); }//--▲if--Filter-- }//--▲foreach-- //配列設定 $num = 20;//最大件数 if(count($rssArray)>$num){$count=$num;}else{$count=count($rssArray);}//取得件数優先 rsort($rssArray);//並び替え //HTML整形 echo "
    \n"; for ($i=0; $i<$count; $i++) { $date=date("Y年m月d日",strtotime($rssArray[$i][0])); $title=$rssArray[$i][1]; $link=$rssArray[$i][2]; $site_title=$rssArray[$i][3]; $site_link=$rssArray[$i][4]; $gazo=$rssArray[$i][5]; $desc=mb_substr(strip_tags($rssArray[$i][6]),0,180,"UTF-8")."..."; if($rssArray[$i][7]){ $img = "/news_thumb/square.php?image=".$rssArray[$i][7]; }else{ $img = "/images/sample_img_01.gif"; } if($site_link){ $favicon = ""; } else { $favicon = ""; } $datelink = "$date"; $gazolink = "
    "; $titlelink = ""; $site_titlelink = ""; echo "
  • $gazolink$datelink$titlelink$desc$site_titlelink
  • \n"; }//--▲for-- echo "
\n"; ?>