YaWK  24.1
Yet another WebKit
YAWK\WIDGETS\TWITCH\EMBED\twitch Class Reference

Embed any Twitch channel. More...

+ Inheritance diagram for YAWK\WIDGETS\TWITCH\EMBED\twitch:

Public Member Functions

 __construct ($db)
 Load all widget settings from database and fill object. More...
 
 init ()
 Init twitch widget. More...
 
- Public Member Functions inherited from YAWK\widget
 getHeading ($heading, $subtext)
 Get widget heading and subtext, return headline. More...
 
 getWidgetSettingsArray ($db)
 Get widget settings and return it as array. More...
 
 printObject ()
 Print all object data. More...
 

Public Attributes

 $twitchChannel = "yourChannel"
 
 $twitchChannelFullscreen = true
 
 $twitchChannelHeight = "720"
 
 $twitchChannelWidth = "100%"
 
 $twitchChat = "1"
 
 $twitchChatHeight = "250"
 
 $twitchChatWidth = "100%"
 
 $twitchHeading = ''
 
 $twitchSubtext = ''
 
 $widget = ''
 
- Public Attributes inherited from YAWK\widget
 $data
 
 $date_publish
 
 $date_unpublish
 
 $folder
 
 $id
 
 $marginBottom
 
 $marginTop
 
 $name
 
 $pageID
 
 $position
 
 $published
 
 $sort
 
 $widgetTitle
 
 $widgetType
 

Additional Inherited Members

- Static Public Member Functions inherited from YAWK\widget
static getAllSettingsIntoArray ($db, $widgetID)
 Returns an array with all widget settings data. More...
 
static getAllWidgetTypes ($db)
 Return all widget types as associative array. More...
 
static getCurrentWidgetPath ($db)
 return current widget path More...
 
static getFacebookLikeBox ()
 return the facebook likebox widget More...
 
static getLoginBox ()
 return the user login box widget More...
 
static loadWidgetsOfPage ($db, $page)
 Returns an array of all widgets that are linked with given page->id. More...
 

Detailed Description

Embed any Twitch channel.

Twitch Widget - embed any twitch channel

Twitch is a gaming streaming platform. Use this widget to embed any twitch channel. You can set your channel, width, height, either if the chat should be displayed or not, allow fullscreen and more.

Author
Daniel Retzl danie.nosp@m.lret.nosp@m.zl@gm.nosp@m.ail..nosp@m.com
Version
1.0.0

Definition at line 16 of file twitch.php.

Constructor & Destructor Documentation

◆ __construct()

YAWK\WIDGETS\TWITCH\EMBED\twitch::__construct (   $db)

Load all widget settings from database and fill object.

Parameters
object$dbDatabase Object

Load all widget settings on object init.

Definition at line 44 of file twitch.php.

46  {
47  // load this widget settings from db
48  $this->widget = new \YAWK\widget();
49  $settings = $this->widget->getWidgetSettingsArray($db);
50  foreach ($settings as $property => $value) {
51  $this->$property = $value;
52  }
if(isset($_POST['save'])) $settings
$value

References $db, $settings, $value, and YAWK\widget\getWidgetSettingsArray().

Member Function Documentation

◆ init()

YAWK\WIDGETS\TWITCH\EMBED\twitch::init ( )

Init twitch widget.

Twitch Widget Init

Definition at line 58 of file twitch.php.

60  { // display heading
61  echo $this->getHeading($this->twitchHeading, $this->twitchSubtext);
62  // to output correct html
63  if ($this->twitchChannelFullscreen === "true") { // set fullscreen property
64  $allowfullscreen = "allowfullscreen=\"true\"";
65  } else { // or leave empty if fullscreen should be false
66  $allowfullscreen = '';
67  }
68 // HTML output
69  echo "
70 <!-- twitch video stream -->
71 <iframe
72  src=\"http://player.twitch.tv/?channel=$this->twitchChannel\"
73  height=\"$this->twitchChannelHeight\"
74  width=\"$this->twitchChannelWidth\"
75  frameborder=\"0\"
76  scrolling=\"no\"
77  $allowfullscreen\">
78 </iframe>";
79 
80 // check if chat should be shown
81  if (isset($this->twitchChat) && ($this->twitchChat === 1)) { // ok, show chat html frame
82  echo "
83 
84 <!-- twitch chat -->
85 <iframe
86  frameborder=\"0\"
87  scrolling=\"no\"
88  src=\"http://www.twitch.tv/popout/$this->twitchChannel/chat\"
89  height=\"$this->twitchChatHeight\"
90  width=\"$this->twitchChatWidth\">
91 </iframe>";
92  }
getHeading($heading, $subtext)
Get widget heading and subtext, return headline.
Definition: widget.php:669

References YAWK\widget\getHeading().

Member Data Documentation

◆ $twitchChannel

YAWK\WIDGETS\TWITCH\EMBED\twitch::$twitchChannel = "yourChannel"
Parameters
stringChannel that will be included

Definition at line 25 of file twitch.php.

◆ $twitchChannelFullscreen

YAWK\WIDGETS\TWITCH\EMBED\twitch::$twitchChannelFullscreen = true
Parameters
boolAllow fullscreen?

Definition at line 31 of file twitch.php.

◆ $twitchChannelHeight

YAWK\WIDGETS\TWITCH\EMBED\twitch::$twitchChannelHeight = "720"
Parameters
stringHeight of your channel

Definition at line 27 of file twitch.php.

◆ $twitchChannelWidth

YAWK\WIDGETS\TWITCH\EMBED\twitch::$twitchChannelWidth = "100%"
Parameters
stringWidth of your channel

Definition at line 29 of file twitch.php.

◆ $twitchChat

YAWK\WIDGETS\TWITCH\EMBED\twitch::$twitchChat = "1"
Parameters
intShow chat window?

Definition at line 33 of file twitch.php.

◆ $twitchChatHeight

YAWK\WIDGETS\TWITCH\EMBED\twitch::$twitchChatHeight = "250"
Parameters
intChat window height

Definition at line 35 of file twitch.php.

◆ $twitchChatWidth

YAWK\WIDGETS\TWITCH\EMBED\twitch::$twitchChatWidth = "100%"
Parameters
intChat window width

Definition at line 37 of file twitch.php.

◆ $twitchHeading

YAWK\WIDGETS\TWITCH\EMBED\twitch::$twitchHeading = ''
Parameters
stringTitle that will be shown above widget

Definition at line 21 of file twitch.php.

◆ $twitchSubtext

YAWK\WIDGETS\TWITCH\EMBED\twitch::$twitchSubtext = ''
Parameters
stringSubtext will be displayed beside title

Definition at line 23 of file twitch.php.

◆ $widget

YAWK\WIDGETS\TWITCH\EMBED\twitch::$widget = ''
Parameters
objectglobal widget object data

Definition at line 19 of file twitch.php.


The documentation for this class was generated from the following file: