@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | - function getGitLog( $_dir = "./" ) { |
|
| 3 | - if(!file_exists($_dir)) |
|
| 2 | + function getGitLog($_dir = "./") { |
|
| 3 | + if (!file_exists($_dir)) |
|
| 4 | 4 | return []; |
| 5 | 5 | $currentDir = getcwd(); |
| 6 | 6 | chdir($_dir); |
| 7 | 7 | $gitHistory = []; |
| 8 | 8 | $gitLogs = []; |
| 9 | 9 | $gitPath = str_replace('\\', '/', exec("git rev-parse --show-toplevel")); |
| 10 | - $rootPath = str_replace('\\', '/', getcwd ()); |
|
| 10 | + $rootPath = str_replace('\\', '/', getcwd()); |
|
| 11 | 11 | $lastHash = null; |
| 12 | - if( $gitPath != $rootPath ) { |
|
| 12 | + if ($gitPath != $rootPath) { |
|
| 13 | 13 | chdir($currentDir); |
| 14 | 14 | return []; |
| 15 | 15 | } |
@@ -1,7 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | function getGitLog( $_dir = "./" ) { |
| 3 | - if(!file_exists($_dir)) |
|
| 4 | - return []; |
|
| 3 | + if(!file_exists($_dir)) { |
|
| 4 | + return []; |
|
| 5 | + } |
|
| 5 | 6 | $currentDir = getcwd(); |
| 6 | 7 | chdir($_dir); |
| 7 | 8 | $gitHistory = []; |
@@ -35,19 +36,17 @@ discard block |
||
| 35 | 36 | $tag = trim($tag[0]); |
| 36 | 37 | $gitHistory[$lastHash]['tag'] = $tag; |
| 37 | 38 | } |
| 38 | - } |
|
| 39 | - else if (strpos($line, 'Author') === 0) { |
|
| 39 | + } else if (strpos($line, 'Author') === 0) { |
|
| 40 | 40 | $author = explode(':', $line); |
| 41 | 41 | $author = trim(end($author)); |
| 42 | 42 | $gitHistory[$lastHash]['author'] = $author; |
| 43 | - } |
|
| 44 | - else if (strpos($line, 'Date') === 0) { |
|
| 43 | + } else if (strpos($line, 'Date') === 0) { |
|
| 45 | 44 | $date = explode(':', $line, 2); |
| 46 | 45 | $date = trim(end($date)); |
| 47 | 46 | $gitHistory[$lastHash]['date'] = date('d/m/Y H:i:s A', strtotime($date)); |
| 47 | + } else { |
|
| 48 | + $gitHistory[$lastHash]['message'] .= "$line<br>"; |
|
| 48 | 49 | } |
| 49 | - else |
|
| 50 | - $gitHistory[$lastHash]['message'] .= "$line<br>"; |
|
| 51 | 50 | } |
| 52 | 51 | } |
| 53 | 52 | chdir($currentDir); |
@@ -13,9 +13,10 @@ discard block |
||
| 13 | 13 | $pk_menu = $i["pk_menu"]; |
| 14 | 14 | array_push($temp, array("label" => $i["label"], "link" => $i["link"], "submenu" => [])); |
| 15 | 15 | $submenu = $this->queryFetch("SELECT * FROM menu WHERE fk_menu = $pk_menu ORDER BY `order`"); |
| 16 | - if($submenu) |
|
| 17 | - foreach ($submenu as $j) |
|
| 16 | + if($submenu) { |
|
| 17 | + foreach ($submenu as $j) |
|
| 18 | 18 | array_push( $temp[count($temp)-1]["submenu"], array("label" => $j["label"], "link" => $j["link"], []) ); |
| 19 | + } |
|
| 19 | 20 | } |
| 20 | 21 | } |
| 21 | 22 | $this->tags["menu"] = $temp; |
@@ -26,9 +27,9 @@ discard block |
||
| 26 | 27 | $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; |
| 27 | 28 | foreach ($this->tags["menu"] as $i) { |
| 28 | 29 | $active = $this->isSubString($actual_link,array_merge(array_column($i["submenu"], 'link'), array($i["link"])))? "active" : ""; |
| 29 | - if( is_array($i["submenu"]) && count($i["submenu"])<1) |
|
| 30 | - $temp .= "<li class='$active'><a href='$i[link]'>$i[label]</a></li>"; |
|
| 31 | - else { |
|
| 30 | + if( is_array($i["submenu"]) && count($i["submenu"])<1) { |
|
| 31 | + $temp .= "<li class='$active'><a href='$i[link]'>$i[label]</a></li>"; |
|
| 32 | + } else { |
|
| 32 | 33 | $temp .= "<li class='dropdown $active'>"; |
| 33 | 34 | $temp .= |
| 34 | 35 | '<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'. |
@@ -36,8 +37,9 @@ discard block |
||
| 36 | 37 | '<span class="caret"></span>'. |
| 37 | 38 | '</a>'. |
| 38 | 39 | '<ul class="dropdown-menu">'; |
| 39 | - foreach ($i["submenu"] as $j) |
|
| 40 | - $temp .= "<li><a href='$j[link]'>$j[label]</a></li>"; |
|
| 40 | + foreach ($i["submenu"] as $j) { |
|
| 41 | + $temp .= "<li><a href='$j[link]'>$j[label]</a></li>"; |
|
| 42 | + } |
|
| 41 | 43 | $temp .= "</ul></li>"; |
| 42 | 44 | } |
| 43 | 45 | } |
@@ -45,17 +47,19 @@ discard block |
||
| 45 | 47 | } |
| 46 | 48 | protected function isSubString( $_string, $_list) { |
| 47 | 49 | $success = false; |
| 48 | - foreach ($_list as $i) |
|
| 49 | - if(strpos($_string,$i) !== false) |
|
| 50 | + foreach ($_list as $i) { |
|
| 51 | + if(strpos($_string,$i) !== false) |
|
| 50 | 52 | $success = true; |
| 53 | + } |
|
| 51 | 54 | return $success; |
| 52 | 55 | } |
| 53 | 56 | public function loginWithUser() { |
| 54 | 57 | $this->init(); |
| 55 | 58 | $temp = []; |
| 56 | 59 | $user = ""; |
| 57 | - if(!isset($_SESSION["username"])) |
|
| 58 | - $_SESSION["username"] ="guest"; |
|
| 60 | + if(!isset($_SESSION["username"])) { |
|
| 61 | + $_SESSION["username"] ="guest"; |
|
| 62 | + } |
|
| 59 | 63 | $user = $_SESSION["username"]; |
| 60 | 64 | $blackList = $this->queryFetch( |
| 61 | 65 | "SELECT user.*,user_section.* |
@@ -69,11 +73,13 @@ discard block |
||
| 69 | 73 | foreach ($this->tags["menu"] as $i) { |
| 70 | 74 | $success = true; |
| 71 | 75 | $k = $i["label"]; |
| 72 | - foreach ($blackList as $j) |
|
| 73 | - if( $j["section"] == $k) |
|
| 76 | + foreach ($blackList as $j) { |
|
| 77 | + if( $j["section"] == $k) |
|
| 74 | 78 | $success = false; |
| 75 | - if($success) |
|
| 76 | - array_push($temp,$i); |
|
| 79 | + } |
|
| 80 | + if($success) { |
|
| 81 | + array_push($temp,$i); |
|
| 82 | + } |
|
| 77 | 83 | } |
| 78 | 84 | $this->tags["menu"] = $temp; |
| 79 | 85 | } |
@@ -3,17 +3,17 @@ |
||
| 3 | 3 | public function __construct() { |
| 4 | 4 | parent::__construct(); |
| 5 | 5 | } |
| 6 | - public function init( $_page ) { |
|
| 6 | + public function init($_page) { |
|
| 7 | 7 | $this->tags = $_page->tags; |
| 8 | 8 | } |
| 9 | - public function draw( $_template ) { |
|
| 9 | + public function draw($_template) { |
|
| 10 | 10 | $page = file_get_contents($_template); |
| 11 | 11 | $render = $this->overlayTag($page); |
| 12 | 12 | echo minifyOutput($render); |
| 13 | 13 | } |
| 14 | - protected function overlayTag( $_page ) { |
|
| 15 | - foreach($this->tags as $key => $value) |
|
| 16 | - if(!is_array($value)) |
|
| 14 | + protected function overlayTag($_page) { |
|
| 15 | + foreach ($this->tags as $key => $value) |
|
| 16 | + if (!is_array($value)) |
|
| 17 | 17 | $_page = str_replace("<_${key}_>", "$value", $_page); |
| 18 | 18 | return $_page; |
| 19 | 19 | } |
@@ -12,9 +12,10 @@ |
||
| 12 | 12 | echo minifyOutput($render); |
| 13 | 13 | } |
| 14 | 14 | protected function overlayTag( $_page ) { |
| 15 | - foreach($this->tags as $key => $value) |
|
| 16 | - if(!is_array($value)) |
|
| 15 | + foreach($this->tags as $key => $value) { |
|
| 16 | + if(!is_array($value)) |
|
| 17 | 17 | $_page = str_replace("<_${key}_>", "$value", $_page); |
| 18 | + } |
|
| 18 | 19 | return $_page; |
| 19 | 20 | } |
| 20 | 21 | } |
@@ -8,23 +8,23 @@ |
||
| 8 | 8 | $this->tags["brandImg"] = ""; |
| 9 | 9 | $this->tags["menu"] = ""; |
| 10 | 10 | $this->tags["title"] = ""; |
| 11 | - $this->tags["subtitle"] = ""; |
|
| 11 | + $this->tags["subtitle"] = ""; |
|
| 12 | 12 | $this->tags["content"] = ""; |
| 13 | - $this->tags["outContent"] = ""; |
|
| 13 | + $this->tags["outContent"] = ""; |
|
| 14 | 14 | $this->tags["footer"] = ""; |
| 15 | 15 | $this->tags["pagePath"] = []; |
| 16 | - $this->tags["css"] = []; |
|
| 17 | - $this->tags["js"] = []; |
|
| 16 | + $this->tags["css"] = []; |
|
| 17 | + $this->tags["js"] = []; |
|
| 18 | 18 | $this->tags["jsVariables"] = []; |
| 19 | - $this->tags["metaDescription"] = []; |
|
| 20 | - $this->tags["metaKeywords"] = []; |
|
| 19 | + $this->tags["metaDescription"] = []; |
|
| 20 | + $this->tags["metaKeywords"] = []; |
|
| 21 | 21 | $this->tags["metaAuthor"] = []; |
| 22 | 22 | } |
| 23 | 23 | public function uniforma() { |
| 24 | 24 | $this->addDipendences(); |
| 25 | 25 | $this->tags["css"] = array_unique($this->tags["css"]); |
| 26 | 26 | $this->tags["js"] = array_unique($this->tags["js"]); |
| 27 | - $this->tags["pagePath"] = json_encode($this->tags["pagePath"]); |
|
| 27 | + $this->tags["pagePath"] = json_encode($this->tags["pagePath"]); |
|
| 28 | 28 | $tempStr = ""; |
| 29 | 29 | foreach ($this->tags["css"] as $i) |
| 30 | 30 | $tempStr .= "<link rel='stylesheet' href='$i'>"; |
@@ -26,17 +26,20 @@ |
||
| 26 | 26 | $this->tags["js"] = array_unique($this->tags["js"]); |
| 27 | 27 | $this->tags["pagePath"] = json_encode($this->tags["pagePath"]); |
| 28 | 28 | $tempStr = ""; |
| 29 | - foreach ($this->tags["css"] as $i) |
|
| 30 | - $tempStr .= "<link rel='stylesheet' href='$i'>"; |
|
| 29 | + foreach ($this->tags["css"] as $i) { |
|
| 30 | + $tempStr .= "<link rel='stylesheet' href='$i'>"; |
|
| 31 | + } |
|
| 31 | 32 | $this->tags["css"] = $tempStr; |
| 32 | 33 | $tempStr = ""; |
| 33 | - foreach ($this->tags["js"] as $i) |
|
| 34 | - $tempStr .= "<script src='$i'></script>"; |
|
| 34 | + foreach ($this->tags["js"] as $i) { |
|
| 35 | + $tempStr .= "<script src='$i'></script>"; |
|
| 36 | + } |
|
| 35 | 37 | $this->tags["js"] = $tempStr; |
| 36 | 38 | $tempStr = ""; |
| 37 | 39 | $tempStr .= "<script type='text/javascript'>"; |
| 38 | - foreach ($this->tags["jsVariables"] as $i) |
|
| 39 | - $tempStr .= " $i[0] = $i[1];\n"; |
|
| 40 | + foreach ($this->tags["jsVariables"] as $i) { |
|
| 41 | + $tempStr .= " $i[0] = $i[1];\n"; |
|
| 42 | + } |
|
| 40 | 43 | $tempStr .= "</script>"; |
| 41 | 44 | $this->tags["jsVariables"] = $tempStr; |
| 42 | 45 | } |