public function setAuthor($author, $email = null, $uri = null)
    {
        if ($this->version == Feed::RSS1)
            throw new InvalidOperationException('The author element is not supported in RSS1 feeds.');

        // Regex from RFC 4287 page 41
        if ($email != null && preg_match('/.+@.+/', $email) != 1)
            throw new \InvalidArgumentException('The email address is syntactically incorrect.');

        if ($this->version == Feed::RSS2)
        {
            if ($email != null)
                $author = $email . ' (' . $author . ')';

            $this->addElement('author', $author);
        }
        else
        {
            $elements = array('name' => $author);

            if ($email != null)
                $elements['email'] = $email;

            if ($uri != null)
                $elements['uri'] = $uri;

            $this->addElement('author', $elements);
        }

        return $this;
    }
public function setAuthor($author, $email = null, $uri = null)
    {
        if ($this->version == Feed::RSS1)
            throw new InvalidOperationException('The author element is not supported in RSS1 feeds.');

        // Regex from RFC 4287 page 41
        if ($email != null && preg_match('/.+@.+/', $email) != 1)
            throw new \InvalidArgumentException('The email address is syntactically incorrect.');

        if ($this->version == Feed::RSS2)
        {
            if ($email != null)
                $author = $email . ' (' . $author . ')';

            $this->addElement('author', $author);
        }
        else
        {
            $elements = array('name' => $author);

            if ($email != null)
                $elements['email'] = $email;

            if ($uri != null)
                $elements['uri'] = $uri;

            $this->addElement('author', $elements);
        }

        return $this;
    }
public function setAuthor ( $ author , $ email = null , $ uri = null ) { if ( $ this -> version == Feed :: RSS1 ) throw new InvalidOperationException ( 'The author element is not supported in RSS1 feeds.' ) ; // Regex from RFC 4287 page 41 if ( $ email != null && preg_match ( '/.+@.+/' , $ email ) != 1 ) throw new \ InvalidArgumentException ( 'The email address is syntactically incorrect.' ) ; if ( $ this -> version == Feed :: RSS2 ) { if ( $ email != null ) $ author = $ email . ' (' . $ author . ')' ; $ this -> addElement ( 'author' , $ author ) ; } else { $ elements = array ( 'name' => $ author ) ; if ( $ email != null ) $ elements [ 'email' ] = $ email ; if ( $ uri != null ) $ elements [ 'uri' ] = $ uri ; $ this -> addElement ( 'author' , $ elements ) ; } return $ this ; }
Set the 'author' element of feed item.
Not supported in RSS 1.0 feeds.

@access   public
@param    string $author The author of this item
@param    string|null $email Optional email address of the author
@param    string|null $uri Optional URI related to the author
@return   self
@throws   \InvalidArgumentException if the provided email address is syntactically incorrect.
@throws   InvalidOperationException if this method is called on RSS1 feeds.
Set the author element of feed item . Not supported in RSS 1 . 0 feeds .