@@ -8,20 +8,20 @@ discard block |
||
8 | 8 | parent::__construct(); |
9 | 9 | $args = func_get_args(); |
10 | 10 | $count = func_num_args(); |
11 | - if (method_exists($this,$func='__construct'.$count)) |
|
12 | - call_user_func_array(array($this,$func),$args); |
|
11 | + if (method_exists($this, $func = '__construct'.$count)) |
|
12 | + call_user_func_array(array($this, $func), $args); |
|
13 | 13 | } |
14 | 14 | public function __construct0() { |
15 | 15 | $this->database = null; |
16 | 16 | } |
17 | - public function __construct4 ( $_srv, $_db, $_usr, $_pass ) { |
|
17 | + public function __construct4($_srv, $_db, $_usr, $_pass) { |
|
18 | 18 | $this->setConnection($_srv, $_db, $_usr, $_pass, "pdo"); |
19 | 19 | } |
20 | - public function __construct5 ( $_srv, $_db, $_usr, $_pass, $_type ) { |
|
20 | + public function __construct5($_srv, $_db, $_usr, $_pass, $_type) { |
|
21 | 21 | $type = $this->getConnectionType($_type); |
22 | 22 | $this->setConnection($_srv, $_db, $_usr, $_pass, $type); |
23 | 23 | } |
24 | - protected function setConnection ( $_srv, $_db, $_usr, $_pass, $_type ) { |
|
24 | + protected function setConnection($_srv, $_db, $_usr, $_pass, $_type) { |
|
25 | 25 | switch ($_type) { |
26 | 26 | case "mysqli": |
27 | 27 | $this->database = new ConnectionMysqliAdapter($_srv, $_db, $_usr, $_pass); |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | $this->database = new ConnectionPdoAdapter($_srv, $_db, $_usr, $_pass); |
31 | 31 | break; |
32 | 32 | } |
33 | - $this->setConnectionParameters( $_srv, $_db, $_usr, $_pass); |
|
33 | + $this->setConnectionParameters($_srv, $_db, $_usr, $_pass); |
|
34 | 34 | } |
35 | - protected function getConnectionType( $_type ) { |
|
35 | + protected function getConnectionType($_type) { |
|
36 | 36 | foreach ($_type as $key => $value) |
37 | - if($value) |
|
37 | + if ($value) |
|
38 | 38 | return $key; |
39 | 39 | return "pdo"; |
40 | 40 | } |
41 | - protected function setConnectionParameters( $_srv, $_db, $_usr, $_pass) { |
|
41 | + protected function setConnectionParameters($_srv, $_db, $_usr, $_pass) { |
|
42 | 42 | $this->info = []; |
43 | 43 | $this->info["server"] = $_srv; |
44 | 44 | $this->info["database"] = $_db; |
@@ -6,7 +6,7 @@ |
||
6 | 6 | } |
7 | 7 | public function getPage() { |
8 | 8 | $request = $this->parameters["app"]->server["REQUEST_URI"]; |
9 | - $base = $this->parameters["app"]->server["RELATIVE"]; |
|
9 | + $base = $this->parameters["app"]->server["RELATIVE"]; |
|
10 | 10 | $url = str_replace($base, "", $request); |
11 | 11 | $url = explode("/", $url); |
12 | 12 | return $url; |
@@ -14,38 +14,38 @@ |
||
14 | 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 | 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; |
|
39 | - $return = []; |
|
37 | + protected function obj2array(&$_instance) { |
|
38 | + $clone = (array) $_instance; |
|
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 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | requireComponent("../Query/Query.php"); |
3 | 3 | class Html extends Query { |
4 | - public function __construct( $_parameters = [ "app" => null, "page" => null] ) { |
|
4 | + public function __construct($_parameters = ["app" => null, "page" => null]) { |
|
5 | 5 | parent::__construct(); |
6 | 6 | $this->data["template"] = ""; |
7 | 7 | $this->tags["brand"] = ""; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | } |
25 | 25 | public function uniforma() { |
26 | 26 | $this->addDipendences(); |
27 | - $this->tags["css"] = array_unique($this->tags["css"]); |
|
27 | + $this->tags["css"] = array_unique($this->tags["css"]); |
|
28 | 28 | $this->tags["js"] = array_unique($this->tags["js"]); |
29 | 29 | $this->tags["pagePath"] = json_encode($this->tags["pagePath"]); |
30 | 30 | $tempStr = ""; |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | $menu = $this->queryFetch("SELECT * FROM menu WHERE flag_active = 1 ORDER BY `order`"); |
9 | 9 | $temp = []; |
10 | 10 | foreach ($menu as $i) { |
11 | - if($i["fk_menu"] == 0) { |
|
11 | + if ($i["fk_menu"] == 0) { |
|
12 | 12 | $pk_menu = $i["pk_menu"]; |
13 | 13 | array_push($temp, array("label" => $i["label"], "link" => $i["link"], "submenu" => [], "relative" => false)); |
14 | 14 | $submenu = $this->queryFetch("SELECT * FROM menu WHERE fk_menu = $pk_menu ORDER BY `order`"); |
15 | - if($submenu) |
|
15 | + if ($submenu) |
|
16 | 16 | foreach ($submenu as $j) |
17 | - array_push( $temp[count($temp)-1]["submenu"], array("label" => $j["label"], "link" => $j["link"], "submenu" => [], "relative" => false) ); |
|
17 | + array_push($temp[count($temp) - 1]["submenu"], array("label" => $j["label"], "link" => $j["link"], "submenu" => [], "relative" => false)); |
|
18 | 18 | } |
19 | 19 | } |
20 | 20 | $this->tags["menu"] = $temp; |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | $relative = $this->parameters["app"]->server["RELATIVE"]; |
29 | 29 | foreach ($this->tags["menu"] as $i) { |
30 | 30 | $prePath = ""; |
31 | - if($i["relative"]) |
|
31 | + if ($i["relative"]) |
|
32 | 32 | $prePath = $relative; |
33 | 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) |
|
34 | + if (is_array($i["submenu"]) && count($i["submenu"]) < 1) |
|
35 | 35 | $temp .= "<li class='$active'><a href='$prePath$i[link]'>$i[label]</a></li>"; |
36 | 36 | else { |
37 | 37 | $temp .= "<li class='dropdown $active'>"; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | '<ul class="dropdown-menu">'; |
44 | 44 | foreach ($i["submenu"] as $j) { |
45 | 45 | $prePath = ""; |
46 | - if($j["relative"]) |
|
46 | + if ($j["relative"]) |
|
47 | 47 | $prePath = $relative; |
48 | 48 | $temp .= "<li><a href='$prePath$j[link]'>$j[label]</a></li>"; |
49 | 49 | } |
@@ -52,18 +52,18 @@ discard block |
||
52 | 52 | } |
53 | 53 | return $temp; |
54 | 54 | } |
55 | - protected function isSubString( $_string, $_list) { |
|
55 | + protected function isSubString($_string, $_list) { |
|
56 | 56 | $success = false; |
57 | 57 | foreach ($_list as $i) |
58 | - if(strpos($_string,$i) !== false) |
|
58 | + if (strpos($_string, $i) !== false) |
|
59 | 59 | $success = true; |
60 | 60 | return $success; |
61 | 61 | } |
62 | 62 | public function loginWithUser() { |
63 | 63 | $this->init(); |
64 | 64 | $temp = []; |
65 | - if(!isset($_SESSION["username"])) |
|
66 | - $_SESSION["username"] ="guest"; |
|
65 | + if (!isset($_SESSION["username"])) |
|
66 | + $_SESSION["username"] = "guest"; |
|
67 | 67 | $user = $_SESSION["username"]; |
68 | 68 | $blackList = $this->queryFetch( |
69 | 69 | "SELECT user.*,user_section.* |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | $success = true; |
79 | 79 | $k = $i["label"]; |
80 | 80 | foreach ($blackList as $j) |
81 | - if( $j["section"] == $k) |
|
81 | + if ($j["section"] == $k) |
|
82 | 82 | $success = false; |
83 | - if($success) |
|
84 | - array_push($temp,$i); |
|
83 | + if ($success) |
|
84 | + array_push($temp, $i); |
|
85 | 85 | } |
86 | 86 | $this->tags["menu"] = $temp; |
87 | 87 | } |
@@ -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; |
@@ -8,27 +8,27 @@ |
||
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 | return $this->currentConnection->database->query($_query); |
24 | 24 | } |
25 | - public function queryInsert( $_query ) { |
|
25 | + public function queryInsert($_query) { |
|
26 | 26 | return $this->currentConnection->database->queryInsert($_query); |
27 | 27 | } |
28 | - public function queryFetch( $_query ) { |
|
28 | + public function queryFetch($_query) { |
|
29 | 29 | return $this->currentConnection->database->queryFetch($_query); |
30 | 30 | } |
31 | - public function queryArray( $_query ) { |
|
31 | + public function queryArray($_query) { |
|
32 | 32 | return $this->currentConnection->database->queryArray($_query); |
33 | 33 | } |
34 | 34 | } |
@@ -1,45 +1,45 @@ |
||
1 | 1 | <?php |
2 | - function requireComponent( $_path, $_local = true ) { |
|
2 | + function requireComponent($_path, $_local = true) { |
|
3 | 3 | $path = getJFolder($_path, $_local, debug_backtrace()); |
4 | - if(file_exists($path) && isPhp($path)) |
|
4 | + if (file_exists($path) && isPhp($path)) |
|
5 | 5 | jRequire($path, false, 0); |
6 | 6 | else |
7 | 7 | requireError($_path); |
8 | 8 | } |
9 | - function requireComponents( $_path, $_local = true ) { |
|
9 | + function requireComponents($_path, $_local = true) { |
|
10 | 10 | $path = getJFolder($_path, $_local, debug_backtrace()); |
11 | - if(file_exists($path)) { |
|
11 | + if (file_exists($path)) { |
|
12 | 12 | $files = subFolderFile($path); |
13 | 13 | foreach ($files as $i) { |
14 | - if(isPhp($path."/".$i)) |
|
14 | + if (isPhp($path."/".$i)) |
|
15 | 15 | requireComponent($path."/".$i, false, 0); |
16 | 16 | } |
17 | 17 | } else |
18 | 18 | requireError($_path); |
19 | 19 | } |
20 | - function requireError( $_path ) { |
|
20 | + function requireError($_path) { |
|
21 | 21 | global $DEBUG; |
22 | - if( $DEBUG == 1 ) |
|
22 | + if ($DEBUG == 1) |
|
23 | 23 | echo "Error load ($_path)<br>"; |
24 | 24 | } |
25 | - function isPhp ( $_file ) { |
|
26 | - if(!is_file($_file)) return false; |
|
25 | + function isPhp($_file) { |
|
26 | + if (!is_file($_file)) return false; |
|
27 | 27 | $info = pathinfo($_file); |
28 | 28 | return ($info["extension"] == "php") || ($info["extension"] == "PHP"); |
29 | 29 | } |
30 | - function requireModules( $_path, $_local = true ) { |
|
30 | + function requireModules($_path, $_local = true) { |
|
31 | 31 | $path = getJFolder($_path, $_local, debug_backtrace()); |
32 | 32 | $subFolders = subFolderDir($path); |
33 | 33 | foreach ($subFolders as $i) { |
34 | 34 | requireComponents($path."/".$i, false, 0); |
35 | 35 | } |
36 | 36 | } |
37 | - function jRequire( $_path, $_local = true ) { |
|
37 | + function jRequire($_path, $_local = true) { |
|
38 | 38 | $path = getJFolder($_path, $_local, debug_backtrace()); |
39 | - require_once( $path ); |
|
39 | + require_once($path); |
|
40 | 40 | } |
41 | - function getJFolder( $_path, $_local, $_stack ) { |
|
42 | - if($_local) { |
|
41 | + function getJFolder($_path, $_local, $_stack) { |
|
42 | + if ($_local) { |
|
43 | 43 | $stackInfo = $_stack; |
44 | 44 | $folder = dirname($stackInfo[0]["file"]); |
45 | 45 | $file = "$folder/$_path"; |
@@ -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 | } |