Music Player for WooCommerce - Version 1.0.180

Version Description

  • Improves the plugin feedback.
Download this release

Release Info

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

Code changes from version 1.0.179 to 1.0.180

feedback/cp-feedback.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! class_exists( 'WCMP_FEEDBACK' ) ) {
3
+ class WCMP_FEEDBACK {
4
+
5
+ private $feedback_url = 'https://wordpress.dwbooster.com/licensesystem/debug-data.php';
6
+ private $plugin_slug;
7
+ private $plugin_file;
8
+ private $support_link;
9
+ private $full_support_link;
10
+
11
+ public function __construct( $plugin_slug, $plugin_file, $support_link ) {
12
+ $this->plugin_slug = $plugin_slug;
13
+ $this->plugin_file = $plugin_file;
14
+ $this->support_link = $support_link;
15
+ $this->full_support_link = $support_link . ( ( strpos( $support_link, '?' ) === false ) ? '?' : '&' ) . 'priority-support=yes';
16
+
17
+ // To know when the plugin was installed
18
+ if ( ! get_option( 'installed_' . $this->plugin_slug, false ) ) {
19
+ update_option( 'installed_' . $this->plugin_slug, time() );
20
+ }
21
+ // Actions and filters
22
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
23
+ add_action( 'wp_ajax_wcmp_feedback', array( $this, 'feedback_action' ) );
24
+ } // End __construct
25
+
26
+ public function enqueue_scripts( $hook ) {
27
+ if ( 'plugins.php' == $hook ) {
28
+ wp_enqueue_style( 'wp-jquery-ui-dialog' );
29
+ wp_enqueue_script( 'jquery' );
30
+ wp_enqueue_script( 'jquery-ui-dialog' );
31
+
32
+ add_action( 'admin_footer', array( $this, 'feedback_interface' ) );
33
+ }
34
+ } // End insert_admin_scripts
35
+
36
+ public function feedback_interface() {
37
+ // Varibles to use into the feedback interface
38
+ $plugin_slug = $this->plugin_slug;
39
+ $support_link = $this->support_link;
40
+ $full_support_link = $this->full_support_link;
41
+
42
+ include_once dirname( $this->plugin_file ) . '/feedback/feedback.html';
43
+ } // End feedback_interface
44
+
45
+ // This function is used only if explicitly accepted (opt-in) by the user
46
+ public function feedback_action() {
47
+ if (
48
+ isset( $_POST['_wpnonce'] ) &&
49
+ wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), 'woocommerce-music-player-feedback' ) &&
50
+ isset( $_POST['feedback_plugin'] ) &&
51
+ $_POST['feedback_plugin'] == $this->plugin_slug
52
+ ) {
53
+ $plugin_data = get_plugin_data( $this->plugin_file );
54
+ $plugin_version = $plugin_data['Version'];
55
+ $time = time() - get_option( 'installed_' . $this->plugin_slug, 0 );
56
+
57
+ $data = array(
58
+ 'plugin' => $plugin_data['Name'],
59
+ 'pluginv' => $plugin_version,
60
+ 'wordpress' => get_bloginfo( 'version' ),
61
+ 'itime' => $time,
62
+ 'phpversion' => phpversion(),
63
+ );
64
+
65
+ foreach ( $_POST as $parameter => $value ) {
66
+ $data[ $parameter ] = $value;
67
+ }
68
+
69
+ if ( ! isset( $_POST['wcmp_feedback_anonymous'] ) ) {
70
+ $current_user = wp_get_current_user();
71
+ $data['email'] = $current_user->user_email;
72
+ $data['website'] = isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '';
73
+ $data['url'] = get_site_url();
74
+ }
75
+
76
+ // Send data
77
+ $response = wp_remote_post(
78
+ $this->feedback_url,
79
+ array(
80
+ 'body' => $data,
81
+ 'sslverify' => false,
82
+ )
83
+ );
84
+
85
+ wp_die(); // this is required to terminate immediately and return a proper response
86
+ }
87
+
88
+ } // End feedback_action
89
+
90
+ } // End class
91
+ }
feedback/feedback.html ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script id="wcmp_feedback_html<?php print esc_attr($plugin_slug); ?>" type="text/template">
2
+ <div title="QUICK FEEDBACK">
3
+ <div style="padding:10px;">
4
+ <style type="text/css">
5
+ .cp-feedback-reason-block { margin-top:8px; }
6
+ </style>
7
+ <h3><strong>If you have a moment, please let us know why you are deactivating:</strong></h3>
8
+ <form id="wcmp_feedback_form{{plugin_slug}}">
9
+ <?php wp_nonce_field( 'woocommerce-music-player-feedback', '_wpnonce' ); ?>
10
+ <div class="cp-feedback-reason-block">
11
+ <label>
12
+ <input type="radio" name="answer" value="The player is not displayed.">
13
+ The player does not appear on product pages.<br />
14
+ </label>
15
+ <div id="wcmp_feedback_no_display_issue" style="margin-left:25px;padding:10px;border:1px dotted gray;">
16
+ <p>There are different reasons why audio players do not load on product pages.</p>
17
+ <p>Please try the following recommendations before deactivating the plugin.</p>
18
+ <ol>
19
+ <li>
20
+ <p><b>The products have not been configured as downloadable, or do not include audio files in the list of downloadable files.</b></p>
21
+ <p><b>Solution:</b> Visit the product configuration and tick the "Downloadable" checkbox. The action will display a new section in the product settings to select the files to download. Select at least one audio file.</p>
22
+ <p style="border:1px dotted gray"><img src="<?php print esc_attr( WCMP_PLUGIN_URL . '/feedback/screenshots/screen1.png' ); ?>" style="max-width:100%;" /></p>
23
+ </li>
24
+ <li>
25
+ <p><b>The products are downloadable, but the players are not loaded.</b></p>
26
+ <p><b>Solution:</b></p>
27
+ <ul>
28
+ <li>
29
+ <p>Make sure the player is enabled. Go to the product configuration and tick the <b>"Include music player"</b> checkbox.</p>
30
+ <p style="border:1px dotted gray"><img src="<?php print esc_attr( WCMP_PLUGIN_URL . '/feedback/screenshots/screen2.png' ); ?>" style="max-width:100%;" /></p>
31
+ </li>
32
+ <li>
33
+ <p>If the player is loaded by the product pages but not by the store page or vice versa. Tick the <b>"all pages"</b> option in the product settings.</p>
34
+ </li>
35
+ <li>
36
+ <p>The player is configured correctly on the product page but it still won't load.</p>
37
+ <p>Go to the plugin settings page via the <i>"Settings > Music Player for WooCommerce"</i> menu option, tick the boxes <b>"Include main player in front of product titles"</b> and <b>"Force to show audio player in product title"</b>.</p>
38
+ <p style="border:1px dotted gray"><img src="<?php print esc_attr( WCMP_PLUGIN_URL . '/feedback/screenshots/screen3.png' ); ?>" style="max-width:100%;" /></p>
39
+ <p>If you have designed the products with Elementor templates, you can insert the playlist shortcode without the <i>"products_ids"</i> attribute: <b>[wcmp-playlist]</b></p>
40
+ </li>
41
+ </ul>
42
+ </li>
43
+ <li>
44
+ <p>The player was enabled in the plugin settings page, but not applied to existing products.</p>
45
+ <p>On the plugin settings page, accessible through the <i>"Settings > Music Player for WooCommerce"</i> menu option, tick the <b>"Include the music player on all products"</b> option, and very important, tick the <b>"Apply the above settings to all product pages of the website"</b> checkbox before pressing the <b>"Save settings"</b> button.</p>
46
+ <p style="border:1px dotted gray"><img src="<?php print esc_attr( WCMP_PLUGIN_URL . '/feedback/screenshots/screen4.png' ); ?>" style="max-width:100%;" /></p>
47
+ </li>
48
+ </ol>
49
+ <p><b>Please note</b>: To load players on non-downloadable products, you must install the Professional version of our plugin, and select the audio files via the <b>"Select my own demo files"</b> section on the product settings.</p>
50
+ </div>
51
+ </div>
52
+ <div class="cp-feedback-reason-block">
53
+ <label>
54
+ <input type="radio" name="answer" value="temporary-deactivation"> It's a temporary deactivation. I'm just upgrading to the Professional version or debugging an issue.<br />
55
+ </label>
56
+ </div>
57
+ <div id="wcmp_feedback_anonymous" style="display:none;margin-top:30px;text-align:right">
58
+ <input type="checkbox" name="wcmp_feedback_anonymous" value="yes"> Anonymous feedback
59
+ </div>
60
+ </form>
61
+ </div>
62
+ </div>
63
+ </script>
64
+ <script type="text/javascript">
65
+ jQuery(window).on(
66
+ 'load',
67
+ function()
68
+ {
69
+ var $ = jQuery,
70
+ plugin_slug = '<?php print esc_js($plugin_slug); ?>',
71
+ support_link = '<?php print esc_js($support_link); ?>',
72
+ full_support_link = '<?php print esc_js($full_support_link); ?>';
73
+ $('[data-slug="'+plugin_slug+'"] .deactivate a').
74
+ on(
75
+ 'click',
76
+ function(evt)
77
+ {
78
+ evt.preventDefault()
79
+ evt.stopPropagation();
80
+ // Define events
81
+ $(document).on(
82
+ 'change',
83
+ '[id="wcmp_feedback_form'+plugin_slug+'"] [name="answer"]',
84
+ function()
85
+ {
86
+ var field = $(this),
87
+ value = field.val(),
88
+ form = field.closest('form');
89
+ $("#wcmp_feedback_deactivatebtn:visible").val('Submit & Deactivate');
90
+ $("#wcmp_feedback_deactivatebtn:visible").html('<span class="ui-button-text">Submit &amp; Deactivate</span>');
91
+ form.find("#wcmp_feedback_anonymous").show();
92
+ }
93
+ );
94
+ var url_redirect = $('[data-slug="'+plugin_slug+'"] .deactivate a').attr('href'),
95
+ html = $('[id="wcmp_feedback_html'+plugin_slug+'"]').html();
96
+ html = html.replace(/\{\{plugin_slug\}\}/g, plugin_slug)
97
+ .replace(/\{\{support_link\}\}/g, full_support_link)
98
+ .replace(/\{\{support_link_text\}\}/g, support_link);
99
+ $(html).dialog(
100
+ {
101
+ width:'600',
102
+ dialogClass: 'wp-dialog',
103
+ modal: true,
104
+ close: function(event, ui)
105
+ {
106
+ $(this).dialog("close");
107
+ $(this).remove();
108
+ },
109
+ closeOnEscape: true,
110
+ buttons: [
111
+ {
112
+ id: 'wcmp_feedback_deactivatebtn',
113
+ text: "Skip & Deactivate",
114
+ click: function()
115
+ {
116
+ var form = $('[id="wcmp_feedback_form'+plugin_slug+'"]'),
117
+ answer = form.find("input[name='answer']:checked").val(),
118
+ submitFeedback = function(){
119
+ var data = {
120
+ 'action': 'wcmp_feedback',
121
+ 'feedback_plugin': plugin_slug
122
+ };
123
+ $.each(form.serializeArray(), function(i,v){data[v['name']] = v['value'];});
124
+ if(ajaxurl) // WordPress global variable with the AJAX URL
125
+ {
126
+ $.post(
127
+ ajaxurl,
128
+ data,
129
+ function(response)
130
+ {
131
+ window.location.href = url_redirect;
132
+ }
133
+ );
134
+ }
135
+ };
136
+
137
+ if (answer == undefined || answer == '')
138
+ {
139
+ window.location.href = url_redirect;
140
+ }
141
+ else
142
+ {
143
+ submitFeedback();
144
+ }
145
+ }
146
+ },
147
+ {
148
+ text: "We can help: Support Service",
149
+ click: function()
150
+ {
151
+ window.open(support_link);
152
+ $(this).dialog("close");
153
+ }
154
+ },
155
+ {
156
+ text: "Cancel",
157
+ "class": 'button button-primary button-close',
158
+ click: function()
159
+ {
160
+ $(this).dialog("close");
161
+ }
162
+ }
163
+ ]
164
+ }
165
+ ); // End dialog
166
+ }
167
+ ); // End onclick deactivate btn
168
+ }
169
+ ); // End onload window
170
+ </script>
feedback/screenshots/screen1.png ADDED
Binary file
feedback/screenshots/screen2.png ADDED
Binary file
feedback/screenshots/screen3.png ADDED
Binary file
feedback/screenshots/screen4.png ADDED
Binary file
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.1
7
- Stable tag: 1.0.179
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.179 =
230
 
