Music Player for WooCommerce - Version 1.0.175

Version Description

  • Improves the plugin's code and its security.
  • Allows the integration with popular third-party plugins.
Download this release

Release Info

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

Code changes from version 1.0.174 to 1.0.175

Files changed (4) hide show
  1. readme.txt +6 -1
  2. views/global_options.php +2 -2
  3. views/player_options.php +113 -104
  4. wcmp.php +29 -10
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.174
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -226,6 +226,11 @@ Each time save the data of a product, the files for demo are deleted and generat
226
 
227
  == Changelog ==
228
 
 
 
 
 
 
229
  = 1.0.174 =
230
  = 1.0.173 =
231
 
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
 
227
  == Changelog ==
228
 
229
+ = 1.0.175 =
230
+
231
+ * Improves the plugin's code and its security.
232
+ * Allows the integration with popular third-party plugins.
233
+
234
  = 1.0.174 =
235
  = 1.0.173 =
236
 
views/global_options.php CHANGED
@@ -4,8 +4,8 @@ if ( ! defined( 'WCMP_PLUGIN_URL' ) ) {
4
  exit; }
5
 
6
  // include resources
7
- wp_enqueue_style( 'wcmp-admin-style', plugin_dir_url( __FILE__ ) . '../css/style.admin.css', array(), '1.0.174' );
8
- wp_enqueue_script( 'wcmp-admin-js', plugin_dir_url( __FILE__ ) . '../js/admin.js', array(), '1.0.174' );
9
 
10
  $ffmpeg_system_path = defined( 'PHP_OS' ) && strtolower( PHP_OS ) == 'linux' ? @shell_exec( 'which ffmpeg' ) : '';
11
 
4
  exit; }
5
 
6
  // include resources
7
+ wp_enqueue_style( 'wcmp-admin-style', plugin_dir_url( __FILE__ ) . '../css/style.admin.css', array(), '1.0.175' );
8
+ wp_enqueue_script( 'wcmp-admin-js', plugin_dir_url( __FILE__ ) . '../js/admin.js', array(), '1.0.175' );
9
 
10
  $ffmpeg_system_path = defined( 'PHP_OS' ) && strtolower( PHP_OS ) == 'linux' ? @shell_exec( 'which ffmpeg' ) : '';
11
 
views/player_options.php CHANGED
@@ -1,66 +1,71 @@
1
  <?php
2
- if( !defined( 'WCMP_PLUGIN_URL' ) ) { echo 'Direct access not allowed.'; exit; }
 
 
3
 
4
  // include resources
5
- wp_enqueue_style( 'wcmp-admin-style', plugin_dir_url(__FILE__).'../css/style.admin.css', array(), '1.0.24' );
6
 
7
- if(empty($post)) global $post;
 
 
8
 
9
- $enable_player = $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $post->ID, '_wcmp_enable_player', false );
10
- $show_in = $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $post->ID, '_wcmp_show_in', 'all' );
11
- $player_style = $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $post->ID, '_wcmp_player_layout', WCMP_DEFAULT_PLAYER_LAYOUT );
12
- $volume = $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $post->ID, '_wcmp_player_volume', WCMP_DEFAULT_PLAYER_VOLUME );
13
- $player_controls= $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $post->ID, '_wcmp_player_controls', WCMP_DEFAULT_PLAYER_CONTROLS );
14
- $player_title= intval( $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $post->ID, '_wcmp_player_title', 1 ) );
15
- $merge_grouped = intval( $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $post->ID, '_wcmp_merge_in_grouped',0 ) );
16
- $play_all = intval( $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr(
17
- $post->ID,
18
- '_wcmp_play_all',
19
- // This option is only for compatibility with versions previous to 1.0.28
20
- $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr(
 
21
  $post->ID,
22
  'play_all',
23
  0
24
  )
25
- )
26
- );
27
- $preload = $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr(
28
- $post->ID,
29
- '_wcmp_preload',
30
- $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr(
31
- $post->ID,
32
- 'preload',
33
- 'none'
34
- )
35
- );
36
- $on_cover = intval( $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $post->ID, '_wcmp_on_cover', 0 ) );
37
  ?>
38
- <input type="hidden" name="wcmp_nonce" value="<?php echo wp_create_nonce('wcmp_updating_product'); ?>" />
39
  <table class="widefat" style="border-left:0;border-right:0;border-bottom:0;padding-bottom:0;">
40
  <tr>
41
  <td>
42
- <?php if(current_user_can( 'manage_options' )): ?>
43
  <div class="wcmp-highlight-box">
44
- <?php
45
- _e(
46
- '<p>The player uses the audio files associated to the product. If you want protecting the audio files for selling, tick the checkbox: <b>"Protect the file"</b>, in whose case the plugin will create a truncated version of the audio files for selling to be used for demo. The size of audio files for demo is based on the number entered through the attribute: <b>"Percent of audio used for protected playbacks"</b>.</p><p><b>Protecting the files prevents that malicious users can access to the original audio files without pay for them.</b></p>',
47
- 'music-player-for-woocommerce'
48
- );
49
- ?>
50
- <p><?php _e( 'The security feature and particular files for demo are only available in the PRO version of the plugin', 'music-player-for-woocommerce'); ?>. <a target="_blank" href="https://wcmp.dwbooster.com"><?php _e('CLICK HERE TO GET THE PRO VERSION OF THE PLUGIN', 'music-player-for-woocommerce'); ?></a></p>
51
- <p><?php _e( 'For testing the premium version of the plugin, visit the online demo:<br/> <a href="https://demos.dwbooster.com/music-player-for-woocommerce/wp-login.php" target="_blank">Administration area: Click to access the administration area demo</a><br/><a href="https://demos.dwbooster.com/music-player-for-woocommerce/" target="_blank">Public page: Click to visit the WooCommerce Store</a>', 'music-player-for-woocommerce'); ?></p>
52
  </div>
53
  <?php endif; ?>
54
  <div class="wcmp-highlight-box">
55
  <div id="wcmp_tips_header">
56
  <h3 style="margin-top:2px;margin-bottom:5px;cursor:pointer;" onclick="jQuery('#wcmp_tips_body').toggle();">
57
- <?php _e('[+|-] Tips', 'music-player-for-woocommerce'); ?>
58
  </h3>
59
  </div>
60
  <div id="wcmp_tips_body">
61
  <div class="wcmp-highlight-box">
