Update of /cvsroot/phpweather/phpweather/config
In directory usw-pr-cvs1:/tmp/cvs-serv17587
Modified Files:
pw_option.php
Log Message:
Documentation plus some minor bugfixes.
Index: pw_option.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/config/pw_option.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- pw_option.php 7 Apr 2002 18:38:20 -0000 1.1
+++ pw_option.php 12 Apr 2002 22:08:49 -0000 1.2
@@ -1,12 +1,74 @@
<?php
+/**
+ * This is the baseclass for all options.
+ *
+ * @author Martin Geisler <gim...@gi...>
+ * @version $Id$
+ */
class pw_option {
+ /**
+ * The name of this option.
+ *
+ * It's important that this name correspond to an object in a global
+ * array called $options. If this option is called 'icao', then the
+ * object must be saved to $GLOBALS['options']['icao']
+ *
+ * @var string
+ */
var $name = '';
+
+ /**
+ * A description of the option.
+ *
+ * This should be a note that explains what this option does.
+ *
+ * @var string
+ */
var $description = '';
+
+ /**
+ * The dependencies of this option.
+ *
+ * If this option depends on other options, then their names will be
+ * listed in this array. If this options doesn't have any
+ * dependencies, then the array will be empty.
+ *
+ * @var array
+ */
var $dependencies = array();
+
+ /**
+ * The current value of the option.
+ *
+ * @access private
+ * @var string
+ */
var $value = '';
+
+ /**
+ * The default value of the option.
+ *
+ * This will be used to determine if the option has changed. A call
+ * to get_config() will only return a non-empty string if the option
+ * is changed.
+ *
+ * @access private
+ * @var string
+ */
var $default = '';
+
+ /**
+ * The validator used by this option.
+ *
+ * The validator will be asked to validate the value of the option
+ * to determine if the input is valid. If not, then a call to
+ * get_config() will return an empty string.
+ *
+ * @access private
+ * @var pw_validator
+ */
var $validator;
function pw_option($name, $description, $dependencies,
@@ -19,7 +81,7 @@
} else {
$this->validator = new pw_validator('Please correct your input');
}
- if ($default) {
+ if ($default !== false) {
$this->default = $default;
$this->update_value(array($name . '_value' => $default));
}
|