231
  * Improves the plugin code.
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.1
7
+ Stable tag: 1.0.180
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.180 =
230
+
231
+ * Improves the plugin feedback.
232
+
233
  = 1.0.179 =
234
 
235
  * Improves the plugin code.
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.179
6
  Text Domain: music-player-for-woocommerce
7
  Author: CodePeople
8
  Author URI: https://wcmp.dwbooster.com
@@ -17,6 +17,10 @@ $codepeople_promote_banner_plugins['codepeople-music-player-for-woocommerce'] =
17
  'plugin_url' => 'https://wordpress.org/support/plugin/music-player-for-woocommerce/reviews/#new-post',
18
  );
19
 
 
 
 
 
20
  // CONSTANTS
21
 
22
  define( 'WCMP_WEBSITE_URL', get_home_url( get_current_blog_id(), '', is_ssl() ? 'https' : 'http' ) );
@@ -26,7 +30,7 @@ define( 'WCMP_DEFAULT_PLAYER_VOLUME', 1 );
26
  define( 'WCMP_DEFAULT_PLAYER_CONTROLS', 'default' );
27
  define( 'WCMP_DEFAULT_PlAYER_TITLE', 1 );
28
  define( 'WCMP_REMOTE_TIMEOUT', 120 );
29
- define( 'WCMP_VERSION', '1.0.179' );
30
 
