]>
src.bluestatic.org Git - isso.git/blob - Register.php
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)
29 require_once('ISSO/Functions.php');
34 * This is an ISSO registry class. It holds all of the ISSO system variables as well
35 * as serving as an object registry that is avaliable in the global scope to prevent
36 * globalization of variables.
39 * @copyright Copyright ©2002 - [#]year[#], Blue Static
50 private $application = 'Unknown ISSO Project';
74 private $debug = false;
77 * The master registry list
80 private $registry = array();
82 // ###################################################################
84 * Sets the application name
86 * @param string Application name
88 public function setApplication($name)
90 $this->application
= $name;
93 // ###################################################################
95 * Gets the application name
97 * @return string Application name
99 public function getApplication()
101 return $this->application
;
104 // ###################################################################
106 * Sets the application's working path
110 public function setAppPath($path)
112 $this->appPath
= BSFunctions
::FetchSourcePath($path);
115 // ###################################################################
117 * Returns the path to the application
119 * @return string Application path
121 public function getAppPath()
123 return $this->appPath
;
126 // ###################################################################
128 * Sets the application version
130 * @param string Application version
132 public function setAppVersion($vers)
134 $this->appVersion
= $vers;
137 // ###################################################################
139 * Gets the application version
141 * @return string Application version
143 public function getAppVersion()
145 return $this->appVersion
;
148 // ###################################################################
150 * Sets the application's web path, which is the full path from the
155 public function setWebPath($path)
157 $this->webPath
= BSFunctions
::FetchSourcePath($path);
160 // ###################################################################
162 * Returns the web path to the application
164 * @return string Application's web path
166 public function getWebPath()
168 return $this->webPath
;
171 // ###################################################################
173 * Sets the debug state
175 * @param bool Debug mode on?
177 public function setDebug($debug)
179 $this->debug
= $debug;
182 // ###################################################################
184 * Gets the debug mode state
186 * @return bool Debug mode on?
188 public function getDebug()
193 // ###################################################################
195 * Registers a value in the master registry. You cannot overwrite
196 * values. You must first unregister() them if you wish to do so.
198 * @param string Registry key
199 * @param mixed Value to register
201 public function register($key, $value)
203 if (isset($this->registry
["$key"]))
205 trigger_error('Cannot overwrite a key in the registry');
209 $this->registry["$key"] = $value;
212 // ###################################################################
214 * Unregisters a value from the registry. This removes all traces of
215 * it from this object.
217 * @param string Registry key
219 public function unregister($key)
221 if (!isset($this->registry
["$key"]))
223 trigger_error('You cannot unregister a key that does not exist');
227 unset($this->registry["$key"]);
230 // ###################################################################
232 * This gets a value from the registry with a specific key
234 * @param string The key
236 * @return mixed Value in the registry for key
238 public function get($key)
240 if (!isset($this->registry
["$key"]))
242 trigger_error('Cannot access the registry with a non-existent key');
246 return $this->registry["$key"];
249 // ###################################################################
251 * Returns the entire registry stack
253 * @return array Complete registry
255 public function getAll()
257 return $this->registry
;
261 /*=====================================================================*\
262 || ###################################################################
265 || ###################################################################
266 \*=====================================================================*/