PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.3.2
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.3.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
← All changes | includes/admin/class-promotion.php +204 -382 1.6.241.3.2 View file →
@@ -1,382 +1,204 @@
1 -<?php
2 -
3 -/**
4 - * Promotional offer class
5 - */
6 -class WeForms_Admin_Promotion {
7 -
8 - public function __construct() {
9 - add_action( 'admin_notices', [ $this, 'promotional_offer' ] );
10 - add_action( 'admin_notices', [ $this, 'weforms_review_notice_message' ] );
11 - add_action( 'wp_ajax_weforms-dismiss-promotional-offer-notice', [ $this, 'dismiss_promotional_offer' ] );
12 - add_action( 'wp_ajax_weforms-dismiss-review-notice', [ $this, 'dismiss_review_notice' ] );
13 - }
14 -
15 - /**
16 - * Promotional offer notice
17 - *
18 - * @return void
19 - *
20 - * @since 1.2.6
21 - */
22 - public function promotional_offer() {
23 - if ( !current_user_can( 'manage_options' ) ) {
24 - return;
25 - }
26 -
27 - if ( class_exists( 'WeForms_Pro' ) ) {
28 - return;
29 - }
30 -
31 - // check if it has already been dismissed
32 - $offer_key = 'weforms_promotional_offer_notice';
33 - $offer_start_date = strtotime( '2019-11-20 00:00:01' );
34 - $offer_end_date = strtotime( '2019-12-04 23:59:00' );
35 - $hide_notice = get_option( $offer_key, 'show' );
36 -
37 - if ( 'hide' == $hide_notice ) {
38 - return;
39 - }
40 -
41 - if ( $offer_start_date < current_time( 'timestamp' ) && current_time( 'timestamp' ) < $offer_end_date ) {
42 - ?>
43 - <div class="notice notice-success is-dismissible" id="weforms-bfcm-notice">
44 - <div class="logo">
45 - <img src="<?php echo esc_attr( WEFORMS_ASSET_URI ) . '/images/promo-logo.png' ?>" alt="weForms">
46 - </div>
47 - <div class="content">
48 - <p>Biggest Sale of the year on this</p>
49 -
50 - <h3><span class="highlight-green"> Black Friday &amp; </span>Cyber Monday</h3>
51 - <p>Claim your discount on <span class="highlight-olive">weForms</span> till 4th December</p>
52 - </div>
53 - <div class="call-to-action">
54 - <a target="_blank" href="https://wedevs.com/weforms/pricing?utm_campaign=black_friday_&_cyber_monday&utm_medium=banner&utm_source=plugin_dashboard">
55 - <img src="<?php echo esc_attr( WEFORMS_ASSET_URI ) . '/images/promo-btn.png' ?>" alt="Btn">
56 - </a>
57 - <p>
58 - <span class="highlight-green">Coupon: </span>
59 - <span class="coupon-code">BFCM2019</span>
60 - </p>
61 - </div>
62 - </div>
63 -
64 - <style>
65 - #weforms-bfcm-notice {
66 - font-size: 14px;
67 - border-left: none;
68 - background: #398085;
69 - color: #fff;
70 - display: flex
71 - }
72 -
73 - #weforms-bfcm-notice .notice-dismiss:before {
74 - color: #76E5FF;
75 - }
76 -
77 - #weforms-bfcm-notice .notice-dismiss:hover:before {
78 - color: #b71c1c;
79 - }
80 -
81 - #weforms-bfcm-notice .logo {
82 - text-align: center;
83 - text-align: center;
84 - margin: auto 50px;
85 - }
86 -
87 - #weforms-bfcm-notice .logo img {
88 - width: 80%;
89 - }
90 -
91 - #weforms-bfcm-notice .highlight-green {
92 - color: #72F3FB;
93 - }
94 -
95 - #weforms-bfcm-notice .highlight-olive {
96 - color: #7CF5AA;
97 - }
98 -
99 - #weforms-bfcm-notice .content {
100 - margin-top: 5px;
101 - }
102 -
103 - #weforms-bfcm-notice .content h3 {
104 - color: #FFF;
105 - margin: 12px 0 5px;
106 - font-weight: normal;
107 - font-size: 30px;
108 - }
109 -
110 - #weforms-bfcm-notice .content p {
111 - margin-top: 12px;
112 - padding: 0;
113 - letter-spacing: .4px;
114 - color: #ffffff;
115 - font-size: 15px;
116 - }
117 -
118 - #weforms-bfcm-notice .call-to-action {
119 - margin-left: 10%;
120 - margin-top: 20px;
121 - }
122 -
123 - #weforms-bfcm-notice .call-to-action a:focus {
124 - box-shadow: none;
125 - }
126 -
127 - #weforms-bfcm-notice .call-to-action p {
128 - font-size: 16px;
129 - color: #fff;
130 - margin-top: 1px;
131 - text-align: center;
132 - }
133 -
134 - #weforms-bfcm-notice .coupon-code {
135 - -moz-user-select: all;
136 - -webkit-user-select: all;
137 - user-select: all;
138 - }
139 - </style>
140 -
141 - <script type='text/javascript'>
142 - jQuery('body').on('click', '#weforms-bfcm-notice .notice-dismiss', function (e) {
143 - e.preventDefault();
144 -
145 - wp.ajax.post('weforms-dismiss-promotional-offer-notice', {
146 - dismissed: true,
147 - _wpnonce: '<?php echo esc_attr ( wp_create_nonce( 'weforms' ) ); ?>'
148 - });
149 - });
150 - </script>
151 - <?php
152 - }
153 - }
154 -
155 - /**
156 - * @return void
157 - *
158 - **@since 1.3.5
159 - */
160 - public function weforms_review_notice_message() {
161 - // Show only to Admins
162 - if ( !current_user_can( 'manage_options' ) ) {
163 - return;
164 - }
165 -
166 - $screen = get_current_screen();
167 - if ( $screen && $screen->base && 'toplevel_page_weforms' !== $screen->base ) {
168 - return;
169 - }
170 -
171 - $dismiss_notice = get_option( 'weforms_review_notice_dismiss', 'no' );
172 - $activation_time = get_option( 'weforms_installed' );
173 - $total_entries = weforms_count_entries();
174 -
175 - $args = [
176 - 'order' => 'DESC',
177 - 'orderby' => 'post_date',
178 - ];
179 -
180 - $contact_forms = weforms()->form->get_forms( $args );
181 - $form_published = count( $contact_forms['forms'] );
182 -
183 - // check if it has already been dismissed
184 - // and don't show notice in 45 days of installation, 3888000 = 45 Days in seconds
185 - if ( 'yes' == $dismiss_notice ) {
186 - return;
187 - }
188 -
189 - if (
190 - ( time() - $activation_time < 3888000 )
191 - && $total_entries < 25
192 - && $form_published < 3
193 - ) {
194 - return;
195 - } ?>
196 - <div id="weforms-review-notice" class="weforms-review-notice updated notice">
197 - <div class="weforms-review-top">
198 - <p><img src="<?php echo esc_attr( WEFORMS_ASSET_URI ) . '/images/weforms-logo.png'; ?>" alt=""></p>
199 - <div class="weforms-review-text">
200 - <?php if ( $total_entries >= 25 ) : ?>
201 - <h3><?php printf( __( 'Enjoying %sweForms%s?', 'weforms' ), '<strong>', '</strong>' ); ?></h3>
202 - <p><?php
203 - printf(
204 - // translators: opening <a>tag, closing </a> tag.
205 - __(
206 - 'Seems like you are getting a good response using weForms. Would you please show us a little love by rating us in the %sWordPress.org%s?',
207 - 'weforms'
208 - ),
209 - '<a href="https://wordpress.org/support/plugin/weforms/reviews/#postform" target="_blank"><strong>',
210 - '</strong></a>'
211 - ); ?></p>
212 - <?php else: ?>
213 - <h3><?php printf(
214 - // translators: opening <strong> tag, closing </strong> tag.
215 - __( 'Enjoying %sweForms%s?', 'weforms' ),
216 - '<strong>',
217 - '</strong>' ); ?></h3>
218 - <p><?php
219 - printf(
220 - // translators: opening <a> tag, closing </a> tag
221 - __(
222 - '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 %sWordPress.org%s?',
223 - 'weforms'
224 - ),
225 - '<a href="https://wordpress.org/support/plugin/weforms/reviews/#postform" target="_blank"><strong>',
226 - '</strong></a>'
227 - ); ?></p>
228 - <?php endif; ?>
229 - </div>
230 - </div>
231 - <div class="weforms-review-links">
232 - <ul class="weforms-review-ul">
233 - <li><a class="button-primary button" href="https://wordpress.org/support/plugin/weforms/reviews/#postform" target="_blank"><span
234 - class="dashicons dashicons-external"></span><?php esc_html_e( 'Sure! I\'d love to!', 'weforms' ) ?>
235 - </a></li>
236 - <li><a href="#" class="button notice-dismiss"><span
237 - class="dashicons dashicons-smiley"></span><?php esc_html_e( 'I\'ve already left a review', 'weforms' ) ?>
238 - </a></li>
239 - <li><a href="#" class="button notice-dismiss"><span
240 - class="dashicons dashicons-dismiss"></span><?php esc_html_e( 'Never show again', 'weforms' ) ?>
241 - </a>
242 - </li>
243 - </ul>
244 - </div>
245 - </div>
246 - <style type="text/css">
247 -
248 - #weforms-review-notice .notice-dismiss:before {
249 - display: none;
250 - }
251 -
252 - #weforms-review-notice.weforms-review-notice {
253 - background-color: #fff;
254 - border-radius: 3px;
255 - margin: 5px 0 15px;
256 - }
257 -
258 - #weforms-review-notice .weforms-review-top {
259 - display: flex;
260 - margin: 0.5em 0;
261 - }
262 -
263 - #weforms-review-notice .weforms-review-top > p {
264 - padding-right: 15px;
265 - }
266 -
267 - #weforms-review-notice .weforms-review-thumbnail {
268 - width: 114px;
269 - float: left;
270 - line-height: 80px;
271 - text-align: center;
272 - border-right: 4px solid transparent;
273 - }
274 -
275 - #weforms-review-notice .weforms-review-thumbnail img {
276 - width: 60px;
277 - vertical-align: middle;
278 - }
279 -
280 - #weforms-review-notice .weforms-review-text {
281 - overflow: hidden;
282 - }
283 -
284 - #weforms-review-notice .weforms-review-text h3 {
285 - font-size: 24px;
286 - margin: 0 0 5px;
287 - font-weight: 400;
288 - line-height: 1.3;
289 - }
290 -
291 - #weforms-review-notice .weforms-review-links {
292 - margin: 0.5em 0;
293 - }
294 -
295 - #weforms-review-notice .weforms-review-text p {
296 - font-size: 13px;
297 - margin: 0 0 5px;
298 - }
299 -
300 - #weforms-review-notice .weforms-review-ul {
301 - margin: 0;
302 - padding: 0;
303 - }
304 -
305 - #weforms-review-notice .weforms-review-ul li {
306 - display: inline-block;
307 - margin-right: 15px;
308 - }
309 -
310 - #weforms-review-notice .weforms-review-ul li a {
311 - display: flex;
312 - align-items: center;
313 - justify-content: space-between;
314 - text-decoration: none;
315 - position: relative;
316 - }
317 -
318 - #weforms-review-notice .weforms-review-ul li a span {
319 - margin-right: 10px;
320 - }
321 - </style>
322 - <script type='text/javascript'>
323 - jQuery('body').on('click', '#weforms-review-notice .notice-dismiss', function (e) {
324 - e.preventDefault();
325 - jQuery("#weforms-review-notice").hide();
326 -
327 - wp.ajax.post('weforms-dismiss-review-notice', {
328 - dismissed: true,
329 - _wpnonce: '<?php echo esc_attr ( wp_create_nonce( 'weforms' ) ); ?>'
330 - });
331 - });
332 - </script>
333 - <?php
334 - }
335 -
336 - /**
337 - * Dismiss promotion notice
338 - *
339 - * @return void
340 - *
341 - * @since 1.2.6
342 - */
343 - public function dismiss_promotional_offer() {
344 - if( empty( $_POST['_wpnonce'] ) ) {
345 - wp_send_json_error( __( 'Unauthorized operation', 'weforms' ) );
346 - }
347 -
348 - if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), 'weforms' ) ) {
349 - wp_send_json_error( __( 'Unauthorized operation', 'weforms' ) );
350 - }
351 -
352 - if ( ! isset( $_POST['reason_id'] ) ) {
353 - wp_send_json_error();
354 - }
355 -
356 - if ( ! empty( $_POST['dismissed'] ) ) {
357 - $offer_key = 'weforms_promotional_offer_notice';
358 - update_option( $offer_key, 'hide' );
359 - }
360 - }
361 -
362 - /**
363 - * Dismiss review notice
364 - *
365 - * @return void
366 - *
367 - **@since 1.3.5
368 - */
369 - public function dismiss_review_notice() {
370 - if( empty( $_POST['_wpnonce'] ) ) {
371 - wp_send_json_error( __( 'Unauthorized operation', 'weforms' ) );
372 - }
373 -
374 - if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), 'weforms' ) ) {
375 - wp_send_json_error( __( 'Unauthorized operation', 'weforms' ) );
376 - }
377 -
378 - if ( ! empty( $_POST['dismissed'] ) ) {
379 - update_option( 'weforms_review_notice_dismiss', 'yes' );
380 - }
381 - }
382 -}
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( 'wp_ajax_weforms-dismiss-promotional-offer-notice', array( $this, 'dismiss_promotional_offer' ) );
12 + }
13 +
14 + /**
15 + * Promotional offer notice
16 + *
17 + * @since 1.2.6
18 + *
19 + * @return void
20 + */
21 + public function promotional_offer() {
22 + // Show only to Admins
23 + if ( ! current_user_can( 'manage_options' ) ) {
24 + return;
25 + }
26 +
27 + // 2018-03-26 23:59:00
28 + if ( time() > 1522108740 ) {
29 + return;
30 + }
31 +
32 + // check if wpuf is showing banner
33 + if ( class_exists( 'WPUF_Admin_Promotion' ) ) {
34 + return;
35 + }
36 +
37 + // check if it has already been dismissed
38 + $hide_notice = get_option( 'weforms_promotional_offer_notice', 'no' );
39 +
40 + if ( 'hide' == $hide_notice ) {
41 + return;
42 + }
43 +
44 + // $product_text = ( weforms()->is_pro() ) ? __( 'Pro upgrade and all extensions, ', 'weforms' ) : __( 'all extensions, ', 'weforms' );
45 +
46 + // $offer_msg = __( '<h2><span class="dashicons dashicons-awards"></span> weDevs 5th Birthday Offer</h2>', 'weforms' );
47 + $offer_msg = sprintf( __( '<p>
48 + <strong class="highlight-text" style="font-size: 18px">It’s Our Birthday <span class="weforms-cake" style="font-size: 20px"> &#x1F382;</span>
49 + But You Get The Present <span class="weforms-gift" style="font-size: 20px"> &#x1F381;</span> </strong><br>
50 + Get 25&#37; Discount with coupon:
51 + <a target="_blank" href="%1$s"><strong> we25 </strong></a>
52 + <br>
53 + Offer ending soon!
54 + </p>', 'weforms' ), 'https://wedevs.com/in/get-25-off' );
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/in/get-25-off" 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 + * Dismiss promotion notice
193 + *
194 + * @since 1.2.6
195 + *
196 + * @return void
197 + */
198 + public function dismiss_promotional_offer() {
199 + if ( ! empty( $_POST['dismissed'] ) ) {
200 + $offer_key = 'weforms_promotional_offer_notice';
201 + update_option( $offer_key, 'hide' );
202 + }
203 + }
204 +}