Completed
Push — master ( a847da...ede37a )
by Federico
03:15
created
dist/jate/functions/block.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@
 block discarded – undo
51 51
   function minifyOutput($_buffer) {
52 52
     $search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' );
53 53
     $replace = array ( '>', '<', '\\1' );
54
-    if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1)
55
-      $_buffer = preg_replace($search, $replace, utf8_decode($_buffer));
54
+    if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) {
55
+          $_buffer = preg_replace($search, $replace, utf8_decode($_buffer));
56
+    }
56 57
     return utf8_encode($_buffer);
57 58
   }
58 59
 ?>
Please login to merge, or discard this patch.
dist/jate/functions/folder.php 1 patch
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 requireSubfolder( $_dir = "./" ) {
34 35
     $temp = subFolderFile($_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 = subFolderFile($_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.
dist/jate.php 1 patch
Braces   +10 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 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 = [
5 6
       "bower_components/JATE/dist/"
6 7
     , "vendor/xaberr/jate/dist/"
@@ -9,13 +10,15 @@  discard block
 block discarded – undo
9 10
     , dirname(__FILE__)."/"
10 11
   ];
11 12
   $jSuccess = false;
12
-  foreach ($commonLocations as $path)
13
-    if(file_exists("${path}jate/coreEngine.php")) {
13
+  foreach ($commonLocations as $path) {
14
+      if(file_exists("${path}jate/coreEngine.php")) {
14 15
       array_push($GLOBALS["JATEPath"], $path);
16
+  }
15 17
       require_once("${path}jate/coreEngine.php");
16 18
       $jSuccess = true;
17 19
       break;
18 20
     }
19
-  if( !$jSuccess )
20
-    throw new Exception("JATE can't find coreEngine.php.");
21
-?>
21
+  if( !$jSuccess ) {
22
+      throw new Exception("JATE can't find coreEngine.php.");
23
+  }
24
+  ?>
Please login to merge, or discard this patch.
dist/jate/functions/requirer.php 1 patch
Braces   +32 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,36 +1,43 @@  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
-      foreach ($files as $i)
14
-        if(isPhp("$path/$i"))
14
+      foreach ($files as $i) {
15
+              if(isPhp("$path/$i"))
15 16
           requireComponent($path."/".$i, false);
16
-    } else
17
-      requireError($_path);
17
+      }
18
+    } else {
19
+          requireError($_path);
20
+    }
18 21
   }
19 22
   function requireError( $_path ) {
20 23
     global $DEBUG;
21
-    if( $DEBUG == 1 )
22
-      echo "Error load ($_path)<br>";
24
+    if( $DEBUG == 1 ) {
25
+          echo "Error load ($_path)<br>";
26
+    }
23 27
   }
24 28
   function isPhp ( $_file ) {
25
-    if(!is_file($_file)) return false;
29
+    if(!is_file($_file)) {
30
+    	return false;
31
+    }
26 32
     $info = pathinfo($_file);
27 33
     return ($info["extension"] == "php") || ($info["extension"] == "PHP");
28 34
   }
29 35
   function requireModules( $_path, $_local = true ) {
30 36
     $path = getJFolder($_path, $_local, debug_backtrace());
31 37
     $subFolders = subFolderDir($path);
32
-    foreach ($subFolders as $i)
33
-      requireComponents("$path/$i", false);
38
+    foreach ($subFolders as $i) {
39
+          requireComponents("$path/$i", false);
40
+    }
34 41
   }
35 42
   function jRequire( $_path, $_local = true ) {
36 43
     $path = getJFolder($_path, $_local, debug_backtrace());
@@ -41,21 +48,24 @@  discard block
 block discarded – undo
41 48
       $stackInfo = $_stack;
42 49
       $folder = dirname($stackInfo[0]["file"]);
43 50
       $file = "$folder/$_path";
44
-    } else
45
-      $file = $_path;
51
+    } else {
52
+          $file = $_path;
53
+    }
46 54
     return $file;
