function author() { $author = array(); $aa = $this->entry->get_authors(); if (count($aa) > 0) { $a = reset($aa); $author = array('name' => $a->get_name(), 'email' => $a->get_email(), 'uri' => $a->get_link()); } if (FEEDWORDPRESS_COMPATIBILITY) { // Search through the MagpieRSS elements: Atom, Dublin Core, RSS if (isset($this->item['author_name'])) { $author['name'] = $this->item['author_name']; } elseif (isset($this->item['dc']['creator'])) { $author['name'] = $this->item['dc']['creator']; } elseif (isset($this->item['dc']['contributor'])) { $author['name'] = $this->item['dc']['contributor']; } elseif (isset($this->feed->channel['dc']['creator'])) { $author['name'] = $this->feed->channel['dc']['creator']; } elseif (isset($this->feed->channel['dc']['contributor'])) { $author['name'] = $this->feed->channel['dc']['contributor']; } elseif (isset($this->feed->channel['author_name'])) { $author['name'] = $this->feed->channel['author_name']; } elseif ($this->feed->is_rss() and isset($this->item['author'])) { // The author element in RSS is allegedly an // e-mail address, but lots of people don't use // it that way. So let's make of it what we can. $author = parse_email_with_realname($this->item['author']); if (!isset($author['name'])) { if (isset($author['email'])) { $author['name'] = $author['email']; } else { $author['name'] = $this->feed->channel['title']; } } } } if (!isset($author['name']) or is_null($author['name'])) { // Nothing found. Try some crappy defaults. if ($this->link->name()) { $author['name'] = $this->link->name(); } else { $url = parse_url($this->link->uri()); $author['name'] = $url['host']; } } if (FEEDWORDPRESS_COMPATIBILITY) { if (isset($this->item['author_email'])) { $author['email'] = $this->item['author_email']; } elseif (isset($this->feed->channel['author_email'])) { $author['email'] = $this->feed->channel['author_email']; } if (isset($this->item['author_uri'])) { $author['uri'] = $this->item['author_uri']; } elseif (isset($this->item['author_url'])) { $author['uri'] = $this->item['author_url']; } elseif (isset($this->feed->channel['author_uri'])) { $author['uri'] = $this->item['author_uri']; } elseif (isset($this->feed->channel['author_url'])) { $author['uri'] = $this->item['author_url']; } elseif (isset($this->feed->channel['link'])) { $author['uri'] = $this->feed->channel['link']; } } return $author; }
function author() { $author = array(); if (isset($this->item['author_name'])) { $author['name'] = $this->item['author_name']; } elseif (isset($this->item['dc']['creator'])) { $author['name'] = $this->item['dc']['creator']; } elseif (isset($this->item['dc']['contributor'])) { $author['name'] = $this->item['dc']['contributor']; } elseif (isset($this->feed->channel['dc']['creator'])) { $author['name'] = $this->feed->channel['dc']['creator']; } elseif (isset($this->feed->channel['dc']['contributor'])) { $author['name'] = $this->feed->channel['dc']['contributor']; } elseif (isset($this->feed->channel['author_name'])) { $author['name'] = $this->feed->channel['author_name']; } elseif ($this->feed->is_rss() and isset($this->item['author'])) { // The author element in RSS is allegedly an // e-mail address, but lots of people don't use // it that way. So let's make of it what we can. $author = parse_email_with_realname($this->item['author']); if (!isset($author['name'])) { if (isset($author['email'])) { $author['name'] = $author['email']; } else { $author['name'] = $this->feed->channel['title']; } } } else { $author['name'] = $this->feed->channel['title']; } if (isset($this->item['author_email'])) { $author['email'] = $this->item['author_email']; } elseif (isset($this->feed->channel['author_email'])) { $author['email'] = $this->feed->channel['author_email']; } if (isset($this->item['author_url'])) { $author['uri'] = $this->item['author_url']; } elseif (isset($this->feed->channel['author_url'])) { $author['uri'] = $this->item['author_url']; } elseif (isset($this->feed->channel['link'])) { $author['uri'] = $this->feed->channel['link']; } return $author; }