コード例 #1
0
 if ((int) $item->get_date('U') > 0) {
     $newitem->setDate((int) $item->get_date('U'));
 } elseif ($extractor->getDate()) {
     $newitem->setDate($extractor->getDate());
 }
 // add authors
 if ($authors = $item->get_authors()) {
     foreach ($authors as $author) {
         // for some feeds, SimplePie stores author's name as email, e.g. http://feeds.feedburner.com/nymag/intel
         if ($author->get_name() !== null) {
             $newitem->addElement('dc:creator', $author->get_name());
         } elseif ($author->get_email() !== null) {
             $newitem->addElement('dc:creator', $author->get_email());
         }
     }
 } elseif ($authors = $extractor->getAuthors()) {
     //TODO: make sure the list size is reasonable
     foreach ($authors as $author) {
         // TODO: xpath often selects authors from other articles linked from the page.
         // for now choose first item
         $newitem->addElement('dc:creator', $author);
         break;
     }
 }
 // add language
 if ($detect_language) {
     $language = $extractor->getLanguage();
     if (!$language) {
         $language = $feed->get_language();
     }
     if (($detect_language == 3 || !$language && $detect_language == 2) && $text_sample) {