Rev 16 | Rev 19 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 16 | Rev 17 | ||
|---|---|---|---|
| 1 | <?php
|
1 | <?php
|
| 2 | 2 | ||
| 3 | require_once 'global.inc'; |
3 | require_once 'global.inc'; |
| 4 | 4 | ||
| 5 | define('FEATURES_ENCODING', |
5 | define('FEATURES_ENCODING', |
| 6 | mb_detect_encoding(file_get_contents($_SERVER['SCRIPT_FILENAME']))); |
6 | mb_detect_encoding(file_get_contents($_SERVER['SCRIPT_FILENAME']))); |
| 7 | 7 | ||
| 8 | /**
|
8 | /**
|
| 9 | * A list of language features with URNs definitions
|
9 | * A list of language features with URNs definitions
|
| 10 | * for reference links.
|
10 | * for reference links.
|
| 11 | */
|
11 | */
|
| 12 | class FeatureList
|
12 | class FeatureList
|
| 13 | {
|
13 | {
|
| 14 | public $versions = array(); |
14 | public $versions = array(); |
| 15 | 15 | ||
| 16 | /**
|
16 | /**
|
| 17 | * Versions of implementations that are considered safe.
|
17 | * Versions of implementations that are considered safe.
|
| 18 | * A feature is considered safe if it does not require
|
18 | * A feature is considered safe if it does not require
|
| 19 | * an implementation version above these versions.
|
19 | * an implementation version above these versions.
|
| 20 | *
|
20 | *
|
| 21 | * @var Array[string=>string]
|
21 | * @var Array[string=>string]
|
| 22 | */
|
22 | */
|
| 23 | public $safeVersions = array(); |
23 | public $safeVersions = array(); |
| 24 | 24 | ||
| 25 | /**
|
25 | /**
|
| 26 | * URNs that can be used for reference links.
|
26 | * URNs that can be used for reference links.
|
| 27 | *
|
27 | *
|
| 28 | * @var Array[string=>string]
|
28 | * @var Array[string=>string]
|
| 29 | */
|
29 | */
|
| 30 | protected $urns = array(); |
30 | protected $urns = array(); |
| 31 | 31 | ||
| 32 | /**
|
32 | /**
|
| 33 | * The list of language features
|
33 | * The list of language features
|
| 34 | *
|
34 | *
|
| 35 | * @var array[Features]
|
35 | * @var array[Features]
|
| 36 | */
|
36 | */
|
| 37 | protected $items = array(); |
37 | protected $items = array(); |
| 38 | 38 | ||
| 39 | /**
|
39 | /**
|
| 40 | * Determines the number of printed items the table headings should be repeated
|
40 | * Determines the number of printed items the table headings should be repeated
|
| 41 | *
|
41 | *
|
| 42 | * @var int
|
42 | * @var int
|
| 43 | */
|
43 | */
|
| 44 | protected $headerRepeat = 25; |
44 | protected $headerRepeat = 25; |
| 45 | 45 | ||
| 46 | /**
|
46 | /**
|
| 47 | * Initializes the FeatureList object
|
47 | * Initializes the FeatureList object
|
| 48 | *
|
48 | *
|
| 49 | * @param array|Object $a
|
49 | * @param array|Object $a
|
| 50 | * @return FeatureList
|
50 | * @return FeatureList
|
| 51 | */
|
51 | */
|
| 52 | public function __construct($a) |
52 | public function __construct($a) |
| 53 | {
|
53 | {
|
| 54 | $aVars = get_class_vars(get_class($this)); |
54 | $aVars = get_class_vars(get_class($this)); |
| 55 | 55 | ||
| 56 | while ((list($key, $value) = each($aVars))) |
56 | while ((list($key, $value) = each($aVars))) |
| 57 | {
|
57 | {
|
| 58 | if (isset($a[$key])) |
58 | if (isset($a[$key])) |
| 59 | {
|
59 | {
|
| 60 | $this->$key = $a[$key]; |
60 | $this->$key = $a[$key]; |
| 61 | }
|
61 | }
|
| 62 | }
|
62 | }
|
| 63 | 63 | ||
| 64 | /* Inform items of ourself so that URNs can be used for links */
|
64 | /* Inform items of ourself so that URNs can be used for links */
|
| 65 | if (is_array($this->items)) |
65 | if (is_array($this->items)) |
| 66 | {
|
66 | {
|
| 67 | foreach ($this->items as &$item) |
67 | foreach ($this->items as &$item) |
| 68 | {
|
68 | {
|
| 69 | $item->setList($this); |
69 | $item->setList($this); |
| 70 | }
|
70 | }
|
| 71 | }
|
71 | }
|
| 72 | 72 | ||
| 73 | /* resolve URN references that are URNs */
|
73 | /* resolve URN references that are URNs */
|
| 74 | if (is_array($this->urns)) |
74 | if (is_array($this->urns)) |
| 75 | {
|
75 | {
|
| 76 | foreach ($this->urns as &$urn) |
76 | foreach ($this->urns as &$urn) |
| 77 | {
|
77 | {
|
| 78 | if (($url = $this->resolveURN($urn))) |
78 | if (($url = $this->resolveURN($urn))) |
| 79 | {
|
79 | {
|
| 80 | $urn = $url; |
80 | $urn = $url; |
| 81 | }
|
81 | }
|
| 82 | }
|
82 | }
|
| 83 | }
|
83 | }
|
| 84 | }
|
84 | }
|
| 85 | 85 | ||
| 86 | public function printHeaders() |
86 | public function printHeaders() |
| 87 | {
|
87 | {
|
| 88 | foreach ($this->versions as $ver) |
88 | foreach ($this->versions as $ver) |
| 89 | {
|
89 | {
|
| 90 | ?>
|
90 | ?>
|
| 91 | <th><?php echo $ver; ?></th> |
91 | <th><?php echo $ver; ?></th> |
| 92 | <?php
|
92 | <?php
|
| 93 | }
|
93 | }
|
| 94 | }
|
94 | }
|
| 95 | 95 | ||
| 96 | /**
|
96 | /**
|
| 97 | * Prints the list of features.
|
97 | * Prints the list of features.
|
| 98 | *
|
98 | *
|
| 99 | * @see Feature::printMe()
|
99 | * @see Feature::printMe()
|
| 100 | */
|
100 | */
|
| 101 | public function printItems() |
101 | public function printItems() |
| 102 | {
|
102 | {
|
| 103 | $counter = 0; |
103 | $counter = 0; |
| 104 | $headerRepeat = $this->headerRepeat; |
104 | $headerRepeat = $this->headerRepeat; |
| 105 | $repeatHeaders = ($headerRepeat > 1); |
105 | $repeatHeaders = ($headerRepeat > 1); |
| 106 | 106 | ||
| 107 | foreach ($this->items as $feature) |
107 | foreach ($this->items as $feature) |
| 108 | {
|
108 | {
|
| 109 | if ($feature instanceof Feature) |
109 | if ($feature instanceof Feature) |
| 110 | {
|
110 | {
|
| 111 | /*
|
111 | /*
|
| 112 | * TODO: Disabled header repetition until footnote ref. name/ID
|
112 | * TODO: Disabled header repetition until footnote ref. name/ID
|
| 113 | * problem has been solved
|
113 | * problem has been solved
|
| 114 | */
|
114 | */
|
| 115 | // if ($repeatHeaders
|
115 | // if ($repeatHeaders
|
| 116 | // && $counter > 1
|
116 | // && $counter > 1
|
| 117 | // && $counter % $headerRepeat === 0)
|
117 | // && $counter % $headerRepeat === 0)
|
| 118 | // {
|
118 | // {
|
| 119 | // echo <<<HTML
|
119 | // echo <<<HTML
|
| 120 | // <tr class="header">
|
120 | // <tr class="header">
|
| 121 | // <th>Feature</th>
|
121 | // <th>Feature</th>
|
| 122 | // {$this->printHeaders()}
|
122 | // {$this->printHeaders()}
|
| 123 | // </tr>
|
123 | // </tr>
|
| 124 | //HTML;
|
124 | //HTML;
|
| 125 | // }
|
125 | // }
|
| 126 | 126 | ||
| 127 | $feature->printMe(); |
127 | $feature->printMe(); |
| 128 | 128 | ||
| 129 | $counter++; |
129 | $counter++; |
| 130 | }
|
130 | }
|
| 131 | }
|
131 | }
|
| 132 | }
|
132 | }
|
| 133 | 133 | ||
| 134 | /**
|
134 | /**
|
| 135 | * Resolves a URN according to the value of the
|
135 | * Resolves a URN according to the value of the
|
| 136 | * object's <code>$urn</code> property.
|
136 | * object's <code>$urn</code> property.
|
| 137 | *
|
137 | *
|
| 138 | * @param string $urn
|
138 | * @param string $urn
|
| 139 | * URN to be resolved
|
139 | * URN to be resolved
|
| 140 | * @return string|boolean
|
140 | * @return string|boolean
|
| 141 | * The resolved URN if successful,
|
141 | * The resolved URN if successful,
|
| 142 | * <code>false</code> otherwise.
|
142 | * <code>false</code> otherwise.
|
| 143 | */
|
143 | */
|
| 144 | public function resolveURN($urn) |
144 | public function resolveURN($urn) |
| 145 | {
|
145 | {
|
| 146 | if (is_array($this->urns)) |
146 | if (is_array($this->urns)) |
| 147 | {
|
147 | {
|
| 148 | $reURN = '|^(.+?):(?!//)|'; |
148 | $reURN = '|^(.+?):(?!//)|'; |
| 149 | 149 | ||
| 150 | if (preg_match($reURN, $urn, $m) && isset($this->urns[$m[1]])) |
150 | if (preg_match($reURN, $urn, $m) && isset($this->urns[$m[1]])) |
| 151 | {
|
151 | {
|
| 152 | return preg_replace($reURN, $this->urns[$m[1]], $urn); |
152 | return preg_replace($reURN, $this->urns[$m[1]], $urn); |
| 153 | }
|
153 | }
|
| 154 | }
|
154 | }
|
| 155 | 155 | ||
| 156 | return $urn; |
156 | return $urn; |
| 157 | }
|
157 | }
|
| 158 | }
|
158 | }
|
| 159 | 159 | ||
| 160 | /**
|
160 | /**
|
| 161 | * A language feature.
|
161 | * A language feature.
|
| 162 | */
|
162 | */
|
| 163 | class Feature
|
163 | class Feature
|
| 164 | {
|
164 | {
|
| 165 | /**
|
165 | /**
|
| 166 | * Fragment identifiers to be defined for quickly accessing
|
166 | * Fragment identifiers to be defined for quickly accessing
|
| 167 | * the feature description.
|
167 | * the feature description.
|
| 168 | *
|
168 | *
|
| 169 | * @var Array[String]
|
169 | * @var Array[String]
|
| 170 | */
|
170 | */
|
| 171 | protected $anchors = array(); |
171 | protected $anchors = array(); |
| 172 | 172 | ||
| 173 | /**
|
173 | /**
|
| 174 | * Value of the explanatory <code>title</code> attribute for the feature.
|
174 | * Value of the explanatory <code>title</code> attribute for the feature.
|
| 175 | *
|
175 | *
|
| 176 | * @var string
|
176 | * @var string
|
| 177 | */
|
177 | */
|
| 178 | protected $title = ''; |
178 | protected $title = ''; |
| 179 | 179 | ||
| 180 | /**
|
180 | /**
|
| 181 | * Name or example code of the feature
|
181 | * Name or example code of the feature
|
| 182 | *
|
182 | *
|
| 183 | * @var string
|
183 | * @var string
|
| 184 | */
|
184 | */
|
| 185 | protected $content = ''; |
185 | protected $content = ''; |
| 186 | 186 | ||
| 187 | /**
|
187 | /**
|
| 188 | * Description of the feature. Displayed directly if code is missing,
|
188 | * Description of the feature. Displayed directly if code is missing,
|
| 189 | * otherwise used as `title' attribute value.
|
189 | * otherwise used as `title' attribute value.
|
| 190 | *
|
190 | *
|
| 191 | * @var string
|
191 | * @var string
|
| 192 | */
|
192 | */
|
| 193 | protected $descr = ''; |
193 | protected $descr = ''; |
| 194 | 194 | ||
| 195 | /**
|
195 | /**
|
| 196 | * Versions that support this feature
|
196 | * Versions that support this feature
|
| 197 | *
|
197 | *
|
| 198 | * @var Array
|
198 | * @var Array
|
| 199 | */
|
199 | */
|
| 200 | protected $versions = array(); |
200 | protected $versions = array(); |
| 201 | 201 | ||
| 202 | /**
|
202 | /**
|
| 203 | * Reference to the FeatureList that this feature belongs to
|
203 | * Reference to the FeatureList that this feature belongs to
|
| 204 | *
|
204 | *
|
| 205 | * @var FeatureList
|
205 | * @var FeatureList
|
| 206 | */
|
206 | */
|
| 207 | protected $list = null; |
207 | protected $list = null; |
| 208 | 208 | ||
| 209 | public function setList(&$oList) |
209 | public function setList(&$oList) |
| 210 | {
|
210 | {
|
| 211 | $this->list =& $oList; |
211 | $this->list =& $oList; |
| 212 | }
|
212 | }
|
| 213 | 213 | ||
| 214 | /**
|
214 | /**
|
| 215 | * Creates a new Feature object, using values from the passed parameters
|
215 | * Creates a new Feature object, using values from the passed parameters
|
| 216 | * array.
|
216 | * array.
|
| 217 | *
|
217 | *
|
| 218 | * @param array|Object $params
|
218 | * @param array|Object $params
|
| 219 | * @return Feature
|
219 | * @return Feature
|
| 220 | */
|
220 | */
|
| 221 | public function __construct($params = array()) |
221 | public function __construct($params = array()) |
| 222 | {
|
222 | {
|
| 223 | $aVars = get_class_vars(__CLASS__); |
223 | $aVars = get_class_vars(__CLASS__); |
| 224 | 224 | ||
| 225 | while ((list($key, $value) = each($aVars))) |
225 | while ((list($key, $value) = each($aVars))) |
| 226 | {
|
226 | {
|
| 227 | if (isset($params[$key])) |
227 | if (isset($params[$key])) |
| 228 | {
|
228 | {
|
| 229 | $this->$key = $params[$key]; |
229 | $this->$key = $params[$key]; |
| 230 | }
|
230 | }
|
| 231 | }
|
231 | }
|
| 232 | }
|
232 | }
|
| 233 | 233 | ||
| 234 | /**
|
234 | /**
|
| - | 235 | * Determines whether one version is greater than another.
|
|
| - | 236 | *
|
|
| - | 237 | * @param string $v1 Version string #1
|
|
| - | 238 | * @param string $v2 Version string #2
|
|
| - | 239 | * @return bool
|
|
| - | 240 | * <code>true</code> if the version <var>$v1</var> is greater than
|
|
| - | 241 | * the version <var>$v2</var>, <code>false</code> otherwise
|
|
| - | 242 | */
|
|
| - | 243 | protected static function _versionIsGreater($v1, $v2) |
|
| - | 244 | {
|
|
| - | 245 | $v1 = explode('.', $v1); |
|
| - | 246 | $v2 = explode('.', $v2); |
|
| - | 247 | ||
| - | 248 | foreach ($v1 as $key => $value) |
|
| - | 249 | {
|
|
| - | 250 | if ((int)$value <= (int)$v2[$key]) |
|
| - | 251 | {
|
|
| - | 252 | return false; |
|
| - | 253 | }
|
|
| - | 254 | }
|
|
| - | 255 | ||
| - | 256 | return true; |
|
| - | 257 | }
|
|
| - | 258 | ||
| - | 259 | /**
|
|
| 235 | * Returns <code>' class="safe"'</code> if the feature
|
260 | * Returns <code>' class="safe"'</code> if the feature
|
| 236 | * can be considered safe. The required information
|
261 | * can be considered safe. The required information
|
| 237 | * is stored in the <code>safeVersions</code> property
|
262 | * is stored in the <code>safeVersions</code> property
|
| 238 | * of the associated <code>FeatureList</code> object.
|
263 | * of the associated <code>FeatureList</code> object.
|
| 239 | *
|
264 | *
|
| 240 | * @return string
|
265 | * @return string
|
| 241 | * @see FeatureList::defaultSafeVersions
|
266 | * @see FeatureList::defaultSafeVersions
|
| 242 | */
|
267 | */
|
| 243 | protected function getSafeStr() |
268 | protected function getSafeStr() |
| 244 | {
|
269 | {
|
| 245 | if (!is_null($this->list)) |
270 | if (!is_null($this->list)) |
| 246 | {
|
271 | {
|
| 247 | foreach ($this->list->safeVersions as $impl => &$safeVer) |
272 | foreach ($this->list->safeVersions as $impl => &$safeVer) |
| 248 | {
|
273 | {
|
| 249 | $thisImplVer =& $this->versions[$impl]; |
274 | $thisImplVer =& $this->versions[$impl]; |
| 250 | if (is_array($thisImplVer)) |
275 | if (is_array($thisImplVer)) |
| 251 | {
|
276 | {
|
| 252 | if (isset($thisImplVer['tested']) && !is_bool($thisImplVer['tested'])) |
277 | if (isset($thisImplVer['tested']) && !is_bool($thisImplVer['tested'])) |
| 253 | {
|
278 | {
|
| 254 | $thisImplVer =& $thisImplVer['tested']; |
279 | $thisImplVer =& $thisImplVer['tested']; |
| 255 | }
|
280 | }
|
| 256 | else
|
281 | else
|
| 257 | {
|
282 | {
|
| 258 | $thisImplVer =& $thisImplVer[0]; |
283 | $thisImplVer =& $thisImplVer[0]; |
| 259 | }
|
284 | }
|
| 260 | }
|
285 | }
|
| 261 | 286 | ||
| 262 | /* DEBUG */
|
287 | /* DEBUG */
|
| 263 | // echo " $impl=$thisImplVer ";
|
288 | // echo " $impl=$thisImplVer ";
|
| 264 | 289 | ||
| 265 | if (preg_match('/^-?$/', $thisImplVer) || $thisImplVer > $safeVer) |
290 | if (preg_match('/^-?$/', $thisImplVer) || self::_versionIsGreater($thisImplVer, $safeVer)) |
| 266 | {
|
291 | {
|
| 267 | return ''; |
292 | return ''; |
| 268 | }
|
293 | }
|
| 269 | }
|
294 | }
|
| 270 | 295 | ||
| 271 | return ' class="safe"'; |
296 | return ' class="safe"'; |
| 272 | }
|
297 | }
|
| 273 | else
|
298 | else
|
| 274 | {
|
299 | {
|
| 275 | return ''; |
300 | return ''; |
| 276 | }
|
301 | }
|
| 277 | }
|
302 | }
|
| 278 | 303 | ||
| 279 | protected function getTitleStr() |
304 | protected function getTitleStr() |
| 280 | {
|
305 | {
|
| 281 | if (!empty($this->title)) |
306 | if (!empty($this->title)) |
| 282 | {
|
307 | {
|
| 283 | return " title=\"{$this->title}\""; |
308 | return " title=\"{$this->title}\""; |
| 284 | }
|
309 | }
|
| 285 | else
|
310 | else
|
| 286 | {
|
311 | {
|
| 287 | return ''; |
312 | return ''; |
| 288 | }
|
313 | }
|
| 289 | }
|
314 | }
|
| 290 | 315 | ||
| 291 | protected function getAnchors() |
316 | protected function getAnchors() |
| 292 | {
|
317 | {
|
| 293 | $result = array(); |
318 | $result = array(); |
| 294 | 319 | ||
| 295 | foreach ($this->anchors as $anchor) |
320 | foreach ($this->anchors as $anchor) |
| 296 | {
|
321 | {
|
| 297 | $result[] = "<a name=\"{$anchor}\""; |
322 | $result[] = "<a name=\"{$anchor}\""; |
| 298 | 323 | ||
| 299 | if (preg_match('/^[a-z][a-z0-9_:.-]*/i', $anchor)) |
324 | if (preg_match('/^[a-z][a-z0-9_:.-]*/i', $anchor)) |
| 300 | {
|
325 | {
|
| 301 | $result[] = " id=\"{$anchor}\""; |
326 | $result[] = " id=\"{$anchor}\""; |
| 302 | }
|
327 | }
|
| 303 | 328 | ||
| 304 | $result[] = '></a>'; |
329 | $result[] = '></a>'; |
| 305 | }
|
330 | }
|
| 306 | 331 | ||
| 307 | return join('', $result); |
332 | return join('', $result); |
| 308 | }
|
333 | }
|
| 309 | 334 | ||
| 310 | protected function getAssumed($v) |
335 | protected function getAssumed($v) |
| 311 | {
|
336 | {
|
| 312 | if (is_array($v) && isset($v['assumed']) && $v['assumed']) |
337 | if (is_array($v) && isset($v['assumed']) && $v['assumed']) |
| 313 | {
|
338 | {
|
| 314 | return ' class="assumed"'; |
339 | return ' class="assumed"'; |
| 315 | }
|
340 | }
|
| 316 | 341 | ||
| 317 | return ''; |
342 | return ''; |
| 318 | }
|
343 | }
|
| 319 | 344 | ||
| 320 | protected function getTested($v) |
345 | protected function getTested($v) |
| 321 | {
|
346 | {
|
| 322 | if (is_array($v) && isset($v['tested']) && $v['tested']) |
347 | if (is_array($v) && isset($v['tested']) && $v['tested']) |
| 323 | {
|
348 | {
|
| 324 | return ' class="tested"'; |
349 | return ' class="tested"'; |
| 325 | }
|
350 | }
|
| 326 | 351 | ||
| 327 | return ''; |
352 | return ''; |
| 328 | }
|
353 | }
|
| 329 | 354 | ||
| 330 | /**
|
355 | /**
|
| 331 | * Returns the version of a feature.
|
356 | * Returns the version of a feature.
|
| 332 | *
|
357 | *
|
| 333 | * @param string|VersionInfo $vInfo
|
358 | * @param string|VersionInfo $vInfo
|
| 334 | * @return mixed
|
359 | * @return mixed
|
| 335 | */
|
360 | */
|
| 336 | protected function getVer($vInfo) |
361 | protected function getVer($vInfo) |
| 337 | {
|
362 | {
|
| 338 | if (is_array($vInfo)) |
363 | if (is_array($vInfo)) |
| 339 | {
|
364 | {
|
| 340 | /* TODO: Return all versions: documented, assumed, and tested */
|
365 | /* TODO: Return all versions: documented, assumed, and tested */
|
| 341 | $vNumber = (isset($vInfo['tested']) |
366 | $vNumber = (isset($vInfo['tested']) |
| 342 | && gettype($vInfo['tested']) !== 'boolean') |
367 | && gettype($vInfo['tested']) !== 'boolean') |
| 343 | ? $vInfo['tested'] |
368 | ? $vInfo['tested'] |
| 344 | : $vInfo[0]; |
369 | : $vInfo[0]; |
| 345 | $section = isset($vInfo['section']) |
370 | $section = isset($vInfo['section']) |
| 346 | ? ' <span class="section" title="Specification section">['
|
371 | ? ' <span class="section" title="Specification section">['
|
| 347 | . $vInfo['section'] . ']</span>' |
372 | . $vInfo['section'] . ']</span>' |
| 348 | : ''; |
373 | : ''; |
| 349 | 374 | ||
| 350 | if (isset($vInfo['urn'])) |
375 | if (isset($vInfo['urn'])) |
| 351 | {
|
376 | {
|
| 352 | if ($this->list instanceof FeatureList) |
377 | if ($this->list instanceof FeatureList) |
| 353 | {
|
378 | {
|
| 354 | $url = $this->list->resolveURN($vInfo['urn']); |
379 | $url = $this->list->resolveURN($vInfo['urn']); |
| 355 | $vNumber = '<a href="' . $url . '">' . $vNumber |
380 | $vNumber = '<a href="' . $url . '">' . $vNumber |
| 356 | . ($section ? $section : '') . '</a>'; |
381 | . ($section ? $section : '') . '</a>'; |
| 357 | }
|
382 | }
|
| 358 | }
|
383 | }
|
| 359 | else if ($section) |
384 | else if ($section) |
| 360 | {
|
385 | {
|
| 361 | $vNumber .= $section; |
386 | $vNumber .= $section; |
| 362 | }
|
387 | }
|
| 363 | 388 | ||
| 364 | $vInfo = $vNumber; |
389 | $vInfo = $vNumber; |
| 365 | }
|
390 | }
|
| 366 | 391 | ||
| 367 | return ($vInfo === '-') |
392 | return ($vInfo === '-') |
| 368 | ? '<span title="Not supported">−</span>'
|
393 | ? '<span title="Not supported">−</span>'
|
| 369 | : $vInfo; |
394 | : $vInfo; |
| 370 | }
|
395 | }
|
| 371 | 396 | ||
| - | 397 | /**
|
|
| - | 398 | * Returns a syntax-highlighted version of a string
|
|
| - | 399 | *
|
|
| - | 400 | * @param string $s
|
|
| - | 401 | * @return string
|
|
| - | 402 | */
|
|
| 372 | protected static function shl($s) |
403 | protected static function shl($s) |
| 373 | {
|
404 | {
|
| 374 | /* stub */
|
405 | /* stub */
|
| - | 406 | return $s; |
|
| 375 | }
|
407 | }
|
| 376 | 408 | ||
| 377 | public function printMe() |
409 | public function printMe() |
| 378 | {
|
410 | {
|
| 379 | ?>
|
411 | ?>
|
| 380 | <tr<?php echo $this->getSafeStr(); ?>> |
412 | <tr<?php echo $this->getSafeStr(); ?>> |
| 381 | <th<?php echo $this->getTitleStr(); ?>><?php |
413 | <th<?php echo $this->getTitleStr(); ?>><?php |
| 382 | echo $this->getAnchors(); |
414 | echo $this->getAnchors(); |
| 383 | echo /*preg_replace_callback( |
415 | echo /*preg_replace_callback( |
| 384 | '#(<code>)(.+?)(</code>)#',
|
416 | '#(<code>)(.+?)(</code>)#',
|
| 385 | array('self', 'shl'),*/
|
417 | array('self', 'shl'),*/
|
| 386 | preg_replace('/…/', '…', $this->content)/*)*/; |
418 | preg_replace('/…/', '…', $this->content)/*)*/; |
| 387 | ?></th>
|
419 | ?></th>
|
| 388 | <?php
|
420 | <?php
|
| 389 | $versions = $this->versions; |
421 | $versions = $this->versions; |
| 390 | if (!is_null($this->list)) |
422 | if (!is_null($this->list)) |
| 391 | {
|
423 | {
|
| 392 | $versions =& $this->list->versions; |
424 | $versions =& $this->list->versions; |
| 393 | }
|
425 | }
|
| 394 | 426 | ||
| 395 | static $row = 0; |
427 | static $row = 0; |
| 396 | $row++; |
428 | $row++; |
| 397 | 429 | ||
| 398 | $column = 0; |
430 | $column = 0; |
| - | 431 | $thisVersions =& $this->versions; |
|
| 399 | 432 | ||
| 400 | foreach ($versions as $key => $value) |
433 | foreach ($versions as $key => $value) |
| 401 | {
|
434 | {
|
| 402 | $column++; |
435 | $column++; |
| 403 | $id = "td$row-$column"; |
436 | $id = "td$row-$column"; |
| 404 | $ver = $this->versions[$key]; |
437 | $ver = isset($thisVersions[$key]) ? $thisVersions[$key] : ''; |
| 405 | ?>
|
438 | ?>
|
| 406 | <td id="<?php echo $id; ?>"<?php |
439 | <td<?php
|
| - | 440 | if (!$key) |
|
| - | 441 | {
|
|
| - | 442 | echo " id='$id'"; |
|
| - | 443 | }
|
|
| - | 444 | ||
| 407 | echo $this->getAssumed($ver) . $this->getTested($ver); |
445 | echo $this->getAssumed($ver) . $this->getTested($ver); |
| - | 446 | ||
| 408 | if (!$key) |
447 | if (!$key) |
| 409 | {
|
448 | {
|
| 410 | if (!empty($ver)) |
449 | if (!empty($ver)) |
| 411 | {
|
450 | {
|
| 412 | echo ' title="Test code: ' |
451 | echo ' title="Test code: ' |
| 413 | . htmlspecialchars( |
452 | . htmlspecialchars( |
| - | 453 | preg_replace('/\\\(["\'])/', '\1', |
|
| 414 | stripslashes($ver), |
454 | reduceWhitespace($ver) |
| - | 455 | ), |
|
| 415 | ENT_COMPAT, |
456 | ENT_COMPAT, |
| 416 | FEATURES_ENCODING)
|
457 | FEATURES_ENCODING |
| - | 458 | )
|
|
| 417 | . '"'; |
459 | . '"'; |
| 418 | }
|
460 | }
|
| 419 | else
|
461 | else
|
| 420 | {
|
462 | {
|
| 421 | echo ' title="Not applicable: No automated test case' |
463 | echo ' title="Not applicable: No automated test case' |
| 422 | . ' is available for this feature. Please click' |
464 | . ' is available for this feature. If possible, please' |
| 423 | . ' the feature code in the first column to run' |
465 | . ' click the feature code in the first column to run' |
| 424 | . ' a manual test."'; |
466 | . ' a manual test."'; |
| 425 | }
|
467 | }
|
| 426 | }
|
468 | }
|
| 427 | ?>><?php |
469 | ?>><?php |
| 428 | if ($key) |
470 | if ($key) |
| 429 | {
|
471 | {
|
| 430 | echo $this->getVer($ver); |
472 | echo $this->getVer($ver); |
| - | 473 | ||
| - | 474 | /* General footnotes support: include footnotes.class.php to enable */
|
|
| - | 475 | if (is_array($ver) && isset($ver['footnote']) && $ver['footnote']) |
|
| - | 476 | {
|
|
| - | 477 | echo $ver['footnote']; |
|
| - | 478 | }
|
|
| 431 | }
|
479 | }
|
| 432 | else
|
480 | else
|
| 433 | {
|
481 | {
|
| 434 | if (!empty($ver)) |
482 | if (!empty($ver)) |
| 435 | {
|
483 | {
|
| 436 | ?><script type="text/javascript">
|
484 | ?><script type="text/javascript">
|
| 437 | // <![CDATA[ |
485 | // <![CDATA[ |
| 438 | var s = test(<?php echo $ver; ?>, '<span title="Supported">+</span>', |
486 | var s = test(<?php echo $ver; ?>, '<span title="Supported">+<\/span>', |
| 439 | '<span title="Not supported">−</span>'); |
487 | '<span title="Not supported">−<\/span>'); |
| 440 | tryThis("document.write(s);",
|
488 | tryThis("document.write(s);",
|
| 441 | "document.getElementById('<?php echo $id; ?>').appendChild("
|
489 | "document.getElementById('<?php echo $id; ?>').appendChild("
|
| 442 | + "document.createTextNode(s));"); |
490 | + "document.createTextNode(s));"); |
| 443 | // ]]> |
491 | // ]]> |
| 444 | </script><?php
|
492 | </script><?php
|
| 445 | }
|
493 | }
|
| 446 | else
|
494 | else
|
| 447 | {
|
495 | {
|
| 448 | echo '<abbr>N/A</abbr>'; |
496 | echo '<abbr>N/A</abbr>'; |
| 449 | }
|
497 | }
|
| 450 | }
|
498 | }
|
| 451 | ?></td>
|
499 | ?></td>
|
| 452 | <?php
|
500 | <?php
|
| 453 | }
|
501 | }
|
| 454 | ?>
|
502 | ?>
|
| 455 | </tr> |
503 | </tr> |
| 456 | <?php
|
504 | <?php
|
| 457 | }
|
505 | }
|
| 458 | }
|
506 | }
|
| 459 | 507 | ||
| 460 | ?>
|
508 | ?>
|
| 461 | 509 | ||