/** * Write Controller' specifics params into XML before send it * * @access protected * @since 1.0 */ protected function writeParams() { // We check if we aren't passed here with the dispatcher if ($this->_output == "xhtml") { if (strpos($this->_generic->getBufferXML(),"<ControllerParams>") === false) { $controllersParams = new SLS_XMLToolbox(false); $controllersParams->startTag("action"); $controllersParams->startTag("metas"); $controllersParams->addFullTag("title", $this->_pageTitle, true); $controllersParams->addFullTag("description", $this->_metas['description'], true); $controllersParams->addFullTag("keywords", $this->_metas['keywords'], true); $controllersParams->addFullTag("robots", $this->_metas['robots'], true); $controllersParams->addFullTag("author", $this->_metas['author'], true); $controllersParams->addFullTag("copyright", $this->_metas['copyright'], true); $controllersParams->addFullTag("favicon", $this->_metas['favicon'], true); $controllersParams->endTag("metas"); $controllersParams->startTag("links"); $links = $this->_generic->getRegisteredLinks(); for($i=0;$i<count($links);$i++) { $controllersParams->startTag("link"); $controllersParams->addFullTag("name", strtoupper($links[$i]['codeName']), true); $controllersParams->addFullTag("href", $links[$i]['href'], true); $controllersParams->endTag("link"); } $controllersParams->endTag("links"); $controllersParams->endTag("action"); // Save it into the XML's buffer $this->_generic->setBufferXML($controllersParams->getXML(), true, "//root/Statics/Sls/Configs"); } // Set Protocol $xml = new SLS_XMLToolbox($this->_generic->getBufferXML()); $xml->setTag("//root/Statics/Sls/Configs/site/protocol", $this->_generic->getProtocol(), true); $xml->setTag("//root/Statics/Sls/Configs/site/siteprotocol", $this->_generic->getSiteConfig('protocol'), true); $this->_generic->setBufferXML($xml->getXML(), false); } elseif ($this->_output == "json") { $xml = new SLS_XMLToolbox($this->_generic->getBufferXML()); $output = json_encode(SLS_XMLToArray::createArray($xml->getNode("//root/View"))); header('Content-Type: application/json'); header('X-Robots-Tag: noindex,nofollow,noarchive'); print($output); exit; } else if ($this->_output == "rss" || $this->_output == "atom") { if ($this->_output == "rss") header('Content-Type: application/rss+xml'); else header('Content-Type: application/atom+xml'); print($this->_outputOptions); exit; } else { header("Content-type: text/xml"); if (!is_null($this->_outputOptions)) print($this->_outputOptions); else { $xml = new SLS_XMLToolbox($this->_generic->getBufferXML()); $view = $xml->getNode("//root/View"); print('<?xml version="1.0" encoding="UTF-8"?>'.$view); } exit; } }