Move libraries to autoload format
This commit is contained in:
parent
7ac0f6c850
commit
b4f758f0b5
8 changed files with 1009 additions and 23 deletions
|
|
@ -32,7 +32,7 @@ class Config {
|
|||
* Url: http://domain.com/index.php/{module}/index/{arg1}/{arg2} -> modules/module/controller_index.php AppController->App($args);
|
||||
*/
|
||||
|
||||
function get_controller($controller, $args=[]) {
|
||||
function get_controller($path_info, $controller, $args=[]) {
|
||||
|
||||
$controller=__DIR__.'/../'.$controller;
|
||||
|
||||
|
|
@ -44,6 +44,8 @@ function get_controller($controller, $args=[]) {
|
|||
|
||||
$controller=new \AppController();
|
||||
|
||||
$controller->path_info=$path_info;
|
||||
|
||||
//return $controller->App($args);
|
||||
return call_user_func_array(array($controller, 'App'), $args);
|
||||
|
||||
|
|
@ -75,7 +77,7 @@ function get_controller($controller, $args=[]) {
|
|||
//Route is: /module/file/switch/parameter1/parameter2
|
||||
|
||||
function get_route($path_info) {
|
||||
|
||||
|
||||
if($path_info!='') {
|
||||
|
||||
$arr_path=filter_path($path_info);
|
||||
|
|
@ -86,7 +88,7 @@ function get_route($path_info) {
|
|||
|
||||
$controller=\PhangoApp\PhaRouter\Config::$modules_allowed[\PhangoApp\PhaRouter\Config::$home_module].'/controllers/app.php';
|
||||
|
||||
return \PhangoApp\PhaRouter\get_controller($controller, []);
|
||||
return \PhangoApp\PhaRouter\get_controller($path_info, $controller, []);
|
||||
|
||||
break;
|
||||
|
||||
|
|
@ -98,7 +100,7 @@ function get_route($path_info) {
|
|||
|
||||
$controller=$module_path.'/controllers/app.php';
|
||||
|
||||
return \PhangoApp\PhaRouter\get_controller($controller, []);
|
||||
return \PhangoApp\PhaRouter\get_controller($path_info, $controller, []);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +114,7 @@ function get_route($path_info) {
|
|||
|
||||
$controller=$module_path.'/controllers/'.$arr_path[2].'.php';
|
||||
|
||||
return \PhangoApp\PhaRouter\get_controller($controller, []);
|
||||
return \PhangoApp\PhaRouter\get_controller($path_info, $controller, []);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -128,7 +130,7 @@ function get_route($path_info) {
|
|||
|
||||
$args=array_slice($arr_path, 2, count($arr_path));
|
||||
|
||||
return \PhangoApp\PhaRouter\get_controller($controller, $args);
|
||||
return \PhangoApp\PhaRouter\get_controller($path_info, $controller, $args);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -141,7 +143,7 @@ function get_route($path_info) {
|
|||
|
||||
$controller=\PhangoApp\PhaRouter\Config::$modules_allowed[\PhangoApp\PhaRouter\Config::$home_module].'/controllers/app.php';
|
||||
|
||||
return \PhangoApp\PhaRouter\get_controller($controller, []);
|
||||
return \PhangoApp\PhaRouter\get_controller($path_info, $controller, []);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -225,6 +227,8 @@ class Url {
|
|||
|
||||
class Controller {
|
||||
|
||||
public $path_info='';
|
||||
|
||||
public function json($arr_return) {
|
||||
|
||||
$final_return=json_encode($arr_return);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue