]> git.mjollnir.org Git - moodle.git/commitdiff
New param type: PARAM_NUMBER, for floating point numbers.
authortjhunt <tjhunt>
Fri, 22 Dec 2006 13:29:20 +0000 (13:29 +0000)
committertjhunt <tjhunt>
Fri, 22 Dec 2006 13:29:20 +0000 (13:29 +0000)
lib/moodlelib.php

index c91d066b0a89e4e5b946c877523f4c3b5119c128..b1860325b5f99d0ce19514c06fbc0a506f5e7047 100644 (file)
@@ -115,6 +115,11 @@ define('PARAM_INT',      0x0002);
  */
 define('PARAM_INTEGER',  0x0002);
 
+/**
+ * PARAM_NUMBER - a real/floating point number. 
+ */
+define('PARAM_NUMBER',  0x000a);
+
 /**
  * PARAM_ALPHA - contains only english letters.
  */
@@ -363,6 +368,9 @@ function clean_param($param, $type) {
         case PARAM_INT:
             return (int)$param;  // Convert to integer
 
+        case PARAM_NUMBER:
+            return (float)$param;  // Convert to integer
+
         case PARAM_ALPHA:        // Remove everything not a-z
             return eregi_replace('[^a-zA-Z]', '', $param);