BLOGGER ftp公開廃止に伴う移行 その3 rssの書式

atom rss2.0 rss1.0は以下の感じで作っています。

if(isset($_GET['feed']) && $_GET['feed']){$xml=$_GET['feed'];}

if(isset($xml)){
$rss_title="ヘアサロン店長の独り言/奈良県橿原市/アトリエヘアピークス";
$rss_description="奈良県橿原市の美容室AtelierhairPeaksの店長の独り言プログです、ヘアケア、スタイルは勿論、車やプログラムを綴っています。";
$year=date("Y");

if($xml=="rdf"){
print <<<EOF
<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF xmlns="http://purl.org/rss/1.0/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xml:lang="ja">
<channel rdf:about="$BASE_URL/rdf.xml">
<title>$rss_title</title>
EOF;
}elseif($xml=="rss"){
print <<<EOF
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0">
<channel>
<title>$rss_title</title>
<link>$BASE_URL/rss.xml</link>
<description>$rss_description</description>
<language>ja</language>
<copyright>Copyright $year, PeaksDesign</copyright>
EOF;
}elseif($xml=="atom"){
print <<<EOF
<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
 <title type="text">$rss_title</title>
<subtitle type="text">$rss_description</subtitle>
<link rel="self" type='application/atom+xml' href="$BASE_URL/atom.xml"/>
<link rel='alternate' type='text/html' href='$BASE_URL/'/>
<author><name>PeaksDesign</name></author>
EOF;
}}

foreach( $bloglogDATA as $key => $value) {list($date,$title,$tag,$url,$text)=split("<>",$value);
$rss_title=$title;
$rss_link="$BASE_URL/$url";
$description ="<![CDATA[<b>$text</b>]]>";
$ctime2 =$date;
$rss_category = ereg_replace(",", "</category><category>", $tag);
$rss_term = "<category term='" .ereg_replace(",", "'/><category term='", $tag)."'/>";
if(!$toptime){$toptime =$ctime2;}

if(isset($xml) && $xml =="rdf"){
$items_list .= " <rdf:li rdf:resource='$rss_link'/>\n";
$item_rdf .="
 <item rdf:about='$rss_link'>
  <title>$rss_title</title>
   <link>$rss_link</link>
   <description>$description</description>
   <dc:date>$ctime2</dc:date>
 </item>";
}elseif(isset($xml) && $xml =="rss"){
$item_rss2 .="
 <item>
  <title>$rss_title</title>
   <description>$description</description>
   <link>$rss_link</link>
   <guid>$rss_link</guid>
   <category>$rss_category</category>
   <pubDate>$ctime2</pubDate>
 </item>";
}elseif(isset($xml) && $xml =="atom"){
$item_atom .="
 <entry>
  <title>$rss_title</title>
    <link rel='alternate' type='text/html' href='$rss_link' title='$rss_title'/>
  <content type='html'>$description</content>
  <published>$ctime2</published>
  <updated>$ctime2</updated>
  <author><name>PeaksDesign</name><uri>https://www.peaks.jp/</uri></author>
  $rss_term
  <id>$rss_link</id>
 </entry>";
}
}

if(isset($xml) && $xml =="rdf"){
print"
<link>$rss_link</link>
<description>$rss_description</description>
<items>
<rdf:Seq>
$items_list
</rdf:Seq>
</items>
</channel>
$item_rdf
</rdf:RDF>
";
exit;
}elseif(isset($xml) && $xml =="rss"){
print"
<lastBuildDate>$toptime</lastBuildDate>
<generator>PeaksDesign</generator>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
$item_rss2
</channel>
</rss>
";
exit;
}elseif(isset($xml) && $xml =="atom"){
print"
 <updated>$toptime</updated>
 <id>http://example.com/atom1.xml</id>
$item_atom
</feed>
";
exit;
}