62
  <a class="wcmp-tip"href="javascript:void(0);" onclick="jQuery(this).next('.wcmp-tip-text').toggle();">
63
- <?php _e('[+|-] Using the audio files stored on Google Drive', 'music-player-for-woocommerce'); ?>
64
  </a>
65
  <div class="wcmp-tip-text">
66
  <ul>
@@ -71,7 +76,7 @@ $on_cover = intval( $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $p
71
  'Go to Drive, press the right click on the file to use, and select the option: <b>"Get Shareable Link"</b>',
72
  'music-player-for-woocommerce'
73
  );
74
- ?>
75
  </p>
76
  <p>
77
  <?php
@@ -79,17 +84,17 @@ $on_cover = intval( $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $p
79
  'The previous action will generate an url with the structure: <b>https://drive.google.com/open?id=FILE_ID</b>',
80
  'music-player-for-woocommerce'
81
  );
82
- ?>
83
  </p>
84
  </li>
85
  <li>
86
  <p> -
87
  <?php
88
- _e(
89
  'Knowing the FILE_ID, extracted from the previous URL, enter the URL below, into the WooCommerce product, to allow the Music Player accessing to it:',
90
  'music-player-for-woocommerce'
91
  );
92
- ?>
93
  </p>
94
  <p>
95
  <b>https://drive.google.com/uc?export=download&id=FILE_ID&.mp3</b>
