PluginProbe
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce / 1.2.6
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce v1.2.6
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 / admin / class-admin.php

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

222 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\Admin;
3 use WeDevs\ERP\Framework\Traits\Hooker;
4
5 class Admin_Page {
6
7 use Hooker;
8
9 function __construct() {
10 $this->init_actions();
11 $this->init_classes();
12 }
13
14 /**
15 * Initialize action hooks
16 *
17 * @return void
18 */
19 public function init_actions() {
20 $this->action( 'init', 'includes' );
21 $this->action( 'admin_init', 'admin_redirects' );
22 add_action( 'admin_footer', 'erp_include_popup_markup' );
23
24 $this->action( 'admin_notices', 'promotional_offer' );
25 }
26
27 /**
28 * Include required files
29 *
30 * @return void
31 */
32 public function includes() {
33 // Setup/welcome
34 if ( ! empty( $_GET['page'] ) ) {
35
36 if ( 'erp-setup' == $_GET['page'] ) {
37 include_once dirname( __FILE__ ) . '/class-setup-wizard.php';
38 }
39 }
40 }
41
42 /**
43 * Initialize required classes
44 *
45 * @return void
46 */
47 public function init_classes() {
48 new Form_Handler();
49 new Ajax();
50 }
51
52 /**
53 * Handle redirects to setup/welcome page after install and updates.
54 *
55 * @return void
56 */
57 public function admin_redirects() {
58 if ( ! get_transient( '_erp_activation_redirect' ) ) {
59 return;
60 }
61
62 delete_transient( '_erp_activation_redirect' );
63
64 if ( ( ! empty( $_GET['page'] ) && in_array( $_GET['page'], array( 'erp-setup', 'erp-welcome' ) ) ) || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_options' ) ) {
65 return;
66 }
67
68 // If it's the first time
69 if ( get_option( 'erp_setup_wizard_ran' ) != '1' ) {
70 wp_safe_redirect( admin_url( 'index.php?page=erp-setup' ) );
71 exit;
72
73 // Otherwise, the welcome page
74 } else {
75 wp_safe_redirect( admin_url( 'index.php?page=erp-welcome' ) );
76 exit;
77 }
78 }
79
80 /**
81 * Promotional offer notice
82 *
83 * @since 1.1.15
84 *
85 * @return void
86 */
87 public function promotional_offer() {
88 // Show only to Admins
89 if ( ! current_user_can( 'manage_options' ) ) {
90 return;
91 }
92
93 // check if it has already been dismissed
94 $hide_notice = get_option( 'erp_promotional_offer_notice_quiz-aug17', 'no' );
95
96 if ( 'hide' == $hide_notice ) {
97 return;
98 }
99 ?>
100 <div class="notice is-dismissible" id="erp-promotional-offer-notice">
101 <table>
102 <tbody>
103 <tr>
104 <td class="image-container">
105 <img src="https://ps.w.org/erp/assets/icon-256x256.png" alt="">
106 </td>
107 <td class="message-container">
108 <h2><span class="dashicons dashicons-awards"></span> Big Discount!</h2>
109 <p>
110 <a href="https://wperp.com/in/WPERP-Quiz" class="highlight-text" target="_blank">Play This Quiz</a> on WP ERP and Win Massive 50% Discount. Hurry Up! Limited Time Offer!
111 </p>
112 </td>
113 </tr>
114 </tbody>
115 </table>
116
117 <span class="dashicons dashicons-megaphone"></span>
118 </div><!-- #erp-promotional-offer-notice -->
119
120 <style>
121 #erp-promotional-offer-notice {
122 background-color: #089dd7;
123 border: 0px;
124 padding: 0;
125 opacity: 0;
126 }
127
128 .wrap > #erp-promotional-offer-notice {
129 opacity: 1;
130 }
131
132 #erp-promotional-offer-notice table {
133 border-collapse: collapse;
134 width: 100%;
135 }
136
137 #erp-promotional-offer-notice table td {
138 padding: 0;
139 }
140
141 #erp-promotional-offer-notice table td.image-container {
142 background-color: #fff;
143 vertical-align: middle;
144 width: 95px;
145 }
146
147
148 #erp-promotional-offer-notice img {
149 max-width: 100%;
150 max-height: 100px;
151 vertical-align: middle;
152 }
153
154 #erp-promotional-offer-notice table td.message-container {
155 padding: 0 10px;
156 }
157
158 #erp-promotional-offer-notice h2 {
159 color: rgba(250, 250, 250, 0.77);
160 margin-bottom: 10px;
161 font-weight: normal;
162 margin: 16px 0 14px;
163 -webkit-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
164 -moz-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
165 -o-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
166 text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
167 }
168
169
170 #erp-promotional-offer-notice h2 span {
171 position: relative;
172 top: 0;
173 }
174
175 #erp-promotional-offer-notice p {
176 color: rgba(250, 250, 250, 0.77);
177 font-size: 14px;
178 margin-bottom: 10px;
179 -webkit-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
180 -moz-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
181 -o-text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
182 text-shadow: 0.1px 0.1px 0px rgba(250, 250, 250, 0.24);
183 }
184
185 #erp-promotional-offer-notice p strong.highlight-text{
186 color: #fff;
187 }
188
189 #erp-promotional-offer-notice p a {
190 color: #fafafa;
191 }
192
193 #erp-promotional-offer-notice .notice-dismiss:before {
194 color: #fff;
195 }
196
197 #erp-promotional-offer-notice span.dashicons-megaphone {
198 position: absolute;
199 bottom: 46px;
200 right: 119px;
201 color: rgba(253, 253, 253, 0.29);
202 font-size: 96px;
203 transform: rotate(-21deg);
204 }
205
206 </style>
207
208 <script type='text/javascript'>
209 jQuery('body').on('click', '#erp-promotional-offer-notice .notice-dismiss', function(e) {
210 e.preventDefault();
211
212 wp.ajax.post('erp-dismiss-promotional-offer-notice', {
213 dismissed: true
214 });
215 });
216 </script>
217 <?php
218 }
219 }
220
221 new Admin_Page();
222