Test Failed
Push — master ( 014002...9a5747 )
by Federico
01:51
created
dist/jate/modules/Statistic/Statistic.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
   jRequire("../Module/Module.php");
3 3
   class Statistic extends Module {
4
-    public function __construct( $_webApp ) {
5
-      parent::__construct();
6
-      $pages = [];
7
-      $stats = [];
8
-      $pages = $_webApp->pages;
9
-      foreach ( $pages as $k => $v ) {
10
-        $temp = new $v[0]($v[1]);
11
-        $temp->addDipendences();
12
-        $stats[$k] = [];
13
-        $stats[$k]["page"]  = $v[0];
14
-        $stats[$k]["css"]    = $temp->data["css"];
15
-        $stats[$k]["js"]    = $temp->data["js"];
16
-      }
17
-      $this->data = $stats;
18
-    }
19
-    public function draw() {
20
-      jBlock();
21
-      foreach ($this->data as $i) {
22
-      ?>
4
+	public function __construct( $_webApp ) {
5
+	  parent::__construct();
6
+	  $pages = [];
7
+	  $stats = [];
8
+	  $pages = $_webApp->pages;
9
+	  foreach ( $pages as $k => $v ) {
10
+		$temp = new $v[0]($v[1]);
11
+		$temp->addDipendences();
12
+		$stats[$k] = [];
13
+		$stats[$k]["page"]  = $v[0];
14
+		$stats[$k]["css"]    = $temp->data["css"];
15
+		$stats[$k]["js"]    = $temp->data["js"];
16
+	  }
17
+	  $this->data = $stats;
18
+	}
19
+	public function draw() {
20
+	  jBlock();
21
+	  foreach ($this->data as $i) {
22
+	  ?>
23 23
         <div class="row">
24 24
           <div class="col-lg-12">
25 25
             Page: <?=$i["page"]?><br>
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
           </div>
29 29
         </div>
30 30
       <?php
31
-      }
32
-      return jBlockEnd();
33
-    }
31
+	  }
32
+	  return jBlockEnd();
33
+	}
34 34
   }
35 35
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/WebApp/WebApp.php 1 patch
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -1,90 +1,90 @@
 block discarded – undo
1 1
 <?php
2 2
   jRequire("../Module/Module.php");
