]>
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)
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();
82 * An array of debug messages
85 private $debugInfo = array();
87 // ###################################################################
89 * Sets the application name
91 * @param string Application name
93 public function setApplication($name)
95 $this->application
= $name;
98 // ###################################################################
100 * Gets the application name
102 * @return string Application name
104 public function getApplication()
106 return $this->application
;
109 // ###################################################################
111 * Sets the application's working path
115 public function setAppPath($path)
117 $this->appPath
= BSFunctions
::FetchSourcePath($path);
120 // ###################################################################
122 * Returns the path to the application
124 * @return string Application path
126 public function getAppPath()
128 return $this->appPath
;
131 // ###################################################################
133 * Sets the application version
135 * @param string Application version
137 public function setAppVersion($vers)
139 $this->appVersion
= $vers;
142 // ###################################################################
144 * Gets the application version
146 * @return string Application version
148 public function getAppVersion()
150 return $this->appVersion
;
153 // ###################################################################
155 * Sets the application's web path, which is the full path from the
160 public function setWebPath($path)
162 $this->webPath
= BSFunctions
::FetchSourcePath($path);
165 // ###################################################################
167 * Returns the web path to the application
169 * @return string Application's web path
171 public function getWebPath()
173 return $this->webPath
;
176 // ###################################################################
178 * Sets the debug state
180 * @param bool Debug mode on?
182 public function setDebug($debug)
184 $this->debug
= $debug;
187 // ###################################################################
189 * Gets the debug mode state
191 * @return bool Debug mode on?
193 public function getDebug()
198 // ###################################################################
200 * Registers a value in the master registry. You cannot overwrite
201 * values. You must first unregister() them if you wish to do so.
203 * @param string Registry key
204 * @param mixed Value to register
206 public function register($key, $value)
208 if (isset($this->registry
["$key"]))
210 trigger_error('Cannot overwrite a key in the registry');
214 $this->registry["$key"] = $value;
217 // ###################################################################
219 * Unregisters a value from the registry. This removes all traces of
220 * it from this object.
222 * @param string Registry key
224 public function unregister($key)
226 if (!isset($this->registry
["$key"]))
228 trigger_error('You cannot unregister a key that does not exist');
232 unset($this->registry["$key"]);
235 // ###################################################################
237 * This gets a value from the registry with a specific key
239 * @param string The key
241 * @return mixed Value in the registry for key
243 public function get($key)
245 if (!isset($this->registry
["$key"]))
247 trigger_error('Cannot access the registry with a non-existent key');
251 return $this->registry["$key"];
254 // ###################################################################
256 * Returns the entire registry stack
258 * @return array Complete registry
260 public function getAll()
262 return $this->registry
;
265 // ###################################################################
267 * Adds a debug message to the array. This only works when debug mode
270 * @param string Debug message
272 public function debug($msg)
276 $this->debugInfo
[] = $msg;
281 /*=====================================================================*\
282 || ###################################################################
285 || ###################################################################
286 \*=====================================================================*/