Plugin Directory

Changeset 1176986


Ignore:
Timestamp:
06/08/2015 07:05:58 PM (11 years ago)
Author:
thinkoomph
Message:

2.0.1 release. Updates i18n functions to ensure proper escaping in all contexts.

Location:
ooyala-video-browser/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • ooyala-video-browser/trunk/js/ooyala-views.js

    r1169444 r1176986  
    798798        initialize: function() {
    799799            media.view.Attachment.prototype.initialize.apply(this, arguments);
     800            this.$el.addClass('ooyala-attachment-item');
    800801
    801802            this.model.on('change:status', this.changeStatus, this);
  • ooyala-video-browser/trunk/ooyala-templates.php

    r1169444 r1176986  
    7474
    7575        <# if ( data.buttons.close ) { #>
    76             <a class="close media-modal-icon" href="#" title="<?php _e('Remove'); ?>"></a>
     76            <a class="close media-modal-icon" href="#" title="<?php esc_attr_e( 'Remove', 'ooyala' ); ?>"></a>
    7777        <# } #>
    7878
    7979        <# if ( data.buttons.check ) { #>
    80             <a class="check" href="#" title="<?php _e('Deselect'); ?>"><div class="media-modal-icon"></div></a>
     80            <a class="check" href="#" title="<?php esc_attr_e( 'Deselect', 'ooyala' ); ?>"><div class="media-modal-icon"></div></a>
    8181        <# } #>
    8282    </div>
     
    9494<dl class="ooyala-image-details-list">
    9595
    96     <dt class="ooyala-title"><?php _e( "Title: ", 'ooyala' ); ?></dt>
     96    <dt class="ooyala-title"><?php esc_html_e( "Title: ", 'ooyala' ); ?></dt>
    9797    <dd class="ooyala-title">{{ data.name }}</dd>
    9898
    9999    <# if (data.duration) { #>
    100     <dt class="ooyala-duration"><?php _e( "Duration: ", 'ooyala' ); ?></dt>
     100    <dt class="ooyala-duration"><?php esc_html_e( "Duration: ", 'ooyala' ); ?></dt>
    101101    <dd class="ooyala-duration">{{ data.duration_string }}</dd>
    102102    <# } #>
    103103
    104     <dt class="ooyala-status"><?php _e( "Status: ", 'ooyala' ); ?></dt>
     104    <dt class="ooyala-status"><?php esc_html_e( "Status: ", 'ooyala' ); ?></dt>
    105105    <dd class="ooyala-status ooyala-status-{{ data.status }} {{ data.status == 'processing' ? 'loading' : '' }}">{{ data.status }}
    106106    <# if (data.status=='uploading' && data.percent !== undefined) { #>
     
    110110
    111111    <# if ( data.description ) { #>
    112     <dt class="ooyala-description"><?php _e( "Description: ", 'ooyala' ); ?></dt>
     112    <dt class="ooyala-description"><?php esc_html_e( "Description: ", 'ooyala' ); ?></dt>
    113113    <#  if ( data.description.length > ( data.descriptionMaxLen + data.maxLenThreshold ) ) {
    114114            var trunc = data.description.lastIndexOf(" ", data.descriptionMaxLen);
     
    123123    <# if(data.labels && data.labels.length > 0) {
    124124    #>
    125     <dt class="ooyala-labels"><?php _e( "Labels: ", 'ooyala' ); ?></dt>
     125    <dt class="ooyala-labels"><?php esc_html_e( "Labels: ", 'ooyala' ); ?></dt>
    126126    <dd class="ooyala-labels">
    127127        <ul>
     
    143143<div class="message"><?php esc_html_e( 'This asset may not display correctly due to its current status. Do you wish to embed it anyway?', 'ooyala' ); ?><a href="#">Show Player Settings</a></div>
    144144<label class="setting">
    145     <span><?php _e( 'Player', 'ooyala' ); ?></span>
     145    <span><?php esc_html_e( 'Player', 'ooyala' ); ?></span>
    146146    <# if ( data.players.isFetching ) { #>
    147         <em class="loading"><?php _e( 'Retrieving players', 'ooyala' ); ?></em>
     147        <em class="loading"><?php esc_html_e( 'Retrieving players', 'ooyala' ); ?></em>
    148148    <# } else { #>
    149149        <select data-setting="player_id">
     
    157157
    158158<label class="setting">
    159     <span><?php _e( 'Platform', 'ooyala' ); ?></span>
     159    <span><?php esc_html_e( 'Platform', 'ooyala' ); ?></span>
    160160    <select data-setting="platform">
    161         <option value=""><?php _e( 'Default', 'ooyala' ); ?></option>
     161        <option value=""><?php esc_html_e( 'Default', 'ooyala' ); ?></option>
    162162        <# _.each(['flash','flash-only','html5-fallback','html5-priority'], function(value) { #>
    163163            <option value="{{ value }}">{{ value }}</option>
     
    167167
    168168<div class="setting resolution">
    169     <span><?php _e( 'Size', 'ooyala' ); ?></span>
     169    <span><?php esc_html_e( 'Size', 'ooyala' ); ?></span>
    170170    <# if (data.model.attachment.get('downloadingResolutions')) { #>
    171         <em class="loading"><?php _e( 'Retrieving video resolutions', 'ooyala' ); ?></em>
     171        <em class="loading"><?php esc_html_e( 'Retrieving video resolutions', 'ooyala' ); ?></em>
    172172    <# } else { #>
    173173        <select data-setting="resolution">
     
    179179            <# }
    180180        } #>
    181             <option value="custom"><?php _e( 'Custom', 'ooyala' ); ?></option>
     181            <option value="custom"><?php esc_html_e( 'Custom', 'ooyala' ); ?></option>
    182182        </select>
    183183        <div class="custom-resolution">
     
    185185            X
    186186            <input type="text" data-setting="height"/>
    187             <label><input type="checkbox" data-setting="lockAspectRatio"> <?php _e( 'Maintain aspect ratio', 'ooyala' ); ?></label>
    188         </div>
    189     <# } #>
    190 </div>
    191 
    192 <label class="setting">
    193     <span><?php _e( 'Enable Channels', 'ooyala' ); ?></span>
     187            <label><input type="checkbox" data-setting="lockAspectRatio"> <?php esc_html_e( 'Maintain aspect ratio', 'ooyala' ); ?></label>
     188        </div>
     189    <# } #>
     190</div>
     191
     192<label class="setting">
     193    <span><?php esc_html_e( 'Enable Channels', 'ooyala' ); ?></span>
    194194    <input type="checkbox" data-setting="enable_channels"/>
    195195</label>
    196196
    197197<label class="setting initial-time">
    198     <span><?php _e( 'Initial Time', 'ooyala' ); ?></span>
    199     <input type="text" data-setting="initial_time" min="0" max="{{ data.model.attachment.get('duration') / 1000 }}"> <?php _e( 'sec', 'ooyala' ); ?>
    200 </label>
    201 
    202 <label class="setting">
    203     <span><?php _e( 'Locale', 'ooyala' ); ?></span>
     198    <span><?php esc_html_e( 'Initial Time', 'ooyala' ); ?></span>
     199    <input type="text" data-setting="initial_time" min="0" max="{{ data.model.attachment.get('duration') / 1000 }}"> <?php esc_html_e( 'sec', 'ooyala' ); ?>
     200</label>
     201
     202<label class="setting">
     203    <span><?php esc_html_e( 'Locale', 'ooyala' ); ?></span>
    204204    <select data-setting="locale">
    205         <option value=''>User Default</option>
     205        <option value=''><?php esc_html_e( 'User Default', 'ooyala' ); ?></option>
    206206    <?php
    207207    $locales = array(
     
    225225
    226226<label class="setting additional-parameters">
    227     <span><?php _e( 'Additional Player Parameters', 'ooyala' ); ?></span>
    228     <em class="error-message"><?php _e( 'There is an error in your syntax:', 'ooyala' ); ?></em>
    229     <textarea data-setting="additional_params_raw" placeholder="Key/value pairs in JSON or JavaScript object literal notation">{{ data.model.additional_params }}</textarea>
     227    <span><?php esc_html_e( 'Additional Player Parameters', 'ooyala' ); ?></span>
     228    <em class="error-message"><?php esc_html_e( 'There is an error in your syntax:', 'ooyala' ); ?></em>
     229    <textarea data-setting="additional_params_raw" placeholder="<?php esc_attr_e( 'Key/value pairs in JSON or JavaScript object literal notation', 'ooyala' ); ?>">{{ data.model.additional_params }}</textarea>
    230230</label>
    231231</div>
     
    239239        <div class="ooyala-more-text-container">
    240240            <!--// <span class="ooyala-number-remaining"></span> //-->
    241             <span class="ooyala-more-text"><?php _e( "More", 'ooyala' ); ?></span>
     241            <span class="ooyala-more-text"><?php esc_html_e( "More", 'ooyala' ); ?></span>
    242242        </div>
    243243    </div>
     
    246246<!-- Unsupported browser message -->
    247247<script type="text/html" id="tmpl-ooyala-unsupported-browser">
    248     <h1><?php _e( "Sorry, this browser is unsupported!", 'ooyala' ); ?></h1>
    249 
    250     <p><?php _e( "The Ooyala plugin requires at least Internet Explorer 10 to function. This plugin also supports other modern browsers with proper CORS support such as Firefox, Chrome, Safari, and Opera.", 'ooyala' ); ?></p>
     248    <h1><?php esc_html_e( "Sorry, this browser is unsupported!", 'ooyala' ); ?></h1>
     249
     250    <p><?php esc_html_e( "The Ooyala plugin requires at least Internet Explorer 10 to function. This plugin also supports other modern browsers with proper CORS support such as Firefox, Chrome, Safari, and Opera.", 'ooyala' ); ?></p>
    251251</script>
    252252
     
    258258        var isUploading = data.controller.uploader.state === ooyala.plupload.STARTED;
    259259        #>
    260         <div class="file-name">File: {{ file.name }} <em class="file-size">({{ new Number( file.size ).bytesToString() }})</em>
     260        <div class="file-name"><?php esc_html_e( 'File:', 'ooyala' ); ?> {{ file.name }} <em class="file-size">({{ new Number( file.size ).bytesToString() }})</em>
    261261        <# if( !isUploading ) { #>
    262             <a class="button ooyala-upload-browser" tabindex="10">Change</a>
    263         <# } #>
    264         </div>
    265         <label class="setting">Title<input type="text" value="{{ file.model.get('name') }}" data-setting="name" tabindex="20"></label>
    266         <label class="setting">Description<textarea data-setting="description" tabindex="30">{{ file.model.get('description') }}</textarea></label>
    267         <label class="setting">Post-processing Status
     262            <a class="button ooyala-upload-browser" tabindex="10"><?php esc_html_e( 'Change', 'ooyala' ); ?></a>
     263        <# } #>
     264        </div>
     265        <label class="setting"><?php esc_html_e( 'Title', 'ooyala' ); ?><input type="text" value="{{ file.model.get('name') }}" data-setting="name" tabindex="20"></label>
     266        <label class="setting"><?php esc_html_e( 'Description', 'ooyala' ); ?><textarea data-setting="description" tabindex="30">{{ file.model.get('description') }}</textarea></label>
     267        <label class="setting"><?php esc_html_e( 'Post-processing Status', 'ooyala' ); ?>
    268268        <select data-setting="futureStatus" tabindex="40">
    269269        <# var status = ['live','paused'];
     
    274274        <div class="ooyala-upload-controls {{ isUploading ? 'uploading' : '' }}">
    275275            <div class="progress"><span>{{ ( file.model.asset && file.model.asset.get('percent') ) || 0 }}</span>%</div>
    276             <a class="button ooyala-stop-upload" tabindex="60">Cancel Upload</a>
    277             <a class="button ooyala-start-upload" tabindex="50">Start Upload</a>
     276            <a class="button ooyala-stop-upload" tabindex="60"><?php esc_html_e( 'Cancel Upload', 'ooyala' ); ?></a>
     277            <a class="button ooyala-start-upload" tabindex="50"><?php esc_html_e( 'Start Upload', 'ooyala' ); ?></a>
    278278        </div>
    279279    <# } else { #>
    280280        <div class="ooyala-upload-browser-container">
    281             <h4>Upload an asset to your account.</h4>
    282         <a class="button button-hero ooyala-upload-browser">Select File</a>
     281            <h4><?php esc_html_e( 'Upload an asset to your account.', 'ooyala' ); ?></h4>
     282        <a class="button button-hero ooyala-upload-browser"><?php esc_html_e( 'Select File', 'ooyala' ); ?></a>
    283283        </div>
    284284    <# } #>
     
    289289    <?php esc_html_e( 'Refining by Label:', 'ooyala' ); ?>
    290290    <span class="ooyala-selected-label"></span>
    291     <a href="#" title="Clear Label" class="ooyala-clear-label dashicons dashicons-dismiss"></a>
    292 </script>
     291    <a href="#" title="<?php esc_attr_e( 'Clear Label', 'ooyala' ); ?>" class="ooyala-clear-label dashicons dashicons-dismiss"></a>
     292</script>
  • ooyala-video-browser/trunk/ooyala.css

    r1169444 r1176986  
    308308        margin-right: 7px;
    309309    }
    310     .ooyala-toolbar li.attachment:focus, .ooyala-results li.attachment:focus:not(.selected) {
     310    .ooyala-toolbar li.attachment.ooyala-attachment-item:focus,
     311    .ooyala-toolbar li.attachment.ooyala-attachment-item,
     312    .ooyala-results li.attachment.ooyala-attachment-item:focus:not(.selected) {
    311313        -webkit-box-shadow: none;
    312314        box-shadow: none;
  • ooyala-video-browser/trunk/ooyala.php

    r1169444 r1176986  
    33Plugin name: Ooyala
    44Plugin URI: http://www.oomphinc.com/work/ooyala-wordpress-plugin/
    5 Description: Integrate your site with Ooyala
    6 Author: bendoh
     5Description: Easy Embedding of Ooyala Videos based off an Ooyala Account as defined in media settings.
     6Author: ooyala
    77Author URI: http://oomphinc.com/
    8 Version: 2.0
     8Version: 2.0.1
    99*/
    1010
    11 /*  Copyright 2014  Ooyala
     11/*  Copyright 2015  Ooyala
    1212
    1313    This program is free software; you can redistribute it and/or modify
     
    5252    // some of these field names differ from the player API bc WP lowercases shortcode params, they are mapped below
    5353    public $playerDefaults = array(
    54         'platform' => '', //if none is supplied, this defaults to flash
    55         'width' => '600', //if none are provided by the asset's streams
     54        'code' => '',
     55        'player_id' => '',
     56        'platform' => 'html5-fallback',
     57        'width' => '500', //if none are provided by the asset's streams
    5658        'height' => '400',
    5759        'enable_channels' => false,
     60        'wmode' => 'opaque',
    5861        'initial_time' => '0',
     62        'autoplay' => '',
     63        'wrapper_class' => 'ooyala-video-wrapper',
     64        'callback' => 'recieveOoyalaEvent',
    5965        'locale' => '', //equivalent to "User Default" aka providing no locale
    6066        'additional_params' => '', //these will come through as the shortcode content, if supplied
     
    6773    );
    6874
     75    public $allowed_values = array(
     76        'wmode' => array( 'window', 'transparent', 'opaque', 'gpu', 'direct' ),
     77        'platform' => array( 'flash', 'flash-only', 'html5-fallback', 'html5-priority' ),
     78    );
     79
    6980    var $settings_default = array(
    70         'key' => '',
    71         'secret' => ''
     81        'api_key' => '',
     82        'api_secret' => '',
     83        'video_width' => '',
     84        'player_id' => '', //default player ID
    7285    );
    7386
     
    123136     */
    124137    function settings_fields() {
    125         $option = get_option( self::settings_key, $this->settings_default ); ?>
     138        $option = $this->get_settings(); ?>
    126139        <table class="form-table" id="ooyala">
    127140            <tr>
    128141                <th scope="row"><label for="ooyala-apikey"><?php esc_html_e( "API Key", 'ooyala' ); ?></label></th>
    129                 <td scope="row"><input type="text" name="ooyala[key]" class="widefat" id="ooyala-apikey" value="<?php echo esc_attr( $option['key'] ); ?>" /></td>
     142                <td scope="row"><input type="text" name="ooyala[api_key]" class="widefat" id="ooyala-apikey" value="<?php echo esc_attr( $option['api_key'] ); ?>" /></td>
    130143            </tr>
    131144            <tr>
    132145                <th scope="row"><label for="ooyala-apisecret"><?php esc_html_e( "API Secret", 'ooyala' ); ?></label></th>
    133                 <td scope="row"><input type="text" name="ooyala[secret]" class="widefat" id="ooyala-apisecret" value="<?php echo esc_attr( $option['secret'] ); ?>" /></td>
     146                <td scope="row"><input type="text" name="ooyala[api_secret]" class="widefat" id="ooyala-apisecret" value="<?php echo esc_attr( $option['api_secret'] ); ?>" /></td>
    134147            </tr>
    135148            <tr>
     
    138151                </td>
    139152            </tr>
     153            <tr>
     154                <th scope="row"><label for="ooyala-playerid"><?php esc_html_e( 'Default Player ID', 'ooyala' ); ?></label></th>
     155                <td scope="row"><input type="text" name="ooyala[player_id]" class="widefat" id="ooyala-playerid" value="<?php echo esc_attr( $option['player_id'] ); ?>" /></td>
     156            </tr>
     157            <tr>
     158                <th scope="row"><label for="ooyala-videowidth"><?php esc_html_e( 'Default Video Width', 'ooyala' ); ?></label></th>
     159                <td scope="row"><input type="text" name="ooyala[video_width]" id="ooyala-videowidth" value="<?php echo esc_attr( $option['video_width'] ); ?>" />px</td>
     160            </tr>
    140161        </table>
    141162    <?php
     
    148169        $validated = $this->settings_default;
    149170
    150         if( isset( $settings['key'] ) && is_string( $settings['key'] ) ) {
    151             $validated['key'] = sanitize_text_field( $settings['key'] );
    152         }
    153 
    154         if( isset( $settings['secret'] ) && is_string( $settings['secret'] ) ) {
    155             $validated['secret'] = sanitize_text_field( $settings['secret'] );
     171        foreach ( $this->settings_default as $key => $value ) {
     172            if( isset( $settings[ $key ] ) && is_string( $settings[ $key ] ) ) {
     173                $validated[ $key ] = sanitize_text_field( $settings[ $key ] );
     174            }
    156175        }
    157176
    158177        return $validated;
     178    }
     179
     180    /**
     181     * Get the user's saved settings for this plugin, filled in with default values.
     182     * @return array settings or defaults
     183     */
     184    function get_settings() {
     185        return get_option( self::settings_key, $this->settings_default );
    159186    }
    160187
     
    165192     */
    166193    function ajax_sign_request() {
    167         $settings = get_option( self::settings_key, $this->settings_default );
     194        $settings = $this->get_settings();
    168195
    169196        if( !$this->configured() ) {
     
    187214        ) );
    188215
    189         $request['params']['api_key'] = $settings['key'];
     216        $request['params']['api_key'] = $settings['api_key'];
    190217        $request['params']['expires'] = time() + 300;
    191218
    192         $to_sign = $settings['secret'] . $request['method'] . $request['path'];
     219        $to_sign = $settings['api_secret'] . $request['method'] . $request['path'];
    193220
    194221        $param_sorted = array_keys( $request['params'] );
     
    263290        // Ensure all the files required by the media manager are present
    264291        wp_enqueue_media();
    265 
    266         wp_register_script( 'jquery-cookie', plugins_url( '/js/jquery.cookie.js', __FILE__ ), array( 'jquery' ), '2006', true );
    267292
    268293        wp_enqueue_script( 'spin-js', plugins_url( '/js/spin.js', __FILE__ ), array(), 1, true );
     
    281306                'model' => array(), // Backbone models
    282307                'view' => array(), // Backbone views
    283                 'api' => get_option( self::settings_key, $this->settings_default ),
     308                'api' => $this->get_settings(),
    284309                'sign' => admin_url( 'admin-ajax.php?action=ooyala_sign_request&nonce=' . wp_create_nonce( 'ooyala' ) ),
    285310                'playerDefaults' => $this->playerDefaults,
     
    339364     */
    340365    function configured() {
    341         $settings = get_option( self::settings_key, $this->settings_default );
    342 
    343         return !empty( $settings['key'] ) && !empty( $settings['secret'] );
     366        $settings = $this->get_settings();
     367
     368        return !empty( $settings['api_key'] ) && !empty( $settings['api_secret'] );
    344369    }
    345370
     
    356381        ?>
    357382        <div class="update-nag">
    358             <?php printf( __( 'Your Ooyala API credentials are not configured in <a href="%s">Media Settings</a>.', 'ooyala' ), esc_url( $url ) ); ?>
     383            <?php echo wp_kses_post( sprintf( __( 'Your Ooyala API credentials are not configured in <a href="%s">Media Settings</a>.', 'ooyala' ), esc_url( $url ) ) ); ?>
    359384        </div>
    360385        <?php
     
    376401    function shortcode( $atts, $content = null ) {
    377402        static $num;
    378         if ( !$atts['code'] || !$atts['player_id'] ) {
     403        // do not display markup in feeds
     404        if ( is_feed() ) {
    379405            return;
    380406        }
     407        // handle the 'legacy' shortcode format: [ooyala code12345]
     408        if ( empty( $atts['code'] ) ) {
     409            if ( isset( $atts[0] ) ) {
     410                $atts['code'] = $atts[0];
     411            } else {
     412                // we need a code!
     413                return;
     414            }
     415        }
    381416        $num++;
     417        $settings = $this->get_settings();
     418        // fill in defaults saved in user settings
     419        if ( empty( $atts['player_id'] ) && !empty( $settings['player_id'] ) ) {
     420            $atts['player_id'] = $settings['player_id'];
     421        }
     422        // set a width from some defaults
     423        if ( empty( $atts['width'] ) ) {
     424            if ( !empty( $settings['video_width'] ) ) {
     425                $atts['width'] = $settings['video_width'];
     426            } elseif ( !empty( $GLOBALS['content_width'] ) ) {
     427                $atts['width'] = $GLOBALS['content_width'];
     428            }
     429        }
     430        // fill in remaining player defaults
     431        $atts = shortcode_atts( apply_filters( 'ooyala_default_query_args', $this->playerDefaults ), $atts );
    382432        //coerce string true and false to their respective boolean counterparts
    383433        $atts = array_map( function($value) { if ($value==='true') return true; elseif ($value==='false') return false; else return $value; }, $atts );
    384434
    385         // fill in default width / height vals
    386         $atts['width'] = intval( isset( $atts['width'] ) ? $atts['width'] : $this->playerDefaults['width'] );
    387         $atts['height'] = intval( isset( $atts['height'] ) ? $atts['height'] : $this->playerDefaults['height'] );
    388 
    389         // player query string parameters
    390         $query_params = array(
    391             'namespace' => 'OoyalaPlayer' . $num // each player has its own namespace to avoid collisions
    392         );
    393 
    394         // JS parameters - start with passed json, if any
    395         if ( $content
    396             && ( $json = json_decode( $content, true ) )
    397             && is_array( $json )
    398             && count( array_filter( array_keys( $json ), 'is_string' ) ) //only if assoc array
    399         ) {
    400             $js_params = $json;
     435        // match against allowed values
     436        foreach ( array( 'wmode', 'platform' ) as $att ) {
     437            $atts[ $att ] = in_array( $atts[ $att ], $this->allowed_values[ $att ] ) ? $atts[ $att ] : $this->playerDefaults[ $att ];
     438        }
     439
     440        ob_start();
     441        if ( !empty( $atts['player_id'] ) ) {
     442            // player query string parameters
     443            $query_params = array(
     444                'namespace' => 'OoyalaPlayer' . $num // each player has its own namespace to avoid collisions
     445            );
     446            // JS parameters - start with passed json, if any
     447            if ( $content
     448                && ( $json = json_decode( $content, true ) )
     449                && is_array( $json )
     450                && count( array_filter( array_keys( $json ), 'is_string' ) ) //only if assoc array
     451            ) {
     452                $js_params = $json;
     453            } else {
     454                $js_params = array();
     455            }
     456
     457            // pick out all other params
     458            foreach ( $atts as $key => $value ) {
     459                switch ( $key ) {
     460                    // no-op bc these have special placement in the embed code
     461                    case 'width':
     462                    case 'height':
     463                    case 'code':
     464                    case 'player_id':
     465                        break;
     466
     467                    // these are query params and are appended to the player script URL
     468                    case 'platform':
     469                        $query_params[$key] = $value;
     470                        break;
     471
     472                    // all other params become JS parameters
     473                    // these will override values of the same name supplied from the JSON content block
     474                    default:
     475                        if ( !$this->is_default( $key, $value ) ) {
     476                            $js_params[ isset( $this->paramMapping[ $key ] ) ? $this->paramMapping[ $key ] : $key ] = $value;
     477                        }
     478                    break;
     479                }
     480            }
     481        ?>
     482            <script src="<?php echo esc_url( '//player.ooyala.com/v3/' . $atts['player_id'] . '?' . http_build_query( $query_params ) ); ?>"></script>
     483            <div id="ooyalaplayer-<?php echo (int) $num; ?>" class="<?php echo esc_attr( $atts['wrapper_class'] ); ?>" style="width:<?php echo (int) $atts['width']; ?>px;height:<?php echo (int) $atts['height']; ?>px"></div>
     484            <script>
     485                <?php
     486                $player = 'OoyalaPlayer' . $num;
     487                $params = array( "ooyalaplayer-$num", $atts['code'] );
     488                if ( count( $js_params ) ) {
     489                    $params[] = $js_params;
     490                }
     491                echo esc_js( $player ) . '.ready(function() { ' . esc_js( $player ) . '.Player.create.apply(this, ' . json_encode( $params ) .'); });';
     492                ?>
     493            </script>
     494            <noscript><div><?php esc_html_e( 'Please enable Javascript to watch this video', 'ooyala' ); ?></div></noscript>
     495        <?php
     496        // no player id, use the v2 player
    401497        } else {
    402             $js_params = array();
    403         }
    404 
    405         // pick out all other params
    406         foreach ( $atts as $key => $value ) {
    407             switch ( $key ) {
    408                 // no-op bc these have special placement in the embed code
    409                 case 'width':
    410                 case 'height':
    411                 case 'code':
    412                 case 'player_id':
    413                     break;
    414 
    415                 // these are query params and are appended to the player script URL
    416                 case 'platform':
    417                     if ( !$this->is_default( $key, $value ) ) {
    418                         $query_params[$key] = $value;
    419                     }
    420                     break;
    421 
    422                 // all other params become JS parameters
    423                 // these will override values of the same name supplied from the JSON content block
    424                 default:
    425                     if ( !$this->is_default( $key, $value ) ) {
    426                         $js_params[ isset( $this->paramMapping[ $key ] ) ? $this->paramMapping[ $key ] : $key ] = $value;
    427                     }
    428                 break;
    429             }
    430         }
    431         ob_start();
    432         ?>
    433         <script src="<?php echo esc_url( '//player.ooyala.com/v3/' . $atts['player_id'] . '?' . http_build_query( $query_params ) ); ?>"></script>
    434         <div id="ooyalaplayer-<?php echo $num; ?>" class="ooyala-player" style="width:<?php echo $atts['width']; ?>px;height:<?php echo $atts['height']; ?>px"></div>
    435         <script>
     498            $script_url = add_query_arg( array(
     499                'width' => $atts['width'],
     500                'height' => $atts['height'],
     501                'embedCode' => $atts['code'],
     502                'autoplay' => $atts['autoplay'] ? '1' : '0',
     503                'callback' => $atts['callback'],
     504                'wmode' => $atts['wmode'],
     505                'version' => 2,
     506            ), 'http://player.ooyala.com/player.js' );
     507            ?>
     508            <div id="ooyalaplayer-<?php echo (int) $num; ?>" class="<?php echo esc_attr( $atts['wrapper_class'] ); ?>">
     509                <script src="<?php echo esc_url( $script_url ); ?>"></script>
     510                <noscript>
     511                    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="<?php echo (int) $atts['width']; ?>" height="<?php echo (int) $atts['height']; ?>" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
     512                        <param name="movie" value="<?php echo esc_url( 'http://player.ooyala.com/player.swf?embedCode=' . $atts['code'] . '&version=2' ); ?>">
     513                        <param name="bgcolor" value="#000000">
     514                        <param name="allowScriptAccess" value="always">
     515                        <param name="allowFullScreen" value="true">
     516                        <param name="wmode" value="<?php echo esc_attr( $atts['wmode'] ); ?>">
     517                        <param name="flashvars" value="embedType=noscriptObjectTag&amp;embedCode=###VID###">
     518                        <embed src="<?php echo esc_url( 'http://player.ooyala.com/player.swf?embedCode=' . $atts['code'] . '&version=2' ); ?>" bgcolor="#000000" width="<?php echo (int) $atts['width']; ?>" height="<?php echo (int) $atts['height']; ?>" align="middle" play="true" loop="false" allowscriptaccess="always" allowfullscreen="true" type="application/x-shockwave-flash" flashvars="&amp;embedCode=<?php echo esc_attr( $atts['code'] ); ?>" pluginspage="http://www.adobe.com/go/getflashplayer">
     519                        </embed>
     520                    </object>
     521                </noscript>
     522            </div>
    436523            <?php
    437             $player = 'OoyalaPlayer' . $num;
    438             $params = array( "ooyalaplayer-$num", $atts['code'] );
    439             if ( count( $js_params ) ) {
    440                 $params[] = $js_params;
    441             }
    442             echo "$player.ready(function() { $player.Player.create.apply(this, " . json_encode( $params ) ."); });";
    443             ?>
    444         </script>
    445         <noscript><div>Please enable Javascript to watch this video</div></noscript>
    446         <?php
     524        }
    447525        return ob_get_clean();
    448526    }
  • ooyala-video-browser/trunk/readme.txt

    r1169444 r1176986  
    11=== Ooyala ===
    2 Contributors: Ooyala
     2Contributors: ooyala, thinkoomph, balbuf
    33Tags: video, media, ooyala
    44Requires at least: 3.9
    55Tested up to: 4.1.1
    6 Stable tag: 2.0
     6Stable tag: 2.0.1
    77License: GPLv2 or later
    88
     
    4141
    4242== Changelog ==
     43
     44= 2.0.1 =
     45* Backwards compatibility fixes to honor existing settings, including default player_id, video_width, and previously entered API key and secret.
    4346
    4447= 2.0 =
     
    7982* Added Automattic as contributor
    8083
    81 = 1.4.2 = 
     84= 1.4.2 =
    8285* Provided more robustness around the API calls being made.
    8386* Updated documentation to direct users to the V1 API keys.
    8487
    85 = 1.4.1 = 
     88= 1.4.1 =
    8689* Fixed a deprecated function call
    8790* Changed the default timeout for the remote request to 10 seconds. If you need to further extend the timeout for any reason, you can also use the 'ooyala_http_request_timeout' filter.
Note: See TracChangeset for help on using the changeset viewer.