Passed
Push — master ( 09abe8...7f2391 )
by Federico
02:56
created
examples/03pageParameters/bundles/controllers/Items.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
examples/03pageParameters/bundles/controllers/Page404.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 	class Page404 extends Template {
3
-		public function __construct( $_parameters ) {
3
+		public function __construct($_parameters) {
4 4
 			parent::__construct();
5
-			$this->tags["title"]		= "JATE - 404";
5
+			$this->tags["title"] = "JATE - 404";
6 6
 			$this->tags["content"] = $this->makePage();
7 7
 		}
8 8
 		public function makePage() {
Please login to merge, or discard this patch.
examples/03pageParameters/bundles/models/Template.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	class Template extends Html {
3
-		public function __construct( $_parameters ) {
4
-			parent::__construct( $_parameters );
3
+		public function __construct($_parameters) {
4
+			parent::__construct($_parameters);
5 5
 			$this->tags["brand"]		= "JATE";
6 6
 			$this->tags["brandImg"] = "";
7 7
 			$this->tags["title"]		= "JATE - 06items";
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
20 20
 		public function makeConnection() {
21 21
 			$jConfig = $this->parameters["app"];
22 22
 			$connection = null;
23
-			if( $jConfig != null && $jConfig->connection["enable"])
23
+			if ($jConfig != null && $jConfig->connection["enable"])
24 24
 				$connection = new Connection(
25 25
 						$jConfig->connection["server"]
26 26
 					, $jConfig->connection["database"]
27 27
 					, $jConfig->connection["user"]
28 28
 					, $jConfig->connection["password"]
29 29
 				);
30
-			$this->addConnection("base",$connection);
30
+			$this->addConnection("base", $connection);
31 31
 		}
32 32
 		public function makeMenu() {
33 33
 			$temp = "";
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,13 +20,14 @@
 block discarded – undo
20 20
 		public function makeConnection() {
21 21
 			$jConfig = $this->parameters["app"];
22 22
 			$connection = null;
23
-			if( $jConfig != null && $jConfig->connection["enable"])
24
-				$connection = new Connection(
23
+			if( $jConfig != null && $jConfig->connection["enable"]) {
24
+							$connection = new Connection(
25 25
 						$jConfig->connection["server"]
26 26
 					, $jConfig->connection["database"]
27 27
 					, $jConfig->connection["user"]
28 28
 					, $jConfig->connection["password"]
29 29
 				);
30
+			}
30 31
 			$this->addConnection("base",$connection);
31 32
 		}
32 33
 		public function makeMenu() {
Please login to merge, or discard this patch.
examples/03pageParameters/jate.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,14 +1,16 @@
 block discarded – undo
1 1
 <?php
2
-	if(!isset($GLOBALS["JATEPath"]))
3
-		$GLOBALS["JATEPath"] = [];
2
+	if(!isset($GLOBALS["JATEPath"])) {
3
+			$GLOBALS["JATEPath"] = [];
4
+	}
4 5
 	$commonLocations = array(
5 6
 		"bower_components/JATE/dist/",
6 7
 		"vendor/xaberr/jate/dist/",
7 8
 		"../../dist/"
8 9
 	);
9
-	foreach ($commonLocations as $i)
10
-		if(file_exists($i."jate/coreEngine.php")) {
10
+	foreach ($commonLocations as $i) {
11
+			if(file_exists($i."jate/coreEngine.php")) {
11 12
 			array_push($GLOBALS["JATEPath"], $i);
13
+	}
12 14
 			require_once($i."jate/coreEngine.php");
13 15
 			break;
14 16
 		}
Please login to merge, or discard this patch.
dist/jate/coreEngine.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,15 +4,15 @@
 block discarded – undo
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
 ?>
Please login to merge, or discard this patch.
dist/jate/functions/requirer.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,45 +1,45 @@
 block discarded – undo
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";
Please login to merge, or discard this patch.
Braces   +20 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,29 +1,35 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	function requireComponent( $_path, $_local = true ) {
3 3
 		$path = getJFolder($_path, $_local, debug_backtrace());
4
-		if(file_exists($path) && isPhp($path))
5
-			jRequire($path, false, 0);
6
-		else
7
-			requireError($_path);
4
+		if(file_exists($path) && isPhp($path)) {
5
+					jRequire($path, false, 0);
6
+		} else {
7
+					requireError($_path);
8
+		}
8 9
 	}
9 10
 	function requireComponents( $_path, $_local = true ) {
10 11
 		$path = getJFolder($_path, $_local, debug_backtrace());
11 12
 		if(file_exists($path)) {
12 13
 			$files = subFolderFile($path);
13 14
 			foreach ($files as $i) {
14
-				if(isPhp($path."/".$i))
15
-					requireComponent($path."/".$i, false, 0);
15
+				if(isPhp($path."/".$i)) {
16
+									requireComponent($path."/".$i, false, 0);
17
+				}
16 18
 			}
17
-		} else
18
-			requireError($_path);
19
+		} else {
20
+					requireError($_path);
21
+		}
19 22
 	}
20 23
 	function requireError( $_path ) {
21 24
 		global $DEBUG;
22
-		if( $DEBUG == 1 )
23
-			echo "Error load ($_path)<br>";
25
+		if( $DEBUG == 1 ) {
26
+					echo "Error load ($_path)<br>";
27
+		}
24 28
 	}
25 29
 	function isPhp ( $_file ) {
26
-		if(!is_file($_file)) return false;
30
+		if(!is_file($_file)) {
31
+			return false;
32
+		}
27 33
 		$info = pathinfo($_file);
28 34
 		return ($info["extension"] == "php") || ($info["extension"] == "PHP");
29 35
 	}
@@ -43,8 +49,9 @@  discard block
 block discarded – undo
43 49
 			$stackInfo = $_stack;
44 50
 			$folder = dirname($stackInfo[0]["file"]);
45 51
 			$file = "$folder/$_path";
46
-		} else
47
-			$file = $_path;
52
+		} else {
53
+					$file = $_path;
54
+		}
48 55
 		return $file;
49 56
 	}
50 57
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/WebApp/WebApp.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,49 +7,49 @@  discard block
 block discarded – undo
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
 			$path		= "";
16 16
 			$class	= "";
17 17
 			$param	= [];
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
 			} else {
24 24
 				$path		= $_page;
25 25
 				$class	= $_page;
26 26
 			}
27
-			$this->pages[$path] = [$class,$param];
27
+			$this->pages[$path] = [$class, $param];
28 28
 		}
29
-		public function addPages( $_pages ) {
29
+		public function addPages($_pages) {
30 30
 			foreach ($_pages as $i)
31 31
 				$this->addPage($i);
32 32
 		}
33
-		public function fetchPage( $_stack ) {
33
+		public function fetchPage($_stack) {
34 34
 			$parameters = [];
35
-			$temp	= $this->defaultPage;
35
+			$temp = $this->defaultPage;
36 36
 			$variables = null;
37 37
 			foreach ($this->pages as $key => $value) {
38 38
 				$variables = $this->pathSeeker(explode("/", $key), $_stack);
39
-				if(is_array($variables)) {
39
+				if (is_array($variables)) {
40 40
 					$temp = $value;
41 41
 					$parameters = $variables;
42 42
 					break;
43 43
 				}
44 44
 			}
45
-			if( isset($temp[1]) && is_array($temp[1]) )
45
+			if (isset($temp[1]) && is_array($temp[1]))
46 46
 				$temp[1] = array_merge($temp[1], $parameters);
47 47
 			else
48 48
 				$temp[1] = $parameters;
49 49
 			$this->currentPage = new $temp[0](["app" => $this->jConfig, "page" => $temp[1]]);
50 50
 			return $this->currentPage;
51 51
 		}
52
-		public function setDefaultPage( $_page ) {
52
+		public function setDefaultPage($_page) {
53 53
 			$this->defaultPage = $_page;
54 54
 		}
55 55
 		public function draw() {
@@ -58,28 +58,28 @@  discard block
 block discarded – undo
58 58
 			$gui->init($this->currentPage);
59 59
 			$gui->draw($this->currentPage->data["template"]);
60 60
 		}
61
-		public function pathSeeker( $_path, $_url ) {
61
+		public function pathSeeker($_path, $_url) {
62 62
 			$urlLength = count($_url);
63 63
 			$cont = 0;
64 64
 			$variables = [];
65 65
 			$pathLength = count($_path);
66
-			if($urlLength == $pathLength) {
67
-				while($cont < $urlLength) {
68
-					if( $_path[$cont] == $_url[$cont] )
66
+			if ($urlLength == $pathLength) {
67
+				while ($cont < $urlLength) {
68
+					if ($_path[$cont] == $_url[$cont])
69 69
 						$cont++;
70
-					else if( strpos($_path[$cont], "\$") !== false ) {
70
+					else if (strpos($_path[$cont], "\$") !== false) {
71 71
 						$variables[str_replace('$', "", $_path[$cont])] = $_url[$cont];
72 72
 						$cont++;
73 73
 					} else break;
74 74
 				}
75
-				if($cont == $urlLength)
75
+				if ($cont == $urlLength)
76 76
 					return $variables;
77 77
 			}
78 78
 			return null;
79 79
 		}
80
-		public function newConfig( $_path = "config/") {
80
+		public function newConfig($_path = "config/") {
81 81
 			$this->jConfig = new JConfig();
82
-			$this->jConfig->import("${_path}connection.json","connection");
82
+			$this->jConfig->import("${_path}connection.json", "connection");
83 83
 			$this->jConfig->import("${_path}misc.json");
84 84
 			$this->jConfig->import("${_path}router.json");
85 85
 		}
Please login to merge, or discard this patch.
Braces   +20 added lines, -14 removed lines patch added patch discarded remove patch
@@ -18,8 +18,9 @@  discard block
 block discarded – undo
18 18
 			if(is_array($_page)) {
19 19
 				$path		= $_page[0];
20 20
 				$class	= $_page[1];
21
-				if(isset($_page[2]))
22
-					$param = $_page[2];
21
+				if(isset($_page[2])) {
22
+									$param = $_page[2];
23
+				}
23 24
 			} else {
24 25
 				$path		= $_page;
25 26
 				$class	= $_page;
@@ -27,8 +28,9 @@  discard block
 block discarded – undo
27 28
 			$this->pages[$path] = [$class,$param];
28 29
 		}
29 30
 		public function addPages( $_pages ) {
30
-			foreach ($_pages as $i)
31
-				$this->addPage($i);
31
+			foreach ($_pages as $i) {
32
+							$this->addPage($i);
33
+			}
32 34
 		}
33 35
 		public function fetchPage( $_stack ) {
34 36
 			$parameters = [];
@@ -42,10 +44,11 @@  discard block
 block discarded – undo
42 44
 					break;
43 45
 				}
44 46
 			}
45
-			if( isset($temp[1]) && is_array($temp[1]) )
46
-				$temp[1] = array_merge($temp[1], $parameters);
47
-			else
48
-				$temp[1] = $parameters;
47
+			if( isset($temp[1]) && is_array($temp[1]) ) {
48
+							$temp[1] = array_merge($temp[1], $parameters);
49
+			} else {
50
+							$temp[1] = $parameters;
51
+			}
49 52
 			$this->currentPage = new $temp[0](["app" => $this->jConfig, "page" => $temp[1]]);
50 53
 			return $this->currentPage;
51 54
 		}
@@ -65,15 +68,18 @@  discard block
 block discarded – undo
65 68
 			$pathLength = count($_path);
66 69
 			if($urlLength == $pathLength) {
67 70
 				while($cont < $urlLength) {
68
-					if( $_path[$cont] == $_url[$cont] )
69
-						$cont++;
70
-					else if( strpos($_path[$cont], "\$") !== false ) {
71
+					if( $_path[$cont] == $_url[$cont] ) {
72
+											$cont++;
73
+					} else if( strpos($_path[$cont], "\$") !== false ) {
71 74
 						$variables[str_replace('$', "", $_path[$cont])] = $_url[$cont];
72 75
 						$cont++;
73
-					} else break;
76
+					} else {
77
+						break;
78
+					}
79
+				}
80
+				if($cont == $urlLength) {
81
+									return $variables;
74 82
 				}
75
-				if($cont == $urlLength)
76
-					return $variables;
77 83
 			}
78 84
 			return null;
79 85
 		}
Please login to merge, or discard this patch.
dist/jate/modules/JConfig/JConfig.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -6,45 +6,45 @@
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
dist/jate/modules/Html/Html.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,31 +2,31 @@
 block discarded – undo
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'>";
Please login to merge, or discard this patch.