Music Player for WooCommerce - Version 1.0.170

Version Description

  • Fixes an issue with the volume when the default value is zero.
Download this release

Release Info

Developer codepeople
Plugin Icon 128x128 Music Player for WooCommerce
Version 1.0.170
Comparing to
See all releases

Code changes from version 1.0.167 to 1.0.170

js/public.js CHANGED
@@ -1,13 +1,13 @@
1
- var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,e,b){a instanceof String&&(a=String(a));for(var f=a.length,h=0;h<f;h++){var c=a[h];if(e.call(b,c,h,a))return{i:h,v:c}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
2
- $jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,e,b){a!=Array.prototype&&a!=Object.prototype&&(a[e]=b.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);
3
- $jscomp.polyfill=function(a,e,b,f){if(e){b=$jscomp.global;a=a.split(".");for(f=0;f<a.length-1;f++){var h=a[f];h in b||(b[h]={});b=b[h]}a=a[a.length-1];f=b[a];e=e(f);e!=f&&null!=e&&$jscomp.defineProperty(b,a,{configurable:!0,writable:!0,value:e})}};$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,b){return $jscomp.findInternal(this,a,b).v}},"es6","es3");
4
- (function(){var a=[],e=0;window.generate_the_wcmp=function(b){function f(g,l){if(g+1<e||l){var d=g+1;!l||d!=e&&0!=c('[playernumber="'+d+'"]').closest("[data-loop]").length&&c('[playernumber="'+d+'"]').closest("[data-loop]")[0]==c('[playernumber="'+g+'"]').closest("[data-loop]")[0]||(d=c('[playernumber="'+g+'"]').closest("[data-loop]").find("[playernumber]:first").attr("playernumber"));a[d]instanceof c&&a[d].is("a")?a[d].is(":visible")?a[d].click():f(g+1,l):c(a[d].container).is(":visible")?a[d].play():
5
- f(g+1,l)}}function h(g){var a=g.data("product"),d=c("img.product-"+a);d.length&&1==c('[data-product="'+a+'"]').length&&(a=d.offset(),g=g.closest("div.wcmp-player"),g.css({position:"absolute","z-index":999999}).offset({left:a.left+(d.width()-g.width())/2,top:a.top+(d.height()-g.height())/2}))}if(!("boolean"!==typeof b&&"undefined"!=typeof wcmp_global_settings&&1*wcmp_global_settings.onload)&&"undefined"===typeof generated_the_wcmp){generated_the_wcmp=!0;var c=jQuery;c(".wcmp-player-container").on("click",
6
- "*",function(a){a.preventDefault();a.stopPropagation();return!1});c.expr[":"].regex=function(a,b,d){b=d[3].split(",");var m=/^(data|css):/;d=b[0].match(m)?b[0].split(":")[0]:"attr";m=b.shift().replace(m,"");return(new RegExp(b.join("").replace(/^\s+|\s+$/g,""),"ig")).test(c(a)[d](m))};var r="undefined"!=typeof wcmp_global_settings?wcmp_global_settings.play_all:!0,k="undefined"!=typeof wcmp_global_settings?!(1*wcmp_global_settings.play_simultaneously):!0,p="undefined"!=typeof wcmp_global_settings?
7
- 1*wcmp_global_settings.fade_out:!0,q="undefined"!=typeof wcmp_global_settings&&"ios_controls"in wcmp_global_settings&&1*wcmp_global_settings.ios_controls?!0:!1;b=c("audio.wcmp-player:not(.track):not([playernumber])");var t=c("audio.wcmp-player.track:not([playernumber])"),n={pauseOtherPlayers:k,iPadUseNativeControls:q,iPhoneUseNativeControls:q,success:function(a,b){c(b).attr("volume")&&a.setVolume(parseFloat(c(b).attr("volume")));var d=function(a){a=c(a.target||a.detail.target);var m=a.data("duration");
8
- "undefined"!=typeof m&&a.closest(".wcmp-player-container").find(".mejs-duration").html(m)};a.addEventListener("timeupdate",function(a){d(a);a=a.target||a.detail.target;isNaN(a.currentTime)||isNaN(a.duration)||(p&&4>a.duration-a.currentTime?a.setVolume(a.volume-a.volume/3):("undefined"==typeof a.bkVolume&&(a.bkVolume=a.volume),a.setVolume(a.bkVolume)))});a.addEventListener("volumechange",function(a){a=a.target||a.detail.target;isNaN(a.currentTime)||isNaN(a.duration)||!(4<a.duration-a.currentTime)&&
9
- p||!a.currentTime||(a.bkVolume=a.volume)});a.addEventListener("ended",function(a){var b=a.target||a.detail.target;a=c(b).closest('[data-loop="1"]');if(1*r||a.length)b=1*c(b).attr("playernumber"),f(b,a.length)});a.addEventListener("loadedmetadata",function(a){d(a)})}};k=".product-type-grouped :regex(name,quantity\\[\\d+\\])";b.each(function(){var b=c(this);b.find("source").attr("src");b.attr("playernumber",e);n.audioVolume="vertical";try{a[e]=new MediaElementPlayer(b[0],n)}catch(l){"console"in window&&
10
- console.log(l)}e++});t.each(function(){var b=c(this);b.find("source").attr("src");b.attr("playernumber",e);n.features=["playpause"];try{a[e]=new MediaElementPlayer(b[0],n)}catch(l){"console"in window&&console.log(l)}e++;h(b);c(window).resize(function(){h(b)})});c(k).length||(k=".product-type-grouped [data-product_id]");c(k).length||(k=".woocommerce-grouped-product-list [data-product_id]");c(k).length||(k='.woocommerce-grouped-product-list [id*="product-"]');c(k).each(function(){try{var a=c(this),
11
- b=(a.data("product_id")||a.attr("name")||a.attr("id")).replace(/[^\d]/g,""),d=c(".wcmp-player-list.merge_in_grouped_products .product-"+b+":first .wcmp-player-title"),e=c("<table></table>");d.length&&!d.closest(".wcmp-first-in-product").length&&(d.closest("tr").addClass("wcmp-first-in-product"),0==d.closest("form").length&&d.closest(".wcmp-player-list").prependTo(a.closest("form")),e.append(a.closest("tr").prepend("<td>"+d.html()+"</td>")),d.html("").append(e))}catch(u){}})}};window.wcmp_force_init=
12
- function(){delete window.generated_the_wcmp;generate_the_wcmp(!0)};jQuery(generate_the_wcmp);jQuery(window).on("load",function(){generate_the_wcmp(!0);var a=jQuery,e=window.navigator.userAgent;a("[data-lazyloading]").each(function(){var b=a(this);b.attr("preload",b.data("lazyloading"))});if(e.match(/iPad/i)||e.match(/iPhone/i))if("undefined"!=typeof wcmp_global_settings?wcmp_global_settings.play_all:1)a(".wcmp-player .mejs-play button").one("click",function(){if("undefined"==typeof wcmp_preprocessed_players){wcmp_preprocessed_players=
13
- !0;var b=a(this);a(".wcmp-player audio").each(function(){this.play();this.pause()});setTimeout(function(){b.click()},500)}})}).on("popstate",function(){jQuery("audio[data-product]:not([playernumber])").length&&wcmp_force_init()});jQuery(document).on("scroll wpfAjaxSuccess woof_ajax_done yith-wcan-ajax-filtered wpf_ajax_success berocket_ajax_products_loaded berocket_ajax_products_infinite_loaded",wcmp_force_init)})();
1
+ var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(b,f,e){b instanceof String&&(b=String(b));for(var g=b.length,h=0;h<g;h++){var c=b[h];if(f.call(e,c,h,b))return{i:h,v:c}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
2
+ $jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(b,f,e){b!=Array.prototype&&b!=Object.prototype&&(b[f]=e.value)};$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};$jscomp.global=$jscomp.getGlobal(this);
3
+ $jscomp.polyfill=function(b,f,e,g){if(f){e=$jscomp.global;b=b.split(".");for(g=0;g<b.length-1;g++){var h=b[g];h in e||(e[h]={});e=e[h]}b=b[b.length-1];g=e[b];f=f(g);f!=g&&null!=f&&$jscomp.defineProperty(e,b,{configurable:!0,writable:!0,value:f})}};$jscomp.polyfill("Array.prototype.find",function(b){return b?b:function(b,e){return $jscomp.findInternal(this,b,e).v}},"es6","es3");
4
+ (function(){var b=[],f=0;window.generate_the_wcmp=function(e){function g(a,l){if(a+1<f||l){var d=a+1;!l||d!=f&&0!=c('[playernumber="'+d+'"]').closest("[data-loop]").length&&c('[playernumber="'+d+'"]').closest("[data-loop]")[0]==c('[playernumber="'+a+'"]').closest("[data-loop]")[0]||(d=c('[playernumber="'+a+'"]').closest("[data-loop]").find("[playernumber]:first").attr("playernumber"));b[d]instanceof c&&b[d].is("a")?b[d].is(":visible")?b[d].click():g(a+1,l):c(b[d].container).is(":visible")?b[d].play():
5
+ g(a+1,l)}}function h(a){var b=a.data("product"),d=c("img.product-"+b);d.length&&1==c('[data-product="'+b+'"]').length&&(b=d.offset(),a=a.closest("div.wcmp-player"),a.css({position:"absolute","z-index":999999}).offset({left:b.left+(d.width()-a.width())/2,top:b.top+(d.height()-a.height())/2}))}if(!("boolean"!==typeof e&&"undefined"!=typeof wcmp_global_settings&&1*wcmp_global_settings.onload)&&"undefined"===typeof generated_the_wcmp){generated_the_wcmp=!0;var c=jQuery;c(".wcmp-player-container").on("click",
6
+ "*",function(a){a.preventDefault();a.stopPropagation();return!1});c.expr[":"].regex=function(a,b,d){b=d[3].split(",");var e=/^(data|css):/;d=b[0].match(e)?b[0].split(":")[0]:"attr";e=b.shift().replace(e,"");return(new RegExp(b.join("").replace(/^\s+|\s+$/g,""),"ig")).test(c(a)[d](e))};var q="undefined"!=typeof wcmp_global_settings?wcmp_global_settings.play_all:!0,k="undefined"!=typeof wcmp_global_settings?!(1*wcmp_global_settings.play_simultaneously):!0,n="undefined"!=typeof wcmp_global_settings?
7
+ 1*wcmp_global_settings.fade_out:!0,p="undefined"!=typeof wcmp_global_settings&&"ios_controls"in wcmp_global_settings&&1*wcmp_global_settings.ios_controls?!0:!1;e=c("audio.wcmp-player:not(.track):not([playernumber])");var r=c("audio.wcmp-player.track:not([playernumber])"),m={pauseOtherPlayers:k,iPadUseNativeControls:p,iPhoneUseNativeControls:p,success:function(a,b){c(b).attr("volume")&&(a.setVolume(parseFloat(c(b).attr("volume"))),0==a.volume&&a.setMuted(!0));var d=function(a){var b=c(a).find("audio,video").data("duration");
8
+ "undefined"!=typeof b&&c(a).closest(".wcmp-player-container").find(".mejs-duration").html(b)};a.addEventListener("timeupdate",function(b){d(a);isNaN(a.currentTime)||isNaN(a.duration)||(n&&4>a.duration-a.currentTime?a.setVolume(a.volume-a.volume/3):a.currentTime&&("undefined"==typeof a.bkVolume&&(a.bkVolume=parseFloat(c(a).find("audio,video").attr("volume")||a.volume)),a.setVolume(a.bkVolume),0==a.bkVolume&&a.setMuted(!0)))});a.addEventListener("volumechange",function(b){isNaN(a.currentTime)||isNaN(a.duration)||
9
+ !(4<a.duration-a.currentTime)&&n||!a.currentTime||(a.bkVolume=a.volume)});a.addEventListener("ended",function(b){b=c(a).closest('[data-loop="1"]');if(1*q||b.length){var d=1*c(a).attr("playernumber");g(d,b.length)}});a.addEventListener("loadedmetadata",function(){d(a)})}};k=".product-type-grouped :regex(name,quantity\\[\\d+\\])";e.each(function(){var a=c(this);a.find("source").attr("src");a.attr("playernumber",f);m.audioVolume="vertical";try{b[f]=new MediaElementPlayer(a[0],m)}catch(l){"console"in
10
+ window&&console.log(l)}f++});r.each(function(){var a=c(this);a.find("source").attr("src");a.attr("playernumber",f);m.features=["playpause"];try{b[f]=new MediaElementPlayer(a[0],m)}catch(l){"console"in window&&console.log(l)}f++;h(a);c(window).resize(function(){h(a)})});c(k).length||(k=".product-type-grouped [data-product_id]");c(k).length||(k=".woocommerce-grouped-product-list [data-product_id]");c(k).length||(k='.woocommerce-grouped-product-list [id*="product-"]');c(k).each(function(){try{var a=
11
+ c(this),b=(a.data("product_id")||a.attr("name")||a.attr("id")).replace(/[^\d]/g,""),d=c(".wcmp-player-list.merge_in_grouped_products .product-"+b+":first .wcmp-player-title"),e=c("<table></table>");d.length&&!d.closest(".wcmp-first-in-product").length&&(d.closest("tr").addClass("wcmp-first-in-product"),0==d.closest("form").length&&d.closest(".wcmp-player-list").prependTo(a.closest("form")),e.append(a.closest("tr").prepend("<td>"+d.html()+"</td>")),d.html("").append(e))}catch(t){}})}};window.wcmp_force_init=
12
+ function(){delete window.generated_the_wcmp;generate_the_wcmp(!0)};jQuery(generate_the_wcmp);jQuery(window).on("load",function(){generate_the_wcmp(!0);var b=jQuery,f=window.navigator.userAgent;b("[data-lazyloading]").each(function(){var e=b(this);e.attr("preload",e.data("lazyloading"))});if(f.match(/iPad/i)||f.match(/iPhone/i))if("undefined"!=typeof wcmp_global_settings?wcmp_global_settings.play_all:1)b(".wcmp-player .mejs-play button").one("click",function(){if("undefined"==typeof wcmp_preprocessed_players){wcmp_preprocessed_players=
13
+ !0;var e=b(this);b(".wcmp-player audio").each(function(){this.play();this.pause()});setTimeout(function(){e.click()},500)}})}).on("popstate",function(){jQuery("audio[data-product]:not([playernumber])").length&&wcmp_force_init()});jQuery(document).on("scroll wpfAjaxSuccess woof_ajax_done yith-wcan-ajax-filtered wpf_ajax_success berocket_ajax_products_loaded berocket_ajax_products_infinite_loaded",wcmp_force_init)})();
js/public_src.js CHANGED
@@ -93,21 +93,24 @@
93
  iPadUseNativeControls: ios_controls,
94
  iPhoneUseNativeControls: ios_controls,
95
  success: function( media, dom ){
96
- if($(dom).attr('volume')) media.setVolume(parseFloat($(dom).attr('volume')));
97
- var update_duration = function(e){
98
- var t = $(e.target || e.detail.target),
99
- duration = t.data('duration');
 
 
 
100
  if(typeof duration != 'undefined')
101
  {
102
- t.closest('.wcmp-player-container')
103
  .find('.mejs-duration')
104
  .html(duration);
105
  }
106
  };
107
 
108
  media.addEventListener( 'timeupdate', function( evt ){
109
- update_duration(evt);
110
- var e = evt.target || evt.detail.target;
111
  if(!isNaN( e.currentTime ) && !isNaN( e.duration ))
112
  {
113
  if( fade_out && e.duration - e.currentTime < 4 )
@@ -116,15 +119,20 @@
116
  }
117
  else
118
  {
119
- if( typeof e[ 'bkVolume' ] == 'undefined' ) e[ 'bkVolume' ] = e.volume;
120
- e.setVolume( e.bkVolume );
 
 
 
 
 
121
  }
122
 
123
  }
124
  });
125
 
126
  media.addEventListener( 'volumechange', function( evt ){
127
- var e = evt.target || evt.detail.target;
128
  if(!isNaN( e.currentTime ) && !isNaN( e.duration ))
129
  {
130
  if( ( e.duration - e.currentTime > 4 || !fade_out) && e.currentTime ) e[ 'bkVolume' ] = e.volume;
@@ -132,7 +140,7 @@
132
  });
133
 
134
  media.addEventListener( 'ended', function( evt ){
135
- var e = evt.target || evt.detail.target,
136
  c = $(e).closest('[data-loop="1"]');
137
  if( play_all*1 || c.length)
138
  {
@@ -141,8 +149,8 @@
141
  }
142
  });
143
 
144
- media.addEventListener('loadedmetadata', function( e ){
145
- update_duration(e);
146
  });
147
  }
148
  },