@@ -107,7 +112,7 @@ $on_cover = intval( $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $p
107
  </div>
108
  <div class="wcmp-highlight-box">
109
  <a class="wcmp-tip"href="javascript:void(0);" onclick="jQuery(this).next('.wcmp-tip-text').toggle();">
110
- <?php _e('[+|-] Using the audio files stored on DropBox', 'music-player-for-woocommerce'); ?>
111
  </a>
112
  <div class="wcmp-tip-text">
113
  <ul>
@@ -118,7 +123,7 @@ $on_cover = intval( $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $p
118
  'Sign in to <a href="https://www.dropbox.com/login" target="_blank">dropbox.com </a>',
119
  'music-player-for-woocommerce'
120
  );
121
- ?>
122
  </p>
123
  </li>
124
  <li>
@@ -128,17 +133,17 @@ $on_cover = intval( $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $p
128
  "Hover your cursor over the file or folder you'd like to share and click <b>Share</b> when it appears.",
129
  'music-player-for-woocommerce'
130
  );
131
- ?>
132
  </p>
133
  </li>
134
  <li>
135
  <p> -
136
  <?php
137
- _e(
138
- "If a link hasn't been created, click Create a link. (If a link was already created, click Copy link.",
139
  'music-player-for-woocommerce'
140
  );
141
- ?>
142
  </p>
143
  <p>
144
  <?php
@@ -146,7 +151,7 @@ $on_cover = intval( $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $p
146
  'The link structure would be similar to:<br> https://www.dropbox.com/s/rycvgn8iokfedmo/file.mp3?dl=0',
147
  'music-player-for-woocommerce'
148
  );
149
- ?>
150
  </p>
151
  </li>
152
  <li>
@@ -156,7 +161,7 @@ $on_cover = intval( $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $p
156
  'Enter the URL into the WooCommerce product with the following structure:<br> https://www.dropbox.com/s/rycvgn8iokfedmo/file.mp3?dl=1&.mp3',
157
  'music-player-for-woocommerce'
158
  );
159
- ?>
160
  </p>
161
  <p>
162
  <?php
@@ -177,108 +182,112 @@ $on_cover = intval( $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $p
177
  <td>
178
  <table class="widefat wcmp-player-settings" style="border:1px solid #e1e1e1;">
179
  <tr>
180
- <td><?php _e( 'Include music player', 'music-player-for-woocommerce' ); ?></td>
181
- <td><div class="wcmp-tooltip"><span class="wcmp-tooltiptext"><?php _e('The player is shown only if the product is "downloadable", and there is at least an audio file between the "Downloadable files"', 'music-player-for-woocommerce'); ?></span><input aria-label="<?php print esc_attr(__('Enable player','music-player-for-woocommerce')); ?>" type="checkbox" name="_wcmp_enable_player" <?php echo (( $enable_player ) ? 'checked' : '' ); ?> /></div></td>
182
  </tr>
183
  <tr>
184
- <td><?php _e( 'Include in', 'music-player-for-woocommerce' ); ?></td>
185
  <td>
186
- <input aria-label="<?php print esc_attr(__('Include on products pages','music-player-for-woocommerce')); ?>" type="radio" name="_wcmp_show_in" value="single" <?php echo (( $show_in == 'single' ) ? 'checked' : '' ); ?> />
187
- <?php _e('single-entry pages <i>(Product\'s page only)</i>', 'music-player-for-woocommerce'); ?><br />
188
 
189
- <input aria-label="<?php print esc_attr(__('Include on multiple-entry pages','music-player-for-woocommerce')); ?>" type="radio" name="_wcmp_show_in" value="multiple" <?php echo (( $show_in == 'multiple' ) ? 'checked' : '' ); ?> />
190
- <?php _e('multiple entries pages <i>(Shop pages, archive pages, but not in the product\'s page)</i>', 'music-player-for-woocommerce'); ?><br />
191
 
192
- <input aria-label="<?php print esc_attr(__('Include on product and multiple-entry pages', 'music-player-for-woocommerce')); ?>" type="radio" name="_wcmp_show_in" value="all" <?php echo (( $show_in == 'all' ) ? 'checked' : '' ); ?> />
193
- <?php _e('all pages <i>(with single or multiple-entries)</i>', 'music-player-for-woocommerce'); ?>
194
  </td>
195
  </tr>
196
  <tr>
197
- <td><?php _e( 'Merge in grouped products', 'music-player-for-woocommerce' ); ?></td>
198
- <td><input aria-label="<?php print esc_attr(__('Merge in grouped products','music-player-for-woocommerce')); ?>" type="checkbox" name="_wcmp_merge_in_grouped" <?php echo (( $merge_grouped ) ? 'checked' : '' ); ?> /><br /><em><?php _e( 'In grouped products, display the "Add to cart" buttons and quantity fields in the players rows', 'music-player-for-woocommerce' ); ?></em></td>
199
  </tr>
200
  <tr>
201
- <td valign="top"><?php _e( 'Player layout', 'music-player-for-woocommerce' ); ?></td>
202
  <td>
203
  <table>
204
  <tr>
205
- <td><input aria-label="<?php print esc_attr(__('Skin 1','music-player-for-woocommerce')); ?>" name="_wcmp_player_layout" type="radio" value="mejs-classic" <?php echo (($player_style == 'mejs-classic') ? 'checked' : '') ;?> /></td>
206
- <td><img alt="<?php print esc_attr(__('Skin 1','music-player-for-woocommerce')); ?>" src="<?php print esc_url(WCMP_PLUGIN_URL); ?>/views/assets/skin1.png" /></td>
207
  </tr>
208
 
209
  <tr>
210
- <td><input aria-label="<?php print esc_attr(__('Skin 2','music-player-for-woocommerce')); ?>" name="_wcmp_player_layout" type="radio" value="mejs-ted" <?php echo (($player_style == 'mejs-ted') ? 'checked' : '') ;?> /></td>
211
- <td><img alt="<?php print esc_attr(__('Skin 2','music-player-for-woocommerce')); ?>" src="<?php print esc_url(WCMP_PLUGIN_URL); ?>/views/assets/skin2.png" /></td>
212
  </tr>
213
 
214
  <tr>
215
- <td><input aria-label="<?php print esc_attr(__('Skin 3','music-player-for-woocommerce')); ?>" name="_wcmp_player_layout" type="radio" value="mejs-wmp" <?php echo (($player_style == 'mejs-wmp') ? 'checked' : '') ;?> /></td>
216
- <td><img alt="<?php print esc_attr(__('Skin 3','music-player-for-woocommerce')); ?>" src="<?php print esc_url(WCMP_PLUGIN_URL); ?>/views/assets/skin3.png" /></td>
217
  </tr>
218
  </table>
219
  </td>
220
  </tr>
221
  <tr>
222
  <td>
223
- <?php _e( 'Preload', 'music-player-for-woocommerce' ); ?>
224
  </td>
225
  <td>
226
- <label><input aria-label="<?php print esc_attr(__('Preload - none','music-player-for-woocommerce')); ?>" type="radio" name="_wcmp_preload" value="none" <?php if($preload == 'none') echo 'CHECKED'; ?> /> None</label><br />
227
- <label><input aria-label="<?php print esc_attr(__('Preload - metadata','music-player-for-woocommerce')); ?>" type="radio" name="_wcmp_preload" value="metadata" <?php if($preload == 'metadata') echo 'CHECKED'; ?> /> Metadata</label><br />
228
- <label><input aria-label="<?php print esc_attr(__('Preload - auto','music-player-for-woocommerce')); ?>" type="radio" name="_wcmp_preload" value="auto" <?php if($preload == 'auto') echo 'CHECKED'; ?> /> Auto</label><br />
 
 
 
229
  </td>
230
  </tr>
231
  <tr>
232
  <td>
233
- <?php _e( 'Play all', 'music-player-for-woocommerce' ); ?>
234
  </td>
235
  <td>
236
- <input aria-label="<?php print esc_attr(__('Play all','music-player-for-woocommerce')); ?>" type="checkbox" name="_wcmp_play_all" <?php if(!empty($play_all)) echo 'CHECKED'; ?> />
 
237
  </td>
238
  </tr>
239
  <tr>
240
- <td><?php _e( 'Player volume (from 0 to 1)', 'music-player-for-woocommerce' ); ?></td>
241
  <td>
242
- <input aria-label="<?php print esc_attr(__('Player volume', 'music-player-for-woocommerce')); ?>" type="number" name="_wcmp_player_volume" min="0" max="1" step="0.01" value="<?php echo esc_attr($volume); ?>" />
243
  </td>
244
  </tr>
245
  <tr>
246
- <td><?php _e( 'Player controls', 'music-player-for-woocommerce' ); ?></td>
247
  <td>
248
- <input aria-label="<?php print esc_attr(__('Play/pause button','music-player-for-woocommerce')); ?>" type="radio" name="_wcmp_player_controls" value="button" <?php echo (( $player_controls == 'button' ) ? 'checked' : ''); ?> /> <?php _e( 'the play/pause button only', 'music-player-for-woocommerce' ); ?><br />
249
- <input aria-label="<?php print esc_attr(__('All controls', 'music-player-for-woocommerce')); ?>" type="radio" name="_wcmp_player_controls" value="all" <?php echo (( $player_controls == 'all' ) ? 'checked' : ''); ?> /> <?php _e( 'all controls', 'music-player-for-woocommerce' ); ?><br />
250
- <input aria-label="<?php print esc_attr(__('Depending on context','music-player-for-woocommerce')); ?>" type="radio" name="_wcmp_player_controls" value="default" <?php echo (( $player_controls == 'default' ) ? 'checked' : ''); ?> /> <?php _e( 'the play/pause button only, or all controls depending on context', 'music-player-for-woocommerce' ); ?>
251
  <div class="wcmp-on-cover" style="margin-top:10px;">
252
- <input aria-label="<?php print esc_attr(__('On cover','music-player-for-woocommerce')); ?>" type="checkbox" name="_wcmp_player_on_cover" value="default" <?php
253
- echo ((!empty($on_cover) && ( $player_controls == 'button' || $player_controls == 'default')) ? 'checked' : '');
254
  ?> />
255
- <?php _e( 'for play/pause button players display them on cover images.', 'music-player-for-woocommerce' ); ?>
256
  <i>
257
  <?php
258
- _e('(This feature is experimental, and will depend on the theme active on the website.)', 'music-player-for-woocommerce');
259
  ?>
260
  </i>
261
  </div>
262
  </td>
263
  </tr>
264
  <tr>
265
- <td><?php _e( 'Display the player\'s title', 'music-player-for-woocommerce' ); ?></td>
266
  <td>
267
- <input aria-label="<?php print esc_attr(__('Display the player title','music-player-for-woocommerce')); ?>" type="checkbox" name="_wcmp_player_title" <?php echo (( !empty($player_title) ) ? 'checked' : ''); ?> />
268
  </td>
269
  </tr>
270
  <tr>
271
- <td colspan="2" style="color:red;"><?php _e( 'The security feature is only available in the PRO version of the plugin', 'music-player-for-woocommerce'); ?>. <a target="_blank" href="https://wcmp.dwbooster.com"><?php _e('CLICK HERE TO GET THE PRO VERSION OF THE PLUGIN', 'music-player-for-woocommerce'); ?></a></td>
272
  </tr>
273
  <tr>
274
- <td style="color:#DDDDDD;"><?php _e( 'Protect the file', 'music-player-for-woocommerce' ); ?></td>
275
- <td><input aria-label="<?php print esc_attr(__('Protect the file','music-player-for-woocommerce')); ?>" type="checkbox" DISABLED /></td>
276
  </tr>
277
  <tr valign="top">
278
- <td style="color:#DDDDDD;"><?php _e('Percent of audio used for protected playbacks', 'music-player-for-woocommerce'); ?></td>
279
  <td style="color:#DDDDDD;">
280
- <input aria-label="<?php print esc_attr(__('Percent of audio used for protected playbacks','music-player-for-woocommerce')); ?>" type="number" DISABLED /> % <br /><br />
281
- <em><?php _e('To prevent unauthorized copying of audio files, the files will be partially accessible', 'music-player-for-woocommerce'); ?></em>
282
  </td>
283
  </tr>
284
  </table>
@@ -290,39 +299,39 @@ $on_cover = intval( $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $p
290
  <td style="color:#DDDDDD;">
291
  <table class="widefat wcmp-player-demos" style="border:1px solid #e1e1e1;">
292
  <tr valign="top">
293
- <td style="color:#DDDDDD;"><input aria-label="<?php print esc_attr(__('Own demo files','music-player-for-woocommerce')); ?>" type="checkbox" disabled /> <?php _e('Select my own demo files', 'music-player-for-woocommerce'); ?></td>
294
  </tr>
295
  <tr valign="top" class="wcmp-demo-files">
296
  <td>
297
- <div style="color:#DDDDDD;"><?php _e('Demo files', 'music-player-for-woocommerce'); ?></div>
298
  <table class="widefat">
299
  <thead>
300
  <tr>
301
- <th style="color:#DDDDDD;"><?php _e('Name', 'music-player-for-woocommerce'); ?></th>
302
- <th colspan="2" style="color:#DDDDDD;"><?php _e('File URL', 'music-player-for-woocommerce'); ?></th>
303
  <th>&nbsp;</th>
304
  </tr>
305
  </thead>
306
  <tbody>
307
  <tr>
308
  <td>
309
- <input aria-label="<?php print esc_attr(__('File name','music-player-for-woocommerce')); ?>" type="text" class="wcmp-file-name" placeholder="<?php _e('File Name', 'music-player-for-woocommerce'); ?>" disabled style="color:#DDDDDD;" />
310
  </td>
311
  <td>
312
- <input aria-label="<?php print esc_attr(__('File URL','music-player-for-woocommerce')); ?>" type="text" class="wcmp-file-url" placeholder="http://" disabled style="color:#DDDDDD;" />
313
  </td>
314
  <td width="1%" style="color:#DDDDDD;">
315
- <a href="javascript:void(0);" class="button wcmp-select-file" style="color:#DDDDDD;"><?php _e('Choose file', 'music-player-for-woocommerce'); ?></a>
316
  </td>
317
  <td width="1%" style="color:#DDDDDD;">
318
- <a href="javascript:void(0);" class="wcmp-delete" style="color:#DDDDDD;"><?php _e('Delete', 'music-player-for-woocommerce');?></a>
319
  </td>
320
  </tr>
321
  </tbody>
322
  <tfoot>
323
  <tr>
324
  <th colspan="4" style="color:#DDDDDD;">
325
- <a href="javascript:void(0);" class="button wcmp-add" style="color:#DDDDDD;"><?php _e('Add File', 'music-player-for-woocommerce'); ?></a>
326
  </th>
327
  </tr>
328
  </tfoot>
@@ -339,7 +348,7 @@ $on_cover = intval( $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $p
339
  {
340
  var v = $('[name="_wcmp_player_controls"]:checked').val(),
341
  c = $('.wcmp-on-cover');
342
- if(v == 'default' || v == 'button') c.show();
343
  else c.hide();
344
  };
345
  $(document).on('change', '[name="_wcmp_player_controls"]', function(){
@@ -347,4 +356,4 @@ $on_cover = intval( $GLOBALS[ 'WooCommerceMusicPlayer' ]->get_product_attr( $p
347
  });
348
  coverSection();
349
  });</script>
350
- <style>.wcmp-player-settings tr td:first-child{width:225px;}</style>
1
  <?php
2
+ if ( ! defined( 'WCMP_PLUGIN_URL' ) ) {
3
+ echo 'Direct access not allowed.';
4
+ exit; }
5
 
6
  // include resources
7
+ wp_enqueue_style( 'wcmp-admin-style', plugin_dir_url( __FILE__ ) . '../css/style.admin.css', array(), '1.0.175' );
8
 
9
+ if ( empty( $post ) ) {
10
+ global $post;
11
+ }
12
 
13
+ $enable_player = $GLOBALS['WooCommerceMusicPlayer']->get_product_attr( $post->ID, '_wcmp_enable_player', false );
14
+ $show_in = $GLOBALS['WooCommerceMusicPlayer']->get_product_attr( $post->ID, '_wcmp_show_in', 'all' );
15
+ $player_style = $GLOBALS['WooCommerceMusicPlayer']->get_product_attr( $post->ID, '_wcmp_player_layout', WCMP_DEFAULT_PLAYER_LAYOUT );
16
+ $volume = $GLOBALS['WooCommerceMusicPlayer']->get_product_attr( $post->ID, '_wcmp_player_volume', WCMP_DEFAULT_PLAYER_VOLUME );
17
+ $player_controls = $GLOBALS['WooCommerceMusicPlayer']->get_product_attr( $post->ID, '_wcmp_player_controls', WCMP_DEFAULT_PLAYER_CONTROLS );
18
+ $player_title = intval( $GLOBALS['WooCommerceMusicPlayer']->get_product_attr( $post->ID, '_wcmp_player_title', 1 ) );
19
+ $merge_grouped = intval( $GLOBALS['WooCommerceMusicPlayer']->get_product_attr( $post->ID, '_wcmp_merge_in_grouped', 0 ) );
20
+ $play_all = intval(
21
+ $GLOBALS['WooCommerceMusicPlayer']->get_product_attr(
22
+ $post->ID,
23
+ '_wcmp_play_all',
24
+ // This option is only for compatibility with versions previous to 1.0.28
25
+ $GLOBALS['WooCommerceMusicPlayer']->get_product_attr(
26
  $post->ID,
27
  'play_all',
28
  0
29
  )
30
+ )
31
+ );
32
+ $preload = $GLOBALS['WooCommerceMusicPlayer']->get_product_attr(
33
+ $post->ID,
34
+ '_wcmp_preload',
35
+ $GLOBALS['WooCommerceMusicPlayer']->get_product_attr(
36
+ $post->ID,
37
+ 'preload',
38
+ 'none'
39
+ )
40
+ );
41
+ $on_cover = intval( $GLOBALS['WooCommerceMusicPlayer']->get_product_attr( $post->ID, '_wcmp_on_cover', 0 ) );
42
  ?>
43
+ <input type="hidden" name="wcmp_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wcmp_updating_product' ) ); ?>" />
44
  <table class="widefat" style="border-left:0;border-right:0;border-bottom:0;padding-bottom:0;">
45
  <tr>
46
  <td>
47
+ <?php if ( current_user_can( 'manage_options' ) ) : ?>
48
  <div class="wcmp-highlight-box">
49
+ <?php
50
+ _e(
51
+ '<p>The player uses the audio files associated to the product. If you want protecting the audio files for selling, tick the checkbox: <b>"Protect the file"</b>, in whose case the plugin will create a truncated version of the audio files for selling to be used for demo. The size of audio files for demo is based on the number entered through the attribute: <b>"Percent of audio used for protected playbacks"</b>.</p><p><b>Protecting the files prevents that malicious users can access to the original audio files without pay for them.</b></p>',
52
+ 'music-player-for-woocommerce'
53
+ );
54
+ ?>
55
+ <p><?php esc_html_e( 'The security feature and particular files for demo are only available in the PRO version of the plugin', 'music-player-for-woocommerce' ); ?>. <a target="_blank" href="https://wcmp.dwbooster.com"><?php esc_html_e( 'CLICK HERE TO GET THE PRO VERSION OF THE PLUGIN', 'music-player-for-woocommerce' ); ?></a></p>
56
+ <p><?php _e( 'For testing the premium version of the plugin, visit the online demo:<br/> <a href="https://demos.dwbooster.com/music-player-for-woocommerce/wp-login.php" target="_blank">Administration area: Click to access the administration area demo</a><br/><a href="https://demos.dwbooster.com/music-player-for-woocommerce/" target="_blank">Public page: Click to visit the WooCommerce Store</a>', 'music-player-for-woocommerce' ); ?></p>
57
  </div>
58
  <?php endif; ?>
59
  <div class="wcmp-highlight-box">
60
  <div id="wcmp_tips_header">
61
  <h3 style="margin-top:2px;margin-bottom:5px;cursor:pointer;" onclick="jQuery('#wcmp_tips_body').toggle();">
62
+ <?php esc_html_e( '[+|-] Tips', 'music-player-for-woocommerce' ); ?>
63
  </h3>
64
  </div>
65
  <div id="wcmp_tips_body">
66
  <div class="wcmp-highlight-box">
67
  <a class="wcmp-tip"href="javascript:void(0);" onclick="jQuery(this).next('.wcmp-tip-text').toggle();">
68
+ <?php esc_html_e( '[+|-] Using the audio files stored on Google Drive', 'music-player-for-woocommerce' ); ?>
69
  </a>
70
  <div class="wcmp-tip-text">
71
  <ul>
76
  'Go to Drive, press the right click on the file to use, and select the option: <b>"Get Shareable Link"</b>',
77
  'music-player-for-woocommerce'
78
  );
79
+ ?>
80
  </p>
81
  <p>
82
  <?php
84
  'The previous action will generate an url with the structure: <b>https://drive.google.com/open?id=FILE_ID</b>',
85
  'music-player-for-woocommerce'
86
  );
87
+ ?>
88
  </p>
89
  </li>
90
  <li>
91
  <p> -
92
  <?php
93
+ esc_html_e(
94
  'Knowing the FILE_ID, extracted from the previous URL, enter the URL below, into the WooCommerce product, to allow the Music Player accessing to it:',
95
  'music-player-for-woocommerce'
96
  );
97
+ ?>
98
  </p>
99
  <p>
100
  <b>https://drive.google.com/uc?export=download&id=FILE_ID&.mp3</b>
112
  </div>
113
  <div class="wcmp-highlight-box">
114
  <a class="wcmp-tip"href="javascript:void(0);" onclick="jQuery(this).next('.wcmp-tip-text').toggle();">
115
+ <?php esc_html_e( '[+|-] Using the audio files stored on DropBox', 'music-player-for-woocommerce' ); ?>
116
  </a>
117
  <div class="wcmp-tip-text">
118
  <ul>
123
  'Sign in to <a href="https://www.dropbox.com/login" target="_blank">dropbox.com </a>',
124
  'music-player-for-woocommerce'
125
  );
126
+ ?>
127
  </p>
128
  </li>
129
  <li>
133
  "Hover your cursor over the file or folder you'd like to share and click <b>Share</b> when it appears.",
134
  'music-player-for-woocommerce'
135
  );
