@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | $menu = $this->queryFetch("SELECT * FROM menu WHERE flag_active = 1 ORDER BY `order`"); |
9 | 9 | $temp = []; |
10 | 10 | foreach ($menu as $i) { |
11 | - if($i["fk_menu"] == 0) { |
|
11 | + if ($i["fk_menu"] == 0) { |
|
12 | 12 | $pk_menu = $i["pk_menu"]; |
13 | 13 | array_push($temp, array("label" => $i["label"], "link" => $i["link"], "submenu" => [], "relative" => false)); |
14 | 14 | $submenu = $this->queryFetch("SELECT * FROM menu WHERE fk_menu = $pk_menu ORDER BY `order`"); |
15 | - if($submenu) |
|
15 | + if ($submenu) |
|
16 | 16 | foreach ($submenu as $j) |
17 | - array_push( $temp[count($temp)-1]["submenu"], array("label" => $j["label"], "link" => $j["link"], "submenu" => [], "relative" => false) ); |
|
17 | + array_push($temp[count($temp) - 1]["submenu"], array("label" => $j["label"], "link" => $j["link"], "submenu" => [], "relative" => false)); |
|
18 | 18 | } |
19 | 19 | } |
20 | 20 | $this->tags["menu"] = $temp; |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | public function draw() { |
24 | 24 | $temp = ""; |
25 | 25 | $host = $this->parameters["app"]->server["HTTP_HOST"]; |
26 | - $uri = $this->parameters["app"]->server["REQUEST_URI"]; |
|
27 | - $actualLink = "http://$host$uri"; |
|
28 | - $relative = $this->parameters["app"]->server["RELATIVE"]; |
|
26 | + $uri = $this->parameters["app"]->server["REQUEST_URI"]; |
|
27 | + $actualLink = "http://$host$uri"; |
|
28 | + $relative = $this->parameters["app"]->server["RELATIVE"]; |
|
29 | 29 | foreach ($this->tags["menu"] as $i) { |
30 | 30 | $prePath = ""; |
31 | - if($i["relative"]) |
|
31 | + if ($i["relative"]) |
|
32 | 32 | $prePath = $relative; |
33 | 33 | $active = $this->isSubString($actualLink, array_merge(array_column($i["submenu"], 'link'), array($i["link"]))) ? "active" : ""; |
34 | - if( is_array($i["submenu"]) && count($i["submenu"])<1) |
|
34 | + if (is_array($i["submenu"]) && count($i["submenu"]) < 1) |
|
35 | 35 | $temp .= "<li class='$active'><a href='$prePath$i[link]'>$i[label]</a></li>"; |
36 | 36 | else { |
37 | 37 | $temp .= "<li class='dropdown $active'>"; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | '<ul class="dropdown-menu">'; |
44 | 44 | foreach ($i["submenu"] as $j) { |
45 | 45 | $prePath = ""; |
46 | - if($j["relative"]) |
|
46 | + if ($j["relative"]) |
|
47 | 47 | $prePath = $relative; |
48 | 48 | $temp .= "<li><a href='$prePath$j[link]'>$j[label]</a></li>"; |
49 | 49 | } |
@@ -52,18 +52,18 @@ discard block |
||
52 | 52 | } |
53 | 53 | return $temp; |
54 | 54 | } |
55 | - protected function isSubString( $_string, $_list) { |
|
55 | + protected function isSubString($_string, $_list) { |
|
56 | 56 | $success = false; |
57 | 57 | foreach ($_list as $i) |
58 | - if(strpos($_string,$i) !== false) |
|
58 | + if (strpos($_string, $i) !== false) |
|
59 | 59 | $success = true; |
60 | 60 | return $success; |
61 | 61 | } |
62 | 62 | public function loginWithUser() { |
63 | 63 | $this->init(); |
64 | 64 | $temp = []; |
65 | - if(!isset($_SESSION["username"])) |
|
66 | - $_SESSION["username"] ="guest"; |
|
65 | + if (!isset($_SESSION["username"])) |
|
66 | + $_SESSION["username"] = "guest"; |
|
67 | 67 | $user = $_SESSION["username"]; |
68 | 68 | $blackList = $this->queryFetch( |
69 | 69 | "SELECT user.*,user_section.* |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | $success = true; |
79 | 79 | $k = $i["label"]; |
80 | 80 | foreach ($blackList as $j) |
81 | - if( $j["section"] == $k) |
|
81 | + if ($j["section"] == $k) |
|
82 | 82 | $success = false; |
83 | - if($success) |
|
84 | - array_push($temp,$i); |
|
83 | + if ($success) |
|
84 | + array_push($temp, $i); |
|
85 | 85 | } |
86 | 86 | $this->tags["menu"] = $temp; |
87 | 87 | } |
@@ -12,9 +12,10 @@ discard block |
||
12 | 12 | $pk_menu = $i["pk_menu"]; |
13 | 13 | array_push($temp, array("label" => $i["label"], "link" => $i["link"], "submenu" => [], "relative" => false)); |
14 | 14 | $submenu = $this->queryFetch("SELECT * FROM menu WHERE fk_menu = $pk_menu ORDER BY `order`"); |
15 | - if($submenu) |
|
16 | - foreach ($submenu as $j) |
|
15 | + if($submenu) { |
|
16 | + foreach ($submenu as $j) |
|
17 | 17 | array_push( $temp[count($temp)-1]["submenu"], array("label" => $j["label"], "link" => $j["link"], "submenu" => [], "relative" => false) ); |
18 | + } |
|
18 | 19 | } |
19 | 20 | } |
20 | 21 | $this->tags["menu"] = $temp; |
@@ -28,12 +29,13 @@ discard block |
||
28 | 29 | $relative = $this->parameters["app"]->server["RELATIVE"]; |
29 | 30 | foreach ($this->tags["menu"] as $i) { |
30 | 31 | $prePath = ""; |
31 | - if($i["relative"]) |
|
32 | - $prePath = $relative; |
|
32 | + if($i["relative"]) { |
|
33 | + $prePath = $relative; |
|
34 | + } |
|
33 | 35 | $active = $this->isSubString($actualLink, array_merge(array_column($i["submenu"], 'link'), array($i["link"]))) ? "active" : ""; |
34 | - if( is_array($i["submenu"]) && count($i["submenu"])<1) |
|
35 | - $temp .= "<li class='$active'><a href='$prePath$i[link]'>$i[label]</a></li>"; |
|
36 | - else { |
|
36 | + if( is_array($i["submenu"]) && count($i["submenu"])<1) { |
|
37 | + $temp .= "<li class='$active'><a href='$prePath$i[link]'>$i[label]</a></li>"; |
|
38 | + } else { |
|
37 | 39 | $temp .= "<li class='dropdown $active'>"; |
38 | 40 | $temp .= |
39 | 41 | '<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'. |
@@ -43,8 +45,9 @@ discard block |
||
43 | 45 | '<ul class="dropdown-menu">'; |
44 | 46 | foreach ($i["submenu"] as $j) { |
45 | 47 | $prePath = ""; |
46 | - if($j["relative"]) |
|
47 | - $prePath = $relative; |
|
48 | + if($j["relative"]) { |
|
49 | + $prePath = $relative; |
|
50 | + } |
|
48 | 51 | $temp .= "<li><a href='$prePath$j[link]'>$j[label]</a></li>"; |
49 | 52 | } |
50 | 53 | $temp .= "</ul></li>"; |
@@ -54,16 +57,18 @@ discard block |
||
54 | 57 | } |
55 | 58 | protected function isSubString( $_string, $_list) { |
56 | 59 | $success = false; |
57 | - foreach ($_list as $i) |
|
58 | - if(strpos($_string,$i) !== false) |
|
60 | + foreach ($_list as $i) { |
|
61 | + if(strpos($_string,$i) !== false) |
|
59 | 62 | $success = true; |
63 | + } |
|
60 | 64 | return $success; |
61 | 65 | } |
62 | 66 | public function loginWithUser() { |
63 | 67 | $this->init(); |
64 | 68 | $temp = []; |
65 | - if(!isset($_SESSION["username"])) |
|
66 | - $_SESSION["username"] ="guest"; |
|
69 | + if(!isset($_SESSION["username"])) { |
|
70 | + $_SESSION["username"] ="guest"; |
|
71 | + } |
|
67 | 72 | $user = $_SESSION["username"]; |
68 | 73 | $blackList = $this->queryFetch( |
69 | 74 | "SELECT user.*,user_section.* |
@@ -77,11 +82,13 @@ discard block |
||
77 | 82 | foreach ($this->tags["menu"] as $i) { |
78 | 83 | $success = true; |
79 | 84 | $k = $i["label"]; |
80 | - foreach ($blackList as $j) |
|
81 | - if( $j["section"] == $k) |
|
85 | + foreach ($blackList as $j) { |
|
86 | + if( $j["section"] == $k) |
|
82 | 87 | $success = false; |
83 | - if($success) |
|
84 | - array_push($temp,$i); |
|
88 | + } |
|
89 | + if($success) { |
|
90 | + array_push($temp,$i); |
|
91 | + } |
|
85 | 92 | } |
86 | 93 | $this->tags["menu"] = $temp; |
87 | 94 | } |
@@ -9,6 +9,10 @@ |
||
9 | 9 | public function drawFile( $_template ) { |
10 | 10 | return $this->draw($_template); |
11 | 11 | } |
12 | + |
|
13 | + /** |
|
14 | + * @param string $_template |
|
15 | + */ |
|
12 | 16 | public function drawText( $_template ) { |
13 | 17 | return $this->draw(trim($_template)); |
14 | 18 | } |
@@ -6,13 +6,13 @@ |
||
6 | 6 | public function __construct() { |
7 | 7 | parent::__construct(); |
8 | 8 | } |
9 | - public function drawFile( $_template ) { |
|
9 | + public function drawFile($_template) { |
|
10 | 10 | return $this->draw($_template); |
11 | 11 | } |
12 | - public function drawText( $_template ) { |
|
12 | + public function drawText($_template) { |
|
13 | 13 | return $this->draw(trim($_template)); |
14 | 14 | } |
15 | - public function draw( $_template ) { |
|
15 | + public function draw($_template) { |
|
16 | 16 | $Parsedown = new Parsedown\Parsedown(); |
17 | 17 | $page = $Parsedown->text($_template); |
18 | 18 | return $page; |
@@ -4,14 +4,14 @@ |
||
4 | 4 | |
5 | 5 | //JATE SUFF |
6 | 6 | require_once (end($GLOBALS["JATEPath"])."jate/functions/requirer.php"); |
7 | - requireComponent ("functions/folder.php"); |
|
8 | - requireComponent ("modules/JConfig/JConfig.php"); |
|
9 | - requireComponents ("functions"); |
|
10 | - requireModules ("modules"); |
|
7 | + requireComponent("functions/folder.php"); |
|
8 | + requireComponent("modules/JConfig/JConfig.php"); |
|
9 | + requireComponents("functions"); |
|
10 | + requireModules("modules"); |
|
11 | 11 | |
12 | 12 | //USER STUFF |
13 | - requireComponent ("config.php",false); |
|
14 | - requireModules ("modules",false); |
|
15 | - requireComponents ("bundles/models",false); |
|
16 | - requireComponents ("bundles/controllers",false); |
|
13 | + requireComponent("config.php", false); |
|
14 | + requireModules("modules", false); |
|
15 | + requireComponents("bundles/models", false); |
|
16 | + requireComponents("bundles/controllers", false); |
|
17 | 17 | ?> |
@@ -16,6 +16,9 @@ |
||
16 | 16 | return jBlockFileMan($_path, $extension, $_parameters); |
17 | 17 | } |
18 | 18 | |
19 | + /** |
|
20 | + * @param string $_type |
|
21 | + */ |
|
19 | 22 | function jBlockFileMan( $_path, $_type, $_parameters = [] ) { |
20 | 23 | $temp = file_get_contents($_path); |
21 | 24 | return jBlockParsing($_type, $temp, $_parameters); |
@@ -5,28 +5,28 @@ discard block |
||
5 | 5 | return ob_start(); |
6 | 6 | } |
7 | 7 | |
8 | - function jBlockClose( $_type = "html", $_parameters = [] ) { |
|
8 | + function jBlockClose($_type = "html", $_parameters = []) { |
|
9 | 9 | return jBlockEnd($_type, $_parameters); |
10 | 10 | } |
11 | 11 | |
12 | - function jBlockFile( $_path, $_parameters = [] ) { |
|
12 | + function jBlockFile($_path, $_parameters = []) { |
|
13 | 13 | $extension = explode(".", $_path); |
14 | - $extension = $extension[count($extension)-1]; |
|
14 | + $extension = $extension[count($extension) - 1]; |
|
15 | 15 | $extension = strtolower($extension); |
16 | 16 | return jBlockFileMan($_path, $extension, $_parameters); |
17 | 17 | } |
18 | 18 | |
19 | - function jBlockFileMan( $_path, $_type, $_parameters = [] ) { |
|
19 | + function jBlockFileMan($_path, $_type, $_parameters = []) { |
|
20 | 20 | $temp = file_get_contents($_path); |
21 | 21 | return jBlockParsing($_type, $temp, $_parameters); |
22 | 22 | } |
23 | 23 | |
24 | - function jBlockEnd( $_type = "html", $_parameters = [] ) { |
|
24 | + function jBlockEnd($_type = "html", $_parameters = []) { |
|
25 | 25 | $text = ob_get_clean(); |
26 | 26 | return jBlockParsing($_type, $text, $_parameters); |
27 | 27 | } |
28 | 28 | |
29 | - function jBlockParsing( $_type = "html", $_string = "", $_parameters = [] ) { |
|
29 | + function jBlockParsing($_type = "html", $_string = "", $_parameters = []) { |
|
30 | 30 | switch ($_type) { |
31 | 31 | case "pug": |
32 | 32 | case "jade": |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | function minifyOutput($_buffer) { |
52 | - $search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' ); |
|
53 | - $replace = array ( '>', '<', '\\1' ); |
|
54 | - if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) |
|
52 | + $search = array('/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s'); |
|
53 | + $replace = array('>', '<', '\\1'); |
|
54 | + if (preg_match("/\<html/i", $_buffer) == 1 && preg_match("/\<\/html\>/i", $_buffer) == 1) |
|
55 | 55 | $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
56 | 56 | return utf8_encode($_buffer); |
57 | 57 | } |
@@ -51,8 +51,9 @@ |
||
51 | 51 | function minifyOutput($_buffer) { |
52 | 52 | $search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' ); |
53 | 53 | $replace = array ( '>', '<', '\\1' ); |
54 | - if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) |
|
55 | - $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
|
54 | + if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) { |
|
55 | + $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
|
56 | + } |
|
56 | 57 | return utf8_encode($_buffer); |
57 | 58 | } |
58 | 59 | ?> |
@@ -8,6 +8,10 @@ |
||
8 | 8 | public function drawFile( $_file, $_parameters = [] ) { |
9 | 9 | return $this->draw($_file, $_parameters); |
10 | 10 | } |
11 | + |
|
12 | + /** |
|
13 | + * @param string $_text |
|
14 | + */ |
|
11 | 15 | public function drawText( $_text, $_parameters = [] ) { |
12 | 16 | return $this->draw(trim($_text), $_parameters); |
13 | 17 | } |
@@ -5,13 +5,13 @@ |
||
5 | 5 | public function __construct() { |
6 | 6 | parent::__construct(); |
7 | 7 | } |
8 | - public function drawFile( $_file, $_parameters = [] ) { |
|
8 | + public function drawFile($_file, $_parameters = []) { |
|
9 | 9 | return $this->draw($_file, $_parameters); |
10 | 10 | } |
11 | - public function drawText( $_text, $_parameters = [] ) { |
|
11 | + public function drawText($_text, $_parameters = []) { |
|
12 | 12 | return $this->draw(trim($_text), $_parameters); |
13 | 13 | } |
14 | - public function draw( $_text, $_parameters = [] ) { |
|
14 | + public function draw($_text, $_parameters = []) { |
|
15 | 15 | $pug = new Pug\Pug(); |
16 | 16 | $page = $pug->render($_text, $_parameters); |
17 | 17 | return $page; |
@@ -14,6 +14,10 @@ |
||
14 | 14 | $page = $template->render($_parameters); |
15 | 15 | return $page; |
16 | 16 | } |
17 | + |
|
18 | + /** |
|
19 | + * @param string $_text |
|
20 | + */ |
|
17 | 21 | public function drawText( $_text, $_parameters = [] ) { |
18 | 22 | $loader = new Twig_Loader_Array([ |
19 | 23 | 'index' => $_text |
@@ -5,16 +5,16 @@ |
||
5 | 5 | public function __construct() { |
6 | 6 | parent::__construct(); |
7 | 7 | } |
8 | - public function drawFile( $_file, $_parameters = [] ) { |
|
9 | - $loader = new Twig_Loader_Filesystem('bundles/views'); |
|
10 | - $twig = new Twig_Environment( $loader, [ |
|
8 | + public function drawFile($_file, $_parameters = []) { |
|
9 | + $loader = new Twig_Loader_Filesystem('bundles/views'); |
|
10 | + $twig = new Twig_Environment($loader, [ |
|
11 | 11 | 'cache' => 'bundles/views', |
12 | 12 | ]); |
13 | 13 | $template = $twig->loadTemplate($_text); |
14 | 14 | $page = $template->render($_parameters); |
15 | 15 | return $page; |
16 | 16 | } |
17 | - public function drawText( $_text, $_parameters = [] ) { |
|
17 | + public function drawText($_text, $_parameters = []) { |
|
18 | 18 | $loader = new Twig_Loader_Array([ |
19 | 19 | 'index' => $_text |
20 | 20 | ]); |
@@ -6,24 +6,24 @@ |
||
6 | 6 | public function __construct() { |
7 | 7 | parent::__construct(); |
8 | 8 | } |
9 | - public function init( $_page ) { |
|
9 | + public function init($_page) { |
|
10 | 10 | $this->tags = $_page->tags; |
11 | 11 | } |
12 | - public function draw( $_template ) { |
|
12 | + public function draw($_template) { |
|
13 | 13 | $page = ""; |
14 | - $extension = explode(".",$_template); |
|
15 | - $extension = $extension[count($extension)-1]; |
|
14 | + $extension = explode(".", $_template); |
|
15 | + $extension = $extension[count($extension) - 1]; |
|
16 | 16 | $page = $this->parsingFile($_template, $extension); |
17 | 17 | $render = $this->overlayTag($page); |
18 | 18 | echo minifyOutput($render); |
19 | 19 | } |
20 | - protected function overlayTag( $_page ) { |
|
21 | - foreach($this->tags as $key => $value) |
|
22 | - if(!is_array($value)) |
|
20 | + protected function overlayTag($_page) { |
|
21 | + foreach ($this->tags as $key => $value) |
|
22 | + if (!is_array($value)) |
|
23 | 23 | $_page = str_replace("<_${key}_>", "$value", $_page); |
24 | 24 | return $_page; |
25 | 25 | } |
26 | - protected function parsingFile( $_file, $_type = "html" ) { |
|
26 | + protected function parsingFile($_file, $_type = "html") { |
|
27 | 27 | switch ($_type) { |
28 | 28 | case 'pug': |
29 | 29 | case 'jade': |
@@ -18,9 +18,10 @@ |
||
18 | 18 | echo minifyOutput($render); |
19 | 19 | } |
20 | 20 | protected function overlayTag( $_page ) { |
21 | - foreach($this->tags as $key => $value) |
|
22 | - if(!is_array($value)) |
|
21 | + foreach($this->tags as $key => $value) { |
|
22 | + if(!is_array($value)) |
|
23 | 23 | $_page = str_replace("<_${key}_>", "$value", $_page); |
24 | + } |
|
24 | 25 | return $_page; |
25 | 26 | } |
26 | 27 | protected function parsingFile( $_file, $_type = "html" ) { |
@@ -1,18 +1,18 @@ |
||
1 | 1 | <?php |
2 | 2 | jRequire("../Module/Module.php"); |
3 | 3 | class Statistic extends Module { |
4 | - public function __construct( $_webApp ) { |
|
4 | + public function __construct($_webApp) { |
|
5 | 5 | parent::__construct(); |
6 | 6 | $pages = []; |
7 | 7 | $stats = []; |
8 | 8 | $pages = $_webApp->pages; |
9 | - foreach ( $pages as $k => $v ) { |
|
9 | + foreach ($pages as $k => $v) { |
|
10 | 10 | $temp = new $v[0]($v[1]); |
11 | 11 | $temp->addDipendences(); |
12 | 12 | $stats[$k] = []; |
13 | 13 | $stats[$k]["page"] = $v[0]; |
14 | 14 | $stats[$k]["css"] = $temp->data["css"]; |
15 | - $stats[$k]["js"] = $temp->data["js"]; |
|
15 | + $stats[$k]["js"] = $temp->data["js"]; |
|
16 | 16 | } |
17 | 17 | $this->data = $stats; |
18 | 18 | } |
@@ -8,49 +8,49 @@ discard block |
||
8 | 8 | public function __construct() { |
9 | 9 | parent::__construct(); |
10 | 10 | $this->pages = []; |
11 | - $this->defaultPage = ["Page404",[]]; |
|
11 | + $this->defaultPage = ["Page404", []]; |
|
12 | 12 | $this->currentPage = null; |
13 | - $this->jConfig = null; |
|
13 | + $this->jConfig = null; |
|
14 | 14 | } |
15 | - public function addPage( $_page ) { |
|
15 | + public function addPage($_page) { |
|
16 | 16 | $param = []; |
17 | 17 | $path = $_page; |
18 | 18 | $class = $_page; |
19 | - if(is_array($_page)) { |
|
19 | + if (is_array($_page)) { |
|
20 | 20 | $path = $_page[0]; |
21 | 21 | $class = $_page[1]; |
22 | - if(isset($_page[2])) |
|
22 | + if (isset($_page[2])) |
|
23 | 23 | $param = $_page[2]; |
24 | 24 | } |
25 | 25 | $this->pages[$path] = [$class, $param]; |
26 | 26 | return $this->pages[$path]; |
27 | 27 | } |
28 | - public function addPages( $_pages ) { |
|
28 | + public function addPages($_pages) { |
|
29 | 29 | foreach ($_pages as $i) |
30 | 30 | $this->addPage($i); |
31 | 31 | } |
32 | 32 | public function fetchPage( ) { |
33 | 33 | $router = new Router(); |
34 | - $router->parameters = [ "app" => &$this->jConfig, "page" => null]; |
|
34 | + $router->parameters = ["app" => &$this->jConfig, "page" => null]; |
|
35 | 35 | $stack = $router->getPage(); |
36 | 36 | $parameters = []; |
37 | - $temp = $this->defaultPage; |
|
37 | + $temp = $this->defaultPage; |
|
38 | 38 | foreach ($this->pages as $key => $value) { |
39 | 39 | $variables = $this->pathSeeker(explode("/", $key), $stack); |
40 | - if(is_array($variables)) { |
|
40 | + if (is_array($variables)) { |
|
41 | 41 | $temp = $value; |
42 | 42 | $parameters = $variables; |
43 | 43 | break; |
44 | 44 | } |
45 | 45 | } |
46 | - if( isset($temp[1]) && is_array($temp[1]) ) |
|
46 | + if (isset($temp[1]) && is_array($temp[1])) |
|
47 | 47 | $temp[1] = array_merge($temp[1], $parameters); |
48 | 48 | else |
49 | 49 | $temp[1] = $parameters; |
50 | 50 | $this->currentPage = new $temp[0](["app" => $this->jConfig, "page" => $temp[1]]); |
51 | 51 | return $this->currentPage; |
52 | 52 | } |
53 | - public function setDefaultPage( $_page ) { |
|
53 | + public function setDefaultPage($_page) { |
|
54 | 54 | $this->defaultPage = $this->addPage($_page); |
55 | 55 | } |
56 | 56 | public function draw() { |
@@ -59,28 +59,28 @@ discard block |
||
59 | 59 | $gui->init($this->currentPage); |
60 | 60 | $gui->draw($this->currentPage->data["template"]); |
61 | 61 | } |
62 | - public function pathSeeker( $_path, $_url ) { |
|
62 | + public function pathSeeker($_path, $_url) { |
|
63 | 63 | $urlLength = count($_url); |
64 | 64 | $cont = 0; |
65 | 65 | $variables = []; |
66 | 66 | $pathLength = count($_path); |
67 | - if($urlLength == $pathLength) { |
|
68 | - while($cont < $urlLength) { |
|
69 | - if( $_path[$cont] == $_url[$cont] ) |
|
67 | + if ($urlLength == $pathLength) { |
|
68 | + while ($cont < $urlLength) { |
|
69 | + if ($_path[$cont] == $_url[$cont]) |
|
70 | 70 | $cont++; |
71 | - else if( strpos($_path[$cont], "\$") !== false ) { |
|
71 | + else if (strpos($_path[$cont], "\$") !== false) { |
|
72 | 72 | $variables[str_replace('$', "", $_path[$cont])] = $_url[$cont]; |
73 | 73 | $cont++; |
74 | 74 | } else break; |
75 | 75 | } |
76 | - if($cont == $urlLength) |
|
76 | + if ($cont == $urlLength) |
|
77 | 77 | return $variables; |
78 | 78 | } |
79 | 79 | return null; |
80 | 80 | } |
81 | - public function newConfig( $_path = "config/") { |
|
81 | + public function newConfig($_path = "config/") { |
|
82 | 82 | $this->jConfig = new JConfig(); |
83 | - $this->jConfig->import("${_path}connection.json","connection"); |
|
83 | + $this->jConfig->import("${_path}connection.json", "connection"); |
|
84 | 84 | $this->jConfig->import("${_path}misc.json"); |
85 | 85 | $this->jConfig->import("${_path}router.json"); |
86 | 86 | } |
@@ -19,15 +19,17 @@ discard block |
||
19 | 19 | if(is_array($_page)) { |
20 | 20 | $path = $_page[0]; |
21 | 21 | $class = $_page[1]; |
22 | - if(isset($_page[2])) |
|
23 | - $param = $_page[2]; |
|
22 | + if(isset($_page[2])) { |
|
23 | + $param = $_page[2]; |
|
24 | + } |
|
24 | 25 | } |
25 | 26 | $this->pages[$path] = [$class, $param]; |
26 | 27 | return $this->pages[$path]; |
27 | 28 | } |
28 | 29 | public function addPages( $_pages ) { |
29 | - foreach ($_pages as $i) |
|
30 | - $this->addPage($i); |
|
30 | + foreach ($_pages as $i) { |
|
31 | + $this->addPage($i); |
|
32 | + } |
|
31 | 33 | } |
32 | 34 | public function fetchPage( ) { |
33 | 35 | $router = new Router(); |
@@ -43,10 +45,11 @@ discard block |
||
43 | 45 | break; |
44 | 46 | } |
45 | 47 | } |
46 | - if( isset($temp[1]) && is_array($temp[1]) ) |
|
47 | - $temp[1] = array_merge($temp[1], $parameters); |
|
48 | - else |
|
49 | - $temp[1] = $parameters; |
|
48 | + if( isset($temp[1]) && is_array($temp[1]) ) { |
|
49 | + $temp[1] = array_merge($temp[1], $parameters); |
|
50 | + } else { |
|
51 | + $temp[1] = $parameters; |
|
52 | + } |
|
50 | 53 | $this->currentPage = new $temp[0](["app" => $this->jConfig, "page" => $temp[1]]); |
51 | 54 | return $this->currentPage; |
52 | 55 | } |
@@ -66,15 +69,18 @@ discard block |
||
66 | 69 | $pathLength = count($_path); |
67 | 70 | if($urlLength == $pathLength) { |
68 | 71 | while($cont < $urlLength) { |
69 | - if( $_path[$cont] == $_url[$cont] ) |
|
70 | - $cont++; |
|
71 | - else if( strpos($_path[$cont], "\$") !== false ) { |
|
72 | + if( $_path[$cont] == $_url[$cont] ) { |
|
73 | + $cont++; |
|
74 | + } else if( strpos($_path[$cont], "\$") !== false ) { |
|
72 | 75 | $variables[str_replace('$', "", $_path[$cont])] = $_url[$cont]; |
73 | 76 | $cont++; |
74 | - } else break; |
|
77 | + } else { |
|
78 | + break; |
|
79 | + } |
|
80 | + } |
|
81 | + if($cont == $urlLength) { |
|
82 | + return $variables; |
|
75 | 83 | } |
76 | - if($cont == $urlLength) |
|
77 | - return $variables; |
|
78 | 84 | } |
79 | 85 | return null; |
80 | 86 | } |