93
  iPadUseNativeControls: ios_controls,
94
  iPhoneUseNativeControls: ios_controls,
95
  success: function( media, dom ){
96
+ if($(dom).attr('volume'))
97
+ {
98
+ media.setVolume(parseFloat($(dom).attr('volume')));
99
+ if(media.volume == 0) media.setMuted(true);
100
+ }
101
+ var update_duration = function(t){
102
+ var duration = $(t).find('audio,video').data('duration');
103
  if(typeof duration != 'undefined')
104
  {
105
+ $(t).closest('.wcmp-player-container')
106
  .find('.mejs-duration')
107
  .html(duration);
108
  }
109
  };
110
 
111
  media.addEventListener( 'timeupdate', function( evt ){
112
+ var e = media;
113
+ update_duration(e);
114
  if(!isNaN( e.currentTime ) && !isNaN( e.duration ))
115
  {
116
  if( fade_out && e.duration - e.currentTime < 4 )
119
  }
120
  else
121
  {
122
+ if(e.currentTime)
123
+ {
124
+ if(typeof e[ 'bkVolume' ] == 'undefined' )
125
+ e[ 'bkVolume' ] = parseFloat( $(e).find('audio,video').attr('volume') || e.volume);
126
+ e.setVolume( e.bkVolume );
127
+ if(e.bkVolume == 0) e.setMuted(true);
128
+ }
129
  }
130
 
131
  }
132
  });