136
+ ?>
137
  </p>
138
  </li>
139
  <li>
140
  <p> -
141
  <?php
142
+ esc_html_e(
143
+ "If a link hasn't been created, click Create a link. (If a link was already created, click Copy link)",
144
  'music-player-for-woocommerce'
145
  );
146
+ ?>
147
  </p>
148
  <p>
149
  <?php
151
  'The link structure would be similar to:<br> https://www.dropbox.com/s/rycvgn8iokfedmo/file.mp3?dl=0',
152
  'music-player-for-woocommerce'
153
  );
154
+ ?>
155
  </p>
156
  </li>
157
  <li>
161
  'Enter the URL into the WooCommerce product with the following structure:<br> https://www.dropbox.com/s/rycvgn8iokfedmo/file.mp3?dl=1&.mp3',
162
  'music-player-for-woocommerce'
163
  );
164
+ ?>
165
  </p>
166
  <p>
167
  <?php
182
  <td>
183
  <table class="widefat wcmp-player-settings" style="border:1px solid #e1e1e1;">
184
  <tr>
185
+ <td><?php esc_html_e( 'Include music player', 'music-player-for-woocommerce' ); ?></td>
186
+ <td><div class="wcmp-tooltip"><span class="wcmp-tooltiptext"><?php esc_html_e( 'The player is shown only if the product is "downloadable", and there is at least an audio file between the "Downloadable files"', 'music-player-for-woocommerce' ); ?></span><input aria-label="<?php esc_attr_e( 'Enable player', 'music-player-for-woocommerce' ); ?>" type="checkbox" name="_wcmp_enable_player" <?php echo ( ( $enable_player ) ? 'checked' : '' ); ?> /></div></td>
187
  </tr>
