PluginProbe
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce / 1.3.13
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce v1.3.13
1.17.9 1.17.8 1.17.7 1.17.6 1.17.5 1.17.4 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.3.0 1.3.1 1.3.11 1.3.12 1.3.13 1.3.14 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 All 143 releases
erp / includes / class-promotion.php

class-promotion.php in ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce 1.3.13, at includes/class-promotion.php

198 lines 6.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace WeDevs\ERP;
3
4 /**
5 * Promotional offer class
6 */
7 class Promotion {
8
9 public function __construct() {
10 add_action( 'admin_notices', array( $this, 'promotional_offer' ) );
11 add_action( 'wp_ajax_erp-dismiss-promotional-offer-notice', array( $this, 'dismiss_promotional_offer' ) );
12 }
13
14 /**
15 * Promotional offer notice
16 *
17 * @since 1.1.15
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() > strtotime('30-4-2018') ) {
29 return;
30 }
31
32 // check if it has already been dismissed
33 $hide_notice = get_option( 'erp_birthday2018_promotional_offer_notice', 'no' );
34
35 if ( 'hide' == $hide_notice ) {
36 return;
37 }
38
39 $offer_msg = sprintf( __( '<p><strong class="highlight-text" style="font-size: 18px">It\'s Our Birthday <span class="erp-cake" style="font-size: 20px"> &#x1F382;</span>
40 But You Get The Present <span class="erp-gift" style="font-size: 20px"> &#x1F381;</span> </strong><br>
41 Get 33&#37; Discount with coupon:
42 <a target="_blank" href="%1$s"><strong> Birthday2018 </strong></a>
43 <br>
44 Offer ending soon!
45 </p>', 'erp' ), 'https://wperp.com/in/wordpress-erp-3rd-birthday' );
46
47 ?>
48 <div class="notice is-dismissible" id="erp-promotional-offer-notice">
49 <table>
50 <tbody>
51 <tr>
52 <td class="image-container">
53 <img src="https://ps.w.org/erp/assets/icon-256x256.png" alt="">
54 </td>
55 <td class="message-container">
56 <?php echo $offer_msg; ?>
57 </td>
58 </tr>
59 </tbody>
60 </table>
61
62 <span class="dashicons dashicons-megaphone"></span>
63 <a href="https://wperp.com/in/wordpress-erp-3rd-birthday" class="button button-primary promo-btn" target="_blank"><?php _e( 'Get the Offer', 'erp' ); ?></a>
64 </div><!-- #erp-promotional-offer-notice -->
65
66 <style>
67 #erp-promotional-offer-notice {
68 background-color: #4caf50;
69 border: 0px;
70 padding: 0;
71 opacity: 0;
72 }
73
74 .wrap > #erp-promotional-offer-notice {
75 opacity: 1;
76 }
77
78 #erp-promotional-offer-notice table {
79 border-collapse: collapse;
80 width: 100%;
81 }
82
83 #erp-promotional-offer-notice table td {
84 padding: 0;
85 }
86
87 #erp-promotional-offer-notice table td.image-container {
88 background-color: #fff;
89 vertical-align: middle;
90 width: 95px;
91 }
92
93
94 #erp-promotional-offer-notice img {
95 max-width: 100%;
96 max-height: 100px;
97 vertical-align: middle;
98 }
99
100 #erp-promotional-offer-notice table td.message-container {
101 padding: 0 10px;
102 }
103
104 #erp-promotional-offer-notice h2{
105 color: rgba(250, 250, 250, 0.77);
106 margin-bottom: 10px;
107 font-weight: normal;
108 margin: 16px 0 14px;
109 -webkit-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
110 -moz-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
111 -o-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
112 text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
113 }
114
115
116 #erp-promotional-offer-notice h2 span {
117 position: relative;
118 top: 0;
119 }
120
121 #erp-promotional-offer-notice p{
122 color: rgba(250, 250, 250, 0.77);
123 font-size: 14px;
124 margin-bottom: 10px;
125 -webkit-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
126 -moz-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
127 -o-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
128 text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
129 }
130
131 #erp-promotional-offer-notice p strong.highlight-text{
132 color: #fff;
133 }
134
135 #erp-promotional-offer-notice p a {
136 color: #fafafa;
137 }
138
139 #erp-promotional-offer-notice .notice-dismiss:before {
140 color: #fff;
141 }
142
143 #erp-promotional-offer-notice span.dashicons-megaphone {
144 position: absolute;
145 bottom: 46px;
146 right: 248px;
147 color: rgba(253, 253, 253, 0.29);
148 font-size: 96px;
149 transform: rotate(-21deg);
150 }
151
152 #erp-promotional-offer-notice a.promo-btn{
153 background: #fff;
154 border-color: #fafafa #fafafa #fafafa;
155 box-shadow: 0 1px 0 #fafafa;
156 color: #4caf4f;
157 text-decoration: none;
158 text-shadow: none;
159 position: absolute;
160 top: 30px;
161 right: 26px;
162 height: 40px;
163 line-height: 40px;
164 width: 130px;
165 text-align: center;
166 font-weight: 600;
167 }
168
169 </style>
170
171 <script type='text/javascript'>
172 jQuery('body').on('click', '#erp-promotional-offer-notice .notice-dismiss', function(e) {
173 e.preventDefault();
174
175 wp.ajax.post('erp-dismiss-promotional-offer-notice', {
176 dismissed: true
177 });
178 });
179 </script>
180 <?php
181 }
182
183
184 /**
185 * Dismiss promotion notice
186 *
187 * @since 2.5
188 *
189 * @return void
190 */
191 public function dismiss_promotional_offer() {
192 if ( ! empty( $_POST['dismissed'] ) ) {
193 $offer_key = 'erp_birthday2018_promotional_offer_notice';
194 update_option( $offer_key, 'hide' );
195 }
196 }
197 }
198