47 55
   }
48 56
   function requireModulesList( $_path ) {
49
-    if(!file_exists($_path))
50
-      return;
57
+    if(!file_exists($_path)) {
58
+          return;
59
+    }
51 60
     $data = file_get_contents($_path);
52 61
     $data = json_decode($data);
53
-    if($data === NULL)
54
-      throw new Exception("Error in the file format [$_path]", 1);
62
+    if($data === NULL) {
63
+          throw new Exception("Error in the file format [$_path]", 1);
64
+    }
55 65
     foreach ($data as $item) {
56
-      if(substr($item, -1) == "*")
57
-        requireModules(substr($item, 0, -2), false);
58
-      else {
66
+      if(substr($item, -1) == "*") {
67
+              requireModules(substr($item, 0, -2), false);
68
+      } else {
59 69
         $path = getJFolder($item, false, debug_backtrace());
60 70
         requireComponents("$path", false);
61 71
       }
Please login to merge, or discard this patch.
dist/jate/functions/array.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,13 +36,15 @@
 block discarded – undo
36 36
   function arrayDump( $_array, $_name = "Array", $_tab = "&nbsp;&nbsp;" ) {
37 37
     $position = preg_replace('/&nbsp;&nbsp;/', '', $_tab, 1);
38 38
     echo "$position<span style=\"color:rgb(230,0,0)\">$_name:</span><br>";
39
-    foreach ($_array as $k => $i)
40
-      if(is_array($i))
39
+    foreach ($_array as $k => $i) {
40
+          if(is_array($i))
41 41
         arrayDump( $i, $k, "&nbsp;&nbsp;$_tab" );
42
-      else if(is_object($i))
43
-        echo "$_tab<b>object:</b> [Object]<br>";
44
-      else
45
-        echo "$_tab<b>$k:</b> $i<br>";
42
+    }
43
+      else if(is_object($i)) {
44
+              echo "$_tab<b>object:</b> [Object]<br>";
45
+      } else {
46
+              echo "$_tab<b>$k:</b> $i<br>";
47
+      }
46 48
   }
47 49
 
48 50
   function htmlParser( $_str) {
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Adapters/MysqliAdapter.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,25 +20,28 @@
 block discarded – undo
20 20
       public function queryFetch( $_query ) {
21 21
         $result = $this->stdQuery($_query);
22 22
         $rows = [];
23
-        while($row = $result->fetch_assoc())
24
-          $rows[] = $row;
23
+        while($row = $result->fetch_assoc()) {
24
+                  $rows[] = $row;
25
+        }
25 26
         return $rows;
26 27
       }
27 28
       public function queryArray( $_query ) {
28 29
         $result = $this->stdQuery($_query);
29 30
         $rows = [];
30
-        while($row = $result->fetch_array())
31
-          $rows[] = $row;
31
+        while($row = $result->fetch_array()) {
32
+                  $rows[] = $row;
33
+        }
32 34
         return $rows;
33 35
       }
34 36
       protected function stdQuery( $_query ) {
35 37
         $database = $this->connection;
36 38
         $result = $database->query($_query);
37
-        if(!$result)
38
-          throw new JException(json_encode([
39
+        if(!$result) {
40
+                  throw new JException(json_encode([
39 41
             "query" => $_query,
40 42
             "error" => $database->error
41 43
           ]));
44
+        }
42 45
         return $result;
43 46
       }
44 47
   }
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Adapters/PostgresqlAdapter.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,27 +21,30 @@
 block discarded – undo
21 21
       public function queryFetch( $_query ) {
22 22
         $result = $this->stdQuery($_query);
23 23
         $rows = [];
24
-        while($row = pg_fetch_assoc($result))
25
-          $rows[] = $row;
24
+        while($row = pg_fetch_assoc($result)) {
25
+                  $rows[] = $row;
26
+        }
26 27
         pg_free_result($result);
27 28
         return $rows;
28 29
       }
29 30
       public function queryArray( $_query ) {
30 31
         $result = $this->stdQuery($_query);
31 32
         $rows = [];
32
-        while($row = pg_fetch_array($result))
33
-          $rows[] = $row;
33
+        while($row = pg_fetch_array($result)) {
34
+                  $rows[] = $row;
35
+        }
34 36
         pg_free_result($result);
35 37
         return $rows;
36 38
       }
37 39
       protected function stdQuery( $_query ) {
38 40
         $database = $this->connection;
39 41
         $result = pg_query($database, $_query);
40
-        if(!$result)
41
-          throw new JException(json_encode([
42
+        if(!$result) {
43
+                  throw new JException(json_encode([
42 44
             "query" => $_query,
43 45
             "error" => pg_last_error()
44 46
           ]));
47
+        }
45 48
         return $result;
46 49
       }
47 50
   }
Please login to merge, or discard this patch.
dist/jate/modules/Parser/Adapters/JTagAdapter.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,9 +2,10 @@
 block discarded – undo
2 2
   jRequire("ParserAbstract.php");
3 3
   class JTagAdapter extends ParserAbstract {
4 4
     public function draw( $_text, $_parameters = [] ) {
5
-      foreach($_parameters as $key => $value)
6
-        if(!is_array($value))
5
+      foreach($_parameters as $key => $value) {
6
+              if(!is_array($value))
7 7
           $_text = str_replace("<_${key}_>", "$value", $_text);
8
+      }
8 9
       $_text = preg_replace('~<_[^_]+_>~', '', $_text);
9 10
       return $_text;
10 11
     }
Please login to merge, or discard this patch.
dist/jate/modules/Parser/Parser.php 1 patch
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -28,20 +28,25 @@  discard block
 block discarded – undo
28 28
       return $parser;
29 29
     }
30 30
     public static function parseText( $_text, $_parameters = [], $_type = "html" ) {
31
-      if(!is_string($_text) || !is_string($_type))
32
-        throw new JException("Parameter must be a string.");
33
-      if(!is_array($_parameters))
34
-        throw new JException("Parameter must be an array.");
31
+      if(!is_string($_text) || !is_string($_type)) {
32
+              throw new JException("Parameter must be a string.");
33
+      }
34
+      if(!is_array($_parameters)) {
35
+              throw new JException("Parameter must be an array.");
36
+      }
35 37
       $parser = self::setParser($_type);
36
-      if($parser === -1)
37
-        return $_text;
38
+      if($parser === -1) {
39
+              return $_text;
40
+      }
38 41
       return $parser->drawText($_text, $_parameters);
39 42
     }
40 43
     public static function parseFileMan( $_path, $_parameters = [], $_type = "html"  ) {
41
-      if(!is_string($_path))
42
-        throw new JException("Parameter must be a string.");
43
-      if(!file_exists($_path))
44
-        throw new JException("File [$_path] not found.");
44
+      if(!is_string($_path)) {
45
+              throw new JException("Parameter must be a string.");
46
+      }
47
+      if(!file_exists($_path)) {
48
+              throw new JException("File [$_path] not found.");
49
+      }
45 50
       $string = file_get_contents($_path);
46 51
       try {
47 52
         $text = self::parseText($string, $_parameters, $_type);
@@ -51,8 +56,9 @@  discard block
 block discarded – undo
51 56
       return $text;
52 57
     }
53 58
     public static function parseFile( $_path, $_parameters = [] ) {
54
-      if(!is_string($_path))
55
-        throw new JException("Parameter must be a string.");
59
+      if(!is_string($_path)) {
60
+              throw new JException("Parameter must be a string.");
61
+      }
56 62
       $extension = explode(".", $_path);
57 63
       $extension = $extension[count($extension)-1];
58 64
       $extension = strtolower($extension);
Please login to merge, or discard this patch.