Test Failed
Push — master ( 53306a...8beb08 )
by Federico
07:33
created
dist/jate/functions/block.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -9,6 +9,9 @@
 block discarded – undo
9 9
     return jBlockEnd($_type, $_parameters);
10 10
   }
11 11
 
12
+  /**
13
+   * @param string $_path
14
+   */
12 15
   function jBlockFile( $_path, $_parameters = [] ) {
13 16
     try {
14 17
       $temp = Parser::parseFile($_path, $_parameters);
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -2,46 +2,46 @@
 block discarded – undo
2 2
   jRequire("../modules/Parser/Parser.php");
3 3
   jRequire("../modules/JException/JException.php");
4 4
   function jBlock() {
5
-    return ob_start();
5
+	return ob_start();
6 6
   }
7 7
 
8 8
   function jBlockClose( $_type = "html", $_parameters = [] ) {
9
-    return jBlockEnd($_type, $_parameters);
9
+	return jBlockEnd($_type, $_parameters);
10 10
   }
11 11
 
12 12
   function jBlockFile( $_path, $_parameters = [] ) {
13
-    try {
14
-      $temp = Parser::parseFile($_path, $_parameters);
15
-    } catch (Exception $e) {
16
-      throw new JException($e->getMessage());
17
-    }
18
-    return $temp;
13
+	try {
14
+	  $temp = Parser::parseFile($_path, $_parameters);
15
+	} catch (Exception $e) {
16
+	  throw new JException($e->getMessage());
17
+	}
18
+	return $temp;
19 19
   }
20 20
 
21 21
   function jBlockFileMan( $_path, $_type, $_parameters = [] ) {
22
-    try {
23
-      $temp = Parser::parseFileMan($_path, $_parameters, $_type);
24
-    } catch (Exception $e) {
25
-      throw new JException($e->getMessage());
26
-    }
27
-    return $temp;
22
+	try {
23
+	  $temp = Parser::parseFileMan($_path, $_parameters, $_type);
24
+	} catch (Exception $e) {
25
+	  throw new JException($e->getMessage());
26
+	}
27
+	return $temp;
28 28
   }
29 29
 
30 30
   function jBlockEnd( $_type = "html", $_parameters = [] ) {
31
-    $text = ob_get_clean();
32
-    try {
33
-      $temp = Parser::parseText($text, $_parameters, $_type);
34
-    } catch (Exception $e) {
35
-      throw new JException($e->getMessage());
36
-    }
37
-    return $temp;
31
+	$text = ob_get_clean();
32
+	try {
33
+	  $temp = Parser::parseText($text, $_parameters, $_type);
34
+	} catch (Exception $e) {
35
+	  throw new JException($e->getMessage());
36
+	}
37
+	return $temp;
38 38
   }
39 39
 
40 40
   function minifyOutput($_buffer) {
41
-    $search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' );
42
-    $replace = array ( '>', '<', '\\1' );
43
-    if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1)
44
-      $_buffer = preg_replace($search, $replace, utf8_decode($_buffer));
45
-    return utf8_encode($_buffer);
41
+	$search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' );
42
+	$replace = array ( '>', '<', '\\1' );
43
+	if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1)
44
+	  $_buffer = preg_replace($search, $replace, utf8_decode($_buffer));
45
+	return utf8_encode($_buffer);
46 46
   }
47 47
 ?>
Please login to merge, or discard this patch.
dist/jate/functions/errorHandler.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -1,4 +1,7 @@
 block discarded – undo
1 1
 <?php
