Plugin Directory

Changeset 704174


Ignore:
Timestamp:
04/26/2013 12:45:54 PM (13 years ago)
Author:
tkrivickas
Message:

Separated views from actual shortcode implementation

Location:
live-stream-badger/trunk
Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • live-stream-badger/trunk/shortcode/class-embedded-stream.php

    r700997 r704174  
    11<?php
     2
     3include_once LSB_PLUGIN_BASE_URL . '/view/class-embedded-twitch-view.php';
    24
    35class LSB_Embedded_Stream {
     
    68        $defaults = array(
    79            'url'    => '',
    8             'width'  => '640',
    9             'height' => '480'
     10            'width'  => '620',
     11            'height' => '378'
    1012        );
    1113        $attrs    = shortcode_atts( $defaults, $attrs );
     
    2224            return '';
    2325
    24         $html = '<object type="application/x-shockwave-flash" height="378" width="620" id="live_embed_player_flash" data="http://www.twitch.tv/widgets/live_embed_player.swf?channel=' . $stream_url->channel_name . '" bgcolor="#000000"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="movie" value="http://www.twitch.tv/widgets/live_embed_player.swf" /><param name="flashvars" value="hostname=www.twitch.tv&channel=' . $stream_url->channel_name . '&auto_play=true&start_volume=25" /></object>';
    25         return $html;
     26        $view = NULL;
     27        switch ( $stream_url->api_id ) {
     28            case 'twitch' :
     29                $view = new LSB_Embedded_Twitch_View();
     30                break;
     31        }
     32
     33        if ( empty( $view ) )
     34            return '';
     35
     36        $attrs['stream_url'] = $stream_url;
     37
     38        return $view->get_html( $attrs );
    2639    }
    2740
Note: See TracChangeset for help on using the changeset viewer.