31
  // Load widgets
32
  require_once 'widgets/playlist_widget.php';
2
  /*
3
  Plugin Name: Music Player for WooCommerce
4
  Plugin URI: https://wcmp.dwbooster.com
5
+ Version: 1.0.180
6
  Text Domain: music-player-for-woocommerce
7
  Author: CodePeople
8
  Author URI: https://wcmp.dwbooster.com
17
  'plugin_url' => 'https://wordpress.org/support/plugin/music-player-for-woocommerce/reviews/#new-post',
18
  );
19
 
20
+ // Feedback system
21
+ require_once 'feedback/cp-feedback.php';
22
+ new WCMP_FEEDBACK( 'music-player-for-woocommerce', __FILE__, 'https://wcmp.dwbooster.com/contact-us' );
23
+
24
  // CONSTANTS
25
 
26
  define( 'WCMP_WEBSITE_URL', get_home_url( get_current_blog_id(), '', is_ssl() ? 'https' : 'http' ) );
30
  define( 'WCMP_DEFAULT_PLAYER_CONTROLS', 'default' );
31
  define( 'WCMP_DEFAULT_PlAYER_TITLE', 1 );
32
  define( 'WCMP_REMOTE_TIMEOUT', 120 );
33
+ define( 'WCMP_VERSION', '1.0.180' );
34
 
35
  // Load widgets
36
  require_once 'widgets/playlist_widget.php';