protected function __add__($arg) { if ($arg instanceof AtomEntry) { $this->entry[] = $arg; } else { if ($arg instanceof self) { foreach ($arg->arEntry() as $entry) { $this->entry[] = $entry; } } else { if (is_implements_of($arg, "AtomInterface")) { $entry = new AtomEntry(); $entry->id($arg->atom_id()); $entry->title($arg->atom_title()); $entry->published($arg->atom_published()); $entry->updated($arg->atom_updated()); $entry->issued($arg->atom_issued()); $content = new AtomContent(); $content->value($arg->atom_content()); $entry->content($content); $summary = new AtomSummary(); $summary->value($arg->atom_summary()); $entry->summary($summary); $entry->link(new AtomLink("href=" . $arg->atom_href())); $entry->author(new AtomAuthor("name=" . $arg->atom_author())); $this->entry[] = $entry; } } } }
} ///////////////////////////////////////////////////////////////////////////////////////////////////// $contents2 = dbSortedContents(array()); extract($contents2[0]); global $blog; // $atom = new AtomFeed(array('xml:lang' => 'ja')); $atom->title($blog); $atom->link("{$_SERVER['SCRIPT_NAME']}"); $atom->link("{$_SERVER['REQUEST_URI']}", 'self'); $atom->id("{$_SERVER['SCRIPT_NAME']}/feed"); $atom->updated($moddate); $atom->author(array('name' => 'nyankoPress')); $cnt = 0; foreach ($contents2 as $value) { extract($value); $entry = new AtomEntry(); $entry->title($title); $entry->link("{$_SERVER['SCRIPT_NAME']}?p={$page}"); $entry->id("{$_SERVER['SCRIPT_NAME']}/p{$page}"); $entry->summary(mb_strimwidth(strip_tags($contents), 0, 80, '…', 'utf-8')); $entry->updated($moddate); $entry->author(array('name' => $author)); $atom->addEntry($entry); $cnt++; if ($cnt >= 10) { break; } } header('Content-Type: application/atom+xml'); echo $atom->saveXml();