2
+  /**
3
+   * @param integer $number
4
+   */
2 5
   function jateErrorHandler($number, $message, $file, $line) {
3 6
     if (!(error_reporting() & $number)) {
4 7
       return false;
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
   function jateErrorHandler($number, $message, $file, $line) {
3
-    if (!(error_reporting() & $number)) {
4
-      return false;
5
-    }
6
-    ob_end_clean();
7
-    $message = JException::decode($message);
8
-    echo "
3
+	if (!(error_reporting() & $number)) {
4
+	  return false;
5
+	}
6
+	ob_end_clean();
7
+	$message = JException::decode($message);
8
+	echo "
9 9
       <div id='error'>
10 10
         <header>
11 11
         JATE ERROR
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
         }
52 52
       </style>
53 53
     ";
54
-    exit(1);
55
-    return true;
54
+	exit(1);
55
+	return true;
56 56
   }
57 57
   function fatalErrorShutdownHandler() {
58
-    $last_error = error_get_last();
59
-    if ($last_error['type'] === E_ERROR) {
60
-      jateErrorHandler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']);
61
-    }
58
+	$last_error = error_get_last();
59
+	if ($last_error['type'] === E_ERROR) {
60
+	  jateErrorHandler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']);
61
+	}
62 62
   }
63 63
   set_error_handler('jateErrorHandler');
64 64
   register_shutdown_function('fatalErrorShutdownHandler');
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Connection.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -3,6 +3,10 @@
 block discarded – undo
3 3
   class Connection {
4 4
     public $database;
5 5
     public $info;
6
+
7
+    /**
8
+     * @param JConfig $_object
9
+     */
6 10
     public function __construct( $_object ) {
7 11
       if(!is_object($_object))
8 12
         throw new InvalidArgumentException("Parameter must be an object.");
Please login to merge, or discard this patch.
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -1,42 +1,42 @@
 block discarded – undo
1 1
 <?php
2 2
   requireComponents("Adapters");
3 3
   class Connection {
4
-    public $database;
5
-    public $info;
6
-    public function __construct( $_object ) {
7
-      if(!is_object($_object))
8
-        throw new InvalidArgumentException("Parameter must be an object.");
9
-      $this->setConnection(
10
-        $_object->server,
11
-        $_object->database,
12
-        $_object->user,
13
-        $_object->password,
14
-        $this->getConnectionType($_object->engine)
15
-      );
16
-    }
17
-    protected function setConnection ( $_srv, $_db, $_usr, $_pass, $_type ) {
18
-      switch ($_type) {
19
-        case "mysqli":
20
-          $this->database = new MysqliAdapter($_srv, $_db, $_usr, $_pass);
21
-        break;
22
-        case "postgresql":
23
-          $this->database = new PostgresqlAdapter($_srv, $_db, $_usr, $_pass);
24
-        break;
25
-        case "memory":
26
-          $this->database = new PdoMemoryAdapter($_srv, $_db, $_usr, $_pass);
27
-        break;
28
-        case "pdo":
29
-        default:
30
-          $this->database = new PdoAdapter($_srv, $_db, $_usr, $_pass);
31
-        break;
32
-      }
33
-    }
34
-    protected function getConnectionType( $_type ) {
35
-      $array = (array)$_type;
36
-      foreach ($array as $key => $value)
37
-        if($value)
38
-          return $key;
39
-      return "pdo";
40
-    }
4
+	public $database;
5
+	public $info;
6
+	public function __construct( $_object ) {
7
+	  if(!is_object($_object))
8
+		throw new InvalidArgumentException("Parameter must be an object.");
9
+	  $this->setConnection(
10
+		$_object->server,
11
+		$_object->database,
12
+		$_object->user,
13
+		$_object->password,
14
+		$this->getConnectionType($_object->engine)
15
+	  );
16
+	}
17
+	protected function setConnection ( $_srv, $_db, $_usr, $_pass, $_type ) {
18
+	  switch ($_type) {
19
+		case "mysqli":
20
+		  $this->database = new MysqliAdapter($_srv, $_db, $_usr, $_pass);
21
+		break;
22
+		case "postgresql":
23
+		  $this->database = new PostgresqlAdapter($_srv, $_db, $_usr, $_pass);
24
+		break;
25
+		case "memory":
26
+		  $this->database = new PdoMemoryAdapter($_srv, $_db, $_usr, $_pass);
27
+		break;
28
+		case "pdo":
29
+		default:
30
+		  $this->database = new PdoAdapter($_srv, $_db, $_usr, $_pass);
31
+		break;
32
+	  }
33
+	}
34
+	protected function getConnectionType( $_type ) {
35
+	  $array = (array)$_type;
36
+	  foreach ($array as $key => $value)
37
+		if($value)
38
+		  return $key;
39
+	  return "pdo";
40
+	}
41 41
   }
42 42
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/File/File.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -47,6 +47,10 @@
 block discarded – undo
47 47
       if(!(file_exists($_file) || $this->isCorrectUrl($_file)))
48 48
         throw new JException("File [$_file] not found.");
49 49
     }
50
+
51
+    /**
52
+     * @param string $_url
53
+     */
50 54
     protected function isCorrectUrl( $_url ) {
51 55
       return strpos(@get_headers($_url)[0],'200') === false ? false : true;
52 56
     }
Please login to merge, or discard this patch.
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -1,54 +1,54 @@
 block discarded – undo
1 1
 <?php
2 2
   trait File {
3
-    private $files;
4
-    public function __construct() {
5
-      $this->files = [
6
-        "required" => [],
7
-        "attached" => []
8
-      ];
9
-    }
10
-    public function addFile( $_file ) {
11
-      try {
12
-      $this->isCorrectPath($_file);
13
-      } catch( Exception $e) {
14
-        throw new JException($e->getMessage());
15
-      }
16
-      $this->files["attached"][] = $_file;
17
-    }
18
-    public function addFileRequired( $_file ) {
19
-      try {
20
-        $this->isCorrectPath($_file);
21
-      } catch( Exception $e) {
22
-        throw new JException($e->getMessage());
23
-      }
24
-      $this->files["required"][] = $_file;
25
-    }
26
-    public function addFiles( $_files ) {
27
-      if(!is_array($_files))
28
-        throw new JException("Parameter must be an array.");
29
-      foreach ($_files as $value)
30
-        $this->addFile($value);
31
-    }
32
-    public function addFilesRequired( $_files ) {
33
-      if(!is_array($_files))
34
-        throw new JException("Parameter must be an array.");
35
-      foreach ($_files as $value)
36
-        $this->addFileRequired($value);
37
-    }
38
-    public function getFiles() {
39
-      return $this->files["attached"];
40
-    }
41
-    public function getFilesRequired() {
42
-      return $this->files["required"];
43
-    }
44
-    protected function isCorrectPath( $_file ) {
45
-      if(!is_string($_file))
46
-        throw new JException("Path must be a string.");
47
-      if(!(file_exists($_file) || $this->isCorrectUrl($_file)))
48
-        throw new JException("File [$_file] not found.");
49
-    }
50
-    protected function isCorrectUrl( $_url ) {
51
-      return strpos(@get_headers($_url)[0],'200') === false ? false : true;
52
-    }
3
+	private $files;
4
+	public function __construct() {
5
+	  $this->files = [
6
+		"required" => [],
7
+		"attached" => []
8
+	  ];
9
+	}
10
+	public function addFile( $_file ) {
11
+	  try {
12
+	  $this->isCorrectPath($_file);
13
+	  } catch( Exception $e) {
14
+		throw new JException($e->getMessage());
15
+	  }
16
+	  $this->files["attached"][] = $_file;
17
+	}
18
+	public function addFileRequired( $_file ) {
19
+	  try {
20
+		$this->isCorrectPath($_file);
21
+	  } catch( Exception $e) {
22
+		throw new JException($e->getMessage());
23
+	  }
24
+	  $this->files["required"][] = $_file;
25
+	}
26
+	public function addFiles( $_files ) {
27
+	  if(!is_array($_files))
28
+		throw new JException("Parameter must be an array.");
29
+	  foreach ($_files as $value)
30
+		$this->addFile($value);
31
+	}
32
+	public function addFilesRequired( $_files ) {
33
+	  if(!is_array($_files))
34
+		throw new JException("Parameter must be an array.");
35
+	  foreach ($_files as $value)
36
+		$this->addFileRequired($value);
37
+	}
38
+	public function getFiles() {
39
+	  return $this->files["attached"];
40
+	}
41
+	public function getFilesRequired() {
42
+	  return $this->files["required"];
43
+	}
44
+	protected function isCorrectPath( $_file ) {
45
+	  if(!is_string($_file))
46
+		throw new JException("Path must be a string.");
47
+	  if(!(file_exists($_file) || $this->isCorrectUrl($_file)))
48
+		throw new JException("File [$_file] not found.");
49
+	}
50
+	protected function isCorrectUrl( $_url ) {
51
+	  return strpos(@get_headers($_url)[0],'200') === false ? false : true;
52
+	}
53 53
   }
54 54
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Html/Html.php 2 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -83,6 +83,11 @@
 block discarded – undo
83 83
       $this->tags["js"]    = $this->getJs();
84 84
       $this->tags["jsVar"] = $this->getJsVars();
85 85
     }
86
+
87
+    /**
88
+     * @param string $_function
89
+     * @param string $_extenction
90
+     */
86 91
     protected function getRequire( $_function, $_extenction) {
87 92
       $temp = [];
88 93
       $filesRequired = $this->getFilesRequired();
Please login to merge, or discard this patch.
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -3,99 +3,99 @@
 block discarded – undo
3 3
   requireComponent("../Module/Module.php");
4 4
   requireComponent("../JException/JException.php");
5 5
   abstract class Html extends Module {
6
-    public $template;
7
-    public $app;
8
-    public $page;
9
-    public $tags;
10
-    public $jsVars;
11
-    public function __construct() {
12
-      parent::__construct();
13
-      $this->template = "";
14
-      $this->app      = [];
15
-      $this->page     = [];
16
-      $this->jsVars   = [];
17
-      $this->tags     = [
18
-        "css"   => [],
19
-        "js"    => [],
20
-        "jsVar" => [],
21
-        "base"  => ""
22
-      ];
23
-    }
24
-    public function setParameters( $_parameters = [ "app" => null, "page" => null] ) {
25
-    $this->app  = $_parameters["app"];
26
-    $this->page = $_parameters["page"];
27
-    }
28
-    abstract public function init();
29
-    public function draw() {
30
-      if($this->template == "")
31
-        throw new JException("The variable \$this->template must be set in class $this->name function init().");
32
-      $server = new ServerVars();
33
-      $this->addDipendences();
34
-      $this->tags["css"]  = array_unique($this->tags["css"]);
35
-      $this->tags["js"]   = array_unique($this->tags["js"]);
36
-      $this->tags["base"] = $server->server["RELATIVE"]."/";
37
-      $this->stringifyDipendences();
38
-      return jBlockFile($this->template, $this->tags);
39
-    }
40
-    public function getCss() {
41
-      return $this->getRequire("getCss",".css");
42
-    }
43
-    public function getJs() {
44
-      return $this->getRequire("getJs",".js");
45
-    }
46
-    public function getJsVars() {
47
-      return $this->jsVars;
48
-    }
49
-    public function addJsVar( $_name, $_value ) {
50
-      if(!is_string($_name))
51
-        throw new InvalidArgumentException("Parameter name must be a string.");
52
-      if(!is_string($_value))
53
-        throw new InvalidArgumentException("Parameter value must be a string.");
54
-      $this->jsVars[] = [$_name, $_value];
55
-    }
56
-    public function addJsVars( $_array ) {
57
-      if(!is_array($_array))
58
-        throw new InvalidArgumentException("Parameter must be an array.");
59
-      foreach ($_array as $value)
60
-        $this->addJsVar($value[0], $value[1]);
61
-    }
62
-    protected function stringifyDipendences() {
63
-      $tempStr = "";
64
-      $timeParameter = "?t=".time();
65
-      $time = ($this->app->cache->css == true) ? "" : $timeParameter;
66
-      foreach ($this->tags["css"] as $i)
67
-      $tempStr .= "<link rel='stylesheet' href='$i$time'>";
68
-      $this->tags["css"] = $tempStr;
69
-      $tempStr = "";
70
-      $time = ($this->app->cache->js == true) ? "" : $timeParameter;
71
-      foreach ($this->tags["js"] as $i)
72
-      $tempStr .= "<script src='$i$time'></script>";
73
-      $this->tags["js"] = $tempStr;
74
-      $tempStr = "";
75
-      $tempStr .= "<script type='text/javascript'>";
76
-      foreach ($this->tags["jsVar"] as $i)
77
-      $tempStr .= " $i[0] = $i[1];\n";
78
-      $tempStr .= "</script>";
79
-      $this->tags["jsVar"] = $tempStr;
80
-    }
81
-    protected function addDipendences() {
82
-      $this->tags["css"]   = $this->getCss();
83
-      $this->tags["js"]    = $this->getJs();
84
-      $this->tags["jsVar"] = $this->getJsVars();
85
-    }
86
-    protected function getRequire( $_function, $_extenction) {
87
-      $temp = [];
88
-      $filesRequired = $this->getFilesRequired();
89
-      $files         = $this->getFiles();
90
-      foreach ($filesRequired as $i)
91
-        if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
92
-          $temp[] = $i;
93
-      foreach ($this->modules as $i)
94
-        $temp = array_merge( $temp, $i->$_function() );
95
-      foreach ($files as $i)
96
-        if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
97
-          $temp[] = $i;
98
-      return $temp;
99
-    }
6
+	public $template;
7
+	public $app;
8
+	public $page;
9
+	public $tags;
10
+	public $jsVars;
11
+	public function __construct() {
12
+	  parent::__construct();
13
+	  $this->template = "";
14
+	  $this->app      = [];
15
+	  $this->page     = [];
16
+	  $this->jsVars   = [];
17
+	  $this->tags     = [
18
+		"css"   => [],
19
+		"js"    => [],
20
+		"jsVar" => [],
21
+		"base"  => ""
22
+	  ];
23
+	}
24
+	public function setParameters( $_parameters = [ "app" => null, "page" => null] ) {
25
+	$this->app  = $_parameters["app"];
26
+	$this->page = $_parameters["page"];
27
+	}
28
+	abstract public function init();
29
+	public function draw() {
30
+	  if($this->template == "")
31
+		throw new JException("The variable \$this->template must be set in class $this->name function init().");
32
+	  $server = new ServerVars();
33
+	  $this->addDipendences();
34
+	  $this->tags["css"]  = array_unique($this->tags["css"]);
35
+	  $this->tags["js"]   = array_unique($this->tags["js"]);
36
+	  $this->tags["base"] = $server->server["RELATIVE"]."/";
37
+	  $this->stringifyDipendences();
38
+	  return jBlockFile($this->template, $this->tags);
39
+	}
40
+	public function getCss() {
41
+	  return $this->getRequire("getCss",".css");
42
+	}
43
+	public function getJs() {
44
+	  return $this->getRequire("getJs",".js");
45
+	}
46
+	public function getJsVars() {
47
+	  return $this->jsVars;
48
+	}
49
+	public function addJsVar( $_name, $_value ) {
50
+	  if(!is_string($_name))
51
+		throw new InvalidArgumentException("Parameter name must be a string.");
52
+	  if(!is_string($_value))
53
+		throw new InvalidArgumentException("Parameter value must be a string.");
54
+	  $this->jsVars[] = [$_name, $_value];
55
+	}
56
+	public function addJsVars( $_array ) {
57
+	  if(!is_array($_array))
58
+		throw new InvalidArgumentException("Parameter must be an array.");
59
+	  foreach ($_array as $value)
60
+		$this->addJsVar($value[0], $value[1]);
61
+	}
62
+	protected function stringifyDipendences() {
63
+	  $tempStr = "";
64
+	  $timeParameter = "?t=".time();
65
+	  $time = ($this->app->cache->css == true) ? "" : $timeParameter;
66
+	  foreach ($this->tags["css"] as $i)
67
+	  $tempStr .= "<link rel='stylesheet' href='$i$time'>";
68
+	  $this->tags["css"] = $tempStr;
69
+	  $tempStr = "";
70
+	  $time = ($this->app->cache->js == true) ? "" : $timeParameter;
71
+	  foreach ($this->tags["js"] as $i)
72
+	  $tempStr .= "<script src='$i$time'></script>";
73
+	  $this->tags["js"] = $tempStr;
74
+	  $tempStr = "";
75
+	  $tempStr .= "<script type='text/javascript'>";
76
+	  foreach ($this->tags["jsVar"] as $i)
77
+	  $tempStr .= " $i[0] = $i[1];\n";
78
+	  $tempStr .= "</script>";
79
+	  $this->tags["jsVar"] = $tempStr;
80
+	}
81
+	protected function addDipendences() {
82
+	  $this->tags["css"]   = $this->getCss();
83
+	  $this->tags["js"]    = $this->getJs();
84
+	  $this->tags["jsVar"] = $this->getJsVars();
85
+	}
86
+	protected function getRequire( $_function, $_extenction) {
87
+	  $temp = [];
88
+	  $filesRequired = $this->getFilesRequired();
89
+	  $files         = $this->getFiles();
90
+	  foreach ($filesRequired as $i)
91
+		if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
92
+		  $temp[] = $i;
93
+	  foreach ($this->modules as $i)
94
+		$temp = array_merge( $temp, $i->$_function() );
95
+	  foreach ($files as $i)
96
+		if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
97
+		  $temp[] = $i;
98
+	  return $temp;
99
+	}
100 100
   }
101 101
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Parser/Adapters/ParserAbstract.php 2 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -1,8 +1,16 @@
 block discarded – undo
1 1
 <?php
2 2
   abstract class ParserAbstract {
3
+
4
+    /**
5
+     * @param string $_text
6
+     */
3 7
     public function drawText( $_text, $_parameters = [] ) {
4 8
       return $this->draw(trim($_text), $_parameters);
5 9
     }
10
+
11
+    /**
12
+     * @param string $_text
13
+     */
6 14
     abstract public function draw( $_text, $_parameters = [] );
7 15
   }
8 16
 ?>
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 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 = [] ) {
4
-      return $this->draw(trim($_text), $_parameters);
5
-    }
6
-    abstract public function draw( $_text, $_parameters = [] );
3
+	public function drawText( $_text, $_parameters = [] ) {
4
+	  return $this->draw(trim($_text), $_parameters);
5
+	}
6
+	abstract public function draw( $_text, $_parameters = [] );
7 7
   }
