Ignore:
Timestamp:
Nov 20, 2020, 12:08:12 AM (3 years ago)
Author:
chronos
Message:
  • Added: Static types added to almost all classes, methods and function. Supported by PHP 7.4.
  • Fixed: Various found code issues.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/TV/TV.php

    r874 r887  
    55class PageIPTV extends Page
    66{
    7   var $FullTitle = 'Síťová televize';
    8   var $ShortTitle = 'IPTV';
    9   var $ParentClass = 'PagePortal';
    10 
    11   function Show()
     7  function __construct(System $System)
    128  {
    13     if (count($this->System->PathItems) > 1)
    14     {
    15       if ($this->System->PathItems[1] == 'playlist.m3u') return $this->ShowPlayList();
    16         else return PAGE_NOT_FOUND;
    17     } else return $this->ShowChannelList();
     9    parent::__construct($System);
     10    $this->FullTitle = 'Síťová televize';
     11    $this->ShortTitle = 'IPTV';
     12    $this->ParentClass = 'PagePortal';
    1813  }
    1914
    20   function ShowChannelList()
     15  function Show(): string
    2116  {
    22     global $Channels;
    23 
    24     $Output = 'Stažení přehrávače: <a href="http://www.videolan.org/vlc/">VLC Media Player</a><br/>'.
     17    $Output = 'Stažení přehrávače: <a href="https://www.videolan.org/vlc/">VLC Media Player</a><br/>'.
    2518    'Seznam všech kanálů do přehrávače: <a href="playlist.m3u">Playlist</a><br/>'.
    2619    'Zobrazení playlistu ve VLC lze provést pomocí menu <strong>View - Playlist</strong> nebo klávesové zkratky CTRL+L<br/>'.
     
    2821    '<div align="center"><strong>Výpis kanálů:</strong><br>';
    2922
    30     $Where =
    3123    $DbResult = $this->Database->query('SELECT COUNT(*) FROM `TV` LEFT JOIN `TVGroup` ON `TVGroup`.`Id` = `TV`.`Category` '.
    3224      ' LEFT JOIN `Language` ON `Language`.`Id` = `TV`.`Language` WHERE (`TV`.`Stream` <> "") OR (`TV`.`StreamWeb` <> "")');
     
    6961    $Output .= '</div><br/>';
    7062
    71     $Output .= 'Další online TV na webu: <a href="http://spustit.cz">Spustit.cz</a><br/>';
    72     $Output .= 'Další online TV na webu: <a href="http://www.tvinfo.cz/live/televize/evropa/cz">TV info</a><br/>';
     63    $Output .= 'Další online TV na webu: <a href="https://spustit.cz/">Spustit.cz</a><br/>';
    7364
    7465    return $Output;
    7566  }
     67}
    7668
    77   function ShowPlayList()
     69class PagePlaylist extends Page
     70{
     71  function Show(): string
    7872  {
    7973    $this->ClearPage = true;
     
    8276    Header("Content-Disposition: attachment; filename=playlist.m3u");
    8377
    84     echo('#EXTM3U'."\n");
     78    $Output = '#EXTM3U'."\n";
    8579    if (array_key_exists('id', $_GET))
    8680    {
     
    8983      {
    9084        $Channel = $DbResult->fetch_array();
    91         echo('#EXTINF:0,'.$Channel['Name']."\n");
    92         echo($Channel['Stream']."\n");
     85        $Output .= '#EXTINF:0,'.$Channel['Name']."\n";
     86        $Output .= $Channel['Stream']."\n";
    9387      }
    9488    } else
     
    9791      while ($Channel = $DbResult->fetch_array())
    9892      {
    99         echo('#EXTINF:0,'.$Channel['Name']."\n");
    100         echo($Channel['Stream']."\n");
     93        $Output .= '#EXTINF:0,'.$Channel['Name']."\n";
     94        $Output .= $Channel['Stream']."\n";
    10195      }
    10296    }
     97    return $Output;
    10398  }
    10499}
     
    106101class ModuleTV extends AppModule
    107102{
    108   function __construct($System)
     103  function __construct(System $System)
    109104  {
    110105    parent::__construct($System);
     
    117112  }
    118113
    119   function DoInstall()
     114  function DoInstall(): void
    120115  {
    121116  }
    122117
    123   function DoUninstall()
     118  function DoUninstall(): void
    124119  {
    125120  }
    126121
    127   function DoStart()
     122  function DoStart(): void
    128123  {
    129     $this->System->RegisterPage('tv', 'PageIPTV');
     124    $this->System->RegisterPage(['tv'], 'PageIPTV');
     125    $this->System->RegisterPage(['tv', 'playlist.m3u'], 'PagePlaylist');
    130126    $this->System->FormManager->RegisterClass('TV', array(
    131127      'Title' => 'TV kanály',
     
    170166  }
    171167
    172   function DoStop()
     168  function DoStop(): void
    173169  {
    174170  }
Note: See TracChangeset for help on using the changeset viewer.