188
  <tr>
189
+ <td><?php esc_html_e( 'Include in', 'music-player-for-woocommerce' ); ?></td>
190
  <td>
191
+ <input aria-label="<?php esc_attr_e( 'Include on products pages', 'music-player-for-woocommerce' ); ?>" type="radio" name="_wcmp_show_in" value="single" <?php echo ( ( 'single' == $show_in ) ? 'checked' : '' ); ?> />
192
+ <?php _e( 'single-entry pages <i>(Product\'s page only)</i>', 'music-player-for-woocommerce' ); ?><br />
193
 
194
+ <input aria-label="<?php esc_attr_e( 'Include on multiple-entry pages', 'music-player-for-woocommerce' ); ?>" type="radio" name="_wcmp_show_in" value="multiple" <?php echo ( ( 'multiple' == $show_in ) ? 'checked' : '' ); ?> />
195
+ <?php _e( 'multiple entries pages <i>(Shop pages, archive pages, but not in the product\'s page)</i>', 'music-player-for-woocommerce' ); ?><br />
196
 
197
+ <input aria-label="<?php esc_attr_e( 'Include on product and multiple-entry pages', 'music-player-for-woocommerce' ); ?>" type="radio" name="_wcmp_show_in" value="all" <?php echo ( ( 'all' == $show_in ) ? 'checked' : '' ); ?> />
198
+ <?php _e( 'all pages <i>(with single or multiple-entries)</i>', 'music-player-for-woocommerce' ); ?>
199
  </td>
