Completed
Push — master ( a847da...ede37a )
by Federico
03:15
created
dist/jate/modules/Parser/Adapters/TwigAdapter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
   // use Twig as Twig;
3 3
   jRequire("ParserAbstract.php");
4 4
   class TwigAdapter extends ParserAbstract {
5
-    public function draw( $_text, $_parameters = [] ) {
5
+    public function draw($_text, $_parameters = []) {
6 6
       $loader = new Twig_Loader_Array([
7 7
         'index' => $_text
8 8
       ]);
Please login to merge, or discard this patch.
dist/jate/modules/Parser/Adapters/ParserAbstract.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
   abstract class ParserAbstract {
3
-    public function drawText( $_text, $_parameters = [] ) {
3
+    public function drawText($_text, $_parameters = []) {
4 4
       return $this->draw(trim($_text), $_parameters);
5 5
     }
6
-    abstract public function draw( $_text, $_parameters = [] );
6
+    abstract public function draw($_text, $_parameters = []);
7 7
   }
8 8
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Parser/Adapters/ParsedownAdapter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
   jRequire("../../ExternalModules/Parsedown/Parsedown.php");
4 4
   use Parsedown as Parsedown;
5 5
   class ParsedownAdapter extends ParserAbstract {
6
-    public function draw( $_text, $_parameters = [] ) {
6
+    public function draw($_text, $_parameters = []) {
7 7
       $Parsedown = new Parsedown\Parsedown();
8 8
       $page = $Parsedown->text($_text);
9 9
       $page = preg_replace('/[ ](?=[^>]*(?:<|$))/', "&nbsp", $page);
Please login to merge, or discard this patch.
dist/jate/modules/Parser/Parser.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
   requireComponents("Adapters");
3 3
   jRequire("../JException/JException.php");
4 4
   class Parser {
5
-    private static function setParser ( $_type ) {
5
+    private static function setParser($_type) {
6 6
       $parser = null;
7 7
       $_type = strtolower($_type);
8 8
       switch ($_type) {
@@ -27,20 +27,20 @@  discard block
 block discarded – undo
27 27
       }
28 28
       return $parser;
29 29
     }
30
-    public static function parseText( $_text, $_parameters = [], $_type = "html" ) {
31
-      if(!is_string($_text) || !is_string($_type))
30
+    public static function parseText($_text, $_parameters = [], $_type = "html") {
31
+      if (!is_string($_text) || !is_string($_type))
32 32
         throw new JException("Parameter must be a string.");
33
-      if(!is_array($_parameters))
33
+      if (!is_array($_parameters))
34 34
         throw new JException("Parameter must be an array.");
35 35
       $parser = self::setParser($_type);
36
-      if($parser === -1)
36
+      if ($parser === -1)
37 37
         return $_text;
38 38
       return $parser->drawText($_text, $_parameters);
39 39
     }
40
-    public static function parseFileMan( $_path, $_parameters = [], $_type = "html"  ) {
41
-      if(!is_string($_path))
40
+    public static function parseFileMan($_path, $_parameters = [], $_type = "html") {
41
+      if (!is_string($_path))
42 42
         throw new JException("Parameter must be a string.");
43
-      if(!file_exists($_path))
43
+      if (!file_exists($_path))
44 44
         throw new JException("File [$_path] not found.");
45 45
       $string = file_get_contents($_path);
46 46
       try {
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
       }
51 51
       return $text;
52 52
     }
53
-    public static function parseFile( $_path, $_parameters = [] ) {
54
-      if(!is_string($_path))
53
+    public static function parseFile($_path, $_parameters = []) {
54
+      if (!is_string($_path))
55 55
         throw new JException("Parameter must be a string.");
56 56
       $extension = explode(".", $_path);
57
-      $extension = $extension[count($extension)-1];
57
+      $extension = $extension[count($extension) - 1];
58 58
       $extension = strtolower($extension);
59 59
       try {
60 60
         $text = self::parseFileMan($_path, $_parameters, $extension);
Please login to merge, or discard this patch.
dist/jate/modules/JException/JException.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,26 +3,26 @@
 block discarded – undo
3 3
     static protected $escapeString = "|jate|";
4 4
     public function __construct($_message, $_level = 2, $_code = 0, Exception $_previous = null) {
5 5
       parent::__construct($_message, $_code, $_previous);
6
-      if(isset(debug_backtrace()[$_level]) && isset(debug_backtrace()[$_level]["file"]))
6
+      if (isset(debug_backtrace()[$_level]) && isset(debug_backtrace()[$_level]["file"]))
7 7
         $this->file  = debug_backtrace()[$_level]["file"];
8
-      if(isset(debug_backtrace()[$_level]) && isset(debug_backtrace()[$_level]["line"]))
8
+      if (isset(debug_backtrace()[$_level]) && isset(debug_backtrace()[$_level]["line"]))
9 9
         $this->line  = debug_backtrace()[$_level]["line"];
10
-      if(isset(debug_backtrace()[$_level]) && isset(debug_backtrace()[$_level]["function"]))
10
+      if (isset(debug_backtrace()[$_level]) && isset(debug_backtrace()[$_level]["function"]))
11 11
         $this->function = debug_backtrace()[$_level]["function"];
12
-      if(isset(debug_backtrace()[$_level]) && isset(debug_backtrace()[$_level]["class"]))
12
+      if (isset(debug_backtrace()[$_level]) && isset(debug_backtrace()[$_level]["class"]))
13 13
         $this->class = debug_backtrace()[$_level]["class"];
14 14
     }
15 15
     public function __toString() {
16 16
       return JException::encode(JException::decode($this->message));
17 17
     }
18
-    static public function decode( $_message ) {
18
+    static public function decode($_message) {
19 19
       $messageSplitted = explode(JException::$escapeString, $_message);
20
-      if(count($messageSplitted) == 3)
20
+      if (count($messageSplitted) == 3)
21 21
         return $messageSplitted[1];
22 22
       else
23 23
         return $_message;
24 24
     }
25
-    static public function encode( $_message ) {
25
+    static public function encode($_message) {
26 26
       $escape = JException::$escapeString;
27 27
       return "$escape$_message$escape";
28 28
 
Please login to merge, or discard this patch.
dist/jate/modules/File/File.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -7,30 +7,30 @@  discard block
 block discarded – undo
7 7
         "attached" => []
8 8
       ];
9 9
     }
10
-    public function addFile( $_file ) {
10
+    public function addFile($_file) {
11 11
       try {
12 12
       $this->isCorrectPath($_file);
13
-      } catch( Exception $e) {
13
+      } catch (Exception $e) {
14 14
         throw new JException($e->getMessage());
15 15
       }
16 16
       $this->files["attached"][] = $_file;
17 17
     }
18
-    public function addFileRequired( $_file ) {
18
+    public function addFileRequired($_file) {
19 19
       try {
20 20
         $this->isCorrectPath($_file);
21
-      } catch( Exception $e) {
21
+      } catch (Exception $e) {
22 22
         throw new JException($e->getMessage());
23 23
       }
24 24
       $this->files["required"][] = $_file;
25 25
     }
26
-    public function addFiles( $_files ) {
27
-      if(!is_array($_files))
26
+    public function addFiles($_files) {
27
+      if (!is_array($_files))
28 28
         throw new JException("Parameter must be an array.");
29 29
       foreach ($_files as $value)
30 30
         $this->addFile($value);
31 31
     }
32
-    public function addFilesRequired( $_files ) {
33
-      if(!is_array($_files))
32
+    public function addFilesRequired($_files) {
33
+      if (!is_array($_files))
34 34
         throw new JException("Parameter must be an array.");
35 35
       foreach ($_files as $value)
36 36
         $this->addFileRequired($value);
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
     public function getFilesRequired() {
42 42
       return $this->files["required"];
43 43
     }
44
-    protected function isCorrectPath( $_file ) {
45
-      if(!is_string($_file))
44
+    protected function isCorrectPath($_file) {
45
+      if (!is_string($_file))
46 46
         throw new JException("Path must be a string.");
47
-      if(!(file_exists($_file) || $this->isCorrectUrl($_file)))
47
+      if (!(file_exists($_file) || $this->isCorrectUrl($_file)))
48 48
         throw new JException("File [$_file] not found.");
49 49
     }
50
-    protected function isCorrectUrl( $_url ) {
51
-      return strpos(@get_headers($_url)[0],'200') === false ? false : true;
50
+    protected function isCorrectUrl($_url) {
51
+      return strpos(@get_headers($_url)[0], '200') === false ? false : true;
52 52
     }
53 53
   }
54 54
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Router/Router.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
     protected $pages;
6 6
     protected $defaultPage;
7 7
     protected $urlCaseSensitive;
8
-    public function __construct( $_path, $_urlCaseSensitive = false ) {
9
-      if(!is_string($_path))
8
+    public function __construct($_path, $_urlCaseSensitive = false) {
9
+      if (!is_string($_path))
10 10
         throw new JException("Parameter must be a string.");
11 11
       $jConfig   = new JConfig($_path);
12 12
       $server    = new ServerVars();
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
       $pageSelected = null;
24 24
       foreach ($this->pages as $page) {
25 25
         $urlParameters = $this->pathSeeker(explode("/", $page[0]), $this->url);
26
-        if(is_array($urlParameters)) {
27
-          if(isset($page[2]) && is_array($page[2]))
26
+        if (is_array($urlParameters)) {
27
+          if (isset($page[2]) && is_array($page[2]))
28 28
             $urlParameters = array_merge($urlParameters, $page[2]);
29 29
           $pageSelected = [
30 30
             $page[1],
@@ -33,28 +33,28 @@  discard block
 block discarded – undo
33 33
           break;
34 34
         }
35 35
       }
36
-      if( $pageSelected !== null )
36
+      if ($pageSelected !== null)
37 37
         return $pageSelected;
38 38
       else
39 39
         return $this->defaultPage;
40 40
     }
41
-    protected function pathSeeker( $_path, $_url ) {
41
+    protected function pathSeeker($_path, $_url) {
42 42
       $urlLength = count($_url);
43 43
       $cont = 0;
44 44
       $variables = [];
45 45
       $pathLength = count($_path);
46
-      if($urlLength == $pathLength) {
47
-        while($cont < $urlLength) {
48
-          if(
46
+      if ($urlLength == $pathLength) {
47
+        while ($cont < $urlLength) {
48
+          if (
49 49
             ($this->urlCaseSensitive && $_path[$cont] == $_url[$cont]) ||
50 50
             (!$this->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) )
51 51
             $cont++;
52
-          else if( strpos($_path[$cont], "\$") !== false ) {
52
+          else if (strpos($_path[$cont], "\$") !== false) {
53 53
             $variables[str_replace('$', "", $_path[$cont])] = $_url[$cont];
54 54
             $cont++;
55 55
           } else break;
56 56
         }
57
-        if($cont == $urlLength)
57
+        if ($cont == $urlLength)
58 58
           return $variables;
59 59
       }
60 60
       return null;
Please login to merge, or discard this patch.
dist/jate/modules/Html/Html.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
         "base"  => ""
22 22
       ];
23 23
     }
24
-    public function setParameters( $_parameters = [ "app" => null, "page" => null] ) {
24
+    public function setParameters($_parameters = ["app" => null, "page" => null]) {
25 25
     $this->app  = $_parameters["app"];
26 26
     $this->page = $_parameters["page"];
27 27
     }
28 28
     abstract public function init();
29 29
     public function draw() {
30
-      if($this->template == "")
30
+      if ($this->template == "")
31 31
         throw new JException("The variable \$this->template must be set in class $this->name function init().");
32 32
       $server = new ServerVars();
33 33
       $this->addDipendences();
@@ -38,23 +38,23 @@  discard block
 block discarded – undo
38 38
       return jBlockFile($this->template, $this->tags);
39 39
     }
40 40
     public function getCss() {
41
-      return $this->getRequire("getCss",".css");
41
+      return $this->getRequire("getCss", ".css");
42 42
     }
43 43
     public function getJs() {
44
-      return $this->getRequire("getJs",".js");
44
+      return $this->getRequire("getJs", ".js");
45 45
     }
46 46
     public function getJsVars() {
47 47
       return $this->jsVars;
48 48
     }
49
-    public function addJsVar( $_name, $_value ) {
50
-      if(!is_string($_name))
49
+    public function addJsVar($_name, $_value) {
50
+      if (!is_string($_name))
51 51
         throw new InvalidArgumentException("Parameter name must be a string.");
52
-      if(!is_string($_value))
52
+      if (!is_string($_value))
53 53
         throw new InvalidArgumentException("Parameter value must be a string.");
54 54
       $this->jsVars[] = [$_name, $_value];
55 55
     }
56
-    public function addJsVars( $_array ) {
57
-      if(!is_array($_array))
56
+    public function addJsVars($_array) {
57
+      if (!is_array($_array))
58 58
         throw new InvalidArgumentException("Parameter must be an array.");
59 59
       foreach ($_array as $value)
60 60
         $this->addJsVar($value[0], $value[1]);
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
       $this->tags["js"]    = $this->getJs();
84 84
       $this->tags["jsVar"] = $this->getJsVars();
85 85
     }
86
-    protected function getRequire( $_function, $_extenction) {
86
+    protected function getRequire($_function, $_extenction) {
87 87
       $temp = [];
88 88
       $filesRequired = $this->getFilesRequired();
89 89
       $files         = $this->getFiles();
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
92 92
           $temp[] = $i;
93 93
       foreach ($this->modules as $i)
94
-        $temp = array_merge( $temp, $i->$_function() );
94
+        $temp = array_merge($temp, $i->$_function());
95 95
       foreach ($files as $i)
96 96
         if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
97 97
           $temp[] = $i;
Please login to merge, or discard this patch.
dist/jate/modules/Module/Module.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,19 +16,19 @@
 block discarded – undo
16 16
       $this->__queryConstruct();
17 17
       $this->__fileConstruct();
18 18
     }
19
-    public function addModules( $_modules ) {
20
-      if(!is_array($_modules))
19
+    public function addModules($_modules) {
20
+      if (!is_array($_modules))
21 21
         throw new JException("Parameter must be an array.");
22 22
       foreach ($_modules as $value)
23 23
         $this->addModule($value);
24 24
     }
25
-    public function addModule( $_module ) {
26
-      if(!is_object($_module))
25
+    public function addModule($_module) {
26
+      if (!is_object($_module))
27 27
         throw new JException("Parameter must be a object.");
28
-      if(! is_subclass_of ($_module, "Module"))
28
+      if (!is_subclass_of($_module, "Module"))
29 29
         throw new JException("Parameter must be a object inherited from Module object.");
30 30
       $this->modules[$_module->name] = $_module;
31
-      if($this->currentConnection)
31
+      if ($this->currentConnection)
32 32
         $this->modules[$_module->name]->addConnectionMan($this->currentConnection);
33 33
     }
34 34
   }
Please login to merge, or discard this patch.