rss::__construct PHP Method

__construct() public method

public __construct ( $name, $description, $url, $language )
    public function __construct($name, $description, $url, $language)
    {
        // create a dom xml object
        $this->document = new DOMDocument('1.0', 'UTF-8');
        // create our rss feed
        $rss = $this->element('rss', null, array('version' => '2.0', 'xmlns:atom' => 'http://www.w3.org/2005/Atom'));
        $this->document->appendChild($rss);
        // create channel
        $this->channel = $this->element('channel');
        $rss->appendChild($this->channel);
        // title
        $title = $this->element('title', $name);
        $this->channel->appendChild($title);
        // link
        $link = $this->element('link', $url);
        $this->channel->appendChild($link);
        // description
        $description = $this->element('description', $description);
        $this->channel->appendChild($description);
        // laguage
        // http://www.rssboard.org/rss-language-codes
        $language = $this->element('language', $language);
        $this->channel->appendChild($language);
        $ttl = $this->element('ttl', 60);
        $this->channel->appendChild($ttl);
        $docs = $this->element('docs', 'http://blogs.law.harvard.edu/tech/rss');
        $this->channel->appendChild($docs);
        $copyright = $this->element('copyright', $name);
        $this->channel->appendChild($copyright);
        // atom self link
        $atom = $this->element('atom:link', null, array('href' => $url, 'rel' => 'self', 'type' => 'application/rss+xml'));
        $this->channel->appendChild($atom);
    }