* @license PHP License * @package WB * @subpackage content */ /** * Load base class */ WBClass::load('WBContent'); /** * Content component: CrossDomainXML * * Display crossdomain.xml * * @version 0.1.0 * @package WB * @subpackage content */ class WBContent_CrossDomainXML extends WBContent { /** * my parameter list * @var array */ protected $config = array( 'file' => 'default' ); /** * run * * run component * * @return array parameter list */ public function run() { $base = WBParam::get('wb/dir/base'); $fmt = '%s/%s/crossdomain/%s.xml'; $file = sprintf( $fmt, $base, 'etc', $this->config['file'] ); if (!file_exists($file)) { $file = sprintf( $fmt, $base, 'etc-default', $this->config['file'] ); if (!file_exists($file)) { WBClass::load('WBException_File'); throw new WBException_File('Cross domain XML file: '. $this->config['file'] .' not found.', 1, __CLASS__); } } $this->display(file_get_contents($file)); return $this->config; } /** * create standard google sitemap * * @link http://www.sitemaps.org/ * @uses display() */ protected function displaySitemap() { $this->display($cnt, 'text/xml'); } /** * Display * * CAUTION: This method does not return! * * @param string $content */ protected function display($content) { $res = WBClass::create('WBResponse'); /** @var $res WBResponse */ $res->add($content); $res->addHeader('Content-Type', 'text/xml'); $res->send($this->req); exit(0); } } ?>