200
  </tr>
201
  <tr>
202
+ <td><?php esc_html_e( 'Merge in grouped products', 'music-player-for-woocommerce' ); ?></td>
203
+ <td><input aria-label="<?php esc_attr_e( 'Merge in grouped products', 'music-player-for-woocommerce' ); ?>" type="checkbox" name="_wcmp_merge_in_grouped" <?php echo ( ( $merge_grouped ) ? 'checked' : '' ); ?> /><br /><em><?php esc_html_e( 'In grouped products, display the "Add to cart" buttons and quantity fields in the players rows', 'music-player-for-woocommerce' ); ?></em></td>
204
  </tr>
205
  <tr>
206
+ <td valign="top"><?php esc_html_e( 'Player layout', 'music-player-for-woocommerce' ); ?></td>
207
  <td>
208
  <table>
209
  <tr>
210
+ <td><input aria-label="<?php esc_attr_e( 'Skin 1', 'music-player-for-woocommerce' ); ?>" name="_wcmp_player_layout" type="radio" value="mejs-classic" <?php echo ( ( 'mejs-classic' == $player_style ) ? 'checked' : '' ); ?> /></td>
211
+ <td><img alt="<?php esc_attr_e( 'Skin 1', 'music-player-for-woocommerce' ); ?>" src="<?php print esc_url( WCMP_PLUGIN_URL ); ?>/views/assets/skin1.png" /></td>
212
  </tr>
213
 
214
  <tr>
215
+ <td><input aria-label="<?php esc_attr_e( 'Skin 2', 'music-player-for-woocommerce' ); ?>" name="_wcmp_player_layout" type="radio" value="mejs-ted" <?php echo ( ( 'mejs-ted' == $player_style ) ? 'checked' : '' ); ?> /></td>
216
+ <td><img alt="<?php esc_attr_e( 'Skin 2', 'music-player-for-woocommerce' ); ?>" src="<?php print esc_url( WCMP_PLUGIN_URL ); ?>/views/assets/skin2.png" /></td>
217
  </tr>
218
 
219
  <tr>
220
+ <td><input aria-label="<?php esc_attr_e( 'Skin 3', 'music-player-for-woocommerce' ); ?>" name="_wcmp_player_layout" type="radio" value="mejs-wmp" <?php echo ( ( 'mejs-wmp' == $player_style ) ? 'checked' : '' ); ?> /></td>
221
+ <td><img alt="<?php esc_attr_e( 'Skin 3', 'music-player-for-woocommerce' ); ?>" src="<?php print esc_url( WCMP_PLUGIN_URL ); ?>/views/assets/skin3.png" /></td>
222
  </tr>
223
  </table>
224
  </td>
225
  </tr>
226
  <tr>
227
  <td>
228
+ <?php esc_html_e( 'Preload', 'music-player-for-woocommerce' ); ?>
229
  </td>
230
  <td>
231
+ <label><input aria-label="<?php esc_attr_e( 'Preload - none', 'music-player-for-woocommerce' ); ?>" type="radio" name="_wcmp_preload" value="none" <?php if ( 'none' == $preload ) {
232
+ echo 'CHECKED';} ?> /> None</label><br />
233
+ <label><input aria-label="<?php esc_attr_e( 'Preload - metadata', 'music-player-for-woocommerce' ); ?>" type="radio" name="_wcmp_preload" value="metadata" <?php if ( 'metadata' == $preload ) {
234
+ echo 'CHECKED';} ?> /> Metadata</label><br />
235
+ <label><input aria-label="<?php esc_attr_e( 'Preload - auto', 'music-player-for-woocommerce' ); ?>" type="radio" name="_wcmp_preload" value="auto" <?php if ( 'auto' == $preload ) {
236
+ echo 'CHECKED';} ?> /> Auto</label><br />
237
  </td>
238
  </tr>
239
  <tr>
240
  <td>
241
+ <?php esc_html_e( 'Play all', 'music-player-for-woocommerce' ); ?>
242
  </td>
243
  <td>
244
+ <input aria-label="<?php esc_attr_e( 'Play all', 'music-player-for-woocommerce' ); ?>" type="checkbox" name="_wcmp_play_all" <?php if ( ! empty( $play_all ) ) {
245
+ echo 'CHECKED';} ?> />
246
  </td>
247
  </tr>
248
  <tr>
249
+ <td><?php esc_html_e( 'Player volume (from 0 to 1)', 'music-player-for-woocommerce' ); ?></td>
250
  <td>
