C:\xampp\php\docs\examples\pci180_parsedir_tohtml.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
/**
 * Get the Compatibility info for a list of files into a directory
 * Output is produced by a custom renderer (html2).
 * Rather than write your own stylesheet, you may use the default one, and
 * change some colors on the fly.
 *
 * This example show the new options|features available with API 1.8.0
 *
 * PHP versions 4 and 5
 *
 * @category PHP
 * @package  PHP_CompatInfo
 * @author   Laurent Laville <pear@laurent-laville.org>
 * @license  http://www.opensource.org/licenses/bsd-license.php  BSD
 * @version  CVS: $Id: pci180_parsedir_tohtml.php,v 1.2 2008/07/22 20:26:45 farell Exp $
 * @link     http://pear.php.net/package/PHP_CompatInfo
 * @since    version 1.8.0b4 (2008-06-18)
 * @ignore
 */

require_once 'PHP/CompatInfo.php';
require_once 
'PHP/CompatInfo/Renderer.php';
require_once 
'PHP/CompatInfo/Renderer/Html.php';

/**
 * Custom html layout
 *
 * @ignore
 */
class PHP_CompatInfo_Renderer_Html2 extends PHP_CompatInfo_Renderer_Html
{
    
/**
     * Html2 Renderer Class constructor
     *
     * @param object &$parser Instance of the parser (model of MVC pattern)
     * @param array  $conf    A hash containing any additional configuration
     *
     * @access public
     * @since  version 1.8.0b4 (2008-06-18)
     */
    
function PHP_CompatInfo_Renderer_Html2(&$parser$conf)
    {
        
parent::__construct($parser$conf);
        
// use default stylesheet (pci.css)
        
$this->setStyleSheet();  // Important: do not remove it
    
}

    
/**
     * Returns HTML code of parsing result
     *
     * @param object $obj instance of HTML_Table
     *
     * @access public
     * @return string
     */
    
function toHtml($obj)
    {
        
$styles $this->getStyleSheet(3, array(&$this'_getStyles'));

        
$body $obj->toHtml();

        
$html = <<<HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="author" content="Laurent Laville" />
<title>my PCI widget</title>
<link rel="stylesheet" type="text/css" href="yoursite.css" />
<link rel="stylesheet" type="text/css" href="
$styles" />
</head>
<body>

<div id="header">
<h1>Laurent-Laville.org</h1>
</div>

<div id="footer">
</div>

<div id="contents">

<div class="outer">
<div class="inner">
$body
</div>
</div>

</div>

</body>
</html>
HTML;
        return 
$html;
    }

    
/**
     * User callback to modify stylesheet object
     *
     * @param object $css Instance of HTML_CSS
     * @return string
     * @access private
     */
    
function _getStyles($css)
    {
        
$stylesheet 'pciskin.css';
        
$css->setStyle('.inner''height''12em');
        
$css->setStyle('.inner .even''background-color''#449922');
        
$css->setStyle('.inner .even''color''#FFFFFF');
        
$css->setStyle('.outer thead td''background-color''#006600');
        
$css->setStyle('.outer tfoot td''background-color''#006600');
        
$css->toFile(dirname(__FILE__) . DIRECTORY_SEPARATOR $stylesheet);
        return 
$stylesheet;
    }
}

/*
  Display parsing result of directory '$source' with a website integration
  look and feel.
 */
$driverType    'html2';
$driverOptions = array('args' => array('output-level' => 18));

$compatInfo = new PHP_CompatInfo($driverType$driverOptions);

$source 'C:\wamp\tmp\Services_W3C_CSSValidator-0.1.0';
$compatInfo->parseData($source);
?>
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586