Completed
Push — master ( 23bea2...09abe8 )
by Federico
03:10
created
examples/05database/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/functions/folder.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,10 +21,11 @@  discard block
 block discarded – undo
21 21
 		$temp = [];
22 22
 		if (is_dir($_dir)) {
23 23
 				if ($dirOpened = opendir($_dir)) {
24
-						while (($file = readdir($dirOpened)) !== false)
25
-								if( ($file !='.')&&($file !='..') )
24
+						while (($file = readdir($dirOpened)) !== false) {
25
+														if( ($file !='.')&&($file !='..') )
26 26
 									if($_function($file))
27 27
 										array_push($temp,$file);
28
+						}
28 29
 						closedir($dirOpened);
29 30
 				}
30 31
 		}
@@ -32,14 +33,16 @@  discard block
 block discarded – undo
32 33
 	}
33 34
 	function require_subfolder( $_dir = "./" ) {
34 35
 		$temp = subFolder_file($_dir);
35
-		foreach ($temp as $i)
36
-			jRequire($_dir."/".$i);
36
+		foreach ($temp as $i) {
37
+					jRequire($_dir."/".$i);
38
+		}
37 39
 	}
38 40
 	function require_js( $_dir = "./" ) {
39 41
 		$tempArray = [];
40 42
 		$temp = subFolder_file($_dir);
41
-		foreach ($temp as $i)
42
-			array_push($tempArray, $_dir."/".$i);
43
+		foreach ($temp as $i) {
44
+					array_push($tempArray, $_dir."/".$i);
45
+		}
43 46
 		return $tempArray;
44 47
 	}
45 48
 ?>
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,41 +1,41 @@
 block discarded – undo
1 1
 <?php