3 3
   class WebApp extends Module {
4
-    protected $pages;
5
-    protected $defaultPage;
6
-    public $currentPage;
7
-    public $jConfig;
8
-    public function __construct() {
9
-      parent::__construct();
10
-      $this->pages = [];
11
-      $this->defaultPage = ["Page404",[]];
12
-      $this->currentPage = null;
13
-      $this->jConfig     = null;
14
-    }
15
-    public function addPage( $_page ) {
16
-      $param = [];
17
-      $path  = $_page;
18
-      $class = $_page;
19
-      if(is_array($_page)) {
20
-        $path  = $_page[0];
21
-        $class = $_page[1];
22
-        if(isset($_page[2]))
23
-          $param = $_page[2];
24
-      }
25
-      $this->pages[$path] = [$class, $param];
26
-      return $this->pages[$path];
27
-    }
28
-    public function addPages( $_pages ) {
29
-      foreach ($_pages as $i)
30
-        $this->addPage($i);
31
-    }
32
-    public function fetchPage() {
33
-      $router = new Router();
34
-      $router->parameters = [ "app" => &$this->jConfig, "page" => null];
35
-      $stack = $router->getPage();
36
-      $parameters = [];
37
-      $temp = $this->defaultPage;
38
-      foreach ($this->pages as $key => $value) {
39
-        $variables = $this->pathSeeker(explode("/", $key), $stack);
40
-        if(is_array($variables)) {
41
-          $temp = $value;
42
-          $parameters = $variables;
43
-          break;
44
-        }
45
-      }
46
-      if( isset($temp[1]) && is_array($temp[1]) )
47
-        $temp[1] = array_merge($temp[1], $parameters);
48
-      else
49
-        $temp[1] = $parameters;
50
-      $this->currentPage = new $temp[0](["app" => $this->jConfig, "page" => $temp[1]]);
51
-      return $this->currentPage;
52
-    }
53
-    public function setDefaultPage( $_page ) {
54
-      $this->defaultPage = $this->addPage($_page);
55
-    }
56
-    public function draw() {
57
-      $this->currentPage->uniforma();
58
-      $gui = new GUI();
59
-      $gui->init($this->currentPage);
60
-      $gui->draw($this->currentPage->data["template"]);
61
-    }
62
-    public function pathSeeker( $_path, $_url ) {
63
-      $urlLength = count($_url);
64
-      $cont = 0;
65
-      $variables = [];
66
-      $pathLength = count($_path);
67
-      if($urlLength == $pathLength) {
68
-        while($cont < $urlLength) {
69
-          if(
70
-            ($this->jConfig->urlCaseSensitive && $_path[$cont] == $_url[$cont]) ||
71
-            (!$this->jConfig->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) )
72
-            $cont++;
73
-          else if( strpos($_path[$cont], "\$") !== false ) {
74
-            $variables[str_replace('$', "", $_path[$cont])] = $_url[$cont];
75
-            $cont++;
76
-          } else break;
77
-        }
78
-        if($cont == $urlLength)
79
-          return $variables;
80
-      }
81
-      return null;
82
-    }
83
-    public function newConfig( $_path = "config/") {
84
-      $this->jConfig = new JConfig();
85
-      $this->jConfig->import("${_path}connection.json","connection");
86
-      $this->jConfig->import("${_path}misc.json");
87
-      $this->jConfig->import("${_path}router.json");
88
-    }
4
+	protected $pages;
5
+	protected $defaultPage;
6
+	public $currentPage;
7
+	public $jConfig;
8
+	public function __construct() {
9
+	  parent::__construct();
10
+	  $this->pages = [];
11
+	  $this->defaultPage = ["Page404",[]];
12
+	  $this->currentPage = null;
13
+	  $this->jConfig     = null;
14
+	}
15
+	public function addPage( $_page ) {
16
+	  $param = [];
17
+	  $path  = $_page;
18
+	  $class = $_page;
19
+	  if(is_array($_page)) {
20
+		$path  = $_page[0];
21
+		$class = $_page[1];
22
+		if(isset($_page[2]))
23
+		  $param = $_page[2];
24
+	  }
25
+	  $this->pages[$path] = [$class, $param];
26
+	  return $this->pages[$path];
27
+	}
28
+	public function addPages( $_pages ) {
29
+	  foreach ($_pages as $i)
30
+		$this->addPage($i);
31
+	}
32
+	public function fetchPage() {
33
+	  $router = new Router();
34
+	  $router->parameters = [ "app" => &$this->jConfig, "page" => null];
35
+	  $stack = $router->getPage();
36
+	  $parameters = [];
37
+	  $temp = $this->defaultPage;
38
+	  foreach ($this->pages as $key => $value) {
39
+		$variables = $this->pathSeeker(explode("/", $key), $stack);
40
+		if(is_array($variables)) {
41
+		  $temp = $value;
42
+		  $parameters = $variables;
43
+		  break;
44
+		}
45
+	  }
46
+	  if( isset($temp[1]) && is_array($temp[1]) )
47
+		$temp[1] = array_merge($temp[1], $parameters);
48
+	  else
49
+		$temp[1] = $parameters;
50
+	  $this->currentPage = new $temp[0](["app" => $this->jConfig, "page" => $temp[1]]);
51
+	  return $this->currentPage;
52
+	}
53
+	public function setDefaultPage( $_page ) {
54
+	  $this->defaultPage = $this->addPage($_page);
55
+	}
56
+	public function draw() {
57
+	  $this->currentPage->uniforma();
58
+	  $gui = new GUI();
59
+	  $gui->init($this->currentPage);
60
+	  $gui->draw($this->currentPage->data["template"]);
61
+	}
62
+	public function pathSeeker( $_path, $_url ) {
63
+	  $urlLength = count($_url);
64
+	  $cont = 0;
65
+	  $variables = [];
66
+	  $pathLength = count($_path);
67
+	  if($urlLength == $pathLength) {
68
+		while($cont < $urlLength) {
69
+		  if(
70
+			($this->jConfig->urlCaseSensitive && $_path[$cont] == $_url[$cont]) ||
71
+			(!$this->jConfig->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) )
72
+			$cont++;
73
+		  else if( strpos($_path[$cont], "\$") !== false ) {
74
+			$variables[str_replace('$', "", $_path[$cont])] = $_url[$cont];
75
+			$cont++;
76
+		  } else break;
77
+		}
78
+		if($cont == $urlLength)
79
+		  return $variables;
80
+	  }
81
+	  return null;
82
+	}
83
+	public function newConfig( $_path = "config/") {
84
+	  $this->jConfig = new JConfig();
85
+	  $this->jConfig->import("${_path}connection.json","connection");
86
+	  $this->jConfig->import("${_path}misc.json");
87
+	  $this->jConfig->import("${_path}router.json");
88
+	}
89 89
   }
