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

202 lines 7.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( '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() > 1543276740 ) {
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 = __( '<p>
48 <strong class="highlight-text" style="font-size: 18px">33&#37; flat discount on all our products</strong><br>
49 Save money this holiday season while supercharging your WordPress site with plugins that were made to empower you.
50 <br>
51 Offer ending soon!
52 </p>', 'weforms' );
53
54 ?>
55 <div class="notice is-dismissible" id="weforms-promotional-offer-notice">
56 <table>
57 <tbody>
58 <tr>
59 <td class="image-container">
60 <img src="https://ps.w.org/weforms/assets/icon-256x256.png" alt="">
61 </td>
62 <td class="message-container">
63 <?php echo $offer_msg; ?>
64 </td>
65 </tr>
66 </tbody>
67 </table>
68
69 <span class="dashicons dashicons-megaphone"></span>
70 <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>
71 </div><!-- #weforms-promotional-offer-notice -->
72
73 <style>
74 #weforms-promotional-offer-notice {
75 background-image: linear-gradient(35deg,#00c9ff 0%, #92fe9d 100%) !important;
76 border: 0px;
77 padding: 0;
78 opacity: 0;
79 }
80
81 .wrap > #weforms-promotional-offer-notice {
82 opacity: 1;
83 }
84
85 #weforms-promotional-offer-notice table {
86 border-collapse: collapse;
87 width: 100%;
88 }
89
90 #weforms-promotional-offer-notice table td {
91 padding: 0;
92 }
93
94 #weforms-promotional-offer-notice table td.image-container {
95 background-color: #ebf0f4;
96 vertical-align: middle;
97 width: 95px;
98 }
99
100 #weforms-promotional-offer-notice img {
101 max-width: 100%;
102 max-height: 100px;
103 vertical-align: middle;
104 }
105
106 #weforms-promotional-offer-notice table td.message-container {
107 padding: 0 10px;
108 }
109
110 #weforms-promotional-offer-notice h2{
111 color: rgba(250, 250, 250, 0.77);
112 margin-bottom: 10px;
113 font-weight: normal;
114 margin: 16px 0 14px;
115 -webkit-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
116 -moz-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
117 -o-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
118 text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
119 }
120
121 #weforms-promotional-offer-notice h2 span {
122 position: relative;
123 top: 0;
124 }
125
126 #weforms-promotional-offer-notice p{
127 color: rgba(250, 250, 250, 0.77);
128 font-size: 14px;
129 margin-bottom: 10px;
130 -webkit-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
131 -moz-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
132 -o-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
133 text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
134 }
135
136 #weforms-promotional-offer-notice p strong.highlight-text{
137 color: #fff;
138 }
139
140 #weforms-promotional-offer-notice p a {
141 color: #fafafa;
142 }
143
144 #weforms-promotional-offer-notice .notice-dismiss:before {
145 color: #fff;
146 }
147
148 #weforms-promotional-offer-notice span.dashicons-megaphone {
149 position: absolute;
150 bottom: 46px;
151 right: 248px;
152 color: rgba(253, 253, 253, 0.29);
153 font-size: 96px;
154 transform: rotate(-21deg);
155 }
156
157 #weforms-promotional-offer-notice a.promo-btn{
158 background: #149269;
159 border-color: #149269 #149269 #149269;
160 box-shadow: 0 1px 0 #149269;
161 /*color: #45E2D0;*/
162 text-decoration: none;
163 text-shadow: none;
164 position: absolute;
165 top: 30px;
166 right: 26px;
167 height: 40px;
168 line-height: 40px;
169 width: 130px;
170 text-align: center;
171 font-weight: 600;
172 }
173
174 </style>
175
176 <script type='text/javascript'>
177 jQuery('body').on('click', '#weforms-promotional-offer-notice .notice-dismiss', function(e) {
178 e.preventDefault();
179
180 wp.ajax.post('weforms-dismiss-promotional-offer-notice', {
181 dismissed: true
182 });
183 });
184 </script>
185 <?php
186 }
187
188
189 /**
190 * Dismiss promotion notice
191 *
192 * @since 1.2.6
193 *
194 * @return void
195 */
196 public function dismiss_promotional_offer() {
197 if ( ! empty( $_POST['dismissed'] ) ) {
198 $offer_key = 'weforms_promotional_offer_notice';
199 update_option( $offer_key, 'hide' );
200 }
201 }
202 }