Music Player for WooCommerce - Version 1.0.176

Version Description

  • Fixes an issue with the products titles.
Download this release

Release Info

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

Code changes from version 1.0.175 to 1.0.176

Files changed (4) hide show
  1. js/public.js +6 -6
  2. js/public_src.js +1 -1
  3. readme.txt +5 -1
  4. wcmp.php +15 -11
js/public.js CHANGED
@@ -3,12 +3,12 @@ $jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.definePrope
3
  $jscomp.polyfill=function(a,e,c,h){if(e){c=$jscomp.global;a=a.split(".");for(h=0;h<a.length-1;h++){var g=a[h];g in c||(c[g]={});c=c[g]}a=a[a.length-1];h=c[a];e=e(h);e!=h&&null!=e&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:e})}};$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6","es3");
4
  (function(){var a=[],e=0;window.generate_the_wcmp=function(c){function h(b,l){if(b+1<e||l){var f=b+1;!l||f!=e&&0!=d('[playernumber="'+f+'"]').closest("[data-loop]").length&&d('[playernumber="'+f+'"]').closest("[data-loop]")[0]==d('[playernumber="'+b+'"]').closest("[data-loop]")[0]||(f=d('[playernumber="'+b+'"]').closest("[data-loop]").find("[playernumber]:first").attr("playernumber"));a[f]instanceof d&&a[f].is("a")?a[f].is(":visible")?a[f].click():h(b+1,l):d(a[f].container).is(":visible")?a[f].play():
5
  h(b+1,l)}}function g(b){var a=b.data("product"),f=d("img.product-"+a);f.length&&1==d('[data-product="'+a+'"]').length&&(a=f.offset(),b=b.closest("div.wcmp-player"),b.css({position:"absolute","z-index":999999}).offset({left:a.left+(f.width()-b.width())/2,top:a.top+(f.height()-b.height())/2}))}if(!("boolean"!==typeof c&&"undefined"!=typeof wcmp_global_settings&&1*wcmp_global_settings.onload)&&"undefined"===typeof generated_the_wcmp){generated_the_wcmp=!0;var d=jQuery;d(".wcmp-player-container").on("click",
6
- "*",function(b){b.preventDefault();b.stopPropagation();return!1});d.expr[":"].regex=function(b,a,f){a=f[3].split(",");var c=/^(data|css):/;f=a[0].match(c)?a[0].split(":")[0]:"attr";c=a.shift().replace(c,"");return(new RegExp(a.join("").replace(/^\s+|\s+$/g,""),"ig")).test(d(b)[f](c))};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;c=d("audio.wcmp-player:not(.track):not([playernumber])");var r=d("audio.wcmp-player.track:not([playernumber])"),m={pauseOtherPlayers:k,iPadUseNativeControls:p,iPhoneUseNativeControls:p,success:function(b,c){var f=d(c).data("duration"),e=d(c).data("estimated_duration"),g=d(c).attr("playernumber");"undefined"!=typeof e&&(b.getDuration=function(){return e});
8
- "undefined"!=typeof f&&setTimeout(function(b,c){return function(){a[b].updateDuration=function(){d(this.media).closest(".wcmp-player").find(".mejs-duration").html(c)};a[b].updateDuration()}}(g,f),50);d(c).attr("volume")&&(b.setVolume(parseFloat(d(c).attr("volume"))),0==b.volume&&b.setMuted(!0));b.addEventListener("timeupdate",function(a){a=b.getDuration();isNaN(b.currentTime)||isNaN(a)||(n&&4>a-b.currentTime?b.setVolume(b.volume-b.volume/3):b.currentTime&&("undefined"==typeof b.bkVolume&&(b.bkVolume=
9
- parseFloat(d(b).find("audio,video").attr("volume")||b.volume)),b.setVolume(b.bkVolume),0==b.bkVolume&&b.setMuted(!0)))});b.addEventListener("volumechange",function(a){a=b.getDuration();isNaN(b.currentTime)||isNaN(a)||!(4<a-b.currentTime)&&n||!b.currentTime||(b.bkVolume=b.volume)});b.addEventListener("ended",function(a){a=d(b).closest('[data-loop="1"]');b.currentTime=0;if(1*q||a.length){var c=1*d(b).attr("playernumber");isNaN(c)&&(c=1*d(b).find("[playernumber]").attr("playernumber"));h(c,a.length)}})}};
10
- k=".product-type-grouped :regex(name,quantity\\[\\d+\\])";c.each(function(){var b=d(this);b.find("source").attr("src");b.attr("playernumber",e);m.audioVolume="vertical";try{a[e]=new MediaElementPlayer(b[0],m)}catch(l){"console"in window&&console.log(l)}e++});r.each(function(){var b=d(this);b.find("source").attr("src");b.attr("playernumber",e);m.features=["playpause"];try{a[e]=new MediaElementPlayer(b[0],m)}catch(l){"console"in window&&console.log(l)}e++;g(b);d(window).resize(function(){g(b)})});d(k).length||
11
- (k=".product-type-grouped [data-product_id]");d(k).length||(k=".woocommerce-grouped-product-list [data-product_id]");d(k).length||(k='.woocommerce-grouped-product-list [id*="product-"]');d(k).each(function(){try{var b=d(this),a=(b.data("product_id")||b.attr("name")||b.attr("id")).replace(/[^\d]/g,""),c=d(".wcmp-player-list.merge_in_grouped_products .product-"+a+":first .wcmp-player-title"),e=d("<table></table>");c.length&&!c.closest(".wcmp-first-in-product").length&&(c.closest("tr").addClass("wcmp-first-in-product"),
12
  0==c.closest("form").length&&c.closest(".wcmp-player-list").prependTo(b.closest("form")),e.append(b.closest("tr").prepend("<td>"+c.html()+"</td>")),c.html("").append(e))}catch(t){}})}};window.wcmp_force_init=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 c=a(this);c.attr("preload",c.data("lazyloading"))});if(e.match(/iPad/i)||
13
  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=!0;var c=a(this);a(".wcmp-player audio").each(function(){this.play();this.pause()});setTimeout(function(){c.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",
14
  wcmp_force_init)})();
