PluginProbe
Loading Page with Loading Screen / 1.0.86
Loading Page with Loading Screen v1.0.86
1.2.8 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.1.0 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 1.1.20 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 All 46 releases
loading-page / feedback / cp-feedback.php

cp-feedback.php in Loading Page with Loading Screen 1.0.86, at feedback/cp-feedback.php

87 lines 3.1 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 class CP_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_cp_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 ( isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'loading-page-feedback' ) && isset( $_POST['feedback_plugin'] ) && $_POST['feedback_plugin'] === $this->plugin_slug ) {
48 $plugin_data = get_plugin_data( $this->plugin_file );
49 $plugin_version = $plugin_data['Version'];
50 $time = time() - get_option( 'installed_' . $this->plugin_slug, 0 );
51
52 $data = array(
53 'plugin' => $plugin_data['Name'],
54 'pluginv' => $plugin_version,
55 'wordpress' => get_bloginfo( 'version' ),
56 'itime' => $time,
57 'phpversion' => phpversion(),
58 );
59
60 foreach ( $_POST as $parameter => $value ) {
61 $data[ $parameter ] = sanitize_text_field( wp_unslash( $value ) );
62 }
63
64 if ( ! isset( $_POST['cp_feedback_anonymous'] ) ) {
65 $current_user = wp_get_current_user();
66 $data['email'] = $current_user->user_email;
67 $data['website'] = isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '';
68 $data['url'] = get_site_url();
69 }
70
71 // Send data.
72 $response = wp_remote_post(
73 $this->feedback_url,
74 array(
75 'body' => $data,
76 'sslverify' => false,
77 )
78 );
79
80 wp_die(); // this is required to terminate immediately and return a proper response.
81 }
82
83 } // End feedback_action.
84
85 } // End class.
86 }
87