Subversion Repositories PHPX

Compare Revisions

Last modification

Ignore whitespace Rev 16 → Rev 17

/trunk/features.class.php
232,6 → 232,31
}
/**
* Determines whether one version is greater than another.
*
* @param string $v1 Version string #1
* @param string $v2 Version string #2
* @return bool
* <code>true</code> if the version <var>$v1</var> is greater than
* the version <var>$v2</var>, <code>false</code> otherwise
*/
protected static function _versionIsGreater($v1, $v2)
{
$v1 = explode('.', $v1);
$v2 = explode('.', $v2);
foreach ($v1 as $key => $value)
{
if ((int)$value <= (int)$v2[$key])
{
return false;
}
}
return true;
}
/**
* Returns <code>' class="safe"'</code> if the feature
* can be considered safe. The required information
* is stored in the <code>safeVersions</code> property
262,7 → 287,7
/* DEBUG */
// echo " $impl=$thisImplVer ";
if (preg_match('/^-?$/', $thisImplVer) || $thisImplVer > $safeVer)
if (preg_match('/^-?$/', $thisImplVer) || self::_versionIsGreater($thisImplVer, $safeVer))
{
return '';
}
368,10 → 393,17
? '<span title="Not supported">&#8722;</span>'
: $vInfo;
}
/**
* Returns a syntax-highlighted version of a string
*
* @param string $s
* @return string
*/
protected static function shl($s)
{
/* stub */
return $s;
}
public function printMe()
396,15 → 428,22
$row++;
$column = 0;
$thisVersions =& $this->versions;
foreach ($versions as $key => $value)
{
$column++;
$id = "td$row-$column";
$ver = $this->versions[$key];
$ver = isset($thisVersions[$key]) ? $thisVersions[$key] : '';
?>
<td id="<?php echo $id; ?>"<?php
<td<?php
if (!$key)
{
echo " id='$id'";
}
echo $this->getAssumed($ver) . $this->getTested($ver);
if (!$key)
{
if (!empty($ver))
411,16 → 450,19
{
echo ' title="Test code: '
. htmlspecialchars(
stripslashes($ver),
preg_replace('/\\\(["\'])/', '\1',
reduceWhitespace($ver)
),
ENT_COMPAT,
FEATURES_ENCODING)
FEATURES_ENCODING
)
. '"';
}
else
{
echo ' title="Not applicable: No automated test case'
. ' is available for this feature. Please click'
. ' the feature code in the first column to run'
. ' is available for this feature. If possible, please'
. ' click the feature code in the first column to run'
. ' a manual test."';
}
}
428,6 → 470,12
if ($key)
{
echo $this->getVer($ver);
/* General footnotes support: include footnotes.class.php to enable */
if (is_array($ver) && isset($ver['footnote']) && $ver['footnote'])
{
echo $ver['footnote'];
}
}
else
{
435,8 → 483,8
{
?><script type="text/javascript">
// <![CDATA[
var s = test(<?php echo $ver; ?>, '<span title="Supported">+</span>',
'<span title="Not supported">&#8722;</span>');
var s = test(<?php echo $ver; ?>, '<span title="Supported">+<\/span>',
'<span title="Not supported">&#8722;<\/span>');
tryThis("document.write(s);",
"document.getElementById('<?php echo $id; ?>').appendChild("
+ "document.createTextNode(s));");