From 14949be5836cb210f8b35222fdfda8ba1dbade58 Mon Sep 17 00:00:00 2001 From: TheYurry Date: Thu, 12 Jan 2017 15:58:46 +0100 Subject: [PATCH 01/16] mess#1 --- models/flowplayer.php | 50 +++++++++++--- view/admin.php | 152 ++++++++++++++++++++++++++++++------------ 2 files changed, 151 insertions(+), 51 deletions(-) diff --git a/models/flowplayer.php b/models/flowplayer.php index 7940e89e8..8fde82b71 100644 --- a/models/flowplayer.php +++ b/models/flowplayer.php @@ -194,14 +194,7 @@ public function _set_conf() { $sKey = $aNewOptions['key']; if(isset($aNewOptions['popups'])){ - unset($aNewOptions['popups']['#fv_popup_dummy_key#']); - - foreach( $aNewOptions['popups'] AS $key => $value ) { - $aNewOptions['popups'][$key]['css'] = stripslashes($value['css']); - $aNewOptions['popups'][$key]['html'] = stripslashes($value['html']); - } - - update_option('fv_player_popups',$aNewOptions['popups']); + $this->popup_settings($aNewOptions['popups']); unset($aNewOptions['popups']); } @@ -244,6 +237,35 @@ public function _set_conf() { return true; } + + private function popup_settings($options) { + unset($options['#fv_popup_dummy_key#']); + $aPopupCss = get_option('fv_player_popups_css',array()); + + foreach( $options AS $key => $value ) { + //TODO:this + //$options[$key]['css'] = stripslashes($value['css']); + //$options[$key]['html'] = stripslashes($value['html']); + var_dump($value); + if($value['source'] === 'new'){ + $aPopupCss[] = array( + 'class' => $value['name'], + 'css' => $value['css'], + ); + update_option('fv_player_popups_css',$aPopupCss); + $keys = array_keys($aPopupCss); + $options['source'] = end($keys); + + }else if(empty($value['source']) || $value['source'] === 'default' || $value['source'] === 'old' || isset($aPopupCss[$value['source']])){ + + + } + + } + + update_option('fv_player_popups',$options); + + } /** * Salt function - returns pseudorandom string hash. * @return Pseudorandom string hash. @@ -253,7 +275,17 @@ public function _salt() { return $salt; } - +// public static function get_unique_key($key, $array_keys){ +// if(is_array($array_keys) && isset($array_keys[$key])){ +// $count = 1; +// if(preg_match('/-([0-9]*)$/',$key,$matches)){ +// $count = intval($matches[1]) + 1; +// } +// $key .= '-' . $count; +// } +// return $key; +// } +// private function build_playlist_html( $aArgs, $sSplashImage, $sItemCaption ){ if(isset($aArgs['liststyle']) && $aArgs['liststyle'] == 'vertical'){ diff --git a/view/admin.php b/view/admin.php index 76aa4d2db..a52ba3f56 100644 --- a/view/admin.php +++ b/view/admin.php @@ -845,38 +845,79 @@ function fv_flowplayer_admin_popups(){ array() ); } else { $aPopupData = array( '#fv_popup_dummy_key#' => array() ) + $aPopupData ; } - foreach ($aPopupData AS $key => $aPopup) { + + if(empty($aPopup['source']) && empty($aPopup['css']) || isset($aPopup['source']) && $aPopup['source'] === 'default'){ + $aPopup['source'] = 'default'; + }elseif( isset($aPopupCss[$aPopup['source']])){ + $aPopup['source'] = $aPopup['css']; + $aPopup['csstext'] = $aPopupCss[$aPopup['css']]; + }else{ + $aPopup['source'] = 'old'; + $aPopup['csstext'] = $aPopup['css']; + } ?> > - - - - - - - - - - - - - - -
' placeholder='' />
- - - - /> -
- - + + + + + + + + + + + + + + + + + + + + + + +
' placeholder='' />
+ +
' placeholder='' />
+ + + + /> +
+ + @@ -891,27 +932,54 @@ function fv_flowplayer_admin_popups(){ - - Date: Thu, 12 Jan 2017 17:26:16 +0100 Subject: [PATCH 02/16] somewhat working --- models/flowplayer.php | 29 ++++++---- view/admin.php | 120 ++++++++++++++++++++++-------------------- 2 files changed, 82 insertions(+), 67 deletions(-) diff --git a/models/flowplayer.php b/models/flowplayer.php index 8fde82b71..d0e0b6bd5 100644 --- a/models/flowplayer.php +++ b/models/flowplayer.php @@ -243,22 +243,29 @@ private function popup_settings($options) { $aPopupCss = get_option('fv_player_popups_css',array()); foreach( $options AS $key => $value ) { - //TODO:this - //$options[$key]['css'] = stripslashes($value['css']); - //$options[$key]['html'] = stripslashes($value['html']); - var_dump($value); - if($value['source'] === 'new'){ + //unset( $options[$key]['css_class']); + if(in_array($value['linked_css'], array('default','tw'))){ + $options['css'] = ''; + continue; + } + + + if($value['linked_css'] === 'new'){ $aPopupCss[] = array( - 'class' => $value['name'], + 'class' => $value['css_class'], 'css' => $value['css'], ); - update_option('fv_player_popups_css',$aPopupCss); - $keys = array_keys($aPopupCss); - $options['source'] = end($keys); - }else if(empty($value['source']) || $value['source'] === 'default' || $value['source'] === 'old' || isset($aPopupCss[$value['source']])){ - + $keys = array_keys($aPopupCss); + $options['linked_css'] = end($keys); + update_option('fv_player_popups_css',$aPopupCss); + }else if(isset($value['linked_css']) && isset($aPopupCss[$value['linked_css']])){ + $aPopupCss[] = array( + 'class' => $value['css_class'], + 'css' => $value['css'], + ); + update_option('fv_player_popups_css',$aPopupCss); } } diff --git a/view/admin.php b/view/admin.php index a52ba3f56..e9a38ebbb 100644 --- a/view/admin.php +++ b/view/admin.php @@ -846,7 +846,6 @@ function fv_flowplayer_admin_popups(){ array() ) + $aPopupData ; } + var_dump($aPopupData); foreach ($aPopupData AS $key => $aPopup) { - - if(empty($aPopup['source']) && empty($aPopup['css']) || isset($aPopup['source']) && $aPopup['source'] === 'default'){ - $aPopup['source'] = 'default'; - }elseif( isset($aPopupCss[$aPopup['source']])){ - $aPopup['source'] = $aPopup['css']; - $aPopup['csstext'] = $aPopupCss[$aPopup['css']]; - }else{ - $aPopup['source'] = 'old'; - $aPopup['csstext'] = $aPopup['css']; + if(empty($aPopup['linked_css']) && empty($aPopup['css']) || isset($aPopup['linked_css']) && $aPopup['linked_css'] === 'default'){ + $aPopup['linked_css'] = 'default'; + }elseif(!isset($aPopup['linked_css'])){ + + }elseif( isset($aPopupCss[$aPopup['linked_css']])){ + $aPopup['css'] = $aPopupCss[$aPopup['linked_css']]['css']; } ?> > @@ -884,17 +881,18 @@ function fv_flowplayer_admin_popups(){ - + + $val) { - ?> + foreach ($aPopupCss AS $popupCsskey => $val) { + ?> + - + @@ -902,12 +900,12 @@ function fv_flowplayer_admin_popups(){ - ' placeholder='' /> + ' placeholder='' /> - @@ -935,48 +933,58 @@ function fv_flowplayer_admin_popups(){ Date: Fri, 13 Jan 2017 14:42:23 +0100 Subject: [PATCH 03/16] simplification --- models/flowplayer.php | 45 ++++++++++++------------ view/admin.php | 80 ++++++++++++++++++++++++------------------- 2 files changed, 65 insertions(+), 60 deletions(-) diff --git a/models/flowplayer.php b/models/flowplayer.php index d0e0b6bd5..689e1398a 100644 --- a/models/flowplayer.php +++ b/models/flowplayer.php @@ -238,39 +238,36 @@ public function _set_conf() { return true; } - private function popup_settings($options) { - unset($options['#fv_popup_dummy_key#']); + private function popup_settings($aPopups) { + unset($aPopups['#fv_popup_dummy_key#']); $aPopupCss = get_option('fv_player_popups_css',array()); - foreach( $options AS $key => $value ) { - //unset( $options[$key]['css_class']); - if(in_array($value['linked_css'], array('default','tw'))){ - $options['css'] = ''; + foreach( $aPopups AS $key => $aPopupData ) { + + //unset( $aPopups[$key]['css_preset_name']); + $aPopups[$key]['css'] = stripslashes($aPopupData['css']); + $aPopups[$key]['html'] = stripslashes($aPopupData['html']); + + if(in_array($aPopupData['css_preset'], array('default','tw'))){ + $aPopups[$key]['css'] = ''; continue; } - - - if($value['linked_css'] === 'new'){ - $aPopupCss[] = array( - 'class' => $value['css_class'], - 'css' => $value['css'], - ); - - $keys = array_keys($aPopupCss); - $options['linked_css'] = end($keys); - update_option('fv_player_popups_css',$aPopupCss); + + + if(isset($aPopupData['css_preset']) && is_numeric($aPopupData['css_preset'])){ - }else if(isset($value['linked_css']) && isset($aPopupCss[$value['linked_css']])){ - $aPopupCss[] = array( - 'class' => $value['css_class'], - 'css' => $value['css'], + $aPopupCss[$aPopupData['css_preset']] = array( + 'name' => $aPopupData['css_preset_name'], + 'content' => trim($aPopupData['css_preset_content']), ); + $aPopups[$key]['css_preset'] = $aPopupData['css_preset']; update_option('fv_player_popups_css',$aPopupCss); } - + + } - - update_option('fv_player_popups',$options); + + update_option('fv_player_popups',$aPopups); } /** diff --git a/view/admin.php b/view/admin.php index e9a38ebbb..81792dbf3 100644 --- a/view/admin.php +++ b/view/admin.php @@ -846,25 +846,31 @@ function fv_flowplayer_admin_popups(){ array() ); } else { $aPopupData = array( '#fv_popup_dummy_key#' => array() ) + $aPopupData ; } - var_dump($aPopupData); + foreach ($aPopupData AS $key => $aPopup) { - if(empty($aPopup['linked_css']) && empty($aPopup['css']) || isset($aPopup['linked_css']) && $aPopup['linked_css'] === 'default'){ - $aPopup['linked_css'] = 'default'; - }elseif(!isset($aPopup['linked_css'])){ + $bShowOld = empty($aPopup['css_preset']) && !empty($aPopup['css']); + + - }elseif( isset($aPopupCss[$aPopup['linked_css']])){ - $aPopup['css'] = $aPopupCss[$aPopup['linked_css']]['css']; + if(isset($aPopup['css_preset']) && isset($aPopupCss[$aPopup['css_preset']])){ + $aPopup['css_preset_content'] = $aPopupCss[$aPopup['css_preset']]['content']; + $aPopup['css_preset_name'] = $aPopupCss[$aPopup['css_preset']]['name']; } + var_dump($aPopup); ?> > @@ -878,35 +884,40 @@ function fv_flowplayer_admin_popups(){ + + > + + + + - + - ' placeholder='' /> + - + @@ -935,6 +946,14 @@ function fv_flowplayer_admin_popups(){ ('use strict'); $(document).ready(function(){ + var maxIndex = 0; + $('.fv-player-popup-css-css_preset>option').each(function(){ + var tmp = $(this).val(); + if(!$.isNumeric(tmp)) + return; + maxIndex = Math.max(tmp,maxIndex); + }) + $('#fv-player-popups-add').click( function() { var fv_player_popup_index = (parseInt( $('#fv-player-popups-settings tr.data:last .id').html() ) || 0 ) + 1; $('#fv-player-popups-settings').append($('#fv-player-popups-settings tr.data:first').prop('outerHTML').replace(/#fv_popup_dummy_key#/gi,fv_player_popup_index + "")); @@ -952,37 +971,26 @@ function fv_flowplayer_admin_popups(){ return false; } ); - $(document).on('change','.fv-player-popup-css-linked_css',function(){ + $(document).on('change','.fv-player-popup-css-css_preset',function(){ var parent = $(this).parents('.fv-player-popup-formats'); if($(this).val() !== 'default' && $(this).val() !== 'tw'){ $('.fv-player-popup-css-new-css,.fv-player-popup-css-new-name',parent).show(); }else{ $('.fv-player-popup-css-new-css,.fv-player-popup-css-new-name',parent).hide(); } + if($(this).val() === 'new'){ + $(this).find('option[value=new]').attr('value', ++maxIndex); + } + var data = $(this).find('option[value=' + $(this).val() + ']').data('css'); //data = JSON.parse(data); if(typeof(data) !== 'undefined'){ - $('.fv-player-popup-css-css',parent).html(data.css); - $('.fv-player-popup-css-name',parent).val(data.class); + $('.fv-player-popup-css-css',parent).html(data.content); + $('.fv-player-popup-css-name',parent).val(data.name); } }); - $('.fv-player-popup-css-linked_css').trigger('change'); - - - $(document).on('input','.fv-player-popup-css-new-name > td > input',function(e){ - var parent = $(this).parents('.fv-player-popup-formats'); - - var selector = $(this).val().replace(/[!""#$%&'()\*\+,\./:;<=>\?@\[\\\]^`{\|}~ ]/ig,''); - - var oldClass = $(this).data('old'); - - var text = $('.fv-player-popup-css-new-css > td > textarea',parent).val().replace(new RegExp('^.fv-player-popup-' + oldClass), '.fv-player-popup-' + selector); - - $('.fv-player-popup-css-new-css > td > textarea',parent).val(text); - - $(this).data('old',selector); - }); + $('.fv-player-popup-css-css_preset').trigger('change'); }); }(jQuery)) From 3332ac89628a1467a2a5c9cc77d725a279ae2f8a Mon Sep 17 00:00:00 2001 From: TheYurry Date: Fri, 13 Jan 2017 14:56:07 +0100 Subject: [PATCH 04/16] beta --- view/admin.php | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/view/admin.php b/view/admin.php index 81792dbf3..aa1a2a830 100644 --- a/view/admin.php +++ b/view/admin.php @@ -851,7 +851,7 @@ function fv_flowplayer_admin_popups(){ $cssTextDefault = '.fv-player-popup-css-class{ color:awesome; }'; - $cssClassDefault = 'css-class'; + $cssClassDefault = 'My Cusom Style'; @@ -862,7 +862,7 @@ function fv_flowplayer_admin_popups(){ } foreach ($aPopupData AS $key => $aPopup) { - $bShowOld = empty($aPopup['css_preset']) && !empty($aPopup['css']); + $bShowLegacy = empty($aPopup['css_preset']) && !empty($aPopup['css']); @@ -885,12 +885,12 @@ function fv_flowplayer_admin_popups(){ - > + class="fv-player-popup-css-legacy"> - + > @@ -904,18 +904,18 @@ function fv_flowplayer_admin_popups(){ - - - + + + - + > - + > @@ -973,11 +973,18 @@ function fv_flowplayer_admin_popups(){ $(document).on('change','.fv-player-popup-css-css_preset',function(){ var parent = $(this).parents('.fv-player-popup-formats'); - if($(this).val() !== 'default' && $(this).val() !== 'tw'){ + if($(this).val() !== 'default' && $(this).val() !== 'tw' && $(this).val() !== 'legacy'){ $('.fv-player-popup-css-new-css,.fv-player-popup-css-new-name',parent).show(); }else{ $('.fv-player-popup-css-new-css,.fv-player-popup-css-new-name',parent).hide(); } + + if($(this).val() !== 'legacy'){ + $('.fv-player-popup-css-legacy',parent).hide(); + }else{ + $('.fv-player-popup-css-legacy',parent).show(); + } + if($(this).val() === 'new'){ $(this).find('option[value=new]').attr('value', ++maxIndex); } From ebe1270d06a60608a811f51c5ec6f5fe18a33c4c Mon Sep 17 00:00:00 2001 From: TheYurry Date: Fri, 13 Jan 2017 15:15:47 +0100 Subject: [PATCH 05/16] beta bugfixes --- models/flowplayer.php | 20 ++++++-------------- view/admin.php | 10 ++++------ 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/models/flowplayer.php b/models/flowplayer.php index 689e1398a..1da7ab3bc 100644 --- a/models/flowplayer.php +++ b/models/flowplayer.php @@ -248,8 +248,10 @@ private function popup_settings($aPopups) { $aPopups[$key]['css'] = stripslashes($aPopupData['css']); $aPopups[$key]['html'] = stripslashes($aPopupData['html']); - if(in_array($aPopupData['css_preset'], array('default','tw'))){ + if(in_array($aPopupData['css_preset'], array('default','tw','legacy'))){ $aPopups[$key]['css'] = ''; + $aPopups[$key]['css_preset_name'] = ''; + $aPopups[$key]['css_preset_content'] = ''; continue; } @@ -263,10 +265,10 @@ private function popup_settings($aPopups) { $aPopups[$key]['css_preset'] = $aPopupData['css_preset']; update_option('fv_player_popups_css',$aPopupCss); } - + + } - update_option('fv_player_popups',$aPopups); } @@ -279,17 +281,7 @@ public function _salt() { return $salt; } -// public static function get_unique_key($key, $array_keys){ -// if(is_array($array_keys) && isset($array_keys[$key])){ -// $count = 1; -// if(preg_match('/-([0-9]*)$/',$key,$matches)){ -// $count = intval($matches[1]) + 1; -// } -// $key .= '-' . $count; -// } -// return $key; -// } -// + private function build_playlist_html( $aArgs, $sSplashImage, $sItemCaption ){ if(isset($aArgs['liststyle']) && $aArgs['liststyle'] == 'vertical'){ diff --git a/view/admin.php b/view/admin.php index aa1a2a830..79787ccff 100644 --- a/view/admin.php +++ b/view/admin.php @@ -862,15 +862,13 @@ function fv_flowplayer_admin_popups(){ } foreach ($aPopupData AS $key => $aPopup) { - $bShowLegacy = empty($aPopup['css_preset']) && !empty($aPopup['css']); - - + $bShowLegacy = isset($aPopup['css_preset']) && $aPopup['css_preset'] === 'legacy' || empty($aPopup['css_preset']) && !empty($aPopup['css']); if(isset($aPopup['css_preset']) && isset($aPopupCss[$aPopup['css_preset']])){ $aPopup['css_preset_content'] = $aPopupCss[$aPopup['css_preset']]['content']; $aPopup['css_preset_name'] = $aPopupCss[$aPopup['css_preset']]['name']; } - var_dump($aPopup); + //var_dump($bShowLegacy); ?> > @@ -885,12 +883,12 @@ function fv_flowplayer_admin_popups(){ - class="fv-player-popup-css-legacy"> + class="fv-player-popup-css-legacy"> - > + > From 3039fe282173273f7623762a0061d4a2a62f9712 Mon Sep 17 00:00:00 2001 From: TheYurry Date: Fri, 13 Jan 2017 15:27:09 +0100 Subject: [PATCH 06/16] moving settings around --- view/admin.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/view/admin.php b/view/admin.php index 79787ccff..9a0422e06 100644 --- a/view/admin.php +++ b/view/admin.php @@ -881,14 +881,9 @@ function fv_flowplayer_admin_popups(){ - - - class="fv-player-popup-css-legacy"> - - - + - > + @@ -917,6 +912,12 @@ function fv_flowplayer_admin_popups(){ + + + class="fv-player-popup-css-legacy"> + + + From 0e3d73b659b8208ba7209da28933dd1756453c60 Mon Sep 17 00:00:00 2001 From: TheYurry Date: Fri, 13 Jan 2017 15:32:07 +0100 Subject: [PATCH 07/16] it was saved --- models/flowplayer.php | 6 +++++- view/admin.php | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/models/flowplayer.php b/models/flowplayer.php index 1da7ab3bc..a5b571de1 100644 --- a/models/flowplayer.php +++ b/models/flowplayer.php @@ -248,11 +248,15 @@ private function popup_settings($aPopups) { $aPopups[$key]['css'] = stripslashes($aPopupData['css']); $aPopups[$key]['html'] = stripslashes($aPopupData['html']); - if(in_array($aPopupData['css_preset'], array('default','tw','legacy'))){ + if(in_array($aPopupData['css_preset'], array('default','tw'))){ $aPopups[$key]['css'] = ''; $aPopups[$key]['css_preset_name'] = ''; $aPopups[$key]['css_preset_content'] = ''; continue; + }else if($aPopupData['css_preset'] === 'legacy'){ + $aPopups[$key]['css_preset_name'] = ''; + $aPopups[$key]['css_preset_content'] = ''; + continue; } diff --git a/view/admin.php b/view/admin.php index 9a0422e06..6d1e6db70 100644 --- a/view/admin.php +++ b/view/admin.php @@ -868,7 +868,6 @@ function fv_flowplayer_admin_popups(){ $aPopup['css_preset_content'] = $aPopupCss[$aPopup['css_preset']]['content']; $aPopup['css_preset_name'] = $aPopupCss[$aPopup['css_preset']]['name']; } - //var_dump($bShowLegacy); ?> > From 8d75165233d00d1204b8dbfa85ec6ee33b469d5f Mon Sep 17 00:00:00 2001 From: Martin FV Date: Fri, 13 Jan 2017 17:18:00 +0100 Subject: [PATCH 08/16] Figuring out the CSS classes here. --- css/flowplayer.css | 7 ++++++- flowplayer/fv-flowplayer.min.js | 2 +- models/flowplayer-frontend.php | 4 ++-- models/flowplayer.php | 6 ++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/css/flowplayer.css b/css/flowplayer.css index 8c3e8bcf9..44860209b 100755 --- a/css/flowplayer.css +++ b/css/flowplayer.css @@ -908,4 +908,9 @@ article .entry-content .fvfp_admin_error p { line-height: 18px; } .flowplayer.chrome55fix video::-webkit-media-controls-panel { width: calc(100% + 48px); -} \ No newline at end of file +} + + + +.fv-player-popup-default { position: absolute; top: 10%; z-index: 20; text-align: center; width: 100%; color: #fff; } +.fv-player-popup-default .fv_player_popup_content { background: #555555; padding: 1% 5%; width: 65%; margin: 0 auto; } \ No newline at end of file diff --git a/flowplayer/fv-flowplayer.min.js b/flowplayer/fv-flowplayer.min.js index 9aca76a4b..3a5c83adf 100644 --- a/flowplayer/fv-flowplayer.min.js +++ b/flowplayer/fv-flowplayer.min.js @@ -591,7 +591,7 @@ flowplayer(function (api,root) { if( root.find('.wpfp_custom_popup').length > 0) { root.find('.wpfp_custom_popup').show(); } else { - root.append( '
'+fv_flowplayer_popup[player_id].html+'
' ); + root.append( fv_flowplayer_popup[player_id].html ); } } diff --git a/models/flowplayer-frontend.php b/models/flowplayer-frontend.php index d29cdb04e..1c8c9a7e3 100755 --- a/models/flowplayer-frontend.php +++ b/models/flowplayer-frontend.php @@ -847,12 +847,12 @@ function get_popup_code() { } } - $sClass = ' fv_player_popup-'.$iPopupIndex; + $sClass = ' fv_player_popup-id_'.$iPopupIndex; $popup = apply_filters('fv_flowplayer_popup_html', $popup); if (strlen(trim($popup)) > 0) { $popup_contents = array( - 'html' => '
' . $popup . '
' + 'html' => '
' . $popup . '
' ); return $popup_contents; } diff --git a/models/flowplayer.php b/models/flowplayer.php index a5b571de1..526e7da84 100644 --- a/models/flowplayer.php +++ b/models/flowplayer.php @@ -549,10 +549,8 @@ function css_generate( $skip_style_tag = true ) { .fvplayer .me-cannotplay span { padding: 5px; } #content .fvplayer .mejs-container .mejs-controls div { font-family: conf['font-face']); ?>; } - .wpfp_custom_background { display: none; } - .wpfp_custom_popup { position: absolute; top: 10%; z-index: 20; text-align: center; width: 100%; color: #fff; } - .is-finished .wpfp_custom_background { display: block; } - .fv_player_popup { background: conf['backgroundColor']) ?>; padding: 1% 5%; width: 65%; margin: 0 auto; } + .wpfp_custom_background { display: none; } + .is-finished .wpfp_custom_background { display: block; } conf['ad_css']); ?> .wpfp_custom_ad { color: conf['adTextColor']); ?>; z-index: 20 !important; } From 8d6bea11ccdf36482fcf882d423bb762bab87f32 Mon Sep 17 00:00:00 2001 From: Martin FV Date: Fri, 13 Jan 2017 17:20:44 +0100 Subject: [PATCH 09/16] Putting in the style class. --- models/flowplayer-frontend.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/flowplayer-frontend.php b/models/flowplayer-frontend.php index 1c8c9a7e3..3d246180c 100755 --- a/models/flowplayer-frontend.php +++ b/models/flowplayer-frontend.php @@ -848,11 +848,12 @@ function get_popup_code() { } $sClass = ' fv_player_popup-id_'.$iPopupIndex; + $sStyle = isset($aPopupData[$iPopupIndex]['css_preset']) ? $aPopupData[$iPopupIndex]['css_preset'] : 'default'; $popup = apply_filters('fv_flowplayer_popup_html', $popup); if (strlen(trim($popup)) > 0) { $popup_contents = array( - 'html' => '
' . $popup . '
' + 'html' => '
' . $popup . '
' ); return $popup_contents; } From 4b6dcd4f53067c08678e474b1728cfb6aa692bb1 Mon Sep 17 00:00:00 2001 From: TheYurry Date: Fri, 13 Jan 2017 17:58:41 +0100 Subject: [PATCH 10/16] beta 2 --- css/flowplayer.css | 7 ++++++- flowplayer/fv-flowplayer.min.js | 2 +- models/flowplayer-frontend.php | 5 +++-- models/flowplayer.php | 27 ++++++++++++++++----------- view/admin.php | 15 +++++++++++---- 5 files changed, 37 insertions(+), 19 deletions(-) diff --git a/css/flowplayer.css b/css/flowplayer.css index 8c3e8bcf9..44860209b 100755 --- a/css/flowplayer.css +++ b/css/flowplayer.css @@ -908,4 +908,9 @@ article .entry-content .fvfp_admin_error p { line-height: 18px; } .flowplayer.chrome55fix video::-webkit-media-controls-panel { width: calc(100% + 48px); -} \ No newline at end of file +} + + + +.fv-player-popup-default { position: absolute; top: 10%; z-index: 20; text-align: center; width: 100%; color: #fff; } +.fv-player-popup-default .fv_player_popup_content { background: #555555; padding: 1% 5%; width: 65%; margin: 0 auto; } \ No newline at end of file diff --git a/flowplayer/fv-flowplayer.min.js b/flowplayer/fv-flowplayer.min.js index 9aca76a4b..3a5c83adf 100644 --- a/flowplayer/fv-flowplayer.min.js +++ b/flowplayer/fv-flowplayer.min.js @@ -591,7 +591,7 @@ flowplayer(function (api,root) { if( root.find('.wpfp_custom_popup').length > 0) { root.find('.wpfp_custom_popup').show(); } else { - root.append( '
'+fv_flowplayer_popup[player_id].html+'
' ); + root.append( fv_flowplayer_popup[player_id].html ); } } diff --git a/models/flowplayer-frontend.php b/models/flowplayer-frontend.php index d29cdb04e..3d246180c 100755 --- a/models/flowplayer-frontend.php +++ b/models/flowplayer-frontend.php @@ -847,12 +847,13 @@ function get_popup_code() { } } - $sClass = ' fv_player_popup-'.$iPopupIndex; + $sClass = ' fv_player_popup-id_'.$iPopupIndex; + $sStyle = isset($aPopupData[$iPopupIndex]['css_preset']) ? $aPopupData[$iPopupIndex]['css_preset'] : 'default'; $popup = apply_filters('fv_flowplayer_popup_html', $popup); if (strlen(trim($popup)) > 0) { $popup_contents = array( - 'html' => '
' . $popup . '
' + 'html' => '
' . $popup . '
' ); return $popup_contents; } diff --git a/models/flowplayer.php b/models/flowplayer.php index a5b571de1..b87f11d50 100644 --- a/models/flowplayer.php +++ b/models/flowplayer.php @@ -549,10 +549,8 @@ function css_generate( $skip_style_tag = true ) { .fvplayer .me-cannotplay span { padding: 5px; } #content .fvplayer .mejs-container .mejs-controls div { font-family: conf['font-face']); ?>; } - .wpfp_custom_background { display: none; } - .wpfp_custom_popup { position: absolute; top: 10%; z-index: 20; text-align: center; width: 100%; color: #fff; } - .is-finished .wpfp_custom_background { display: block; } - .fv_player_popup { background: conf['backgroundColor']) ?>; padding: 1% 5%; width: 65%; margin: 0 auto; } + .wpfp_custom_background { display: none; } + .is-finished .wpfp_custom_background { display: block; } conf['ad_css']); ?> .wpfp_custom_ad { color: conf['adTextColor']); ?>; z-index: 20 !important; } @@ -1261,16 +1259,23 @@ function css_writeout_option() { function popup_css( $css ){ - $aPopupData = get_option('fv_player_popups'); + $aPopupData = get_option('fv_player_popups',array()); $sNewCss = ''; - if( is_array($aPopupData) ) { - foreach($aPopupData as $key => $val){ - if( empty($val['css']) ){ - continue; - } - $sNewCss .= stripslashes($val['css'])."\n"; + foreach($aPopupData as $key => $val){ + if( empty($val['css']) ){ + continue; + } + $sNewCss .= stripslashes($val['css'])."\n"; + } + + $aPopupData = get_option('fv_player_popups_css',array()); + foreach($aPopupData as $key => $val){ + if( empty($val['content']) ){ + continue; } + $sNewCss .= stripslashes($val['content'])."\n"; } + if( strlen($sNewCss) ){ $css .= "\n/*custom popup css*/\n".$sNewCss."/*end custom popup css*/\n"; } diff --git a/view/admin.php b/view/admin.php index 6d1e6db70..ddfedaf22 100644 --- a/view/admin.php +++ b/view/admin.php @@ -903,13 +903,17 @@ function fv_flowplayer_admin_popups(){ - > + - + - > + + + + + - + @@ -989,11 +993,14 @@ function fv_flowplayer_admin_popups(){ var data = $(this).find('option[value=' + $(this).val() + ']').data('css'); //data = JSON.parse(data); + var className = '.fv-player-popup-' + $(this).val(); if(typeof(data) !== 'undefined'){ $('.fv-player-popup-css-css',parent).html(data.content); $('.fv-player-popup-css-name',parent).val(data.name); + $('.fv-player-popup-css-class',parent).val(className); } + }); $('.fv-player-popup-css-css_preset').trigger('change'); From 0e6bfff755f62cd21afd20dd59a445b3a6868f76 Mon Sep 17 00:00:00 2001 From: TheYurry Date: Fri, 13 Jan 2017 18:07:30 +0100 Subject: [PATCH 11/16] example css --- view/admin.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/view/admin.php b/view/admin.php index ddfedaf22..febc371f5 100644 --- a/view/admin.php +++ b/view/admin.php @@ -848,10 +848,10 @@ function fv_flowplayer_admin_popups(){ $aPopupCss = get_option('fv_player_popups_css', array()); - $cssTextDefault = '.fv-player-popup-css-class{ - color:awesome; +$cssTextDefault = '.fv-player-popup-#fv_popup_dummy_key#{ + color:red; }'; - $cssClassDefault = 'My Cusom Style'; +$cssClassDefault = 'My Cusom Style'; @@ -995,7 +995,7 @@ function fv_flowplayer_admin_popups(){ //data = JSON.parse(data); var className = '.fv-player-popup-' + $(this).val(); if(typeof(data) !== 'undefined'){ - $('.fv-player-popup-css-css',parent).html(data.content); + $('.fv-player-popup-css-css',parent).html(data.content.replace('#fv_popup_dummy_key#',$(this).val())); $('.fv-player-popup-css-name',parent).val(data.name); $('.fv-player-popup-css-class',parent).val(className); } From 6f68fe3193c531a4d7bbeaca0a769b9350c4f37f Mon Sep 17 00:00:00 2001 From: Martin FV Date: Tue, 17 Jan 2017 14:02:49 +0100 Subject: [PATCH 12/16] Adding some default styles, fixing bugs. --- models/flowplayer-frontend.php | 2 +- view/admin.php | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/models/flowplayer-frontend.php b/models/flowplayer-frontend.php index 3d246180c..b221d4347 100755 --- a/models/flowplayer-frontend.php +++ b/models/flowplayer-frontend.php @@ -853,7 +853,7 @@ function get_popup_code() { $popup = apply_filters('fv_flowplayer_popup_html', $popup); if (strlen(trim($popup)) > 0) { $popup_contents = array( - 'html' => '
' . $popup . '
' + 'html' => '
' . $popup . '
' ); return $popup_contents; } diff --git a/view/admin.php b/view/admin.php index febc371f5..ec6fb8c02 100644 --- a/view/admin.php +++ b/view/admin.php @@ -847,12 +847,13 @@ function fv_flowplayer_admin_popups(){ $aPopupData = get_option('fv_player_popups'); $aPopupCss = get_option('fv_player_popups_css', array()); - -$cssTextDefault = '.fv-player-popup-#fv_popup_dummy_key#{ - color:red; -}'; -$cssClassDefault = 'My Cusom Style'; - + // put default popup CSS here! + $cssTextDefault = <<< CSS +.fv-player-popup-#fv_popup_dummy_key# { position: absolute; top: 10%; z-index: 20; text-align: center; width: 100%; color: #fff; } +.fv-player-popup-#fv_popup_dummy_key# .fv_player_popup_content { background: #555555; padding: 1% 5%; width: 65%; margin: 0 auto; } +CSS; + $cssClassDefault = 'My Custom Style'; + if( empty($aPopupData) ) { @@ -904,11 +905,11 @@ function fv_flowplayer_admin_popups(){ - + - + @@ -995,7 +996,7 @@ function fv_flowplayer_admin_popups(){ //data = JSON.parse(data); var className = '.fv-player-popup-' + $(this).val(); if(typeof(data) !== 'undefined'){ - $('.fv-player-popup-css-css',parent).html(data.content.replace('#fv_popup_dummy_key#',$(this).val())); + $('.fv-player-popup-css-css',parent).html(data.content.replace(/#fv_popup_dummy_key#/g,$(this).val())); $('.fv-player-popup-css-name',parent).val(data.name); $('.fv-player-popup-css-class',parent).val(className); } From cd2562c510d395813d9b6302cd2e7c82b84bcb4d Mon Sep 17 00:00:00 2001 From: Martin FV Date: Tue, 17 Jan 2017 14:04:06 +0100 Subject: [PATCH 13/16] Missed one file. --- css/flowplayer.css | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/css/flowplayer.css b/css/flowplayer.css index 44860209b..cd2f743f9 100755 --- a/css/flowplayer.css +++ b/css/flowplayer.css @@ -913,4 +913,7 @@ article .entry-content .fvfp_admin_error p { line-height: 18px; } .fv-player-popup-default { position: absolute; top: 10%; z-index: 20; text-align: center; width: 100%; color: #fff; } -.fv-player-popup-default .fv_player_popup_content { background: #555555; padding: 1% 5%; width: 65%; margin: 0 auto; } \ No newline at end of file +.fv-player-popup-default .fv_player_popup_content { background: #555555; padding: 1% 5%; width: 65%; margin: 0 auto; } + +.fv-player-popup-tw { position: absolute; top: 10%; z-index: 20; text-align: center; width: 100%; color: #f88; } +.fv-player-popup-tw .fv_player_popup_content { background: #333333; padding: 1% 5%; width: 65%; margin: 0 auto; } \ No newline at end of file From 51d88c02ad2749bef173a63e6e099f236a891694 Mon Sep 17 00:00:00 2001 From: TheYurry Date: Tue, 24 Jan 2017 16:20:14 +0100 Subject: [PATCH 14/16] ui changes * In their hearts humans plan their course, but the LORD establishes their steps. --- css/admin.css | 22 +++++++++++++-------- view/admin.php | 52 ++++++++++++++++++++++++++++++++------------------ 2 files changed, 47 insertions(+), 27 deletions(-) diff --git a/css/admin.css b/css/admin.css index b68d9a60c..77c40419e 100755 --- a/css/admin.css +++ b/css/admin.css @@ -46,19 +46,25 @@ .flowplayer-wrapper { width: 54%; display: inline-block; float: right;} @media only screen and (max-width: 940px) {.flowplayer-wrapper { width: 100%; float: none;} .form-table2.flowplayer-settings {width: 100% !important;}} - +/* POPUPS */ #fv-player-popups-settings tr.data:nth-child(even) { background-color: #eee; } .fv-player-popup-remove { visibility: hidden; } td:hover > .fv-player-popup-remove { visibility: visible; } table.fv-player-popup-formats td:first-child { width: 72px } -#fv_flowplayer_popups .inside label { - display: initial; - text-align: inherit; -} -#fv-player-popups-settings > tbody > tr > td:nth-child( 1 ) { - text-align: center; - max-width: 7px; +#fv_flowplayer_popups .inside label {display: initial;text-align: inherit;} +#fv-player-popups-settings > tbody > tr > td:nth-child( 1 ) {text-align: center;max-width: 7px;} + +.fv-player-popups-editable .hide-if-popups-editable, +.fv-player-popups-editing .hide-if-popups-editing, +.fv-player-popups-legacy .hide-if-popups-legacy, +.fv-player-popups-preset .hide-if-popups-preset{ + display:none; } +.fv-player-popup-css-edit{margin-top: 0!important;} + + + + .fv-metabox-holder { padding-top:0!important; diff --git a/view/admin.php b/view/admin.php index 15a7a3118..22bc3e43a 100644 --- a/view/admin.php +++ b/view/admin.php @@ -839,8 +839,8 @@ function fv_flowplayer_admin_popups(){

- - +
+
@@ -911,23 +911,24 @@ function fv_flowplayer_admin_popups(){ + - + - + - + - class="fv-player-popup-css-legacy"> + class="hide-if-popups-editable hide-if-popups-editing hide-if-popups-preset"> @@ -964,7 +965,7 @@ function fv_flowplayer_admin_popups(){ if(!$.isNumeric(tmp)) return; maxIndex = Math.max(tmp,maxIndex); - }) + }); $('#fv-player-popups-add').click( function() { var fv_player_popup_index = (parseInt( $('#fv-player-popups-settings tr.data:last .id').html() ) || 0 ) + 1; @@ -982,26 +983,39 @@ function fv_flowplayer_admin_popups(){ } return false; } ); + + $(document).on('click','.fv-player-popup-css-edit', false, function() { + $('.fv-player-popups-editing').removeClass('fv-player-popups-editing').addClass('fv-player-popups-editable'); + var parent = $(this).parents('.fv-player-popup-formats'); + parent.attr('class','fv-player-popup-formats'); + parent.addClass('fv-player-popups-editing'); + } ); + + $(document).on('change','.fv-player-popup-css-css_preset',function(){ + var parent = $(this).parents('.fv-player-popup-formats'); - if($(this).val() !== 'default' && $(this).val() !== 'tw' && $(this).val() !== 'legacy'){ - $('.fv-player-popup-css-new-css,.fv-player-popup-css-new-name',parent).show(); - }else{ - $('.fv-player-popup-css-new-css,.fv-player-popup-css-new-name',parent).hide(); - } + parent.attr('class','fv-player-popup-formats'); + //.fv-player-popups-editable + //.fv-player-popups-editing + //.fv-player-popups-legacy + //.fv-player-popups-preset + console.log($(this).val() === 'new',$(this).val()); - if($(this).val() !== 'legacy'){ - $('.fv-player-popup-css-legacy',parent).hide(); - }else{ - $('.fv-player-popup-css-legacy',parent).show(); - } - - if($(this).val() === 'new'){ + if($(this).val() === 'legacy'){ + parent.addClass('fv-player-popups-legacy'); + }else if($(this).val() === 'new' || $(this).find('option[value=' + $(this).val() + ']').data('new') ){ + parent.addClass('fv-player-popups-editing'); $(this).find('option[value=new]').attr('value', ++maxIndex); + }else if($(this).val() === 'default' || $(this).val() === 'tw' ){ + parent.addClass('fv-player-popups-preset'); + }else{ + parent.addClass('fv-player-popups-editable'); } var data = $(this).find('option[value=' + $(this).val() + ']').data('css'); + $(this).find('option[value=' + $(this).val() + ']').data('new',true); //data = JSON.parse(data); var className = '.fv-player-popup-' + $(this).val(); if(typeof(data) !== 'undefined'){ From f738efc5d853b70b2d62a93b17dfb4271aadc057 Mon Sep 17 00:00:00 2001 From: TheYurry Date: Tue, 24 Jan 2017 16:35:39 +0100 Subject: [PATCH 15/16] bugfix --- view/admin.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/view/admin.php b/view/admin.php index 22bc3e43a..3baca685b 100644 --- a/view/admin.php +++ b/view/admin.php @@ -1001,12 +1001,12 @@ function fv_flowplayer_admin_popups(){ //.fv-player-popups-editing //.fv-player-popups-legacy //.fv-player-popups-preset - console.log($(this).val() === 'new',$(this).val()); if($(this).val() === 'legacy'){ parent.addClass('fv-player-popups-legacy'); }else if($(this).val() === 'new' || $(this).find('option[value=' + $(this).val() + ']').data('new') ){ parent.addClass('fv-player-popups-editing'); + $(this).find('option[value=' + $(this).val() + ']').data('new',true); $(this).find('option[value=new]').attr('value', ++maxIndex); }else if($(this).val() === 'default' || $(this).val() === 'tw' ){ parent.addClass('fv-player-popups-preset'); @@ -1015,8 +1015,6 @@ function fv_flowplayer_admin_popups(){ } var data = $(this).find('option[value=' + $(this).val() + ']').data('css'); - $(this).find('option[value=' + $(this).val() + ']').data('new',true); - //data = JSON.parse(data); var className = '.fv-player-popup-' + $(this).val(); if(typeof(data) !== 'undefined'){ $('.fv-player-popup-css-css',parent).html(data.content.replace(/#fv_popup_dummy_key#/g,$(this).val())); From be1aeda4dd9bd51778cc79cae5076e37ea4e714c Mon Sep 17 00:00:00 2001 From: TheYurry Date: Fri, 17 Mar 2017 12:16:23 +0100 Subject: [PATCH 16/16] fixes --- js/shortcode-editor.js | 8 ++++++-- models/flowplayer.php | 9 ++++----- view/wizard.php | 7 +++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/js/shortcode-editor.js b/js/shortcode-editor.js index a25730c19..9ad9239d8 100644 --- a/js/shortcode-editor.js +++ b/js/shortcode-editor.js @@ -1077,7 +1077,11 @@ function fv_wp_flowplayer_submit( preview ) { if( jQuery('[name=fv_wp_flowplayer_field_popup]').val() !== ''){ fv_wp_flowplayer_shortcode_write_arg('fv_wp_flowplayer_field_popup','popup','html'); }else{ - fv_wp_flowplayer_shortcode_write_arg('fv_wp_flowplayer_field_popup_id', 'popup', false, false, ['no','random','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16'] ); + var sPopup = jQuery('#fv_wp_flowplayer_field_popup_id').val(); + if(sPopup){ + fv_wp_fp_shortcode += ' popup="' + sPopup + '"'; + } + } break; } @@ -1336,7 +1340,7 @@ function fv_wp_flowplayer_shortcode_write_arg( sField, sArg, sKind, bCheckbox, a if( typeof(element) == "undefined") { return false; } - + var sValue = false; if( bCheckbox ) { if( element.checked ){ diff --git a/models/flowplayer.php b/models/flowplayer.php index 33d35f373..ac376b9cd 100644 --- a/models/flowplayer.php +++ b/models/flowplayer.php @@ -591,7 +591,7 @@ function css_generate( $skip_style_tag = true ) { .flowplayer.fixed-controls { margin: 0 auto px auto; display: block; } .flowplayer.has-abloop { margin-bottom: px; } .flowplayer.fixed-controls.has-abloop { margin-bottom: px; } - .flowplayer.has-caption, flowplayer.has-caption * { margin: 0 auto; } + .flowplayer.has-caption, .flowplayer.has-caption * { margin: 0 auto; } .flowplayer .fp-controls, .flowplayer .fv-ab-loop, .fv-player-buttons a:active, .fv-player-buttons a { color: _get_option('durationColor'); ?> !important; background-color: _get_option('backgroundColor'); ?> !important; } .flowplayer { background-color: _get_option('canvas'); ?> !important; } .flowplayer .fp-duration, .flowplayer a.fp-play, .flowplayer a.fp-mute { color: _get_option('durationColor'); ?> !important; } @@ -918,7 +918,7 @@ public static function get_duration( $post_id, $video_src ) { public static function get_duration_post( $post_id = false ) { - global $post, $fv_fp; + global $post; $post_id = ( $post_id ) ? $post_id : $post->ID; $content = false; @@ -1405,7 +1405,6 @@ function template_embed_buffer(){ if( get_query_var('fv_player_embed') ) { ob_start(); - global $fvseo; if( isset($_REQUEST['fv_player_preview']) ) { global $fvseo; if( isset($fvseo) ) remove_action('wp_footer', array($fvseo, 'script_footer_content'), 999999 ); @@ -1428,8 +1427,8 @@ function template_embed() { ?> diff --git a/view/wizard.php b/view/wizard.php index 740497c8a..883e18f96 100644 --- a/view/wizard.php +++ b/view/wizard.php @@ -31,8 +31,7 @@ } function fv_flowplayer_admin_select_popups($aArgs) { - global $fv_fp; - + $aPopupData = get_option('fv_player_popups'); @@ -63,7 +62,7 @@ function fv_player_shortcode_row( $args ) { $fv_flowplayer_conf = get_option( 'fvwpflowplayer' ); $args = wp_parse_args( $args, array( 'class' => false, - 'dropdown' => array( 'Default', 'On', 'Off' ), + 'dropdown' => array( array('','Default'), array('true','On'), array('false','Off') ), 'id' => false, 'label' => '', 'live' => true, @@ -109,7 +108,7 @@ function fv_player_shortcode_row( $args ) {