90 90
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Module/Module.php 1 patch
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -1,96 +1,96 @@
 block discarded – undo
1 1
 <?php
2 2
   class Module {
3
-    public $name;
4
-    public $modules;
5
-    public $files;
6
-    public $required;
7
-    public $data;
8
-    public $tags;
9
-    public $connection;
10
-    public $parameters;
11
-    public function __construct() {
12
-      $this->name        = get_class($this);
13
-      $this->modules    = [];
14
-      $this->files      = [];
15
-      $this->required    = [];
16
-      $this->data        = [];
17
-      $this->tags        = [];
18
-      $this->connection  = null;
19
-      $this->parameters = null;
20
-    }
21
-    // abstract public function config();
22
-    // abstract public function init();
23
-    // abstract public function draw();
24
-    public function getCss() {
25
-      return $this->getRequire("getCss",".css");
26
-    }
27
-    public function getJs() {
28
-      return $this->getRequire("getJs",".js");
29
-    }
30
-    public function getJsVariables() {
31
-      $temp = [];
32
-      foreach ($this->required as $i)
33
-        if (is_array($i))
34
-          array_push($temp,$i);
35
-      foreach ($this->modules as $i)
36
-        $temp = array_merge( $temp, $i->getJsVariables() );
37
-      foreach ($this->files as $i)
38
-        if (is_array($i))
39
-          array_push($temp,$i);
40
-      return $temp;
41
-    }
42
-    public function addModules( $_mods ) {
43
-      if(!is_array($_mods))
44
-        throw new InvalidArgumentException("Parameter must be an array.");
45
-      foreach ($_mods as $value)
46
-        $this->addModule($value);
47
-    }
48
-    public function addModule( $_mod ) {
49
-      if(!is_object($_mod))
50
-        throw new InvalidArgumentException("Parameter must be a class.");
51
-      if(! is_subclass_of ($_mod, "Module"))
52
-        throw new InvalidArgumentException("Parameter must be a class.");
53
-      $this->modules[$_mod->name] = $_mod;
54
-      $this->modules[$_mod->name]->parameters = &$this->parameters;
55
-    }
56
-    public function addFiles( $_files ) {
57
-      if(!is_array($_files))
58
-        throw new InvalidArgumentException("Parameter must be an array.");
59
-      foreach ($_files as $value)
60
-        $this->addFile($value);
61
-    }
62
-    public function addFile( $_file ) {
63
-      if(!(is_string($_file) || is_array($_file)))
64
-        throw new InvalidArgumentException("Parameter must be a string or an array.");
65
-      array_push($this->files, $_file);
66
-    }
67
-    public function addFilesRequired( $_files ) {
68
-      if(!is_array($_files))
69
-        throw new InvalidArgumentException("Parameter must be an array.");
70
-      foreach ($_files as $value)
71
-        $this->addFileRequired($value);
72
-    }
73
-    public function addFileRequired( $_file ) {
74
-      if(!is_string($_file))
75
-        throw new InvalidArgumentException("Parameter must be a string.");
76
-      array_push($this->required, $_file);
77
-    }
78
-    protected function addDipendences() {
79
-      $this->tags["css"] = $this->getCss();
80
-      $this->tags["js"] = $this->getJs();
81
-      $this->tags["jsVariables"] = $this->getJsVariables();
82
-    }
83
-    protected function getRequire( $_function, $_extenction) {
84
-      $temp = [];
85
-      foreach ($this->required as $i)
86
-        if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
87
-          array_push($temp,$i);
88
-      foreach ($this->modules as $i)
89
-        $temp = array_merge( $temp, $i->$_function() );
90
-      foreach ($this->files as $i)
91
-        if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
92
-          array_push($temp,$i);
93
-      return $temp;
94
-    }
3
+	public $name;
4
+	public $modules;
5
+	public $files;
6
+	public $required;
7
+	public $data;
8
+	public $tags;
9
+	public $connection;
10
+	public $parameters;
11
+	public function __construct() {
12
+	  $this->name        = get_class($this);
13
+	  $this->modules    = [];
14
+	  $this->files      = [];
15
+	  $this->required    = [];
16
+	  $this->data        = [];
17
+	  $this->tags        = [];
18
+	  $this->connection  = null;
19
+	  $this->parameters = null;
20
+	}
21
+	// abstract public function config();
22
+	// abstract public function init();
23
+	// abstract public function draw();
24
+	public function getCss() {
25
+	  return $this->getRequire("getCss",".css");
26
+	}
27
+	public function getJs() {
28
+	  return $this->getRequire("getJs",".js");
29
+	}
30
+	public function getJsVariables() {
31
+	  $temp = [];
32
+	  foreach ($this->required as $i)
33
+		if (is_array($i))
34
+		  array_push($temp,$i);
35
+	  foreach ($this->modules as $i)
36
+		$temp = array_merge( $temp, $i->getJsVariables() );
37
+	  foreach ($this->files as $i)
38
+		if (is_array($i))
39
+		  array_push($temp,$i);
40
+	  return $temp;
41
+	}
42
+	public function addModules( $_mods ) {
43
+	  if(!is_array($_mods))
44
+		throw new InvalidArgumentException("Parameter must be an array.");
45
+	  foreach ($_mods as $value)
46
+		$this->addModule($value);
47
+	}
48
+	public function addModule( $_mod ) {
49
+	  if(!is_object($_mod))
50
+		throw new InvalidArgumentException("Parameter must be a class.");
51
+	  if(! is_subclass_of ($_mod, "Module"))
52
+		throw new InvalidArgumentException("Parameter must be a class.");
53
+	  $this->modules[$_mod->name] = $_mod;
54
+	  $this->modules[$_mod->name]->parameters = &$this->parameters;
55
+	}
56
+	public function addFiles( $_files ) {
57
+	  if(!is_array($_files))
58
+		throw new InvalidArgumentException("Parameter must be an array.");
59
+	  foreach ($_files as $value)
60
+		$this->addFile($value);
61
+	}
62
+	public function addFile( $_file ) {
63
+	  if(!(is_string($_file) || is_array($_file)))
64
+		throw new InvalidArgumentException("Parameter must be a string or an array.");
65
+	  array_push($this->files, $_file);
66
+	}
67
+	public function addFilesRequired( $_files ) {
68
+	  if(!is_array($_files))
69
+		throw new InvalidArgumentException("Parameter must be an array.");
70
+	  foreach ($_files as $value)
71
+		$this->addFileRequired($value);
72
+	}
73
+	public function addFileRequired( $_file ) {
74
+	  if(!is_string($_file))
75
+		throw new InvalidArgumentException("Parameter must be a string.");
76
+	  array_push($this->required, $_file);
77
+	}
78
+	protected function addDipendences() {
79
+	  $this->tags["css"] = $this->getCss();
80
+	  $this->tags["js"] = $this->getJs();
81
+	  $this->tags["jsVariables"] = $this->getJsVariables();
82
+	}
83
+	protected function getRequire( $_function, $_extenction) {
84
+	  $temp = [];
85
+	  foreach ($this->required as $i)
86
+		if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
87
+		  array_push($temp,$i);
88
+	  foreach ($this->modules as $i)
89
+		$temp = array_merge( $temp, $i->$_function() );
90
+	  foreach ($this->files as $i)
91
+		if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
92
+		  array_push($temp,$i);
93
+	  return $temp;
94
+	}
95 95
   }
