Skip to content

Commit

Permalink
Added - Show live View or live preview picture
Browse files Browse the repository at this point in the history
  • Loading branch information
TomParisDE committed May 25, 2017
1 parent 9200ab3 commit 024881a
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 29 deletions.
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,26 @@ The TomParisDE Twitch Widget for Wordpress allows you to show all your visitors

## Features

* Show your online and offline status
* Show your currently playing game
* Show your online title
* Show the count of your live viewers
* Show the count of your overall views
* Show the count of your follower
* Super-fast for your server and visitors (Caching)
* Set up your Cache Time
* Widget for sidebars
* Four different Layouts
* Multilingual results (EN, DE)
* No expert knowledge needed!
* Localization ready
* No expert knowledge needed!
* Responsive Design: Optimized for tables and smartphones
* You can show your visitors as many channels as you like
* Hide offline channels
* Clan-, Fan- and Community Site Feature
* Show live View or live preview picture
* Show your online and offline status
* Show your currently playing game
* Show your online title
* Show the count of your live viewers
* Show the count of your overall views
* Show the count of your follower
* Super-fast for your server and visitors (Caching)
* Set up your Cache Time
* Widget for sidebars
* Different Layouts
* Multilingual results (EN, DE)
* No expert knowledge needed!
* Localization ready
* Responsive Design: Optimized for tablets and mobile phone
* You can show your visitors as many channels as you like
* Hide offline channels
* Hide title
* Hide statistics

### Credits

Expand Down
35 changes: 32 additions & 3 deletions includes/widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function __construct() {
parent::__construct(
'tp_ttvw_widget', // Base ID
__( 'TomParisDE Twitch Widget', 'tp-ttvw' ), // Name
array( 'description' => __( 'The TomParisDE Twitch Widget for Wordpress allows you to show all your visitors your online or offline status from your twitch stream. You can also enter a lot more stream channel if want to. It´s also possible to add one game with or without a specific language, it´s very handy for a theme based Clan-, Fan- or Community Site.', 'tp-ttvw' ), ) // Args
array( 'description' => __( 'Your TomParisDE Twitch Widget for Blogs, Clan-, Fan- and Community Sites', 'tp-ttvw' ), ) // Args
);
}

