PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.4.1
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.4.1
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.1, at includes/admin/class-promotion.php

360 lines 13.2 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 * @since 1.2.6
20 *
21 * @return void
22 */
23 public function promotional_offer() {
24 // Show only to Admins
25 if ( ! current_user_can( 'manage_options' ) ) {
26 return;
27 }
28
29 // 2018-03-26 23:59:00
30 if ( time() > 1543276740 ) {
31 return;
32 }
33
34 // check if wpuf is showing banner
35 if ( class_exists( 'WPUF_Admin_Promotion' ) ) {
36 return;
37 }
38
39 // check if it has already been dismissed
40 $hide_notice = get_option( 'weforms_promotional_offer_notice', 'no' );
41
42 if ( 'hide' == $hide_notice ) {
43 return;
44 }
45
46 // $product_text = ( weforms()->is_pro() ) ? __( 'Pro upgrade and all extensions, ', 'weforms' ) : __( 'all extensions, ', 'weforms' );
47
48 // $offer_msg = __( '<h2><span class="dashicons dashicons-awards"></span> weDevs 5th Birthday Offer</h2>', 'weforms' );
49 $offer_msg = __( '<p>
50 <strong class="highlight-text" style="font-size: 18px">33&#37; flat discount on all our products</strong><br>
51 Save money this holiday season while supercharging your WordPress site with plugins that were made to empower you.
52 <br>
53 Offer ending soon!
54 </p>', 'weforms' );
55
56 ?>
57 <div class="notice is-dismissible" id="weforms-promotional-offer-notice">
58 <table>
59 <tbody>
60 <tr>
61 <td class="image-container">
62 <img src="https://ps.w.org/weforms/assets/icon-256x256.png" alt="">
63 </td>
64 <td class="message-container">
65 <?php echo $offer_msg; ?>
66 </td>
67 </tr>
68 </tbody>
69 </table>
70
71 <span class="dashicons dashicons-megaphone"></span>
72 <a href="https://wedevs.com/coupons/?utm_campaign=black_friday_cyber_monday&utm_medium=banner&utm_source=inside_plugin" class="button button-primary promo-btn" target="_blank"><?php _e( 'Get the Offer', 'weforms' ); ?></a>
73 </div><!-- #weforms-promotional-offer-notice -->
74
75 <style>
76 #weforms-promotional-offer-notice {
77 background-image: linear-gradient(35deg,#00c9ff 0%, #92fe9d 100%) !important;
78 border: 0px;
79 padding: 0;
80 opacity: 0;
81 }
82
83 .wrap > #weforms-promotional-offer-notice {
84 opacity: 1;
85 }
86
87 #weforms-promotional-offer-notice table {
88 border-collapse: collapse;
89 width: 100%;
90 }
91
92 #weforms-promotional-offer-notice table td {
93 padding: 0;
94 }
95
96 #weforms-promotional-offer-notice table td.image-container {
97 background-color: #ebf0f4;
98 vertical-align: middle;
99 width: 95px;
100 }
101
102 #weforms-promotional-offer-notice img {
103 max-width: 100%;
104 max-height: 100px;
105 vertical-align: middle;
106 }
107
108 #weforms-promotional-offer-notice table td.message-container {
109 padding: 0 10px;
110 }
111
112 #weforms-promotional-offer-notice h2{
113 color: rgba(250, 250, 250, 0.77);
114 margin-bottom: 10px;
115 font-weight: normal;
116 margin: 16px 0 14px;
117 -webkit-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
118 -moz-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
119 -o-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
120 text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
121 }
122
123 #weforms-promotional-offer-notice h2 span {
124 position: relative;
125 top: 0;
126 }
127
128 #weforms-promotional-offer-notice p{
129 color: rgba(250, 250, 250, 0.77);
130 font-size: 14px;
131 margin-bottom: 10px;
132 -webkit-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
133 -moz-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
134 -o-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
135 text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
136 }
137
138 #weforms-promotional-offer-notice p strong.highlight-text{
139 color: #fff;
140 }
141
142 #weforms-promotional-offer-notice p a {
143 color: #fafafa;
144 }
145
146 #weforms-promotional-offer-notice .notice-dismiss:before {
147 color: #fff;
148 }
149
150 #weforms-promotional-offer-notice span.dashicons-megaphone {
151 position: absolute;
152 bottom: 46px;
153 right: 248px;
154 color: rgba(253, 253, 253, 0.29);
155 font-size: 96px;
156 transform: rotate(-21deg);
157 }
158
159 #weforms-promotional-offer-notice a.promo-btn{
160 background: #149269;
161 border-color: #149269 #149269 #149269;
162 box-shadow: 0 1px 0 #149269;
163 /*color: #45E2D0;*/
164 text-decoration: none;
165 text-shadow: none;
166 position: absolute;
167 top: 30px;
168 right: 26px;
169 height: 40px;
170 line-height: 40px;
171 width: 130px;
172 text-align: center;
173 font-weight: 600;
174 }
175
176 </style>
177
178 <script type='text/javascript'>
179 jQuery('body').on('click', '#weforms-promotional-offer-notice .notice-dismiss', function(e) {
180 e.preventDefault();
181
182 wp.ajax.post('weforms-dismiss-promotional-offer-notice', {
183 dismissed: true
184 });
185 });
186 </script>
187 <?php
188 }
189
190 /**
191 *
192 * @since 1.3.5
193 *
194 * @return void
195 **/
196 public function weforms_review_notice_message() {
197 // Show only to Admins
198 if ( ! current_user_can( 'manage_options' ) ) {
199 return;
200 }
201
202 $dismiss_notice = get_option( 'weforms_review_notice_dismiss', 'no' );
203 $activation_time = get_option( 'weforms_installed' );
204 $total_entries = weforms_count_entries();
205
206 $args = array(
207 'order' => 'DESC',
208 'orderby' => 'post_date'
209 );
210
211 $contact_forms = weforms()->form->get_forms( $args );
212 $form_published = count( $contact_forms['forms'] );
213
214 // check if it has already been dismissed
215 // and don't show notice in 45 days of installation, 3888000 = 45 Days in seconds
216 if ( 'yes' == $dismiss_notice ) {
217 return;
218 }
219
220 if (
221 ( time() - $activation_time < 3888000 )
222 && $total_entries < 25
223 && $form_published < 3
224 ) {
225 return;
226 }
227
228 ?>
229 <div id="weforms-review-notice" class="weforms-review-notice">
230 <div class="weforms-review-thumbnail">
231 <img src="<?php echo WEFORMS_ASSET_URI . '/images/icon-weforms.png' ?>" alt="">
232 </div>
233 <div class="weforms-review-text">
234 <?php if( $total_entries >= 25 ) : ?>
235 <h3><?php _e( 'Enjoying <strong>weForms</strong>?', 'weforms' ) ?></h3>
236 <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>
237 <?php else: ?>
238 <h3><?php _e( 'Enjoying <strong>weForms</strong>?', 'weforms' ) ?></h3>
239 <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>
240 <?php endif; ?>
241
242 <ul class="weforms-review-ul">
243 <li><a href="https://wordpress.org/support/plugin/weforms/reviews/#postform" target="_blank"><span class="dashicons dashicons-external"></span><?php _e( 'Sure! I\'d love to!', 'weforms' ) ?></a></li>
244 <li><a href="#" class="notice-dismiss"><span class="dashicons dashicons-smiley"></span><?php _e( 'I\'ve already left a review', 'weforms' ) ?></a></li>
245 <li><a href="#" class="notice-dismiss"><span class="dashicons dashicons-dismiss"></span><?php _e( 'Never show again', 'weforms' ) ?></a></li>
246 </ul>
247 </div>
248 </div>
249 <style type="text/css">
250 #weforms-review-notice .notice-dismiss{
251 padding: 0 0 0 26px;
252 }
253
254 #weforms-review-notice .notice-dismiss:before{
255 display: none;
256 }
257
258 #weforms-review-notice.weforms-review-notice {
259 padding: 15px 15px 15px 0;
260 background-color: #fff;
261 border-radius: 3px;
262 margin: 20px 20px 0 0;
263 border-left: 4px solid transparent;
264 }
265
266 #weforms-review-notice .weforms-review-thumbnail {
267 width: 114px;
268 float: left;
269 line-height: 80px;
270 text-align: center;
271 border-right: 4px solid transparent;
272 }
273
274 #weforms-review-notice .weforms-review-thumbnail img {
275 width: 60px;
276 vertical-align: middle;
277 }
278
279 #weforms-review-notice .weforms-review-text {
280 overflow: hidden;
281 }
282
283 #weforms-review-notice .weforms-review-text h3 {
284 font-size: 24px;
285 margin: 0 0 5px;
286 font-weight: 400;
287 line-height: 1.3;
288 }
289
290 #weforms-review-notice .weforms-review-text p {
291 font-size: 13px;
292 margin: 0 0 5px;
293 }
294
295 #weforms-review-notice .weforms-review-ul {
296 margin: 0;
297 padding: 0;
298 }
299
300 #weforms-review-notice .weforms-review-ul li {
301 display: inline-block;
302 margin-right: 15px;
303 }
304
305 #weforms-review-notice .weforms-review-ul li a {
306 display: inline-block;
307 color: #82C776;
308 text-decoration: none;
309 padding-left: 26px;
310 position: relative;
311 }
312
313 #weforms-review-notice .weforms-review-ul li a span {
314 position: absolute;
315 left: 0;
316 top: -2px;
317 }
318 </style>
319 <script type='text/javascript'>
320 jQuery('body').on('click', '#weforms-review-notice .notice-dismiss', function(e) {
321 e.preventDefault();
322 jQuery("#weforms-review-notice").hide();
323
324 wp.ajax.post('weforms-dismiss-review-notice', {
325 dismissed: true
326 });
327 });
328 </script>
329 <?php
330
331 }
332
333
334 /**
335 * Dismiss promotion notice
336 *
337 * @since 1.2.6
338 *
339 * @return void
340 */
341 public function dismiss_promotional_offer() {
342 if ( ! empty( $_POST['dismissed'] ) ) {
343 $offer_key = 'weforms_promotional_offer_notice';
344 update_option( $offer_key, 'hide' );
345 }
346 }
347
348 /**
349 * Dismiss review notice
350 *
351 * @since 1.3.5
352 *
353 * @return void
354 **/
355 public function dismiss_review_notice() {
356 if ( ! empty( $_POST['dismissed'] ) ) {
357 update_option( 'weforms_review_notice_dismiss', 'yes' );
358 }
359 }
360 }