function buildMenu() { global $Settings; global $xsltSettings; $menu = xml2html($Settings["ContentFolder"] . "/toc.xml", $Settings["XsltFolder"] . "/menu.xslt", $xsltSettings); file_put_contents($Settings["CacheFolder"] . "/menu.xml", $menu); }
<?php $page = $_REQUEST["p"]; function xml2html($xmldata, $xsl) { $xmlDoc = new DOMDocument(); $xmlDoc->load($xmldata); $xslDoc = new DOMDocument(); $xslDoc->load($xsl); $proc = new XSLTProcessor(); $proc->importStylesheet($xslDoc); return $proc->transformToXML($xmlDoc); } if ($page) { //echo(xml2html("../data/xmlkb/".$page.".xml", "defs/article.xslt")); echo xml2html("../data/xmlkb/" . $page, "defs/article.xslt"); }
function getcapabilities() { global $cp, $onlineresource, $tipo; $teste = explode("=", $onlineresource); if (count($teste) > 1) { $onlineresource = $onlineresource . "&"; } # ------------------------------------------------------------- # Test that there is a wms service defined before proceding. # if (!$onlineresource) { # No WMS service provided. wms_fatal("No 'onlineresource' defined."); } $wms_service_request = $onlineresource . "REQUEST=GetCapabilities&SERVICE=" . $tipo; # ------------------------------------------------------------- # Test that the capabilites file has successfully downloaded. # if (!($wms_capabilities = file($wms_service_request))) { # Cannot download the capabilities file. wms_fatal("Não foi possível ler o retorno do serviço '{$wms_service_request}'."); } $wms_capabilities = implode("", $wms_capabilities); # ------------------------------------------------------------- # Test that the capabilites file has successfully parsed. # $dom = new DomDocument(); $dom->loadXML($wms_capabilities); $cp->set_data(xml2html($wms_capabilities)); }
<?php function xml2html($xmldata, $xsl) { $xmlDoc = new DOMDocument(); $xmlDoc->load($xmldata); $xslDoc = new DOMDocument(); $xslDoc->load($xsl); $proc = new XSLTProcessor(); $proc->importStylesheet($xslDoc); return $proc->transformToXML($xmlDoc); } // echo(xml2html("../data/xmlkb/testToc.xml", "defs/toc.xslt")); echo xml2html("../data/xmlkb/toc.xml", "defs/toc.xslt");
function buildMenu() { $menu = xml2html("data/toc.xml", "defs/menu.xslt"); file_put_contents("cache/menu.xml", $menu); }
<?php function xml2html($xmldata, $xsl) { $xmlDoc = new DOMDocument(); $xmlDoc->load($xmldata); $xslDoc = new DOMDocument(); $xslDoc->load($xsl); $proc = new XSLTProcessor(); $proc->importStylesheet($xslDoc); return $proc->transformToXML($xmlDoc); } echo xml2html("data/pictures.xml", "defs/pictures.xslt");
<?php if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if (!is_dir($file) && preg_match('/\\.xml/', $file)) { xml2html($file); } } closedir($handle); } function xml2html($file) { $cmd = "php article2html.php {$file}"; $outfile = preg_replace('/xml$/', "html", $file); echo "{$cmd}: {$outfile}\n"; exec($cmd, $output); $handle = fopen("html/{$outfile}", 'w'); for ($i = 0; $i < count($output); $i++) { if (preg_match('/<A\\s+href/i', $output[$i])) { $output[$i] = preg_replace('/(article2html|"refentry2html).php\\?fn=/i', "", $output[$i]); $output[$i] = preg_replace('/\\.xml/i', '.html', $output[$i]); } if (fwrite($handle, $output[$i] . "\n") === FALSE) { echo "Cannot write to file ({$filename})"; exit; } } fclose($handle); }
<?php if (isset($_REQUEST['debug'])) { $debugMode = true; } function xml2html($xmldata, $xsl) { global $debugMode; $xmlDoc = new DOMDocument(); $xmlDoc->load($xmldata); if ($debugMode == true) { $root = $xmlDoc->documentElement; $root->setAttribute("debug", "true"); } $xslDoc = new DOMDocument(); $xslDoc->load($xsl); $proc = new XSLTProcessor(); $proc->importStylesheet($xslDoc); return $proc->transformToXML($xmlDoc); } echo xml2html("data/toc.xml", "defs/toc.xslt");
function getcapabilities() { global $servico; $teste = explode("=", $servico); if (count($teste) > 1) { $servico = $servico . "&"; } $wms_service_request = $servico . "REQUEST=GetCapabilities&SERVICE=WMS&version=1.1.0"; # ------------------------------------------------------------- # Test that the capabilites file has successfully downloaded. # if (!($wms_capabilities = file($wms_service_request))) { # Cannot download the capabilities file. $cp->set_data("Erro de acesso"); return; } $wms_capabilities = implode("", $wms_capabilities); return xml2html($wms_capabilities); }