@@ -268,25 +268,24 @@ class Application {
268
268
* @access protected
269
269
* @return void
270
270
*/
271
- protected function __construct ($ appName = ' demo ' , $ appRoot = '' ) {
271
+ protected function __construct ($ appRoot ) {
272
272
$ this ->setPathFix ();
273
+ $ this ->setAppRoot ($ appRoot );
273
274
$ this ->setBasePath ();
274
275
$ this ->setFrameRoot ();
275
276
$ this ->setCoreLibRoot ();
276
277
/* Load the framework. */
277
-
278
- include $ this ->frameRoot . 'control.class.php ' ;
279
- include $ this ->frameRoot . 'model.class.php ' ;
280
- include $ this ->frameRoot . 'helper.class.php ' ;
281
-
282
- $ this ->setAppRoot ($ appName , $ appRoot );
283
278
$ this ->setTmpRoot ();
284
279
$ this ->setCacheRoot ();
285
280
$ this ->setLogRoot ();
286
281
$ this ->setConfigRoot ();
287
282
$ this ->setModuleRoot ();
288
283
$ this ->setThemeRoot ();
289
284
285
+ include $ this ->frameRoot . 'control.class.php ' ;
286
+ include $ this ->frameRoot . 'model.class.php ' ;
287
+ include $ this ->frameRoot . 'helper.class.php ' ;
288
+
290
289
$ this ->setSuperVars ();
291
290
292
291
$ this ->loadConfig ('common ' );
@@ -324,9 +323,9 @@ protected function __construct($appName = 'demo', $appRoot = '') {
324
323
* @access public
325
324
* @return object the app object
326
325
*/
327
- public static function createApp ($ appName = ' demo ' , $ appRoot = '' ) {
326
+ public static function createApp ($ appRoot = '' ) {
328
327
$ className = __CLASS__ ;
329
- return new $ className ($ appName , $ appRoot );
328
+ return new $ className ($ appRoot );
330
329
}
331
330
332
331
private static $ _app ;
@@ -337,9 +336,9 @@ public static function createApp($appName = 'demo', $appRoot = '') {
337
336
* @param type $appRoot
338
337
* @return Application
339
338
*/
340
- public static function app ($ appName = ' demo ' , $ appRoot = '' ) {
339
+ public static function app ($ appRoot ) {
341
340
if (!self ::$ _app instanceof Application) {
342
- self ::$ _app = new Application ($ appName , $ appRoot );
341
+ self ::$ _app = new Application ($ appRoot );
343
342
}
344
343
345
344
return self ::$ _app ;
@@ -364,7 +363,7 @@ protected function setPathFix() {
364
363
* @return void
365
364
*/
366
365
protected function setBasePath () {
367
- $ this ->basePath = realpath (dirname ( dirname ( ZTNB_ROOT )) ) . $ this ->pathFix ;
366
+ $ this ->basePath = realpath ($ this -> appRoot ) . $ this ->pathFix ;
368
367
}
369
368
370
369
/**
@@ -395,8 +394,8 @@ protected function setCoreLibRoot() {
395
394
* @access protected
396
395
* @return void
397
396
*/
398
- protected function setAppRoot () {
399
- $ this ->appRoot = realpath (dirname ( dirname ( ZTNB_ROOT )) ) . $ this ->pathFix ;
397
+ protected function setAppRoot ($ appRoot ) {
398
+ $ this ->appRoot = realpath ($ appRoot ) . $ this ->pathFix ;
400
399
401
400
if (!is_dir ($ this ->appRoot ))
402
401
$ this ->triggerError ("The app you call not found in {$ this ->appRoot }" , __FILE__ , __LINE__ , $ exit = true );
0 commit comments