@@ -1,25 +1,25 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | jRequire("../Module/Module.php"); |
3 | 3 | class Statistic extends Module { |
4 | - public function __construct( $_webApp ) { |
|
5 | - parent::__construct(); |
|
6 | - $pages = []; |
|
7 | - $stats = []; |
|
8 | - $pages = $_webApp->pages; |
|
9 | - foreach ( $pages as $k => $v ) { |
|
10 | - $temp = new $v[0]($v[1]); |
|
11 | - $temp->addDipendences(); |
|
12 | - $stats[$k] = []; |
|
13 | - $stats[$k]["page"] = $v[0]; |
|
14 | - $stats[$k]["css"] = $temp->data["css"]; |
|
15 | - $stats[$k]["js"] = $temp->data["js"]; |
|
16 | - } |
|
17 | - $this->data = $stats; |
|
18 | - } |
|
19 | - public function draw() { |
|
20 | - jBlock(); |
|
21 | - foreach ($this->data as $i) { |
|
22 | - ?> |
|
4 | + public function __construct( $_webApp ) { |
|
5 | + parent::__construct(); |
|
6 | + $pages = []; |
|
7 | + $stats = []; |
|
8 | + $pages = $_webApp->pages; |
|
9 | + foreach ( $pages as $k => $v ) { |
|
10 | + $temp = new $v[0]($v[1]); |
|
11 | + $temp->addDipendences(); |
|
12 | + $stats[$k] = []; |
|
13 | + $stats[$k]["page"] = $v[0]; |
|
14 | + $stats[$k]["css"] = $temp->data["css"]; |
|
15 | + $stats[$k]["js"] = $temp->data["js"]; |
|
16 | + } |
|
17 | + $this->data = $stats; |
|
18 | + } |
|
19 | + public function draw() { |
|
20 | + jBlock(); |
|
21 | + foreach ($this->data as $i) { |
|
22 | + ?> |
|
23 | 23 | <div class="row"> |
24 | 24 | <div class="col-lg-12"> |
25 | 25 | Page: <?=$i["page"]?><br> |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | </div> |
29 | 29 | </div> |
30 | 30 | <?php |
31 | - } |
|
32 | - return jBlockEnd(); |
|
33 | - } |
|
31 | + } |
|
32 | + return jBlockEnd(); |
|
33 | + } |
|
34 | 34 | } |
35 | 35 | ?> |
@@ -1,17 +1,17 @@ |
||
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 | - $stats[$k]["css"] = $temp->data["css"]; |
|
14 | + $stats[$k]["css"] = $temp->data["css"]; |
|
15 | 15 | $stats[$k]["js"] = $temp->data["js"]; |
16 | 16 | } |
17 | 17 | $this->data = $stats; |
@@ -1,90 +1,90 @@ |
||
1 | 1 | <?php |
2 | 2 | jRequire("../Module/Module.php"); |
3 | 3 | class WebApp extends Module { |
4 | - protected $pages; |
|
5 | - protected $defaultPage; |
|
6 | - public $currentPage; |
|
7 | - public $jConfig; |
|
8 | - public function __construct() { |
|
9 | - parent::__construct(); |
|
10 | - $this->pages = []; |
|
11 | - $this->defaultPage = ["Page404",[]]; |
|
12 | - $this->currentPage = null; |
|
13 | - $this->jConfig = null; |
|
14 | - } |
|
15 | - public function addPage( $_page ) { |
|
16 | - $param = []; |
|
17 | - $path = $_page; |
|
18 | - $class = $_page; |
|
19 | - if(is_array($_page)) { |
|
20 | - $path = $_page[0]; |
|
21 | - $class = $_page[1]; |
|
22 | - if(isset($_page[2])) |
|
23 | - $param = $_page[2]; |
|
24 | - } |
|
25 | - $this->pages[$path] = [$class, $param]; |
|
26 | - return $this->pages[$path]; |
|
27 | - } |
|
28 | - public function addPages( $_pages ) { |
|
29 | - foreach ($_pages as $i) |
|
30 | - $this->addPage($i); |
|
31 | - } |
|
32 | - public function fetchPage() { |
|
33 | - $router = new Router(); |
|
34 | - $router->parameters = [ "app" => &$this->jConfig, "page" => null]; |
|
35 | - $stack = $router->getPage(); |
|
36 | - $parameters = []; |
|
37 | - $temp = $this->defaultPage; |
|
38 | - foreach ($this->pages as $key => $value) { |
|
39 | - $variables = $this->pathSeeker(explode("/", $key), $stack); |
|
40 | - if(is_array($variables)) { |
|
41 | - $temp = $value; |
|
42 | - $parameters = $variables; |
|
43 | - break; |
|
44 | - } |
|
45 | - } |
|
46 | - if( isset($temp[1]) && is_array($temp[1]) ) |
|
47 | - $temp[1] = array_merge($temp[1], $parameters); |
|
48 | - else |
|
49 | - $temp[1] = $parameters; |
|
50 | - $this->currentPage = new $temp[0](["app" => $this->jConfig, "page" => $temp[1]]); |
|
51 | - return $this->currentPage; |
|
52 | - } |
|
53 | - public function setDefaultPage( $_page ) { |
|
54 | - $this->defaultPage = $this->addPage($_page); |
|
55 | - } |
|
56 | - public function draw() { |
|
57 | - $this->currentPage->uniforma(); |
|
58 | - $gui = new GUI(); |
|
59 | - $gui->init($this->currentPage); |
|
60 | - $gui->draw($this->currentPage->data["template"]); |
|
61 | - } |
|
62 | - public function pathSeeker( $_path, $_url ) { |
|
63 | - $urlLength = count($_url); |
|
64 | - $cont = 0; |
|
65 | - $variables = []; |
|
66 | - $pathLength = count($_path); |
|
67 | - if($urlLength == $pathLength) { |
|
68 | - while($cont < $urlLength) { |
|
69 | - if( |
|
70 | - ($this->jConfig->urlCaseSensitive && $_path[$cont] == $_url[$cont]) || |
|
71 | - (!$this->jConfig->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) ) |
|
72 | - $cont++; |
|
73 | - else if( strpos($_path[$cont], "\$") !== false ) { |
|
74 | - $variables[str_replace('$', "", $_path[$cont])] = $_url[$cont]; |
|
75 | - $cont++; |
|
76 | - } else break; |
|
77 | - } |
|
78 | - if($cont == $urlLength) |
|
79 | - return $variables; |
|
80 | - } |
|
81 | - return null; |
|
82 | - } |
|
83 | - public function newConfig( $_path = "config/") { |
|
84 | - $this->jConfig = new JConfig(); |
|
85 | - $this->jConfig->import("${_path}connection.json","connection"); |
|
86 | - $this->jConfig->import("${_path}misc.json"); |
|
87 | - $this->jConfig->import("${_path}router.json"); |
|
88 | - } |
|
4 | + protected $pages; |
|
5 | + protected $defaultPage; |
|
6 | + public $currentPage; |
|
7 | + public $jConfig; |
|
8 | + public function __construct() { |
|
9 | + parent::__construct(); |
|
10 | + $this->pages = []; |
|
11 | + $this->defaultPage = ["Page404",[]]; |
|
12 | + $this->currentPage = null; |
|
13 | + $this->jConfig = null; |
|
14 | + } |
|
15 | + public function addPage( $_page ) { |
|
16 | + $param = []; |
|
17 | + $path = $_page; |
|
18 | + $class = $_page; |
|
19 | + if(is_array($_page)) { |
|
20 | + $path = $_page[0]; |
|
21 | + $class = $_page[1]; |
|
22 | + if(isset($_page[2])) |
|
23 | + $param = $_page[2]; |
|
24 | + } |
|
25 | + $this->pages[$path] = [$class, $param]; |
|
26 | + return $this->pages[$path]; |
|
27 | + } |
|
28 | + public function addPages( $_pages ) { |
|
29 | + foreach ($_pages as $i) |
|
30 | + $this->addPage($i); |
|
31 | + } |
|
32 | + public function fetchPage() { |
|
33 | + $router = new Router(); |
|
34 | + $router->parameters = [ "app" => &$this->jConfig, "page" => null]; |
|
35 | + $stack = $router->getPage(); |
|
36 | + $parameters = []; |
|
37 | + $temp = $this->defaultPage; |
|
38 | + foreach ($this->pages as $key => $value) { |
|
39 | + $variables = $this->pathSeeker(explode("/", $key), $stack); |
|
40 | + if(is_array($variables)) { |
|
41 | + $temp = $value; |
|
42 | + $parameters = $variables; |
|
43 | + break; |
|
44 | + } |
|
45 | + } |
|
46 | + if( isset($temp[1]) && is_array($temp[1]) ) |
|
47 | + $temp[1] = array_merge($temp[1], $parameters); |
|
48 | + else |
|
49 | + $temp[1] = $parameters; |
|
50 | + $this->currentPage = new $temp[0](["app" => $this->jConfig, "page" => $temp[1]]); |
|
51 | + return $this->currentPage; |
|
52 | + } |
|
53 | + public function setDefaultPage( $_page ) { |
|
54 | + $this->defaultPage = $this->addPage($_page); |
|
55 | + } |
|
56 | + public function draw() { |
|
57 | + $this->currentPage->uniforma(); |
|
58 | + $gui = new GUI(); |
|
59 | + $gui->init($this->currentPage); |
|
60 | + $gui->draw($this->currentPage->data["template"]); |
|
61 | + } |
|
62 | + public function pathSeeker( $_path, $_url ) { |
|
63 | + $urlLength = count($_url); |
|
64 | + $cont = 0; |
|
65 | + $variables = []; |
|
66 | + $pathLength = count($_path); |
|
67 | + if($urlLength == $pathLength) { |
|
68 | + while($cont < $urlLength) { |
|
69 | + if( |
|
70 | + ($this->jConfig->urlCaseSensitive && $_path[$cont] == $_url[$cont]) || |
|
71 | + (!$this->jConfig->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) ) |
|
72 | + $cont++; |
|
73 | + else if( strpos($_path[$cont], "\$") !== false ) { |
|
74 | + $variables[str_replace('$', "", $_path[$cont])] = $_url[$cont]; |
|
75 | + $cont++; |
|
76 | + } else break; |
|
77 | + } |
|
78 | + if($cont == $urlLength) |
|
79 | + return $variables; |
|
80 | + } |
|
81 | + return null; |
|
82 | + } |
|
83 | + public function newConfig( $_path = "config/") { |
|
84 | + $this->jConfig = new JConfig(); |
|
85 | + $this->jConfig->import("${_path}connection.json","connection"); |
|
86 | + $this->jConfig->import("${_path}misc.json"); |
|
87 | + $this->jConfig->import("${_path}router.json"); |
|
88 | + } |
|
89 | 89 | } |
90 | 90 | ?> |
@@ -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 | 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 | 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,30 +59,30 @@ 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( |
|
67 | + if ($urlLength == $pathLength) { |
|
68 | + while ($cont < $urlLength) { |
|
69 | + if ( |
|
70 | 70 | ($this->jConfig->urlCaseSensitive && $_path[$cont] == $_url[$cont]) || |
71 | 71 | (!$this->jConfig->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) ) |
72 | 72 | $cont++; |
73 | - else if( strpos($_path[$cont], "\$") !== false ) { |
|
73 | + else if (strpos($_path[$cont], "\$") !== false) { |
|
74 | 74 | $variables[str_replace('$', "", $_path[$cont])] = $_url[$cont]; |
75 | 75 | $cont++; |
76 | 76 | } else break; |
77 | 77 | } |
78 | - if($cont == $urlLength) |
|
78 | + if ($cont == $urlLength) |
|
79 | 79 | return $variables; |
80 | 80 | } |
81 | 81 | return null; |
82 | 82 | } |
83 | - public function newConfig( $_path = "config/") { |
|
83 | + public function newConfig($_path = "config/") { |
|
84 | 84 | $this->jConfig = new JConfig(); |
85 | - $this->jConfig->import("${_path}connection.json","connection"); |
|
85 | + $this->jConfig->import("${_path}connection.json", "connection"); |
|
86 | 86 | $this->jConfig->import("${_path}misc.json"); |
87 | 87 | $this->jConfig->import("${_path}router.json"); |
88 | 88 | } |
@@ -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 | } |
@@ -68,15 +71,18 @@ discard block |
||
68 | 71 | while($cont < $urlLength) { |
69 | 72 | if( |
70 | 73 | ($this->jConfig->urlCaseSensitive && $_path[$cont] == $_url[$cont]) || |
71 | - (!$this->jConfig->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) ) |
|
72 | - $cont++; |
|
73 | - else if( strpos($_path[$cont], "\$") !== false ) { |
|
74 | + (!$this->jConfig->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) ) { |
|
75 | + $cont++; |
|
76 | + } else if( strpos($_path[$cont], "\$") !== false ) { |
|
74 | 77 | $variables[str_replace('$', "", $_path[$cont])] = $_url[$cont]; |
75 | 78 | $cont++; |
76 | - } else break; |
|
79 | + } else { |
|
80 | + break; |
|
81 | + } |
|
82 | + } |
|
83 | + if($cont == $urlLength) { |
|
84 | + return $variables; |
|
77 | 85 | } |
78 | - if($cont == $urlLength) |
|
79 | - return $variables; |
|
80 | 86 | } |
81 | 87 | return null; |
82 | 88 | } |
@@ -3,48 +3,48 @@ |
||
3 | 3 | jRequire("../Pug/Pug.php"); |
4 | 4 | jRequire("../Twig/Twig.php"); |
5 | 5 | class GUI extends Module { |
6 | - public function __construct() { |
|
7 | - parent::__construct(); |
|
8 | - } |
|
9 | - public function init( $_page ) { |
|
10 | - $this->tags = $_page->tags; |
|
11 | - } |
|
12 | - public function draw( $_template ) { |
|
13 | - $page = ""; |
|
14 | - $extension = explode(".",$_template); |
|
15 | - $extension = $extension[count($extension)-1]; |
|
16 | - $page = $this->parsingFile($_template, $extension); |
|
17 | - $render = $this->overlayTag($page); |
|
18 | - echo minifyOutput($render); |
|
19 | - } |
|
20 | - protected function overlayTag( $_page ) { |
|
21 | - foreach($this->tags as $key => $value) |
|
22 | - if(!is_array($value)) |
|
23 | - $_page = str_replace("<_${key}_>", "$value", $_page); |
|
24 | - return $_page; |
|
25 | - } |
|
26 | - protected function parsingFile( $_file, $_type = "html" ) { |
|
27 | - switch ($_type) { |
|
28 | - case 'pug': |
|
29 | - case 'jade': |
|
30 | - $pug = new Pug(); |
|
31 | - $page = $pug->drawFile($_file); |
|
32 | - break; |
|
33 | - case "md": |
|
34 | - case "markdown": |
|
35 | - case "parsedown": |
|
36 | - $Parsedown = new Parsedown(); |
|
37 | - $page = $Parsedown->drawFile($_file); |
|
38 | - break; |
|
39 | - case 'twig': |
|
40 | - $twig = new Twig(); |
|
41 | - $page = $twig->drawFile($_file); |
|
42 | - break; |
|
43 | - default: |
|
44 | - $page = file_get_contents($_file); |
|
45 | - break; |
|
46 | - } |
|
47 | - return $page; |
|
48 | - } |
|
6 | + public function __construct() { |
|
7 | + parent::__construct(); |
|
8 | + } |
|
9 | + public function init( $_page ) { |
|
10 | + $this->tags = $_page->tags; |
|
11 | + } |
|
12 | + public function draw( $_template ) { |
|
13 | + $page = ""; |
|
14 | + $extension = explode(".",$_template); |
|
15 | + $extension = $extension[count($extension)-1]; |
|
16 | + $page = $this->parsingFile($_template, $extension); |
|
17 | + $render = $this->overlayTag($page); |
|
18 | + echo minifyOutput($render); |
|
19 | + } |
|
20 | + protected function overlayTag( $_page ) { |
|
21 | + foreach($this->tags as $key => $value) |
|
22 | + if(!is_array($value)) |
|
23 | + $_page = str_replace("<_${key}_>", "$value", $_page); |
|
24 | + return $_page; |
|
25 | + } |
|
26 | + protected function parsingFile( $_file, $_type = "html" ) { |
|
27 | + switch ($_type) { |
|
28 | + case 'pug': |
|
29 | + case 'jade': |
|
30 | + $pug = new Pug(); |
|
31 | + $page = $pug->drawFile($_file); |
|
32 | + break; |
|
33 | + case "md": |
|
34 | + case "markdown": |
|
35 | + case "parsedown": |
|
36 | + $Parsedown = new Parsedown(); |
|
37 | + $page = $Parsedown->drawFile($_file); |
|
38 | + break; |
|
39 | + case 'twig': |
|
40 | + $twig = new Twig(); |
|
41 | + $page = $twig->drawFile($_file); |
|
42 | + break; |
|
43 | + default: |
|
44 | + $page = file_get_contents($_file); |
|
45 | + break; |
|
46 | + } |
|
47 | + return $page; |
|
48 | + } |
|
49 | 49 | } |
50 | 50 | ?> |
@@ -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,40 +1,40 @@ |
||
1 | 1 | <?php |
2 | 2 | jRequire("ConnectionInterface.php"); |
3 | 3 | class ConnectionPdoAdapter implements ConnectionAdapterInterface { |
4 | - public $connection; |
|
5 | - public function __construct( $_srv, $_db, $_usr, $_pass ) { |
|
6 | - $connection = "mysql:host=$_srv;dbname=$_db"; |
|
7 | - $this->connection = new PDO( $connection, $_usr, $_pass, [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"] ); |
|
8 | - } |
|
9 | - public function query( $_query ) { |
|
10 | - $this->stdQuery($_query); |
|
11 | - return true; |
|
12 | - } |
|
13 | - public function queryInsert( $_query ) { |
|
14 | - $this->stdQuery($_query); |
|
15 | - return $this->connection->lastInsertId(); |
|
16 | - } |
|
17 | - public function queryFetch( $_query ) { |
|
18 | - $temp = $this->stdQuery($_query); |
|
19 | - return $temp->fetchAll(PDO::FETCH_ASSOC); |
|
20 | - } |
|
21 | - public function queryArray( $_query ) { |
|
22 | - $temp = $this->stdQuery($_query); |
|
23 | - return $temp->fetchAll(PDO::FETCH_COLUMN, 0); |
|
24 | - } |
|
25 | - protected function stdQuery( $_query ) { |
|
26 | - $database = $this->connection; |
|
27 | - $error = "Error query [$_query]"; |
|
28 | - $query = $database->prepare($_query); |
|
29 | - $result = $query->execute(); |
|
30 | - if(!$result) { |
|
31 | - echo "$_query<br>"; |
|
32 | - echo "Something wrong: $error"; |
|
33 | - var_dump($query->errorInfo()); |
|
34 | - var_dump($database->errorInfo()); |
|
35 | - exit(); |
|
36 | - } |
|
37 | - return $query; |
|
38 | - } |
|
4 | + public $connection; |
|
5 | + public function __construct( $_srv, $_db, $_usr, $_pass ) { |
|
6 | + $connection = "mysql:host=$_srv;dbname=$_db"; |
|
7 | + $this->connection = new PDO( $connection, $_usr, $_pass, [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"] ); |
|
8 | + } |
|
9 | + public function query( $_query ) { |
|
10 | + $this->stdQuery($_query); |
|
11 | + return true; |
|
12 | + } |
|
13 | + public function queryInsert( $_query ) { |
|
14 | + $this->stdQuery($_query); |
|
15 | + return $this->connection->lastInsertId(); |
|
16 | + } |
|
17 | + public function queryFetch( $_query ) { |
|
18 | + $temp = $this->stdQuery($_query); |
|
19 | + return $temp->fetchAll(PDO::FETCH_ASSOC); |
|
20 | + } |
|
21 | + public function queryArray( $_query ) { |
|
22 | + $temp = $this->stdQuery($_query); |
|
23 | + return $temp->fetchAll(PDO::FETCH_COLUMN, 0); |
|
24 | + } |
|
25 | + protected function stdQuery( $_query ) { |
|
26 | + $database = $this->connection; |
|
27 | + $error = "Error query [$_query]"; |
|
28 | + $query = $database->prepare($_query); |
|
29 | + $result = $query->execute(); |
|
30 | + if(!$result) { |
|
31 | + echo "$_query<br>"; |
|
32 | + echo "Something wrong: $error"; |
|
33 | + var_dump($query->errorInfo()); |
|
34 | + var_dump($database->errorInfo()); |
|
35 | + exit(); |
|
36 | + } |
|
37 | + return $query; |
|
38 | + } |
|
39 | 39 | } |
40 | 40 | ?> |
@@ -2,32 +2,32 @@ |
||
2 | 2 | jRequire("ConnectionInterface.php"); |
3 | 3 | class ConnectionPdoAdapter implements ConnectionAdapterInterface { |
4 | 4 | public $connection; |
5 | - public function __construct( $_srv, $_db, $_usr, $_pass ) { |
|
5 | + public function __construct($_srv, $_db, $_usr, $_pass) { |
|
6 | 6 | $connection = "mysql:host=$_srv;dbname=$_db"; |
7 | - $this->connection = new PDO( $connection, $_usr, $_pass, [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"] ); |
|
7 | + $this->connection = new PDO($connection, $_usr, $_pass, [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"]); |
|
8 | 8 | } |
9 | - public function query( $_query ) { |
|
9 | + public function query($_query) { |
|
10 | 10 | $this->stdQuery($_query); |
11 | 11 | return true; |
12 | 12 | } |
13 | - public function queryInsert( $_query ) { |
|
13 | + public function queryInsert($_query) { |
|
14 | 14 | $this->stdQuery($_query); |
15 | 15 | return $this->connection->lastInsertId(); |
16 | 16 | } |
17 | - public function queryFetch( $_query ) { |
|
17 | + public function queryFetch($_query) { |
|
18 | 18 | $temp = $this->stdQuery($_query); |
19 | 19 | return $temp->fetchAll(PDO::FETCH_ASSOC); |
20 | 20 | } |
21 | - public function queryArray( $_query ) { |
|
21 | + public function queryArray($_query) { |
|
22 | 22 | $temp = $this->stdQuery($_query); |
23 | 23 | return $temp->fetchAll(PDO::FETCH_COLUMN, 0); |
24 | 24 | } |
25 | - protected function stdQuery( $_query ) { |
|
25 | + protected function stdQuery($_query) { |
|
26 | 26 | $database = $this->connection; |
27 | 27 | $error = "Error query [$_query]"; |
28 | 28 | $query = $database->prepare($_query); |
29 | 29 | $result = $query->execute(); |
30 | - if(!$result) { |
|
30 | + if (!$result) { |
|
31 | 31 | echo "$_query<br>"; |
32 | 32 | echo "Something wrong: $error"; |
33 | 33 | var_dump($query->errorInfo()); |
@@ -1,43 +1,43 @@ |
||
1 | 1 | <?php |
2 | 2 | jRequire("ConnectionInterface.php"); |
3 | 3 | class ConnectionMysqliAdapter implements ConnectionAdapterInterface { |
4 | - public $connection; |
|
5 | - public function __construct( $_srv, $_db, $_usr, $_pass ) { |
|
6 | - $this->connection = new mysqli( $_srv, $_usr, $_pass, $_db ); |
|
7 | - } |
|
8 | - public function query( $_query ) { |
|
9 | - $this->stdQuery($_query); |
|
10 | - return true; |
|
11 | - } |
|
12 | - public function queryInsert( $_query ) { |
|
13 | - $this->stdQuery($_query); |
|
14 | - return $this->connection->insert_id; |
|
15 | - } |
|
16 | - public function queryFetch( $_query ) { |
|
17 | - $result = $this->stdQuery($_query); |
|
18 | - $rows = []; |
|
19 | - while($row = $result->fetch_assoc()) |
|
20 | - $rows[] = $row; |
|
21 | - return $rows; |
|
22 | - } |
|
23 | - public function queryArray( $_query ) { |
|
24 | - $result = $this->stdQuery($_query); |
|
25 | - $rows = []; |
|
26 | - while($row = $result->fetch_array()) |
|
27 | - $rows[] = $row; |
|
28 | - return $rows; |
|
29 | - } |
|
30 | - protected function stdQuery( $_query ) { |
|
31 | - $database = $this->connection; |
|
32 | - $error = "Error query [$_query]"; |
|
33 | - $result = $database->query($_query); |
|
34 | - if(!$result) { |
|
35 | - echo "$_query<br>"; |
|
36 | - echo "Something wrong: $error"; |
|
37 | - var_dump($database->error); |
|
38 | - exit(); |
|
39 | - } |
|
40 | - return $result; |
|
41 | - } |
|
4 | + public $connection; |
|
5 | + public function __construct( $_srv, $_db, $_usr, $_pass ) { |
|
6 | + $this->connection = new mysqli( $_srv, $_usr, $_pass, $_db ); |
|
7 | + } |
|
8 | + public function query( $_query ) { |
|
9 | + $this->stdQuery($_query); |
|
10 | + return true; |
|
11 | + } |
|
12 | + public function queryInsert( $_query ) { |
|
13 | + $this->stdQuery($_query); |
|
14 | + return $this->connection->insert_id; |
|
15 | + } |
|
16 | + public function queryFetch( $_query ) { |
|
17 | + $result = $this->stdQuery($_query); |
|
18 | + $rows = []; |
|
19 | + while($row = $result->fetch_assoc()) |
|
20 | + $rows[] = $row; |
|
21 | + return $rows; |
|
22 | + } |
|
23 | + public function queryArray( $_query ) { |
|
24 | + $result = $this->stdQuery($_query); |
|
25 | + $rows = []; |
|
26 | + while($row = $result->fetch_array()) |
|
27 | + $rows[] = $row; |
|
28 | + return $rows; |
|
29 | + } |
|
30 | + protected function stdQuery( $_query ) { |
|
31 | + $database = $this->connection; |
|
32 | + $error = "Error query [$_query]"; |
|
33 | + $result = $database->query($_query); |
|
34 | + if(!$result) { |
|
35 | + echo "$_query<br>"; |
|
36 | + echo "Something wrong: $error"; |
|
37 | + var_dump($database->error); |
|
38 | + exit(); |
|
39 | + } |
|
40 | + return $result; |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | ?> |
@@ -2,36 +2,36 @@ |
||
2 | 2 | jRequire("ConnectionInterface.php"); |
3 | 3 | class ConnectionMysqliAdapter implements ConnectionAdapterInterface { |
4 | 4 | public $connection; |
5 | - public function __construct( $_srv, $_db, $_usr, $_pass ) { |
|
6 | - $this->connection = new mysqli( $_srv, $_usr, $_pass, $_db ); |
|
5 | + public function __construct($_srv, $_db, $_usr, $_pass) { |
|
6 | + $this->connection = new mysqli($_srv, $_usr, $_pass, $_db); |
|
7 | 7 | } |
8 | - public function query( $_query ) { |
|
8 | + public function query($_query) { |
|
9 | 9 | $this->stdQuery($_query); |
10 | 10 | return true; |
11 | 11 | } |
12 | - public function queryInsert( $_query ) { |
|
12 | + public function queryInsert($_query) { |
|
13 | 13 | $this->stdQuery($_query); |
14 | 14 | return $this->connection->insert_id; |
15 | 15 | } |
16 | - public function queryFetch( $_query ) { |
|
16 | + public function queryFetch($_query) { |
|
17 | 17 | $result = $this->stdQuery($_query); |
18 | 18 | $rows = []; |
19 | - while($row = $result->fetch_assoc()) |
|
19 | + while ($row = $result->fetch_assoc()) |
|
20 | 20 | $rows[] = $row; |
21 | 21 | return $rows; |
22 | 22 | } |
23 | - public function queryArray( $_query ) { |
|
23 | + public function queryArray($_query) { |
|
24 | 24 | $result = $this->stdQuery($_query); |
25 | 25 | $rows = []; |
26 | - while($row = $result->fetch_array()) |
|
26 | + while ($row = $result->fetch_array()) |
|
27 | 27 | $rows[] = $row; |
28 | 28 | return $rows; |
29 | 29 | } |
30 | - protected function stdQuery( $_query ) { |
|
30 | + protected function stdQuery($_query) { |
|
31 | 31 | $database = $this->connection; |
32 | 32 | $error = "Error query [$_query]"; |
33 | 33 | $result = $database->query($_query); |
34 | - if(!$result) { |
|
34 | + if (!$result) { |
|
35 | 35 | echo "$_query<br>"; |
36 | 36 | echo "Something wrong: $error"; |
37 | 37 | var_dump($database->error); |
@@ -16,15 +16,17 @@ |
||
16 | 16 | public function queryFetch( $_query ) { |
17 | 17 | $result = $this->stdQuery($_query); |
18 | 18 | $rows = []; |
19 | - while($row = $result->fetch_assoc()) |
|
20 | - $rows[] = $row; |
|
19 | + while($row = $result->fetch_assoc()) { |
|
20 | + $rows[] = $row; |
|
21 | + } |
|
21 | 22 | return $rows; |
22 | 23 | } |
23 | 24 | public function queryArray( $_query ) { |
24 | 25 | $result = $this->stdQuery($_query); |
25 | 26 | $rows = []; |
26 | - while($row = $result->fetch_array()) |
|
27 | - $rows[] = $row; |
|
27 | + while($row = $result->fetch_array()) { |
|
28 | + $rows[] = $row; |
|
29 | + } |
|
28 | 30 | return $rows; |
29 | 31 | } |
30 | 32 | protected function stdQuery( $_query ) { |
@@ -8,20 +8,20 @@ discard block |
||
8 | 8 | parent::__construct(); |
9 | 9 | $args = func_get_args(); |
10 | 10 | $count = func_num_args(); |
11 | - if (method_exists($this,$func='__construct'.$count)) |
|
12 | - call_user_func_array(array($this,$func),$args); |
|
11 | + if (method_exists($this, $func = '__construct'.$count)) |
|
12 | + call_user_func_array(array($this, $func), $args); |
|
13 | 13 | } |
14 | 14 | public function __construct0() { |
15 | 15 | $this->database = null; |
16 | 16 | } |
17 | - public function __construct4 ( $_srv, $_db, $_usr, $_pass ) { |
|
17 | + public function __construct4($_srv, $_db, $_usr, $_pass) { |
|
18 | 18 | $this->setConnection($_srv, $_db, $_usr, $_pass, "pdo"); |
19 | 19 | } |
20 | - public function __construct5 ( $_srv, $_db, $_usr, $_pass, $_type ) { |
|
20 | + public function __construct5($_srv, $_db, $_usr, $_pass, $_type) { |
|
21 | 21 | $type = $this->getConnectionType($_type); |
22 | 22 | $this->setConnection($_srv, $_db, $_usr, $_pass, $type); |
23 | 23 | } |
24 | - protected function setConnection ( $_srv, $_db, $_usr, $_pass, $_type ) { |
|
24 | + protected function setConnection($_srv, $_db, $_usr, $_pass, $_type) { |
|
25 | 25 | switch ($_type) { |
26 | 26 | case "mysqli": |
27 | 27 | $this->database = new ConnectionMysqliAdapter($_srv, $_db, $_usr, $_pass); |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | $this->database = new ConnectionPdoAdapter($_srv, $_db, $_usr, $_pass); |
31 | 31 | break; |
32 | 32 | } |
33 | - $this->setConnectionParameters( $_srv, $_db, $_usr, $_pass); |
|
33 | + $this->setConnectionParameters($_srv, $_db, $_usr, $_pass); |
|
34 | 34 | } |
35 | - protected function getConnectionType( $_type ) { |
|
35 | + protected function getConnectionType($_type) { |
|
36 | 36 | foreach ($_type as $key => $value) |
37 | - if($value) |
|
37 | + if ($value) |
|
38 | 38 | return $key; |
39 | 39 | return "pdo"; |
40 | 40 | } |
41 | - protected function setConnectionParameters( $_srv, $_db, $_usr, $_pass) { |
|
41 | + protected function setConnectionParameters($_srv, $_db, $_usr, $_pass) { |
|
42 | 42 | $this->info = []; |
43 | 43 | $this->info["server"] = $_srv; |
44 | 44 | $this->info["database"] = $_db; |
@@ -8,8 +8,9 @@ discard block |
||
8 | 8 | parent::__construct(); |
9 | 9 | $args = func_get_args(); |
10 | 10 | $count = func_num_args(); |
11 | - if (method_exists($this,$func='__construct'.$count)) |
|
12 | - call_user_func_array(array($this,$func),$args); |
|
11 | + if (method_exists($this,$func='__construct'.$count)) { |
|
12 | + call_user_func_array(array($this,$func),$args); |
|
13 | + } |
|
13 | 14 | } |
14 | 15 | public function __construct0() { |
15 | 16 | $this->database = null; |
@@ -33,9 +34,10 @@ discard block |
||
33 | 34 | $this->setConnectionParameters( $_srv, $_db, $_usr, $_pass); |
34 | 35 | } |
35 | 36 | protected function getConnectionType( $_type ) { |
36 | - foreach ($_type as $key => $value) |
|
37 | - if($value) |
|
37 | + foreach ($_type as $key => $value) { |
|
38 | + if($value) |
|
38 | 39 | return $key; |
40 | + } |
|
39 | 41 | return "pdo"; |
40 | 42 | } |
41 | 43 | protected function setConnectionParameters( $_srv, $_db, $_usr, $_pass) { |
@@ -2,51 +2,51 @@ |
||
2 | 2 | jRequire("../Module/Module.php"); |
3 | 3 | requireComponents("Adapters"); |
4 | 4 | class Connection extends Module { |
5 | - public $database; |
|
6 | - public $info; |
|
7 | - public function __construct() { |
|
8 | - parent::__construct(); |
|
9 | - $args = func_get_args(); |
|
10 | - $count = func_num_args(); |
|
11 | - if (method_exists($this,$func='__construct'.$count)) |
|
12 | - call_user_func_array(array($this,$func),$args); |
|
13 | - } |
|
14 | - public function __construct0() { |
|
15 | - $this->database = null; |
|
16 | - } |
|
17 | - public function __construct4 ( $_srv, $_db, $_usr, $_pass ) { |
|
18 | - $this->setConnection($_srv, $_db, $_usr, $_pass, "pdo"); |
|
19 | - } |
|
20 | - public function __construct5 ( $_srv, $_db, $_usr, $_pass, $_type ) { |
|
21 | - $type = $this->getConnectionType($_type); |
|
22 | - $this->setConnection($_srv, $_db, $_usr, $_pass, $type); |
|
23 | - } |
|
24 | - protected function setConnection ( $_srv, $_db, $_usr, $_pass, $_type ) { |
|
25 | - switch ($_type) { |
|
26 | - case "mysqli": |
|
27 | - $this->database = new ConnectionMysqliAdapter($_srv, $_db, $_usr, $_pass); |
|
28 | - break; |
|
29 | - case "postgresql": |
|
30 | - $this->database = new ConnectionPostgresqlAdapter($_srv, $_db, $_usr, $_pass); |
|
31 | - break; |
|
32 | - default: |
|
33 | - $this->database = new ConnectionPdoAdapter($_srv, $_db, $_usr, $_pass); |
|
34 | - break; |
|
35 | - } |
|
36 | - $this->setConnectionParameters( $_srv, $_db, $_usr, $_pass); |
|
37 | - } |
|
38 | - protected function getConnectionType( $_type ) { |
|
39 | - foreach ($_type as $key => $value) |
|
40 | - if($value) |
|
41 | - return $key; |
|
42 | - return "pdo"; |
|
43 | - } |
|
44 | - protected function setConnectionParameters( $_srv, $_db, $_usr, $_pass) { |
|
45 | - $this->info = []; |
|
46 | - $this->info["server"] = $_srv; |
|
47 | - $this->info["database"] = $_db; |
|
48 | - $this->info["user"] = $_usr; |
|
49 | - $this->info["password"] = $_pass; |
|
50 | - } |
|
5 | + public $database; |
|
6 | + public $info; |
|
7 | + public function __construct() { |
|
8 | + parent::__construct(); |
|
9 | + $args = func_get_args(); |
|
10 | + $count = func_num_args(); |
|
11 | + if (method_exists($this,$func='__construct'.$count)) |
|
12 | + call_user_func_array(array($this,$func),$args); |
|
13 | + } |
|
14 | + public function __construct0() { |
|
15 | + $this->database = null; |
|
16 | + } |
|
17 | + public function __construct4 ( $_srv, $_db, $_usr, $_pass ) { |
|
18 | + $this->setConnection($_srv, $_db, $_usr, $_pass, "pdo"); |
|
19 | + } |
|
20 | + public function __construct5 ( $_srv, $_db, $_usr, $_pass, $_type ) { |
|
21 | + $type = $this->getConnectionType($_type); |
|
22 | + $this->setConnection($_srv, $_db, $_usr, $_pass, $type); |
|
23 | + } |
|
24 | + protected function setConnection ( $_srv, $_db, $_usr, $_pass, $_type ) { |
|
25 | + switch ($_type) { |
|
26 | + case "mysqli": |
|
27 | + $this->database = new ConnectionMysqliAdapter($_srv, $_db, $_usr, $_pass); |
|
28 | + break; |
|
29 | + case "postgresql": |
|
30 | + $this->database = new ConnectionPostgresqlAdapter($_srv, $_db, $_usr, $_pass); |
|
31 | + break; |
|
32 | + default: |
|
33 | + $this->database = new ConnectionPdoAdapter($_srv, $_db, $_usr, $_pass); |
|
34 | + break; |
|
35 | + } |
|
36 | + $this->setConnectionParameters( $_srv, $_db, $_usr, $_pass); |
|
37 | + } |
|
38 | + protected function getConnectionType( $_type ) { |
|
39 | + foreach ($_type as $key => $value) |
|
40 | + if($value) |
|
41 | + return $key; |
|
42 | + return "pdo"; |
|
43 | + } |
|
44 | + protected function setConnectionParameters( $_srv, $_db, $_usr, $_pass) { |
|
45 | + $this->info = []; |
|
46 | + $this->info["server"] = $_srv; |
|
47 | + $this->info["database"] = $_db; |
|
48 | + $this->info["user"] = $_usr; |
|
49 | + $this->info["password"] = $_pass; |
|
50 | + } |
|
51 | 51 | } |
52 | 52 | ?> |
@@ -1,15 +1,15 @@ |
||
1 | 1 | <?php |
2 | 2 | jRequire("../Module/Module.php"); |
3 | 3 | class Router extends Module { |
4 | - public function __construct() { |
|
5 | - parent::__construct(); |
|
6 | - } |
|
7 | - public function getPage() { |
|
8 | - $request = $this->parameters["app"]->server["REQUEST_URI"]; |
|
9 | - $base = $this->parameters["app"]->server["RELATIVE"]; |
|
10 | - $url = str_replace($base, "", $request); |
|
11 | - $url = explode("/", $url); |
|
12 | - return $url; |
|
13 | - } |
|
4 | + public function __construct() { |
|
5 | + parent::__construct(); |
|
6 | + } |
|
7 | + public function getPage() { |
|
8 | + $request = $this->parameters["app"]->server["REQUEST_URI"]; |
|
9 | + $base = $this->parameters["app"]->server["RELATIVE"]; |
|
10 | + $url = str_replace($base, "", $request); |
|
11 | + $url = explode("/", $url); |
|
12 | + return $url; |
|
13 | + } |
|
14 | 14 | } |
15 | 15 | ?> |
@@ -6,7 +6,7 @@ |
||
6 | 6 | } |
7 | 7 | public function getPage() { |
8 | 8 | $request = $this->parameters["app"]->server["REQUEST_URI"]; |
9 | - $base = $this->parameters["app"]->server["RELATIVE"]; |
|
9 | + $base = $this->parameters["app"]->server["RELATIVE"]; |
|
10 | 10 | $url = str_replace($base, "", $request); |
11 | 11 | $url = explode("/", $url); |
12 | 12 | return $url; |
@@ -1,53 +1,53 @@ |
||
1 | 1 | <?php |
2 | 2 | class JConfig { |
3 | - public $connection; |
|
4 | - public $all; |
|
5 | - public $DEBUG; |
|
6 | - public $pages; |
|
7 | - public $server; |
|
8 | - public function __construct() { |
|
9 | - $this->connection["enable"] = false; |
|
10 | - $this->connection["user"] = ""; |
|
11 | - $this->connection["password"] = ""; |
|
12 | - $this->connection["database"] = ""; |
|
13 | - $this->connection["server"] = ""; |
|
14 | - $this->all = ""; |
|
15 | - $this->DEBUG = 0; |
|
16 | - $this->pages = []; |
|
17 | - $this->server = []; |
|
18 | - $this->server["HTTP_HOST"] = $_SERVER["HTTP_HOST"]; |
|
19 | - $this->server["REQUEST_URI"] = $_SERVER["REQUEST_URI"]; |
|
20 | - $this->server["PHP_SELF"] = $_SERVER["PHP_SELF"]; |
|
21 | - $this->server["RELATIVE"] = str_replace("/index.php", "", $_SERVER["PHP_SELF"]); |
|
22 | - } |
|
23 | - public function import( $_path, $_type = "misc" ) { |
|
24 | - $data = file_get_contents($_path); |
|
25 | - $data = json_decode($data); |
|
26 | - if( $_type == "connection" ) |
|
27 | - $this->overlayConnection($data); |
|
28 | - else |
|
29 | - $this->overlayMisc($data); |
|
30 | - } |
|
31 | - protected function overlayConnection( $_data ) { |
|
32 | - $this->connection = $this->obj2array($_data); |
|
33 | - } |
|
34 | - protected function overlayMisc( $_data ) { |
|
35 | - $this->importObject($_data); |
|
36 | - } |
|
37 | - protected function obj2array ( &$_instance ) { |
|
38 | - $clone = (array) $_instance; |
|
39 | - $return = []; |
|
40 | - $return['___SOURCE_KEYS_'] = $clone; |
|
41 | - while ( list ($key, $value) = each ($clone) ) { |
|
42 | - $temp = explode ("\0", $key); |
|
43 | - $newkey = $temp[count($temp)-1]; |
|
44 | - $return[$newkey] = &$return['___SOURCE_KEYS_'][$key]; |
|
45 | - } |
|
46 | - return $return; |
|
47 | - } |
|
48 | - protected function importObject( $_object ) { |
|
49 | - foreach (get_object_vars($_object) as $key => $value) |
|
50 | - $this->$key = $value; |
|
51 | - } |
|
3 | + public $connection; |
|
4 | + public $all; |
|
5 | + public $DEBUG; |
|
6 | + public $pages; |
|
7 | + public $server; |
|
8 | + public function __construct() { |
|
9 | + $this->connection["enable"] = false; |
|
10 | + $this->connection["user"] = ""; |
|
11 | + $this->connection["password"] = ""; |
|
12 | + $this->connection["database"] = ""; |
|
13 | + $this->connection["server"] = ""; |
|
14 | + $this->all = ""; |
|
15 | + $this->DEBUG = 0; |
|
16 | + $this->pages = []; |
|
17 | + $this->server = []; |
|
18 | + $this->server["HTTP_HOST"] = $_SERVER["HTTP_HOST"]; |
|
19 | + $this->server["REQUEST_URI"] = $_SERVER["REQUEST_URI"]; |
|
20 | + $this->server["PHP_SELF"] = $_SERVER["PHP_SELF"]; |
|
21 | + $this->server["RELATIVE"] = str_replace("/index.php", "", $_SERVER["PHP_SELF"]); |
|
22 | + } |
|
23 | + public function import( $_path, $_type = "misc" ) { |
|
24 | + $data = file_get_contents($_path); |
|
25 | + $data = json_decode($data); |
|
26 | + if( $_type == "connection" ) |
|
27 | + $this->overlayConnection($data); |
|
28 | + else |
|
29 | + $this->overlayMisc($data); |
|
30 | + } |
|
31 | + protected function overlayConnection( $_data ) { |
|
32 | + $this->connection = $this->obj2array($_data); |
|
33 | + } |
|
34 | + protected function overlayMisc( $_data ) { |
|
35 | + $this->importObject($_data); |
|
36 | + } |
|
37 | + protected function obj2array ( &$_instance ) { |
|
38 | + $clone = (array) $_instance; |
|
39 | + $return = []; |
|
40 | + $return['___SOURCE_KEYS_'] = $clone; |
|
41 | + while ( list ($key, $value) = each ($clone) ) { |
|
42 | + $temp = explode ("\0", $key); |
|
43 | + $newkey = $temp[count($temp)-1]; |
|
44 | + $return[$newkey] = &$return['___SOURCE_KEYS_'][$key]; |
|
45 | + } |
|
46 | + return $return; |
|
47 | + } |
|
48 | + protected function importObject( $_object ) { |
|
49 | + foreach (get_object_vars($_object) as $key => $value) |
|
50 | + $this->$key = $value; |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | ?> |
@@ -14,38 +14,38 @@ |
||
14 | 14 | $this->all = ""; |
15 | 15 | $this->DEBUG = 0; |
16 | 16 | $this->pages = []; |
17 | - $this->server = []; |
|
17 | + $this->server = []; |
|
18 | 18 | $this->server["HTTP_HOST"] = $_SERVER["HTTP_HOST"]; |
19 | 19 | $this->server["REQUEST_URI"] = $_SERVER["REQUEST_URI"]; |
20 | 20 | $this->server["PHP_SELF"] = $_SERVER["PHP_SELF"]; |
21 | 21 | $this->server["RELATIVE"] = str_replace("/index.php", "", $_SERVER["PHP_SELF"]); |
22 | 22 | } |
23 | - public function import( $_path, $_type = "misc" ) { |
|
23 | + public function import($_path, $_type = "misc") { |
|
24 | 24 | $data = file_get_contents($_path); |
25 | 25 | $data = json_decode($data); |
26 | - if( $_type == "connection" ) |
|
26 | + if ($_type == "connection") |
|
27 | 27 | $this->overlayConnection($data); |
28 | 28 | else |
29 | 29 | $this->overlayMisc($data); |
30 | 30 | } |
31 | - protected function overlayConnection( $_data ) { |
|
31 | + protected function overlayConnection($_data) { |
|
32 | 32 | $this->connection = $this->obj2array($_data); |
33 | 33 | } |
34 | - protected function overlayMisc( $_data ) { |
|
34 | + protected function overlayMisc($_data) { |
|
35 | 35 | $this->importObject($_data); |
36 | 36 | } |
37 | - protected function obj2array ( &$_instance ) { |
|
38 | - $clone = (array) $_instance; |
|
39 | - $return = []; |
|
37 | + protected function obj2array(&$_instance) { |
|
38 | + $clone = (array) $_instance; |
|
39 | + $return = []; |
|
40 | 40 | $return['___SOURCE_KEYS_'] = $clone; |
41 | - while ( list ($key, $value) = each ($clone) ) { |
|
42 | - $temp = explode ("\0", $key); |
|
43 | - $newkey = $temp[count($temp)-1]; |
|
41 | + while (list ($key, $value) = each($clone)) { |
|
42 | + $temp = explode("\0", $key); |
|
43 | + $newkey = $temp[count($temp) - 1]; |
|
44 | 44 | $return[$newkey] = &$return['___SOURCE_KEYS_'][$key]; |
45 | 45 | } |
46 | 46 | return $return; |
47 | 47 | } |
48 | - protected function importObject( $_object ) { |
|
48 | + protected function importObject($_object) { |
|
49 | 49 | foreach (get_object_vars($_object) as $key => $value) |
50 | 50 | $this->$key = $value; |
51 | 51 | } |
@@ -23,10 +23,11 @@ discard block |
||
23 | 23 | public function import( $_path, $_type = "misc" ) { |
24 | 24 | $data = file_get_contents($_path); |
25 | 25 | $data = json_decode($data); |
26 | - if( $_type == "connection" ) |
|
27 | - $this->overlayConnection($data); |
|
28 | - else |
|
29 | - $this->overlayMisc($data); |
|
26 | + if( $_type == "connection" ) { |
|
27 | + $this->overlayConnection($data); |
|
28 | + } else { |
|
29 | + $this->overlayMisc($data); |
|
30 | + } |
|
30 | 31 | } |
31 | 32 | protected function overlayConnection( $_data ) { |
32 | 33 | $this->connection = $this->obj2array($_data); |
@@ -46,8 +47,9 @@ discard block |
||
46 | 47 | return $return; |
47 | 48 | } |
48 | 49 | protected function importObject( $_object ) { |
49 | - foreach (get_object_vars($_object) as $key => $value) |
|
50 | - $this->$key = $value; |
|
50 | + foreach (get_object_vars($_object) as $key => $value) { |
|
51 | + $this->$key = $value; |
|
52 | + } |
|
51 | 53 | } |
52 | 54 | } |
53 | 55 | ?> |
@@ -1,49 +1,49 @@ |
||
1 | 1 | <?php |
2 | 2 | requireComponent("../Query/Query.php"); |
3 | 3 | class Html extends Query { |
4 | - public function __construct( $_parameters = [ "app" => null, "page" => null] ) { |
|
5 | - parent::__construct(); |
|
6 | - $this->data["template"] = ""; |
|
7 | - $this->tags["brand"] = ""; |
|
8 | - $this->tags["brandImg"] = ""; |
|
9 | - $this->tags["menu"] = ""; |
|
10 | - $this->tags["title"] = ""; |
|
11 | - $this->tags["subtitle"] = ""; |
|
12 | - $this->tags["content"] = ""; |
|
13 | - $this->tags["outContent"] = ""; |
|
14 | - $this->tags["footer"] = ""; |
|
15 | - $this->tags["pagePath"] = []; |
|
16 | - $this->tags["css"] = []; |
|
17 | - $this->tags["js"] = []; |
|
18 | - $this->tags["jsVariables"] = []; |
|
19 | - $this->tags["metaDescription"] = []; |
|
20 | - $this->tags["metaKeywords"] = []; |
|
21 | - $this->tags["metaAuthor"] = []; |
|
22 | - $this->parameters = $_parameters; |
|
23 | - $this->tags["base"] = $_parameters["app"]->server["RELATIVE"]."/"; |
|
24 | - } |
|
25 | - public function uniforma() { |
|
26 | - $this->addDipendences(); |
|
27 | - $this->tags["css"] = array_unique($this->tags["css"]); |
|
28 | - $this->tags["js"] = array_unique($this->tags["js"]); |
|
29 | - $this->tags["pagePath"] = json_encode($this->tags["pagePath"]); |
|
30 | - $tempStr = ""; |
|
31 | - $timeParameter = "?t=".time(); |
|
32 | - $time = ($this->parameters["app"]->cache->css == true) ? "" : $timeParameter; |
|
33 | - foreach ($this->tags["css"] as $i) |
|
34 | - $tempStr .= "<link rel='stylesheet' href='$i$time'>"; |
|
35 | - $this->tags["css"] = $tempStr; |
|
36 | - $tempStr = ""; |
|
37 | - $time = ($this->parameters["app"]->cache->js == true) ? "" : $timeParameter; |
|
38 | - foreach ($this->tags["js"] as $i) |
|
39 | - $tempStr .= "<script src='$i$time'></script>"; |
|
40 | - $this->tags["js"] = $tempStr; |
|
41 | - $tempStr = ""; |
|
42 | - $tempStr .= "<script type='text/javascript'>"; |
|
43 | - foreach ($this->tags["jsVariables"] as $i) |
|
44 | - $tempStr .= " $i[0] = $i[1];\n"; |
|
45 | - $tempStr .= "</script>"; |
|
46 | - $this->tags["jsVariables"] = $tempStr; |
|
47 | - } |
|
4 | + public function __construct( $_parameters = [ "app" => null, "page" => null] ) { |
|
5 | + parent::__construct(); |
|
6 | + $this->data["template"] = ""; |
|
7 | + $this->tags["brand"] = ""; |
|
8 | + $this->tags["brandImg"] = ""; |
|
9 | + $this->tags["menu"] = ""; |
|
10 | + $this->tags["title"] = ""; |
|
11 | + $this->tags["subtitle"] = ""; |
|
12 | + $this->tags["content"] = ""; |
|
13 | + $this->tags["outContent"] = ""; |
|
14 | + $this->tags["footer"] = ""; |
|
15 | + $this->tags["pagePath"] = []; |
|
16 | + $this->tags["css"] = []; |
|
17 | + $this->tags["js"] = []; |
|
18 | + $this->tags["jsVariables"] = []; |
|
19 | + $this->tags["metaDescription"] = []; |
|
20 | + $this->tags["metaKeywords"] = []; |
|
21 | + $this->tags["metaAuthor"] = []; |
|
22 | + $this->parameters = $_parameters; |
|
23 | + $this->tags["base"] = $_parameters["app"]->server["RELATIVE"]."/"; |
|
24 | + } |
|
25 | + public function uniforma() { |
|
26 | + $this->addDipendences(); |
|
27 | + $this->tags["css"] = array_unique($this->tags["css"]); |
|
28 | + $this->tags["js"] = array_unique($this->tags["js"]); |
|
29 | + $this->tags["pagePath"] = json_encode($this->tags["pagePath"]); |
|
30 | + $tempStr = ""; |
|
31 | + $timeParameter = "?t=".time(); |
|
32 | + $time = ($this->parameters["app"]->cache->css == true) ? "" : $timeParameter; |
|
33 | + foreach ($this->tags["css"] as $i) |
|
34 | + $tempStr .= "<link rel='stylesheet' href='$i$time'>"; |
|
35 | + $this->tags["css"] = $tempStr; |
|
36 | + $tempStr = ""; |
|
37 | + $time = ($this->parameters["app"]->cache->js == true) ? "" : $timeParameter; |
|
38 | + foreach ($this->tags["js"] as $i) |
|
39 | + $tempStr .= "<script src='$i$time'></script>"; |
|
40 | + $this->tags["js"] = $tempStr; |
|
41 | + $tempStr = ""; |
|
42 | + $tempStr .= "<script type='text/javascript'>"; |
|
43 | + foreach ($this->tags["jsVariables"] as $i) |
|
44 | + $tempStr .= " $i[0] = $i[1];\n"; |
|
45 | + $tempStr .= "</script>"; |
|
46 | + $this->tags["jsVariables"] = $tempStr; |
|
47 | + } |
|
48 | 48 | } |
49 | 49 | ?> |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | requireComponent("../Query/Query.php"); |
3 | 3 | class Html extends Query { |
4 | - public function __construct( $_parameters = [ "app" => null, "page" => null] ) { |
|
4 | + public function __construct($_parameters = ["app" => null, "page" => null]) { |
|
5 | 5 | parent::__construct(); |
6 | 6 | $this->data["template"] = ""; |
7 | 7 | $this->tags["brand"] = ""; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | } |
25 | 25 | public function uniforma() { |
26 | 26 | $this->addDipendences(); |
27 | - $this->tags["css"] = array_unique($this->tags["css"]); |
|
27 | + $this->tags["css"] = array_unique($this->tags["css"]); |
|
28 | 28 | $this->tags["js"] = array_unique($this->tags["js"]); |
29 | 29 | $this->tags["pagePath"] = json_encode($this->tags["pagePath"]); |
30 | 30 | $tempStr = ""; |
@@ -30,18 +30,21 @@ |
||
30 | 30 | $tempStr = ""; |
31 | 31 | $timeParameter = "?t=".time(); |
32 | 32 | $time = ($this->parameters["app"]->cache->css == true) ? "" : $timeParameter; |
33 | - foreach ($this->tags["css"] as $i) |
|
34 | - $tempStr .= "<link rel='stylesheet' href='$i$time'>"; |
|
33 | + foreach ($this->tags["css"] as $i) { |
|
34 | + $tempStr .= "<link rel='stylesheet' href='$i$time'>"; |
|
35 | + } |
|
35 | 36 | $this->tags["css"] = $tempStr; |
36 | 37 | $tempStr = ""; |
37 | 38 | $time = ($this->parameters["app"]->cache->js == true) ? "" : $timeParameter; |
38 | - foreach ($this->tags["js"] as $i) |
|
39 | - $tempStr .= "<script src='$i$time'></script>"; |
|
39 | + foreach ($this->tags["js"] as $i) { |
|
40 | + $tempStr .= "<script src='$i$time'></script>"; |
|
41 | + } |
|
40 | 42 | $this->tags["js"] = $tempStr; |
41 | 43 | $tempStr = ""; |
42 | 44 | $tempStr .= "<script type='text/javascript'>"; |
43 | - foreach ($this->tags["jsVariables"] as $i) |
|
44 | - $tempStr .= " $i[0] = $i[1];\n"; |
|
45 | + foreach ($this->tags["jsVariables"] as $i) { |
|
46 | + $tempStr .= " $i[0] = $i[1];\n"; |
|
47 | + } |
|
45 | 48 | $tempStr .= "</script>"; |
46 | 49 | $this->tags["jsVariables"] = $tempStr; |
47 | 50 | } |