Ignore:
Timestamp:
Apr 6, 2020, 11:17:40 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code format.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/View.php

    r796 r873  
    2626
    2727    // TODO: Move to external code
    28     if(isset($this->System->Config['Web']['FormatHTML']))
     28    if (isset($this->System->Config['Web']['FormatHTML']))
    2929      $this->FormatHTML = $this->System->Config['Web']['FormatHTML'];
    30     if(isset($this->System->Config['Web']['ShowRuntimeInfo']))
     30    if (isset($this->System->Config['Web']['ShowRuntimeInfo']))
    3131      $this->ShowRuntimeInfo = $this->System->Config['Web']['ShowRuntimeInfo'];
    32     if(isset($this->System->Config['Web']['Charset']))
     32    if (isset($this->System->Config['Web']['Charset']))
    3333      $this->Encoding = $this->System->Config['Web']['Charset'];
    34     if(isset($this->System->Config['Web']['Style']))
     34    if (isset($this->System->Config['Web']['Style']))
    3535      $this->Style = $this->System->Config['Web']['Style'];
    3636  }
     
    3838  function SystemMessage($Title, $Text)
    3939  {
    40     return('<table align="center"><tr><td><div class="SystemMessage"><h3>'.$Title.'</h3><div>'.$Text.'</div></div></td></tr></table>');
     40    return ('<table align="center"><tr><td><div class="SystemMessage"><h3>'.$Title.'</h3><div>'.$Text.'</div></div></td></tr></table>');
    4141    //ShowFooter();
    4242    //die();
     
    4545  function ShowNavigation($Page)
    4646  {
    47     if(array_key_exists('REQUEST_URI', $_SERVER))
     47    if (array_key_exists('REQUEST_URI', $_SERVER))
    4848      $ScriptName = $_SERVER['REQUEST_URI'];
    4949      else $ScriptName = '';
    50     while(strpos($ScriptName, '//') !== false)
     50    while (strpos($ScriptName, '//') !== false)
    5151      $ScriptName = str_replace('//', '/', $ScriptName);
    52     if(strpos($ScriptName, '?') !== false)
     52    if (strpos($ScriptName, '?') !== false)
    5353      $ScriptName = substr($ScriptName, 0, strrpos($ScriptName, '?'));
    5454    $ScriptName = substr($ScriptName, strlen($this->System->Link('')));
    55     if(substr($ScriptName, -1, 1) == '/') $ScriptName = substr($ScriptName, 0, -1);
     55    if (substr($ScriptName, -1, 1) == '/') $ScriptName = substr($ScriptName, 0, -1);
    5656
    5757    $Output = '';
    58     while($Page)
     58    while ($Page)
    5959    {
    6060      $Output = ' &gt; <a href="'.$this->System->Link($ScriptName).'/">'.$Page->ShortTitle.'</a>'.$Output;
    6161
    62       if(class_exists($Page->ParentClass))
     62      if (class_exists($Page->ParentClass))
    6363      {
    6464        $PageClass = $Page->ParentClass;
     
    6868    }
    6969    $Output = substr($Output, 6);
    70     return($Output);
     70    return ($Output);
    7171  }
    7272
     
    7979
    8080    $BodyParam = '';
    81     if(isset($Page->Load)) $BodyParam .= ' onload="'.$Page->Load.'"';
    82     if(isset($Page->Unload)) $BodyParam .= ' onunload="'.$Page->Unload.'"';
     81    if (isset($Page->Load)) $BodyParam .= ' onload="'.$Page->Load.'"';
     82    if (isset($Page->Unload)) $BodyParam .= ' onunload="'.$Page->Unload.'"';
    8383    $Output = '<?xml version="1.0" encoding="'.$this->Encoding.'"?>'."\n".
    8484    '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'.
     
    9191    // Show page headers
    9292    $Bar = '';
    93     foreach($this->System->PageHeaders as $Item)
     93    foreach ($this->System->PageHeaders as $Item)
    9494      $Output .= call_user_func($Item);
    9595
    9696    $Output .= '</head><body'.$BodyParam.'>';
    97     if($this->BasicHTML == false)
     97    if ($this->BasicHTML == false)
    9898    {
    9999      //$Output .= '<div class="MainTitle">'.$Title.'</div>';
    100100      $Output .= '<div class="MainTitle"><span class="MenuItem"><strong>Navigace :: </strong> '.$Navigation.'</span><div class="MenuItem2">';
    101101      $Bar = '';
    102       foreach($this->System->Bars['Top'] as $BarItem)
     102      foreach ($this->System->Bars['Top'] as $BarItem)
    103103        $Bar .= call_user_func($BarItem);
    104       if(trim($Bar) != '') $Output .= $Bar;
     104      if (trim($Bar) != '') $Output .= $Bar;
    105105        else $Output .= '&nbsp;';
    106106      $Output .= '</div></div>';
    107107    }
    108     return($Output);
     108    return ($Output);
    109109  }
    110110
     
    115115    $Time = round(GetMicrotime() - $ScriptTimeStart, 2);
    116116    $Output = '';
    117     if($this->BasicHTML == false)
     117    if ($this->BasicHTML == false)
    118118    {
    119119      $Output .= '<div id="Footer">'.
    120120      '<i>| Správa webu: '.$this->System->Config['Web']['Admin'].' | e-mail: '.$this->System->Config['Web']['AdminEmail'].' | '.
    121121      ' Verze: '.$Revision.' ('.$this->System->HumanDate($ReleaseTime).') |';
    122       if($this->ShowRuntimeInfo == true) $Output .= ' Doba generování: '.$Time.' s / '.ini_get('max_execution_time').
     122      if ($this->ShowRuntimeInfo == true) $Output .= ' Doba generování: '.$Time.' s / '.ini_get('max_execution_time').
    123123        ' s | Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B |';
    124124      $Output .= '</i></div>';
    125125    }
    126126    $Output .= '</body></html>';
    127     return($Output);
     127    return ($Output);
    128128  }
    129129
     
    133133
    134134    $Output = $Page->Show();
    135     if($Page->ClearPage == false)
     135    if ($Page->ClearPage == false)
    136136    {
    137137      $Output = $this->ShowHeader($Page).$Output.$this->ShowFooter();
    138       if($this->FormatHTML == true) $Output = $this->FormatOutput($Output);
     138      if ($this->FormatHTML == true) $Output = $this->FormatOutput($Output);
    139139    }
    140     return($Output);
     140    return ($Output);
    141141  }
    142142
     
    147147    $Page->Database = $this->Database;
    148148    $Page->FormatHTML = $this->FormatHTML;
    149     return($Page);
     149    return ($Page);
    150150  }
    151151
     
    156156    $nn = 0;
    157157    $n = 0;
    158     while($s != '')
     158    while ($s != '')
    159159    {
    160160      $start = strpos($s, '<');
    161161      $end = strpos($s, '>');
    162       if($start != 0)
     162      if ($start != 0)
    163163      {
    164164        $end = $start - 1;
     
    166166      }
    167167      $line = trim(substr($s, $start, $end + 1));
    168       if(strlen($line) > 0)
    169       if($line[0] == '<')
     168      if (strlen($line) > 0)
     169      if ($line[0] == '<')
    170170      {
    171         if($s[$start + 1] == '/')
     171        if ($s[$start + 1] == '/')
    172172        {
    173173          $n = $n - 2;
     
    175175        } else
    176176        {
    177           if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);
     177          if (strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);
    178178          else $cmd = substr($line, 1, strlen($line) - 2);
    179179          //echo('['.$cmd.']');
    180           if(strpos($s, '</'.$cmd.'>')) $n = $n + 2;
     180          if (strpos($s, '</'.$cmd.'>')) $n = $n + 2;
    181181        }
    182182      }// else $line = '['.$line.']';
    183       //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));
    184       if($line != '') $out .= (str_repeat(' ', $nn).$line."\n");
     183      //if ($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));
     184      if ($line != '') $out .= (str_repeat(' ', $nn).$line."\n");
    185185      $s = substr($s, $end + 1, strlen($s));
    186186      $nn = $n;
    187187    }
    188     return($out);
     188    return ($out);
    189189  }
    190190}
Note: See TracChangeset for help on using the changeset viewer.