Changeset 1585797
- Timestamp:
- 01/31/2017 02:16:51 PM (9 years ago)
- Location:
- jw-player/trunk
- Files:
-
- 7 edited
-
include/jwplayer-api.class.php (modified) (1 diff)
-
include/media.php (modified) (1 diff)
-
include/settings.php (modified) (5 diffs)
-
include/shortcode.php (modified) (8 diffs)
-
include/utils.php (modified) (2 diffs)
-
jw-player.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
jw-player/trunk/include/jwplayer-api.class.php
r1404329 r1585797 85 85 86 86 $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 ) ); 95 93 } 96 94 -
jw-player/trunk/include/media.php
r1404329 r1585797 167 167 // Add the video widget to the authoring page, if enabled in the settings 168 168 function 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' ) ) { 170 170 add_meta_box( 'jwplayer-video-box', 'Insert media with JW Player', 'jwplayer_media_widget_body', 'post', 'side', 'high' ); 171 171 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 5 5 function jwplayer_settings_init() { 6 6 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' ); 8 8 9 9 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' ); 17 20 18 21 register_setting( 'jwplayer_settings', 'jwplayer_nr_videos', 'absint' ); … … 21 24 register_setting( 'jwplayer_settings', 'jwplayer_player', 'jwplayer_validate_player' ); 22 25 register_setting( 'jwplayer_settings', 'jwplayer_show_widget', 'jwplayer_validate_boolean' ); 26 register_setting( 'jwplayer_settings', 'jwplayer_enable_sync', 'jwplayer_validate_boolean' ); 23 27 register_setting( 'jwplayer_settings', 'jwplayer_custom_shortcode_parser', 'jwplayer_validate_boolean' ); 24 28 } 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' ); 26 30 } 27 31 … … 74 78 75 79 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 83 function 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>'; 76 85 } 77 86 … … 145 154 // The setting which determines whether we show the widget on the authoring page (or only in the "Add media" window) 146 155 function jwplayer_setting_show_widget() { 147 $show_widget = get_option( 'jwplayer_show_widget' );156 $show_widget = get_option( 'jwplayer_show_widget', JWPLAYER_SHOW_WIDGET ); 148 157 echo '<input name="jwplayer_show_widget" id="jwplayer_show_widget" type="checkbox" '; 149 158 checked( true, $show_widget ); … … 151 160 echo '<label for="jwplayer_show_widget">Show</label>'; 152 161 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. 165 function 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>'; 153 173 } 154 174 -
jw-player/trunk/include/shortcode.php
r1507989 r1585797 20 20 unset( $atts[0] ); 21 21 $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 ) ); 23 23 } else { 24 24 // Legacy shortcode … … 102 102 103 103 function jwplayer_shortcode_handle_legacy( $atts ) { 104 $jw_sync = get_option( 'jwplayer_enable_sync', JWPLAYER_ENABLE_SYNC ); 104 105 // Try to get media 105 106 if ( isset( $atts['mediaid'] ) ) { 106 $hash = jwplayer_media_hash( intval( $atts['mediaid'] ) );107 $hash = jwplayer_media_hash( intval( $atts['mediaid'] ), $jw_sync ); 107 108 if ( ! isset( $atts['image'] ) ) { 108 109 $thumb = get_post_meta( $atts['mediaid'], 'jwplayermodule_thumbnail', true ); … … 111 112 } 112 113 } 114 if ( ! $hash ) { 115 $atts['file'] = wp_get_attachment_url( $atts['mediaid'] ); 116 $hash = 'local'; 117 } 113 118 unset( $atts['mediaid'] ); 114 // }; 115 } elseif ( isset( $atts['file'] ) ) { 119 } elseif ( isset( $atts['file'] ) && $jw_sync ) { 116 120 $title = ( isset( $atts['title'] ) ) ? $atts['title'] : null; 117 121 $hash = jwplayer_media_legacy_external_source( $atts['file'], $title ); 118 122 unset( $atts['file'] ); 123 } elseif ( isset( $atts['file'] ) ) { 124 $hash = 'local'; 119 125 } elseif ( isset( $atts['playlistid'] ) ) { 120 126 $imported_playlists = get_option( 'jwplayer_imported_playlists' ); … … 134 140 // Return the old stuff 135 141 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 ) ); 137 143 } 138 144 return '<!-- ERROR PARSING SHORTCODE -->'; … … 141 147 function jwplayer_shortcode_filter_player_params( $atts ) { 142 148 $params = array(); 143 $strip = array( ' file', 'mediaid', 'playlist', 'playlistid' );149 $strip = array( 'mediaid', 'playlist', 'playlistid' ); 144 150 $translate = array( 145 151 'true' => true, … … 194 200 } 195 201 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 } 197 207 198 208 $timeout = intval( get_option( 'jwplayer_timeout' ) ); 199 209 $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"; 201 211 if ( $timeout > 0 ) { 202 212 $api_secret = get_option( 'jwplayer_api_secret' ); … … 207 217 208 218 $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"; 210 220 } 211 221 … … 225 235 } 226 236 } 227 if ( ! isset( $params['source'] ) ) {228 $params['playlist'] = $json ;237 if ( ! isset( $params['source'] ) && 'local' != $media_hash ) { 238 $params['playlist'] = $json_feed; 229 239 } 230 240 -
jw-player/trunk/include/utils.php
r1389039 r1585797 1 1 <?php 2 2 3 function jwplayer_log( $ line, $print_r = false ) {3 function jwplayer_log( $msg, $print_r = false ) { 4 4 // Due to Wordpress VIP requirements this function is just a stub. 5 5 // If you want to make it work, please visit: … … 24 24 return null; 25 25 } 26 $option_value = json_decode( $raw_json );26 $option_value = json_decode( $raw_json, true ); 27 27 if ( null === $option_value ) { 28 28 $option_value = unserialize( $raw_json ); -
jw-player/trunk/jw-player.php
r1530331 r1585797 5 5 Description: 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. 6 6 Author: JW Player 7 Version: 1. 5.87 Version: 1.6.0 8 8 */ 9 9 … … 23 23 24 24 // Default settings 25 define( 'JWPLAYER_PLUGIN_VERSION', '1. 5.8' );25 define( 'JWPLAYER_PLUGIN_VERSION', '1.6.0' ); 26 26 define( 'JWPLAYER_MINIMUM_PHP_VERSION', '5.4.0' ); 27 27 define( 'JWPLAYER_PLAYER', 'ALJ3XQCI' ); … … 31 31 define( 'JWPLAYER_NR_VIDEOS', '5' ); 32 32 define( 'JWPLAYER_CUSTOM_SHORTCODE_OPTIONS', wp_json_encode( array( 'content', 'excerpt', 'strip' ) ) ); 33 define( 'JWPLAYER_SHOW_WIDGET', false ); 33 define( 'JWPLAYER_SHOW_WIDGET', true ); 34 define( 'JWPLAYER_ENABLE_SYNC', true ); 34 35 define( 'JWPLAYER_CUSTOM_SHORTCODE_PARSER', false ); 35 36 define( 'JWPLAYER_CUSTOM_SHORTCODE_FILTER', 'content' ); … … 78 79 add_option( 'jwplayer_nr_videos', JWPLAYER_NR_VIDEOS ); 79 80 add_option( 'jwplayer_show_widget', JWPLAYER_SHOW_WIDGET ); 81 add_option( 'jwplayer_enable_sync', JWPLAYER_ENABLE_SYNC ); 80 82 add_option( 'jwplayer_custom_shortcode_parser', JWPLAYER_CUSTOM_SHORTCODE_PARSER ); 81 83 add_option( 'jwplayer_shortcode_category_filter', JWPLAYER_CUSTOM_SHORTCODE_FILTER ); … … 110 112 111 113 // 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 ); 114 if ( 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 } 114 118 add_filter( 'media_upload_tabs', 'jwplayer_media_menu' ); 115 119 -
jw-player/trunk/readme.txt
r1530331 r1585797 3 3 Tags: jwplayer, jw, player, jwplatform, video, media, html5 4 4 Requires at least: 4.3 5 Tested up to: 4. 6.16 Stable tag: 1. 5.85 Tested up to: 4.7.1 6 Stable tag: 1.6.0 7 7 License: GPLv3 8 8 … … 97 97 == Changelog == 98 98 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 99 106 = 1.5.8 = 100 107
Note: See TracChangeset
for help on using the changeset viewer.