251
+ <input aria-label="<?php esc_attr_e( 'Player volume', 'music-player-for-woocommerce' ); ?>" type="number" name="_wcmp_player_volume" min="0" max="1" step="0.01" value="<?php echo esc_attr( $volume ); ?>" />
252
  </td>
253
  </tr>
254
  <tr>
255
+ <td><?php esc_html_e( 'Player controls', 'music-player-for-woocommerce' ); ?></td>
256
  <td>
257
+ <input aria-label="<?php esc_attr_e( 'Play/pause button', 'music-player-for-woocommerce' ); ?>" type="radio" name="_wcmp_player_controls" value="button" <?php echo ( ( 'button' == $player_controls ) ? 'checked' : '' ); ?> /> <?php esc_html_e( 'the play/pause button only', 'music-player-for-woocommerce' ); ?><br />
258
+ <input aria-label="<?php esc_attr_e( 'All controls', 'music-player-for-woocommerce' ); ?>" type="radio" name="_wcmp_player_controls" value="all" <?php echo ( ( 'all' == $player_controls ) ? 'checked' : '' ); ?> /> <?php esc_html_e( 'all controls', 'music-player-for-woocommerce' ); ?><br />
259
+ <input aria-label="<?php esc_attr_e( 'Depending on context', 'music-player-for-woocommerce' ); ?>" type="radio" name="_wcmp_player_controls" value="default" <?php echo ( ( 'default' == $player_controls ) ? 'checked' : '' ); ?> /> <?php esc_html_e( 'the play/pause button only, or all controls depending on context', 'music-player-for-woocommerce' ); ?>
260
  <div class="wcmp-on-cover" style="margin-top:10px;">
261
+ <input aria-label="<?php esc_attr_e( 'On cover', 'music-player-for-woocommerce' ); ?>" type="checkbox" name="_wcmp_player_on_cover" value="default" <?php
262
+ echo ( ( ! empty( $on_cover ) && ( 'button' == $player_controls || 'default' == $player_controls ) ) ? 'checked' : '' );
263
  ?> />
264
+ <?php esc_html_e( 'for play/pause button players display them on cover images.', 'music-player-for-woocommerce' ); ?>
265
  <i>
266
  <?php
267
+ esc_html_e( '(This feature is experimental, and will depend on the theme active on the website.)', 'music-player-for-woocommerce' );
268
  ?>
269
  </i>
270
  </div>
271
  </td>
272
  </tr>
273
  <tr>
274
+ <td><?php esc_html_e( 'Display the player\'s title', 'music-player-for-woocommerce' ); ?></td>
275
  <td>
276
+ <input aria-label="<?php esc_attr_e( 'Display the player title', 'music-player-for-woocommerce' ); ?>" type="checkbox" name="_wcmp_player_title" <?php echo ( ( ! empty( $player_title ) ) ? 'checked' : '' ); ?> />
277
  </td>
278
  </tr>
279
  <tr>
280
+ <td colspan="2" style="color:red;"><?php esc_html_e( 'The security feature is only available in the PRO version of the plugin', 'music-player-for-woocommerce' ); ?>. <a target="_blank" href="https://wcmp.dwbooster.com"><?php esc_html_e( 'CLICK HERE TO GET THE PRO VERSION OF THE PLUGIN', 'music-player-for-woocommerce' ); ?></a></td>
281
  </tr>
282
  <tr>
283
+ <td style="color:#DDDDDD;"><?php esc_html_e( 'Protect the file', 'music-player-for-woocommerce' ); ?></td>
284
+ <td><input aria-label="<?php esc_attr_e( 'Protect the file', 'music-player-for-woocommerce' ); ?>" type="checkbox" DISABLED /></td>
285
  </tr>
286
  <tr valign="top">
287
+ <td style="color:#DDDDDD;"><?php esc_html_e( 'Percent of audio used for protected playbacks', 'music-player-for-woocommerce' ); ?></td>
288
  <td style="color:#DDDDDD;">
289
+ <input aria-label="<?php esc_attr_e( 'Percent of audio used for protected playbacks', 'music-player-for-woocommerce' ); ?>" type="number" DISABLED /> % <br /><br />
290
+ <em><?php esc_html_e( 'To prevent unauthorized copying of audio files, the files will be partially accessible', 'music-player-for-woocommerce' ); ?></em>
291
  </td>
292
  </tr>
293
  </table>
299
  <td style="color:#DDDDDD;">
300
  <table class="widefat wcmp-player-demos" style="border:1px solid #e1e1e1;">
301
  <tr valign="top">
302
+ <td style="color:#DDDDDD;"><input aria-label="<?php esc_attr_e( 'Own demo files', 'music-player-for-woocommerce' ); ?>" type="checkbox" disabled /> <?php esc_html_e( 'Select my own demo files', 'music-player-for-woocommerce' ); ?></td>
303
  </tr>
304
  <tr valign="top" class="wcmp-demo-files">
305
  <td>
306
+ <div style="color:#DDDDDD;"><?php esc_html_e( 'Demo files', 'music-player-for-woocommerce' ); ?></div>
307
  <table class="widefat">
308
  <thead>
309
  <tr>
310
+ <th style="color:#DDDDDD;"><?php esc_html_e( 'Name', 'music-player-for-woocommerce' ); ?></th>
311
+ <th colspan="2" style="color:#DDDDDD;"><?php esc_html_e( 'File URL', 'music-player-for-woocommerce' ); ?></th>
312
  <th>&nbsp;</th>
313
  </tr>
314
  </thead>
315
  <tbody>
316
  <tr>
317
  <td>
318
+ <input aria-label="<?php esc_attr_e( 'File name', 'music-player-for-woocommerce' ); ?>" type="text" class="wcmp-file-name" placeholder="<?php esc_attr_e( 'File Name', 'music-player-for-woocommerce' ); ?>" disabled style="color:#DDDDDD;" />
319
  </td>
320
  <td>
321
+ <input aria-label="<?php esc_attr_e( 'File URL', 'music-player-for-woocommerce' ); ?>" type="text" class="wcmp-file-url" placeholder="http://" disabled style="color:#DDDDDD;" />
322
  </td>
323
  <td width="1%" style="color:#DDDDDD;">
324
+ <a href="javascript:void(0);" class="button wcmp-select-file" style="color:#DDDDDD;"><?php esc_html_e( 'Choose file', 'music-player-for-woocommerce' ); ?></a>
325
  </td>
326
  <td width="1%" style="color:#DDDDDD;">
