Changeset 55 for trunk/View.php


Ignore:
Timestamp:
Apr 7, 2020, 12:55:39 AM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/View.php

    r39 r55  
    2727
    2828    // TODO: Move to external code
    29     if(isset($this->System->Config['Web']['FormatHTML']))
     29    if (isset($this->System->Config['Web']['FormatHTML']))
    3030      $this->FormatHTML = $this->System->Config['Web']['FormatHTML'];
    31     if(isset($this->System->Config['Web']['ShowRuntimeInfo']))
     31    if (isset($this->System->Config['Web']['ShowRuntimeInfo']))
    3232      $this->ShowRuntimeInfo = $this->System->Config['Web']['ShowRuntimeInfo'];
    33     if(isset($this->System->Config['Web']['Charset']))
     33    if (isset($this->System->Config['Web']['Charset']))
    3434      $this->Encoding = $this->System->Config['Web']['Charset'];
    35     if(isset($this->System->Config['Web']['Style']))
     35    if (isset($this->System->Config['Web']['Style']))
    3636      $this->Style = $this->System->Config['Web']['Style'];
    3737  }
     
    3939  function SystemMessage($Title, $Text)
    4040  {
    41     return('<table align="center"><tr><td><div class="SystemMessage"><h3>'.$Title.'</h3><div>'.$Text.'</div></div></td></tr></table>');
     41    return '<table align="center"><tr><td><div class="SystemMessage"><h3>'.$Title.'</h3><div>'.$Text.'</div></div></td></tr></table>';
    4242    //ShowFooter();
    4343    //die();
     
    4646  function ShowNavigation($Page)
    4747  {
    48     if(array_key_exists('REQUEST_URI', $_SERVER))
     48    if (array_key_exists('REQUEST_URI', $_SERVER))
    4949      $ScriptName = $_SERVER['REQUEST_URI'];
    5050      else $ScriptName = '';
    51     while(strpos($ScriptName, '//') !== false)
     51    while (strpos($ScriptName, '//') !== false)
    5252      $ScriptName = str_replace('//', '/', $ScriptName);
    53     if(strpos($ScriptName, '?') !== false)
     53    if (strpos($ScriptName, '?') !== false)
    5454      $ScriptName = substr($ScriptName, 0, strrpos($ScriptName, '?'));
    5555    $ScriptName = substr($ScriptName, strlen($this->System->Link('')));
    56     if(substr($ScriptName, -1, 1) == '/') $ScriptName = substr($ScriptName, 0, -1);
     56    if (substr($ScriptName, -1, 1) == '/') $ScriptName = substr($ScriptName, 0, -1);
    5757
    5858    $Output = '';
    59     while($Page)
     59    while ($Page)
    6060    {
    6161      $Output = ' &gt; <a href="'.$this->System->Link($ScriptName).'/">'.$Page->ShortTitle.'</a>'.$Output;
    6262
    63       if(class_exists($Page->ParentClass))
     63      if (class_exists($Page->ParentClass))
    6464      {
    6565        $PageClass = $Page->ParentClass;
     
    6969    }
    7070    $Output = substr($Output, 6);
    71     return($Output);
     71    return $Output;
    7272  }
    7373
     
    8080
    8181    $BodyParam = '';
    82     if(isset($Page->Load)) $BodyParam .= ' onload="'.$Page->Load.'"';
    83     if(isset($Page->Unload)) $BodyParam .= ' onunload="'.$Page->Unload.'"';
     82    if (isset($Page->Load)) $BodyParam .= ' onload="'.$Page->Load.'"';
     83    if (isset($Page->Unload)) $BodyParam .= ' onunload="'.$Page->Unload.'"';
    8484    $Output = '<?xml version="1.0" encoding="'.$this->Encoding.'"?>'."\n".
    8585    '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'.
     
    9696    // Show page headers
    9797    $Bar = '';
    98     foreach($this->System->PageHeaders as $Item)
     98    foreach ($this->System->PageHeaders as $Item)
    9999      $Output .= call_user_func($Item);
    100100
    101101    $Output .= '</head><body'.$BodyParam.'>';
    102102    $Output .= $this->System->ShowMenu();
    103     if($this->BasicHTML == false)
     103    if ($this->BasicHTML == false)
    104104    {
    105105      //$Output .= '<div class="MainTitle">'.$Title.'</div>';
     
    107107        $Output .= '<div class="MainTitle"><span class="MenuItem"><strong>Navigace :: </strong> '.$Navigation.'</span><div class="MenuItem2">';
    108108      $Bar = '';
    109       foreach($this->System->Bars['Top'] as $BarItem)
     109      foreach ($this->System->Bars['Top'] as $BarItem)
    110110        $Bar .= call_user_func($BarItem);
    111       if(trim($Bar) != '') $Output .= $Bar;
     111      if (trim($Bar) != '') $Output .= $Bar;
    112112        else $Output .= '&nbsp;';
    113113      $Output .= '</div></div>';
    114114    }
    115     return($Output);
     115    return $Output;
    116116  }
    117117
     
    122122    $Time = round(GetMicrotime() - $ScriptTimeStart, 2);
    123123    $Output = '';
    124     if($this->BasicHTML == false)
     124    if ($this->BasicHTML == false)
    125125    {           
    126126      $Output .= '<div class="Footer">'.
     
    129129      $Output .= ' <a href="https://app.zdechov.net/tanec/">Zdrojový kód</a> ';
    130130      //$Output .= ' Verze: '.$Revision.' ('.HumanDate($ReleaseTime).') ';
    131       if($this->ShowRuntimeInfo == true)
     131      if ($this->ShowRuntimeInfo == true)
    132132      {
    133133        $Output .= ' Doba generování: '.$Time.' s / '.ini_get('max_execution_time').' s '.
     
    137137    }
    138138    $Output .= '</body></html>';
    139     return($Output);
     139    return $Output;
    140140  }
    141141
     
    145145
    146146    $Output = $Page->Show();
    147     if($Page->ClearPage == false)
     147    if ($Page->ClearPage == false)
    148148    {
    149149      $Output = $this->ShowHeader($Page).$Output.$this->ShowFooter();
    150       if($this->FormatHTML == true) $Output = $this->FormatOutput($Output);
    151     }
    152     return($Output);
     150      if ($this->FormatHTML == true) $Output = $this->FormatOutput($Output);
     151    }
     152    return $Output;
    153153  }
    154154
     
    159159    $Page->Database = $this->Database;
    160160    $Page->FormatHTML = $this->FormatHTML;
    161     return($Page);
     161    return $Page;
    162162  }
    163163
     
    168168    $nn = 0;
    169169    $n = 0;
    170     while($s != '')
     170    while ($s != '')
    171171    {
    172172      $start = strpos($s, '<');
    173173      $end = strpos($s, '>');
    174       if($start != 0)
     174      if ($start != 0)
    175175      {
    176176        $end = $start - 1;
     
    178178      }
    179179      $line = trim(substr($s, $start, $end + 1));
    180       if(strlen($line) > 0)
    181       if($line[0] == '<')
    182       {
    183         if($s[$start + 1] == '/')
     180      if (strlen($line) > 0)
     181      if ($line[0] == '<')
     182      {
     183        if ($s[$start + 1] == '/')
    184184        {
    185185          $n = $n - 2;
     
    187187        } else
    188188        {
    189           if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);
     189          if (strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);
    190190          else $cmd = substr($line, 1, strlen($line) - 2);
    191191          //echo('['.$cmd.']');
    192           if(strpos($s, '</'.$cmd.'>')) $n = $n + 2;
     192          if (strpos($s, '</'.$cmd.'>')) $n = $n + 2;
    193193        }
    194194      }// else $line = '['.$line.']';
    195       //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));
    196       if($line != '') $out .= (str_repeat(' ', $nn).$line."\n");
     195      //if ($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));
     196      if ($line != '') $out .= (str_repeat(' ', $nn).$line."\n");
    197197      $s = substr($s, $end + 1, strlen($s));
    198198      $nn = $n;
    199199    }
    200     return($out);
     200    return $out;
    201201  }
    202202}
Note: See TracChangeset for help on using the changeset viewer.