Rev 16 | Rev 19 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 16 | Rev 17 | ||
---|---|---|---|
Line 230... | Line 230... | ||
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 | *
|
Line 260... | Line 285... | ||
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 | ||
Line 366... | Line 391... | ||
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 | ?>
|
Line 394... | Line 426... | ||
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
|