133
 
134
  media.addEventListener( 'volumechange', function( evt ){
135
+ var e = media;
136
  if(!isNaN( e.currentTime ) && !isNaN( e.duration ))
137
  {
138
  if( ( e.duration - e.currentTime > 4 || !fade_out) && e.currentTime ) e[ 'bkVolume' ] = e.volume;
140
  });
141
 
142
  media.addEventListener( 'ended', function( evt ){
143
+ var e = media,
144
  c = $(e).closest('[data-loop="1"]');
145
  if( play_all*1 || c.length)
146
  {
149
  }
150
  });
151
 
152
+ media.addEventListener('loadedmetadata', function(){
153
+ update_duration(media);
154
  });
155
  }
156
  },
pagebuilders/elementor/elementor.pb.php CHANGED
@@ -32,7 +32,7 @@ class Elementor_WCMP_Widget extends Widget_Base
32
  return true;
33
  } // End is_reload_preview_required
34
 
35
- protected function _register_controls()
36
  {
37
  global $wpdb;
38
 
@@ -54,7 +54,7 @@ class Elementor_WCMP_Widget extends Widget_Base
54
  );
55
 
56
  $this->end_controls_section();
57
- } // End _register_controls
58
 
59
  private function _get_shortcode()
60
  {
32
  return true;
33
  } // End is_reload_preview_required
