Convert an author in the form of "Author Name <mail@example.org>" to author array.

@param string $author The author.

@return array
540434
private function convertAuthor($author)
    {
        list($name, $email) = \explode(' <', $author);
        return [
            'name'     => \trim($name),
            'email'    => \trim(\substr($email, 0, -1)),
        ];
    }
987538
protected function setAuthors($json, $authors)
    {
        $json['authors'] = [];
        foreach ($authors as $author) {
            $json['authors'][] = $author;
        }

        return $json;
    }
769315
public function getAuthors()
    {
        $authors = array();
        foreach ($this->xml->xpath('//AdministrativeMetadata/Property[@FormalName="author"]') as $author) {
            $authorName = $this->readName((string) $author['Value']);
            $authors[] = array(
                'firstname' => $authorName['firstname'],
                'lastname' => $authorName['lastname'],
                'email' => '',
                'link' => '',
            );
        }

        return implode(', ', $authors);
    }
1066135
public function buildUserData($user)
    {
        if (is_string($user)) {
            return array(
                'id' => $user,
            );
        }

        if (!($user instanceof UserInterface)) {
            return array();
        }

        $userData['id'] = method_exists($user, 'getId')
            ? $user->getId()
            : $user->getUsername();

        $userData['username'] = $user->getUsername();

        if (method_exists($user, 'getEmail')) {
            $userData['email'] = $user->getEmail();
        }

        return $userData;
    }
1084968
public void addAuthor(String author) {
		XmpArray array = new XmpArray(XmpArray.ORDERED);
		array.add(author);
		setProperty(CREATOR, array);
	}
44618
protected function getAuthor($author)
    {
        if (false === empty($author)) {
            return $author;
        }
        if (true === isset($GLOBALS['BE_USER']) && true === isset($GLOBALS['BE_USER']->user['name'])) {
            return $GLOBALS['BE_USER']->user['name'] .
                isset($GLOBALS['BE_USER']->user['email']) ? '<' . $GLOBALS['BE_USER']->user['email'] . '>' : '';
        }

        return self::DEFAULT_AUTHOR;
    }
226544
public function addAuthors($authors)
    {
        $app = App::getInstance();

        foreach ($authors as $author) {
            $authorRecord = new ArticleAuthor();
            $authorRecord->setArticle($this)->setAuthor($author)->save();
        }
        return $authors;
    }
691972
public function validateAuthors(array $authors)
    {
        if(!count($authors)) {
            $this->addError('Empty authors section');
            return false;
        }
        $count = 0;
        foreach($authors as $k=>$v) {
            $count++;
            array_map('trim', $v);
            $name = $v['name'];
            $login = $v['user'];
            $email = $v['email'];
            $res = $this->validateMaxLen($name, 256) && strlen($name);
            if(!$res) {
                $this->addError("Invalid or empty name for author #{$count}");
            }
            $res = $this->validatePackageName($login) && strlen($login);
            if(!$res) {
                $this->addError("Invalid or empty login for author #{$count}");
            }
            $res = $this->validateEmail($email);
            if(!$res) {
                $this->addError("Invalid or empty email for author #{$count}");
            }
        }
        return ! $this->hasErrors();
    }
1041667
public function getAuthorName()
    {
        if ($this->Name) {
            return $this->Name;
        } elseif ($author = $this->Author()) {
            return $author->getName();
        }
    }
1095742
public function ignoreAuthor($author)
    {
        $this->ignoredAuthors[$this->arrayKey($author)] = \trim($author);

        return $this;
    }
401530
public function getContentAllReplies(string $author, string $permalink)
    {
        $request = $this->getContentReplies($author, $permalink);

        if(is_array($request))
        {
            foreach ($request as $key => $item)
            {
                if($item['children'] > 0)
                    $request[$key]['replies'] = $this->getContentAllReplies($item['author'], $item['permlink']);
                else
                    $request[$key]['replies'] = [];
            }
        }

        return $request;
    }
144750
function author() {
      function _author(author) {
        var format;
        if (typeof author === 'string') {
          return author;
        }
        format = require('util').format;
        return format('%s <%s>', author.name, author.email);
      }

      if (Array.isArray(pkg.author)) {
        return pkg.author.map(function (author) {
          return _author(author);
        }).join(', ');
      }
      return _author(pkg.author);
    }
390988
def _parse_authors(details):
    
    authors = details.find(
        "tr",
        {"id": "ctl00_ContentPlaceHolder1_tblRowAutor"}
    )

    if not authors:
        return []  # book with unspecified authors

    # parse authors from HTML and convert them to Author objects
    author_list = []
    for author in authors[0].find("a"):
        author_obj = Author(author.getContent())

        if "href" in author.params:
            author_obj.URL = author.params["href"]

        author_list.append(author_obj)

    return author_list
658095
public function getAuthor()
    {
        if ($this->author === null) {
            $this->author = $this->authorFactory->create($this->getAuthorId());
        }

        return $this->author;
    }
1294182
private function create_authors_for_mapping( $author_data ) {

		$author_mapping = array();
		foreach ( $author_data as $author ) {

			if ( isset( $author->user_email ) ) {
				$user = get_user_by( 'email', $author->user_email );
				if ( $user instanceof WP_User ) {
					$author_mapping[] = array(
						'old_user_login' => $author->user_login,
						'new_user_login' => $user->user_login,
					);
					continue;
				}
			}

			$user = get_user_by( 'login', $author->user_login );
			if ( $user instanceof WP_User ) {
				$author_mapping[] = array(
					'old_user_login' => $author->user_login,
					'new_user_login' => $user->user_login,
				);
				continue;
			}

			$user = array(
				'user_login' => '',
				'user_email' => '',
				'user_pass'  => wp_generate_password(),
			);
			$user = array_merge( $user, (array) $author );

			$user_id = wp_insert_user( $user );
			if ( is_wp_error( $user_id ) ) {
				return $user_id;
			}

			$user             = get_user_by( 'id', $user_id );
			$author_mapping[] = array(
				'old_user_login' => $author->user_login,
				'new_user_login' => $user->user_login,
			);
		}
		return $author_mapping;

	}
1260849
public static function Attributes($user) {
      $user = (array)$user;
      $attributes = $user['Attributes'];
      if (is_string($attributes))
         $attributes = unserialize($attributes);
      if (!is_array($attributes))
         $attributes = array();
      return $attributes;
   }
899382
public function setAuthor(Author $author)
    {
        $this->attachment['author_name'] = $author;

        if ($author->hasIcon()) {
            $this->attachment['author_icon'] = $author->getIcon();
        }

        if ($author->hasLink()) {
            $this->attachment['author_link'] = $author->getLink();
        }

        return $this;
    }