11<?php
22
3- /**
4- * myApp is a generic name for KeyPHP application info holders;
5- * here you declare your application by defining different variables
6- * if you choose to declare your app via the constructor method,
7- * please make sure to erase values of the variables
8- * and declare theme one by one in the __constructor method calling
9- * E.G.
10- * class myApp extendsPHPWebAppInfosHolder
11- * {
12- * var $packageID,$infos,$author,$version,$mainClass;
13- * }
14- * // and then replace values in the following order
15- * $myAppInfos = new myApp($packageID,$infos,$author,$version,$mainClass);
16- */
17- class myApp extends PHPWebAppInfosHolder
18- {
19-
20- // to declare your app directly with the given variables of the class
21- // modify those variables to your wish
22- // var $packageID = "yt.pylott.keyphp.example";
23- // var $infos = "an example application made using keyphp";
24- // var $author = "Louis Bertrand <adressepro111@pylott.yt>";
25- // var $version = "1.0.0.BETA";
26- // var $mainClass = "main";
27-
28- /**
29- * if you want to use the constructor,
30- * replace the previous variables with those ones
31- */
32-
33- /**appPackageId ex: com.organization.package*/
34- var $ packageID = null ;
35- /**appInfos ex: AI algorithm*/
36- var $ infos = null ;
37- /**appAuthor ex: Leonard Da Vinci*/
38- var $ author = null ;
39- /**appVersion ex: v2763:22:CZA-Z.1.BETA or v1.0*/
40- var $ version = null ;
41- /**mainClass ex: main*/
42- var $ mainClass = null ;
43-
44- // or use construct to
45- public function __construct ($ packageID = "" ,$ infos = "" ,$ author = "" ,$ version = "" ,$ mainClass = "" ) {
46- if (is_null ($ this ->packageID )) {
47- $ this ->packageID = $ packageID ;
48- }
49- if (is_null ($ this ->infos )) {
50- $ this ->infos = $ infos ;
51- }
52- if (is_null ($ this ->author )) {
53- $ this ->author = $ author ;
54- }
55- if (is_null ($ this ->version )) {
56- $ this ->version = $ version ;
57- }
58- if (is_null ($ this ->mainClass )) {
59- $ this ->mainClass = $ mainClass ;
60- }
61- }
62-
3+ if (debug && in_array ("INFOS " ,$ debugMask )) {
4+ print "APPLICATION SETUP \r\n\r\n" ;
635 }
646
65- // here the application is declared
66- // you can declare your app with construct method or directly into the class
67- // previously declared
68- $ myAppInfos = new myApp ($ GLOBAL_packageID ,$ GLOBAL_infos ,$ GLOBAL_author ,$ GLOBAL_version ,$ GLOBAL_mainClass );
7+ $ myApp_Json = json_decode (file_get_contents ("appInfos.json " ),true );
698
70- // we require the main class
71- require_once ("app/ " .$ myAppInfos ->mainClass .".php " );
729
73- // we declare your main Class
74- $ mainClass = new $ myAppInfos ->mainClass ;
10+ $ myAPP = new KeyPHPKernel \PHPWebAppInfosHolder ($ myApp_Json ["packageName " ],$ myApp_Json ["infos " ],$ myApp_Json ["authors " ],$ myApp_Json ["version " ],$ myApp_Json ["mainClass " ]);
7511
12+ require "app/ " .$ myAPP ->mainClass .".php " ;
13+ $ mainClass = new $ myAPP ->mainClass ;
7614
15+
7716 // ACTUAL EXECUTION
7817
7918
@@ -98,5 +37,4 @@ public function __construct($packageID = "",$infos = "",$author = "",$version =
9837 if (!$ onStopResponse ){
9938 print ("Program ended with return value " .$ onStopResponse ."\r\n" );
10039 exit ;
101- }
102-
40+ }
0 commit comments