34
 
35
+ protected function register_controls()
36
  {
37
  global $wpdb;
38
 
54
  );
55
 
56
  $this->end_controls_section();
57
+ } // End register_controls
58
 
59
  private function _get_shortcode()
60
  {
readme.txt CHANGED
@@ -226,6 +226,18 @@ Each time save the data of a product, the files for demo are deleted and generat
226
 
227
  == Changelog ==
228
 
 
 
 
 
 
 
 
 
 
 
 
 
229
  = 1.0.167 =
230
 
231
  * Include the purchased_times attribute in the playlist shortcode to show how many times a product has been purchased.
226
 
227
  == Changelog ==
228
 
229
+ = 1.0.170 =
230
+
231
+ * Fixes an issue with the volume when the default value is zero.
232
+
233
+ = 1.0.169 =
234
+
235
+ * Removes the functions deprecated by the latest Elementor update.
236
+
237
+ = 1.0.168 =
238
+
239
+ * Modifies the FFMpeg integration and settings.
240
+
241
  = 1.0.167 =
242
 
243
  * Include the purchased_times attribute in the playlist shortcode to show how many times a product has been purchased.
views/global_options.php CHANGED
@@ -5,6 +5,8 @@ if( !defined( 'WCMP_PLUGIN_URL' ) ) { echo 'Direct access not allowed.'; exit;
5
  wp_enqueue_style( 'wcmp-admin-style', plugin_dir_url(__FILE__).'../css/style.admin.css', array(), '5.0.23' );
6
  wp_enqueue_script( 'wcmp-admin-js', plugin_dir_url(__FILE__).'../js/admin.js' );
7
 
 
 
8
  $troubleshoot_default_extension = $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_global_attr( '_wcmp_default_extension', false );
9
  $force_main_player_in_title = $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_global_attr( '_wcmp_force_main_player_in_title', 1 );
10
  $ios_controls = $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_global_attr( '_wcmp_ios_controls', false );
@@ -115,7 +117,7 @@ _e(
115
  </tr>
116
  <tr>
117
  <td width="30%" style="color:#DDDDDD;"><?php _e( 'ffmpeg path', 'music-player-for-woocommerce' ); ?></td>
118
- <td><input aria-label="<?php print esc_attr(__('ffmpeg path','music-player-for-woocommerce')); ?>" type="text" DISABLED style="width:100%;" /></td>
119
  </tr>
120
  <tr>
121
  <td width="30%" style="color:#DDDDDD"><?php _e( 'Watermark audio', 'music-player-for-woocommerce' ); ?></td>
5
  wp_enqueue_style( 'wcmp-admin-style', plugin_dir_url(__FILE__).'../css/style.admin.css', array(), '5.0.23' );
6
  wp_enqueue_script( 'wcmp-admin-js', plugin_dir_url(__FILE__).'../js/admin.js' );
7
 
8
+ $ffmpeg_system_path = defined('PHP_OS') && strtolower(PHP_OS) == 'linux' ? @shell_exec('which ffmpeg') : '';
9
+
10
  $troubleshoot_default_extension = $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_global_attr( '_wcmp_default_extension', false );
11
  $force_main_player_in_title = $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_global_attr( '_wcmp_force_main_player_in_title', 1 );
12
  $ios_controls = $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_global_attr( '_wcmp_ios_controls', false );
117
  </tr>
118
  <tr>
119
  <td width="30%" style="color:#DDDDDD;"><?php _e( 'ffmpeg path', 'music-player-for-woocommerce' ); ?></td>
120
+ <td><input aria-label="<?php print esc_attr(__('ffmpeg path','music-player-for-woocommerce')); ?>" type="text" value="<?php print esc_attr(!empty($ffmpeg_system_path) ? $ffmpeg_system_path : ''); ?>" DISABLED style="width:100%;" /></td>
121
  </tr>
122
  <tr>
123
  <td width="30%" style="color:#DDDDDD"><?php _e( 'Watermark audio', 'music-player-for-woocommerce' ); ?></td>
wcmp.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Music Player for WooCommerce
4
  Plugin URI: https://wcmp.dwbooster.com
5
- Version: 1.0.167
6
  Text Domain: music-player-for-woocommerce
7
  Author: CodePeople
8
  Author URI: https://wcmp.dwbooster.com
@@ -433,7 +433,7 @@ if ( !class_exists( 'WooCommerceMusicPlayer' ) ) {
433
  wp_enqueue_style( 'wcmp-style', plugin_dir_url(__FILE__).'css/style.css' );
434
  wp_enqueue_script('jquery');
435
  wp_enqueue_script('wp-mediaelement');
436
- wp_enqueue_script('wcmp-script', plugin_dir_url(__FILE__).'js/public.js', array('jquery', 'wp-mediaelement'), '1.0.167');
437
 
438
  $play_all = $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_global_attr(
439
  '_wcmp_play_all',
@@ -851,7 +851,14 @@ if ( !class_exists( 'WooCommerceMusicPlayer' ) ) {
851
  $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_global_attr( 'preload', 'none' )
852
  );
853
 
854
- return '<audio '.((!empty($args['volume'])) ? 'volume="'.esc_attr($args['volume']).'"': '').' '.$id.' preload="none" data-lazyloading="'.esc_attr($preload).'" class="wcmp-player '.esc_attr($args[ 'player_controls' ]).' '.esc_attr($args[ 'player_style' ]).'" '.((!empty($args['duration']))? 'data-duration="'.esc_attr($args['duration']).'"': '').'><source src="'.esc_url($audio_url).'" type="audio/'.esc_attr($args['media_type']).'" /></audio>';
 
 
 
 
 
 
 
855
 
856
  } // End get_player
857
 
@@ -908,9 +915,9 @@ if ( !class_exists( 'WooCommerceMusicPlayer' ) ) {
908
  $preload = $this->get_product_attr($id, '_wcmp_preload', '');
909
  $this->enqueue_resources();
910
 
911
- $player_style = $this->get_product_attr( $id, '_wcmp_player_layout', WCMP_DEFAULT_PLAYER_LAYOUT );
912
  $player_controls = ( $this->get_product_attr( $id, '_wcmp_player_controls', WCMP_DEFAULT_PLAYER_CONTROLS ) != 'all' ) ? 'track' : '';
913
- $volume = @floatval($this->get_product_attr( $id, '_wcmp_player_volume', WCMP_DEFAULT_PLAYER_VOLUME ));
914
 
915
  $file = reset($files);
916
  $index = key($files);
2
  /*
3
  Plugin Name: Music Player for WooCommerce
4
  Plugin URI: https://wcmp.dwbooster.com
5
+ Version: 1.0.170
6
  Text Domain: music-player-for-woocommerce
7
  Author: CodePeople
8
  Author URI: https://wcmp.dwbooster.com
433
  wp_enqueue_style( 'wcmp-style', plugin_dir_url(__FILE__).'css/style.css' );
434
  wp_enqueue_script('jquery');
435
  wp_enqueue_script('wp-mediaelement');
436
+ wp_enqueue_script('wcmp-script', plugin_dir_url(__FILE__).'js/public.js', array('jquery', 'wp-mediaelement'), '1.0.170');
437
 
438
  $play_all = $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_global_attr(
439
  '_wcmp_play_all',
851
  $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_global_attr( 'preload', 'none' )
852
  );
853
 
854
+ return '<audio '.(
855
+ (
856
+ isset($args['volume']) &&
857
+ is_numeric($args['volume']) &&
858
+ 0 <= $args['volume']*1 &&
859
+ $args['volume']*1 <= 1
860
+ ) ? 'volume="'.esc_attr($args['volume']).'"': ''
861
+ ).' '.$id.' preload="none" data-lazyloading="'.esc_attr($preload).'" class="wcmp-player '.esc_attr($args[ 'player_controls' ]).' '.esc_attr($args[ 'player_style' ]).'" '.((!empty($args['duration']))? 'data-duration="'.esc_attr($args['duration']).'"': '').'><source src="'.esc_url($audio_url).'" type="audio/'.esc_attr($args['media_type']).'" /></audio>';
862
 
863
  } // End get_player
864
 
915
  $preload = $this->get_product_attr($id, '_wcmp_preload', '');
916
  $this->enqueue_resources();
917
 
918
+ $player_style = $this->get_product_attr( $id, '_wcmp_player_layout', WCMP_DEFAULT_PLAYER_LAYOUT );
919
  $player_controls = ( $this->get_product_attr( $id, '_wcmp_player_controls', WCMP_DEFAULT_PLAYER_CONTROLS ) != 'all' ) ? 'track' : '';
920
+ $volume = @floatval($this->get_product_attr( $id, '_wcmp_player_volume', WCMP_DEFAULT_PLAYER_VOLUME ));
921
 
922
  $file = reset($files);
923
  $index = key($files);