3
  $jscomp.polyfill=function(a,e,c,h){if(e){c=$jscomp.global;a=a.split(".");for(h=0;h<a.length-1;h++){var g=a[h];g in c||(c[g]={});c=c[g]}a=a[a.length-1];h=c[a];e=e(h);e!=h&&null!=e&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:e})}};$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6","es3");
4
  (function(){var a=[],e=0;window.generate_the_wcmp=function(c){function h(b,l){if(b+1<e||l){var f=b+1;!l||f!=e&&0!=d('[playernumber="'+f+'"]').closest("[data-loop]").length&&d('[playernumber="'+f+'"]').closest("[data-loop]")[0]==d('[playernumber="'+b+'"]').closest("[data-loop]")[0]||(f=d('[playernumber="'+b+'"]').closest("[data-loop]").find("[playernumber]:first").attr("playernumber"));a[f]instanceof d&&a[f].is("a")?a[f].is(":visible")?a[f].click():h(b+1,l):d(a[f].container).is(":visible")?a[f].play():
5
  h(b+1,l)}}function g(b){var a=b.data("product"),f=d("img.product-"+a);f.length&&1==d('[data-product="'+a+'"]').length&&(a=f.offset(),b=b.closest("div.wcmp-player"),b.css({position:"absolute","z-index":999999}).offset({left:a.left+(f.width()-b.width())/2,top:a.top+(f.height()-b.height())/2}))}if(!("boolean"!==typeof c&&"undefined"!=typeof wcmp_global_settings&&1*wcmp_global_settings.onload)&&"undefined"===typeof generated_the_wcmp){generated_the_wcmp=!0;var d=jQuery;d(".wcmp-player-container").on("click",
6
+ "*",function(b){b.preventDefault();b.stopPropagation();return!1}).parent().removeAttr("title");d.expr[":"].regex=function(b,a,f){a=f[3].split(",");var c=/^(data|css):/;f=a[0].match(c)?a[0].split(":")[0]:"attr";c=a.shift().replace(c,"");return(new RegExp(a.join("").replace(/^\s+|\s+$/g,""),"ig")).test(d(b)[f](c))};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"!=
7
+ typeof wcmp_global_settings?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;c=d("audio.wcmp-player:not(.track):not([playernumber])");var r=d("audio.wcmp-player.track:not([playernumber])"),m={pauseOtherPlayers:k,iPadUseNativeControls:p,iPhoneUseNativeControls:p,success:function(b,c){var f=d(c).data("duration"),e=d(c).data("estimated_duration"),g=d(c).attr("playernumber");"undefined"!=typeof e&&
8
+ (b.getDuration=function(){return e});"undefined"!=typeof f&&setTimeout(function(b,c){return function(){a[b].updateDuration=function(){d(this.media).closest(".wcmp-player").find(".mejs-duration").html(c)};a[b].updateDuration()}}(g,f),50);d(c).attr("volume")&&(b.setVolume(parseFloat(d(c).attr("volume"))),0==b.volume&&b.setMuted(!0));b.addEventListener("timeupdate",function(a){a=b.getDuration();isNaN(b.currentTime)||isNaN(a)||(n&&4>a-b.currentTime?b.setVolume(b.volume-b.volume/3):b.currentTime&&("undefined"==
9
+ typeof b.bkVolume&&(b.bkVolume=parseFloat(d(b).find("audio,video").attr("volume")||b.volume)),b.setVolume(b.bkVolume),0==b.bkVolume&&b.setMuted(!0)))});b.addEventListener("volumechange",function(a){a=b.getDuration();isNaN(b.currentTime)||isNaN(a)||!(4<a-b.currentTime)&&n||!b.currentTime||(b.bkVolume=b.volume)});b.addEventListener("ended",function(a){a=d(b).closest('[data-loop="1"]');b.currentTime=0;if(1*q||a.length){var c=1*d(b).attr("playernumber");isNaN(c)&&(c=1*d(b).find("[playernumber]").attr("playernumber"));
10
+ h(c,a.length)}})}};k=".product-type-grouped :regex(name,quantity\\[\\d+\\])";c.each(function(){var b=d(this);b.find("source").attr("src");b.attr("playernumber",e);m.audioVolume="vertical";try{a[e]=new MediaElementPlayer(b[0],m)}catch(l){"console"in window&&console.log(l)}e++});r.each(function(){var b=d(this);b.find("source").attr("src");b.attr("playernumber",e);m.features=["playpause"];try{a[e]=new MediaElementPlayer(b[0],m)}catch(l){"console"in window&&console.log(l)}e++;g(b);d(window).resize(function(){g(b)})});
11
+ d(k).length||(k=".product-type-grouped [data-product_id]");d(k).length||(k=".woocommerce-grouped-product-list [data-product_id]");d(k).length||(k='.woocommerce-grouped-product-list [id*="product-"]');d(k).each(function(){try{var b=d(this),a=(b.data("product_id")||b.attr("name")||b.attr("id")).replace(/[^\d]/g,""),c=d(".wcmp-player-list.merge_in_grouped_products .product-"+a+":first .wcmp-player-title"),e=d("<table></table>");c.length&&!c.closest(".wcmp-first-in-product").length&&(c.closest("tr").addClass("wcmp-first-in-product"),
12
  0==c.closest("form").length&&c.closest(".wcmp-player-list").prependTo(b.closest("form")),e.append(b.closest("tr").prepend("<td>"+c.html()+"</td>")),c.html("").append(e))}catch(t){}})}};window.wcmp_force_init=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 c=a(this);c.attr("preload",c.data("lazyloading"))});if(e.match(/iPad/i)||
13
  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=!0;var c=a(this);a(".wcmp-player audio").each(function(){this.play();this.pause()});setTimeout(function(){c.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",
14
  wcmp_force_init)})();
