2 /*=====================================================================*\
3 || ###################################################################
4 || # Blue Static ISSO Framework [#]issoversion[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
23 * ISSO Registry (Register.php)
28 require_once('ISSO/Functions.php');
33 * This is an ISSO registry class. It holds all of the ISSO system variables as well
34 * as serving as an object registry that is avaliable in the global scope to prevent
35 * globalization of variables.
38 * @copyright Copyright ©2002 - [#]year[#], Blue Static
49 private $application = 'Unknown ISSO Project';
73 private $debug = false
;
76 * The master registry list
79 private $registry = array();
81 // ###################################################################
83 * Sets the application name
85 * @param string Application name
87 public function setApplication($name)
89 $this->application
= $name;
92 // ###################################################################
94 * Gets the application name
96 * @return string Application name
98 public function getApplication()
100 return $this->application
;
103 // ###################################################################
105 * Sets the application's working path
109 public function setAppPath($path)
111 $this->appPath
= BSFunctions
::FetchSourcePath($path);
114 // ###################################################################
116 * Returns the path to the application
118 * @return string Application path
120 public function getAppPath()
122 return $this->appPath
;
125 // ###################################################################
127 * Sets the application version
129 * @param string Application version
131 public function setAppVersion($vers)
133 $this->appVersion
= $vers;
136 // ###################################################################
138 * Gets the application version
140 * @return string Application version
142 public function getAppVersion()
144 return $this->appVersion
;
147 // ###################################################################
149 * Sets the application's web path, which is the full path from the
154 public function setWebPath($path)
156 $this->webPath
= BSFunctions
::FetchSourcePath($path);
159 // ###################################################################
161 * Returns the web path to the application
163 * @return string Application's web path
165 public function getWebPath()
167 return $this->webPath
;
170 // ###################################################################
172 * Sets the debug state
174 * @param bool Debug mode on?
176 public function setDebug($debug)
178 $this->debug
= $debug;
181 // ###################################################################
183 * Gets the debug mode state
185 * @return bool Debug mode on?
187 public function getDebug()
192 // ###################################################################
194 * Registers a value in the master registry. You cannot overwrite
195 * values. You must first unregister() them if you wish to do so.
197 * @param string Registry key
198 * @param mixed Value to register
200 public function register($key, $value)
202 if (isset($this->registry
["$key"]))
204 trigger_error('Cannot overwrite a key in the registry');
208 $this->registry
["$key"] = $value;
211 // ###################################################################
213 * Unregisters a value from the registry. This removes all traces of
214 * it from this object.
216 * @param string Registry key
218 public function unregister($key)
220 if (!isset($this->registry
["$key"]))
222 trigger_error('You cannot unregister a key that does not exist');
226 unset($this->registry
["$key"]);
229 // ###################################################################
231 * This gets a value from the registry with a specific key
233 * @param string The key
235 * @return mixed Value in the registry for key
237 public function get($key)
239 if (!isset($this->registry
["$key"]))
241 trigger_error('Cannot access the registry with a non-existent key');
245 return $this->registry
["$key"];
248 // ###################################################################
250 * Returns the entire registry stack
252 * @return array Complete registry
254 public function getAll()
256 return $this->registry
;
260 /*=====================================================================*\
261 || ###################################################################
264 || ###################################################################
265 \*=====================================================================*/