Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/login-customizer/src/Includes/Ajax.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + <?php
2 + if ( ! defined( 'ABSPATH' ) ) {
3 + // Exit if accessed directly.
4 + exit;
5 + }
6 +
7 + /**
8 + * Handling all the AJAX calls in Login Customizer.
9 + *
10 + * @since 2.2.0
11 + * @version 2.1.5
12 +
13 + * @class Deactivate_Login_Customizer
14 + */
15 +
16 + if ( ! class_exists( 'Deactivate_Login_Customizer' ) ) :
17 +
18 + class Deactivate_Login_Customizer {
19 +
20 + /* * * * * * * * * *
21 + * Class constructor
22 + * * * * * * * * * */
23 + public function __construct() {
24 +
25 + $this::init();
26 + }
27 +
28 + /**
29 + * Ajax Calls for Deactivation box
30 + *
31 + * @return void
32 + *
33 + */
34 + public static function init() {
35 +
36 + $ajax_calls = array(
37 + // 'deactivate' => false,
38 + );
39 +
40 + foreach ( $ajax_calls as $ajax_call => $no_priv ) {
41 +
42 + add_action( 'wp_ajax_login_customizer_' . $ajax_call, array( __CLASS__, $ajax_call ) );
43 +
44 + if ( $no_priv ) {
45 + add_action( 'wp_ajax_nopriv_login_customizer_' . $ajax_call, array( __CLASS__, $ajax_call ) );
46 + }
47 + }
48 + }
49 +
50 +
51 + /**
52 + * [deactivate get response from user on deactivating plugin]
53 + * @return [string] [response]
54 + * @since 2.2.0
55 + * @version 2.2.0
56 + */
57 + public function deactivate() {
58 +
59 + check_ajax_referer( 'login-customizer-deactivate-nonce', 'security' );
60 +
61 + if ( ! current_user_can( 'manage_options' ) ) {
62 + wp_die( 'No cheating, huh!' );
63 + }
64 +
65 + $email = get_option( 'admin_email' );
66 + $_reason = sanitize_text_field( wp_unslash( $_POST['reason'] ) );
67 + $reason_detail = sanitize_text_field( wp_unslash( $_POST['reason_detail'] ) );
68 + $reason = '';
69 +
70 + /*
71 + ** I upgraded to login-customizer Pro
72 + *
73 + * The above option doesn't send response to server that's why it is omitted.
74 + *
75 + **/
76 +
77 +
78 + if ( $_reason == '1' ) {
79 + $reason = 'I only needed the plugin for a short period';
80 + } elseif ( $_reason == '2' ) {
81 + $reason = 'I found a better plugin';
82 + } elseif ( $_reason == '3' ) {
83 + $reason = 'The plugin broke my site';
84 + } elseif ( $_reason == '4' ) {
85 + $reason = 'The plugin suddenly stopped working';
86 + } elseif ( $_reason == '5' ) {
87 + $reason = 'I no longer need the plugin';
88 + } elseif ( $_reason == '6' ) {
89 + $reason = 'It\'s a temporary deactivation. I\'m just debugging an issue.';
90 + } elseif ( $_reason == '7' ) {
91 + $reason = 'Other';
92 + }
93 + $fields = array(
94 + 'email' => $email,
95 + 'website' => get_site_url(),
96 + 'action' => 'Deactivate',
97 + 'reason' => $reason,
98 + 'reason_detail' => $reason_detail,
99 + 'blog_language' => get_bloginfo( 'language' ),
100 + 'wordpress_version' => get_bloginfo( 'version' ),
101 + 'php_version' => PHP_VERSION,
102 + 'plugin_version' => LOGINCUST_FREE_VERSION,
103 + 'plugin_name' => 'Login Customizer Free',
104 + );
105 +
106 + $response = wp_remote_post( LOGINCUST_FEEDBACK_SERVER, array(
107 + 'method' => 'POST',
108 + 'timeout' => 5,
109 + 'httpversion' => '1.0',
110 + 'blocking' => false,
111 + 'headers' => array(),
112 + 'body' => $fields,
113 + ) );
114 +
115 + wp_die();
116 + }
117 +
118 + }
119 +
120 + endif;
121 + new Deactivate_Login_Customizer();
122 + ?>
123 +