Changeset 887 for trunk/Common/Global.php
- Timestamp:
- Nov 20, 2020, 12:08:12 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Global.php
r874 r887 20 20 $YesNo = array(false => 'Ne', true => 'Ano'); 21 21 22 function HumanSize( $Value)22 function HumanSize(int $Value): string 23 23 { 24 24 global $UnitNames; … … 33 33 } 34 34 35 function GetMicrotime() 35 function GetMicrotime(): float 36 36 { 37 37 list($Usec, $Sec) = explode(' ', microtime()); … … 39 39 } 40 40 41 function ShowArray( $Pole)41 function ShowArray(array $Array): void 42 42 { 43 43 echo('<pre style="font-size: 8pt;">'); 44 print_r($ Pole);44 print_r($Array); 45 45 echo('</pre>'); 46 46 } 47 47 48 function HumanDate( $Time)48 function HumanDate(?string $Time): string 49 49 { 50 50 if ($Time != '') … … 58 58 59 59 // Show page listing numbers 60 function PagesList( $URL, $Page, $TotalCount, $CountPerPage)60 function PagesList(string $URL, int $Page, int $TotalCount, int $CountPerPage): string 61 61 { 62 62 $Count = ceil($TotalCount / $CountPerPage); … … 94 94 } 95 95 96 function ExtractTime($Time) 96 function ExtractTime($Time): array 97 97 { 98 98 return array( … … 106 106 } 107 107 108 function GetQueryStringArray( $QueryString)108 function GetQueryStringArray(string $QueryString): array 109 109 { 110 110 $Result = array(); … … 122 122 } 123 123 124 function SetQueryStringArray( $QueryStringArray)124 function SetQueryStringArray(array $QueryStringArray): string 125 125 { 126 126 $Parts = array(); … … 132 132 } 133 133 134 function GetPageList( $ObjectName, $TotalCount)134 function GetPageList(string $ObjectName, int $TotalCount): array 135 135 { 136 136 global $System; … … 209 209 $OrderArrowImage = array('sort_asc.png', 'sort_desc.png'); 210 210 211 function GetOrderTableHeader( $ObjectName, $Columns, $DefaultColumn, $DefaultOrder = 0)211 function GetOrderTableHeader(string $ObjectName, array $Columns, string $DefaultColumn, int $DefaultOrder = 0): array 212 212 { 213 213 global $OrderDirSQL, $OrderArrowImage, $Config, $System; … … 262 262 } 263 263 264 function GetRemoteAddress() 264 function GetRemoteAddress(): string 265 265 { 266 266 if (array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR']; … … 269 269 } 270 270 271 function IsInternetAddr() 271 function IsInternetAddr(): bool 272 272 { 273 273 global $Config; … … 286 286 } 287 287 288 function GetMemberByIP($IP) 289 { 290 global $Database; 291 288 function GetMemberByIP(Database $Database, string $IP): string 289 { 292 290 $DbResult = $Database->query('SELECT `Id` FROM `Member` WHERE '. 293 291 '(SELECT `Member` FROM `NetworkDevice` WHERE (SELECT `Device` FROM `NetworkInterface` '. … … 300 298 } 301 299 302 function CommandExist( $Command)300 function CommandExist(string $Command): bool 303 301 { 304 302 $Result = shell_exec('which '.$Command); … … 306 304 } 307 305 308 function RemoveDiacritic( $Text)306 function RemoveDiacritic(string $Text): string 309 307 { 310 308 return str_replace( … … 316 314 } 317 315 318 function RouterOSIdent( $Name)316 function RouterOSIdent(string $Name): string 319 317 { 320 318 return strtr(strtolower(trim($Name)), array(' ' => '-', '.' => '', '(' => '-', ')' => '-', ',' => '-', … … 328 326 } 329 327 330 function NotBlank( $Text)328 function NotBlank(string $Text): string 331 329 { 332 330 if ($Text == '') return ' '; … … 334 332 } 335 333 336 function strip_cdata( $string)334 function strip_cdata(string $string): string 337 335 { 338 336 preg_match_all('/<!\[cdata\[(.*?)\]\]>/is', $string, $matches); … … 351 349 } 352 350 353 function ProcessURL() 351 function ProcessURL(): array 354 352 { 355 353 if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER)) … … 365 363 } 366 364 367 function RepeatFunction( $Period, $Callback)365 function RepeatFunction(int $Period, callable $Callback): void 368 366 { 369 367 while (1) … … 384 382 return call_user_func_array('pack', array_merge(array($v), (array)$a)); 385 383 } 386
Note:
See TracChangeset
for help on using the changeset viewer.