8 8
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Parser/Parser.php 2 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -2,6 +2,10 @@  discard block
 block discarded – undo
2 2
   requireComponents("Adapters");
3 3
   jRequire("../JException/JException.php");
4 4
   class Parser {
5
+
6
+    /**
7
+     * @param string $_type
8
+     */
5 9
     private static function setParser ( $_type ) {
6 10
       $parser = null;
7 11
       $_type = strtolower($_type);
@@ -27,6 +31,10 @@  discard block
 block discarded – undo
27 31
       }
28 32
       return $parser;
29 33
     }
34
+
35
+    /**
36
+     * @param string $_text
37
+     */
30 38
     public static function parseText( $_text, $_parameters = [], $_type = "html" ) {
31 39
       if(!is_string($_text) || !is_string($_type))
32 40
         throw new JException("Parameter must be a string.");
Please login to merge, or discard this patch.
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -2,66 +2,66 @@
 block discarded – undo
2 2
   requireComponents("Adapters");
3 3
   jRequire("../JException/JException.php");
4 4
   class Parser {
5
-    private static function setParser ( $_type ) {
6
-      $parser = null;
7
-      $_type = strtolower($_type);
8
-      switch ($_type) {
9
-        case "twig":
10
-          $parser = new TwigAdapter();
11
-        break;
12
-        case "jate":
13
-          $parser = new JTagAdapter();
14
-        break;
15
-        case 'jade':
16
-        case "pug":
17
-          $parser = new PugAdapter();
18
-        break;
19
-        case "md":
20
-        case "markdown":
21
-        case "parsedown":
22
-          $parser = new ParsedownAdapter();
23
-        break;
24
-        default:
25
-          $parser = -1;
26
-        break;
27
-      }
28
-      return $parser;
29
-    }
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.");
35
-      $parser = self::setParser($_type);
36
-      if($parser === -1)
37
-        return $_text;
38
-      return $parser->drawText($_text, $_parameters);
39
-    }
40
-    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.");
45
-      $string = file_get_contents($_path);
46
-      try {
47
-        $text = self::parseText($string, $_parameters, $_type);
48
-      } catch (Exception $e) {
49
-        throw new JException($e->getMessage());
50
-      }
51
-      return $text;
52
-    }
53
-    public static function parseFile( $_path, $_parameters = [] ) {
54
-      if(!is_string($_path))
55
-        throw new JException("Parameter must be a string.");
56
-      $extension = explode(".", $_path);
57
-      $extension = $extension[count($extension)-1];
58
-      $extension = strtolower($extension);
59
-      try {
60
-        $text = self::parseFileMan($_path, $_parameters, $extension);
61
-      } catch (Exception $e) {
62
-        throw new JException($e->getMessage());
63
-      }
64
-      return $text;
65
-    }
5
+	private static function setParser ( $_type ) {
6
+	  $parser = null;
7
+	  $_type = strtolower($_type);
8
+	  switch ($_type) {
9
+		case "twig":
10
+		  $parser = new TwigAdapter();
11
+		break;
12
+		case "jate":
13
+		  $parser = new JTagAdapter();
14
+		break;
15
+		case 'jade':
16
+		case "pug":
17
+		  $parser = new PugAdapter();
18
+		break;
19
+		case "md":
20
+		case "markdown":
21
+		case "parsedown":
22
+		  $parser = new ParsedownAdapter();
23
+		break;
24
+		default:
25
+		  $parser = -1;
26
+		break;
27
+	  }
28
+	  return $parser;
29
+	}
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.");
35
+	  $parser = self::setParser($_type);
36
+	  if($parser === -1)
37
+		return $_text;
38
+	  return $parser->drawText($_text, $_parameters);
39
+	}
40
+	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.");
45
+	  $string = file_get_contents($_path);
46
+	  try {
47
+		$text = self::parseText($string, $_parameters, $_type);
48
+	  } catch (Exception $e) {
49
+		throw new JException($e->getMessage());
50
+	  }
51
+	  return $text;
52
+	}
53
+	public static function parseFile( $_path, $_parameters = [] ) {
54
+	  if(!is_string($_path))
55
+		throw new JException("Parameter must be a string.");
56
+	  $extension = explode(".", $_path);
57
+	  $extension = $extension[count($extension)-1];
58
+	  $extension = strtolower($extension);
59
+	  try {
60
+		$text = self::parseFileMan($_path, $_parameters, $extension);
61
+	  } catch (Exception $e) {
62
+		throw new JException($e->getMessage());
63
+	  }
64
+	  return $text;
65
+	}
66 66
   }
67 67
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Query/Query.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -22,6 +22,10 @@
 block discarded – undo
22 22
         throw new JException($e->getMessage(), 1);
23 23
       }
24 24
     }
25
+
26
+    /**
27
+     * @param Connection $_connection
28
+     */
25 29
     public function addConnectionMan( $_connection, $_name = "default") {
26 30
       if(!is_object($_connection) || !is_a($_connection, "Connection"))
27 31
         throw new JException("Parameter must be a Connection object.", 1);
Please login to merge, or discard this patch.
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -3,84 +3,84 @@
 block discarded – undo
3 3
   jRequire("../JConfig/JConfig.php");
4 4
   jRequire("../Connection/Connection.php");
5 5
   trait Query {
6
-    public $connection;
7
-    public $currentConnection;
8
-    public function __construct() {
9
-      $this->connection = [];
10
-      $this->currentConnection = null;
11
-    }
12
-    public function addConnection( $_path, $_name = "default" ) {
13
-      if(!is_string($_path))
14
-        throw new JException("Parameter must be a string.", 1);
15
-      try {
16
-        $jConfig = new JConfig($_path);
17
-        if($jConfig->enable) {
18
-          $connection = new Connection($jConfig);
19
-          $this->addConnectionMan($connection, $_name);
20
-        }
21
-      } catch (Exception $e) {
22
-        throw new JException($e->getMessage(), 1);
23
-      }
24
-    }
25
-    public function addConnectionMan( $_connection, $_name = "default") {
26
-      if(!is_object($_connection) || !is_a($_connection, "Connection"))
27
-        throw new JException("Parameter must be a Connection object.", 1);
28
-      try {
29
-        $this->connection["$_name"] = $_connection;
30
-        $this->currentConnection = $_connection;
31
-        foreach ($this->modules as &$module)
32
-          if(isset($this->currentConnection))
33
-            $module->addConnectionMan($this->currentConnection, $_name);
34
-      } catch (Exception $e) {
35
-        throw new JException($e->getMessage(), 1);
36
-      }
37
-    }
38
-    public function setConnection( $_name = "default" ) {
39
-      if(!is_string($_name))
40
-        throw new JException("Parameter must be a string.", 1);
41
-      if(!isset($this->connection["$_name"]))
42
-        throw new JException("This connection name does not exist.", 1);
43
-      $this->currentConnection = $this->connection["$_name"];
44
-    }
45
-    public function query( $_query ) {
46
-      if(!is_string($_query))
47
-        throw new JException("Parameter must be a string.", 1);
48
-      try {
49
-        $temp = $this->currentConnection->database->query($_query);
50
-      } catch (Exception $e) {
51
-        throw new JException($e->getMessage(), 1);
52
-      }
53
-      return $temp;
54
-    }
55
-    public function queryInsert( $_query ) {
56
-      if(!is_string($_query))
57
-        throw new JException("Parameter must be a string.", 1);
58
-      try {
59
-        $temp = $this->currentConnection->database->queryInsert($_query);
60
-      } catch (Exception $e) {
61
-        throw new JException($e->getMessage(), 1);
62
-      }
63
-      return $temp;
64
-    }
65
-    public function queryFetch( $_query ) {
66
-      if(!is_string($_query))
67
-        throw new JException("Parameter must be a string.", 1);
68
-      try {
69
-        $temp = $this->currentConnection->database->queryFetch($_query);
70
-      } catch (Exception $e) {
71
-        throw new JException($e->getMessage(), 1);
72
-      }
73
-      return $temp;
74
-    }
75
-    public function queryArray( $_query ) {
76
-      if(!is_string($_query))
77
-        throw new JException("Parameter must be a string.", 1);
78
-      try {
79
-        $temp = $this->currentConnection->database->queryArray($_query);
80
-      } catch (Exception $e) {
81
-        throw new JException($e->getMessage(), 1);
82
-      }
83
-      return $temp;
84
-    }
6
+	public $connection;
7
+	public $currentConnection;
8
+	public function __construct() {
9
+	  $this->connection = [];
10
+	  $this->currentConnection = null;
11
+	}
12
+	public function addConnection( $_path, $_name = "default" ) {
13
+	  if(!is_string($_path))
14
+		throw new JException("Parameter must be a string.", 1);
15
+	  try {
16
+		$jConfig = new JConfig($_path);
17
+		if($jConfig->enable) {
18
+		  $connection = new Connection($jConfig);
19
+		  $this->addConnectionMan($connection, $_name);
20
+		}
21
+	  } catch (Exception $e) {
22
+		throw new JException($e->getMessage(), 1);
23
+	  }
24
+	}
25
+	public function addConnectionMan( $_connection, $_name = "default") {
26
+	  if(!is_object($_connection) || !is_a($_connection, "Connection"))
27
+		throw new JException("Parameter must be a Connection object.", 1);
28
+	  try {
29
+		$this->connection["$_name"] = $_connection;
30
+		$this->currentConnection = $_connection;
31
+		foreach ($this->modules as &$module)
32
+		  if(isset($this->currentConnection))
33
+			$module->addConnectionMan($this->currentConnection, $_name);
34
+	  } catch (Exception $e) {
35
+		throw new JException($e->getMessage(), 1);
36
+	  }
37
+	}
38
+	public function setConnection( $_name = "default" ) {
39
+	  if(!is_string($_name))
40
+		throw new JException("Parameter must be a string.", 1);
41
+	  if(!isset($this->connection["$_name"]))
42
+		throw new JException("This connection name does not exist.", 1);
43
+	  $this->currentConnection = $this->connection["$_name"];
44
+	}
45
+	public function query( $_query ) {
46
+	  if(!is_string($_query))
47
+		throw new JException("Parameter must be a string.", 1);
48
+	  try {
49
+		$temp = $this->currentConnection->database->query($_query);
50
+	  } catch (Exception $e) {
51
+		throw new JException($e->getMessage(), 1);
52
+	  }
53
+	  return $temp;
54
+	}
55
+	public function queryInsert( $_query ) {
56
+	  if(!is_string($_query))
57
+		throw new JException("Parameter must be a string.", 1);
58
+	  try {
59
+		$temp = $this->currentConnection->database->queryInsert($_query);
60
+	  } catch (Exception $e) {
61
+		throw new JException($e->getMessage(), 1);
62
+	  }
63
+	  return $temp;
64
+	}
65
+	public function queryFetch( $_query ) {
66
+	  if(!is_string($_query))
67
+		throw new JException("Parameter must be a string.", 1);
68
+	  try {
69
+		$temp = $this->currentConnection->database->queryFetch($_query);
70
+	  } catch (Exception $e) {
71
+		throw new JException($e->getMessage(), 1);
72
+	  }
73
+	  return $temp;
74
+	}
75
+	public function queryArray( $_query ) {
76
+	  if(!is_string($_query))
77
+		throw new JException("Parameter must be a string.", 1);
78
+	  try {
79
+		$temp = $this->currentConnection->database->queryArray($_query);
80
+	  } catch (Exception $e) {
81
+		throw new JException($e->getMessage(), 1);
82
+	  }
83
+	  return $temp;
84
+	}
85 85
   }
86 86
 ?>
Please login to merge, or discard this patch.
dist/jate/functions/array.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,51 +1,51 @@
 block discarded – undo
1 1
 <?php
2 2
   function utf8ize($_array) {
3
-    return travelStringArray($_array,"utf8_encode");
3
+	return travelStringArray($_array,"utf8_encode");
4 4
   }
5 5
   function unutf8ize($_array) {
6
-    return travelStringArray($_array,"utf8_decode");
6
+	return travelStringArray($_array,"utf8_decode");
7 7
   }
8 8
   function arraySlash($_array) {
9
-    return travelStringArray($_array,"addslashes");
9
+	return travelStringArray($_array,"addslashes");
10 10
   }
11 11
   function arrayHtmlParser($_array) {
12
-    return travelStringArray($_array,"htmlParser");
12
+	return travelStringArray($_array,"htmlParser");
13 13
   }
14 14
   function travelStringArray ( $_array, $_function ) {
15
-    if (is_array($_array)) {
16
-      foreach ($_array as $k => $v) {
17
-        $_array[$k] = travelStringArray($v, $_function);
18
-      }
19
-    } else if (is_string ($_array)) {
20
-      return call_user_func($_function,$_array);
21
-    }
22
-    return $_array;
15
+	if (is_array($_array)) {
16
+	  foreach ($_array as $k => $v) {
17
+		$_array[$k] = travelStringArray($v, $_function);
18
+	  }
19
+	} else if (is_string ($_array)) {
20
+	  return call_user_func($_function,$_array);
21
+	}
22
+	return $_array;
23 23
   }
24 24
   function arrayDepth( $_array ) {
25
-    $maxDepth = 1;
26
-    foreach ($_array as $value) {
27
-      if (is_array($value)) {
28
-        $depth = arrayDepth($value) + 1;
29
-        if ($depth > $maxDepth) {
30
-          $maxDepth = $depth;
31
-        }
32
-      }
33
-    }
34
-    return $maxDepth;
25
+	$maxDepth = 1;
26
+	foreach ($_array as $value) {
27
+	  if (is_array($value)) {
28
+		$depth = arrayDepth($value) + 1;
29
+		if ($depth > $maxDepth) {
30
+		  $maxDepth = $depth;
31
+		}
32
+	  }
33
+	}
34
+	return $maxDepth;
35 35
   }
36 36
   function arrayDump( $_array, $_name = "Array", $_tab = "&nbsp;&nbsp;" ) {
37
-    $position = preg_replace('/&nbsp;&nbsp;/', '', $_tab, 1);
38
-    echo "$position<span style=\"color:rgb(230,0,0)\">$_name:</span><br>";
39
-    foreach ($_array as $k => $i)
40
-      if(is_array($i))
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>";
37
+	$position = preg_replace('/&nbsp;&nbsp;/', '', $_tab, 1);
38
+	echo "$position<span style=\"color:rgb(230,0,0)\">$_name:</span><br>";
39
+	foreach ($_array as $k => $i)
40
+	  if(is_array($i))
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>";
46 46
   }
47 47
 
48 48
   function htmlParser( $_str) {
49
-    return htmlentities($_str, ENT_QUOTES | ENT_IGNORE, "UTF-8");
49
+	return htmlentities($_str, ENT_QUOTES | ENT_IGNORE, "UTF-8");
50 50
   }
51 51
 ?>
Please login to merge, or discard this patch.