PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.4.2
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.4.2
1.6.7 1.6.8 1.6.9 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.18 1.6.19 1.6.2 1.6.20 1.6.21 1.6.22 1.6.23 1.6.24 1.6.25 1.6.26 1.6.27 1.6.28 1.6.3 1.6.4 1.6.5 1.6.6 All 74 releases
weforms / includes / admin / class-promotion.php

class-promotion.php in weForms – Easy Drag & Drop Contact Form Builder For WordPress 1.4.2, at includes/admin/class-promotion.php

332 lines 11.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Promotional offer class
5 */
6
7 class WeForms_Admin_Promotion {
8
9 public function __construct() {
10 add_action( 'admin_notices', array( $this, 'promotional_offer' ) );
11 add_action( 'admin_notices', array( $this, 'weforms_review_notice_message' ) );
12 add_action( 'wp_ajax_weforms-dismiss-promotional-offer-notice', array( $this, 'dismiss_promotional_offer' ) );
13 add_action( 'wp_ajax_weforms-dismiss-review-notice', array( $this, 'dismiss_review_notice' ) );
14 }
15
16 /**
17 * Promotional offer notice
18 *
19 * @return void
20 * @since 1.2.6
21 *
22 */
23 public function promotional_offer() {
24 if ( ! current_user_can( 'manage_options' ) ) {
25 return;
26 }
27
28 if ( class_exists( 'WeForms_Pro' ) ) {
29 return;
30 }
31
32 // check if it has already been dismissed
33 $offer_key = 'weforms_promotional_offer_notice';
34 $offer_start_date = strtotime( '2019-11-20 00:00:01' );
35 $offer_end_date = strtotime( '2019-12-04 23:59:00' );
36 $hide_notice = get_option( $offer_key, 'show' );
37
38 if ( 'hide' == $hide_notice ) {
39 return;
40 }
41
42 if ( $offer_start_date < current_time( 'timestamp' ) && current_time( 'timestamp' ) < $offer_end_date ) {
43 ?>
44 <div class="notice notice-success is-dismissible" id="weforms-bfcm-notice">
45 <div class="logo">
46 <img src="<?php echo WEFORMS_ASSET_URI . '/images/promo-logo.png' ?>" alt="weForms">
47 </div>
48 <div class="content">
49 <p>Biggest Sale of the year on this</p>
50
51 <h3><span class="highlight-green"> Black Friday &amp; </span>Cyber Monday</h3>
52 <p>Claim your discount on <span class="highlight-olive">weForms</span> till 4th December</p>
53 </div>
54 <div class="call-to-action">
55 <a target="_blank" href="https://wedevs.com/weforms/pricing?utm_campaign=black_friday_&_cyber_monday&utm_medium=banner&utm_source=plugin_dashboard">
56 <img src="<?php echo WEFORMS_ASSET_URI . '/images/promo-btn.png' ?>" alt="Btn">
57 </a>
58 <p>
59 <span class="highlight-green">Coupon: </span>
60 <span class="coupon-code">BFCM2019</span>
61 </p>
62 </div>
63 </div>
64
65 <style>
66 #weforms-bfcm-notice {
67 font-size: 14px;
68 border-left: none;
69 background: #398085;
70 color: #fff;
71 display: flex
72 }
73
74 #weforms-bfcm-notice .notice-dismiss:before {
75 color: #76E5FF;
76 }
77
78 #weforms-bfcm-notice .notice-dismiss:hover:before {
79 color: #b71c1c;
80 }
81
82 #weforms-bfcm-notice .logo {
83 text-align: center;
84 text-align: center;
85 margin: auto 50px;
86 }
87
88 #weforms-bfcm-notice .logo img {
89 width: 80%;
90 }
91
92 #weforms-bfcm-notice .highlight-green {
93 color: #72F3FB;
94 }
95
96 #weforms-bfcm-notice .highlight-olive {
97 color: #7CF5AA;
98 }
99
100 #weforms-bfcm-notice .content {
101 margin-top: 5px;
102 }
103
104 #weforms-bfcm-notice .content h3 {
105 color: #FFF;
106 margin: 12px 0 5px;
107 font-weight: normal;
108 font-size: 30px;
109 }
110
111 #weforms-bfcm-notice .content p {
112 margin-top: 12px;
113 padding: 0;
114 letter-spacing: .4px;
115 color: #ffffff;
116 font-size: 15px;
117 }
118
119 #weforms-bfcm-notice .call-to-action {
120 margin-left: 10%;
121 margin-top: 20px;
122 }
123
124 #weforms-bfcm-notice .call-to-action a:focus {
125 box-shadow: none;
126 }
127
128 #weforms-bfcm-notice .call-to-action p {
129 font-size: 16px;
130 color: #fff;
131 margin-top: 1px;
132 text-align: center;
133 }
134
135 #weforms-bfcm-notice .coupon-code {
136 -moz-user-select: all;
137 -webkit-user-select: all;
138 user-select: all;
139 }
140 </style>
141
142 <script type='text/javascript'>
143 jQuery('body').on('click', '#weforms-bfcm-notice .notice-dismiss', function (e) {
144 e.preventDefault();
145
146 wp.ajax.post('weforms-dismiss-promotional-offer-notice', {
147 dismissed: true
148 });
149 });
150 </script>
151 <?php
152 }
153 }
154
155 /**
156 *
157 * @return void
158 **@since 1.3.5
159 *
160 */
161 public function weforms_review_notice_message() {
162 // Show only to Admins
163 if ( ! current_user_can( 'manage_options' ) ) {
164 return;
165 }
166
167 $dismiss_notice = get_option( 'weforms_review_notice_dismiss', 'no' );
168 $activation_time = get_option( 'weforms_installed' );
169 $total_entries = weforms_count_entries();
170
171 $args = array(
172 'order' => 'DESC',
173 'orderby' => 'post_date'
174 );
175
176 $contact_forms = weforms()->form->get_forms( $args );
177 $form_published = count( $contact_forms['forms'] );
178
179 // check if it has already been dismissed
180 // and don't show notice in 45 days of installation, 3888000 = 45 Days in seconds
181 if ( 'yes' == $dismiss_notice ) {
182 return;
183 }
184
185 if (
186 ( time() - $activation_time < 3888000 )
187 && $total_entries < 25
188 && $form_published < 3
189 ) {
190 return;
191 }
192
193 ?>
194 <div id="weforms-review-notice" class="weforms-review-notice">
195 <div class="weforms-review-thumbnail">
196 <img src="<?php echo WEFORMS_ASSET_URI . '/images/icon-weforms.png' ?>" alt="">
197 </div>
198 <div class="weforms-review-text">
199 <?php if ( $total_entries >= 25 ) : ?>
200 <h3><?php _e( 'Enjoying <strong>weForms</strong>?', 'weforms' ) ?></h3>
201 <p><?php _e( 'Seems like you are getting a good response using <strong>weForms</strong>. Would you please show us a little love by rating us in the <a href="https://wordpress.org/support/plugin/weforms/reviews/#postform" target="_blank"><strong>WordPress.org</strong></a>?', 'weforms' ) ?></p>
202 <?php else: ?>
203 <h3><?php _e( 'Enjoying <strong>weForms</strong>?', 'weforms' ) ?></h3>
204 <p><?php _e( 'Hope that you had a neat and snappy experience with the tool. Would you please show us a little love by rating us in the <a href="https://wordpress.org/support/plugin/weforms/reviews/#postform" target="_blank"><strong>WordPress.org</strong></a>?', 'weforms' ) ?></p>
205 <?php endif; ?>
206
207 <ul class="weforms-review-ul">
208 <li><a href="https://wordpress.org/support/plugin/weforms/reviews/#postform" target="_blank"><span
209 class="dashicons dashicons-external"></span><?php _e( 'Sure! I\'d love to!', 'weforms' ) ?>
210 </a></li>
211 <li><a href="#" class="notice-dismiss"><span
212 class="dashicons dashicons-smiley"></span><?php _e( 'I\'ve already left a review', 'weforms' ) ?>
213 </a></li>
214 <li><a href="#" class="notice-dismiss"><span
215 class="dashicons dashicons-dismiss"></span><?php _e( 'Never show again', 'weforms' ) ?>
216 </a></li>
217 </ul>
218 </div>
219 </div>
220 <style type="text/css">
221 #weforms-review-notice .notice-dismiss {
222 padding: 0 0 0 26px;
223 }
224
225 #weforms-review-notice .notice-dismiss:before {
226 display: none;
227 }
228
229 #weforms-review-notice.weforms-review-notice {
230 padding: 15px 15px 15px 0;
231 background-color: #fff;
232 border-radius: 3px;
233 margin: 20px 20px 0 0;
234 border-left: 4px solid transparent;
235 }
236
237 #weforms-review-notice .weforms-review-thumbnail {
238 width: 114px;
239 float: left;
240 line-height: 80px;
241 text-align: center;
242 border-right: 4px solid transparent;
243 }
244
245 #weforms-review-notice .weforms-review-thumbnail img {
246 width: 60px;
247 vertical-align: middle;
248 }
249
250 #weforms-review-notice .weforms-review-text {
251 overflow: hidden;
252 }
253
254 #weforms-review-notice .weforms-review-text h3 {
255 font-size: 24px;
256 margin: 0 0 5px;
257 font-weight: 400;
258 line-height: 1.3;
259 }
260
261 #weforms-review-notice .weforms-review-text p {
262 font-size: 13px;
263 margin: 0 0 5px;
264 }
265
266 #weforms-review-notice .weforms-review-ul {
267 margin: 0;
268 padding: 0;
269 }
270
271 #weforms-review-notice .weforms-review-ul li {
272 display: inline-block;
273 margin-right: 15px;
274 }
275
276 #weforms-review-notice .weforms-review-ul li a {
277 display: inline-block;
278 color: #82C776;
279 text-decoration: none;
280 padding-left: 26px;
281 position: relative;
282 }
283
284 #weforms-review-notice .weforms-review-ul li a span {
285 position: absolute;
286 left: 0;
287 top: -2px;
288 }
289 </style>
290 <script type='text/javascript'>
291 jQuery('body').on('click', '#weforms-review-notice .notice-dismiss', function (e) {
292 e.preventDefault();
293 jQuery("#weforms-review-notice").hide();
294
295 wp.ajax.post('weforms-dismiss-review-notice', {
296 dismissed: true
297 });
298 });
299 </script>
300 <?php
301
302 }
303
304
305 /**
306 * Dismiss promotion notice
307 *
308 * @return void
309 * @since 1.2.6
310 *
311 */
312 public function dismiss_promotional_offer() {
313 if ( ! empty( $_POST['dismissed'] ) ) {
314 $offer_key = 'weforms_promotional_offer_notice';
315 update_option( $offer_key, 'hide' );
316 }
317 }
318
319 /**
320 * Dismiss review notice
321 *
322 * @return void
323 **@since 1.3.5
324 *
325 */
326 public function dismiss_review_notice() {
327 if ( ! empty( $_POST['dismissed'] ) ) {
328 update_option( 'weforms_review_notice_dismiss', 'yes' );
329 }
330 }
331 }
332