PluginProbe
FV Player 8 / 8.1
FV Player 8 v8.1
trunk 8.0.18 8.0.19 8.0.20 8.0.21 8.0.25 8.0.27 8.1 8.1.3
fv-player / view / wizard.php

wizard.php in FV Player 8 8.1, at view/wizard.php

933 lines 40.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 /* FV Player - HTML5 video player with Flash fallback
8 Copyright (C) 2016 Foliovision
9
10 This program is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24 global $fv_wp_flowplayer_ver, $fv_fp;
25 global $post;
26 $post_id = isset($post->ID) ? $post->ID : 0;
27
28 $script_fv_player_editor_defaults = array();
29
30 $script_fv_player_editor_fields = array();
31 $script_fv_player_editor_fields_with_language = array();
32
33 $fv_flowplayer_conf = get_option( 'fvwpflowplayer' );
34
35 function fv_flowplayer_admin_select_popups() {
36 $aPopupData = get_option('fv_player_popups');
37
38 $aPopups = array(
39 array( '' , 'Use site default' ),
40 array( 'no' , 'None' ),
41 array( 'random' , 'Random')
42 );
43
44 if( !empty($aPopupData) && is_array($aPopupData) ) {
45 foreach( $aPopupData AS $key => $aPopupAd ) {
46 $value = !empty($aPopupAd['name']) ? $aPopupAd['name'] : 'Popup - ' . $key;
47
48 if( $aPopupAd['disabled'] == 1 ) $value .= ' (currently disabled)';
49
50 $aPopups[] = array( $key , $value );
51 }
52 }
53
54 return $aPopups;
55 }
56
57 function fv_player_email_lists() {
58 $rawLists = get_option('fv_player_email_lists');
59 $aLists = array();
60
61 foreach($rawLists as $key => $val) {
62 if(!is_numeric($key)) continue;
63
64 $aLists[] = array( $key , (empty($val->name) ? "List " . $key : "$val->name" ) );
65 }
66
67 return $aLists;
68 }
69
70 function fv_player_shortcode_row( $args ) {
71 $fv_flowplayer_conf = get_option( 'fvwpflowplayer' );
72 $args = wp_parse_args( $args, array(
73 'class' => false,
74 'dropdown' => array( 'Default', 'On', 'Off' ),
75 'id' => false,
76 'label' => '',
77 'name' => '',
78 'playlist_label' => false,
79 ) );
80 extract($args);
81
82 $class .= !isset($fv_flowplayer_conf["interface"][$name]) || $fv_flowplayer_conf["interface"][$name] !== 'true' ? ' fv_player_interface_hide' : '';
83 ?>
84 <tr<?php echo $id ? ' id="' . esc_attr( $id ) . '"' : ''; echo $class ? ' class="' . esc_attr( $class ) . '"' : ''; ?>>
85 <th scope="row" class="label">
86 <label for="fv_wp_flowplayer_field_<?php echo esc_attr( $name ); ?>" class="alignright" <?php echo $playlist_label ? ' data-playlist-label="' . esc_attr( $playlist_label ) . '" data-single-label="' . esc_attr( $label ) . '"' : ''; ?>>
87 <?php echo wp_strip_all_tags( $label ); ?>
88 </label>
89 </th>
90 <td class="field">
91 <select id="fv_wp_flowplayer_field_<?php echo esc_attr( $name ); ?>" name="fv_wp_flowplayer_field_<?php echo esc_attr( $name ); ?>">
92 <?php foreach( $dropdown AS $option ) : ?>
93 <?php if( is_array($option) ) : ?>
94 <option value="<?php echo esc_attr( $option[0] ); ?>"><?php echo wp_strip_all_tags( $option[1] ); ?></option>
95 <?php else : ?>
96 <option><?php echo wp_strip_all_tags( $option ); ?></option>
97 <?php endif; ?>
98 <?php endforeach; ?>
99 </select>
100 </td>
101 </tr>
102 <?php
103 }
104
105 // TODO: How to actually assign any action to this?
106 function fv_player_editor_button( $args ) {
107 extract($args);
108 ?>
109 <div<?php echo $id ? ' id="' . esc_attr( $id ) . '"' : ''; ?> class="components-base-control__field">
110 <a class="components-button is-secondary" id="fv_wp_flowplayer_field_<?php echo esc_attr( $name ); ?>"><?php echo wp_strip_all_tags( $label ); ?></a>
111 </div>
112 <?php
113 }
114
115 function fv_player_editor_checkbox( $args ) {
116 extract($args);
117 ?>
118 <div<?php echo $id ? ' id="' . esc_attr( $id ) . '"' : ''; ?> class="components-base-control__field">
119 <span class="components-form-toggle<?php /*if( $default ) echo ' is-checked';*/ ?>">
120 <input class="components-form-toggle__input<?php if( $no_data ) echo ' no-data'; ?>" type="checkbox" aria-describedby="inspector-toggle-control-0__help" id="fv_wp_flowplayer_field_<?php echo esc_html( $name ); ?>" name="fv_wp_flowplayer_field_<?php echo esc_html( $name ); ?>" />
121 <span class="components-form-toggle__track"></span>
122 <span class="components-form-toggle__thumb"></span>
123 </span>
124 <label for="inspector-toggle-control-0" class="components-toggle-control__label"><?php echo wp_strip_all_tags( $label ); ?></label>
125 </div>
126 <?php
127 }
128
129 function fv_player_editor_numfield( $args ) {
130 extract($args);
131
132 $field_id = 'fv_wp_flowplayer_field_' . esc_attr( $name );
133 ?>
134 <div<?php echo $id ? ' id="' . esc_attr( $id ) . '"' : ''; ?> class="components-base-control">
135 <label class="components-base-control__label" for="<?php echo esc_attr( $field_id ); ?>"><?php echo esc_html( $label ); ?></label>
136 <div class="components-base-control__field">
137 <input class="components-text-control__input" type="number" id="<?php echo esc_attr( $field_id ); ?>" name="<?php echo esc_attr( $field_id ); ?>" />
138 </div>
139 </div>
140 <?php
141 }
142
143 function fv_player_editor_select( $args ) {
144 extract($args);
145
146 $field_id = 'fv_wp_flowplayer_field_' . esc_attr( $name );
147 ?>
148 <div<?php echo $id ? ' id="' . esc_attr( $id ) . '"' : ''; ?> class="components-base-control__field">
149 <div class="components-flex components-select-control">
150 <div class="components-flex__item">
151 <label for="<?php echo esc_attr( $field_id ); ?>" class="components-input-control__label"><?php echo esc_html( $label ); ?></label>
152 </div>
153 <div class="components-input-control__container">
154 <select class="components-select-control__input" id="<?php echo esc_attr( $field_id ); ?>" name="<?php echo esc_attr( $field_id ); ?>" <?php if( $multiple ) echo 'multiple'; ?>>
155 <?php foreach( $options AS $option ) : ?>
156 <?php if( is_array($option) ) : ?>
157 <option value="<?php echo esc_attr( $option[0] ); ?>"><?php echo esc_html( $option[1] ); ?></option>
158 <?php else : ?>
159 <option><?php echo esc_html( $option ); ?></option>
160 <?php endif; ?>
161 <?php endforeach; ?>
162 </select>
163
164 </div>
165 </div>
166 </div>
167 <?php
168 }
169
170 function fv_player_editor_textarea( $args ) {
171 extract($args);
172
173 $field_id = 'fv_wp_flowplayer_field_' . esc_attr( $name );
174 ?>
175 <div<?php echo $id ? ' id="' . esc_attr( $id ) . '"' : ''; ?> class="components-base-control">
176 <label class="components-base-control__label" for="<?php echo esc_attr( $field_id ); ?>"><?php echo esc_html( $label ); ?></label>
177 <div class="components-base-control__field">
178 <textarea class="components-textarea-control__input" type="text" id="<?php echo esc_attr( $field_id ); ?>" name="<?php echo esc_attr( $field_id ); ?>" rows="4"></textarea>
179 </div>
180 </div>
181 <?php
182 }
183
184 function fv_player_editor_textfield( $args ) {
185 extract($args);
186
187 $field_id = 'fv_wp_flowplayer_field_' . esc_attr( $name );
188 ?>
189 <div<?php echo $id ? ' id="' . esc_attr( $id ) . '"' : ''; ?> class="components-base-control">
190 <label class="components-base-control__label" for="<?php echo esc_attr( $field_id ); ?>"><?php echo esc_html( $label ); ?></label>
191 <div class="components-base-control__field">
192 <?php if( $language ): ?>
193 <div class="field-with-language">
194 <?php // We use a simple input field here, but it will be upgraded to a select box with all the languages in JavaScript ?>
195 <input type="text" class="<?php echo esc_attr( $field_id ); ?>_lang" name="<?php echo esc_attr( $field_id ); ?>_lang" />
196 <?php endif; ?>
197
198 <?php if($browser):?>
199 <div class="fv_player_editor_url_shortened" id="<?php echo "fv_player_editor_url_field_" . esc_attr( $name ) ; ?>">
200 <span class="link-preview"></span>
201 <span class="dashicons dashicons-edit"></span>
202 </div>
203 <?php endif; ?>
204
205 <input class="<?php if($browser) echo "fv_player_interface_hide fv_player_editor_url_field "; ?>components-text-control__input" type="text" id="<?php echo esc_attr( $field_id ); ?>" name="<?php echo esc_attr( $field_id ); ?>" />
206
207 <?php if( $language ) : ?>
208 </div><!-- /.field-with-language-->
209 <?php endif; ?>
210
211 <?php if( $browser ) : ?>
212 <a class="components-button is-secondary add_media" href="#" data-target="<?php echo esc_attr( $field_id ); ?>"><?php esc_html_e('Add from media library', 'fv_flowplayer'); ?></a>
213 <?php endif; ?>
214
215 <?php if( $language ) : ?>
216 <a class="remove_language" href="#" data-field_name="<?php echo esc_attr( $name ); ?>" data-field_label="<?php echo $label_signular ? esc_attr( $label_signular ) : esc_attr( $label ); ?>"><span class="dashicons dashicons-trash"></span></a>
217 <?php endif; ?>
218 </div>
219
220 <?php if( $language ) : ?>
221 <a class="components-button is-secondary add_language" href="#" data-field_name="<?php echo esc_attr( $name ); ?>"><?php esc_html_e('Add Another Language', 'fv_flowplayer'); ?></a>
222 <?php endif; ?>
223
224 </div>
225 <?php
226 }
227
228 function fv_player_editor_hidden( $args ) {
229 extract($args);
230
231 if( $id ) {
232 $field_id = $id;
233 } else {
234 $field_id = 'fv_wp_flowplayer_field_' . esc_attr( $name );
235 }
236
237 ?>
238 <input type="hidden" id="<?php echo esc_attr( $field_id ); ?>" name="<?php echo esc_attr( $field_id ); ?>"/>
239 <?php
240 }
241
242 function fv_player_editor_notice_info( $args ) {
243 extract($args);
244
245 $field_class = 'fv_wp_flowplayer_field_' . esc_attr( $name );
246
247 ?>
248 <div<?php echo $id ? ' id="' . esc_attr( $id ) . '"' : ''; ?> class="components-base-control">
249 <div class="components-base-control__field">
250 <div class="<?php echo esc_attr( $field_class ); ?>">
251 <?php echo $content; // TODO: use wp_kses() allowing <select> and <option> ?>
252 </div>
253 </div>
254 </div>
255 <?php
256 }
257
258 function fv_player_editor_input( $args, $is_child = false ) {
259 global $script_fv_player_editor_fields, $script_fv_player_editor_fields_with_language;
260
261 $args = wp_parse_args(
262 $args,
263 array(
264 'browser' => false,
265 'children' => false,
266 'class' => false,
267 'content' => false,
268 'default' => false,
269 'dependencies' => false,
270 'dropdown' => array( 'Default', 'On', 'Off' ),
271 'id' => false,
272 'label' => '',
273 'label_signular' => '',
274 'multiple' => false, // applies to type = select
275 'name' => '',
276 'no_data' => false, // do not save any data based on this input
277 'options' => array(),
278 'playlist_label' => false,
279 'scope' => false,
280 'language' => false,
281 'type' => false,
282 'player_meta' => false,
283 'video_meta' => false,
284 'visible' => false,
285 'width' => false,
286 )
287 );
288
289 extract($args);
290
291 if ( ! isset( $script_fv_player_editor_fields[ $name ] ) ) {
292 $script_fv_player_editor_fields[ $name ] = array();
293 }
294
295 if ( $player_meta ) {
296 $script_fv_player_editor_fields[ $name ]['store'] = 'player_meta';
297 }
298
299 if ( $video_meta ) {
300 $script_fv_player_editor_fields[ $name ]['store'] = 'video_meta';
301 }
302
303 // This tells JavaScript to upgrade the text input to a select box with all the languages
304 if ( $language ) {
305 $script_fv_player_editor_fields_with_language[] = $name;
306 }
307
308 if( !empty($dependencies) ) {
309 global $script_fv_player_editor_dependencies;
310
311 foreach( $dependencies AS $parent => $value ) {
312 if( empty($script_fv_player_editor_dependencies[$parent]) ) {
313 $script_fv_player_editor_dependencies[$parent] = array();
314 }
315 if( empty($script_fv_player_editor_dependencies[$parent][$value]) ) {
316 $script_fv_player_editor_dependencies[$parent][$value] = array();
317 }
318 $script_fv_player_editor_dependencies[$parent][$value][] = $name;
319 }
320 }
321
322
323
324 if( !$visible ) {
325 $class .= ' fv_player_interface_hide';
326 }
327
328 if ( $width && in_array( $width, array( 'half' ) ) ) {
329 $class .= ' fv-player-editor-field-' . esc_attr( $width );
330 }
331
332 if( $scope == 'playlist' ) {
333 $class .= ' hide-if-singular';
334 }
335
336 // TODO: Not needed?
337 $playlist_label = $playlist_label ? ' data-playlist-label="' . esc_attr( $playlist_label ) . '" data-single-label="' . esc_attr( $label ) . '"' : '';
338
339 if( !$is_child ) {
340 $class .= ' components-base-control';
341 }
342
343 if( $children ) {
344 $class .= ' fv-player-editor-children-wrap';
345 }
346
347 ?>
348 <div class="fv-player-editor-field-wrap-<?php echo esc_attr( $name ); ?><?php echo esc_attr( $class ); ?>">
349 <?php
350
351 if( !$type || $type == 'checkbox' ) {
352 fv_player_editor_checkbox( $args );
353 } else if( $type == 'text' ) {
354 fv_player_editor_textfield( $args );
355 } else if( $type == 'number' ) {
356 fv_player_editor_numfield( $args );
357 } else if( $type == 'select' ) {
358 fv_player_editor_select( $args );
359 } else if( $type == 'button' ) {
360 fv_player_editor_button( $args );
361 } else if( $type == 'textarea' ) {
362 fv_player_editor_textarea( $args );
363 } else if( $type == 'hidden' ) {
364 fv_player_editor_hidden( $args );
365 } else if( $type == 'notice_info' ) {
366 fv_player_editor_notice_info( $args );
367 }
368
369 if( !empty($args['description']) ) : ?>
370 <p class="components-form-token-field__help"><?php echo wp_kses_post( $args['description'] ); ?></p>
371 <?php endif;
372
373 if( $children ) : ?>
374 <div class="fv-player-editor-field-children-<?php echo esc_attr( $name ); ?>" style="display: none">
375 <?php
376 foreach( $children AS $child_input ) {
377 fv_player_editor_input( $child_input, true );
378 }
379 ?>
380 </div>
381 <?php endif; ?>
382 </div>
383 <?php
384 }
385
386 function fv_player_editor_input_group( $settings ) {
387 global $script_fv_player_editor_defaults;
388
389 // Check if the field is enabled in Post Interface Options
390 $conf = get_option( 'fvwpflowplayer' );
391
392 foreach( $settings AS $group => $group_options ) {
393 $group_options = wp_parse_args( $group_options, array(
394 'sort' => true,
395 ) );
396
397 // Determine if each field should be shown
398 // and if there is anything to show at all in this group
399 $have_visible_setting = false;
400 foreach( $group_options['items'] AS $k => $v ) {
401 if( isset($conf["interface"][$v['name']]) &&
402 $conf["interface"][$v['name']] == 'true' ) {
403 $group_options['items'][$k]['visible'] = true;
404 $have_visible_setting = true;
405 }
406
407 if( !empty($v['visible']) ) {
408 $have_visible_setting = true;
409 }
410 }
411
412 $class = $have_visible_setting ? 'is-open' : 'fv_player_interface_hide';
413
414 echo "<div class='fv_player_editor-panel__body fv-player-editor-options-" . esc_attr( $group ) . " " . esc_attr( $class ) . "'>\n";
415
416 if( !empty($group_options['label']) ) {
417 echo "<h2 class='fv_player_editor-panel__body-title'><button type='button' aria-expanded='true' class='components-button fv_player_editor-panel__body-toggle'>" . esc_html( $group_options['label'] ) . "</button></h2>\n";
418 }
419
420 if( $group_options['sort'] ) {
421 usort( $group_options['items'], 'fv_player_editor_input_sort' );
422 }
423
424 echo "<div class='fv-fv_player_editor-panel__body-content'>\n";
425
426 foreach( $group_options['items'] AS $input ) {
427 if( isset($input['default']) ) {
428 $script_fv_player_editor_defaults[$input['name']] = $input['default'];
429 }
430
431 fv_player_editor_input( $input );
432
433 }
434
435 echo "</div><!-- .fv-fv_player_editor-panel__body-content -->\n";
436 echo "</div><!-- .fv_player_editor-panel__body -->\n";
437 }
438 }
439
440 // Sort inputs alphabetically, but the one with sticky always wins
441 function fv_player_editor_input_sort( $a, $b ) {
442 if( !empty($a["sticky"]) ) {
443 return -1;
444 }
445 return strnatcasecmp($a["label"], $b["label"]);
446 }
447
448 $fv_flowplayer_helper_tag = ( is_plugin_active('jetpack/jetpack.php') ) ? 'b' : 'span';
449 ?>
450
451 <script>
452 var fvwpflowplayer_helper_tag = '<?php echo esc_html( $fv_flowplayer_helper_tag ) ?>';
453 var fv_wp_flowplayer_re_edit = /\[[^\]]*?<<?php echo esc_html( $fv_flowplayer_helper_tag ); ?>[^>]*?rel="FCKFVWPFlowplayerPlaceholder"[^>]*?>.*?<\/<?php echo esc_html( $fv_flowplayer_helper_tag ); ?>>.*?[^\\]\]/mi;
454 var fv_wp_flowplayer_re_insert = /<<?php echo esc_html( $fv_flowplayer_helper_tag ); ?>[^>]*?rel="FCKFVWPFlowplayerPlaceholder"[^>]*?>.*?<\/<?php echo esc_html( $fv_flowplayer_helper_tag ); ?>>/gi;
455 var fv_flowplayer_set_post_thumbnail_id = <?php echo intval( $post_id ); ?>;
456 var fv_flowplayer_set_post_thumbnail_nonce = '<?php echo wp_create_nonce( "set_post_thumbnail-" . intval( $post_id ) ); ?>';
457 var fv_flowplayer_preview_nonce = '<?php echo wp_create_nonce( "fv-player-preview" ); ?>';
458 var fv_Player_site_base = '<?php echo home_url('/') ?>';
459 </script>
460
461 <div id="fv-player-editor-backdrop" style="display: none">
462 </div>
463 <div id="fv-player-editor-modal" style="display: none">
464
465 <div id="fv-player-shortcode-editor"<?php if( did_action('elementor/editor/wp_head') ) echo ' class="wp-core-ui"'; // when using Elementor we need to add this class to ensure proper button styling ?> style="display: none">
466
467 <input type="hidden" id="fv_wp_flowplayer_field_post_id" name="fv_wp_flowplayer_field_post_id" value="<?php echo get_the_ID(); ?>" />
468
469 <div id="fv-player-editor-loading-overlay" class="fv-player-editor-overlay">
470 </div>
471
472 <div id="fv-player-editor-message-overlay" class="fv-player-editor-overlay">
473 <p></p>
474 </div>
475
476 <div id="fv-player-editor-copy_player-overlay" class="fv-player-editor-overlay media-frame hide-menu">
477 <div class="wp-core-ui media-frame-content attachments-browser">
478 <div class="media-toolbar">
479 <div class="media-toolbar-primary search-form">
480 <input type="search" placeholder="Search videos or playlists" class="search" name="players_selector" >
481 </div>
482 </div>
483
484 <ul class="attachments"></ul>
485
486 <div class="media-sidebar">
487 <div class="attachment-details" style="display: none">
488 <h2>Player Details</h2>
489 <div class="attachment-info">
490 <div class="details">
491 <div class="filename"></div>
492 <div class="uploaded"></div>
493 </div>
494 </div>
495
496 <h2>Videos</h2>
497 <div class="videos-list"></div>
498
499 <h2>Embedded on</h2>
500 <div class="posts-list"></div>
501
502 </div>
503 </div>
504 </div>
505 <div class="media-frame-toolbar">
506 <div class="media-toolbar">
507 <div class="media-toolbar-secondary"></div>
508 <div class="media-toolbar-primary search-form">
509 <button type="button" class="button media-button button-primary button-large media-button-select" disabled>Choose</button>
510 </div>
511 </div>
512 </div>
513 </div>
514
515 <div id="fv-player-editor-import-overlay" class="fv-player-editor-overlay">
516 <textarea name="fv_player_import_data" id="fv_player_import_data" rows="13" placeholder="Paste your FV Player Export JSON data here"></textarea>
517 <br />
518 <br />
519 <a id="fv-player-editor-import-overlay-import" href="#" class="button button-primary">Import player</a>
520 <div class="fv-player-editor-overlay-notice"></div>
521 </div>
522
523 <div id="fv-player-editor-export-overlay" class="fv-player-editor-overlay">
524 <textarea name="fv_player_copy_to_clipboard" rows="13"></textarea>
525 <br />
526 <br />
527 <a data-fv-player-editor-export-overlay-copy href="#" class="button button-primary">Copy To Clipboard</a>
528 <div class="fv-player-editor-overlay-notice"></div>
529 </div>
530
531 <div id="fv-player-editor-error_saving-overlay" class="fv-player-editor-overlay">
532 <p data-error></p>
533 <p>An unexpected error has occurred. Please copy the player raw data below and <a href="https://foliovision.com/support/fv-wordpress-flowplayer/bug-reports#new-post" target="_blank">submit a support ticket to Foliovision</a></p>
534 <textarea name="fv_player_copy_to_clipboard" rows="15"></textarea>
535 <br />
536 <br />
537 <a data-fv-player-editor-export-overlay-copy href="#" class="button button-primary">Copy To Clipboard</a>
538 <div class="fv-player-editor-overlay-notice"></div>
539 </div>
540
541 <div id="fv-player-editor-modal-top">
542 <h1>FV Player</h1>
543 <button type="button" id="fv-player-editor-modal-close">close</button>
544 </div>
545
546 <div id="fv-player-shortcode-editor-left">
547 <div id="fv-player-shortcode-editor-preview">
548 <div id="fv-player-shortcode-editor-preview-spinner" class="fv-player-shortcode-editor-helper"></div>
549 <div id="fv-player-shortcode-editor-preview-no" class="fv-player-shortcode-editor-helper">
550 <p><?php esc_html_e( 'Add your video', 'fv-player' ); ?></p>
551 <div class="components-base-control__field">
552 <input class="components-text-control__input" type="text" placeholder="Paste a link to a new video." name="hero-src" /> or
553 <button type="button" class="browser button button-hero" style="position: relative; z-index: 1;">Choose from <?php echo get_bloginfo(); ?>'s library</button>
554 </div>
555 <div class="fv-player-editor-notice notice-url-format" style="display: none"><?php esc_html_e( 'This does not look like a video link.', 'fv-player' ); ?></div>
556 </div>
557 <div id="fv-player-shortcode-editor-preview-new-tab" class="fv-player-shortcode-editor-helper">
558 <a class="button" href="" target="_blank"><?php esc_html_e( 'Playlist too long, click here for preview', 'fv-player' ); ?></a>
559 </div>
560 <div id="fv-player-shortcode-editor-preview-target"></div>
561 </div>
562 </div>
563 <div id="fv-player-shortcode-editor-right">
564 <input type="text" class="hide-if-playlist hide-if-singular" name="fv_wp_flowplayer_field_player_name" id="fv_wp_flowplayer_field_player_name" placeholder="Playlist name" /> <span id="player_id_top_text"></span>
565 <div class="fv-player-tabs-header">
566 <h2 class="fv-player-playlist-item-title nav-tab nav-tab-active"></h2>
567 <h2 class="nav-tab-wrapper hide-if-no-js">
568 <a href="#" class="nav-tab hide-if-singular hide-if-playlist" style="outline: 0;" data-tab="fv-player-tab-playlist"><?php esc_html_e( 'Playlist', 'fv-player' ); ?></a>
569 <a href="#" class="nav-tab nav-tab-active hide-if-playlist-active" style="outline: 0;" data-tab="fv-player-tab-video-files"><?php esc_html_e( 'Video', 'fv-player' ); ?></a>
570 <a href="#" class="nav-tab hide-if-playlist-active" style="outline: 0;" data-tab="fv-player-tab-subtitles"><?php esc_html_e( 'Subtitles', 'fv-player' ); ?></a>
571 <a href="#" class="nav-tab hide-if-playlist" style="outline: 0;" data-tab="fv-player-tab-options"><?php esc_html_e( 'Options', 'fv-player' ); ?></a>
572 <a href="#" class="nav-tab hide-if-playlist" style="outline: 0;" data-tab="fv-player-tab-actions"><?php esc_html_e( 'Actions', 'fv-player' ); ?></a>
573 <a href="#" class="nav-tab" style="outline: 0;" data-tab="fv-player-tab-embeds"><?php esc_html_e( 'Embeds', 'fv-player' ); ?></a>
574 <?php do_action('fv_player_shortcode_editor_tab'); ?>
575 </h2>
576 </div>
577 <div class="fv-player-tabs">
578
579 <div class="fv-player-tab fv-player-tab-playlist">
580 <div id="fv-player-editor-playlist">
581 <div class="fv-player-editor-playlist-item">
582 <div class="fv-player-editor-playlist-move">
583 <span class="fv-player-editor-playlist-move-up dashicons dashicons-arrow-up-alt2"></span>
584 <span class="fv-player-editor-playlist-move-handle"></span>
585 <span class="fv-player-editor-playlist-move-down dashicons dashicons-arrow-down-alt2"></span>
586 </div>
587 <a class="fvp_item_video-thumbnail"></a>
588 <div class="fvp_item_video-title-wrap">
589 <span class="fvp_item_video-filename"></span>
590 <a class="configure-video" href="#">Configure video</a>
591 </div>
592 <input class="fvp_item_video-edit-input" type="text" style="display: none;">
593 <span class="fvp_item_video-duration"></span>
594 <a class="fvp_item_remove" href="#"><span class="dashicons dashicons-trash"></span></a>
595 </div>
596 </div>
597 <div id="playlist-hero" style="display: none">
598 <div class="components-base-control__field">
599 <input class="components-text-control__input" type="text" placeholder="Paste a link to a new video." name="hero-src" data-playlist-hero="true" />
600 <button type="button" class="browser button button-hero" style="position: relative; z-index: 1;" data-playlist-hero="true">Choose from <?php echo get_bloginfo(); ?>'s library</button>
601 <div class="fv-player-editor-notice notice-url-format" style="display: none"><?php esc_html_e( 'This does not look like a video link.', 'fv-player' ); ?></div>
602 <div class="fv-player-editor-notice notice-use-ui" style="display: none"><?php esc_html_e( 'Please post a link to the new video or choose one.', 'fv-player' ); ?></div>
603 </div>
604 </div>
605 <a class="playlist_add" data-html="+" data-alt-html="&#10140;">+</a>
606
607 </div>
608
609 <div class="fv-player-tab fv-player-tab-video-files">
610 <div class="fv-player-playlist-item" data-playlist-item data-index="0">
611 <?php
612 fv_player_editor_input_group( fv_player_editor_video_fields() );
613
614 // Legacy
615 echo "<div class='fv_player_editor-panel__body fv-player-editor-legacy'>\n";
616
617 // TODO: Will these still actually work?
618 do_action('fv_flowplayer_shortcode_editor_before');
619 do_action('fv_flowplayer_shortcode_editor_item_after');
620
621 echo "</div>\n";
622 ?>
623 </div>
624 </div>
625
626 <div class="fv-player-tab fv-player-tab-subtitles" style="display: none">
627 <div class="fv-player-playlist-item" data-playlist-item data-index="0">
628
629 <?php
630 fv_player_editor_input_group( fv_player_editor_subtitle_fields() );
631
632 // Legacy
633 echo "<div class='fv_player_editor-panel__body fv-player-editor-legacy'>\n";
634
635 // TODO: Will these still actually work?
636 do_action('fv_flowplayer_shortcode_editor_subtitles_tab_prepend');
637 do_action('fv_flowplayer_shortcode_editor_subtitles_tab_append');
638
639 echo "</div>\n";
640 ?>
641
642 </div>
643 </div>
644
645 <div class="fv-player-tab fv-player-tab-options" style="display: none">
646 <?php
647 $player_options = apply_filters('fv_player_editor_player_options', array(
648 'general' => array(
649 'label' => __( 'Appearance', 'fv-player' ),
650 'items' => array(
651 array(
652 'label' => __( 'Autoplay', 'fv-player' ),
653 'name' => 'autoplay',
654 'description' => __( 'Video will autoplay when it\'s in browser viewport.', 'fv-player' ),
655 'default' => in_array( $fv_fp->_get_option('autoplay_preload'), array( 'sticky', 'viewport' ) ),
656 'children' => array(
657 array(
658 'label' => __( 'Muted Autoplay', 'fv-player' ),
659 'name' => 'autoplay_muted'
660 ), // TODO: Save properly
661 )
662 ),
663 /*array(
664 'label' => __( 'Player Alignment', 'fv-player' ),
665 'name' => 'align',
666 'description' => __( 'Allows the article text to wrap around the player.', 'fv-player' ),
667 'children' => array(
668 array(
669 'label' => __( 'Position', 'fv-player' ),
670 'name' => 'align',
671 'options' => array(
672 'Left',
673 'Right',
674 'Centered'
675 ),
676 'type' => 'select'
677 ),
678 array(
679 'label' => __( 'Width', 'fv-player' ),
680 'name' => 'lightbox_width',
681 'type' => 'number'
682 )
683 )
684 ),*/
685 array(
686 'label' => __( 'Playlist Auto Advance', 'fv-player' ),
687 'name' => 'playlist_advance',
688 'default' => !$fv_fp->_get_option('playlist_advance'),
689 'scope' => 'playlist'
690 ),
691 array(
692 'label' => __( 'Playlist Style', 'fv-player' ),
693 'name' => 'playlist',
694 'dependencies' => array( 'lightbox' => false ),
695 'options' => array(
696 array( '', 'Default' ),
697 array( 'horizontal', 'Horizontal' ),
698 array( 'tabs', 'Tabland' ),
699 array( 'prevnext', 'Big arrows (deprecated)' ),
700 array( 'vertical', 'Vertical' ),
701 array( 'slider', 'Scrollslider' ),
702 array( 'season', 'Episodes' ),
703 array( 'polaroid', 'Polaroid' ),
704 array( 'text', 'Text' ),
705 array( 'version-one', 'Sliderland' ),
706 array( 'version-two', 'Sliderbar' ),
707 ),
708 'scope' => 'playlist',
709 'type' => 'select',
710 ),
711 array(
712 'label' => __( 'Sticky video', 'fv-player' ),
713 'name' => 'sticky',
714 'description' => __( 'Watch the playing video when scrolling down the page.', 'fv-player' ),
715 'default' => in_array( $fv_fp->_get_option('sticky_video'), array( 'desktop', 'all' ) ),
716 'dependencies' => array( 'lightbox' => false )
717 )
718 )
719 ),
720 'controls' => array(
721 'label' => __( 'Controls', 'fv-player' ),
722 'items' => array(
723 array(
724 'label' => __( 'Controlbar', 'fv-player' ),
725 'name' => 'controlbar',
726 'description' => __( 'Without the controlbar seeking in video is impossible.', 'fv-player' ),
727 'default' => true,
728 'sticky' => true
729 ),
730 array(
731 'label' => __( 'LMS | Teaching', 'fv-player' ),
732 'name' => 'lms_teaching',
733 'description' => __( 'Seeking forward not allowed if user did not see the full video.', 'fv-player' ),
734 'dependencies' => array( 'controlbar' => true )
735 ),
736 array(
737 'label' => __( 'Speed Buttons', 'fv-player' ),
738 'name' => 'speed',
739 'description' => __( 'Allows user to speed up or slow down the video.', 'fv-player' ),
740 'default' => $fv_fp->_get_option('ui_speed'),
741 'dependencies' => array( 'controlbar' => true )
742 )
743 )
744 ),
745 'header' => array(
746 'label' => __( 'Sharing', 'fv-player' ),
747 'items' => array(
748 array(
749 'label' => __( 'Embedding', 'fv-player' ),
750 'name' => 'embed',
751 'description' => __( 'Allows users to embed your player on their websites.', 'fv-player' ),
752 'default' => $fv_fp->_get_option( 'ui_embed' )
753 ),
754 array(
755 'label' => __( 'Sharing Buttons', 'fv-player' ),
756 'name' => 'share',
757 'description' => __( 'Provides a quick way of sharing your article on Facebook, Twitter or via Email.', 'fv-player' ),
758 'default' => $fv_fp->_get_option( 'ui_sharing' )
759 ), // TODO: Custom URL setting
760 )
761 )
762 ));
763
764 fv_player_editor_input_group( $player_options );
765 ?>
766
767 <table width="100%">
768 <tr id="fv_wp_flowplayer_field_share_custom" style="display: none">
769 <th scope="row" class="label"><label for="fv_wp_flowplayer_field_lightbox" class="alignright">Sharing Properties</label></th>
770 <td class="field">
771 <input type="text" id="fv_wp_flowplayer_field_share_url" name="fv_wp_flowplayer_field_share_url" style="width: 49%" placeholder="URL" />
772 <input type="text" id="fv_wp_flowplayer_field_share_title" name="fv_wp_flowplayer_field_share_title" style="width: 49%" placeholder="Title" />
773 </td>
774 </tr>
775
776
777 <?php do_action('fv_flowplayer_shortcode_editor_tab_options'); ?>
778 </table>
779 </div>
780
781 <div class="fv-player-tab fv-player-tab-actions" style="display: none">
782 <?php
783 $overlay_show_after = $fv_fp->_get_option('overlay_show_after');
784
785 $actions = array(
786 'actions' => array(
787 'items' => array(
788 array(
789 'label' => __( 'End of Video Action', 'fv-player' ),
790 'name' => 'toggle_end_action',
791 'description' => __( 'What should happen at the end of the video.', 'fv-player' ),
792 'children' => array(
793 array(
794 'label' => __( 'Pick the action', 'fv-player' ),
795 'name' => 'end_actions',
796 'options' => array(
797 array('', 'Default'),
798 array('no', 'Nothing'),
799 array('redirect', 'Redirect'),
800 array('loop', 'Loop'),
801 array('popup', 'Show popup'),
802 array('splashend', 'Show splash screen'),
803 array('email_list', 'Collect Emails')
804 ),
805 'type' => 'select',
806 'visible' => true
807 ),
808 array(
809 'label' => __( 'Redirect', 'fv-player' ),
810 'name' => 'redirect',
811 'type' => 'text'
812 ),
813 array(
814 'label' => __( 'Popup', 'fv-player' ),
815 'name' => 'popup_id',
816 'type' => 'select',
817 'options' => fv_flowplayer_admin_select_popups()
818 ),
819 array(
820 'label' => __( 'Email list', 'fv-player' ),
821 'name' => 'email_list',
822 'type' => 'select',
823 'options' => fv_player_email_lists()
824 ),
825 ),
826 'visible' => true
827 ),
828 array(
829 'label' => __( 'Show Overlay', 'fv-player' ),
830 'name' => 'toggle_overlay',
831 'description' => __( 'Enter text or HTML to show on top of video while it\'s playing.', 'fv-player' ),
832 'children' => array(
833 array(
834 'label' => __( 'Overlay Code', 'fv-player' ),
835 'name' => 'overlay',
836 'description' => $overlay_show_after ? sprintf( __( 'Shows after %d seconds.', 'fv-player' ), $overlay_show_after ) : false,
837 'type' => 'textarea',
838 'visible' => true
839 ),
840 array(
841 'label' => __( 'Width', 'fv-player' ),
842 'name' => 'overlay_width',
843 'type' => 'number',
844 'visible' => true
845 ),
846 array(
847 'label' => __( 'Height', 'fv-player' ),
848 'name' => 'overlay_height',
849 'type' => 'number',
850 'visible' => true
851 )
852 ),
853 'visible' => true,
854 'dependencies' => array( 'overlay_skip' => false )
855 ),
856 ),
857 'sort' => false
858 )
859 );
860
861 if( $fv_fp->_get_option('overlay') ) {
862 $actions['actions']['items'][] = array(
863 'label' => __( 'Do not show global overlay', 'fv-player' ),
864 'name' => 'overlay_skip',
865 'description' => sprintf( __( 'Use to disable overlay set in <a href="%s" target="_blank">Actions -> Overlays</a>', 'fv-player' ), admin_url('admin.php?page=fvplayer#postbox-container-tab_actions') ),
866 'visible' => true,
867 'dependencies' => array( 'toggle_overlay' => false )
868 );
869 }
870
871 $actions = apply_filters('fv_player_editor_actions', $actions );
872
873 fv_player_editor_input_group( $actions );
874
875 // Legacy
876 echo "<div class='fv_player_editor-panel__body fv-player-editor-legacy'>\n";
877
878 // TODO: Will these still actually work?
879 do_action('fv_flowplayer_shortcode_editor_after');
880 do_action('fv_flowplayer_shortcode_editor_tab_actions');
881
882 echo "</div>\n";
883 ?>
884
885 </div>
886
887 <div class="fv-player-tab fv-player-tab-embeds" style="display: none">
888 <p>This page shows you where else this player is used.</p>
889 <table width="100%">
890 <tr>
891 <th scope="row" class="label"><label for="fv_wp_flowplayer_field_embedded_on" class="alignright"><?php esc_html_e('Embedded on', 'fv_flowplayer'); ?></label></th>
892 <td></td>
893 </tr>
894 </table>
895 </div>
896
897 <?php do_action('fv_player_shortcode_editor_tab_content'); ?>
898
899 <div id="fv-player-editor-modal-bottom">
900 <a class="button-primary fv_player_field_insert-button"><?php esc_html_e('Insert', 'fv_flowplayer'); ?></a>
901 <a class="playlist_edit button hide-if-playlist-active" href="#" data-create="<?php esc_attr_e('Add another video into playlist', 'fv_flowplayer'); ?>" data-edit="<?php esc_attr_e('Back to playlist', 'fv_flowplayer'); ?>"><?php esc_html_e('Add another video into playlist', 'fv_flowplayer'); ?></a>
902
903 <?php
904 if( function_exists('get_current_screen') && current_user_can('edit_posts') ) :
905 $screen = get_current_screen();
906 if ( $screen->parent_base != 'fv_player' ) : ?>
907 <a class="copy_player button" href="#"><?php esc_html_e( 'Pick existing player', 'fv_flowplayer' ); ?></a>
908 <?php endif;
909 endif; ?>
910
911 </div>
912
913 </div>
914 <!--<div id="fv-player-tabs-debug"></div>-->
915 </div>
916
917 <div style="clear: both"></div>
918
919 <div id="fv-player-editor-notices"></div>
920 </div>
921 </div>
922
923 <?php
924 global $script_fv_player_editor_defaults, $script_fv_player_editor_dependencies, $script_fv_player_editor_fields, $script_fv_player_editor_fields_with_language;
925
926 echo "<script>var fv_player_editor_defaults = ".wp_json_encode($script_fv_player_editor_defaults)."</script>\n";
927 echo "<script>var fv_player_editor_dependencies = ".wp_json_encode($script_fv_player_editor_dependencies)."</script>\n";
928 echo "<script>var fv_player_editor_fields = ".wp_json_encode($script_fv_player_editor_fields)."</script>\n";
929
930 // This tells JavaScript to upgrade the text input to a select box with all the languages
931 echo "<script>var fv_player_editor_fields_with_language = ".wp_json_encode($script_fv_player_editor_fields_with_language)."</script>\n";
932 ?>
933