@@ -5,16 +5,16 @@ |
||
5 | 5 | public function __construct() { |
6 | 6 | parent::__construct(); |
7 | 7 | } |
8 | - public function drawFile( $_file, $_parameters = [] ) { |
|
9 | - $loader = new Twig_Loader_Filesystem('bundles/views'); |
|
10 | - $twig = new Twig_Environment( $loader, [ |
|
8 | + public function drawFile($_file, $_parameters = []) { |
|
9 | + $loader = new Twig_Loader_Filesystem('bundles/views'); |
|
10 | + $twig = new Twig_Environment($loader, [ |
|
11 | 11 | 'cache' => 'bundles/views', |
12 | 12 | ]); |
13 | 13 | $template = $twig->loadTemplate($_text); |
14 | 14 | $page = $template->render($_parameters); |
15 | 15 | return $page; |
16 | 16 | } |
17 | - public function drawText( $_text, $_parameters = [] ) { |
|
17 | + public function drawText($_text, $_parameters = []) { |
|
18 | 18 | $loader = new Twig_Loader_Array([ |
19 | 19 | 'index' => $_text |
20 | 20 | ]); |
@@ -5,13 +5,13 @@ |
||
5 | 5 | public function __construct() { |
6 | 6 | parent::__construct(); |
7 | 7 | } |
8 | - public function drawFile( $_file, $_parameters = [] ) { |
|
8 | + public function drawFile($_file, $_parameters = []) { |
|
9 | 9 | return $this->draw($_file, $_parameters); |
10 | 10 | } |
11 | - public function drawText( $_text, $_parameters = [] ) { |
|
11 | + public function drawText($_text, $_parameters = []) { |
|
12 | 12 | return $this->draw(trim($_text), $_parameters); |
13 | 13 | } |
14 | - public function draw( $_text, $_parameters = [] ) { |
|
14 | + public function draw($_text, $_parameters = []) { |
|
15 | 15 | $pug = new Pug\Pug(); |
16 | 16 | $page = $pug->render($_text, $_parameters); |
17 | 17 | return $page; |
@@ -5,28 +5,28 @@ discard block |
||
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 | $extension = explode(".", $_path); |
14 | - $extension = $extension[count($extension)-1]; |
|
14 | + $extension = $extension[count($extension) - 1]; |
|
15 | 15 | $extension = strtolower($extension); |
16 | 16 | return jBlockFileMan($_path, $extension, $_parameters); |
17 | 17 | } |
18 | 18 | |
19 | - function jBlockFileMan( $_path, $_type, $_parameters = [] ) { |
|
19 | + function jBlockFileMan($_path, $_type, $_parameters = []) { |
|
20 | 20 | $temp = file_get_contents($_path); |
21 | 21 | return jBlockParsing($_type, $temp, $_parameters); |
22 | 22 | } |
23 | 23 | |
24 | - function jBlockEnd( $_type = "html", $_parameters = [] ) { |
|
24 | + function jBlockEnd($_type = "html", $_parameters = []) { |
|
25 | 25 | $text = ob_get_clean(); |
26 | 26 | return jBlockParsing($_type, $text, $_parameters); |
27 | 27 | } |
28 | 28 | |
29 | - function jBlockParsing( $_type = "html", $_string = "", $_parameters = [] ) { |
|
29 | + function jBlockParsing($_type = "html", $_string = "", $_parameters = []) { |
|
30 | 30 | switch ($_type) { |
31 | 31 | case "pug": |
32 | 32 | case "jade": |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | function minifyOutput($_buffer) { |
52 | - $search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' ); |
|
53 | - $replace = array ( '>', '<', '\\1' ); |
|
54 | - if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) |
|
52 | + $search = array('/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s'); |
|
53 | + $replace = array('>', '<', '\\1'); |
|
54 | + if (preg_match("/\<html/i", $_buffer) == 1 && preg_match("/\<\/html\>/i", $_buffer) == 1) |
|
55 | 55 | $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
56 | 56 | return utf8_encode($_buffer); |
57 | 57 | } |
@@ -1,18 +1,18 @@ |
||
1 | 1 | <?php |
2 | 2 | jRequire("../Module/Module.php"); |
3 | 3 | class Statistic extends Module { |
4 | - public function __construct( $_webApp ) { |
|
4 | + public function __construct($_webApp) { |
|
5 | 5 | parent::__construct(); |
6 | 6 | $pages = []; |
7 | 7 | $stats = []; |
8 | 8 | $pages = $_webApp->pages; |
9 | - foreach ( $pages as $k => $v ) { |
|
9 | + foreach ($pages as $k => $v) { |
|
10 | 10 | $temp = new $v[0]($v[1]); |
11 | 11 | $temp->addDipendences(); |
12 | 12 | $stats[$k] = []; |
13 | 13 | $stats[$k]["page"] = $v[0]; |
14 | 14 | $stats[$k]["css"] = $temp->data["css"]; |
15 | - $stats[$k]["js"] = $temp->data["js"]; |
|
15 | + $stats[$k]["js"] = $temp->data["js"]; |
|
16 | 16 | } |
17 | 17 | $this->data = $stats; |
18 | 18 | } |
@@ -6,46 +6,46 @@ |
||
6 | 6 | public $pages; |
7 | 7 | public $server; |
8 | 8 | public function __construct() { |
9 | - $this->connection["enable"] = false; |
|
10 | - $this->connection["user"] = ""; |
|
9 | + $this->connection["enable"] = false; |
|
10 | + $this->connection["user"] = ""; |
|
11 | 11 | $this->connection["password"] = ""; |
12 | 12 | $this->connection["database"] = ""; |
13 | - $this->connection["server"] = ""; |
|
14 | - $this->all = ""; |
|
13 | + $this->connection["server"] = ""; |
|
14 | + $this->all = ""; |
|
15 | 15 | $this->DEBUG = 0; |
16 | 16 | $this->pages = []; |
17 | - $this->server = []; |
|
17 | + $this->server = []; |
|
18 | 18 | $this->server["HTTP_HOST"] = $_SERVER["HTTP_HOST"]; |
19 | - $this->server["REQUEST_URI"] = $_SERVER["REQUEST_URI"]; |
|
19 | + $this->server["REQUEST_URI"] = $_SERVER["REQUEST_URI"]; |
|
20 | 20 | $this->server["PHP_SELF"] = $_SERVER["PHP_SELF"]; |
21 | 21 | $this->server["RELATIVE"] = str_replace("/index.php", "", $_SERVER["PHP_SELF"]); |
22 | 22 | } |
23 | - public function import( $_path, $_type = "misc" ) { |
|
23 | + public function import($_path, $_type = "misc") { |
|
24 | 24 | $data = file_get_contents($_path); |
25 | 25 | $data = json_decode($data); |
26 | - if( $_type == "connection" ) |
|
26 | + if ($_type == "connection") |
|
27 | 27 | $this->overlayConnection($data); |
28 | 28 | else |
29 | 29 | $this->overlayMisc($data); |
30 | 30 | } |
31 | - protected function overlayConnection( $_data ) { |
|
31 | + protected function overlayConnection($_data) { |
|
32 | 32 | $this->connection = $this->obj2array($_data); |
33 | 33 | } |
34 | - protected function overlayMisc( $_data ) { |
|
34 | + protected function overlayMisc($_data) { |
|
35 | 35 | $this->importObject($_data); |
36 | 36 | } |
37 | - protected function obj2array ( &$_instance ) { |
|
38 | - $clone = (array) $_instance; |
|
37 | + protected function obj2array(&$_instance) { |
|
38 | + $clone = (array) $_instance; |
|
39 | 39 | $return = []; |
40 | 40 | $return['___SOURCE_KEYS_'] = $clone; |
41 | - while ( list ($key, $value) = each ($clone) ) { |
|
42 | - $temp = explode ("\0", $key); |
|
43 | - $newkey = $temp[count($temp)-1]; |
|
41 | + while (list ($key, $value) = each($clone)) { |
|
42 | + $temp = explode("\0", $key); |
|
43 | + $newkey = $temp[count($temp) - 1]; |
|
44 | 44 | $return[$newkey] = &$return['___SOURCE_KEYS_'][$key]; |
45 | 45 | } |
46 | 46 | return $return; |
47 | 47 | } |
48 | - protected function importObject( $_object ) { |
|
48 | + protected function importObject($_object) { |
|
49 | 49 | foreach (get_object_vars($_object) as $key => $value) |
50 | 50 | $this->$key = $value; |
51 | 51 | } |
@@ -8,49 +8,49 @@ discard block |
||
8 | 8 | public function __construct() { |
9 | 9 | parent::__construct(); |
10 | 10 | $this->pages = []; |
11 | - $this->defaultPage = ["Page404",[]]; |
|
11 | + $this->defaultPage = ["Page404", []]; |
|
12 | 12 | $this->currentPage = null; |
13 | - $this->jConfig = null; |
|
13 | + $this->jConfig = null; |
|
14 | 14 | } |
15 | - public function addPage( $_page ) { |
|
15 | + public function addPage($_page) { |
|
16 | 16 | $param = []; |
17 | 17 | $path = $_page; |
18 | 18 | $class = $_page; |
19 | - if(is_array($_page)) { |
|
19 | + if (is_array($_page)) { |
|
20 | 20 | $path = $_page[0]; |
21 | 21 | $class = $_page[1]; |
22 | - if(isset($_page[2])) |
|
22 | + if (isset($_page[2])) |
|
23 | 23 | $param = $_page[2]; |
24 | 24 | } |
25 | 25 | $this->pages[$path] = [$class, $param]; |
26 | 26 | return $this->pages[$path]; |
27 | 27 | } |
28 | - public function addPages( $_pages ) { |
|
28 | + public function addPages($_pages) { |
|
29 | 29 | foreach ($_pages as $i) |
30 | 30 | $this->addPage($i); |
31 | 31 | } |
32 | 32 | public function fetchPage( ) { |
33 | 33 | $router = new Router(); |
34 | - $router->parameters = [ "app" => &$this->jConfig, "page" => null]; |
|
34 | + $router->parameters = ["app" => &$this->jConfig, "page" => null]; |
|
35 | 35 | $stack = $router->getPage(); |
36 | 36 | $parameters = []; |
37 | - $temp = $this->defaultPage; |
|
37 | + $temp = $this->defaultPage; |
|
38 | 38 | foreach ($this->pages as $key => $value) { |
39 | 39 | $variables = $this->pathSeeker(explode("/", $key), $stack); |
40 | - if(is_array($variables)) { |
|
40 | + if (is_array($variables)) { |
|
41 | 41 | $temp = $value; |
42 | 42 | $parameters = $variables; |
43 | 43 | break; |
44 | 44 | } |
45 | 45 | } |
46 | - if( isset($temp[1]) && is_array($temp[1]) ) |
|
46 | + if (isset($temp[1]) && is_array($temp[1])) |
|
47 | 47 | $temp[1] = array_merge($temp[1], $parameters); |
48 | 48 | else |
49 | 49 | $temp[1] = $parameters; |
50 | 50 | $this->currentPage = new $temp[0](["app" => $this->jConfig, "page" => $temp[1]]); |
51 | 51 | return $this->currentPage; |
52 | 52 | } |
53 | - public function setDefaultPage( $_page ) { |
|
53 | + public function setDefaultPage($_page) { |
|
54 | 54 | $this->defaultPage = $this->addPage($_page); |
55 | 55 | } |
56 | 56 | public function draw() { |
@@ -59,28 +59,28 @@ discard block |
||
59 | 59 | $gui->init($this->currentPage); |
60 | 60 | $gui->draw($this->currentPage->data["template"]); |
61 | 61 | } |
62 | - public function pathSeeker( $_path, $_url ) { |
|
62 | + public function pathSeeker($_path, $_url) { |
|
63 | 63 | $urlLength = count($_url); |
64 | 64 | $cont = 0; |
65 | 65 | $variables = []; |
66 | 66 | $pathLength = count($_path); |
67 | - if($urlLength == $pathLength) { |
|
68 | - while($cont < $urlLength) { |
|
69 | - if( $_path[$cont] == $_url[$cont] ) |
|
67 | + if ($urlLength == $pathLength) { |
|
68 | + while ($cont < $urlLength) { |
|
69 | + if ($_path[$cont] == $_url[$cont]) |
|
70 | 70 | $cont++; |
71 | - else if( strpos($_path[$cont], "\$") !== false ) { |
|
71 | + else if (strpos($_path[$cont], "\$") !== false) { |
|
72 | 72 | $variables[str_replace('$', "", $_path[$cont])] = $_url[$cont]; |
73 | 73 | $cont++; |
74 | 74 | } else break; |
75 | 75 | } |
76 | - if($cont == $urlLength) |
|
76 | + if ($cont == $urlLength) |
|
77 | 77 | return $variables; |
78 | 78 | } |
79 | 79 | return null; |
80 | 80 | } |
81 | - public function newConfig( $_path = "config/") { |
|
81 | + public function newConfig($_path = "config/") { |
|
82 | 82 | $this->jConfig = new JConfig(); |
83 | - $this->jConfig->import("${_path}connection.json","connection"); |
|
83 | + $this->jConfig->import("${_path}connection.json", "connection"); |
|
84 | 84 | $this->jConfig->import("${_path}misc.json"); |
85 | 85 | $this->jConfig->import("${_path}router.json"); |
86 | 86 | } |
@@ -7,19 +7,19 @@ |
||
7 | 7 | parent::__construct(); |
8 | 8 | $args = func_get_args(); |
9 | 9 | $count = func_num_args(); |
10 | - if (method_exists($this,$func='__construct'.$count)) |
|
11 | - call_user_func_array(array($this,$func),$args); |
|
10 | + if (method_exists($this, $func = '__construct'.$count)) |
|
11 | + call_user_func_array(array($this, $func), $args); |
|
12 | 12 | } |
13 | 13 | public function __construct0() { |
14 | 14 | $this->database = null; |
15 | 15 | } |
16 | - public function __construct4( $_srv, $_db, $_usr, $_pass) { |
|
16 | + public function __construct4($_srv, $_db, $_usr, $_pass) { |
|
17 | 17 | $this->connection = "mysql:host=$_srv;dbname=$_db"; |
18 | - $this->database = new PDO( $this->connection, $_usr, $_pass,array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'")); |
|
18 | + $this->database = new PDO($this->connection, $_usr, $_pass, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'")); |
|
19 | 19 | $this->info = []; |
20 | - $this->info["server"] = $_srv; |
|
20 | + $this->info["server"] = $_srv; |
|
21 | 21 | $this->info["database"] = $_db; |
22 | - $this->info["user"] = $_usr; |
|
22 | + $this->info["user"] = $_usr; |
|
23 | 23 | $this->info["password"] = $_pass; |
24 | 24 | } |
25 | 25 | } |
@@ -8,42 +8,42 @@ |
||
8 | 8 | $this->connection = []; |
9 | 9 | $this->currentConnection = null; |
10 | 10 | } |
11 | - public function addConnection( $_name, $_connection ) { |
|
11 | + public function addConnection($_name, $_connection) { |
|
12 | 12 | $this->connection["$_name"] = $_connection; |
13 | 13 | $this->currentConnection = $_connection; |
14 | 14 | |
15 | 15 | foreach ($this->modules as &$module) |
16 | - if(isset($module->currentConnection)) |
|
16 | + if (isset($module->currentConnection)) |
|
17 | 17 | $module->addConnection($_name, $_connection); |
18 | 18 | } |
19 | - public function setConnection( $_name ) { |
|
19 | + public function setConnection($_name) { |
|
20 | 20 | $this->currentConnection = $this->connection["$_name"]; |
21 | 21 | } |
22 | - public function query( $_query ) { |
|
22 | + public function query($_query) { |
|
23 | 23 | $this->stdQuery($_query); |
24 | 24 | return true; |
25 | 25 | } |
26 | - public function queryInsert( $_query ) { |
|
26 | + public function queryInsert($_query) { |
|
27 | 27 | $this->stdQuery($_query); |
28 | 28 | return $this->currentConnection->database->lastInsertId(); |
29 | 29 | } |
30 | 30 | |
31 | - public function queryFetch( $_query ) { |
|
31 | + public function queryFetch($_query) { |
|
32 | 32 | $temp = $this->stdQuery($_query); |
33 | 33 | return $temp->fetchAll(PDO::FETCH_ASSOC); |
34 | 34 | } |
35 | 35 | |
36 | - public function queryArray( $_query ) { |
|
36 | + public function queryArray($_query) { |
|
37 | 37 | $temp = $this->stdQuery($_query); |
38 | 38 | return $temp->fetchAll(PDO::FETCH_COLUMN, 0); |
39 | 39 | } |
40 | 40 | |
41 | - protected function stdQuery( $_query ) { |
|
41 | + protected function stdQuery($_query) { |
|
42 | 42 | $database = $this->currentConnection->database; |
43 | 43 | $error = "Error query [$_query]"; |
44 | 44 | $query = $database->prepare($_query); |
45 | 45 | $_result = $query->execute(); |
46 | - if(!$_result) { |
|
46 | + if (!$_result) { |
|
47 | 47 | echo "$_query<br>"; |
48 | 48 | echo "Something wrong: $error"; |
49 | 49 | var_dump($query->errorInfo()); |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | $percent; |
23 | 23 | foreach (getGitLog() as $i) { |
24 | 24 | $cont++; |
25 | - if($cont % $nPerCol == 1) |
|
25 | + if ($cont % $nPerCol == 1) |
|
26 | 26 | echo '<div class="row">'; |
27 | - if(isset($i["tag"])) { |
|
28 | - $percent = explode(".",$i["tag"]); |
|
27 | + if (isset($i["tag"])) { |
|
28 | + $percent = explode(".", $i["tag"]); |
|
29 | 29 | $percent = 100 * intval($percent[0]) + 10 * intval($percent[1]) + intval($percent[2]); |
30 | 30 | } |
31 | 31 | ?> |
32 | 32 | <div class="col-lg-<?=$dim?>"> |
33 | 33 | <div class="well well-sm miniblock"> |
34 | 34 | <div class="autor"><b>Autor:</b> <?=$i["author"]?><br></div> |
35 | - <div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) echo $i["tag"]?><br></div> |
|
35 | + <div class="tag"><b>Tag:</b> <?php if (isset($i["tag"])) echo $i["tag"]?><br></div> |
|
36 | 36 | <div class="date"><b>Date:</b> <?=$i["date"]?><br></div> |
37 | 37 | <div class="message"><b>Message:</b> <?=$i["message"]?><br></div> |
38 | 38 | <div class="progress"> |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | </div> |
45 | 45 | </div> |
46 | 46 | <?php |
47 | - if($cont % $nPerCol == 0) |
|
47 | + if ($cont % $nPerCol == 0) |
|
48 | 48 | echo '</div>'; |
49 | 49 | } ?> |
50 | 50 | </div> |