@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; // Exit if accessed directly |
13 | 13 | } |
14 | 14 | |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return bool|string |
24 | 24 | */ |
25 | -function give_is_field_callback_exist( $field ) { |
|
26 | - return ( give_get_field_callback( $field ) ? true : false ); |
|
25 | +function give_is_field_callback_exist($field) { |
|
26 | + return (give_get_field_callback($field) ? true : false); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return bool|string |
37 | 37 | */ |
38 | -function give_get_field_callback( $field ) { |
|
38 | +function give_get_field_callback($field) { |
|
39 | 39 | $func_name_prefix = 'give'; |
40 | 40 | $func_name = ''; |
41 | 41 | |
42 | 42 | // Set callback function on basis of cmb2 field name. |
43 | - switch ( $field['type'] ) { |
|
43 | + switch ($field['type']) { |
|
44 | 44 | case 'radio_inline': |
45 | 45 | $func_name = "{$func_name_prefix}_radio"; |
46 | 46 | break; |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | default: |
79 | 79 | |
80 | 80 | if ( |
81 | - array_key_exists( 'callback', $field ) |
|
82 | - && ! empty( $field['callback'] ) |
|
81 | + array_key_exists('callback', $field) |
|
82 | + && ! empty($field['callback']) |
|
83 | 83 | ) { |
84 | 84 | $func_name = $field['callback']; |
85 | 85 | } else { |
@@ -92,15 +92,15 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @since 1.8 |
94 | 94 | */ |
95 | - $func_name = apply_filters( 'give_get_field_callback', $func_name, $field ); |
|
95 | + $func_name = apply_filters('give_get_field_callback', $func_name, $field); |
|
96 | 96 | |
97 | 97 | // Exit if not any function exist. |
98 | 98 | // Check if render callback exist or not. |
99 | - if ( empty( $func_name ) ) { |
|
99 | + if (empty($func_name)) { |
|
100 | 100 | return false; |
101 | - } elseif ( is_string( $func_name ) && ! function_exists( "$func_name" ) ) { |
|
101 | + } elseif (is_string($func_name) && ! function_exists("$func_name")) { |
|
102 | 102 | return false; |
103 | - } elseif ( is_array( $func_name ) && ! method_exists( $func_name[0], "$func_name[1]" ) ) { |
|
103 | + } elseif (is_array($func_name) && ! method_exists($func_name[0], "$func_name[1]")) { |
|
104 | 104 | return false; |
105 | 105 | } |
106 | 106 | |
@@ -116,35 +116,35 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @return bool |
118 | 118 | */ |
119 | -function give_render_field( $field ) { |
|
119 | +function give_render_field($field) { |
|
120 | 120 | |
121 | 121 | // Check if render callback exist or not. |
122 | - if ( ! ( $func_name = give_get_field_callback( $field ) ) ) { |
|
122 | + if ( ! ($func_name = give_get_field_callback($field))) { |
|
123 | 123 | return false; |
124 | 124 | } |
125 | 125 | |
126 | 126 | // CMB2 compatibility: Push all classes to attributes's class key |
127 | - if ( empty( $field['class'] ) ) { |
|
127 | + if (empty($field['class'])) { |
|
128 | 128 | $field['class'] = ''; |
129 | 129 | } |
130 | 130 | |
131 | - if ( empty( $field['attributes']['class'] ) ) { |
|
131 | + if (empty($field['attributes']['class'])) { |
|
132 | 132 | $field['attributes']['class'] = ''; |
133 | 133 | } |
134 | 134 | |
135 | - $field['attributes']['class'] = trim( "give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}" ); |
|
136 | - unset( $field['class'] ); |
|
135 | + $field['attributes']['class'] = trim("give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}"); |
|
136 | + unset($field['class']); |
|
137 | 137 | |
138 | 138 | // CMB2 compatibility: Set wrapper class if any. |
139 | - if ( ! empty( $field['row_classes'] ) ) { |
|
139 | + if ( ! empty($field['row_classes'])) { |
|
140 | 140 | $field['wrapper_class'] = $field['row_classes']; |
141 | - unset( $field['row_classes'] ); |
|
141 | + unset($field['row_classes']); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | // Set field params on basis of cmb2 field name. |
145 | - switch ( $field['type'] ) { |
|
145 | + switch ($field['type']) { |
|
146 | 146 | case 'radio_inline': |
147 | - if ( empty( $field['wrapper_class'] ) ) { |
|
147 | + if (empty($field['wrapper_class'])) { |
|
148 | 148 | $field['wrapper_class'] = ''; |
149 | 149 | } |
150 | 150 | $field['wrapper_class'] .= ' give-inline-radio-fields'; |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | case 'text-small' : |
158 | 158 | case 'text_small' : |
159 | 159 | // CMB2 compatibility: Set field type to text. |
160 | - $field['type'] = isset( $field['attributes']['type'] ) ? $field['attributes']['type'] : 'text'; |
|
160 | + $field['type'] = isset($field['attributes']['type']) ? $field['attributes']['type'] : 'text'; |
|
161 | 161 | |
162 | 162 | // CMB2 compatibility: Set data type to price. |
163 | 163 | if ( |
164 | - empty( $field['data_type'] ) |
|
165 | - && ! empty( $field['attributes']['class'] ) |
|
164 | + empty($field['data_type']) |
|
165 | + && ! empty($field['attributes']['class']) |
|
166 | 166 | && ( |
167 | - false !== strpos( $field['attributes']['class'], 'money' ) |
|
168 | - || false !== strpos( $field['attributes']['class'], 'amount' ) |
|
167 | + false !== strpos($field['attributes']['class'], 'money') |
|
168 | + || false !== strpos($field['attributes']['class'], 'amount') |
|
169 | 169 | ) |
170 | 170 | ) { |
171 | 171 | $field['data_type'] = 'decimal'; |
@@ -184,22 +184,22 @@ discard block |
||
184 | 184 | case 'give_default_radio_inline': |
185 | 185 | $field['type'] = 'radio'; |
186 | 186 | $field['options'] = array( |
187 | - 'default' => __( 'Default' ), |
|
187 | + 'default' => __('Default'), |
|
188 | 188 | ); |
189 | 189 | break; |
190 | 190 | } |
191 | 191 | |
192 | 192 | // CMB2 compatibility: Add support to define field description by desc & description param. |
193 | 193 | // We encourage you to use description param. |
194 | - $field['description'] = ( ! empty( $field['description'] ) |
|
194 | + $field['description'] = ( ! empty($field['description']) |
|
195 | 195 | ? $field['description'] |
196 | - : ( ! empty( $field['desc'] ) ? $field['desc'] : '' ) ); |
|
196 | + : ( ! empty($field['desc']) ? $field['desc'] : '')); |
|
197 | 197 | |
198 | 198 | // Call render function. |
199 | - if ( is_array( $func_name ) ) { |
|
200 | - $func_name[0]->{$func_name[1]}( $field ); |
|
199 | + if (is_array($func_name)) { |
|
200 | + $func_name[0]->{$func_name[1]}($field); |
|
201 | 201 | } else { |
202 | - $func_name( $field ); |
|
202 | + $func_name($field); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | return true; |
@@ -229,29 +229,29 @@ discard block |
||
229 | 229 | * } |
230 | 230 | * @return void |
231 | 231 | */ |
232 | -function give_text_input( $field ) { |
|
232 | +function give_text_input($field) { |
|
233 | 233 | global $thepostid, $post; |
234 | 234 | |
235 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
236 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
237 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
238 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
239 | - $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text'; |
|
235 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
236 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
237 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
238 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
239 | + $field['type'] = isset($field['type']) ? $field['type'] : 'text'; |
|
240 | 240 | $field['before_field'] = ''; |
241 | 241 | $field['after_field'] = ''; |
242 | - $data_type = empty( $field['data_type'] ) ? '' : $field['data_type']; |
|
242 | + $data_type = empty($field['data_type']) ? '' : $field['data_type']; |
|
243 | 243 | |
244 | - switch ( $data_type ) { |
|
244 | + switch ($data_type) { |
|
245 | 245 | case 'price' : |
246 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_amount( give_maybe_sanitize_amount( $field['value'] ), array( 'sanitize' => false ) ) : $field['value'] ); |
|
246 | + $field['value'] = ( ! empty($field['value']) ? give_format_amount(give_maybe_sanitize_amount($field['value']), array('sanitize' => false)) : $field['value']); |
|
247 | 247 | |
248 | - $field['before_field'] = ! empty( $field['before_field'] ) ? $field['before_field'] : ( give_get_option( 'currency_position', 'before' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' ); |
|
249 | - $field['after_field'] = ! empty( $field['after_field'] ) ? $field['after_field'] : ( give_get_option( 'currency_position', 'before' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' ); |
|
248 | + $field['before_field'] = ! empty($field['before_field']) ? $field['before_field'] : (give_get_option('currency_position', 'before') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : ''); |
|
249 | + $field['after_field'] = ! empty($field['after_field']) ? $field['after_field'] : (give_get_option('currency_position', 'before') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : ''); |
|
250 | 250 | break; |
251 | 251 | |
252 | 252 | case 'decimal' : |
253 | 253 | $field['attributes']['class'] .= ' give_input_decimal'; |
254 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( give_maybe_sanitize_amount( $field['value'] ), false, false ) : $field['value'] ); |
|
254 | + $field['value'] = ( ! empty($field['value']) ? give_format_decimal(give_maybe_sanitize_amount($field['value']), false, false) : $field['value']); |
|
255 | 255 | break; |
256 | 256 | |
257 | 257 | default : |
@@ -259,20 +259,20 @@ discard block |
||
259 | 259 | } |
260 | 260 | |
261 | 261 | ?> |
262 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
263 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
262 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
263 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
264 | 264 | <?php echo $field['before_field']; ?> |
265 | 265 | <input |
266 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
267 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
268 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
269 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
270 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
271 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
266 | + type="<?php echo esc_attr($field['type']); ?>" |
|
267 | + style="<?php echo esc_attr($field['style']); ?>" |
|
268 | + name="<?php echo give_get_field_name($field); ?>" |
|
269 | + id="<?php echo esc_attr($field['id']); ?>" |
|
270 | + value="<?php echo esc_attr($field['value']); ?>" |
|
271 | + <?php echo give_get_custom_attributes($field); ?> |
|
272 | 272 | /> |
273 | 273 | <?php echo $field['after_field']; ?> |
274 | 274 | <?php |
275 | - echo give_get_field_description( $field ); |
|
275 | + echo give_get_field_description($field); |
|
276 | 276 | echo '</p>'; |
277 | 277 | } |
278 | 278 | |
@@ -294,29 +294,29 @@ discard block |
||
294 | 294 | * } |
295 | 295 | * @return void |
296 | 296 | */ |
297 | -function give_hidden_input( $field ) { |
|
297 | +function give_hidden_input($field) { |
|
298 | 298 | global $thepostid, $post; |
299 | 299 | |
300 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
301 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
300 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
301 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
302 | 302 | |
303 | 303 | // Custom attribute handling |
304 | 304 | $custom_attributes = array(); |
305 | 305 | |
306 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
306 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
307 | 307 | |
308 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
309 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
308 | + foreach ($field['attributes'] as $attribute => $value) { |
|
309 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
310 | 310 | } |
311 | 311 | } |
312 | 312 | ?> |
313 | 313 | |
314 | 314 | <input |
315 | 315 | type="hidden" |
316 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
317 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
318 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
319 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
316 | + name="<?php echo give_get_field_name($field); ?>" |
|
317 | + id="<?php echo esc_attr($field['id']); ?>" |
|
318 | + value="<?php echo esc_attr($field['value']); ?>" |
|
319 | + <?php echo give_get_custom_attributes($field); ?> |
|
320 | 320 | /> |
321 | 321 | <?php |
322 | 322 | } |
@@ -342,27 +342,27 @@ discard block |
||
342 | 342 | * } |
343 | 343 | * @return void |
344 | 344 | */ |
345 | -function give_textarea_input( $field ) { |
|
345 | +function give_textarea_input($field) { |
|
346 | 346 | global $thepostid, $post; |
347 | 347 | |
348 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
349 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
350 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
351 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
348 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
349 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
350 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
351 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
352 | 352 | |
353 | 353 | ?> |
354 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
355 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
354 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
355 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
356 | 356 | <textarea |
357 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
358 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
359 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
357 | + style="<?php echo esc_attr($field['style']); ?>" |
|
358 | + name="<?php echo give_get_field_name($field); ?>" |
|
359 | + id="<?php echo esc_attr($field['id']); ?>" |
|
360 | 360 | rows="10" |
361 | 361 | cols="20" |
362 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
363 | - ><?php echo esc_textarea( $field['value'] ); ?></textarea> |
|
362 | + <?php echo give_get_custom_attributes($field); ?> |
|
363 | + ><?php echo esc_textarea($field['value']); ?></textarea> |
|
364 | 364 | <?php |
365 | - echo give_get_field_description( $field ); |
|
365 | + echo give_get_field_description($field); |
|
366 | 366 | echo '</p>'; |
367 | 367 | } |
368 | 368 | |
@@ -386,29 +386,29 @@ discard block |
||
386 | 386 | * } |
387 | 387 | * @return void |
388 | 388 | */ |
389 | -function give_wysiwyg( $field ) { |
|
389 | +function give_wysiwyg($field) { |
|
390 | 390 | global $thepostid, $post; |
391 | 391 | |
392 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
393 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
394 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
395 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
392 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
393 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
394 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
395 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
396 | 396 | |
397 | - $field['unique_field_id'] = give_get_field_name( $field ); |
|
397 | + $field['unique_field_id'] = give_get_field_name($field); |
|
398 | 398 | $editor_attributes = array( |
399 | - 'textarea_name' => isset( $field['repeatable_field_id'] ) ? $field['repeatable_field_id'] : $field['id'], |
|
399 | + 'textarea_name' => isset($field['repeatable_field_id']) ? $field['repeatable_field_id'] : $field['id'], |
|
400 | 400 | 'textarea_rows' => '10', |
401 | - 'editor_css' => esc_attr( $field['style'] ), |
|
401 | + 'editor_css' => esc_attr($field['style']), |
|
402 | 402 | 'editor_class' => $field['attributes']['class'], |
403 | 403 | ); |
404 | - $data_wp_editor = ' data-wp-editor="' . base64_encode( json_encode( array( |
|
404 | + $data_wp_editor = ' data-wp-editor="'.base64_encode(json_encode(array( |
|
405 | 405 | $field['value'], |
406 | 406 | $field['unique_field_id'], |
407 | 407 | $editor_attributes, |
408 | - ) ) ) . '"'; |
|
409 | - $data_wp_editor = isset( $field['repeatable_field_id'] ) ? $data_wp_editor : ''; |
|
408 | + ))).'"'; |
|
409 | + $data_wp_editor = isset($field['repeatable_field_id']) ? $data_wp_editor : ''; |
|
410 | 410 | |
411 | - echo '<div class="give-field-wrap ' . $field['unique_field_id'] . '_field ' . esc_attr( $field['wrapper_class'] ) . '"' . $data_wp_editor . '><label for="' . $field['unique_field_id'] . '">' . wp_kses_post( $field['name'] ) . '</label>'; |
|
411 | + echo '<div class="give-field-wrap '.$field['unique_field_id'].'_field '.esc_attr($field['wrapper_class']).'"'.$data_wp_editor.'><label for="'.$field['unique_field_id'].'">'.wp_kses_post($field['name']).'</label>'; |
|
412 | 412 | |
413 | 413 | wp_editor( |
414 | 414 | $field['value'], |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | $editor_attributes |
417 | 417 | ); |
418 | 418 | |
419 | - echo give_get_field_description( $field ); |
|
419 | + echo give_get_field_description($field); |
|
420 | 420 | echo '</div>'; |
421 | 421 | } |
422 | 422 | |
@@ -441,29 +441,29 @@ discard block |
||
441 | 441 | * } |
442 | 442 | * @return void |
443 | 443 | */ |
444 | -function give_checkbox( $field ) { |
|
444 | +function give_checkbox($field) { |
|
445 | 445 | global $thepostid, $post; |
446 | 446 | |
447 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
448 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
449 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
450 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
451 | - $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'on'; |
|
452 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
447 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
448 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
449 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
450 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
451 | + $field['cbvalue'] = isset($field['cbvalue']) ? $field['cbvalue'] : 'on'; |
|
452 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
453 | 453 | ?> |
454 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
455 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
454 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
455 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
456 | 456 | <input |
457 | 457 | type="checkbox" |
458 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
459 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
460 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
461 | - value="<?php echo esc_attr( $field['cbvalue'] ); ?>" |
|
462 | - <?php echo checked( $field['value'], $field['cbvalue'], false ); ?> |
|
463 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
458 | + style="<?php echo esc_attr($field['style']); ?>" |
|
459 | + name="<?php echo give_get_field_name($field); ?>" |
|
460 | + id="<?php echo esc_attr($field['id']); ?>" |
|
461 | + value="<?php echo esc_attr($field['cbvalue']); ?>" |
|
462 | + <?php echo checked($field['value'], $field['cbvalue'], false); ?> |
|
463 | + <?php echo give_get_custom_attributes($field); ?> |
|
464 | 464 | /> |
465 | 465 | <?php |
466 | - echo give_get_field_description( $field ); |
|
466 | + echo give_get_field_description($field); |
|
467 | 467 | echo '</p>'; |
468 | 468 | } |
469 | 469 | |
@@ -489,29 +489,29 @@ discard block |
||
489 | 489 | * } |
490 | 490 | * @return void |
491 | 491 | */ |
492 | -function give_select( $field ) { |
|
492 | +function give_select($field) { |
|
493 | 493 | global $thepostid, $post; |
494 | 494 | |
495 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
496 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
497 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
498 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
499 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
495 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
496 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
497 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
498 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
499 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
500 | 500 | ?> |
501 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
502 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
501 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
502 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
503 | 503 | <select |
504 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
505 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
506 | - style="<?php echo esc_attr( $field['style'] ) ?>" |
|
507 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
504 | + id="<?php echo esc_attr($field['id']); ?>" |
|
505 | + name="<?php echo give_get_field_name($field); ?>" |
|
506 | + style="<?php echo esc_attr($field['style']) ?>" |
|
507 | + <?php echo give_get_custom_attributes($field); ?> |
|
508 | 508 | > |
509 | 509 | <?php |
510 | - foreach ( $field['options'] as $key => $value ) { |
|
511 | - echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>'; |
|
510 | + foreach ($field['options'] as $key => $value) { |
|
511 | + echo '<option value="'.esc_attr($key).'" '.selected(esc_attr($field['value']), esc_attr($key), false).'>'.esc_html($value).'</option>'; |
|
512 | 512 | } |
513 | 513 | echo '</select>'; |
514 | - echo give_get_field_description( $field ); |
|
514 | + echo give_get_field_description($field); |
|
515 | 515 | echo '</p>'; |
516 | 516 | } |
517 | 517 | |
@@ -538,32 +538,32 @@ discard block |
||
538 | 538 | * } |
539 | 539 | * @return void |
540 | 540 | */ |
541 | -function give_radio( $field ) { |
|
541 | +function give_radio($field) { |
|
542 | 542 | global $thepostid, $post; |
543 | 543 | |
544 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
545 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
546 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
547 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
548 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
544 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
545 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
546 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
547 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
548 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
549 | 549 | |
550 | - echo '<fieldset class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><span class="give-field-label">' . wp_kses_post( $field['name'] ) . '</span><legend class="screen-reader-text">' . wp_kses_post( $field['name'] ) . '</legend><ul class="give-radios">'; |
|
550 | + echo '<fieldset class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><span class="give-field-label">'.wp_kses_post($field['name']).'</span><legend class="screen-reader-text">'.wp_kses_post($field['name']).'</legend><ul class="give-radios">'; |
|
551 | 551 | |
552 | - foreach ( $field['options'] as $key => $value ) { |
|
552 | + foreach ($field['options'] as $key => $value) { |
|
553 | 553 | |
554 | 554 | echo '<li><label><input |
555 | - name="' . give_get_field_name( $field ) . '" |
|
556 | - value="' . esc_attr( $key ) . '" |
|
555 | + name="' . give_get_field_name($field).'" |
|
556 | + value="' . esc_attr($key).'" |
|
557 | 557 | type="radio" |
558 | - style="' . esc_attr( $field['style'] ) . '" |
|
559 | - ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
|
560 | - . give_get_custom_attributes( $field ) . ' |
|
561 | - /> ' . esc_html( $value ) . '</label> |
|
558 | + style="' . esc_attr($field['style']).'" |
|
559 | + ' . checked(esc_attr($field['value']), esc_attr($key), false).' ' |
|
560 | + . give_get_custom_attributes($field).' |
|
561 | + /> ' . esc_html($value).'</label> |
|
562 | 562 | </li>'; |
563 | 563 | } |
564 | 564 | echo '</ul>'; |
565 | 565 | |
566 | - echo give_get_field_description( $field ); |
|
566 | + echo give_get_field_description($field); |
|
567 | 567 | echo '</fieldset>'; |
568 | 568 | } |
569 | 569 | |
@@ -587,27 +587,27 @@ discard block |
||
587 | 587 | * } |
588 | 588 | * @return void |
589 | 589 | */ |
590 | -function give_colorpicker( $field ) { |
|
590 | +function give_colorpicker($field) { |
|
591 | 591 | global $thepostid, $post; |
592 | 592 | |
593 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
594 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
595 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
596 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
597 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
593 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
594 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
595 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
596 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
597 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
598 | 598 | $field['type'] = 'text'; |
599 | 599 | ?> |
600 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
601 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
600 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
601 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
602 | 602 | <input |
603 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
604 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
605 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
606 | - id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr( $field['value'] ); ?>" |
|
607 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
603 | + type="<?php echo esc_attr($field['type']); ?>" |
|
604 | + style="<?php echo esc_attr($field['style']); ?>" |
|
605 | + name="<?php echo give_get_field_name($field); ?>" |
|
606 | + id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr($field['value']); ?>" |
|
607 | + <?php echo give_get_custom_attributes($field); ?> |
|
608 | 608 | /> |
609 | 609 | <?php |
610 | - echo give_get_field_description( $field ); |
|
610 | + echo give_get_field_description($field); |
|
611 | 611 | echo '</p>'; |
612 | 612 | } |
613 | 613 | |
@@ -618,8 +618,8 @@ discard block |
||
618 | 618 | * |
619 | 619 | * @param array $field |
620 | 620 | */ |
621 | -function give_file( $field ) { |
|
622 | - give_media( $field ); |
|
621 | +function give_file($field) { |
|
622 | + give_media($field); |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | |
@@ -630,37 +630,37 @@ discard block |
||
630 | 630 | * |
631 | 631 | * @param array $field |
632 | 632 | */ |
633 | -function give_media( $field ) { |
|
633 | +function give_media($field) { |
|
634 | 634 | global $thepostid, $post; |
635 | 635 | |
636 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
637 | - $button_label = esc_html__( sprintf( 'Add or Upload %s', ( 'file' === $field['type'] ? 'File' : 'Image' ) ), 'give' ); |
|
636 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
637 | + $button_label = esc_html__(sprintf('Add or Upload %s', ('file' === $field['type'] ? 'File' : 'Image')), 'give'); |
|
638 | 638 | |
639 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
640 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
641 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
642 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
639 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
640 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
641 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
642 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
643 | 643 | $field['attributes']['class'] = "{$field['attributes']['class']} give-text-medium"; |
644 | 644 | |
645 | 645 | // Allow developer to save attachment ID or attachment url as metadata. |
646 | - $field['fvalue'] = isset( $field['fvalue'] ) ? $field['fvalue'] : 'url'; |
|
646 | + $field['fvalue'] = isset($field['fvalue']) ? $field['fvalue'] : 'url'; |
|
647 | 647 | |
648 | - $allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' ); |
|
649 | - $preview_image_src = $field['value'] ? ( 'id' === $field['fvalue'] ? wp_get_attachment_url( $field['value'] ) : $field['value'] ) : '#'; |
|
650 | - $preview_image_extension = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : ''; |
|
651 | - $is_show_preview = in_array( $preview_image_extension, $allow_media_preview_tags ); |
|
648 | + $allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico'); |
|
649 | + $preview_image_src = $field['value'] ? ('id' === $field['fvalue'] ? wp_get_attachment_url($field['value']) : $field['value']) : '#'; |
|
650 | + $preview_image_extension = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : ''; |
|
651 | + $is_show_preview = in_array($preview_image_extension, $allow_media_preview_tags); |
|
652 | 652 | ?> |
653 | - <fieldset class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
654 | - <label for="<?php echo give_get_field_name( $field ) ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
653 | + <fieldset class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
654 | + <label for="<?php echo give_get_field_name($field) ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
655 | 655 | <input |
656 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
657 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
656 | + name="<?php echo give_get_field_name($field); ?>" |
|
657 | + id="<?php echo esc_attr($field['id']); ?>" |
|
658 | 658 | type="text" |
659 | 659 | value="<?php echo $field['value']; ?>" |
660 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
661 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
660 | + style="<?php echo esc_attr($field['style']); ?>" |
|
661 | + <?php echo give_get_custom_attributes($field); ?> |
|
662 | 662 | /> <input class="give-upload-button button" type="button" value="<?php echo $button_label; ?>" data-fvalue="<?php echo $field['fvalue']; ?>" data-field-type="<?php echo $field['type']; ?>"> |
663 | - <?php echo give_get_field_description( $field ); ?> |
|
663 | + <?php echo give_get_field_description($field); ?> |
|
664 | 664 | <div class="give-image-thumb<?php echo ! $field['value'] || ! $is_show_preview ? ' give-hidden' : ''; ?>"> |
665 | 665 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
666 | 666 | <img src="<?php echo $preview_image_src; ?>" alt=""> |
@@ -678,27 +678,27 @@ discard block |
||
678 | 678 | * |
679 | 679 | * @return void |
680 | 680 | */ |
681 | -function give_default_gateway( $field ) { |
|
681 | +function give_default_gateway($field) { |
|
682 | 682 | global $thepostid, $post; |
683 | 683 | |
684 | 684 | // get all active payment gateways. |
685 | - $gateways = give_get_enabled_payment_gateways( $thepostid ); |
|
685 | + $gateways = give_get_enabled_payment_gateways($thepostid); |
|
686 | 686 | $field['options'] = array(); |
687 | 687 | |
688 | 688 | // Set field option value. |
689 | - if ( ! empty( $gateways ) ) { |
|
690 | - foreach ( $gateways as $key => $option ) { |
|
691 | - $field['options'][ $key ] = $option['admin_label']; |
|
689 | + if ( ! empty($gateways)) { |
|
690 | + foreach ($gateways as $key => $option) { |
|
691 | + $field['options'][$key] = $option['admin_label']; |
|
692 | 692 | } |
693 | 693 | } |
694 | 694 | |
695 | 695 | // Add a field to the Give Form admin single post view of this field |
696 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
697 | - $field['options'] = array_merge( array( 'global' => esc_html__( 'Global Default', 'give' ) ), $field['options'] ); |
|
696 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
697 | + $field['options'] = array_merge(array('global' => esc_html__('Global Default', 'give')), $field['options']); |
|
698 | 698 | } |
699 | 699 | |
700 | 700 | // Render select field. |
701 | - give_select( $field ); |
|
701 | + give_select($field); |
|
702 | 702 | } |
703 | 703 | |
704 | 704 | /** |
@@ -720,13 +720,13 @@ discard block |
||
720 | 720 | * @return void |
721 | 721 | */ |
722 | 722 | |
723 | -function give_docs_link( $field ) { |
|
724 | - $field['url'] = isset( $field['url'] ) ? $field['url'] : 'https://givewp.com/documentation'; |
|
725 | - $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation'; |
|
723 | +function give_docs_link($field) { |
|
724 | + $field['url'] = isset($field['url']) ? $field['url'] : 'https://givewp.com/documentation'; |
|
725 | + $field['title'] = isset($field['title']) ? $field['title'] : 'Documentation'; |
|
726 | 726 | |
727 | - echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] ) |
|
727 | + echo '<p class="give-docs-link"><a href="'.esc_url($field['url']) |
|
728 | 728 | . '" target="_blank">' |
729 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] ) |
|
729 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $field['title']) |
|
730 | 730 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
731 | 731 | } |
732 | 732 | |
@@ -737,15 +737,15 @@ discard block |
||
737 | 737 | * @since 2.0 |
738 | 738 | * @param $field |
739 | 739 | */ |
740 | -function give_email_preview_buttons( $field ) { |
|
740 | +function give_email_preview_buttons($field) { |
|
741 | 741 | /* @var WP_Post $post */ |
742 | 742 | global $post; |
743 | 743 | |
744 | - $field_id = str_replace( array( '_give_', '_preview_buttons' ), '', $field['id'] ); |
|
744 | + $field_id = str_replace(array('_give_', '_preview_buttons'), '', $field['id']); |
|
745 | 745 | |
746 | 746 | ob_start(); |
747 | 747 | |
748 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label>'; |
|
748 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label>'; |
|
749 | 749 | |
750 | 750 | echo sprintf( |
751 | 751 | '<a href="%1$s" class="button-secondary" target="_blank">%2$s</a>', |
@@ -773,12 +773,12 @@ discard block |
||
773 | 773 | 'form_id' => $post->ID, |
774 | 774 | ) |
775 | 775 | ), 'give-send-preview-email' ), |
776 | - esc_attr__( 'Send Test Email.', 'give' ), |
|
777 | - esc_html__( 'Send Test Email', 'give' ) |
|
776 | + esc_attr__('Send Test Email.', 'give'), |
|
777 | + esc_html__('Send Test Email', 'give') |
|
778 | 778 | ); |
779 | 779 | |
780 | - if ( ! empty( $field['description'] ) ) { |
|
781 | - echo '<span class="give-field-description">' . wp_kses_post( $field['desc'] ) . '</span>'; |
|
780 | + if ( ! empty($field['description'])) { |
|
781 | + echo '<span class="give-field-description">'.wp_kses_post($field['desc']).'</span>'; |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | echo '</p>'; |
@@ -798,13 +798,13 @@ discard block |
||
798 | 798 | * |
799 | 799 | * @return mixed |
800 | 800 | */ |
801 | -function give_get_field_value( $field, $postid ) { |
|
802 | - if ( isset( $field['attributes']['value'] ) ) { |
|
801 | +function give_get_field_value($field, $postid) { |
|
802 | + if (isset($field['attributes']['value'])) { |
|
803 | 803 | return $field['attributes']['value']; |
804 | 804 | } |
805 | 805 | |
806 | 806 | // Get value from db. |
807 | - $field_value = give_get_meta( $postid, $field['id'], true ); |
|
807 | + $field_value = give_get_meta($postid, $field['id'], true); |
|
808 | 808 | |
809 | 809 | /** |
810 | 810 | * Filter the field value before apply default value. |
@@ -813,10 +813,10 @@ discard block |
||
813 | 813 | * |
814 | 814 | * @param mixed $field_value Field value. |
815 | 815 | */ |
816 | - $field_value = apply_filters( "{$field['id']}_field_value", $field_value, $field, $postid ); |
|
816 | + $field_value = apply_filters("{$field['id']}_field_value", $field_value, $field, $postid); |
|
817 | 817 | |
818 | 818 | // Set default value if no any data saved to db. |
819 | - if ( ! $field_value && isset( $field['default'] ) ) { |
|
819 | + if ( ! $field_value && isset($field['default'])) { |
|
820 | 820 | $field_value = $field['default']; |
821 | 821 | } |
822 | 822 | |
@@ -833,20 +833,20 @@ discard block |
||
833 | 833 | * |
834 | 834 | * @return string |
835 | 835 | */ |
836 | -function give_get_field_description( $field ) { |
|
836 | +function give_get_field_description($field) { |
|
837 | 837 | $field_desc_html = ''; |
838 | 838 | $description = ''; |
839 | 839 | |
840 | 840 | // Check for both `description` and `desc`. |
841 | - if ( isset( $field['description'] ) ) { |
|
841 | + if (isset($field['description'])) { |
|
842 | 842 | $description = $field['description']; |
843 | - } elseif ( isset( $field['desc'] ) ) { |
|
843 | + } elseif (isset($field['desc'])) { |
|
844 | 844 | $description = $field['desc']; |
845 | 845 | } |
846 | 846 | |
847 | 847 | // Set if there is a description. |
848 | - if ( ! empty( $description ) ) { |
|
849 | - $field_desc_html = '<span class="give-field-description">' . wp_kses_post( $description ) . '</span>'; |
|
848 | + if ( ! empty($description)) { |
|
849 | + $field_desc_html = '<span class="give-field-description">'.wp_kses_post($description).'</span>'; |
|
850 | 850 | } |
851 | 851 | |
852 | 852 | return $field_desc_html; |
@@ -866,8 +866,8 @@ discard block |
||
866 | 866 | * |
867 | 867 | * @return string |
868 | 868 | */ |
869 | -function give_get_repeater_field_value( $field, $field_group, $fields ) { |
|
870 | - $field_value = ( isset( $field_group[ $field['id'] ] ) ? $field_group[ $field['id'] ] : '' ); |
|
869 | +function give_get_repeater_field_value($field, $field_group, $fields) { |
|
870 | + $field_value = (isset($field_group[$field['id']]) ? $field_group[$field['id']] : ''); |
|
871 | 871 | |
872 | 872 | /** |
873 | 873 | * Filter the specific repeater field value |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | * |
877 | 877 | * @param string $field_id |
878 | 878 | */ |
879 | - $field_value = apply_filters( "give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields ); |
|
879 | + $field_value = apply_filters("give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields); |
|
880 | 880 | |
881 | 881 | /** |
882 | 882 | * Filter the repeater field value |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | * |
886 | 886 | * @param string $field_id |
887 | 887 | */ |
888 | - $field_value = apply_filters( 'give_get_repeater_field_value', $field_value, $field, $field_group, $fields ); |
|
888 | + $field_value = apply_filters('give_get_repeater_field_value', $field_value, $field, $field_group, $fields); |
|
889 | 889 | |
890 | 890 | return $field_value; |
891 | 891 | } |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | * |
904 | 904 | * @return string |
905 | 905 | */ |
906 | -function give_get_repeater_field_id( $field, $fields, $default = false ) { |
|
906 | +function give_get_repeater_field_id($field, $fields, $default = false) { |
|
907 | 907 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
908 | 908 | |
909 | 909 | // Get field id. |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | * |
917 | 917 | * @param string $field_id |
918 | 918 | */ |
919 | - $field_id = apply_filters( "give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default ); |
|
919 | + $field_id = apply_filters("give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default); |
|
920 | 920 | |
921 | 921 | /** |
922 | 922 | * Filter the repeater field id |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | * |
926 | 926 | * @param string $field_id |
927 | 927 | */ |
928 | - $field_id = apply_filters( 'give_get_repeater_field_id', $field_id, $field, $fields, $default ); |
|
928 | + $field_id = apply_filters('give_get_repeater_field_id', $field_id, $field, $fields, $default); |
|
929 | 929 | |
930 | 930 | return $field_id; |
931 | 931 | } |
@@ -940,8 +940,8 @@ discard block |
||
940 | 940 | * |
941 | 941 | * @return string |
942 | 942 | */ |
943 | -function give_get_field_name( $field ) { |
|
944 | - $field_name = esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] ); |
|
943 | +function give_get_field_name($field) { |
|
944 | + $field_name = esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']); |
|
945 | 945 | |
946 | 946 | /** |
947 | 947 | * Filter the field name. |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | * |
951 | 951 | * @param string $field_name |
952 | 952 | */ |
953 | - $field_name = apply_filters( 'give_get_field_name', $field_name, $field ); |
|
953 | + $field_name = apply_filters('give_get_field_name', $field_name, $field); |
|
954 | 954 | |
955 | 955 | return $field_name; |
956 | 956 | } |
@@ -967,40 +967,40 @@ discard block |
||
967 | 967 | * |
968 | 968 | * @return void |
969 | 969 | */ |
970 | -function _give_metabox_form_data_repeater_fields( $fields ) { |
|
970 | +function _give_metabox_form_data_repeater_fields($fields) { |
|
971 | 971 | global $thepostid, $post; |
972 | 972 | |
973 | 973 | // Bailout. |
974 | - if ( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) { |
|
974 | + if ( ! isset($fields['fields']) || empty($fields['fields'])) { |
|
975 | 975 | return; |
976 | 976 | } |
977 | 977 | |
978 | - $group_numbering = isset( $fields['options']['group_numbering'] ) ? (int) $fields['options']['group_numbering'] : 0; |
|
979 | - $close_tabs = isset( $fields['options']['close_tabs'] ) ? (int) $fields['options']['close_tabs'] : 0; |
|
980 | - $wrapper_class = isset( $fields['wrapper_class'] ) ? $fields['wrapper_class'] : ''; |
|
978 | + $group_numbering = isset($fields['options']['group_numbering']) ? (int) $fields['options']['group_numbering'] : 0; |
|
979 | + $close_tabs = isset($fields['options']['close_tabs']) ? (int) $fields['options']['close_tabs'] : 0; |
|
980 | + $wrapper_class = isset($fields['wrapper_class']) ? $fields['wrapper_class'] : ''; |
|
981 | 981 | ?> |
982 | - <div class="give-repeatable-field-section <?php echo esc_attr( $wrapper_class ); ?>" id="<?php echo "{$fields['id']}_field"; ?>" |
|
982 | + <div class="give-repeatable-field-section <?php echo esc_attr($wrapper_class); ?>" id="<?php echo "{$fields['id']}_field"; ?>" |
|
983 | 983 | data-group-numbering="<?php echo $group_numbering; ?>" data-close-tabs="<?php echo $close_tabs; ?>"> |
984 | - <?php if ( ! empty( $fields['name'] ) ) : ?> |
|
984 | + <?php if ( ! empty($fields['name'])) : ?> |
|
985 | 985 | <p class="give-repeater-field-name"><?php echo $fields['name']; ?></p> |
986 | 986 | <?php endif; ?> |
987 | 987 | |
988 | - <?php if ( ! empty( $fields['description'] ) ) : ?> |
|
988 | + <?php if ( ! empty($fields['description'])) : ?> |
|
989 | 989 | <p class="give-repeater-field-description"><?php echo $fields['description']; ?></p> |
990 | 990 | <?php endif; ?> |
991 | 991 | |
992 | 992 | <table class="give-repeatable-fields-section-wrapper" cellspacing="0"> |
993 | 993 | <?php |
994 | - $repeater_field_values = give_get_meta( $thepostid, $fields['id'], true ); |
|
995 | - $header_title = isset( $fields['options']['header_title'] ) |
|
994 | + $repeater_field_values = give_get_meta($thepostid, $fields['id'], true); |
|
995 | + $header_title = isset($fields['options']['header_title']) |
|
996 | 996 | ? $fields['options']['header_title'] |
997 | - : esc_attr__( 'Group', 'give' ); |
|
997 | + : esc_attr__('Group', 'give'); |
|
998 | 998 | |
999 | 999 | $add_default_donation_field = false; |
1000 | 1000 | |
1001 | 1001 | // Check if level is not created or we have to add default level. |
1002 | - if ( is_array( $repeater_field_values ) && ( $fields_count = count( $repeater_field_values ) ) ) { |
|
1003 | - $repeater_field_values = array_values( $repeater_field_values ); |
|
1002 | + if (is_array($repeater_field_values) && ($fields_count = count($repeater_field_values))) { |
|
1003 | + $repeater_field_values = array_values($repeater_field_values); |
|
1004 | 1004 | } else { |
1005 | 1005 | $fields_count = 1; |
1006 | 1006 | $add_default_donation_field = true; |
@@ -1013,77 +1013,77 @@ discard block |
||
1013 | 1013 | <div class="give-row-head give-move"> |
1014 | 1014 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span> |
1015 | 1015 | </button> |
1016 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-</span> |
|
1016 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-</span> |
|
1017 | 1017 | <h2> |
1018 | 1018 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
1019 | 1019 | </h2> |
1020 | 1020 | </div> |
1021 | 1021 | <div class="give-row-body"> |
1022 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
1022 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
1023 | 1023 | <?php |
1024 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
1024 | + if ( ! give_is_field_callback_exist($field)) { |
|
1025 | 1025 | continue; |
1026 | 1026 | } |
1027 | 1027 | ?> |
1028 | 1028 | <?php |
1029 | 1029 | $field['repeat'] = true; |
1030 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields ); |
|
1030 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields); |
|
1031 | 1031 | $field['id'] = str_replace( |
1032 | - array( '[', ']' ), |
|
1033 | - array( '_', '', ), |
|
1032 | + array('[', ']'), |
|
1033 | + array('_', '',), |
|
1034 | 1034 | $field['repeatable_field_id'] |
1035 | 1035 | ); |
1036 | 1036 | ?> |
1037 | - <?php give_render_field( $field ); ?> |
|
1037 | + <?php give_render_field($field); ?> |
|
1038 | 1038 | <?php endforeach; ?> |
1039 | 1039 | </div> |
1040 | 1040 | </td> |
1041 | 1041 | </tr> |
1042 | 1042 | |
1043 | - <?php if ( ! empty( $repeater_field_values ) ) : ?> |
|
1043 | + <?php if ( ! empty($repeater_field_values)) : ?> |
|
1044 | 1044 | <!--Stored repeater field group--> |
1045 | - <?php foreach ( $repeater_field_values as $index => $field_group ) : ?> |
|
1045 | + <?php foreach ($repeater_field_values as $index => $field_group) : ?> |
|
1046 | 1046 | <tr class="give-row"> |
1047 | 1047 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
1048 | 1048 | <div class="give-row-head give-move"> |
1049 | 1049 | <button type="button" class="handlediv button-link"> |
1050 | 1050 | <span class="toggle-indicator"></span></button> |
1051 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
1051 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
1052 | 1052 | </span> |
1053 | 1053 | <h2> |
1054 | 1054 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
1055 | 1055 | </h2> |
1056 | 1056 | </div> |
1057 | 1057 | <div class="give-row-body"> |
1058 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
1059 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
1058 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
1059 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
1060 | 1060 | continue; |
1061 | 1061 | } ?> |
1062 | 1062 | <?php |
1063 | 1063 | $field['repeat'] = true; |
1064 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, $index ); |
|
1065 | - $field['attributes']['value'] = give_get_repeater_field_value( $field, $field_group, $fields ); |
|
1064 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, $index); |
|
1065 | + $field['attributes']['value'] = give_get_repeater_field_value($field, $field_group, $fields); |
|
1066 | 1066 | $field['id'] = str_replace( |
1067 | - array( '[', ']' ), |
|
1068 | - array( '_', '', ), |
|
1067 | + array('[', ']'), |
|
1068 | + array('_', '',), |
|
1069 | 1069 | $field['repeatable_field_id'] |
1070 | 1070 | ); |
1071 | 1071 | ?> |
1072 | - <?php give_render_field( $field ); ?> |
|
1072 | + <?php give_render_field($field); ?> |
|
1073 | 1073 | <?php endforeach; ?> |
1074 | 1074 | </div> |
1075 | 1075 | </td> |
1076 | 1076 | </tr> |
1077 | - <?php endforeach;; ?> |
|
1077 | + <?php endforeach; ; ?> |
|
1078 | 1078 | |
1079 | - <?php elseif ( $add_default_donation_field ) : ?> |
|
1079 | + <?php elseif ($add_default_donation_field) : ?> |
|
1080 | 1080 | <!--Default repeater field group--> |
1081 | 1081 | <tr class="give-row"> |
1082 | 1082 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
1083 | 1083 | <div class="give-row-head give-move"> |
1084 | 1084 | <button type="button" class="handlediv button-link"> |
1085 | 1085 | <span class="toggle-indicator"></span></button> |
1086 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
1086 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
1087 | 1087 | </span> |
1088 | 1088 | <h2> |
1089 | 1089 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
@@ -1091,25 +1091,25 @@ discard block |
||
1091 | 1091 | </div> |
1092 | 1092 | <div class="give-row-body"> |
1093 | 1093 | <?php |
1094 | - foreach ( $fields['fields'] as $field ) : |
|
1095 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
1094 | + foreach ($fields['fields'] as $field) : |
|
1095 | + if ( ! give_is_field_callback_exist($field)) { |
|
1096 | 1096 | continue; |
1097 | 1097 | } |
1098 | 1098 | |
1099 | 1099 | $field['repeat'] = true; |
1100 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, 0 ); |
|
1100 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, 0); |
|
1101 | 1101 | $field['attributes']['value'] = apply_filters( |
1102 | 1102 | "give_default_field_group_field_{$field['id']}_value", |
1103 | - ( ! empty( $field['default'] ) ? $field['default'] : '' ), |
|
1103 | + ( ! empty($field['default']) ? $field['default'] : ''), |
|
1104 | 1104 | $field, |
1105 | 1105 | $fields |
1106 | 1106 | ); |
1107 | - $field['id'] = str_replace( |
|
1108 | - array( '[', ']' ), |
|
1109 | - array( '_', '', ), |
|
1107 | + $field['id'] = str_replace( |
|
1108 | + array('[', ']'), |
|
1109 | + array('_', '',), |
|
1110 | 1110 | $field['repeatable_field_id'] |
1111 | 1111 | ); |
1112 | - give_render_field( $field ); |
|
1112 | + give_render_field($field); |
|
1113 | 1113 | |
1114 | 1114 | endforeach; |
1115 | 1115 | ?> |
@@ -1121,9 +1121,9 @@ discard block |
||
1121 | 1121 | <tfoot> |
1122 | 1122 | <tr> |
1123 | 1123 | <?php |
1124 | - $add_row_btn_title = isset( $fields['options']['add_button'] ) |
|
1124 | + $add_row_btn_title = isset($fields['options']['add_button']) |
|
1125 | 1125 | ? $add_row_btn_title = $fields['options']['add_button'] |
1126 | - : esc_html__( 'Add Row', 'give' ); |
|
1126 | + : esc_html__('Add Row', 'give'); |
|
1127 | 1127 | ?> |
1128 | 1128 | <td colspan="2" class="give-add-repeater-field-section-row-wrap"> |
1129 | 1129 | <button type="button" class="button button-primary give-add-repeater-field-section-row"><?php echo $add_row_btn_title; ?></button> |
@@ -1153,10 +1153,10 @@ discard block |
||
1153 | 1153 | * |
1154 | 1154 | * @param string |
1155 | 1155 | */ |
1156 | - $default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' ); |
|
1156 | + $default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general'); |
|
1157 | 1157 | |
1158 | 1158 | // Get current tab. |
1159 | - $current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] ); |
|
1159 | + $current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']); |
|
1160 | 1160 | |
1161 | 1161 | // Output. |
1162 | 1162 | return $current_tab; |
@@ -1180,10 +1180,10 @@ discard block |
||
1180 | 1180 | * |
1181 | 1181 | * @param string |
1182 | 1182 | */ |
1183 | - $default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' ); |
|
1183 | + $default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", ''); |
|
1184 | 1184 | |
1185 | 1185 | // Get current section. |
1186 | - $current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] ); |
|
1186 | + $current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']); |
|
1187 | 1187 | |
1188 | 1188 | // Output. |
1189 | 1189 | return $current_section; |
@@ -1197,7 +1197,7 @@ discard block |
||
1197 | 1197 | */ |
1198 | 1198 | function give_get_current_setting_page() { |
1199 | 1199 | // Get current page. |
1200 | - $setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : ''; |
|
1200 | + $setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : ''; |
|
1201 | 1201 | |
1202 | 1202 | // Output. |
1203 | 1203 | return $setting_page; |
@@ -1217,13 +1217,13 @@ discard block |
||
1217 | 1217 | * |
1218 | 1218 | * @return string |
1219 | 1219 | */ |
1220 | -function _give_display_content_field_value( $field_value, $field, $postid ) { |
|
1221 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
1220 | +function _give_display_content_field_value($field_value, $field, $postid) { |
|
1221 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
1222 | 1222 | |
1223 | 1223 | if ( |
1224 | - ! give_get_meta( $postid, '_give_display_content', true ) |
|
1224 | + ! give_get_meta($postid, '_give_display_content', true) |
|
1225 | 1225 | && $show_content |
1226 | - && ( 'none' !== $show_content ) |
|
1226 | + && ('none' !== $show_content) |
|
1227 | 1227 | ) { |
1228 | 1228 | $field_value = 'enabled'; |
1229 | 1229 | } |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | return $field_value; |
1232 | 1232 | } |
1233 | 1233 | |
1234 | -add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 ); |
|
1234 | +add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3); |
|
1235 | 1235 | |
1236 | 1236 | |
1237 | 1237 | /** |
@@ -1248,12 +1248,12 @@ discard block |
||
1248 | 1248 | * |
1249 | 1249 | * @return string |
1250 | 1250 | */ |
1251 | -function _give_content_placement_field_value( $field_value, $field, $postid ) { |
|
1252 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
1251 | +function _give_content_placement_field_value($field_value, $field, $postid) { |
|
1252 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
1253 | 1253 | |
1254 | 1254 | if ( |
1255 | - ! give_get_meta( $postid, '_give_content_placement', true ) |
|
1256 | - && ( 'none' !== $show_content ) |
|
1255 | + ! give_get_meta($postid, '_give_content_placement', true) |
|
1256 | + && ('none' !== $show_content) |
|
1257 | 1257 | ) { |
1258 | 1258 | $field_value = $show_content; |
1259 | 1259 | } |
@@ -1261,7 +1261,7 @@ discard block |
||
1261 | 1261 | return $field_value; |
1262 | 1262 | } |
1263 | 1263 | |
1264 | -add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 ); |
|
1264 | +add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3); |
|
1265 | 1265 | |
1266 | 1266 | |
1267 | 1267 | /** |
@@ -1277,17 +1277,17 @@ discard block |
||
1277 | 1277 | * |
1278 | 1278 | * @return string |
1279 | 1279 | */ |
1280 | -function _give_terms_option_field_value( $field_value, $field, $postid ) { |
|
1281 | - $term_option = give_get_meta( $postid, '_give_terms_option', true ); |
|
1280 | +function _give_terms_option_field_value($field_value, $field, $postid) { |
|
1281 | + $term_option = give_get_meta($postid, '_give_terms_option', true); |
|
1282 | 1282 | |
1283 | - if ( in_array( $term_option, array( 'none', 'yes' ) ) ) { |
|
1284 | - $field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' ); |
|
1283 | + if (in_array($term_option, array('none', 'yes'))) { |
|
1284 | + $field_value = ('yes' === $term_option ? 'enabled' : 'disabled'); |
|
1285 | 1285 | } |
1286 | 1286 | |
1287 | 1287 | return $field_value; |
1288 | 1288 | } |
1289 | 1289 | |
1290 | -add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 ); |
|
1290 | +add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3); |
|
1291 | 1291 | |
1292 | 1292 | |
1293 | 1293 | /** |
@@ -1304,17 +1304,17 @@ discard block |
||
1304 | 1304 | * |
1305 | 1305 | * @return string |
1306 | 1306 | */ |
1307 | -function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ) { |
|
1308 | - $offline_donation = give_get_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true ); |
|
1307 | +function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) { |
|
1308 | + $offline_donation = give_get_meta($postid, '_give_offline_donation_enable_billing_fields_single', true); |
|
1309 | 1309 | |
1310 | - if ( 'on' === $offline_donation ) { |
|
1310 | + if ('on' === $offline_donation) { |
|
1311 | 1311 | $field_value = 'enabled'; |
1312 | 1312 | } |
1313 | 1313 | |
1314 | 1314 | return $field_value; |
1315 | 1315 | } |
1316 | 1316 | |
1317 | -add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 ); |
|
1317 | +add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3); |
|
1318 | 1318 | |
1319 | 1319 | |
1320 | 1320 | /** |
@@ -1330,17 +1330,17 @@ discard block |
||
1330 | 1330 | * |
1331 | 1331 | * @return string |
1332 | 1332 | */ |
1333 | -function _give_custom_amount_field_value( $field_value, $field, $postid ) { |
|
1334 | - $custom_amount = give_get_meta( $postid, '_give_custom_amount', true ); |
|
1333 | +function _give_custom_amount_field_value($field_value, $field, $postid) { |
|
1334 | + $custom_amount = give_get_meta($postid, '_give_custom_amount', true); |
|
1335 | 1335 | |
1336 | - if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) { |
|
1337 | - $field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' ); |
|
1336 | + if (in_array($custom_amount, array('yes', 'no'))) { |
|
1337 | + $field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled'); |
|
1338 | 1338 | } |
1339 | 1339 | |
1340 | 1340 | return $field_value; |
1341 | 1341 | } |
1342 | 1342 | |
1343 | -add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 ); |
|
1343 | +add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3); |
|
1344 | 1344 | |
1345 | 1345 | |
1346 | 1346 | /** |
@@ -1356,17 +1356,17 @@ discard block |
||
1356 | 1356 | * |
1357 | 1357 | * @return string |
1358 | 1358 | */ |
1359 | -function _give_goal_option_field_value( $field_value, $field, $postid ) { |
|
1360 | - $goal_option = give_get_meta( $postid, '_give_goal_option', true ); |
|
1359 | +function _give_goal_option_field_value($field_value, $field, $postid) { |
|
1360 | + $goal_option = give_get_meta($postid, '_give_goal_option', true); |
|
1361 | 1361 | |
1362 | - if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) { |
|
1363 | - $field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' ); |
|
1362 | + if (in_array($goal_option, array('yes', 'no'))) { |
|
1363 | + $field_value = ('yes' === $goal_option ? 'enabled' : 'disabled'); |
|
1364 | 1364 | } |
1365 | 1365 | |
1366 | 1366 | return $field_value; |
1367 | 1367 | } |
1368 | 1368 | |
1369 | -add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 ); |
|
1369 | +add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3); |
|
1370 | 1370 | |
1371 | 1371 | /** |
1372 | 1372 | * Set value for Donation Goal --> close Form. |
@@ -1382,17 +1382,17 @@ discard block |
||
1382 | 1382 | * |
1383 | 1383 | * @return string |
1384 | 1384 | */ |
1385 | -function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) { |
|
1386 | - $close_form = give_get_meta( $postid, '_give_close_form_when_goal_achieved', true ); |
|
1385 | +function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) { |
|
1386 | + $close_form = give_get_meta($postid, '_give_close_form_when_goal_achieved', true); |
|
1387 | 1387 | |
1388 | - if ( in_array( $close_form, array( 'yes', 'no' ) ) ) { |
|
1389 | - $field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' ); |
|
1388 | + if (in_array($close_form, array('yes', 'no'))) { |
|
1389 | + $field_value = ('yes' === $close_form ? 'enabled' : 'disabled'); |
|
1390 | 1390 | } |
1391 | 1391 | |
1392 | 1392 | return $field_value; |
1393 | 1393 | } |
1394 | 1394 | |
1395 | -add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 ); |
|
1395 | +add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3); |
|
1396 | 1396 | |
1397 | 1397 | |
1398 | 1398 | /** |
@@ -1408,17 +1408,17 @@ discard block |
||
1408 | 1408 | * |
1409 | 1409 | * @return string |
1410 | 1410 | */ |
1411 | -function _give_logged_in_only_value( $field_value, $field, $postid ) { |
|
1412 | - $guest_donation = give_get_meta( $postid, '_give_logged_in_only', true ); |
|
1411 | +function _give_logged_in_only_value($field_value, $field, $postid) { |
|
1412 | + $guest_donation = give_get_meta($postid, '_give_logged_in_only', true); |
|
1413 | 1413 | |
1414 | - if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) { |
|
1415 | - $field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' ); |
|
1414 | + if (in_array($guest_donation, array('yes', 'no'))) { |
|
1415 | + $field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled'); |
|
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | return $field_value; |
1419 | 1419 | } |
1420 | 1420 | |
1421 | -add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 ); |
|
1421 | +add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3); |
|
1422 | 1422 | |
1423 | 1423 | /** |
1424 | 1424 | * Set value for Offline Donations --> Offline Donations. |
@@ -1434,17 +1434,17 @@ discard block |
||
1434 | 1434 | * |
1435 | 1435 | * @return string |
1436 | 1436 | */ |
1437 | -function _give_customize_offline_donations_value( $field_value, $field, $postid ) { |
|
1438 | - $customize_offline_text = give_get_meta( $postid, '_give_customize_offline_donations', true ); |
|
1437 | +function _give_customize_offline_donations_value($field_value, $field, $postid) { |
|
1438 | + $customize_offline_text = give_get_meta($postid, '_give_customize_offline_donations', true); |
|
1439 | 1439 | |
1440 | - if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) { |
|
1441 | - $field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' ); |
|
1440 | + if (in_array($customize_offline_text, array('yes', 'no'))) { |
|
1441 | + $field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled'); |
|
1442 | 1442 | } |
1443 | 1443 | |
1444 | 1444 | return $field_value; |
1445 | 1445 | } |
1446 | 1446 | |
1447 | -add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 ); |
|
1447 | +add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3); |
|
1448 | 1448 | |
1449 | 1449 | |
1450 | 1450 | /** |
@@ -1459,14 +1459,14 @@ discard block |
||
1459 | 1459 | * |
1460 | 1460 | * @return mixed |
1461 | 1461 | */ |
1462 | -function _give_set_multi_level_repeater_field_id( $field_id, $field, $fields, $default ) { |
|
1462 | +function _give_set_multi_level_repeater_field_id($field_id, $field, $fields, $default) { |
|
1463 | 1463 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
1464 | 1464 | $field_id = "{$fields['id']}[{$row_placeholder}][{$field['id']}][level_id]"; |
1465 | 1465 | |
1466 | 1466 | return $field_id; |
1467 | 1467 | } |
1468 | 1468 | |
1469 | -add_filter( 'give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4 ); |
|
1469 | +add_filter('give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4); |
|
1470 | 1470 | |
1471 | 1471 | /** |
1472 | 1472 | * Set repeater field value for multi donation form. |
@@ -1480,13 +1480,13 @@ discard block |
||
1480 | 1480 | * |
1481 | 1481 | * @return mixed |
1482 | 1482 | */ |
1483 | -function _give_set_multi_level_repeater_field_value( $field_value, $field, $field_group, $fields ) { |
|
1484 | - $field_value = $field_group[ $field['id'] ]['level_id']; |
|
1483 | +function _give_set_multi_level_repeater_field_value($field_value, $field, $field_group, $fields) { |
|
1484 | + $field_value = $field_group[$field['id']]['level_id']; |
|
1485 | 1485 | |
1486 | 1486 | return $field_value; |
1487 | 1487 | } |
1488 | 1488 | |
1489 | -add_filter( 'give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4 ); |
|
1489 | +add_filter('give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4); |
|
1490 | 1490 | |
1491 | 1491 | /** |
1492 | 1492 | * Set default value for _give_id field. |
@@ -1497,11 +1497,11 @@ discard block |
||
1497 | 1497 | * |
1498 | 1498 | * @return string |
1499 | 1499 | */ |
1500 | -function _give_set_field_give_id_default_value( $field ) { |
|
1500 | +function _give_set_field_give_id_default_value($field) { |
|
1501 | 1501 | return 0; |
1502 | 1502 | } |
1503 | 1503 | |
1504 | -add_filter( 'give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value' ); |
|
1504 | +add_filter('give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value'); |
|
1505 | 1505 | |
1506 | 1506 | /** |
1507 | 1507 | * Set default value for _give_default field. |
@@ -1512,11 +1512,11 @@ discard block |
||
1512 | 1512 | * |
1513 | 1513 | * @return string |
1514 | 1514 | */ |
1515 | -function _give_set_field_give_default_default_value( $field ) { |
|
1515 | +function _give_set_field_give_default_default_value($field) { |
|
1516 | 1516 | return 'default'; |
1517 | 1517 | } |
1518 | 1518 | |
1519 | -add_filter( 'give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value' ); |
|
1519 | +add_filter('give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value'); |
|
1520 | 1520 | |
1521 | 1521 | /** |
1522 | 1522 | * Set repeater field editor id for field type wysiwyg. |
@@ -1528,12 +1528,12 @@ discard block |
||
1528 | 1528 | * |
1529 | 1529 | * @return string |
1530 | 1530 | */ |
1531 | -function give_repeater_field_set_editor_id( $field_name, $field ) { |
|
1532 | - if ( isset( $field['repeatable_field_id'] ) && 'wysiwyg' == $field['type'] ) { |
|
1533 | - $field_name = '_give_repeater_' . uniqid() . '_wysiwyg'; |
|
1531 | +function give_repeater_field_set_editor_id($field_name, $field) { |
|
1532 | + if (isset($field['repeatable_field_id']) && 'wysiwyg' == $field['type']) { |
|
1533 | + $field_name = '_give_repeater_'.uniqid().'_wysiwyg'; |
|
1534 | 1534 | } |
1535 | 1535 | |
1536 | 1536 | return $field_name; |
1537 | 1537 | } |
1538 | 1538 | |
1539 | -add_filter( 'give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2 ); |
|
1539 | +add_filter('give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | give_ignore_user_abort(); |
43 | 43 | |
44 | 44 | nocache_headers(); |
45 | - header( 'Content-Type: application/json; charset=utf-8' ); |
|
46 | - header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_core_settings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.json' ); |
|
47 | - header( 'Expires: 0' ); |
|
45 | + header('Content-Type: application/json; charset=utf-8'); |
|
46 | + header('Content-Disposition: attachment; filename='.apply_filters('give_core_settings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.json'); |
|
47 | + header('Expires: 0'); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -54,18 +54,18 @@ discard block |
||
54 | 54 | * @since 1.8.17 |
55 | 55 | */ |
56 | 56 | public function json_core_settings_export() { |
57 | - $settings_excludes = isset( $_POST['settings_export_excludes'] ) ? give_clean( $_POST['settings_export_excludes'] ) : array(); |
|
58 | - $give_settings = get_option( 'give_settings' ); |
|
57 | + $settings_excludes = isset($_POST['settings_export_excludes']) ? give_clean($_POST['settings_export_excludes']) : array(); |
|
58 | + $give_settings = get_option('give_settings'); |
|
59 | 59 | |
60 | - if ( is_array( $settings_excludes ) && ! empty( $settings_excludes ) ) { |
|
61 | - foreach ( $settings_excludes as $key => $value ) { |
|
62 | - if ( give_is_setting_enabled( $value ) ) { |
|
63 | - unset( $give_settings[ $key ] ); |
|
60 | + if (is_array($settings_excludes) && ! empty($settings_excludes)) { |
|
61 | + foreach ($settings_excludes as $key => $value) { |
|
62 | + if (give_is_setting_enabled($value)) { |
|
63 | + unset($give_settings[$key]); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | - echo wp_json_encode( $give_settings ); |
|
68 | + echo wp_json_encode($give_settings); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @since 1.8.17 |
76 | 76 | */ |
77 | 77 | public function export() { |
78 | - if ( ! $this->can_export() ) { |
|
79 | - wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
78 | + if ( ! $this->can_export()) { |
|
79 | + wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | // Set headers. |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Admin View: Exports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } ?> |
9 | 9 | |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @since 1.0 |
20 | 20 | */ |
21 | - do_action( 'give_tools_tab_export_content_top' ); |
|
21 | + do_action('give_tools_tab_export_content_top'); |
|
22 | 22 | ?> |
23 | 23 | |
24 | 24 | <table class="widefat export-options-table give-table striped"> |
25 | 25 | <thead> |
26 | 26 | <tr> |
27 | - <th scope="col"><?php esc_html_e( 'Export Type', 'give' ); ?></th> |
|
28 | - <th scope="col"><?php esc_html_e( 'Export Options', 'give' ); ?></th> |
|
27 | + <th scope="col"><?php esc_html_e('Export Type', 'give'); ?></th> |
|
28 | + <th scope="col"><?php esc_html_e('Export Options', 'give'); ?></th> |
|
29 | 29 | </tr> |
30 | 30 | </thead> |
31 | 31 | <tbody> |
@@ -38,42 +38,42 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @since 1.0 |
40 | 40 | */ |
41 | - do_action( 'give_tools_tab_export_table_top' ); |
|
41 | + do_action('give_tools_tab_export_table_top'); |
|
42 | 42 | ?> |
43 | 43 | <tr class="give-export-pdf-sales-earnings"> |
44 | 44 | <td scope="row" class="row-title"> |
45 | 45 | <h3> |
46 | - <span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span> |
|
46 | + <span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span> |
|
47 | 47 | </h3> |
48 | - <p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
48 | + <p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
49 | 49 | </td> |
50 | 50 | <td> |
51 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"> |
|
52 | - <?php esc_html_e( 'Generate PDF', 'give' ); ?> |
|
51 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"> |
|
52 | + <?php esc_html_e('Generate PDF', 'give'); ?> |
|
53 | 53 | </a> |
54 | 54 | </td> |
55 | 55 | </tr> |
56 | 56 | <tr class="give-export-sales-earnings"> |
57 | 57 | <td scope="row" class="row-title"> |
58 | 58 | <h3> |
59 | - <span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span> |
|
59 | + <span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span> |
|
60 | 60 | </h3> |
61 | - <p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
61 | + <p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
62 | 62 | </td> |
63 | 63 | <td> |
64 | 64 | <form method="post"> |
65 | 65 | <?php |
66 | 66 | printf( |
67 | 67 | /* translators: 1: start date dropdown 2: end date dropdown */ |
68 | - esc_html__( '%1$s to %2$s', 'give' ), |
|
69 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
70 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
68 | + esc_html__('%1$s to %2$s', 'give'), |
|
69 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
70 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
71 | 71 | ); |
72 | 72 | ?> |
73 | 73 | <input type="hidden" name="give-action" |
74 | 74 | value="earnings_export"/> |
75 | 75 | <input type="submit" |
76 | - value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
76 | + value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
77 | 77 | class="button-secondary"/> |
78 | 78 | </form> |
79 | 79 | </td> |
@@ -81,37 +81,37 @@ discard block |
||
81 | 81 | <tr class="give-export-payment-history"> |
82 | 82 | <td scope="row" class="row-title"> |
83 | 83 | <h3> |
84 | - <span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span> |
|
84 | + <span><?php esc_html_e('Export Donation History', 'give'); ?></span> |
|
85 | 85 | </h3> |
86 | - <p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
86 | + <p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
87 | 87 | </td> |
88 | 88 | <td> |
89 | 89 | <form id="give-export-payments" |
90 | 90 | class="give-export-form" method="post"> |
91 | 91 | <?php |
92 | - echo Give()->html->date_field( array( |
|
92 | + echo Give()->html->date_field(array( |
|
93 | 93 | 'id' => 'give-payment-export-start', |
94 | 94 | 'name' => 'start', |
95 | - 'placeholder' => esc_attr__( 'Start date', 'give' ), |
|
96 | - ) ); |
|
95 | + 'placeholder' => esc_attr__('Start date', 'give'), |
|
96 | + )); |
|
97 | 97 | |
98 | - echo Give()->html->date_field( array( |
|
98 | + echo Give()->html->date_field(array( |
|
99 | 99 | 'id' => 'give-payment-export-end', |
100 | 100 | 'name' => 'end', |
101 | - 'placeholder' => esc_attr__( 'End date', 'give' ), |
|
102 | - ) ); |
|
101 | + 'placeholder' => esc_attr__('End date', 'give'), |
|
102 | + )); |
|
103 | 103 | ?> |
104 | 104 | <select name="status"> |
105 | - <option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option> |
|
105 | + <option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option> |
|
106 | 106 | <?php |
107 | 107 | $statuses = give_get_payment_statuses(); |
108 | - foreach ( $statuses as $status => $label ) { |
|
109 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
108 | + foreach ($statuses as $status => $label) { |
|
109 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
110 | 110 | } |
111 | 111 | ?> |
112 | 112 | </select> |
113 | 113 | <?php |
114 | - if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) { |
|
114 | + if (give_is_setting_enabled(give_get_option('categories'))) { |
|
115 | 115 | echo Give()->html->category_dropdown( |
116 | 116 | 'give_forms_categories[]', |
117 | 117 | 0, |
@@ -121,12 +121,12 @@ discard block |
||
121 | 121 | 'multiple' => true, |
122 | 122 | 'selected' => array(), |
123 | 123 | 'show_option_all' => false, |
124 | - 'placeholder' => __( 'Choose one or more from categories', 'give' ), |
|
124 | + 'placeholder' => __('Choose one or more from categories', 'give'), |
|
125 | 125 | ) |
126 | 126 | ); |
127 | 127 | } |
128 | 128 | |
129 | - if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) { |
|
129 | + if (give_is_setting_enabled(give_get_option('tags'))) { |
|
130 | 130 | echo Give()->html->tags_dropdown( |
131 | 131 | 'give_forms_tags[]', |
132 | 132 | 0, |
@@ -136,18 +136,18 @@ discard block |
||
136 | 136 | 'multiple' => true, |
137 | 137 | 'selected' => array(), |
138 | 138 | 'show_option_all' => false, |
139 | - 'placeholder' => __( 'Choose one or more from tags', 'give' ), |
|
139 | + 'placeholder' => __('Choose one or more from tags', 'give'), |
|
140 | 140 | ) |
141 | 141 | ); |
142 | 142 | } |
143 | 143 | |
144 | - wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); |
|
144 | + wp_nonce_field('give_ajax_export', 'give_ajax_export'); |
|
145 | 145 | ?> |
146 | 146 | <input type="hidden" name="give-export-class" |
147 | 147 | value="Give_Batch_Payments_Export"/> |
148 | 148 | <span> |
149 | 149 | <input type="submit" |
150 | - value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
150 | + value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
151 | 151 | class="button-secondary"/> |
152 | 152 | <span class="spinner"></span> |
153 | 153 | </span> |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | <tr class="give-export-donors"> |
158 | 158 | <td scope="row" class="row-title"> |
159 | 159 | <h3> |
160 | - <span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span> |
|
160 | + <span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span> |
|
161 | 161 | </h3> |
162 | - <p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p> |
|
162 | + <p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p> |
|
163 | 163 | </td> |
164 | 164 | <td> |
165 | 165 | <form method="post" id="give_donor_export" |
@@ -167,93 +167,93 @@ discard block |
||
167 | 167 | |
168 | 168 | <?php |
169 | 169 | // Start Date form field for donors |
170 | - echo Give()->html->date_field( array( |
|
170 | + echo Give()->html->date_field(array( |
|
171 | 171 | 'id' => 'give_donor_export_start_date', |
172 | 172 | 'name' => 'donor_export_start_date', |
173 | - 'placeholder' => esc_attr__( 'Start date', 'give' ), |
|
174 | - ) ); |
|
173 | + 'placeholder' => esc_attr__('Start date', 'give'), |
|
174 | + )); |
|
175 | 175 | |
176 | 176 | // End Date form field for donors |
177 | - echo Give()->html->date_field( array( |
|
177 | + echo Give()->html->date_field(array( |
|
178 | 178 | 'id' => 'give_donor_export_end_date', |
179 | 179 | 'name' => 'donor_export_end_date', |
180 | - 'placeholder' => esc_attr__( 'End date', 'give' ), |
|
181 | - ) ); |
|
180 | + 'placeholder' => esc_attr__('End date', 'give'), |
|
181 | + )); |
|
182 | 182 | |
183 | 183 | // Donation forms dropdown for donors export |
184 | - echo Give()->html->forms_dropdown( array( |
|
184 | + echo Give()->html->forms_dropdown(array( |
|
185 | 185 | 'name' => 'forms', |
186 | 186 | 'id' => 'give_donor_export_form', |
187 | 187 | 'chosen' => true, |
188 | - ) ); |
|
188 | + )); |
|
189 | 189 | ?> |
190 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
190 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
191 | 191 | |
192 | 192 | <div id="export-donor-options-wrap" |
193 | 193 | class="give-clearfix"> |
194 | - <p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p> |
|
194 | + <p><?php esc_html_e('Export Columns:', 'give'); ?></p> |
|
195 | 195 | <ul id="give-export-option-ul"> |
196 | 196 | <li> |
197 | 197 | <label for="give-export-fullname"> |
198 | 198 | <input type="checkbox" checked |
199 | 199 | name="give_export_option[full_name]" |
200 | - id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?> |
|
200 | + id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?> |
|
201 | 201 | </label> |
202 | 202 | </li> |
203 | 203 | <li> |
204 | 204 | <label for="give-export-email"> |
205 | 205 | <input type="checkbox" checked |
206 | 206 | name="give_export_option[email]" |
207 | - id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?> |
|
207 | + id="give-export-email"><?php esc_html_e('Email', 'give'); ?> |
|
208 | 208 | </label> |
209 | 209 | </li> |
210 | 210 | <li> |
211 | 211 | <label for="give-export-address"> |
212 | 212 | <input type="checkbox" checked |
213 | 213 | name="give_export_option[address]" |
214 | - id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?> |
|
214 | + id="give-export-address"><?php esc_html_e('Address', 'give'); ?> |
|
215 | 215 | </label> |
216 | 216 | </li> |
217 | 217 | <li> |
218 | 218 | <label for="give-export-userid"> |
219 | 219 | <input type="checkbox" checked |
220 | 220 | name="give_export_option[userid]" |
221 | - id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?> |
|
221 | + id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?> |
|
222 | 222 | </label> |
223 | 223 | </li> |
224 | 224 | <li> |
225 | 225 | <label for="give-export-donation-form"> |
226 | 226 | <input type="checkbox" checked |
227 | 227 | name="give_export_option[donation_form]" |
228 | - id="give-export-donation-form"><?php esc_html_e( 'Donation Form', 'give' ); ?> |
|
228 | + id="give-export-donation-form"><?php esc_html_e('Donation Form', 'give'); ?> |
|
229 | 229 | </label> |
230 | 230 | </li> |
231 | 231 | <li> |
232 | 232 | <label for="give-export-first-donation-date"> |
233 | 233 | <input type="checkbox" checked |
234 | 234 | name="give_export_option[date_first_donated]" |
235 | - id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?> |
|
235 | + id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?> |
|
236 | 236 | </label> |
237 | 237 | </li> |
238 | 238 | <li> |
239 | 239 | <label for="give-export-donation-number"> |
240 | 240 | <input type="checkbox" checked |
241 | 241 | name="give_export_option[donations]" |
242 | - id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?> |
|
242 | + id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?> |
|
243 | 243 | </label> |
244 | 244 | </li> |
245 | 245 | <li> |
246 | 246 | <label for="give-export-donation-sum"> |
247 | 247 | <input type="checkbox" checked |
248 | 248 | name="give_export_option[donation_sum]" |
249 | - id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?> |
|
249 | + id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?> |
|
250 | 250 | </label> |
251 | 251 | </li> |
252 | 252 | </ul> |
253 | 253 | </div> |
254 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
254 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
255 | 255 | <input type="hidden" name="give-export-class" value="Give_Batch_Donors_Export"/> |
256 | - <input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid( 'give_' ); ?>"/> |
|
256 | + <input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid('give_'); ?>"/> |
|
257 | 257 | </form> |
258 | 258 | </td> |
259 | 259 | </tr> |
@@ -261,32 +261,32 @@ discard block |
||
261 | 261 | <tr class="give-export-core-settings"> |
262 | 262 | <td scope="row" class="row-title"> |
263 | 263 | <h3> |
264 | - <span><?php esc_html_e( 'Export Give Settings', 'give' ); ?></span> |
|
264 | + <span><?php esc_html_e('Export Give Settings', 'give'); ?></span> |
|
265 | 265 | </h3> |
266 | - <p><?php esc_html_e( 'Download an export of Give\'s settings and import it in a new WordPress installation.', 'give' ); ?></p> |
|
266 | + <p><?php esc_html_e('Download an export of Give\'s settings and import it in a new WordPress installation.', 'give'); ?></p> |
|
267 | 267 | </td> |
268 | 268 | <td> |
269 | 269 | <form method="post"> |
270 | 270 | <?php |
271 | - $export_excludes = apply_filters( 'settings_export_excludes', array() ); |
|
272 | - if ( ! empty( $export_excludes ) ) { |
|
271 | + $export_excludes = apply_filters('settings_export_excludes', array()); |
|
272 | + if ( ! empty($export_excludes)) { |
|
273 | 273 | ?> |
274 | - <i class="settings-excludes-title"><?php echo __( 'Checked options from the list will not be exported.', 'give' ); ?></i> |
|
274 | + <i class="settings-excludes-title"><?php echo __('Checked options from the list will not be exported.', 'give'); ?></i> |
|
275 | 275 | <ul class="settings-excludes-list"> |
276 | - <?php foreach ( $export_excludes as $option_key => $option_label ) { ?> |
|
276 | + <?php foreach ($export_excludes as $option_key => $option_label) { ?> |
|
277 | 277 | <li> |
278 | 278 | <label for="settings_export_excludes[<?php echo $option_key?>]"> |
279 | 279 | <input |
280 | 280 | type="checkbox" checked |
281 | 281 | name="settings_export_excludes[<?php echo $option_key?>]" |
282 | - id="settings_export_excludes[<?php echo $option_key?>]"><?php echo esc_html( $option_label ); ?> |
|
282 | + id="settings_export_excludes[<?php echo $option_key?>]"><?php echo esc_html($option_label); ?> |
|
283 | 283 | </label> |
284 | 284 | </li> |
285 | 285 | <?php } ?> |
286 | 286 | </ul> |
287 | 287 | <?php } ?> |
288 | 288 | <input type="hidden" name="give-action" value="core_settings_export"/> |
289 | - <input type="submit" value="<?php esc_attr_e( 'Export JSON', 'give' ); ?>" class="button-secondary"/> |
|
289 | + <input type="submit" value="<?php esc_attr_e('Export JSON', 'give'); ?>" class="button-secondary"/> |
|
290 | 290 | </form> |
291 | 291 | </td> |
292 | 292 | </tr> |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * |
300 | 300 | * @since 1.0 |
301 | 301 | */ |
302 | - do_action( 'give_tools_tab_export_table_bottom' ); |
|
302 | + do_action('give_tools_tab_export_table_bottom'); |
|
303 | 303 | ?> |
304 | 304 | </tbody> |
305 | 305 | </table> |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * |
311 | 311 | * @since 1.0 |
312 | 312 | */ |
313 | - do_action( 'give_tools_tab_export_content_bottom' ); |
|
313 | + do_action('give_tools_tab_export_content_bottom'); |
|
314 | 314 | ?> |
315 | 315 | |
316 | 316 | </div> |
@@ -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 | |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | * @param int|bool $_id Post id. Default is false. |
338 | 338 | * @param array $_args Arguments passed. |
339 | 339 | */ |
340 | - public function __construct( $_id = false, $_args = array() ) { |
|
340 | + public function __construct($_id = false, $_args = array()) { |
|
341 | 341 | |
342 | - $donation_form = WP_Post::get_instance( $_id ); |
|
342 | + $donation_form = WP_Post::get_instance($_id); |
|
343 | 343 | |
344 | - return $this->setup_donation_form( $donation_form ); |
|
344 | + return $this->setup_donation_form($donation_form); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -354,23 +354,23 @@ discard block |
||
354 | 354 | * |
355 | 355 | * @return bool If the setup was successful or not. |
356 | 356 | */ |
357 | - private function setup_donation_form( $donation_form ) { |
|
357 | + private function setup_donation_form($donation_form) { |
|
358 | 358 | |
359 | - if ( ! is_object( $donation_form ) ) { |
|
359 | + if ( ! is_object($donation_form)) { |
|
360 | 360 | return false; |
361 | 361 | } |
362 | 362 | |
363 | - if ( ! is_a( $donation_form, 'WP_Post' ) ) { |
|
363 | + if ( ! is_a($donation_form, 'WP_Post')) { |
|
364 | 364 | return false; |
365 | 365 | } |
366 | 366 | |
367 | - if ( 'give_forms' !== $donation_form->post_type ) { |
|
367 | + if ('give_forms' !== $donation_form->post_type) { |
|
368 | 368 | return false; |
369 | 369 | } |
370 | 370 | |
371 | - foreach ( $donation_form as $key => $value ) { |
|
371 | + foreach ($donation_form as $key => $value) { |
|
372 | 372 | |
373 | - switch ( $key ) { |
|
373 | + switch ($key) { |
|
374 | 374 | |
375 | 375 | default: |
376 | 376 | $this->$key = $value; |
@@ -394,16 +394,16 @@ discard block |
||
394 | 394 | * |
395 | 395 | * @return mixed |
396 | 396 | */ |
397 | - public function __get( $key ) { |
|
397 | + public function __get($key) { |
|
398 | 398 | |
399 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
399 | + if (method_exists($this, 'get_'.$key)) { |
|
400 | 400 | |
401 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
401 | + return call_user_func(array($this, 'get_'.$key)); |
|
402 | 402 | |
403 | 403 | } else { |
404 | 404 | |
405 | 405 | /* translators: %s: property key */ |
406 | - return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
406 | + return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
407 | 407 | |
408 | 408 | } |
409 | 409 | |
@@ -419,30 +419,30 @@ discard block |
||
419 | 419 | * |
420 | 420 | * @return bool|int False if data isn't passed and class not instantiated for creation, or New Form ID. |
421 | 421 | */ |
422 | - public function create( $data = array() ) { |
|
422 | + public function create($data = array()) { |
|
423 | 423 | |
424 | - if ( $this->id != 0 ) { |
|
424 | + if ($this->id != 0) { |
|
425 | 425 | return false; |
426 | 426 | } |
427 | 427 | |
428 | 428 | $defaults = array( |
429 | 429 | 'post_type' => 'give_forms', |
430 | 430 | 'post_status' => 'draft', |
431 | - 'post_title' => __( 'New Donation Form', 'give' ), |
|
431 | + 'post_title' => __('New Donation Form', 'give'), |
|
432 | 432 | ); |
433 | 433 | |
434 | - $args = wp_parse_args( $data, $defaults ); |
|
434 | + $args = wp_parse_args($data, $defaults); |
|
435 | 435 | |
436 | 436 | /** |
437 | 437 | * Fired before a donation form is created |
438 | 438 | * |
439 | 439 | * @param array $args The post object arguments used for creation. |
440 | 440 | */ |
441 | - do_action( 'give_form_pre_create', $args ); |
|
441 | + do_action('give_form_pre_create', $args); |
|
442 | 442 | |
443 | - $id = wp_insert_post( $args, true ); |
|
443 | + $id = wp_insert_post($args, true); |
|
444 | 444 | |
445 | - $donation_form = WP_Post::get_instance( $id ); |
|
445 | + $donation_form = WP_Post::get_instance($id); |
|
446 | 446 | |
447 | 447 | /** |
448 | 448 | * Fired after a donation form is created |
@@ -450,9 +450,9 @@ discard block |
||
450 | 450 | * @param int $id The post ID of the created item. |
451 | 451 | * @param array $args The post object arguments used for creation. |
452 | 452 | */ |
453 | - do_action( 'give_form_post_create', $id, $args ); |
|
453 | + do_action('give_form_post_create', $id, $args); |
|
454 | 454 | |
455 | - return $this->setup_donation_form( $donation_form ); |
|
455 | + return $this->setup_donation_form($donation_form); |
|
456 | 456 | |
457 | 457 | } |
458 | 458 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @return string Donation form name. |
478 | 478 | */ |
479 | 479 | public function get_name() { |
480 | - return get_the_title( $this->ID ); |
|
480 | + return get_the_title($this->ID); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | /** |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | */ |
491 | 491 | public function get_price() { |
492 | 492 | |
493 | - if ( ! isset( $this->price ) ) { |
|
493 | + if ( ! isset($this->price)) { |
|
494 | 494 | |
495 | 495 | $this->price = give_maybe_sanitize_amount( |
496 | 496 | give_get_meta( |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | ) |
501 | 501 | ); |
502 | 502 | |
503 | - if ( ! $this->price ) { |
|
503 | + if ( ! $this->price) { |
|
504 | 504 | $this->price = 0; |
505 | 505 | } |
506 | 506 | |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | * @param string $price The donation form price. |
515 | 515 | * @param string|int $id The form ID. |
516 | 516 | */ |
517 | - return apply_filters( 'give_get_set_price', $this->price, $this->ID ); |
|
517 | + return apply_filters('give_get_set_price', $this->price, $this->ID); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | /** |
@@ -527,17 +527,17 @@ discard block |
||
527 | 527 | */ |
528 | 528 | public function get_minimum_price() { |
529 | 529 | |
530 | - if ( ! isset( $this->minimum_price ) ) { |
|
530 | + if ( ! isset($this->minimum_price)) { |
|
531 | 531 | |
532 | - $this->minimum_price = give_get_meta( $this->ID, '_give_custom_amount_minimum', true ); |
|
532 | + $this->minimum_price = give_get_meta($this->ID, '_give_custom_amount_minimum', true); |
|
533 | 533 | |
534 | - if ( ! $this->is_custom_price_mode() ) { |
|
534 | + if ( ! $this->is_custom_price_mode()) { |
|
535 | 535 | $this->minimum_price = 0; |
536 | 536 | } |
537 | 537 | |
538 | 538 | } |
539 | 539 | |
540 | - return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID ); |
|
540 | + return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | /** |
@@ -550,9 +550,9 @@ discard block |
||
550 | 550 | */ |
551 | 551 | public function get_prices() { |
552 | 552 | |
553 | - if ( ! isset( $this->prices ) ) { |
|
553 | + if ( ! isset($this->prices)) { |
|
554 | 554 | |
555 | - $this->prices = give_get_meta( $this->ID, '_give_donation_levels', true ); |
|
555 | + $this->prices = give_get_meta($this->ID, '_give_donation_levels', true); |
|
556 | 556 | |
557 | 557 | } |
558 | 558 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | * @param array $prices The array of mulit-level prices. |
565 | 565 | * @param int|string $ID The ID of the form. |
566 | 566 | */ |
567 | - return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID ); |
|
567 | + return apply_filters('give_get_donation_levels', $this->prices, $this->ID); |
|
568 | 568 | |
569 | 569 | } |
570 | 570 | |
@@ -578,18 +578,18 @@ discard block |
||
578 | 578 | * |
579 | 579 | * @return array|null |
580 | 580 | */ |
581 | - public function get_level_info( $price_id ) { |
|
581 | + public function get_level_info($price_id) { |
|
582 | 582 | $level_info = array(); |
583 | 583 | |
584 | 584 | // Bailout. |
585 | - if ( 'multi' !== $this->get_type() ) { |
|
585 | + if ('multi' !== $this->get_type()) { |
|
586 | 586 | return null; |
587 | - } elseif ( ! ( $levels = $this->get_prices() ) ) { |
|
587 | + } elseif ( ! ($levels = $this->get_prices())) { |
|
588 | 588 | return $level_info; |
589 | 589 | } |
590 | 590 | |
591 | - foreach ( $levels as $level ) { |
|
592 | - if( $price_id === $level['_give_id']['level_id'] ) { |
|
591 | + foreach ($levels as $level) { |
|
592 | + if ($price_id === $level['_give_id']['level_id']) { |
|
593 | 593 | $level_info = $level; |
594 | 594 | break; |
595 | 595 | } |
@@ -609,21 +609,21 @@ discard block |
||
609 | 609 | */ |
610 | 610 | public function get_goal() { |
611 | 611 | |
612 | - if ( ! isset( $this->goal ) ) { |
|
612 | + if ( ! isset($this->goal)) { |
|
613 | 613 | |
614 | - if ( 'donation' === give_get_form_goal_format( $this->ID ) ) { |
|
615 | - $this->goal = give_get_meta( $this->ID, '_give_number_of_donation_goal', true ); |
|
614 | + if ('donation' === give_get_form_goal_format($this->ID)) { |
|
615 | + $this->goal = give_get_meta($this->ID, '_give_number_of_donation_goal', true); |
|
616 | 616 | } else { |
617 | - $this->goal = give_get_meta( $this->ID, '_give_set_goal', true ); |
|
617 | + $this->goal = give_get_meta($this->ID, '_give_set_goal', true); |
|
618 | 618 | } |
619 | 619 | |
620 | - if ( ! $this->goal ) { |
|
620 | + if ( ! $this->goal) { |
|
621 | 621 | $this->goal = 0; |
622 | 622 | } |
623 | 623 | |
624 | 624 | } |
625 | 625 | |
626 | - return apply_filters( 'give_get_set_goal', $this->goal, $this->ID ); |
|
626 | + return apply_filters('give_get_set_goal', $this->goal, $this->ID); |
|
627 | 627 | |
628 | 628 | } |
629 | 629 | |
@@ -637,10 +637,10 @@ discard block |
||
637 | 637 | */ |
638 | 638 | public function is_single_price_mode() { |
639 | 639 | |
640 | - $option = give_get_meta( $this->ID, '_give_price_option', true ); |
|
640 | + $option = give_get_meta($this->ID, '_give_price_option', true); |
|
641 | 641 | $ret = 0; |
642 | 642 | |
643 | - if ( empty( $option ) || $option === 'set' ) { |
|
643 | + if (empty($option) || $option === 'set') { |
|
644 | 644 | $ret = 1; |
645 | 645 | } |
646 | 646 | |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | * @param bool $ret Is donation form in single price mode? |
653 | 653 | * @param int|string $ID The ID of the donation form. |
654 | 654 | */ |
655 | - return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID ); |
|
655 | + return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID); |
|
656 | 656 | |
657 | 657 | } |
658 | 658 | |
@@ -666,10 +666,10 @@ discard block |
||
666 | 666 | */ |
667 | 667 | public function is_custom_price_mode() { |
668 | 668 | |
669 | - $option = give_get_meta( $this->ID, '_give_custom_amount', true ); |
|
669 | + $option = give_get_meta($this->ID, '_give_custom_amount', true); |
|
670 | 670 | $ret = 0; |
671 | 671 | |
672 | - if ( give_is_setting_enabled( $option ) ) { |
|
672 | + if (give_is_setting_enabled($option)) { |
|
673 | 673 | $ret = 1; |
674 | 674 | } |
675 | 675 | |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | * @param bool $ret Is donation form in custom price mode? |
682 | 682 | * @param int|string $ID The ID of the donation form. |
683 | 683 | */ |
684 | - return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID ); |
|
684 | + return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID); |
|
685 | 685 | |
686 | 686 | } |
687 | 687 | |
@@ -695,20 +695,20 @@ discard block |
||
695 | 695 | * |
696 | 696 | * @return bool |
697 | 697 | */ |
698 | - public function is_custom_price( $amount ) { |
|
698 | + public function is_custom_price($amount) { |
|
699 | 699 | $result = false; |
700 | - $amount = give_maybe_sanitize_amount( $amount ); |
|
700 | + $amount = give_maybe_sanitize_amount($amount); |
|
701 | 701 | |
702 | - if ( $this->is_custom_price_mode() ) { |
|
702 | + if ($this->is_custom_price_mode()) { |
|
703 | 703 | |
704 | - if ( 'set' === $this->get_type() ) { |
|
705 | - if ( $amount !== $this->get_price() ) { |
|
704 | + if ('set' === $this->get_type()) { |
|
705 | + if ($amount !== $this->get_price()) { |
|
706 | 706 | $result = true; |
707 | 707 | } |
708 | 708 | |
709 | - } elseif ( 'multi' === $this->get_type() ) { |
|
710 | - $level_amounts = array_map( 'give_maybe_sanitize_amount', wp_list_pluck( $this->get_prices(), '_give_amount' ) ); |
|
711 | - $result = ! in_array( $amount, $level_amounts ); |
|
709 | + } elseif ('multi' === $this->get_type()) { |
|
710 | + $level_amounts = array_map('give_maybe_sanitize_amount', wp_list_pluck($this->get_prices(), '_give_amount')); |
|
711 | + $result = ! in_array($amount, $level_amounts); |
|
712 | 712 | } |
713 | 713 | } |
714 | 714 | |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | * |
722 | 722 | * @since 1.8.18 |
723 | 723 | */ |
724 | - return (bool) apply_filters( 'give_is_custom_price', $result, $amount, $this->ID ); |
|
724 | + return (bool) apply_filters('give_is_custom_price', $result, $amount, $this->ID); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | /** |
@@ -736,10 +736,10 @@ discard block |
||
736 | 736 | */ |
737 | 737 | public function has_variable_prices() { |
738 | 738 | |
739 | - $option = give_get_meta( $this->ID, '_give_price_option', true ); |
|
739 | + $option = give_get_meta($this->ID, '_give_price_option', true); |
|
740 | 740 | $ret = 0; |
741 | 741 | |
742 | - if ( $option === 'multi' ) { |
|
742 | + if ($option === 'multi') { |
|
743 | 743 | $ret = 1; |
744 | 744 | } |
745 | 745 | |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | * @param bool $ret Does donation form have variable prices? |
750 | 750 | * @param int|string $ID The ID of the donation form. |
751 | 751 | */ |
752 | - return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID ); |
|
752 | + return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID); |
|
753 | 753 | |
754 | 754 | } |
755 | 755 | |
@@ -763,17 +763,17 @@ discard block |
||
763 | 763 | */ |
764 | 764 | public function get_type() { |
765 | 765 | |
766 | - if ( ! isset( $this->type ) ) { |
|
766 | + if ( ! isset($this->type)) { |
|
767 | 767 | |
768 | - $this->type = give_get_meta( $this->ID, '_give_price_option', true ); |
|
768 | + $this->type = give_get_meta($this->ID, '_give_price_option', true); |
|
769 | 769 | |
770 | - if ( empty( $this->type ) ) { |
|
770 | + if (empty($this->type)) { |
|
771 | 771 | $this->type = 'set'; |
772 | 772 | } |
773 | 773 | |
774 | 774 | } |
775 | 775 | |
776 | - return apply_filters( 'give_get_form_type', $this->type, $this->ID ); |
|
776 | + return apply_filters('give_get_form_type', $this->type, $this->ID); |
|
777 | 777 | |
778 | 778 | } |
779 | 779 | |
@@ -789,23 +789,23 @@ discard block |
||
789 | 789 | * |
790 | 790 | * @return string |
791 | 791 | */ |
792 | - public function get_form_classes( $args ) { |
|
792 | + public function get_form_classes($args) { |
|
793 | 793 | |
794 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
794 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
795 | 795 | ? 'float-labels-enabled' |
796 | 796 | : ''; |
797 | 797 | |
798 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
798 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
799 | 799 | 'give-form', |
800 | - 'give-form-' . $this->ID, |
|
801 | - 'give-form-type-' . $this->get_type(), |
|
800 | + 'give-form-'.$this->ID, |
|
801 | + 'give-form-type-'.$this->get_type(), |
|
802 | 802 | $float_labels_option, |
803 | - ), $this->ID, $args ); |
|
803 | + ), $this->ID, $args); |
|
804 | 804 | |
805 | 805 | // Remove empty class names. |
806 | - $form_classes_array = array_filter( $form_classes_array ); |
|
806 | + $form_classes_array = array_filter($form_classes_array); |
|
807 | 807 | |
808 | - return implode( ' ', $form_classes_array ); |
|
808 | + return implode(' ', $form_classes_array); |
|
809 | 809 | |
810 | 810 | } |
811 | 811 | |
@@ -820,22 +820,22 @@ discard block |
||
820 | 820 | * |
821 | 821 | * @return string |
822 | 822 | */ |
823 | - public function get_form_wrap_classes( $args ) { |
|
823 | + public function get_form_wrap_classes($args) { |
|
824 | 824 | $custom_class = array( |
825 | 825 | 'give-form-wrap', |
826 | 826 | ); |
827 | 827 | |
828 | - if ( $this->is_close_donation_form() ) { |
|
828 | + if ($this->is_close_donation_form()) { |
|
829 | 829 | $custom_class[] = 'give-form-closed'; |
830 | - } else{ |
|
831 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
830 | + } else { |
|
831 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
832 | 832 | ? $args['display_style'] |
833 | - : give_get_meta( $this->ID, '_give_payment_display', true ); |
|
833 | + : give_get_meta($this->ID, '_give_payment_display', true); |
|
834 | 834 | |
835 | 835 | $custom_class[] = "give-display-{$display_option}"; |
836 | 836 | |
837 | 837 | // If admin want to show only button for form then user inbuilt modal functionality. |
838 | - if ( 'button' === $display_option ) { |
|
838 | + if ('button' === $display_option) { |
|
839 | 839 | $custom_class[] = 'give-display-button-only'; |
840 | 840 | } |
841 | 841 | } |
@@ -846,10 +846,10 @@ discard block |
||
846 | 846 | * |
847 | 847 | * @since 1.0 |
848 | 848 | */ |
849 | - $form_wrap_classes_array = (array) apply_filters( 'give_form_wrap_classes', $custom_class, $this->ID, $args ); |
|
849 | + $form_wrap_classes_array = (array) apply_filters('give_form_wrap_classes', $custom_class, $this->ID, $args); |
|
850 | 850 | |
851 | 851 | |
852 | - return implode( ' ', $form_wrap_classes_array ); |
|
852 | + return implode(' ', $form_wrap_classes_array); |
|
853 | 853 | |
854 | 854 | } |
855 | 855 | |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | public function is_set_type_donation_form() { |
865 | 865 | $form_type = $this->get_type(); |
866 | 866 | |
867 | - return ( 'set' === $form_type ? true : false ); |
|
867 | + return ('set' === $form_type ? true : false); |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | /** |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | public function is_multi_type_donation_form() { |
879 | 879 | $form_type = $this->get_type(); |
880 | 880 | |
881 | - return ( 'multi' === $form_type ? true : false ); |
|
881 | + return ('multi' === $form_type ? true : false); |
|
882 | 882 | |
883 | 883 | } |
884 | 884 | |
@@ -892,15 +892,15 @@ discard block |
||
892 | 892 | */ |
893 | 893 | public function get_sales() { |
894 | 894 | |
895 | - if ( ! isset( $this->sales ) ) { |
|
895 | + if ( ! isset($this->sales)) { |
|
896 | 896 | |
897 | - if ( '' == give_get_meta( $this->ID, '_give_form_sales', true ) ) { |
|
898 | - add_post_meta( $this->ID, '_give_form_sales', 0 ); |
|
897 | + if ('' == give_get_meta($this->ID, '_give_form_sales', true)) { |
|
898 | + add_post_meta($this->ID, '_give_form_sales', 0); |
|
899 | 899 | } // End if |
900 | 900 | |
901 | - $this->sales = give_get_meta( $this->ID, '_give_form_sales', true ); |
|
901 | + $this->sales = give_get_meta($this->ID, '_give_form_sales', true); |
|
902 | 902 | |
903 | - if ( $this->sales < 0 ) { |
|
903 | + if ($this->sales < 0) { |
|
904 | 904 | // Never let sales be less than zero. |
905 | 905 | $this->sales = 0; |
906 | 906 | } |
@@ -921,13 +921,13 @@ discard block |
||
921 | 921 | * |
922 | 922 | * @return int|false New number of total sales. |
923 | 923 | */ |
924 | - public function increase_sales( $quantity = 1 ) { |
|
924 | + public function increase_sales($quantity = 1) { |
|
925 | 925 | |
926 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
927 | - $quantity = absint( $quantity ); |
|
926 | + $sales = give_get_form_sales_stats($this->ID); |
|
927 | + $quantity = absint($quantity); |
|
928 | 928 | $total_sales = $sales + $quantity; |
929 | 929 | |
930 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
930 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
931 | 931 | |
932 | 932 | $this->sales = $total_sales; |
933 | 933 | |
@@ -948,17 +948,17 @@ discard block |
||
948 | 948 | * |
949 | 949 | * @return int|false New number of total sales. |
950 | 950 | */ |
951 | - public function decrease_sales( $quantity = 1 ) { |
|
951 | + public function decrease_sales($quantity = 1) { |
|
952 | 952 | |
953 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
953 | + $sales = give_get_form_sales_stats($this->ID); |
|
954 | 954 | |
955 | 955 | // Only decrease if not already zero |
956 | - if ( $sales > 0 ) { |
|
956 | + if ($sales > 0) { |
|
957 | 957 | |
958 | - $quantity = absint( $quantity ); |
|
958 | + $quantity = absint($quantity); |
|
959 | 959 | $total_sales = $sales - $quantity; |
960 | 960 | |
961 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
961 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
962 | 962 | |
963 | 963 | $this->sales = $sales; |
964 | 964 | |
@@ -982,15 +982,15 @@ discard block |
||
982 | 982 | */ |
983 | 983 | public function get_earnings() { |
984 | 984 | |
985 | - if ( ! isset( $this->earnings ) ) { |
|
985 | + if ( ! isset($this->earnings)) { |
|
986 | 986 | |
987 | - if ( '' == give_get_meta( $this->ID, '_give_form_earnings', true ) ) { |
|
988 | - add_post_meta( $this->ID, '_give_form_earnings', 0 ); |
|
987 | + if ('' == give_get_meta($this->ID, '_give_form_earnings', true)) { |
|
988 | + add_post_meta($this->ID, '_give_form_earnings', 0); |
|
989 | 989 | } |
990 | 990 | |
991 | - $this->earnings = give_get_meta( $this->ID, '_give_form_earnings', true ); |
|
991 | + $this->earnings = give_get_meta($this->ID, '_give_form_earnings', true); |
|
992 | 992 | |
993 | - if ( $this->earnings < 0 ) { |
|
993 | + if ($this->earnings < 0) { |
|
994 | 994 | // Never let earnings be less than zero |
995 | 995 | $this->earnings = 0; |
996 | 996 | } |
@@ -1011,12 +1011,12 @@ discard block |
||
1011 | 1011 | * |
1012 | 1012 | * @return float|false |
1013 | 1013 | */ |
1014 | - public function increase_earnings( $amount = 0 ) { |
|
1014 | + public function increase_earnings($amount = 0) { |
|
1015 | 1015 | |
1016 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
1016 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
1017 | 1017 | $new_amount = $earnings + (float) $amount; |
1018 | 1018 | |
1019 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
1019 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
1020 | 1020 | |
1021 | 1021 | $this->earnings = $new_amount; |
1022 | 1022 | |
@@ -1038,16 +1038,16 @@ discard block |
||
1038 | 1038 | * |
1039 | 1039 | * @return float|false |
1040 | 1040 | */ |
1041 | - public function decrease_earnings( $amount ) { |
|
1041 | + public function decrease_earnings($amount) { |
|
1042 | 1042 | |
1043 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
1043 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
1044 | 1044 | |
1045 | - if ( $earnings > 0 ) { |
|
1045 | + if ($earnings > 0) { |
|
1046 | 1046 | // Only decrease if greater than zero |
1047 | 1047 | $new_amount = $earnings - (float) $amount; |
1048 | 1048 | |
1049 | 1049 | |
1050 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
1050 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
1051 | 1051 | |
1052 | 1052 | $this->earnings = $new_amount; |
1053 | 1053 | |
@@ -1071,22 +1071,22 @@ discard block |
||
1071 | 1071 | * |
1072 | 1072 | * @return bool |
1073 | 1073 | */ |
1074 | - public function is_free( $price_id = false ) { |
|
1074 | + public function is_free($price_id = false) { |
|
1075 | 1075 | |
1076 | 1076 | $is_free = false; |
1077 | - $variable_pricing = give_has_variable_prices( $this->ID ); |
|
1077 | + $variable_pricing = give_has_variable_prices($this->ID); |
|
1078 | 1078 | |
1079 | - if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) { |
|
1080 | - $price = give_get_price_option_amount( $this->ID, $price_id ); |
|
1081 | - } elseif ( ! $variable_pricing ) { |
|
1082 | - $price = give_get_meta( $this->ID, '_give_set_price', true ); |
|
1079 | + if ($variable_pricing && ! is_null($price_id) && $price_id !== false) { |
|
1080 | + $price = give_get_price_option_amount($this->ID, $price_id); |
|
1081 | + } elseif ( ! $variable_pricing) { |
|
1082 | + $price = give_get_meta($this->ID, '_give_set_price', true); |
|
1083 | 1083 | } |
1084 | 1084 | |
1085 | - if ( isset( $price ) && (float) $price == 0 ) { |
|
1085 | + if (isset($price) && (float) $price == 0) { |
|
1086 | 1086 | $is_free = true; |
1087 | 1087 | } |
1088 | 1088 | |
1089 | - return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id ); |
|
1089 | + return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id); |
|
1090 | 1090 | |
1091 | 1091 | } |
1092 | 1092 | |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | */ |
1106 | 1106 | public function is_close_donation_form() { |
1107 | 1107 | |
1108 | - $goal_format = give_get_form_goal_format( $this->ID ); |
|
1108 | + $goal_format = give_get_form_goal_format($this->ID); |
|
1109 | 1109 | |
1110 | 1110 | /** |
1111 | 1111 | * Filter the close form result. |
@@ -1115,9 +1115,9 @@ discard block |
||
1115 | 1115 | $is_close_form = apply_filters( |
1116 | 1116 | 'give_is_close_donation_form', |
1117 | 1117 | ( |
1118 | - give_is_setting_enabled( give_get_meta( $this->ID, '_give_goal_option', true ) ) && |
|
1119 | - give_is_setting_enabled( give_get_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) ) && |
|
1120 | - ( 'donation' === $goal_format ? $this->get_goal() <= $this->get_sales() : $this->get_goal() <= $this->get_earnings() ) |
|
1118 | + give_is_setting_enabled(give_get_meta($this->ID, '_give_goal_option', true)) && |
|
1119 | + give_is_setting_enabled(give_get_meta($this->ID, '_give_close_form_when_goal_achieved', true)) && |
|
1120 | + ('donation' === $goal_format ? $this->get_goal() <= $this->get_sales() : $this->get_goal() <= $this->get_earnings()) |
|
1121 | 1121 | ), |
1122 | 1122 | $this->ID |
1123 | 1123 | ); |
@@ -1136,17 +1136,17 @@ discard block |
||
1136 | 1136 | * |
1137 | 1137 | * @return bool The result of the update query. |
1138 | 1138 | */ |
1139 | - private function update_meta( $meta_key = '', $meta_value = '' ) { |
|
1139 | + private function update_meta($meta_key = '', $meta_value = '') { |
|
1140 | 1140 | |
1141 | 1141 | /* @var WPDB $wpdb */ |
1142 | 1142 | global $wpdb; |
1143 | 1143 | |
1144 | 1144 | // Bailout. |
1145 | - if ( empty( $meta_key ) ) { |
|
1145 | + if (empty($meta_key)) { |
|
1146 | 1146 | return false; |
1147 | 1147 | } |
1148 | 1148 | |
1149 | - if ( give_update_meta( $this->ID, $meta_key, $meta_value ) ) { |
|
1149 | + if (give_update_meta($this->ID, $meta_key, $meta_value)) { |
|
1150 | 1150 | return true; |
1151 | 1151 | } |
1152 | 1152 |
@@ -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 | |
@@ -53,21 +53,21 @@ discard block |
||
53 | 53 | * @since 1.8.9 |
54 | 54 | */ |
55 | 55 | public function __construct() { |
56 | - add_action( 'admin_notices', array( $this, 'render_admin_notices' ), 999 ); |
|
57 | - add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) ); |
|
56 | + add_action('admin_notices', array($this, 'render_admin_notices'), 999); |
|
57 | + add_action('give_dismiss_notices', array($this, 'dismiss_notices')); |
|
58 | 58 | |
59 | - add_action( 'give_frontend_notices', array( $this, 'render_frontend_notices' ), 999 ); |
|
60 | - add_action( 'give_pre_form', array( $this, 'render_frontend_notices' ), 11 ); |
|
61 | - add_action( 'give_ajax_donation_errors', array( $this, 'render_frontend_notices' ) ); |
|
59 | + add_action('give_frontend_notices', array($this, 'render_frontend_notices'), 999); |
|
60 | + add_action('give_pre_form', array($this, 'render_frontend_notices'), 11); |
|
61 | + add_action('give_ajax_donation_errors', array($this, 'render_frontend_notices')); |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * Backward compatibility for deprecated params. |
65 | 65 | * |
66 | 66 | * @since 1.8.14 |
67 | 67 | */ |
68 | - add_filter( 'give_register_notice_args', array( $this, 'bc_deprecated_params' ) ); |
|
69 | - add_filter( 'give_frontend_errors_args', array( $this, 'bc_deprecated_params' ) ); |
|
70 | - add_filter( 'give_frontend_notice_args', array( $this, 'bc_deprecated_params' ) ); |
|
68 | + add_filter('give_register_notice_args', array($this, 'bc_deprecated_params')); |
|
69 | + add_filter('give_frontend_errors_args', array($this, 'bc_deprecated_params')); |
|
70 | + add_filter('give_frontend_notice_args', array($this, 'bc_deprecated_params')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -80,19 +80,19 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return array |
82 | 82 | */ |
83 | - public function bc_deprecated_params( $args ) { |
|
83 | + public function bc_deprecated_params($args) { |
|
84 | 84 | /** |
85 | 85 | * Param: auto_dismissible |
86 | 86 | * deprecated in 1.8.14 |
87 | 87 | * |
88 | 88 | * Check if auto_dismissible is set and it true then unset and change dismissible parameter value to auto |
89 | 89 | */ |
90 | - if ( isset( $args['auto_dismissible'] ) ) { |
|
91 | - if ( ! empty( $args['auto_dismissible'] ) ) { |
|
90 | + if (isset($args['auto_dismissible'])) { |
|
91 | + if ( ! empty($args['auto_dismissible'])) { |
|
92 | 92 | $args['dismissible'] = 'auto'; |
93 | 93 | } |
94 | 94 | // unset auto_dismissible as it has been deprecated. |
95 | - unset( $args['auto_dismissible'] ); |
|
95 | + unset($args['auto_dismissible']); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return $args; |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return bool |
110 | 110 | */ |
111 | - public function register_notice( $notice_args ) { |
|
111 | + public function register_notice($notice_args) { |
|
112 | 112 | // Bailout. |
113 | - if ( empty( $notice_args['id'] ) || array_key_exists( $notice_args['id'], self::$notices ) ) { |
|
113 | + if (empty($notice_args['id']) || array_key_exists($notice_args['id'], self::$notices)) { |
|
114 | 114 | return false; |
115 | 115 | } |
116 | 116 | |
@@ -159,39 +159,39 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @since 1.8.14 |
161 | 161 | */ |
162 | - $notice_args = apply_filters( 'give_register_notice_args', $notice_args ); |
|
162 | + $notice_args = apply_filters('give_register_notice_args', $notice_args); |
|
163 | 163 | |
164 | 164 | // Set extra dismiss links if any. |
165 | - if ( false !== strpos( $notice_args['description'], 'data-dismiss-interval' ) ) { |
|
165 | + if (false !== strpos($notice_args['description'], 'data-dismiss-interval')) { |
|
166 | 166 | |
167 | - preg_match_all( "/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link ); |
|
167 | + preg_match_all("/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link); |
|
168 | 168 | |
169 | - if ( ! empty( $extra_notice_dismiss_link ) ) { |
|
170 | - $extra_notice_dismiss_links = array_chunk( current( $extra_notice_dismiss_link ), 3 ); |
|
171 | - foreach ( $extra_notice_dismiss_links as $extra_notice_dismiss_link ) { |
|
169 | + if ( ! empty($extra_notice_dismiss_link)) { |
|
170 | + $extra_notice_dismiss_links = array_chunk(current($extra_notice_dismiss_link), 3); |
|
171 | + foreach ($extra_notice_dismiss_links as $extra_notice_dismiss_link) { |
|
172 | 172 | // Create array og key ==> value by parsing query string created after renaming data attributes. |
173 | - $data_attribute_query_str = str_replace( array( 'data-', '-', '"' ), array( |
|
173 | + $data_attribute_query_str = str_replace(array('data-', '-', '"'), array( |
|
174 | 174 | '', |
175 | 175 | '_', |
176 | 176 | '', |
177 | - ), implode( '&', $extra_notice_dismiss_link ) ); |
|
177 | + ), implode('&', $extra_notice_dismiss_link)); |
|
178 | 178 | |
179 | - $notice_args['extra_links'][] = wp_parse_args( $data_attribute_query_str ); |
|
179 | + $notice_args['extra_links'][] = wp_parse_args($data_attribute_query_str); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | 184 | |
185 | - self::$notices[ $notice_args['id'] ] = $notice_args; |
|
185 | + self::$notices[$notice_args['id']] = $notice_args; |
|
186 | 186 | |
187 | 187 | // Auto set show param if not already set. |
188 | - if ( ! isset( self::$notices[ $notice_args['id'] ]['show'] ) ) { |
|
189 | - self::$notices[ $notice_args['id'] ]['show'] = $this->is_notice_dismissed( $notice_args ) ? false : true; |
|
188 | + if ( ! isset(self::$notices[$notice_args['id']]['show'])) { |
|
189 | + self::$notices[$notice_args['id']]['show'] = $this->is_notice_dismissed($notice_args) ? false : true; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | // Auto set time interval for shortly. |
193 | - if ( 'shortly' === self::$notices[ $notice_args['id'] ]['dismiss_interval'] ) { |
|
194 | - self::$notices[ $notice_args['id'] ]['dismiss_interval_time'] = DAY_IN_SECONDS; |
|
193 | + if ('shortly' === self::$notices[$notice_args['id']]['dismiss_interval']) { |
|
194 | + self::$notices[$notice_args['id']]['dismiss_interval_time'] = DAY_IN_SECONDS; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | return true; |
@@ -205,51 +205,51 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function render_admin_notices() { |
207 | 207 | // Bailout. |
208 | - if ( empty( self::$notices ) ) { |
|
208 | + if (empty(self::$notices)) { |
|
209 | 209 | return; |
210 | 210 | } |
211 | 211 | |
212 | 212 | $output = ''; |
213 | 213 | |
214 | - foreach ( self::$notices as $notice_id => $notice ) { |
|
214 | + foreach (self::$notices as $notice_id => $notice) { |
|
215 | 215 | // Check flag set to true to show notice. |
216 | - if ( ! $notice['show'] ) { |
|
216 | + if ( ! $notice['show']) { |
|
217 | 217 | continue; |
218 | 218 | } |
219 | 219 | |
220 | 220 | |
221 | 221 | // Render custom html. |
222 | - if( ! empty( $notice['description_html'] ) ) { |
|
222 | + if ( ! empty($notice['description_html'])) { |
|
223 | 223 | $output .= "{$notice['description_html']} \n"; |
224 | 224 | continue; |
225 | 225 | } |
226 | 226 | |
227 | 227 | // Check if notice dismissible or not. |
228 | - if ( ! self::$has_auto_dismissible_notice ) { |
|
229 | - self::$has_auto_dismissible_notice = ( 'auto' === $notice['dismissible'] ); |
|
228 | + if ( ! self::$has_auto_dismissible_notice) { |
|
229 | + self::$has_auto_dismissible_notice = ('auto' === $notice['dismissible']); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | // Check if notice dismissible or not. |
233 | - if ( ! self::$has_dismiss_interval_notice ) { |
|
233 | + if ( ! self::$has_dismiss_interval_notice) { |
|
234 | 234 | self::$has_dismiss_interval_notice = $notice['dismiss_interval']; |
235 | 235 | } |
236 | 236 | |
237 | - $css_id = ( false === strpos( $notice['id'], 'give' ) ? "give-{$notice['id']}" : $notice['id'] ); |
|
237 | + $css_id = (false === strpos($notice['id'], 'give') ? "give-{$notice['id']}" : $notice['id']); |
|
238 | 238 | |
239 | - $css_class = 'give-notice notice ' . ( empty( $notice['dismissible'] ) ? 'non' : 'is' ) . "-dismissible {$notice['type']} notice-{$notice['type']}"; |
|
240 | - $output .= sprintf( |
|
241 | - '<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">' . " \n", |
|
239 | + $css_class = 'give-notice notice '.(empty($notice['dismissible']) ? 'non' : 'is')."-dismissible {$notice['type']} notice-{$notice['type']}"; |
|
240 | + $output .= sprintf( |
|
241 | + '<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">'." \n", |
|
242 | 242 | $css_id, |
243 | 243 | $css_class, |
244 | - give_clean( $notice['dismissible'] ), |
|
244 | + give_clean($notice['dismissible']), |
|
245 | 245 | $notice['dismissible_type'], |
246 | 246 | $notice['dismiss_interval'], |
247 | 247 | $notice['id'], |
248 | - empty( $notice['dismissible_type'] ) ? '' : wp_create_nonce( "give_edit_{$notice_id}_notice" ), |
|
248 | + empty($notice['dismissible_type']) ? '' : wp_create_nonce("give_edit_{$notice_id}_notice"), |
|
249 | 249 | $notice['dismiss_interval_time'] |
250 | 250 | ); |
251 | 251 | |
252 | - $output .= ( 0 === strpos( $notice['description'], '<div' ) || 0 === strpos( $notice['description'], '<p' ) ? $notice['description'] : "<p>{$notice['description']}</p>" ); |
|
252 | + $output .= (0 === strpos($notice['description'], '<div') || 0 === strpos($notice['description'], '<p') ? $notice['description'] : "<p>{$notice['description']}</p>"); |
|
253 | 253 | $output .= "</div> \n"; |
254 | 254 | } |
255 | 255 | |
@@ -267,18 +267,18 @@ discard block |
||
267 | 267 | * |
268 | 268 | * @param int $form_id |
269 | 269 | */ |
270 | - public function render_frontend_notices( $form_id = 0 ) { |
|
270 | + public function render_frontend_notices($form_id = 0) { |
|
271 | 271 | $errors = give_get_errors(); |
272 | 272 | |
273 | - $request_form_id = isset( $_REQUEST['form-id'] ) ? absint( $_REQUEST['form-id'] ) : 0; |
|
273 | + $request_form_id = isset($_REQUEST['form-id']) ? absint($_REQUEST['form-id']) : 0; |
|
274 | 274 | |
275 | 275 | // Sanity checks first: Ensure that gateway returned errors display on the appropriate form. |
276 | - if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) { |
|
276 | + if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) { |
|
277 | 277 | return; |
278 | 278 | } |
279 | 279 | |
280 | - if ( $errors ) { |
|
281 | - self::print_frontend_errors( $errors ); |
|
280 | + if ($errors) { |
|
281 | + self::print_frontend_errors($errors); |
|
282 | 282 | |
283 | 283 | give_clear_errors(); |
284 | 284 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @access private |
292 | 292 | */ |
293 | 293 | private function print_js() { |
294 | - if ( self::$has_auto_dismissible_notice ) : |
|
294 | + if (self::$has_auto_dismissible_notice) : |
|
295 | 295 | ?> |
296 | 296 | <script> |
297 | 297 | jQuery(document).ready(function () { |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | <?php |
308 | 308 | endif; |
309 | 309 | |
310 | - if ( self::$has_dismiss_interval_notice ) : |
|
310 | + if (self::$has_dismiss_interval_notice) : |
|
311 | 311 | ?> |
312 | 312 | <script> |
313 | 313 | jQuery(document).ready(function () { |
@@ -386,36 +386,36 @@ discard block |
||
386 | 386 | * @access public |
387 | 387 | */ |
388 | 388 | public function dismiss_notices() { |
389 | - $_post = give_clean( $_POST ); |
|
390 | - $notice_id = esc_attr( $_post['notice_id'] ); |
|
389 | + $_post = give_clean($_POST); |
|
390 | + $notice_id = esc_attr($_post['notice_id']); |
|
391 | 391 | |
392 | 392 | // Bailout. |
393 | 393 | if ( |
394 | - empty( $notice_id ) || |
|
395 | - empty( $_post['dismissible_type'] ) || |
|
396 | - empty( $_post['dismiss_interval'] ) || |
|
397 | - ! check_ajax_referer( "give_edit_{$notice_id}_notice", '_wpnonce' ) |
|
394 | + empty($notice_id) || |
|
395 | + empty($_post['dismissible_type']) || |
|
396 | + empty($_post['dismiss_interval']) || |
|
397 | + ! check_ajax_referer("give_edit_{$notice_id}_notice", '_wpnonce') |
|
398 | 398 | ) { |
399 | 399 | wp_send_json_error(); |
400 | 400 | } |
401 | 401 | |
402 | - $notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'] ); |
|
403 | - if ( 'user' === $_post['dismissible_type'] ) { |
|
402 | + $notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval']); |
|
403 | + if ('user' === $_post['dismissible_type']) { |
|
404 | 404 | $current_user = wp_get_current_user(); |
405 | - $notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'], $current_user->ID ); |
|
405 | + $notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval'], $current_user->ID); |
|
406 | 406 | } |
407 | 407 | |
408 | - $notice_dismiss_time = ! empty( $_post['dismiss_interval_time'] ) ? $_post['dismiss_interval_time'] : null; |
|
408 | + $notice_dismiss_time = ! empty($_post['dismiss_interval_time']) ? $_post['dismiss_interval_time'] : null; |
|
409 | 409 | |
410 | 410 | // Save option to hide notice. |
411 | - Give_Cache::set( $notice_key, true, $notice_dismiss_time, true ); |
|
411 | + Give_Cache::set($notice_key, true, $notice_dismiss_time, true); |
|
412 | 412 | |
413 | 413 | /** |
414 | 414 | * Fire the action when notice dismissed |
415 | 415 | * |
416 | 416 | * @since 2.0 |
417 | 417 | */ |
418 | - do_action( 'give_dismiss_notices', $_post ); |
|
418 | + do_action('give_dismiss_notices', $_post); |
|
419 | 419 | |
420 | 420 | wp_send_json_success(); |
421 | 421 | } |
@@ -433,18 +433,18 @@ discard block |
||
433 | 433 | * |
434 | 434 | * @return string |
435 | 435 | */ |
436 | - public function get_notice_key( $notice_id, $dismiss_interval = null, $user_id = 0 ) { |
|
436 | + public function get_notice_key($notice_id, $dismiss_interval = null, $user_id = 0) { |
|
437 | 437 | $notice_key = "_give_notice_{$notice_id}"; |
438 | 438 | |
439 | - if ( ! empty( $dismiss_interval ) ) { |
|
439 | + if ( ! empty($dismiss_interval)) { |
|
440 | 440 | $notice_key .= "_{$dismiss_interval}"; |
441 | 441 | } |
442 | 442 | |
443 | - if ( $user_id ) { |
|
443 | + if ($user_id) { |
|
444 | 444 | $notice_key .= "_{$user_id}"; |
445 | 445 | } |
446 | 446 | |
447 | - $notice_key = sanitize_key( $notice_key ); |
|
447 | + $notice_key = sanitize_key($notice_key); |
|
448 | 448 | |
449 | 449 | return $notice_key; |
450 | 450 | } |
@@ -457,11 +457,11 @@ discard block |
||
457 | 457 | * |
458 | 458 | * @return string |
459 | 459 | */ |
460 | - public function get_dismiss_link( $notice_args ) { |
|
460 | + public function get_dismiss_link($notice_args) { |
|
461 | 461 | $notice_args = wp_parse_args( |
462 | 462 | $notice_args, |
463 | 463 | array( |
464 | - 'title' => __( 'Click here', 'give' ), |
|
464 | + 'title' => __('Click here', 'give'), |
|
465 | 465 | 'dismissible_type' => '', |
466 | 466 | 'dismiss_interval' => '', |
467 | 467 | 'dismiss_interval_time' => null, |
@@ -488,31 +488,31 @@ discard block |
||
488 | 488 | * |
489 | 489 | * @return bool|null |
490 | 490 | */ |
491 | - public function is_notice_dismissed( $notice ) { |
|
492 | - $notice_key = $this->get_notice_key( $notice['id'], $notice['dismiss_interval'] ); |
|
491 | + public function is_notice_dismissed($notice) { |
|
492 | + $notice_key = $this->get_notice_key($notice['id'], $notice['dismiss_interval']); |
|
493 | 493 | $is_notice_dismissed = false; |
494 | 494 | |
495 | - if ( 'user' === $notice['dismissible_type'] ) { |
|
495 | + if ('user' === $notice['dismissible_type']) { |
|
496 | 496 | $current_user = wp_get_current_user(); |
497 | - $notice_key = Give()->notices->get_notice_key( $notice['id'], $notice['dismiss_interval'], $current_user->ID ); |
|
497 | + $notice_key = Give()->notices->get_notice_key($notice['id'], $notice['dismiss_interval'], $current_user->ID); |
|
498 | 498 | } |
499 | 499 | |
500 | - $notice_data = Give_Cache::get( $notice_key, true ); |
|
500 | + $notice_data = Give_Cache::get($notice_key, true); |
|
501 | 501 | |
502 | 502 | // Find notice dismiss link status if notice has extra dismissible links. |
503 | - if ( ( empty( $notice_data ) || is_wp_error( $notice_data ) ) && ! empty( $notice['extra_links'] ) ) { |
|
503 | + if ((empty($notice_data) || is_wp_error($notice_data)) && ! empty($notice['extra_links'])) { |
|
504 | 504 | |
505 | - foreach ( $notice['extra_links'] as $extra_link ) { |
|
506 | - $new_notice_data = wp_parse_args( $extra_link, $notice ); |
|
507 | - unset( $new_notice_data['extra_links'] ); |
|
505 | + foreach ($notice['extra_links'] as $extra_link) { |
|
506 | + $new_notice_data = wp_parse_args($extra_link, $notice); |
|
507 | + unset($new_notice_data['extra_links']); |
|
508 | 508 | |
509 | - if ( $is_notice_dismissed = $this->is_notice_dismissed( $new_notice_data ) ) { |
|
509 | + if ($is_notice_dismissed = $this->is_notice_dismissed($new_notice_data)) { |
|
510 | 510 | return $is_notice_dismissed; |
511 | 511 | } |
512 | 512 | } |
513 | 513 | } |
514 | 514 | |
515 | - $is_notice_dismissed = ! empty( $notice_data ) && ! is_wp_error( $notice_data ); |
|
515 | + $is_notice_dismissed = ! empty($notice_data) && ! is_wp_error($notice_data); |
|
516 | 516 | |
517 | 517 | return $is_notice_dismissed; |
518 | 518 | } |
@@ -526,9 +526,9 @@ discard block |
||
526 | 526 | * |
527 | 527 | * @param array $errors |
528 | 528 | */ |
529 | - public static function print_frontend_errors( $errors ) { |
|
529 | + public static function print_frontend_errors($errors) { |
|
530 | 530 | // Bailout. |
531 | - if ( ! $errors ) { |
|
531 | + if ( ! $errors) { |
|
532 | 532 | return; |
533 | 533 | } |
534 | 534 | |
@@ -543,37 +543,37 @@ discard block |
||
543 | 543 | ); |
544 | 544 | |
545 | 545 | // Note: we will remove give_errors class in future. |
546 | - $classes = apply_filters( 'give_error_class', array( 'give_notices', 'give_errors' ) ); |
|
546 | + $classes = apply_filters('give_error_class', array('give_notices', 'give_errors')); |
|
547 | 547 | |
548 | - echo sprintf( '<div class="%s">', implode( ' ', $classes ) ); |
|
548 | + echo sprintf('<div class="%s">', implode(' ', $classes)); |
|
549 | 549 | |
550 | 550 | // Loop error codes and display errors. |
551 | - foreach ( $errors as $error_id => $error ) { |
|
551 | + foreach ($errors as $error_id => $error) { |
|
552 | 552 | // Backward compatibility v<1.8.11 |
553 | - if ( is_string( $error ) ) { |
|
553 | + if (is_string($error)) { |
|
554 | 554 | $error = array( |
555 | 555 | 'message' => $error, |
556 | 556 | 'notice_args' => array(), |
557 | 557 | ); |
558 | 558 | } |
559 | 559 | |
560 | - $notice_args = wp_parse_args( $error['notice_args'], $default_notice_args ); |
|
560 | + $notice_args = wp_parse_args($error['notice_args'], $default_notice_args); |
|
561 | 561 | |
562 | 562 | /** |
563 | 563 | * Filter to modify Frontend Errors args before errors is display. |
564 | 564 | * |
565 | 565 | * @since 1.8.14 |
566 | 566 | */ |
567 | - $notice_args = apply_filters( 'give_frontend_errors_args', $notice_args ); |
|
567 | + $notice_args = apply_filters('give_frontend_errors_args', $notice_args); |
|
568 | 568 | |
569 | 569 | echo sprintf( |
570 | 570 | '<div class="give_error give_notice" id="give_error_%1$s" data-dismissible="%2$s" data-dismiss-interval="%3$d"> |
571 | 571 | <p><strong>%4$s</strong>: %5$s</p> |
572 | 572 | </div>', |
573 | 573 | $error_id, |
574 | - give_clean( $notice_args['dismissible'] ), |
|
575 | - absint( $notice_args['dismiss_interval'] ), |
|
576 | - esc_html__( 'Error', 'give' ), |
|
574 | + give_clean($notice_args['dismissible']), |
|
575 | + absint($notice_args['dismiss_interval']), |
|
576 | + esc_html__('Error', 'give'), |
|
577 | 577 | $error['message'] |
578 | 578 | ); |
579 | 579 | } |
@@ -595,8 +595,8 @@ discard block |
||
595 | 595 | * |
596 | 596 | * @return string |
597 | 597 | */ |
598 | - public static function print_frontend_notice( $message, $echo = true, $notice_type = 'warning', $notice_args = array() ) { |
|
599 | - if ( empty( $message ) ) { |
|
598 | + public static function print_frontend_notice($message, $echo = true, $notice_type = 'warning', $notice_args = array()) { |
|
599 | + if (empty($message)) { |
|
600 | 600 | return ''; |
601 | 601 | } |
602 | 602 | |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | 'dismiss_interval' => 5000, |
612 | 612 | ); |
613 | 613 | |
614 | - $notice_args = wp_parse_args( $notice_args, $default_notice_args ); |
|
614 | + $notice_args = wp_parse_args($notice_args, $default_notice_args); |
|
615 | 615 | |
616 | 616 | // Notice dismissible must be true for dismiss type. |
617 | 617 | $notice_args['dismiss_type'] = ! $notice_args['dismissible'] ? '' : $notice_args['dismiss_type']; |
@@ -621,15 +621,14 @@ discard block |
||
621 | 621 | * |
622 | 622 | * @since 1.8.14 |
623 | 623 | */ |
624 | - $notice_args = apply_filters( 'give_frontend_notice_args', $notice_args ); |
|
624 | + $notice_args = apply_filters('give_frontend_notice_args', $notice_args); |
|
625 | 625 | |
626 | 626 | $close_icon = 'manual' === $notice_args['dismiss_type'] ? |
627 | 627 | sprintf( |
628 | 628 | '<img class="notice-dismiss give-notice-close" src="%s" />', |
629 | - esc_url( GIVE_PLUGIN_URL . 'assets/images/svg/close.svg' ) |
|
629 | + esc_url(GIVE_PLUGIN_URL.'assets/images/svg/close.svg') |
|
630 | 630 | |
631 | - ) : |
|
632 | - ''; |
|
631 | + ) : ''; |
|
633 | 632 | |
634 | 633 | // Note: we will remove give_errors class in future. |
635 | 634 | $error = sprintf( |
@@ -640,15 +639,15 @@ discard block |
||
640 | 639 | %6$s |
641 | 640 | </div>', |
642 | 641 | $notice_type, |
643 | - give_clean( $notice_args['dismissible'] ), |
|
644 | - absint( $notice_args['dismiss_interval'] ), |
|
645 | - give_clean( $notice_args['dismiss_type'] ), |
|
642 | + give_clean($notice_args['dismissible']), |
|
643 | + absint($notice_args['dismiss_interval']), |
|
644 | + give_clean($notice_args['dismiss_type']), |
|
646 | 645 | $message, |
647 | 646 | $close_icon |
648 | 647 | |
649 | 648 | ); |
650 | 649 | |
651 | - if ( ! $echo ) { |
|
650 | + if ( ! $echo) { |
|
652 | 651 | return $error; |
653 | 652 | } |
654 | 653 | |
@@ -668,24 +667,24 @@ discard block |
||
668 | 667 | * |
669 | 668 | * @return string |
670 | 669 | */ |
671 | - public function print_admin_notices( $notice_args = array() ) { |
|
670 | + public function print_admin_notices($notice_args = array()) { |
|
672 | 671 | // Bailout. |
673 | - if ( empty( $notice_args['description'] ) ) { |
|
672 | + if (empty($notice_args['description'])) { |
|
674 | 673 | return ''; |
675 | 674 | } |
676 | 675 | |
677 | - $defaults = array( |
|
676 | + $defaults = array( |
|
678 | 677 | 'id' => '', |
679 | 678 | 'echo' => true, |
680 | 679 | 'notice_type' => 'warning', |
681 | 680 | 'dismissible' => true, |
682 | 681 | ); |
683 | - $notice_args = wp_parse_args( $notice_args, $defaults ); |
|
682 | + $notice_args = wp_parse_args($notice_args, $defaults); |
|
684 | 683 | |
685 | 684 | $output = ''; |
686 | - $css_id = ! empty( $notice_args['id'] ) ? $notice_args['id'] : uniqid( 'give-inline-notice-' ); |
|
685 | + $css_id = ! empty($notice_args['id']) ? $notice_args['id'] : uniqid('give-inline-notice-'); |
|
687 | 686 | $css_class = "notice-{$notice_args['notice_type']} give-notice notice inline"; |
688 | - $css_class .= ( $notice_args['dismissible'] ) ? ' is-dismissible' : ''; |
|
687 | + $css_class .= ($notice_args['dismissible']) ? ' is-dismissible' : ''; |
|
689 | 688 | $output .= sprintf( |
690 | 689 | '<div id="%1$s" class="%2$s"><p>%3$s</p></div>', |
691 | 690 | $css_id, |
@@ -693,7 +692,7 @@ discard block |
||
693 | 692 | $notice_args['description'] |
694 | 693 | ); |
695 | 694 | |
696 | - if ( ! $notice_args['echo'] ) { |
|
695 | + if ( ! $notice_args['echo']) { |
|
697 | 696 | return $output; |
698 | 697 | } |
699 | 698 |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | |
41 | 41 | // Exit if accessed directly. |
42 | -if ( ! defined( 'ABSPATH' ) ) { |
|
42 | +if ( ! defined('ABSPATH')) { |
|
43 | 43 | exit; |
44 | 44 | } |
45 | 45 | |
46 | -if ( ! class_exists( 'Give' ) ) : |
|
46 | +if ( ! class_exists('Give')) : |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Main Give Class |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @return Give |
238 | 238 | */ |
239 | 239 | public static function instance() { |
240 | - if ( is_null( self::$_instance ) ) { |
|
240 | + if (is_null(self::$_instance)) { |
|
241 | 241 | self::$_instance = new self(); |
242 | 242 | } |
243 | 243 | |
@@ -249,13 +249,13 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function __construct() { |
251 | 251 | // PHP version |
252 | - if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) { |
|
253 | - define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' ); |
|
252 | + if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) { |
|
253 | + define('GIVE_REQUIRED_PHP_VERSION', '5.3'); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | // Bailout: Need minimum php version to load plugin. |
257 | - if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) { |
|
258 | - add_action( 'admin_notices', array( $this, 'minmum_phpversion_notice' ) ); |
|
257 | + if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) { |
|
258 | + add_action('admin_notices', array($this, 'minmum_phpversion_notice')); |
|
259 | 259 | |
260 | 260 | return; |
261 | 261 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $this->includes(); |
266 | 266 | $this->init_hooks(); |
267 | 267 | |
268 | - do_action( 'give_loaded' ); |
|
268 | + do_action('give_loaded'); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -274,12 +274,12 @@ discard block |
||
274 | 274 | * @since 1.8.9 |
275 | 275 | */ |
276 | 276 | private function init_hooks() { |
277 | - register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
277 | + register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
278 | 278 | |
279 | - add_action( 'plugins_loaded', array( $this, 'init' ), 0 ); |
|
279 | + add_action('plugins_loaded', array($this, 'init'), 0); |
|
280 | 280 | |
281 | 281 | // Set up localization on init Hook. |
282 | - add_action( 'init', array( $this, 'load_textdomain' ), 0 ); |
|
282 | + add_action('init', array($this, 'load_textdomain'), 0); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @since 1.8.9 |
296 | 296 | */ |
297 | - do_action( 'before_give_init' ); |
|
297 | + do_action('before_give_init'); |
|
298 | 298 | |
299 | 299 | $this->roles = new Give_Roles(); |
300 | 300 | $this->api = new Give_API(); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * |
322 | 322 | * @since 1.8.7 |
323 | 323 | */ |
324 | - do_action( 'give_init', $this ); |
|
324 | + do_action('give_init', $this); |
|
325 | 325 | |
326 | 326 | } |
327 | 327 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | */ |
339 | 339 | public function __clone() { |
340 | 340 | // Cloning instances of the class is forbidden. |
341 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
341 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | /** |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | */ |
352 | 352 | public function __wakeup() { |
353 | 353 | // Unserializing instances of the class is forbidden. |
354 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
354 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | /** |
@@ -365,33 +365,33 @@ discard block |
||
365 | 365 | private function setup_constants() { |
366 | 366 | |
367 | 367 | // Plugin version |
368 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
369 | - define( 'GIVE_VERSION', '2.0.6' ); |
|
368 | + if ( ! defined('GIVE_VERSION')) { |
|
369 | + define('GIVE_VERSION', '2.0.6'); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | // Plugin Root File |
373 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
374 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
373 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
374 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | // Plugin Folder Path |
378 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
379 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) ); |
|
378 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
379 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE)); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | // Plugin Folder URL |
383 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
384 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) ); |
|
383 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
384 | + define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE)); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | // Plugin Basename aka: "give/give.php" |
388 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
389 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) ); |
|
388 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
389 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE)); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | // Make sure CAL_GREGORIAN is defined |
393 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
394 | - define( 'CAL_GREGORIAN', 1 ); |
|
393 | + if ( ! defined('CAL_GREGORIAN')) { |
|
394 | + define('CAL_GREGORIAN', 1); |
|
395 | 395 | } |
396 | 396 | } |
397 | 397 | |
@@ -409,152 +409,152 @@ discard block |
||
409 | 409 | /** |
410 | 410 | * Load libraries. |
411 | 411 | */ |
412 | - if ( ! class_exists( 'WP_Async_Request' ) ) { |
|
413 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' ); |
|
412 | + if ( ! class_exists('WP_Async_Request')) { |
|
413 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php'); |
|
414 | 414 | } |
415 | 415 | |
416 | - if ( ! class_exists( 'WP_Background_Process' ) ) { |
|
417 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' ); |
|
416 | + if ( ! class_exists('WP_Background_Process')) { |
|
417 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php'); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | /** |
421 | 421 | * Load plugin files |
422 | 422 | */ |
423 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
424 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
423 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
424 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
425 | 425 | $give_options = give_get_settings(); |
426 | 426 | |
427 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
428 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php'; |
|
429 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
430 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php'; |
|
431 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
432 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
433 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
434 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
435 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
436 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
437 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php'; |
|
438 | - require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php'; |
|
439 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php'; |
|
440 | - |
|
441 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
442 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
443 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
444 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
445 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php'; |
|
446 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php'; |
|
447 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php'; |
|
448 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php'; |
|
449 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
450 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
451 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
452 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
453 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
454 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
455 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php'; |
|
456 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php'; |
|
457 | - |
|
458 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
459 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
460 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
461 | - require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php'; |
|
462 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
463 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
464 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
465 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
466 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
467 | - require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php'; |
|
468 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
469 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
470 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
471 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
472 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
473 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
474 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php'; |
|
475 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
476 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
477 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
478 | - |
|
479 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php'; |
|
480 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
481 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
482 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
483 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
484 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
485 | - |
|
486 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
487 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
488 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
489 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
490 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
491 | - |
|
492 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
493 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
494 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php'; |
|
495 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
496 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
497 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
498 | - |
|
499 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php'; |
|
500 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php'; |
|
501 | - |
|
502 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php'; |
|
503 | - |
|
504 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
505 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
427 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
428 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php'; |
|
429 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
430 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php'; |
|
431 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
432 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
433 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
434 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
435 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
436 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
437 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php'; |
|
438 | + require_once GIVE_PLUGIN_DIR.'includes/class-notices.php'; |
|
439 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php'; |
|
440 | + |
|
441 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
442 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
443 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
444 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
445 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php'; |
|
446 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php'; |
|
447 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php'; |
|
448 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php'; |
|
449 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
450 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
451 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
452 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
453 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
454 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
455 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php'; |
|
456 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php'; |
|
457 | + |
|
458 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
459 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
460 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
461 | + require_once GIVE_PLUGIN_DIR.'includes/import-functions.php'; |
|
462 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
463 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
464 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
465 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
466 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
467 | + require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php'; |
|
468 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
469 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
470 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
471 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
472 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
473 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
474 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php'; |
|
475 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
476 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
477 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
478 | + |
|
479 | + require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php'; |
|
480 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
481 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
482 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
483 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
484 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
485 | + |
|
486 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
487 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
488 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
489 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
490 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
491 | + |
|
492 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
493 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
494 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php'; |
|
495 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
496 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
497 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
498 | + |
|
499 | + require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php'; |
|
500 | + require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php'; |
|
501 | + |
|
502 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php'; |
|
503 | + |
|
504 | + if (defined('WP_CLI') && WP_CLI) { |
|
505 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
506 | 506 | } |
507 | 507 | |
508 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
509 | - |
|
510 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
511 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
512 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
513 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
514 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
515 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
516 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
517 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
518 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
519 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
520 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php'; |
|
521 | - |
|
522 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
523 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
524 | - |
|
525 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php'; |
|
526 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php'; |
|
527 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php'; |
|
528 | - |
|
529 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
530 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
531 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
532 | - |
|
533 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php'; |
|
534 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php'; |
|
535 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php'; |
|
536 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php'; |
|
537 | - |
|
538 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php'; |
|
539 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php'; |
|
540 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php'; |
|
541 | - |
|
542 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php'; |
|
543 | - |
|
544 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php'; |
|
545 | - |
|
546 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
547 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
548 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
549 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
550 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
551 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
552 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
553 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
554 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
508 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
509 | + |
|
510 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
511 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
512 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
513 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
514 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
515 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
516 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
517 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
518 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
519 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
520 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php'; |
|
521 | + |
|
522 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
523 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
524 | + |
|
525 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php'; |
|
526 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php'; |
|
527 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php'; |
|
528 | + |
|
529 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
530 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
531 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
532 | + |
|
533 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php'; |
|
534 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php'; |
|
535 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php'; |
|
536 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php'; |
|
537 | + |
|
538 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php'; |
|
539 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php'; |
|
540 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php'; |
|
541 | + |
|
542 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'; |
|
543 | + |
|
544 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php'; |
|
545 | + |
|
546 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
547 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
548 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
549 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
550 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
551 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
552 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
553 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
554 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
555 | 555 | }// End if(). |
556 | 556 | |
557 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
557 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
558 | 558 | |
559 | 559 | } |
560 | 560 | |
@@ -569,16 +569,16 @@ discard block |
||
569 | 569 | public function load_textdomain() { |
570 | 570 | |
571 | 571 | // Set filter for Give's languages directory |
572 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
573 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
572 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
573 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
574 | 574 | |
575 | 575 | // Traditional WordPress plugin locale filter. |
576 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
577 | - $locale = apply_filters( 'plugin_locale', $locale, 'give' ); |
|
576 | + $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
577 | + $locale = apply_filters('plugin_locale', $locale, 'give'); |
|
578 | 578 | |
579 | - unload_textdomain( 'give' ); |
|
580 | - load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' ); |
|
581 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
579 | + unload_textdomain('give'); |
|
580 | + load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo'); |
|
581 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
582 | 582 | |
583 | 583 | } |
584 | 584 | |
@@ -591,17 +591,17 @@ discard block |
||
591 | 591 | */ |
592 | 592 | public function minmum_phpversion_notice() { |
593 | 593 | // Bailout. |
594 | - if ( ! is_admin() ) { |
|
594 | + if ( ! is_admin()) { |
|
595 | 595 | return; |
596 | 596 | } |
597 | 597 | |
598 | - $notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>'; |
|
599 | - $notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>'; |
|
600 | - $notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>'; |
|
601 | - $notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>'; |
|
602 | - $notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>'; |
|
603 | - $notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>'; |
|
604 | - $notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>'; |
|
598 | + $notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>'; |
|
599 | + $notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>'; |
|
600 | + $notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>'; |
|
601 | + $notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>'; |
|
602 | + $notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>'; |
|
603 | + $notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>'; |
|
604 | + $notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>'; |
|
605 | 605 | |
606 | 606 | echo sprintf( |
607 | 607 | '<div class="notice notice-error">%1$s</div>', |