PluginProbe ʕ •ᴥ•ʔ
Music Player for WooCommerce / 1.0.194
Music Player for WooCommerce v1.0.194
1.8.3 1.8.2 1.8.1 1.1.10 1.1.11 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.10 1.3.11 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5.0 1.5.1 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 trunk 1.0.173 1.0.174 1.0.175 1.0.176 1.0.177 1.0.178 1.0.179 1.0.180 1.0.181 1.0.182 1.0.183 1.0.184 1.0.185 1.0.186 1.0.187 1.0.188 1.0.189 1.0.190 1.0.191 1.0.192 1.0.193 1.0.194 1.0.195 1.0.196 1.0.197 1.1.0 1.1.1
music-player-for-woocommerce / feedback / cp-feedback.php
music-player-for-woocommerce / feedback Last commit date
screenshots 3 years ago cp-feedback.php 3 years ago feedback.html 3 years ago
cp-feedback.php
92 lines
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 }
92