Expand Down Expand Up @@ -40,6 +40,9 @@ public function widget( $args, $instance ) {
@$max_games = $instance['max_games'];
@$channel_or_game = $instance['channel_or_game'];
@$twitch_streamer_language = $instance['twitch_streamer_language'];
@$live_or_picture = $instance['live_or_picture'];
@$live_or_picture_height = $instance['live_or_picture_height'];
@$live_or_picture_width = $instance['live_or_picture_width'];


// Data for output
Expand Down Expand Up @@ -156,6 +159,9 @@ public function form( $instance ) {
$max_games = ! empty( $instance['max_games'] ) ? $instance['max_games'] : '';
$channel_or_game = ! empty( $instance['channel_or_game'] ) ? $instance['channel_or_game'] : '';
$twitch_streamer_language = ! empty( $instance['twitch_streamer_language'] ) ? $instance['twitch_streamer_language'] : '';
$live_or_picture = ! empty( $instance['live_or_picture'] ) ? $instance['live_or_picture'] : '';
$live_or_picture_height = ! empty( $instance['live_or_picture_height'] ) ? $instance['live_or_picture_height'] : '';
$live_or_picture_width = ! empty( $instance['live_or_picture_width'] ) ? $instance['live_or_picture_width'] : '';

?>

Expand Down Expand Up @@ -183,7 +189,7 @@ public function form( $instance ) {
<p style="font-size: 24px; font-weight: 600;"><?php _e( 'Twitch Channel Settings', 'tp-ttvw' ); ?></p>

<p>
<label for="<?php echo $this->get_field_id( 'channel' ); ?>"><?php _e( 'Twitch Channels:', 'tp-ttvw' ); ?></label>
<label for="<?php echo $this->get_field_id( 'channel' ); ?>"><?php _e( 'Twitch Channel(s):', 'tp-ttvw' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'channel' ); ?>" name="<?php echo $this->get_field_name( 'channel' ); ?>" type="text" value="<?php echo esc_attr( $channel ); ?>">
</p>

Expand Down Expand Up @@ -225,7 +231,26 @@ public function form( $instance ) {
</p>

<p>
<label for="<?php echo $this->get_field_id( 'banner_postion' ); ?>"><?php _e( 'Live Picture Position: (Big Template)', 'tp-ytw' ); ?></label>
<label for="<?php echo $this->get_field_id( 'live_or_picture' ); ?>"><?php _e( 'Live View or Live Preview Picture: (Big Template)', 'tp-ytw' ); ?></label>

<select class="widefat" id="<?php echo $this->get_field_id( 'live_or_picture' ); ?>" name="<?php echo $this->get_field_name( 'live_or_picture' ); ?>">
<option value="twitch_live"<?php selected( $live_or_picture, "twitch_live" ); ?>><?php _e( 'Live View', 'tp-ytw' ); ?></option>
<option value="twitch_picture"<?php selected( $live_or_picture, "twitch_picture" ); ?>><?php _e( 'Live Preview Picture', 'tp-ytw' ); ?></option>
</select>
</p>

<p>
<label for="<?php echo $this->get_field_id( 'live_or_picture_height' ); ?>"><?php _e( 'Live View (Height): (Big Template)', 'tp-ytw' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'live_or_picture_height' ); ?>" name="<?php echo $this->get_field_name( 'live_or_picture_height' ); ?>" placeholder="auto" type="text" value="<?php echo esc_attr( $live_or_picture_height ); ?>">
</p>

<p>
<label for="<?php echo $this->get_field_id( 'live_or_picture_width' ); ?>"><?php _e( 'Live View (Width): (Big Template)', 'tp-ytw' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'live_or_picture_width' ); ?>" name="<?php echo $this->get_field_name( 'live_or_picture_width' ); ?>" placeholder="auto" type="text" value="<?php echo esc_attr( $live_or_picture_width ); ?>">
</p>

<p>
<label for="<?php echo $this->get_field_id( 'banner_postion' ); ?>"><?php _e( 'Live View or Live Preview Picture Position: (Big Template)', 'tp-ytw' ); ?></label>

<select class="widefat" id="<?php echo $this->get_field_id( 'banner_postion' ); ?>" name="<?php echo $this->get_field_name( 'banner_postion' ); ?>">
<option value="top"<?php selected( $banner_postion, "top" ); ?>><?php _e( 'Top', 'tp-ytw' ); ?></option>
Expand Down Expand Up @@ -283,6 +308,10 @@ public function update( $new_instance, $old_instance ) {
$instance['max_games'] = ( ! empty( $new_instance['max_games'] ) ) ? strip_tags( $new_instance['max_games'] ) : '';
$instance['channel_or_game'] = ( ! empty( $new_instance['channel_or_game'] ) ) ? strip_tags( $new_instance['channel_or_game'] ) : '';
$instance['twitch_streamer_language'] = ( ! empty( $new_instance['twitch_streamer_language'] ) ) ? strip_tags( $new_instance['twitch_streamer_language'] ) : '';
$instance['live_or_picture'] = ( ! empty( $new_instance['live_or_picture'] ) ) ? strip_tags( $new_instance['live_or_picture'] ) : '';
$instance['live_or_picture_height'] = ( ! empty( $new_instance['live_or_picture_height'] ) ) ? strip_tags( $new_instance['live_or_picture_height'] ) : '';
$instance['live_or_picture_width'] = ( ! empty( $new_instance['live_or_picture_width'] ) ) ? strip_tags( $new_instance['live_or_picture_width'] ) : '';


return $instance;
}
Expand Down
17 changes: 12 additions & 5 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/tomparis/
Tags: twitch, api, widget, tomparis, tomparisde, twitchtv
Requires at least: 3.5.1
Tested up to: 4.7.5
Stable tag: 1.1.0
Stable tag: 1.1.1
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand All @@ -16,7 +16,8 @@ The TomParisDE Twitch Widget for Wordpress allows you to show all your visitors

= Features =

* *new* Add on specific Game with or without a language to show all Twitch Streamer
* Clan-, Fan- and Community Site Feature
* Show live View or live preview picture
* Show your online and offline status
* Show your currently playing game
* Show your online title
Expand All @@ -26,19 +27,19 @@ The TomParisDE Twitch Widget for Wordpress allows you to show all your visitors
* Super-fast for your server and visitors (Caching)
* Set up your Cache Time
* Widget for sidebars
* Four different Layouts
* Different Layouts
* Multilingual results (EN, DE)
* No expert knowledge needed!
* Localization ready
* Responsive Design: Optimized for tablets and smartphones
* Responsive Design: Optimized for tablets and mobile phone
* You can show your visitors as many channels as you like
* Hide offline channels
* Hide title
* Hide statistics

= Credits =

* This plugin is not official made or maintained but making use of the official youtube api and functions
* This plugin is not official made or maintained but making use of the official Twitch api and functions

== Installation ==

Expand Down Expand Up @@ -79,6 +80,9 @@ Yes of course.

== Changelog ==

= 1.1.1 =
* Added Live View for Twitch Stream

= 1.1.0 =
* Added Clan-, Fan- and Community Site Feature

Expand All @@ -90,6 +94,9 @@ Yes of course.

== Upgrade Notice ==

= 1.1.1 =
* Added Live View for Twitch Stream

= 1.1.0 =
* Added Clan-, Fan- and Community Site Feature

Expand Down
4 changes: 2 additions & 2 deletions tp-twitch-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
Plugin Name: TomParisDE Twitch Widget
Description: Your TomParisDE Twitch Widget for Blogs, Clan-, Fan- and Community Sites
Version: 1.1.0
Version: 1.1.1
Plugin URI: http://coder.tomparis.de/wordpress-twitch-plugin/
Author: Florian 'TomParisDE' Kirchner
Author URI: http://coder.tomparis.de/
Expand Down Expand Up @@ -60,7 +60,7 @@ public static function instance() {
private function setup_constants() {

// Plugin version
define( 'TP_TTVW_VER', '1.1.0' );
define( 'TP_TTVW_VER', '1.1.1' );

// Plugin path
define( 'TP_TTVW_DIR', plugin_dir_path( __FILE__ ) );
Expand Down
38 changes: 36 additions & 2 deletions views/widget_big.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

<div class="tp-ttvw-big-box-in-wrapper<?php echo $style; ?>">

<!-- LIVE VIEW OR PICTURE -- TOP -->

<?php if ($banner_postion == 'top') { ?>
<div class="tp-ttvw-big-box-username" style="margin-top: -5px; margin-bottom: 5px">
<a target="_blank"
Expand All @@ -13,15 +15,45 @@

<div>
<a target="_blank" href="https://www.twitch.tv/<?php echo $channel['username']; ?>/">
<img class="tp-ttvw-big-box-live-pic" src="<?php echo $channel['preview_large'] ?>"/>
<?php if ($live_or_picture == 'twitch_picture') { ?>
<img class="tp-ttvw-big-box-live-pic" src="<?php echo $channel['preview_large'] ?>"/>
<?php } else { ?>

<iframe
src="http://player.twitch.tv/?channel=<?php echo $channel['display_name'] ?>&muted=true"
height="<?php echo $live_or_picture_height ?>"
width="<?php echo $live_or_picture_width ?>"
frameborder="0"
scrolling="no"
allowfullscreen="true">
</iframe>

<?php } ?>
</a>
</div>
<?php } ?>

<!-- LIVE VIEW OR PICTURE -- END -->

<!-- LIVE VIEW OR PICTURE -- MIDDLE -->

<?php if ($banner_postion == 'middle') { ?>
<div>
<a target="_blank" href="https://www.twitch.tv/<?php echo $channel['username']; ?>/">
<img class="tp-ttvw-big-box-live-pic" src="<?php echo $channel['preview_large'] ?>"/>
<?php if ($live_or_picture == 'twitch_picture') { ?>
<img class="tp-ttvw-big-box-live-pic" src="<?php echo $channel['preview_large'] ?>"/>
<?php } else { ?>

<iframe
src="http://player.twitch.tv/?channel=<?php echo $channel['display_name'] ?>&muted=true"
height="<?php echo $live_or_picture_height ?>"
width="<?php echo $live_or_picture_width ?>"
frameborder="0"
scrolling="no"
allowfullscreen="true">
</iframe>

<?php } ?>
</a>
</div>

Expand All @@ -32,6 +64,8 @@
</div>
<?php } ?>

<!-- LIVE VIEW OR PICTURE -- END -->

<?php if (isset ($channel['aktiv_game']) ) { ?>
<div class="tp-ttvw-big-box-is-playing-wrapper">
<div class="tp-ttvw-big-box-is-playing-fix"><?php _e( 'Is Currently Playing:', 'tp-ttvw' ); ?></div>
Expand Down

0 comments on commit 024881a

Please sign in to comment.