96 96
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/GUI/GUI.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -3,48 +3,48 @@
 block discarded – undo
3 3
   jRequire("../Pug/Pug.php");
4 4
   jRequire("../Twig/Twig.php");
5 5
   class GUI extends Module {
6
-    public function __construct() {
7
-      parent::__construct();
8
-    }
9
-    public function init( $_page ) {
10
-      $this->tags = $_page->tags;
11
-    }
12
-    public function draw( $_template ) {
13
-      $page = "";
14
-      $extension = explode(".",$_template);
15
-      $extension = $extension[count($extension)-1];
16
-      $page = $this->parsingFile($_template, $extension);
17
-      $render = $this->overlayTag($page);
18
-      echo minifyOutput($render);
19
-    }
20
-    protected function overlayTag( $_page ) {
21
-      foreach($this->tags as $key => $value)
22
-        if(!is_array($value))
23
-          $_page = str_replace("<_${key}_>", "$value", $_page);
24
-      return $_page;
25
-    }
26
-    protected function parsingFile( $_file, $_type = "html" ) {
27
-      switch ($_type) {
28
-        case 'pug':
29
-        case 'jade':
30
-          $pug = new Pug();
31
-          $page = $pug->drawFile($_file);
32
-        break;
33
-        case "md":
34
-        case "markdown":
35
-        case "parsedown":
36
-          $Parsedown = new Parsedown();
37
-          $page = $Parsedown->drawFile($_file);
38
-        break;
39
-        case 'twig':
40
-          $twig = new Twig();
41
-          $page = $twig->drawFile($_file);
42
-        break;
43
-        default:
44
-          $page = file_get_contents($_file);
45
-        break;
46
-      }
47
-      return $page;
48
-    }
6
+	public function __construct() {
7
+	  parent::__construct();
8
+	}
9
+	public function init( $_page ) {
10
+	  $this->tags = $_page->tags;
11
+	}
12
+	public function draw( $_template ) {
13
+	  $page = "";
14
+	  $extension = explode(".",$_template);
15
+	  $extension = $extension[count($extension)-1];
16
+	  $page = $this->parsingFile($_template, $extension);
17
+	  $render = $this->overlayTag($page);
18
+	  echo minifyOutput($render);
19
+	}
20
+	protected function overlayTag( $_page ) {
21
+	  foreach($this->tags as $key => $value)
22
+		if(!is_array($value))
23
+		  $_page = str_replace("<_${key}_>", "$value", $_page);
24
+	  return $_page;
25
+	}
26
+	protected function parsingFile( $_file, $_type = "html" ) {
27
+	  switch ($_type) {
28
+		case 'pug':
29
+		case 'jade':
30
+		  $pug = new Pug();
31
+		  $page = $pug->drawFile($_file);
32
+		break;
33
+		case "md":
34
+		case "markdown":
35
+		case "parsedown":
36
+		  $Parsedown = new Parsedown();
37
+		  $page = $Parsedown->drawFile($_file);
38
+		break;
39
+		case 'twig':
40
+		  $twig = new Twig();
41
+		  $page = $twig->drawFile($_file);
42
+		break;
43
+		default:
44
+		  $page = file_get_contents($_file);
45
+		break;
46
+	  }
47
+	  return $page;
48
+	}
49 49
   }
