PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 3.2.4.1
Adminify – White Label, Admin Menu Editor, Login Customizer v3.2.4.1
4.3.2 4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 All 165 releases
adminify / Inc / Classes / Notifications / What_We_Collect.php

What_We_Collect.php in Adminify – White Label, Admin Menu Editor, Login Customizer 3.2.4.1, at Inc/Classes/Notifications/What_We_Collect.php

194 lines 5.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace WPAdminify\Inc\Classes\Notifications;
3
4 use WPAdminify\Inc\Classes\Notifications\Base\User_Data;
5 use WPAdminify\Inc\Classes\Notifications\Model\Notice;
6
7 if ( ! class_exists( 'What_We_Collect' ) ) {
8 /**
9 * Class for what we collect
10 *
11 * Jewel Theme <[email protected]>
12 */
13 class What_We_Collect extends Notice {
14
15
16 use User_Data;
17
18 public $color = 'warning';
19
20 /**
21 * Constructor method
22 *
23 * @author Jewel Theme <[email protected]>
24 */
25 public function __construct() {
26 parent::__construct();
27 add_action( 'wp_ajax_jltwp_adminify_allow_collect', array( $this, 'jltwp_adminify_allow_collect' ) );
28 }
29
30 /**
31 * Allow collect data
32 *
33 * @author Jewel Theme <[email protected]>
34 */
35 public function jltwp_adminify_allow_collect() {
36 check_ajax_referer( 'jltwp_adminify_allow_collect_nonce' );
37
38 $email = get_bloginfo( 'admin_email' );
39
40 $author_obj = get_user_by( 'email', $email );
41 $user_id = $author_obj->ID;
42 $full_name = $author_obj->display_name;
43
44 $response = $this->get_collect_data( $user_id, array(
45 'first_name' => $full_name,
46 'email' => '$email',
47 ) );
48
49 if ( ! is_wp_error( $response ) && 200 === $response['response']['code'] && 'OK' === $response['response']['message'] ) {
50 wp_send_json_success( 'Thanks for Allow!' );
51 } else {
52 wp_send_json_error( "Couldn't Collect" );
53 }
54 }
55
56 /**
57 * Title Content
58 *
59 * @author Jewel Theme <[email protected]>
60 */
61 public function set_title() {
62 printf(
63 '<h4>Wanna get some discount for %1$s? No Worries!! We got you!! give us your email we will send you the discount code?</h4>',
64 esc_html__( 'WP Adminify', 'adminify' )
65 );
66 }
67
68 /**
69 * Link for collect data
70 *
71 * @author Jewel Theme <[email protected]>
72 */
73 public function what_we_collect_link() {
74 echo '<a href="!#" class="wp-adminify-wwc-link">' . esc_html__( 'what we collect', 'adminify' ) . '</a>';
75 }
76
77 /**
78 * Notice Content
79 *
80 * @author Jewel Theme <[email protected]>
81 */
82 public function notice_content() { ?>
83 <div class="wp-adminify-notice-review-box wp-adminify-wwc">
84 <p>
85 <?php
86 echo sprintf(
87 __( 'Want to help make <strong>%1$s</strong> even more awesome? Allow %1$s to collect non-sensitive diagnostic data and usage information.', 'adminify' ),
88 __( 'WP Adminify', 'adminify' )
89 );
90 ?>
91 (<?php $this->what_we_collect_link(); ?>)</p>
92 <div class="wp-adminify-wwc-content" style="display:none">
93 <?php echo sprintf(
94 __( 'Server environment details (php, mysql, server, WordPress versions), Number of users in your site, Site language, Number of active and inactive plugins, Local or Production Site, IP Address, Site name and url, Your name and email address etc. No sensitive data is tracked. Learn more about our <a href="%1$s" target="_blank">Privacy Policy</a>, how we handle and collects your data.', 'adminify' ),
95 esc_url( 'https://wpadminify.com/privacy-policy' )
96 ); ?>
97 </div>
98 </div>
99
100 <?php
101 }
102
103 /**
104 * Plugin rate url
105 *
106 * @author Jewel Theme <[email protected]>
107 */
108 public function plugin_rate_url() {
109 return '#';
110 }
111
112 /**
113 * Footer Content
114 *
115 * @author Jewel Theme <[email protected]>
116 */
117 public function footer_content() {
118 ?>
119 <a class="button button-primary allow-button" href="<?php echo esc_url( $this->plugin_rate_url() ); ?>" rel="nofollow" target="_blank">
120 <?php echo esc_html__( 'Allow', 'adminify' ); ?>
121 </a>
122 <a class="button button-secondary button-reject wp-adminify-notice-dismiss" href="#" rel="nofollow">
123 <?php echo esc_html__( 'No Thanks', 'adminify' ); ?>
124 </a>
125 <?php
126 }
127
128 /**
129 * Intervals
130 *
131 * @author Jewel Theme <[email protected]>
132 */
133 public function intervals() {
134 return array( 0, 7, 10, 15, 20, 15, 25, 30 );
135 }
136
137 /**
138 * Core Script
139 *
140 * @param [type] $trigger_time .
141 * @author Jewel Theme <[email protected]>
142 */
143 public function core_script( $trigger_time ) {
144 parent::core_script( $trigger_time );
145 ?>
146
147 <script>
148 jQuery('body').on('click', '.wp-adminify-notice-what_we_collect .wp-adminify-wwc-link', function(e) {
149 e.preventDefault();
150 if (jQuery(this).hasClass('show')) {
151 jQuery(this).removeClass("show");
152 jQuery('.wp-adminify-wwc-content').stop().slideUp(200);
153 } else {
154 jQuery(this).addClass("show");
155 jQuery('.wp-adminify-wwc-content').stop().slideDown(200);
156 }
157 });
158
159 jQuery('body').on('click', '.wp-adminify-notice-what_we_collect .allow-button', function(e) {
160
161 e.preventDefault();
162
163 let noticeWrapper = jQuery(this).closest('.notice-wp-adminify');
164
165 noticeWrapper.css('opacity', '0.4').find('button').prop('disabled', true);
166
167 jQuery.ajax({
168 url: '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>',
169 method: 'POST',
170 crossDomain: true,
171 data: {
172 action: 'jltwp_adminify_allow_collect',
173 _wpnonce: '<?php echo esc_js( wp_create_nonce( 'jltwp_adminify_allow_collect_nonce' ) ); ?>',
174 }
175 })
176 .done(function(response) {
177 noticeWrapper.children(':not(.notice-dismiss)').hide().end().append('<p class="wp-adminify--notice-message"><strong>' + response.data + '</strong></p>');
178 let subsTimeout = setTimeout(function() {
179 jltwp_adminify_notice_action(null, noticeWrapper.children(), 'disable');
180 clearTimeout(subsTimeout);
181 }, 1500);
182 })
183 .always(function() {
184 noticeWrapper.css('opacity', '1').find('button').prop('disabled', false);
185 })
186
187 });
188 </script>
189
190 <?php
191 }
192 }
193 }
194