_baseUrl = $params['baseurl']; } else { $this->_baseUrl = c::config()->baseUrl->{c::env()}; } } public function addItem($params) { if (isset($params['loc'])) { $content = ''; if (!isset($params['lastmod'])) { $params['lastmod'] = date('Y-m-d'); } if (!isset($params['changefreq'])) { $params['changefreq'] = 'monthly'; } if (!isset($params['priority'])) { $params['priority'] = '0.5'; } foreach ($params as $key => $value) { if ($key == 'loc' && !isset($params['options']['nobase'])) { $value = $this->_baseUrl.$value; } if ($key != 'options') { $content .= '<'.$key.'>'.$value.''; } } $content .= ''; $this->_content .= $content; } } public function content() { return ''.$this->_content.''; } public function output() { header('content-type: text/xml'); echo $this->content(); } }