js/public_src.js CHANGED
@@ -14,7 +14,7 @@
14
  generated_the_wcmp = true;
15
 
16
  var $ = jQuery;
17
- $('.wcmp-player-container').on('click', '*', function(evt){evt.preventDefault();evt.stopPropagation();return false;});
18
 
19
  /**
20
  * Play next player
14
  generated_the_wcmp = true;
15
 
16
  var $ = jQuery;
17
+ $('.wcmp-player-container').on('click', '*', function(evt){evt.preventDefault();evt.stopPropagation();return false;}).parent().removeAttr('title');
18
 
19
  /**
20
  * Play next player
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://wcmp.dwbooster.com
4
  Tags:WooCommerce,music player,audio,music,song,player,audio player,media player,mp3,m3u,m3u8,wav,oga,ogg,dokan,wcfm
5
  Requires at least: 3.5.0
6
  Tested up to: 6.0
7
- Stable tag: 1.0.175
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -226,6 +226,10 @@ Each time save the data of a product, the files for demo are deleted and generat
226
 
227
  == Changelog ==
228
 
 
 
 
 
229
  = 1.0.175 =
230
 
231
  * Improves the plugin's code and its security.
4
  Tags:WooCommerce,music player,audio,music,song,player,audio player,media player,mp3,m3u,m3u8,wav,oga,ogg,dokan,wcfm
5
  Requires at least: 3.5.0
6
  Tested up to: 6.0
7
+ Stable tag: 1.0.176
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
226
 
227
  == Changelog ==
228
 
229
+ = 1.0.176 =
230
+
231
+ * Fixes an issue with the products titles.
232
+
233
  = 1.0.175 =
234
 
235
  * Improves the plugin's code and its security.
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.175
6
  Text Domain: music-player-for-woocommerce
7
  Author: CodePeople
8
  Author URI: https://wcmp.dwbooster.com
@@ -205,12 +205,7 @@ if ( ! class_exists( 'WooCommerceMusicPlayer' ) ) {
205
  ) {
206
  add_filter( 'woocommerce_product_title', array( &$this, 'woocommerce_product_title' ), 10, 2 );
207
 
208
- add_filter( 'esc_html', function( $safe_text, $text ) {
209
- if ( strpos( $safe_text, 'wcmp-player-container' ) !== false ) {
210
- return $text;
211
- }
212
- return $safe_text;
213
- }, 10, 2 );
214
  }
215
 
216
  // For accepting the <source> tags
@@ -423,6 +418,13 @@ if ( ! class_exists( 'WooCommerceMusicPlayer' ) ) {
423
  delete_post_meta( $post_id, '_wcmp_on_cover' );
424
  } // End delete_post
425
 
 
 
 
 
 
 
 
426
  public function enqueue_resources() {
427
  if ( $this->_enqueued_resources ) {
428
  return;
@@ -439,7 +441,7 @@ if ( ! class_exists( 'WooCommerceMusicPlayer' ) ) {
439
  wp_enqueue_style( 'wcmp-style', plugin_dir_url( __FILE__ ) . 'css/style.css' );
440
  wp_enqueue_script( 'jquery' );
441
  wp_enqueue_script( 'wp-mediaelement' );
442
- wp_enqueue_script( 'wcmp-script', plugin_dir_url( __FILE__ ) . 'js/public.js', array( 'jquery', 'wp-mediaelement' ), '1.0.175' );
443
 
444
  $play_all = $GLOBALS['WooCommerceMusicPlayer']->get_global_attr(
445
  '_wcmp_play_all',
@@ -660,8 +662,8 @@ if ( ! class_exists( 'WooCommerceMusicPlayer' ) ) {
660
  // Enqueue resources
661
 
662
  $this->enqueue_resources();
663
- wp_enqueue_style( 'wcmp-playlist-widget-style', plugin_dir_url( __FILE__ ) . 'widgets/playlist_widget/css/style.css', array(), '1.0.175' );
664
- wp_enqueue_script( 'wcmp-playlist-widget-script', plugin_dir_url( __FILE__ ) . 'widgets/playlist_widget/js/public.js', array(), '1.0.175' );
665
  wp_localize_script(
666
  'wcmp-playlist-widget-script',
667
  'wcmp_widget_settings',
@@ -891,9 +893,11 @@ if ( ! class_exists( 'WooCommerceMusicPlayer' ) ) {
891
  public function include_main_player_filter( $value, $id ) {
892
  if ( $this->_force_hook_title ) {
893
  try {
894
- if ( ! is_admin() && ( ! function_exists( 'is_product' ) || ! is_product() ) && ! is_cart() && ! is_page( 'cart' ) && ! is_checkout() && is_int( $id ) ) {
895
  $p = wc_get_product( $id );
896
  if ( ! empty( $p ) ) {
 
 
897
  $player = '';
898
  ob_start();
899
  $this->include_main_player( $p );
2
  /*
3
  Plugin Name: Music Player for WooCommerce
4
  Plugin URI: https://wcmp.dwbooster.com
5
+ Version: 1.0.176
6
  Text Domain: music-player-for-woocommerce
7
  Author: CodePeople
8
  Author URI: https://wcmp.dwbooster.com
205
  ) {
206
  add_filter( 'woocommerce_product_title', array( &$this, 'woocommerce_product_title' ), 10, 2 );
207
 
208
+ add_filter( 'esc_html', array( &$this, 'esc_html' ), 10, 2 );
 
 
 
 
 
209
  }
210
 
211
  // For accepting the <source> tags
418
  delete_post_meta( $post_id, '_wcmp_on_cover' );
419
  } // End delete_post
420
 
421
+ public function esc_html( $safe_text, $text ) {
422
+ if ( strpos( $safe_text, 'wcmp-player-container' ) !== false ) {
423
+ return $text;
424
+ }
425
+ return $safe_text;
426
+ } // End esc_html
427
+
428
  public function enqueue_resources() {
429
  if ( $this->_enqueued_resources ) {
430
  return;
441
  wp_enqueue_style( 'wcmp-style', plugin_dir_url( __FILE__ ) . 'css/style.css' );
442
  wp_enqueue_script( 'jquery' );
443
  wp_enqueue_script( 'wp-mediaelement' );
444
+ wp_enqueue_script( 'wcmp-script', plugin_dir_url( __FILE__ ) . 'js/public.js', array( 'jquery', 'wp-mediaelement' ), '1.0.176' );
445
 
446
  $play_all = $GLOBALS['WooCommerceMusicPlayer']->get_global_attr(
447
  '_wcmp_play_all',
662
  // Enqueue resources
663
 
664
  $this->enqueue_resources();
665
+ wp_enqueue_style( 'wcmp-playlist-widget-style', plugin_dir_url( __FILE__ ) . 'widgets/playlist_widget/css/style.css', array(), '1.0.176' );
666
+ wp_enqueue_script( 'wcmp-playlist-widget-script', plugin_dir_url( __FILE__ ) . 'widgets/playlist_widget/js/public.js', array(), '1.0.176' );
667
  wp_localize_script(
668
  'wcmp-playlist-widget-script',
669
  'wcmp_widget_settings',
893
  public function include_main_player_filter( $value, $id ) {
894
  if ( $this->_force_hook_title ) {
895
  try {
896
+ if ( ( wp_doing_ajax() || ! is_admin() ) && ( ! function_exists( 'is_product' ) || ! is_product() ) && ! is_cart() && ! is_page( 'cart' ) && ! is_checkout() && is_int( $id ) ) {
897
  $p = wc_get_product( $id );
898
  if ( ! empty( $p ) ) {
899
+ add_filter( 'esc_html', array( &$this, 'esc_html' ), 10, 2 );
900
+
901
  $player = '';
902
  ob_start();
903
  $this->include_main_player( $p );