327
+ <a href="javascript:void(0);" class="wcmp-delete" style="color:#DDDDDD;"><?php esc_html_e( 'Delete', 'music-player-for-woocommerce' ); ?></a>
328
  </td>
329
  </tr>
330
  </tbody>
331
  <tfoot>
332
  <tr>
333
  <th colspan="4" style="color:#DDDDDD;">
334
+ <a href="javascript:void(0);" class="button wcmp-add" style="color:#DDDDDD;"><?php esc_html_e( 'Add File', 'music-player-for-woocommerce' ); ?></a>
335
  </th>
336
  </tr>
337
  </tfoot>
348
  {
349
  var v = $('[name="_wcmp_player_controls"]:checked').val(),
350
  c = $('.wcmp-on-cover');
351
+ if('default' == v || 'button' == v) c.show();
352
  else c.hide();
353
  };
354
  $(document).on('change', '[name="_wcmp_player_controls"]', function(){
356
  });
357
  coverSection();
358
  });</script>
359
+ <style>.wcmp-player-settings tr td:first-child{width:225px;}</style>
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.174
6
  Text Domain: music-player-for-woocommerce
7
  Author: CodePeople
8
  Author URI: https://wcmp.dwbooster.com
@@ -199,10 +199,18 @@ if ( ! class_exists( 'WooCommerceMusicPlayer' ) ) {
199
  // Include players with the titles
200
  if (
201
  $this->get_global_attr( '_wcmp_force_main_player_in_title', 1 ) &&
202
- ! empty( $_SERVER['REQUEST_URI'] ) &&
203
- stripos( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'wc/store' ) !== false
 
204
  ) {
205
  add_filter( 'woocommerce_product_title', array( &$this, 'woocommerce_product_title' ), 10, 2 );
 
 
 
 
 
 
 
206
  }
207
 
208
  // For accepting the <source> tags
@@ -431,7 +439,7 @@ if ( ! class_exists( 'WooCommerceMusicPlayer' ) ) {
431
  wp_enqueue_style( 'wcmp-style', plugin_dir_url( __FILE__ ) . 'css/style.css' );
432
  wp_enqueue_script( 'jquery' );
433
  wp_enqueue_script( 'wp-mediaelement' );
434
- wp_enqueue_script( 'wcmp-script', plugin_dir_url( __FILE__ ) . 'js/public.js', array( 'jquery', 'wp-mediaelement' ), '1.0.174' );
435
 
436
  $play_all = $GLOBALS['WooCommerceMusicPlayer']->get_global_attr(
437
  '_wcmp_play_all',
@@ -652,8 +660,8 @@ if ( ! class_exists( 'WooCommerceMusicPlayer' ) ) {
652
  // Enqueue resources
653
 
654
  $this->enqueue_resources();
655
- wp_enqueue_style( 'wcmp-playlist-widget-style', plugin_dir_url( __FILE__ ) . 'widgets/playlist_widget/css/style.css', array(), '1.0.174' );
656
- wp_enqueue_script( 'wcmp-playlist-widget-script', plugin_dir_url( __FILE__ ) . 'widgets/playlist_widget/js/public.js', array(), '1.0.174' );
657
  wp_localize_script(
658
  'wcmp-playlist-widget-script',
659
  'wcmp_widget_settings',
@@ -901,9 +909,13 @@ if ( ! class_exists( 'WooCommerceMusicPlayer' ) ) {
901
  return $value;
902
  }
903
 
904
- public function include_main_player( $product = '' ) {
 
905
  if ( ! $this->_insert_player ) {
906
- return;
 
 
 
907
  }
908
  if ( ! is_object( $product ) ) {
909
  $product = wc_get_product();
@@ -922,7 +934,7 @@ if ( ! class_exists( 'WooCommerceMusicPlayer' ) ) {
922
  ( $show_in == 'single' && ( ! function_exists( 'is_product' ) || ! is_product() ) ) ||
923
  ( $show_in == 'multiple' && ( function_exists( 'is_product' ) && is_product() ) && get_queried_object_id() == $id )
924
  ) {
925
- return;
926
  }
927
  $preload = $this->get_product_attr( $id, '_wcmp_preload', '' );
928
  $this->enqueue_resources();
@@ -954,8 +966,15 @@ if ( ! class_exists( 'WooCommerceMusicPlayer' ) ) {
954
  );
955
 
956
  do_action( 'wcmp_before_player_shop_page', $id );
957
- print '<div class="wcmp-player-container product-' . esc_attr( $file['product'] ) . '">' . $audio_tag . '</div>';
 
 
 
 
 
958
  do_action( 'wcmp_after_player_shop_page', $id );
 
 
959
  }
960
  } // End include_main_player
961
 
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
199
  // Include players with the titles
200
  if (
201
  $this->get_global_attr( '_wcmp_force_main_player_in_title', 1 ) &&
202
+ ! empty( $_SERVER['REQUEST_URI'] )
203
+ /* ! empty( $_SERVER['REQUEST_URI'] ) &&
204
+ stripos( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'wc/store' ) !== false */
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
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
  // 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',
909
  return $value;
910
  }
911
 
912
+ public function include_main_player( $product = '', $echo = true ) {
913
+ $output = '';
914
  if ( ! $this->_insert_player ) {
915
+ return $output;
916
+ }
917
+ if ( is_numeric( $product ) ) {
918
+ $product = wc_get_product( $product );
919
  }
920
  if ( ! is_object( $product ) ) {
921
  $product = wc_get_product();
934
  ( $show_in == 'single' && ( ! function_exists( 'is_product' ) || ! is_product() ) ) ||
935
  ( $show_in == 'multiple' && ( function_exists( 'is_product' ) && is_product() ) && get_queried_object_id() == $id )
936
  ) {
937
+ return $output;
938
  }
939
  $preload = $this->get_product_attr( $id, '_wcmp_preload', '' );
940
  $this->enqueue_resources();
966
  );
967
 
968
  do_action( 'wcmp_before_player_shop_page', $id );
969
+
970
+ $output = '<div class="wcmp-player-container product-' . esc_attr( $file['product'] ) . '">' . $audio_tag . '</div>';
971
+ if ( $echo ) {
972
+ print $output;
973
+ }
974
+
975
  do_action( 'wcmp_after_player_shop_page', $id );
976
+
977
+ return $output;
978
  }
979
  } // End include_main_player
980