-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
48 lines (40 loc) · 851 Bytes
/
functions.php
File metadata and controls
48 lines (40 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
function MakeHeader(): string
{
$pages = array('home', 'products', 'cart', 'login', 'admin', 'info');
$uri = get_url();
if ($uri == '' || $uri == '/')
return $uri;
$uri = substr($uri, 1);
$page = in_array($uri, $pages)? $uri : 'home';
return $page;
}
function abaAtiva(bool $flag): string
{
if($flag)
{
return "class='nav-link active' aria-current='page'";
}
else
{
return "class='nav-link'";
}
}
function get_url(): string
{
if(isset($_SERVER['REQUEST_URI']))
{
$uri = explode('trabalho', $_SERVER['REQUEST_URI']);
$uri = $uri[array_key_last($uri)];
return $uri;
}
else
{
return '';
}
}
function dump_informations(array $value): void
{
echo "<pre>" . var_dump($value) . "</pre>";
die();
}