2
-	function subFolder( $_dir = "./" ) {
2
+	function subFolder($_dir = "./") {
3 3
 		$temp = fetchInSubFolder($_dir, function() {
4 4
 			return true;
5 5
 		});
6 6
 		return $temp;
7 7
 	}
8
-	function subFolderFile( $_dir = "./" ) {
9
-		$temp = fetchInSubFolder($_dir, function( $_file ) {
8
+	function subFolderFile($_dir = "./") {
9
+		$temp = fetchInSubFolder($_dir, function($_file) {
10 10
 			return !is_dir($_file);
11 11
 		});
12 12
 		return $temp;
13 13
 	}
14
-	function subFolderDir( $_dir = "./" ) {
15
-		$temp = fetchInSubFolder($_dir, function( $_file ) {
14
+	function subFolderDir($_dir = "./") {
15
+		$temp = fetchInSubFolder($_dir, function($_file) {
16 16
 			return !is_file($_file);
17 17
 		});
18 18
 		return $temp;
19 19
 	}
20
-	function fetchInSubFolder( $_dir = "./", $_function) {
20
+	function fetchInSubFolder($_dir = "./", $_function) {
21 21
 		$temp = [];
22 22
 		if (is_dir($_dir)) {
23 23
 				if ($dirOpened = opendir($_dir)) {
24 24
 						while (($file = readdir($dirOpened)) !== false)
25
-								if( ($file !='.')&&($file !='..') )
26
-									if($_function($file))
27
-										array_push($temp,$file);
25
+								if (($file != '.') && ($file != '..'))
26
+									if ($_function($file))
27
+										array_push($temp, $file);
28 28
 						closedir($dirOpened);
29 29
 				}
30 30
 		}
31 31
 		return $temp;
32 32
 	}
33
-	function requireSubfolder( $_dir = "./" ) {
33
+	function requireSubfolder($_dir = "./") {
34 34
 		$temp = subFolderFile($_dir);
35 35
 		foreach ($temp as $i)
36 36
 			jRequire($_dir."/".$i);
37 37
 	}
38
-	function require_js( $_dir = "./" ) {
38
+	function require_js($_dir = "./") {
39 39
 		$tempArray = [];
40 40
 		$temp = subFolderFile($_dir);
41 41
 		foreach ($temp as $i)
Please login to merge, or discard this patch.
dist/jate/functions/requirer.php 2 patches
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, $_stack = null ) {
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, $_stack = null ) {
10 11
 		$path = getJFolder($_path, $_local, debug_backtrace());
11 12
 		if(file_exists($path)) {
12 13
 			$files = subFolder_file($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 $jConfig;
22
-		if( $jConfig->DEBUG == 1 )
23
-			echo "Error load ($_path)<br>";
25
+		if( $jConfig->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.
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 $jConfig;
22
-		if( $jConfig->DEBUG == 1 )
22
+		if ($jConfig->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.
dist/jate/functions/block.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	function minify_output($_buffer) {
16
-		$search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' );
17
-		$replace = array ( '>', '<', '\\1' );
18
-		if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1)
16
+		$search = array('/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s');
17
+		$replace = array('>', '<', '\\1');
18
+		if (preg_match("/\<html/i", $_buffer) == 1 && preg_match("/\<\/html\>/i", $_buffer) == 1)
19 19
 			$_buffer = preg_replace($search, $replace, utf8_decode($_buffer));
20 20
 		return utf8_encode($_buffer);
21 21
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,9 @@
 block discarded – undo
15 15
 	function minify_output($_buffer) {
16 16
 		$search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' );
17 17
 		$replace = array ( '>', '<', '\\1' );
18
-		if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1)
19
-			$_buffer = preg_replace($search, $replace, utf8_decode($_buffer));
18
+		if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) {
19
+					$_buffer = preg_replace($search, $replace, utf8_decode($_buffer));
20
+		}
20 21
 		return utf8_encode($_buffer);
21 22
 	}
22 23
 ?>
Please login to merge, or discard this patch.
dist/jate/functions/string.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-	function htmlParser( $_str) {
2
+	function htmlParser($_str) {
3 3
 		return htmlentities($_str, ENT_QUOTES | ENT_IGNORE, "UTF-8");
4 4
 	}
5 5
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/WebApp/WebApp.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,37 +7,37 @@
 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 12
 			$this->connection		= null;
13 13
 		}
14
-		public function addPage( $_page ) {
14
+		public function addPage($_page) {
15 15
 			$label = "";
16 16
 			$class = "";
17 17
 			$param = [];
18
-			if(is_array($_page)) {
18
+			if (is_array($_page)) {
19 19
 				$label = $_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
 				$label = $_page;
25 25
 				$class = $_page;
26 26
 			}
27
-			$this->pages[$label] = [$class,$param];
27
+			$this->pages[$label] = [$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( $_label ) {
33
+		public function fetchPage($_label) {
34 34
 			$temp = $this->defaultPage;
35
-			if(isset($this->pages[$_label]))
35
+			if (isset($this->pages[$_label]))
36 36
 				$temp = $this->pages[$_label];
37 37
 			$this->currentPage = new $temp[0]($temp[1]);
38 38
 			return $this->currentPage;
39 39
 		}
40
-		public function setDefaultPage( $_page ) {
40
+		public function setDefaultPage($_page) {
41 41
 			$this->defaultPage = $_page;
42 42
 		}
43 43
 		public function draw() {
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 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
 				$label = $_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
 				$label = $_page;
25 26
 				$class = $_page;
@@ -27,13 +28,15 @@  discard block
 block discarded – undo
27 28
 			$this->pages[$label] = [$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( $_label ) {
34 36
 			$temp = $this->defaultPage;
35
-			if(isset($this->pages[$_label]))
36
-				$temp = $this->pages[$_label];
37
+			if(isset($this->pages[$_label])) {
38
+							$temp = $this->pages[$_label];
39
+			}
37 40
 			$this->currentPage = new $temp[0]($temp[1]);
38 41
 			return $this->currentPage;
39 42
 		}
Please login to merge, or discard this patch.
dist/jate/modules/Statistic/Statistic.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <?php
2 2
 	class Statistic extends Module {
3
-		public function __construct( $_webApp ) {
3
+		public function __construct($_webApp) {
4 4
 			parent::__construct();
5 5
 			$pages = [];
6 6
 			$stats = [];
7 7
 			$pages = $_webApp->pages;
8
-			foreach ( $pages as $k => $v ) {
8
+			foreach ($pages as $k => $v) {
9 9
 				$temp = new $v[0]($v[1]);
10 10
 				$temp->addDipendences();
11 11
 				$stats[$k] = [];
12 12
 				$stats[$k]["page"]	= $v[0];
13 13
 				$stats[$k]["css"]		= $temp->data["css"];
14
-				$stats[$k]["js"]		= $temp->data["js"];
14
+				$stats[$k]["js"] = $temp->data["js"];
15 15
 			}
16 16
 			$this->data = $stats;
17 17
 		}
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Connection.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,20 +7,20 @@
 block discarded – undo
7 7
 			parent::__construct();
8 8
 			$args = func_get_args();
9 9
 			$count = func_num_args();
10
-			if (method_exists($this,$func='__construct'.$count))
11
-				call_user_func_array(array($this,$func),$args);
10
+			if (method_exists($this, $func = '__construct'.$count))
11
+				call_user_func_array(array($this, $func), $args);
12 12
 		}
13 13
 		public function __construct0() {
14 14
 			$this->connection = null;
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->connection = "mysql:host=$_srv;dbname=$_db";
19
-			$this->database = new PDO( $this->connection, $_usr, $_pass,array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"));
19
+			$this->database = new PDO($this->connection, $_usr, $_pass, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"));
20 20
 			$this->info = [];
21
-			$this->info["server"]		= $_srv;
21
+			$this->info["server"] = $_srv;
22 22
 			$this->info["database"]	= $_db;
23
-			$this->info["user"]			= $_usr;
23
+			$this->info["user"] = $_usr;
24 24
 			$this->info["password"]	= $_pass;
25 25
 		}
26 26
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,9 @@
 block discarded – undo
7 7
 			parent::__construct();
8 8
 			$args = func_get_args();
9 9
 			$count = func_num_args();
10
-			if (method_exists($this,$func='__construct'.$count))
11
-				call_user_func_array(array($this,$func),$args);
10
+			if (method_exists($this,$func='__construct'.$count)) {
11
+							call_user_func_array(array($this,$func),$args);
12
+			}
12 13
 		}
13 14
 		public function __construct0() {
14 15
 			$this->connection = null;
Please login to merge, or discard this patch.
dist/status.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
 					$percent;
23 23
 					foreach (getGitLog() as $i) {
24 24
 						$cont++;
25
-						if($cont % $nPerCol == 1)
25
+						if ($cont % $nPerCol == 1)
26 26
 							echo '<div class="row">';
27
-						if(isset($i["tag"])) {
28
-							$percent = explode(".",$i["tag"]);
27
+						if (isset($i["tag"])) {
28
+							$percent = explode(".", $i["tag"]);
29 29
 							$percent = 100 * intval($percent[0]) + 10 * intval($percent[1]) + intval($percent[2]);
30 30
 						}
31 31
 					?>
32 32
 						<div class="col-lg-<?=$dim?>">
33 33
 							<div class="well well-sm miniblock">
34 34
 								<div class="autor"><b>Autor:</b> <?=$i["author"]?><br></div>
35
-								<div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) echo $i["tag"]?><br></div>
35
+								<div class="tag"><b>Tag:</b> <?php if (isset($i["tag"])) echo $i["tag"]?><br></div>
36 36
 								<div class="date"><b>Date:</b> <?=$i["date"]?><br></div>
37 37
 								<div class="message"><b>Message:</b> <?=$i["message"]?><br></div>
38 38
 								<div class="progress">
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 							</div>
45 45
 						</div>
46 46
 					<?php
47
-					if($cont % $nPerCol == 0)
47
+					if ($cont % $nPerCol == 0)
48 48
 						echo '</div>';
49 49
 					} ?>
50 50
 				</div>
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@  discard block
 block discarded – undo
22 22
 					$percent;
23 23
 					foreach (getGitLog() as $i) {
24 24
 						$cont++;
25
-						if($cont % $nPerCol == 1)
26
-							echo '<div class="row">';
25
+						if($cont % $nPerCol == 1) {
26
+													echo '<div class="row">';
27
+						}
27 28
 						if(isset($i["tag"])) {
28 29
 							$percent = explode(".",$i["tag"]);
29 30
 							$percent = 100 * intval($percent[0]) + 10 * intval($percent[1]) + intval($percent[2]);
@@ -32,7 +33,8 @@  discard block
 block discarded – undo
32 33
 						<div class="col-lg-<?=$dim?>">
33 34
 							<div class="well well-sm miniblock">
34 35
 								<div class="autor"><b>Autor:</b> <?=$i["author"]?><br></div>
35
-								<div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) echo $i["tag"]?><br></div>
36
+								<div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) {
37
+	echo $i["tag"]?><br></div>
36 38
 								<div class="date"><b>Date:</b> <?=$i["date"]?><br></div>
37 39
 								<div class="message"><b>Message:</b> <?=$i["message"]?><br></div>
38 40
 								<div class="progress">
@@ -46,6 +48,7 @@  discard block
 block discarded – undo
46 48
 					<?php
47 49
 					if($cont % $nPerCol == 0)
48 50
 						echo '</div>';
51
+}
49 52
 					} ?>
50 53
 				</div>
51 54
 			</div>
Please login to merge, or discard this patch.