/** * Get user agent information as XML * @param \DOMElement $node */ public static function getUserAgentXML($node) { if ($ua = self::getUserAgent()) { DOM::array2domAttr($node, $ua); } if ($uac = self::getUserAgentClass()) { $node->setAttribute('uaClass', $uac); } }
/** * Get plugins information as XML * @param \DOMElement|\DOMNode $node */ public static function getPluginsXML($node) { self::smartPluginsEnable(); self::fillMissingReq(); $pluginsNode = $node->appendChild($node->ownerDocument->createElement('plugins')); DOM::array2domAttr($pluginsNode, self::$pluginsData); $provisionsNode = $node->appendChild($node->ownerDocument->createElement('provisions')); DOM::array2domAttr($provisionsNode, self::$provisions); }
/** * Add console data to output XML * @param \DOMNode|\DOMElement $node * @param bool $standalone * @return string */ public static function debugXML($node, $standalone = false) { self::init(); $node->setAttribute('debug', self::$enabled ? '1' : '0'); $node->setAttribute('debugConsole', self::$console); $node->setAttribute('caches', self::$caches ? '1' : '0'); if (!self::$console) { return; } /** @var $debugNode \DOMElement */ $debugNode = $node->appendChild($node->ownerDocument->createElement('debug')); Libs\XML\DOM::array2domAttr($debugNode, self::$output, true); if ($standalone) { $node->setAttribute('standalone', 1); } }
/** * If some disallowed element is not empty, replace it with span * @param \DOMElement $node */ private function replace(&$node) { if (!$node->hasChildNodes()) { $node->parentNode->removeChild($node); return; } DOM::renameNode($node, 'span'); }