You are here

protected function Feed::getAuthorFromElement in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Feed.php \Zend\Feed\Reader\Extension\Atom\Feed::getAuthorFromElement()

Get an author entry in RSS format

Parameters

DOMElement $element:

Return value

string

1 call to Feed::getAuthorFromElement()
Feed::getAuthors in vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Feed.php
Get an array with feed authors

File

vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Feed.php, line 453

Class

Feed

Namespace

Zend\Feed\Reader\Extension\Atom

Code

protected function getAuthorFromElement(DOMElement $element) {
  $author = [];
  $emailNode = $element
    ->getElementsByTagName('email');
  $nameNode = $element
    ->getElementsByTagName('name');
  $uriNode = $element
    ->getElementsByTagName('uri');
  if ($emailNode->length && strlen($emailNode
    ->item(0)->nodeValue) > 0) {
    $author['email'] = $emailNode
      ->item(0)->nodeValue;
  }
  if ($nameNode->length && strlen($nameNode
    ->item(0)->nodeValue) > 0) {
    $author['name'] = $nameNode
      ->item(0)->nodeValue;
  }
  if ($uriNode->length && strlen($uriNode
    ->item(0)->nodeValue) > 0) {
    $author['uri'] = $uriNode
      ->item(0)->nodeValue;
  }
  if (empty($author)) {
    return;
  }
  return $author;
}