@@ -1,6 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require_once("main.php"); |
| 3 | - if(!isset($_GET["page"])) $_GET["page"] = "home"; |
|
| 3 | + if(!isset($_GET["page"])) { |
|
| 4 | + $_GET["page"] = "home"; |
|
| 5 | + } |
|
| 4 | 6 | $webApp->fetchPage($_GET["page"]); |
| 5 | 7 | $webApp->draw(); |
| 6 | 8 | ?> |
@@ -1,14 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | - if(!isset($GLOBALS["JATEPath"])) |
|
| 3 | - $GLOBALS["JATEPath"] = []; |
|
| 2 | + if(!isset($GLOBALS["JATEPath"])) { |
|
| 3 | + $GLOBALS["JATEPath"] = []; |
|
| 4 | + } |
|
| 4 | 5 | $commonLocations = array( |
| 5 | 6 | "bower_components/JATE/dist/", |
| 6 | 7 | "vendor/xaberr/jate/dist/", |
| 7 | 8 | "../../dist/" |
| 8 | 9 | ); |
| 9 | - foreach ($commonLocations as $i) |
|
| 10 | - if(file_exists($i."jate/coreEngine.php")) { |
|
| 10 | + foreach ($commonLocations as $i) { |
|
| 11 | + if(file_exists($i."jate/coreEngine.php")) { |
|
| 11 | 12 | array_push($GLOBALS["JATEPath"], $i); |
| 13 | + } |
|
| 12 | 14 | require_once($i."jate/coreEngine.php"); |
| 13 | 15 | break; |
| 14 | 16 | } |
@@ -21,10 +21,11 @@ discard block |
||
| 21 | 21 | $temp = []; |
| 22 | 22 | if (is_dir($_dir)) { |
| 23 | 23 | if ($dirOpened = opendir($_dir)) { |
| 24 | - while (($file = readdir($dirOpened)) !== false) |
|
| 25 | - if( ($file !='.')&&($file !='..') ) |
|
| 24 | + while (($file = readdir($dirOpened)) !== false) { |
|
| 25 | + if( ($file !='.')&&($file !='..') ) |
|
| 26 | 26 | if($_function($file)) |
| 27 | 27 | array_push($temp,$file); |
| 28 | + } |
|
| 28 | 29 | closedir($dirOpened); |
| 29 | 30 | } |
| 30 | 31 | } |
@@ -32,14 +33,16 @@ discard block |
||
| 32 | 33 | } |
| 33 | 34 | function require_subfolder( $_dir = "./" ) { |
| 34 | 35 | $temp = subFolder_file($_dir); |
| 35 | - foreach ($temp as $i) |
|
| 36 | - jRequire($_dir."/".$i); |
|
| 36 | + foreach ($temp as $i) { |
|
| 37 | + jRequire($_dir."/".$i); |
|
| 38 | + } |
|
| 37 | 39 | } |
| 38 | 40 | function require_js( $_dir = "./" ) { |
| 39 | 41 | $tempArray = []; |
| 40 | 42 | $temp = subFolder_file($_dir); |
| 41 | - foreach ($temp as $i) |
|
| 42 | - array_push($tempArray, $_dir."/".$i); |
|
| 43 | + foreach ($temp as $i) { |
|
| 44 | + array_push($tempArray, $_dir."/".$i); |
|
| 45 | + } |
|
| 43 | 46 | return $tempArray; |
| 44 | 47 | } |
| 45 | 48 | ?> |
@@ -1,6 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | function getGitLog( $_dir = "./" ) { |
| 3 | - if(!file_exists($_dir)) return []; |
|
| 3 | + if(!file_exists($_dir)) { |
|
| 4 | + return []; |
|
| 5 | + } |
|
| 4 | 6 | $currentDir = getcwd(); |
| 5 | 7 | chdir($_dir); |
| 6 | 8 | $git_history = []; |
@@ -35,19 +37,17 @@ discard block |
||
| 35 | 37 | $tag = trim($tag[0]); |
| 36 | 38 | $git_history[$last_hash]['tag'] = $tag; |
| 37 | 39 | } |
| 38 | - } |
|
| 39 | - else if (strpos($line, 'Author') === 0) { |
|
| 40 | + } else if (strpos($line, 'Author') === 0) { |
|
| 40 | 41 | $author = explode(':', $line); |
| 41 | 42 | $author = trim(end($author)); |
| 42 | 43 | $git_history[$last_hash]['author'] = $author; |
| 43 | - } |
|
| 44 | - else if (strpos($line, 'Date') === 0) { |
|
| 44 | + } else if (strpos($line, 'Date') === 0) { |
|
| 45 | 45 | $date = explode(':', $line, 2); |
| 46 | 46 | $date = trim(end($date)); |
| 47 | 47 | $git_history[$last_hash]['date'] = date('d/m/Y H:i:s A', strtotime($date)); |
| 48 | + } else { |
|
| 49 | + $git_history[$last_hash]['message'] .= $line ." "; |
|
| 48 | 50 | } |
| 49 | - else |
|
| 50 | - $git_history[$last_hash]['message'] .= $line ." "; |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | chdir($currentDir); |
@@ -1,29 +1,35 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | function requireComponent( $_path, $_local = true, $_stack = null ) { |
| 3 | 3 | $path = getJFolder($_path, $_local, debug_backtrace()); |
| 4 | - if(file_exists($path) && isPhp($path)) |
|
| 5 | - jRequire($path, false, 0); |
|
| 6 | - else |
|
| 7 | - requireError($_path); |
|
| 4 | + if(file_exists($path) && isPhp($path)) { |
|
| 5 | + jRequire($path, false, 0); |
|
| 6 | + } else { |
|
| 7 | + requireError($_path); |
|
| 8 | + } |
|
| 8 | 9 | } |
| 9 | 10 | function requireComponents( $_path, $_local = true, $_stack = null ) { |
| 10 | 11 | $path = getJFolder($_path, $_local, debug_backtrace()); |
| 11 | 12 | if(file_exists($path)) { |
| 12 | 13 | $files = subFolder_file($path); |
| 13 | 14 | foreach ($files as $i) { |
| 14 | - if(isPhp($path."/".$i)) |
|
| 15 | - requireComponent($path."/".$i, false, 0); |
|
| 15 | + if(isPhp($path."/".$i)) { |
|
| 16 | + requireComponent($path."/".$i, false, 0); |
|
| 17 | + } |
|
| 16 | 18 | } |
| 17 | - } else |
|
| 18 | - requireError($_path); |
|
| 19 | + } else { |
|
| 20 | + requireError($_path); |
|
| 21 | + } |
|
| 19 | 22 | } |
| 20 | 23 | function requireError( $_path ) { |
| 21 | 24 | global $jConfig; |
| 22 | - if( $jConfig->DEBUG == 1 ) |
|
| 23 | - echo "Error load ($_path)<br>"; |
|
| 25 | + if( $jConfig->DEBUG == 1 ) { |
|
| 26 | + echo "Error load ($_path)<br>"; |
|
| 27 | + } |
|
| 24 | 28 | } |
| 25 | 29 | function isPhp ( $_file ) { |
| 26 | - if(!is_file($_file)) return false; |
|
| 30 | + if(!is_file($_file)) { |
|
| 31 | + return false; |
|
| 32 | + } |
|
| 27 | 33 | $info = pathinfo($_file); |
| 28 | 34 | return ($info["extension"] == "php") || ($info["extension"] == "PHP"); |
| 29 | 35 | } |
@@ -43,8 +49,9 @@ discard block |
||
| 43 | 49 | $stackInfo = $_stack; |
| 44 | 50 | $folder = dirname($stackInfo[0]["file"]); |
| 45 | 51 | $file = "$folder/$_path"; |
| 46 | - } else |
|
| 47 | - $file = $_path; |
|
| 52 | + } else { |
|
| 53 | + $file = $_path; |
|
| 54 | + } |
|
| 48 | 55 | return $file; |
| 49 | 56 | } |
| 50 | 57 | ?> |
@@ -15,8 +15,9 @@ |
||
| 15 | 15 | function minify_output($_buffer) { |
| 16 | 16 | $search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' ); |
| 17 | 17 | $replace = array ( '>', '<', '\\1' ); |
| 18 | - if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) |
|
| 19 | - $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
|
| 18 | + if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) { |
|
| 19 | + $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
|
| 20 | + } |
|
| 20 | 21 | return utf8_encode($_buffer); |
| 21 | 22 | } |
| 22 | 23 | ?> |
@@ -18,8 +18,9 @@ discard block |
||
| 18 | 18 | if(is_array($_page)) { |
| 19 | 19 | $label = $_page[0]; |
| 20 | 20 | $class = $_page[1]; |
| 21 | - if(isset($_page[2])) |
|
| 22 | - $param = $_page[2]; |
|
| 21 | + if(isset($_page[2])) { |
|
| 22 | + $param = $_page[2]; |
|
| 23 | + } |
|
| 23 | 24 | } else { |
| 24 | 25 | $label = $_page; |
| 25 | 26 | $class = $_page; |
@@ -27,13 +28,15 @@ discard block |
||
| 27 | 28 | $this->pages[$label] = [$class,$param]; |
| 28 | 29 | } |
| 29 | 30 | public function addPages( $_pages ) { |
| 30 | - foreach ($_pages as $i) |
|
| 31 | - $this->addPage($i); |
|
| 31 | + foreach ($_pages as $i) { |
|
| 32 | + $this->addPage($i); |
|
| 33 | + } |
|
| 32 | 34 | } |
| 33 | 35 | public function fetchPage( $_label ) { |
| 34 | 36 | $temp = $this->defaultPage; |
| 35 | - if(isset($this->pages[$_label])) |
|
| 36 | - $temp = $this->pages[$_label]; |
|
| 37 | + if(isset($this->pages[$_label])) { |
|
| 38 | + $temp = $this->pages[$_label]; |
|
| 39 | + } |
|
| 37 | 40 | $this->currentPage = new $temp[0]($temp[1]); |
| 38 | 41 | return $this->currentPage; |
| 39 | 42 | } |
@@ -7,8 +7,9 @@ |
||
| 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 | 14 | public function __construct0() { |
| 14 | 15 | $this->connection = null; |
@@ -25,17 +25,20 @@ |
||
| 25 | 25 | $this->data["js"] = array_unique($this->data["js"]); |
| 26 | 26 | $this->data["pagePath"] = json_encode($this->data["pagePath"]); |
| 27 | 27 | $tempStr = ""; |
| 28 | - foreach ($this->data["css"] as $i) |
|
| 29 | - $tempStr .= '<link rel="stylesheet" href="'.$i.'">'; |
|
| 28 | + foreach ($this->data["css"] as $i) { |
|
| 29 | + $tempStr .= '<link rel="stylesheet" href="'.$i.'">'; |
|
| 30 | + } |
|
| 30 | 31 | $this->data["css"] = $tempStr; |
| 31 | 32 | $tempStr = ""; |
| 32 | - foreach ($this->data["js"] as $i) |
|
| 33 | - $tempStr .= '<script src="'.$i.'"></script>'; |
|
| 33 | + foreach ($this->data["js"] as $i) { |
|
| 34 | + $tempStr .= '<script src="'.$i.'"></script>'; |
|
| 35 | + } |
|
| 34 | 36 | $this->data["js"] = $tempStr; |
| 35 | 37 | $tempStr = ""; |
| 36 | 38 | $tempStr .= '<script type="text/javascript">'; |
| 37 | - foreach ($this->data["jsVariables"] as $i) |
|
| 38 | - $tempStr .= " ".$i[0]." = ".$i[1].";\n"; |
|
| 39 | + foreach ($this->data["jsVariables"] as $i) { |
|
| 40 | + $tempStr .= " ".$i[0]." = ".$i[1].";\n"; |
|
| 41 | + } |
|
| 39 | 42 | $tempStr .= '</script>'; |
| 40 | 43 | $this->data["jsVariables"] = $tempStr; |
| 41 | 44 | } |