PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.1.3
Adminify – White Label, Admin Menu Editor, Login Customizer v4.1.3
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 4.1.17 All 164 releases
adminify / Inc / Classes / Notifications / What_We_Collect.php

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

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