More exceptions added, class loader can now load extra configs
[mailer.git] / application / mxchange / class_ApplicationHelper.php
1 <?php
2 /**
3  * A class holding general data about the application and some methods for
4  * the management including the entry point.
5  *
6  * E.g.:
7  *
8  * index.php?app=my_app
9  *
10  * You need to create a folder in the folder "application" named "my_app"
11  * (without the quotes) and create a include file called
12  * class_ApplicationHelper.php. You have to write the same class for your
13  * application and implement the same interface called ManageableApplication
14  * because this class include file will be searched for.
15  *
16  * It is good when you avoid more GET parameters to keep URLs short and sweet.
17  * But sometimes you need some GET paramerers e.g. for your imprint or info page
18  * or other linked pages which you have to create and state some informations.
19  *
20  * Please remember that this include file is being loaded *before* the class
21  * loader is loading classes from "exceptions", "interfaces" and "main"!
22  *
23  * @author              Roland Haeder <webmaster@mxchange.org>
24  * @version             0.3.0
25  * @copyright   Copyright(c) 2007, 2008 Roland Haeder, this is free software
26  * @license             GNU GPL 3.0 or any newer version
27  * @link                http://www.mxchange.org
28  *
29  * This program is free software: you can redistribute it and/or modify
30  * it under the terms of the GNU General Public License as published by
31  * the Free Software Foundation, either version 3 of the License, or
32  * (at your option) any later version.
33  *
34  * This program is distributed in the hope that it will be useful,
35  * but WITHOUT ANY WARRANTY; without even the implied warranty of
36  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
37  * GNU General Public License for more details.
38  *
39  * You should have received a copy of the GNU General Public License
40  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
41  */
42 class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplication {
43         /**
44          * The version number of this application
45          */
46         private $appVersion = "";
47
48         /**
49          * The human-readable name for this application
50          */
51         private $appName = "";
52
53         /**
54          * The short uni*-like name of this application
55          */
56         private $shortName = "";
57
58         /**
59          * An instance of this class
60          */
61         private static $thisInstance = null;
62
63         /**
64          * Private constructor
65          *
66          * @return      void
67          */
68         private function __construct () {
69                 // Call parent constructor
70                 parent::constructor(__CLASS__);
71
72                 // Set description
73                 $this->setPartDescr("Application-Helper");
74
75                 // Create an unique ID
76                 $this->createUniqueID();
77
78                 // Tidy up a little
79                 $this->removeSystemArray();
80         }
81
82         /**
83          * Getter for an instance of this class
84          *
85          * @return      $thisInstance           An instance of this class
86          */
87         public final static function getInstance () {
88                 // Is the instance there?
89                 if (is_null(self::$thisInstance)) {
90                         self::$thisInstance = new ApplicationHelper();
91                 }
92
93                 // Return the instance
94                 return self::$thisInstance;
95         }
96
97         /**
98          * Getter for the version number
99          *
100          * @return      $appVersion     The application's version number
101          */
102         public final function getAppVersion () {
103                 return $this->appVersion;
104         }
105
106         /**
107          * Setter for the version number
108          *
109          * @param               $appVersion     The application's version number
110          * @return      void
111          */
112         public final function setAppVersion ($appVersion) {
113                 // Cast and set it
114                 $appVersion = (string) $appVersion;
115                 $this->appVersion = $appVersion;
116         }
117
118         /**
119          * Getter for human-readable name
120          *
121          * @return      $appName        The application's human-readable name
122          */
123         public final function getAppName () {
124                 return $this->appName;
125         }
126
127         /**
128          * Setter for human-readable name
129          *
130          * @param               $appName        The application's human-readable name
131          * @return      void
132          */
133         public final function setAppName ($appName) {
134                 // Cast and set it
135                 $appName = (string) $appName;
136                 $this->appName = $appName;
137         }
138
139         /**
140          * Getter for short uni*-like name
141          *
142          * @return      $shortName      The application's short uni*-like name
143          */
144         public final function getAppShortName () {
145                 return $this->shortName;
146         }
147
148         /**
149          * Setter for short uni*-like name
150          *
151          * @param               $shortName      The application's short uni*-like name
152          * @return      void
153          */
154         public final function setAppShortName ($shortName) {
155                 // Cast and set it
156                 $shortName = (string) $shortName;
157                 $this->shortName = $shortName;
158         }
159
160         /**
161          * Launcher for the mxchange mailexchange script
162          *
163          * @return      void
164          */
165         public final function entryPoint () {
166                 // Not yet implemented
167                 trigger_error(__METHOD__.": Not yet implemented!");
168         }
169 }
170
171 // [EOF]
172 ?>