50 50
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Twig/Twig.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -2,25 +2,25 @@
 block discarded – undo
2 2
   // use Twig as Twig;
3 3
   jRequire("../Module/Module.php");
4 4
   class Twig extends Module {
5
-    public function __construct() {
6
-      parent::__construct();
7
-    }
8
-    public function drawFile( $_file, $_parameters = [] ) {
9
-      $loader  = new Twig_Loader_Filesystem('bundles/views');
10
-      $twig    = new Twig_Environment( $loader, [
11
-        'cache' => 'bundles/views',
12
-      ]);
13
-      $template = $twig->loadTemplate($_text);
14
-      $page = $template->render($_parameters);
15
-      return $page;
16
-    }
17
-    public function drawText( $_text, $_parameters = [] ) {
18
-      $loader = new Twig_Loader_Array([
19
-        'index' => $_text
20
-      ]);
21
-      $twig = new Twig_Environment($loader);
22
-      $page = $twig->render('index', $_parameters);
23
-      return $page;
24
-    }
5
+	public function __construct() {
6
+	  parent::__construct();
7
+	}
8
+	public function drawFile( $_file, $_parameters = [] ) {
9
+	  $loader  = new Twig_Loader_Filesystem('bundles/views');
10
+	  $twig    = new Twig_Environment( $loader, [
11
+		'cache' => 'bundles/views',
12
+	  ]);
13
+	  $template = $twig->loadTemplate($_text);
14
+	  $page = $template->render($_parameters);
15
+	  return $page;
16
+	}
17
+	public function drawText( $_text, $_parameters = [] ) {
18
+	  $loader = new Twig_Loader_Array([
19
+		'index' => $_text
20
+	  ]);
21
+	  $twig = new Twig_Environment($loader);
22
+	  $page = $twig->render('index', $_parameters);
23
+	  return $page;
24
+	}
25 25
   }
26 26
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Adapters/ConnectionInterface.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
   interface ConnectionAdapterInterface {
3
-    public function __construct( $_srv, $_db, $_usr, $_pass);
4
-    public function query( $_query );
5
-    public function queryFetch( $_query );
6
-    public function queryArray( $_query );
7
-    public function queryInsert( $_query );
3
+	public function __construct( $_srv, $_db, $_usr, $_pass);
4
+	public function query( $_query );
5
+	public function queryFetch( $_query );
6
+	public function queryArray( $_query );
7
+	public function queryInsert( $_query );
8 8
   }
9 9
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Router/Router.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2 2
   jRequire("../Module/Module.php");
