@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -33,17 +33,17 @@ discard block |
||
33 | 33 | global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_upgrades_screen, $give_donors_page, $give_tools_page; |
34 | 34 | |
35 | 35 | //Payments |
36 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
37 | - $give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' ); |
|
36 | + $give_payment = get_post_type_object('give_payment'); |
|
37 | + $give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page'); |
|
38 | 38 | |
39 | 39 | //Donors |
40 | - $give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Donors', 'give' ), esc_html__( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_customers_page' ); |
|
40 | + $give_donors_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Donors', 'give'), esc_html__('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_customers_page'); |
|
41 | 41 | |
42 | 42 | //Reports` |
43 | 43 | $give_reports_page = add_submenu_page( |
44 | 44 | 'edit.php?post_type=give_forms', |
45 | - esc_html__( 'Donation Reports', 'give' ), |
|
46 | - esc_html__( 'Reports', 'give' ), |
|
45 | + esc_html__('Donation Reports', 'give'), |
|
46 | + esc_html__('Reports', 'give'), |
|
47 | 47 | 'view_give_reports', |
48 | 48 | 'give-reports', |
49 | 49 | array( |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | //Settings |
56 | 56 | $give_settings_page = add_submenu_page( |
57 | 57 | 'edit.php?post_type=give_forms', |
58 | - esc_html__( 'Give Settings', 'give' ), |
|
59 | - esc_html__( 'Settings', 'give' ), |
|
58 | + esc_html__('Give Settings', 'give'), |
|
59 | + esc_html__('Settings', 'give'), |
|
60 | 60 | 'manage_give_settings', |
61 | 61 | 'give-settings', |
62 | 62 | array( |
@@ -66,21 +66,21 @@ discard block |
||
66 | 66 | ); |
67 | 67 | |
68 | 68 | //Tools. |
69 | - $give_tools_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Tools', 'give' ), esc_html__( 'Tools', 'give' ), 'manage_give_settings', 'give-tools', array( |
|
69 | + $give_tools_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Tools', 'give'), esc_html__('Tools', 'give'), 'manage_give_settings', 'give-tools', array( |
|
70 | 70 | Give()->give_settings, |
71 | 71 | 'output' |
72 | - ) ); |
|
72 | + )); |
|
73 | 73 | |
74 | 74 | //Add-ons |
75 | - $give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Add-ons', 'give' ), esc_html__( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' ); |
|
75 | + $give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Add-ons', 'give'), esc_html__('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page'); |
|
76 | 76 | |
77 | 77 | //Upgrades |
78 | - $give_upgrades_screen = add_submenu_page( null, esc_html__( 'Give Upgrades', 'give' ), esc_html__( 'Give Upgrades', 'give' ), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen' ); |
|
78 | + $give_upgrades_screen = add_submenu_page(null, esc_html__('Give Upgrades', 'give'), esc_html__('Give Upgrades', 'give'), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen'); |
|
79 | 79 | |
80 | 80 | |
81 | 81 | } |
82 | 82 | |
83 | -add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
83 | +add_action('admin_menu', 'give_add_options_links', 10); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Determines whether the current admin page is a Give admin page. |
@@ -95,224 +95,224 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return bool True if Give admin page. |
97 | 97 | */ |
98 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
98 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
99 | 99 | |
100 | 100 | global $pagenow, $typenow; |
101 | 101 | |
102 | 102 | $found = false; |
103 | - $post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false; |
|
104 | - $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false; |
|
105 | - $taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false; |
|
106 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
107 | - $view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false; |
|
108 | - $tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false; |
|
109 | - |
|
110 | - switch ( $passed_page ) { |
|
103 | + $post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false; |
|
104 | + $action = isset($_GET['action']) ? strtolower($_GET['action']) : false; |
|
105 | + $taxonomy = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false; |
|
106 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
107 | + $view = isset($_GET['view']) ? strtolower($_GET['view']) : false; |
|
108 | + $tab = isset($_GET['tab']) ? strtolower($_GET['tab']) : false; |
|
109 | + |
|
110 | + switch ($passed_page) { |
|
111 | 111 | case 'give_forms': |
112 | - switch ( $passed_view ) { |
|
112 | + switch ($passed_view) { |
|
113 | 113 | case 'list-table': |
114 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) { |
|
114 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') { |
|
115 | 115 | $found = true; |
116 | 116 | } |
117 | 117 | break; |
118 | 118 | case 'edit': |
119 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) { |
|
119 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') { |
|
120 | 120 | $found = true; |
121 | 121 | } |
122 | 122 | break; |
123 | 123 | case 'new': |
124 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) { |
|
124 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') { |
|
125 | 125 | $found = true; |
126 | 126 | } |
127 | 127 | break; |
128 | 128 | default: |
129 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) { |
|
129 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) { |
|
130 | 130 | $found = true; |
131 | 131 | } |
132 | 132 | break; |
133 | 133 | } |
134 | 134 | break; |
135 | 135 | case 'categories': |
136 | - switch ( $passed_view ) { |
|
136 | + switch ($passed_view) { |
|
137 | 137 | case 'list-table': |
138 | 138 | case 'new': |
139 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) { |
|
139 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) { |
|
140 | 140 | $found = true; |
141 | 141 | } |
142 | 142 | break; |
143 | 143 | case 'edit': |
144 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) { |
|
144 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) { |
|
145 | 145 | $found = true; |
146 | 146 | } |
147 | 147 | break; |
148 | 148 | default: |
149 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) { |
|
149 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) { |
|
150 | 150 | $found = true; |
151 | 151 | } |
152 | 152 | break; |
153 | 153 | } |
154 | 154 | break; |
155 | 155 | case 'tags': |
156 | - switch ( $passed_view ) { |
|
156 | + switch ($passed_view) { |
|
157 | 157 | case 'list-table': |
158 | 158 | case 'new': |
159 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) { |
|
159 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) { |
|
160 | 160 | $found = true; |
161 | 161 | } |
162 | 162 | break; |
163 | 163 | case 'edit': |
164 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) { |
|
164 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) { |
|
165 | 165 | $found = true; |
166 | 166 | } |
167 | 167 | break; |
168 | 168 | default: |
169 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) { |
|
169 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) { |
|
170 | 170 | $found = true; |
171 | 171 | } |
172 | 172 | break; |
173 | 173 | } |
174 | 174 | break; |
175 | 175 | case 'payments': |
176 | - switch ( $passed_view ) { |
|
176 | + switch ($passed_view) { |
|
177 | 177 | case 'list-table': |
178 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) { |
|
178 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) { |
|
179 | 179 | $found = true; |
180 | 180 | } |
181 | 181 | break; |
182 | 182 | case 'edit': |
183 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view ) { |
|
183 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view) { |
|
184 | 184 | $found = true; |
185 | 185 | } |
186 | 186 | break; |
187 | 187 | default: |
188 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) { |
|
188 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) { |
|
189 | 189 | $found = true; |
190 | 190 | } |
191 | 191 | break; |
192 | 192 | } |
193 | 193 | break; |
194 | 194 | case 'reports': |
195 | - switch ( $passed_view ) { |
|
195 | + switch ($passed_view) { |
|
196 | 196 | // If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ] |
197 | 197 | case 'earnings': |
198 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) { |
|
198 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) { |
|
199 | 199 | $found = true; |
200 | 200 | } |
201 | 201 | break; |
202 | 202 | case 'donors': |
203 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) { |
|
203 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) { |
|
204 | 204 | $found = true; |
205 | 205 | } |
206 | 206 | break; |
207 | 207 | case 'gateways': |
208 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) { |
|
208 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) { |
|
209 | 209 | $found = true; |
210 | 210 | } |
211 | 211 | break; |
212 | 212 | case 'export': |
213 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) { |
|
213 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) { |
|
214 | 214 | $found = true; |
215 | 215 | } |
216 | 216 | break; |
217 | 217 | case 'logs': |
218 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) { |
|
218 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) { |
|
219 | 219 | $found = true; |
220 | 220 | } |
221 | 221 | break; |
222 | 222 | default: |
223 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
223 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
224 | 224 | $found = true; |
225 | 225 | } |
226 | 226 | break; |
227 | 227 | } |
228 | 228 | break; |
229 | 229 | case 'settings': |
230 | - switch ( $passed_view ) { |
|
230 | + switch ($passed_view) { |
|
231 | 231 | case 'general': |
232 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) { |
|
232 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) { |
|
233 | 233 | $found = true; |
234 | 234 | } |
235 | 235 | break; |
236 | 236 | case 'gateways': |
237 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) { |
|
237 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) { |
|
238 | 238 | $found = true; |
239 | 239 | } |
240 | 240 | break; |
241 | 241 | case 'emails': |
242 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) { |
|
242 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) { |
|
243 | 243 | $found = true; |
244 | 244 | } |
245 | 245 | break; |
246 | 246 | case 'display': |
247 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) { |
|
247 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) { |
|
248 | 248 | $found = true; |
249 | 249 | } |
250 | 250 | break; |
251 | 251 | case 'licenses': |
252 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) { |
|
252 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) { |
|
253 | 253 | $found = true; |
254 | 254 | } |
255 | 255 | break; |
256 | 256 | case 'api': |
257 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) { |
|
257 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) { |
|
258 | 258 | $found = true; |
259 | 259 | } |
260 | 260 | break; |
261 | 261 | case 'advanced': |
262 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) { |
|
262 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) { |
|
263 | 263 | $found = true; |
264 | 264 | } |
265 | 265 | break; |
266 | 266 | case 'system_info': |
267 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) { |
|
267 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) { |
|
268 | 268 | $found = true; |
269 | 269 | } |
270 | 270 | break; |
271 | 271 | default: |
272 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) { |
|
272 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) { |
|
273 | 273 | $found = true; |
274 | 274 | } |
275 | 275 | break; |
276 | 276 | } |
277 | 277 | break; |
278 | 278 | case 'addons': |
279 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) { |
|
279 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) { |
|
280 | 280 | $found = true; |
281 | 281 | } |
282 | 282 | break; |
283 | 283 | case 'donors': |
284 | - switch ( $passed_view ) { |
|
284 | + switch ($passed_view) { |
|
285 | 285 | case 'list-table': |
286 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) { |
|
286 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) { |
|
287 | 287 | $found = true; |
288 | 288 | } |
289 | 289 | break; |
290 | 290 | case 'overview': |
291 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) { |
|
291 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) { |
|
292 | 292 | $found = true; |
293 | 293 | } |
294 | 294 | break; |
295 | 295 | case 'notes': |
296 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) { |
|
296 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) { |
|
297 | 297 | $found = true; |
298 | 298 | } |
299 | 299 | break; |
300 | 300 | default: |
301 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) { |
|
301 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) { |
|
302 | 302 | $found = true; |
303 | 303 | } |
304 | 304 | break; |
305 | 305 | } |
306 | 306 | break; |
307 | 307 | case 'reports': |
308 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
308 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
309 | 309 | $found = true; |
310 | 310 | } |
311 | 311 | break; |
312 | 312 | default: |
313 | 313 | global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_upgrades_screen, $give_customers_page, $give_tools_page; |
314 | 314 | |
315 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
315 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
316 | 316 | $give_payments_page, |
317 | 317 | $give_settings_page, |
318 | 318 | $give_reports_page, |
@@ -323,19 +323,19 @@ discard block |
||
323 | 323 | $give_customers_page, |
324 | 324 | $give_tools_page, |
325 | 325 | 'widgets.php' |
326 | - ) ); |
|
327 | - if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) { |
|
326 | + )); |
|
327 | + if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) { |
|
328 | 328 | $found = true; |
329 | - if ( 'give-upgrades' === $page ) { |
|
329 | + if ('give-upgrades' === $page) { |
|
330 | 330 | $found = false; |
331 | 331 | } |
332 | - } elseif ( in_array( $pagenow, $admin_pages ) ) { |
|
332 | + } elseif (in_array($pagenow, $admin_pages)) { |
|
333 | 333 | $found = true; |
334 | 334 | } |
335 | 335 | break; |
336 | 336 | } |
337 | 337 | |
338 | - return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view ); |
|
338 | + return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view); |
|
339 | 339 | |
340 | 340 | } |
341 | 341 | |
@@ -347,37 +347,37 @@ discard block |
||
347 | 347 | * @param array $settings |
348 | 348 | * @return array |
349 | 349 | */ |
350 | -function give_settings_page_pages( $settings ) { |
|
351 | - include( 'abstract-admin-settings-page.php' ); |
|
352 | - include( 'settings/class-settings-cmb2-backward-compatibility.php' ); |
|
350 | +function give_settings_page_pages($settings) { |
|
351 | + include('abstract-admin-settings-page.php'); |
|
352 | + include('settings/class-settings-cmb2-backward-compatibility.php'); |
|
353 | 353 | |
354 | 354 | $settings = array( |
355 | 355 | // General settings. |
356 | - include( 'settings/class-settings-general.php' ), |
|
356 | + include('settings/class-settings-general.php'), |
|
357 | 357 | |
358 | 358 | // Payment Gateways Settings. |
359 | - include( 'settings/class-settings-gateways.php' ), |
|
359 | + include('settings/class-settings-gateways.php'), |
|
360 | 360 | |
361 | 361 | // Display settings. |
362 | - include( 'settings/class-settings-display.php' ), |
|
362 | + include('settings/class-settings-display.php'), |
|
363 | 363 | |
364 | 364 | // Emails settings. |
365 | - include( 'settings/class-settings-email.php' ), |
|
365 | + include('settings/class-settings-email.php'), |
|
366 | 366 | |
367 | 367 | // Addons settings. |
368 | - include( 'settings/class-settings-addon.php' ), |
|
368 | + include('settings/class-settings-addon.php'), |
|
369 | 369 | |
370 | 370 | // License settings. |
371 | - include( 'settings/class-settings-license.php' ), |
|
371 | + include('settings/class-settings-license.php'), |
|
372 | 372 | |
373 | 373 | // Advanced settinns. |
374 | - include( 'settings/class-settings-advanced.php' ) |
|
374 | + include('settings/class-settings-advanced.php') |
|
375 | 375 | ); |
376 | 376 | |
377 | 377 | // Output. |
378 | 378 | return $settings; |
379 | 379 | } |
380 | -add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 ); |
|
380 | +add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1); |
|
381 | 381 | |
382 | 382 | |
383 | 383 | /** |
@@ -387,30 +387,30 @@ discard block |
||
387 | 387 | * @param array $settings |
388 | 388 | * @return array |
389 | 389 | */ |
390 | -function give_reports_page_pages( $settings ) { |
|
391 | - include( 'abstract-admin-settings-page.php' ); |
|
390 | +function give_reports_page_pages($settings) { |
|
391 | + include('abstract-admin-settings-page.php'); |
|
392 | 392 | |
393 | 393 | $settings = array( |
394 | 394 | // Earnings. |
395 | - include( 'reporting/class-settings-earnings.php' ), |
|
395 | + include('reporting/class-settings-earnings.php'), |
|
396 | 396 | |
397 | 397 | // Forms. |
398 | - include( 'reporting/class-settings-forms.php' ), |
|
398 | + include('reporting/class-settings-forms.php'), |
|
399 | 399 | |
400 | 400 | // Donors. |
401 | - include( 'reporting/class-settings-donors.php' ), |
|
401 | + include('reporting/class-settings-donors.php'), |
|
402 | 402 | |
403 | 403 | // Gateways. |
404 | - include( 'reporting/class-settings-gateways.php' ), |
|
404 | + include('reporting/class-settings-gateways.php'), |
|
405 | 405 | |
406 | 406 | // Export. |
407 | - include( 'reporting/class-settings-export.php' ), |
|
407 | + include('reporting/class-settings-export.php'), |
|
408 | 408 | ); |
409 | 409 | |
410 | 410 | // Output. |
411 | 411 | return $settings; |
412 | 412 | } |
413 | -add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 ); |
|
413 | +add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1); |
|
414 | 414 | |
415 | 415 | /** |
416 | 416 | * Add setting tab to give-settings page |
@@ -419,27 +419,27 @@ discard block |
||
419 | 419 | * @param array $settings |
420 | 420 | * @return array |
421 | 421 | */ |
422 | -function give_tools_page_pages( $settings ) { |
|
423 | - include( 'abstract-admin-settings-page.php' ); |
|
422 | +function give_tools_page_pages($settings) { |
|
423 | + include('abstract-admin-settings-page.php'); |
|
424 | 424 | |
425 | 425 | $settings = array( |
426 | 426 | // System Info. |
427 | - include( 'tools/class-settings-system-info.php' ), |
|
427 | + include('tools/class-settings-system-info.php'), |
|
428 | 428 | |
429 | 429 | // Logs. |
430 | - include( 'tools/class-settings-logs.php' ), |
|
430 | + include('tools/class-settings-logs.php'), |
|
431 | 431 | |
432 | 432 | // API. |
433 | - include( 'tools/class-settings-api.php' ), |
|
433 | + include('tools/class-settings-api.php'), |
|
434 | 434 | |
435 | 435 | // Data. |
436 | - include( 'tools/class-settings-data.php' ), |
|
436 | + include('tools/class-settings-data.php'), |
|
437 | 437 | ); |
438 | 438 | |
439 | 439 | // Output. |
440 | 440 | return $settings; |
441 | 441 | } |
442 | -add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 ); |
|
442 | +add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1); |
|
443 | 443 | |
444 | 444 | /** |
445 | 445 | * Set default tools page tab. |
@@ -448,10 +448,10 @@ discard block |
||
448 | 448 | * @param string $default_tab Default tab name. |
449 | 449 | * @return string |
450 | 450 | */ |
451 | -function give_set_default_tab_form_tools_page( $default_tab ) { |
|
451 | +function give_set_default_tab_form_tools_page($default_tab) { |
|
452 | 452 | return 'system-info'; |
453 | 453 | } |
454 | -add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 ); |
|
454 | +add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1); |
|
455 | 455 | |
456 | 456 | |
457 | 457 | /** |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * @param string $default_tab Default tab name. |
462 | 462 | * @return string |
463 | 463 | */ |
464 | -function give_set_default_tab_form_reports_page( $default_tab ) { |
|
464 | +function give_set_default_tab_form_reports_page($default_tab) { |
|
465 | 465 | return 'earnings'; |
466 | 466 | } |
467 | -add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 ); |
|
468 | 467 | \ No newline at end of file |
468 | +add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1); |
|
469 | 469 | \ No newline at end of file |
@@ -87,13 +87,13 @@ |
||
87 | 87 | 'disabled' => __( 'Head', 'give' ), |
88 | 88 | ) |
89 | 89 | ), |
90 | - array( |
|
91 | - 'name' => esc_html__( 'Advanced Settings Docs Link', 'give' ), |
|
92 | - 'id' => 'advanced_settings_docs_link', |
|
93 | - 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
94 | - 'title' => __( 'Advanced Settings', 'give' ), |
|
95 | - 'type' => 'give_docs_link', |
|
96 | - ), |
|
90 | + array( |
|
91 | + 'name' => esc_html__( 'Advanced Settings Docs Link', 'give' ), |
|
92 | + 'id' => 'advanced_settings_docs_link', |
|
93 | + 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
94 | + 'title' => __( 'Advanced Settings', 'give' ), |
|
95 | + 'type' => 'give_docs_link', |
|
96 | + ), |
|
97 | 97 | array( |
98 | 98 | 'id' => 'give_title_data_control_2', |
99 | 99 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Advanced' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Advanced')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Advanced. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'advanced'; |
30 | - $this->label = esc_html__( 'Advanced', 'give' ); |
|
30 | + $this->label = esc_html__('Advanced', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'advanced-options'; |
33 | 33 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $current_section = give_get_current_setting_section(); |
47 | 47 | |
48 | - switch ( $current_section ) { |
|
48 | + switch ($current_section) { |
|
49 | 49 | case 'advanced-options': |
50 | 50 | $settings = array( |
51 | 51 | array( |
@@ -53,45 +53,45 @@ discard block |
||
53 | 53 | 'type' => 'title' |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => esc_html__( 'Remove Data on Uninstall', 'give' ), |
|
57 | - 'desc' => esc_html__( 'When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give' ), |
|
56 | + 'name' => esc_html__('Remove Data on Uninstall', 'give'), |
|
57 | + 'desc' => esc_html__('When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give'), |
|
58 | 58 | 'id' => 'uninstall_on_delete', |
59 | 59 | 'type' => 'radio_inline', |
60 | 60 | 'default' => 'disabled', |
61 | 61 | 'options' => array( |
62 | - 'enabled' => __( 'Yes, Remove all data', 'give' ), |
|
63 | - 'disabled' => __( 'No, keep my Give settings and donation data this time', 'give' ), |
|
62 | + 'enabled' => __('Yes, Remove all data', 'give'), |
|
63 | + 'disabled' => __('No, keep my Give settings and donation data this time', 'give'), |
|
64 | 64 | ) |
65 | 65 | ), |
66 | 66 | array( |
67 | 67 | /* translators: %s: the_content */ |
68 | - 'name' => sprintf( __( '%s filter', 'give' ), '<code>the_content</code>' ), |
|
68 | + 'name' => sprintf(__('%s filter', 'give'), '<code>the_content</code>'), |
|
69 | 69 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
70 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
70 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
71 | 71 | 'id' => 'the_content_filter', |
72 | 72 | 'default' => 'enabled', |
73 | 73 | 'type' => 'radio_inline', |
74 | 74 | 'options' => array( |
75 | - 'enabled' => __( 'Enabled', 'give' ), |
|
76 | - 'disabled' => __( 'Disabled', 'give' ), |
|
75 | + 'enabled' => __('Enabled', 'give'), |
|
76 | + 'disabled' => __('Disabled', 'give'), |
|
77 | 77 | ) |
78 | 78 | ), |
79 | 79 | array( |
80 | - 'name' => esc_html__( 'Script Loading Location', 'give' ), |
|
81 | - 'desc' => __( 'This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give' ), |
|
80 | + 'name' => esc_html__('Script Loading Location', 'give'), |
|
81 | + 'desc' => __('This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give'), |
|
82 | 82 | 'id' => 'scripts_footer', |
83 | 83 | 'type' => 'radio_inline', |
84 | 84 | 'default' => 'disabled', |
85 | 85 | 'options' => array( |
86 | - 'enabled' => __( 'Footer', 'give' ), |
|
87 | - 'disabled' => __( 'Head', 'give' ), |
|
86 | + 'enabled' => __('Footer', 'give'), |
|
87 | + 'disabled' => __('Head', 'give'), |
|
88 | 88 | ) |
89 | 89 | ), |
90 | 90 | array( |
91 | - 'name' => esc_html__( 'Advanced Settings Docs Link', 'give' ), |
|
91 | + 'name' => esc_html__('Advanced Settings Docs Link', 'give'), |
|
92 | 92 | 'id' => 'advanced_settings_docs_link', |
93 | - 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
94 | - 'title' => __( 'Advanced Settings', 'give' ), |
|
93 | + 'url' => esc_url('http://docs.givewp.com/settings-advanced'), |
|
94 | + 'title' => __('Advanced Settings', 'give'), |
|
95 | 95 | 'type' => 'give_docs_link', |
96 | 96 | ), |
97 | 97 | array( |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * Filter the advanced settings. |
108 | 108 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
109 | 109 | */ |
110 | - $settings = apply_filters( 'give_settings_advanced', $settings ); |
|
110 | + $settings = apply_filters('give_settings_advanced', $settings); |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * Filter the settings. |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @param array $settings |
118 | 118 | */ |
119 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
119 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
120 | 120 | |
121 | 121 | // Output. |
122 | 122 | return $settings; |
@@ -130,10 +130,10 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function get_sections() { |
132 | 132 | $sections = array( |
133 | - 'advanced-options' => esc_html__( 'Advanced Options', 'give' ) |
|
133 | + 'advanced-options' => esc_html__('Advanced Options', 'give') |
|
134 | 134 | ); |
135 | 135 | |
136 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
136 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return string $message Fully formatted message |
43 | 43 | */ |
44 | -function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) { |
|
45 | - return give_do_email_tags( $message, $payment_id ); |
|
44 | +function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) { |
|
45 | + return give_do_email_tags($message, $payment_id); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -56,42 +56,42 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return string $message Fully formatted message |
58 | 58 | */ |
59 | -function give_email_preview_template_tags( $message ) { |
|
59 | +function give_email_preview_template_tags($message) { |
|
60 | 60 | |
61 | - $price = give_currency_filter( give_format_amount( 10.50 ) ); |
|
61 | + $price = give_currency_filter(give_format_amount(10.50)); |
|
62 | 62 | |
63 | 63 | $gateway = 'PayPal'; |
64 | 64 | |
65 | - $receipt_id = strtolower( md5( uniqid() ) ); |
|
65 | + $receipt_id = strtolower(md5(uniqid())); |
|
66 | 66 | |
67 | - $payment_id = rand( 1, 100 ); |
|
67 | + $payment_id = rand(1, 100); |
|
68 | 68 | |
69 | - $receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) ); |
|
69 | + $receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url())); |
|
70 | 70 | $receipt_link = sprintf( |
71 | 71 | '<a href="%1$s">%2$s</a>', |
72 | 72 | $receipt_link_url, |
73 | - esc_html__( 'View the receipt in your browser »', 'give' ) |
|
73 | + esc_html__('View the receipt in your browser »', 'give') |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | $user = wp_get_current_user(); |
77 | 77 | |
78 | - $message = str_replace( '{name}', $user->display_name, $message ); |
|
79 | - $message = str_replace( '{fullname}', $user->display_name, $message ); |
|
80 | - $message = str_replace( '{username}', $user->user_login, $message ); |
|
81 | - $message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message ); |
|
82 | - $message = str_replace( '{amount}', $price, $message ); |
|
83 | - $message = str_replace( '{price}', $price, $message ); |
|
84 | - $message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message ); |
|
85 | - $message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message ); |
|
86 | - $message = str_replace( '{receipt_id}', $receipt_id, $message ); |
|
87 | - $message = str_replace( '{payment_method}', $gateway, $message ); |
|
88 | - $message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message ); |
|
89 | - $message = str_replace( '{payment_id}', $payment_id, $message ); |
|
90 | - $message = str_replace( '{receipt_link}', $receipt_link, $message ); |
|
91 | - $message = str_replace( '{receipt_link_url}', $receipt_link_url, $message ); |
|
92 | - $message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message ); |
|
93 | - |
|
94 | - return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) ); |
|
78 | + $message = str_replace('{name}', $user->display_name, $message); |
|
79 | + $message = str_replace('{fullname}', $user->display_name, $message); |
|
80 | + $message = str_replace('{username}', $user->user_login, $message); |
|
81 | + $message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message); |
|
82 | + $message = str_replace('{amount}', $price, $message); |
|
83 | + $message = str_replace('{price}', $price, $message); |
|
84 | + $message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message); |
|
85 | + $message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message); |
|
86 | + $message = str_replace('{receipt_id}', $receipt_id, $message); |
|
87 | + $message = str_replace('{payment_method}', $gateway, $message); |
|
88 | + $message = str_replace('{sitename}', get_bloginfo('name'), $message); |
|
89 | + $message = str_replace('{payment_id}', $payment_id, $message); |
|
90 | + $message = str_replace('{receipt_link}', $receipt_link, $message); |
|
91 | + $message = str_replace('{receipt_link_url}', $receipt_link_url, $message); |
|
92 | + $message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message); |
|
93 | + |
|
94 | + return wpautop(apply_filters('give_email_preview_template_tags', $message)); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -103,23 +103,23 @@ discard block |
||
103 | 103 | * @since 1.0 |
104 | 104 | * @return array|bool |
105 | 105 | */ |
106 | -function give_email_template_preview( $array ) { |
|
106 | +function give_email_template_preview($array) { |
|
107 | 107 | |
108 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
108 | + if ( ! current_user_can('manage_give_settings')) { |
|
109 | 109 | return false; |
110 | 110 | } |
111 | 111 | $custom_field = array( |
112 | - 'name' => esc_html__( 'Preview Email', 'give' ), |
|
113 | - 'desc' => esc_html__( 'Click the buttons to preview or send test emails.', 'give' ), |
|
112 | + 'name' => esc_html__('Preview Email', 'give'), |
|
113 | + 'desc' => esc_html__('Click the buttons to preview or send test emails.', 'give'), |
|
114 | 114 | 'id' => 'give_email_preview_buttons', |
115 | 115 | 'type' => 'email_preview_buttons' |
116 | 116 | ); |
117 | 117 | |
118 | - return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) ); |
|
118 | + return give_settings_array_insert($array, 'donation_subject', array($custom_field)); |
|
119 | 119 | |
120 | 120 | } |
121 | 121 | |
122 | -add_filter( 'give_settings_emails', 'give_email_template_preview' ); |
|
122 | +add_filter('give_settings_emails', 'give_email_template_preview'); |
|
123 | 123 | |
124 | 124 | /** |
125 | 125 | * Output Email Template Preview Buttons. |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | function give_email_preview_buttons_callback() { |
132 | 132 | ob_start(); |
133 | 133 | ?> |
134 | - <a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank"><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a> |
|
135 | - <a href="<?php echo wp_nonce_url( add_query_arg( array( |
|
134 | + <a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank"><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a> |
|
135 | + <a href="<?php echo wp_nonce_url(add_query_arg(array( |
|
136 | 136 | 'give_action' => 'send_test_email', |
137 | 137 | 'give-message' => 'sent-test-email', |
138 | 138 | 'tag' => 'emails' |
139 | - ) ), 'give-test-email' ); ?>" aria-label="<?php esc_attr_e( 'Send demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a> |
|
139 | + )), 'give-test-email'); ?>" aria-label="<?php esc_attr_e('Send demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a> |
|
140 | 140 | <?php |
141 | 141 | echo ob_get_clean(); |
142 | 142 | } |
@@ -149,46 +149,46 @@ discard block |
||
149 | 149 | */ |
150 | 150 | function give_display_email_template_preview() { |
151 | 151 | |
152 | - if ( empty( $_GET['give_action'] ) ) { |
|
152 | + if (empty($_GET['give_action'])) { |
|
153 | 153 | return; |
154 | 154 | } |
155 | 155 | |
156 | - if ( 'preview_email' !== $_GET['give_action'] ) { |
|
156 | + if ('preview_email' !== $_GET['give_action']) { |
|
157 | 157 | return; |
158 | 158 | } |
159 | 159 | |
160 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
160 | + if ( ! current_user_can('manage_give_settings')) { |
|
161 | 161 | return; |
162 | 162 | } |
163 | 163 | |
164 | 164 | |
165 | - Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' ); |
|
165 | + Give()->emails->heading = esc_html__('Donation Receipt', 'give'); |
|
166 | 166 | |
167 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
167 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
168 | 168 | |
169 | 169 | echo give_get_preview_email_header(); |
170 | 170 | |
171 | 171 | //Are we previewing an actual payment? |
172 | - if ( ! empty( $payment_id ) ) { |
|
172 | + if ( ! empty($payment_id)) { |
|
173 | 173 | |
174 | - $content = give_get_email_body_content( $payment_id ); |
|
174 | + $content = give_get_email_body_content($payment_id); |
|
175 | 175 | |
176 | - $preview_content = give_do_email_tags( $content, $payment_id ); |
|
176 | + $preview_content = give_do_email_tags($content, $payment_id); |
|
177 | 177 | |
178 | 178 | } else { |
179 | 179 | |
180 | 180 | //No payment ID, use sample preview content |
181 | - $preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
181 | + $preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
185 | - echo Give()->emails->build_email( $preview_content ); |
|
185 | + echo Give()->emails->build_email($preview_content); |
|
186 | 186 | |
187 | 187 | exit; |
188 | 188 | |
189 | 189 | } |
190 | 190 | |
191 | -add_action( 'init', 'give_display_email_template_preview' ); |
|
191 | +add_action('init', 'give_display_email_template_preview'); |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * Email Template Body. |
@@ -200,18 +200,18 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return string $email_body Body of the email |
202 | 202 | */ |
203 | -function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) { |
|
203 | +function give_get_email_body_content($payment_id = 0, $payment_data = array()) { |
|
204 | 204 | |
205 | 205 | $default_email_body = give_get_default_donation_receipt_email(); |
206 | 206 | |
207 | - $email_content = give_get_option( 'donation_receipt' ); |
|
208 | - $email_content = isset( $email_content ) ? stripslashes( $email_content ) : $default_email_body; |
|
207 | + $email_content = give_get_option('donation_receipt'); |
|
208 | + $email_content = isset($email_content) ? stripslashes($email_content) : $default_email_body; |
|
209 | 209 | |
210 | - $email_body = wpautop( $email_content ); |
|
210 | + $email_body = wpautop($email_content); |
|
211 | 211 | |
212 | - $email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data ); |
|
212 | + $email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data); |
|
213 | 213 | |
214 | - return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data ); |
|
214 | + return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -224,36 +224,36 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @return string $email_body Body of the email |
226 | 226 | */ |
227 | -function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) { |
|
227 | +function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) { |
|
228 | 228 | |
229 | - $user_info = maybe_unserialize( $payment_data['user_info'] ); |
|
230 | - $email = give_get_payment_user_email( $payment_id ); |
|
229 | + $user_info = maybe_unserialize($payment_data['user_info']); |
|
230 | + $email = give_get_payment_user_email($payment_id); |
|
231 | 231 | |
232 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
233 | - $user_data = get_userdata( $user_info['id'] ); |
|
232 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
233 | + $user_data = get_userdata($user_info['id']); |
|
234 | 234 | $name = $user_data->display_name; |
235 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
236 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
235 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
236 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
237 | 237 | } else { |
238 | 238 | $name = $email; |
239 | 239 | } |
240 | 240 | |
241 | - $gateway = give_get_gateway_admin_label( get_post_meta( $payment_id, '_give_payment_gateway', true ) ); |
|
241 | + $gateway = give_get_gateway_admin_label(get_post_meta($payment_id, '_give_payment_gateway', true)); |
|
242 | 242 | |
243 | - $default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n"; |
|
244 | - $default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n"; |
|
245 | - $default_email_body .= esc_html__( 'Donation:', 'give' ) . "\n\n"; |
|
246 | - $default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
247 | - $default_email_body .= esc_html__( 'Amount:', 'give' ) . ' ' . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
248 | - $default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n"; |
|
249 | - $default_email_body .= esc_html__( 'Thank you', 'give' ); |
|
243 | + $default_email_body = esc_html__('Hello', 'give')."\n\n"; |
|
244 | + $default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n"; |
|
245 | + $default_email_body .= esc_html__('Donation:', 'give')."\n\n"; |
|
246 | + $default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n"; |
|
247 | + $default_email_body .= esc_html__('Amount:', 'give').' '.html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8')."\n"; |
|
248 | + $default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n"; |
|
249 | + $default_email_body .= esc_html__('Thank you', 'give'); |
|
250 | 250 | |
251 | - $email = give_get_option( 'donation_notification' ); |
|
252 | - $email = isset( $email ) ? stripslashes( $email ) : $default_email_body; |
|
251 | + $email = give_get_option('donation_notification'); |
|
252 | + $email = isset($email) ? stripslashes($email) : $default_email_body; |
|
253 | 253 | |
254 | - $email_body = give_do_email_tags( $email, $payment_id ); |
|
254 | + $email_body = give_do_email_tags($email, $payment_id); |
|
255 | 255 | |
256 | - return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data ); |
|
256 | + return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -266,19 +266,19 @@ discard block |
||
266 | 266 | * @since 1.0 |
267 | 267 | */ |
268 | 268 | function give_render_receipt_in_browser() { |
269 | - if ( ! isset( $_GET['payment_key'] ) ) { |
|
270 | - wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
269 | + if ( ! isset($_GET['payment_key'])) { |
|
270 | + wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
271 | 271 | } |
272 | 272 | |
273 | - $key = urlencode( $_GET['payment_key'] ); |
|
273 | + $key = urlencode($_GET['payment_key']); |
|
274 | 274 | |
275 | 275 | ob_start(); |
276 | 276 | //Disallows caching of the page |
277 | - header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" ); |
|
278 | - header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1 |
|
279 | - header( "Cache-Control: post-check=0, pre-check=0", false ); |
|
280 | - header( "Pragma: no-cache" ); // HTTP/1.0 |
|
281 | - header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past |
|
277 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
278 | + header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 |
|
279 | + header("Cache-Control: post-check=0, pre-check=0", false); |
|
280 | + header("Pragma: no-cache"); // HTTP/1.0 |
|
281 | + header("Expires: Sat, 23 Oct 1977 05:00:00 PST"); // Date in the past |
|
282 | 282 | ?> |
283 | 283 | <!DOCTYPE html> |
284 | 284 | <html lang="en"> |
@@ -289,10 +289,10 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @since 1.0 |
291 | 291 | */ |
292 | - do_action( 'give_receipt_head' ); |
|
292 | + do_action('give_receipt_head'); |
|
293 | 293 | ?> |
294 | 294 | </head> |
295 | - <body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>"> |
|
295 | + <body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>"> |
|
296 | 296 | |
297 | 297 | <div id="give_receipt_wrapper"> |
298 | 298 | <?php |
@@ -301,16 +301,16 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @since 1.0 |
303 | 303 | */ |
304 | - do_action( 'give_render_receipt_in_browser_before' ); |
|
304 | + do_action('give_render_receipt_in_browser_before'); |
|
305 | 305 | |
306 | - echo do_shortcode( '[give_receipt payment_key=' . $key . ']' ); |
|
306 | + echo do_shortcode('[give_receipt payment_key='.$key.']'); |
|
307 | 307 | |
308 | 308 | /** |
309 | 309 | * Fires in the receipt template after the content. |
310 | 310 | * |
311 | 311 | * @since 1.0 |
312 | 312 | */ |
313 | - do_action( 'give_render_receipt_in_browser_after' ); |
|
313 | + do_action('give_render_receipt_in_browser_after'); |
|
314 | 314 | ?> |
315 | 315 | </div> |
316 | 316 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * |
321 | 321 | * @since 1.0 |
322 | 322 | */ |
323 | - do_action( 'give_receipt_footer' ); |
|
323 | + do_action('give_receipt_footer'); |
|
324 | 324 | ?> |
325 | 325 | </body> |
326 | 326 | </html> |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | die(); |
330 | 330 | } |
331 | 331 | |
332 | -add_action( 'give_view_receipt', 'give_render_receipt_in_browser' ); |
|
332 | +add_action('give_view_receipt', 'give_render_receipt_in_browser'); |
|
333 | 333 | |
334 | 334 | |
335 | 335 | /** |
@@ -344,29 +344,29 @@ discard block |
||
344 | 344 | |
345 | 345 | //Payment receipt switcher |
346 | 346 | $payment_count = give_count_payments()->publish; |
347 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
347 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
348 | 348 | |
349 | - if ( $payment_count <= 0 ) { |
|
349 | + if ($payment_count <= 0) { |
|
350 | 350 | return false; |
351 | 351 | } |
352 | 352 | |
353 | 353 | //Get payments. |
354 | - $payments = new Give_Payments_Query( array( |
|
354 | + $payments = new Give_Payments_Query(array( |
|
355 | 355 | 'number' => 100 |
356 | - ) ); |
|
356 | + )); |
|
357 | 357 | $payments = $payments->get_payments(); |
358 | 358 | $options = array(); |
359 | 359 | |
360 | 360 | //Provide nice human readable options. |
361 | - if ( $payments ) { |
|
362 | - $options[0] = esc_html__( '- Select a donation -', 'give' ); |
|
363 | - foreach ( $payments as $payment ) { |
|
361 | + if ($payments) { |
|
362 | + $options[0] = esc_html__('- Select a donation -', 'give'); |
|
363 | + foreach ($payments as $payment) { |
|
364 | 364 | |
365 | - $options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title ); |
|
365 | + $options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title); |
|
366 | 366 | |
367 | 367 | } |
368 | 368 | } else { |
369 | - $options[0] = esc_html__( 'No donations found.', 'give' ); |
|
369 | + $options[0] = esc_html__('No donations found.', 'give'); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | //Start constructing HTML output. |
@@ -379,16 +379,16 @@ discard block |
||
379 | 379 | var selected_trans = transactions.options[transactions.selectedIndex]; |
380 | 380 | console.log(selected_trans); |
381 | 381 | if (selected_trans){ |
382 | - var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value; |
|
382 | + var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value; |
|
383 | 383 | window.location = url_string; |
384 | 384 | } |
385 | 385 | } |
386 | 386 | </script>'; |
387 | 387 | |
388 | - $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>'; |
|
388 | + $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>'; |
|
389 | 389 | |
390 | 390 | //The select field with 100 latest transactions |
391 | - $transaction_header .= Give()->html->select( array( |
|
391 | + $transaction_header .= Give()->html->select(array( |
|
392 | 392 | 'name' => 'preview_email_payment_id', |
393 | 393 | 'selected' => $payment_id, |
394 | 394 | 'id' => 'give_preview_email_payment_id', |
@@ -398,12 +398,12 @@ discard block |
||
398 | 398 | 'select_atts' => 'onchange="change_preview()">', |
399 | 399 | 'show_option_all' => false, |
400 | 400 | 'show_option_none' => false |
401 | - ) ); |
|
401 | + )); |
|
402 | 402 | |
403 | 403 | //Closing tag |
404 | 404 | $transaction_header .= '</div>'; |
405 | 405 | |
406 | - return apply_filters( 'give_preview_email_receipt_header', $transaction_header ); |
|
406 | + return apply_filters('give_preview_email_receipt_header', $transaction_header); |
|
407 | 407 | |
408 | 408 | } |
409 | 409 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | function give_receipt_head_content() { |
418 | 418 | |
419 | 419 | //Title. |
420 | - $output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>'; |
|
420 | + $output = '<title>'.esc_html__('Donation Receipt', 'give').'</title>'; |
|
421 | 421 | |
422 | 422 | //Meta. |
423 | 423 | $output .= '<meta charset="utf-8"/> |
@@ -431,10 +431,10 @@ discard block |
||
431 | 431 | <meta name="robots" content="noindex, nofollow"/>'; |
432 | 432 | |
433 | 433 | //CSS |
434 | - $output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">'; |
|
434 | + $output .= '<link rel="stylesheet" href="'.give_get_stylesheet_uri().'?ver='.GIVE_VERSION.'">'; |
|
435 | 435 | |
436 | - echo apply_filters( 'give_receipt_head_content', $output ); |
|
436 | + echo apply_filters('give_receipt_head_content', $output); |
|
437 | 437 | |
438 | 438 | } |
439 | 439 | |
440 | -add_action( 'give_receipt_head', 'give_receipt_head_content' ); |
|
441 | 440 | \ No newline at end of file |
441 | +add_action('give_receipt_head', 'give_receipt_head_content'); |
|
442 | 442 | \ No newline at end of file |
@@ -137,31 +137,31 @@ |
||
137 | 137 | * @return void |
138 | 138 | */ |
139 | 139 | function give_process_user_logout( $data ) { |
140 | - if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
140 | + if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
141 | 141 | |
142 | - // Prevent occurring of any custom action on wp_logout. |
|
143 | - remove_all_actions( 'wp_logout' ); |
|
142 | + // Prevent occurring of any custom action on wp_logout. |
|
143 | + remove_all_actions( 'wp_logout' ); |
|
144 | 144 | |
145 | 145 | /** |
146 | 146 | * Fires before processing user logout. |
147 | 147 | * |
148 | 148 | * @since 1.0 |
149 | 149 | */ |
150 | - do_action( 'give_before_user_logout' ); |
|
150 | + do_action( 'give_before_user_logout' ); |
|
151 | 151 | |
152 | - // Logout user. |
|
153 | - wp_logout(); |
|
152 | + // Logout user. |
|
153 | + wp_logout(); |
|
154 | 154 | |
155 | 155 | /** |
156 | 156 | * Fires after processing user logout. |
157 | 157 | * |
158 | 158 | * @since 1.0 |
159 | 159 | */ |
160 | - do_action( 'give_after_user_logout' ); |
|
160 | + do_action( 'give_after_user_logout' ); |
|
161 | 161 | |
162 | - wp_redirect( $data['give_logout_redirect'] ); |
|
163 | - give_die(); |
|
164 | - } |
|
162 | + wp_redirect( $data['give_logout_redirect'] ); |
|
163 | + give_die(); |
|
164 | + } |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | add_action( 'give_user_logout', 'give_process_user_logout' ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return string Login form |
28 | 28 | */ |
29 | -function give_login_form( $login_redirect = '', $logout_redirect = '' ) { |
|
30 | - if ( empty( $login_redirect ) ) { |
|
29 | +function give_login_form($login_redirect = '', $logout_redirect = '') { |
|
30 | + if (empty($login_redirect)) { |
|
31 | 31 | $login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url()); |
32 | 32 | } |
33 | 33 | |
34 | - if ( empty( $logout_redirect ) ) { |
|
35 | - $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() ); |
|
34 | + if (empty($logout_redirect)) { |
|
35 | + $logout_redirect = add_query_arg('give-logout-success', 'true', give_get_current_page_url()); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | $logout_redirect = add_query_arg( |
41 | 41 | array( |
42 | 42 | 'give_action' => 'user_logout', |
43 | - 'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ), |
|
44 | - 'give_logout_redirect' => urlencode( $logout_redirect ), |
|
43 | + 'give_logout_nonce' => wp_create_nonce('give-logout-nonce'), |
|
44 | + 'give_logout_redirect' => urlencode($logout_redirect), |
|
45 | 45 | ), |
46 | - home_url( '/' ) |
|
46 | + home_url('/') |
|
47 | 47 | ); |
48 | 48 | |
49 | 49 | ob_start(); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | ) |
57 | 57 | ); |
58 | 58 | |
59 | - return apply_filters( 'give_login_form', ob_get_clean() ); |
|
59 | + return apply_filters('give_login_form', ob_get_clean()); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return string Register form |
71 | 71 | */ |
72 | -function give_register_form( $redirect = '' ) { |
|
73 | - if ( empty( $redirect ) ) { |
|
72 | +function give_register_form($redirect = '') { |
|
73 | + if (empty($redirect)) { |
|
74 | 74 | $redirect = give_get_current_page_url(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | ob_start(); |
78 | 78 | |
79 | - if ( ! is_user_logged_in() ) { |
|
79 | + if ( ! is_user_logged_in()) { |
|
80 | 80 | give_get_template( |
81 | 81 | 'shortcode-register', |
82 | 82 | array( |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ); |
86 | 86 | } |
87 | 87 | |
88 | - return apply_filters( 'give_register_form', ob_get_clean() ); |
|
88 | + return apply_filters('give_register_form', ob_get_clean()); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -97,34 +97,34 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @return void |
99 | 99 | */ |
100 | -function give_process_login_form( $data ) { |
|
101 | - if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) { |
|
102 | - $user_data = get_user_by( 'login', $data['give_user_login'] ); |
|
103 | - if ( ! $user_data ) { |
|
104 | - $user_data = get_user_by( 'email', $data['give_user_login'] ); |
|
100 | +function give_process_login_form($data) { |
|
101 | + if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) { |
|
102 | + $user_data = get_user_by('login', $data['give_user_login']); |
|
103 | + if ( ! $user_data) { |
|
104 | + $user_data = get_user_by('email', $data['give_user_login']); |
|
105 | 105 | } |
106 | - if ( $user_data ) { |
|
106 | + if ($user_data) { |
|
107 | 107 | $user_ID = $user_data->ID; |
108 | 108 | $user_email = $user_data->user_email; |
109 | - if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_data->ID ) ) { |
|
110 | - give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] ); |
|
109 | + if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_data->ID)) { |
|
110 | + give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']); |
|
111 | 111 | } else { |
112 | - give_set_error( 'password_incorrect', esc_html__( 'The password you entered is incorrect.', 'give' ) ); |
|
112 | + give_set_error('password_incorrect', esc_html__('The password you entered is incorrect.', 'give')); |
|
113 | 113 | } |
114 | 114 | } else { |
115 | - give_set_error( 'username_incorrect', esc_html__( 'The username you entered does not exist.', 'give' ) ); |
|
115 | + give_set_error('username_incorrect', esc_html__('The username you entered does not exist.', 'give')); |
|
116 | 116 | } |
117 | 117 | // Check for errors and redirect if none present |
118 | 118 | $errors = give_get_errors(); |
119 | - if ( ! $errors ) { |
|
120 | - $redirect = apply_filters( 'give_login_redirect', $data['give_login_redirect'], $user_ID ); |
|
121 | - wp_redirect( $redirect ); |
|
119 | + if ( ! $errors) { |
|
120 | + $redirect = apply_filters('give_login_redirect', $data['give_login_redirect'], $user_ID); |
|
121 | + wp_redirect($redirect); |
|
122 | 122 | give_die(); |
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | -add_action( 'give_user_login', 'give_process_login_form' ); |
|
127 | +add_action('give_user_login', 'give_process_login_form'); |
|
128 | 128 | |
129 | 129 | |
130 | 130 | /** |
@@ -136,18 +136,18 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return void |
138 | 138 | */ |
139 | -function give_process_user_logout( $data ) { |
|
140 | - if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
139 | +function give_process_user_logout($data) { |
|
140 | + if (wp_verify_nonce($data['give_logout_nonce'], 'give-logout-nonce') && is_user_logged_in()) { |
|
141 | 141 | |
142 | 142 | // Prevent occurring of any custom action on wp_logout. |
143 | - remove_all_actions( 'wp_logout' ); |
|
143 | + remove_all_actions('wp_logout'); |
|
144 | 144 | |
145 | 145 | /** |
146 | 146 | * Fires before processing user logout. |
147 | 147 | * |
148 | 148 | * @since 1.0 |
149 | 149 | */ |
150 | - do_action( 'give_before_user_logout' ); |
|
150 | + do_action('give_before_user_logout'); |
|
151 | 151 | |
152 | 152 | // Logout user. |
153 | 153 | wp_logout(); |
@@ -157,14 +157,14 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @since 1.0 |
159 | 159 | */ |
160 | - do_action( 'give_after_user_logout' ); |
|
160 | + do_action('give_after_user_logout'); |
|
161 | 161 | |
162 | - wp_redirect( $data['give_logout_redirect'] ); |
|
162 | + wp_redirect($data['give_logout_redirect']); |
|
163 | 163 | give_die(); |
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | -add_action( 'give_user_logout', 'give_process_user_logout' ); |
|
167 | +add_action('give_user_logout', 'give_process_user_logout'); |
|
168 | 168 | |
169 | 169 | /** |
170 | 170 | * Log User In |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return void |
179 | 179 | */ |
180 | -function give_log_user_in( $user_id, $user_login, $user_pass ) { |
|
181 | - if ( $user_id < 1 ) { |
|
180 | +function give_log_user_in($user_id, $user_login, $user_pass) { |
|
181 | + if ($user_id < 1) { |
|
182 | 182 | return; |
183 | 183 | } |
184 | 184 | |
185 | - wp_set_auth_cookie( $user_id ); |
|
186 | - wp_set_current_user( $user_id, $user_login ); |
|
185 | + wp_set_auth_cookie($user_id); |
|
186 | + wp_set_current_user($user_id, $user_login); |
|
187 | 187 | |
188 | 188 | /** |
189 | 189 | * Fires after the user has successfully logged in. |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @param string $user_login Username. |
194 | 194 | * @param WP_User $$user WP_User object of the logged-in user. |
195 | 195 | */ |
196 | - do_action( 'wp_login', $user_login, get_userdata( $user_id ) ); |
|
196 | + do_action('wp_login', $user_login, get_userdata($user_id)); |
|
197 | 197 | |
198 | 198 | /** |
199 | 199 | * Fires after give user has successfully logged in. |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @param string $user_login Username. |
205 | 205 | * @param string $user_pass User password. |
206 | 206 | */ |
207 | - do_action( 'give_log_user_in', $user_id, $user_login, $user_pass ); |
|
207 | + do_action('give_log_user_in', $user_id, $user_login, $user_pass); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @return void |
219 | 219 | */ |
220 | -function give_process_register_form( $data ) { |
|
220 | +function give_process_register_form($data) { |
|
221 | 221 | |
222 | - if ( is_user_logged_in() ) { |
|
222 | + if (is_user_logged_in()) { |
|
223 | 223 | return; |
224 | 224 | } |
225 | 225 | |
226 | - if ( empty( $_POST['give_register_submit'] ) ) { |
|
226 | + if (empty($_POST['give_register_submit'])) { |
|
227 | 227 | return; |
228 | 228 | } |
229 | 229 | |
@@ -232,38 +232,38 @@ discard block |
||
232 | 232 | * |
233 | 233 | * @since 1.0 |
234 | 234 | */ |
235 | - do_action( 'give_pre_process_register_form' ); |
|
235 | + do_action('give_pre_process_register_form'); |
|
236 | 236 | |
237 | - if ( empty( $data['give_user_login'] ) ) { |
|
238 | - give_set_error( 'empty_username', esc_html__( 'Invalid username.', 'give' ) ); |
|
237 | + if (empty($data['give_user_login'])) { |
|
238 | + give_set_error('empty_username', esc_html__('Invalid username.', 'give')); |
|
239 | 239 | } |
240 | 240 | |
241 | - if ( username_exists( $data['give_user_login'] ) ) { |
|
242 | - give_set_error( 'username_unavailable', esc_html__( 'Username already taken.', 'give' ) ); |
|
241 | + if (username_exists($data['give_user_login'])) { |
|
242 | + give_set_error('username_unavailable', esc_html__('Username already taken.', 'give')); |
|
243 | 243 | } |
244 | 244 | |
245 | - if ( ! validate_username( $data['give_user_login'] ) ) { |
|
246 | - give_set_error( 'username_invalid', esc_html__( 'Invalid username.', 'give' ) ); |
|
245 | + if ( ! validate_username($data['give_user_login'])) { |
|
246 | + give_set_error('username_invalid', esc_html__('Invalid username.', 'give')); |
|
247 | 247 | } |
248 | 248 | |
249 | - if ( email_exists( $data['give_user_email'] ) ) { |
|
250 | - give_set_error( 'email_unavailable', esc_html__( 'Email address already taken.', 'give' ) ); |
|
249 | + if (email_exists($data['give_user_email'])) { |
|
250 | + give_set_error('email_unavailable', esc_html__('Email address already taken.', 'give')); |
|
251 | 251 | } |
252 | 252 | |
253 | - if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) { |
|
254 | - give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) ); |
|
253 | + if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) { |
|
254 | + give_set_error('email_invalid', esc_html__('Invalid email.', 'give')); |
|
255 | 255 | } |
256 | 256 | |
257 | - if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) { |
|
258 | - give_set_error( 'payment_email_invalid', esc_html__( 'Invalid payment email.', 'give' ) ); |
|
257 | + if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) { |
|
258 | + give_set_error('payment_email_invalid', esc_html__('Invalid payment email.', 'give')); |
|
259 | 259 | } |
260 | 260 | |
261 | - if ( empty( $_POST['give_user_pass'] ) ) { |
|
262 | - give_set_error( 'empty_password', esc_html__( 'Please enter a password.', 'give' ) ); |
|
261 | + if (empty($_POST['give_user_pass'])) { |
|
262 | + give_set_error('empty_password', esc_html__('Please enter a password.', 'give')); |
|
263 | 263 | } |
264 | 264 | |
265 | - if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) { |
|
266 | - give_set_error( 'password_mismatch', esc_html__( 'Passwords don\'t match.', 'give' ) ); |
|
265 | + if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) { |
|
266 | + give_set_error('password_mismatch', esc_html__('Passwords don\'t match.', 'give')); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -271,26 +271,26 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @since 1.0 |
273 | 273 | */ |
274 | - do_action( 'give_process_register_form' ); |
|
274 | + do_action('give_process_register_form'); |
|
275 | 275 | |
276 | 276 | // Check for errors and redirect if none present |
277 | 277 | $errors = give_get_errors(); |
278 | 278 | |
279 | - if ( empty( $errors ) ) { |
|
279 | + if (empty($errors)) { |
|
280 | 280 | |
281 | - $redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] ); |
|
281 | + $redirect = apply_filters('give_register_redirect', $data['give_redirect']); |
|
282 | 282 | |
283 | - give_register_and_login_new_user( array( |
|
283 | + give_register_and_login_new_user(array( |
|
284 | 284 | 'user_login' => $data['give_user_login'], |
285 | 285 | 'user_pass' => $data['give_user_pass'], |
286 | 286 | 'user_email' => $data['give_user_email'], |
287 | - 'user_registered' => date( 'Y-m-d H:i:s' ), |
|
288 | - 'role' => get_option( 'default_role' ) |
|
289 | - ) ); |
|
287 | + 'user_registered' => date('Y-m-d H:i:s'), |
|
288 | + 'role' => get_option('default_role') |
|
289 | + )); |
|
290 | 290 | |
291 | - wp_redirect( $redirect ); |
|
291 | + wp_redirect($redirect); |
|
292 | 292 | give_die(); |
293 | 293 | } |
294 | 294 | } |
295 | 295 | |
296 | -add_action( 'give_user_register', 'give_process_register_form' ); |
|
297 | 296 | \ No newline at end of file |
297 | +add_action('give_user_register', 'give_process_register_form'); |
|
298 | 298 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,25 +25,25 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_load_scripts() { |
27 | 27 | |
28 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
29 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
30 | - $scripts_footer = ( give_get_option( 'scripts_footer' ) == 'on' ) ? true : false; |
|
28 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
29 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
30 | + $scripts_footer = (give_get_option('scripts_footer') == 'on') ? true : false; |
|
31 | 31 | |
32 | 32 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
33 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
33 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
34 | 34 | |
35 | 35 | // Localize / PHP to AJAX vars. |
36 | - $localize_give_vars = apply_filters( 'give_global_script_vars', array( |
|
36 | + $localize_give_vars = apply_filters('give_global_script_vars', array( |
|
37 | 37 | 'ajaxurl' => give_get_ajax_url(), |
38 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
39 | - 'currency_sign' => give_currency_filter( '' ), |
|
38 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
39 | + 'currency_sign' => give_currency_filter(''), |
|
40 | 40 | 'currency_pos' => give_get_currency_position(), |
41 | 41 | 'thousands_separator' => give_get_price_thousand_separator(), |
42 | 42 | 'decimal_separator' => give_get_price_decimal_separator(), |
43 | - 'no_gateway' => __( 'Please select a payment method.', 'give' ), |
|
44 | - 'bad_minimum' => __( 'The minimum donation amount for this form is', 'give' ), |
|
45 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
46 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
43 | + 'no_gateway' => __('Please select a payment method.', 'give'), |
|
44 | + 'bad_minimum' => __('The minimum donation amount for this form is', 'give'), |
|
45 | + 'general_loading' => __('Loading...', 'give'), |
|
46 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
47 | 47 | 'number_decimals' => give_get_price_decimals(), |
48 | 48 | 'give_version' => GIVE_VERSION, |
49 | 49 | 'magnific_options' => apply_filters( |
@@ -57,81 +57,81 @@ discard block |
||
57 | 57 | 'give_form_translation_js', |
58 | 58 | array( |
59 | 59 | // Field name Validation message. |
60 | - 'payment-mode' => __( 'Please select payment mode.', 'give' ), |
|
61 | - 'give_first' => __( 'Please enter your first name.', 'give' ), |
|
62 | - 'give_email' => __( 'Please enter a valid email address.', 'give' ), |
|
63 | - 'give_user_login' => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
|
64 | - 'give_user_pass' => __( 'Enter a password.', 'give' ), |
|
65 | - 'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ), |
|
66 | - 'give_agree_to_terms' => __( 'You must agree to the terms and conditions.', 'give' ), |
|
60 | + 'payment-mode' => __('Please select payment mode.', 'give'), |
|
61 | + 'give_first' => __('Please enter your first name.', 'give'), |
|
62 | + 'give_email' => __('Please enter a valid email address.', 'give'), |
|
63 | + 'give_user_login' => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'), |
|
64 | + 'give_user_pass' => __('Enter a password.', 'give'), |
|
65 | + 'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'), |
|
66 | + 'give_agree_to_terms' => __('You must agree to the terms and conditions.', 'give'), |
|
67 | 67 | ) |
68 | 68 | ), |
69 | - ) ); |
|
69 | + )); |
|
70 | 70 | |
71 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
71 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
72 | 72 | 'ajaxurl' => give_get_ajax_url(), |
73 | - 'loading' => __( 'Loading', 'give' ), |
|
73 | + 'loading' => __('Loading', 'give'), |
|
74 | 74 | // General loading message. |
75 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
75 | + 'select_option' => __('Please select an option', 'give'), |
|
76 | 76 | // Variable pricing error with multi-donation option enabled. |
77 | - 'default_gateway' => give_get_default_gateway( null ), |
|
78 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
77 | + 'default_gateway' => give_get_default_gateway(null), |
|
78 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
79 | 79 | 'number_decimals' => give_get_price_decimals(), |
80 | - ) ); |
|
80 | + )); |
|
81 | 81 | |
82 | 82 | // DEBUG is On. |
83 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
83 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
84 | 84 | |
85 | - if ( give_is_cc_verify_enabled() ) { |
|
86 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
87 | - wp_enqueue_script( 'give-cc-validator' ); |
|
85 | + if (give_is_cc_verify_enabled()) { |
|
86 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
87 | + wp_enqueue_script('give-cc-validator'); |
|
88 | 88 | } |
89 | 89 | |
90 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
91 | - wp_enqueue_script( 'give-float-labels' ); |
|
90 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
91 | + wp_enqueue_script('give-float-labels'); |
|
92 | 92 | |
93 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
94 | - wp_enqueue_script( 'give-blockui' ); |
|
93 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
94 | + wp_enqueue_script('give-blockui'); |
|
95 | 95 | |
96 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
97 | - wp_enqueue_script( 'give-qtip' ); |
|
96 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
97 | + wp_enqueue_script('give-qtip'); |
|
98 | 98 | |
99 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
100 | - wp_enqueue_script( 'give-accounting' ); |
|
99 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
100 | + wp_enqueue_script('give-accounting'); |
|
101 | 101 | |
102 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
103 | - wp_enqueue_script( 'give-magnific' ); |
|
102 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
103 | + wp_enqueue_script('give-magnific'); |
|
104 | 104 | |
105 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
106 | - wp_enqueue_script( 'give-checkout-global' ); |
|
105 | + wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
106 | + wp_enqueue_script('give-checkout-global'); |
|
107 | 107 | |
108 | 108 | // General scripts. |
109 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
110 | - wp_enqueue_script( 'give-scripts' ); |
|
109 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
110 | + wp_enqueue_script('give-scripts'); |
|
111 | 111 | |
112 | 112 | // Load AJAX scripts, if enabled. |
113 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
114 | - wp_enqueue_script( 'give-ajax' ); |
|
113 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
114 | + wp_enqueue_script('give-ajax'); |
|
115 | 115 | |
116 | 116 | // Localize / Pass AJAX vars from PHP, |
117 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars ); |
|
118 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
117 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars); |
|
118 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
119 | 119 | |
120 | 120 | } else { |
121 | 121 | |
122 | 122 | // DEBUG is OFF (one JS file to rule them all!). |
123 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
124 | - wp_enqueue_script( 'give' ); |
|
123 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
124 | + wp_enqueue_script('give'); |
|
125 | 125 | |
126 | 126 | // Localize / Pass AJAX vars from PHP. |
127 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
|
128 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
127 | + wp_localize_script('give', 'give_global_vars', $localize_give_vars); |
|
128 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
129 | 129 | |
130 | 130 | } |
131 | 131 | |
132 | 132 | } |
133 | 133 | |
134 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
134 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Register styles. |
@@ -144,16 +144,16 @@ discard block |
||
144 | 144 | */ |
145 | 145 | function give_register_styles() { |
146 | 146 | |
147 | - if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
|
147 | + if ( ! give_is_setting_enabled(give_get_option('css'))) { |
|
148 | 148 | return; |
149 | 149 | } |
150 | 150 | |
151 | - wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
152 | - wp_enqueue_style( 'give-styles' ); |
|
151 | + wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
152 | + wp_enqueue_style('give-styles'); |
|
153 | 153 | |
154 | 154 | } |
155 | 155 | |
156 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
156 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
157 | 157 | |
158 | 158 | |
159 | 159 | /** |
@@ -166,19 +166,19 @@ discard block |
||
166 | 166 | function give_get_stylesheet_uri() { |
167 | 167 | |
168 | 168 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
169 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
169 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
170 | 170 | |
171 | 171 | // LTR or RTL files. |
172 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
172 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
173 | 173 | |
174 | - $file = 'give' . $direction . $suffix . '.css'; |
|
174 | + $file = 'give'.$direction.$suffix.'.css'; |
|
175 | 175 | $templates_dir = give_get_theme_template_dir_name(); |
176 | 176 | |
177 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
178 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
179 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
180 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
181 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
177 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
178 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css'; |
|
179 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
180 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css'; |
|
181 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
182 | 182 | |
183 | 183 | $uri = false; |
184 | 184 | |
@@ -188,23 +188,23 @@ discard block |
||
188 | 188 | * followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
189 | 189 | * This allows users to copy just give.css to their theme. |
190 | 190 | */ |
191 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
192 | - if ( ! empty( $nonmin ) ) { |
|
193 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
191 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
192 | + if ( ! empty($nonmin)) { |
|
193 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
194 | 194 | } else { |
195 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
195 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
196 | 196 | } |
197 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
198 | - if ( ! empty( $nonmin ) ) { |
|
199 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
197 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
198 | + if ( ! empty($nonmin)) { |
|
199 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
200 | 200 | } else { |
201 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
201 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
202 | 202 | } |
203 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
204 | - $uri = trailingslashit( give_get_templates_url() ) . $file; |
|
203 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
204 | + $uri = trailingslashit(give_get_templates_url()).$file; |
|
205 | 205 | } |
206 | 206 | |
207 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
207 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | |
@@ -221,73 +221,73 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return void |
223 | 223 | */ |
224 | -function give_load_admin_scripts( $hook ) { |
|
224 | +function give_load_admin_scripts($hook) { |
|
225 | 225 | |
226 | 226 | global $post, $post_type; |
227 | 227 | |
228 | 228 | $give_options = give_get_settings(); |
229 | 229 | |
230 | 230 | // Directories of assets. |
231 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
232 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
233 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
231 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
232 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
233 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
234 | 234 | |
235 | 235 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
236 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
236 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
237 | 237 | |
238 | 238 | // LTR or RTL files. |
239 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
239 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
240 | 240 | |
241 | 241 | // Global Admin. |
242 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
243 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
242 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
243 | + wp_enqueue_style('give-admin-bar-notification'); |
|
244 | 244 | |
245 | 245 | // Give Admin Only. |
246 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
246 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
247 | 247 | return; |
248 | 248 | } |
249 | 249 | |
250 | 250 | // CSS. |
251 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
252 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
253 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION ); |
|
254 | - wp_enqueue_style( 'give-admin' ); |
|
255 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
256 | - wp_enqueue_style( 'jquery-chosen' ); |
|
257 | - wp_enqueue_style( 'thickbox' ); |
|
251 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
252 | + wp_enqueue_style('jquery-ui-css'); |
|
253 | + wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', array(), GIVE_VERSION); |
|
254 | + wp_enqueue_style('give-admin'); |
|
255 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
256 | + wp_enqueue_style('jquery-chosen'); |
|
257 | + wp_enqueue_style('thickbox'); |
|
258 | 258 | |
259 | 259 | // JS. |
260 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
261 | - wp_enqueue_script( 'jquery-chosen' ); |
|
260 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
261 | + wp_enqueue_script('jquery-chosen'); |
|
262 | 262 | |
263 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
264 | - wp_enqueue_script( 'give-accounting' ); |
|
263 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
264 | + wp_enqueue_script('give-accounting'); |
|
265 | 265 | |
266 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
267 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
266 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
267 | + wp_enqueue_script('give-admin-scripts'); |
|
268 | 268 | |
269 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
270 | - wp_enqueue_script( 'jquery-flot' ); |
|
269 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
270 | + wp_enqueue_script('jquery-flot'); |
|
271 | 271 | |
272 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
273 | - wp_enqueue_script( 'give-qtip' ); |
|
272 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
273 | + wp_enqueue_script('give-qtip'); |
|
274 | 274 | |
275 | - wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
276 | - wp_enqueue_script( 'give-repeatable-fields' ); |
|
275 | + wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
276 | + wp_enqueue_script('give-repeatable-fields'); |
|
277 | 277 | |
278 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
279 | - wp_enqueue_script( 'thickbox' ); |
|
278 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
279 | + wp_enqueue_script('thickbox'); |
|
280 | 280 | |
281 | 281 | // Forms CPT Script. |
282 | - if ( $post_type === 'give_forms' ) { |
|
283 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
284 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
282 | + if ($post_type === 'give_forms') { |
|
283 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
284 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | // Settings Scripts. |
288 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) { |
|
289 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
290 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
288 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
289 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
290 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | // Price Separators. |
@@ -295,60 +295,60 @@ discard block |
||
295 | 295 | $decimal_separator = give_get_price_decimal_separator(); |
296 | 296 | |
297 | 297 | // Localize strings & variables for JS. |
298 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
299 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
298 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
299 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
300 | 300 | 'give_version' => GIVE_VERSION, |
301 | 301 | 'thousands_separator' => $thousand_separator, |
302 | 302 | 'decimal_separator' => $decimal_separator, |
303 | - 'quick_edit_warning' => __( 'Not available for variable priced forms.', 'give' ), |
|
304 | - 'delete_payment' => __( 'Are you sure you wish to delete this payment?', 'give' ), |
|
305 | - 'delete_payment_note' => __( 'Are you sure you wish to delete this note?', 'give' ), |
|
306 | - 'revoke_api_key' => __( 'Are you sure you wish to revoke this API key?', 'give' ), |
|
307 | - 'regenerate_api_key' => __( 'Are you sure you wish to regenerate this API key?', 'give' ), |
|
308 | - 'resend_receipt' => __( 'Are you sure you wish to resend the donation receipt?', 'give' ), |
|
309 | - 'logo' => __( 'Logo', 'give' ), |
|
310 | - 'use_this_image' => __( 'Use this image', 'give' ), |
|
311 | - 'one_option' => __( 'Choose a form', 'give' ), |
|
312 | - 'one_or_more_option' => __( 'Choose one or more forms', 'give' ), |
|
313 | - 'currency_sign' => give_currency_filter( '' ), |
|
314 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
315 | - 'currency_decimals' => give_currency_decimal_filter( give_get_price_decimals() ), |
|
316 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
317 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
318 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
319 | - 'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
|
303 | + 'quick_edit_warning' => __('Not available for variable priced forms.', 'give'), |
|
304 | + 'delete_payment' => __('Are you sure you wish to delete this payment?', 'give'), |
|
305 | + 'delete_payment_note' => __('Are you sure you wish to delete this note?', 'give'), |
|
306 | + 'revoke_api_key' => __('Are you sure you wish to revoke this API key?', 'give'), |
|
307 | + 'regenerate_api_key' => __('Are you sure you wish to regenerate this API key?', 'give'), |
|
308 | + 'resend_receipt' => __('Are you sure you wish to resend the donation receipt?', 'give'), |
|
309 | + 'logo' => __('Logo', 'give'), |
|
310 | + 'use_this_image' => __('Use this image', 'give'), |
|
311 | + 'one_option' => __('Choose a form', 'give'), |
|
312 | + 'one_or_more_option' => __('Choose one or more forms', 'give'), |
|
313 | + 'currency_sign' => give_currency_filter(''), |
|
314 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
315 | + 'currency_decimals' => give_currency_decimal_filter(give_get_price_decimals()), |
|
316 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
317 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
318 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
319 | + 'price_format_guide' => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator), |
|
320 | 320 | /* translators : %s: Donation form options metabox */ |
321 | - 'confirm_before_remove_row_text' => __( 'Do you want to delete this level?', 'give' ), |
|
322 | - 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
323 | - 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
321 | + 'confirm_before_remove_row_text' => __('Do you want to delete this level?', 'give'), |
|
322 | + 'matched_success_failure_page' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
323 | + 'dismiss_notice_text' => __('Dismiss this notice.', 'give'), |
|
324 | 324 | 'bulk_action' => array( |
325 | 325 | 'delete' => array( |
326 | - 'zero_payment_selected' => __( 'You must choose at least one or more payments to delete.', 'give' ), |
|
327 | - 'delete_payment' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
|
328 | - 'delete_payments' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
|
326 | + 'zero_payment_selected' => __('You must choose at least one or more payments to delete.', 'give'), |
|
327 | + 'delete_payment' => __('Are you sure you want to permanently delete this donation?', 'give'), |
|
328 | + 'delete_payments' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'), |
|
329 | 329 | ), |
330 | 330 | 'resend_receipt' => array( |
331 | - 'zero_recipient_selected' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
|
332 | - 'resend_receipt' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
|
333 | - 'resend_receipts' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
|
331 | + 'zero_recipient_selected' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'), |
|
332 | + 'resend_receipt' => __('Are you sure you want to resend the email receipt to this recipient?', 'give'), |
|
333 | + 'resend_receipts' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'), |
|
334 | 334 | ), |
335 | 335 | ), |
336 | - 'upgrade_confirmation' => __( 'Please make sure to create a database backup before initiating the upgrade.', 'give' ), |
|
336 | + 'upgrade_confirmation' => __('Please make sure to create a database backup before initiating the upgrade.', 'give'), |
|
337 | 337 | 'metabox_fields' => array( |
338 | 338 | 'media' => array( |
339 | - 'button_title' => esc_html__( 'Choose Attachment', 'give' ), |
|
339 | + 'button_title' => esc_html__('Choose Attachment', 'give'), |
|
340 | 340 | ) |
341 | 341 | ) |
342 | - ) ); |
|
342 | + )); |
|
343 | 343 | |
344 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) { |
|
344 | + if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) { |
|
345 | 345 | // call for new media manager. |
346 | 346 | wp_enqueue_media(); |
347 | 347 | } |
348 | 348 | |
349 | 349 | } |
350 | 350 | |
351 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
351 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
352 | 352 | |
353 | 353 | /** |
354 | 354 | * Admin Give Icon |
@@ -363,13 +363,13 @@ discard block |
||
363 | 363 | ?> |
364 | 364 | <style type="text/css" media="screen"> |
365 | 365 | |
366 | - <?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?> |
|
366 | + <?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?> |
|
367 | 367 | @font-face { |
368 | 368 | font-family: 'give-icomoon'; |
369 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
370 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
371 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
372 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
369 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
370 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
371 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
372 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
373 | 373 | font-weight: normal; |
374 | 374 | font-style: normal; |
375 | 375 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | <?php |
389 | 389 | } |
390 | 390 | |
391 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
391 | +add_action('admin_head', 'give_admin_icon'); |
|
392 | 392 | |
393 | 393 | /** |
394 | 394 | * Admin js code |
@@ -418,4 +418,4 @@ discard block |
||
418 | 418 | <?php |
419 | 419 | } |
420 | 420 | |
421 | -add_action( 'admin_head', 'give_admin_hide_notice_shortly_js' ); |
|
421 | +add_action('admin_head', 'give_admin_hide_notice_shortly_js'); |