Skip to content

Commit

Permalink
Release Master V1.0.1.BETA
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis Bertrand committed Jul 26, 2019
1 parent c932672 commit 736b324
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 29 deletions.
16 changes: 16 additions & 0 deletions ENV.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,20 @@

require_once(constant("yt.pylott.keyphp.base"));

// 1.0.1.BETA feature : #0001 : appSettingsFile
// application datas will come from a .ini file

$GLOBAL_appSettings = parse_ini_file("conf/appSettings.ini", true);

// var_dump($GLOBAL_appSettings);
// exit;

$GLOBAL_packageID = $GLOBAL_appSettings["AppInfosHolder"]["packageID"];
$GLOBAL_infos = $GLOBAL_appSettings["AppInfosHolder"]["infos"];
$GLOBAL_author = $GLOBAL_appSettings["AppInfosHolder"]["author"];
$GLOBAL_version = $GLOBAL_appSettings["AppInfosHolder"]["version"];
$GLOBAL_mainClass = $GLOBAL_appSettings["AppInfosHolder"]["mainClass"];

// end of 1.0.1.BETA feature : #0001 : appSettingsFile

require_once("application.php");
13 changes: 13 additions & 0 deletions app/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ class main extends KEYPHPAPPLICATION

public function loop()
{

// // OverKill method for std io that reads and prints user prompted value
// $stdio = new stdio;
// $stdin = $stdio->openstdin();
// $val = $stdio->ccin();
// $stdout = $stdio->openstdout();
// $stdio->ccout($val);
// $stdio->closestdin($stdin);
// $stdio->closestdout($stdout);

// // basic method for std io that reads and prints user prompted value
// stdio::cout(stdio::cin());

stdio::cout("Hello World!");
new bis;
return false;
Expand Down
36 changes: 21 additions & 15 deletions application.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,30 @@
*/
class myApp extends PHPWebAppInfosHolder
{


// to declare your app directly with the given variables of the class
// modify those variables to your wish
var $packageID = "yt.pylott.keyphp.example";
var $infos = "an example application made using keyphp";
var $author = "Louis Bertrand <adressepro111@pylott.yt>";
var $version = "1.0.0.BETA";
var $mainClass = "main";
// var $packageID = "yt.pylott.keyphp.example";
// var $infos = "an example application made using keyphp";
// var $author = "Louis Bertrand <adressepro111@pylott.yt>";
// var $version = "1.0.0.BETA";
// var $mainClass = "main";

/**
* if you want to use the constructor,
* replace the previous variables with thoose ones
* replace the previous variables with those ones
*/

// var $packageID;
// var $infos;
// var $author;
// var $version;
// var $mainClass;
/**appPackageId ex: com.organization.package*/
var $packageID = null;
/**appInfos ex: AI algorithm*/
var $infos = null;
/**appAuthor ex: Leonard Da Vinci*/
var $author = null;
/**appVersion ex: v2763:22:CZA-Z.1.BETA or v1.0*/
var $version = null;
/**mainClass ex: main*/
var $mainClass = null;

// or use construct to
public function __construct($packageID = "",$infos = "",$author = "",$version = "",$mainClass = "") {
Expand All @@ -55,12 +61,11 @@ public function __construct($packageID = "",$infos = "",$author = "",$version =
}

}

// here the application is declared
// you can declare your app with construct method or directly into the class
// previously declared
// in future releases, a more elegant way would be appricieated
$myAppInfos = new myApp();
$myAppInfos = new myApp($GLOBAL_packageID,$GLOBAL_infos,$GLOBAL_author,$GLOBAL_version,$GLOBAL_mainClass);

// we require the main class
require_once("app/".$myAppInfos->mainClass.".php");
Expand Down Expand Up @@ -94,3 +99,4 @@ public function __construct($packageID = "",$infos = "",$author = "",$version =
print("Program ended with return value ".$onStopResponse."\r\n");
exit;
}

6 changes: 6 additions & 0 deletions conf/appSettings.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[AppInfosHolder]
packageID=appPackageId ; appPackageId ex: com.organization.package
infos=appInfos ; appInfos ex: AI algorithm
author=appAuthor ; appAuthor ex: Leonard Da Vinci
version=appVersion ; appVersion ex: v2763:22:CZA-Z.1.BETA or v1.0
mainClass=main ; mainClass ex: main
20 changes: 16 additions & 4 deletions doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ to setup a KeyPHP environnement, you need
first you need to clone the git into your folder

$ cd <your folder>
$ git clone git:github.com/PYLOTT/KeyPHP.git
$ git clone git://github.com/PYLOTT/KeyPHP.git

and here you go

Expand Down Expand Up @@ -54,8 +54,10 @@ lib directly in the folder with a "git clone".
WARNING: libraries in KeyPHP are made a certain way.
They must include:

- a file that require every classes
example: foo.php
- a file that require every classes (you are free
to make every classes inside this file but it's
preferred to have one file for each class in an
other folder) example: foo.php
- a file containing every infos on the library called
infos.ini ; this file will be loaded with all classes
and will be stored in a "library object" depending on
Expand All @@ -73,7 +75,17 @@ or

--- 3. APPLICATION DECLARATION ---

to declare your application go to the application.php file
to declare your application, there are several methods

preferred method:

- go into the /conf/ folder
- open appSettings.ini file
- go to [AppInfosHolder]
- replace every variables values with your chosen ones

second method:
go to the application.php file
and change infos in this class

class myApp extends PHPWebAppInfosHolder
Expand Down
2 changes: 1 addition & 1 deletion libraries/base/links/KEYPHPAPPLICATION.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function loop()
public function onStop()
{

return false;
return true;

}

Expand Down
87 changes: 78 additions & 9 deletions libraries/stdio/links/stdio.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,85 @@ class stdio
*/
var $stdout;

/**
* openstdin
*
* open stdin stream file
*
* @usage
* $stdio = new stdio;
* $stdin = $stdio->openstdin();
*
* @return resource|false
*/
public function openstdin() {
$this->stdin = fopen('php://stdin', 'r');
return $this->stdin;
}


/**
* openstdout
*
* open stdout stream file
*
* @usage
* $stdio = new stdio;
* $stdout = $stdio->openstdout();
*
* @return resource|false
*/
public function openstdout() {
$this->stdout = fopen('php://stdout', 'w');
return $this->stdin;
}

public function closestdin() {
/**
* closestdin
*
* close stdin stream file
*
* @usage
* $stdio = new stdio;
* $stdin = $stdio->openstdin();
* $stdio->closestdin($stdin);
*
* @return true
*/
public function closestdin(&$stdin) {
$this->stdin = null;
$stdin = null;
return true;
}

public function closestdout() {
/**
* closestdout
*
* close stdout stream file
*
* @usage
* $stdio = new stdio;
* $stdout = $stdio->openstdout();
* $stdio->closestdout($stdout);
*
* @return true
*/
public function closestdout(&$stdout) {
$this->stdout = null;
$stdout = null;
return true;
}

/**
* cin() function
*
* cin is a function that reads line from stdin
*
* @return mixed
**/
* @usage
* $someVar = stdio::cin();
*
* @return string
*/
public function cin()
{

Expand All @@ -50,9 +106,14 @@ public function cin()
* ccin() function
*
* cin is a function that reads line from stdin
*
* @usage
* $stdio = new stdio;
* $stdin = $stdio->openstdin();
* $someVar = $stdio->ccin();
*
* @return mixed
**/
* @return string
*/
public function ccin()
{

Expand All @@ -64,9 +125,14 @@ public function ccin()
* cout() function
*
* cout is a function that write line into stdout
*
*
* @usage
* $stdio = new stdio;
* $stdout = $stdio->openstdout();
* $stdio->ccout("some string");
*
* @return int|false
**/
*/
public function ccout($string)
{

Expand All @@ -79,8 +145,11 @@ public function ccout($string)
*
* cout is a function that write line into stdout
*
* @usage
* stdio::cout("some string");
*
* @return int|false
**/
*/
public function cout($string)
{

Expand Down

0 comments on commit 736b324

Please sign in to comment.