FV Flowplayer Video Player - Version 6.1.5

Version Description

  • 2016/06/29 =

  • Compatibility - bugfix for FV Player widget as it was breaking Featured Image insertion when also using DesignThemes Core Features Plugin

  • Iframe embedding - using width and height attributes like YouTube or Vimeo to ensure FV Player Iframe embeds are responsive at least in themes with iframe responsiveness code

  • Microsoft Smooth Streaming - adding support for http://.streaming.mediaservices.windows.net/.ism/manifest(format=mpd-time-csf) and ...(format=m3u8-aapl) kind of URLs

  • Reverting - Ajax loading - fix for repeated autoplay if your theme loads FV Player using Ajax and uses autoplay for the loaded content. You have to set fv_player_did_autoplay

Download this release

Release Info

Developer FolioVision
Plugin Icon 128x128 FV Flowplayer Video Player
Version 6.1.5
Comparing to
See all releases

Code changes from version 6.0.5.24 to 6.1.5

controller/backend.php CHANGED
@@ -15,714 +15,175 @@
15
16
You should have received a copy of the GNU General Public License
17
along with this program. If not, see <http://www.gnu.org/licenses/>.
18
- */
19
-
20
- add_action('wp_ajax_fv_wp_flowplayer_support_mail', 'fv_wp_flowplayer_support_mail');
21
- add_action('wp_ajax_fv_wp_flowplayer_activate_extension', 'fv_wp_flowplayer_activate_extension');
22
- add_action('wp_ajax_fv_wp_flowplayer_check_template', 'fv_wp_flowplayer_check_template');
23
- add_action('wp_ajax_fv_wp_flowplayer_check_files', 'fv_wp_flowplayer_check_files');
24
- add_action('wp_ajax_fv_wp_flowplayer_check_license', 'fv_wp_flowplayer_check_license');
25
-
26
- add_action('admin_head', 'flowplayer_admin_head');
27
- add_action('admin_footer', 'flowplayer_admin_footer');
28
- add_action('admin_print_footer_scripts', 'flowplayer_admin_footer_wp_js_restore', 999999 );
29
-
30
- add_action('admin_menu', 'flowplayer_admin');
31
- add_action('media_buttons', 'flowplayer_add_media_button', 10);
32
- add_action('media_upload_fvplayer_video', '__return_false'); // keep for compatibility!
33
-
34
-
35
- add_action('admin_init', 'fv_wp_flowplayer_admin_init');
36
- add_action( 'wp_ajax_fv_foliopress_ajax_pointers', 'fv_wp_flowplayer_pointers_ajax' );
37
-
38
-
39
-
40
- add_action( 'admin_enqueue_scripts', 'fv_player_shortcode_editor_scripts' );
41
- add_action( 'edit_form_after_editor', 'fv_wp_flowplayer_edit_form_after_editor' );
42
-
43
- add_action( 'after_plugin_row', 'fv_wp_flowplayer_after_plugin_row', 10, 3 );
44
-
45
- add_action( 'save_post', 'fv_wp_flowplayer_save_post' );
46
- add_action( 'save_post', 'fv_wp_flowplayer_featured_image' , 10000 );
47
-
48
-
49
- add_filter( 'get_user_option_closedpostboxes_fv_flowplayer_settings', 'fv_wp_flowplayer_closed_meta_boxes' );
50
-
51
-
52
- add_action('the_content', 'flowplayer_content_remove_commas');
53
-
54
- add_filter('admin_print_scripts', 'flowplayer_print_scripts');
55
- add_action('admin_print_styles', 'flowplayer_print_styles');
56
- add_action('admin_enqueue_scripts', 'fv_flowplayer_admin_scripts');
57
-
58
- //conversion script via AJAX
59
- add_action('wp_ajax_flowplayer_conversion_script', 'flowplayer_conversion_script');
60
- add_action('admin_notices', 'fv_wp_flowplayer_admin_notice');
61
-
62
-
63
-
64
- function fv_wp_flowplayer_featured_image($post_id) {
65
- if( $parent_id = wp_is_post_revision($post_id) ) {
66
- $post_id = $parent_id;
67
- }
68
-
69
- global $fv_fp;
70
- if( !isset($fv_fp->conf['integrations']['featured_img']) || $fv_fp->conf['integrations']['featured_img'] != 'true' ){
71
- return;
72
- }
73
-
74
- $thumbnail_id = get_post_thumbnail_id($post_id);
75
- if( $thumbnail_id != 0 ) {
76
- return;
77
- }
78
-
79
- $post = get_post($post_id);
80
- if( !$post || empty($post->post_content) ){
81
- return;
82
- }
83
-
84
- $sThumbUrl = array();
85
- if (!preg_match('/(?:splash=\\\?")([^"]*.(?:jpg|gif|png))/', $post->post_content, $sThumbUrl) || empty($sThumbUrl[1])) {
86
- return;
87
- }
88
-
89
- $thumbnail_id = fv_wp_flowplayer_save_to_media_library($sThumbUrl[1], $post_id);
90
- if($thumbnail_id){
91
- set_post_thumbnail($post_id, $thumbnail_id);
92
- }
93
-
94
- }
95
-
96
- function fv_wp_flowplayer_construct_filename( $post_id ) {
97
- $filename = get_the_title( $post_id );
98
- $filename = sanitize_title( $filename, $post_id );
99
- $filename = urldecode( $filename );
100
- $filename = preg_replace( '/[^a-zA-Z0-9\-]/', '', $filename );
101
- $filename = substr( $filename, 0, 32 );
102
- $filename = trim( $filename, '-' );
103
- if ( $filename == '' ) $filename = (string) $post_id;
104
- return $filename;
105
- }
106
-
107
- function fv_wp_flowplayer_save_to_media_library( $image_url, $post_id ) {
108
-
109
- $error = '';
110
- $response = wp_remote_get( $image_url );
111
- if( is_wp_error( $response ) ) {
112
- $error = new WP_Error( 'thumbnail_retrieval', sprintf( __( 'Error retrieving a thumbnail from the URL <a href="%1$s">%1$s</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.', 'video-thumbnails' ), $image_url ) . '<br>' . __( 'Error Details:', 'video-thumbnails' ) . ' ' . $response->get_error_message() );
113
- } else {
114
- $image_contents = $response['body'];
115
- $image_type = wp_remote_retrieve_header( $response, 'content-type' );
116
- }
117
-
118
- if ( $error != '' || $image_contents == '' ) {
119
- return false;
120
- } else {
121
-
122
- // Translate MIME type into an extension
123
- if ( $image_type == 'image/jpeg' ) {
124
- $image_extension = '.jpg';
125
- } elseif ( $image_type == 'image/png' ) {
126
- $image_extension = '.png';
127
- } elseif ( $image_type == 'image/gif' ) {
128
- $image_extension = '.gif';
129
- } else {
130
- return new WP_Error( 'thumbnail_upload', __( 'Unsupported MIME type:', 'video-thumbnails' ) . ' ' . $image_type );
131
- }
132
-
133
- // Construct a file name with extension
134
- $new_filename = fv_wp_flowplayer_construct_filename( $post_id ) . $image_extension;
135
-
136
- // Save the image bits using the new filename
137
- $upload = wp_upload_bits( $new_filename, null, $image_contents );
138
-
139
- // Stop for any errors while saving the data or else continue adding the image to the media library
140
- if ( $upload['error'] ) {
141
- $error = new WP_Error( 'thumbnail_upload', __( 'Error uploading image data:', 'video-thumbnails' ) . ' ' . $upload['error'] );
142
- return $error;
143
- } else {
144
-
145
- $wp_filetype = wp_check_filetype( basename( $upload['file'] ), null );
146
-
147
- $upload = apply_filters( 'wp_handle_upload', array(
148
- 'file' => $upload['file'],
149
- 'url' => $upload['url'],
150
- 'type' => $wp_filetype['type']
151
- ), 'sideload' );
152
-
153
- // Contstruct the attachment array
154
- $attachment = array(
155
- 'post_mime_type' => $upload['type'],
156
- 'post_title' => get_the_title( $post_id ),
157
- 'post_content' => '',
158
- 'post_status' => 'inherit'
159
- );
160
- // Insert the attachment
161
- $attach_id = wp_insert_attachment( $attachment, $upload['file'], $post_id );
162
-
163
- }
164
-
165
- }
166
-
167
- return $attach_id;
168
-
169
- }
170
-
171
- function flowplayer_activate() {
172
-
173
- }
174
-
175
-
176
- function flowplayer_deactivate() {
177
- if( flowplayer::is_licensed() ) {
178
- delete_transient( 'fv_flowplayer_license' );
179
- }
180
- delete_option( 'fv_flowplayer_extension_install' );
181
- wp_clear_scheduled_hook('fv_flowplayer_checker_event');
182
- }
183
-
184
-
185
- function flowplayer_admin_head() {
186
-
187
- if( !isset($_GET['page']) || $_GET['page'] != 'fvplayer' ) {
188
- return;
189
- }
190
-
191
- global $fv_wp_flowplayer_ver;
192
- ?>
193
- <script type="text/javascript" src="<?php echo FV_FP_RELATIVE_PATH; ?>/js/jscolor/jscolor.js"></script>
194
- <link rel="stylesheet" type="text/css" href="<?php echo flowplayer::get_plugin_url().'/css/license.css'; ?>?ver=<?php echo $fv_wp_flowplayer_ver; ?>" />
195
-
196
- <script>
197
- jQuery(window).on('unload', function(){
198
- window.fv_flowplayer_wp = window.wp;
199
- });
200
- </script>
201
- <?php
202
- }
203
-
204
-
205
- function flowplayer_admin_footer() {
206
- if( !isset($_GET['page']) || $_GET['page'] != 'fvplayer' ) {
207
- return;
208
- }
209
-
210
- flowplayer_prepare_scripts();
211
- }
212
-
213
-
214
- function flowplayer_admin_footer_wp_js_restore() {
215
- if( !isset($_GET['page']) || $_GET['page'] != 'fvplayer' ) {
216
- return;
217
- }
218
-
219
- ?>
220
- <script>
221
- jQuery(window).on('unload', function(){
222
- window.wp = window.fv_flowplayer_wp;
223
- });
224
- </script>
225
- <?php
226
- }
227
-
228
-
229
-
230
-
231
- /**
232
- * Administrator environment function.
233
- */
234
- function flowplayer_admin () {
235
- if( function_exists('add_submenu_page') ) {
236
- add_options_page( 'FV Player', 'FV Player', 'manage_options', 'fvplayer', 'flowplayer_page' );
237
- }
238
- }
239
-
240
-
241
- /**
242
- * Outputs HTML code for bool options based on arg passed.
243
- * @param string Currently selected value ('true' or 'false').
244
- * @return string HTML code
245
- */
246
- function flowplayer_bool_select($current) {
247
- switch($current) {
248
- case "true":
249
- $html = '<option selected="selected" value="true">true</option><option value="false">false</option>';
250
- break;
251
- case "false":
252
- $html = '<option value="true" >true</option><option selected="selected" value="false">false</option>';
253
- break;
254
- default:
255
- $html = '<option value="true">true</option><option selected="selected" value="false">false</option>';
256
- break;
257
- }
258
- return $html;
259
- }
260
-
261
-
262
- /**
263
- * Displays administrator menu with configuration.
264
- */
265
- function flowplayer_page() {
266
- global $fv_fp;
267
- include dirname( __FILE__ ) . '/../view/admin.php';
268
- }
269
270
271
- /**
272
- * Checks for errors regarding access to configuration file. Displays errors if any occur.
273
- * @param object $fv_fp Flowplayer class object.
274
*/
275
- function flowplayer_check_errors($fv_fp) {
276
-
277
- }
278
-
279
-
280
- function flowplayer_add_media_button() {
281
- if( stripos( $_SERVER['REQUEST_URI'], 'post.php' ) === FALSE && stripos( $_SERVER['REQUEST_URI'], 'post-new.php' ) === FALSE ) {
282
- return;
283
- }
284
-
285
- global $post;
286
- $plugins = get_option('active_plugins');
287
- $found = false;
288
- foreach ( $plugins AS $plugin ) {
289
- if( stripos($plugin,'foliopress-wysiwyg') !== FALSE )
290
- $found = true;
291
- }
292
- $button_tip = 'Insert a video';
293
- $wizard_url = 'media-upload.php?post_id='.$post->ID.'&type=fv-wp-flowplayer';
294
- $icon = '<span> </span>';
295
-
296
- echo '<a title="' . __('Add FV Player', 'fv-wordpress-flowplayer') . '" title="' . $button_tip . '" href="#" class="button fv-wordpress-flowplayer-button" >'.$icon.' Player</a>';
297
- }
298
-
299
-
300
- function flowplayer_print_scripts() {
301
- wp_enqueue_script('media-upload');
302
- wp_enqueue_script('thickbox');
303
- }
304
-
305
-
306
- function flowplayer_print_styles() {
307
- wp_enqueue_style('thickbox');
308
- }
309
-
310
-
311
- function flowplayer_conversion_script() {
312
- global $wpdb;
313
-
314
- $posts = $wpdb->get_results("SELECT ID, post_content FROM {$wpdb->posts} WHERE post_type != 'revision'");
315
-
316
- $old_shorttag = '[flowplayer';
317
- $new_shorttag = '[fvplayer';
318
- $counter = 0;
319
-
320
- echo '<ol>';
321
- foreach($posts as $fv_post) {
322
- if ( stripos( $fv_post->post_content, $old_shorttag ) !== false ) {
323
- $update_post = array();
324
- $update_post['ID'] = $fv_post->ID;
325
- $update_post['post_content'] = str_replace( $old_shorttag, $new_shorttag, $fv_post->post_content );
326
- wp_update_post( $update_post );
327
- echo '<li><a href="' . get_permalink($fv_post->ID) . '">' . get_the_title($fv_post->ID) . '</a> updated</li>';
328
- $counter++;
329
- }
330
- }
331
- echo '</ol>';
332
-
333
- echo '<strong>Conversion was succesful. Total number of converted posts: ' . $counter . '</strong>';
334
-
335
- delete_option('fvwpflowplayer_conversion');
336
-
337
- die();
338
- }
339
-
340
-
341
- function fv_wp_flowplayer_admin_notice() {
342
- if( $notices = get_option('fv_wordpress_flowplayer_deferred_notices') ) {
343
- echo '<div class="updated inline">
344
- <p>'.$notices.'</p>
345
- </div>';
346
- delete_option('fv_wordpress_flowplayer_deferred_notices');
347
- }
348
-
349
- $conversion = false; //(bool)get_option('fvwpflowplayer_conversion');
350
- if ($conversion) {
351
- echo '<div class="updated" id="fvwpflowplayer_conversion_notice"><p>';
352
- printf(__('FV Wordpress Flowplayer has found old shortcodes in the content of your posts. <a href="%1$s">Run the conversion script.</a>'), get_admin_url() . 'options-general.php?page=fvplayer');
353
- echo "</p></div>";
354
- }
355
-
356
- if( isset($_GET['fv-licensing']) && $_GET['fv-licensing'] == "check" ){
357
- echo '<div class="updated inline">
358
- <p>Thank you for purchase. Your license will be renewed in couple of minutes.<br/>
359
- Please make sure you upgrade <strong>FV Player Pro</strong> and <strong>FV Player VAST</strong> if you are using it.</p>
360
- </div>';
361
- }
362
-
363
- global $FV_Player_Pro;
364
- if( $FV_Player_Pro && version_compare($FV_Player_Pro->version,'0.5') == -1 ) :
365
- ?>
366
- <div class="error">
367
- <p><?php _e( 'FV Wordpress Flowplayer: Your pro extension is installed, but it\'s not compatible with FV Flowplayer 6! Make sure you upgrade your FV Player Pro to version 0.5 or above.', 'my-text-domain' ); ?></p>
368
- </div>
369
- <?php
370
- endif;
371
-
372
- /*if( isset($_GET['page']) && $_GET['page'] == 'backend.php' ) {
373
- $options = get_option( 'fvwpflowplayer' );
374
- if( $options['key'] == 'false' ) {
375
- echo '<div class="updated"><p>';
376
- printf(__('Brand new version of Flowplayer for HTML5. <a href="http://foliovision.com/wordpress/plugins/fv-wordpress-flowplayer/buy">Licenses half price</a> in May.' ) );
377
- echo "</p></div>";
378
- }
379
- }*/
380
- }
381
-
382
383
- function fv_player_shortcode_editor_scripts( $page ) {
384
- if( $page !== 'post.php' && $page !== 'post-new.php' ) {
385
- return;
386
- }
387
-
388
- global $fv_wp_flowplayer_ver;
389
-
390
-
391
- wp_register_script('fvwpflowplayer-domwindow', flowplayer::get_plugin_url().'/js/jquery.colorbox-min.js',array('jquery'), $fv_wp_flowplayer_ver );
392
- wp_enqueue_script('fvwpflowplayer-domwindow');
393
-
394
- wp_register_script('fvwpflowplayer-shortcode-editor', flowplayer::get_plugin_url().'/js/shortcode-editor.js',array('jquery'), $fv_wp_flowplayer_ver );
395
- wp_register_script('fvwpflowplayer-shortcode-editor-old', flowplayer::get_plugin_url().'/js/shortcode-editor.old.js',array('jquery'), $fv_wp_flowplayer_ver );
396
-
397
- global $fv_fp;
398
- if( isset($fv_fp->conf["interface"]['shortcode_editor_old']) && $fv_fp->conf["interface"]['shortcode_editor_old'] == 'true' ) {
399
- wp_enqueue_script('fvwpflowplayer-shortcode-editor-old');
400
- } else {
401
- wp_enqueue_script('fvwpflowplayer-shortcode-editor');
402
- }
403
-
404
- wp_register_style('fvwpflowplayer-domwindow-css', flowplayer::get_plugin_url().'/css/colorbox.css','','1.0','screen');
405
- wp_enqueue_style('fvwpflowplayer-domwindow-css');
406
- }
407
408
- /*
409
- Trick media uploader to show video only, while making sure we use our custom type; Also save options
410
- */
411
- function fv_wp_flowplayer_admin_init() {
412
- if( isset($_GET['type']) ) {
413
- if( $_GET['type'] == 'fvplayer_video' || $_GET['type'] == 'fvplayer_video_1' || $_GET['type'] == 'fvplayer_video_2' || $_GET['type'] == 'fvplayer_mobile' ) {
414
- $_GET['post_mime_type'] = 'video';
415
- }
416
- else if( $_GET['type'] == 'fvplayer_splash' || $_GET['type'] == 'fvplayer_logo' ) {
417
- $_GET['post_mime_type'] = 'image';
418
- }
419
- }
420
-
421
- if( isset($_POST['fv-wp-flowplayer-submit']) ) {
422
- check_admin_referer('fv_flowplayer_settings_nonce','fv_flowplayer_settings_nonce');
423
-
424
- global $fv_fp;
425
- if( method_exists($fv_fp,'_set_conf') ) {
426
- $fv_fp->_set_conf();
427
- } else {
428
- echo 'Error saving FV Flowplayer options.';
429
- }
430
- }
431
-
432
- if( isset($_GET['fv-licensing']) && $_GET['fv-licensing'] == "check" ){
433
- delete_option("fv_wordpress_flowplayer_persistent_notices");
434
-
435
- //license will expire in 5 seconds in the function:
436
- fv_wp_flowplayer_admin_key_update();
437
- }
438
439
- global $fv_fp;
440
- global $fv_wp_flowplayer_ver, $fv_wp_flowplayer_core_ver;
441
- if(
442
- preg_match( '!^\$\d+!', $fv_fp->conf['key'] ) &&
443
- (
444
- ( isset($fv_fp->conf['key_automatic']) && $fv_fp->conf['key_automatic'] == 'true' ) ||
445
- ( isset($fv_fp->conf['video_checker_agreement']) && $fv_fp->conf['video_checker_agreement'] == 'true' )
446
- )
447
- ) {
448
-
449
- $version = get_option( 'fvwpflowplayer_core_ver' );
450
- if( version_compare( $fv_wp_flowplayer_core_ver, $version ) == 1 ) {
451
- fv_wp_flowplayer_admin_key_update();
452
- fv_wp_flowplayer_delete_extensions_transients();
453
- }
454
- }
455
-
456
- if(
457
- isset($fv_fp->conf['disable_videochecker']) && $fv_fp->conf['disable_videochecker'] == 'false' &&
458
- ( !isset($fv_fp->conf['video_checker_agreement']) || $fv_fp->conf['video_checker_agreement'] != 'true' ) &&
459
- ( !isset($fv_fp->conf['key_automatic']) || $fv_fp->conf['key_automatic'] != 'true' )
460
- ) {
461
- $fv_fp->pointer_boxes['fv_flowplayer_video_checker_service'] = array(
462
- 'id' => '#wp-admin-bar-new-content',
463
- 'pointerClass' => 'fv_flowplayer_video_checker_service',
464
- 'heading' => __('FV Player Video Checker', 'fv-wordpress-flowplayer'),
465
- 'content' => __("<p>FV Player includes a free video checker which will check your videos for any encoding errors and helps ensure smooth playback of all your videos. To work its magic, our video checker must contact our server.</p><p>Would you like to enable the video encoding checker?</p>", 'fv-wordpress-flowplayer'),
466
- 'position' => array( 'edge' => 'top', 'align' => 'center' ),
467
- 'button1' => __('Allow', 'fv-wordpress-flowplayer'),
468
- 'button2' => __('Disable the video checker', 'fv-wordpress-flowplayer')
469
- );
470
- } else {
471
- if(
472
- preg_match( '!^\$\d+!', $fv_fp->conf['key'] ) && version_compare( $fv_wp_flowplayer_core_ver, get_option('fvwpflowplayer_core_ver') ) !== 0 &&
473
- ( !isset($fv_fp->conf['key_automatic']) || $fv_fp->conf['key_automatic'] != 'true' ) &&
474
- ( !isset($fv_fp->conf['video_checker_agreement']) || $fv_fp->conf['video_checker_agreement'] != 'true' )
475
- ) {
476
- $fv_fp->pointer_boxes['fv_flowplayer_key_automatic'] = array(
477
- 'id' => '#wp-admin-bar-new-content',
478
- 'pointerClass' => 'fv_flowplayer_key_automatic',
479
- 'pointerWidth' => 340,
480
- 'heading' => __('FV Flowplayer License Update', 'fv-wordpress-flowplayer'),
481
- 'content' => __('New version of FV Flowplayer core has been installed for your licensed website. Please accept the automatic license key updating (connects to Foliovision servers) or update the key manually by loggin into your Foliovision account.', 'fv-wordpress-flowplayer'),
482
- 'position' => array( 'edge' => 'top', 'align' => 'center' ),
483
- 'button1' => __('Always auto-update', 'fv-wordpress-flowplayer'),
484
- 'button2' => __("I'll update it manually", 'fv-wordpress-flowplayer')
485
- );
486
- } else if( version_compare( $fv_wp_flowplayer_core_ver, get_option('fvwpflowplayer_core_ver') ) !== 0 && preg_match( '!^\$\d+!', $fv_fp->conf['key'] ) == 0 ) {
487
- update_option( 'fvwpflowplayer_core_ver', $fv_wp_flowplayer_core_ver );
488
- }
489
- }
490
-
491
- if(
492
- (stripos( $_SERVER['REQUEST_URI'], '/plugins.php') !== false || ( isset($_GET['page']) && $_GET['page'] === 'fvplayer' ) )
493
- && $pnotices = get_option('fv_wordpress_flowplayer_persistent_notices')
494
- ) {
495
- $fv_fp->pointer_boxes['fv_flowplayer_license_expired'] = array(
496
- 'id' => '#wp-admin-bar-new-content',
497
- 'pointerClass' => 'fv_flowplayer_license_expired',
498
- 'pointerWidth' => 340,
499
- 'heading' => __('FV Flowplayer License Expired', 'fv-wordpress-flowplayer'),
500
- 'content' => __( $pnotices ),
501
- 'position' => array( 'edge' => 'top', 'align' => 'center' ),
502
- 'button1' => __('Hide this notice', 'fv-wordpress-flowplayer'),
503
- 'button2' => __('I\'ll check this later', 'fv-wordpress-flowplayer')
504
- );
505
- }
506
-
507
- if( !$fv_fp->_get_option('disable_video_hash_links') && !$fv_fp->_get_option('notification_video_links') ) {
508
- $fv_fp->pointer_boxes['fv_player_notification_video_links'] = array(
509
- 'id' => '#wp-admin-bar-new-content',
510
- 'pointerClass' => 'fv_player_notification_video_links',
511
- 'heading' => __('FV Player Video Links', 'fv-wordpress-flowplayer'),
512
- 'content' => $fv_fp->_get_option('disableembedding') ? __("<p>Now you can enable Video Links to allow people to share exact location in your videos. Clicking that link gives them a link to play that video at the exact time.</p>", 'fv-wordpress-flowplayer') : __("<p>Each video player now contains a link in the top bar. Clicking that link gives your visitors a link to play that video at the exact time where they are watching it.</p>", 'fv-wordpress-flowplayer'),
513
- 'position' => array( 'edge' => 'top', 'align' => 'center' ),
514
- 'button1' => __('Open Settings', 'fv-wordpress-flowplayer'),
515
- 'button2' => __('Dismiss', 'fv-wordpress-flowplayer')
516
- );
517
-
518
- add_action( 'admin_print_footer_scripts', 'fv_player_pointer_scripts' );
519
- }
520
-
521
- $aOptions = get_option( 'fvwpflowplayer' );
522
- if( !isset($aOptions['version']) || version_compare( $fv_wp_flowplayer_ver, $aOptions['version'] ) ) {
523
- //update_option( 'fv_wordpress_flowplayer_deferred_notices', 'FV Flowplayer upgraded - please click "Check template" and "Check videos" for automated check of your site at <a href="'.site_url().'/wp-admin/options-general.php?page=fvplayer">the settings page</a> for automated checks!' );
524
-
525
- if( $aOptions['version'] == '6.0.5.20' && $aOptions['playlist_advance'] == 'true' ) { // version 6.0.5 used reverse login for this option!
526
- $aOptions['playlist_advance'] = false;
527
- $fv_fp->conf = $aOptions;
528
- }
529
-
530
- $aOptions['version'] = $fv_wp_flowplayer_ver;
531
- update_option( 'fvwpflowplayer', $aOptions );
532
-
533
- fv_wp_flowplayer_pro_settings_update_for_lightbox();
534
- $fv_fp->css_writeout();
535
-
536
- fv_wp_flowplayer_delete_extensions_transients();
537
- delete_option('fv_flowplayer_extension_install');
538
- }
539
-
540
- if( isset($_GET['page']) && $_GET['page'] == 'fvplayer' ) {
541
- wp_enqueue_script('common');
542
- wp_enqueue_script('wp-lists');
543
- wp_enqueue_script('postbox');
544
-
545
- wp_register_script('fv-player-admin', flowplayer::get_plugin_url().'/js/admin.js',array('jquery'), $fv_wp_flowplayer_ver );
546
- wp_enqueue_script('fv-player-admin');
547
- }
548
549
-
550
- if( flowplayer::is_licensed() ) {
551
- if ( false === ( $aCheck = get_transient( 'fv_flowplayer_license' ) ) ) {
552
- $aCheck = fv_wp_flowplayer_license_check( array('action' => 'check') );
553
- if( $aCheck ) {
554
- set_transient( 'fv_flowplayer_license', $aCheck, 60*60*24 );
555
- } else {
556
- set_transient( 'fv_flowplayer_license', json_decode(json_encode( array('error' => 'Error checking license') ), FALSE), 60*60*24 );
557
- }
558
- }
559
-
560
- $aCheck = get_transient( 'fv_flowplayer_license' );
561
- $aInstalled = get_option('fv_flowplayer_extension_install');
562
- if( isset($aCheck->valid) && $aCheck->valid){
563
564
- if( !isset($aInstalled['fv_player_pro']) || ( isset($_REQUEST['nonce_fv_player_pro_install']) && wp_verify_nonce( $_REQUEST['nonce_fv_player_pro_install'], 'fv_player_pro_install') ) ) {
565
- fv_wp_flowplayer_install_extension('fv_player_pro');
566
- }
567
- delete_option('fv_wordpress_flowplayer_persistent_notices');
568
- }
569
-
570
- if( isset($aCheck->expired) && $aCheck->expired && stripos( implode(get_option('active_plugins')), 'fv-player-pro' ) !== false ) {
571
- add_filter( 'site_transient_update_plugins', 'fv_player_remove_update' );
572
- }
573
}
574
}
575
576
-
577
- function fv_wp_flowplayer_admin_key_update() {
578
- global $fv_fp, $fv_wp_flowplayer_core_ver;
579
580
- $data = fv_wp_flowplayer_license_check( array('action' => 'key_update') );
581
- if( isset($data->domain) ) { // todo: test
582
- if( $data->domain && $data->key && stripos( home_url(), $data->domain ) !== false ) {
583
- $fv_fp->conf['key'] = $data->key;
584
- update_option( 'fvwpflowplayer', $fv_fp->conf );
585
- update_option( 'fvwpflowplayer_core_ver', $fv_wp_flowplayer_core_ver );
586
-
587
- fv_wp_flowplayer_change_transient_expiration("fv_flowplayer_license",5);
588
- fv_wp_flowplayer_delete_extensions_transients(5);
589
- return true;
590
- }
591
- } else if( isset($data->expired) && $data->expired && isset($data->message) ){
592
- update_option( 'fv_wordpress_flowplayer_persistent_notices', $data->message );
593
- update_option( 'fvwpflowplayer_core_ver', $fv_wp_flowplayer_core_ver );
594
- return false;
595
- } else {
596
- update_option( 'fv_wordpress_flowplayer_deferred_notices', 'FV Flowplayer License upgrade failed - please check if you are running the plugin on your licensed domain.' );
597
- update_option( 'fvwpflowplayer_core_ver', $fv_wp_flowplayer_core_ver );
598
- return false;
599
}
600
- }
601
-
602
-
603
- function fv_wp_flowplayer_license_check( $aArgs ) {
604
- global $fv_wp_flowplayer_ver, $fv_wp_flowplayer_core_ver;
605
-
606
- $args = array(
607
- 'body' => array( 'plugin' => 'fv-wordpress-flowplayer', 'version' => $fv_wp_flowplayer_ver, 'core_ver' => $fv_wp_flowplayer_core_ver, 'type' => home_url(), 'action' => $aArgs['action'], 'admin-url' => admin_url() ),
608
- 'timeout' => 10,
609
- 'user-agent' => 'fv-wordpress-flowplayer-'.$fv_wp_flowplayer_ver.' ('.$fv_wp_flowplayer_core_ver.')'
610
- );
611
- $resp = wp_remote_post( 'https://foliovision.com/?fv_remote=true', $args );
612
613
- if( !is_wp_error($resp) && isset($resp['body']) && $resp['body'] && $data = json_decode( preg_replace( '~[\s\S]*?<FVFLOWPLAYER>(.*?)</FVFLOWPLAYER>[\s\S]*?~', '$1', $resp['body'] ) ) ) {
614
- return $data;
615
-
616
- } else if( is_wp_error($resp) && stripos($resp->get_error_message(),'SSL' ) !== false ) {
617
- $args = array( 'sslverify' => false );
618
- $resp = wp_remote_post( 'https://foliovision.com/?fv_remote=true', $args );
619
-
620
- if( !is_wp_error($resp) && isset($resp['body']) && $resp['body'] && $data = json_decode( preg_replace( '~[\s\S]*?<FVFLOWPLAYER>(.*?)</FVFLOWPLAYER>[\s\S]*?~', '$1', $resp['body'] ) ) ) {
621
- return $data;
622
- }
623
-
624
- }
625
-
626
- return false;
627
}
628
629
- function fv_wp_flowplayer_pro_settings_update_for_lightbox(){
630
- global $fv_fp;
631
- if(isset($fv_fp->conf['pro']) && isset($fv_fp->conf['pro']['interface']['lightbox']) && $fv_fp->conf['pro']['interface']['lightbox'] == true ){
632
- $fv_fp->conf['interface']['lightbox'] = true;
633
- $fv_fp->conf['pro']['interface']['lightbox'] = false;
634
- $options = get_option('fvwpflowplayer');
635
- unset($options['pro']['interface']['lightbox']);
636
- $options['interface']['lightbox'] = true;
637
- update_option('fvwpflowplayer', $options);
638
- }
639
- if(isset($fv_fp->conf['pro']) && isset($fv_fp->conf['pro']['lightbox_images']) && $fv_fp->conf['pro']['lightbox_images'] == true ){
640
- $fv_fp->conf['lightbox_images'] = true;
641
- $fv_fp->conf['pro']['lightbox_images'] = false;
642
- $options = get_option('fvwpflowplayer');
643
- unset($options['pro']['lightbox_images']);
644
- $options['lightbox_images'] = true;
645
- update_option('fvwpflowplayer', $options);
646
- }
647
-
648
- }
649
650
- function fv_wp_flowplayer_change_transient_expiration( $transient_name, $time ){
651
- $transient_val = get_transient($transient_name);
652
- if( $transient_val ){
653
- set_transient($transient_name,$transient_val,$time);
654
- return true;
655
- }
656
- return false;
657
- }
658
659
660
- function fv_wp_flowplayer_delete_extensions_transients( $delete_delay = false ){
661
- $aTransientsLike = array('fv-player-pro_license','fv-player-vast_license','fv-player-pro_fp-private-updates','fv-player-vast_fp-private-updates');
662
-
663
- global $wpdb;
664
- $aWhere = array();
665
- foreach( $aTransientsLike AS $sKey ) {
666
- $aWhere[] = 'option_name LIKE "%'.$sKey.'%"';
667
}
668
- $sWhere = implode(" OR ", $aWhere);
669
- $aOptions = $wpdb->get_col( "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE '%_transient_fv%' AND ( ".$sWhere." )" );
670
671
- foreach( $aOptions AS $sKey ) {
672
- if( !$delete_delay ){
673
- delete_transient( str_replace('_transient_','',$sKey) );
674
- } else {
675
- fv_wp_flowplayer_change_transient_expiration( str_replace('_transient_','',$sKey), $delete_delay );
676
- }
677
- }
678
679
- $aUpdates = get_site_transient('update_plugins');
680
- set_site_transient('update_plugins', $aUpdates );
681
-
682
}
683
684
685
- function fv_wp_flowplayer_edit_form_after_editor( ) {
686
- global $fv_fp;
687
- if( isset($fv_fp->conf["interface"]['shortcode_editor_old']) && $fv_fp->conf["interface"]['shortcode_editor_old'] == 'true' ) {
688
- include dirname( __FILE__ ) . '/../view/wizard.old.php';
689
- } else {
690
- include dirname( __FILE__ ) . '/../view/wizard.php';
691
- }
692
- }
693
694
695
/*
696
- Custom media uploader type is really just the default one
697
- */
698
- function fv_wp_flowplayer_media_upload() {
699
- wp_media_upload_handler();
700
- }
701
702
703
- function fv_wp_flowplayer_after_plugin_row( $arg) {
704
- if( apply_filters('fv_player_skip_ads',false) ) {
705
- return;
706
}
707
708
- $args = func_get_args();
709
-
710
- if( $args[1]['Name'] == 'FV Wordpress Flowplayer' ) {
711
- $options = get_option( 'fvwpflowplayer' );
712
- if( $options['key'] == 'false' || $options['key'] == '' ) :
713
- ?>
714
- <tr class="plugin-update-tr fv-wordpress-flowplayer-tr">
715
- <td class="plugin-update colspanchange" colspan="3">
716
- <div class="update-message">
717
- <a href="http://foliovision.com/wordpress/plugins/fv-wordpress-flowplayer/download">All Licenses 20% Off</a> - Easter sale!
718
- </div>
719
- </td>
720
- </tr>
721
- <?php
722
- endif;
723
- }
724
}
725
-
726
727
// enter script URL, return false if it's not version 5
728
function fv_wp_flowplayer_check_script_version( $url ) {
@@ -740,7 +201,6 @@ function fv_wp_flowplayer_check_script_version( $url ) {
740
return 0;
741
}
742
743
-
744
function fv_wp_flowplayer_check_jquery_version( $url, &$array, $key ) {
745
$url_mod = preg_replace( '!\?.+!', '', $url );
746
if( preg_match( '!(\d+.[\d\.]+)!', $url_mod, $version ) && $version[1] ) {
@@ -766,6 +226,13 @@ function fv_wp_flowplayer_check_jquery_version( $url, &$array, $key ) {
766
}
767
768
769
function fv_wp_flowplayer_check_files() {
770
if( stripos( $_SERVER['HTTP_REFERER'], home_url() ) === 0 ) {
771
global $wpdb;
@@ -868,260 +335,309 @@ function fv_wp_flowplayer_check_files() {
868
}
869
870
871
- function fv_wp_flowplayer_check_template() {
872
- $ok = array();
873
- $errors = array();
874
-
875
- if( stripos( $_SERVER['HTTP_REFERER'], home_url() ) === 0 ) {
876
- $response = wp_remote_get( home_url().'?fv_wp_flowplayer_check_template=yes' );
877
- if( is_wp_error( $response ) ) {
878
- $error_message = $response->get_error_message();
879
- $output = array( 'error' => $error_message );
880
- } else {
881
-
882
- $active_plugins = get_option( 'active_plugins' );
883
- foreach( $active_plugins AS $plugin ) {
884
- if( stripos( $plugin, 'wp-minify' ) !== false ) {
885
- $errors[] = "You are using <strong>WP Minify</strong>, so the script checks would not be accurate. Please check your videos manually.";
886
- $output = array( 'errors' => $errors, 'ok' => $ok/*, 'html' => $response['body'] */);
887
- echo '<FVFLOWPLAYER>'.json_encode($output).'</FVFLOWPLAYER>';
888
- die();
889
- }
890
- }
891
-
892
- if( function_exists( 'w3_instance' ) && $minify = w3_instance('W3_Plugin_Minify') ) {
893
- if( $minify->_config->get_boolean('minify.js.enable') ) {
894
- $errors[] = "You are using <strong>W3 Total Cache</strong> with JS Minify enabled. The template check might not be accurate. Please check your videos manually.";
895
- $output = array( 'errors' => $errors, 'ok' => $ok/*, 'html' => $response['body'] */);
896
- echo '<FVFLOWPLAYER>'.json_encode($output).'</FVFLOWPLAYER>';
897
- }
898
- }
899
-
900
- if( stripos( $response['body'], '/html5.js') === FALSE && stripos( $response['body'], '/html5shiv.js') === FALSE ) {
901
- $errors[] = 'html5.js not found in your template! Videos might not play in old browsers, like Internet Explorer 6-8. Read our instrutions <a href="https://foliovision.com/player/installation#html5js">here</a>.';
902
- }
903
-
904
- $ok[] = __('Template checker has changed. Just open any of your videos on your site and see if you get a red warning message about JavaScript not working.', 'fv-wordpress-flowplayer');
905
-
906
- $response['body'] = preg_replace( 'lt;!--[\s\S]+?-->#x27;, '', $response['body'] ); // handle HTML comments
907
-
908
- // check Flowplayer scripts
909
- preg_match_all( '!<script[^>]*?src=[\'"]([^\'"]*?flowplayer[0-9.-]*?(?:\.min)?\.js[^\'"]*?)[\'"][^>]*?>\s*?</script>!', $response['body'], $flowplayer_scripts );
910
- if( count($flowplayer_scripts[1]) > 0 ) {
911
- if( count($flowplayer_scripts[1]) > 1 ) {
912
- $errors[] = "It appears there are <strong>multiple</strong> Flowplayer scripts on your site, your videos might not be playing, please check. There might be some other plugin adding the script.";
913
- }
914
- foreach( $flowplayer_scripts[1] AS $flowplayer_script ) {
915
- $check = fv_wp_flowplayer_check_script_version( $flowplayer_script );
916
- if( $check == - 1 ) {
917
- $errors[] = "Flowplayer script <code>$flowplayer_script</code> is old version and won't play. You need to get rid of this script.";
918
- } else if( $check == 1 ) {
919
- $ok[] = __('FV Flowplayer script found: ', 'fv-wordpress-flowplayer') . "<code>$flowplayer_script</code>!";
920
- $fv_flowplayer_pos = strpos( $response['body'], $flowplayer_script );
921
- }
922
- }
923
- } else if( count($flowplayer_scripts[1]) < 1 ) {
924
- $errors[] = "It appears there are <strong>no</strong> Flowplayer scripts on your site, your videos might not be playing, please check. Check your template's header.php file if it contains wp_head() function call and footer.php should contain wp_footer()!";
925
- }
926
-
927
928
- // check jQuery scripts
929
- preg_match_all( '!<script[^>]*?src=[\'"]([^\'"]*?/jquery[0-9.-]*?(?:\.min)?\.js[^\'"]*?)[\'"][^>]*?>\s*?</script>!', $response['body'], $jquery_scripts );
930
- if( count($jquery_scripts[1]) > 0 ) {
931
- foreach( $jquery_scripts[1] AS $jkey => $jquery_script ) {
932
- $ok[] = __('jQuery library found: ', 'fv-wordpress-flowplayer') . "<code>$jquery_script</code>!";
933
- $jquery_pos = strpos( $response['body'], $jquery_script );
934
- }
935
-
936
- if( count($jquery_scripts[1]) > 1 ) {
937
- $errors[] = "It appears there are <strong>multiple</strong> jQuery libraries on your site, your videos might not be playing or may play with defects, please check.\n";
938
- }
939
- } else if( count($jquery_scripts[1]) < 1 ) {
940
- $errors[] = "It appears there are <strong>no</strong> jQuery library on your site, your videos might not be playing, please check.\n";
941
- }
942
-
943
-
944
- if( $fv_flowplayer_pos > 0 && $jquery_pos > 0 && $jquery_pos > $fv_flowplayer_pos && count($jquery_scripts[1]) < 1 ) {
945
- $errors[] = "It appears your Flowplayer JavaScript library is loading before jQuery. Your videos probably won't work. Please make sure your jQuery library is loading using the standard Wordpress function - wp_enqueue_scripts(), or move it above wp_head() in your header.php template.";
946
- }
947
-
948
- $output = array( 'errors' => $errors, 'ok' => $ok/*, 'html' => $response['body'] */);
949
- }
950
- echo '<FVFLOWPLAYER>'.json_encode($output).'</FVFLOWPLAYER>';
951
die();
952
}
953
-
954
- die('-1');
955
}
956
957
958
- function fv_wp_flowplayer_check_license() {
959
- if( stripos( $_SERVER['HTTP_REFERER'], home_url() ) === 0 ) {
960
- if( fv_wp_flowplayer_admin_key_update() ) {
961
- $output = array( 'errors' => false, 'ok' => array(__('License key acquired successfully. <a href="">Reload</a>', 'fv-wordpress-flowplayer')) );
962
- fv_wp_flowplayer_install_extension();
963
- } else {
964
- $message = get_option('fv_wordpress_flowplayer_deferred_notices');
965
- if( !$message ) $message = get_option('fv_wordpress_flowplayer_persistent_notices');
966
- $output = array( 'errors' => array($message), 'ok' => false );
967
}
968
- echo '<FVFLOWPLAYER>'.json_encode($output).'</FVFLOWPLAYER>';
969
- die();
970
}
971
- die('-1');
972
}
973
974
-
975
- function fv_wp_flowplayer_array_search_by_item( $find, $in_array, &$found, $like = false ) {
976
- global $fv_wp_flowplayer_array_search_by_item_depth;
977
-
978
- $fv_wp_flowplayer_array_search_by_item_depth++;
979
- if( $fv_wp_flowplayer_array_search_by_item_depth > 100 ) {
980
- return false;
981
- }
982
-
983
- if( is_array( $in_array ) )
984
- {
985
- foreach( $in_array as $key=> $val )
986
- {
987
- if( is_array( $val ) ) {
988
- fv_wp_flowplayer_array_search_by_item( $find, $val, $found );
989
- } else {
990
- if( !$like && strcasecmp($find, $val) === 0 ) {
991
- $found[] = $in_array;
992
- } else if( $like && stripos($val, $find) !== false ) {
993
- $found[] = $in_array;
994
- }
995
- }
996
- }
997
- return false;
998
- }
999
return false;
1000
- }
1001
-
1002
-
1003
- function fv_wp_flowplayer_support_mail() {
1004
- if( isset( $_POST['notice'] ) && stripos( $_SERVER['HTTP_REFERER'], home_url() ) === 0 ) {
1005
1006
- $current_user = wp_get_current_user();
1007
1008
- $content = '<p>User: '.$current_user->display_name." (".$current_user->user_email.")</p>\n";
1009
- $content .= '<p>User Agent: '.$_SERVER['HTTP_USER_AGENT']."</p>\n";
1010
- $content .= '<p>Referer: '.$_SERVER['HTTP_REFERER']."</p>\n";
1011
- $content .= "<p>Comment:</p>\n".wpautop( stripslashes($_POST['comment']) );
1012
- $notice = str_replace( '<span class="value"', ': <span class="value"', stripslashes($_POST['notice']) );
1013
- $notice .= str_replace( '<span class="value"', ': <span class="value"', stripslashes($_POST['details']) );
1014
-
1015
- $content .= "<p>Video analysis:</p>\n".$notice;
1016
-
1017
- global $fv_wp_flowplayer_support_mail_from, $fv_wp_flowplayer_support_mail_from_name;
1018
1019
- //$headers = "Reply-To: \"$current_user->display_name\" <$current_user->user_email>\r\n";
1020
- $fv_wp_flowplayer_support_mail_from_name = $current_user->display_name;
1021
- $fv_wp_flowplayer_support_mail_from = $current_user->user_email;
1022
-
1023
- add_filter( 'wp_mail_content_type', create_function('', "return 'text/html';") );
1024
-
1025
- //add_action('phpmailer_init', 'fv_wp_flowplayer_support_mail_phpmailer_init' );
1026
- wp_mail( 'fvplayer@foliovision.com', 'FV Flowplayer Quick Support Submission', $content );
1027
-
1028
- die('1');
1029
}
1030
}
1031
1032
-
1033
- function fv_wp_flowplayer_support_mail_phpmailer_init( $phpmailer ) {
1034
- global $fv_wp_flowplayer_support_mail_from, $fv_wp_flowplayer_support_mail_from_name;
1035
-
1036
- if( $fv_wp_flowplayer_support_mail_from_name ) {
1037
- $phpmailer->FromName = trim( $fv_filled_in_phpmailer_init_from_name );
1038
- }
1039
- if( $fv_wp_flowplayer_support_mail_from ) {
1040
- if( strcmp( trim($phpmailer->From), trim($fv_wp_flowplayer_support_mail_from) ) != 0 && !trim($phpmailer->Sender) ) {
1041
- $phpmailer->Sender = trim($phpmailer->From);
1042
- }
1043
- $phpmailer->From = trim( $fv_wp_flowplayer_support_mail_from );
1044
- }
1045
-
1046
}
1047
1048
1049
- function fv_wp_flowplayer_closed_meta_boxes( $closed ) {
1050
- if ( false === $closed )
1051
- $closed = array( 'fv_flowplayer_amazon_options', 'fv_flowplayer_interface_options', 'fv_flowplayer_default_options', 'fv_flowplayer_ads', 'fv_flowplayer_integrations', 'fv_player_pro' );
1052
1053
- return $closed;
1054
- }
1055
1056
1057
- function fv_wp_flowplayer_pointers_ajax() {
1058
- if( isset($_POST['key']) && $_POST['key'] == 'fv_flowplayer_key_automatic' && isset($_POST['value']) ) {
1059
- check_ajax_referer('fv_flowplayer_key_automatic');
1060
- $conf = get_option( 'fvwpflowplayer' );
1061
- if( $conf ) {
1062
- $conf['key_automatic'] = ( $_POST['value'] == 'true' ) ? 'true' : 'false';
1063
- if( $conf['key_automatic'] == 'true' ) {
1064
- fv_wp_flowplayer_admin_key_update();
1065
- $conf = get_option( 'fvwpflowplayer' );
1066
- } else {
1067
- global $fv_wp_flowplayer_core_ver;
1068
- update_option( 'fvwpflowplayer_core_ver', $fv_wp_flowplayer_core_ver );
1069
- }
1070
- update_option( 'fvwpflowplayer', $conf );
1071
- }
1072
- die();
1073
- }
1074
1075
- if( isset($_POST['key']) && $_POST['key'] == 'fv_flowplayer_video_checker_service' && isset($_POST['value']) ) {
1076
- check_ajax_referer('fv_flowplayer_video_checker_service');
1077
- $conf = get_option( 'fvwpflowplayer' );
1078
- if( $conf ) {
1079
- if( $_POST['value'] == 'true' ) {
1080
- $conf['disable_videochecker'] = 'false';
1081
- $conf['video_checker_agreement'] = 'true';
1082
- } else {
1083
- $conf['disable_videochecker'] = 'true';
1084
- }
1085
- update_option( 'fvwpflowplayer', $conf );
1086
- }
1087
- die();
1088
- }
1089
1090
- if( isset($_POST['key']) && $_POST['key'] == 'fv_player_notification_video_links' && isset($_POST['value']) ) {
1091
- check_ajax_referer('fv_player_notification_video_links');
1092
- $conf = get_option( 'fvwpflowplayer' );
1093
- if( $conf ) {
1094
- $conf['notification_video_links'] = 'true';
1095
- update_option( 'fvwpflowplayer', $conf );
1096
- }
1097
- die();
1098
- }
1099
-
1100
- if( isset($_POST['key']) && $_POST['key'] == 'fv_flowplayer_license_expired' && isset($_POST['value']) && $_POST['value'] === 'true' ) {
1101
- check_ajax_referer('fv_flowplayer_license_expired');
1102
- delete_option("fv_wordpress_flowplayer_persistent_notices");
1103
- die();
1104
}
1105
-
1106
}
1107
1108
1109
- // allow .vtt subtitle files
1110
- add_filter( 'wp_check_filetype_and_ext', 'fv_flowplayer_filetypes', 10, 4 );
1111
1112
- function fv_flowplayer_filetypes( $aFile ) {
1113
- $aArgs = func_get_args();
1114
- foreach( array( 'vtt', 'webm', 'ogg') AS $item ) {
1115
- if( isset($aArgs[2]) && preg_match( '~\.'.$item.'~', $aArgs[2] ) ) {
1116
- $aFile['type'] = $item;
1117
- $aFile['ext'] = $item;
1118
- $aFile['proper_filename'] = $aArgs[2];
1119
- }
1120
}
1121
- return $aFile;
1122
}
1123
1124
1125
/*
1126
* Check the extension info from plugin license transient and activate the plugin
1127
*/
@@ -1137,6 +653,10 @@ function fv_wp_flowplayer_install_extension( $plugin_package = 'fv_player_pro' )
1137
$download_url = $aPluginInfo->{$plugin_package}->url;
1138
1139
$sPluginBasenameReal = fv_flowplayer_get_extension_path( str_replace( '_', '-', $plugin_package ) );
1140
$plugin_basename = $sPluginBasenameReal ? $sPluginBasenameReal : $plugin_basename;
1141
1142
$url = wp_nonce_url( site_url().'/wp-admin/options-general.php?page=fvplayer', 'fv_player_pro_install', 'nonce_fv_player_pro_install' );
@@ -1238,40 +758,7 @@ function fv_wp_flowplayer_install_extension_talk( $content ) {
1238
}
1239
1240
1241
- function fv_wp_flowplayer_activate_extension() {
1242
- check_ajax_referer( 'fv_wp_flowplayer_activate_extension', 'nonce' );
1243
- if( !isset( $_POST['plugin'] ) ) {
1244
- die();
1245
- }
1246
-
1247
- $activate = activate_plugin( $_POST['plugin'] );
1248
- if ( is_wp_error( $activate ) ) {
1249
- echo "<FVFLOWPLAYER>".json_encode( array( 'message' => $activate->get_error_message(), 'error' => $activate->get_error_message() ) )."</FVFLOWPLAYER>";
1250
- die();
1251
- }
1252
-
1253
- echo "<FVFLOWPLAYER>".json_encode( array( 'message' => 'Success!', 'plugin' => $_POST['plugin'] ) )."</FVFLOWPLAYER>";
1254
- die();
1255
- }
1256
-
1257
- add_filter('plugin_action_links', 'fv_wp_flowplayer_plugin_action_links', 10, 2);
1258
-
1259
- function fv_wp_flowplayer_plugin_action_links($links, $file) {
1260
- if( $file == 'fv-wordpress-flowplayer/flowplayer.php') {
1261
- $settings_link = '<a href="https://foliovision.com/pro-support" target="_blank">Premium Support</a>';
1262
- array_unshift($links, $settings_link);
1263
- $settings_link = '<a href="options-general.php?page=fvplayer">Settings</a>';
1264
- array_unshift($links, $settings_link);
1265
- }
1266
- return $links;
1267
- }
1268
1269
-
1270
- function fv_flowplayer_admin_scripts() {
1271
- if (isset($_GET['page']) && $_GET['page'] == 'fvplayer') {
1272
- wp_enqueue_media();
1273
- }
1274
- }
1275
1276
//search for plugin path with {slug}.php
1277
function fv_flowplayer_get_extension_path( $slug ){
@@ -1288,8 +775,9 @@ function fv_flowplayer_get_extension_path( $slug ){
1288
return $item;
1289
}
1290
1291
foreach( $aInactivePlugins as $item ){
1292
- if( stripos($item,$slug.'.php') !== false )
1293
return $item;
1294
}
1295
@@ -1322,31 +810,30 @@ add_action( 'deleted_transient_fv_flowplayer_license', 'fv_player_disable_object
1322
1323
1324
1325
- function fv_player_remove_update( $objUpdates ) {
1326
- if( !$objUpdates || !isset($objUpdates->response) || count($objUpdates->response) == 0 ) return $objUpdates;
1327
-
1328
- foreach( $objUpdates->response AS $key => $objUpdate ) {
1329
- if( stripos($key,'fv-wordpress-flowplayer') === 0 ) {
1330
- unset($objUpdates->response[$key]);
1331
- }
1332
}
1333
-
1334
- return $objUpdates;
1335
}
1336
1337
1338
1339
1340
- function fv_player_pointer_scripts() {
1341
- ?>
1342
- <script>
1343
- (function ($) {
1344
- $(document).on('click', '.fv_player_notification_video_links .button-primary', function(e) {
1345
- $(document).ajaxComplete( function() {
1346
- window.location = '<?php echo site_url('wp-admin/options-general.php?page=fvplayer'); ?>#playlist_advance';
1347
- });
1348
- });
1349
- })(jQuery);
1350
- </script>
1351
- <?php
1352
}
15
16
You should have received a copy of the GNU General Public License
17
along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+ */
19
20
21
+ /*
22
+ * Video Checker support email
23
*/
24
+ add_action('wp_ajax_fv_wp_flowplayer_support_mail', 'fv_wp_flowplayer_support_mail');
25
26
+ function fv_wp_flowplayer_support_mail() {
27
+ if( isset( $_POST['notice'] ) && stripos( $_SERVER['HTTP_REFERER'], home_url() ) === 0 ) {
28
29
+ $current_user = wp_get_current_user();
30
31
+ $content = '<p>User: '.$current_user->display_name." (".$current_user->user_email.")</p>\n";
32
+ $content .= '<p>User Agent: '.$_SERVER['HTTP_USER_AGENT']."</p>\n";
33
+ $content .= '<p>Referer: '.$_SERVER['HTTP_REFERER']."</p>\n";
34
+ $content .= "<p>Comment:</p>\n".wpautop( stripslashes($_POST['comment']) );
35
+ $notice = str_replace( '<span class="value"', ': <span class="value"', stripslashes($_POST['notice']) );
36
+ $notice .= str_replace( '<span class="value"', ': <span class="value"', stripslashes($_POST['details']) );
37
+
38
+ $content .= "<p>Video analysis:</p>\n".$notice;
39
40
+ global $fv_wp_flowplayer_support_mail_from, $fv_wp_flowplayer_support_mail_from_name;
41
42
+ //$headers = "Reply-To: \"$current_user->display_name\" <$current_user->user_email>\r\n";
43
+ $fv_wp_flowplayer_support_mail_from_name = $current_user->display_name;
44
+ $fv_wp_flowplayer_support_mail_from = $current_user->user_email;
45
+
46
+ add_filter( 'wp_mail_content_type', create_function('', "return 'text/html';") );
47
+
48
+ //add_action('phpmailer_init', 'fv_wp_flowplayer_support_mail_phpmailer_init' );
49
+ wp_mail( 'fvplayer@foliovision.com', 'FV Flowplayer Quick Support Submission', $content );
50
+
51
+ die('1');
52
}
53
}
54
55
+ function fv_wp_flowplayer_support_mail_phpmailer_init( $phpmailer ) {
56
+ global $fv_wp_flowplayer_support_mail_from, $fv_wp_flowplayer_support_mail_from_name;
57
58
+ if( $fv_wp_flowplayer_support_mail_from_name ) {
59
+ $phpmailer->FromName = trim( $fv_filled_in_phpmailer_init_from_name );
60
}
61
+ if( $fv_wp_flowplayer_support_mail_from ) {
62
+ if( strcmp( trim($phpmailer->From), trim($fv_wp_flowplayer_support_mail_from) ) != 0 && !trim($phpmailer->Sender) ) {
63
+ $phpmailer->Sender = trim($phpmailer->From);
64
+ }
65
+ $phpmailer->From = trim( $fv_wp_flowplayer_support_mail_from );
66
+ }
67
68
}
69
70
71
72
73
+ /*
74
+ * Activating Extensions
75
+ */
76
+ add_action('wp_ajax_fv_wp_flowplayer_activate_extension', 'fv_wp_flowplayer_activate_extension');
77
+
78
+ function fv_wp_flowplayer_activate_extension() {
79
+ check_ajax_referer( 'fv_wp_flowplayer_activate_extension', 'nonce' );
80
+ if( !isset( $_POST['plugin'] ) ) {
81
+ die();
82
}
83
84
+ $activate = activate_plugin( $_POST['plugin'] );
85
+ if ( is_wp_error( $activate ) ) {
86
+ echo "<FVFLOWPLAYER>".json_encode( array( 'message' => $activate->get_error_message(), 'error' => $activate->get_error_message() ) )."</FVFLOWPLAYER>";
87
+ die();
88
+ }
89
90
+ echo "<FVFLOWPLAYER>".json_encode( array( 'message' => 'Success!', 'plugin' => $_POST['plugin'] ) )."</FVFLOWPLAYER>";
91
+ die();
92
}
93
94
95
96
97
/*
98
+ * Template Check
99
+ */
100
+ add_action('wp_ajax_fv_wp_flowplayer_check_template', 'fv_wp_flowplayer_check_template');
101
102
+ function fv_wp_flowplayer_check_template() {
103
+ $ok = array();
104
+ $errors = array();
105
+
106
+ if( stripos( $_SERVER['HTTP_REFERER'], home_url() ) === 0 ) {
107
+ $response = wp_remote_get( home_url().'?fv_wp_flowplayer_check_template=yes' );
108
+ if( is_wp_error( $response ) ) {
109
+ $error_message = $response->get_error_message();
110
+ $output = array( 'error' => $error_message );
111
+ } else {
112
+
113
+ $active_plugins = get_option( 'active_plugins' );
114
+ foreach( $active_plugins AS $plugin ) {
115
+ if( stripos( $plugin, 'wp-minify' ) !== false ) {
116
+ $errors[] = "You are using <strong>WP Minify</strong>, so the script checks would not be accurate. Please check your videos manually.";
117
+ $output = array( 'errors' => $errors, 'ok' => $ok/*, 'html' => $response['body'] */);
118
+ echo '<FVFLOWPLAYER>'.json_encode($output).'</FVFLOWPLAYER>';
119
+ die();
120
+ }
121
+ }
122
+
123
+ if( function_exists( 'w3_instance' ) && $minify = w3_instance('W3_Plugin_Minify') ) {
124
+ if( $minify->_config->get_boolean('minify.js.enable') ) {
125
+ $errors[] = "You are using <strong>W3 Total Cache</strong> with JS Minify enabled. The template check might not be accurate. Please check your videos manually.";
126
+ $output = array( 'errors' => $errors, 'ok' => $ok/*, 'html' => $response['body'] */);
127
+ echo '<FVFLOWPLAYER>'.json_encode($output).'</FVFLOWPLAYER>';
128
+ }
129
+ }
130
+
131
+ if( stripos( $response['body'], '/html5.js') === FALSE && stripos( $response['body'], '/html5shiv.js') === FALSE ) {
132
+ $errors[] = 'html5.js not found in your template! Videos might not play in old browsers, like Internet Explorer 6-8. Read our instrutions <a href="https://foliovision.com/player/installation#html5js">here</a>.';
133
+ }
134
+
135
+ $ok[] = __('Template checker has changed. Just open any of your videos on your site and see if you get a red warning message about JavaScript not working.', 'fv-wordpress-flowplayer');
136
+
137
+ $response['body'] = preg_replace( 'lt;!--[\s\S]+?-->#x27;, '', $response['body'] ); // handle HTML comments
138
+
139
+ // check Flowplayer scripts
140
+ preg_match_all( '!<script[^>]*?src=[\'"]([^\'"]*?flowplayer[0-9.-]*?(?:\.min)?\.js[^\'"]*?)[\'"][^>]*?>\s*?</script>!', $response['body'], $flowplayer_scripts );
141
+ if( count($flowplayer_scripts[1]) > 0 ) {
142
+ if( count($flowplayer_scripts[1]) > 1 ) {
143
+ $errors[] = "It appears there are <strong>multiple</strong> Flowplayer scripts on your site, your videos might not be playing, please check. There might be some other plugin adding the script.";
144
+ }
145
+ foreach( $flowplayer_scripts[1] AS $flowplayer_script ) {
146
+ $check = fv_wp_flowplayer_check_script_version( $flowplayer_script );
147
+ if( $check == - 1 ) {
148
+ $errors[] = "Flowplayer script <code>$flowplayer_script</code> is old version and won't play. You need to get rid of this script.";
149
+ } else if( $check == 1 ) {
150
+ $ok[] = __('FV Flowplayer script found: ', 'fv-wordpress-flowplayer') . "<code>$flowplayer_script</code>!";
151
+ $fv_flowplayer_pos = strpos( $response['body'], $flowplayer_script );
152
+ }
153
+ }
154
+ } else if( count($flowplayer_scripts[1]) < 1 ) {
155
+ $errors[] = "It appears there are <strong>no</strong> Flowplayer scripts on your site, your videos might not be playing, please check. Check your template's header.php file if it contains wp_head() function call and footer.php should contain wp_footer()!";
156
+ }
157
+
158
159
+ // check jQuery scripts
160
+ preg_match_all( '!<script[^>]*?src=[\'"]([^\'"]*?/jquery[0-9.-]*?(?:\.min)?\.js[^\'"]*?)[\'"][^>]*?>\s*?</script>!', $response['body'], $jquery_scripts );
161
+ if( count($jquery_scripts[1]) > 0 ) {
162
+ foreach( $jquery_scripts[1] AS $jkey => $jquery_script ) {
163
+ $ok[] = __('jQuery library found: ', 'fv-wordpress-flowplayer') . "<code>$jquery_script</code>!";
164
+ $jquery_pos = strpos( $response['body'], $jquery_script );
165
+ }
166
+
167
+ if( count($jquery_scripts[1]) > 1 ) {
168
+ $errors[] = "It appears there are <strong>multiple</strong> jQuery libraries on your site, your videos might not be playing or may play with defects, please check.\n";
169
+ }
170
+ } else if( count($jquery_scripts[1]) < 1 ) {
171
+ $errors[] = "It appears there are <strong>no</strong> jQuery library on your site, your videos might not be playing, please check.\n";
172
+ }
173
+
174
+
175
+ if( $fv_flowplayer_pos > 0 && $jquery_pos > 0 && $jquery_pos > $fv_flowplayer_pos && count($jquery_scripts[1]) < 1 ) {
176
+ $errors[] = "It appears your Flowplayer JavaScript library is loading before jQuery. Your videos probably won't work. Please make sure your jQuery library is loading using the standard Wordpress function - wp_enqueue_scripts(), or move it above wp_head() in your header.php template.";
177
+ }
178
+
179
+ $output = array( 'errors' => $errors, 'ok' => $ok/*, 'html' => $response['body'] */);
180
+ }
181
+ echo '<FVFLOWPLAYER>'.json_encode($output).'</FVFLOWPLAYER>';
182
+ die();
183
}
184
185
+ die('-1');
186
}
187
188
// enter script URL, return false if it's not version 5
189
function fv_wp_flowplayer_check_script_version( $url ) {
201
return 0;
202
}
203
204
function fv_wp_flowplayer_check_jquery_version( $url, &$array, $key ) {
205
$url_mod = preg_replace( '!\?.+!', '', $url );
206
if( preg_match( '!(\d+.[\d\.]+)!', $url_mod, $version ) && $version[1] ) {
226
}
227
228
229
+
230
+
231
+ /*
232
+ * Check video files
233
+ */
234
+ add_action('wp_ajax_fv_wp_flowplayer_check_files', 'fv_wp_flowplayer_check_files');
235
+
236
function fv_wp_flowplayer_check_files() {
237
if( stripos( $_SERVER['HTTP_REFERER'], home_url() ) === 0 ) {
238
global $wpdb;
335
}
336
337
338
339
+
340
+ /*
341
+ * Apply Pro Upgrade button
342
+ */
343
+ add_action('wp_ajax_fv_wp_flowplayer_check_license', 'fv_wp_flowplayer_check_license');
344
+
345
+ function fv_wp_flowplayer_check_license() {
346
+ if( stripos( $_SERVER['HTTP_REFERER'], home_url() ) === 0 ) {
347
+ if( fv_wp_flowplayer_admin_key_update() ) {
348
+ $output = array( 'errors' => false, 'ok' => array(__('License key acquired successfully. <a href="">Reload</a>', 'fv-wordpress-flowplayer')) );
349
+ fv_wp_flowplayer_install_extension();
350
+ } else {
351
+ $message = get_option('fv_wordpress_flowplayer_deferred_notices');
352
+ if( !$message ) $message = get_option('fv_wordpress_flowplayer_persistent_notices');
353
+ $output = array( 'errors' => array($message), 'ok' => false );
354
+ }
355
+ echo '<FVFLOWPLAYER>'.json_encode($output).'</FVFLOWPLAYER>';
356
die();
357
}
358
+ die('-1');
359
+ }
360
+
361
+
362
+
363
+ /*
364
+ * Run this when new version is installed
365
+ */
366
+ add_action('admin_init', 'fv_player_admin_update');
367
+
368
+ function fv_player_admin_update() {
369
+ global $fv_fp, $fv_wp_flowplayer_ver, $fv_wp_flowplayer_core_ver;
370
+
371
+ $aOptions = get_option( 'fvwpflowplayer' );
372
+ if( !isset($aOptions['version']) || version_compare( $fv_wp_flowplayer_ver, $aOptions['version'] ) ) {
373
+ //update_option( 'fv_wordpress_flowplayer_deferred_notices', 'FV Flowplayer upgraded - please click "Check template" and "Check videos" for automated check of your site at <a href="'.site_url().'/wp-admin/options-general.php?page=fvplayer">the settings page</a> for automated checks!' );
374
+
375
+ if( $aOptions['version'] == '6.0.5.20' && $aOptions['playlist_advance'] == 'true' ) { // version 6.0.5 used reverse login for this option!
376
+ $aOptions['playlist_advance'] = false;
377
+ $fv_fp->conf = $aOptions;
378
+ }
379
+
380
+ $aOptions['version'] = $fv_wp_flowplayer_ver;
381
+ update_option( 'fvwpflowplayer', $aOptions );
382
+
383
+ fv_wp_flowplayer_pro_settings_update_for_lightbox();
384
+ $fv_fp->css_writeout();
385
+
386
+ fv_wp_flowplayer_delete_extensions_transients();
387
+ delete_option('fv_flowplayer_extension_install');
388
+ }
389
+ }
390
+
391
+ function fv_wp_flowplayer_pro_settings_update_for_lightbox(){
392
+ global $fv_fp;
393
+ if(isset($fv_fp->conf['pro']) && isset($fv_fp->conf['pro']['interface']['lightbox']) && $fv_fp->conf['pro']['interface']['lightbox'] == true ){
394
+ $fv_fp->conf['interface']['lightbox'] = true;
395
+ $fv_fp->conf['pro']['interface']['lightbox'] = false;
396
+ $options = get_option('fvwpflowplayer');
397
+ unset($options['pro']['interface']['lightbox']);
398
+ $options['interface']['lightbox'] = true;
399
+ update_option('fvwpflowplayer', $options);
400
+ }
401
+ if(isset($fv_fp->conf['pro']) && isset($fv_fp->conf['pro']['lightbox_images']) && $fv_fp->conf['pro']['lightbox_images'] == true ){
402
+ $fv_fp->conf['lightbox_images'] = true;
403
+ $fv_fp->conf['pro']['lightbox_images'] = false;
404
+ $options = get_option('fvwpflowplayer');
405
+ unset($options['pro']['lightbox_images']);
406
+ $options['lightbox_images'] = true;
407
+ update_option('fvwpflowplayer', $options);
408
+ }
409
+
410
+ }
411
+
412
+ function fv_wp_flowplayer_delete_extensions_transients( $delete_delay = false ){
413
+ $aTransientsLike = array('fv_flowplayer_license','fv-player-pro_license','fv-player-vast_license','fv-player-pro_fp-private-updates','fv-player-vast_fp-private-updates');
414
+
415
+ global $wpdb;
416
+ $aWhere = array();
417
+ foreach( $aTransientsLike AS $sKey ) {
418
+ $aWhere[] = 'option_name LIKE "%'.$sKey.'%"';
419
+ }
420
+ $sWhere = implode(" OR ", $aWhere);
421
+ $aOptions = $wpdb->get_col( "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE '%_transient_fv%' AND ( ".$sWhere." )" );
422
+
423
+ foreach( $aOptions AS $sKey ) {
424
+ if( !$delete_delay ){
425
+ delete_transient( str_replace('_transient_','',$sKey) );
426
+ } else {
427
+ fv_wp_flowplayer_change_transient_expiration( str_replace('_transient_','',$sKey), $delete_delay );
428
+ }
429
+ }
430
+
431
+ $aUpdates = get_site_transient('update_plugins');
432
+ set_site_transient('update_plugins', $aUpdates );
433
+
434
+ }
435
+
436
+
437
+
438
+ add_action('admin_init', 'fv_player_lchecks');
439
+
440
+ function fv_player_lchecks() {
441
+ if( isset($_GET['fv-licensing']) && $_GET['fv-licensing'] == "check" ){
442
+ delete_option("fv_wordpress_flowplayer_persistent_notices");
443
+
444
+ //license will expire in 5 seconds in the function:
445
+ fv_wp_flowplayer_admin_key_update();
446
+ }
447
+
448
+ global $fv_fp, $fv_wp_flowplayer_core_ver;
449
+ if( preg_match( '!^\$\d+!', $fv_fp->conf['key'] ) ) {
450
+ $version = get_option( 'fvwpflowplayer_core_ver' );
451
+ if( version_compare( $fv_wp_flowplayer_core_ver, $version ) == 1 ) {
452
+ fv_wp_flowplayer_admin_key_update();
453
+ fv_wp_flowplayer_delete_extensions_transients();
454
+ }
455
+ }
456
+
457
+ if( flowplayer::is_licensed() ) {
458
+ if ( false === ( $aCheck = get_transient( 'fv_flowplayer_license' ) ) ) {
459
+ $aCheck = fv_wp_flowplayer_license_check( array('action' => 'check') );
460
+ if( $aCheck ) {
461
+ set_transient( 'fv_flowplayer_license', $aCheck, 60*60*24 );
462
+ } else {
463
+ set_transient( 'fv_flowplayer_license', json_decode(json_encode( array('error' => 'Error checking license') ), FALSE), 60*60*24 );
464
+ }
465
+ }
466
+
467
+ $aCheck = get_transient( 'fv_flowplayer_license' );
468
+ $aInstalled = get_option('fv_flowplayer_extension_install');
469
+ if( isset($aCheck->valid) && $aCheck->valid){
470
+
471
+ if( !isset($aInstalled['fv_player_pro']) || ( isset($_REQUEST['nonce_fv_player_pro_install']) && wp_verify_nonce( $_REQUEST['nonce_fv_player_pro_install'], 'fv_player_pro_install') ) ) {
472
+ fv_wp_flowplayer_install_extension('fv_player_pro');
473
+ }
474
+ delete_option('fv_wordpress_flowplayer_persistent_notices');
475
+ }
476
+
477
+ if( isset($aCheck->expired) && $aCheck->expired && stripos( implode(get_option('active_plugins')), 'fv-player-pro' ) !== false ) {
478
+ add_filter( 'site_transient_update_plugins', 'fv_player_remove_update' );
479
+ }
480
+ }
481
}
482
483
+ function fv_player_remove_update( $objUpdates ) {
484
+ if( !$objUpdates || !isset($objUpdates->response) || count($objUpdates->response) == 0 ) return $objUpdates;
485
486
+ foreach( $objUpdates->response AS $key => $objUpdate ) {
487
+ if( stripos($key,'fv-wordpress-flowplayer') === 0 ) {
488
+ unset($objUpdates->response[$key]);
489
}
490
}
491
+
492
+ return $objUpdates;
493
}
494
495
+ function fv_wp_flowplayer_admin_key_update() {
496
+ global $fv_fp, $fv_wp_flowplayer_core_ver;
497
+
498
+ $data = fv_wp_flowplayer_license_check( array('action' => 'key_update') );
499
+ if( isset($data->domain) ) { // todo: test
500
+ if( $data->domain && $data->key && stripos( home_url(), $data->domain ) !== false ) {
501
+ $fv_fp->conf['key'] = $data->key;
502
+ update_option( 'fvwpflowplayer', $fv_fp->conf );
503
+ update_option( 'fvwpflowplayer_core_ver', $fv_wp_flowplayer_core_ver );
504
+
505
+ fv_wp_flowplayer_change_transient_expiration("fv_flowplayer_license",5);
506
+ fv_wp_flowplayer_delete_extensions_transients(5);
507
+ return true;
508
+ }
509
+ } else if( isset($data->expired) && $data->expired && isset($data->message) ){
510
+ update_option( 'fv_wordpress_flowplayer_persistent_notices', $data->message );
511
+ update_option( 'fvwpflowplayer_core_ver', $fv_wp_flowplayer_core_ver );
512
return false;
513
+ } else {
514
+ update_option( 'fv_wordpress_flowplayer_deferred_notices', 'FV Flowplayer License upgrade failed - please check if you are running the plugin on your licensed domain.' );
515
+ update_option( 'fvwpflowplayer_core_ver', $fv_wp_flowplayer_core_ver );
516
+ return false;
517
+ }
518
+ }
519
520
+ function fv_wp_flowplayer_license_check( $aArgs ) {
521
+ global $fv_wp_flowplayer_ver, $fv_wp_flowplayer_core_ver;
522
+
523
+ $args = array(
524
+ 'body' => array( 'plugin' => 'fv-wordpress-flowplayer', 'version' => $fv_wp_flowplayer_ver, 'core_ver' => $fv_wp_flowplayer_core_ver, 'type' => home_url(), 'action' => $aArgs['action'], 'admin-url' => admin_url() ),
525
+ 'timeout' => 10,
526
+ 'user-agent' => 'fv-wordpress-flowplayer-'.$fv_wp_flowplayer_ver.' ('.$fv_wp_flowplayer_core_ver.')'
527
+ );
528
+ $resp = wp_remote_post( 'https://foliovision.com/?fv_remote=true', $args );
529
530
+ if( !is_wp_error($resp) && isset($resp['body']) && $resp['body'] && $data = json_decode( preg_replace( '~[\s\S]*?<FVFLOWPLAYER>(.*?)</FVFLOWPLAYER>[\s\S]*?~', '$1', $resp['body'] ) ) ) {
531
+ return $data;
532
+
533
+ } else if( is_wp_error($resp) && stripos($resp->get_error_message(),'SSL' ) !== false ) {
534
+ $args = array( 'sslverify' => false );
535
+ $resp = wp_remote_post( 'https://foliovision.com/?fv_remote=true', $args );
536
+
537
+ if( !is_wp_error($resp) && isset($resp['body']) && $resp['body'] && $data = json_decode( preg_replace( '~[\s\S]*?<FVFLOWPLAYER>(.*?)</FVFLOWPLAYER>[\s\S]*?~', '$1', $resp['body'] ) ) ) {
538
+ return $data;
539
+ }
540
541
}
542
+
543
+ return false;
544
}
545
546
+ function fv_wp_flowplayer_change_transient_expiration( $transient_name, $time ){
547
+ $transient_val = get_transient($transient_name);
548
+ if( $transient_val ){
549
+ set_transient($transient_name,$transient_val,$time);
550
+ return true;
551
+ }
552
+ return false;
553
}
554
555
556
557
558
+ add_action('wp_ajax_flowplayer_conversion_script', 'flowplayer_conversion_script');
559
560
+ function flowplayer_conversion_script() {
561
+ global $wpdb;
562
563
+ $posts = $wpdb->get_results("SELECT ID, post_content FROM {$wpdb->posts} WHERE post_type != 'revision'");
564
565
+ $old_shorttag = '[flowplayer';
566
+ $new_shorttag = '[fvplayer';
567
+ $counter = 0;
568
+
569
+ echo '<ol>';
570
+ foreach($posts as $fv_post) {
571
+ if ( stripos( $fv_post->post_content, $old_shorttag ) !== false ) {
572
+ $update_post = array();
573
+ $update_post['ID'] = $fv_post->ID;
574
+ $update_post['post_content'] = str_replace( $old_shorttag, $new_shorttag, $fv_post->post_content );
575
+ wp_update_post( $update_post );
576
+ echo '<li><a href="' . get_permalink($fv_post->ID) . '">' . get_the_title($fv_post->ID) . '</a> updated</li>';
577
+ $counter++;
578
+ }
579
}
580
+ echo '</ol>';
581
+
582
+ echo '<strong>Conversion was succesful. Total number of converted posts: ' . $counter . '</strong>';
583
+
584
+ delete_option('fvwpflowplayer_conversion');
585
+
586
+ die();
587
}
588
589
590
591
+
592
+ add_action('admin_notices', 'fv_wp_flowplayer_admin_notice');
593
+
594
+ function fv_wp_flowplayer_admin_notice() {
595
+ if( $notices = get_option('fv_wordpress_flowplayer_deferred_notices') ) {
596
+ echo '<div class="updated inline">
597
+ <p>'.$notices.'</p>
598
+ </div>';
599
+ delete_option('fv_wordpress_flowplayer_deferred_notices');
600
+ }
601
+
602
+ $conversion = false; //(bool)get_option('fvwpflowplayer_conversion');
603
+ if ($conversion) {
604
+ echo '<div class="updated" id="fvwpflowplayer_conversion_notice"><p>';
605
+ printf(__('FV Player has found old shortcodes in the content of your posts. <a href="%1$s">Run the conversion script.</a>'), get_admin_url() . 'options-general.php?page=fvplayer');
606
+ echo "</p></div>";
607
+ }
608
+
609
+ if( isset($_GET['fv-licensing']) && $_GET['fv-licensing'] == "check" ){
610
+ echo '<div class="updated inline">
611
+ <p>Thank you for purchase. Your license will be renewed in couple of minutes.<br/>
612
+ Please make sure you upgrade <strong>FV Player Pro</strong> and <strong>FV Player VAST</strong> if you are using it.</p>
613
+ </div>';
614
}
615
+
616
+ global $FV_Player_Pro;
617
+ if( $FV_Player_Pro && version_compare($FV_Player_Pro->version,'0.5') == -1 ) :
618
+ ?>
619
+ <div class="error">
620
+ <p><?php _e( 'FV Player: Your pro extension is installed, but it\'s not compatible with FV Player 6! Make sure you upgrade your FV Player Pro to version 0.5 or above.', 'my-text-domain' ); ?></p>
621
+ </div>
622
+ <?php
623
+ endif;
624
+
625
+ /*if( isset($_GET['page']) && $_GET['page'] == 'backend.php' ) {
626
+ $options = get_option( 'fvwpflowplayer' );
627
+ if( $options['key'] == 'false' ) {
628
+ echo '<div class="updated"><p>';
629
+ printf(__('Brand new version of Flowplayer for HTML5. <a href="http://foliovision.com/wordpress/plugins/fv-wordpress-flowplayer/buy">Licenses half price</a> in May.' ) );
630
+ echo "</p></div>";
631
+ }
632
+ }*/
633
}
634
635
636
+
637
+
638
+
639
+
640
+
641
/*
642
* Check the extension info from plugin license transient and activate the plugin
643
*/
653
$download_url = $aPluginInfo->{$plugin_package}->url;
654
655
$sPluginBasenameReal = fv_flowplayer_get_extension_path( str_replace( '_', '-', $plugin_package ) );
656
+ if( $sPluginBasenameReal ) {
657
+ return; // already installed
658
+ }
659
+
660
$plugin_basename = $sPluginBasenameReal ? $sPluginBasenameReal : $plugin_basename;
661
662
$url = wp_nonce_url( site_url().'/wp-admin/options-general.php?page=fvplayer', 'fv_player_pro_install', 'nonce_fv_player_pro_install' );
758
}
759
760
761
762
763
//search for plugin path with {slug}.php
764
function fv_flowplayer_get_extension_path( $slug ){
775
return $item;
776
}
777
778
+ $sPluginFolder = plugin_dir_path( dirname( dirname(__FILE__) ) );
779
foreach( $aInactivePlugins as $item ){
780
+ if( stripos($item,$slug.'.php') !== false && file_exists($sPluginFolder.$item) )
781
return $item;
782
}
783
810
811
812
813
+ function flowplayer_deactivate() {
814
+ if( flowplayer::is_licensed() ) {
815
+ delete_transient( 'fv_flowplayer_license' );
816
}
817
+ delete_option( 'fv_flowplayer_extension_install' );
818
+ wp_clear_scheduled_hook('fv_flowplayer_checker_event');
819
}
820
821
822
823
824
+ add_action( 'admin_notices', 'fv_player_admin_notice_expired_license' );
825
+ add_action( 'fv_player_settings_pre', 'fv_player_admin_notice_expired_license' );
826
+
827
+ function fv_player_admin_notice_expired_license() {
828
+ global $FV_Player_Pro;
829
+ $screen = get_current_screen();
830
+ if( ( $screen && $screen->id == 'plugins' || did_action('fv_player_settings_pre') ) && isset($FV_Player_Pro) && isset($FV_Player_Pro->version) && version_compare( str_replace( '.beta', '', $FV_Player_Pro->version), '0.8.17') == -1 ) {
831
+ $aCheck = get_transient( 'fv-player-pro_license' );
832
+ if( !empty($aCheck->expired) || !empty($aCheck->error) ) { ?>
833
+ <div class="updated">
834
+ <?php echo $aCheck->message; ?>
835
+ <?php if( !empty($aCheck->changelog) ) echo $aCheck->changelog; ?>
836
+ </div>
837
+ <?php }
838
+ }
839
}
controller/editor.php ADDED
@@ -0,0 +1,227 @@
1
+ <?php
2
+
3
+ add_action( 'admin_enqueue_scripts', 'fv_player_shortcode_editor_scripts' );
4
+
5
+ function fv_player_shortcode_editor_scripts( $page ) {
6
+ if( $page !== 'post.php' && $page !== 'post-new.php' ) {
7
+ return;
8
+ }
9
+
10
+ global $fv_wp_flowplayer_ver;
11
+
12
+
13
+ wp_register_script('fvwpflowplayer-domwindow', flowplayer::get_plugin_url().'/js/jquery.colorbox-min.js',array('jquery'), $fv_wp_flowplayer_ver );
14
+ wp_enqueue_script('fvwpflowplayer-domwindow');
15
+
16
+ wp_register_script('fvwpflowplayer-shortcode-editor', flowplayer::get_plugin_url().'/js/shortcode-editor.js',array('jquery'), $fv_wp_flowplayer_ver );
17
+ wp_register_script('fvwpflowplayer-shortcode-editor-old', flowplayer::get_plugin_url().'/js/shortcode-editor.old.js',array('jquery'), $fv_wp_flowplayer_ver );
18
+
19
+ global $fv_fp;
20
+ if( isset($fv_fp->conf["interface"]['shortcode_editor_old']) && $fv_fp->conf["interface"]['shortcode_editor_old'] == 'true' ) {
21
+ wp_enqueue_script('fvwpflowplayer-shortcode-editor-old');
22
+ } else {
23
+ wp_enqueue_script('fvwpflowplayer-shortcode-editor');
24
+ }
25
+
26
+ wp_register_style('fvwpflowplayer-domwindow-css', flowplayer::get_plugin_url().'/css/colorbox.css','','1.0','screen');
27
+ wp_enqueue_style('fvwpflowplayer-domwindow-css');
28
+ }
29
+
30
+
31
+
32
+
33
+ add_action('media_buttons', 'flowplayer_add_media_button', 10);
34
+
35
+ function flowplayer_add_media_button() {
36
+ if( stripos( $_SERVER['REQUEST_URI'], 'post.php' ) === FALSE && stripos( $_SERVER['REQUEST_URI'], 'post-new.php' ) === FALSE ) {
37
+ return;
38
+ }
39
+
40
+ global $post;
41
+ $plugins = get_option('active_plugins');
42
+ $found = false;
43
+ foreach ( $plugins AS $plugin ) {
44
+ if( stripos($plugin,'foliopress-wysiwyg') !== FALSE )
45
+ $found = true;
46
+ }
47
+ $button_tip = 'Insert a video';
48
+ $wizard_url = 'media-upload.php?post_id='.$post->ID.'&type=fv-wp-flowplayer';
49
+ $icon = '<span> </span>';
50
+
51
+ echo '<a title="' . __('Add FV Player', 'fv-wordpress-flowplayer') . '" title="' . $button_tip . '" href="#" class="button fv-wordpress-flowplayer-button" >'.$icon.' Player</a>';
52
+ }
53
+
54
+
55
+
56
+
57
+ add_action('media_upload_fvplayer_video', '__return_false'); // keep for compatibility!
58
+
59
+
60
+
61
+
62
+ add_action( 'edit_form_after_editor', 'fv_wp_flowplayer_edit_form_after_editor' );
63
+
64
+ function fv_wp_flowplayer_edit_form_after_editor( ) {
65
+ global $fv_fp;
66
+ if( isset($fv_fp->conf["interface"]['shortcode_editor_old']) && $fv_fp->conf["interface"]['shortcode_editor_old'] == 'true' ) {
67
+ include dirname( __FILE__ ) . '/../view/wizard.old.php';
68
+ } else {
69
+ include dirname( __FILE__ ) . '/../view/wizard.php';
70
+ }
71
+ }
72
+
73
+ // allow .vtt subtitle files
74
+ add_filter( 'wp_check_filetype_and_ext', 'fv_flowplayer_filetypes', 10, 4 );
75
+
76
+ function fv_flowplayer_filetypes( $aFile ) {
77
+ $aArgs = func_get_args();
78
+ foreach( array( 'vtt', 'webm', 'ogg') AS $item ) {
79
+ if( isset($aArgs[2]) && preg_match( '~\.'.$item.'~', $aArgs[2] ) ) {
80
+ $aFile['type'] = $item;
81
+ $aFile['ext'] = $item;
82
+ $aFile['proper_filename'] = $aArgs[2];
83
+ }
84
+ }
85
+ return $aFile;
86
+ }
87
+
88
+
89
+
90
+
91
+ add_filter('admin_print_scripts', 'flowplayer_print_scripts');
92
+
93
+ function flowplayer_print_scripts() {
94
+ wp_enqueue_script('media-upload');
95
+ wp_enqueue_script('thickbox');
96
+ }
97
+
98
+
99
+
100
+
101
+ add_action('admin_print_styles', 'flowplayer_print_styles');
102
+
103
+ function flowplayer_print_styles() {
104
+ wp_enqueue_style('thickbox');
105
+ }
106
+
107
+
108
+
109
+
110
+ add_action( 'save_post', 'fv_wp_flowplayer_save_post' );
111
+
112
+
113
+
114
+
115
+ add_action( 'save_post', 'fv_wp_flowplayer_featured_image' , 10000 );
116
+
117
+ function fv_wp_flowplayer_featured_image($post_id) {
118
+ if( $parent_id = wp_is_post_revision($post_id) ) {
119
+ $post_id = $parent_id;
120
+ }
121
+
122
+ global $fv_fp;
123
+ if( !isset($fv_fp->conf['integrations']['featured_img']) || $fv_fp->conf['integrations']['featured_img'] != 'true' ){
124
+ return;
125
+ }
126
+
127
+ $thumbnail_id = get_post_thumbnail_id($post_id);
128
+ if( $thumbnail_id != 0 ) {
129
+ return;
130
+ }
131
+
132
+ $post = get_post($post_id);
133
+ if( !$post || empty($post->post_content) ){
134
+ return;
135
+ }
136
+
137
+ $sThumbUrl = array();
138
+ if (!preg_match('/(?:splash=\\\?")([^"]*.(?:jpg|gif|png))/', $post->post_content, $sThumbUrl) || empty($sThumbUrl[1])) {
139
+ return;
140
+ }
141
+
142
+ $thumbnail_id = fv_wp_flowplayer_save_to_media_library($sThumbUrl[1], $post_id);
143
+ if($thumbnail_id){
144
+ set_post_thumbnail($post_id, $thumbnail_id);
145
+ }
146
+
147
+ }
148
+
149
+ function fv_wp_flowplayer_construct_filename( $post_id ) {
150
+ $filename = get_the_title( $post_id );
151
+ $filename = sanitize_title( $filename, $post_id );
152
+ $filename = urldecode( $filename );
153
+ $filename = preg_replace( '/[^a-zA-Z0-9\-]/', '', $filename );
154
+ $filename = substr( $filename, 0, 32 );
155
+ $filename = trim( $filename, '-' );
156
+ if ( $filename == '' ) $filename = (string) $post_id;
157
+ return $filename;
158
+ }
159
+
160
+ function fv_wp_flowplayer_save_to_media_library( $image_url, $post_id ) {
161
+
162
+ $error = '';
163
+ $response = wp_remote_get( $image_url );
164
+ if( is_wp_error( $response ) ) {
165
+ $error = new WP_Error( 'thumbnail_retrieval', sprintf( __( 'Error retrieving a thumbnail from the URL <a href="%1$s">%1$s</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.', 'video-thumbnails' ), $image_url ) . '<br>' . __( 'Error Details:', 'video-thumbnails' ) . ' ' . $response->get_error_message() );
166
+ } else {
167
+ $image_contents = $response['body'];
168
+ $image_type = wp_remote_retrieve_header( $response, 'content-type' );
169
+ }
170
+
171
+ if ( $error != '' || $image_contents == '' ) {
172
+ return false;
173
+ } else {
174
+
175
+ // Translate MIME type into an extension
176
+ if ( $image_type == 'image/jpeg' ) {
177
+ $image_extension = '.jpg';
178
+ } elseif ( $image_type == 'image/png' ) {
179
+ $image_extension = '.png';
180
+ } elseif ( $image_type == 'image/gif' ) {
181
+ $image_extension = '.gif';
182
+ } else {
183
+ return new WP_Error( 'thumbnail_upload', __( 'Unsupported MIME type:', 'video-thumbnails' ) . ' ' . $image_type );
184
+ }
185
+
186
+ // Construct a file name with extension
187
+ $new_filename = fv_wp_flowplayer_construct_filename( $post_id ) . $image_extension;
188
+
189
+ // Save the image bits using the new filename
190
+ $upload = wp_upload_bits( $new_filename, null, $image_contents );
191
+
192
+ // Stop for any errors while saving the data or else continue adding the image to the media library
193
+ if ( $upload['error'] ) {
194
+ $error = new WP_Error( 'thumbnail_upload', __( 'Error uploading image data:', 'video-thumbnails' ) . ' ' . $upload['error'] );
195
+ return $error;
196
+ } else {
197
+
198
+ $wp_filetype = wp_check_filetype( basename( $upload['file'] ), null );
199
+
200
+ $upload = apply_filters( 'wp_handle_upload', array(
201
+ 'file' => $upload['file'],
202
+ 'url' => $upload['url'],
203
+ 'type' => $wp_filetype['type']
204
+ ), 'sideload' );
205
+
206
+ // Contstruct the attachment array
207
+ $attachment = array(
208
+ 'post_mime_type' => $upload['type'],
209
+ 'post_title' => get_the_title( $post_id ),
210
+ 'post_content' => '',
211
+ 'post_status' => 'inherit'
212
+ );
213
+ // Insert the attachment
214
+ $attach_id = wp_insert_attachment( $attachment, $upload['file'], $post_id );
215
+
216
+ }
217
+
218
+ }
219
+
220
+ return $attach_id;
221
+
222
+ }
223
+
224
+
225
+
226
+
227
+ add_action('the_content', 'flowplayer_content_remove_commas');
controller/frontend.php CHANGED
@@ -73,9 +73,11 @@ function fv_flowplayer_get_js_translations() {
73
'video_issues' =>__('Video Issues','fv-wordpress-flowplayer'),
74
'link_copied' =>__('Video Link Copied to Clipboard','fv-wordpress-flowplayer'),
75
'embed_copied' =>__('Embed Code Copied to Clipboard','fv-wordpress-flowplayer'),
76
'warning_iphone_subs' => __('This video has subtitles, that are not supported on your device.','fv-wordpress-flowplayer'),
77
- 'warning_unstable_android' => __('You are using an old Android device. If you experience issues with the video please use <a href="https://play.google.com/store/apps/details?id=org.mozilla.firefox">Firefox</a>.','fv-wordpress-flowplayer').$sWhy,
78
- 'warning_old_safari' => __('You are using an old Safari browser. If you experience issues with the video please use <a href="https://www.mozilla.org/en-US/firefox/new/">Firefox</a> or other modern browser.','fv-wordpress-flowplayer').$sWhy,
79
);
80
81
return $aStrings;
@@ -313,6 +315,8 @@ function flowplayer_prepare_scripts() {
313
$aDependencies[] = 'jquery-ui-tabs';
314
}
315
316
wp_enqueue_script( 'flowplayer', flowplayer::get_plugin_url().'/flowplayer/fv-flowplayer.min.js', $aDependencies, $fv_wp_flowplayer_ver, true );
317
318
$sPluginUrl = preg_replace( '~^.*://~', '//', FV_FP_RELATIVE_PATH );
@@ -361,6 +365,17 @@ function flowplayer_prepare_scripts() {
361
if( $aConf['volume'] > 1 ) {
362
$aConf['volume'] = 1;
363
}
364
wp_localize_script( 'flowplayer', 'fv_flowplayer_conf', $aConf );
365
if( current_user_can('manage_options') ) {
366
wp_localize_script( 'flowplayer', 'fv_flowplayer_admin_input', array(true) );
@@ -372,11 +387,17 @@ function flowplayer_prepare_scripts() {
372
373
wp_localize_script( 'flowplayer', 'fv_flowplayer_translations', fv_flowplayer_get_js_translations());
374
wp_localize_script( 'flowplayer', 'fv_fp_ajaxurl', site_url().'/wp-admin/admin-ajax.php' );
375
- wp_localize_script( 'flowplayer', 'fv_flowplayer_playlists', $fv_fp->aPlaylists );
376
- if( count($fv_fp->aAds) > 0 ) {
377
wp_localize_script( 'flowplayer', 'fv_flowplayer_ad', $fv_fp->aAds );
378
}
379
- if( count($fv_fp->aPopups) > 0 ) {
380
wp_localize_script( 'flowplayer', 'fv_flowplayer_popup', $fv_fp->aPopups );
381
}
382
@@ -397,9 +418,11 @@ function flowplayer_prepare_scripts() {
397
}
398
399
global $FV_Player_lightbox;
400
- if( $FV_Player_lightbox->bLoad || isset($fv_fp->conf['lightbox_images']) && $fv_fp->conf['lightbox_images'] == 'true' ) {
401
$aConf = array();
402
- $aConf['lightbox_images'] = !empty($fv_fp->conf['lightbox_images']) && $fv_fp->conf['lightbox_images'] == 'true' ? true : false;
403
404
wp_enqueue_script( 'fv_player_lightbox', flowplayer::get_plugin_url().'/js/lightbox.js', 'jquery', $fv_wp_flowplayer_ver, true );
405
wp_localize_script( 'fv_player_lightbox', 'fv_player_lightbox', $aConf );
73
'video_issues' =>__('Video Issues','fv-wordpress-flowplayer'),
74
'link_copied' =>__('Video Link Copied to Clipboard','fv-wordpress-flowplayer'),
75
'embed_copied' =>__('Embed Code Copied to Clipboard','fv-wordpress-flowplayer'),
76
+ 'subtitles_disabled' =>__('Subtitles disabled','fv-wordpress-flowplayer'),
77
+ 'subtitles_switched' =>__('Subtitles switched to ','fv-wordpress-flowplayer'),
78
'warning_iphone_subs' => __('This video has subtitles, that are not supported on your device.','fv-wordpress-flowplayer'),
79
+ 'warning_unstable_android' => __('You are using an old Android device. If you experience issues with the video please use <a href="https://play.google.com/store/apps/details?id=org.mozilla.firefox">Firefox</a>.','fv-wordpress-flowplayer').$sWhy,
80
+ 'warning_old_safari' => __('You are using an old Safari browser. If you experience issues with the video please use <a href="https://www.mozilla.org/en-US/firefox/new/">Firefox</a> or other modern browser.','fv-wordpress-flowplayer').$sWhy,
81
);
82
83
return $aStrings;
315
$aDependencies[] = 'jquery-ui-tabs';
316
}
317
318
+ if( !$fv_fp->bCSSLoaded ) $fv_fp->css_enqueue(true);
319
+
320
wp_enqueue_script( 'flowplayer', flowplayer::get_plugin_url().'/flowplayer/fv-flowplayer.min.js', $aDependencies, $fv_wp_flowplayer_ver, true );
321
322
$sPluginUrl = preg_replace( '~^.*://~', '//', FV_FP_RELATIVE_PATH );
365
if( $aConf['volume'] > 1 ) {
366
$aConf['volume'] = 1;
367
}
368
+
369
+ $aConf['mobile_native_fullscreen'] = $fv_fp->_get_option('mobile_native_fullscreen');
370
+ $aConf['mobile_force_fullscreen'] = $fv_fp->_get_option('mobile_force_fullscreen');
371
+
372
+ global $post;
373
+ if( $post && isset($post->ID) && $post->ID > 0 ) {
374
+ if( get_post_meta($post->ID, 'fv_player_mobile_native_fullscreen', true) ) $aConf['mobile_native_fullscreen'] = true;
375
+ if( get_post_meta($post->ID, 'fv_player_mobile_force_fullscreen', true) ) $aConf['mobile_force_fullscreen'] = true;
376
+ }
377
+
378
+
379
wp_localize_script( 'flowplayer', 'fv_flowplayer_conf', $aConf );
380
if( current_user_can('manage_options') ) {
381
wp_localize_script( 'flowplayer', 'fv_flowplayer_admin_input', array(true) );
387
388
wp_localize_script( 'flowplayer', 'fv_flowplayer_translations', fv_flowplayer_get_js_translations());
389
wp_localize_script( 'flowplayer', 'fv_fp_ajaxurl', site_url().'/wp-admin/admin-ajax.php' );
390
+
391
+ if( $fv_fp->_get_option('old_code') ) {
392
+ wp_localize_script( 'flowplayer', 'fv_flowplayer_playlists', $fv_fp->aPlaylists );
393
+ } else {
394
+ wp_localize_script( 'flowplayer', 'fv_flowplayer_playlists', array() ); // has to be defined for FV Player Pro 0.6.20 and such
395
+ }
396
+
397
+ if( count($fv_fp->aAds) > 0 ) { // todo: move into player
398
wp_localize_script( 'flowplayer', 'fv_flowplayer_ad', $fv_fp->aAds );
399
}
400
+ if( count($fv_fp->aPopups) > 0 ) { // todo: move into player
401
wp_localize_script( 'flowplayer', 'fv_flowplayer_popup', $fv_fp->aPopups );
402
}
403
418
}
419
420
global $FV_Player_lightbox;
421
+ if( $FV_Player_lightbox->bLoad || $fv_fp->_get_option('lightbox_images') || $fv_fp->_get_option('js-everywhere') ) {
422
$aConf = array();
423
+ $aConf['lightbox_images'] = $fv_fp->_get_option('lightbox_images');
424
+
425
+ if( !$FV_Player_lightbox->bCSSLoaded ) $FV_Player_lightbox->css_enqueue(true);
426
427
wp_enqueue_script( 'fv_player_lightbox', flowplayer::get_plugin_url().'/js/lightbox.js', 'jquery', $fv_wp_flowplayer_ver, true );
428
wp_localize_script( 'fv_player_lightbox', 'fv_player_lightbox', $aConf );
controller/settings.php ADDED
@@ -0,0 +1,298 @@
1
+ <?php
2
+
3
+ /*
4
+ * Admin menus and such...
5
+ */
6
+ add_action('admin_menu', 'fv_player_admin_menu');
7
+
8
+ function fv_player_admin_menu () {
9
+ if( function_exists('add_submenu_page') ) {
10
+ add_options_page( 'FV Player', 'FV Player', 'manage_options', 'fvplayer', 'fv_player_admin_page' );
11
+ }
12
+ }
13
+
14
+
15
+
16
+
17
+ function fv_player_admin_page() {
18
+ global $fv_fp;
19
+ include dirname( __FILE__ ) . '/../view/admin.php';
20
+ }
21
+
22
+
23
+
24
+
25
+ add_filter('plugin_action_links', 'fv_wp_flowplayer_plugin_action_links', 10, 2);
26
+
27
+ function fv_wp_flowplayer_plugin_action_links($links, $file) {
28
+ if( $file == 'fv-wordpress-flowplayer/flowplayer.php') {
29
+ $settings_link = '<a href="https://foliovision.com/pro-support" target="_blank">Premium Support</a>';
30
+ array_unshift($links, $settings_link);
31
+ $settings_link = '<a href="options-general.php?page=fvplayer">Settings</a>';
32
+ array_unshift($links, $settings_link);
33
+ }
34
+ return $links;
35
+ }
36
+
37
+
38
+
39
+
40
+ add_action( 'after_plugin_row', 'fv_wp_flowplayer_after_plugin_row', 10, 3 );
41
+
42
+ function fv_wp_flowplayer_after_plugin_row( $arg) {
43
+ if( apply_filters('fv_player_skip_ads',false) ) {
44
+ return;
45
+ }
46
+
47
+ $args = func_get_args();
48
+
49
+ if( $args[1]['Name'] == 'FV Wordpress Flowplayer' ) {
50
+ $options = get_option( 'fvwpflowplayer' );
51
+ if( $options['key'] == 'false' || $options['key'] == '' ) :
52
+ ?>
53
+ <tr class="plugin-update-tr fv-wordpress-flowplayer-tr">
54
+ <td class="plugin-update colspanchange" colspan="3">
55
+ <div class="update-message">
56
+ <a href="http://foliovision.com/wordpress/plugins/fv-wordpress-flowplayer/download">All Licenses 20% Off</a> - Easter sale!
57
+ </div>
58
+ </td>
59
+ </tr>
60
+ <?php
61
+ endif;
62
+ }
63
+ }
64
+
65
+
66
+
67
+
68
+ add_filter( 'get_user_option_closedpostboxes_fv_flowplayer_settings', 'fv_wp_flowplayer_closed_meta_boxes' );
69
+
70
+ function fv_wp_flowplayer_closed_meta_boxes( $closed ) {
71
+ if ( false === $closed )
72
+ $closed = array( 'fv_flowplayer_amazon_options', 'fv_flowplayer_interface_options', 'fv_flowplayer_default_options', 'fv_flowplayer_ads', 'fv_flowplayer_integrations', 'fv_player_pro' );
73
+
74
+ return $closed;
75
+ }
76
+
77
+
78
+
79
+
80
+ /*
81
+ * Saving settings
82
+ */
83
+ add_action('admin_init', 'fv_player_settings_save', 9);
84
+
85
+ function fv_player_settings_save() {
86
+ // Trick media uploader to show video only, while making sure we use our custom type; Also save options
87
+ if( isset($_GET['type']) ) {
88
+ if( $_GET['type'] == 'fvplayer_video' || $_GET['type'] == 'fvplayer_video_1' || $_GET['type'] == 'fvplayer_video_2' || $_GET['type'] == 'fvplayer_mobile' ) {
89
+ $_GET['post_mime_type'] = 'video';
90
+ }
91
+ else if( $_GET['type'] == 'fvplayer_splash' || $_GET['type'] == 'fvplayer_logo' ) {
92
+ $_GET['post_mime_type'] = 'image';
93
+ }
94
+ }
95
+
96
+ if( isset($_POST['fv-wp-flowplayer-submit']) ) {
97
+ check_admin_referer('fv_flowplayer_settings_nonce','fv_flowplayer_settings_nonce');
98
+
99
+ global $fv_fp;
100
+ if( method_exists($fv_fp,'_set_conf') ) {
101
+ $fv_fp->_set_conf();
102
+ } else {
103
+ echo 'Error saving FV Flowplayer options.';
104
+ }
105
+ }
106
+ }
107
+
108
+
109
+
110
+
111
+ /*
112
+ * Pointer boxes
113
+ */
114
+ add_action('admin_init', 'fv_player_admin_pointer_boxes');
115
+
116
+ function fv_player_admin_pointer_boxes() {
117
+ global $fv_fp;
118
+ global $fv_wp_flowplayer_ver, $fv_wp_flowplayer_core_ver;
119
+
120
+ if(
121
+ isset($fv_fp->conf['disable_videochecker']) && $fv_fp->conf['disable_videochecker'] == 'false' &&
122
+ ( !isset($fv_fp->conf['video_checker_agreement']) || $fv_fp->conf['video_checker_agreement'] != 'true' )
123
+ ) {
124
+ $fv_fp->pointer_boxes['fv_flowplayer_video_checker_service'] = array(
125
+ 'id' => '#wp-admin-bar-new-content',
126
+