Completed
Push — master ( a847da...ede37a )
by Federico
03:15
created
dist/jate/functions/block.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@  discard block
 block discarded – undo
5 5
     return ob_start();
6 6
   }
7 7
 
8
-  function jBlockClose( $_type = "html", $_parameters = [] ) {
8
+  function jBlockClose($_type = "html", $_parameters = []) {
9 9
     return jBlockEnd($_type, $_parameters);
10 10
   }
11 11
 
12
-  function jBlockFile( $_path, $_parameters = [] ) {
12
+  function jBlockFile($_path, $_parameters = []) {
13 13
     try {
14 14
       $temp = Parser::parseFile($_path, $_parameters);
15 15
     } catch (Exception $e) {
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     return $temp;
19 19
   }
20 20
 
21
-  function view( $_path, $_parameters = [] ) {
21
+  function view($_path, $_parameters = []) {
22 22
     try {
23 23
       $temp = jBlockFile("bundles/views/$_path", $_parameters);
24 24
     } catch (Exception $e) {
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     return $temp;
28 28
   }
29 29
 
30
-  function sql( $_path, $_parameters = [] ) {
30
+  function sql($_path, $_parameters = []) {
31 31
     try {
32 32
       $temp = jBlockFileMan("bundles/sql/$_path", "sql", $_parameters);
33 33
     } catch (Exception $e) {
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     return $temp;
37 37
   }
38 38
 
39
-  function jBlockFileMan( $_path, $_type, $_parameters = [] ) {
39
+  function jBlockFileMan($_path, $_type, $_parameters = []) {
40 40
     try {
41 41
       $temp = Parser::parseFileMan($_path, $_parameters, $_type);
42 42
     } catch (Exception $e) {
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     return $temp;
46 46
   }
47 47
 
48
-  function jBlockEnd( $_type = "html", $_parameters = [] ) {
48
+  function jBlockEnd($_type = "html", $_parameters = []) {
49 49
     $text = ob_get_clean();
50 50
     try {
51 51
       $temp = Parser::parseText($text, $_parameters, $_type);
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
   }
57 57
 
58 58
   function minifyOutput($_buffer) {
59
-    $search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' );
60
-    $replace = array ( '>', '<', '\\1' );
61
-    if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1)
59
+    $search = array('/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s');
60
+    $replace = array('>', '<', '\\1');
61
+    if (preg_match("/\<html/i", $_buffer) == 1 && preg_match("/\<\/html\>/i", $_buffer) == 1)
62 62
       $_buffer = preg_replace($search, $replace, utf8_decode($_buffer));
63 63
     return utf8_encode($_buffer);
64 64
   }
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Connection.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
   class Connection {
4 4
     public $database;
5 5
     public $info;
6
-    public function __construct( $_object ) {
7
-      if(!is_object($_object))
6
+    public function __construct($_object) {
7
+      if (!is_object($_object))
8 8
         throw new JException("Parameter must be an object.");
9 9
       $this->setConnection(
10 10
         $_object->server,
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
         $this->getConnectionType($_object->engine)
15 15
       );
16 16
     }
17
-    protected function setConnection ( $_srv, $_db, $_usr, $_pass, $_type ) {
17
+    protected function setConnection($_srv, $_db, $_usr, $_pass, $_type) {
18 18
       switch ($_type) {
19 19
         case "mysqli":
20 20
           $this->database = new MysqliAdapter($_srv, $_db, $_usr, $_pass);
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
         "type" => $_type
39 39
       ];
40 40
     }
41
-    protected function getConnectionType( $_type ) {
42
-      $array = (array)$_type;
41
+    protected function getConnectionType($_type) {
42
+      $array = (array) $_type;
43 43
       foreach ($array as $key => $value)
44
-        if($value)
44
+        if ($value)
45 45
           return $key;
46 46
       return "pdo";
47 47
     }
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Adapters/PdoAdapterSqLiteMemory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,14 +2,14 @@
 block discarded – undo
2 2
   jRequire("PdoAdapterMysql.php");
3 3
   class PdoAdapterSqLiteMemory extends PdoAdapterMysql {
4 4
       public $connection;
5
-      public function __construct( $_srv, $_db, $_usr, $_pass ) {
5
+      public function __construct($_srv, $_db, $_usr, $_pass) {
6 6
         try {
7 7
           $this->connection = new PDO("sqlite::memory:");
8
-        } catch( Exception $e ) {
8
+        } catch (Exception $e) {
9 9
           throw new JException($e->getMessage());
10 10
         }
11 11
       }
12
-      public function newTable( $_sql ) {
12
+      public function newTable($_sql) {
13 13
         try {
14 14
           $temp = $this->connection->exec($_sql);
15 15
         } catch (Exception $e) {
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Adapters/PdoAdapterMysql.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,35 +2,35 @@
 block discarded – undo
2 2
   jRequire("ConnectionInterface.php");
3 3
   class PdoAdapterMysql implements ConnectionAdapterInterface {
4 4
       public $connection;
5
-      public function __construct( $_srv, $_db, $_usr, $_pass ) {
5
+      public function __construct($_srv, $_db, $_usr, $_pass) {
6 6
         try {
7 7
           $connection = "mysql:host=$_srv;dbname=$_db";
8
-          $this->connection = new PDO( $connection, $_usr, $_pass, [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"] );
9
-        } catch( Exception $e ) {
8
+          $this->connection = new PDO($connection, $_usr, $_pass, [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"]);
9
+        } catch (Exception $e) {
10 10
           throw new JException($e->getMessage());
11 11
         }
12 12
       }
13
-      public function query( $_query ) {
13
+      public function query($_query) {
14 14
         $this->stdQuery($_query);
15 15
         return true;
16 16
       }
17
-      public function queryInsert( $_query ) {
17
+      public function queryInsert($_query) {
18 18
         $this->stdQuery($_query);
19 19
         return $this->connection->lastInsertId();
20 20
       }
21
-      public function queryFetch( $_query ) {
21
+      public function queryFetch($_query) {
22 22
         $temp = $this->stdQuery($_query);
23 23
         return $temp->fetchAll(PDO::FETCH_ASSOC);
24 24
       }
25
-      public function queryArray( $_query ) {
25
+      public function queryArray($_query) {
26 26
         $temp = $this->stdQuery($_query);
27 27
         return $temp->fetchAll(PDO::FETCH_COLUMN, 0);
28 28
       }
29
-      protected function stdQuery( $_query ) {
29
+      protected function stdQuery($_query) {
30 30
         $database = $this->connection;
31 31
         $query = $database->prepare($_query);
32 32
         $result = $query->execute();
33
-        if(!$result)
33
+        if (!$result)
34 34
           throw new JException(json_encode([
35 35
             "query" => $_query,
36 36
             "error" => [
Please login to merge, or discard this patch.
dist/jate/modules/Query/Query.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@  discard block
 block discarded – undo
9 9
       $this->connection = [];
10 10
       $this->currentConnection = null;
11 11
     }
12
-    public function addConnection( $_path, $_name = "default" ) {
13
-      if(!is_string($_path))
12
+    public function addConnection($_path, $_name = "default") {
13
+      if (!is_string($_path))
14 14
         throw new JException("Parameter must be a string.", 1);
15 15
       try {
16 16
         $jConfig = new JConfig($_path);
17
-        if($jConfig->enable) {
17
+        if ($jConfig->enable) {
18 18
           $connection = new Connection($jConfig);
19 19
           $this->addConnectionMan($connection, $_name);
20 20
         }
@@ -22,30 +22,30 @@  discard block
 block discarded – undo
22 22
         throw new JException($e->getMessage(), 1);
23 23
       }
24 24
     }
25
-    public function addConnectionMan( $_connection, $_name = "default") {
26
-      if(!is_object($_connection) || !is_a($_connection, "Connection"))
25
+    public function addConnectionMan($_connection, $_name = "default") {
26
+      if (!is_object($_connection) || !is_a($_connection, "Connection"))
27 27
         throw new JException("Parameter must be a Connection object.", 1);
28 28
       try {
29 29
         $this->connection["$_name"] = $_connection;
30 30
         $this->currentConnection = $_connection;
31 31
         foreach ($this->modules as &$module)
32
-          if(isset($this->currentConnection))
32
+          if (isset($this->currentConnection))
33 33
             $module->addConnectionMan($this->currentConnection, $_name);
34 34
       } catch (Exception $e) {
35 35
         throw new JException($e->getMessage(), 1);
36 36
       }
37 37
     }
38
-    public function setConnection( $_name = "default" ) {
39
-      if(!is_string($_name))
38
+    public function setConnection($_name = "default") {
39
+      if (!is_string($_name))
40 40
         throw new JException("Parameter must be a string.", 1);
41
-      if(!isset($this->connection["$_name"]))
41
+      if (!isset($this->connection["$_name"]))
42 42
         throw new JException("This connection name does not exist.", 1);
43 43
       $this->currentConnection = $this->connection["$_name"];
44 44
     }
45
-    public function query( $_query ) {
46
-      if(!is_string($_query))
45
+    public function query($_query) {
46
+      if (!is_string($_query))
47 47
         throw new JException("Parameter must be a string.", 1);
48
-      if($this->currentConnection == null)
48
+      if ($this->currentConnection == null)
49 49
         throw new JException("No connection selected.", 1);
50 50
       try {
51 51
         $temp = $this->currentConnection->database->query($_query);
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
       }
55 55
       return $temp;
56 56
     }
57
-    public function queryInsert( $_query ) {
58
-      if(!is_string($_query))
57
+    public function queryInsert($_query) {
58
+      if (!is_string($_query))
59 59
         throw new JException("Parameter must be a string.", 1);
60
-      if($this->currentConnection == null)
60
+      if ($this->currentConnection == null)
61 61
         throw new JException("No connection selected.", 1);
62 62
       try {
63 63
         $temp = $this->currentConnection->database->queryInsert($_query);
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
       }
67 67
       return $temp;
68 68
     }
69
-    public function queryFetch( $_query ) {
70
-      if(!is_string($_query))
69
+    public function queryFetch($_query) {
70
+      if (!is_string($_query))
71 71
         throw new JException("Parameter must be a string.", 1);
72
-      if($this->currentConnection == null)
72
+      if ($this->currentConnection == null)
73 73
         throw new JException("No connection selected.", 1);
74 74
       try {
75 75
         $temp = $this->currentConnection->database->queryFetch($_query);
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
       }
79 79
       return $temp;
80 80
     }
81
-    public function queryArray( $_query ) {
82
-      if(!is_string($_query))
81
+    public function queryArray($_query) {
82
+      if (!is_string($_query))
83 83
         throw new JException("Parameter must be a string.", 1);
84
-      if($this->currentConnection == null)
84
+      if ($this->currentConnection == null)
85 85
         throw new JException("No connection selected.", 1);
86 86
       try {
87 87
         $temp = $this->currentConnection->database->queryArray($_query);
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
       }
91 91
       return $temp;
92 92
     }
93
-    public function newTable( $_query ) {
94
-      if(!is_string($_query))
93
+    public function newTable($_query) {
94
+      if (!is_string($_query))
95 95
         throw new JException("Parameter must be a string.", 1);
96
-      if($this->currentConnection == null)
96
+      if ($this->currentConnection == null)
97 97
         throw new JException("No connection selected.", 1);
98 98
       try {
99 99
         $temp = $this->currentConnection->database->newTable($_query);
Please login to merge, or discard this patch.