3 3
   class Router extends Module {
4
-    public function __construct() {
5
-      parent::__construct();
6
-    }
7
-    public function getPage() {
8
-      $request  = $this->parameters["app"]->server["REQUEST_URI"];
9
-      $base      = $this->parameters["app"]->server["RELATIVE"];
10
-      $url      = str_replace($base, "", $request);
11
-      $url      = explode("/", $url);
12
-      return $url;
13
-    }
4
+	public function __construct() {
5
+	  parent::__construct();
6
+	}
7
+	public function getPage() {
8
+	  $request  = $this->parameters["app"]->server["REQUEST_URI"];
9
+	  $base      = $this->parameters["app"]->server["RELATIVE"];
10
+	  $url      = str_replace($base, "", $request);
11
+	  $url      = explode("/", $url);
12
+	  return $url;
13
+	}
14 14
   }
15 15
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Html/Html.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -1,49 +1,49 @@
 block discarded – undo
1 1
 <?php
2 2
   requireComponent("../Query/Query.php");
3 3
   class Html extends Query {
4
-    public function __construct( $_parameters = [ "app" => null, "page" => null] ) {
5
-      parent::__construct();
6
-      $this->data["template"]          = "";
7
-      $this->tags["brand"]            = "";
8
-      $this->tags["brandImg"]          = "";
9
-      $this->tags["menu"]              = "";
10
-      $this->tags["title"]            = "";
11
-      $this->tags["subtitle"]           = "";
12
-      $this->tags["content"]           = "";
13
-      $this->tags["outContent"]         = "";
14
-      $this->tags["footer"]             = "";
15
-      $this->tags["pagePath"]           = [];
16
-      $this->tags["css"]              = [];
17
-      $this->tags["js"]                 = [];
18
-      $this->tags["jsVariables"]      = [];
19
-      $this->tags["metaDescription"]  = [];
20
-      $this->tags["metaKeywords"]      = [];
21
-      $this->tags["metaAuthor"]        = [];
22
-      $this->parameters                = $_parameters;
23
-      $this->tags["base"]              = $_parameters["app"]->server["RELATIVE"]."/";
24
-    }
25
-    public function uniforma() {
26
-      $this->addDipendences();
27
-      $this->tags["css"]      = array_unique($this->tags["css"]);
28
-      $this->tags["js"]        = array_unique($this->tags["js"]);
29
-      $this->tags["pagePath"]  = json_encode($this->tags["pagePath"]);
30
-      $tempStr = "";
31
-      $timeParameter = "?t=".time();
32
-      $time = ($this->parameters["app"]->cache->css == true) ? "" : $timeParameter;
33
-      foreach ($this->tags["css"] as $i)
34
-        $tempStr .= "<link rel='stylesheet' href='$i$time'>";
35
-      $this->tags["css"] = $tempStr;
36
-      $tempStr = "";
37
-      $time = ($this->parameters["app"]->cache->js == true) ? "" : $timeParameter;
38
-      foreach ($this->tags["js"] as $i)
39
-        $tempStr .= "<script src='$i$time'></script>";
40
-      $this->tags["js"] = $tempStr;
41
-      $tempStr = "";
42
-      $tempStr .= "<script type='text/javascript'>";
43
-      foreach ($this->tags["jsVariables"] as $i)
44
-        $tempStr .= " $i[0] = $i[1];\n";
45
-      $tempStr .= "</script>";
46
-      $this->tags["jsVariables"] = $tempStr;
47
-    }
4
+	public function __construct( $_parameters = [ "app" => null, "page" => null] ) {
5
+	  parent::__construct();
6
+	  $this->data["template"]          = "";
7
+	  $this->tags["brand"]            = "";
8
+	  $this->tags["brandImg"]          = "";
9
+	  $this->tags["menu"]              = "";
10
+	  $this->tags["title"]            = "";
11
+	  $this->tags["subtitle"]           = "";
12
+	  $this->tags["content"]           = "";
13
+	  $this->tags["outContent"]         = "";
14
+	  $this->tags["footer"]             = "";
15
+	  $this->tags["pagePath"]           = [];
16
+	  $this->tags["css"]              = [];
17
+	  $this->tags["js"]                 = [];
18
+	  $this->tags["jsVariables"]      = [];
19
+	  $this->tags["metaDescription"]  = [];
20
+	  $this->tags["metaKeywords"]      = [];
21
+	  $this->tags["metaAuthor"]        = [];
22
+	  $this->parameters                = $_parameters;
23
+	  $this->tags["base"]              = $_parameters["app"]->server["RELATIVE"]."/";
24
+	}
25
+	public function uniforma() {
26
+	  $this->addDipendences();
27
+	  $this->tags["css"]      = array_unique($this->tags["css"]);
28
+	  $this->tags["js"]        = array_unique($this->tags["js"]);
29
+	  $this->tags["pagePath"]  = json_encode($this->tags["pagePath"]);
30
+	  $tempStr = "";
31
+	  $timeParameter = "?t=".time();
32
+	  $time = ($this->parameters["app"]->cache->css == true) ? "" : $timeParameter;
33
+	  foreach ($this->tags["css"] as $i)
34
+		$tempStr .= "<link rel='stylesheet' href='$i$time'>";
35
+	  $this->tags["css"] = $tempStr;
36
+	  $tempStr = "";
37
+	  $time = ($this->parameters["app"]->cache->js == true) ? "" : $timeParameter;
38
+	  foreach ($this->tags["js"] as $i)
39
+		$tempStr .= "<script src='$i$time'></script>";
40
+	  $this->tags["js"] = $tempStr;
41
+	  $tempStr = "";
42
+	  $tempStr .= "<script type='text/javascript'>";
43
+	  foreach ($this->tags["jsVariables"] as $i)
44
+		$tempStr .= " $i[0] = $i[1];\n";
45
+	  $tempStr .= "</script>";
46
+	  $this->tags["jsVariables"] = $tempStr;
47
+	}
48 48
   }
