Update of /cvsroot/openfirst/base/includes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv731/includes
Modified Files:
functions.php
Log Message:
added ofCompareVersions()
Index: functions.php
===================================================================
RCS file: /cvsroot/openfirst/base/includes/functions.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** functions.php 16 Oct 2005 22:21:15 -0000 1.11
--- functions.php 19 Nov 2005 02:09:41 -0000 1.12
***************
*** 180,183 ****
--- 180,185 ----
}
+ /** Uses var_dump() to output a variable, except appropriately cleaned.
+ */
function ofDebugVar($var) {
ob_start();
***************
*** 188,190 ****
--- 190,213 ----
echo "</pre>\n";
}
+
+ /** Compares 2 module versions
+ *
+ * The versions strings are either PHP-formatted versions, or "CVS" (case
+ * sensitive) to mean development (use dates instead). (See version_compare()
+ * <http://us3.php.net/manual/en/function.version-compare.php> for the details
+ * as to how to format versions.)
+ *
+ * It is always assumed that dev is newer if compared to a version.
+ *
+ * @param string $left The left-hand version
+ * @param string $right The right-hand version
+ * @return mixed -1 if the left is older, 1 if the right is older, 0 if they
+ * are equal, and false if dates should be used (ie, they're both CVS).
+ */
+ function ofCompareVersions($left, $right) {
+ if ($left == 'CVS' && $right == 'CVS') {
+ return false;
+ }
+ version_compare($left, $right);
+ }
?>
\ No newline at end of file
|