@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | public $parameters; |
11 | 11 | public function __construct() { |
12 | 12 | $this->name = get_class($this); |
13 | - $this->modules = []; |
|
13 | + $this->modules = []; |
|
14 | 14 | $this->files = []; |
15 | - $this->required = []; |
|
15 | + $this->required = []; |
|
16 | 16 | $this->data = []; |
17 | 17 | $this->tags = []; |
18 | 18 | $this->connection = null; |
@@ -22,43 +22,43 @@ discard block |
||
22 | 22 | // abstract public function init(); |
23 | 23 | // abstract public function draw(); |
24 | 24 | public function getCss() { |
25 | - return $this->getRequire("getCss",".css"); |
|
25 | + return $this->getRequire("getCss", ".css"); |
|
26 | 26 | } |
27 | 27 | public function getJs() { |
28 | - return $this->getRequire("getJs",".js"); |
|
28 | + return $this->getRequire("getJs", ".js"); |
|
29 | 29 | } |
30 | 30 | public function getJsVariables() { |
31 | 31 | $temp = []; |
32 | 32 | foreach ($this->required as $i) |
33 | 33 | if (is_array($i)) |
34 | - array_push($temp,$i); |
|
34 | + array_push($temp, $i); |
|
35 | 35 | foreach ($this->modules as $i) |
36 | - $temp = array_merge( $temp, $i->getJsVariables() ); |
|
36 | + $temp = array_merge($temp, $i->getJsVariables()); |
|
37 | 37 | foreach ($this->files as $i) |
38 | 38 | if (is_array($i)) |
39 | - array_push($temp,$i); |
|
39 | + array_push($temp, $i); |
|
40 | 40 | return $temp; |
41 | 41 | } |
42 | - public function addModules( $_mods ) { |
|
42 | + public function addModules($_mods) { |
|
43 | 43 | foreach ($_mods as $value) |
44 | 44 | $this->addModule($value); |
45 | 45 | } |
46 | - public function addModule( $_mod ) { |
|
46 | + public function addModule($_mod) { |
|
47 | 47 | $this->modules[$_mod->name] = $_mod; |
48 | 48 | $this->modules[$_mod->name]->parameters = &$this->parameters; |
49 | 49 | } |
50 | - public function addFiles( $_files ) { |
|
50 | + public function addFiles($_files) { |
|
51 | 51 | foreach ($_files as $value) |
52 | 52 | $this->addFile($value); |
53 | 53 | } |
54 | - public function addFile( $_file ) { |
|
54 | + public function addFile($_file) { |
|
55 | 55 | array_push($this->files, $_file); |
56 | 56 | } |
57 | - public function addFilesRequired( $_files ) { |
|
57 | + public function addFilesRequired($_files) { |
|
58 | 58 | foreach ($_files as $value) |
59 | 59 | $this->addFileRequired($value); |
60 | 60 | } |
61 | - public function addFileRequired( $_file ) { |
|
61 | + public function addFileRequired($_file) { |
|
62 | 62 | array_push($this->required, $_file); |
63 | 63 | } |
64 | 64 | protected function addDipendences() { |
@@ -66,16 +66,16 @@ discard block |
||
66 | 66 | $this->tags["js"] = $this->getJs(); |
67 | 67 | $this->tags["jsVariables"] = $this->getJsVariables(); |
68 | 68 | } |
69 | - protected function getRequire( $_function, $_extenction) { |
|
69 | + protected function getRequire($_function, $_extenction) { |
|
70 | 70 | $temp = []; |
71 | 71 | foreach ($this->required as $i) |
72 | 72 | if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
73 | - array_push($temp,$i); |
|
73 | + array_push($temp, $i); |
|
74 | 74 | foreach ($this->modules as $i) |
75 | - $temp = array_merge( $temp, $i->$_function() ); |
|
75 | + $temp = array_merge($temp, $i->$_function()); |
|
76 | 76 | foreach ($this->files as $i) |
77 | 77 | if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
78 | - array_push($temp,$i); |
|
78 | + array_push($temp, $i); |
|
79 | 79 | return $temp; |
80 | 80 | } |
81 | 81 | } |
@@ -66,6 +66,11 @@ |
||
66 | 66 | $this->tags["js"] = $this->getJs(); |
67 | 67 | $this->tags["jsVariables"] = $this->getJsVariables(); |
68 | 68 | } |
69 | + |
|
70 | + /** |
|
71 | + * @param string $_function |
|
72 | + * @param string $_extenction |
|
73 | + */ |
|
69 | 74 | protected function getRequire( $_function, $_extenction) { |
70 | 75 | $temp = []; |
71 | 76 | foreach ($this->required as $i) |
@@ -29,34 +29,40 @@ discard block |
||
29 | 29 | } |
30 | 30 | public function getJsVariables() { |
31 | 31 | $temp = []; |
32 | - foreach ($this->required as $i) |
|
33 | - if (is_array($i)) |
|
32 | + foreach ($this->required as $i) { |
|
33 | + if (is_array($i)) |
|
34 | 34 | array_push($temp,$i); |
35 | - foreach ($this->modules as $i) |
|
36 | - $temp = array_merge( $temp, $i->getJsVariables() ); |
|
37 | - foreach ($this->files as $i) |
|
38 | - if (is_array($i)) |
|
35 | + } |
|
36 | + foreach ($this->modules as $i) { |
|
37 | + $temp = array_merge( $temp, $i->getJsVariables() ); |
|
38 | + } |
|
39 | + foreach ($this->files as $i) { |
|
40 | + if (is_array($i)) |
|
39 | 41 | array_push($temp,$i); |
42 | + } |
|
40 | 43 | return $temp; |
41 | 44 | } |
42 | 45 | public function addModules( $_mods ) { |
43 | - foreach ($_mods as $value) |
|
44 | - $this->addModule($value); |
|
46 | + foreach ($_mods as $value) { |
|
47 | + $this->addModule($value); |
|
48 | + } |
|
45 | 49 | } |
46 | 50 | public function addModule( $_mod ) { |
47 | 51 | $this->modules[$_mod->name] = $_mod; |
48 | 52 | $this->modules[$_mod->name]->parameters = &$this->parameters; |
49 | 53 | } |
50 | 54 | public function addFiles( $_files ) { |
51 | - foreach ($_files as $value) |
|
52 | - $this->addFile($value); |
|
55 | + foreach ($_files as $value) { |
|
56 | + $this->addFile($value); |
|
57 | + } |
|
53 | 58 | } |
54 | 59 | public function addFile( $_file ) { |
55 | 60 | array_push($this->files, $_file); |
56 | 61 | } |
57 | 62 | public function addFilesRequired( $_files ) { |
58 | - foreach ($_files as $value) |
|
59 | - $this->addFileRequired($value); |
|
63 | + foreach ($_files as $value) { |
|
64 | + $this->addFileRequired($value); |
|
65 | + } |
|
60 | 66 | } |
61 | 67 | public function addFileRequired( $_file ) { |
62 | 68 | array_push($this->required, $_file); |
@@ -68,14 +74,17 @@ discard block |
||
68 | 74 | } |
69 | 75 | protected function getRequire( $_function, $_extenction) { |
70 | 76 | $temp = []; |
71 | - foreach ($this->required as $i) |
|
72 | - if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
|
77 | + foreach ($this->required as $i) { |
|
78 | + if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
|
73 | 79 | array_push($temp,$i); |
74 | - foreach ($this->modules as $i) |
|
75 | - $temp = array_merge( $temp, $i->$_function() ); |
|
76 | - foreach ($this->files as $i) |
|
77 | - if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
|
80 | + } |
|
81 | + foreach ($this->modules as $i) { |
|
82 | + $temp = array_merge( $temp, $i->$_function() ); |
|
83 | + } |
|
84 | + foreach ($this->files as $i) { |
|
85 | + if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
|
78 | 86 | array_push($temp,$i); |
87 | + } |
|
79 | 88 | return $temp; |
80 | 89 | } |
81 | 90 | } |
@@ -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 | } |