From 6135dd794108b3627965d3403f1d7cb48fdd3f21 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 15 Aug 2006 06:12:59 +0000 Subject: [PATCH] Removing the existing get/set system --- kernel.php | 194 ----------------------------------------------------- 1 file changed, 194 deletions(-) diff --git a/kernel.php b/kernel.php index 2474f86..9fb26a4 100644 --- a/kernel.php +++ b/kernel.php @@ -278,200 +278,6 @@ class ISSO } } - // ################################################################### - /** - * Sets a specified field in the ISSO. This is used to set all the - * required fields that ISSO uses for linking. It replaces the old - * method of setting the instance variables directly. - * - * @param string Field name - * @param mixed Value of the field - */ - public function set($fieldname, $value) - { - $this->do_set($fieldname, $value, null); - } - - // ################################################################### - /** - * Does the actual setting of the field. set() is defined in each - * module, but this controls the actual data. This is done so that - * there isn't an extra parameter in set() that controls module spaces - * - * @param string Field name - * @param mixed Value - * @param string Module name (as referred to in ISSO->modules[]) to place in - */ - protected function do_set($fieldname, $value, $module) - { - if ($module == null) - { - $field =& $this->fields["$fieldname"]; - } - else - { - $field =& $this->modules["$module"]->fields["$fieldname"]; - } - - if (is_array($field)) - { - if ($field[1] != null) - { - if (preg_match('#^\$(.*)#', $field[1])) - { - $caller = preg_replace('#^\$(.*)->([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)$#', 'array(&$\1, "\2")', $field[1]); - eval('$caller = ' . $caller . ';'); - } - else - { - $caller = array(&$this, $field[1]); - } - - $value = call_user_func($caller, $value); - } - - if ($module == null) - { - $this->$fieldname = $value; - } - else - { - $this->modules["$module"]->$fieldname = $value; - } - - $field[2] = true; - } - else - { - trigger_error('Invalid field `' . $module . '.' . $fieldname . '` specified in ISSO->do_set()', E_USER_ERROR); - } - } - - // ################################################################### - /** - * Fetches the value of a field. This is protected because get() should - * be defined in each module to make a call to this function. - * - * @param string Field name - * @param string Module name (as referred to in ISSO->modules[]) to fetch from - */ - protected function do_get($fieldname, $module) - { - if ($module == null) - { - $field =& $this->fields["$fieldname"]; - } - else - { - $field =& $this->modules["$module"]->fields["$fieldname"]; - } - - if (is_array($field)) - { - if ($field[2] == false) - { - trigger_error('Field ' . $module . ':: ' . $filedname . ' is not set and therefore cannot be get()', E_USER_ERROR); - } - - if ($module == null) - { - return $this->$fieldname; - } - else - { - return $this->modules["$module"]->$fieldname; - } - - $field[2] = true; - } - else - { - trigger_error('Invalid field `' . $module . '.' . $fieldname . '` specified in ISSO->do_get()', E_USER_ERROR); - } - } - - // ################################################################### - /** - * Returns the value of an ISSO field. You should not access any instance - * variables directly, use this instead. - * - * @param string Field name - * - * @return mixed Value of the field - */ - public function get($fieldname) - { - return $this->do_get($fieldname, null); - } - - // ################################################################### - /** - * Makes sure that all of the required fields in ISSO are set before - * any action is done. This will throw an error block describing - * the fields that need to be set if any are missing. - * - * @param string Module to check for; null is kernel, string is a module name, false is all - * @param bool Is this a non-error environment that should display all fields? - */ - public function check_isso_fields($module = null, $called = false) - { - $missing = array(); - - if ($module === false) - { - $modules = $this->show_modules(true); - } - else if ($module === null) - { - $modules = array(get_class($this)); - } - else - { - $modules = array($module); - } - - foreach ($modules AS $module) - { - if (empty($this->modules["$module"]->fields)) - { - continue; - } - - foreach ($this->modules["$module"]->fields AS $name => $field) - { - if ($field[0] == REQ_YES AND $field[2] == false AND $called == false) - { - $missing[] = $module . ':: ' . $name; - } - else if ($called == true AND $field[2] == false) - { - $missing[] = $module . ':: ' . $name . ($field[0] == REQ_YES ? ' (REQUIRED)' : ''); - } - } - } - - if (sizeof($missing) > 0) - { - $error = ($called ? 'The following fields are not set:' : 'You are missing required ISSO fields. Please make sure you have set:'); - $error .= "\n"; - $error .= ''; - - $this->message(($called ? '' : 'Missing ') . 'Fields', $error, ($called ? 1 : 3)); - - if ($called == false) - { - exit; - } - } - } - // ################################################################### /** * Prepares a path for being set as the sourcepath -- 2.43.5