Пример #1
0
 /**
  * init the globals variables, by reading the given
  * array which describes all this variables
  *
  *  each build options item should be an array
  *   0: help (or false for hidden options)
  *   1: the default value (string)
  *   2: a preg expression to verify the given value
  *   or
  *   1: a boolean, which indicates that the option is a boolean value
  *      the value of this boolean is the default value
  *    2: no value
  * @param array $build_options the options to create as globals variables
  */
 public static function init($build_options)
 {
     self::$variables_def = $build_options;
     foreach ($build_options as $name => $def) {
         // if there isn't a defined default value,
         // let's defining an empty string as default value
         if (!isset($def[1])) {
             self::$variables_def[$name][1] = '';
         }
         // if the default value is not a boolean, and if there isn't a third
         // parameter in the array, let's define a third parameter
         if (!isset($def[2]) && !is_bool(self::$variables_def[$name][1])) {
             self::$variables_def[$name][2] = '';
         }
         self::storeValue($name, self::$variables_def[$name][1]);
     }
 }