root/trunk/viewSource.php

Revision 67 (checked in by hspath, 3 years ago)

- added "view source" link to example page template
- changed time:countdown christmas example to year 2005 (example3.xml)
- changed require/include statements to fit new directory structure
- moved inclusions to the files where there are needed

(e.g. "require 'patTemplate.php' was in /index.php, but patTemplate is used
in pat/patXMLRenderer.php)

- added page-level DocBlocks? where missing
- reformatted most code to come near PEAR Coding Standards
- fixed several E_NOTICEs
- merged some features from patSite
- optimized referer filtering for logging
- added function for creating directories recursively
- created /pat/patXMLRenderer/Extension

  • Property 0 set to
  • Property 1 set to
Line 
1 <?php
2 /**
3  * Display pretty version of XML source
4  * 
5  * Just open this file with viewSource.php?file=example.xml to view the XML source of a file
6  *
7  * Config is in config/xmlPretty.xml and the HTML template in templates/xmlPretty.tmpl
8  *
9  * @package     patXMLRenderer
10  * @version     $Id$
11  * @author      Stephan Schmidt <schst@php-tools.net>
12  */
13
14 /** include config (file locations) */
15 require_once 'config/patXMLRenderer.php';
16
17 /** include list of known extensions (file is generated by Admin) */
18 include_once $extDir.'/knownExtensions.php';
19
20 /** required by patTemplate and patConfiguration, which don't take care of inclusion */
21 require_once 'pat/patErrorManager.php';
22
23 require_once 'pat/patTemplate.php';
24 require_once 'pat/patConfiguration.php';
25
26 require_once 'pat/patXMLPretty.php';
27
28 $file = isset( $_GET['file'] )
29       ? $_GET['file']
30       : 'index.xml';
31
32 if ( !file_exists( $xmlDir.'/'.$file ) )
33     $file = '404.xml';
34
35 $tmpl = new patTemplate();
36 $tmpl->setBasedir( 'templates' );
37 $tmpl->readTemplatesFromFile( 'xmlPretty.tmpl' );
38 $tmpl->addGlobalVar( 'XMLSOURCE', $file );
39
40 $config = new patConfiguration;
41 $config->setConfigDir( 'config' );
42
43 $pretty = new patXMLPretty;
44
45 //  tell the xmlPretty
46 $pretty->setExtensionDir( $extDir );
47 $pretty->setKnownExtensions( $knownExtensions );
48
49 $pretty->setTemplate( $tmpl );
50 $pretty->setConfiguration( $config );
51
52 $pretty->setXMLDir( $xmlDir );
53 $pretty->setXMLFile( $file );
54
55 $pretty->displayPretty();
56 ?>
57
Note: See TracBrowser for help on using the browser.