49 49
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Menu/Menu.php 1 patch
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -1,89 +1,89 @@
 block discarded – undo
1 1
 <?php
2 2
   jRequire("../Query/Query.php");
3 3
   class Menu extends Query {
4
-    public function __construct() {
5
-      parent::__construct();
6
-    }
7
-    public function init() {
8
-      $menu = $this->queryFetch("SELECT * FROM menu WHERE flag_active = 1 ORDER BY `order`");
9
-      $temp = [];
10
-      foreach ($menu as $i) {
11
-        if($i["fk_menu"] == 0) {
12
-          $pk_menu = $i["pk_menu"];
13
-          array_push($temp, array("label" => $i["label"], "link" => $i["link"], "submenu" => [], "relative" => false));
14
-          $submenu = $this->queryFetch("SELECT * FROM menu WHERE fk_menu = $pk_menu ORDER BY `order`");
15
-          if($submenu)
16
-          foreach ($submenu as $j)
17
-            array_push( $temp[count($temp)-1]["submenu"], array("label" => $j["label"], "link" => $j["link"], "submenu" => [], "relative" => false) );
18
-        }
19
-      }
20
-      $this->tags["menu"] = $temp;
21
-      return $temp;
22
-    }
23
-    public function draw() {
24
-      $temp = "";
25
-      $host = $this->parameters["app"]->server["HTTP_HOST"];
26
-      $uri  = $this->parameters["app"]->server["REQUEST_URI"];
27
-      $actualLink  = "http://$host$uri";
28
-      $relative    = $this->parameters["app"]->server["RELATIVE"];
29
-      foreach ($this->tags["menu"] as $i) {
30
-        $prePath = "";
31
-        if($i["relative"])
32
-          $prePath = $relative;
33
-        $active = $this->isSubString($actualLink, array_merge(array_column($i["submenu"], 'link'), array($i["link"]))) ? "active" : "";
34
-        if( is_array($i["submenu"]) && count($i["submenu"])<1)
35
-            $temp .= "<li class='$active'><a href='$prePath$i[link]'>$i[label]</a></li>";
36
-        else {
37
-          $temp .= "<li class='dropdown $active'>";
38
-          $temp .=
39
-            '<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'.
40
-            $i["label"].
41
-            '<span class="caret"></span>'.
42
-            '</a>'.
43
-            '<ul class="dropdown-menu">';
44
-          foreach ($i["submenu"] as $j) {
45
-            $prePath = "";
46
-            if($j["relative"])
47
-              $prePath = $relative;
48
-            $temp .= "<li><a href='$prePath$j[link]'>$j[label]</a></li>";
49
-          }
50
-          $temp .= "</ul></li>";
51
-        }
52
-      }
53
-      return $temp;
54
-    }
55
-    protected function isSubString( $_string, $_list) {
56
-      $success = false;
57
-      foreach ($_list as $i)
58
-        if(strpos($_string,$i) !== false)
59
-          $success = true;
60
-      return $success;
61
-    }
62
-    public function loginWithUser() {
63
-      $this->init();
64
-      $temp = [];
65
-      if(!isset($_SESSION["username"]))
66
-        $_SESSION["username"] ="guest";
67
-      $user = $_SESSION["username"];
68
-      $blackList = $this->queryFetch(
69
-        "SELECT user.*,user_section.*
4
+	public function __construct() {
5
+	  parent::__construct();
6
+	}
7
+	public function init() {
8
+	  $menu = $this->queryFetch("SELECT * FROM menu WHERE flag_active = 1 ORDER BY `order`");
9
+	  $temp = [];
10
+	  foreach ($menu as $i) {
11
+		if($i["fk_menu"] == 0) {
12
+		  $pk_menu = $i["pk_menu"];
13
+		  array_push($temp, array("label" => $i["label"], "link" => $i["link"], "submenu" => [], "relative" => false));
14
+		  $submenu = $this->queryFetch("SELECT * FROM menu WHERE fk_menu = $pk_menu ORDER BY `order`");
15
+		  if($submenu)
16
+		  foreach ($submenu as $j)
17
+			array_push( $temp[count($temp)-1]["submenu"], array("label" => $j["label"], "link" => $j["link"], "submenu" => [], "relative" => false) );
18
+		}
19
+	  }
20
+	  $this->tags["menu"] = $temp;
21
+	  return $temp;
22
+	}
23
+	public function draw() {
24
+	  $temp = "";
25
+	  $host = $this->parameters["app"]->server["HTTP_HOST"];
26
+	  $uri  = $this->parameters["app"]->server["REQUEST_URI"];
27
+	  $actualLink  = "http://$host$uri";
28
+	  $relative    = $this->parameters["app"]->server["RELATIVE"];
29
+	  foreach ($this->tags["menu"] as $i) {
30
+		$prePath = "";
31
+		if($i["relative"])
32
+		  $prePath = $relative;
33
+		$active = $this->isSubString($actualLink, array_merge(array_column($i["submenu"], 'link'), array($i["link"]))) ? "active" : "";
34
+		if( is_array($i["submenu"]) && count($i["submenu"])<1)
35
+			$temp .= "<li class='$active'><a href='$prePath$i[link]'>$i[label]</a></li>";
36
+		else {
37
+		  $temp .= "<li class='dropdown $active'>";
38
+		  $temp .=
39
+			'<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'.
40
+			$i["label"].
41
+			'<span class="caret"></span>'.
42
+			'</a>'.
43
+			'<ul class="dropdown-menu">';
44
+		  foreach ($i["submenu"] as $j) {
45
+			$prePath = "";
46
+			if($j["relative"])
47
+			  $prePath = $relative;
48
+			$temp .= "<li><a href='$prePath$j[link]'>$j[label]</a></li>";
49
+		  }
50
+		  $temp .= "</ul></li>";
51
+		}
52
+	  }
53
+	  return $temp;
54
+	}
55
+	protected function isSubString( $_string, $_list) {
56
+	  $success = false;
57
+	  foreach ($_list as $i)
58
+		if(strpos($_string,$i) !== false)
59
+		  $success = true;
60
+	  return $success;
61
+	}
62
+	public function loginWithUser() {
63
+	  $this->init();
64
+	  $temp = [];
65
+	  if(!isset($_SESSION["username"]))
66
+		$_SESSION["username"] ="guest";
67
+	  $user = $_SESSION["username"];
68
+	  $blackList = $this->queryFetch(
69
+		"SELECT user.*,user_section.*
70 70
         FROM user
71 71
         INNER JOIN user_x_section
72 72
         ON user.pk_user = user_x_section.fk_user
73 73
         INNER JOIN user_section
74 74
         ON user_section.pk_user_section = user_x_section.fk_user_section
75 75
         WHERE user.username = '$user'"
76
-      );
77
-      foreach ($this->tags["menu"] as $i) {
78
-        $success = true;
79
-        $k = $i["label"];
80
-        foreach ($blackList as $j)
81
-          if( $j["section"] == $k)
82
-            $success = false;
83
-        if($success)
84
-          array_push($temp,$i);
85
-      }
86
-      $this->tags["menu"] = $temp;
87
-    }
76
+	  );
77
+	  foreach ($this->tags["menu"] as $i) {
78
+		$success = true;
79
+		$k = $i["label"];
80
+		foreach ($blackList as $j)
81
+		  if( $j["section"] == $k)
82
+			$success = false;
83
+		if($success)
84
+		  array_push($temp,$i);
85
+	  }
86
+	  $this->tags["menu"] = $temp;
87
+	}
88 88
   }
89 89
 ?>
Please login to merge, or discard this patch.