Plugin Directory

Changeset 1585797


Ignore:
Timestamp:
01/31/2017 02:16:51 PM (9 years ago)
Author:
LongTail Video
Message:

Version 1.6.0

Location:
jw-player/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • jw-player/trunk/include/jwplayer-api.class.php

    r1404329 r1585797  
    8585
    8686        $response = null;
    87         switch ( $this->_library ) {
    88             case 'wpvip':
    89                 $response = vip_safe_wp_remote_get( $url );
    90                 break;
    91             case 'wp':
    92             default:
    93                 $response = wp_remote_get( $url );
    94             break;
     87        if ( 'wpvip' == $this->_library ) {
     88            $response = vip_safe_wp_remote_get( $url );
     89        } else {
     90            $response = wp_remote_get( $url, array(
     91                'timeout' => 15
     92            ) );
    9593        }
    9694
  • jw-player/trunk/include/media.php

    r1404329 r1585797  
    167167// Add the video widget to the authoring page, if enabled in the settings
    168168function jwplayer_media_add_video_box() {
    169     if ( get_option( 'jwplayer_show_widget' ) && get_option( 'jwplayer_api_key' ) ) {
     169    if ( get_option( 'jwplayer_show_widget', JWPLAYER_SHOW_WIDGET ) && get_option( 'jwplayer_api_key' ) ) {
    170170        add_meta_box( 'jwplayer-video-box', 'Insert media with JW Player', 'jwplayer_media_widget_body', 'post', 'side', 'high' );
    171171        add_meta_box( 'jwplayer-video-box', 'Insert media with JW Player', 'jwplayer_media_widget_body', 'page', 'side', 'high' );
  • jw-player/trunk/include/settings.php

    r1389039 r1585797  
    55function jwplayer_settings_init() {
    66    add_options_page( 'JW Player Plugin Settings', 'JW Player', 'manage_options', 'jwplayer_settings', 'jwplayer_settings_page' );
    7     add_settings_section( 'jwplayer_setting_section', null, '__return_true', 'jwplayer_settings' );
     7    add_settings_section( 'jwplayer_setting_basic_section', null, '__return_true', 'jwplayer_settings' );
    88
    99    if ( get_option( 'jwplayer_api_key' ) ) {
    10         add_settings_field( 'jwplayer_logout_link', 'Authorization', 'jwplayer_setting_logout_link', 'jwplayer_settings', 'jwplayer_setting_section' );
    11         add_settings_field( 'jwplayer_player', 'Default player', 'jwplayer_setting_player', 'jwplayer_settings', 'jwplayer_setting_section' );
    12         add_settings_field( 'jwplayer_show_widget', 'Authoring page widget', 'jwplayer_setting_show_widget', 'jwplayer_settings', 'jwplayer_setting_section' );
    13         add_settings_field( 'jwplayer_nr_videos', 'Videos in widget', 'jwplayer_setting_nr_videos', 'jwplayer_settings', 'jwplayer_setting_section' );
    14         add_settings_field( 'jwplayer_timeout', 'Timeout for signed links', 'jwplayer_setting_timeout', 'jwplayer_settings', 'jwplayer_setting_section' );
    15         add_settings_field( 'jwplayer_content_mask', 'Content DNS mask', 'jwplayer_setting_content_mask', 'jwplayer_settings', 'jwplayer_setting_section' );
    16         add_settings_field( 'jwplayer_custom_shortcode_parser', 'Custom shortcode parser', 'jwplayer_setting_custom_shortcode', 'jwplayer_settings', 'jwplayer_setting_section' );
     10        add_settings_field( 'jwplayer_logout_link', 'Authorization', 'jwplayer_setting_logout_link', 'jwplayer_settings', 'jwplayer_setting_basic_section' );
     11        add_settings_field( 'jwplayer_player', 'Default player', 'jwplayer_setting_player', 'jwplayer_settings', 'jwplayer_setting_basic_section' );
     12        add_settings_field( 'jwplayer_show_widget', 'Authoring page widget', 'jwplayer_setting_show_widget', 'jwplayer_settings', 'jwplayer_setting_basic_section' );
     13        add_settings_field( 'jwplayer_nr_videos', 'Videos in widget', 'jwplayer_setting_nr_videos', 'jwplayer_settings', 'jwplayer_setting_basic_section' );
     14
     15        add_settings_section( 'jwplayer_setting_advanced_section', 'Advanced Settings', 'jwplayer_settings_advanced', 'jwplayer_settings' );
     16        add_settings_field( 'jwplayer_timeout', 'Timeout for signed links', 'jwplayer_setting_timeout', 'jwplayer_settings', 'jwplayer_setting_advanced_section' );
     17        add_settings_field( 'jwplayer_content_mask', 'Content DNS mask', 'jwplayer_setting_content_mask', 'jwplayer_settings', 'jwplayer_setting_advanced_section' );
     18        add_settings_field( 'jwplayer_enable_sync', 'Enable JW Sync', 'jwplayer_setting_enable_sync', 'jwplayer_settings', 'jwplayer_setting_advanced_section' );
     19        add_settings_field( 'jwplayer_custom_shortcode_parser', 'Custom shortcode parser', 'jwplayer_setting_custom_shortcode', 'jwplayer_settings', 'jwplayer_setting_advanced_section' );
    1720
    1821        register_setting( 'jwplayer_settings', 'jwplayer_nr_videos', 'absint' );
     
    2124        register_setting( 'jwplayer_settings', 'jwplayer_player', 'jwplayer_validate_player' );
    2225        register_setting( 'jwplayer_settings', 'jwplayer_show_widget', 'jwplayer_validate_boolean' );
     26        register_setting( 'jwplayer_settings', 'jwplayer_enable_sync', 'jwplayer_validate_boolean' );
    2327        register_setting( 'jwplayer_settings', 'jwplayer_custom_shortcode_parser', 'jwplayer_validate_boolean' );
    2428    } else {
    25         add_settings_field( 'jwplayer_login_link', 'Authorization', 'jwplayer_setting_login_link', 'jwplayer_settings', 'jwplayer_setting_section' );
     29        add_settings_field( 'jwplayer_login_link', 'Authorization', 'jwplayer_setting_login_link', 'jwplayer_settings', 'jwplayer_setting_basic_section' );
    2630    }
    2731
     
    7478
    7579    echo 'Show <input name="jwplayer_nr_videos" id="jwplayer_nr_videos" type="text" size="2" value="' . esc_attr( $nr_videos ) . '" /> videos.';
     80}
     81
     82// Adds the Advanced Settings submenu intro
     83function jwplayer_settings_advanced() {
     84    echo '<p>Please make sure to read the documentation before changing any of the settings below. If these settings are used incorrectly, your plugin or Wordpress site might not function properly.</p>';
    7685}
    7786
     
    145154// The setting which determines whether we show the widget on the authoring page (or only in the "Add media" window)
    146155function jwplayer_setting_show_widget() {
    147     $show_widget = get_option( 'jwplayer_show_widget' );
     156    $show_widget = get_option( 'jwplayer_show_widget', JWPLAYER_SHOW_WIDGET );
    148157    echo '<input name="jwplayer_show_widget" id="jwplayer_show_widget" type="checkbox" ';
    149158    checked( true, $show_widget );
     
    151160    echo '<label for="jwplayer_show_widget">Show</label>';
    152161    echo '<p class="description"><strong>Note:</strong> The widget is always accessible from the <em>Add media</em> window.</p>';
     162}
     163
     164// The settings which determines if external media is imported into the JW Player account or left as is.
     165function jwplayer_setting_enable_sync() {
     166    $enable_sync = get_option( 'jwplayer_enable_sync', JWPLAYER_ENABLE_SYNC );
     167    echo '<input name="jwplayer_enable_sync" id="jwplayer_enable_sync" type="checkbox" ';
     168    checked( true, $enable_sync );
     169    echo ' value="1" /> ';
     170    echo '<label for="jwplayer_enable_sync">Sync media to JW Player</label>';
     171    echo '<p class="description">Enabling this setting will make it possible to sync your local media files to your JW Player account.</p>';
     172    echo '<p class="description">For synced media you can manage metadata and see video statistics inside the JW Player dashboard.</p>';
    153173}
    154174
  • jw-player/trunk/include/shortcode.php

    r1507989 r1585797  
    2020        unset( $atts[0] );
    2121        $player = ( isset( $m['player'] ) ) ? $m['player'] : null;
    22         return jwplayer_shortcode_create_js_embed( $m['media'], $player, $atts );
     22        return apply_filters( 'jwplayer_js_embed', jwplayer_shortcode_create_js_embed( $m['media'], $player, $atts ) );
    2323    } else {
    2424        // Legacy shortcode
     
    102102
    103103function jwplayer_shortcode_handle_legacy( $atts ) {
     104    $jw_sync = get_option( 'jwplayer_enable_sync', JWPLAYER_ENABLE_SYNC );
    104105    // Try to get media
    105106    if ( isset( $atts['mediaid'] ) ) {
    106         $hash = jwplayer_media_hash( intval( $atts['mediaid'] ) );
     107        $hash = jwplayer_media_hash( intval( $atts['mediaid'] ), $jw_sync );
    107108        if ( ! isset( $atts['image'] ) ) {
    108109            $thumb = get_post_meta( $atts['mediaid'], 'jwplayermodule_thumbnail', true );
     
    111112            }
    112113        }
     114        if ( ! $hash ) {
     115            $atts['file'] = wp_get_attachment_url( $atts['mediaid'] );
     116            $hash = 'local';
     117        }
    113118        unset( $atts['mediaid'] );
    114         // };
    115     } elseif ( isset( $atts['file'] ) ) {
     119    } elseif ( isset( $atts['file'] ) && $jw_sync ) {
    116120        $title = ( isset( $atts['title'] ) ) ? $atts['title'] : null;
    117121        $hash = jwplayer_media_legacy_external_source( $atts['file'], $title );
    118122        unset( $atts['file'] );
     123    } elseif ( isset( $atts['file'] ) ) {
     124        $hash = 'local';
    119125    } elseif ( isset( $atts['playlistid'] ) ) {
    120126        $imported_playlists = get_option( 'jwplayer_imported_playlists' );
     
    134140    // Return the old stuff
    135141    if ( isset( $hash ) ) {
    136         return jwplayer_shortcode_create_js_embed( $hash, $player_hash, $atts );
     142        return apply_filters( 'jwplayer_js_embed', jwplayer_shortcode_create_js_embed( $hash, $player_hash, $atts ) );
    137143    }
    138144    return '<!-- ERROR PARSING SHORTCODE -->';
     
    141147function jwplayer_shortcode_filter_player_params( $atts ) {
    142148    $params = array();
    143     $strip = array( 'file', 'mediaid', 'playlist', 'playlistid' );
     149    $strip = array( 'mediaid', 'playlist', 'playlistid' );
    144150    $translate = array(
    145151        'true'  => true,
     
    194200    }
    195201
    196     $element_id = "jwplayer_{$media_hash}_{$player_hash}_div";
     202    if ( 'local' == $media_hash ) {
     203        $element_id = "jwplayer_" . wp_generate_password( 12, false ) . "_div";
     204    } else {
     205        $element_id = "jwplayer_{$media_hash}_{$player_hash}_div";
     206    }
    197207
    198208    $timeout = intval( get_option( 'jwplayer_timeout' ) );
    199209    $js_lib = "$protocol://$content_mask/libraries/$player_hash.js";
    200     $json = "$protocol://$content_mask/feeds/$media_hash.json";
     210    $json_feed = "$protocol://$content_mask/feeds/$media_hash.json";
    201211    if ( $timeout > 0 ) {
    202212        $api_secret = get_option( 'jwplayer_api_secret' );
     
    207217
    208218        $json_sig = md5( "feeds/$media_hash.json:" . $expires . ':' . $api_secret );
    209         $json = "$json?exp=$expires&sig=$json_sig";
     219        $json_feed = "$json_feed?exp=$expires&sig=$json_sig";
    210220    }
    211221
     
    225235        }
    226236    }
    227     if ( ! isset( $params['source'] ) ) {
    228         $params['playlist'] = $json;
     237    if ( ! isset( $params['source'] ) && 'local' != $media_hash ) {
     238        $params['playlist'] = $json_feed;
    229239    }
    230240
  • jw-player/trunk/include/utils.php

    r1389039 r1585797  
    11<?php
    22
    3 function jwplayer_log( $line, $print_r = false ) {
     3function jwplayer_log( $msg, $print_r = false ) {
    44    // Due to Wordpress VIP requirements this function is just a stub.
    55    // If you want to make it work, please visit:
     
    2424        return null;
    2525    }
    26     $option_value = json_decode( $raw_json );
     26    $option_value = json_decode( $raw_json, true );
    2727    if ( null === $option_value ) {
    2828        $option_value = unserialize( $raw_json );
  • jw-player/trunk/jw-player.php

    r1530331 r1585797  
    55Description: This plugin allows you to easily upload and embed videos using the JW Player. The embedded video links can be signed, making it harder for viewers to steal your content.
    66Author: JW Player
    7 Version: 1.5.8
     7Version: 1.6.0
    88*/
    99
     
    2323
    2424// Default settings
    25 define( 'JWPLAYER_PLUGIN_VERSION', '1.5.8' );
     25define( 'JWPLAYER_PLUGIN_VERSION', '1.6.0' );
    2626define( 'JWPLAYER_MINIMUM_PHP_VERSION', '5.4.0' );
    2727define( 'JWPLAYER_PLAYER', 'ALJ3XQCI' );
     
    3131define( 'JWPLAYER_NR_VIDEOS', '5' );
    3232define( 'JWPLAYER_CUSTOM_SHORTCODE_OPTIONS', wp_json_encode( array( 'content', 'excerpt', 'strip' ) ) );
    33 define( 'JWPLAYER_SHOW_WIDGET', false );
     33define( 'JWPLAYER_SHOW_WIDGET', true );
     34define( 'JWPLAYER_ENABLE_SYNC', true );
    3435define( 'JWPLAYER_CUSTOM_SHORTCODE_PARSER', false );
    3536define( 'JWPLAYER_CUSTOM_SHORTCODE_FILTER', 'content' );
     
    7879    add_option( 'jwplayer_nr_videos', JWPLAYER_NR_VIDEOS );
    7980    add_option( 'jwplayer_show_widget', JWPLAYER_SHOW_WIDGET );
     81    add_option( 'jwplayer_enable_sync', JWPLAYER_ENABLE_SYNC );
    8082    add_option( 'jwplayer_custom_shortcode_parser', JWPLAYER_CUSTOM_SHORTCODE_PARSER );
    8183    add_option( 'jwplayer_shortcode_category_filter', JWPLAYER_CUSTOM_SHORTCODE_FILTER );
     
    110112
    111113// Initialize the media pages:
    112 add_filter( 'attachment_fields_to_edit', 'jwplayer_media_attachment_fields_to_edit', 99, 2 );
    113 add_filter( 'attachment_fields_to_save', 'jwplayer_media_attachment_fields_to_save', 99, 2 );
     114if ( get_option( 'jwplayer_enable_sync', JWPLAYER_ENABLE_SYNC ) ) {
     115    add_filter( 'attachment_fields_to_edit', 'jwplayer_media_attachment_fields_to_edit', 99, 2 );
     116    add_filter( 'attachment_fields_to_save', 'jwplayer_media_attachment_fields_to_save', 99, 2 );
     117}
    114118add_filter( 'media_upload_tabs', 'jwplayer_media_menu' );
    115119
  • jw-player/trunk/readme.txt

    r1530331 r1585797  
    33Tags: jwplayer, jw, player, jwplatform, video, media, html5
    44Requires at least: 4.3
    5 Tested up to: 4.6.1
    6 Stable tag: 1.5.8
     5Tested up to: 4.7.1
     6Stable tag: 1.6.0
    77License: GPLv3
    88
     
    9797== Changelog ==
    9898
     99= 1.6.0 =
     100
     101* Feature: Added option to disable syncing local content to your JW Player account.
     102* Feature: Added a filter hook for generated JS embed code. Thanks to [@nirarazi](https://github.com/nirarazi)
     103* Update: Show Widget by default
     104* Update: Tested for compatibility with Wordpress 4.7
     105
    99106= 1.5.8 =
    100107
Note: See TracChangeset for help on using the changeset viewer.