@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | class Items extends Template { |
3 | - public function __construct( $_parameters ) { |
|
4 | - parent::__construct( $_parameters ); |
|
5 | - $this->tags["title"] = "JATE - Items"; |
|
6 | - $this->tags["content"] = $this->makePage(); |
|
3 | + public function __construct($_parameters) { |
|
4 | + parent::__construct($_parameters); |
|
5 | + $this->tags["title"] = "JATE - Items"; |
|
6 | + $this->tags["content"] = $this->makePage(); |
|
7 | 7 | } |
8 | 8 | public function makePage() { |
9 | 9 | jBlock(); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | - if(!isset($GLOBALS["JATEPath"])) |
|
2 | + if (!isset($GLOBALS["JATEPath"])) |
|
3 | 3 | $GLOBALS["JATEPath"] = []; |
4 | 4 | $commonLocations = array( |
5 | 5 | "bower_components/JATE/dist/", |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | "../../dist/" |
8 | 8 | ); |
9 | 9 | foreach ($commonLocations as $i) |
10 | - if(file_exists($i."jate/coreEngine.php")) { |
|
10 | + if (file_exists($i."jate/coreEngine.php")) { |
|
11 | 11 | array_push($GLOBALS["JATEPath"], $i); |
12 | 12 | require_once($i."jate/coreEngine.php"); |
13 | 13 | break; |
@@ -4,15 +4,15 @@ |
||
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 | - requireComponent ("modules/Module/Module.php"); |
|
10 | - requireComponents ("functions"); |
|
11 | - requireModules ("modules"); |
|
7 | + requireComponent("functions/folder.php"); |
|
8 | + requireComponent("modules/JConfig/JConfig.php"); |
|
9 | + requireComponent("modules/Module/Module.php"); |
|
10 | + requireComponents("functions"); |
|
11 | + requireModules("modules"); |
|
12 | 12 | |
13 | 13 | //USER STUFF |
14 | - requireComponent ("config.php",false); |
|
15 | - requireModules ("modules",false); |
|
16 | - requireComponents ("bundles/models",false); |
|
17 | - requireComponents ("bundles/controllers",false); |
|
14 | + requireComponent("config.php", false); |
|
15 | + requireModules("modules", false); |
|
16 | + requireComponents("bundles/models", false); |
|
17 | + requireComponents("bundles/controllers", false); |
|
18 | 18 | ?> |
@@ -1,45 +1,45 @@ |
||
1 | 1 | <?php |
2 | - function requireComponent( $_path, $_local = true ) { |
|
2 | + function requireComponent($_path, $_local = true) { |
|
3 | 3 | $path = getJFolder($_path, $_local, debug_backtrace()); |
4 | - if(file_exists($path) && isPhp($path)) |
|
4 | + if (file_exists($path) && isPhp($path)) |
|
5 | 5 | jRequire($path, false, 0); |
6 | 6 | else |
7 | 7 | requireError($_path); |
8 | 8 | } |
9 | - function requireComponents( $_path, $_local = true ) { |
|
9 | + function requireComponents($_path, $_local = true) { |
|
10 | 10 | $path = getJFolder($_path, $_local, debug_backtrace()); |
11 | - if(file_exists($path)) { |
|
11 | + if (file_exists($path)) { |
|
12 | 12 | $files = subFolderFile($path); |
13 | 13 | foreach ($files as $i) { |
14 | - if(isPhp($path."/".$i)) |
|
14 | + if (isPhp($path."/".$i)) |
|
15 | 15 | requireComponent($path."/".$i, false, 0); |
16 | 16 | } |
17 | 17 | } else |
18 | 18 | requireError($_path); |
19 | 19 | } |
20 | - function requireError( $_path ) { |
|
20 | + function requireError($_path) { |
|
21 | 21 | global $DEBUG; |
22 | - if( $DEBUG == 1 ) |
|
22 | + if ($DEBUG == 1) |
|
23 | 23 | echo "Error load ($_path)<br>"; |
24 | 24 | } |
25 | - function isPhp ( $_file ) { |
|
26 | - if(!is_file($_file)) return false; |
|
25 | + function isPhp($_file) { |
|
26 | + if (!is_file($_file)) return false; |
|
27 | 27 | $info = pathinfo($_file); |
28 | 28 | return ($info["extension"] == "php") || ($info["extension"] == "PHP"); |
29 | 29 | } |
30 | - function requireModules( $_path, $_local = true ) { |
|
30 | + function requireModules($_path, $_local = true) { |
|
31 | 31 | $path = getJFolder($_path, $_local, debug_backtrace()); |
32 | 32 | $subFolders = subFolderDir($path); |
33 | 33 | foreach ($subFolders as $i) { |
34 | 34 | requireComponents($path."/".$i, false, 0); |
35 | 35 | } |
36 | 36 | } |
37 | - function jRequire( $_path, $_local = true ) { |
|
37 | + function jRequire($_path, $_local = true) { |
|
38 | 38 | $path = getJFolder($_path, $_local, debug_backtrace()); |
39 | - require_once( $path ); |
|
39 | + require_once($path); |
|
40 | 40 | } |
41 | - function getJFolder( $_path, $_local, $_stack ) { |
|
42 | - if($_local) { |
|
41 | + function getJFolder($_path, $_local, $_stack) { |
|
42 | + if ($_local) { |
|
43 | 43 | $stackInfo = $_stack; |
44 | 44 | $folder = dirname($stackInfo[0]["file"]); |
45 | 45 | $file = "$folder/$_path"; |
@@ -6,45 +6,45 @@ |
||
6 | 6 | public $pages; |
7 | 7 | public $server; |
8 | 8 | public function __construct() { |
9 | - $this->connection["enable"] = false; |
|
10 | - $this->connection["user"] = ""; |
|
9 | + $this->connection["enable"] = false; |
|
10 | + $this->connection["user"] = ""; |
|
11 | 11 | $this->connection["password"] = ""; |
12 | 12 | $this->connection["database"] = ""; |
13 | - $this->connection["server"] = ""; |
|
14 | - $this->all = ""; |
|
13 | + $this->connection["server"] = ""; |
|
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 | - $this->server["REQUEST_URI"] = $_SERVER["REQUEST_URI"]; |
|
19 | + $this->server["REQUEST_URI"] = $_SERVER["REQUEST_URI"]; |
|
20 | 20 | $this->server["PHP_SELF"] = $_SERVER["PHP_SELF"]; |
21 | 21 | } |
22 | - public function import( $_path, $_type = "misc" ) { |
|
22 | + public function import($_path, $_type = "misc") { |
|
23 | 23 | $data = file_get_contents($_path); |
24 | 24 | $data = json_decode($data); |
25 | - if( $_type == "connection" ) |
|
25 | + if ($_type == "connection") |
|
26 | 26 | $this->overlayConnection($data); |
27 | 27 | else |
28 | 28 | $this->overlayMisc($data); |
29 | 29 | } |
30 | - protected function overlayConnection( $_data ) { |
|
30 | + protected function overlayConnection($_data) { |
|
31 | 31 | $this->connection = $this->obj2array($_data); |
32 | 32 | } |
33 | - protected function overlayMisc( $_data ) { |
|
33 | + protected function overlayMisc($_data) { |
|
34 | 34 | $this->importObject($_data); |
35 | 35 | } |
36 | - protected function obj2array ( &$_instance ) { |
|
37 | - $clone = (array) $_instance; |
|
36 | + protected function obj2array(&$_instance) { |
|
37 | + $clone = (array) $_instance; |
|
38 | 38 | $return = []; |
39 | 39 | $return['___SOURCE_KEYS_'] = $clone; |
40 | - while ( list ($key, $value) = each ($clone) ) { |
|
41 | - $temp = explode ("\0", $key); |
|
42 | - $newkey = $temp[count($temp)-1]; |
|
40 | + while (list ($key, $value) = each($clone)) { |
|
41 | + $temp = explode("\0", $key); |
|
42 | + $newkey = $temp[count($temp) - 1]; |
|
43 | 43 | $return[$newkey] = &$return['___SOURCE_KEYS_'][$key]; |
44 | 44 | } |
45 | 45 | return $return; |
46 | 46 | } |
47 | - protected function importObject( $_object ) { |
|
47 | + protected function importObject($_object) { |
|
48 | 48 | foreach (get_object_vars($_object) as $key => $value) |
49 | 49 | $this->$key = $value; |
50 | 50 | } |
@@ -2,31 +2,31 @@ |
||
2 | 2 | requireComponent("../Query/Query.php"); |
3 | 3 | class Html extends Query { |
4 | 4 | public $parameters; |
5 | - public function __construct( $_parameters = [ "app" => null, "page" => null] ) { |
|
5 | + public function __construct($_parameters = ["app" => null, "page" => null]) { |
|
6 | 6 | parent::__construct(); |
7 | 7 | $this->data["template"] = ""; |
8 | 8 | $this->tags["brand"] = ""; |
9 | 9 | $this->tags["brandImg"] = ""; |
10 | 10 | $this->tags["menu"] = ""; |
11 | 11 | $this->tags["title"] = ""; |
12 | - $this->tags["subtitle"] = ""; |
|
12 | + $this->tags["subtitle"] = ""; |
|
13 | 13 | $this->tags["content"] = ""; |
14 | - $this->tags["outContent"] = ""; |
|
14 | + $this->tags["outContent"] = ""; |
|
15 | 15 | $this->tags["footer"] = ""; |
16 | 16 | $this->tags["pagePath"] = []; |
17 | - $this->tags["css"] = []; |
|
18 | - $this->tags["js"] = []; |
|
17 | + $this->tags["css"] = []; |
|
18 | + $this->tags["js"] = []; |
|
19 | 19 | $this->tags["jsVariables"] = []; |
20 | - $this->tags["metaDescription"] = []; |
|
21 | - $this->tags["metaKeywords"] = []; |
|
20 | + $this->tags["metaDescription"] = []; |
|
21 | + $this->tags["metaKeywords"] = []; |
|
22 | 22 | $this->tags["metaAuthor"] = []; |
23 | - $this->parameters = $_parameters; |
|
23 | + $this->parameters = $_parameters; |
|
24 | 24 | } |
25 | 25 | public function uniforma() { |
26 | 26 | $this->addDipendences(); |
27 | 27 | $this->tags["css"] = array_unique($this->tags["css"]); |
28 | 28 | $this->tags["js"] = array_unique($this->tags["js"]); |
29 | - $this->tags["pagePath"] = json_encode($this->tags["pagePath"]); |
|
29 | + $this->tags["pagePath"] = json_encode($this->tags["pagePath"]); |
|
30 | 30 | $tempStr = ""; |
31 | 31 | foreach ($this->tags["css"] as $i) |
32 | 32 | $tempStr .= "<link rel='stylesheet' href='$i'>"; |
@@ -4,8 +4,8 @@ |
||
4 | 4 | parent::__construct(); |
5 | 5 | } |
6 | 6 | public function getPage() { |
7 | - $request = $this->parameters["app"]->server["REQUEST_URI"]; |
|
8 | - $base = $this->parameters["app"]->server["RELATIVE"]; |
|
7 | + $request = $this->parameters["app"]->server["REQUEST_URI"]; |
|
8 | + $base = $this->parameters["app"]->server["RELATIVE"]; |
|
9 | 9 | $url = str_replace($base, "", $request); |
10 | 10 | $url = explode("/", $url); |
11 | 11 | return $url; |
@@ -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 | } |
@@ -7,48 +7,48 @@ discard block |
||
7 | 7 | public function __construct() { |
8 | 8 | parent::__construct(); |
9 | 9 | $this->pages = []; |
10 | - $this->defaultPage = ["Page404",[]]; |
|
10 | + $this->defaultPage = ["Page404", []]; |
|
11 | 11 | $this->currentPage = null; |
12 | - $this->jConfig = null; |
|
12 | + $this->jConfig = null; |
|
13 | 13 | } |
14 | - public function addPage( $_page ) { |
|
14 | + public function addPage($_page) { |
|
15 | 15 | $param = []; |
16 | 16 | $path = $_page; |
17 | 17 | $class = $_page; |
18 | - if(is_array($_page)) { |
|
18 | + if (is_array($_page)) { |
|
19 | 19 | $path = $_page[0]; |
20 | 20 | $class = $_page[1]; |
21 | - if(isset($_page[2])) |
|
21 | + if (isset($_page[2])) |
|
22 | 22 | $param = $_page[2]; |
23 | 23 | } |
24 | 24 | $this->pages[$path] = [$class, $param]; |
25 | 25 | } |
26 | - public function addPages( $_pages ) { |
|
26 | + public function addPages($_pages) { |
|
27 | 27 | foreach ($_pages as $i) |
28 | 28 | $this->addPage($i); |
29 | 29 | } |
30 | 30 | public function fetchPage( ) { |
31 | 31 | $router = new Router(); |
32 | - $router->parameters = [ "app" => &$this->jConfig, "page" => null]; |
|
32 | + $router->parameters = ["app" => &$this->jConfig, "page" => null]; |
|
33 | 33 | $stack = $router->getPage(); |
34 | 34 | $parameters = []; |
35 | - $temp = $this->defaultPage; |
|
35 | + $temp = $this->defaultPage; |
|
36 | 36 | foreach ($this->pages as $key => $value) { |
37 | 37 | $variables = $this->pathSeeker(explode("/", $key), $stack); |
38 | - if(is_array($variables)) { |
|
38 | + if (is_array($variables)) { |
|
39 | 39 | $temp = $value; |
40 | 40 | $parameters = $variables; |
41 | 41 | break; |
42 | 42 | } |
43 | 43 | } |
44 | - if( isset($temp[1]) && is_array($temp[1]) ) |
|
44 | + if (isset($temp[1]) && is_array($temp[1])) |
|
45 | 45 | $temp[1] = array_merge($temp[1], $parameters); |
46 | 46 | else |
47 | 47 | $temp[1] = $parameters; |
48 | 48 | $this->currentPage = new $temp[0](["app" => $this->jConfig, "page" => $temp[1]]); |
49 | 49 | return $this->currentPage; |
50 | 50 | } |
51 | - public function setDefaultPage( $_page ) { |
|
51 | + public function setDefaultPage($_page) { |
|
52 | 52 | $this->defaultPage = $_page; |
53 | 53 | } |
54 | 54 | public function draw() { |
@@ -57,28 +57,28 @@ discard block |
||
57 | 57 | $gui->init($this->currentPage); |
58 | 58 | $gui->draw($this->currentPage->data["template"]); |
59 | 59 | } |
60 | - public function pathSeeker( $_path, $_url ) { |
|
60 | + public function pathSeeker($_path, $_url) { |
|
61 | 61 | $urlLength = count($_url); |
62 | 62 | $cont = 0; |
63 | 63 | $variables = []; |
64 | 64 | $pathLength = count($_path); |
65 | - if($urlLength == $pathLength) { |
|
66 | - while($cont < $urlLength) { |
|
67 | - if( $_path[$cont] == $_url[$cont] ) |
|
65 | + if ($urlLength == $pathLength) { |
|
66 | + while ($cont < $urlLength) { |
|
67 | + if ($_path[$cont] == $_url[$cont]) |
|
68 | 68 | $cont++; |
69 | - else if( strpos($_path[$cont], "\$") !== false ) { |
|
69 | + else if (strpos($_path[$cont], "\$") !== false) { |
|
70 | 70 | $variables[str_replace('$', "", $_path[$cont])] = $_url[$cont]; |
71 | 71 | $cont++; |
72 | 72 | } else break; |
73 | 73 | } |
74 | - if($cont == $urlLength) |
|
74 | + if ($cont == $urlLength) |
|
75 | 75 | return $variables; |
76 | 76 | } |
77 | 77 | return null; |
78 | 78 | } |
79 | - public function newConfig( $_path = "config/") { |
|
79 | + public function newConfig($_path = "config/") { |
|
80 | 80 | $this->jConfig = new JConfig(); |
81 | - $this->jConfig->import("${_path}connection.json","connection"); |
|
81 | + $this->jConfig->import("${_path}connection.json", "connection"); |
|
82 | 82 | $this->jConfig->import("${_path}misc.json"); |
83 | 83 | $this->jConfig->import("${_path}router.json"); |
84 | 84 | } |