Changeset 9 for trunk/Global.php
- Timestamp:
- Jun 1, 2023, 1:01:38 AM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Global.php
r7 r9 1 1 <?php 2 2 3 function HumanDate( $Time)3 function HumanDate(?string $Time): string 4 4 { 5 5 return date('j.n.Y', $Time); 6 6 } 7 7 8 function GetMicrotime() 8 function GetMicrotime(): float 9 9 { 10 list($Usec, $Sec) = explode( " ", microtime());10 list($Usec, $Sec) = explode(' ', microtime()); 11 11 return (float)$Usec + (float)$Sec; 12 } 12 } 13 13 14 function MakeLink( $Target, $Title)14 function MakeLink(string $Target, string $Title): string 15 15 { 16 16 return '<a href="'.$Target.'">'.$Title.'</a>'; 17 17 } 18 18 19 function Table( $Table)19 function Table(array $Table): string 20 20 { 21 $Result = '<table cellspacing="0" class="BasicTable">'; 22 $Result .= '<tr>'; 23 foreach ($Table['Header'] as $Item) 24 $Result .= '<th>'.$Item.'</th>'; 25 $Result .= '</tr>'; 21 $Result = '<table class="BasicTable">'; 22 if (array_key_exists('Header', $Table)) 23 { 24 $Result .= '<tr>'; 25 foreach ($Table['Header'] as $Item) 26 $Result .= '<th>'.$Item.'</th>'; 27 $Result .= '</tr>'; 28 } 26 29 foreach ($Table['Rows'] as $Row) 27 30 { 28 31 $Result .= '<tr>'; 29 foreach ($Row as $Item) 30 $Result .= '<td>'.$Item.'</td>'; 32 foreach ($Row as $Index => $Item) 33 { 34 if ($Index == 0) $Class = ' class="Header"'; else $Class = ''; 35 $Result .= '<td'.$Class.' style="width: '.(floor(100 / count($Row))).'%">'.$Item.'</td>'; 36 } 31 37 $Result .= '</tr>'; 32 38 } … … 35 41 } 36 42 37 function ShowEditTable( $ClassName, $Values)43 function ShowEditTable(string $ClassName, array $Values): string 38 44 { 39 45 global $Classes, $Types; … … 68 74 } 69 75 70 function ProcessURL() 76 function ProcessURL(): array 71 77 { 72 78 if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER)) … … 82 88 } 83 89 84 function GetQueryStringArray( $QueryString)90 function GetQueryStringArray(string $QueryString): array 85 91 { 86 92 $Result = array(); … … 98 104 } 99 105 100 function SetQueryStringArray( $QueryStringArray)106 function SetQueryStringArray(array $QueryStringArray): string 101 107 { 102 108 $Parts = array(); … … 108 114 } 109 115 110 function GetRemoteAddress() 116 function GetRemoteAddress(): string 111 117 { 112 118 if (array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR'];
Note:
See TracChangeset
for help on using the changeset viewer.