Changeset 9 for trunk/Global.php


Ignore:
Timestamp:
Jun 1, 2023, 1:01:38 AM (18 months ago)
Author:
chronos
Message:
  • Fixed: Modules initialization.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Global.php

    r7 r9  
    11<?php
    22
    3 function HumanDate($Time)
     3function HumanDate(?string $Time): string
    44{
    55  return date('j.n.Y', $Time);
    66}
    77
    8 function GetMicrotime()
     8function GetMicrotime(): float
    99{
    10   list($Usec, $Sec) = explode(" ", microtime());
     10  list($Usec, $Sec) = explode(' ', microtime());
    1111  return (float)$Usec + (float)$Sec;
    12 }
     12} 
    1313
    14 function MakeLink($Target, $Title)
     14function MakeLink(string $Target, string $Title): string
    1515{
    1616  return '<a href="'.$Target.'">'.$Title.'</a>';
    1717}
    1818
    19 function Table($Table)
     19function Table(array $Table): string
    2020{
    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  }
    2629  foreach ($Table['Rows'] as $Row)
    2730  {
    2831    $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    }
    3137    $Result .= '</tr>';
    3238  }
     
    3541}
    3642
    37 function ShowEditTable($ClassName, $Values)
     43function ShowEditTable(string $ClassName, array $Values): string
    3844{
    3945  global $Classes, $Types;
     
    6874}
    6975
    70 function ProcessURL()
     76function ProcessURL(): array
    7177{
    7278  if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))
     
    8288}
    8389
    84 function GetQueryStringArray($QueryString)
     90function GetQueryStringArray(string $QueryString): array
    8591{
    8692  $Result = array();
     
    98104}
    99105
    100 function SetQueryStringArray($QueryStringArray)
     106function SetQueryStringArray(array $QueryStringArray): string
    101107{
    102108  $Parts = array();
     
    108114}
    109115
    110 function GetRemoteAddress()
     116function GetRemoteAddress(): string
    111117{
    112118  if (array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR'];
Note: See TracChangeset for help on using the changeset viewer.