PluginProbe
CodePeople Post Map for Google Maps / 1.2.3
CodePeople Post Map for Google Maps v1.2.3
1.3.0 1.2.9 1.2.8 1.2.7 1.2.6 trunk 1.0.44 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5
codepeople-post-map / feedback / cp-feedback.php

cp-feedback.php in CodePeople Post Map for Google Maps 1.2.3, at feedback/cp-feedback.php

101 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if(!class_exists('CP_FEEDBACK'))
3 {
4 class CP_FEEDBACK
5 {
6 private $feedback_url = 'https://wordpress.dwbooster.com/licensesystem/debug-data.php';
7 private $plugin_slug;
8 private $plugin_file;
9 private $support_link;
10 private $full_support_link;
11
12 public function __construct($plugin_slug, $plugin_file, $support_link)
13 {
14 $this->plugin_slug = $plugin_slug;
15 $this->plugin_file = $plugin_file;
16 $this->support_link = $support_link;
17 $this->full_support_link = $support_link.((strpos($support_link, '?') === false) ? '?' : '&' ).'priority-support=yes';
18
19 // To know when the plugin was installed
20 if (!get_option('installed_'.$this->plugin_slug, false))
21 {
22 update_option('installed_'.$this->plugin_slug, time() );
23 }
24 // Actions and filters
25 add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts'), 1);
26 add_action( 'wp_ajax_cp_feedback', array($this,'feedback_action'));
27 } // End __construct
28
29 public function enqueue_scripts($hook)
30 {
31 if( 'plugins.php' == $hook )
32 {
33 wp_enqueue_style('wp-jquery-ui-dialog');
34 wp_enqueue_script('jquery');
35 wp_enqueue_script('jquery-ui-dialog');
36
37 add_action( 'admin_footer', array($this, 'feedback_interface') );
38 }
39 } // End insert_admin_scripts
40
41 public function feedback_interface()
42 {
43 // Varibles to use into the feedback interface
44 $plugin_slug = $this->plugin_slug;
45 $support_link = $this->support_link;
46 $full_support_link = $this->full_support_link;
47
48 include_once dirname($this->plugin_file).'/feedback/feedback.html';
49 } // End feedback_interface
50
51 // This function is used only if explicitly accepted (opt-in) by the user
52 public function feedback_action()
53 {
54 if(
55 isset($_POST['feedback_plugin']) &&
56 $_POST['feedback_plugin'] == $this->plugin_slug &&
57 isset( $_POST['_wpnonce'] ) &&
58 wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), 'cp-google-maps-feedback' )
59 ) {
60 $plugin_data = get_plugin_data( $this->plugin_file );
61 $plugin_version = $plugin_data['Version'];
62 $time = time() - get_option('installed_'.$this->plugin_slug, 0);
63
64 $data = array(
65 'plugin' => $plugin_data['Name'],
66 'pluginv' => $plugin_version,
67 'wordpress' => get_bloginfo('version'),
68 'itime' => $time,
69 'phpversion' => phpversion()
70 );
71
72 foreach($_POST as $parameter => $value)
73 {
74 $data[$parameter] = $value;
75 }
76
77 if(!isset($_POST["cp_feedback_anonymous"])) // send this data only if explicitly accepted
78 {
79 $current_user = wp_get_current_user();
80 $data['email'] = $current_user->user_email;
81 $data['website'] = $_SERVER['HTTP_HOST'];
82 $data['url'] = get_site_url();
83 }
84
85 // Send data
86 $response = wp_remote_post(
87 $this->feedback_url,
88 array(
89 'body' => $data,
90 'sslverify' => false
91 )
92 );
93
94 wp_die(); // this is required to terminate immediately and return a proper response
95 }
96
97
98 } // End feedback_action
99
100 } // End class
101 }