@@ -713,7 +713,7 @@ |
||
713 | 713 | * |
714 | 714 | * @param array $value The form field value array |
715 | 715 | * |
716 | - * @return array The description and tip as a 2 element array |
|
716 | + * @return string The description and tip as a 2 element array |
|
717 | 717 | */ |
718 | 718 | public static function get_field_description( $value ) { |
719 | 719 | $description = ''; |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Admin_Settings' ) ) : |
|
16 | +if ( ! class_exists('Give_Admin_Settings')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Admin_Settings Class. |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param array $settings Array of settings class object. |
74 | 74 | */ |
75 | - self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() ); |
|
75 | + self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array()); |
|
76 | 76 | |
77 | 77 | return self::$settings; |
78 | 78 | } |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | public static function save() { |
87 | 87 | $current_tab = give_get_current_setting_tab(); |
88 | 88 | |
89 | - if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) { |
|
90 | - die( __( 'Action failed. Please refresh the page and retry.', 'give' ) ); |
|
89 | + if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) { |
|
90 | + die(__('Action failed. Please refresh the page and retry.', 'give')); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @since 1.8 |
101 | 101 | */ |
102 | - do_action( self::$setting_filter_prefix . '_save_' . $current_tab ); |
|
102 | + do_action(self::$setting_filter_prefix.'_save_'.$current_tab); |
|
103 | 103 | |
104 | - self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) ); |
|
104 | + self::add_message('give-setting-updated', __('Your settings have been saved.', 'give')); |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * Trigger Action. |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @since 1.8 |
114 | 114 | */ |
115 | - do_action( self::$setting_filter_prefix . '_saved' ); |
|
115 | + do_action(self::$setting_filter_prefix.'_saved'); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return void |
127 | 127 | */ |
128 | - public static function add_message( $code, $message ) { |
|
129 | - self::$messages[ $code ] = $message; |
|
128 | + public static function add_message($code, $message) { |
|
129 | + self::$messages[$code] = $message; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @return void |
141 | 141 | */ |
142 | - public static function add_error( $code, $message ) { |
|
143 | - self::$errors[ $code ] = $message; |
|
142 | + public static function add_error($code, $message) { |
|
143 | + self::$errors[$code] = $message; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -153,18 +153,18 @@ discard block |
||
153 | 153 | $notice_html = ''; |
154 | 154 | $classes = 'give-notice settings-error notice is-dismissible'; |
155 | 155 | |
156 | - self::$errors = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors ); |
|
157 | - self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages ); |
|
156 | + self::$errors = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors); |
|
157 | + self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages); |
|
158 | 158 | |
159 | - if ( 0 < count( self::$errors ) ) { |
|
160 | - foreach ( self::$errors as $code => $message ) { |
|
161 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>'; |
|
159 | + if (0 < count(self::$errors)) { |
|
160 | + foreach (self::$errors as $code => $message) { |
|
161 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>'; |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | - if ( 0 < count( self::$messages ) ) { |
|
166 | - foreach ( self::$messages as $code => $message ) { |
|
167 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>'; |
|
165 | + if (0 < count(self::$messages)) { |
|
166 | + foreach (self::$messages as $code => $message) { |
|
167 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>'; |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | self::$setting_filter_prefix = give_get_current_setting_page(); |
185 | 185 | |
186 | 186 | // Bailout: Exit if setting page is not defined. |
187 | - if ( empty( self::$setting_filter_prefix ) ) { |
|
187 | + if (empty(self::$setting_filter_prefix)) { |
|
188 | 188 | return false; |
189 | 189 | } |
190 | 190 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @since 1.8 |
199 | 199 | */ |
200 | - do_action( self::$setting_filter_prefix . '_start' ); |
|
200 | + do_action(self::$setting_filter_prefix.'_start'); |
|
201 | 201 | |
202 | 202 | $current_tab = give_get_current_setting_tab(); |
203 | 203 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | self::get_settings_pages(); |
206 | 206 | |
207 | 207 | // Save settings if data has been posted. |
208 | - if ( ! empty( $_POST ) ) { |
|
208 | + if ( ! empty($_POST)) { |
|
209 | 209 | self::save(); |
210 | 210 | } |
211 | 211 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @since 1.8 |
220 | 220 | */ |
221 | - $tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() ); |
|
221 | + $tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array()); |
|
222 | 222 | |
223 | 223 | include 'views/html-admin-settings.php'; |
224 | 224 | |
@@ -236,25 +236,25 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @return string|bool |
238 | 238 | */ |
239 | - public static function get_option( $option_name = '', $field_id = '', $default = false ) { |
|
239 | + public static function get_option($option_name = '', $field_id = '', $default = false) { |
|
240 | 240 | // Bailout. |
241 | - if ( empty( $option_name ) && empty( $field_id ) ) { |
|
241 | + if (empty($option_name) && empty($field_id)) { |
|
242 | 242 | return false; |
243 | 243 | } |
244 | 244 | |
245 | - if ( ! empty( $field_id ) && ! empty( $option_name ) ) { |
|
245 | + if ( ! empty($field_id) && ! empty($option_name)) { |
|
246 | 246 | // Get field value if any. |
247 | - $option_value = get_option( $option_name ); |
|
247 | + $option_value = get_option($option_name); |
|
248 | 248 | |
249 | - $option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) ) |
|
250 | - ? $option_value[ $field_id ] |
|
249 | + $option_value = (is_array($option_value) && array_key_exists($field_id, $option_value)) |
|
250 | + ? $option_value[$field_id] |
|
251 | 251 | : $default; |
252 | 252 | } else { |
253 | 253 | // If option name is empty but not field name then this means, setting is direct store to option table under there field name. |
254 | 254 | $option_name = ! $option_name ? $field_id : $option_name; |
255 | 255 | |
256 | 256 | // Get option value if any. |
257 | - $option_value = get_option( $option_name, $default ); |
|
257 | + $option_value = get_option($option_name, $default); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | return $option_value; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * |
273 | 273 | * @return void |
274 | 274 | */ |
275 | - public static function output_fields( $options, $option_name = '' ) { |
|
275 | + public static function output_fields($options, $option_name = '') { |
|
276 | 276 | $current_tab = give_get_current_setting_tab(); |
277 | 277 | |
278 | 278 | // Field Default values. |
@@ -285,46 +285,46 @@ discard block |
||
285 | 285 | 'table_html' => true, |
286 | 286 | ); |
287 | 287 | |
288 | - foreach ( $options as $value ) { |
|
289 | - if ( ! isset( $value['type'] ) ) { |
|
288 | + foreach ($options as $value) { |
|
289 | + if ( ! isset($value['type'])) { |
|
290 | 290 | continue; |
291 | 291 | } |
292 | 292 | |
293 | 293 | // Set title. |
294 | - $defaults['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
294 | + $defaults['title'] = isset($value['name']) ? $value['name'] : ''; |
|
295 | 295 | |
296 | - $value = wp_parse_args( $value, $defaults ); |
|
296 | + $value = wp_parse_args($value, $defaults); |
|
297 | 297 | |
298 | 298 | // Custom attribute handling. |
299 | 299 | $custom_attributes = array(); |
300 | 300 | |
301 | - if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) { |
|
302 | - foreach ( $value['attributes'] as $attribute => $attribute_value ) { |
|
303 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
301 | + if ( ! empty($value['attributes']) && is_array($value['attributes'])) { |
|
302 | + foreach ($value['attributes'] as $attribute => $attribute_value) { |
|
303 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | |
307 | 307 | // Description handling. |
308 | - $description = self::get_field_description( $value ); |
|
308 | + $description = self::get_field_description($value); |
|
309 | 309 | |
310 | 310 | // Switch based on type. |
311 | - switch ( $value['type'] ) { |
|
311 | + switch ($value['type']) { |
|
312 | 312 | |
313 | 313 | // Section Titles |
314 | 314 | case 'title': |
315 | - if ( ! empty( $value['title'] ) ) { |
|
316 | - echo '<div class="give-setting-tab-header give-setting-tab-header-' . $current_tab . '"><h2>' . self::get_field_title( $value ) . '</h2><hr></div>'; |
|
315 | + if ( ! empty($value['title'])) { |
|
316 | + echo '<div class="give-setting-tab-header give-setting-tab-header-'.$current_tab.'"><h2>'.self::get_field_title($value).'</h2><hr></div>'; |
|
317 | 317 | } |
318 | 318 | |
319 | - if ( ! empty( $value['desc'] ) ) { |
|
320 | - echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); |
|
319 | + if ( ! empty($value['desc'])) { |
|
320 | + echo wpautop(wptexturize(wp_kses_post($value['desc']))); |
|
321 | 321 | } |
322 | 322 | |
323 | - if ( $value['table_html'] ) { |
|
324 | - echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n"; |
|
323 | + if ($value['table_html']) { |
|
324 | + echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n"; |
|
325 | 325 | } |
326 | 326 | |
327 | - if ( ! empty( $value['id'] ) ) { |
|
327 | + if ( ! empty($value['id'])) { |
|
328 | 328 | |
329 | 329 | /** |
330 | 330 | * Trigger Action. |
@@ -333,14 +333,14 @@ discard block |
||
333 | 333 | * |
334 | 334 | * @since 1.8 |
335 | 335 | */ |
336 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) ); |
|
336 | + do_action('give_settings_'.sanitize_title($value['id'])); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | break; |
340 | 340 | |
341 | 341 | // Section Ends. |
342 | 342 | case 'sectionend': |
343 | - if ( ! empty( $value['id'] ) ) { |
|
343 | + if ( ! empty($value['id'])) { |
|
344 | 344 | |
345 | 345 | /** |
346 | 346 | * Trigger Action. |
@@ -349,14 +349,14 @@ discard block |
||
349 | 349 | * |
350 | 350 | * @since 1.8 |
351 | 351 | */ |
352 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
352 | + do_action('give_settings_'.sanitize_title($value['id']).'_end'); |
|
353 | 353 | } |
354 | 354 | |
355 | - if ( $value['table_html'] ) { |
|
355 | + if ($value['table_html']) { |
|
356 | 356 | echo '</table>'; |
357 | 357 | } |
358 | 358 | |
359 | - if ( ! empty( $value['id'] ) ) { |
|
359 | + if ( ! empty($value['id'])) { |
|
360 | 360 | |
361 | 361 | /** |
362 | 362 | * Trigger Action. |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * |
366 | 366 | * @since 1.8 |
367 | 367 | */ |
368 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
368 | + do_action('give_settings_'.sanitize_title($value['id']).'_after'); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | break; |
@@ -377,22 +377,22 @@ discard block |
||
377 | 377 | case 'password' : |
378 | 378 | |
379 | 379 | $type = $value['type']; |
380 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
380 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
381 | 381 | |
382 | 382 | ?> |
383 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
383 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
384 | 384 | <th scope="row" class="titledesc"> |
385 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
385 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
386 | 386 | </th> |
387 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
387 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
388 | 388 | <input |
389 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
390 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
391 | - type="<?php echo esc_attr( $type ); ?>" |
|
392 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
393 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
394 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
395 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
389 | + name="<?php echo esc_attr($value['id']); ?>" |
|
390 | + id="<?php echo esc_attr($value['id']); ?>" |
|
391 | + type="<?php echo esc_attr($type); ?>" |
|
392 | + style="<?php echo esc_attr($value['css']); ?>" |
|
393 | + value="<?php echo esc_attr($option_value); ?>" |
|
394 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
395 | + <?php echo implode(' ', $custom_attributes); ?> |
|
396 | 396 | /> <?php echo $description; ?> |
397 | 397 | </td> |
398 | 398 | </tr><?php |
@@ -401,23 +401,23 @@ discard block |
||
401 | 401 | // Textarea. |
402 | 402 | case 'textarea': |
403 | 403 | |
404 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
404 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
405 | 405 | |
406 | 406 | ?> |
407 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
407 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
408 | 408 | <th scope="row" class="titledesc"> |
409 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
409 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
410 | 410 | </th> |
411 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
411 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
412 | 412 | <textarea |
413 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
414 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
415 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
416 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
413 | + name="<?php echo esc_attr($value['id']); ?>" |
|
414 | + id="<?php echo esc_attr($value['id']); ?>" |
|
415 | + style="<?php echo esc_attr($value['css']); ?>" |
|
416 | + class="<?php echo esc_attr($value['class']); ?>" |
|
417 | 417 | rows="10" |
418 | 418 | cols="60" |
419 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
420 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
419 | + <?php echo implode(' ', $custom_attributes); ?> |
|
420 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
421 | 421 | <?php echo $description; ?> |
422 | 422 | </td> |
423 | 423 | </tr><?php |
@@ -427,35 +427,35 @@ discard block |
||
427 | 427 | case 'select' : |
428 | 428 | case 'multiselect' : |
429 | 429 | |
430 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
430 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
431 | 431 | |
432 | 432 | ?> |
433 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
433 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
434 | 434 | <th scope="row" class="titledesc"> |
435 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
435 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
436 | 436 | </th> |
437 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
437 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
438 | 438 | <select |
439 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) { |
|
439 | + name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') { |
|
440 | 440 | echo '[]'; |
441 | 441 | } ?>" |
442 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
443 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
444 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
445 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
446 | - <?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?> |
|
442 | + id="<?php echo esc_attr($value['id']); ?>" |
|
443 | + style="<?php echo esc_attr($value['css']); ?>" |
|
444 | + class="<?php echo esc_attr($value['class']); ?>" |
|
445 | + <?php echo implode(' ', $custom_attributes); ?> |
|
446 | + <?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?> |
|
447 | 447 | > |
448 | 448 | |
449 | 449 | <?php |
450 | - if ( ! empty( $value['options'] ) ) { |
|
451 | - foreach ( $value['options'] as $key => $val ) { |
|
450 | + if ( ! empty($value['options'])) { |
|
451 | + foreach ($value['options'] as $key => $val) { |
|
452 | 452 | ?> |
453 | - <option value="<?php echo esc_attr( $key ); ?>" <?php |
|
453 | + <option value="<?php echo esc_attr($key); ?>" <?php |
|
454 | 454 | |
455 | - if ( is_array( $option_value ) ) { |
|
456 | - selected( in_array( $key, $option_value ), true ); |
|
455 | + if (is_array($option_value)) { |
|
456 | + selected(in_array($key, $option_value), true); |
|
457 | 457 | } else { |
458 | - selected( $option_value, $key ); |
|
458 | + selected($option_value, $key); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | ?>><?php echo $val ?></option> |
@@ -471,28 +471,28 @@ discard block |
||
471 | 471 | |
472 | 472 | // Radio inputs. |
473 | 473 | case 'radio_inline' : |
474 | - $value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline'; |
|
474 | + $value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline'; |
|
475 | 475 | case 'radio' : |
476 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
476 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
477 | 477 | ?> |
478 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
478 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
479 | 479 | <th scope="row" class="titledesc"> |
480 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
480 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
481 | 481 | </th> |
482 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
482 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
483 | 483 | <fieldset> |
484 | 484 | <ul> |
485 | 485 | <?php |
486 | - foreach ( $value['options'] as $key => $val ) { |
|
486 | + foreach ($value['options'] as $key => $val) { |
|
487 | 487 | ?> |
488 | 488 | <li> |
489 | 489 | <label><input |
490 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
490 | + name="<?php echo esc_attr($value['id']); ?>" |
|
491 | 491 | value="<?php echo $key; ?>" |
492 | 492 | type="radio" |
493 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
494 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
495 | - <?php checked( $key, $option_value ); ?> |
|
493 | + style="<?php echo esc_attr($value['css']); ?>" |
|
494 | + <?php echo implode(' ', $custom_attributes); ?> |
|
495 | + <?php checked($key, $option_value); ?> |
|
496 | 496 | /> <?php echo $val ?></label> |
497 | 497 | </li> |
498 | 498 | <?php |
@@ -506,21 +506,21 @@ discard block |
||
506 | 506 | |
507 | 507 | // Checkbox input. |
508 | 508 | case 'checkbox' : |
509 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
509 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
510 | 510 | ?> |
511 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
511 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
512 | 512 | <th scope="row" class="titledesc"> |
513 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
513 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
514 | 514 | </th> |
515 | 515 | <td class="give-forminp"> |
516 | 516 | <input |
517 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
518 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
517 | + name="<?php echo esc_attr($value['id']); ?>" |
|
518 | + id="<?php echo esc_attr($value['id']); ?>" |
|
519 | 519 | type="checkbox" |
520 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
520 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
521 | 521 | value="1" |
522 | - <?php checked( $option_value, 'on' ); ?> |
|
523 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
522 | + <?php checked($option_value, 'on'); ?> |
|
523 | + <?php echo implode(' ', $custom_attributes); ?> |
|
524 | 524 | /> |
525 | 525 | <?php echo $description; ?> |
526 | 526 | </td> |
@@ -530,28 +530,28 @@ discard block |
||
530 | 530 | |
531 | 531 | // Multi Checkbox input. |
532 | 532 | case 'multicheck' : |
533 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
534 | - $option_value = is_array( $option_value ) ? $option_value : array(); |
|
533 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
534 | + $option_value = is_array($option_value) ? $option_value : array(); |
|
535 | 535 | ?> |
536 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
536 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
537 | 537 | <th scope="row" class="titledesc"> |
538 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
538 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
539 | 539 | </th> |
540 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
540 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
541 | 541 | <fieldset> |
542 | 542 | <ul> |
543 | 543 | <?php |
544 | - foreach ( $value['options'] as $key => $val ) { |
|
544 | + foreach ($value['options'] as $key => $val) { |
|
545 | 545 | ?> |
546 | 546 | <li> |
547 | 547 | <label> |
548 | 548 | <input |
549 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
549 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
550 | 550 | value="<?php echo $key; ?>" |
551 | 551 | type="checkbox" |
552 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
553 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
554 | - <?php if ( in_array( $key, $option_value ) ) { |
|
552 | + style="<?php echo esc_attr($value['css']); ?>" |
|
553 | + <?php echo implode(' ', $custom_attributes); ?> |
|
554 | + <?php if (in_array($key, $option_value)) { |
|
555 | 555 | echo 'checked="checked"'; |
556 | 556 | } ?> |
557 | 557 | /> <?php echo $val ?> |
@@ -569,24 +569,24 @@ discard block |
||
569 | 569 | |
570 | 570 | // File input field. |
571 | 571 | case 'file' : |
572 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
572 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
573 | 573 | ?> |
574 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
574 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
575 | 575 | <th scope="row" class="titledesc"> |
576 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
576 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
577 | 577 | </th> |
578 | 578 | <td class="give-forminp"> |
579 | 579 | <div class="give-field-wrap"> |
580 | 580 | <label for="<?php echo $value['id'] ?>"> |
581 | 581 | <input |
582 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
583 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
582 | + name="<?php echo esc_attr($value['id']); ?>" |
|
583 | + id="<?php echo esc_attr($value['id']); ?>" |
|
584 | 584 | type="text" |
585 | - class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>" |
|
585 | + class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>" |
|
586 | 586 | value="<?php echo $option_value; ?>" |
587 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
588 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
589 | - /> <input class="give-upload-button button" type="button" value="<?php echo esc_html__( 'Add or Upload File', 'give' ); ?>"> |
|
587 | + style="<?php echo esc_attr($value['css']); ?>" |
|
588 | + <?php echo implode(' ', $custom_attributes); ?> |
|
589 | + /> <input class="give-upload-button button" type="button" value="<?php echo esc_html__('Add or Upload File', 'give'); ?>"> |
|
590 | 590 | <?php echo $description ?> |
591 | 591 | <div class="give-image-thumb<?php echo ! $option_value ? ' give-hidden' : ''; ?>"> |
592 | 592 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
@@ -601,17 +601,17 @@ discard block |
||
601 | 601 | // WordPress Editor. |
602 | 602 | case 'wysiwyg' : |
603 | 603 | // Get option value. |
604 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
604 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
605 | 605 | |
606 | 606 | // Get editor settings. |
607 | - $editor_settings = ! empty( $value['options'] ) ? $value['options'] : array(); |
|
607 | + $editor_settings = ! empty($value['options']) ? $value['options'] : array(); |
|
608 | 608 | ?> |
609 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
609 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
610 | 610 | <th scope="row" class="titledesc"> |
611 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
611 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
612 | 612 | </th> |
613 | 613 | <td class="give-forminp"> |
614 | - <?php wp_editor( $option_value, $value['id'], $editor_settings ); ?> |
|
614 | + <?php wp_editor($option_value, $value['id'], $editor_settings); ?> |
|
615 | 615 | <?php echo $description; ?> |
616 | 616 | </td> |
617 | 617 | </tr><?php |
@@ -620,9 +620,9 @@ discard block |
||
620 | 620 | // Custom: System setting field. |
621 | 621 | case 'system_info' : |
622 | 622 | ?> |
623 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
623 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
624 | 624 | <th scope="row" class="titledesc"> |
625 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
625 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
626 | 626 | </th> |
627 | 627 | <td class="give-forminp"> |
628 | 628 | <?php give_system_info_callback(); ?> |
@@ -633,14 +633,14 @@ discard block |
||
633 | 633 | |
634 | 634 | // Custom: Default gateways setting field. |
635 | 635 | case 'default_gateway' : |
636 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
636 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
637 | 637 | ?> |
638 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
638 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
639 | 639 | <th scope="row" class="titledesc"> |
640 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
640 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
641 | 641 | </th> |
642 | 642 | <td class="give-forminp"> |
643 | - <?php give_default_gateway_callback( $value, $option_value ); ?> |
|
643 | + <?php give_default_gateway_callback($value, $option_value); ?> |
|
644 | 644 | <?php echo $description; ?> |
645 | 645 | </td> |
646 | 646 | </tr><?php |
@@ -648,14 +648,14 @@ discard block |
||
648 | 648 | |
649 | 649 | // Custom: Enable gateways setting field. |
650 | 650 | case 'enabled_gateways' : |
651 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
651 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
652 | 652 | ?> |
653 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
653 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
654 | 654 | <th scope="row" class="titledesc"> |
655 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
655 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
656 | 656 | </th> |
657 | 657 | <td class="give-forminp"> |
658 | - <?php give_enabled_gateways_callback( $value, $option_value ); ?> |
|
658 | + <?php give_enabled_gateways_callback($value, $option_value); ?> |
|
659 | 659 | <?php echo $description; ?> |
660 | 660 | </td> |
661 | 661 | </tr><?php |
@@ -664,9 +664,9 @@ discard block |
||
664 | 664 | // Custom: Email preview buttons field. |
665 | 665 | case 'email_preview_buttons' : |
666 | 666 | ?> |
667 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
667 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
668 | 668 | <th scope="row" class="titledesc"> |
669 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
669 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
670 | 670 | </th> |
671 | 671 | <td class="give-forminp"> |
672 | 672 | <?php give_email_preview_buttons_callback(); ?> |
@@ -697,12 +697,12 @@ discard block |
||
697 | 697 | // Custom: Give Docs Link field type. |
698 | 698 | case 'give_docs_link' : |
699 | 699 | ?> |
700 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
700 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
701 | 701 | <td class="give-docs-link" colspan="2"> |
702 | 702 | <?php |
703 | - echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
|
703 | + echo '<p class="give-docs-link"><a href="'.esc_url($value['url']) |
|
704 | 704 | . '" target="_blank">' |
705 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $value['title'] ) |
|
705 | + . sprintf(esc_html__('Need Help? See docs on "%s"'), $value['title']) |
|
706 | 706 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
707 | 707 | ?> |
708 | 708 | </td> |
@@ -713,8 +713,8 @@ discard block |
||
713 | 713 | // You can add or handle your custom field action. |
714 | 714 | default: |
715 | 715 | // Get option value. |
716 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
717 | - do_action( 'give_admin_field_' . $value['type'], $value, $option_value ); |
|
716 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
717 | + do_action('give_admin_field_'.$value['type'], $value, $option_value); |
|
718 | 718 | break; |
719 | 719 | } |
720 | 720 | } |
@@ -730,11 +730,11 @@ discard block |
||
730 | 730 | * |
731 | 731 | * @return array The description and tip as a 2 element array |
732 | 732 | */ |
733 | - public static function get_field_description( $value ) { |
|
733 | + public static function get_field_description($value) { |
|
734 | 734 | $description = ''; |
735 | 735 | |
736 | - if ( ! empty( $value['desc'] ) ) { |
|
737 | - $description = '<p class="give-field-description">' . wp_kses_post( $value['desc'] ) . '</p>'; |
|
736 | + if ( ! empty($value['desc'])) { |
|
737 | + $description = '<p class="give-field-description">'.wp_kses_post($value['desc']).'</p>'; |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | return $description; |
@@ -751,11 +751,11 @@ discard block |
||
751 | 751 | * |
752 | 752 | * @return array The description and tip as a 2 element array |
753 | 753 | */ |
754 | - public static function get_field_title( $value ) { |
|
755 | - $title = esc_html( $value['title'] ); |
|
754 | + public static function get_field_title($value) { |
|
755 | + $title = esc_html($value['title']); |
|
756 | 756 | |
757 | 757 | // If html tag detected then allow them to print. |
758 | - if ( strip_tags( $title ) ) { |
|
758 | + if (strip_tags($title)) { |
|
759 | 759 | $title = $value['title']; |
760 | 760 | } |
761 | 761 | |
@@ -774,8 +774,8 @@ discard block |
||
774 | 774 | * |
775 | 775 | * @return bool |
776 | 776 | */ |
777 | - public static function save_fields( $options, $option_name = '' ) { |
|
778 | - if ( empty( $_POST ) ) { |
|
777 | + public static function save_fields($options, $option_name = '') { |
|
778 | + if (empty($_POST)) { |
|
779 | 779 | return false; |
780 | 780 | } |
781 | 781 | |
@@ -783,37 +783,37 @@ discard block |
||
783 | 783 | $update_options = array(); |
784 | 784 | |
785 | 785 | // Loop options and get values to save. |
786 | - foreach ( $options as $option ) { |
|
787 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
786 | + foreach ($options as $option) { |
|
787 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
788 | 788 | continue; |
789 | 789 | } |
790 | 790 | |
791 | 791 | // Get posted value. |
792 | - if ( strstr( $option['id'], '[' ) ) { |
|
793 | - parse_str( $option['id'], $option_name_array ); |
|
794 | - $field_option_name = current( array_keys( $option_name_array ) ); |
|
795 | - $setting_name = key( $option_name_array[ $field_option_name ] ); |
|
796 | - $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; |
|
792 | + if (strstr($option['id'], '[')) { |
|
793 | + parse_str($option['id'], $option_name_array); |
|
794 | + $field_option_name = current(array_keys($option_name_array)); |
|
795 | + $setting_name = key($option_name_array[$field_option_name]); |
|
796 | + $raw_value = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null; |
|
797 | 797 | } else { |
798 | 798 | $field_option_name = $option['id']; |
799 | 799 | $setting_name = ''; |
800 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
800 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
801 | 801 | } |
802 | 802 | |
803 | 803 | // Format the value based on option type. |
804 | - switch ( $option['type'] ) { |
|
804 | + switch ($option['type']) { |
|
805 | 805 | case 'checkbox' : |
806 | - $value = is_null( $raw_value ) ? '' : 'on'; |
|
806 | + $value = is_null($raw_value) ? '' : 'on'; |
|
807 | 807 | break; |
808 | 808 | case 'wysiwyg' : |
809 | 809 | case 'textarea' : |
810 | - $value = wp_kses_post( trim( $raw_value ) ); |
|
810 | + $value = wp_kses_post(trim($raw_value)); |
|
811 | 811 | break; |
812 | 812 | case 'multiselect' : |
813 | - $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); |
|
813 | + $value = array_filter(array_map('give_clean', (array) $raw_value)); |
|
814 | 814 | break; |
815 | 815 | default : |
816 | - $value = give_clean( $raw_value ); |
|
816 | + $value = give_clean($raw_value); |
|
817 | 817 | break; |
818 | 818 | } |
819 | 819 | |
@@ -822,37 +822,37 @@ discard block |
||
822 | 822 | * |
823 | 823 | * @since 1.8 |
824 | 824 | */ |
825 | - $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); |
|
825 | + $value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value); |
|
826 | 826 | |
827 | 827 | /** |
828 | 828 | * Sanitize the value of an option by option name. |
829 | 829 | * |
830 | 830 | * @since 1.8 |
831 | 831 | */ |
832 | - $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); |
|
832 | + $value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value); |
|
833 | 833 | |
834 | - if ( is_null( $value ) ) { |
|
834 | + if (is_null($value)) { |
|
835 | 835 | continue; |
836 | 836 | } |
837 | 837 | |
838 | 838 | // Check if option is an array and handle that differently to single values. |
839 | - if ( $field_option_name && $setting_name ) { |
|
840 | - if ( ! isset( $update_options[ $field_option_name ] ) ) { |
|
841 | - $update_options[ $field_option_name ] = get_option( $field_option_name, array() ); |
|
839 | + if ($field_option_name && $setting_name) { |
|
840 | + if ( ! isset($update_options[$field_option_name])) { |
|
841 | + $update_options[$field_option_name] = get_option($field_option_name, array()); |
|
842 | 842 | } |
843 | - if ( ! is_array( $update_options[ $field_option_name ] ) ) { |
|
844 | - $update_options[ $field_option_name ] = array(); |
|
843 | + if ( ! is_array($update_options[$field_option_name])) { |
|
844 | + $update_options[$field_option_name] = array(); |
|
845 | 845 | } |
846 | - $update_options[ $field_option_name ][ $setting_name ] = $value; |
|
846 | + $update_options[$field_option_name][$setting_name] = $value; |
|
847 | 847 | } else { |
848 | - $update_options[ $field_option_name ] = $value; |
|
848 | + $update_options[$field_option_name] = $value; |
|
849 | 849 | } |
850 | 850 | } |
851 | 851 | |
852 | 852 | // Save all options in our array or there own option name i.e. option id. |
853 | - if ( empty( $option_name ) ) { |
|
854 | - foreach ( $update_options as $name => $value ) { |
|
855 | - update_option( $name, $value ); |
|
853 | + if (empty($option_name)) { |
|
854 | + foreach ($update_options as $name => $value) { |
|
855 | + update_option($name, $value); |
|
856 | 856 | |
857 | 857 | /** |
858 | 858 | * Trigger action. |
@@ -861,13 +861,13 @@ discard block |
||
861 | 861 | * |
862 | 862 | * @since 1.8 |
863 | 863 | */ |
864 | - do_action( "give_save_option_{$name}", $value, $name ); |
|
864 | + do_action("give_save_option_{$name}", $value, $name); |
|
865 | 865 | } |
866 | 866 | } else { |
867 | - $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : array(); |
|
868 | - $update_options = array_merge( $old_options, $update_options ); |
|
867 | + $old_options = ($old_options = get_option($option_name)) ? $old_options : array(); |
|
868 | + $update_options = array_merge($old_options, $update_options); |
|
869 | 869 | |
870 | - update_option( $option_name, $update_options ); |
|
870 | + update_option($option_name, $update_options); |
|
871 | 871 | |
872 | 872 | /** |
873 | 873 | * Trigger action. |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | * |
877 | 877 | * @since 1.8 |
878 | 878 | */ |
879 | - do_action( "give_save_settings_{$option_name}", $update_options, $option_name ); |
|
879 | + do_action("give_save_settings_{$option_name}", $update_options, $option_name); |
|
880 | 880 | } |
881 | 881 | |
882 | 882 | return true; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @param $url |
73 | 73 | * |
74 | - * @return mixed |
|
74 | + * @return string |
|
75 | 75 | */ |
76 | 76 | public function give_update_cmb_meta_box_url( $url ) { |
77 | 77 | //Path to Give's CMB |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | * @global $give_options |
850 | 850 | * |
851 | 851 | * @param string $key The Key to update |
852 | - * @param string|bool|int $value The value to set the key to |
|
852 | + * @param integer $value The value to set the key to |
|
853 | 853 | * |
854 | 854 | * @return boolean True if updated, false if not. |
855 | 855 | */ |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | * @since 1.3.5 |
953 | 953 | * |
954 | 954 | * @param $array |
955 | - * @param $position |int|string Expects an array key or 'id' of the settings field to appear after |
|
955 | + * @param string $position |int|string Expects an array key or 'id' of the settings field to appear after |
|
956 | 956 | * @param $insert |array a valid array of options to insert |
957 | 957 | * |
958 | 958 | * @return array |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | * |
991 | 991 | * @since 1.0 |
992 | 992 | * @param array $field_arr |
993 | - * @param array $saved_values |
|
993 | + * @param string|boolean $saved_values |
|
994 | 994 | * @return void |
995 | 995 | */ |
996 | 996 | function give_enabled_gateways_callback( $field_arr, $saved_values = array() ) { |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | * |
1024 | 1024 | * @since 1.0 |
1025 | 1025 | * @param array $field_arr |
1026 | - * @param array $saved_value |
|
1026 | + * @param string|boolean $saved_value |
|
1027 | 1027 | * @return void |
1028 | 1028 | */ |
1029 | 1029 | function give_default_gateway_callback( $field_arr, $saved_value ) { |
@@ -1181,23 +1181,23 @@ discard block |
||
1181 | 1181 | function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
1182 | 1182 | /* @var CMB2_Types $field_type_object */ |
1183 | 1183 | |
1184 | - $id = $field_type_object->field->args['id']; |
|
1184 | + $id = $field_type_object->field->args['id']; |
|
1185 | 1185 | $field_description = $field_type_object->field->args['desc']; |
1186 | 1186 | $license = $field_type_object->field->args['options']['license']; |
1187 | - $license_key = $escaped_value; |
|
1188 | - $is_license_key = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) ); |
|
1189 | - $is_valid_license = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) ); |
|
1190 | - $shortname = $field_type_object->field->args['options']['shortname']; |
|
1187 | + $license_key = $escaped_value; |
|
1188 | + $is_license_key = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) ); |
|
1189 | + $is_valid_license = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) ); |
|
1190 | + $shortname = $field_type_object->field->args['options']['shortname']; |
|
1191 | 1191 | $field_classes = 'regular-text give-license-field'; |
1192 | 1192 | $type = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password'; |
1193 | - $custom_html = ''; |
|
1194 | - $messages = array(); |
|
1195 | - $class = ''; |
|
1196 | - $account_page_link = $field_type_object->field->args['options']['account_url']; |
|
1197 | - $checkout_page_link = $field_type_object->field->args['options']['checkout_url']; |
|
1198 | - $addon_name = $field_type_object->field->args['options']['item_name']; |
|
1199 | - $license_status = null; |
|
1200 | - $is_in_subscription = null; |
|
1193 | + $custom_html = ''; |
|
1194 | + $messages = array(); |
|
1195 | + $class = ''; |
|
1196 | + $account_page_link = $field_type_object->field->args['options']['account_url']; |
|
1197 | + $checkout_page_link = $field_type_object->field->args['options']['checkout_url']; |
|
1198 | + $addon_name = $field_type_object->field->args['options']['item_name']; |
|
1199 | + $license_status = null; |
|
1200 | + $is_in_subscription = null; |
|
1201 | 1201 | |
1202 | 1202 | // By default query on edd api url will return license object which contain status and message property, this can break below functionality. |
1203 | 1203 | // To combat that check if status is set to error or not, if yes then set $is_license_key to false. |
@@ -1259,17 +1259,17 @@ discard block |
||
1259 | 1259 | |
1260 | 1260 | } elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) { |
1261 | 1261 | |
1262 | - // activate_license 'invalid' on anything other than valid, so if there was an error capture it |
|
1263 | - switch( $license->error ) { |
|
1264 | - case 'expired' : |
|
1265 | - $class = $license->error; |
|
1266 | - $messages[] = sprintf( |
|
1267 | - __( 'Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ), |
|
1268 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ), |
|
1269 | - $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1270 | - ); |
|
1271 | - $license_status = 'license-' . $class; |
|
1272 | - break; |
|
1262 | + // activate_license 'invalid' on anything other than valid, so if there was an error capture it |
|
1263 | + switch( $license->error ) { |
|
1264 | + case 'expired' : |
|
1265 | + $class = $license->error; |
|
1266 | + $messages[] = sprintf( |
|
1267 | + __( 'Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ), |
|
1268 | + date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ), |
|
1269 | + $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1270 | + ); |
|
1271 | + $license_status = 'license-' . $class; |
|
1272 | + break; |
|
1273 | 1273 | |
1274 | 1274 | case 'missing' : |
1275 | 1275 | $class = $license->error; |
@@ -1300,11 +1300,11 @@ discard block |
||
1300 | 1300 | $license_status = 'license-' . $class; |
1301 | 1301 | break; |
1302 | 1302 | |
1303 | - case 'item_name_mismatch' : |
|
1304 | - $class = $license->error; |
|
1305 | - $messages[] = sprintf( __( 'This license %s does not belong to %s.', 'give' ), $license_key, $addon_name ); |
|
1306 | - $license_status = 'license-' . $class; |
|
1307 | - break; |
|
1303 | + case 'item_name_mismatch' : |
|
1304 | + $class = $license->error; |
|
1305 | + $messages[] = sprintf( __( 'This license %s does not belong to %s.', 'give' ), $license_key, $addon_name ); |
|
1306 | + $license_status = 'license-' . $class; |
|
1307 | + break; |
|
1308 | 1308 | |
1309 | 1309 | case 'no_activations_left': |
1310 | 1310 | $class = $license->error; |
@@ -1359,7 +1359,7 @@ discard block |
||
1359 | 1359 | |
1360 | 1360 | // If license is active so show deactivate button. |
1361 | 1361 | if ( $is_valid_license ) { |
1362 | - // Get input field html. |
|
1362 | + // Get input field html. |
|
1363 | 1363 | $input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\" readonly=\"readonly\">"; |
1364 | 1364 | |
1365 | 1365 | $custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>'; |
@@ -1375,11 +1375,11 @@ discard block |
||
1375 | 1375 | $messages[] = apply_filters( "{$shortname}_default_addon_notice", esc_html__( 'To receive updates, please enter your valid license key.', 'give' ) ); |
1376 | 1376 | } |
1377 | 1377 | |
1378 | - foreach( $messages as $message ) { |
|
1379 | - $custom_html .= '<div class="give-license-status-notice give-' . $license_status . '">'; |
|
1380 | - $custom_html .= '<p>' . $message . '</p>'; |
|
1381 | - $custom_html .= '</div>'; |
|
1382 | - } |
|
1378 | + foreach( $messages as $message ) { |
|
1379 | + $custom_html .= '<div class="give-license-status-notice give-' . $license_status . '">'; |
|
1380 | + $custom_html .= '<p>' . $message . '</p>'; |
|
1381 | + $custom_html .= '</div>'; |
|
1382 | + } |
|
1383 | 1383 | |
1384 | 1384 | |
1385 | 1385 | // Field html. |
@@ -1388,8 +1388,8 @@ discard block |
||
1388 | 1388 | // Nonce. |
1389 | 1389 | wp_nonce_field( $id . '-nonce', $id . '-nonce' ); |
1390 | 1390 | |
1391 | - // Print field html. |
|
1392 | - echo "<div class=\"give-license-key\"><label for=\"{$id}\">{$addon_name }</label></div><div class=\"give-license-block\">{$custom_html}</div>"; |
|
1391 | + // Print field html. |
|
1392 | + echo "<div class=\"give-license-key\"><label for=\"{$id}\">{$addon_name }</label></div><div class=\"give-license-block\">{$custom_html}</div>"; |
|
1393 | 1393 | } |
1394 | 1394 | |
1395 | 1395 |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | public function __construct() { |
47 | 47 | |
48 | 48 | //Custom CMB2 Settings Fields |
49 | - add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 ); |
|
50 | - add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 ); |
|
51 | - add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 ); |
|
52 | - add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 ); |
|
53 | - add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 ); |
|
54 | - add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 ); |
|
55 | - add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 ); |
|
56 | - add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 ); |
|
49 | + add_action('cmb2_render_give_title', 'give_title_callback', 10, 5); |
|
50 | + add_action('cmb2_render_give_description', 'give_description_callback', 10, 5); |
|
51 | + add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5); |
|
52 | + add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5); |
|
53 | + add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5); |
|
54 | + add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5); |
|
55 | + add_action('cmb2_render_api', 'give_api_callback', 10, 5); |
|
56 | + add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @since 1.0 |
64 | 64 | */ |
65 | 65 | public function init() { |
66 | - register_setting( $this->key, $this->key ); |
|
66 | + register_setting($this->key, $this->key); |
|
67 | 67 | |
68 | 68 | } |
69 | 69 | |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return mixed |
79 | 79 | */ |
80 | - public function give_update_cmb_meta_box_url( $url ) { |
|
80 | + public function give_update_cmb_meta_box_url($url) { |
|
81 | 81 | //Path to Give's CMB |
82 | - return GIVE_PLUGIN_URL . '/includes/libraries/cmb2'; |
|
82 | + return GIVE_PLUGIN_URL.'/includes/libraries/cmb2'; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,27 +91,27 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function give_get_settings_tabs() { |
93 | 93 | |
94 | - $settings = $this->give_settings( null ); |
|
94 | + $settings = $this->give_settings(null); |
|
95 | 95 | |
96 | 96 | $tabs = array(); |
97 | - $tabs['general'] = esc_html__( 'General', 'give' ); |
|
98 | - $tabs['gateways'] = esc_html__( 'Payment Gateways', 'give' ); |
|
99 | - $tabs['display'] = esc_html__( 'Display Options', 'give' ); |
|
100 | - $tabs['emails'] = esc_html__( 'Emails', 'give' ); |
|
97 | + $tabs['general'] = esc_html__('General', 'give'); |
|
98 | + $tabs['gateways'] = esc_html__('Payment Gateways', 'give'); |
|
99 | + $tabs['display'] = esc_html__('Display Options', 'give'); |
|
100 | + $tabs['emails'] = esc_html__('Emails', 'give'); |
|
101 | 101 | |
102 | - if ( ! empty( $settings['addons']['fields'] ) ) { |
|
103 | - $tabs['addons'] = esc_html__( 'Add-ons', 'give' ); |
|
102 | + if ( ! empty($settings['addons']['fields'])) { |
|
103 | + $tabs['addons'] = esc_html__('Add-ons', 'give'); |
|
104 | 104 | } |
105 | 105 | |
106 | - if ( ! empty( $settings['licenses']['fields'] ) ) { |
|
107 | - $tabs['licenses'] = esc_html__( 'Licenses', 'give' ); |
|
106 | + if ( ! empty($settings['licenses']['fields'])) { |
|
107 | + $tabs['licenses'] = esc_html__('Licenses', 'give'); |
|
108 | 108 | } |
109 | 109 | |
110 | - $tabs['advanced'] = esc_html__( 'Advanced', 'give' ); |
|
111 | - $tabs['api'] = esc_html__( 'API', 'give' ); |
|
112 | - $tabs['system_info'] = esc_html__( 'System Info', 'give' ); |
|
110 | + $tabs['advanced'] = esc_html__('Advanced', 'give'); |
|
111 | + $tabs['api'] = esc_html__('API', 'give'); |
|
112 | + $tabs['system_info'] = esc_html__('System Info', 'give'); |
|
113 | 113 | |
114 | - return apply_filters( 'give_settings_tabs', $tabs ); |
|
114 | + return apply_filters('give_settings_tabs', $tabs); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function admin_page_display() { |
123 | 123 | |
124 | - $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general'; |
|
124 | + $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general'; |
|
125 | 125 | |
126 | 126 | ?> |
127 | 127 | |
@@ -131,22 +131,22 @@ discard block |
||
131 | 131 | |
132 | 132 | <h2 class="nav-tab-wrapper"> |
133 | 133 | <?php |
134 | - foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) { |
|
134 | + foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) { |
|
135 | 135 | |
136 | - $tab_url = esc_url( add_query_arg( array( |
|
136 | + $tab_url = esc_url(add_query_arg(array( |
|
137 | 137 | 'settings-updated' => false, |
138 | 138 | 'tab' => $tab_id |
139 | - ) ) ); |
|
139 | + ))); |
|
140 | 140 | |
141 | 141 | $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; |
142 | 142 | |
143 | - echo '<a href="' . esc_url( $tab_url ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>'; |
|
143 | + echo '<a href="'.esc_url($tab_url).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>'; |
|
144 | 144 | |
145 | 145 | } |
146 | 146 | ?> |
147 | 147 | </h2> |
148 | 148 | |
149 | - <?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?> |
|
149 | + <?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?> |
|
150 | 150 | |
151 | 151 | </div><!-- .wrap --> |
152 | 152 | |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | * |
169 | 169 | * @return string |
170 | 170 | */ |
171 | - function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) { |
|
171 | + function give_modify_cmb2_form_output($form_format, $object_id, $cmb) { |
|
172 | 172 | |
173 | 173 | //only modify the give settings form |
174 | - if ( 'give_settings' == $object_id ) { |
|
174 | + if ('give_settings' == $object_id) { |
|
175 | 175 | |
176 | - return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . esc_attr__( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>'; |
|
176 | + return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.esc_attr__('Save Settings', 'give').'" class="button-primary"></div></form>'; |
|
177 | 177 | |
178 | 178 | } |
179 | 179 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * |
191 | 191 | * @return array |
192 | 192 | */ |
193 | - public function give_settings( $active_tab ) { |
|
193 | + public function give_settings($active_tab) { |
|
194 | 194 | |
195 | 195 | $give_settings = array( |
196 | 196 | /** |
@@ -198,99 +198,99 @@ discard block |
||
198 | 198 | */ |
199 | 199 | 'general' => array( |
200 | 200 | 'id' => 'general_settings', |
201 | - 'give_title' => esc_html__( 'General Settings', 'give' ), |
|
202 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
203 | - 'fields' => apply_filters( 'give_settings_general', array( |
|
201 | + 'give_title' => esc_html__('General Settings', 'give'), |
|
202 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
203 | + 'fields' => apply_filters('give_settings_general', array( |
|
204 | 204 | array( |
205 | - 'name' => esc_html__( 'General Settings', 'give' ), |
|
205 | + 'name' => esc_html__('General Settings', 'give'), |
|
206 | 206 | 'desc' => '', |
207 | 207 | 'type' => 'give_title', |
208 | 208 | 'id' => 'give_title_general_settings_1' |
209 | 209 | ), |
210 | 210 | array( |
211 | - 'name' => esc_html__( 'Success Page', 'give' ), |
|
211 | + 'name' => esc_html__('Success Page', 'give'), |
|
212 | 212 | /* translators: %s: [give_receipt] */ |
213 | - 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
213 | + 'desc' => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
214 | 214 | 'id' => 'success_page', |
215 | 215 | 'type' => 'select', |
216 | - 'options' => give_cmb2_get_post_options( array( |
|
216 | + 'options' => give_cmb2_get_post_options(array( |
|
217 | 217 | 'post_type' => 'page', |
218 | - 'numberposts' => - 1 |
|
219 | - ) ), |
|
218 | + 'numberposts' => -1 |
|
219 | + )), |
|
220 | 220 | ), |
221 | 221 | array( |
222 | - 'name' => esc_html__( 'Failed Donation Page', 'give' ), |
|
223 | - 'desc' => esc_html__( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ), |
|
222 | + 'name' => esc_html__('Failed Donation Page', 'give'), |
|
223 | + 'desc' => esc_html__('The page donors are sent to if their donation is cancelled or fails.', 'give'), |
|
224 | 224 | 'id' => 'failure_page', |
225 | 225 | 'type' => 'select', |
226 | - 'options' => give_cmb2_get_post_options( array( |
|
226 | + 'options' => give_cmb2_get_post_options(array( |
|
227 | 227 | 'post_type' => 'page', |
228 | - 'numberposts' => - 1 |
|
229 | - ) ), |
|
228 | + 'numberposts' => -1 |
|
229 | + )), |
|
230 | 230 | ), |
231 | 231 | array( |
232 | - 'name' => esc_html__( 'Donation History Page', 'give' ), |
|
232 | + 'name' => esc_html__('Donation History Page', 'give'), |
|
233 | 233 | /* translators: %s: [donation_history] */ |
234 | - 'desc' => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
234 | + 'desc' => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
235 | 235 | 'id' => 'history_page', |
236 | 236 | 'type' => 'select', |
237 | - 'options' => give_cmb2_get_post_options( array( |
|
237 | + 'options' => give_cmb2_get_post_options(array( |
|
238 | 238 | 'post_type' => 'page', |
239 | - 'numberposts' => - 1 |
|
240 | - ) ), |
|
239 | + 'numberposts' => -1 |
|
240 | + )), |
|
241 | 241 | ), |
242 | 242 | array( |
243 | - 'name' => esc_html__( 'Base Country', 'give' ), |
|
244 | - 'desc' => esc_html__( 'The country your site operates from.', 'give' ), |
|
243 | + 'name' => esc_html__('Base Country', 'give'), |
|
244 | + 'desc' => esc_html__('The country your site operates from.', 'give'), |
|
245 | 245 | 'id' => 'base_country', |
246 | 246 | 'type' => 'select', |
247 | 247 | 'options' => give_get_country_list(), |
248 | 248 | ), |
249 | 249 | array( |
250 | - 'name' => esc_html__( 'Currency Settings', 'give' ), |
|
250 | + 'name' => esc_html__('Currency Settings', 'give'), |
|
251 | 251 | 'desc' => '', |
252 | 252 | 'type' => 'give_title', |
253 | 253 | 'id' => 'give_title_general_settings_2' |
254 | 254 | ), |
255 | 255 | array( |
256 | - 'name' => esc_html__( 'Currency', 'give' ), |
|
257 | - 'desc' => esc_html__( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
256 | + 'name' => esc_html__('Currency', 'give'), |
|
257 | + 'desc' => esc_html__('The donation currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
258 | 258 | 'id' => 'currency', |
259 | 259 | 'type' => 'select', |
260 | 260 | 'options' => give_get_currencies(), |
261 | 261 | 'default' => 'USD', |
262 | 262 | ), |
263 | 263 | array( |
264 | - 'name' => esc_html__( 'Currency Position', 'give' ), |
|
265 | - 'desc' => esc_html__( 'The position of the currency symbol.', 'give' ), |
|
264 | + 'name' => esc_html__('Currency Position', 'give'), |
|
265 | + 'desc' => esc_html__('The position of the currency symbol.', 'give'), |
|
266 | 266 | 'id' => 'currency_position', |
267 | 267 | 'type' => 'select', |
268 | 268 | 'options' => array( |
269 | 269 | /* translators: %s: currency symbol */ |
270 | - 'before' => sprintf( esc_html__( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
270 | + 'before' => sprintf(esc_html__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())), |
|
271 | 271 | /* translators: %s: currency symbol */ |
272 | - 'after' => sprintf( esc_html__( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) ) |
|
272 | + 'after' => sprintf(esc_html__('After - 10%s', 'give'), give_currency_symbol(give_get_currency())) |
|
273 | 273 | ), |
274 | 274 | 'default' => 'before', |
275 | 275 | ), |
276 | 276 | array( |
277 | - 'name' => esc_html__( 'Thousands Separator', 'give' ), |
|
278 | - 'desc' => esc_html__( 'The symbol (usually , or .) to separate thousands.', 'give' ), |
|
277 | + 'name' => esc_html__('Thousands Separator', 'give'), |
|
278 | + 'desc' => esc_html__('The symbol (usually , or .) to separate thousands.', 'give'), |
|
279 | 279 | 'id' => 'thousands_separator', |
280 | 280 | 'type' => 'text_small', |
281 | 281 | 'sanitization_cb' => 'give_sanitize_thousand_separator', |
282 | 282 | 'default' => ',', |
283 | 283 | ), |
284 | 284 | array( |
285 | - 'name' => esc_html__( 'Decimal Separator', 'give' ), |
|
286 | - 'desc' => esc_html__( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
285 | + 'name' => esc_html__('Decimal Separator', 'give'), |
|
286 | + 'desc' => esc_html__('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
287 | 287 | 'id' => 'decimal_separator', |
288 | 288 | 'type' => 'text_small', |
289 | 289 | 'default' => '.', |
290 | 290 | ), |
291 | 291 | array( |
292 | - 'name' => esc_html__( 'Number of Decimals', 'give' ), |
|
293 | - 'desc' => esc_html__( 'The number of decimal points displayed in amounts.', 'give' ), |
|
292 | + 'name' => esc_html__('Number of Decimals', 'give'), |
|
293 | + 'desc' => esc_html__('The number of decimal points displayed in amounts.', 'give'), |
|
294 | 294 | 'id' => 'number_decimals', |
295 | 295 | 'type' => 'text_small', |
296 | 296 | 'default' => 2, |
@@ -304,83 +304,83 @@ discard block |
||
304 | 304 | */ |
305 | 305 | 'gateways' => array( |
306 | 306 | 'id' => 'payment_gateways', |
307 | - 'give_title' => esc_html__( 'Payment Gateways', 'give' ), |
|
308 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
309 | - 'fields' => apply_filters( 'give_settings_gateways', array( |
|
307 | + 'give_title' => esc_html__('Payment Gateways', 'give'), |
|
308 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
309 | + 'fields' => apply_filters('give_settings_gateways', array( |
|
310 | 310 | array( |
311 | - 'name' => esc_html__( 'Gateways Settings', 'give' ), |
|
311 | + 'name' => esc_html__('Gateways Settings', 'give'), |
|
312 | 312 | 'desc' => '', |
313 | 313 | 'id' => 'give_title_gateway_settings_1', |
314 | 314 | 'type' => 'give_title' |
315 | 315 | ), |
316 | 316 | array( |
317 | - 'name' => esc_html__( 'Test Mode', 'give' ), |
|
318 | - 'desc' => esc_html__( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
317 | + 'name' => esc_html__('Test Mode', 'give'), |
|
318 | + 'desc' => esc_html__('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
319 | 319 | 'id' => 'test_mode', |
320 | 320 | 'type' => 'checkbox' |
321 | 321 | ), |
322 | 322 | array( |
323 | - 'name' => esc_html__( 'Enabled Gateways', 'give' ), |
|
324 | - 'desc' => esc_html__( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ), |
|
323 | + 'name' => esc_html__('Enabled Gateways', 'give'), |
|
324 | + 'desc' => esc_html__('Enable your payment gateway. Can be ordered by dragging.', 'give'), |
|
325 | 325 | 'id' => 'gateways', |
326 | 326 | 'type' => 'enabled_gateways' |
327 | 327 | ), |
328 | 328 | array( |
329 | - 'name' => esc_html__( 'Default Gateway', 'give' ), |
|
330 | - 'desc' => esc_html__( 'The gateway that will be selected by default.', 'give' ), |
|
329 | + 'name' => esc_html__('Default Gateway', 'give'), |
|
330 | + 'desc' => esc_html__('The gateway that will be selected by default.', 'give'), |
|
331 | 331 | 'id' => 'default_gateway', |
332 | 332 | 'type' => 'default_gateway' |
333 | 333 | ), |
334 | 334 | array( |
335 | - 'name' => esc_html__( 'PayPal Standard', 'give' ), |
|
335 | + 'name' => esc_html__('PayPal Standard', 'give'), |
|
336 | 336 | 'desc' => '', |
337 | 337 | 'type' => 'give_title', |
338 | 338 | 'id' => 'give_title_gateway_settings_2', |
339 | 339 | ), |
340 | 340 | array( |
341 | - 'name' => esc_html__( 'PayPal Email', 'give' ), |
|
342 | - 'desc' => esc_html__( 'Enter your PayPal account\'s email.', 'give' ), |
|
341 | + 'name' => esc_html__('PayPal Email', 'give'), |
|
342 | + 'desc' => esc_html__('Enter your PayPal account\'s email.', 'give'), |
|
343 | 343 | 'id' => 'paypal_email', |
344 | 344 | 'type' => 'text_email', |
345 | 345 | ), |
346 | 346 | array( |
347 | - 'name' => esc_html__( 'PayPal Page Style', 'give' ), |
|
348 | - 'desc' => esc_html__( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ), |
|
347 | + 'name' => esc_html__('PayPal Page Style', 'give'), |
|
348 | + 'desc' => esc_html__('Enter the name of the page style to use, or leave blank to use the default.', 'give'), |
|
349 | 349 | 'id' => 'paypal_page_style', |
350 | 350 | 'type' => 'text', |
351 | 351 | ), |
352 | 352 | array( |
353 | - 'name' => esc_html__( 'PayPal Transaction Type', 'give' ), |
|
354 | - 'desc' => esc_html__( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
353 | + 'name' => esc_html__('PayPal Transaction Type', 'give'), |
|
354 | + 'desc' => esc_html__('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
355 | 355 | 'id' => 'paypal_button_type', |
356 | 356 | 'type' => 'radio_inline', |
357 | 357 | 'options' => array( |
358 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
359 | - 'standard' => esc_html__( 'Standard Transaction', 'give' ) |
|
358 | + 'donation' => esc_html__('Donation', 'give'), |
|
359 | + 'standard' => esc_html__('Standard Transaction', 'give') |
|
360 | 360 | ), |
361 | 361 | 'default' => 'donation', |
362 | 362 | ), |
363 | 363 | array( |
364 | - 'name' => esc_html__( 'Disable PayPal IPN Verification', 'give' ), |
|
365 | - 'desc' => esc_html__( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ), |
|
364 | + 'name' => esc_html__('Disable PayPal IPN Verification', 'give'), |
|
365 | + 'desc' => esc_html__('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'), |
|
366 | 366 | 'id' => 'disable_paypal_verification', |
367 | 367 | 'type' => 'checkbox' |
368 | 368 | ), |
369 | 369 | array( |
370 | - 'name' => esc_html__( 'Offline Donations', 'give' ), |
|
370 | + 'name' => esc_html__('Offline Donations', 'give'), |
|
371 | 371 | 'desc' => '', |
372 | 372 | 'type' => 'give_title', |
373 | 373 | 'id' => 'give_title_gateway_settings_3', |
374 | 374 | ), |
375 | 375 | array( |
376 | - 'name' => esc_html__( 'Collect Billing Details', 'give' ), |
|
377 | - 'desc' => esc_html__( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ), |
|
376 | + 'name' => esc_html__('Collect Billing Details', 'give'), |
|
377 | + 'desc' => esc_html__('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'), |
|
378 | 378 | 'id' => 'give_offline_donation_enable_billing_fields', |
379 | 379 | 'type' => 'checkbox' |
380 | 380 | ), |
381 | 381 | array( |
382 | - 'name' => esc_html__( 'Offline Donation Instructions', 'give' ), |
|
383 | - 'desc' => esc_html__( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
382 | + 'name' => esc_html__('Offline Donation Instructions', 'give'), |
|
383 | + 'desc' => esc_html__('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
384 | 384 | 'id' => 'global_offline_donation_content', |
385 | 385 | 'default' => give_get_default_offline_donation_content(), |
386 | 386 | 'type' => 'wysiwyg', |
@@ -389,15 +389,15 @@ discard block |
||
389 | 389 | ) |
390 | 390 | ), |
391 | 391 | array( |
392 | - 'name' => esc_html__( 'Offline Donation Email Instructions Subject', 'give' ), |
|
393 | - 'desc' => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
392 | + 'name' => esc_html__('Offline Donation Email Instructions Subject', 'give'), |
|
393 | + 'desc' => esc_html__('Enter the subject line for the donation receipt email.', 'give'), |
|
394 | 394 | 'id' => 'offline_donation_subject', |
395 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
395 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
396 | 396 | 'type' => 'text' |
397 | 397 | ), |
398 | 398 | array( |
399 | - 'name' => esc_html__( 'Offline Donation Email Instructions', 'give' ), |
|
400 | - 'desc' => esc_html__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
399 | + 'name' => esc_html__('Offline Donation Email Instructions', 'give'), |
|
400 | + 'desc' => esc_html__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
401 | 401 | 'id' => 'global_offline_donation_email', |
402 | 402 | 'default' => give_get_default_offline_donation_email_content(), |
403 | 403 | 'type' => 'wysiwyg', |
@@ -411,100 +411,100 @@ discard block |
||
411 | 411 | /** Display Settings */ |
412 | 412 | 'display' => array( |
413 | 413 | 'id' => 'display_settings', |
414 | - 'give_title' => esc_html__( 'Display Settings', 'give' ), |
|
415 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
416 | - 'fields' => apply_filters( 'give_settings_display', array( |
|
414 | + 'give_title' => esc_html__('Display Settings', 'give'), |
|
415 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
416 | + 'fields' => apply_filters('give_settings_display', array( |
|
417 | 417 | array( |
418 | - 'name' => esc_html__( 'Display Settings', 'give' ), |
|
418 | + 'name' => esc_html__('Display Settings', 'give'), |
|
419 | 419 | 'desc' => '', |
420 | 420 | 'id' => 'give_title_display_settings_1', |
421 | 421 | 'type' => 'give_title' |
422 | 422 | ), |
423 | 423 | array( |
424 | - 'name' => esc_html__( 'Disable CSS', 'give' ), |
|
425 | - 'desc' => esc_html__( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ), |
|
424 | + 'name' => esc_html__('Disable CSS', 'give'), |
|
425 | + 'desc' => esc_html__('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'), |
|
426 | 426 | 'id' => 'disable_css', |
427 | 427 | 'type' => 'checkbox' |
428 | 428 | ), |
429 | 429 | array( |
430 | - 'name' => esc_html__( 'Enable Floating Labels', 'give' ), |
|
430 | + 'name' => esc_html__('Enable Floating Labels', 'give'), |
|
431 | 431 | /* translators: %s: https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */ |
432 | - 'desc' => sprintf( wp_kses( __( 'Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ), |
|
432 | + 'desc' => sprintf(wp_kses(__('Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')), |
|
433 | 433 | 'id' => 'floatlabels', |
434 | 434 | 'type' => 'checkbox' |
435 | 435 | ), |
436 | 436 | array( |
437 | - 'name' => esc_html__( 'Disable Welcome Screen', 'give' ), |
|
437 | + 'name' => esc_html__('Disable Welcome Screen', 'give'), |
|
438 | 438 | /* translators: %s: about page URL */ |
439 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give' ), array( |
|
439 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give'), array( |
|
440 | 440 | 'a' => array( |
441 | 441 | 'href' => array(), |
442 | 442 | 'target' => array() |
443 | 443 | ) |
444 | - ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
444 | + )), esc_url(admin_url('index.php?page=give-about'))), |
|
445 | 445 | 'id' => 'disable_welcome', |
446 | 446 | 'type' => 'checkbox' |
447 | 447 | ), |
448 | 448 | array( |
449 | - 'name' => esc_html__( 'Post Types', 'give' ), |
|
449 | + 'name' => esc_html__('Post Types', 'give'), |
|
450 | 450 | 'desc' => '', |
451 | 451 | 'id' => 'give_title_display_settings_2', |
452 | 452 | 'type' => 'give_title' |
453 | 453 | ), |
454 | 454 | array( |
455 | - 'name' => esc_html__( 'Disable Form Single Views', 'give' ), |
|
456 | - 'desc' => esc_html__( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
455 | + 'name' => esc_html__('Disable Form Single Views', 'give'), |
|
456 | + 'desc' => esc_html__('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
457 | 457 | 'id' => 'disable_forms_singular', |
458 | 458 | 'type' => 'checkbox' |
459 | 459 | ), |
460 | 460 | array( |
461 | - 'name' => esc_html__( 'Disable Form Archives', 'give' ), |
|
462 | - 'desc' => esc_html__( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ), |
|
461 | + 'name' => esc_html__('Disable Form Archives', 'give'), |
|
462 | + 'desc' => esc_html__('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'), |
|
463 | 463 | 'id' => 'disable_forms_archives', |
464 | 464 | 'type' => 'checkbox' |
465 | 465 | ), |
466 | 466 | array( |
467 | - 'name' => esc_html__( 'Disable Form Excerpts', 'give' ), |
|
468 | - 'desc' => esc_html__( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
467 | + 'name' => esc_html__('Disable Form Excerpts', 'give'), |
|
468 | + 'desc' => esc_html__('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
469 | 469 | 'id' => 'disable_forms_excerpt', |
470 | 470 | 'type' => 'checkbox' |
471 | 471 | ), |
472 | 472 | |
473 | 473 | array( |
474 | - 'name' => esc_html__( 'Featured Image Size', 'give' ), |
|
475 | - 'desc' => esc_html__( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ), |
|
474 | + 'name' => esc_html__('Featured Image Size', 'give'), |
|
475 | + 'desc' => esc_html__('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'), |
|
476 | 476 | 'id' => 'featured_image_size', |
477 | 477 | 'type' => 'select', |
478 | 478 | 'default' => 'large', |
479 | 479 | 'options' => give_get_featured_image_sizes() |
480 | 480 | ), |
481 | 481 | array( |
482 | - 'name' => esc_html__( 'Disable Form Featured Image', 'give' ), |
|
483 | - 'desc' => esc_html__( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
482 | + 'name' => esc_html__('Disable Form Featured Image', 'give'), |
|
483 | + 'desc' => esc_html__('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
484 | 484 | 'id' => 'disable_form_featured_img', |
485 | 485 | 'type' => 'checkbox' |
486 | 486 | ), |
487 | 487 | array( |
488 | - 'name' => esc_html__( 'Disable Single Form Sidebar', 'give' ), |
|
489 | - 'desc' => esc_html__( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
488 | + 'name' => esc_html__('Disable Single Form Sidebar', 'give'), |
|
489 | + 'desc' => esc_html__('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
490 | 490 | 'id' => 'disable_form_sidebar', |
491 | 491 | 'type' => 'checkbox' |
492 | 492 | ), |
493 | 493 | array( |
494 | - 'name' => esc_html__( 'Taxonomies', 'give' ), |
|
494 | + 'name' => esc_html__('Taxonomies', 'give'), |
|
495 | 495 | 'desc' => '', |
496 | 496 | 'id' => 'give_title_display_settings_3', |
497 | 497 | 'type' => 'give_title' |
498 | 498 | ), |
499 | 499 | array( |
500 | - 'name' => esc_html__( 'Enable Form Categories', 'give' ), |
|
501 | - 'desc' => esc_html__( 'Enables the "Category" taxonomy for all Give forms.', 'give' ), |
|
500 | + 'name' => esc_html__('Enable Form Categories', 'give'), |
|
501 | + 'desc' => esc_html__('Enables the "Category" taxonomy for all Give forms.', 'give'), |
|
502 | 502 | 'id' => 'categories', |
503 | 503 | 'type' => 'checkbox' |
504 | 504 | ), |
505 | 505 | array( |
506 | - 'name' => esc_html__( 'Enable Form Tags', 'give' ), |
|
507 | - 'desc' => esc_html__( 'Enables the "Tag" taxonomy for all Give forms.', 'give' ), |
|
506 | + 'name' => esc_html__('Enable Form Tags', 'give'), |
|
507 | + 'desc' => esc_html__('Enables the "Tag" taxonomy for all Give forms.', 'give'), |
|
508 | 508 | 'id' => 'tags', |
509 | 509 | 'type' => 'checkbox' |
510 | 510 | ), |
@@ -538,101 +538,101 @@ discard block |
||
538 | 538 | */ |
539 | 539 | 'emails' => array( |
540 | 540 | 'id' => 'email_settings', |
541 | - 'give_title' => esc_html__( 'Email Settings', 'give' ), |
|
542 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
543 | - 'fields' => apply_filters( 'give_settings_emails', array( |
|
541 | + 'give_title' => esc_html__('Email Settings', 'give'), |
|
542 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
543 | + 'fields' => apply_filters('give_settings_emails', array( |
|
544 | 544 | array( |
545 | - 'name' => esc_html__( 'Email Settings', 'give' ), |
|
545 | + 'name' => esc_html__('Email Settings', 'give'), |
|
546 | 546 | 'desc' => '', |
547 | 547 | 'id' => 'give_title_email_settings_1', |
548 | 548 | 'type' => 'give_title' |
549 | 549 | ), |
550 | 550 | array( |
551 | 551 | 'id' => 'email_template', |
552 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
553 | - 'desc' => esc_html__( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ), |
|
552 | + 'name' => esc_html__('Email Template', 'give'), |
|
553 | + 'desc' => esc_html__('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'), |
|
554 | 554 | 'type' => 'select', |
555 | 555 | 'options' => give_get_email_templates() |
556 | 556 | ), |
557 | 557 | array( |
558 | 558 | 'id' => 'email_logo', |
559 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
560 | - 'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
559 | + 'name' => esc_html__('Logo', 'give'), |
|
560 | + 'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
561 | 561 | 'type' => 'file' |
562 | 562 | ), |
563 | 563 | array( |
564 | 564 | 'id' => 'from_name', |
565 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
566 | - 'desc' => esc_html__( 'The name that appears in the "From" field in donation receipt emails.', 'give' ), |
|
567 | - 'default' => get_bloginfo( 'name' ), |
|
565 | + 'name' => esc_html__('From Name', 'give'), |
|
566 | + 'desc' => esc_html__('The name that appears in the "From" field in donation receipt emails.', 'give'), |
|
567 | + 'default' => get_bloginfo('name'), |
|
568 | 568 | 'type' => 'text' |
569 | 569 | ), |
570 | 570 | array( |
571 | 571 | 'id' => 'from_email', |
572 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
573 | - 'desc' => esc_html__( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ), |
|
574 | - 'default' => get_bloginfo( 'admin_email' ), |
|
572 | + 'name' => esc_html__('From Email', 'give'), |
|
573 | + 'desc' => esc_html__('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'), |
|
574 | + 'default' => get_bloginfo('admin_email'), |
|
575 | 575 | 'type' => 'text' |
576 | 576 | ), |
577 | 577 | array( |
578 | - 'name' => esc_html__( 'Donation Receipt', 'give' ), |
|
578 | + 'name' => esc_html__('Donation Receipt', 'give'), |
|
579 | 579 | 'desc' => '', |
580 | 580 | 'id' => 'give_title_email_settings_2', |
581 | 581 | 'type' => 'give_title' |
582 | 582 | ), |
583 | 583 | array( |
584 | 584 | 'id' => 'donation_subject', |
585 | - 'name' => esc_html__( 'Donation Email Subject', 'give' ), |
|
586 | - 'desc' => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
587 | - 'default' => esc_attr__( 'Donation Receipt', 'give' ), |
|
585 | + 'name' => esc_html__('Donation Email Subject', 'give'), |
|
586 | + 'desc' => esc_html__('Enter the subject line for the donation receipt email.', 'give'), |
|
587 | + 'default' => esc_attr__('Donation Receipt', 'give'), |
|
588 | 588 | 'type' => 'text' |
589 | 589 | ), |
590 | 590 | array( |
591 | 591 | 'id' => 'donation_receipt', |
592 | - 'name' => esc_html__( 'Donation Receipt', 'give' ), |
|
592 | + 'name' => esc_html__('Donation Receipt', 'give'), |
|
593 | 593 | 'desc' => sprintf( |
594 | 594 | /* translators: %s: emails tags list */ |
595 | - esc_html__( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ), |
|
596 | - '<br/>' . give_get_emails_tags_list() |
|
595 | + esc_html__('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'), |
|
596 | + '<br/>'.give_get_emails_tags_list() |
|
597 | 597 | ), |
598 | 598 | 'type' => 'wysiwyg', |
599 | 599 | 'default' => give_get_default_donation_receipt_email() |
600 | 600 | ), |
601 | 601 | array( |
602 | - 'name' => esc_html__( 'New Donation Notification', 'give' ), |
|
602 | + 'name' => esc_html__('New Donation Notification', 'give'), |
|
603 | 603 | 'desc' => '', |
604 | 604 | 'id' => 'give_title_email_settings_3', |
605 | 605 | 'type' => 'give_title' |
606 | 606 | ), |
607 | 607 | array( |
608 | 608 | 'id' => 'donation_notification_subject', |
609 | - 'name' => esc_html__( 'Donation Notification Subject', 'give' ), |
|
610 | - 'desc' => esc_html__( 'Enter the subject line for the donation notification email.', 'give' ), |
|
609 | + 'name' => esc_html__('Donation Notification Subject', 'give'), |
|
610 | + 'desc' => esc_html__('Enter the subject line for the donation notification email.', 'give'), |
|
611 | 611 | 'type' => 'text', |
612 | - 'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ) |
|
612 | + 'default' => esc_attr__('New Donation - #{payment_id}', 'give') |
|
613 | 613 | ), |
614 | 614 | array( |
615 | 615 | 'id' => 'donation_notification', |
616 | - 'name' => esc_html__( 'Donation Notification', 'give' ), |
|
616 | + 'name' => esc_html__('Donation Notification', 'give'), |
|
617 | 617 | 'desc' => sprintf( |
618 | 618 | /* translators: %s: emails tags list */ |
619 | - esc_html__( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ), |
|
620 | - '<br/>' . give_get_emails_tags_list() |
|
619 | + esc_html__('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'), |
|
620 | + '<br/>'.give_get_emails_tags_list() |
|
621 | 621 | ), |
622 | 622 | 'type' => 'wysiwyg', |
623 | 623 | 'default' => give_get_default_donation_notification_email() |
624 | 624 | ), |
625 | 625 | array( |
626 | 626 | 'id' => 'admin_notice_emails', |
627 | - 'name' => esc_html__( 'Donation Notification Emails', 'give' ), |
|
628 | - 'desc' => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ), |
|
627 | + 'name' => esc_html__('Donation Notification Emails', 'give'), |
|
628 | + 'desc' => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'), |
|
629 | 629 | 'type' => 'textarea', |
630 | - 'default' => get_bloginfo( 'admin_email' ) |
|
630 | + 'default' => get_bloginfo('admin_email') |
|
631 | 631 | ), |
632 | 632 | array( |
633 | 633 | 'id' => 'disable_admin_notices', |
634 | - 'name' => esc_html__( 'Disable Admin Notifications', 'give' ), |
|
635 | - 'desc' => esc_html__( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ), |
|
634 | + 'name' => esc_html__('Disable Admin Notifications', 'give'), |
|
635 | + 'desc' => esc_html__('Check this box if you do not want to receive emails when new donations are made.', 'give'), |
|
636 | 636 | 'type' => 'checkbox' |
637 | 637 | ) |
638 | 638 | ) |
@@ -641,99 +641,99 @@ discard block |
||
641 | 641 | /** Extension Settings */ |
642 | 642 | 'addons' => array( |
643 | 643 | 'id' => 'addons', |
644 | - 'give_title' => esc_html__( 'Give Add-ons Settings', 'give' ), |
|
645 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
646 | - 'fields' => apply_filters( 'give_settings_addons', array() |
|
644 | + 'give_title' => esc_html__('Give Add-ons Settings', 'give'), |
|
645 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
646 | + 'fields' => apply_filters('give_settings_addons', array() |
|
647 | 647 | ) |
648 | 648 | ), |
649 | 649 | /** Licenses Settings */ |
650 | 650 | 'licenses' => array( |
651 | 651 | 'id' => 'licenses', |
652 | - 'give_title' => esc_html__( 'Give Licenses', 'give' ), |
|
653 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
654 | - 'fields' => apply_filters( 'give_settings_licenses', array() |
|
652 | + 'give_title' => esc_html__('Give Licenses', 'give'), |
|
653 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
654 | + 'fields' => apply_filters('give_settings_licenses', array() |
|
655 | 655 | ) |
656 | 656 | ), |
657 | 657 | /** Advanced Options */ |
658 | 658 | 'advanced' => array( |
659 | 659 | 'id' => 'advanced_options', |
660 | - 'give_title' => esc_html__( 'Advanced Options', 'give' ), |
|
661 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
662 | - 'fields' => apply_filters( 'give_settings_advanced', array( |
|
660 | + 'give_title' => esc_html__('Advanced Options', 'give'), |
|
661 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
662 | + 'fields' => apply_filters('give_settings_advanced', array( |
|
663 | 663 | array( |
664 | - 'name' => esc_html__( 'Access Control', 'give' ), |
|
664 | + 'name' => esc_html__('Access Control', 'give'), |
|
665 | 665 | 'desc' => '', |
666 | 666 | 'id' => 'give_title_session_control_1', |
667 | 667 | 'type' => 'give_title' |
668 | 668 | ), |
669 | 669 | array( |
670 | 670 | 'id' => 'session_lifetime', |
671 | - 'name' => esc_html__( 'Session Lifetime', 'give' ), |
|
672 | - 'desc' => esc_html__( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ), |
|
671 | + 'name' => esc_html__('Session Lifetime', 'give'), |
|
672 | + 'desc' => esc_html__('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'), |
|
673 | 673 | 'type' => 'select', |
674 | 674 | 'options' => array( |
675 | - '86400' => esc_html__( '24 Hours', 'give' ), |
|
676 | - '172800' => esc_html__( '48 Hours', 'give' ), |
|
677 | - '259200' => esc_html__( '72 Hours', 'give' ), |
|
678 | - '604800' => esc_html__( '1 Week', 'give' ), |
|
675 | + '86400' => esc_html__('24 Hours', 'give'), |
|
676 | + '172800' => esc_html__('48 Hours', 'give'), |
|
677 | + '259200' => esc_html__('72 Hours', 'give'), |
|
678 | + '604800' => esc_html__('1 Week', 'give'), |
|
679 | 679 | ) |
680 | 680 | ), |
681 | 681 | array( |
682 | - 'name' => esc_html__( 'Email Access', 'give' ), |
|
683 | - 'desc' => esc_html__( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
682 | + 'name' => esc_html__('Email Access', 'give'), |
|
683 | + 'desc' => esc_html__('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
684 | 684 | 'id' => 'email_access', |
685 | 685 | 'type' => 'checkbox', |
686 | 686 | ), |
687 | 687 | array( |
688 | 688 | 'id' => 'recaptcha_key', |
689 | - 'name' => esc_html__( 'reCAPTCHA Site Key', 'give' ), |
|
689 | + 'name' => esc_html__('reCAPTCHA Site Key', 'give'), |
|
690 | 690 | /* translators: %s: https://www.google.com/recaptcha/ */ |
691 | - 'desc' => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ), |
|
691 | + 'desc' => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')), |
|
692 | 692 | 'default' => '', |
693 | 693 | 'type' => 'text' |
694 | 694 | ), |
695 | 695 | array( |
696 | 696 | 'id' => 'recaptcha_secret', |
697 | - 'name' => esc_html__( 'reCAPTCHA Secret Key', 'give' ), |
|
698 | - 'desc' => esc_html__( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ), |
|
697 | + 'name' => esc_html__('reCAPTCHA Secret Key', 'give'), |
|
698 | + 'desc' => esc_html__('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'), |
|
699 | 699 | 'default' => '', |
700 | 700 | 'type' => 'text' |
701 | 701 | ), |
702 | 702 | array( |
703 | - 'name' => esc_html__( 'Data Control', 'give' ), |
|
703 | + 'name' => esc_html__('Data Control', 'give'), |
|
704 | 704 | 'desc' => '', |
705 | 705 | 'id' => 'give_title_data_control_2', |
706 | 706 | 'type' => 'give_title' |
707 | 707 | ), |
708 | 708 | array( |
709 | - 'name' => esc_html__( 'Remove All Data on Uninstall?', 'give' ), |
|
710 | - 'desc' => esc_html__( 'When the plugin is deleted, completely remove all Give data.', 'give' ), |
|
709 | + 'name' => esc_html__('Remove All Data on Uninstall?', 'give'), |
|
710 | + 'desc' => esc_html__('When the plugin is deleted, completely remove all Give data.', 'give'), |
|
711 | 711 | 'id' => 'uninstall_on_delete', |
712 | 712 | 'type' => 'checkbox' |
713 | 713 | ), |
714 | 714 | array( |
715 | - 'name' => esc_html__( 'Filter Control', 'give' ), |
|
715 | + 'name' => esc_html__('Filter Control', 'give'), |
|
716 | 716 | 'desc' => '', |
717 | 717 | 'id' => 'give_title_filter_control', |
718 | 718 | 'type' => 'give_title' |
719 | 719 | ), |
720 | 720 | array( |
721 | 721 | /* translators: %s: the_content */ |
722 | - 'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ), |
|
722 | + 'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'), |
|
723 | 723 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
724 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
724 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
725 | 725 | 'id' => 'disable_the_content_filter', |
726 | 726 | 'type' => 'checkbox' |
727 | 727 | ), |
728 | 728 | array( |
729 | - 'name' => esc_html__( 'Script Loading', 'give' ), |
|
729 | + 'name' => esc_html__('Script Loading', 'give'), |
|
730 | 730 | 'desc' => '', |
731 | 731 | 'id' => 'give_title_script_control', |
732 | 732 | 'type' => 'give_title' |
733 | 733 | ), |
734 | 734 | array( |
735 | - 'name' => esc_html__( 'Load Scripts in Footer?', 'give' ), |
|
736 | - 'desc' => esc_html__( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ), |
|
735 | + 'name' => esc_html__('Load Scripts in Footer?', 'give'), |
|
736 | + 'desc' => esc_html__('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'), |
|
737 | 737 | 'id' => 'scripts_footer', |
738 | 738 | 'type' => 'checkbox' |
739 | 739 | ) |
@@ -743,13 +743,13 @@ discard block |
||
743 | 743 | /** API Settings */ |
744 | 744 | 'api' => array( |
745 | 745 | 'id' => 'api', |
746 | - 'give_title' => esc_html__( 'API', 'give' ), |
|
747 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
746 | + 'give_title' => esc_html__('API', 'give'), |
|
747 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
748 | 748 | 'show_names' => false, // Hide field names on the left |
749 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
749 | + 'fields' => apply_filters('give_settings_system', array( |
|
750 | 750 | array( |
751 | 751 | 'id' => 'api', |
752 | - 'name' => esc_html__( 'API', 'give' ), |
|
752 | + 'name' => esc_html__('API', 'give'), |
|
753 | 753 | 'type' => 'api' |
754 | 754 | ) |
755 | 755 | ) |
@@ -758,13 +758,13 @@ discard block |
||
758 | 758 | /** Licenses Settings */ |
759 | 759 | 'system_info' => array( |
760 | 760 | 'id' => 'system_info', |
761 | - 'give_title' => esc_html__( 'System Info', 'give' ), |
|
762 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
763 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
761 | + 'give_title' => esc_html__('System Info', 'give'), |
|
762 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
763 | + 'fields' => apply_filters('give_settings_system', array( |
|
764 | 764 | array( |
765 | 765 | 'id' => 'system-info-textarea', |
766 | - 'name' => esc_html__( 'System Info', 'give' ), |
|
767 | - 'desc' => esc_html__( 'Please copy and paste this information in your ticket when contacting support.', 'give' ), |
|
766 | + 'name' => esc_html__('System Info', 'give'), |
|
767 | + 'desc' => esc_html__('Please copy and paste this information in your ticket when contacting support.', 'give'), |
|
768 | 768 | 'type' => 'system_info' |
769 | 769 | ) |
770 | 770 | ) |
@@ -772,16 +772,16 @@ discard block |
||
772 | 772 | ), |
773 | 773 | ); |
774 | 774 | |
775 | - $give_settings = apply_filters( 'give_registered_settings', $give_settings ); |
|
775 | + $give_settings = apply_filters('give_registered_settings', $give_settings); |
|
776 | 776 | |
777 | 777 | //Return all settings array if no active tab |
778 | - if ( empty( $active_tab ) || ! isset( $give_settings[ $active_tab ] ) ) { |
|
778 | + if (empty($active_tab) || ! isset($give_settings[$active_tab])) { |
|
779 | 779 | return $give_settings; |
780 | 780 | } |
781 | 781 | |
782 | 782 | |
783 | 783 | // Add other tabs and settings fields as needed |
784 | - return $give_settings[ $active_tab ]; |
|
784 | + return $give_settings[$active_tab]; |
|
785 | 785 | |
786 | 786 | } |
787 | 787 | |
@@ -790,11 +790,11 @@ discard block |
||
790 | 790 | */ |
791 | 791 | public function settings_notices() { |
792 | 792 | |
793 | - if ( ! isset( $_POST['give_settings_saved'] ) ) { |
|
793 | + if ( ! isset($_POST['give_settings_saved'])) { |
|
794 | 794 | return; |
795 | 795 | } |
796 | 796 | |
797 | - add_settings_error( 'give-notices', 'global-settings-updated', esc_html__( 'Settings updated.', 'give' ), 'updated' ); |
|
797 | + add_settings_error('give-notices', 'global-settings-updated', esc_html__('Settings updated.', 'give'), 'updated'); |
|
798 | 798 | |
799 | 799 | } |
800 | 800 | |
@@ -809,17 +809,17 @@ discard block |
||
809 | 809 | * @return mixed Field value or exception is thrown. |
810 | 810 | * @throws Exception Throws an exception if the field is invalid. |
811 | 811 | */ |
812 | - public function __get( $field ) { |
|
812 | + public function __get($field) { |
|
813 | 813 | |
814 | 814 | // Allowed fields to retrieve |
815 | - if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) { |
|
815 | + if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) { |
|
816 | 816 | return $this->{$field}; |
817 | 817 | } |
818 | - if ( 'option_metabox' === $field ) { |
|
818 | + if ('option_metabox' === $field) { |
|
819 | 819 | return $this->option_metabox(); |
820 | 820 | } |
821 | 821 | |
822 | - throw new Exception( sprintf( esc_html__( 'Invalid property: %s', 'give' ), $field ) ); |
|
822 | + throw new Exception(sprintf(esc_html__('Invalid property: %s', 'give'), $field)); |
|
823 | 823 | } |
824 | 824 | |
825 | 825 | |
@@ -837,12 +837,12 @@ discard block |
||
837 | 837 | * |
838 | 838 | * @return mixed Option value |
839 | 839 | */ |
840 | -function give_get_option( $key = '', $default = false ) { |
|
840 | +function give_get_option($key = '', $default = false) { |
|
841 | 841 | $give_options = give_get_settings(); |
842 | - $value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default; |
|
843 | - $value = apply_filters( 'give_get_option', $value, $key, $default ); |
|
842 | + $value = ! empty($give_options[$key]) ? $give_options[$key] : $default; |
|
843 | + $value = apply_filters('give_get_option', $value, $key, $default); |
|
844 | 844 | |
845 | - return apply_filters( "give_get_option_{$key}", $value, $key, $default ); |
|
845 | + return apply_filters("give_get_option_{$key}", $value, $key, $default); |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | |
@@ -860,33 +860,33 @@ discard block |
||
860 | 860 | * |
861 | 861 | * @return boolean True if updated, false if not. |
862 | 862 | */ |
863 | -function give_update_option( $key = '', $value = false ) { |
|
863 | +function give_update_option($key = '', $value = false) { |
|
864 | 864 | |
865 | 865 | // If no key, exit |
866 | - if ( empty( $key ) ) { |
|
866 | + if (empty($key)) { |
|
867 | 867 | return false; |
868 | 868 | } |
869 | 869 | |
870 | - if ( empty( $value ) ) { |
|
871 | - $remove_option = give_delete_option( $key ); |
|
870 | + if (empty($value)) { |
|
871 | + $remove_option = give_delete_option($key); |
|
872 | 872 | |
873 | 873 | return $remove_option; |
874 | 874 | } |
875 | 875 | |
876 | 876 | // First let's grab the current settings |
877 | - $options = get_option( 'give_settings' ); |
|
877 | + $options = get_option('give_settings'); |
|
878 | 878 | |
879 | 879 | // Let's let devs alter that value coming in |
880 | - $value = apply_filters( 'give_update_option', $value, $key ); |
|
880 | + $value = apply_filters('give_update_option', $value, $key); |
|
881 | 881 | |
882 | 882 | // Next let's try to update the value |
883 | - $options[ $key ] = $value; |
|
884 | - $did_update = update_option( 'give_settings', $options ); |
|
883 | + $options[$key] = $value; |
|
884 | + $did_update = update_option('give_settings', $options); |
|
885 | 885 | |
886 | 886 | // If it updated, let's update the global variable |
887 | - if ( $did_update ) { |
|
887 | + if ($did_update) { |
|
888 | 888 | global $give_options; |
889 | - $give_options[ $key ] = $value; |
|
889 | + $give_options[$key] = $value; |
|
890 | 890 | } |
891 | 891 | |
892 | 892 | return $did_update; |
@@ -905,27 +905,27 @@ discard block |
||
905 | 905 | * |
906 | 906 | * @return boolean True if updated, false if not. |
907 | 907 | */ |
908 | -function give_delete_option( $key = '' ) { |
|
908 | +function give_delete_option($key = '') { |
|
909 | 909 | |
910 | 910 | // If no key, exit |
911 | - if ( empty( $key ) ) { |
|
911 | + if (empty($key)) { |
|
912 | 912 | return false; |
913 | 913 | } |
914 | 914 | |
915 | 915 | // First let's grab the current settings |
916 | - $options = get_option( 'give_settings' ); |
|
916 | + $options = get_option('give_settings'); |
|
917 | 917 | |
918 | 918 | // Next let's try to update the value |
919 | - if ( isset( $options[ $key ] ) ) { |
|
919 | + if (isset($options[$key])) { |
|
920 | 920 | |
921 | - unset( $options[ $key ] ); |
|
921 | + unset($options[$key]); |
|
922 | 922 | |
923 | 923 | } |
924 | 924 | |
925 | - $did_update = update_option( 'give_settings', $options ); |
|
925 | + $did_update = update_option('give_settings', $options); |
|
926 | 926 | |
927 | 927 | // If it updated, let's update the global variable |
928 | - if ( $did_update ) { |
|
928 | + if ($did_update) { |
|
929 | 929 | global $give_options; |
930 | 930 | $give_options = $options; |
931 | 931 | } |
@@ -944,9 +944,9 @@ discard block |
||
944 | 944 | */ |
945 | 945 | function give_get_settings() { |
946 | 946 | |
947 | - $settings = get_option( 'give_settings' ); |
|
947 | + $settings = get_option('give_settings'); |
|
948 | 948 | |
949 | - return (array) apply_filters( 'give_get_settings', $settings ); |
|
949 | + return (array) apply_filters('give_get_settings', $settings); |
|
950 | 950 | |
951 | 951 | } |
952 | 952 | |
@@ -964,25 +964,25 @@ discard block |
||
964 | 964 | * |
965 | 965 | * @return array |
966 | 966 | */ |
967 | -function give_settings_array_insert( $array, $position, $insert ) { |
|
968 | - if ( is_int( $position ) ) { |
|
969 | - array_splice( $array, $position, 0, $insert ); |
|
967 | +function give_settings_array_insert($array, $position, $insert) { |
|
968 | + if (is_int($position)) { |
|
969 | + array_splice($array, $position, 0, $insert); |
|
970 | 970 | } else { |
971 | 971 | |
972 | - foreach ( $array as $index => $subarray ) { |
|
973 | - if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) { |
|
972 | + foreach ($array as $index => $subarray) { |
|
973 | + if (isset($subarray['id']) && $subarray['id'] == $position) { |
|
974 | 974 | $pos = $index; |
975 | 975 | } |
976 | 976 | } |
977 | 977 | |
978 | - if ( ! isset( $pos ) ) { |
|
978 | + if ( ! isset($pos)) { |
|
979 | 979 | return $array; |
980 | 980 | } |
981 | 981 | |
982 | 982 | $array = array_merge( |
983 | - array_slice( $array, 0, $pos ), |
|
983 | + array_slice($array, 0, $pos), |
|
984 | 984 | $insert, |
985 | - array_slice( $array, $pos ) |
|
985 | + array_slice($array, $pos) |
|
986 | 986 | ); |
987 | 987 | } |
988 | 988 | |
@@ -1000,23 +1000,23 @@ discard block |
||
1000 | 1000 | * @param array $saved_values |
1001 | 1001 | * @return void |
1002 | 1002 | */ |
1003 | -function give_enabled_gateways_callback( $field_arr, $saved_values = array() ) { |
|
1003 | +function give_enabled_gateways_callback($field_arr, $saved_values = array()) { |
|
1004 | 1004 | |
1005 | 1005 | $id = $field_arr['id']; |
1006 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
1006 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
1007 | 1007 | |
1008 | 1008 | echo '<ul class="give-checklist-fields give-payment-gatways-list">'; |
1009 | 1009 | |
1010 | - foreach ( $gateways as $key => $option ) : |
|
1010 | + foreach ($gateways as $key => $option) : |
|
1011 | 1011 | |
1012 | - if ( is_array( $saved_values ) && array_key_exists( $key, $saved_values ) ) { |
|
1012 | + if (is_array($saved_values) && array_key_exists($key, $saved_values)) { |
|
1013 | 1013 | $enabled = '1'; |
1014 | 1014 | } else { |
1015 | 1015 | $enabled = null; |
1016 | 1016 | } |
1017 | 1017 | |
1018 | - echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/> '; |
|
1019 | - echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>'; |
|
1018 | + echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/> '; |
|
1019 | + echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>'; |
|
1020 | 1020 | |
1021 | 1021 | endforeach; |
1022 | 1022 | |
@@ -1033,16 +1033,16 @@ discard block |
||
1033 | 1033 | * @param array $saved_value |
1034 | 1034 | * @return void |
1035 | 1035 | */ |
1036 | -function give_default_gateway_callback( $field_arr, $saved_value ) { |
|
1036 | +function give_default_gateway_callback($field_arr, $saved_value) { |
|
1037 | 1037 | $id = $field_arr['id']; |
1038 | 1038 | $gateways = give_get_enabled_payment_gateways(); |
1039 | - $saved_value = give_get_default_gateway( null ); |
|
1039 | + $saved_value = give_get_default_gateway(null); |
|
1040 | 1040 | |
1041 | - echo '<select class="give-select" name="' . $id . '" id="' . $id . '">'; |
|
1041 | + echo '<select class="give-select" name="'.$id.'" id="'.$id.'">'; |
|
1042 | 1042 | |
1043 | - foreach ( $gateways as $key => $option ) : |
|
1044 | - $selected = isset( $saved_value ) ? selected( $key, $saved_value, false ) : ''; |
|
1045 | - echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
1043 | + foreach ($gateways as $key => $option) : |
|
1044 | + $selected = isset($saved_value) ? selected($key, $saved_value, false) : ''; |
|
1045 | + echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>'; |
|
1046 | 1046 | endforeach; |
1047 | 1047 | |
1048 | 1048 | echo '</select>'; |
@@ -1060,13 +1060,13 @@ discard block |
||
1060 | 1060 | * |
1061 | 1061 | * @return void |
1062 | 1062 | */ |
1063 | -function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1063 | +function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1064 | 1064 | |
1065 | 1065 | $id = $field_type_object->field->args['id']; |
1066 | 1066 | $title = $field_type_object->field->args['name']; |
1067 | 1067 | $field_description = $field_type_object->field->args['desc']; |
1068 | 1068 | |
1069 | - echo '<hr>' . $field_description; |
|
1069 | + echo '<hr>'.$field_description; |
|
1070 | 1070 | |
1071 | 1071 | } |
1072 | 1072 | |
@@ -1081,7 +1081,7 @@ discard block |
||
1081 | 1081 | * |
1082 | 1082 | * @return void |
1083 | 1083 | */ |
1084 | -function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1084 | +function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1085 | 1085 | |
1086 | 1086 | $id = $field_type_object->field->args['id']; |
1087 | 1087 | $title = $field_type_object->field->args['name']; |
@@ -1101,25 +1101,25 @@ discard block |
||
1101 | 1101 | * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types |
1102 | 1102 | * @return array An array of options that matches the CMB2 options array |
1103 | 1103 | */ |
1104 | -function give_cmb2_get_post_options( $query_args, $force = false ) { |
|
1104 | +function give_cmb2_get_post_options($query_args, $force = false) { |
|
1105 | 1105 | |
1106 | - $post_options = array( '' => '' ); // Blank option |
|
1106 | + $post_options = array('' => ''); // Blank option |
|
1107 | 1107 | |
1108 | - if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) { |
|
1108 | + if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) { |
|
1109 | 1109 | return $post_options; |
1110 | 1110 | } |
1111 | 1111 | |
1112 | - $args = wp_parse_args( $query_args, array( |
|
1112 | + $args = wp_parse_args($query_args, array( |
|
1113 | 1113 | 'post_type' => 'page', |
1114 | 1114 | 'numberposts' => 10, |
1115 | - ) ); |
|
1115 | + )); |
|
1116 | 1116 | |
1117 | - $posts = get_posts( $args ); |
|
1117 | + $posts = get_posts($args); |
|
1118 | 1118 | |
1119 | - if ( $posts ) { |
|
1120 | - foreach ( $posts as $post ) { |
|
1119 | + if ($posts) { |
|
1120 | + foreach ($posts as $post) { |
|
1121 | 1121 | |
1122 | - $post_options[ $post->ID ] = $post->post_title; |
|
1122 | + $post_options[$post->ID] = $post->post_title; |
|
1123 | 1123 | |
1124 | 1124 | } |
1125 | 1125 | } |
@@ -1143,21 +1143,21 @@ discard block |
||
1143 | 1143 | $get_sizes = get_intermediate_image_sizes(); |
1144 | 1144 | |
1145 | 1145 | // check whether intermediate image sizes exist first |
1146 | - if ( empty( $get_sizes ) ) { |
|
1147 | - $get_sizes = array( 'thumbnail', 'medium', 'medium_large', 'large' ); |
|
1146 | + if (empty($get_sizes)) { |
|
1147 | + $get_sizes = array('thumbnail', 'medium', 'medium_large', 'large'); |
|
1148 | 1148 | } |
1149 | 1149 | |
1150 | - foreach ( $get_sizes as $_size ) { |
|
1150 | + foreach ($get_sizes as $_size) { |
|
1151 | 1151 | |
1152 | - if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) { |
|
1153 | - $sizes[ $_size ] = $_size . ' - ' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" ); |
|
1154 | - } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) { |
|
1155 | - $sizes[ $_size ] = $_size . ' - ' . $_wp_additional_image_sizes[ $_size ]['width'] . 'x' . $_wp_additional_image_sizes[ $_size ]['height']; |
|
1152 | + if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) { |
|
1153 | + $sizes[$_size] = $_size.' - '.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h"); |
|
1154 | + } elseif (isset($_wp_additional_image_sizes[$_size])) { |
|
1155 | + $sizes[$_size] = $_size.' - '.$_wp_additional_image_sizes[$_size]['width'].'x'.$_wp_additional_image_sizes[$_size]['height']; |
|
1156 | 1156 | } |
1157 | 1157 | |
1158 | 1158 | } |
1159 | 1159 | |
1160 | - return apply_filters( 'give_get_featured_image_sizes', $sizes ); |
|
1160 | + return apply_filters('give_get_featured_image_sizes', $sizes); |
|
1161 | 1161 | } |
1162 | 1162 | |
1163 | 1163 | |
@@ -1172,18 +1172,18 @@ discard block |
||
1172 | 1172 | * |
1173 | 1173 | * @return void |
1174 | 1174 | */ |
1175 | -function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1175 | +function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1176 | 1176 | /* @var CMB2_Types $field_type_object */ |
1177 | 1177 | |
1178 | 1178 | $id = $field_type_object->field->args['id']; |
1179 | 1179 | $field_description = $field_type_object->field->args['desc']; |
1180 | 1180 | $license = $field_type_object->field->args['options']['license']; |
1181 | 1181 | $license_key = $escaped_value; |
1182 | - $is_license_key = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) ); |
|
1183 | - $is_valid_license = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) ); |
|
1182 | + $is_license_key = apply_filters('give_is_license_key', (is_object($license) && ! empty($license))); |
|
1183 | + $is_valid_license = apply_filters('give_is_valid_license', ($is_license_key && property_exists($license, 'license') && 'valid' === $license->license)); |
|
1184 | 1184 | $shortname = $field_type_object->field->args['options']['shortname']; |
1185 | 1185 | $field_classes = 'regular-text give-license-field'; |
1186 | - $type = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password'; |
|
1186 | + $type = empty($escaped_value) || ! $is_valid_license ? 'text' : 'password'; |
|
1187 | 1187 | $custom_html = ''; |
1188 | 1188 | $messages = array(); |
1189 | 1189 | $class = ''; |
@@ -1195,17 +1195,17 @@ discard block |
||
1195 | 1195 | |
1196 | 1196 | // By default query on edd api url will return license object which contain status and message property, this can break below functionality. |
1197 | 1197 | // To combat that check if status is set to error or not, if yes then set $is_license_key to false. |
1198 | - if ( $is_license_key && property_exists( $license, 'status' ) && 'error' === $license->status ) { |
|
1198 | + if ($is_license_key && property_exists($license, 'status') && 'error' === $license->status) { |
|
1199 | 1199 | $is_license_key = false; |
1200 | 1200 | } |
1201 | 1201 | |
1202 | 1202 | |
1203 | 1203 | // Check if current license is part of subscription or not. |
1204 | - $subscriptions = get_option( 'give_subscriptions' ); |
|
1204 | + $subscriptions = get_option('give_subscriptions'); |
|
1205 | 1205 | |
1206 | - if ( $is_license_key && $subscriptions ) { |
|
1207 | - foreach ( $subscriptions as $subscription ) { |
|
1208 | - if ( in_array( $license_key, $subscription['licenses'] ) ) { |
|
1206 | + if ($is_license_key && $subscriptions) { |
|
1207 | + foreach ($subscriptions as $subscription) { |
|
1208 | + if (in_array($license_key, $subscription['licenses'])) { |
|
1209 | 1209 | $is_in_subscription = $subscription['id']; |
1210 | 1210 | break; |
1211 | 1211 | } |
@@ -1213,121 +1213,121 @@ discard block |
||
1213 | 1213 | } |
1214 | 1214 | |
1215 | 1215 | |
1216 | - if ( $is_license_key ) { |
|
1217 | - if ( $is_in_subscription ) { |
|
1218 | - $subscription_expires = strtotime( $subscriptions[ $is_in_subscription ]['expires'] ); |
|
1219 | - $subscription_status = esc_html__( 'renew', 'give' ); |
|
1216 | + if ($is_license_key) { |
|
1217 | + if ($is_in_subscription) { |
|
1218 | + $subscription_expires = strtotime($subscriptions[$is_in_subscription]['expires']); |
|
1219 | + $subscription_status = esc_html__('renew', 'give'); |
|
1220 | 1220 | |
1221 | - if ( ( 'active' !== $subscriptions[ $is_in_subscription ]['status'] ) ) { |
|
1222 | - $subscription_status = esc_html__( 'expire', 'give' ); |
|
1221 | + if (('active' !== $subscriptions[$is_in_subscription]['status'])) { |
|
1222 | + $subscription_status = esc_html__('expire', 'give'); |
|
1223 | 1223 | } |
1224 | 1224 | |
1225 | - if ( $subscription_expires < current_time( 'timestamp', 1 ) ) { |
|
1226 | - $messages[] = sprintf( |
|
1227 | - __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ), |
|
1228 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1229 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1230 | - $checkout_page_link . '?edd_license_key=' . $subscriptions[ $is_in_subscription ]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1225 | + if ($subscription_expires < current_time('timestamp', 1)) { |
|
1226 | + $messages[] = sprintf( |
|
1227 | + __('Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give'), |
|
1228 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1229 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1230 | + $checkout_page_link.'?edd_license_key='.$subscriptions[$is_in_subscription]['license_key'].'&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1231 | 1231 | ); |
1232 | 1232 | $license_status = 'license-expired'; |
1233 | - } elseif ( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) { |
|
1233 | + } elseif (strtotime('- 7 days', $subscription_expires) < current_time('timestamp', 1)) { |
|
1234 | 1234 | $messages[] = sprintf( |
1235 | - __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give' ), |
|
1236 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1237 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1235 | + __('Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give'), |
|
1236 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1237 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1238 | 1238 | $subscription_status, |
1239 | - human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[ $is_in_subscription ]['expires'] ) ) |
|
1239 | + human_time_diff(current_time('timestamp', 1), strtotime($subscriptions[$is_in_subscription]['expires'])) |
|
1240 | 1240 | ); |
1241 | 1241 | $license_status = 'license-expires-soon'; |
1242 | 1242 | } else { |
1243 | 1243 | $messages[] = sprintf( |
1244 | - __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give' ), |
|
1245 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1246 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1244 | + __('Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give'), |
|
1245 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1246 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1247 | 1247 | $subscription_status, |
1248 | - date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[ $is_in_subscription ]['expires'], current_time( 'timestamp' ) ) ) |
|
1248 | + date_i18n(get_option('date_format'), strtotime($subscriptions[$is_in_subscription]['expires'], current_time('timestamp'))) |
|
1249 | 1249 | ); |
1250 | 1250 | $license_status = 'license-expiration-date'; |
1251 | 1251 | } |
1252 | 1252 | |
1253 | 1253 | |
1254 | - } elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) { |
|
1254 | + } elseif (empty($license->success) && property_exists($license, 'error')) { |
|
1255 | 1255 | |
1256 | 1256 | // activate_license 'invalid' on anything other than valid, so if there was an error capture it |
1257 | - switch( $license->error ) { |
|
1257 | + switch ($license->error) { |
|
1258 | 1258 | case 'expired' : |
1259 | 1259 | $class = $license->error; |
1260 | 1260 | $messages[] = sprintf( |
1261 | - __( 'Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ), |
|
1262 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ), |
|
1263 | - $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1261 | + __('Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give'), |
|
1262 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))), |
|
1263 | + $checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1264 | 1264 | ); |
1265 | - $license_status = 'license-' . $class; |
|
1265 | + $license_status = 'license-'.$class; |
|
1266 | 1266 | break; |
1267 | 1267 | |
1268 | 1268 | case 'missing' : |
1269 | 1269 | $class = $license->error; |
1270 | 1270 | $messages[] = sprintf( |
1271 | - __( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ), |
|
1272 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing' |
|
1271 | + __('Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give'), |
|
1272 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=missing' |
|
1273 | 1273 | ); |
1274 | - $license_status = 'license-' . $class; |
|
1274 | + $license_status = 'license-'.$class; |
|
1275 | 1275 | break; |
1276 | 1276 | |
1277 | 1277 | case 'invalid' : |
1278 | 1278 | $class = $license->error; |
1279 | 1279 | $messages[] = sprintf( |
1280 | - __( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1280 | + __('Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1281 | 1281 | $addon_name, |
1282 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1282 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1283 | 1283 | ); |
1284 | - $license_status = 'license-' . $class; |
|
1284 | + $license_status = 'license-'.$class; |
|
1285 | 1285 | break; |
1286 | 1286 | |
1287 | 1287 | case 'site_inactive' : |
1288 | 1288 | $class = $license->error; |
1289 | 1289 | $messages[] = sprintf( |
1290 | - __( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1290 | + __('Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1291 | 1291 | $addon_name, |
1292 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1292 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1293 | 1293 | ); |
1294 | - $license_status = 'license-' . $class; |
|
1294 | + $license_status = 'license-'.$class; |
|
1295 | 1295 | break; |
1296 | 1296 | |
1297 | 1297 | case 'item_name_mismatch' : |
1298 | 1298 | $class = $license->error; |
1299 | - $messages[] = sprintf( __( 'This license %s does not belong to %s.', 'give' ), $license_key, $addon_name ); |
|
1300 | - $license_status = 'license-' . $class; |
|
1299 | + $messages[] = sprintf(__('This license %s does not belong to %s.', 'give'), $license_key, $addon_name); |
|
1300 | + $license_status = 'license-'.$class; |
|
1301 | 1301 | break; |
1302 | 1302 | |
1303 | 1303 | case 'no_activations_left': |
1304 | 1304 | $class = $license->error; |
1305 | - $messages[] = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link ); |
|
1306 | - $license_status = 'license-' . $class; |
|
1305 | + $messages[] = sprintf(__('Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give'), $account_page_link); |
|
1306 | + $license_status = 'license-'.$class; |
|
1307 | 1307 | break; |
1308 | 1308 | } |
1309 | 1309 | } else { |
1310 | - switch ( $license->license ) { |
|
1310 | + switch ($license->license) { |
|
1311 | 1311 | case 'valid' : |
1312 | 1312 | default: |
1313 | 1313 | $class = 'valid'; |
1314 | - $now = current_time( 'timestamp' ); |
|
1315 | - $expiration = strtotime( $license->expires, current_time( 'timestamp' ) ); |
|
1314 | + $now = current_time('timestamp'); |
|
1315 | + $expiration = strtotime($license->expires, current_time('timestamp')); |
|
1316 | 1316 | |
1317 | - if ( 'lifetime' === $license->expires ) { |
|
1318 | - $messages[] = esc_html__( 'License key never expires.', 'give' ); |
|
1317 | + if ('lifetime' === $license->expires) { |
|
1318 | + $messages[] = esc_html__('License key never expires.', 'give'); |
|
1319 | 1319 | $license_status = 'license-lifetime-notice'; |
1320 | - } elseif ( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) { |
|
1320 | + } elseif ($expiration > $now && $expiration - $now < (DAY_IN_SECONDS * 30)) { |
|
1321 | 1321 | $messages[] = sprintf( |
1322 | - __( 'Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ), |
|
1323 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ), |
|
1324 | - $checkout_page_link . '?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew' |
|
1322 | + __('Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give'), |
|
1323 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))), |
|
1324 | + $checkout_page_link.'?edd_license_key='.$value.'&utm_campaign=admin&utm_source=licenses&utm_medium=renew' |
|
1325 | 1325 | ); |
1326 | 1326 | $license_status = 'license-expires-soon'; |
1327 | 1327 | } else { |
1328 | 1328 | $messages[] = sprintf( |
1329 | - __( 'Your license key expires on %s.', 'give' ), |
|
1330 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ) |
|
1329 | + __('Your license key expires on %s.', 'give'), |
|
1330 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))) |
|
1331 | 1331 | ); |
1332 | 1332 | $license_status = 'license-expiration-date'; |
1333 | 1333 | } |
@@ -1335,8 +1335,8 @@ discard block |
||
1335 | 1335 | } |
1336 | 1336 | } |
1337 | 1337 | } else { |
1338 | - $messages[] = sprintf( |
|
1339 | - __( 'To receive updates, please enter your valid %s license key.', 'give' ), |
|
1338 | + $messages[] = sprintf( |
|
1339 | + __('To receive updates, please enter your valid %s license key.', 'give'), |
|
1340 | 1340 | $addon_name |
1341 | 1341 | ); |
1342 | 1342 | $license_status = 'inactive'; |
@@ -1344,7 +1344,7 @@ discard block |
||
1344 | 1344 | |
1345 | 1345 | |
1346 | 1346 | // Add class for input field if license is active. |
1347 | - if ( $is_valid_license ) { |
|
1347 | + if ($is_valid_license) { |
|
1348 | 1348 | $field_classes .= ' give-license-active'; |
1349 | 1349 | } |
1350 | 1350 | |
@@ -1352,35 +1352,35 @@ discard block |
||
1352 | 1352 | $input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\">"; |
1353 | 1353 | |
1354 | 1354 | // If license is active so show deactivate button. |
1355 | - if ( $is_valid_license ) { |
|
1355 | + if ($is_valid_license) { |
|
1356 | 1356 | // Get input field html. |
1357 | 1357 | $input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\" readonly=\"readonly\">"; |
1358 | 1358 | |
1359 | - $custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>'; |
|
1359 | + $custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>'; |
|
1360 | 1360 | |
1361 | 1361 | |
1362 | 1362 | } |
1363 | 1363 | |
1364 | 1364 | // Field description. |
1365 | - $custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>'; |
|
1365 | + $custom_html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>'; |
|
1366 | 1366 | |
1367 | 1367 | // If no messages found then inform user that to get updated in future register yourself. |
1368 | - if ( empty( $messages ) ) { |
|
1369 | - $messages[] = apply_filters( "{$shortname}_default_addon_notice", esc_html__( 'To receive updates, please enter your valid license key.', 'give' ) ); |
|
1368 | + if (empty($messages)) { |
|
1369 | + $messages[] = apply_filters("{$shortname}_default_addon_notice", esc_html__('To receive updates, please enter your valid license key.', 'give')); |
|
1370 | 1370 | } |
1371 | 1371 | |
1372 | - foreach( $messages as $message ) { |
|
1373 | - $custom_html .= '<div class="give-license-status-notice give-' . $license_status . '">'; |
|
1374 | - $custom_html .= '<p>' . $message . '</p>'; |
|
1372 | + foreach ($messages as $message) { |
|
1373 | + $custom_html .= '<div class="give-license-status-notice give-'.$license_status.'">'; |
|
1374 | + $custom_html .= '<p>'.$message.'</p>'; |
|
1375 | 1375 | $custom_html .= '</div>'; |
1376 | 1376 | } |
1377 | 1377 | |
1378 | 1378 | |
1379 | 1379 | // Field html. |
1380 | - $custom_html = apply_filters( 'give_license_key_field_html', $input_field_html . $custom_html, $field_type_object ); |
|
1380 | + $custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object); |
|
1381 | 1381 | |
1382 | 1382 | // Nonce. |
1383 | - wp_nonce_field( $id . '-nonce', $id . '-nonce' ); |
|
1383 | + wp_nonce_field($id.'-nonce', $id.'-nonce'); |
|
1384 | 1384 | |
1385 | 1385 | // Print field html. |
1386 | 1386 | echo "<div class=\"give-license-key\"><label for=\"{$id}\">{$addon_name }</label></div><div class=\"give-license-block\">{$custom_html}</div>"; |
@@ -1395,7 +1395,7 @@ discard block |
||
1395 | 1395 | */ |
1396 | 1396 | function give_api_callback() { |
1397 | 1397 | |
1398 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
1398 | + if ( ! current_user_can('manage_give_settings')) { |
|
1399 | 1399 | return; |
1400 | 1400 | } |
1401 | 1401 | |
@@ -1404,9 +1404,9 @@ discard block |
||
1404 | 1404 | * |
1405 | 1405 | * @since 1.0 |
1406 | 1406 | */ |
1407 | - do_action( 'give_tools_api_keys_before' ); |
|
1407 | + do_action('give_tools_api_keys_before'); |
|
1408 | 1408 | |
1409 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
1409 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
1410 | 1410 | |
1411 | 1411 | $api_keys_table = new Give_API_Keys_Table(); |
1412 | 1412 | $api_keys_table->prepare_items(); |
@@ -1415,9 +1415,9 @@ discard block |
||
1415 | 1415 | <span class="cmb2-metabox-description api-description"> |
1416 | 1416 | <?php echo sprintf( |
1417 | 1417 | /* translators: 1: https://givewp.com/documentation/give-api-reference/ 2: https://givewp.com/addons/zapier/ */ |
1418 | - __( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ), |
|
1419 | - esc_url( 'https://givewp.com/documentation/give-api-reference/' ), |
|
1420 | - esc_url( 'https://givewp.com/addons/zapier/' ) |
|
1418 | + __('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'), |
|
1419 | + esc_url('https://givewp.com/documentation/give-api-reference/'), |
|
1420 | + esc_url('https://givewp.com/addons/zapier/') |
|
1421 | 1421 | ); ?> |
1422 | 1422 | </span> |
1423 | 1423 | <?php |
@@ -1427,10 +1427,10 @@ discard block |
||
1427 | 1427 | * |
1428 | 1428 | * @since 1.0 |
1429 | 1429 | */ |
1430 | - do_action( 'give_tools_api_keys_after' ); |
|
1430 | + do_action('give_tools_api_keys_after'); |
|
1431 | 1431 | } |
1432 | 1432 | |
1433 | -add_action( 'give_settings_tab_api_keys', 'give_api_callback' ); |
|
1433 | +add_action('give_settings_tab_api_keys', 'give_api_callback'); |
|
1434 | 1434 | |
1435 | 1435 | /** |
1436 | 1436 | * Hook Callback |
@@ -1443,7 +1443,7 @@ discard block |
||
1443 | 1443 | * |
1444 | 1444 | * @return void |
1445 | 1445 | */ |
1446 | -function give_hook_callback( $args ) { |
|
1446 | +function give_hook_callback($args) { |
|
1447 | 1447 | |
1448 | 1448 | $id = $args['id']; |
1449 | 1449 | |
@@ -1452,7 +1452,7 @@ discard block |
||
1452 | 1452 | * |
1453 | 1453 | * @since 1.0 |
1454 | 1454 | */ |
1455 | - do_action( "give_{$id}" ); |
|
1455 | + do_action("give_{$id}"); |
|
1456 | 1456 | |
1457 | 1457 | } |
1458 | 1458 | |
@@ -1465,19 +1465,19 @@ discard block |
||
1465 | 1465 | * @param string $compare_with |
1466 | 1466 | * @return bool |
1467 | 1467 | */ |
1468 | -function give_is_setting_enabled( $value, $compare_with = null ) { |
|
1469 | - if( ! is_null( $compare_with ) ) { |
|
1468 | +function give_is_setting_enabled($value, $compare_with = null) { |
|
1469 | + if ( ! is_null($compare_with)) { |
|
1470 | 1470 | |
1471 | - if( is_array( $compare_with ) ) { |
|
1471 | + if (is_array($compare_with)) { |
|
1472 | 1472 | // Output. |
1473 | - return in_array( $value, $compare_with ); |
|
1473 | + return in_array($value, $compare_with); |
|
1474 | 1474 | } |
1475 | 1475 | |
1476 | 1476 | // Output. |
1477 | - return ( $value === $compare_with ); |
|
1477 | + return ($value === $compare_with); |
|
1478 | 1478 | } |
1479 | 1479 | |
1480 | 1480 | // Backward compatibility: From version 1.8 most of setting is modified to enabled/disabled |
1481 | 1481 | // Output. |
1482 | - return ( in_array( $value, array( 'enabled', 'on', 'yes' ) ) ? true : false ); |
|
1482 | + return (in_array($value, array('enabled', 'on', 'yes')) ? true : false); |
|
1483 | 1483 | } |
1484 | 1484 | \ No newline at end of file |
@@ -85,7 +85,7 @@ |
||
85 | 85 | * |
86 | 86 | * @since 1.8 |
87 | 87 | * |
88 | - * @param $setting_tab |
|
88 | + * @param string $setting_tab |
|
89 | 89 | * |
90 | 90 | * @return string |
91 | 91 | */ |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! class_exists( 'Give_CMB2_Settings_Loader' ) ) : |
|
12 | +if ( ! class_exists('Give_CMB2_Settings_Loader')) : |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * This class loads the cmb2 settings. |
@@ -52,30 +52,30 @@ discard block |
||
52 | 52 | |
53 | 53 | // Get current tab. |
54 | 54 | $this->current_tab = give_get_current_setting_tab(); |
55 | - $this->current_section = empty( $_REQUEST['section'] ) ? ( current( array_keys( $this->get_sections() ) ) ) : sanitize_title( $_REQUEST['section'] ); |
|
55 | + $this->current_section = empty($_REQUEST['section']) ? (current(array_keys($this->get_sections()))) : sanitize_title($_REQUEST['section']); |
|
56 | 56 | |
57 | 57 | // Tab ID. |
58 | 58 | $this->id = $this->current_tab; |
59 | 59 | |
60 | 60 | // Add addon tabs. |
61 | - add_filter( 'give-settings_tabs_array', array( $this, 'add_addon_settings_page' ), 999999 ); |
|
61 | + add_filter('give-settings_tabs_array', array($this, 'add_addon_settings_page'), 999999); |
|
62 | 62 | |
63 | 63 | // Add save hook to addons. |
64 | - add_action( 'give-settings_get_settings_pages', array( $this, 'setup_addon_save_hook' ), 999999 ); |
|
64 | + add_action('give-settings_get_settings_pages', array($this, 'setup_addon_save_hook'), 999999); |
|
65 | 65 | |
66 | 66 | // Add backward compatibility filters plugin settings. |
67 | - $setting_tabs = array( 'general', 'gateways', 'display', 'emails', 'addons', 'licenses' ); |
|
67 | + $setting_tabs = array('general', 'gateways', 'display', 'emails', 'addons', 'licenses'); |
|
68 | 68 | |
69 | 69 | // Filter Payment Gateways settings. |
70 | - if ( in_array( $this->current_tab, $setting_tabs ) ) { |
|
71 | - add_filter( "give_get_settings_{$this->current_tab}", array( |
|
70 | + if (in_array($this->current_tab, $setting_tabs)) { |
|
71 | + add_filter("give_get_settings_{$this->current_tab}", array( |
|
72 | 72 | $this, |
73 | 73 | 'get_filtered_addon_settings', |
74 | - ), 999999, 1 ); |
|
75 | - add_filter( "give_get_sections_{$this->current_tab}", array( |
|
74 | + ), 999999, 1); |
|
75 | + add_filter("give_get_sections_{$this->current_tab}", array( |
|
76 | 76 | $this, |
77 | 77 | 'get_filtered_addon_sections', |
78 | - ), 999999, 1 ); |
|
78 | + ), 999999, 1); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return string |
90 | 90 | */ |
91 | - function set_default_setting_tab( $setting_tab ) { |
|
91 | + function set_default_setting_tab($setting_tab) { |
|
92 | 92 | $default_tab = ''; |
93 | 93 | |
94 | 94 | // Set default tab to first setting tab. |
95 | - if ( $sections = array_keys( $this->get_sections() ) ) { |
|
96 | - $default_tab = current( $sections ); |
|
95 | + if ($sections = array_keys($this->get_sections())) { |
|
96 | + $default_tab = current($sections); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $default_tab; |
@@ -108,29 +108,29 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return mixed |
110 | 110 | */ |
111 | - function add_addon_settings_page( $pages ) { |
|
111 | + function add_addon_settings_page($pages) { |
|
112 | 112 | // Previous setting page. |
113 | 113 | $previous_pages = $this->prev_settings->give_get_settings_tabs(); |
114 | 114 | |
115 | 115 | // API and System Info setting tab merge to Tools setting tab, so remove them from tabs. |
116 | - unset( $previous_pages['api'] ); |
|
117 | - unset( $previous_pages['system_info'] ); |
|
116 | + unset($previous_pages['api']); |
|
117 | + unset($previous_pages['system_info']); |
|
118 | 118 | |
119 | 119 | // Tab is not register. |
120 | - $pages_diff = array_keys( array_diff( $previous_pages, $pages ) ); |
|
120 | + $pages_diff = array_keys(array_diff($previous_pages, $pages)); |
|
121 | 121 | |
122 | 122 | // Merge old settings with new settings. |
123 | - $pages = array_merge( $pages, $previous_pages ); |
|
123 | + $pages = array_merge($pages, $previous_pages); |
|
124 | 124 | |
125 | - if ( in_array( $this->current_tab, $pages_diff ) ) { |
|
125 | + if (in_array($this->current_tab, $pages_diff)) { |
|
126 | 126 | // Filter & actions. |
127 | - add_filter( "give_default_setting_tab_section_{$this->current_tab}", array( |
|
127 | + add_filter("give_default_setting_tab_section_{$this->current_tab}", array( |
|
128 | 128 | $this, |
129 | 129 | 'set_default_setting_tab', |
130 | - ), 10 ); |
|
131 | - add_action( "give-settings_sections_{$this->current_tab}_page", array( $this, 'output_sections' ) ); |
|
132 | - add_action( "give-settings_settings_{$this->current_tab}_page", array( $this, 'output' ), 10 ); |
|
133 | - add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) ); |
|
130 | + ), 10); |
|
131 | + add_action("give-settings_sections_{$this->current_tab}_page", array($this, 'output_sections')); |
|
132 | + add_action("give-settings_settings_{$this->current_tab}_page", array($this, 'output'), 10); |
|
133 | + add_action("give-settings_save_{$this->current_tab}", array($this, 'save')); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | return $pages; |
@@ -146,29 +146,29 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @return mixed |
148 | 148 | */ |
149 | - function setup_addon_save_hook( $pages ) { |
|
149 | + function setup_addon_save_hook($pages) { |
|
150 | 150 | $page_ids = array(); |
151 | 151 | |
152 | - foreach ( $pages as $page ) { |
|
153 | - $page_ids = $page->add_settings_page( $page_ids ); |
|
152 | + foreach ($pages as $page) { |
|
153 | + $page_ids = $page->add_settings_page($page_ids); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | // Previous setting page. |
157 | 157 | $previous_pages = $this->prev_settings->give_get_settings_tabs(); |
158 | 158 | |
159 | 159 | // API and System Info setting tab merge to Tools setting tab, so remove them from tabs. |
160 | - unset( $previous_pages['api'] ); |
|
161 | - unset( $previous_pages['system_info'] ); |
|
160 | + unset($previous_pages['api']); |
|
161 | + unset($previous_pages['system_info']); |
|
162 | 162 | |
163 | 163 | // Tab is not register. |
164 | - $pages_diff = array_keys( array_diff( $previous_pages, $page_ids ) ); |
|
164 | + $pages_diff = array_keys(array_diff($previous_pages, $page_ids)); |
|
165 | 165 | |
166 | 166 | // Merge old settings with new settings. |
167 | - $pages = array_merge( $page_ids, $previous_pages ); |
|
167 | + $pages = array_merge($page_ids, $previous_pages); |
|
168 | 168 | |
169 | - if ( in_array( $this->current_tab, $pages_diff ) ) { |
|
169 | + if (in_array($this->current_tab, $pages_diff)) { |
|
170 | 170 | // Filter & actions. |
171 | - add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) ); |
|
171 | + add_action("give-settings_save_{$this->current_tab}", array($this, 'save')); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | return $pages; |
@@ -183,16 +183,16 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @return string |
185 | 185 | */ |
186 | - function get_section_name( $field_name ) { |
|
186 | + function get_section_name($field_name) { |
|
187 | 187 | // Bailout. |
188 | - if ( empty( $field_name ) ) { |
|
188 | + if (empty($field_name)) { |
|
189 | 189 | return $field_name; |
190 | 190 | } |
191 | 191 | |
192 | - $section_name = explode( ' ', $field_name ); |
|
192 | + $section_name = explode(' ', $field_name); |
|
193 | 193 | |
194 | 194 | // Output. |
195 | - return strip_tags( implode( ' ', $section_name ) ); |
|
195 | + return strip_tags(implode(' ', $section_name)); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -205,39 +205,39 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @return mixed |
207 | 207 | */ |
208 | - function get_filtered_addon_sections( $sections = array() ) { |
|
208 | + function get_filtered_addon_sections($sections = array()) { |
|
209 | 209 | // New sections. |
210 | 210 | $new_sections = array(); |
211 | - $sections_ID = array_keys( $sections ); |
|
211 | + $sections_ID = array_keys($sections); |
|
212 | 212 | |
213 | - if ( ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) && ! empty( $setting_fields['fields'] ) ) { |
|
213 | + if (($setting_fields = $this->prev_settings->give_settings($this->current_tab)) && ! empty($setting_fields['fields'])) { |
|
214 | 214 | |
215 | - foreach ( $setting_fields['fields'] as $field ) { |
|
215 | + foreach ($setting_fields['fields'] as $field) { |
|
216 | 216 | // Section name. |
217 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : ''; |
|
218 | - $section_name = $this->get_section_name( $field['name'] ); |
|
217 | + $field['name'] = isset($field['name']) ? $field['name'] : ''; |
|
218 | + $section_name = $this->get_section_name($field['name']); |
|
219 | 219 | |
220 | 220 | // Check if section name exit and section title array is not empty. |
221 | - if ( ! empty( $sections ) && ! empty( $field['name'] ) ) { |
|
221 | + if ( ! empty($sections) && ! empty($field['name'])) { |
|
222 | 222 | |
223 | 223 | // Bailout: Do not load section if it is already exist. |
224 | 224 | if ( |
225 | - in_array( sanitize_title( $field['name'] ), $sections_ID ) // Check section id. |
|
226 | - || in_array( $section_name, $sections ) // Check section name. |
|
225 | + in_array(sanitize_title($field['name']), $sections_ID) // Check section id. |
|
226 | + || in_array($section_name, $sections) // Check section name. |
|
227 | 227 | ) { |
228 | 228 | continue; |
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | 232 | // Collect new sections from addons. |
233 | - if ( 'give_title' == $field['type'] ) { |
|
234 | - $new_sections[ sanitize_title( $field['name'] ) ] = $section_name; |
|
233 | + if ('give_title' == $field['type']) { |
|
234 | + $new_sections[sanitize_title($field['name'])] = $section_name; |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
239 | 239 | // Add new section. |
240 | - $sections = array_merge( $sections, $new_sections ); |
|
240 | + $sections = array_merge($sections, $new_sections); |
|
241 | 241 | |
242 | 242 | // Output. |
243 | 243 | return $sections; |
@@ -254,19 +254,19 @@ discard block |
||
254 | 254 | * |
255 | 255 | * @return array |
256 | 256 | */ |
257 | - function get_filtered_addon_settings( $settings, $setting_fields = array() ) { |
|
257 | + function get_filtered_addon_settings($settings, $setting_fields = array()) { |
|
258 | 258 | global $wp_filter; |
259 | 259 | |
260 | 260 | $new_setting_fields = array(); |
261 | 261 | |
262 | - if ( ! empty( $settings ) ) { |
|
262 | + if ( ! empty($settings)) { |
|
263 | 263 | // Bailout: If setting array contain first element of type title then it means it is already created with new setting api (skip this section ). |
264 | - if ( isset( $settings[0]['type'] ) && 'title' == $settings[0]['type'] ) { |
|
265 | - foreach ( $settings as $setting ) { |
|
264 | + if (isset($settings[0]['type']) && 'title' == $settings[0]['type']) { |
|
265 | + foreach ($settings as $setting) { |
|
266 | 266 | $new_setting_fields[] = $setting; |
267 | 267 | |
268 | 268 | // We need setting only till first section end. |
269 | - if ( 'sectionend' === $setting['type'] ) { |
|
269 | + if ('sectionend' === $setting['type']) { |
|
270 | 270 | break; |
271 | 271 | } |
272 | 272 | } |
@@ -278,24 +278,24 @@ discard block |
||
278 | 278 | $prev_title_field_id = ''; |
279 | 279 | |
280 | 280 | // Create new setting fields. |
281 | - foreach ( $settings as $index => $field ) { |
|
281 | + foreach ($settings as $index => $field) { |
|
282 | 282 | |
283 | 283 | // Bailout: Must need field type to process. |
284 | - if ( ! isset( $field['type'] ) ) { |
|
284 | + if ( ! isset($field['type'])) { |
|
285 | 285 | continue; |
286 | 286 | } |
287 | 287 | |
288 | 288 | // Set wrapper class if any. |
289 | - if ( ! empty( $field['row_classes'] ) ) { |
|
289 | + if ( ! empty($field['row_classes'])) { |
|
290 | 290 | $field['wrapper_class'] = $field['row_classes']; |
291 | - unset( $field['row_classes'] ); |
|
291 | + unset($field['row_classes']); |
|
292 | 292 | } |
293 | 293 | |
294 | - $field['name'] = ! isset( $field['name'] ) ? '' : $field['name']; |
|
295 | - $field['desc'] = ! isset( $field['desc'] ) ? '' : $field['desc']; |
|
294 | + $field['name'] = ! isset($field['name']) ? '' : $field['name']; |
|
295 | + $field['desc'] = ! isset($field['desc']) ? '' : $field['desc']; |
|
296 | 296 | |
297 | 297 | // Modify cmb2 setting fields. |
298 | - switch ( $field['type'] ) { |
|
298 | + switch ($field['type']) { |
|
299 | 299 | case 'text' : |
300 | 300 | case 'file' : |
301 | 301 | $field['css'] = 'width:25em;'; |
@@ -319,18 +319,18 @@ discard block |
||
319 | 319 | $field['type'] = 'title'; |
320 | 320 | |
321 | 321 | // Since we are showing sections, so there now ned to show horizontal rules. |
322 | - if ( '<hr>' === $field['desc'] ) { |
|
322 | + if ('<hr>' === $field['desc']) { |
|
323 | 323 | $field['desc'] = ''; |
324 | 324 | } |
325 | 325 | |
326 | 326 | break; |
327 | 327 | } |
328 | 328 | |
329 | - if ( 'title' === $field['type'] ) { |
|
329 | + if ('title' === $field['type']) { |
|
330 | 330 | |
331 | 331 | // If we do not have first element as title then these field will be skip from frontend |
332 | 332 | // because there are not belong to any section, so put all abandon fields under first section. |
333 | - if ( $index && empty( $prev_title_field_id ) ) { |
|
333 | + if ($index && empty($prev_title_field_id)) { |
|
334 | 334 | array_unshift( |
335 | 335 | $new_setting_fields, |
336 | 336 | array( |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $prev_title_field_id = $field['id']; |
345 | 345 | |
346 | 346 | continue; |
347 | - } elseif ( $index ) { |
|
347 | + } elseif ($index) { |
|
348 | 348 | // Section end. |
349 | 349 | $new_setting_fields[] = array( |
350 | 350 | 'type' => 'sectionend', |
@@ -376,52 +376,52 @@ discard block |
||
376 | 376 | |
377 | 377 | // Check if setting page has title section or not. |
378 | 378 | // If setting page does not have title section then add title section to it and fix section end array id. |
379 | - if ( 'title' !== $new_setting_fields[0]['type'] ) { |
|
379 | + if ('title' !== $new_setting_fields[0]['type']) { |
|
380 | 380 | array_unshift( |
381 | 381 | $new_setting_fields, |
382 | 382 | array( |
383 | - 'title' => ( isset( $settings['give_title'] ) ? $settings['give_title'] : '' ), |
|
383 | + 'title' => (isset($settings['give_title']) ? $settings['give_title'] : ''), |
|
384 | 384 | 'type' => 'title', |
385 | - 'desc' => ! empty( $setting_fields['desc'] ) ? $setting_fields['desc'] : '', |
|
386 | - 'id' => ( isset( $settings['id'] ) ? $settings['id'] : '' ), |
|
385 | + 'desc' => ! empty($setting_fields['desc']) ? $setting_fields['desc'] : '', |
|
386 | + 'id' => (isset($settings['id']) ? $settings['id'] : ''), |
|
387 | 387 | ) |
388 | 388 | ); |
389 | 389 | |
390 | 390 | // Update id in section end array if does not contain. |
391 | - if ( empty( $new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] ) ) { |
|
392 | - $new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] = ( isset( $settings['id'] ) ? $settings['id'] : '' ); |
|
391 | + if (empty($new_setting_fields[count($new_setting_fields) - 1]['id'])) { |
|
392 | + $new_setting_fields[count($new_setting_fields) - 1]['id'] = (isset($settings['id']) ? $settings['id'] : ''); |
|
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
396 | 396 | // Return only section related settings. |
397 | - if ( $sections = $this->get_filtered_addon_sections() ) { |
|
398 | - $new_setting_fields = $this->get_section_settings( $new_setting_fields ); |
|
397 | + if ($sections = $this->get_filtered_addon_sections()) { |
|
398 | + $new_setting_fields = $this->get_section_settings($new_setting_fields); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | // Third party plugin backward compatibility. |
402 | - $wp_filter_keys = array_keys( $wp_filter ); |
|
403 | - foreach ( $new_setting_fields as $index => $field ) { |
|
404 | - if ( ! isset( $field['type'] ) || in_array( $field['type'], array( 'title', 'sectionend' ) ) ) { |
|
402 | + $wp_filter_keys = array_keys($wp_filter); |
|
403 | + foreach ($new_setting_fields as $index => $field) { |
|
404 | + if ( ! isset($field['type']) || in_array($field['type'], array('title', 'sectionend'))) { |
|
405 | 405 | continue; |
406 | 406 | } |
407 | 407 | |
408 | 408 | $cmb2_filter_name = "cmb2_render_{$field['type']}"; |
409 | 409 | |
410 | - if ( in_array( $cmb2_filter_name, $wp_filter_keys ) ) { |
|
410 | + if (in_array($cmb2_filter_name, $wp_filter_keys)) { |
|
411 | 411 | |
412 | - if ( 0 >= version_compare( 4.7, get_bloginfo( 'version' ) ) && ! empty( $wp_filter[ $cmb2_filter_name ]->callbacks ) ) { |
|
413 | - $cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ]->callbacks ); |
|
412 | + if (0 >= version_compare(4.7, get_bloginfo('version')) && ! empty($wp_filter[$cmb2_filter_name]->callbacks)) { |
|
413 | + $cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]->callbacks); |
|
414 | 414 | } else { |
415 | - $cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ] ); |
|
415 | + $cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]); |
|
416 | 416 | } |
417 | 417 | |
418 | - if ( ! empty( $cmb2_filter_arr ) ) { |
|
418 | + if ( ! empty($cmb2_filter_arr)) { |
|
419 | 419 | // Note: function can be called either globally or with class object, it depends on how developer invoke it. |
420 | - $new_setting_fields[ $index ]['func'] = current( $cmb2_filter_arr ); |
|
421 | - add_action( "give_admin_field_{$field['type']}", array( |
|
420 | + $new_setting_fields[$index]['func'] = current($cmb2_filter_arr); |
|
421 | + add_action("give_admin_field_{$field['type']}", array( |
|
422 | 422 | $this, |
423 | 423 | 'addon_setting_field', |
424 | - ), 10, 2 ); |
|
424 | + ), 10, 2); |
|
425 | 425 | } |
426 | 426 | } |
427 | 427 | } |
@@ -442,31 +442,31 @@ discard block |
||
442 | 442 | * |
443 | 443 | * @return array |
444 | 444 | */ |
445 | - function get_section_settings( $tab_settings ) { |
|
445 | + function get_section_settings($tab_settings) { |
|
446 | 446 | $current_section = give_get_current_setting_section(); |
447 | 447 | |
448 | 448 | // Note: If we are opening default tabe for addon setting then it is possible that we will get empty string as current section |
449 | 449 | // because default section filter added after save hook fire, so we will always get problem to save first section [default] or if there are only on section |
450 | 450 | // This is hack to fix this. |
451 | - if ( empty( $current_section ) ) { |
|
452 | - $current_section = $this->set_default_setting_tab( $current_section ); |
|
451 | + if (empty($current_section)) { |
|
452 | + $current_section = $this->set_default_setting_tab($current_section); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | $section_start = false; |
456 | 456 | $section_end = false; |
457 | 457 | $section_only_setting_fields = array(); |
458 | 458 | |
459 | - foreach ( $tab_settings as $field ) { |
|
460 | - if ( 'title' == $field['type'] && $current_section == sanitize_title( $field['title'] ) ) { |
|
459 | + foreach ($tab_settings as $field) { |
|
460 | + if ('title' == $field['type'] && $current_section == sanitize_title($field['title'])) { |
|
461 | 461 | $section_start = true; |
462 | 462 | } |
463 | 463 | |
464 | - if ( ! $section_start || $section_end ) { |
|
464 | + if ( ! $section_start || $section_end) { |
|
465 | 465 | continue; |
466 | 466 | } |
467 | 467 | |
468 | - if ( $section_start && ! $section_end ) { |
|
469 | - if ( 'sectionend' == $field['type'] ) { |
|
468 | + if ($section_start && ! $section_end) { |
|
469 | + if ('sectionend' == $field['type']) { |
|
470 | 470 | $section_end = true; |
471 | 471 | } |
472 | 472 | $section_only_setting_fields[] = $field; |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | // Remove title from setting, pevent it from render in setting tab. |
477 | 477 | $section_only_setting_fields[0]['title'] = ''; |
478 | 478 | |
479 | - return apply_filters( "give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings ); |
|
479 | + return apply_filters("give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings); |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | |
@@ -490,17 +490,17 @@ discard block |
||
490 | 490 | * |
491 | 491 | * @return void |
492 | 492 | */ |
493 | - function addon_setting_field( $field, $saved_value ) { |
|
493 | + function addon_setting_field($field, $saved_value) { |
|
494 | 494 | // Create object for cmb2 function callback backward compatibility. |
495 | 495 | // Note: Do not call any cmb2 function on these objects |
496 | - $field_obj = (object) array( 'args' => $field ); |
|
497 | - $field_type_obj = (object) array( 'field' => $field_obj ); |
|
496 | + $field_obj = (object) array('args' => $field); |
|
497 | + $field_type_obj = (object) array('field' => $field_obj); |
|
498 | 498 | |
499 | - switch ( $this->current_tab ) : |
|
499 | + switch ($this->current_tab) : |
|
500 | 500 | case 'licenses': |
501 | 501 | ?> |
502 | 502 | <div class="give-settings-wrap give-settings-wrap-<?php echo $this->current_tab; ?>"> |
503 | - <?php $field['func']['function']( $field_obj, $saved_value, '', '', $field_type_obj ); ?> |
|
503 | + <?php $field['func']['function']($field_obj, $saved_value, '', '', $field_type_obj); ?> |
|
504 | 504 | </div> |
505 | 505 | <?php break; |
506 | 506 | |
@@ -508,19 +508,19 @@ discard block |
||
508 | 508 | $colspan = 'colspan="2"'; |
509 | 509 | ?> |
510 | 510 | <tr valign="top"> |
511 | - <?php if ( ! empty( $field['name'] ) && ! in_array( $field['name'], array( ' ' ) ) ) : ?> |
|
511 | + <?php if ( ! empty($field['name']) && ! in_array($field['name'], array(' '))) : ?> |
|
512 | 512 | <th scope="row" class="titledesc"> |
513 | 513 | <label |
514 | - for="<?php echo esc_attr( $field['name'] ); ?>"><?php echo $field['title']; ?></label> |
|
514 | + for="<?php echo esc_attr($field['name']); ?>"><?php echo $field['title']; ?></label> |
|
515 | 515 | </th> |
516 | 516 | <?php $colspan = ''; ?> |
517 | 517 | <?php endif; ?> |
518 | 518 | <td class="give-forminp" <?php echo $colspan; ?>> |
519 | 519 | <?php |
520 | - if ( is_array( $field['func']['function'] ) ) { |
|
521 | - $field['func']['function'][0]->$field['func']['function'][1]( $field_obj, $saved_value, '', '', $field_type_obj ); |
|
520 | + if (is_array($field['func']['function'])) { |
|
521 | + $field['func']['function'][0]->$field['func']['function'][1]($field_obj, $saved_value, '', '', $field_type_obj); |
|
522 | 522 | } else { |
523 | - $field['func']['function']( $field_obj, $saved_value, '', '', $field_type_obj ); |
|
523 | + $field['func']['function']($field_obj, $saved_value, '', '', $field_type_obj); |
|
524 | 524 | } |
525 | 525 | ?> |
526 | 526 | </td> |
@@ -538,10 +538,10 @@ discard block |
||
538 | 538 | public function get_sections() { |
539 | 539 | $sections = array(); |
540 | 540 | |
541 | - if ( ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) && ! empty( $setting_fields['fields'] ) ) { |
|
542 | - foreach ( $setting_fields['fields'] as $field ) { |
|
543 | - if ( 'give_title' == $field['type'] ) { |
|
544 | - $sections[ sanitize_title( $field['name'] ) ] = $this->get_section_name( $field['name'] ); |
|
541 | + if (($setting_fields = $this->prev_settings->give_settings($this->current_tab)) && ! empty($setting_fields['fields'])) { |
|
542 | + foreach ($setting_fields['fields'] as $field) { |
|
543 | + if ('give_title' == $field['type']) { |
|
544 | + $sections[sanitize_title($field['name'])] = $this->get_section_name($field['name']); |
|
545 | 545 | } |
546 | 546 | } |
547 | 547 | } |
@@ -561,16 +561,16 @@ discard block |
||
561 | 561 | |
562 | 562 | $new_setting_fields = array(); |
563 | 563 | |
564 | - if ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) { |
|
565 | - if ( isset( $setting_fields['fields'] ) ) { |
|
564 | + if ($setting_fields = $this->prev_settings->give_settings($this->current_tab)) { |
|
565 | + if (isset($setting_fields['fields'])) { |
|
566 | 566 | |
567 | 567 | $tab_data = array( |
568 | 568 | 'id' => $setting_fields['id'], |
569 | 569 | 'give_title' => $setting_fields['give_title'], |
570 | - 'desc' => ( isset( $setting_fields['desc'] ) ? $setting_fields['desc'] : '' ), |
|
570 | + 'desc' => (isset($setting_fields['desc']) ? $setting_fields['desc'] : ''), |
|
571 | 571 | ); |
572 | 572 | |
573 | - $new_setting_fields = $this->get_filtered_addon_settings( $setting_fields['fields'], $tab_data ); |
|
573 | + $new_setting_fields = $this->get_filtered_addon_settings($setting_fields['fields'], $tab_data); |
|
574 | 574 | } |
575 | 575 | } |
576 | 576 | |
@@ -587,23 +587,23 @@ discard block |
||
587 | 587 | $sections = $this->get_sections(); |
588 | 588 | |
589 | 589 | // Show section settings only if setting section exist. |
590 | - if ( ! in_array( $this->current_section, array_keys( $sections ) ) ) { |
|
591 | - echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; |
|
590 | + if ( ! in_array($this->current_section, array_keys($sections))) { |
|
591 | + echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; |
|
592 | 592 | |
593 | 593 | return; |
594 | 594 | } |
595 | 595 | |
596 | 596 | // Bailout. |
597 | - if ( empty( $sections ) ) { |
|
597 | + if (empty($sections)) { |
|
598 | 598 | return; |
599 | 599 | } |
600 | 600 | |
601 | 601 | echo '<ul class="subsubsub">'; |
602 | 602 | |
603 | - $array_keys = array_keys( $sections ); |
|
603 | + $array_keys = array_keys($sections); |
|
604 | 604 | |
605 | - foreach ( $sections as $id => $label ) { |
|
606 | - echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=' . $this->current_tab . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $this->current_section == $id ? 'current' : '' ) . '">' . strip_tags( $label ) . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>'; |
|
605 | + foreach ($sections as $id => $label) { |
|
606 | + echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page=give-settings&tab='.$this->current_tab.'§ion='.sanitize_title($id)).'" class="'.($this->current_section == $id ? 'current' : '').'">'.strip_tags($label).'</a> '.(end($array_keys) == $id ? '' : '|').' </li>'; |
|
607 | 607 | } |
608 | 608 | |
609 | 609 | echo '</ul><br class="clear" /><hr>'; |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | public function output() { |
619 | 619 | $settings = $this->get_settings(); |
620 | 620 | |
621 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
621 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | /** |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | public function save() { |
631 | 631 | $settings = $this->get_settings(); |
632 | 632 | |
633 | - Give_Admin_Settings::save_fields( $settings, 'give_settings' ); |
|
633 | + Give_Admin_Settings::save_fields($settings, 'give_settings'); |
|
634 | 634 | } |
635 | 635 | } |
636 | 636 | endif; |
@@ -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 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @return string |
22 | 22 | */ |
23 | 23 | function give_get_templates_dir() { |
24 | - return GIVE_PLUGIN_DIR . 'templates'; |
|
24 | + return GIVE_PLUGIN_DIR.'templates'; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return string |
32 | 32 | */ |
33 | 33 | function give_get_templates_url() { |
34 | - return GIVE_PLUGIN_URL . 'templates'; |
|
34 | + return GIVE_PLUGIN_URL.'templates'; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -44,23 +44,23 @@ discard block |
||
44 | 44 | * @param string $template_path Template file path. Default is empty. |
45 | 45 | * @param string $default_path Default path. Default is empty. |
46 | 46 | */ |
47 | -function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
|
48 | - if ( ! empty( $args ) && is_array( $args ) ) { |
|
49 | - extract( $args ); |
|
47 | +function give_get_template($template_name, $args = array(), $template_path = '', $default_path = '') { |
|
48 | + if ( ! empty($args) && is_array($args)) { |
|
49 | + extract($args); |
|
50 | 50 | } |
51 | 51 | |
52 | - $template_names = array( $template_name . '.php' ); |
|
52 | + $template_names = array($template_name.'.php'); |
|
53 | 53 | |
54 | - $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
54 | + $located = give_locate_template($template_names, $template_path, $default_path); |
|
55 | 55 | |
56 | - if ( ! file_exists( $located ) ) { |
|
56 | + if ( ! file_exists($located)) { |
|
57 | 57 | /* translators: %s: the template */ |
58 | - give_output_error( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
58 | + give_output_error(sprintf(__('The %s template was not found.', 'give'), $located), true); |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | 62 | // Allow 3rd party plugin filter template file from their plugin. |
63 | - $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
63 | + $located = apply_filters('give_get_template', $located, $template_name, $args, $template_path, $default_path); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Fires in give template, before the file is included. |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * @param string $located Template file filter by 3rd party plugin. |
75 | 75 | * @param array $args Passed arguments. |
76 | 76 | */ |
77 | - do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
77 | + do_action('give_before_template_part', $template_name, $template_path, $located, $args); |
|
78 | 78 | |
79 | - include( $located ); |
|
79 | + include($located); |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Fires in give template, after the file is included. |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param string $located Template file filter by 3rd party plugin. |
91 | 91 | * @param array $args Passed arguments. |
92 | 92 | */ |
93 | - do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
93 | + do_action('give_after_template_part', $template_name, $template_path, $located, $args); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return string |
108 | 108 | */ |
109 | -function give_get_template_part( $slug, $name = null, $load = true ) { |
|
109 | +function give_get_template_part($slug, $name = null, $load = true) { |
|
110 | 110 | |
111 | 111 | /** |
112 | 112 | * Fires in give template part, before the template part is retrieved. |
@@ -118,20 +118,20 @@ discard block |
||
118 | 118 | * @param string $slug Template part file slug {slug}.php. |
119 | 119 | * @param string $name Template part file name {slug}-{name}.php. |
120 | 120 | */ |
121 | - do_action( "get_template_part_{$slug}", $slug, $name ); |
|
121 | + do_action("get_template_part_{$slug}", $slug, $name); |
|
122 | 122 | |
123 | 123 | // Setup possible parts |
124 | 124 | $templates = array(); |
125 | - if ( isset( $name ) ) { |
|
126 | - $templates[] = $slug . '-' . $name . '.php'; |
|
125 | + if (isset($name)) { |
|
126 | + $templates[] = $slug.'-'.$name.'.php'; |
|
127 | 127 | } |
128 | - $templates[] = $slug . '.php'; |
|
128 | + $templates[] = $slug.'.php'; |
|
129 | 129 | |
130 | 130 | // Allow template parts to be filtered |
131 | - $templates = apply_filters( 'give_get_template_part', $templates, $slug, $name ); |
|
131 | + $templates = apply_filters('give_get_template_part', $templates, $slug, $name); |
|
132 | 132 | |
133 | 133 | // Return the part that is found |
134 | - return give_locate_template( $templates, $load, false ); |
|
134 | + return give_locate_template($templates, $load, false); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -152,37 +152,37 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return string The template filename if one is located. |
154 | 154 | */ |
155 | -function give_locate_template( $template_names, $load = false, $require_once = true ) { |
|
155 | +function give_locate_template($template_names, $load = false, $require_once = true) { |
|
156 | 156 | // No file found yet |
157 | 157 | $located = false; |
158 | 158 | |
159 | 159 | // Try to find a template file |
160 | - foreach ( (array) $template_names as $template_name ) { |
|
160 | + foreach ((array) $template_names as $template_name) { |
|
161 | 161 | |
162 | 162 | // Continue if template is empty |
163 | - if ( empty( $template_name ) ) { |
|
163 | + if (empty($template_name)) { |
|
164 | 164 | continue; |
165 | 165 | } |
166 | 166 | |
167 | 167 | // Trim off any slashes from the template name |
168 | - $template_name = ltrim( $template_name, '/' ); |
|
168 | + $template_name = ltrim($template_name, '/'); |
|
169 | 169 | |
170 | 170 | // try locating this template file by looping through the template paths |
171 | - foreach ( give_get_theme_template_paths() as $template_path ) { |
|
171 | + foreach (give_get_theme_template_paths() as $template_path) { |
|
172 | 172 | |
173 | - if ( file_exists( $template_path . $template_name ) ) { |
|
174 | - $located = $template_path . $template_name; |
|
173 | + if (file_exists($template_path.$template_name)) { |
|
174 | + $located = $template_path.$template_name; |
|
175 | 175 | break; |
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | - if ( $located ) { |
|
179 | + if ($located) { |
|
180 | 180 | break; |
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | - if ( ( true == $load ) && ! empty( $located ) ) { |
|
185 | - load_template( $located, $require_once ); |
|
184 | + if ((true == $load) && ! empty($located)) { |
|
185 | + load_template($located, $require_once); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | return $located; |
@@ -199,17 +199,17 @@ discard block |
||
199 | 199 | $template_dir = give_get_theme_template_dir_name(); |
200 | 200 | |
201 | 201 | $file_paths = array( |
202 | - 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir, |
|
203 | - 10 => trailingslashit( get_template_directory() ) . $template_dir, |
|
202 | + 1 => trailingslashit(get_stylesheet_directory()).$template_dir, |
|
203 | + 10 => trailingslashit(get_template_directory()).$template_dir, |
|
204 | 204 | 100 => give_get_templates_dir() |
205 | 205 | ); |
206 | 206 | |
207 | - $file_paths = apply_filters( 'give_template_paths', $file_paths ); |
|
207 | + $file_paths = apply_filters('give_template_paths', $file_paths); |
|
208 | 208 | |
209 | 209 | // sort the file paths based on priority |
210 | - ksort( $file_paths, SORT_NUMERIC ); |
|
210 | + ksort($file_paths, SORT_NUMERIC); |
|
211 | 211 | |
212 | - return array_map( 'trailingslashit', $file_paths ); |
|
212 | + return array_map('trailingslashit', $file_paths); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @return string |
222 | 222 | */ |
223 | 223 | function give_get_theme_template_dir_name() { |
224 | - return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) ); |
|
224 | + return trailingslashit(apply_filters('give_templates_dir', 'give')); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | * @return void |
232 | 232 | */ |
233 | 233 | function give_version_in_header() { |
234 | - echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n"; |
|
234 | + echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n"; |
|
235 | 235 | } |
236 | 236 | |
237 | -add_action( 'wp_head', 'give_version_in_header' ); |
|
237 | +add_action('wp_head', 'give_version_in_header'); |
|
238 | 238 | |
239 | 239 | /** |
240 | 240 | * Determines if we're currently on the Donations History page. |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | */ |
245 | 245 | function give_is_donation_history_page() { |
246 | 246 | |
247 | - $ret = is_page( give_get_option( 'history_page' ) ); |
|
247 | + $ret = is_page(give_get_option('history_page')); |
|
248 | 248 | |
249 | - return apply_filters( 'give_is_donation_history_page', $ret ); |
|
249 | + return apply_filters('give_is_donation_history_page', $ret); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -258,25 +258,25 @@ discard block |
||
258 | 258 | * |
259 | 259 | * @return array Modified array of classes |
260 | 260 | */ |
261 | -function give_add_body_classes( $class ) { |
|
261 | +function give_add_body_classes($class) { |
|
262 | 262 | $classes = (array) $class; |
263 | 263 | |
264 | - if ( give_is_success_page() ) { |
|
264 | + if (give_is_success_page()) { |
|
265 | 265 | $classes[] = 'give-success'; |
266 | 266 | $classes[] = 'give-page'; |
267 | 267 | } |
268 | 268 | |
269 | - if ( give_is_failed_transaction_page() ) { |
|
269 | + if (give_is_failed_transaction_page()) { |
|
270 | 270 | $classes[] = 'give-failed-transaction'; |
271 | 271 | $classes[] = 'give-page'; |
272 | 272 | } |
273 | 273 | |
274 | - if ( give_is_donation_history_page() ) { |
|
274 | + if (give_is_donation_history_page()) { |
|
275 | 275 | $classes[] = 'give-donation-history'; |
276 | 276 | $classes[] = 'give-page'; |
277 | 277 | } |
278 | 278 | |
279 | - if ( give_is_test_mode() ) { |
|
279 | + if (give_is_test_mode()) { |
|
280 | 280 | $classes[] = 'give-test-mode'; |
281 | 281 | $classes[] = 'give-page'; |
282 | 282 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | //Theme-specific Classes used to prevent conflicts via CSS |
285 | 285 | $current_theme = wp_get_theme(); |
286 | 286 | |
287 | - switch ( $current_theme->template ) { |
|
287 | + switch ($current_theme->template) { |
|
288 | 288 | |
289 | 289 | case 'Divi': |
290 | 290 | $classes[] = 'give-divi'; |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | |
299 | 299 | } |
300 | 300 | |
301 | - return array_unique( $classes ); |
|
301 | + return array_unique($classes); |
|
302 | 302 | } |
303 | 303 | |
304 | -add_filter( 'body_class', 'give_add_body_classes' ); |
|
304 | +add_filter('body_class', 'give_add_body_classes'); |
|
305 | 305 | |
306 | 306 | |
307 | 307 | /** |
@@ -317,22 +317,22 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @return array |
319 | 319 | */ |
320 | -function give_add_post_class( $classes, $class = '', $post_id = '' ) { |
|
321 | - if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) { |
|
320 | +function give_add_post_class($classes, $class = '', $post_id = '') { |
|
321 | + if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) { |
|
322 | 322 | return $classes; |
323 | 323 | } |
324 | 324 | |
325 | 325 | //@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc). |
326 | 326 | |
327 | - if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) { |
|
328 | - unset( $classes[ $key ] ); |
|
327 | + if (false !== ($key = array_search('hentry', $classes))) { |
|
328 | + unset($classes[$key]); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | return $classes; |
332 | 332 | } |
333 | 333 | |
334 | 334 | |
335 | -add_filter( 'post_class', 'give_add_post_class', 20, 3 ); |
|
335 | +add_filter('post_class', 'give_add_post_class', 20, 3); |
|
336 | 336 | |
337 | 337 | /** |
338 | 338 | * Get the placeholder image URL for forms etc |
@@ -342,84 +342,84 @@ discard block |
||
342 | 342 | */ |
343 | 343 | function give_get_placeholder_img_src() { |
344 | 344 | |
345 | - $placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) ); |
|
345 | + $placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give')); |
|
346 | 346 | |
347 | - return apply_filters( 'give_placeholder_img_src', $placeholder_url ); |
|
347 | + return apply_filters('give_placeholder_img_src', $placeholder_url); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | |
351 | 351 | /** |
352 | 352 | * Global |
353 | 353 | */ |
354 | -if ( ! function_exists( 'give_output_content_wrapper' ) ) { |
|
354 | +if ( ! function_exists('give_output_content_wrapper')) { |
|
355 | 355 | |
356 | 356 | /** |
357 | 357 | * Output the start of the page wrapper. |
358 | 358 | */ |
359 | 359 | function give_output_content_wrapper() { |
360 | - give_get_template_part( 'global/wrapper-start' ); |
|
360 | + give_get_template_part('global/wrapper-start'); |
|
361 | 361 | } |
362 | 362 | } |
363 | -if ( ! function_exists( 'give_output_content_wrapper_end' ) ) { |
|
363 | +if ( ! function_exists('give_output_content_wrapper_end')) { |
|
364 | 364 | |
365 | 365 | /** |
366 | 366 | * Output the end of the page wrapper. |
367 | 367 | */ |
368 | 368 | function give_output_content_wrapper_end() { |
369 | - give_get_template_part( 'global/wrapper-end' ); |
|
369 | + give_get_template_part('global/wrapper-end'); |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
374 | 374 | * Single Give Form |
375 | 375 | */ |
376 | -if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) { |
|
376 | +if ( ! function_exists('give_left_sidebar_pre_wrap')) { |
|
377 | 377 | function give_left_sidebar_pre_wrap() { |
378 | - echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' ); |
|
378 | + echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">'); |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | |
382 | -if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) { |
|
382 | +if ( ! function_exists('give_left_sidebar_post_wrap')) { |
|
383 | 383 | function give_left_sidebar_post_wrap() { |
384 | - echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' ); |
|
384 | + echo apply_filters('give_left_sidebar_post_wrap', '</div>'); |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | |
388 | -if ( ! function_exists( 'give_get_forms_sidebar' ) ) { |
|
388 | +if ( ! function_exists('give_get_forms_sidebar')) { |
|
389 | 389 | function give_get_forms_sidebar() { |
390 | - give_get_template_part( 'single-give-form/sidebar' ); |
|
390 | + give_get_template_part('single-give-form/sidebar'); |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | |
394 | -if ( ! function_exists( 'give_show_form_images' ) ) { |
|
394 | +if ( ! function_exists('give_show_form_images')) { |
|
395 | 395 | |
396 | 396 | /** |
397 | 397 | * Output the donation form featured image. |
398 | 398 | */ |
399 | 399 | function give_show_form_images() { |
400 | - if ( give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
401 | - give_get_template_part( 'single-give-form/featured-image' ); |
|
400 | + if (give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
401 | + give_get_template_part('single-give-form/featured-image'); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
406 | -if ( ! function_exists( 'give_template_single_title' ) ) { |
|
406 | +if ( ! function_exists('give_template_single_title')) { |
|
407 | 407 | |
408 | 408 | /** |
409 | 409 | * Output the form title. |
410 | 410 | */ |
411 | 411 | function give_template_single_title() { |
412 | - give_get_template_part( 'single-give-form/title' ); |
|
412 | + give_get_template_part('single-give-form/title'); |
|
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
416 | -if ( ! function_exists( 'give_show_avatars' ) ) { |
|
416 | +if ( ! function_exists('give_show_avatars')) { |
|
417 | 417 | |
418 | 418 | /** |
419 | 419 | * Output the product title. |
420 | 420 | */ |
421 | 421 | function give_show_avatars() { |
422 | - echo do_shortcode( '[give_donors_gravatars]' ); |
|
422 | + echo do_shortcode('[give_donors_gravatars]'); |
|
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * Conditional Functions |
428 | 428 | */ |
429 | 429 | |
430 | -if ( ! function_exists( 'is_give_form' ) ) { |
|
430 | +if ( ! function_exists('is_give_form')) { |
|
431 | 431 | |
432 | 432 | /** |
433 | 433 | * is_give_form |
@@ -439,11 +439,11 @@ discard block |
||
439 | 439 | * @return bool |
440 | 440 | */ |
441 | 441 | function is_give_form() { |
442 | - return is_singular( array( 'give_form' ) ); |
|
442 | + return is_singular(array('give_form')); |
|
443 | 443 | } |
444 | 444 | } |
445 | 445 | |
446 | -if ( ! function_exists( 'is_give_category' ) ) { |
|
446 | +if ( ! function_exists('is_give_category')) { |
|
447 | 447 | |
448 | 448 | /** |
449 | 449 | * is_give_category |
@@ -458,12 +458,12 @@ discard block |
||
458 | 458 | * |
459 | 459 | * @return bool |
460 | 460 | */ |
461 | - function is_give_category( $term = '' ) { |
|
462 | - return is_tax( 'give_forms_category', $term ); |
|
461 | + function is_give_category($term = '') { |
|
462 | + return is_tax('give_forms_category', $term); |
|
463 | 463 | } |
464 | 464 | } |
465 | 465 | |
466 | -if ( ! function_exists( 'is_give_tag' ) ) { |
|
466 | +if ( ! function_exists('is_give_tag')) { |
|
467 | 467 | |
468 | 468 | /** |
469 | 469 | * is_give_tag |
@@ -478,12 +478,12 @@ discard block |
||
478 | 478 | * |
479 | 479 | * @return bool |
480 | 480 | */ |
481 | - function is_give_tag( $term = '' ) { |
|
482 | - return is_tax( 'give_forms_tag', $term ); |
|
481 | + function is_give_tag($term = '') { |
|
482 | + return is_tax('give_forms_tag', $term); |
|
483 | 483 | } |
484 | 484 | } |
485 | 485 | |
486 | -if ( ! function_exists( 'is_give_taxonomy' ) ) { |
|
486 | +if ( ! function_exists('is_give_taxonomy')) { |
|
487 | 487 | |
488 | 488 | /** |
489 | 489 | * is_give_taxonomy |
@@ -495,6 +495,6 @@ discard block |
||
495 | 495 | * @return bool |
496 | 496 | */ |
497 | 497 | function is_give_taxonomy() { |
498 | - return is_tax( get_object_taxonomies( 'give_form' ) ); |
|
498 | + return is_tax(get_object_taxonomies('give_form')); |
|
499 | 499 | } |
500 | 500 | } |
@@ -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 | |
@@ -36,29 +36,29 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * Templates |
38 | 38 | */ |
39 | - add_filter( 'template_include', array( __CLASS__, 'template_loader' ) ); |
|
39 | + add_filter('template_include', array(__CLASS__, 'template_loader')); |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Content Wrappers |
43 | 43 | */ |
44 | - add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 ); |
|
45 | - add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 ); |
|
44 | + add_action('give_before_main_content', 'give_output_content_wrapper', 10); |
|
45 | + add_action('give_after_main_content', 'give_output_content_wrapper_end', 10); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Entry Summary Classes |
49 | 49 | */ |
50 | - add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) ); |
|
50 | + add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes')); |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Sidebar |
54 | 54 | */ |
55 | - add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 ); |
|
55 | + add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * Single Forms Summary Box |
59 | 59 | */ |
60 | - add_action( 'give_single_form_summary', 'give_template_single_title', 5 ); |
|
61 | - add_action( 'give_single_form_summary', 'give_get_donation_form', 10 ); |
|
60 | + add_action('give_single_form_summary', 'give_template_single_title', 5); |
|
61 | + add_action('give_single_form_summary', 'give_get_donation_form', 10); |
|
62 | 62 | |
63 | 63 | } |
64 | 64 | |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return string $classes List of space separated class names. |
75 | 75 | */ |
76 | - public function give_set_single_summary_classes( $classes ) { |
|
76 | + public function give_set_single_summary_classes($classes) { |
|
77 | 77 | |
78 | 78 | //Add full width class when feature image is disabled AND no widgets are present |
79 | - if ( ! give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) { |
|
79 | + if ( ! give_is_setting_enabled(give_get_option('form_sidebar'))) { |
|
80 | 80 | $classes .= ' give-full-width'; |
81 | 81 | } |
82 | 82 | |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | public function give_output_sidebar_option() { |
98 | 98 | |
99 | 99 | //Add full width class when feature image is disabled AND no widgets are present |
100 | - if ( give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) { |
|
101 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 ); |
|
102 | - add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 ); |
|
103 | - add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 ); |
|
104 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 ); |
|
100 | + if (give_is_setting_enabled(give_get_option('form_sidebar'))) { |
|
101 | + add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5); |
|
102 | + add_action('give_before_single_form_summary', 'give_show_form_images', 10); |
|
103 | + add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20); |
|
104 | + add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | } |
@@ -123,20 +123,20 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return string $template |
125 | 125 | */ |
126 | - public static function template_loader( $template ) { |
|
127 | - $find = array( 'give.php' ); |
|
126 | + public static function template_loader($template) { |
|
127 | + $find = array('give.php'); |
|
128 | 128 | $file = ''; |
129 | 129 | |
130 | - if ( is_single() && get_post_type() == 'give_forms' ) { |
|
130 | + if (is_single() && get_post_type() == 'give_forms') { |
|
131 | 131 | $file = 'single-give-form.php'; |
132 | 132 | $find[] = $file; |
133 | - $find[] = apply_filters( 'give_template_path', 'give/' ) . $file; |
|
133 | + $find[] = apply_filters('give_template_path', 'give/').$file; |
|
134 | 134 | } |
135 | 135 | |
136 | - if ( $file ) { |
|
137 | - $template = locate_template( array_unique( $find ) ); |
|
138 | - if ( ! $template ) { |
|
139 | - $template = GIVE_PLUGIN_DIR . '/templates/' . $file; |
|
136 | + if ($file) { |
|
137 | + $template = locate_template(array_unique($find)); |
|
138 | + if ( ! $template) { |
|
139 | + $template = GIVE_PLUGIN_DIR.'/templates/'.$file; |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 |
@@ -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 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_tools_recount_stats_display() { |
24 | 24 | |
25 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
25 | + if ( ! current_user_can('manage_give_settings')) { |
|
26 | 26 | return; |
27 | 27 | } |
28 | 28 | |
@@ -31,27 +31,27 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @since 1.5 |
33 | 33 | */ |
34 | - do_action( 'give_tools_recount_stats_before' ); |
|
34 | + do_action('give_tools_recount_stats_before'); |
|
35 | 35 | ?> |
36 | 36 | <div id="poststuff"> |
37 | 37 | <div class="postbox"> |
38 | 38 | |
39 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
39 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
40 | 40 | |
41 | 41 | <div class="inside recount-stats-controls"> |
42 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
42 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
43 | 43 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
44 | 44 | |
45 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
45 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
46 | 46 | |
47 | 47 | <select name="give-export-class" id="recount-stats-type"> |
48 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
49 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
50 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
51 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
52 | - <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
53 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Transactions', 'give' ); ?></option> |
|
54 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
48 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
49 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
50 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
51 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
52 | + <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
53 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Transactions', 'give'); ?></option> |
|
54 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
55 | 55 | <?php |
56 | 56 | /** |
57 | 57 | * Fires in the recount stats selectbox. |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @since 1.5 |
62 | 62 | */ |
63 | - do_action( 'give_recount_tool_options' ); |
|
63 | + do_action('give_recount_tool_options'); |
|
64 | 64 | ?> |
65 | 65 | </select> |
66 | 66 | |
@@ -68,22 +68,22 @@ discard block |
||
68 | 68 | <?php |
69 | 69 | $args = array( |
70 | 70 | 'name' => 'form_id', |
71 | - 'number' => - 1, |
|
71 | + 'number' => -1, |
|
72 | 72 | 'chosen' => true, |
73 | 73 | ); |
74 | - echo Give()->html->forms_dropdown( $args ); |
|
74 | + echo Give()->html->forms_dropdown($args); |
|
75 | 75 | ?> |
76 | 76 | </span> |
77 | 77 | |
78 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
78 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
79 | 79 | |
80 | 80 | <br/> |
81 | 81 | |
82 | 82 | <span class="give-recount-stats-descriptions"> |
83 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
84 | - <span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span> |
|
85 | - <span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
|
86 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
83 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
84 | + <span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span> |
|
85 | + <span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span> |
|
86 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
87 | 87 | <?php |
88 | 88 | /** |
89 | 89 | * Fires in the recount stats description area. |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @since 1.5 |
94 | 94 | */ |
95 | - do_action( 'give_recount_tool_descriptions' ); |
|
95 | + do_action('give_recount_tool_descriptions'); |
|
96 | 96 | ?> |
97 | - <span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
|
98 | - <span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
97 | + <span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span> |
|
98 | + <span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
99 | 99 | </span> |
100 | 100 | |
101 | 101 | <span class="spinner"></span> |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @since 1.5 |
111 | 111 | */ |
112 | - do_action( 'give_tools_recount_forms' ); |
|
112 | + do_action('give_tools_recount_forms'); |
|
113 | 113 | ?> |
114 | 114 | </div><!-- .inside --> |
115 | 115 | </div><!-- .postbox --> |
@@ -120,5 +120,5 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @since 1.5 |
122 | 122 | */ |
123 | - do_action( 'give_tools_recount_stats_after' ); |
|
123 | + do_action('give_tools_recount_stats_after'); |
|
124 | 124 | } |
125 | 125 | \ No newline at end of file |
@@ -2,13 +2,13 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Admin View: Settings |
4 | 4 | */ |
5 | -if ( ! defined( 'ABSPATH' ) ) { |
|
5 | +if ( ! defined('ABSPATH')) { |
|
6 | 6 | exit; |
7 | 7 | } |
8 | 8 | |
9 | 9 | |
10 | 10 | // Bailout: Do not output anything if setting tab is not defined. |
11 | -if( ! empty( $tabs ) ) : |
|
11 | +if ( ! empty($tabs)) : |
|
12 | 12 | /** |
13 | 13 | * Filter the form action. |
14 | 14 | * |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @since 1.8 |
20 | 20 | */ |
21 | - $form_method = apply_filters( self::$setting_filter_prefix . '_form_method_tab_' . $current_tab, 'post' ); |
|
21 | + $form_method = apply_filters(self::$setting_filter_prefix.'_form_method_tab_'.$current_tab, 'post'); |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Filter the main form tab. |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @since 1.8 |
32 | 32 | */ |
33 | - $form_open_tag = apply_filters( self::$setting_filter_prefix . '_open_form', '<form method="' . $form_method . '" id="give-mainform" action="" enctype="multipart/form-data">' ); |
|
34 | - $form_close_tag = apply_filters( self::$setting_filter_prefix . '_close_form', '</form>' ); |
|
33 | + $form_open_tag = apply_filters(self::$setting_filter_prefix.'_open_form', '<form method="'.$form_method.'" id="give-mainform" action="" enctype="multipart/form-data">'); |
|
34 | + $form_close_tag = apply_filters(self::$setting_filter_prefix.'_close_form', '</form>'); |
|
35 | 35 | ?> |
36 | - <div class="wrap give-settings-page <?php echo self::$setting_filter_prefix . '-setting-page'; ?>"> |
|
36 | + <div class="wrap give-settings-page <?php echo self::$setting_filter_prefix.'-setting-page'; ?>"> |
|
37 | 37 | <?php echo $form_open_tag; ?> |
38 | 38 | <h2 class="nav-tab-wrapper woo-nav-tab-wrapper"> |
39 | 39 | <?php |
40 | - foreach ( $tabs as $name => $label ) { |
|
41 | - echo '<a href="' . admin_url( "edit.php?post_type=give_forms&page=" . self::$setting_filter_prefix . "&tab={$name}" ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . $label . '</a>'; |
|
40 | + foreach ($tabs as $name => $label) { |
|
41 | + echo '<a href="'.admin_url("edit.php?post_type=give_forms&page=".self::$setting_filter_prefix."&tab={$name}").'" class="nav-tab '.($current_tab == $name ? 'nav-tab-active' : '').'">'.$label.'</a>'; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @since 1.8 |
52 | 52 | */ |
53 | - do_action( self::$setting_filter_prefix . '_tabs' ); |
|
53 | + do_action(self::$setting_filter_prefix.'_tabs'); |
|
54 | 54 | ?> |
55 | 55 | </h2> |
56 | - <h1 class="screen-reader-text"><?php echo esc_html( $tabs[ $current_tab ] ); ?></h1> |
|
56 | + <h1 class="screen-reader-text"><?php echo esc_html($tabs[$current_tab]); ?></h1> |
|
57 | 57 | <?php |
58 | 58 | |
59 | 59 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @since 1.8 |
67 | 67 | */ |
68 | - do_action( self::$setting_filter_prefix . "_sections_{$current_tab}_page" ); |
|
68 | + do_action(self::$setting_filter_prefix."_sections_{$current_tab}_page"); |
|
69 | 69 | |
70 | 70 | |
71 | 71 | // Show messages. |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @since 1.8 |
83 | 83 | */ |
84 | - do_action( self::$setting_filter_prefix . "_settings_{$current_tab}_page" ); |
|
84 | + do_action(self::$setting_filter_prefix."_settings_{$current_tab}_page"); |
|
85 | 85 | |
86 | - if ( empty( $GLOBALS['give_hide_save_button'] ) ) : ?> |
|
86 | + if (empty($GLOBALS['give_hide_save_button'])) : ?> |
|
87 | 87 | <div class="give-submit-wrap"> |
88 | - <?php wp_nonce_field( 'give-save-settings', '_give-save-settings' ); ?> |
|
89 | - <input name="save" class="button-primary give-save-button" type="submit" value="<?php esc_attr_e( 'Save changes', 'give' ); ?>" /> |
|
88 | + <?php wp_nonce_field('give-save-settings', '_give-save-settings'); ?> |
|
89 | + <input name="save" class="button-primary give-save-button" type="submit" value="<?php esc_attr_e('Save changes', 'give'); ?>" /> |
|
90 | 90 | </div> |
91 | 91 | <?php endif; ?> |
92 | 92 | <?php echo $form_close_tag; ?> |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_API' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_API')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_API. |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'api'; |
46 | - $this->label = esc_html__( 'API', 'give' ); |
|
46 | + $this->label = esc_html__('API', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
48 | + add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-tools_settings_{$this->id}_page", array($this, 'output')); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @param array $pages Lst of pages. |
57 | 57 | * @return array |
58 | 58 | */ |
59 | - public function add_settings_page( $pages ) { |
|
60 | - $pages[ $this->id ] = $this->label; |
|
59 | + public function add_settings_page($pages) { |
|
60 | + $pages[$this->id] = $this->label; |
|
61 | 61 | |
62 | 62 | return $pages; |
63 | 63 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $GLOBALS['give_hide_save_button'] = true; |
74 | 74 | |
75 | 75 | // Get settings. |
76 | - $settings = apply_filters( 'give_settings_system', array( |
|
76 | + $settings = apply_filters('give_settings_system', array( |
|
77 | 77 | array( |
78 | 78 | 'id' => 'give_tools_api', |
79 | 79 | 'type' => 'title', |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | ), |
82 | 82 | array( |
83 | 83 | 'id' => 'api', |
84 | - 'name' => esc_html__( 'API', 'give' ), |
|
84 | + 'name' => esc_html__('API', 'give'), |
|
85 | 85 | 'type' => 'api', |
86 | 86 | ), |
87 | 87 | array( |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @since 1.8 |
98 | 98 | * @param array $settings |
99 | 99 | */ |
100 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
100 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
101 | 101 | |
102 | 102 | // Output. |
103 | 103 | return $settings; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | public function output() { |
113 | 113 | $settings = $this->get_settings(); |
114 | 114 | |
115 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
115 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Data' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Data')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Data. |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'data'; |
46 | - $this->label = esc_html__( 'Data', 'give' ); |
|
46 | + $this->label = esc_html__('Data', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
48 | + add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-tools_settings_{$this->id}_page", array($this, 'output')); |
|
50 | 50 | |
51 | 51 | // Do not use main form for this tab. |
52 | - if( give_get_current_setting_tab() === $this->id ) { |
|
53 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
54 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
52 | + if (give_get_current_setting_tab() === $this->id) { |
|
53 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
54 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @param array $pages Lst of pages. |
63 | 63 | * @return array |
64 | 64 | */ |
65 | - public function add_settings_page( $pages ) { |
|
66 | - $pages[ $this->id ] = $this->label; |
|
65 | + public function add_settings_page($pages) { |
|
66 | + $pages[$this->id] = $this->label; |
|
67 | 67 | |
68 | 68 | return $pages; |
69 | 69 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $GLOBALS['give_hide_save_button'] = true; |
80 | 80 | |
81 | 81 | // Get settings. |
82 | - $settings = apply_filters( 'give_settings_system', array( |
|
82 | + $settings = apply_filters('give_settings_system', array( |
|
83 | 83 | array( |
84 | 84 | 'id' => 'give_tools_tools', |
85 | 85 | 'type' => 'title', |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | ), |
88 | 88 | array( |
89 | 89 | 'id' => 'api', |
90 | - 'name' => esc_html__( 'Tools', 'give' ), |
|
90 | + 'name' => esc_html__('Tools', 'give'), |
|
91 | 91 | 'type' => 'data', |
92 | 92 | ), |
93 | 93 | array( |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @since 1.8 |
104 | 104 | * @param array $settings |
105 | 105 | */ |
106 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
106 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
107 | 107 | |
108 | 108 | // Output. |
109 | 109 | return $settings; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function output() { |
119 | 119 | $settings = $this->get_settings(); |
120 | 120 | |
121 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
121 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 |