@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 11 | +if ( ! defined('ABSPATH')) { |
|
| 12 | 12 | exit; // Exit if accessed directly |
| 13 | 13 | } |
| 14 | 14 | |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | * @return bool|string |
| 24 | 24 | */ |
| 25 | -function give_is_field_callback_exist( $field ) { |
|
| 26 | - return ( give_get_field_callback( $field ) ? true : false ); |
|
| 25 | +function give_is_field_callback_exist($field) { |
|
| 26 | + return (give_get_field_callback($field) ? true : false); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @return bool|string |
| 37 | 37 | */ |
| 38 | -function give_get_field_callback( $field ) { |
|
| 38 | +function give_get_field_callback($field) { |
|
| 39 | 39 | $func_name_prefix = 'give'; |
| 40 | 40 | $func_name = ''; |
| 41 | 41 | |
| 42 | 42 | // Set callback function on basis of cmb2 field name. |
| 43 | - switch ( $field['type'] ) { |
|
| 43 | + switch ($field['type']) { |
|
| 44 | 44 | case 'radio_inline': |
| 45 | 45 | $func_name = "{$func_name_prefix}_radio"; |
| 46 | 46 | break; |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | default: |
| 77 | 77 | |
| 78 | 78 | if ( |
| 79 | - array_key_exists( 'callback', $field ) |
|
| 80 | - && ! empty( $field['callback'] ) |
|
| 79 | + array_key_exists('callback', $field) |
|
| 80 | + && ! empty($field['callback']) |
|
| 81 | 81 | ) { |
| 82 | 82 | $func_name = $field['callback']; |
| 83 | 83 | } else { |
@@ -90,15 +90,15 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @since 1.8 |
| 92 | 92 | */ |
| 93 | - $func_name = apply_filters( 'give_get_field_callback', $func_name, $field ); |
|
| 93 | + $func_name = apply_filters('give_get_field_callback', $func_name, $field); |
|
| 94 | 94 | |
| 95 | 95 | // Exit if not any function exist. |
| 96 | 96 | // Check if render callback exist or not. |
| 97 | - if ( empty( $func_name ) ) { |
|
| 97 | + if (empty($func_name)) { |
|
| 98 | 98 | return false; |
| 99 | - } elseif ( is_string( $func_name ) && ! function_exists( "$func_name" ) ) { |
|
| 99 | + } elseif (is_string($func_name) && ! function_exists("$func_name")) { |
|
| 100 | 100 | return false; |
| 101 | - } elseif ( is_array( $func_name ) && ! method_exists( $func_name[0], "$func_name[1]" ) ) { |
|
| 101 | + } elseif (is_array($func_name) && ! method_exists($func_name[0], "$func_name[1]")) { |
|
| 102 | 102 | return false; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -114,35 +114,35 @@ discard block |
||
| 114 | 114 | * |
| 115 | 115 | * @return bool |
| 116 | 116 | */ |
| 117 | -function give_render_field( $field ) { |
|
| 117 | +function give_render_field($field) { |
|
| 118 | 118 | |
| 119 | 119 | // Check if render callback exist or not. |
| 120 | - if ( ! ( $func_name = give_get_field_callback( $field ) ) ) { |
|
| 120 | + if ( ! ($func_name = give_get_field_callback($field))) { |
|
| 121 | 121 | return false; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | // CMB2 compatibility: Push all classes to attributes's class key |
| 125 | - if ( empty( $field['class'] ) ) { |
|
| 125 | + if (empty($field['class'])) { |
|
| 126 | 126 | $field['class'] = ''; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if ( empty( $field['attributes']['class'] ) ) { |
|
| 129 | + if (empty($field['attributes']['class'])) { |
|
| 130 | 130 | $field['attributes']['class'] = ''; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - $field['attributes']['class'] = trim( "give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}" ); |
|
| 134 | - unset( $field['class'] ); |
|
| 133 | + $field['attributes']['class'] = trim("give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}"); |
|
| 134 | + unset($field['class']); |
|
| 135 | 135 | |
| 136 | 136 | // CMB2 compatibility: Set wrapper class if any. |
| 137 | - if ( ! empty( $field['row_classes'] ) ) { |
|
| 137 | + if ( ! empty($field['row_classes'])) { |
|
| 138 | 138 | $field['wrapper_class'] = $field['row_classes']; |
| 139 | - unset( $field['row_classes'] ); |
|
| 139 | + unset($field['row_classes']); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // Set field params on basis of cmb2 field name. |
| 143 | - switch ( $field['type'] ) { |
|
| 143 | + switch ($field['type']) { |
|
| 144 | 144 | case 'radio_inline': |
| 145 | - if ( empty( $field['wrapper_class'] ) ) { |
|
| 145 | + if (empty($field['wrapper_class'])) { |
|
| 146 | 146 | $field['wrapper_class'] = ''; |
| 147 | 147 | } |
| 148 | 148 | $field['wrapper_class'] .= ' give-inline-radio-fields'; |
@@ -155,15 +155,15 @@ discard block |
||
| 155 | 155 | case 'text-small' : |
| 156 | 156 | case 'text_small' : |
| 157 | 157 | // CMB2 compatibility: Set field type to text. |
| 158 | - $field['type'] = isset( $field['attributes']['type'] ) ? $field['attributes']['type'] : 'text'; |
|
| 158 | + $field['type'] = isset($field['attributes']['type']) ? $field['attributes']['type'] : 'text'; |
|
| 159 | 159 | |
| 160 | 160 | // CMB2 compatibility: Set data type to price. |
| 161 | 161 | if ( |
| 162 | - empty( $field['data_type'] ) |
|
| 163 | - && ! empty( $field['attributes']['class'] ) |
|
| 162 | + empty($field['data_type']) |
|
| 163 | + && ! empty($field['attributes']['class']) |
|
| 164 | 164 | && ( |
| 165 | - false !== strpos( $field['attributes']['class'], 'money' ) |
|
| 166 | - || false !== strpos( $field['attributes']['class'], 'amount' ) |
|
| 165 | + false !== strpos($field['attributes']['class'], 'money') |
|
| 166 | + || false !== strpos($field['attributes']['class'], 'amount') |
|
| 167 | 167 | ) |
| 168 | 168 | ) { |
| 169 | 169 | $field['data_type'] = 'decimal'; |
@@ -182,22 +182,22 @@ discard block |
||
| 182 | 182 | case 'give_default_radio_inline': |
| 183 | 183 | $field['type'] = 'radio'; |
| 184 | 184 | $field['options'] = array( |
| 185 | - 'default' => __( 'Default' ), |
|
| 185 | + 'default' => __('Default'), |
|
| 186 | 186 | ); |
| 187 | 187 | break; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | // CMB2 compatibility: Add support to define field description by desc & description param. |
| 191 | 191 | // We encourage you to use description param. |
| 192 | - $field['description'] = ( ! empty( $field['description'] ) |
|
| 192 | + $field['description'] = ( ! empty($field['description']) |
|
| 193 | 193 | ? $field['description'] |
| 194 | - : ( ! empty( $field['desc'] ) ? $field['desc'] : '' ) ); |
|
| 194 | + : ( ! empty($field['desc']) ? $field['desc'] : '')); |
|
| 195 | 195 | |
| 196 | 196 | // Call render function. |
| 197 | - if ( is_array( $func_name ) ) { |
|
| 198 | - $func_name[0]->{$func_name[1]}( $field ); |
|
| 197 | + if (is_array($func_name)) { |
|
| 198 | + $func_name[0]->{$func_name[1]}($field); |
|
| 199 | 199 | } else { |
| 200 | - $func_name( $field ); |
|
| 200 | + $func_name($field); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | return true; |
@@ -227,29 +227,29 @@ discard block |
||
| 227 | 227 | * } |
| 228 | 228 | * @return void |
| 229 | 229 | */ |
| 230 | -function give_text_input( $field ) { |
|
| 230 | +function give_text_input($field) { |
|
| 231 | 231 | global $thepostid, $post; |
| 232 | 232 | |
| 233 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 234 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 235 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 236 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 237 | - $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text'; |
|
| 233 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 234 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 235 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 236 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 237 | + $field['type'] = isset($field['type']) ? $field['type'] : 'text'; |
|
| 238 | 238 | $field['before_field'] = ''; |
| 239 | 239 | $field['after_field'] = ''; |
| 240 | - $data_type = empty( $field['data_type'] ) ? '' : $field['data_type']; |
|
| 240 | + $data_type = empty($field['data_type']) ? '' : $field['data_type']; |
|
| 241 | 241 | |
| 242 | - switch ( $data_type ) { |
|
| 242 | + switch ($data_type) { |
|
| 243 | 243 | case 'price' : |
| 244 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_amount( give_maybe_sanitize_amount( $field['value'] ), array( 'sanitize' => false ) ) : $field['value'] ); |
|
| 244 | + $field['value'] = ( ! empty($field['value']) ? give_format_amount(give_maybe_sanitize_amount($field['value']), array('sanitize' => false)) : $field['value']); |
|
| 245 | 245 | |
| 246 | - $field['before_field'] = ! empty( $field['before_field'] ) ? $field['before_field'] : ( give_get_option( 'currency_position', 'before' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' ); |
|
| 247 | - $field['after_field'] = ! empty( $field['after_field'] ) ? $field['after_field'] : ( give_get_option( 'currency_position', 'before' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' ); |
|
| 246 | + $field['before_field'] = ! empty($field['before_field']) ? $field['before_field'] : (give_get_option('currency_position', 'before') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : ''); |
|
| 247 | + $field['after_field'] = ! empty($field['after_field']) ? $field['after_field'] : (give_get_option('currency_position', 'before') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : ''); |
|
| 248 | 248 | break; |
| 249 | 249 | |
| 250 | 250 | case 'decimal' : |
| 251 | 251 | $field['attributes']['class'] .= ' give_input_decimal'; |
| 252 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( give_maybe_sanitize_amount( $field['value'] ), false, false ) : $field['value'] ); |
|
| 252 | + $field['value'] = ( ! empty($field['value']) ? give_format_decimal(give_maybe_sanitize_amount($field['value']), false, false) : $field['value']); |
|
| 253 | 253 | break; |
| 254 | 254 | |
| 255 | 255 | default : |
@@ -257,20 +257,20 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | ?> |
| 260 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 261 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 260 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 261 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 262 | 262 | <?php echo $field['before_field']; ?> |
| 263 | 263 | <input |
| 264 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
| 265 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 266 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 267 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 268 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
| 269 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 264 | + type="<?php echo esc_attr($field['type']); ?>" |
|
| 265 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 266 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 267 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 268 | + value="<?php echo esc_attr($field['value']); ?>" |
|
| 269 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 270 | 270 | /> |
| 271 | 271 | <?php echo $field['after_field']; ?> |
| 272 | 272 | <?php |
| 273 | - echo give_get_field_description( $field ); |
|
| 273 | + echo give_get_field_description($field); |
|
| 274 | 274 | echo '</p>'; |
| 275 | 275 | } |
| 276 | 276 | |
@@ -292,29 +292,29 @@ discard block |
||
| 292 | 292 | * } |
| 293 | 293 | * @return void |
| 294 | 294 | */ |
| 295 | -function give_hidden_input( $field ) { |
|
| 295 | +function give_hidden_input($field) { |
|
| 296 | 296 | global $thepostid, $post; |
| 297 | 297 | |
| 298 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 299 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 298 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 299 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 300 | 300 | |
| 301 | 301 | // Custom attribute handling |
| 302 | 302 | $custom_attributes = array(); |
| 303 | 303 | |
| 304 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
| 304 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
| 305 | 305 | |
| 306 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
| 307 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
| 306 | + foreach ($field['attributes'] as $attribute => $value) { |
|
| 307 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | 310 | ?> |
| 311 | 311 | |
| 312 | 312 | <input |
| 313 | 313 | type="hidden" |
| 314 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 315 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 316 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
| 317 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 314 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 315 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 316 | + value="<?php echo esc_attr($field['value']); ?>" |
|
| 317 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 318 | 318 | /> |
| 319 | 319 | <?php |
| 320 | 320 | } |
@@ -340,27 +340,27 @@ discard block |
||
| 340 | 340 | * } |
| 341 | 341 | * @return void |
| 342 | 342 | */ |
| 343 | -function give_textarea_input( $field ) { |
|
| 343 | +function give_textarea_input($field) { |
|
| 344 | 344 | global $thepostid, $post; |
| 345 | 345 | |
| 346 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 347 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 348 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 349 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 346 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 347 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 348 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 349 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 350 | 350 | |
| 351 | 351 | ?> |
| 352 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 353 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 352 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 353 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 354 | 354 | <textarea |
| 355 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 356 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 357 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 355 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 356 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 357 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 358 | 358 | rows="10" |
| 359 | 359 | cols="20" |
| 360 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 361 | - ><?php echo esc_textarea( $field['value'] ); ?></textarea> |
|
| 360 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 361 | + ><?php echo esc_textarea($field['value']); ?></textarea> |
|
| 362 | 362 | <?php |
| 363 | - echo give_get_field_description( $field ); |
|
| 363 | + echo give_get_field_description($field); |
|
| 364 | 364 | echo '</p>'; |
| 365 | 365 | } |
| 366 | 366 | |
@@ -384,29 +384,29 @@ discard block |
||
| 384 | 384 | * } |
| 385 | 385 | * @return void |
| 386 | 386 | */ |
| 387 | -function give_wysiwyg( $field ) { |
|
| 387 | +function give_wysiwyg($field) { |
|
| 388 | 388 | global $thepostid, $post; |
| 389 | 389 | |
| 390 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 391 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 392 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 393 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 390 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 391 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 392 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 393 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 394 | 394 | |
| 395 | - $field['unique_field_id'] = give_get_field_name( $field ); |
|
| 395 | + $field['unique_field_id'] = give_get_field_name($field); |
|
| 396 | 396 | $editor_attributes = array( |
| 397 | - 'textarea_name' => isset( $field['repeatable_field_id'] ) ? $field['repeatable_field_id'] : $field['id'], |
|
| 397 | + 'textarea_name' => isset($field['repeatable_field_id']) ? $field['repeatable_field_id'] : $field['id'], |
|
| 398 | 398 | 'textarea_rows' => '10', |
| 399 | - 'editor_css' => esc_attr( $field['style'] ), |
|
| 399 | + 'editor_css' => esc_attr($field['style']), |
|
| 400 | 400 | 'editor_class' => $field['attributes']['class'], |
| 401 | 401 | ); |
| 402 | - $data_wp_editor = ' data-wp-editor="' . base64_encode( json_encode( array( |
|
| 402 | + $data_wp_editor = ' data-wp-editor="'.base64_encode(json_encode(array( |
|
| 403 | 403 | $field['value'], |
| 404 | 404 | $field['unique_field_id'], |
| 405 | 405 | $editor_attributes, |
| 406 | - ) ) ) . '"'; |
|
| 407 | - $data_wp_editor = isset( $field['repeatable_field_id'] ) ? $data_wp_editor : ''; |
|
| 406 | + ))).'"'; |
|
| 407 | + $data_wp_editor = isset($field['repeatable_field_id']) ? $data_wp_editor : ''; |
|
| 408 | 408 | |
| 409 | - echo '<div class="give-field-wrap ' . $field['unique_field_id'] . '_field ' . esc_attr( $field['wrapper_class'] ) . '"' . $data_wp_editor . '><label for="' . $field['unique_field_id'] . '">' . wp_kses_post( $field['name'] ) . '</label>'; |
|
| 409 | + echo '<div class="give-field-wrap '.$field['unique_field_id'].'_field '.esc_attr($field['wrapper_class']).'"'.$data_wp_editor.'><label for="'.$field['unique_field_id'].'">'.wp_kses_post($field['name']).'</label>'; |
|
| 410 | 410 | |
| 411 | 411 | wp_editor( |
| 412 | 412 | $field['value'], |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | $editor_attributes |
| 415 | 415 | ); |
| 416 | 416 | |
| 417 | - echo give_get_field_description( $field ); |
|
| 417 | + echo give_get_field_description($field); |
|
| 418 | 418 | echo '</div>'; |
| 419 | 419 | } |
| 420 | 420 | |
@@ -439,29 +439,29 @@ discard block |
||
| 439 | 439 | * } |
| 440 | 440 | * @return void |
| 441 | 441 | */ |
| 442 | -function give_checkbox( $field ) { |
|
| 442 | +function give_checkbox($field) { |
|
| 443 | 443 | global $thepostid, $post; |
| 444 | 444 | |
| 445 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 446 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 447 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 448 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 449 | - $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'on'; |
|
| 450 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 445 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 446 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 447 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 448 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 449 | + $field['cbvalue'] = isset($field['cbvalue']) ? $field['cbvalue'] : 'on'; |
|
| 450 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 451 | 451 | ?> |
| 452 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 453 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 452 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 453 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 454 | 454 | <input |
| 455 | 455 | type="checkbox" |
| 456 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 457 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 458 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 459 | - value="<?php echo esc_attr( $field['cbvalue'] ); ?>" |
|
| 460 | - <?php echo checked( $field['value'], $field['cbvalue'], false ); ?> |
|
| 461 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 456 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 457 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 458 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 459 | + value="<?php echo esc_attr($field['cbvalue']); ?>" |
|
| 460 | + <?php echo checked($field['value'], $field['cbvalue'], false); ?> |
|
| 461 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 462 | 462 | /> |
| 463 | 463 | <?php |
| 464 | - echo give_get_field_description( $field ); |
|
| 464 | + echo give_get_field_description($field); |
|
| 465 | 465 | echo '</p>'; |
| 466 | 466 | } |
| 467 | 467 | |
@@ -487,29 +487,29 @@ discard block |
||
| 487 | 487 | * } |
| 488 | 488 | * @return void |
| 489 | 489 | */ |
| 490 | -function give_select( $field ) { |
|
| 490 | +function give_select($field) { |
|
| 491 | 491 | global $thepostid, $post; |
| 492 | 492 | |
| 493 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 494 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 495 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 496 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 497 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 493 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 494 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 495 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 496 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 497 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 498 | 498 | ?> |
| 499 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 500 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 499 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 500 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 501 | 501 | <select |
| 502 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 503 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 504 | - style="<?php echo esc_attr( $field['style'] ) ?>" |
|
| 505 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 502 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 503 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 504 | + style="<?php echo esc_attr($field['style']) ?>" |
|
| 505 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 506 | 506 | > |
| 507 | 507 | <?php |
| 508 | - foreach ( $field['options'] as $key => $value ) { |
|
| 509 | - echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>'; |
|
| 508 | + foreach ($field['options'] as $key => $value) { |
|
| 509 | + echo '<option value="'.esc_attr($key).'" '.selected(esc_attr($field['value']), esc_attr($key), false).'>'.esc_html($value).'</option>'; |
|
| 510 | 510 | } |
| 511 | 511 | echo '</select>'; |
| 512 | - echo give_get_field_description( $field ); |
|
| 512 | + echo give_get_field_description($field); |
|
| 513 | 513 | echo '</p>'; |
| 514 | 514 | } |
| 515 | 515 | |
@@ -536,32 +536,32 @@ discard block |
||
| 536 | 536 | * } |
| 537 | 537 | * @return void |
| 538 | 538 | */ |
| 539 | -function give_radio( $field ) { |
|
| 539 | +function give_radio($field) { |
|
| 540 | 540 | global $thepostid, $post; |
| 541 | 541 | |
| 542 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 543 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 544 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 545 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 546 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 542 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 543 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 544 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 545 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 546 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 547 | 547 | |
| 548 | - echo '<fieldset class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><span class="give-field-label">' . wp_kses_post( $field['name'] ) . '</span><legend class="screen-reader-text">' . wp_kses_post( $field['name'] ) . '</legend><ul class="give-radios">'; |
|
| 548 | + echo '<fieldset class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><span class="give-field-label">'.wp_kses_post($field['name']).'</span><legend class="screen-reader-text">'.wp_kses_post($field['name']).'</legend><ul class="give-radios">'; |
|
| 549 | 549 | |
| 550 | - foreach ( $field['options'] as $key => $value ) { |
|
| 550 | + foreach ($field['options'] as $key => $value) { |
|
| 551 | 551 | |
| 552 | 552 | echo '<li><label><input |
| 553 | - name="' . give_get_field_name( $field ) . '" |
|
| 554 | - value="' . esc_attr( $key ) . '" |
|
| 553 | + name="' . give_get_field_name($field).'" |
|
| 554 | + value="' . esc_attr($key).'" |
|
| 555 | 555 | type="radio" |
| 556 | - style="' . esc_attr( $field['style'] ) . '" |
|
| 557 | - ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
|
| 558 | - . give_get_custom_attributes( $field ) . ' |
|
| 559 | - /> ' . esc_html( $value ) . '</label> |
|
| 556 | + style="' . esc_attr($field['style']).'" |
|
| 557 | + ' . checked(esc_attr($field['value']), esc_attr($key), false).' ' |
|
| 558 | + . give_get_custom_attributes($field).' |
|
| 559 | + /> ' . esc_html($value).'</label> |
|
| 560 | 560 | </li>'; |
| 561 | 561 | } |
| 562 | 562 | echo '</ul>'; |
| 563 | 563 | |
| 564 | - echo give_get_field_description( $field ); |
|
| 564 | + echo give_get_field_description($field); |
|
| 565 | 565 | echo '</fieldset>'; |
| 566 | 566 | } |
| 567 | 567 | |
@@ -585,27 +585,27 @@ discard block |
||
| 585 | 585 | * } |
| 586 | 586 | * @return void |
| 587 | 587 | */ |
| 588 | -function give_colorpicker( $field ) { |
|
| 588 | +function give_colorpicker($field) { |
|
| 589 | 589 | global $thepostid, $post; |
| 590 | 590 | |
| 591 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 592 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 593 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 594 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 595 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 591 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 592 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 593 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 594 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 595 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 596 | 596 | $field['type'] = 'text'; |
| 597 | 597 | ?> |
| 598 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 599 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 598 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 599 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 600 | 600 | <input |
| 601 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
| 602 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 603 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 604 | - id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr( $field['value'] ); ?>" |
|
| 605 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 601 | + type="<?php echo esc_attr($field['type']); ?>" |
|
| 602 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 603 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 604 | + id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr($field['value']); ?>" |
|
| 605 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 606 | 606 | /> |
| 607 | 607 | <?php |
| 608 | - echo give_get_field_description( $field ); |
|
| 608 | + echo give_get_field_description($field); |
|
| 609 | 609 | echo '</p>'; |
| 610 | 610 | } |
| 611 | 611 | |
@@ -616,8 +616,8 @@ discard block |
||
| 616 | 616 | * |
| 617 | 617 | * @param array $field |
| 618 | 618 | */ |
| 619 | -function give_file( $field ) { |
|
| 620 | - give_media( $field ); |
|
| 619 | +function give_file($field) { |
|
| 620 | + give_media($field); |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | |
@@ -628,37 +628,37 @@ discard block |
||
| 628 | 628 | * |
| 629 | 629 | * @param array $field |
| 630 | 630 | */ |
| 631 | -function give_media( $field ) { |
|
| 631 | +function give_media($field) { |
|
| 632 | 632 | global $thepostid, $post; |
| 633 | 633 | |
| 634 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 635 | - $button_label = esc_html__( sprintf( 'Add or Upload %s', ( 'file' === $field['type'] ? 'File' : 'Image' ) ), 'give' ); |
|
| 634 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 635 | + $button_label = esc_html__(sprintf('Add or Upload %s', ('file' === $field['type'] ? 'File' : 'Image')), 'give'); |
|
| 636 | 636 | |
| 637 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 638 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 639 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 640 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 637 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 638 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 639 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 640 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 641 | 641 | $field['attributes']['class'] = "{$field['attributes']['class']} give-text-medium"; |
| 642 | 642 | |
| 643 | 643 | // Allow developer to save attachment ID or attachment url as metadata. |
| 644 | - $field['fvalue'] = isset( $field['fvalue'] ) ? $field['fvalue'] : 'url'; |
|
| 644 | + $field['fvalue'] = isset($field['fvalue']) ? $field['fvalue'] : 'url'; |
|
| 645 | 645 | |
| 646 | - $allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' ); |
|
| 647 | - $preview_image_src = $field['value'] ? ( 'id' === $field['fvalue'] ? wp_get_attachment_url( $field['value'] ) : $field['value'] ) : '#'; |
|
| 648 | - $preview_image_extension = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : ''; |
|
| 649 | - $is_show_preview = in_array( $preview_image_extension, $allow_media_preview_tags ); |
|
| 646 | + $allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico'); |
|
| 647 | + $preview_image_src = $field['value'] ? ('id' === $field['fvalue'] ? wp_get_attachment_url($field['value']) : $field['value']) : '#'; |
|
| 648 | + $preview_image_extension = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : ''; |
|
| 649 | + $is_show_preview = in_array($preview_image_extension, $allow_media_preview_tags); |
|
| 650 | 650 | ?> |
| 651 | - <fieldset class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 652 | - <label for="<?php echo give_get_field_name( $field ) ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 651 | + <fieldset class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 652 | + <label for="<?php echo give_get_field_name($field) ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 653 | 653 | <input |
| 654 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 655 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 654 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 655 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 656 | 656 | type="text" |
| 657 | 657 | value="<?php echo $field['value']; ?>" |
| 658 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 659 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 658 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 659 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 660 | 660 | /> <input class="give-upload-button button" type="button" value="<?php echo $button_label; ?>" data-fvalue="<?php echo $field['fvalue']; ?>" data-field-type="<?php echo $field['type']; ?>"> |
| 661 | - <?php echo give_get_field_description( $field ); ?> |
|
| 661 | + <?php echo give_get_field_description($field); ?> |
|
| 662 | 662 | <div class="give-image-thumb<?php echo ! $field['value'] || ! $is_show_preview ? ' give-hidden' : ''; ?>"> |
| 663 | 663 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
| 664 | 664 | <img src="<?php echo $preview_image_src; ?>" alt=""> |
@@ -676,27 +676,27 @@ discard block |
||
| 676 | 676 | * |
| 677 | 677 | * @return void |
| 678 | 678 | */ |
| 679 | -function give_default_gateway( $field ) { |
|
| 679 | +function give_default_gateway($field) { |
|
| 680 | 680 | global $thepostid, $post; |
| 681 | 681 | |
| 682 | 682 | // get all active payment gateways. |
| 683 | - $gateways = give_get_enabled_payment_gateways( $thepostid ); |
|
| 683 | + $gateways = give_get_enabled_payment_gateways($thepostid); |
|
| 684 | 684 | $field['options'] = array(); |
| 685 | 685 | |
| 686 | 686 | // Set field option value. |
| 687 | - if ( ! empty( $gateways ) ) { |
|
| 688 | - foreach ( $gateways as $key => $option ) { |
|
| 689 | - $field['options'][ $key ] = $option['admin_label']; |
|
| 687 | + if ( ! empty($gateways)) { |
|
| 688 | + foreach ($gateways as $key => $option) { |
|
| 689 | + $field['options'][$key] = $option['admin_label']; |
|
| 690 | 690 | } |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | // Add a field to the Give Form admin single post view of this field |
| 694 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
| 695 | - $field['options'] = array_merge( array( 'global' => esc_html__( 'Global Default', 'give' ) ), $field['options'] ); |
|
| 694 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
| 695 | + $field['options'] = array_merge(array('global' => esc_html__('Global Default', 'give')), $field['options']); |
|
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | // Render select field. |
| 699 | - give_select( $field ); |
|
| 699 | + give_select($field); |
|
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | /** |
@@ -718,13 +718,13 @@ discard block |
||
| 718 | 718 | * @return void |
| 719 | 719 | */ |
| 720 | 720 | |
| 721 | -function give_docs_link( $field ) { |
|
| 722 | - $field['url'] = isset( $field['url'] ) ? $field['url'] : 'https://givewp.com/documentation'; |
|
| 723 | - $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation'; |
|
| 721 | +function give_docs_link($field) { |
|
| 722 | + $field['url'] = isset($field['url']) ? $field['url'] : 'https://givewp.com/documentation'; |
|
| 723 | + $field['title'] = isset($field['title']) ? $field['title'] : 'Documentation'; |
|
| 724 | 724 | |
| 725 | - echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] ) |
|
| 725 | + echo '<p class="give-docs-link"><a href="'.esc_url($field['url']) |
|
| 726 | 726 | . '" target="_blank">' |
| 727 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] ) |
|
| 727 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $field['title']) |
|
| 728 | 728 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
| 729 | 729 | } |
| 730 | 730 | |
@@ -740,13 +740,13 @@ discard block |
||
| 740 | 740 | * |
| 741 | 741 | * @return mixed |
| 742 | 742 | */ |
| 743 | -function give_get_field_value( $field, $postid ) { |
|
| 744 | - if ( isset( $field['attributes']['value'] ) ) { |
|
| 743 | +function give_get_field_value($field, $postid) { |
|
| 744 | + if (isset($field['attributes']['value'])) { |
|
| 745 | 745 | return $field['attributes']['value']; |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | // Get value from db. |
| 749 | - $field_value = give_get_meta( $postid, $field['id'], true ); |
|
| 749 | + $field_value = give_get_meta($postid, $field['id'], true); |
|
| 750 | 750 | |
| 751 | 751 | /** |
| 752 | 752 | * Filter the field value before apply default value. |
@@ -755,10 +755,10 @@ discard block |
||
| 755 | 755 | * |
| 756 | 756 | * @param mixed $field_value Field value. |
| 757 | 757 | */ |
| 758 | - $field_value = apply_filters( "{$field['id']}_field_value", $field_value, $field, $postid ); |
|
| 758 | + $field_value = apply_filters("{$field['id']}_field_value", $field_value, $field, $postid); |
|
| 759 | 759 | |
| 760 | 760 | // Set default value if no any data saved to db. |
| 761 | - if ( ! $field_value && isset( $field['default'] ) ) { |
|
| 761 | + if ( ! $field_value && isset($field['default'])) { |
|
| 762 | 762 | $field_value = $field['default']; |
| 763 | 763 | } |
| 764 | 764 | |
@@ -775,20 +775,20 @@ discard block |
||
| 775 | 775 | * |
| 776 | 776 | * @return string |
| 777 | 777 | */ |
| 778 | -function give_get_field_description( $field ) { |
|
| 778 | +function give_get_field_description($field) { |
|
| 779 | 779 | $field_desc_html = ''; |
| 780 | 780 | $description = ''; |
| 781 | 781 | |
| 782 | 782 | // Check for both `description` and `desc`. |
| 783 | - if ( isset( $field['description'] ) ) { |
|
| 783 | + if (isset($field['description'])) { |
|
| 784 | 784 | $description = $field['description']; |
| 785 | - } elseif ( isset( $field['desc'] ) ) { |
|
| 785 | + } elseif (isset($field['desc'])) { |
|
| 786 | 786 | $description = $field['desc']; |
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | // Set if there is a description. |
| 790 | - if ( ! empty( $description ) ) { |
|
| 791 | - $field_desc_html = '<span class="give-field-description">' . wp_kses_post( $description ) . '</span>'; |
|
| 790 | + if ( ! empty($description)) { |
|
| 791 | + $field_desc_html = '<span class="give-field-description">'.wp_kses_post($description).'</span>'; |
|
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | return $field_desc_html; |
@@ -808,8 +808,8 @@ discard block |
||
| 808 | 808 | * |
| 809 | 809 | * @return string |
| 810 | 810 | */ |
| 811 | -function give_get_repeater_field_value( $field, $field_group, $fields ) { |
|
| 812 | - $field_value = ( isset( $field_group[ $field['id'] ] ) ? $field_group[ $field['id'] ] : '' ); |
|
| 811 | +function give_get_repeater_field_value($field, $field_group, $fields) { |
|
| 812 | + $field_value = (isset($field_group[$field['id']]) ? $field_group[$field['id']] : ''); |
|
| 813 | 813 | |
| 814 | 814 | /** |
| 815 | 815 | * Filter the specific repeater field value |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | * |
| 819 | 819 | * @param string $field_id |
| 820 | 820 | */ |
| 821 | - $field_value = apply_filters( "give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields ); |
|
| 821 | + $field_value = apply_filters("give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields); |
|
| 822 | 822 | |
| 823 | 823 | /** |
| 824 | 824 | * Filter the repeater field value |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | * |
| 828 | 828 | * @param string $field_id |
| 829 | 829 | */ |
| 830 | - $field_value = apply_filters( 'give_get_repeater_field_value', $field_value, $field, $field_group, $fields ); |
|
| 830 | + $field_value = apply_filters('give_get_repeater_field_value', $field_value, $field, $field_group, $fields); |
|
| 831 | 831 | |
| 832 | 832 | return $field_value; |
| 833 | 833 | } |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | * |
| 846 | 846 | * @return string |
| 847 | 847 | */ |
| 848 | -function give_get_repeater_field_id( $field, $fields, $default = false ) { |
|
| 848 | +function give_get_repeater_field_id($field, $fields, $default = false) { |
|
| 849 | 849 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
| 850 | 850 | |
| 851 | 851 | // Get field id. |
@@ -858,7 +858,7 @@ discard block |
||
| 858 | 858 | * |
| 859 | 859 | * @param string $field_id |
| 860 | 860 | */ |
| 861 | - $field_id = apply_filters( "give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default ); |
|
| 861 | + $field_id = apply_filters("give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default); |
|
| 862 | 862 | |
| 863 | 863 | /** |
| 864 | 864 | * Filter the repeater field id |
@@ -867,7 +867,7 @@ discard block |
||
| 867 | 867 | * |
| 868 | 868 | * @param string $field_id |
| 869 | 869 | */ |
| 870 | - $field_id = apply_filters( 'give_get_repeater_field_id', $field_id, $field, $fields, $default ); |
|
| 870 | + $field_id = apply_filters('give_get_repeater_field_id', $field_id, $field, $fields, $default); |
|
| 871 | 871 | |
| 872 | 872 | return $field_id; |
| 873 | 873 | } |
@@ -882,8 +882,8 @@ discard block |
||
| 882 | 882 | * |
| 883 | 883 | * @return string |
| 884 | 884 | */ |
| 885 | -function give_get_field_name( $field ) { |
|
| 886 | - $field_name = esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] ); |
|
| 885 | +function give_get_field_name($field) { |
|
| 886 | + $field_name = esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']); |
|
| 887 | 887 | |
| 888 | 888 | /** |
| 889 | 889 | * Filter the field name. |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | * |
| 893 | 893 | * @param string $field_name |
| 894 | 894 | */ |
| 895 | - $field_name = apply_filters( 'give_get_field_name', $field_name, $field ); |
|
| 895 | + $field_name = apply_filters('give_get_field_name', $field_name, $field); |
|
| 896 | 896 | |
| 897 | 897 | return $field_name; |
| 898 | 898 | } |
@@ -909,40 +909,40 @@ discard block |
||
| 909 | 909 | * |
| 910 | 910 | * @return void |
| 911 | 911 | */ |
| 912 | -function _give_metabox_form_data_repeater_fields( $fields ) { |
|
| 912 | +function _give_metabox_form_data_repeater_fields($fields) { |
|
| 913 | 913 | global $thepostid, $post; |
| 914 | 914 | |
| 915 | 915 | // Bailout. |
| 916 | - if ( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) { |
|
| 916 | + if ( ! isset($fields['fields']) || empty($fields['fields'])) { |
|
| 917 | 917 | return; |
| 918 | 918 | } |
| 919 | 919 | |
| 920 | - $group_numbering = isset( $fields['options']['group_numbering'] ) ? (int) $fields['options']['group_numbering'] : 0; |
|
| 921 | - $close_tabs = isset( $fields['options']['close_tabs'] ) ? (int) $fields['options']['close_tabs'] : 0; |
|
| 922 | - $wrapper_class = isset( $fields['wrapper_class'] ) ? $fields['wrapper_class'] : ''; |
|
| 920 | + $group_numbering = isset($fields['options']['group_numbering']) ? (int) $fields['options']['group_numbering'] : 0; |
|
| 921 | + $close_tabs = isset($fields['options']['close_tabs']) ? (int) $fields['options']['close_tabs'] : 0; |
|
| 922 | + $wrapper_class = isset($fields['wrapper_class']) ? $fields['wrapper_class'] : ''; |
|
| 923 | 923 | ?> |
| 924 | - <div class="give-repeatable-field-section <?php echo esc_attr( $wrapper_class ); ?>" id="<?php echo "{$fields['id']}_field"; ?>" |
|
| 924 | + <div class="give-repeatable-field-section <?php echo esc_attr($wrapper_class); ?>" id="<?php echo "{$fields['id']}_field"; ?>" |
|
| 925 | 925 | data-group-numbering="<?php echo $group_numbering; ?>" data-close-tabs="<?php echo $close_tabs; ?>"> |
| 926 | - <?php if ( ! empty( $fields['name'] ) ) : ?> |
|
| 926 | + <?php if ( ! empty($fields['name'])) : ?> |
|
| 927 | 927 | <p class="give-repeater-field-name"><?php echo $fields['name']; ?></p> |
| 928 | 928 | <?php endif; ?> |
| 929 | 929 | |
| 930 | - <?php if ( ! empty( $fields['description'] ) ) : ?> |
|
| 930 | + <?php if ( ! empty($fields['description'])) : ?> |
|
| 931 | 931 | <p class="give-repeater-field-description"><?php echo $fields['description']; ?></p> |
| 932 | 932 | <?php endif; ?> |
| 933 | 933 | |
| 934 | 934 | <table class="give-repeatable-fields-section-wrapper" cellspacing="0"> |
| 935 | 935 | <?php |
| 936 | - $repeater_field_values = give_get_meta( $thepostid, $fields['id'], true ); |
|
| 937 | - $header_title = isset( $fields['options']['header_title'] ) |
|
| 936 | + $repeater_field_values = give_get_meta($thepostid, $fields['id'], true); |
|
| 937 | + $header_title = isset($fields['options']['header_title']) |
|
| 938 | 938 | ? $fields['options']['header_title'] |
| 939 | - : esc_attr__( 'Group', 'give' ); |
|
| 939 | + : esc_attr__('Group', 'give'); |
|
| 940 | 940 | |
| 941 | 941 | $add_default_donation_field = false; |
| 942 | 942 | |
| 943 | 943 | // Check if level is not created or we have to add default level. |
| 944 | - if ( is_array( $repeater_field_values ) && ( $fields_count = count( $repeater_field_values ) ) ) { |
|
| 945 | - $repeater_field_values = array_values( $repeater_field_values ); |
|
| 944 | + if (is_array($repeater_field_values) && ($fields_count = count($repeater_field_values))) { |
|
| 945 | + $repeater_field_values = array_values($repeater_field_values); |
|
| 946 | 946 | } else { |
| 947 | 947 | $fields_count = 1; |
| 948 | 948 | $add_default_donation_field = true; |
@@ -955,77 +955,77 @@ discard block |
||
| 955 | 955 | <div class="give-row-head give-move"> |
| 956 | 956 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span> |
| 957 | 957 | </button> |
| 958 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-</span> |
|
| 958 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-</span> |
|
| 959 | 959 | <h2> |
| 960 | 960 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
| 961 | 961 | </h2> |
| 962 | 962 | </div> |
| 963 | 963 | <div class="give-row-body"> |
| 964 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
| 964 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
| 965 | 965 | <?php |
| 966 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
| 966 | + if ( ! give_is_field_callback_exist($field)) { |
|
| 967 | 967 | continue; |
| 968 | 968 | } |
| 969 | 969 | ?> |
| 970 | 970 | <?php |
| 971 | 971 | $field['repeat'] = true; |
| 972 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields ); |
|
| 972 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields); |
|
| 973 | 973 | $field['id'] = str_replace( |
| 974 | - array( '[', ']' ), |
|
| 975 | - array( '_', '', ), |
|
| 974 | + array('[', ']'), |
|
| 975 | + array('_', '',), |
|
| 976 | 976 | $field['repeatable_field_id'] |
| 977 | 977 | ); |
| 978 | 978 | ?> |
| 979 | - <?php give_render_field( $field ); ?> |
|
| 979 | + <?php give_render_field($field); ?> |
|
| 980 | 980 | <?php endforeach; ?> |
| 981 | 981 | </div> |
| 982 | 982 | </td> |
| 983 | 983 | </tr> |
| 984 | 984 | |
| 985 | - <?php if ( ! empty( $repeater_field_values ) ) : ?> |
|
| 985 | + <?php if ( ! empty($repeater_field_values)) : ?> |
|
| 986 | 986 | <!--Stored repeater field group--> |
| 987 | - <?php foreach ( $repeater_field_values as $index => $field_group ) : ?> |
|
| 987 | + <?php foreach ($repeater_field_values as $index => $field_group) : ?> |
|
| 988 | 988 | <tr class="give-row"> |
| 989 | 989 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
| 990 | 990 | <div class="give-row-head give-move"> |
| 991 | 991 | <button type="button" class="handlediv button-link"> |
| 992 | 992 | <span class="toggle-indicator"></span></button> |
| 993 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
| 993 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
| 994 | 994 | </span> |
| 995 | 995 | <h2> |
| 996 | 996 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
| 997 | 997 | </h2> |
| 998 | 998 | </div> |
| 999 | 999 | <div class="give-row-body"> |
| 1000 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
| 1001 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
| 1000 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
| 1001 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
| 1002 | 1002 | continue; |
| 1003 | 1003 | } ?> |
| 1004 | 1004 | <?php |
| 1005 | 1005 | $field['repeat'] = true; |
| 1006 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, $index ); |
|
| 1007 | - $field['attributes']['value'] = give_get_repeater_field_value( $field, $field_group, $fields ); |
|
| 1006 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, $index); |
|
| 1007 | + $field['attributes']['value'] = give_get_repeater_field_value($field, $field_group, $fields); |
|
| 1008 | 1008 | $field['id'] = str_replace( |
| 1009 | - array( '[', ']' ), |
|
| 1010 | - array( '_', '', ), |
|
| 1009 | + array('[', ']'), |
|
| 1010 | + array('_', '',), |
|
| 1011 | 1011 | $field['repeatable_field_id'] |
| 1012 | 1012 | ); |
| 1013 | 1013 | ?> |
| 1014 | - <?php give_render_field( $field ); ?> |
|
| 1014 | + <?php give_render_field($field); ?> |
|
| 1015 | 1015 | <?php endforeach; ?> |
| 1016 | 1016 | </div> |
| 1017 | 1017 | </td> |
| 1018 | 1018 | </tr> |
| 1019 | - <?php endforeach;; ?> |
|
| 1019 | + <?php endforeach; ; ?> |
|
| 1020 | 1020 | |
| 1021 | - <?php elseif ( $add_default_donation_field ) : ?> |
|
| 1021 | + <?php elseif ($add_default_donation_field) : ?> |
|
| 1022 | 1022 | <!--Default repeater field group--> |
| 1023 | 1023 | <tr class="give-row"> |
| 1024 | 1024 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
| 1025 | 1025 | <div class="give-row-head give-move"> |
| 1026 | 1026 | <button type="button" class="handlediv button-link"> |
| 1027 | 1027 | <span class="toggle-indicator"></span></button> |
| 1028 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
| 1028 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
| 1029 | 1029 | </span> |
| 1030 | 1030 | <h2> |
| 1031 | 1031 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
@@ -1033,25 +1033,25 @@ discard block |
||
| 1033 | 1033 | </div> |
| 1034 | 1034 | <div class="give-row-body"> |
| 1035 | 1035 | <?php |
| 1036 | - foreach ( $fields['fields'] as $field ) : |
|
| 1037 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
| 1036 | + foreach ($fields['fields'] as $field) : |
|
| 1037 | + if ( ! give_is_field_callback_exist($field)) { |
|
| 1038 | 1038 | continue; |
| 1039 | 1039 | } |
| 1040 | 1040 | |
| 1041 | 1041 | $field['repeat'] = true; |
| 1042 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, 0 ); |
|
| 1042 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, 0); |
|
| 1043 | 1043 | $field['attributes']['value'] = apply_filters( |
| 1044 | 1044 | "give_default_field_group_field_{$field['id']}_value", |
| 1045 | - ( ! empty( $field['default'] ) ? $field['default'] : '' ), |
|
| 1045 | + ( ! empty($field['default']) ? $field['default'] : ''), |
|
| 1046 | 1046 | $field, |
| 1047 | 1047 | $fields |
| 1048 | 1048 | ); |
| 1049 | - $field['id'] = str_replace( |
|
| 1050 | - array( '[', ']' ), |
|
| 1051 | - array( '_', '', ), |
|
| 1049 | + $field['id'] = str_replace( |
|
| 1050 | + array('[', ']'), |
|
| 1051 | + array('_', '',), |
|
| 1052 | 1052 | $field['repeatable_field_id'] |
| 1053 | 1053 | ); |
| 1054 | - give_render_field( $field ); |
|
| 1054 | + give_render_field($field); |
|
| 1055 | 1055 | |
| 1056 | 1056 | endforeach; |
| 1057 | 1057 | ?> |
@@ -1063,9 +1063,9 @@ discard block |
||
| 1063 | 1063 | <tfoot> |
| 1064 | 1064 | <tr> |
| 1065 | 1065 | <?php |
| 1066 | - $add_row_btn_title = isset( $fields['options']['add_button'] ) |
|
| 1066 | + $add_row_btn_title = isset($fields['options']['add_button']) |
|
| 1067 | 1067 | ? $add_row_btn_title = $fields['options']['add_button'] |
| 1068 | - : esc_html__( 'Add Row', 'give' ); |
|
| 1068 | + : esc_html__('Add Row', 'give'); |
|
| 1069 | 1069 | ?> |
| 1070 | 1070 | <td colspan="2" class="give-add-repeater-field-section-row-wrap"> |
| 1071 | 1071 | <span class="button button-primary give-add-repeater-field-section-row"><?php echo $add_row_btn_title; ?></span> |
@@ -1095,10 +1095,10 @@ discard block |
||
| 1095 | 1095 | * |
| 1096 | 1096 | * @param string |
| 1097 | 1097 | */ |
| 1098 | - $default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' ); |
|
| 1098 | + $default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general'); |
|
| 1099 | 1099 | |
| 1100 | 1100 | // Get current tab. |
| 1101 | - $current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] ); |
|
| 1101 | + $current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']); |
|
| 1102 | 1102 | |
| 1103 | 1103 | // Output. |
| 1104 | 1104 | return $current_tab; |
@@ -1122,10 +1122,10 @@ discard block |
||
| 1122 | 1122 | * |
| 1123 | 1123 | * @param string |
| 1124 | 1124 | */ |
| 1125 | - $default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' ); |
|
| 1125 | + $default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", ''); |
|
| 1126 | 1126 | |
| 1127 | 1127 | // Get current section. |
| 1128 | - $current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] ); |
|
| 1128 | + $current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']); |
|
| 1129 | 1129 | |
| 1130 | 1130 | // Output. |
| 1131 | 1131 | return $current_section; |
@@ -1139,7 +1139,7 @@ discard block |
||
| 1139 | 1139 | */ |
| 1140 | 1140 | function give_get_current_setting_page() { |
| 1141 | 1141 | // Get current page. |
| 1142 | - $setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : ''; |
|
| 1142 | + $setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : ''; |
|
| 1143 | 1143 | |
| 1144 | 1144 | // Output. |
| 1145 | 1145 | return $setting_page; |
@@ -1159,13 +1159,13 @@ discard block |
||
| 1159 | 1159 | * |
| 1160 | 1160 | * @return string |
| 1161 | 1161 | */ |
| 1162 | -function _give_display_content_field_value( $field_value, $field, $postid ) { |
|
| 1163 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
| 1162 | +function _give_display_content_field_value($field_value, $field, $postid) { |
|
| 1163 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
| 1164 | 1164 | |
| 1165 | 1165 | if ( |
| 1166 | - ! give_get_meta( $postid, '_give_display_content', true ) |
|
| 1166 | + ! give_get_meta($postid, '_give_display_content', true) |
|
| 1167 | 1167 | && $show_content |
| 1168 | - && ( 'none' !== $show_content ) |
|
| 1168 | + && ('none' !== $show_content) |
|
| 1169 | 1169 | ) { |
| 1170 | 1170 | $field_value = 'enabled'; |
| 1171 | 1171 | } |
@@ -1173,7 +1173,7 @@ discard block |
||
| 1173 | 1173 | return $field_value; |
| 1174 | 1174 | } |
| 1175 | 1175 | |
| 1176 | -add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 ); |
|
| 1176 | +add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3); |
|
| 1177 | 1177 | |
| 1178 | 1178 | |
| 1179 | 1179 | /** |
@@ -1190,12 +1190,12 @@ discard block |
||
| 1190 | 1190 | * |
| 1191 | 1191 | * @return string |
| 1192 | 1192 | */ |
| 1193 | -function _give_content_placement_field_value( $field_value, $field, $postid ) { |
|
| 1194 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
| 1193 | +function _give_content_placement_field_value($field_value, $field, $postid) { |
|
| 1194 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
| 1195 | 1195 | |
| 1196 | 1196 | if ( |
| 1197 | - ! give_get_meta( $postid, '_give_content_placement', true ) |
|
| 1198 | - && ( 'none' !== $show_content ) |
|
| 1197 | + ! give_get_meta($postid, '_give_content_placement', true) |
|
| 1198 | + && ('none' !== $show_content) |
|
| 1199 | 1199 | ) { |
| 1200 | 1200 | $field_value = $show_content; |
| 1201 | 1201 | } |
@@ -1203,7 +1203,7 @@ discard block |
||
| 1203 | 1203 | return $field_value; |
| 1204 | 1204 | } |
| 1205 | 1205 | |
| 1206 | -add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 ); |
|
| 1206 | +add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3); |
|
| 1207 | 1207 | |
| 1208 | 1208 | |
| 1209 | 1209 | /** |
@@ -1219,17 +1219,17 @@ discard block |
||
| 1219 | 1219 | * |
| 1220 | 1220 | * @return string |
| 1221 | 1221 | */ |
| 1222 | -function _give_terms_option_field_value( $field_value, $field, $postid ) { |
|
| 1223 | - $term_option = give_get_meta( $postid, '_give_terms_option', true ); |
|
| 1222 | +function _give_terms_option_field_value($field_value, $field, $postid) { |
|
| 1223 | + $term_option = give_get_meta($postid, '_give_terms_option', true); |
|
| 1224 | 1224 | |
| 1225 | - if ( in_array( $term_option, array( 'none', 'yes' ) ) ) { |
|
| 1226 | - $field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' ); |
|
| 1225 | + if (in_array($term_option, array('none', 'yes'))) { |
|
| 1226 | + $field_value = ('yes' === $term_option ? 'enabled' : 'disabled'); |
|
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | 1229 | return $field_value; |
| 1230 | 1230 | } |
| 1231 | 1231 | |
| 1232 | -add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 ); |
|
| 1232 | +add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3); |
|
| 1233 | 1233 | |
| 1234 | 1234 | |
| 1235 | 1235 | /** |
@@ -1246,17 +1246,17 @@ discard block |
||
| 1246 | 1246 | * |
| 1247 | 1247 | * @return string |
| 1248 | 1248 | */ |
| 1249 | -function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ) { |
|
| 1250 | - $offline_donation = give_get_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true ); |
|
| 1249 | +function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) { |
|
| 1250 | + $offline_donation = give_get_meta($postid, '_give_offline_donation_enable_billing_fields_single', true); |
|
| 1251 | 1251 | |
| 1252 | - if ( 'on' === $offline_donation ) { |
|
| 1252 | + if ('on' === $offline_donation) { |
|
| 1253 | 1253 | $field_value = 'enabled'; |
| 1254 | 1254 | } |
| 1255 | 1255 | |
| 1256 | 1256 | return $field_value; |
| 1257 | 1257 | } |
| 1258 | 1258 | |
| 1259 | -add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 ); |
|
| 1259 | +add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3); |
|
| 1260 | 1260 | |
| 1261 | 1261 | |
| 1262 | 1262 | /** |
@@ -1272,17 +1272,17 @@ discard block |
||
| 1272 | 1272 | * |
| 1273 | 1273 | * @return string |
| 1274 | 1274 | */ |
| 1275 | -function _give_custom_amount_field_value( $field_value, $field, $postid ) { |
|
| 1276 | - $custom_amount = give_get_meta( $postid, '_give_custom_amount', true ); |
|
| 1275 | +function _give_custom_amount_field_value($field_value, $field, $postid) { |
|
| 1276 | + $custom_amount = give_get_meta($postid, '_give_custom_amount', true); |
|
| 1277 | 1277 | |
| 1278 | - if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) { |
|
| 1279 | - $field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' ); |
|
| 1278 | + if (in_array($custom_amount, array('yes', 'no'))) { |
|
| 1279 | + $field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled'); |
|
| 1280 | 1280 | } |
| 1281 | 1281 | |
| 1282 | 1282 | return $field_value; |
| 1283 | 1283 | } |
| 1284 | 1284 | |
| 1285 | -add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 ); |
|
| 1285 | +add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3); |
|
| 1286 | 1286 | |
| 1287 | 1287 | |
| 1288 | 1288 | /** |
@@ -1298,17 +1298,17 @@ discard block |
||
| 1298 | 1298 | * |
| 1299 | 1299 | * @return string |
| 1300 | 1300 | */ |
| 1301 | -function _give_goal_option_field_value( $field_value, $field, $postid ) { |
|
| 1302 | - $goal_option = give_get_meta( $postid, '_give_goal_option', true ); |
|
| 1301 | +function _give_goal_option_field_value($field_value, $field, $postid) { |
|
| 1302 | + $goal_option = give_get_meta($postid, '_give_goal_option', true); |
|
| 1303 | 1303 | |
| 1304 | - if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) { |
|
| 1305 | - $field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' ); |
|
| 1304 | + if (in_array($goal_option, array('yes', 'no'))) { |
|
| 1305 | + $field_value = ('yes' === $goal_option ? 'enabled' : 'disabled'); |
|
| 1306 | 1306 | } |
| 1307 | 1307 | |
| 1308 | 1308 | return $field_value; |
| 1309 | 1309 | } |
| 1310 | 1310 | |
| 1311 | -add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 ); |
|
| 1311 | +add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3); |
|
| 1312 | 1312 | |
| 1313 | 1313 | /** |
| 1314 | 1314 | * Set value for Donation Goal --> close Form. |
@@ -1324,17 +1324,17 @@ discard block |
||
| 1324 | 1324 | * |
| 1325 | 1325 | * @return string |
| 1326 | 1326 | */ |
| 1327 | -function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) { |
|
| 1328 | - $close_form = give_get_meta( $postid, '_give_close_form_when_goal_achieved', true ); |
|
| 1327 | +function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) { |
|
| 1328 | + $close_form = give_get_meta($postid, '_give_close_form_when_goal_achieved', true); |
|
| 1329 | 1329 | |
| 1330 | - if ( in_array( $close_form, array( 'yes', 'no' ) ) ) { |
|
| 1331 | - $field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' ); |
|
| 1330 | + if (in_array($close_form, array('yes', 'no'))) { |
|
| 1331 | + $field_value = ('yes' === $close_form ? 'enabled' : 'disabled'); |
|
| 1332 | 1332 | } |
| 1333 | 1333 | |
| 1334 | 1334 | return $field_value; |
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | -add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 ); |
|
| 1337 | +add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3); |
|
| 1338 | 1338 | |
| 1339 | 1339 | |
| 1340 | 1340 | /** |
@@ -1350,17 +1350,17 @@ discard block |
||
| 1350 | 1350 | * |
| 1351 | 1351 | * @return string |
| 1352 | 1352 | */ |
| 1353 | -function _give_logged_in_only_value( $field_value, $field, $postid ) { |
|
| 1354 | - $guest_donation = give_get_meta( $postid, '_give_logged_in_only', true ); |
|
| 1353 | +function _give_logged_in_only_value($field_value, $field, $postid) { |
|
| 1354 | + $guest_donation = give_get_meta($postid, '_give_logged_in_only', true); |
|
| 1355 | 1355 | |
| 1356 | - if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) { |
|
| 1357 | - $field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' ); |
|
| 1356 | + if (in_array($guest_donation, array('yes', 'no'))) { |
|
| 1357 | + $field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled'); |
|
| 1358 | 1358 | } |
| 1359 | 1359 | |
| 1360 | 1360 | return $field_value; |
| 1361 | 1361 | } |
| 1362 | 1362 | |
| 1363 | -add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 ); |
|
| 1363 | +add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3); |
|
| 1364 | 1364 | |
| 1365 | 1365 | /** |
| 1366 | 1366 | * Set value for Offline Donations --> Offline Donations. |
@@ -1376,17 +1376,17 @@ discard block |
||
| 1376 | 1376 | * |
| 1377 | 1377 | * @return string |
| 1378 | 1378 | */ |
| 1379 | -function _give_customize_offline_donations_value( $field_value, $field, $postid ) { |
|
| 1380 | - $customize_offline_text = give_get_meta( $postid, '_give_customize_offline_donations', true ); |
|
| 1379 | +function _give_customize_offline_donations_value($field_value, $field, $postid) { |
|
| 1380 | + $customize_offline_text = give_get_meta($postid, '_give_customize_offline_donations', true); |
|
| 1381 | 1381 | |
| 1382 | - if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) { |
|
| 1383 | - $field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' ); |
|
| 1382 | + if (in_array($customize_offline_text, array('yes', 'no'))) { |
|
| 1383 | + $field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled'); |
|
| 1384 | 1384 | } |
| 1385 | 1385 | |
| 1386 | 1386 | return $field_value; |
| 1387 | 1387 | } |
| 1388 | 1388 | |
| 1389 | -add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 ); |
|
| 1389 | +add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3); |
|
| 1390 | 1390 | |
| 1391 | 1391 | |
| 1392 | 1392 | /** |
@@ -1401,14 +1401,14 @@ discard block |
||
| 1401 | 1401 | * |
| 1402 | 1402 | * @return mixed |
| 1403 | 1403 | */ |
| 1404 | -function _give_set_multi_level_repeater_field_id( $field_id, $field, $fields, $default ) { |
|
| 1404 | +function _give_set_multi_level_repeater_field_id($field_id, $field, $fields, $default) { |
|
| 1405 | 1405 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
| 1406 | 1406 | $field_id = "{$fields['id']}[{$row_placeholder}][{$field['id']}][level_id]"; |
| 1407 | 1407 | |
| 1408 | 1408 | return $field_id; |
| 1409 | 1409 | } |
| 1410 | 1410 | |
| 1411 | -add_filter( 'give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4 ); |
|
| 1411 | +add_filter('give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4); |
|
| 1412 | 1412 | |
| 1413 | 1413 | /** |
| 1414 | 1414 | * Set repeater field value for multi donation form. |
@@ -1422,13 +1422,13 @@ discard block |
||
| 1422 | 1422 | * |
| 1423 | 1423 | * @return mixed |
| 1424 | 1424 | */ |
| 1425 | -function _give_set_multi_level_repeater_field_value( $field_value, $field, $field_group, $fields ) { |
|
| 1426 | - $field_value = $field_group[ $field['id'] ]['level_id']; |
|
| 1425 | +function _give_set_multi_level_repeater_field_value($field_value, $field, $field_group, $fields) { |
|
| 1426 | + $field_value = $field_group[$field['id']]['level_id']; |
|
| 1427 | 1427 | |
| 1428 | 1428 | return $field_value; |
| 1429 | 1429 | } |
| 1430 | 1430 | |
| 1431 | -add_filter( 'give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4 ); |
|
| 1431 | +add_filter('give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4); |
|
| 1432 | 1432 | |
| 1433 | 1433 | /** |
| 1434 | 1434 | * Set default value for _give_id field. |
@@ -1439,11 +1439,11 @@ discard block |
||
| 1439 | 1439 | * |
| 1440 | 1440 | * @return string |
| 1441 | 1441 | */ |
| 1442 | -function _give_set_field_give_id_default_value( $field ) { |
|
| 1442 | +function _give_set_field_give_id_default_value($field) { |
|
| 1443 | 1443 | return 0; |
| 1444 | 1444 | } |
| 1445 | 1445 | |
| 1446 | -add_filter( 'give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value' ); |
|
| 1446 | +add_filter('give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value'); |
|
| 1447 | 1447 | |
| 1448 | 1448 | /** |
| 1449 | 1449 | * Set default value for _give_default field. |
@@ -1454,11 +1454,11 @@ discard block |
||
| 1454 | 1454 | * |
| 1455 | 1455 | * @return string |
| 1456 | 1456 | */ |
| 1457 | -function _give_set_field_give_default_default_value( $field ) { |
|
| 1457 | +function _give_set_field_give_default_default_value($field) { |
|
| 1458 | 1458 | return 'default'; |
| 1459 | 1459 | } |
| 1460 | 1460 | |
| 1461 | -add_filter( 'give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value' ); |
|
| 1461 | +add_filter('give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value'); |
|
| 1462 | 1462 | |
| 1463 | 1463 | /** |
| 1464 | 1464 | * Set repeater field editor id for field type wysiwyg. |
@@ -1470,12 +1470,12 @@ discard block |
||
| 1470 | 1470 | * |
| 1471 | 1471 | * @return string |
| 1472 | 1472 | */ |
| 1473 | -function give_repeater_field_set_editor_id( $field_name, $field ) { |
|
| 1474 | - if ( isset( $field['repeatable_field_id'] ) && 'wysiwyg' == $field['type'] ) { |
|
| 1475 | - $field_name = '_give_repeater_' . uniqid() . '_wysiwyg'; |
|
| 1473 | +function give_repeater_field_set_editor_id($field_name, $field) { |
|
| 1474 | + if (isset($field['repeatable_field_id']) && 'wysiwyg' == $field['type']) { |
|
| 1475 | + $field_name = '_give_repeater_'.uniqid().'_wysiwyg'; |
|
| 1476 | 1476 | } |
| 1477 | 1477 | |
| 1478 | 1478 | return $field_name; |
| 1479 | 1479 | } |
| 1480 | 1480 | |
| 1481 | -add_filter( 'give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2 ); |
|
| 1481 | +add_filter('give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2); |
|
@@ -46,24 +46,24 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | function __construct() { |
| 48 | 48 | $this->metabox_id = 'give-metabox-form-data'; |
| 49 | - $this->metabox_label = __( 'Donation Form Options', 'give' ); |
|
| 49 | + $this->metabox_label = __('Donation Form Options', 'give'); |
|
| 50 | 50 | |
| 51 | 51 | // Setup. |
| 52 | - add_action( 'admin_init', array( $this, 'setup' ) ); |
|
| 52 | + add_action('admin_init', array($this, 'setup')); |
|
| 53 | 53 | |
| 54 | 54 | // Add metabox. |
| 55 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 10 ); |
|
| 55 | + add_action('add_meta_boxes', array($this, 'add_meta_box'), 10); |
|
| 56 | 56 | |
| 57 | 57 | // Save form meta. |
| 58 | - add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 ); |
|
| 58 | + add_action('save_post_give_forms', array($this, 'save'), 10, 2); |
|
| 59 | 59 | |
| 60 | 60 | // cmb2 old setting loaders. |
| 61 | 61 | // add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) ); |
| 62 | 62 | // Add offline donations options. |
| 63 | - add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 ); |
|
| 63 | + add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1); |
|
| 64 | 64 | |
| 65 | 65 | // Maintain active tab query parameter after save. |
| 66 | - add_filter( 'redirect_post_location', array( $this, 'maintain_active_tab' ), 10, 2 ); |
|
| 66 | + add_filter('redirect_post_location', array($this, 'maintain_active_tab'), 10, 2); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | function get_settings() { |
| 89 | 89 | $post_id = give_get_admin_post_id(); |
| 90 | - $price_placeholder = give_format_decimal( '1.00', false, false ); |
|
| 90 | + $price_placeholder = give_format_decimal('1.00', false, false); |
|
| 91 | 91 | |
| 92 | 92 | // Start with an underscore to hide fields from custom fields list |
| 93 | 93 | $prefix = '_give_'; |
@@ -96,27 +96,27 @@ discard block |
||
| 96 | 96 | /** |
| 97 | 97 | * Repeatable Field Groups |
| 98 | 98 | */ |
| 99 | - 'form_field_options' => apply_filters( 'give_forms_field_options', array( |
|
| 99 | + 'form_field_options' => apply_filters('give_forms_field_options', array( |
|
| 100 | 100 | 'id' => 'form_field_options', |
| 101 | - 'title' => __( 'Donation Options', 'give' ), |
|
| 101 | + 'title' => __('Donation Options', 'give'), |
|
| 102 | 102 | 'icon-html' => '<span class="give-icon give-icon-heart"></span>', |
| 103 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
| 103 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
| 104 | 104 | // Donation Option. |
| 105 | 105 | array( |
| 106 | - 'name' => __( 'Donation Option', 'give' ), |
|
| 107 | - 'description' => __( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
| 108 | - 'id' => $prefix . 'price_option', |
|
| 106 | + 'name' => __('Donation Option', 'give'), |
|
| 107 | + 'description' => __('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
| 108 | + 'id' => $prefix.'price_option', |
|
| 109 | 109 | 'type' => 'radio_inline', |
| 110 | 110 | 'default' => 'multi', |
| 111 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
| 112 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
| 113 | - 'set' => __( 'Set Donation', 'give' ), |
|
| 114 | - ) ), |
|
| 111 | + 'options' => apply_filters('give_forms_price_options', array( |
|
| 112 | + 'multi' => __('Multi-level Donation', 'give'), |
|
| 113 | + 'set' => __('Set Donation', 'give'), |
|
| 114 | + )), |
|
| 115 | 115 | ), |
| 116 | 116 | array( |
| 117 | - 'name' => __( 'Set Donation', 'give' ), |
|
| 118 | - 'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
| 119 | - 'id' => $prefix . 'set_price', |
|
| 117 | + 'name' => __('Set Donation', 'give'), |
|
| 118 | + 'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
| 119 | + 'id' => $prefix.'set_price', |
|
| 120 | 120 | 'type' => 'text_small', |
| 121 | 121 | 'data_type' => 'price', |
| 122 | 122 | 'attributes' => array( |
@@ -126,34 +126,34 @@ discard block |
||
| 126 | 126 | ), |
| 127 | 127 | // Display Style. |
| 128 | 128 | array( |
| 129 | - 'name' => __( 'Display Style', 'give' ), |
|
| 130 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
| 131 | - 'id' => $prefix . 'display_style', |
|
| 129 | + 'name' => __('Display Style', 'give'), |
|
| 130 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
| 131 | + 'id' => $prefix.'display_style', |
|
| 132 | 132 | 'type' => 'radio_inline', |
| 133 | 133 | 'default' => 'buttons', |
| 134 | 134 | 'options' => array( |
| 135 | - 'buttons' => __( 'Buttons', 'give' ), |
|
| 136 | - 'radios' => __( 'Radios', 'give' ), |
|
| 137 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
| 135 | + 'buttons' => __('Buttons', 'give'), |
|
| 136 | + 'radios' => __('Radios', 'give'), |
|
| 137 | + 'dropdown' => __('Dropdown', 'give'), |
|
| 138 | 138 | ), |
| 139 | 139 | 'wrapper_class' => 'give-hidden', |
| 140 | 140 | ), |
| 141 | 141 | // Custom Amount. |
| 142 | 142 | array( |
| 143 | - 'name' => __( 'Custom Amount', 'give' ), |
|
| 144 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
| 145 | - 'id' => $prefix . 'custom_amount', |
|
| 143 | + 'name' => __('Custom Amount', 'give'), |
|
| 144 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
| 145 | + 'id' => $prefix.'custom_amount', |
|
| 146 | 146 | 'type' => 'radio_inline', |
| 147 | 147 | 'default' => 'disabled', |
| 148 | 148 | 'options' => array( |
| 149 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 150 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 149 | + 'enabled' => __('Enabled', 'give'), |
|
| 150 | + 'disabled' => __('Disabled', 'give'), |
|
| 151 | 151 | ), |
| 152 | 152 | ), |
| 153 | 153 | array( |
| 154 | - 'name' => __( 'Minimum Amount', 'give' ), |
|
| 155 | - 'description' => __( 'Enter the minimum custom donation amount.', 'give' ), |
|
| 156 | - 'id' => $prefix . 'custom_amount_minimum', |
|
| 154 | + 'name' => __('Minimum Amount', 'give'), |
|
| 155 | + 'description' => __('Enter the minimum custom donation amount.', 'give'), |
|
| 156 | + 'id' => $prefix.'custom_amount_minimum', |
|
| 157 | 157 | 'type' => 'text_small', |
| 158 | 158 | 'data_type' => 'price', |
| 159 | 159 | 'attributes' => array( |
@@ -163,37 +163,37 @@ discard block |
||
| 163 | 163 | 'wrapper_class' => 'give-hidden', |
| 164 | 164 | ), |
| 165 | 165 | array( |
| 166 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
| 167 | - 'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
| 168 | - 'id' => $prefix . 'custom_amount_text', |
|
| 166 | + 'name' => __('Custom Amount Text', 'give'), |
|
| 167 | + 'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
| 168 | + 'id' => $prefix.'custom_amount_text', |
|
| 169 | 169 | 'type' => 'text_medium', |
| 170 | 170 | 'attributes' => array( |
| 171 | 171 | 'rows' => 3, |
| 172 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
| 172 | + 'placeholder' => __('Give a Custom Amount', 'give'), |
|
| 173 | 173 | ), |
| 174 | 174 | 'wrapper_class' => 'give-hidden', |
| 175 | 175 | ), |
| 176 | 176 | // Donation Levels. |
| 177 | 177 | array( |
| 178 | - 'id' => $prefix . 'donation_levels', |
|
| 178 | + 'id' => $prefix.'donation_levels', |
|
| 179 | 179 | 'type' => 'group', |
| 180 | 180 | 'options' => array( |
| 181 | - 'add_button' => __( 'Add Level', 'give' ), |
|
| 182 | - 'header_title' => __( 'Donation Level', 'give' ), |
|
| 181 | + 'add_button' => __('Add Level', 'give'), |
|
| 182 | + 'header_title' => __('Donation Level', 'give'), |
|
| 183 | 183 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
| 184 | 184 | ), |
| 185 | 185 | 'wrapper_class' => 'give-hidden', |
| 186 | 186 | // Fields array works the same, except id's only need to be unique for this group. |
| 187 | 187 | // Prefix is not needed. |
| 188 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
| 188 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
| 189 | 189 | array( |
| 190 | - 'name' => __( 'ID', 'give' ), |
|
| 191 | - 'id' => $prefix . 'id', |
|
| 190 | + 'name' => __('ID', 'give'), |
|
| 191 | + 'id' => $prefix.'id', |
|
| 192 | 192 | 'type' => 'levels_id', |
| 193 | 193 | ), |
| 194 | 194 | array( |
| 195 | - 'name' => __( 'Amount', 'give' ), |
|
| 196 | - 'id' => $prefix . 'amount', |
|
| 195 | + 'name' => __('Amount', 'give'), |
|
| 196 | + 'id' => $prefix.'amount', |
|
| 197 | 197 | 'type' => 'text_small', |
| 198 | 198 | 'data_type' => 'price', |
| 199 | 199 | 'attributes' => array( |
@@ -202,112 +202,112 @@ discard block |
||
| 202 | 202 | ), |
| 203 | 203 | ), |
| 204 | 204 | array( |
| 205 | - 'name' => __( 'Text', 'give' ), |
|
| 206 | - 'id' => $prefix . 'text', |
|
| 205 | + 'name' => __('Text', 'give'), |
|
| 206 | + 'id' => $prefix.'text', |
|
| 207 | 207 | 'type' => 'text', |
| 208 | 208 | 'attributes' => array( |
| 209 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
| 209 | + 'placeholder' => __('Donation Level', 'give'), |
|
| 210 | 210 | 'class' => 'give-multilevel-text-field', |
| 211 | 211 | ), |
| 212 | 212 | ), |
| 213 | 213 | array( |
| 214 | - 'name' => __( 'Default', 'give' ), |
|
| 215 | - 'id' => $prefix . 'default', |
|
| 214 | + 'name' => __('Default', 'give'), |
|
| 215 | + 'id' => $prefix.'default', |
|
| 216 | 216 | 'type' => 'give_default_radio_inline', |
| 217 | 217 | ), |
| 218 | - ) ), |
|
| 218 | + )), |
|
| 219 | 219 | ), |
| 220 | 220 | array( |
| 221 | 221 | 'name' => 'donation_options_docs', |
| 222 | 222 | 'type' => 'docs_link', |
| 223 | 223 | 'url' => 'http://docs.givewp.com/form-donation-options', |
| 224 | - 'title' => __( 'Donation Options', 'give' ), |
|
| 224 | + 'title' => __('Donation Options', 'give'), |
|
| 225 | 225 | ), |
| 226 | 226 | ), |
| 227 | 227 | $post_id |
| 228 | 228 | ), |
| 229 | - ) ), |
|
| 229 | + )), |
|
| 230 | 230 | |
| 231 | 231 | /** |
| 232 | 232 | * Display Options |
| 233 | 233 | */ |
| 234 | - 'form_display_options' => apply_filters( 'give_form_display_options', array( |
|
| 234 | + 'form_display_options' => apply_filters('give_form_display_options', array( |
|
| 235 | 235 | 'id' => 'form_display_options', |
| 236 | - 'title' => __( 'Form Display', 'give' ), |
|
| 236 | + 'title' => __('Form Display', 'give'), |
|
| 237 | 237 | 'icon-html' => '<span class="give-icon give-icon-display"></span>', |
| 238 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
| 238 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
| 239 | 239 | array( |
| 240 | - 'name' => __( 'Display Options', 'give' ), |
|
| 241 | - 'desc' => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ), |
|
| 242 | - 'id' => $prefix . 'payment_display', |
|
| 240 | + 'name' => __('Display Options', 'give'), |
|
| 241 | + 'desc' => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'), |
|
| 242 | + 'id' => $prefix.'payment_display', |
|
| 243 | 243 | 'type' => 'radio_inline', |
| 244 | 244 | 'options' => array( |
| 245 | - 'onpage' => __( 'All Fields', 'give' ), |
|
| 246 | - 'modal' => __( 'Modal', 'give' ), |
|
| 247 | - 'reveal' => __( 'Reveal', 'give' ), |
|
| 248 | - 'button' => __( 'Button', 'give' ), |
|
| 245 | + 'onpage' => __('All Fields', 'give'), |
|
| 246 | + 'modal' => __('Modal', 'give'), |
|
| 247 | + 'reveal' => __('Reveal', 'give'), |
|
| 248 | + 'button' => __('Button', 'give'), |
|
| 249 | 249 | ), |
| 250 | 250 | 'default' => 'onpage', |
| 251 | 251 | ), |
| 252 | 252 | array( |
| 253 | - 'id' => $prefix . 'reveal_label', |
|
| 254 | - 'name' => __( 'Continue Button', 'give' ), |
|
| 255 | - 'desc' => __( 'The button label for displaying the additional payment fields.', 'give' ), |
|
| 253 | + 'id' => $prefix.'reveal_label', |
|
| 254 | + 'name' => __('Continue Button', 'give'), |
|
| 255 | + 'desc' => __('The button label for displaying the additional payment fields.', 'give'), |
|
| 256 | 256 | 'type' => 'text_small', |
| 257 | 257 | 'attributes' => array( |
| 258 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
| 258 | + 'placeholder' => __('Donate Now', 'give'), |
|
| 259 | 259 | ), |
| 260 | 260 | 'wrapper_class' => 'give-hidden', |
| 261 | 261 | ), |
| 262 | 262 | array( |
| 263 | - 'id' => $prefix . 'checkout_label', |
|
| 264 | - 'name' => __( 'Submit Button', 'give' ), |
|
| 265 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
| 263 | + 'id' => $prefix.'checkout_label', |
|
| 264 | + 'name' => __('Submit Button', 'give'), |
|
| 265 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
| 266 | 266 | 'type' => 'text_small', |
| 267 | 267 | 'attributes' => array( |
| 268 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
| 268 | + 'placeholder' => __('Donate Now', 'give'), |
|
| 269 | 269 | ), |
| 270 | 270 | ), |
| 271 | 271 | array( |
| 272 | - 'name' => __( 'Default Gateway', 'give' ), |
|
| 273 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
| 274 | - 'id' => $prefix . 'default_gateway', |
|
| 272 | + 'name' => __('Default Gateway', 'give'), |
|
| 273 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
| 274 | + 'id' => $prefix.'default_gateway', |
|
| 275 | 275 | 'type' => 'default_gateway', |
| 276 | 276 | ), |
| 277 | 277 | array( |
| 278 | - 'name' => __( 'Guest Donations', 'give' ), |
|
| 279 | - 'desc' => __( 'Do you want to allow non-logged-in users to make donations?', 'give' ), |
|
| 280 | - 'id' => $prefix . 'logged_in_only', |
|
| 278 | + 'name' => __('Guest Donations', 'give'), |
|
| 279 | + 'desc' => __('Do you want to allow non-logged-in users to make donations?', 'give'), |
|
| 280 | + 'id' => $prefix.'logged_in_only', |
|
| 281 | 281 | 'type' => 'radio_inline', |
| 282 | 282 | 'default' => 'enabled', |
| 283 | 283 | 'options' => array( |
| 284 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 285 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 284 | + 'enabled' => __('Enabled', 'give'), |
|
| 285 | + 'disabled' => __('Disabled', 'give'), |
|
| 286 | 286 | ), |
| 287 | 287 | ), |
| 288 | 288 | array( |
| 289 | - 'name' => __( 'Registration', 'give' ), |
|
| 290 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
| 291 | - 'id' => $prefix . 'show_register_form', |
|
| 289 | + 'name' => __('Registration', 'give'), |
|
| 290 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
| 291 | + 'id' => $prefix.'show_register_form', |
|
| 292 | 292 | 'type' => 'radio', |
| 293 | 293 | 'options' => array( |
| 294 | - 'none' => __( 'None', 'give' ), |
|
| 295 | - 'registration' => __( 'Registration', 'give' ), |
|
| 296 | - 'login' => __( 'Login', 'give' ), |
|
| 297 | - 'both' => __( 'Registration + Login', 'give' ), |
|
| 294 | + 'none' => __('None', 'give'), |
|
| 295 | + 'registration' => __('Registration', 'give'), |
|
| 296 | + 'login' => __('Login', 'give'), |
|
| 297 | + 'both' => __('Registration + Login', 'give'), |
|
| 298 | 298 | ), |
| 299 | 299 | 'default' => 'none', |
| 300 | 300 | ), |
| 301 | 301 | array( |
| 302 | - 'name' => __( 'Floating Labels', 'give' ), |
|
| 302 | + 'name' => __('Floating Labels', 'give'), |
|
| 303 | 303 | /* translators: %s: forms http://docs.givewp.com/form-floating-labels */ |
| 304 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
| 305 | - 'id' => $prefix . 'form_floating_labels', |
|
| 304 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
| 305 | + 'id' => $prefix.'form_floating_labels', |
|
| 306 | 306 | 'type' => 'radio_inline', |
| 307 | 307 | 'options' => array( |
| 308 | - 'global' => __( 'Global Option', 'give' ), |
|
| 309 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 310 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 308 | + 'global' => __('Global Option', 'give'), |
|
| 309 | + 'enabled' => __('Enabled', 'give'), |
|
| 310 | + 'disabled' => __('Disabled', 'give'), |
|
| 311 | 311 | ), |
| 312 | 312 | 'default' => 'global', |
| 313 | 313 | ), |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | 'name' => 'form_display_docs', |
| 316 | 316 | 'type' => 'docs_link', |
| 317 | 317 | 'url' => 'http://docs.givewp.com/form-display-options', |
| 318 | - 'title' => __( 'Form Display', 'give' ), |
|
| 318 | + 'title' => __('Form Display', 'give'), |
|
| 319 | 319 | ), |
| 320 | 320 | ), |
| 321 | 321 | $post_id |
@@ -326,27 +326,27 @@ discard block |
||
| 326 | 326 | /** |
| 327 | 327 | * Donation Goals |
| 328 | 328 | */ |
| 329 | - 'donation_goal_options' => apply_filters( 'give_donation_goal_options', array( |
|
| 329 | + 'donation_goal_options' => apply_filters('give_donation_goal_options', array( |
|
| 330 | 330 | 'id' => 'donation_goal_options', |
| 331 | - 'title' => __( 'Donation Goal', 'give' ), |
|
| 331 | + 'title' => __('Donation Goal', 'give'), |
|
| 332 | 332 | 'icon-html' => '<span class="give-icon give-icon-target"></span>', |
| 333 | - 'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array( |
|
| 333 | + 'fields' => apply_filters('give_forms_donation_goal_metabox_fields', array( |
|
| 334 | 334 | // Goals |
| 335 | 335 | array( |
| 336 | - 'name' => __( 'Donation Goal', 'give' ), |
|
| 337 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
| 338 | - 'id' => $prefix . 'goal_option', |
|
| 336 | + 'name' => __('Donation Goal', 'give'), |
|
| 337 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
| 338 | + 'id' => $prefix.'goal_option', |
|
| 339 | 339 | 'type' => 'radio_inline', |
| 340 | 340 | 'default' => 'disabled', |
| 341 | 341 | 'options' => array( |
| 342 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 343 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 342 | + 'enabled' => __('Enabled', 'give'), |
|
| 343 | + 'disabled' => __('Disabled', 'give'), |
|
| 344 | 344 | ), |
| 345 | 345 | ), |
| 346 | 346 | array( |
| 347 | - 'name' => __( 'Goal Amount', 'give' ), |
|
| 348 | - 'description' => __( 'This is the monetary goal amount you want to reach for this form.', 'give' ), |
|
| 349 | - 'id' => $prefix . 'set_goal', |
|
| 347 | + 'name' => __('Goal Amount', 'give'), |
|
| 348 | + 'description' => __('This is the monetary goal amount you want to reach for this form.', 'give'), |
|
| 349 | + 'id' => $prefix.'set_goal', |
|
| 350 | 350 | 'type' => 'text_small', |
| 351 | 351 | 'data_type' => 'price', |
| 352 | 352 | 'attributes' => array( |
@@ -357,97 +357,97 @@ discard block |
||
| 357 | 357 | ), |
| 358 | 358 | |
| 359 | 359 | array( |
| 360 | - 'name' => __( 'Goal Format', 'give' ), |
|
| 361 | - 'description' => __( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
| 362 | - 'id' => $prefix . 'goal_format', |
|
| 360 | + 'name' => __('Goal Format', 'give'), |
|
| 361 | + 'description' => __('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'), |
|
| 362 | + 'id' => $prefix.'goal_format', |
|
| 363 | 363 | 'type' => 'radio_inline', |
| 364 | 364 | 'default' => 'amount', |
| 365 | 365 | 'options' => array( |
| 366 | - 'amount' => __( 'Amount', 'give' ), |
|
| 367 | - 'percentage' => __( 'Percentage', 'give' ), |
|
| 366 | + 'amount' => __('Amount', 'give'), |
|
| 367 | + 'percentage' => __('Percentage', 'give'), |
|
| 368 | 368 | ), |
| 369 | 369 | 'wrapper_class' => 'give-hidden', |
| 370 | 370 | ), |
| 371 | 371 | array( |
| 372 | - 'name' => __( 'Progress Bar Color', 'give' ), |
|
| 373 | - 'desc' => __( 'Customize the color of the goal progress bar.', 'give' ), |
|
| 374 | - 'id' => $prefix . 'goal_color', |
|
| 372 | + 'name' => __('Progress Bar Color', 'give'), |
|
| 373 | + 'desc' => __('Customize the color of the goal progress bar.', 'give'), |
|
| 374 | + 'id' => $prefix.'goal_color', |
|
| 375 | 375 | 'type' => 'colorpicker', |
| 376 | 376 | 'default' => '#2bc253', |
| 377 | 377 | 'wrapper_class' => 'give-hidden', |
| 378 | 378 | ), |
| 379 | 379 | |
| 380 | 380 | array( |
| 381 | - 'name' => __( 'Close Form', 'give' ), |
|
| 382 | - 'desc' => __( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
| 383 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
| 381 | + 'name' => __('Close Form', 'give'), |
|
| 382 | + 'desc' => __('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
| 383 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
| 384 | 384 | 'type' => 'radio_inline', |
| 385 | 385 | 'default' => 'disabled', |
| 386 | 386 | 'options' => array( |
| 387 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 388 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 387 | + 'enabled' => __('Enabled', 'give'), |
|
| 388 | + 'disabled' => __('Disabled', 'give'), |
|
| 389 | 389 | ), |
| 390 | 390 | 'wrapper_class' => 'give-hidden', |
| 391 | 391 | ), |
| 392 | 392 | array( |
| 393 | - 'name' => __( 'Goal Achieved Message', 'give' ), |
|
| 394 | - 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
|
| 395 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
| 393 | + 'name' => __('Goal Achieved Message', 'give'), |
|
| 394 | + 'desc' => __('Do you want to display a custom message when the goal is closed?', 'give'), |
|
| 395 | + 'id' => $prefix.'form_goal_achieved_message', |
|
| 396 | 396 | 'type' => 'wysiwyg', |
| 397 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
| 397 | + 'default' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
| 398 | 398 | 'wrapper_class' => 'give-hidden', |
| 399 | 399 | ), |
| 400 | 400 | array( |
| 401 | 401 | 'name' => 'donation_goal_docs', |
| 402 | 402 | 'type' => 'docs_link', |
| 403 | 403 | 'url' => 'http://docs.givewp.com/form-donation-goal', |
| 404 | - 'title' => __( 'Donation Goal', 'give' ), |
|
| 404 | + 'title' => __('Donation Goal', 'give'), |
|
| 405 | 405 | ), |
| 406 | 406 | ), |
| 407 | 407 | $post_id |
| 408 | 408 | ), |
| 409 | - ) ), |
|
| 409 | + )), |
|
| 410 | 410 | |
| 411 | 411 | /** |
| 412 | 412 | * Content Field |
| 413 | 413 | */ |
| 414 | - 'form_content_options' => apply_filters( 'give_forms_content_options', array( |
|
| 414 | + 'form_content_options' => apply_filters('give_forms_content_options', array( |
|
| 415 | 415 | 'id' => 'form_content_options', |
| 416 | - 'title' => __( 'Form Content', 'give' ), |
|
| 416 | + 'title' => __('Form Content', 'give'), |
|
| 417 | 417 | 'icon-html' => '<span class="give-icon give-icon-edit"></span>', |
| 418 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
| 418 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
| 419 | 419 | |
| 420 | 420 | // Donation content. |
| 421 | 421 | array( |
| 422 | - 'name' => __( 'Display Content', 'give' ), |
|
| 423 | - 'description' => __( 'Do you want to add custom content to this form?', 'give' ), |
|
| 424 | - 'id' => $prefix . 'display_content', |
|
| 422 | + 'name' => __('Display Content', 'give'), |
|
| 423 | + 'description' => __('Do you want to add custom content to this form?', 'give'), |
|
| 424 | + 'id' => $prefix.'display_content', |
|
| 425 | 425 | 'type' => 'radio_inline', |
| 426 | 426 | 'options' => array( |
| 427 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 428 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 427 | + 'enabled' => __('Enabled', 'give'), |
|
| 428 | + 'disabled' => __('Disabled', 'give'), |
|
| 429 | 429 | ), |
| 430 | 430 | 'default' => 'disabled', |
| 431 | 431 | ), |
| 432 | 432 | |
| 433 | 433 | // Content placement. |
| 434 | 434 | array( |
| 435 | - 'name' => __( 'Content Placement', 'give' ), |
|
| 436 | - 'description' => __( 'This option controls where the content appears within the donation form.', 'give' ), |
|
| 437 | - 'id' => $prefix . 'content_placement', |
|
| 435 | + 'name' => __('Content Placement', 'give'), |
|
| 436 | + 'description' => __('This option controls where the content appears within the donation form.', 'give'), |
|
| 437 | + 'id' => $prefix.'content_placement', |
|
| 438 | 438 | 'type' => 'radio_inline', |
| 439 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 440 | - 'give_pre_form' => __( 'Above fields', 'give' ), |
|
| 441 | - 'give_post_form' => __( 'Below fields', 'give' ), |
|
| 439 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
| 440 | + 'give_pre_form' => __('Above fields', 'give'), |
|
| 441 | + 'give_post_form' => __('Below fields', 'give'), |
|
| 442 | 442 | ) |
| 443 | 443 | ), |
| 444 | 444 | 'default' => 'give_pre_form', |
| 445 | 445 | 'wrapper_class' => 'give-hidden', |
| 446 | 446 | ), |
| 447 | 447 | array( |
| 448 | - 'name' => __( 'Content', 'give' ), |
|
| 449 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
| 450 | - 'id' => $prefix . 'form_content', |
|
| 448 | + 'name' => __('Content', 'give'), |
|
| 449 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
| 450 | + 'id' => $prefix.'form_content', |
|
| 451 | 451 | 'type' => 'wysiwyg', |
| 452 | 452 | 'wrapper_class' => 'give-hidden', |
| 453 | 453 | ), |
@@ -455,51 +455,51 @@ discard block |
||
| 455 | 455 | 'name' => 'form_content_docs', |
| 456 | 456 | 'type' => 'docs_link', |
| 457 | 457 | 'url' => 'http://docs.givewp.com/form-content', |
| 458 | - 'title' => __( 'Form Content', 'give' ), |
|
| 458 | + 'title' => __('Form Content', 'give'), |
|
| 459 | 459 | ), |
| 460 | 460 | ), |
| 461 | 461 | $post_id |
| 462 | 462 | ), |
| 463 | - ) ), |
|
| 463 | + )), |
|
| 464 | 464 | |
| 465 | 465 | /** |
| 466 | 466 | * Terms & Conditions |
| 467 | 467 | */ |
| 468 | - 'form_terms_options' => apply_filters( 'give_forms_terms_options', array( |
|
| 468 | + 'form_terms_options' => apply_filters('give_forms_terms_options', array( |
|
| 469 | 469 | 'id' => 'form_terms_options', |
| 470 | - 'title' => __( 'Terms & Conditions', 'give' ), |
|
| 470 | + 'title' => __('Terms & Conditions', 'give'), |
|
| 471 | 471 | 'icon-html' => '<span class="give-icon give-icon-checklist"></span>', |
| 472 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
| 472 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
| 473 | 473 | // Donation Option |
| 474 | 474 | array( |
| 475 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
| 476 | - 'description' => __( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ), |
|
| 477 | - 'id' => $prefix . 'terms_option', |
|
| 475 | + 'name' => __('Terms and Conditions', 'give'), |
|
| 476 | + 'description' => __('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'), |
|
| 477 | + 'id' => $prefix.'terms_option', |
|
| 478 | 478 | 'type' => 'radio_inline', |
| 479 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 480 | - 'global' => __( 'Global Option', 'give' ), |
|
| 481 | - 'enabled' => __( 'Customize', 'give' ), |
|
| 482 | - 'disabled' => __( 'Disable', 'give' ), |
|
| 479 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
| 480 | + 'global' => __('Global Option', 'give'), |
|
| 481 | + 'enabled' => __('Customize', 'give'), |
|
| 482 | + 'disabled' => __('Disable', 'give'), |
|
| 483 | 483 | ) |
| 484 | 484 | ), |
| 485 | 485 | 'default' => 'global', |
| 486 | 486 | ), |
| 487 | 487 | array( |
| 488 | - 'id' => $prefix . 'agree_label', |
|
| 489 | - 'name' => __( 'Agreement Label', 'give' ), |
|
| 490 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
| 488 | + 'id' => $prefix.'agree_label', |
|
| 489 | + 'name' => __('Agreement Label', 'give'), |
|
| 490 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
| 491 | 491 | 'type' => 'text', |
| 492 | 492 | 'size' => 'regular', |
| 493 | 493 | 'attributes' => array( |
| 494 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
| 494 | + 'placeholder' => __('Agree to Terms?', 'give'), |
|
| 495 | 495 | ), |
| 496 | 496 | 'wrapper_class' => 'give-hidden', |
| 497 | 497 | ), |
| 498 | 498 | array( |
| 499 | - 'id' => $prefix . 'agree_text', |
|
| 500 | - 'name' => __( 'Agreement Text', 'give' ), |
|
| 501 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
| 502 | - 'default' => give_get_option( 'agreement_text' ), |
|
| 499 | + 'id' => $prefix.'agree_text', |
|
| 500 | + 'name' => __('Agreement Text', 'give'), |
|
| 501 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
| 502 | + 'default' => give_get_option('agreement_text'), |
|
| 503 | 503 | 'type' => 'wysiwyg', |
| 504 | 504 | 'wrapper_class' => 'give-hidden', |
| 505 | 505 | ), |
@@ -507,18 +507,18 @@ discard block |
||
| 507 | 507 | 'name' => 'terms_docs', |
| 508 | 508 | 'type' => 'docs_link', |
| 509 | 509 | 'url' => 'http://docs.givewp.com/form-terms', |
| 510 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
| 510 | + 'title' => __('Terms and Conditions', 'give'), |
|
| 511 | 511 | ), |
| 512 | 512 | ), |
| 513 | 513 | $post_id |
| 514 | 514 | ), |
| 515 | - ) ), |
|
| 515 | + )), |
|
| 516 | 516 | ); |
| 517 | 517 | |
| 518 | 518 | /** |
| 519 | 519 | * Filter the metabox tabbed panel settings. |
| 520 | 520 | */ |
| 521 | - $settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id ); |
|
| 521 | + $settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id); |
|
| 522 | 522 | |
| 523 | 523 | // Output. |
| 524 | 524 | return $settings; |
@@ -535,8 +535,8 @@ discard block |
||
| 535 | 535 | add_meta_box( |
| 536 | 536 | $this->get_metabox_ID(), |
| 537 | 537 | $this->get_metabox_label(), |
| 538 | - array( $this, 'output' ), |
|
| 539 | - array( 'give_forms' ), |
|
| 538 | + array($this, 'output'), |
|
| 539 | + array('give_forms'), |
|
| 540 | 540 | 'normal', |
| 541 | 541 | 'high' |
| 542 | 542 | ); |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | function enqueue_script() { |
| 554 | 554 | global $post; |
| 555 | 555 | |
| 556 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
| 556 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
| 557 | 557 | |
| 558 | 558 | } |
| 559 | 559 | } |
@@ -591,32 +591,32 @@ discard block |
||
| 591 | 591 | public function get_tabs() { |
| 592 | 592 | $tabs = array(); |
| 593 | 593 | |
| 594 | - if ( ! empty( $this->settings ) ) { |
|
| 595 | - foreach ( $this->settings as $setting ) { |
|
| 596 | - if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) { |
|
| 594 | + if ( ! empty($this->settings)) { |
|
| 595 | + foreach ($this->settings as $setting) { |
|
| 596 | + if ( ! isset($setting['id']) || ! isset($setting['title'])) { |
|
| 597 | 597 | continue; |
| 598 | 598 | } |
| 599 | 599 | $tab = array( |
| 600 | 600 | 'id' => $setting['id'], |
| 601 | 601 | 'label' => $setting['title'], |
| 602 | - 'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ), |
|
| 602 | + 'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''), |
|
| 603 | 603 | ); |
| 604 | 604 | |
| 605 | - if ( $this->has_sub_tab( $setting ) ) { |
|
| 606 | - if ( empty( $setting['sub-fields'] ) ) { |
|
| 605 | + if ($this->has_sub_tab($setting)) { |
|
| 606 | + if (empty($setting['sub-fields'])) { |
|
| 607 | 607 | $tab = array(); |
| 608 | 608 | } else { |
| 609 | - foreach ( $setting['sub-fields'] as $sub_fields ) { |
|
| 609 | + foreach ($setting['sub-fields'] as $sub_fields) { |
|
| 610 | 610 | $tab['sub-fields'][] = array( |
| 611 | 611 | 'id' => $sub_fields['id'], |
| 612 | 612 | 'label' => $sub_fields['title'], |
| 613 | - 'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ), |
|
| 613 | + 'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''), |
|
| 614 | 614 | ); |
| 615 | 615 | } |
| 616 | 616 | } |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | - if ( ! empty( $tab ) ) { |
|
| 619 | + if ( ! empty($tab)) { |
|
| 620 | 620 | $tabs[] = $tab; |
| 621 | 621 | } |
| 622 | 622 | } |
@@ -634,33 +634,33 @@ discard block |
||
| 634 | 634 | */ |
| 635 | 635 | public function output() { |
| 636 | 636 | // Bailout. |
| 637 | - if ( $form_data_tabs = $this->get_tabs() ) : |
|
| 638 | - $active_tab = ! empty( $_GET['give_tab'] ) ? give_clean( $_GET['give_tab'] ) : 'form_field_options'; |
|
| 639 | - wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' ); |
|
| 637 | + if ($form_data_tabs = $this->get_tabs()) : |
|
| 638 | + $active_tab = ! empty($_GET['give_tab']) ? give_clean($_GET['give_tab']) : 'form_field_options'; |
|
| 639 | + wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce'); |
|
| 640 | 640 | ?> |
| 641 | 641 | <input id="give_form_active_tab" type="hidden" name="give_form_active_tab"> |
| 642 | 642 | <div class="give-metabox-panel-wrap"> |
| 643 | 643 | <ul class="give-form-data-tabs give-metabox-tabs"> |
| 644 | - <?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?> |
|
| 644 | + <?php foreach ($form_data_tabs as $index => $form_data_tab) : ?> |
|
| 645 | 645 | <?php |
| 646 | 646 | // Determine if current tab is active. |
| 647 | 647 | $is_active = $active_tab === $form_data_tab['id'] ? true : false; |
| 648 | 648 | ?> |
| 649 | - <li class="<?php echo "{$form_data_tab['id']}_tab" . ( $is_active ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>"> |
|
| 649 | + <li class="<?php echo "{$form_data_tab['id']}_tab".($is_active ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>"> |
|
| 650 | 650 | <a href="#<?php echo $form_data_tab['id']; ?>" data-tab-id="<?php echo $form_data_tab['id']; ?>"> |
| 651 | - <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
|
| 651 | + <?php if ( ! empty($form_data_tab['icon-html'])) : ?> |
|
| 652 | 652 | <?php echo $form_data_tab['icon-html']; ?> |
| 653 | 653 | <?php else : ?> |
| 654 | 654 | <span class="give-icon give-icon-default"></span> |
| 655 | 655 | <?php endif; ?> |
| 656 | 656 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
| 657 | 657 | </a> |
| 658 | - <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
|
| 658 | + <?php if ($this->has_sub_tab($form_data_tab)) : ?> |
|
| 659 | 659 | <ul class="give-metabox-sub-tabs give-hidden"> |
| 660 | - <?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?> |
|
| 660 | + <?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?> |
|
| 661 | 661 | <li class="<?php echo "{$sub_tab['id']}_tab"; ?>"> |
| 662 | 662 | <a href="#<?php echo $sub_tab['id']; ?>" data-tab-id="<?php echo $sub_tab['id']; ?>"> |
| 663 | - <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
|
| 663 | + <?php if ( ! empty($sub_tab['icon-html'])) : ?> |
|
| 664 | 664 | <?php echo $sub_tab['icon-html']; ?> |
| 665 | 665 | <?php else : ?> |
| 666 | 666 | <span class="give-icon give-icon-default"></span> |
@@ -675,30 +675,30 @@ discard block |
||
| 675 | 675 | <?php endforeach; ?> |
| 676 | 676 | </ul> |
| 677 | 677 | |
| 678 | - <?php foreach ( $this->settings as $setting ) : ?> |
|
| 679 | - <?php if ( ! $this->has_sub_tab( $setting ) ) : ?> |
|
| 680 | - <?php do_action( "give_before_{$setting['id']}_settings" ); ?> |
|
| 678 | + <?php foreach ($this->settings as $setting) : ?> |
|
| 679 | + <?php if ( ! $this->has_sub_tab($setting)) : ?> |
|
| 680 | + <?php do_action("give_before_{$setting['id']}_settings"); ?> |
|
| 681 | 681 | <?php |
| 682 | 682 | // Determine if current panel is active. |
| 683 | 683 | $is_active = $active_tab === $setting['id'] ? true : false; |
| 684 | 684 | ?> |
| 685 | - <div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo( $is_active ? ' active' : '' ); ?>"> |
|
| 686 | - <?php if ( ! empty( $setting['fields'] ) ) : ?> |
|
| 687 | - <?php foreach ( $setting['fields'] as $field ) : ?> |
|
| 688 | - <?php give_render_field( $field ); ?> |
|
| 685 | + <div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo($is_active ? ' active' : ''); ?>"> |
|
| 686 | + <?php if ( ! empty($setting['fields'])) : ?> |
|
| 687 | + <?php foreach ($setting['fields'] as $field) : ?> |
|
| 688 | + <?php give_render_field($field); ?> |
|
| 689 | 689 | <?php endforeach; ?> |
| 690 | 690 | <?php endif; ?> |
| 691 | 691 | </div> |
| 692 | 692 | |
| 693 | - <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
|
| 693 | + <?php do_action("give_after_{$setting['id']}_settings"); ?> |
|
| 694 | 694 | <?php else : ?> |
| 695 | - <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
|
| 696 | - <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
|
| 697 | - <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
|
| 695 | + <?php if ($this->has_sub_tab($setting)) : ?> |
|
| 696 | + <?php if ( ! empty($setting['sub-fields'])) : ?> |
|
| 697 | + <?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?> |
|
| 698 | 698 | <div id="<?php echo $sub_fields['id']; ?>" class="panel give_options_panel give-hidden"> |
| 699 | - <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
|
| 700 | - <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
|
| 701 | - <?php give_render_field( $sub_field ); ?> |
|
| 699 | + <?php if ( ! empty($sub_fields['fields'])) : ?> |
|
| 700 | + <?php foreach ($sub_fields['fields'] as $sub_field) : ?> |
|
| 701 | + <?php give_render_field($sub_field); ?> |
|
| 702 | 702 | <?php endforeach; ?> |
| 703 | 703 | <?php endif; ?> |
| 704 | 704 | </div> |
@@ -722,9 +722,9 @@ discard block |
||
| 722 | 722 | * |
| 723 | 723 | * @return bool |
| 724 | 724 | */ |
| 725 | - private function has_sub_tab( $field_setting ) { |
|
| 725 | + private function has_sub_tab($field_setting) { |
|
| 726 | 726 | $has_sub_tab = false; |
| 727 | - if ( array_key_exists( 'sub-fields', $field_setting ) ) { |
|
| 727 | + if (array_key_exists('sub-fields', $field_setting)) { |
|
| 728 | 728 | $has_sub_tab = true; |
| 729 | 729 | } |
| 730 | 730 | |
@@ -739,13 +739,13 @@ discard block |
||
| 739 | 739 | * @return array |
| 740 | 740 | */ |
| 741 | 741 | function cmb2_metabox_settings() { |
| 742 | - $all_cmb2_settings = apply_filters( 'cmb2_meta_boxes', array() ); |
|
| 742 | + $all_cmb2_settings = apply_filters('cmb2_meta_boxes', array()); |
|
| 743 | 743 | $give_forms_settings = $all_cmb2_settings; |
| 744 | 744 | |
| 745 | 745 | // Filter settings: Use only give forms related settings. |
| 746 | - foreach ( $all_cmb2_settings as $index => $setting ) { |
|
| 747 | - if ( ! in_array( 'give_forms', $setting['object_types'] ) ) { |
|
| 748 | - unset( $give_forms_settings[ $index ] ); |
|
| 746 | + foreach ($all_cmb2_settings as $index => $setting) { |
|
| 747 | + if ( ! in_array('give_forms', $setting['object_types'])) { |
|
| 748 | + unset($give_forms_settings[$index]); |
|
| 749 | 749 | } |
| 750 | 750 | } |
| 751 | 751 | |
@@ -763,96 +763,96 @@ discard block |
||
| 763 | 763 | * |
| 764 | 764 | * @return void |
| 765 | 765 | */ |
| 766 | - public function save( $post_id, $post ) { |
|
| 766 | + public function save($post_id, $post) { |
|
| 767 | 767 | |
| 768 | 768 | // $post_id and $post are required. |
| 769 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
| 769 | + if (empty($post_id) || empty($post)) { |
|
| 770 | 770 | return; |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | // Don't save meta boxes for revisions or autosaves. |
| 774 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
| 774 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
| 775 | 775 | return; |
| 776 | 776 | } |
| 777 | 777 | |
| 778 | 778 | // Check the nonce. |
| 779 | - if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) { |
|
| 779 | + if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) { |
|
| 780 | 780 | return; |
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
| 784 | - if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) { |
|
| 784 | + if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { |
|
| 785 | 785 | return; |
| 786 | 786 | } |
| 787 | 787 | |
| 788 | 788 | // Check user has permission to edit. |
| 789 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
| 789 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
| 790 | 790 | return; |
| 791 | 791 | } |
| 792 | 792 | |
| 793 | 793 | // Fire action before saving form meta. |
| 794 | - do_action( 'give_pre_process_give_forms_meta', $post_id, $post ); |
|
| 794 | + do_action('give_pre_process_give_forms_meta', $post_id, $post); |
|
| 795 | 795 | |
| 796 | 796 | /** |
| 797 | 797 | * Filter the meta key to save. |
| 798 | 798 | * Third party addon developer can remove there meta keys from this array to handle saving data on there own. |
| 799 | 799 | */ |
| 800 | - $form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() ); |
|
| 800 | + $form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings()); |
|
| 801 | 801 | |
| 802 | 802 | // Save form meta data. |
| 803 | - if ( ! empty( $form_meta_keys ) ) { |
|
| 804 | - foreach ( $form_meta_keys as $form_meta_key ) { |
|
| 803 | + if ( ! empty($form_meta_keys)) { |
|
| 804 | + foreach ($form_meta_keys as $form_meta_key) { |
|
| 805 | 805 | |
| 806 | 806 | // Set default value for checkbox fields. |
| 807 | 807 | if ( |
| 808 | - ! isset( $_POST[ $form_meta_key ] ) |
|
| 809 | - && ( 'checkbox' === $this->get_field_type( $form_meta_key ) ) |
|
| 808 | + ! isset($_POST[$form_meta_key]) |
|
| 809 | + && ('checkbox' === $this->get_field_type($form_meta_key)) |
|
| 810 | 810 | ) { |
| 811 | - $_POST[ $form_meta_key ] = ''; |
|
| 811 | + $_POST[$form_meta_key] = ''; |
|
| 812 | 812 | } |
| 813 | 813 | |
| 814 | - if ( isset( $_POST[ $form_meta_key ] ) ) { |
|
| 815 | - $setting_field = $this->get_setting_field( $form_meta_key ); |
|
| 816 | - if ( ! empty( $setting_field['type'] ) ) { |
|
| 817 | - switch ( $setting_field['type'] ) { |
|
| 814 | + if (isset($_POST[$form_meta_key])) { |
|
| 815 | + $setting_field = $this->get_setting_field($form_meta_key); |
|
| 816 | + if ( ! empty($setting_field['type'])) { |
|
| 817 | + switch ($setting_field['type']) { |
|
| 818 | 818 | case 'textarea': |
| 819 | 819 | case 'wysiwyg': |
| 820 | - $form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] ); |
|
| 820 | + $form_meta_value = wp_kses_post($_POST[$form_meta_key]); |
|
| 821 | 821 | break; |
| 822 | 822 | |
| 823 | 823 | case 'group': |
| 824 | 824 | $form_meta_value = array(); |
| 825 | 825 | |
| 826 | - foreach ( $_POST[ $form_meta_key ] as $index => $group ) { |
|
| 826 | + foreach ($_POST[$form_meta_key] as $index => $group) { |
|
| 827 | 827 | |
| 828 | 828 | // Do not save template input field values. |
| 829 | - if ( '{{row-count-placeholder}}' === $index ) { |
|
| 829 | + if ('{{row-count-placeholder}}' === $index) { |
|
| 830 | 830 | continue; |
| 831 | 831 | } |
| 832 | 832 | |
| 833 | 833 | $group_meta_value = array(); |
| 834 | - foreach ( $group as $field_id => $field_value ) { |
|
| 835 | - switch ( $this->get_field_type( $field_id, $form_meta_key ) ) { |
|
| 834 | + foreach ($group as $field_id => $field_value) { |
|
| 835 | + switch ($this->get_field_type($field_id, $form_meta_key)) { |
|
| 836 | 836 | case 'wysiwyg': |
| 837 | - $group_meta_value[ $field_id ] = wp_kses_post( $field_value ); |
|
| 837 | + $group_meta_value[$field_id] = wp_kses_post($field_value); |
|
| 838 | 838 | break; |
| 839 | 839 | |
| 840 | 840 | default: |
| 841 | - $group_meta_value[ $field_id ] = give_clean( $field_value ); |
|
| 841 | + $group_meta_value[$field_id] = give_clean($field_value); |
|
| 842 | 842 | } |
| 843 | 843 | } |
| 844 | 844 | |
| 845 | - if ( ! empty( $group_meta_value ) ) { |
|
| 846 | - $form_meta_value[ $index ] = $group_meta_value; |
|
| 845 | + if ( ! empty($group_meta_value)) { |
|
| 846 | + $form_meta_value[$index] = $group_meta_value; |
|
| 847 | 847 | } |
| 848 | 848 | } |
| 849 | 849 | |
| 850 | 850 | // Arrange repeater field keys in order. |
| 851 | - $form_meta_value = array_values( $form_meta_value ); |
|
| 851 | + $form_meta_value = array_values($form_meta_value); |
|
| 852 | 852 | break; |
| 853 | 853 | |
| 854 | 854 | default: |
| 855 | - $form_meta_value = give_clean( $_POST[ $form_meta_key ] ); |
|
| 855 | + $form_meta_value = give_clean($_POST[$form_meta_key]); |
|
| 856 | 856 | }// End switch(). |
| 857 | 857 | |
| 858 | 858 | /** |
@@ -862,24 +862,24 @@ discard block |
||
| 862 | 862 | */ |
| 863 | 863 | $form_meta_value = apply_filters( |
| 864 | 864 | 'give_pre_save_form_meta_value', |
| 865 | - $this->sanitize_form_meta( $form_meta_value, $setting_field ), |
|
| 865 | + $this->sanitize_form_meta($form_meta_value, $setting_field), |
|
| 866 | 866 | $form_meta_key, |
| 867 | 867 | $this, |
| 868 | 868 | $post_id |
| 869 | 869 | ); |
| 870 | 870 | |
| 871 | 871 | // Save data. |
| 872 | - give_update_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
| 872 | + give_update_meta($post_id, $form_meta_key, $form_meta_value); |
|
| 873 | 873 | |
| 874 | 874 | // Fire after saving form meta key. |
| 875 | - do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post ); |
|
| 875 | + do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post); |
|
| 876 | 876 | }// End if(). |
| 877 | 877 | }// End if(). |
| 878 | 878 | }// End foreach(). |
| 879 | 879 | }// End if(). |
| 880 | 880 | |
| 881 | 881 | // Fire action after saving form meta. |
| 882 | - do_action( 'give_post_process_give_forms_meta', $post_id, $post ); |
|
| 882 | + do_action('give_post_process_give_forms_meta', $post_id, $post); |
|
| 883 | 883 | } |
| 884 | 884 | |
| 885 | 885 | |
@@ -892,10 +892,10 @@ discard block |
||
| 892 | 892 | * |
| 893 | 893 | * @return string |
| 894 | 894 | */ |
| 895 | - private function get_field_id( $field ) { |
|
| 895 | + private function get_field_id($field) { |
|
| 896 | 896 | $field_id = ''; |
| 897 | 897 | |
| 898 | - if ( array_key_exists( 'id', $field ) ) { |
|
| 898 | + if (array_key_exists('id', $field)) { |
|
| 899 | 899 | $field_id = $field['id']; |
| 900 | 900 | |
| 901 | 901 | } |
@@ -912,12 +912,12 @@ discard block |
||
| 912 | 912 | * |
| 913 | 913 | * @return array |
| 914 | 914 | */ |
| 915 | - private function get_fields_id( $setting ) { |
|
| 915 | + private function get_fields_id($setting) { |
|
| 916 | 916 | $meta_keys = array(); |
| 917 | 917 | |
| 918 | - if ( ! empty( $setting ) ) { |
|
| 919 | - foreach ( $setting['fields'] as $field ) { |
|
| 920 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
| 918 | + if ( ! empty($setting)) { |
|
| 919 | + foreach ($setting['fields'] as $field) { |
|
| 920 | + if ($field_id = $this->get_field_id($field)) { |
|
| 921 | 921 | $meta_keys[] = $field_id; |
| 922 | 922 | } |
| 923 | 923 | } |
@@ -935,14 +935,14 @@ discard block |
||
| 935 | 935 | * |
| 936 | 936 | * @return array |
| 937 | 937 | */ |
| 938 | - private function get_sub_fields_id( $setting ) { |
|
| 938 | + private function get_sub_fields_id($setting) { |
|
| 939 | 939 | $meta_keys = array(); |
| 940 | 940 | |
| 941 | - if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) { |
|
| 942 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
| 943 | - if ( ! empty( $fields['fields'] ) ) { |
|
| 944 | - foreach ( $fields['fields'] as $field ) { |
|
| 945 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
| 941 | + if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) { |
|
| 942 | + foreach ($setting['sub-fields'] as $fields) { |
|
| 943 | + if ( ! empty($fields['fields'])) { |
|
| 944 | + foreach ($fields['fields'] as $field) { |
|
| 945 | + if ($field_id = $this->get_field_id($field)) { |
|
| 946 | 946 | $meta_keys[] = $field_id; |
| 947 | 947 | } |
| 948 | 948 | } |
@@ -964,14 +964,14 @@ discard block |
||
| 964 | 964 | private function get_meta_keys_from_settings() { |
| 965 | 965 | $meta_keys = array(); |
| 966 | 966 | |
| 967 | - foreach ( $this->settings as $setting ) { |
|
| 968 | - if ( $this->has_sub_tab( $setting ) ) { |
|
| 969 | - $meta_key = $this->get_sub_fields_id( $setting ); |
|
| 967 | + foreach ($this->settings as $setting) { |
|
| 968 | + if ($this->has_sub_tab($setting)) { |
|
| 969 | + $meta_key = $this->get_sub_fields_id($setting); |
|
| 970 | 970 | } else { |
| 971 | - $meta_key = $this->get_fields_id( $setting ); |
|
| 971 | + $meta_key = $this->get_fields_id($setting); |
|
| 972 | 972 | } |
| 973 | 973 | |
| 974 | - $meta_keys = array_merge( $meta_keys, $meta_key ); |
|
| 974 | + $meta_keys = array_merge($meta_keys, $meta_key); |
|
| 975 | 975 | } |
| 976 | 976 | |
| 977 | 977 | return $meta_keys; |
@@ -988,10 +988,10 @@ discard block |
||
| 988 | 988 | * |
| 989 | 989 | * @return string |
| 990 | 990 | */ |
| 991 | - function get_field_type( $field_id, $group_id = '' ) { |
|
| 992 | - $field = $this->get_setting_field( $field_id, $group_id ); |
|
| 991 | + function get_field_type($field_id, $group_id = '') { |
|
| 992 | + $field = $this->get_setting_field($field_id, $group_id); |
|
| 993 | 993 | |
| 994 | - $type = array_key_exists( 'type', $field ) |
|
| 994 | + $type = array_key_exists('type', $field) |
|
| 995 | 995 | ? $field['type'] |
| 996 | 996 | : ''; |
| 997 | 997 | |
@@ -1009,12 +1009,12 @@ discard block |
||
| 1009 | 1009 | * |
| 1010 | 1010 | * @return array |
| 1011 | 1011 | */ |
| 1012 | - private function get_field( $setting, $field_id ) { |
|
| 1012 | + private function get_field($setting, $field_id) { |
|
| 1013 | 1013 | $setting_field = array(); |
| 1014 | 1014 | |
| 1015 | - if ( ! empty( $setting['fields'] ) ) { |
|
| 1016 | - foreach ( $setting['fields'] as $field ) { |
|
| 1017 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) { |
|
| 1015 | + if ( ! empty($setting['fields'])) { |
|
| 1016 | + foreach ($setting['fields'] as $field) { |
|
| 1017 | + if (array_key_exists('id', $field) && $field['id'] === $field_id) { |
|
| 1018 | 1018 | $setting_field = $field; |
| 1019 | 1019 | break; |
| 1020 | 1020 | } |
@@ -1034,12 +1034,12 @@ discard block |
||
| 1034 | 1034 | * |
| 1035 | 1035 | * @return array |
| 1036 | 1036 | */ |
| 1037 | - private function get_sub_field( $setting, $field_id ) { |
|
| 1037 | + private function get_sub_field($setting, $field_id) { |
|
| 1038 | 1038 | $setting_field = array(); |
| 1039 | 1039 | |
| 1040 | - if ( ! empty( $setting['sub-fields'] ) ) { |
|
| 1041 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
| 1042 | - if ( $field = $this->get_field( $fields, $field_id ) ) { |
|
| 1040 | + if ( ! empty($setting['sub-fields'])) { |
|
| 1041 | + foreach ($setting['sub-fields'] as $fields) { |
|
| 1042 | + if ($field = $this->get_field($fields, $field_id)) { |
|
| 1043 | 1043 | $setting_field = $field; |
| 1044 | 1044 | break; |
| 1045 | 1045 | } |
@@ -1059,17 +1059,17 @@ discard block |
||
| 1059 | 1059 | * |
| 1060 | 1060 | * @return array |
| 1061 | 1061 | */ |
| 1062 | - function get_setting_field( $field_id, $group_id = '' ) { |
|
| 1062 | + function get_setting_field($field_id, $group_id = '') { |
|
| 1063 | 1063 | $setting_field = array(); |
| 1064 | 1064 | |
| 1065 | 1065 | $_field_id = $field_id; |
| 1066 | - $field_id = empty( $group_id ) ? $field_id : $group_id; |
|
| 1066 | + $field_id = empty($group_id) ? $field_id : $group_id; |
|
| 1067 | 1067 | |
| 1068 | - if ( ! empty( $this->settings ) ) { |
|
| 1069 | - foreach ( $this->settings as $setting ) { |
|
| 1068 | + if ( ! empty($this->settings)) { |
|
| 1069 | + foreach ($this->settings as $setting) { |
|
| 1070 | 1070 | if ( |
| 1071 | - ( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) ) |
|
| 1072 | - || ( $setting_field = $this->get_field( $setting, $field_id ) ) |
|
| 1071 | + ($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id))) |
|
| 1072 | + || ($setting_field = $this->get_field($setting, $field_id)) |
|
| 1073 | 1073 | ) { |
| 1074 | 1074 | break; |
| 1075 | 1075 | } |
@@ -1077,9 +1077,9 @@ discard block |
||
| 1077 | 1077 | } |
| 1078 | 1078 | |
| 1079 | 1079 | // Get field from group. |
| 1080 | - if ( ! empty( $group_id ) ) { |
|
| 1081 | - foreach ( $setting_field['fields'] as $field ) { |
|
| 1082 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) { |
|
| 1080 | + if ( ! empty($group_id)) { |
|
| 1081 | + foreach ($setting_field['fields'] as $field) { |
|
| 1082 | + if (array_key_exists('id', $field) && $field['id'] === $_field_id) { |
|
| 1083 | 1083 | $setting_field = $field; |
| 1084 | 1084 | } |
| 1085 | 1085 | } |
@@ -1098,14 +1098,14 @@ discard block |
||
| 1098 | 1098 | * |
| 1099 | 1099 | * @return mixed |
| 1100 | 1100 | */ |
| 1101 | - function add_offline_donations_setting_tab( $settings ) { |
|
| 1102 | - if ( give_is_gateway_active( 'offline' ) ) { |
|
| 1103 | - $settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array( |
|
| 1101 | + function add_offline_donations_setting_tab($settings) { |
|
| 1102 | + if (give_is_gateway_active('offline')) { |
|
| 1103 | + $settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array( |
|
| 1104 | 1104 | 'id' => 'offline_donations_options', |
| 1105 | - 'title' => __( 'Offline Donations', 'give' ), |
|
| 1105 | + 'title' => __('Offline Donations', 'give'), |
|
| 1106 | 1106 | 'icon-html' => '<span class="give-icon give-icon-purse"></span>', |
| 1107 | - 'fields' => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ), |
|
| 1108 | - ) ); |
|
| 1107 | + 'fields' => apply_filters('give_forms_offline_donations_metabox_fields', array()), |
|
| 1108 | + )); |
|
| 1109 | 1109 | } |
| 1110 | 1110 | |
| 1111 | 1111 | return $settings; |
@@ -1123,22 +1123,22 @@ discard block |
||
| 1123 | 1123 | * |
| 1124 | 1124 | * @return mixed |
| 1125 | 1125 | */ |
| 1126 | - function sanitize_form_meta( $meta_value, $setting_field ) { |
|
| 1127 | - switch ( $setting_field['type'] ) { |
|
| 1126 | + function sanitize_form_meta($meta_value, $setting_field) { |
|
| 1127 | + switch ($setting_field['type']) { |
|
| 1128 | 1128 | case 'group': |
| 1129 | - if ( ! empty( $setting_field['fields'] ) ) { |
|
| 1130 | - foreach ( $setting_field['fields'] as $field ) { |
|
| 1131 | - if ( empty( $field['data_type'] ) || 'price' !== $field['data_type'] ) { |
|
| 1129 | + if ( ! empty($setting_field['fields'])) { |
|
| 1130 | + foreach ($setting_field['fields'] as $field) { |
|
| 1131 | + if (empty($field['data_type']) || 'price' !== $field['data_type']) { |
|
| 1132 | 1132 | continue; |
| 1133 | 1133 | } |
| 1134 | 1134 | |
| 1135 | - foreach ( $meta_value as $index => $meta_data ) { |
|
| 1136 | - if ( ! isset( $meta_value[ $index ][ $field['id'] ] ) ) { |
|
| 1135 | + foreach ($meta_value as $index => $meta_data) { |
|
| 1136 | + if ( ! isset($meta_value[$index][$field['id']])) { |
|
| 1137 | 1137 | continue; |
| 1138 | 1138 | } |
| 1139 | 1139 | |
| 1140 | - $meta_value[ $index ][ $field['id'] ] = ! empty( $meta_value[ $index ][ $field['id'] ] ) |
|
| 1141 | - ? give_sanitize_amount_for_db( $meta_value[ $index ][ $field['id'] ] ) |
|
| 1140 | + $meta_value[$index][$field['id']] = ! empty($meta_value[$index][$field['id']]) |
|
| 1141 | + ? give_sanitize_amount_for_db($meta_value[$index][$field['id']]) |
|
| 1142 | 1142 | : 0; |
| 1143 | 1143 | } |
| 1144 | 1144 | } |
@@ -1146,8 +1146,8 @@ discard block |
||
| 1146 | 1146 | break; |
| 1147 | 1147 | |
| 1148 | 1148 | default: |
| 1149 | - if ( ! empty( $setting_field['data_type'] ) && 'price' === $setting_field['data_type'] ) { |
|
| 1150 | - $meta_value = $meta_value ? give_sanitize_amount_for_db( $meta_value ) : 0; |
|
| 1149 | + if ( ! empty($setting_field['data_type']) && 'price' === $setting_field['data_type']) { |
|
| 1150 | + $meta_value = $meta_value ? give_sanitize_amount_for_db($meta_value) : 0; |
|
| 1151 | 1151 | } |
| 1152 | 1152 | } |
| 1153 | 1153 | |
@@ -1165,12 +1165,12 @@ discard block |
||
| 1165 | 1165 | * |
| 1166 | 1166 | * @return string The URL after redirect. |
| 1167 | 1167 | */ |
| 1168 | - public function maintain_active_tab( $location, $post_id ) { |
|
| 1168 | + public function maintain_active_tab($location, $post_id) { |
|
| 1169 | 1169 | if ( |
| 1170 | - 'give_forms' === get_post_type( $post_id ) && |
|
| 1171 | - ! empty( $_POST['give_form_active_tab'] ) |
|
| 1170 | + 'give_forms' === get_post_type($post_id) && |
|
| 1171 | + ! empty($_POST['give_form_active_tab']) |
|
| 1172 | 1172 | ) { |
| 1173 | - $location = add_query_arg( 'give_tab', give_clean( $_POST['give_form_active_tab'] ), $location ); |
|
| 1173 | + $location = add_query_arg('give_tab', give_clean($_POST['give_form_active_tab']), $location); |
|
| 1174 | 1174 | } |
| 1175 | 1175 | |
| 1176 | 1176 | return $location; |
@@ -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 | |
@@ -32,17 +32,17 @@ discard block |
||
| 32 | 32 | global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_donors_page, $give_tools_page; |
| 33 | 33 | |
| 34 | 34 | //Payments |
| 35 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
| 36 | - $give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' ); |
|
| 35 | + $give_payment = get_post_type_object('give_payment'); |
|
| 36 | + $give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page'); |
|
| 37 | 37 | |
| 38 | 38 | //Donors |
| 39 | - $give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Donors', 'give' ), esc_html__( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_donors_page' ); |
|
| 39 | + $give_donors_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Donors', 'give'), esc_html__('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_donors_page'); |
|
| 40 | 40 | |
| 41 | 41 | //Reports` |
| 42 | 42 | $give_reports_page = add_submenu_page( |
| 43 | 43 | 'edit.php?post_type=give_forms', |
| 44 | - esc_html__( 'Donation Reports', 'give' ), |
|
| 45 | - esc_html__( 'Reports', 'give' ), |
|
| 44 | + esc_html__('Donation Reports', 'give'), |
|
| 45 | + esc_html__('Reports', 'give'), |
|
| 46 | 46 | 'view_give_reports', |
| 47 | 47 | 'give-reports', |
| 48 | 48 | array( |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | //Settings |
| 55 | 55 | $give_settings_page = add_submenu_page( |
| 56 | 56 | 'edit.php?post_type=give_forms', |
| 57 | - esc_html__( 'Give Settings', 'give' ), |
|
| 58 | - esc_html__( 'Settings', 'give' ), |
|
| 57 | + esc_html__('Give Settings', 'give'), |
|
| 58 | + esc_html__('Settings', 'give'), |
|
| 59 | 59 | 'manage_give_settings', |
| 60 | 60 | 'give-settings', |
| 61 | 61 | array( |
@@ -65,16 +65,16 @@ discard block |
||
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | 67 | //Tools. |
| 68 | - $give_tools_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Tools', 'give' ), esc_html__( 'Tools', 'give' ), 'manage_give_settings', 'give-tools', array( |
|
| 68 | + $give_tools_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Tools', 'give'), esc_html__('Tools', 'give'), 'manage_give_settings', 'give-tools', array( |
|
| 69 | 69 | Give()->give_settings, |
| 70 | 70 | 'output' |
| 71 | - ) ); |
|
| 71 | + )); |
|
| 72 | 72 | |
| 73 | 73 | //Add-ons |
| 74 | - $give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Add-ons', 'give' ), esc_html__( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' ); |
|
| 74 | + $give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Add-ons', 'give'), esc_html__('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page'); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | -add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
| 77 | +add_action('admin_menu', 'give_add_options_links', 10); |
|
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * Determines whether the current admin page is a Give admin page. |
@@ -89,224 +89,224 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @return bool True if Give admin page. |
| 91 | 91 | */ |
| 92 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
| 92 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
| 93 | 93 | |
| 94 | 94 | global $pagenow, $typenow; |
| 95 | 95 | |
| 96 | 96 | $found = false; |
| 97 | - $post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false; |
|
| 98 | - $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false; |
|
| 99 | - $taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false; |
|
| 100 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
| 101 | - $view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false; |
|
| 102 | - $tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false; |
|
| 103 | - |
|
| 104 | - switch ( $passed_page ) { |
|
| 97 | + $post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false; |
|
| 98 | + $action = isset($_GET['action']) ? strtolower($_GET['action']) : false; |
|
| 99 | + $taxonomy = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false; |
|
| 100 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
| 101 | + $view = isset($_GET['view']) ? strtolower($_GET['view']) : false; |
|
| 102 | + $tab = isset($_GET['tab']) ? strtolower($_GET['tab']) : false; |
|
| 103 | + |
|
| 104 | + switch ($passed_page) { |
|
| 105 | 105 | case 'give_forms': |
| 106 | - switch ( $passed_view ) { |
|
| 106 | + switch ($passed_view) { |
|
| 107 | 107 | case 'list-table': |
| 108 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) { |
|
| 108 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') { |
|
| 109 | 109 | $found = true; |
| 110 | 110 | } |
| 111 | 111 | break; |
| 112 | 112 | case 'edit': |
| 113 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) { |
|
| 113 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') { |
|
| 114 | 114 | $found = true; |
| 115 | 115 | } |
| 116 | 116 | break; |
| 117 | 117 | case 'new': |
| 118 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) { |
|
| 118 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') { |
|
| 119 | 119 | $found = true; |
| 120 | 120 | } |
| 121 | 121 | break; |
| 122 | 122 | default: |
| 123 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) { |
|
| 123 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) { |
|
| 124 | 124 | $found = true; |
| 125 | 125 | } |
| 126 | 126 | break; |
| 127 | 127 | } |
| 128 | 128 | break; |
| 129 | 129 | case 'categories': |
| 130 | - switch ( $passed_view ) { |
|
| 130 | + switch ($passed_view) { |
|
| 131 | 131 | case 'list-table': |
| 132 | 132 | case 'new': |
| 133 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) { |
|
| 133 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) { |
|
| 134 | 134 | $found = true; |
| 135 | 135 | } |
| 136 | 136 | break; |
| 137 | 137 | case 'edit': |
| 138 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) { |
|
| 138 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) { |
|
| 139 | 139 | $found = true; |
| 140 | 140 | } |
| 141 | 141 | break; |
| 142 | 142 | default: |
| 143 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) { |
|
| 143 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) { |
|
| 144 | 144 | $found = true; |
| 145 | 145 | } |
| 146 | 146 | break; |
| 147 | 147 | } |
| 148 | 148 | break; |
| 149 | 149 | case 'tags': |
| 150 | - switch ( $passed_view ) { |
|
| 150 | + switch ($passed_view) { |
|
| 151 | 151 | case 'list-table': |
| 152 | 152 | case 'new': |
| 153 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) { |
|
| 153 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) { |
|
| 154 | 154 | $found = true; |
| 155 | 155 | } |
| 156 | 156 | break; |
| 157 | 157 | case 'edit': |
| 158 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) { |
|
| 158 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) { |
|
| 159 | 159 | $found = true; |
| 160 | 160 | } |
| 161 | 161 | break; |
| 162 | 162 | default: |
| 163 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) { |
|
| 163 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) { |
|
| 164 | 164 | $found = true; |
| 165 | 165 | } |
| 166 | 166 | break; |
| 167 | 167 | } |
| 168 | 168 | break; |
| 169 | 169 | case 'payments': |
| 170 | - switch ( $passed_view ) { |
|
| 170 | + switch ($passed_view) { |
|
| 171 | 171 | case 'list-table': |
| 172 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) { |
|
| 172 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) { |
|
| 173 | 173 | $found = true; |
| 174 | 174 | } |
| 175 | 175 | break; |
| 176 | 176 | case 'edit': |
| 177 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view ) { |
|
| 177 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view) { |
|
| 178 | 178 | $found = true; |
| 179 | 179 | } |
| 180 | 180 | break; |
| 181 | 181 | default: |
| 182 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) { |
|
| 182 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) { |
|
| 183 | 183 | $found = true; |
| 184 | 184 | } |
| 185 | 185 | break; |
| 186 | 186 | } |
| 187 | 187 | break; |
| 188 | 188 | case 'reports': |
| 189 | - switch ( $passed_view ) { |
|
| 189 | + switch ($passed_view) { |
|
| 190 | 190 | // If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ] |
| 191 | 191 | case 'earnings': |
| 192 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) { |
|
| 192 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) { |
|
| 193 | 193 | $found = true; |
| 194 | 194 | } |
| 195 | 195 | break; |
| 196 | 196 | case 'donors': |
| 197 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) { |
|
| 197 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) { |
|
| 198 | 198 | $found = true; |
| 199 | 199 | } |
| 200 | 200 | break; |
| 201 | 201 | case 'gateways': |
| 202 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) { |
|
| 202 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) { |
|
| 203 | 203 | $found = true; |
| 204 | 204 | } |
| 205 | 205 | break; |
| 206 | 206 | case 'export': |
| 207 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) { |
|
| 207 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) { |
|
| 208 | 208 | $found = true; |
| 209 | 209 | } |
| 210 | 210 | break; |
| 211 | 211 | case 'logs': |
| 212 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) { |
|
| 212 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) { |
|
| 213 | 213 | $found = true; |
| 214 | 214 | } |
| 215 | 215 | break; |
| 216 | 216 | default: |
| 217 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
| 217 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
| 218 | 218 | $found = true; |
| 219 | 219 | } |
| 220 | 220 | break; |
| 221 | 221 | } |
| 222 | 222 | break; |
| 223 | 223 | case 'settings': |
| 224 | - switch ( $passed_view ) { |
|
| 224 | + switch ($passed_view) { |
|
| 225 | 225 | case 'general': |
| 226 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) { |
|
| 226 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) { |
|
| 227 | 227 | $found = true; |
| 228 | 228 | } |
| 229 | 229 | break; |
| 230 | 230 | case 'gateways': |
| 231 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) { |
|
| 231 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) { |
|
| 232 | 232 | $found = true; |
| 233 | 233 | } |
| 234 | 234 | break; |
| 235 | 235 | case 'emails': |
| 236 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) { |
|
| 236 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) { |
|
| 237 | 237 | $found = true; |
| 238 | 238 | } |
| 239 | 239 | break; |
| 240 | 240 | case 'display': |
| 241 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) { |
|
| 241 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) { |
|
| 242 | 242 | $found = true; |
| 243 | 243 | } |
| 244 | 244 | break; |
| 245 | 245 | case 'licenses': |
| 246 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) { |
|
| 246 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) { |
|
| 247 | 247 | $found = true; |
| 248 | 248 | } |
| 249 | 249 | break; |
| 250 | 250 | case 'api': |
| 251 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) { |
|
| 251 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) { |
|
| 252 | 252 | $found = true; |
| 253 | 253 | } |
| 254 | 254 | break; |
| 255 | 255 | case 'advanced': |
| 256 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) { |
|
| 256 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) { |
|
| 257 | 257 | $found = true; |
| 258 | 258 | } |
| 259 | 259 | break; |
| 260 | 260 | case 'system_info': |
| 261 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) { |
|
| 261 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) { |
|
| 262 | 262 | $found = true; |
| 263 | 263 | } |
| 264 | 264 | break; |
| 265 | 265 | default: |
| 266 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) { |
|
| 266 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) { |
|
| 267 | 267 | $found = true; |
| 268 | 268 | } |
| 269 | 269 | break; |
| 270 | 270 | } |
| 271 | 271 | break; |
| 272 | 272 | case 'addons': |
| 273 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) { |
|
| 273 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) { |
|
| 274 | 274 | $found = true; |
| 275 | 275 | } |
| 276 | 276 | break; |
| 277 | 277 | case 'donors': |
| 278 | - switch ( $passed_view ) { |
|
| 278 | + switch ($passed_view) { |
|
| 279 | 279 | case 'list-table': |
| 280 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) { |
|
| 280 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) { |
|
| 281 | 281 | $found = true; |
| 282 | 282 | } |
| 283 | 283 | break; |
| 284 | 284 | case 'overview': |
| 285 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) { |
|
| 285 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) { |
|
| 286 | 286 | $found = true; |
| 287 | 287 | } |
| 288 | 288 | break; |
| 289 | 289 | case 'notes': |
| 290 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) { |
|
| 290 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) { |
|
| 291 | 291 | $found = true; |
| 292 | 292 | } |
| 293 | 293 | break; |
| 294 | 294 | default: |
| 295 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) { |
|
| 295 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) { |
|
| 296 | 296 | $found = true; |
| 297 | 297 | } |
| 298 | 298 | break; |
| 299 | 299 | } |
| 300 | 300 | break; |
| 301 | 301 | case 'reports': |
| 302 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
| 302 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
| 303 | 303 | $found = true; |
| 304 | 304 | } |
| 305 | 305 | break; |
| 306 | 306 | default: |
| 307 | 307 | global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_donors_page, $give_tools_page; |
| 308 | 308 | |
| 309 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
| 309 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
| 310 | 310 | $give_payments_page, |
| 311 | 311 | $give_settings_page, |
| 312 | 312 | $give_reports_page, |
@@ -316,16 +316,16 @@ discard block |
||
| 316 | 316 | $give_donors_page, |
| 317 | 317 | $give_tools_page, |
| 318 | 318 | 'widgets.php' |
| 319 | - ) ); |
|
| 320 | - if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) { |
|
| 319 | + )); |
|
| 320 | + if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) { |
|
| 321 | 321 | $found = true; |
| 322 | - } elseif ( in_array( $pagenow, $admin_pages ) ) { |
|
| 322 | + } elseif (in_array($pagenow, $admin_pages)) { |
|
| 323 | 323 | $found = true; |
| 324 | 324 | } |
| 325 | 325 | break; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view ); |
|
| 328 | + return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view); |
|
| 329 | 329 | |
| 330 | 330 | } |
| 331 | 331 | |
@@ -337,37 +337,37 @@ discard block |
||
| 337 | 337 | * @param array $settings |
| 338 | 338 | * @return array |
| 339 | 339 | */ |
| 340 | -function give_settings_page_pages( $settings ) { |
|
| 341 | - include( 'abstract-admin-settings-page.php' ); |
|
| 342 | - include( 'settings/class-settings-cmb2-backward-compatibility.php' ); |
|
| 340 | +function give_settings_page_pages($settings) { |
|
| 341 | + include('abstract-admin-settings-page.php'); |
|
| 342 | + include('settings/class-settings-cmb2-backward-compatibility.php'); |
|
| 343 | 343 | |
| 344 | 344 | $settings = array( |
| 345 | 345 | // General settings. |
| 346 | - include( 'settings/class-settings-general.php' ), |
|
| 346 | + include('settings/class-settings-general.php'), |
|
| 347 | 347 | |
| 348 | 348 | // Payment Gateways Settings. |
| 349 | - include( 'settings/class-settings-gateways.php' ), |
|
| 349 | + include('settings/class-settings-gateways.php'), |
|
| 350 | 350 | |
| 351 | 351 | // Display settings. |
| 352 | - include( 'settings/class-settings-display.php' ), |
|
| 352 | + include('settings/class-settings-display.php'), |
|
| 353 | 353 | |
| 354 | 354 | // Emails settings. |
| 355 | - include( 'settings/class-settings-email.php' ), |
|
| 355 | + include('settings/class-settings-email.php'), |
|
| 356 | 356 | |
| 357 | 357 | // Addons settings. |
| 358 | - include( 'settings/class-settings-addon.php' ), |
|
| 358 | + include('settings/class-settings-addon.php'), |
|
| 359 | 359 | |
| 360 | 360 | // License settings. |
| 361 | - include( 'settings/class-settings-license.php' ), |
|
| 361 | + include('settings/class-settings-license.php'), |
|
| 362 | 362 | |
| 363 | 363 | // Advanced settings. |
| 364 | - include( 'settings/class-settings-advanced.php' ) |
|
| 364 | + include('settings/class-settings-advanced.php') |
|
| 365 | 365 | ); |
| 366 | 366 | |
| 367 | 367 | // Output. |
| 368 | 368 | return $settings; |
| 369 | 369 | } |
| 370 | -add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 ); |
|
| 370 | +add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1); |
|
| 371 | 371 | |
| 372 | 372 | |
| 373 | 373 | /** |
@@ -377,25 +377,25 @@ discard block |
||
| 377 | 377 | * @param array $settings |
| 378 | 378 | * @return array |
| 379 | 379 | */ |
| 380 | -function give_reports_page_pages( $settings ) { |
|
| 381 | - include( 'abstract-admin-settings-page.php' ); |
|
| 380 | +function give_reports_page_pages($settings) { |
|
| 381 | + include('abstract-admin-settings-page.php'); |
|
| 382 | 382 | |
| 383 | 383 | $settings = array( |
| 384 | 384 | // Earnings. |
| 385 | - include( 'reports/class-earnings-report.php' ), |
|
| 385 | + include('reports/class-earnings-report.php'), |
|
| 386 | 386 | |
| 387 | 387 | // Forms. |
| 388 | - include( 'reports/class-forms-report.php' ), |
|
| 388 | + include('reports/class-forms-report.php'), |
|
| 389 | 389 | |
| 390 | 390 | // Gateways. |
| 391 | - include( 'reports/class-gateways-report.php' ), |
|
| 391 | + include('reports/class-gateways-report.php'), |
|
| 392 | 392 | |
| 393 | 393 | ); |
| 394 | 394 | |
| 395 | 395 | // Output. |
| 396 | 396 | return $settings; |
| 397 | 397 | } |
| 398 | -add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 ); |
|
| 398 | +add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1); |
|
| 399 | 399 | |
| 400 | 400 | /** |
| 401 | 401 | * Add setting tab to give-settings page |
@@ -404,34 +404,34 @@ discard block |
||
| 404 | 404 | * @param array $settings |
| 405 | 405 | * @return array |
| 406 | 406 | */ |
| 407 | -function give_tools_page_pages( $settings ) { |
|
| 408 | - include( 'abstract-admin-settings-page.php' ); |
|
| 407 | +function give_tools_page_pages($settings) { |
|
| 408 | + include('abstract-admin-settings-page.php'); |
|
| 409 | 409 | |
| 410 | 410 | $settings = array( |
| 411 | 411 | // System Info. |
| 412 | - include( 'tools/class-settings-system-info.php' ), |
|
| 412 | + include('tools/class-settings-system-info.php'), |
|
| 413 | 413 | |
| 414 | 414 | // Logs. |
| 415 | - include( 'tools/class-settings-logs.php' ), |
|
| 415 | + include('tools/class-settings-logs.php'), |
|
| 416 | 416 | |
| 417 | 417 | // API. |
| 418 | - include( 'tools/class-settings-api.php' ), |
|
| 418 | + include('tools/class-settings-api.php'), |
|
| 419 | 419 | |
| 420 | 420 | // Data. |
| 421 | - include( 'tools/class-settings-data.php' ), |
|
| 421 | + include('tools/class-settings-data.php'), |
|
| 422 | 422 | |
| 423 | 423 | // Export. |
| 424 | - include( 'tools/class-settings-export.php' ), |
|
| 424 | + include('tools/class-settings-export.php'), |
|
| 425 | 425 | |
| 426 | 426 | // Import. |
| 427 | - include( 'tools/class-settings-import.php' ), |
|
| 427 | + include('tools/class-settings-import.php'), |
|
| 428 | 428 | |
| 429 | 429 | ); |
| 430 | 430 | |
| 431 | 431 | // Output. |
| 432 | 432 | return $settings; |
| 433 | 433 | } |
| 434 | -add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 ); |
|
| 434 | +add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1); |
|
| 435 | 435 | |
| 436 | 436 | /** |
| 437 | 437 | * Set default tools page tab. |
@@ -440,10 +440,10 @@ discard block |
||
| 440 | 440 | * @param string $default_tab Default tab name. |
| 441 | 441 | * @return string |
| 442 | 442 | */ |
| 443 | -function give_set_default_tab_form_tools_page( $default_tab ) { |
|
| 443 | +function give_set_default_tab_form_tools_page($default_tab) { |
|
| 444 | 444 | return 'system-info'; |
| 445 | 445 | } |
| 446 | -add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 ); |
|
| 446 | +add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1); |
|
| 447 | 447 | |
| 448 | 448 | |
| 449 | 449 | /** |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | * @param string $default_tab Default tab name. |
| 454 | 454 | * @return string |
| 455 | 455 | */ |
| 456 | -function give_set_default_tab_form_reports_page( $default_tab ) { |
|
| 456 | +function give_set_default_tab_form_reports_page($default_tab) { |
|
| 457 | 457 | return 'earnings'; |
| 458 | 458 | } |
| 459 | -add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 ); |
|
| 460 | 459 | \ No newline at end of file |
| 460 | +add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1); |
|
| 461 | 461 | \ No newline at end of file |
@@ -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_Page' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Settings_Page')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Settings_Page. |
@@ -70,25 +70,25 @@ discard block |
||
| 70 | 70 | // Get current setting page. |
| 71 | 71 | $this->current_setting_page = give_get_current_setting_page(); |
| 72 | 72 | |
| 73 | - add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 ); |
|
| 74 | - add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 ); |
|
| 75 | - add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
| 73 | + add_filter("give_default_setting_tab_section_{$this->id}", array($this, 'set_default_setting_tab'), 10); |
|
| 74 | + add_filter("{$this->current_setting_page}_tabs_array", array($this, 'add_settings_page'), 20); |
|
| 75 | + add_action("{$this->current_setting_page}_settings_{$this->id}_page", array($this, 'output')); |
|
| 76 | 76 | |
| 77 | 77 | // Output section only if exist. |
| 78 | 78 | $sections = $this->get_sections(); |
| 79 | - if ( ! empty( $sections ) ) { |
|
| 80 | - add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array( |
|
| 79 | + if ( ! empty($sections)) { |
|
| 80 | + add_action("{$this->current_setting_page}_sections_{$this->id}_page", array( |
|
| 81 | 81 | $this, |
| 82 | 82 | 'output_sections', |
| 83 | - ) ); |
|
| 83 | + )); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // Save hide button by default. |
| 87 | 87 | $GLOBALS['give_hide_save_button'] = true; |
| 88 | 88 | |
| 89 | 89 | // Enable saving feature. |
| 90 | - if ( $this->enable_save ) { |
|
| 91 | - add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) ); |
|
| 90 | + if ($this->enable_save) { |
|
| 91 | + add_action("{$this->current_setting_page}_save_{$this->id}", array($this, 'save')); |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @return string |
| 115 | 115 | */ |
| 116 | - function set_default_setting_tab( $setting_tab ) { |
|
| 116 | + function set_default_setting_tab($setting_tab) { |
|
| 117 | 117 | return $this->default_tab; |
| 118 | 118 | } |
| 119 | 119 | |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @return array |
| 128 | 128 | */ |
| 129 | - public function add_settings_page( $pages ) { |
|
| 130 | - $pages[ $this->id ] = $this->label; |
|
| 129 | + public function add_settings_page($pages) { |
|
| 130 | + $pages[$this->id] = $this->label; |
|
| 131 | 131 | |
| 132 | 132 | return $pages; |
| 133 | 133 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * |
| 147 | 147 | * @param array $settings |
| 148 | 148 | */ |
| 149 | - $settings = apply_filters( 'give_get_settings_' . $this->id, array() ); |
|
| 149 | + $settings = apply_filters('give_get_settings_'.$this->id, array()); |
|
| 150 | 150 | |
| 151 | 151 | // Output. |
| 152 | 152 | return $settings; |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @return array |
| 160 | 160 | */ |
| 161 | 161 | public function get_sections() { |
| 162 | - return apply_filters( 'give_get_sections_' . $this->id, array() ); |
|
| 162 | + return apply_filters('give_get_sections_'.$this->id, array()); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -176,29 +176,29 @@ discard block |
||
| 176 | 176 | $sections = $this->get_sections(); |
| 177 | 177 | |
| 178 | 178 | // Show section settings only if setting section exist. |
| 179 | - if ( $current_section && ! in_array( $current_section, array_keys( $sections ) ) ) { |
|
| 180 | - echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; |
|
| 179 | + if ($current_section && ! in_array($current_section, array_keys($sections))) { |
|
| 180 | + echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; |
|
| 181 | 181 | $GLOBALS['give_hide_save_button'] = true; |
| 182 | 182 | |
| 183 | 183 | return; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | // Bailout. |
| 187 | - if ( empty( $sections ) ) { |
|
| 187 | + if (empty($sections)) { |
|
| 188 | 188 | return; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - if ( is_null( $this->current_setting_page ) ) { |
|
| 191 | + if (is_null($this->current_setting_page)) { |
|
| 192 | 192 | $this->current_setting_page = give_get_current_setting_page(); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | echo '<ul class="subsubsub">'; |
| 196 | 196 | |
| 197 | 197 | // Get section keys. |
| 198 | - $array_keys = array_keys( $sections ); |
|
| 198 | + $array_keys = array_keys($sections); |
|
| 199 | 199 | |
| 200 | - foreach ( $sections as $id => $label ) { |
|
| 201 | - echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=' . $this->current_setting_page . '&tab=' . $this->id . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>'; |
|
| 200 | + foreach ($sections as $id => $label) { |
|
| 201 | + echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page='.$this->current_setting_page.'&tab='.$this->id.'§ion='.sanitize_title($id)).'" class="'.($current_section == $id ? 'current' : '').'">'.$label.'</a> '.(end($array_keys) == $id ? '' : '|').' </li>'; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | echo '</ul><br class="clear" /><hr>'; |
@@ -213,13 +213,13 @@ discard block |
||
| 213 | 213 | * @return void |
| 214 | 214 | */ |
| 215 | 215 | public function output() { |
| 216 | - if ( $this->enable_save ) { |
|
| 216 | + if ($this->enable_save) { |
|
| 217 | 217 | $GLOBALS['give_hide_save_button'] = false; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | $settings = $this->get_settings(); |
| 221 | 221 | |
| 222 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
| 222 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
@@ -232,14 +232,14 @@ discard block |
||
| 232 | 232 | $settings = $this->get_settings(); |
| 233 | 233 | $current_section = give_get_current_setting_section(); |
| 234 | 234 | |
| 235 | - Give_Admin_Settings::save_fields( $settings, 'give_settings' ); |
|
| 235 | + Give_Admin_Settings::save_fields($settings, 'give_settings'); |
|
| 236 | 236 | |
| 237 | 237 | /** |
| 238 | 238 | * Trigger Action |
| 239 | 239 | * |
| 240 | 240 | * @since 1.8 |
| 241 | 241 | */ |
| 242 | - do_action( 'give_update_options_' . $this->id . '_' . $current_section ); |
|
| 242 | + do_action('give_update_options_'.$this->id.'_'.$current_section); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
@@ -256,11 +256,11 @@ discard block |
||
| 256 | 256 | $section = $this->get_sections(); |
| 257 | 257 | $current_section = give_get_current_setting_section(); |
| 258 | 258 | |
| 259 | - if ( array_key_exists( $current_section, $section ) ) { |
|
| 260 | - $heading[] = $section[ $current_section ]; |
|
| 259 | + if (array_key_exists($current_section, $section)) { |
|
| 260 | + $heading[] = $section[$current_section]; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - return array_unique( $heading ); |
|
| 263 | + return array_unique($heading); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | /** |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | public function get_heading_html() { |
| 275 | 275 | return sprintf( |
| 276 | 276 | '<h1 class="wp-heading-inline">%s</h1><hr class="wp-header-end">', |
| 277 | - implode( ' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading() ) |
|
| 277 | + implode(' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading()) |
|
| 278 | 278 | ); |
| 279 | 279 | } |
| 280 | 280 | } |
@@ -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 | |
@@ -27,30 +27,30 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @return mixed |
| 29 | 29 | */ |
| 30 | -function __give_sanitize_number_decimals_setting_field( $value ) { |
|
| 30 | +function __give_sanitize_number_decimals_setting_field($value) { |
|
| 31 | 31 | $value_changed = false; |
| 32 | 32 | $old_value = $value; |
| 33 | 33 | |
| 34 | - if ( isset( $_POST['decimal_separator'] ) ) { |
|
| 35 | - $value = ! empty( $_POST['decimal_separator'] ) ? $value : 0; |
|
| 34 | + if (isset($_POST['decimal_separator'])) { |
|
| 35 | + $value = ! empty($_POST['decimal_separator']) ? $value : 0; |
|
| 36 | 36 | $value_changed = true; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if ( $value_changed && ( $old_value != $value ) ) { |
|
| 40 | - Give_Admin_Settings::add_error( 'give-number-decimal', __( 'The \'Number of Decimals\' option has been automatically set to zero because the \'Decimal Separator\' is not set.', 'give' ) ); |
|
| 39 | + if ($value_changed && ($old_value != $value)) { |
|
| 40 | + Give_Admin_Settings::add_error('give-number-decimal', __('The \'Number of Decimals\' option has been automatically set to zero because the \'Decimal Separator\' is not set.', 'give')); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $value = absint( $value ); |
|
| 43 | + $value = absint($value); |
|
| 44 | 44 | |
| 45 | - if( 6 <= $value ) { |
|
| 45 | + if (6 <= $value) { |
|
| 46 | 46 | $value = 5; |
| 47 | - Give_Admin_Settings::add_error( 'give-number-decimal', __( 'The \'Number of Decimals\' option has been automatically set to 5 because you entered a number higher than the maximum allowed.', 'give' ) ); |
|
| 47 | + Give_Admin_Settings::add_error('give-number-decimal', __('The \'Number of Decimals\' option has been automatically set to 5 because you entered a number higher than the maximum allowed.', 'give')); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - return absint( $value ); |
|
| 50 | + return absint($value); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | -add_filter( 'give_admin_settings_sanitize_option_number_decimals', '__give_sanitize_number_decimals_setting_field', 10 ); |
|
| 53 | +add_filter('give_admin_settings_sanitize_option_number_decimals', '__give_sanitize_number_decimals_setting_field', 10); |
|
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -66,20 +66,20 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return mixed |
| 68 | 68 | */ |
| 69 | -function __give_validate_decimal_separator_setting_field( $value ) { |
|
| 70 | - $thousand_separator = give_clean( $_POST['thousands_separator'] ); |
|
| 71 | - $decimal_separator = give_clean( $_POST['decimal_separator'] ); |
|
| 69 | +function __give_validate_decimal_separator_setting_field($value) { |
|
| 70 | + $thousand_separator = give_clean($_POST['thousands_separator']); |
|
| 71 | + $decimal_separator = give_clean($_POST['decimal_separator']); |
|
| 72 | 72 | |
| 73 | - if ( $decimal_separator === $thousand_separator ) { |
|
| 73 | + if ($decimal_separator === $thousand_separator) { |
|
| 74 | 74 | $value = ''; |
| 75 | 75 | $_POST['number_decimals'] = 0; |
| 76 | - Give_Admin_Settings::add_error( 'give-decimal-separator', __( 'The \'Decimal Separator\' option has automatically been set to empty because it can not be equal to the \'Thousand Separator\'', 'give' ) ); |
|
| 76 | + Give_Admin_Settings::add_error('give-decimal-separator', __('The \'Decimal Separator\' option has automatically been set to empty because it can not be equal to the \'Thousand Separator\'', 'give')); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | return $value; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | -add_filter( 'give_admin_settings_sanitize_option_decimal_separator', '__give_validate_decimal_separator_setting_field', 10 ); |
|
| 82 | +add_filter('give_admin_settings_sanitize_option_decimal_separator', '__give_validate_decimal_separator_setting_field', 10); |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Change $delimiter text to symbol. |
@@ -90,16 +90,16 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @return string $delimiter. |
| 92 | 92 | */ |
| 93 | -function __give_import_delimiter_set_callback( $delimiter ) { |
|
| 93 | +function __give_import_delimiter_set_callback($delimiter) { |
|
| 94 | 94 | $delimite_type = array( |
| 95 | 95 | 'csv' => ",", |
| 96 | 96 | 'tab-separated-values' => "\t", |
| 97 | 97 | ); |
| 98 | 98 | |
| 99 | - return ( array_key_exists( $delimiter, $delimite_type ) ? $delimite_type[ $delimiter ] : "," ); |
|
| 99 | + return (array_key_exists($delimiter, $delimite_type) ? $delimite_type[$delimiter] : ","); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | -add_filter( 'give_import_delimiter_set', '__give_import_delimiter_set_callback', 10 ); |
|
| 102 | +add_filter('give_import_delimiter_set', '__give_import_delimiter_set_callback', 10); |
|
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * Give unset the page id from the core setting data from the json files. |
@@ -111,17 +111,17 @@ discard block |
||
| 111 | 111 | * |
| 112 | 112 | * @return array $json_to_array |
| 113 | 113 | */ |
| 114 | -function give_import_core_settings_merge_pages( $json_to_array, $type ) { |
|
| 115 | - if ( 'merge' === $type ) { |
|
| 116 | - unset( $json_to_array['success_page'] ); |
|
| 117 | - unset( $json_to_array['failure_page'] ); |
|
| 118 | - unset( $json_to_array['history_page'] ); |
|
| 114 | +function give_import_core_settings_merge_pages($json_to_array, $type) { |
|
| 115 | + if ('merge' === $type) { |
|
| 116 | + unset($json_to_array['success_page']); |
|
| 117 | + unset($json_to_array['failure_page']); |
|
| 118 | + unset($json_to_array['history_page']); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | return $json_to_array; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | -add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_pages', 11, 2 ); |
|
| 124 | +add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_pages', 11, 2); |
|
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * Give check the image size from the core setting data from the json files. |
@@ -133,14 +133,14 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @return array $json_to_array |
| 135 | 135 | */ |
| 136 | -function give_import_core_settings_merge_image_size( $json_to_array, $type ) { |
|
| 137 | - if ( 'merge' === $type ) { |
|
| 136 | +function give_import_core_settings_merge_image_size($json_to_array, $type) { |
|
| 137 | + if ('merge' === $type) { |
|
| 138 | 138 | // Featured image sizes import under Display Options > Post Types > Featured Image Size. |
| 139 | - if ( 'enabled' === $json_to_array['form_featured_img'] ) { |
|
| 139 | + if ('enabled' === $json_to_array['form_featured_img']) { |
|
| 140 | 140 | $images_sizes = get_intermediate_image_sizes(); |
| 141 | 141 | |
| 142 | - if ( ! in_array( $json_to_array['featured_image_size'], $images_sizes ) ) { |
|
| 143 | - unset( $json_to_array['featured_image_size'] ); |
|
| 142 | + if ( ! in_array($json_to_array['featured_image_size'], $images_sizes)) { |
|
| 143 | + unset($json_to_array['featured_image_size']); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | return $json_to_array; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | -add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_image_size', 12, 2 ); |
|
| 151 | +add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_image_size', 12, 2); |
|
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | 154 | * Give upload the image logo from the core setting data from the json files. |
@@ -160,24 +160,24 @@ discard block |
||
| 160 | 160 | * |
| 161 | 161 | * @return array $json_to_array |
| 162 | 162 | */ |
| 163 | -function give_import_core_settings_merge_upload_image( $json_to_array, $type ) { |
|
| 164 | - if ( 'merge' === $type ) { |
|
| 163 | +function give_import_core_settings_merge_upload_image($json_to_array, $type) { |
|
| 164 | + if ('merge' === $type) { |
|
| 165 | 165 | // Emails > Email Settings > Logo. |
| 166 | - if ( ! empty( $json_to_array['email_logo'] ) ) { |
|
| 166 | + if ( ! empty($json_to_array['email_logo'])) { |
|
| 167 | 167 | |
| 168 | 168 | // Need to require these files. |
| 169 | - if ( ! function_exists( 'media_handle_upload' ) ) { |
|
| 170 | - require_once( ABSPATH . 'wp-admin/includes/image.php' ); |
|
| 171 | - require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
| 172 | - require_once( ABSPATH . 'wp-admin/includes/media.php' ); |
|
| 169 | + if ( ! function_exists('media_handle_upload')) { |
|
| 170 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
| 171 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
| 172 | + require_once(ABSPATH.'wp-admin/includes/media.php'); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | $url = $json_to_array['email_logo']; |
| 176 | - $new_url = media_sideload_image( $url, 0, null, 'src' ); |
|
| 177 | - if ( ! is_wp_error( $new_url ) ) { |
|
| 176 | + $new_url = media_sideload_image($url, 0, null, 'src'); |
|
| 177 | + if ( ! is_wp_error($new_url)) { |
|
| 178 | 178 | $json_to_array['email_logo'] = $new_url; |
| 179 | 179 | } else { |
| 180 | - unset( $json_to_array['email_logo'] ); |
|
| 180 | + unset($json_to_array['email_logo']); |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | return $json_to_array; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | -add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_upload_image', 13, 2 ); |
|
| 188 | +add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_upload_image', 13, 2); |
|
| 189 | 189 | |
| 190 | 190 | /** |
| 191 | 191 | * Give unset the license key from the core setting data from the json files. |
@@ -197,12 +197,12 @@ discard block |
||
| 197 | 197 | * |
| 198 | 198 | * @return array $json_to_array |
| 199 | 199 | */ |
| 200 | -function give_import_core_settings_merge_license_key( $json_to_array, $type ) { |
|
| 201 | - if ( 'merge' === $type ) { |
|
| 202 | - foreach ( $json_to_array as $key => $value ) { |
|
| 203 | - $is_license_key = strpos( '_license_key', $key ); |
|
| 204 | - if ( ! empty( $is_license_key ) ) { |
|
| 205 | - unset( $json_to_array[ $key ] ); |
|
| 200 | +function give_import_core_settings_merge_license_key($json_to_array, $type) { |
|
| 201 | + if ('merge' === $type) { |
|
| 202 | + foreach ($json_to_array as $key => $value) { |
|
| 203 | + $is_license_key = strpos('_license_key', $key); |
|
| 204 | + if ( ! empty($is_license_key)) { |
|
| 205 | + unset($json_to_array[$key]); |
|
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | return $json_to_array; |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | -add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_license_key', 14, 2 ); |
|
| 213 | +add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_license_key', 14, 2); |
|
| 214 | 214 | |
| 215 | 215 | /** |
| 216 | 216 | * Give merge the json data and setting data. |
@@ -223,16 +223,16 @@ discard block |
||
| 223 | 223 | * |
| 224 | 224 | * @return array $json_to_array |
| 225 | 225 | */ |
| 226 | -function give_import_core_settings_merge_data( $json_to_array, $type, $host_give_options ) { |
|
| 227 | - if ( 'merge' === $type ) { |
|
| 228 | - $json_to_array_merge = array_merge( $host_give_options, $json_to_array ); |
|
| 226 | +function give_import_core_settings_merge_data($json_to_array, $type, $host_give_options) { |
|
| 227 | + if ('merge' === $type) { |
|
| 228 | + $json_to_array_merge = array_merge($host_give_options, $json_to_array); |
|
| 229 | 229 | $json_to_array = $json_to_array_merge; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | return $json_to_array; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | -add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_data', 1000, 3 ); |
|
| 235 | +add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_data', 1000, 3); |
|
| 236 | 236 | |
| 237 | 237 | /** |
| 238 | 238 | * Backward Compatibility - Cleanup User Roles. |
@@ -243,11 +243,11 @@ discard block |
||
| 243 | 243 | * |
| 244 | 244 | * @return mixed |
| 245 | 245 | */ |
| 246 | -function give_bc_1817_cleanup_user_roles( $caps ){ |
|
| 246 | +function give_bc_1817_cleanup_user_roles($caps) { |
|
| 247 | 247 | |
| 248 | 248 | if ( |
| 249 | - ! give_has_upgrade_completed( 'v1817_cleanup_user_roles' ) && |
|
| 250 | - ! isset( $caps['view_give_payments'] ) |
|
| 249 | + ! give_has_upgrade_completed('v1817_cleanup_user_roles') && |
|
| 250 | + ! isset($caps['view_give_payments']) |
|
| 251 | 251 | ) { |
| 252 | 252 | give_v1817_process_cleanup_user_roles(); |
| 253 | 253 | } |
@@ -255,4 +255,4 @@ discard block |
||
| 255 | 255 | return $caps; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | -add_filter( 'user_has_cap', 'give_bc_1817_cleanup_user_roles' ); |
|
| 259 | 258 | \ No newline at end of file |
| 259 | +add_filter('user_has_cap', 'give_bc_1817_cleanup_user_roles'); |
|
| 260 | 260 | \ No newline at end of file |
@@ -10,13 +10,13 @@ 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 | |
| 17 | -if ( ! current_user_can( 'view_give_payments' ) ) { |
|
| 17 | +if ( ! current_user_can('view_give_payments')) { |
|
| 18 | 18 | wp_die( |
| 19 | - __( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array( |
|
| 19 | + __('Sorry, you are not allowed to access this page.', 'give'), __('Error', 'give'), array( |
|
| 20 | 20 | 'response' => 403, |
| 21 | 21 | ) |
| 22 | 22 | ); |
@@ -28,27 +28,27 @@ discard block |
||
| 28 | 28 | * @since 1.0 |
| 29 | 29 | * @return void |
| 30 | 30 | */ |
| 31 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
| 32 | - wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 31 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
| 32 | + wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // Setup the variables |
| 36 | -$payment_id = absint( $_GET['id'] ); |
|
| 37 | -$payment = new Give_Payment( $payment_id ); |
|
| 36 | +$payment_id = absint($_GET['id']); |
|
| 37 | +$payment = new Give_Payment($payment_id); |
|
| 38 | 38 | |
| 39 | 39 | // Sanity check... fail if donation ID is invalid |
| 40 | 40 | $payment_exists = $payment->ID; |
| 41 | -if ( empty( $payment_exists ) ) { |
|
| 42 | - wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 41 | +if (empty($payment_exists)) { |
|
| 42 | + wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $number = $payment->number; |
| 46 | 46 | $payment_meta = $payment->get_meta(); |
| 47 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
| 47 | +$transaction_id = esc_attr($payment->transaction_id); |
|
| 48 | 48 | $user_id = $payment->user_id; |
| 49 | 49 | $donor_id = $payment->customer_id; |
| 50 | -$payment_date = strtotime( $payment->date ); |
|
| 51 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
| 50 | +$payment_date = strtotime($payment->date); |
|
| 51 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
| 52 | 52 | $address = $payment->address; |
| 53 | 53 | $currency_code = $payment->currency; |
| 54 | 54 | $gateway = $payment->gateway; |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | <?php |
| 62 | 62 | printf( |
| 63 | 63 | /* translators: %s: donation number */ |
| 64 | - esc_html__( 'Donation %s', 'give' ), |
|
| 64 | + esc_html__('Donation %s', 'give'), |
|
| 65 | 65 | $number |
| 66 | 66 | ); |
| 67 | - if ( $payment_mode == 'test' ) { |
|
| 68 | - echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>'; |
|
| 67 | + if ($payment_mode == 'test') { |
|
| 68 | + echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>'; |
|
| 69 | 69 | } |
| 70 | 70 | ?> |
| 71 | 71 | </h1> |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @param int $payment_id Payment id. |
| 80 | 80 | */ |
| 81 | - do_action( 'give_view_order_details_before', $payment_id ); |
|
| 81 | + do_action('give_view_order_details_before', $payment_id); |
|
| 82 | 82 | ?> |
| 83 | 83 | |
| 84 | 84 | <hr class="wp-header-end"> |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @param int $payment_id Payment id. |
| 94 | 94 | */ |
| 95 | - do_action( 'give_view_order_details_form_top', $payment_id ); |
|
| 95 | + do_action('give_view_order_details_form_top', $payment_id); |
|
| 96 | 96 | ?> |
| 97 | 97 | <div id="poststuff"> |
| 98 | 98 | <div id="give-dashboard-widgets-wrap"> |
@@ -108,12 +108,12 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @param int $payment_id Payment id. |
| 110 | 110 | */ |
| 111 | - do_action( 'give_view_order_details_sidebar_before', $payment_id ); |
|
| 111 | + do_action('give_view_order_details_sidebar_before', $payment_id); |
|
| 112 | 112 | ?> |
| 113 | 113 | |
| 114 | 114 | <div id="give-order-update" class="postbox give-order-data"> |
| 115 | 115 | |
| 116 | - <h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3> |
|
| 116 | + <h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3> |
|
| 117 | 117 | |
| 118 | 118 | <div class="inside"> |
| 119 | 119 | <div class="give-admin-box"> |
@@ -126,33 +126,33 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @param int $payment_id Payment id. |
| 128 | 128 | */ |
| 129 | - do_action( 'give_view_order_details_totals_before', $payment_id ); |
|
| 129 | + do_action('give_view_order_details_totals_before', $payment_id); |
|
| 130 | 130 | ?> |
| 131 | 131 | |
| 132 | 132 | <div class="give-admin-box-inside"> |
| 133 | 133 | <p> |
| 134 | - <label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label> |
|
| 134 | + <label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label> |
|
| 135 | 135 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
| 136 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
| 137 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
| 136 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
| 137 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
| 138 | 138 | <?php endforeach; ?> |
| 139 | 139 | </select> |
| 140 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
| 140 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
| 141 | 141 | </p> |
| 142 | 142 | </div> |
| 143 | 143 | |
| 144 | 144 | <div class="give-admin-box-inside"> |
| 145 | 145 | <p> |
| 146 | - <label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label> |
|
| 147 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
| 146 | + <label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label> |
|
| 147 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
| 148 | 148 | </p> |
| 149 | 149 | </div> |
| 150 | 150 | |
| 151 | 151 | <div class="give-admin-box-inside"> |
| 152 | 152 | <p> |
| 153 | - <label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label> |
|
| 154 | - <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
| 155 | - <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
| 153 | + <label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label> |
|
| 154 | + <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
| 155 | + <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
| 156 | 156 | </p> |
| 157 | 157 | </div> |
| 158 | 158 | |
@@ -166,14 +166,14 @@ discard block |
||
| 166 | 166 | * |
| 167 | 167 | * @param int $payment_id Payment id. |
| 168 | 168 | */ |
| 169 | - do_action( 'give_view_order_details_update_inner', $payment_id ); |
|
| 169 | + do_action('give_view_order_details_update_inner', $payment_id); |
|
| 170 | 170 | ?> |
| 171 | 171 | |
| 172 | 172 | <div class="give-order-payment give-admin-box-inside"> |
| 173 | 173 | <p> |
| 174 | - <label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label> |
|
| 175 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
| 176 | - <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_donation_amount( $payment_id ), false, false ) ); ?>"/> |
|
| 174 | + <label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label> |
|
| 175 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
| 176 | + <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_donation_amount($payment_id), false, false)); ?>"/> |
|
| 177 | 177 | </p> |
| 178 | 178 | </div> |
| 179 | 179 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * |
| 186 | 186 | * @param int $payment_id Payment id. |
| 187 | 187 | */ |
| 188 | - do_action( 'give_view_order_details_totals_after', $payment_id ); |
|
| 188 | + do_action('give_view_order_details_totals_after', $payment_id); |
|
| 189 | 189 | ?> |
| 190 | 190 | |
| 191 | 191 | </div> |
@@ -203,14 +203,14 @@ discard block |
||
| 203 | 203 | * |
| 204 | 204 | * @param int $payment_id Payment id. |
| 205 | 205 | */ |
| 206 | - do_action( 'give_view_order_details_update_before', $payment_id ); |
|
| 206 | + do_action('give_view_order_details_update_before', $payment_id); |
|
| 207 | 207 | ?> |
| 208 | 208 | |
| 209 | 209 | <div id="major-publishing-actions"> |
| 210 | 210 | <div id="publishing-action"> |
| 211 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
| 211 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
| 212 | 212 | <?php |
| 213 | - if ( give_is_payment_complete( $payment_id ) ) { |
|
| 213 | + if (give_is_payment_complete($payment_id)) { |
|
| 214 | 214 | echo sprintf( |
| 215 | 215 | '<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>', |
| 216 | 216 | esc_url( |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | ) |
| 222 | 222 | ) |
| 223 | 223 | ), |
| 224 | - __( 'Resend Receipt', 'give' ) |
|
| 224 | + __('Resend Receipt', 'give') |
|
| 225 | 225 | ); |
| 226 | 226 | } |
| 227 | 227 | ?> |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | * |
| 238 | 238 | * @param int $payment_id Payment id. |
| 239 | 239 | */ |
| 240 | - do_action( 'give_view_order_details_update_after', $payment_id ); |
|
| 240 | + do_action('give_view_order_details_update_after', $payment_id); |
|
| 241 | 241 | ?> |
| 242 | 242 | |
| 243 | 243 | </div> |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | <div id="give-order-details" class="postbox give-order-data"> |
| 250 | 250 | |
| 251 | - <h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3> |
|
| 251 | + <h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3> |
|
| 252 | 252 | |
| 253 | 253 | <div class="inside"> |
| 254 | 254 | <div class="give-admin-box"> |
@@ -261,45 +261,45 @@ discard block |
||
| 261 | 261 | * |
| 262 | 262 | * @param int $payment_id Payment id. |
| 263 | 263 | */ |
| 264 | - do_action( 'give_view_order_details_payment_meta_before', $payment_id ); |
|
| 264 | + do_action('give_view_order_details_payment_meta_before', $payment_id); |
|
| 265 | 265 | |
| 266 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
| 267 | - if ( $gateway ) : |
|
| 266 | + $gateway = give_get_payment_gateway($payment_id); |
|
| 267 | + if ($gateway) : |
|
| 268 | 268 | ?> |
| 269 | 269 | <div class="give-order-gateway give-admin-box-inside"> |
| 270 | 270 | <p> |
| 271 | - <strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong> |
|
| 272 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
| 271 | + <strong><?php esc_html_e('Gateway:', 'give'); ?></strong> |
|
| 272 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
| 273 | 273 | </p> |
| 274 | 274 | </div> |
| 275 | 275 | <?php endif; ?> |
| 276 | 276 | |
| 277 | 277 | <div class="give-order-payment-key give-admin-box-inside"> |
| 278 | 278 | <p> |
| 279 | - <strong><?php esc_html_e( 'Key:', 'give' ); ?></strong> |
|
| 280 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
| 279 | + <strong><?php esc_html_e('Key:', 'give'); ?></strong> |
|
| 280 | + <?php echo give_get_payment_key($payment_id); ?> |
|
| 281 | 281 | </p> |
| 282 | 282 | </div> |
| 283 | 283 | |
| 284 | 284 | <div class="give-order-ip give-admin-box-inside"> |
| 285 | 285 | <p> |
| 286 | - <strong><?php esc_html_e( 'IP:', 'give' ); ?></strong> |
|
| 287 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
| 286 | + <strong><?php esc_html_e('IP:', 'give'); ?></strong> |
|
| 287 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
| 288 | 288 | </p> |
| 289 | 289 | </div> |
| 290 | 290 | |
| 291 | - <?php if ( $transaction_id ) : ?> |
|
| 291 | + <?php if ($transaction_id) : ?> |
|
| 292 | 292 | <div class="give-order-tx-id give-admin-box-inside"> |
| 293 | 293 | <p> |
| 294 | - <strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong> |
|
| 295 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
| 294 | + <strong><?php esc_html_e('Donation ID:', 'give'); ?></strong> |
|
| 295 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
| 296 | 296 | </p> |
| 297 | 297 | </div> |
| 298 | 298 | <?php endif; ?> |
| 299 | 299 | |
| 300 | 300 | <div class="give-admin-box-inside"> |
| 301 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?> |
|
| 302 | - <a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor »', 'give' ); ?></a> |
|
| 301 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?> |
|
| 302 | + <a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor »', 'give'); ?></a> |
|
| 303 | 303 | </p> |
| 304 | 304 | </div> |
| 305 | 305 | |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | * |
| 312 | 312 | * @param int $payment_id Payment id. |
| 313 | 313 | */ |
| 314 | - do_action( 'give_view_order_details_payment_meta_after', $payment_id ); |
|
| 314 | + do_action('give_view_order_details_payment_meta_after', $payment_id); |
|
| 315 | 315 | ?> |
| 316 | 316 | |
| 317 | 317 | </div> |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | * |
| 332 | 332 | * @param int $payment_id Payment id. |
| 333 | 333 | */ |
| 334 | - do_action( 'give_view_order_details_sidebar_after', $payment_id ); |
|
| 334 | + do_action('give_view_order_details_sidebar_after', $payment_id); |
|
| 335 | 335 | ?> |
| 336 | 336 | |
| 337 | 337 | </div> |
@@ -351,31 +351,31 @@ discard block |
||
| 351 | 351 | * |
| 352 | 352 | * @param int $payment_id Payment id. |
| 353 | 353 | */ |
| 354 | - do_action( 'give_view_order_details_main_before', $payment_id ); |
|
| 354 | + do_action('give_view_order_details_main_before', $payment_id); |
|
| 355 | 355 | ?> |
| 356 | 356 | |
| 357 | 357 | <?php $column_count = 'columns-3'; ?> |
| 358 | 358 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
| 359 | - <h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3> |
|
| 359 | + <h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3> |
|
| 360 | 360 | |
| 361 | 361 | <div class="inside"> |
| 362 | 362 | |
| 363 | 363 | <div class="column-container"> |
| 364 | 364 | <div class="column"> |
| 365 | 365 | <p> |
| 366 | - <strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
| 366 | + <strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br> |
|
| 367 | 367 | <?php |
| 368 | - if ( $payment_meta['form_id'] ) : |
|
| 368 | + if ($payment_meta['form_id']) : |
|
| 369 | 369 | printf( |
| 370 | 370 | '<a href="%1$s">#%2$s</a>', |
| 371 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
| 371 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
| 372 | 372 | $payment_meta['form_id'] |
| 373 | 373 | ); |
| 374 | 374 | endif; |
| 375 | 375 | ?> |
| 376 | 376 | </p> |
| 377 | 377 | <p> |
| 378 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
| 378 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
| 379 | 379 | <?php |
| 380 | 380 | echo Give()->html->forms_dropdown( |
| 381 | 381 | array( |
@@ -391,21 +391,21 @@ discard block |
||
| 391 | 391 | </div> |
| 392 | 392 | <div class="column"> |
| 393 | 393 | <p> |
| 394 | - <strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br> |
|
| 395 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
| 394 | + <strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br> |
|
| 395 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
| 396 | 396 | </p> |
| 397 | 397 | <p> |
| 398 | - <strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br> |
|
| 398 | + <strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br> |
|
| 399 | 399 | <span class="give-donation-level"> |
| 400 | 400 | <?php |
| 401 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
| 402 | - if ( empty( $var_prices ) ) { |
|
| 403 | - esc_html_e( 'n/a', 'give' ); |
|
| 401 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
| 402 | + if (empty($var_prices)) { |
|
| 403 | + esc_html_e('n/a', 'give'); |
|
| 404 | 404 | } else { |
| 405 | 405 | $prices_atts = array(); |
| 406 | - if ( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
| 407 | - foreach ( $variable_prices as $variable_price ) { |
|
| 408 | - $prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ); |
|
| 406 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
| 407 | + foreach ($variable_prices as $variable_price) { |
|
| 408 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false)); |
|
| 409 | 409 | } |
| 410 | 410 | } |
| 411 | 411 | // Variable price dropdown options. |
@@ -414,12 +414,12 @@ discard block |
||
| 414 | 414 | 'name' => 'give-variable-price', |
| 415 | 415 | 'chosen' => true, |
| 416 | 416 | 'show_option_all' => '', |
| 417 | - 'show_option_none' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' ) : '' ), |
|
| 418 | - 'select_atts' => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ), |
|
| 417 | + 'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''), |
|
| 418 | + 'select_atts' => 'data-prices='.esc_attr(wp_json_encode($prices_atts)), |
|
| 419 | 419 | 'selected' => $payment_meta['price_id'], |
| 420 | 420 | ); |
| 421 | 421 | // Render variable prices select tag html. |
| 422 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
| 422 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
| 423 | 423 | } |
| 424 | 424 | ?> |
| 425 | 425 | </span> |
@@ -427,8 +427,8 @@ discard block |
||
| 427 | 427 | </div> |
| 428 | 428 | <div class="column"> |
| 429 | 429 | <p> |
| 430 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
| 431 | - <?php echo give_currency_filter( give_format_amount( $payment->total, array( 'sanitize' => false ) ), give_get_payment_currency_code( $payment->ID ) ); ?> |
|
| 430 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
| 431 | + <?php echo give_currency_filter(give_format_amount($payment->total, array('sanitize' => false)), give_get_payment_currency_code($payment->ID)); ?> |
|
| 432 | 432 | </p> |
| 433 | 433 | <p> |
| 434 | 434 | <?php |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | * |
| 442 | 442 | * @param int $payment_id Payment id. |
| 443 | 443 | */ |
| 444 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
| 444 | + do_action('give_donation_details_thead_before', $payment_id); |
|
| 445 | 445 | |
| 446 | 446 | |
| 447 | 447 | /** |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | * |
| 454 | 454 | * @param int $payment_id Payment id. |
| 455 | 455 | */ |
| 456 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
| 456 | + do_action('give_donation_details_thead_after', $payment_id); |
|
| 457 | 457 | |
| 458 | 458 | /** |
| 459 | 459 | * Fires in order details page, in the donation-information metabox, before the body elements. |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | * |
| 465 | 465 | * @param int $payment_id Payment id. |
| 466 | 466 | */ |
| 467 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
| 467 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
| 468 | 468 | |
| 469 | 469 | /** |
| 470 | 470 | * Fires in order details page, in the donation-information metabox, after the body elements. |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | * |
| 476 | 476 | * @param int $payment_id Payment id. |
| 477 | 477 | */ |
| 478 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
| 478 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
| 479 | 479 | ?> |
| 480 | 480 | </p> |
| 481 | 481 | </div> |
@@ -495,58 +495,58 @@ discard block |
||
| 495 | 495 | * |
| 496 | 496 | * @param int $payment_id Payment id. |
| 497 | 497 | */ |
| 498 | - do_action( 'give_view_order_details_files_after', $payment_id ); |
|
| 498 | + do_action('give_view_order_details_files_after', $payment_id); |
|
| 499 | 499 | ?> |
| 500 | 500 | |
| 501 | 501 | <div id="give-donor-details" class="postbox"> |
| 502 | - <h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3> |
|
| 502 | + <h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3> |
|
| 503 | 503 | |
| 504 | 504 | <div class="inside"> |
| 505 | 505 | |
| 506 | - <?php $donor = new Give_Donor( $donor_id ); ?> |
|
| 506 | + <?php $donor = new Give_Donor($donor_id); ?> |
|
| 507 | 507 | |
| 508 | 508 | <div class="column-container donor-info"> |
| 509 | 509 | <div class="column"> |
| 510 | 510 | <p> |
| 511 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
| 511 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
| 512 | 512 | <?php |
| 513 | - if ( ! empty( $donor->id ) ) { |
|
| 513 | + if ( ! empty($donor->id)) { |
|
| 514 | 514 | printf( |
| 515 | 515 | '<a href="%1$s">#%2$s</a>', |
| 516 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ), |
|
| 516 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id), |
|
| 517 | 517 | $donor->id |
| 518 | 518 | ); |
| 519 | 519 | } |
| 520 | 520 | ?> |
| 521 | 521 | </p> |
| 522 | 522 | <p> |
| 523 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
| 524 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ); ?> |
|
| 523 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
| 524 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)); ?> |
|
| 525 | 525 | </p> |
| 526 | 526 | </div> |
| 527 | 527 | <div class="column"> |
| 528 | 528 | <p> |
| 529 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
| 529 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
| 530 | 530 | <?php |
| 531 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
| 532 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
| 531 | + $donor_billing_name = give_get_donor_name_by($payment_id, 'donation'); |
|
| 532 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
| 533 | 533 | |
| 534 | 534 | // Check whether the donor name and WP_User name is same or not. |
| 535 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
| 536 | - echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
| 535 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
| 536 | + echo $donor_billing_name.' (<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>)'; |
|
| 537 | 537 | } else { |
| 538 | 538 | echo $donor_name; |
| 539 | 539 | } |
| 540 | 540 | ?> |
| 541 | 541 | </p> |
| 542 | 542 | <p> |
| 543 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
| 543 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
| 544 | 544 | <?php echo $donor->email; ?> |
| 545 | 545 | </p> |
| 546 | 546 | </div> |
| 547 | 547 | <div class="column"> |
| 548 | 548 | <p> |
| 549 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
| 549 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
| 550 | 550 | <?php |
| 551 | 551 | echo Give()->html->donor_dropdown( |
| 552 | 552 | array( |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | ?> |
| 558 | 558 | </p> |
| 559 | 559 | <p> |
| 560 | - <a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a> |
|
| 560 | + <a href="#new" class="give-payment-new-donor"><?php esc_html_e('Create New Donor', 'give'); ?></a> |
|
| 561 | 561 | </p> |
| 562 | 562 | </div> |
| 563 | 563 | </div> |
@@ -565,13 +565,13 @@ discard block |
||
| 565 | 565 | <div class="column-container new-donor" style="display: none"> |
| 566 | 566 | <div class="column"> |
| 567 | 567 | <p> |
| 568 | - <label for="give-new-donor-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label> |
|
| 568 | + <label for="give-new-donor-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label> |
|
| 569 | 569 | <input id="give-new-donor-name" type="text" name="give-new-donor-name" value="" class="medium-text"/> |
| 570 | 570 | </p> |
| 571 | 571 | </div> |
| 572 | 572 | <div class="column"> |
| 573 | 573 | <p> |
| 574 | - <label for="give-new-donor-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label> |
|
| 574 | + <label for="give-new-donor-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label> |
|
| 575 | 575 | <input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/> |
| 576 | 576 | </p> |
| 577 | 577 | </div> |
@@ -579,9 +579,9 @@ discard block |
||
| 579 | 579 | <p> |
| 580 | 580 | <input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/> |
| 581 | 581 | <input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/> |
| 582 | - <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
| 582 | + <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
| 583 | 583 | <br> |
| 584 | - <em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
| 584 | + <em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
| 585 | 585 | </p> |
| 586 | 586 | </div> |
| 587 | 587 | </div> |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | * @param array $payment_meta Payment meta. |
| 598 | 598 | * @param array $user_info User information. |
| 599 | 599 | */ |
| 600 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
| 600 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
| 601 | 601 | |
| 602 | 602 | /** |
| 603 | 603 | * Fires on the donation details page, in the donor-details metabox. |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | * |
| 607 | 607 | * @param int $payment_id Payment id. |
| 608 | 608 | */ |
| 609 | - do_action( 'give_payment_view_details', $payment_id ); |
|
| 609 | + do_action('give_payment_view_details', $payment_id); |
|
| 610 | 610 | ?> |
| 611 | 611 | |
| 612 | 612 | </div> |
@@ -622,11 +622,11 @@ discard block |
||
| 622 | 622 | * |
| 623 | 623 | * @param int $payment_id Payment id. |
| 624 | 624 | */ |
| 625 | - do_action( 'give_view_order_details_billing_before', $payment_id ); |
|
| 625 | + do_action('give_view_order_details_billing_before', $payment_id); |
|
| 626 | 626 | ?> |
| 627 | 627 | |
| 628 | 628 | <div id="give-billing-details" class="postbox"> |
| 629 | - <h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3> |
|
| 629 | + <h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3> |
|
| 630 | 630 | |
| 631 | 631 | <div class="inside"> |
| 632 | 632 | |
@@ -636,9 +636,9 @@ discard block |
||
| 636 | 636 | <div class="data column-container"> |
| 637 | 637 | |
| 638 | 638 | <?php |
| 639 | - $address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() ); |
|
| 639 | + $address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country()); |
|
| 640 | 640 | |
| 641 | - $address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' ); |
|
| 641 | + $address['state'] = ( ! empty($address['state']) ? $address['state'] : ''); |
|
| 642 | 642 | |
| 643 | 643 | // Get the country list that does not have any states init. |
| 644 | 644 | $no_states_country = give_no_states_country_list(); |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | |
| 647 | 647 | <div class="row"> |
| 648 | 648 | <div id="give-order-address-country-wrap"> |
| 649 | - <label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
| 649 | + <label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label> |
|
| 650 | 650 | <?php |
| 651 | 651 | echo Give()->html->select( |
| 652 | 652 | array( |
@@ -656,8 +656,8 @@ discard block |
||
| 656 | 656 | 'show_option_all' => false, |
| 657 | 657 | 'show_option_none' => false, |
| 658 | 658 | 'chosen' => true, |
| 659 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
| 660 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
| 659 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
| 660 | + 'data' => array('search-type' => 'no_ajax'), |
|
| 661 | 661 | ) |
| 662 | 662 | ); |
| 663 | 663 | ?> |
@@ -666,35 +666,35 @@ discard block |
||
| 666 | 666 | |
| 667 | 667 | <div class="row"> |
| 668 | 668 | <div class="give-wrap-address-line1"> |
| 669 | - <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
| 670 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
| 669 | + <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
| 670 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
| 671 | 671 | </div> |
| 672 | 672 | </div> |
| 673 | 673 | |
| 674 | 674 | <div class="row"> |
| 675 | 675 | <div class="give-wrap-address-line2"> |
| 676 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
| 677 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
| 676 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
| 677 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
| 678 | 678 | </div> |
| 679 | 679 | </div> |
| 680 | 680 | |
| 681 | 681 | <div class="row"> |
| 682 | 682 | <div class="give-wrap-address-city"> |
| 683 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
| 684 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
| 683 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
| 684 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
| 685 | 685 | </div> |
| 686 | 686 | </div> |
| 687 | 687 | |
| 688 | 688 | <?php |
| 689 | - $state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false ); |
|
| 689 | + $state_exists = ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? true : false); |
|
| 690 | 690 | ?> |
| 691 | 691 | <div class="row"> |
| 692 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state"> |
|
| 693 | - <div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>"> |
|
| 694 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
| 692 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-state"> |
|
| 693 | + <div id="give-order-address-state-wrap" class="<?php echo( ! empty($state_exists) ? 'give-hidden' : ''); ?>"> |
|
| 694 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
| 695 | 695 | <?php |
| 696 | - $states = give_get_states( $address['country'] ); |
|
| 697 | - if ( ! empty( $states ) ) { |
|
| 696 | + $states = give_get_states($address['country']); |
|
| 697 | + if ( ! empty($states)) { |
|
| 698 | 698 | echo Give()->html->select( |
| 699 | 699 | array( |
| 700 | 700 | 'options' => $states, |
@@ -703,23 +703,23 @@ discard block |
||
| 703 | 703 | 'show_option_all' => false, |
| 704 | 704 | 'show_option_none' => false, |
| 705 | 705 | 'chosen' => true, |
| 706 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
| 707 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
| 706 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
| 707 | + 'data' => array('search-type' => 'no_ajax'), |
|
| 708 | 708 | ) |
| 709 | 709 | ); |
| 710 | 710 | } else { |
| 711 | 711 | ?> |
| 712 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
| 712 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
| 713 | 713 | <?php |
| 714 | 714 | } |
| 715 | 715 | ?> |
| 716 | 716 | </div> |
| 717 | 717 | </div> |
| 718 | 718 | |
| 719 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip"> |
|
| 719 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-zip"> |
|
| 720 | 720 | <div class="give-wrap-address-zip"> |
| 721 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
| 722 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
| 721 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
| 722 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
| 723 | 723 | </div> |
| 724 | 724 | </div> |
| 725 | 725 | </div> |
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | * |
| 739 | 739 | * @param int $payment_id Payment id. |
| 740 | 740 | */ |
| 741 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
| 741 | + do_action('give_payment_billing_details', $payment_id); |
|
| 742 | 742 | ?> |
| 743 | 743 | |
| 744 | 744 | </div> |
@@ -754,33 +754,33 @@ discard block |
||
| 754 | 754 | * |
| 755 | 755 | * @param int $payment_id Payment id. |
| 756 | 756 | */ |
| 757 | - do_action( 'give_view_order_details_billing_after', $payment_id ); |
|
| 757 | + do_action('give_view_order_details_billing_after', $payment_id); |
|
| 758 | 758 | ?> |
| 759 | 759 | |
| 760 | 760 | <div id="give-payment-notes" class="postbox"> |
| 761 | - <h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3> |
|
| 761 | + <h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3> |
|
| 762 | 762 | |
| 763 | 763 | <div class="inside"> |
| 764 | 764 | <div id="give-payment-notes-inner"> |
| 765 | 765 | <?php |
| 766 | - $notes = give_get_payment_notes( $payment_id ); |
|
| 767 | - if ( ! empty( $notes ) ) { |
|
| 766 | + $notes = give_get_payment_notes($payment_id); |
|
| 767 | + if ( ! empty($notes)) { |
|
| 768 | 768 | $no_notes_display = ' style="display:none;"'; |
| 769 | - foreach ( $notes as $note ) : |
|
| 769 | + foreach ($notes as $note) : |
|
| 770 | 770 | |
| 771 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
| 771 | + echo give_get_payment_note_html($note, $payment_id); |
|
| 772 | 772 | |
| 773 | 773 | endforeach; |
| 774 | 774 | } else { |
| 775 | 775 | $no_notes_display = ''; |
| 776 | 776 | } |
| 777 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; |
|
| 777 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; |
|
| 778 | 778 | ?> |
| 779 | 779 | </div> |
| 780 | 780 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
| 781 | 781 | |
| 782 | 782 | <div class="give-clearfix"> |
| 783 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button> |
|
| 783 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button> |
|
| 784 | 784 | </div> |
| 785 | 785 | |
| 786 | 786 | </div> |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | * |
| 797 | 797 | * @param int $payment_id Payment id. |
| 798 | 798 | */ |
| 799 | - do_action( 'give_view_order_details_main_after', $payment_id ); |
|
| 799 | + do_action('give_view_order_details_main_after', $payment_id); |
|
| 800 | 800 | ?> |
| 801 | 801 | |
| 802 | 802 | </div> |
@@ -818,11 +818,11 @@ discard block |
||
| 818 | 818 | * |
| 819 | 819 | * @param int $payment_id Payment id. |
| 820 | 820 | */ |
| 821 | - do_action( 'give_view_order_details_form_bottom', $payment_id ); |
|
| 821 | + do_action('give_view_order_details_form_bottom', $payment_id); |
|
| 822 | 822 | |
| 823 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
| 823 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
| 824 | 824 | ?> |
| 825 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
| 825 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
| 826 | 826 | <input type="hidden" name="give_action" value="update_payment_details"/> |
| 827 | 827 | </form> |
| 828 | 828 | <?php |
@@ -833,6 +833,6 @@ discard block |
||
| 833 | 833 | * |
| 834 | 834 | * @param int $payment_id Payment id. |
| 835 | 835 | */ |
| 836 | - do_action( 'give_view_order_details_after', $payment_id ); |
|
| 836 | + do_action('give_view_order_details_after', $payment_id); |
|
| 837 | 837 | ?> |
| 838 | 838 | </div><!-- /.wrap --> |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -25,52 +25,52 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | -function give_update_payment_details( $data ) { |
|
| 28 | +function give_update_payment_details($data) { |
|
| 29 | 29 | |
| 30 | - if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) { |
|
| 31 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 30 | + if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) { |
|
| 31 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - check_admin_referer( 'give_update_payment_details_nonce' ); |
|
| 34 | + check_admin_referer('give_update_payment_details_nonce'); |
|
| 35 | 35 | |
| 36 | 36 | // Retrieve the payment ID. |
| 37 | - $payment_id = absint( $data['give_payment_id'] ); |
|
| 37 | + $payment_id = absint($data['give_payment_id']); |
|
| 38 | 38 | |
| 39 | 39 | /* @var Give_Payment $payment */ |
| 40 | - $payment = new Give_Payment( $payment_id ); |
|
| 40 | + $payment = new Give_Payment($payment_id); |
|
| 41 | 41 | |
| 42 | 42 | // Retrieve existing payment meta. |
| 43 | 43 | $meta = $payment->get_meta(); |
| 44 | 44 | $user_info = $payment->user_info; |
| 45 | 45 | |
| 46 | 46 | $status = $data['give-payment-status']; |
| 47 | - $date = sanitize_text_field( $data['give-payment-date'] ); |
|
| 48 | - $hour = sanitize_text_field( $data['give-payment-time-hour'] ); |
|
| 47 | + $date = sanitize_text_field($data['give-payment-date']); |
|
| 48 | + $hour = sanitize_text_field($data['give-payment-time-hour']); |
|
| 49 | 49 | |
| 50 | 50 | // Restrict to our high and low. |
| 51 | - if ( $hour > 23 ) { |
|
| 51 | + if ($hour > 23) { |
|
| 52 | 52 | $hour = 23; |
| 53 | - } elseif ( $hour < 0 ) { |
|
| 53 | + } elseif ($hour < 0) { |
|
| 54 | 54 | $hour = 00; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $minute = sanitize_text_field( $data['give-payment-time-min'] ); |
|
| 57 | + $minute = sanitize_text_field($data['give-payment-time-min']); |
|
| 58 | 58 | |
| 59 | 59 | // Restrict to our high and low. |
| 60 | - if ( $minute > 59 ) { |
|
| 60 | + if ($minute > 59) { |
|
| 61 | 61 | $minute = 59; |
| 62 | - } elseif ( $minute < 0 ) { |
|
| 62 | + } elseif ($minute < 0) { |
|
| 63 | 63 | $minute = 00; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - $address = give_clean( $data['give-payment-address'][0] ); |
|
| 66 | + $address = give_clean($data['give-payment-address'][0]); |
|
| 67 | 67 | |
| 68 | 68 | $curr_total = $payment->total; |
| 69 | - $new_total = give_maybe_sanitize_amount( ( ! empty( $data['give-payment-total'] ) ? $data['give-payment-total'] : 0 ) ); |
|
| 70 | - $date = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00'; |
|
| 69 | + $new_total = give_maybe_sanitize_amount(( ! empty($data['give-payment-total']) ? $data['give-payment-total'] : 0)); |
|
| 70 | + $date = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00'; |
|
| 71 | 71 | |
| 72 | - $curr_donor_id = sanitize_text_field( $data['give-current-donor'] ); |
|
| 73 | - $new_donor_id = sanitize_text_field( $data['donor-id'] ); |
|
| 72 | + $curr_donor_id = sanitize_text_field($data['give-current-donor']); |
|
| 73 | + $new_donor_id = sanitize_text_field($data['donor-id']); |
|
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * Fires before updating edited donation. |
@@ -80,100 +80,100 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @param int $payment_id The ID of the payment. |
| 82 | 82 | */ |
| 83 | - do_action( 'give_update_edited_donation', $payment_id ); |
|
| 83 | + do_action('give_update_edited_donation', $payment_id); |
|
| 84 | 84 | |
| 85 | 85 | $payment->date = $date; |
| 86 | 86 | $updated = $payment->save(); |
| 87 | 87 | |
| 88 | - if ( 0 === $updated ) { |
|
| 89 | - wp_die( esc_html__( 'Error Updating Donation.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 88 | + if (0 === $updated) { |
|
| 89 | + wp_die(esc_html__('Error Updating Donation.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $donor_changed = false; |
| 93 | 93 | |
| 94 | - if ( isset( $data['give-new-donor'] ) && $data['give-new-donor'] == '1' ) { |
|
| 94 | + if (isset($data['give-new-donor']) && $data['give-new-donor'] == '1') { |
|
| 95 | 95 | |
| 96 | - $email = isset( $data['give-new-donor-email'] ) ? sanitize_text_field( $data['give-new-donor-email'] ) : ''; |
|
| 97 | - $names = isset( $data['give-new-donor-name'] ) ? sanitize_text_field( $data['give-new-donor-name'] ) : ''; |
|
| 96 | + $email = isset($data['give-new-donor-email']) ? sanitize_text_field($data['give-new-donor-email']) : ''; |
|
| 97 | + $names = isset($data['give-new-donor-name']) ? sanitize_text_field($data['give-new-donor-name']) : ''; |
|
| 98 | 98 | |
| 99 | - if ( empty( $email ) || empty( $names ) ) { |
|
| 100 | - wp_die( esc_html__( 'New donors require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 99 | + if (empty($email) || empty($names)) { |
|
| 100 | + wp_die(esc_html__('New donors require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $donor = new Give_Donor( $email ); |
|
| 104 | - if ( empty( $donor->id ) ) { |
|
| 105 | - $donor_data = array( 'name' => $names, 'email' => $email ); |
|
| 106 | - $user_id = email_exists( $email ); |
|
| 107 | - if ( false !== $user_id ) { |
|
| 103 | + $donor = new Give_Donor($email); |
|
| 104 | + if (empty($donor->id)) { |
|
| 105 | + $donor_data = array('name' => $names, 'email' => $email); |
|
| 106 | + $user_id = email_exists($email); |
|
| 107 | + if (false !== $user_id) { |
|
| 108 | 108 | $donor_data['user_id'] = $user_id; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if ( ! $donor->create( $donor_data ) ) { |
|
| 111 | + if ( ! $donor->create($donor_data)) { |
|
| 112 | 112 | // Failed to crete the new donor, assume the previous donor. |
| 113 | 113 | $donor_changed = false; |
| 114 | - $donor = new Give_Donor( $curr_donor_id ); |
|
| 115 | - give_set_error( 'give-payment-new-donor-fail', __( 'Error creating new donor.', 'give' ) ); |
|
| 114 | + $donor = new Give_Donor($curr_donor_id); |
|
| 115 | + give_set_error('give-payment-new-donor-fail', __('Error creating new donor.', 'give')); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | $new_donor_id = $donor->id; |
| 120 | 120 | |
| 121 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
| 121 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
| 122 | 122 | |
| 123 | 123 | $donor_changed = true; |
| 124 | 124 | |
| 125 | - } elseif ( $curr_donor_id !== $new_donor_id ) { |
|
| 125 | + } elseif ($curr_donor_id !== $new_donor_id) { |
|
| 126 | 126 | |
| 127 | - $donor = new Give_Donor( $new_donor_id ); |
|
| 127 | + $donor = new Give_Donor($new_donor_id); |
|
| 128 | 128 | $email = $donor->email; |
| 129 | 129 | $names = $donor->name; |
| 130 | 130 | |
| 131 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
| 131 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
| 132 | 132 | |
| 133 | 133 | $donor_changed = true; |
| 134 | 134 | |
| 135 | 135 | } else { |
| 136 | - $donor = new Give_Donor( $curr_donor_id ); |
|
| 136 | + $donor = new Give_Donor($curr_donor_id); |
|
| 137 | 137 | $email = $donor->email; |
| 138 | 138 | $names = $donor->name; |
| 139 | 139 | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if ( $donor_changed ) { |
|
| 142 | + if ($donor_changed) { |
|
| 143 | 143 | |
| 144 | 144 | // Setup first and last name from input values. |
| 145 | - $names = explode( ' ', $names ); |
|
| 146 | - $first_name = ! empty( $names[0] ) ? $names[0] : ''; |
|
| 145 | + $names = explode(' ', $names); |
|
| 146 | + $first_name = ! empty($names[0]) ? $names[0] : ''; |
|
| 147 | 147 | $last_name = ''; |
| 148 | - if ( ! empty( $names[1] ) ) { |
|
| 149 | - unset( $names[0] ); |
|
| 150 | - $last_name = implode( ' ', $names ); |
|
| 148 | + if ( ! empty($names[1])) { |
|
| 149 | + unset($names[0]); |
|
| 150 | + $last_name = implode(' ', $names); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $payment->first_name = $first_name; |
| 154 | 154 | $payment->last_name = $last_name; |
| 155 | 155 | |
| 156 | 156 | // Remove the stats and payment from the previous donor and attach it to the new donor. |
| 157 | - $previous_donor->remove_payment( $payment_id, false ); |
|
| 158 | - $donor->attach_payment( $payment_id, false ); |
|
| 157 | + $previous_donor->remove_payment($payment_id, false); |
|
| 158 | + $donor->attach_payment($payment_id, false); |
|
| 159 | 159 | |
| 160 | - if ( 'publish' == $status ) { |
|
| 160 | + if ('publish' == $status) { |
|
| 161 | 161 | |
| 162 | 162 | // Reduce previous user donation count and amount. |
| 163 | 163 | $previous_donor->decrease_donation_count(); |
| 164 | - $previous_donor->decrease_value( $curr_total ); |
|
| 164 | + $previous_donor->decrease_value($curr_total); |
|
| 165 | 165 | |
| 166 | 166 | // If donation was completed adjust stats of new donors. |
| 167 | 167 | $donor->increase_purchase_count(); |
| 168 | - $donor->increase_value( $new_total ); |
|
| 168 | + $donor->increase_value($new_total); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | $payment->customer_id = $donor->id; |
| 172 | 172 | } else { |
| 173 | 173 | |
| 174 | - if ( 'publish' === $status ) { |
|
| 174 | + if ('publish' === $status) { |
|
| 175 | 175 | // Update user donation stat. |
| 176 | - $donor->update_donation_value( $curr_total, $new_total ); |
|
| 176 | + $donor->update_donation_value($curr_total, $new_total); |
|
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
@@ -184,10 +184,10 @@ discard block |
||
| 184 | 184 | $payment->total = $new_total; |
| 185 | 185 | |
| 186 | 186 | // Check for payment notes. |
| 187 | - if ( ! empty( $data['give-payment-note'] ) ) { |
|
| 187 | + if ( ! empty($data['give-payment-note'])) { |
|
| 188 | 188 | |
| 189 | - $note = wp_kses( $data['give-payment-note'], array() ); |
|
| 190 | - give_insert_payment_note( $payment_id, $note ); |
|
| 189 | + $note = wp_kses($data['give-payment-note'], array()); |
|
| 190 | + give_insert_payment_note($payment_id, $note); |
|
| 191 | 191 | |
| 192 | 192 | } |
| 193 | 193 | |
@@ -195,17 +195,17 @@ discard block |
||
| 195 | 195 | $payment->status = $status; |
| 196 | 196 | |
| 197 | 197 | // Adjust total store earnings if the payment total has been changed. |
| 198 | - if ( $new_total !== $curr_total && 'publish' == $status ) { |
|
| 198 | + if ($new_total !== $curr_total && 'publish' == $status) { |
|
| 199 | 199 | |
| 200 | - if ( $new_total > $curr_total ) { |
|
| 200 | + if ($new_total > $curr_total) { |
|
| 201 | 201 | // Increase if our new total is higher. |
| 202 | 202 | $difference = $new_total - $curr_total; |
| 203 | - give_increase_total_earnings( $difference ); |
|
| 203 | + give_increase_total_earnings($difference); |
|
| 204 | 204 | |
| 205 | - } elseif ( $curr_total > $new_total ) { |
|
| 205 | + } elseif ($curr_total > $new_total) { |
|
| 206 | 206 | // Decrease if our new total is lower. |
| 207 | 207 | $difference = $curr_total - $new_total; |
| 208 | - give_decrease_total_earnings( $difference ); |
|
| 208 | + give_decrease_total_earnings($difference); |
|
| 209 | 209 | |
| 210 | 210 | } |
| 211 | 211 | } |
@@ -213,16 +213,16 @@ discard block |
||
| 213 | 213 | $payment->save(); |
| 214 | 214 | |
| 215 | 215 | // Get new give form ID. |
| 216 | - $new_form_id = absint( $data['give-payment-form-select'] ); |
|
| 217 | - $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) ); |
|
| 216 | + $new_form_id = absint($data['give-payment-form-select']); |
|
| 217 | + $current_form_id = absint($payment->get_meta('_give_payment_form_id')); |
|
| 218 | 218 | |
| 219 | 219 | // We are adding payment transfer code in last to remove any conflict with above functionality. |
| 220 | 220 | // For example: above code will automatically handle form stat (increase/decrease) when payment status changes. |
| 221 | 221 | // Check if user want to transfer current payment to new give form id. |
| 222 | - if ( $new_form_id && $new_form_id != $current_form_id ) { |
|
| 222 | + if ($new_form_id && $new_form_id != $current_form_id) { |
|
| 223 | 223 | |
| 224 | 224 | // Get new give form title. |
| 225 | - $new_form_title = get_the_title( $new_form_id ); |
|
| 225 | + $new_form_title = get_the_title($new_form_id); |
|
| 226 | 226 | |
| 227 | 227 | // Update new give form data in payment data. |
| 228 | 228 | $payment_meta = $payment->get_meta(); |
@@ -230,43 +230,43 @@ discard block |
||
| 230 | 230 | $payment_meta['form_id'] = $new_form_id; |
| 231 | 231 | |
| 232 | 232 | // Update price id post meta data for set donation form. |
| 233 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
| 233 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
| 234 | 234 | $payment_meta['price_id'] = ''; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | // Update payment give form meta data. |
| 238 | - $payment->update_meta( '_give_payment_form_id', $new_form_id ); |
|
| 239 | - $payment->update_meta( '_give_payment_form_title', $new_form_title ); |
|
| 240 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
| 238 | + $payment->update_meta('_give_payment_form_id', $new_form_id); |
|
| 239 | + $payment->update_meta('_give_payment_form_title', $new_form_title); |
|
| 240 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
| 241 | 241 | |
| 242 | 242 | // Update price id payment metadata. |
| 243 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
| 244 | - $payment->update_meta( '_give_payment_price_id', '' ); |
|
| 243 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
| 244 | + $payment->update_meta('_give_payment_price_id', ''); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | // If donation was completed, adjust stats of forms. |
| 248 | - if ( 'publish' == $status ) { |
|
| 248 | + if ('publish' == $status) { |
|
| 249 | 249 | |
| 250 | 250 | // Decrease sale of old give form. For other payment status. |
| 251 | - $current_form = new Give_Donate_Form( $current_form_id ); |
|
| 251 | + $current_form = new Give_Donate_Form($current_form_id); |
|
| 252 | 252 | $current_form->decrease_sales(); |
| 253 | - $current_form->decrease_earnings( $curr_total ); |
|
| 253 | + $current_form->decrease_earnings($curr_total); |
|
| 254 | 254 | |
| 255 | 255 | // Increase sale of new give form. |
| 256 | - $new_form = new Give_Donate_Form( $new_form_id ); |
|
| 256 | + $new_form = new Give_Donate_Form($new_form_id); |
|
| 257 | 257 | $new_form->increase_sales(); |
| 258 | - $new_form->increase_earnings( $new_total ); |
|
| 258 | + $new_form->increase_earnings($new_total); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | // Re setup payment to update new meta value in object. |
| 262 | - $payment->update_payment_setup( $payment->ID ); |
|
| 262 | + $payment->update_payment_setup($payment->ID); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | // Update price id if current form is variable form. |
| 266 | 266 | /* @var Give_Donate_Form $form */ |
| 267 | - $form = new Give_Donate_Form( $payment->form_id ); |
|
| 267 | + $form = new Give_Donate_Form($payment->form_id); |
|
| 268 | 268 | |
| 269 | - if ( isset( $data['give-variable-price'] ) && $form->has_variable_prices() ) { |
|
| 269 | + if (isset($data['give-variable-price']) && $form->has_variable_prices()) { |
|
| 270 | 270 | |
| 271 | 271 | // Get payment meta data. |
| 272 | 272 | $payment_meta = $payment->get_meta(); |
@@ -275,9 +275,9 @@ discard block |
||
| 275 | 275 | $price_id = ''; |
| 276 | 276 | |
| 277 | 277 | // Get price info |
| 278 | - if( 0 <= $data['give-variable-price'] ) { |
|
| 279 | - foreach ( $form->prices as $variable_price ) { |
|
| 280 | - if( $new_total === give_maybe_sanitize_amount( $variable_price['_give_amount'] ) ) { |
|
| 278 | + if (0 <= $data['give-variable-price']) { |
|
| 279 | + foreach ($form->prices as $variable_price) { |
|
| 280 | + if ($new_total === give_maybe_sanitize_amount($variable_price['_give_amount'])) { |
|
| 281 | 281 | $price_info = $variable_price; |
| 282 | 282 | break; |
| 283 | 283 | } |
@@ -285,15 +285,15 @@ discard block |
||
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | // Set price id. |
| 288 | - if( ! empty( $price_info ) ) { |
|
| 288 | + if ( ! empty($price_info)) { |
|
| 289 | 289 | $price_id = $data['give-variable-price']; |
| 290 | 290 | |
| 291 | - if( $data['give-variable-price'] !== $price_info['_give_id']['level_id'] ) { |
|
| 291 | + if ($data['give-variable-price'] !== $price_info['_give_id']['level_id']) { |
|
| 292 | 292 | // Set price id to amount match. |
| 293 | 293 | $price_id = $price_info['_give_id']['level_id']; |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - } elseif( $form->is_custom_price_mode() ){ |
|
| 296 | + } elseif ($form->is_custom_price_mode()) { |
|
| 297 | 297 | $price_id = 'custom'; |
| 298 | 298 | } |
| 299 | 299 | |
@@ -301,11 +301,11 @@ discard block |
||
| 301 | 301 | $payment_meta['price_id'] = $price_id; |
| 302 | 302 | |
| 303 | 303 | // Update payment give form meta data. |
| 304 | - $payment->update_meta( '_give_payment_price_id', $price_id ); |
|
| 305 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
| 304 | + $payment->update_meta('_give_payment_price_id', $price_id); |
|
| 305 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
| 306 | 306 | |
| 307 | 307 | // Re setup payment to update new meta value in object. |
| 308 | - $payment->update_payment_setup( $payment->ID ); |
|
| 308 | + $payment->update_payment_setup($payment->ID); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | /** |
@@ -316,13 +316,13 @@ discard block |
||
| 316 | 316 | * |
| 317 | 317 | * @param int $payment_id The ID of the payment. |
| 318 | 318 | */ |
| 319 | - do_action( 'give_updated_edited_donation', $payment_id ); |
|
| 319 | + do_action('give_updated_edited_donation', $payment_id); |
|
| 320 | 320 | |
| 321 | - wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id=' . $payment_id ) ); |
|
| 321 | + wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id='.$payment_id)); |
|
| 322 | 322 | exit; |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | -add_action( 'give_update_payment_details', 'give_update_payment_details' ); |
|
| 325 | +add_action('give_update_payment_details', 'give_update_payment_details'); |
|
| 326 | 326 | |
| 327 | 327 | /** |
| 328 | 328 | * Trigger a Donation Deletion. |
@@ -333,48 +333,48 @@ discard block |
||
| 333 | 333 | * |
| 334 | 334 | * @return void |
| 335 | 335 | */ |
| 336 | -function give_trigger_donation_delete( $data ) { |
|
| 337 | - if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) { |
|
| 336 | +function give_trigger_donation_delete($data) { |
|
| 337 | + if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) { |
|
| 338 | 338 | |
| 339 | - $payment_id = absint( $data['purchase_id'] ); |
|
| 339 | + $payment_id = absint($data['purchase_id']); |
|
| 340 | 340 | |
| 341 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
| 342 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 341 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
| 342 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - give_delete_donation( $payment_id ); |
|
| 346 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted' ) ); |
|
| 345 | + give_delete_donation($payment_id); |
|
| 346 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted')); |
|
| 347 | 347 | give_die(); |
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | -add_action( 'give_delete_payment', 'give_trigger_donation_delete' ); |
|
| 351 | +add_action('give_delete_payment', 'give_trigger_donation_delete'); |
|
| 352 | 352 | |
| 353 | 353 | /** |
| 354 | 354 | * AJAX Store Donation Note |
| 355 | 355 | */ |
| 356 | 356 | function give_ajax_store_payment_note() { |
| 357 | 357 | |
| 358 | - $payment_id = absint( $_POST['payment_id'] ); |
|
| 359 | - $note = wp_kses( $_POST['note'], array() ); |
|
| 358 | + $payment_id = absint($_POST['payment_id']); |
|
| 359 | + $note = wp_kses($_POST['note'], array()); |
|
| 360 | 360 | |
| 361 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
| 362 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 361 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
| 362 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - if ( empty( $payment_id ) ) { |
|
| 366 | - die( '-1' ); |
|
| 365 | + if (empty($payment_id)) { |
|
| 366 | + die('-1'); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - if ( empty( $note ) ) { |
|
| 370 | - die( '-1' ); |
|
| 369 | + if (empty($note)) { |
|
| 370 | + die('-1'); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - $note_id = give_insert_payment_note( $payment_id, $note ); |
|
| 374 | - die( give_get_payment_note_html( $note_id ) ); |
|
| 373 | + $note_id = give_insert_payment_note($payment_id, $note); |
|
| 374 | + die(give_get_payment_note_html($note_id)); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | -add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' ); |
|
| 377 | +add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note'); |
|
| 378 | 378 | |
| 379 | 379 | /** |
| 380 | 380 | * Triggers a donation note deletion without ajax |
@@ -385,24 +385,24 @@ discard block |
||
| 385 | 385 | * |
| 386 | 386 | * @return void |
| 387 | 387 | */ |
| 388 | -function give_trigger_payment_note_deletion( $data ) { |
|
| 388 | +function give_trigger_payment_note_deletion($data) { |
|
| 389 | 389 | |
| 390 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) { |
|
| 390 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) { |
|
| 391 | 391 | return; |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | - if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) { |
|
| 395 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 394 | + if ( ! current_user_can('edit_give_payments', $data['payment_id'])) { |
|
| 395 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - $edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id=' . absint( $data['payment_id'] ) ); |
|
| 398 | + $edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id='.absint($data['payment_id'])); |
|
| 399 | 399 | |
| 400 | - give_delete_payment_note( $data['note_id'], $data['payment_id'] ); |
|
| 400 | + give_delete_payment_note($data['note_id'], $data['payment_id']); |
|
| 401 | 401 | |
| 402 | - wp_redirect( $edit_order_url ); |
|
| 402 | + wp_redirect($edit_order_url); |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | -add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' ); |
|
| 405 | +add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion'); |
|
| 406 | 406 | |
| 407 | 407 | /** |
| 408 | 408 | * Delete a payment note deletion with ajax |
@@ -413,16 +413,16 @@ discard block |
||
| 413 | 413 | */ |
| 414 | 414 | function give_ajax_delete_payment_note() { |
| 415 | 415 | |
| 416 | - if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) { |
|
| 417 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 416 | + if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) { |
|
| 417 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | - if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) { |
|
| 421 | - die( '1' ); |
|
| 420 | + if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) { |
|
| 421 | + die('1'); |
|
| 422 | 422 | } else { |
| 423 | - die( '-1' ); |
|
| 423 | + die('-1'); |
|
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | -add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' ); |
|
| 428 | +add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note'); |
|
@@ -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_Export' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Settings_Export')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Settings_Export. |
@@ -34,16 +34,16 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function __construct() { |
| 36 | 36 | $this->id = 'export'; |
| 37 | - $this->label = __( 'Export', 'give' ); |
|
| 37 | + $this->label = __('Export', 'give'); |
|
| 38 | 38 | |
| 39 | 39 | parent::__construct(); |
| 40 | 40 | |
| 41 | - add_action( 'give_admin_field_tools_export', array( $this, 'render_export_field' ), 10, 2 ); |
|
| 41 | + add_action('give_admin_field_tools_export', array($this, 'render_export_field'), 10, 2); |
|
| 42 | 42 | |
| 43 | 43 | // Do not use main donor for this tab. |
| 44 | - if( give_get_current_setting_tab() === $this->id ) { |
|
| 45 | - add_action( 'give-tools_open_form', '__return_empty_string' ); |
|
| 46 | - add_action( 'give-tools_close_form', '__return_empty_string' ); |
|
| 44 | + if (give_get_current_setting_tab() === $this->id) { |
|
| 45 | + add_action('give-tools_open_form', '__return_empty_string'); |
|
| 46 | + add_action('give-tools_close_form', '__return_empty_string'); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @param array $settings |
| 62 | 62 | */ |
| 63 | 63 | $settings = apply_filters( |
| 64 | - 'give_get_settings_' . $this->id, |
|
| 64 | + 'give_get_settings_'.$this->id, |
|
| 65 | 65 | array( |
| 66 | 66 | array( |
| 67 | 67 | 'id' => 'give_tools_export', |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | ), |
| 71 | 71 | array( |
| 72 | 72 | 'id' => 'export', |
| 73 | - 'name' => __( 'Export', 'give' ), |
|
| 73 | + 'name' => __('Export', 'give'), |
|
| 74 | 74 | 'type' => 'tools_export', |
| 75 | 75 | ), |
| 76 | 76 | array( |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | * @param $field |
| 95 | 95 | * @param $option_value |
| 96 | 96 | */ |
| 97 | - public function render_export_field( $field, $option_value ) { |
|
| 98 | - include_once( 'views/html-admin-page-exports.php' ); |
|
| 97 | + public function render_export_field($field, $option_value) { |
|
| 98 | + include_once('views/html-admin-page-exports.php'); |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly. |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -39,30 +39,30 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function csv_cols() { |
| 41 | 41 | $cols = array( |
| 42 | - 'id' => __( 'ID', 'give' ), // unaltered payment ID (use for querying). |
|
| 43 | - 'seq_id' => __( 'Payment Number', 'give' ), // sequential payment ID. |
|
| 44 | - 'email' => __( 'Email', 'give' ), |
|
| 45 | - 'first' => __( 'First Name', 'give' ), |
|
| 46 | - 'last' => __( 'Last Name', 'give' ), |
|
| 47 | - 'address1' => __( 'Address 1', 'give' ), |
|
| 48 | - 'address2' => __( 'Address 2', 'give' ), |
|
| 49 | - 'city' => __( 'City', 'give' ), |
|
| 50 | - 'state' => __( 'State', 'give' ), |
|
| 51 | - 'country' => __( 'Country', 'give' ), |
|
| 52 | - 'zip' => __( 'Zip / Postal Code', 'give' ), |
|
| 53 | - 'form_id' => __( 'Form ID', 'give' ), |
|
| 54 | - 'form_name' => __( 'Form Name', 'give' ), |
|
| 55 | - 'amount' => __( 'Amount', 'give' ) . ' (' . give_currency_symbol( '', true ) . ')', |
|
| 56 | - 'gateway' => __( 'Payment Method', 'give' ), |
|
| 57 | - 'trans_id' => __( 'Transaction ID', 'give' ), |
|
| 58 | - 'key' => __( 'Key', 'give' ), |
|
| 59 | - 'date' => __( 'Date', 'give' ), |
|
| 60 | - 'user' => __( 'User', 'give' ), |
|
| 61 | - 'status' => __( 'Status', 'give' ) |
|
| 42 | + 'id' => __('ID', 'give'), // unaltered payment ID (use for querying). |
|
| 43 | + 'seq_id' => __('Payment Number', 'give'), // sequential payment ID. |
|
| 44 | + 'email' => __('Email', 'give'), |
|
| 45 | + 'first' => __('First Name', 'give'), |
|
| 46 | + 'last' => __('Last Name', 'give'), |
|
| 47 | + 'address1' => __('Address 1', 'give'), |
|
| 48 | + 'address2' => __('Address 2', 'give'), |
|
| 49 | + 'city' => __('City', 'give'), |
|
| 50 | + 'state' => __('State', 'give'), |
|
| 51 | + 'country' => __('Country', 'give'), |
|
| 52 | + 'zip' => __('Zip / Postal Code', 'give'), |
|
| 53 | + 'form_id' => __('Form ID', 'give'), |
|
| 54 | + 'form_name' => __('Form Name', 'give'), |
|
| 55 | + 'amount' => __('Amount', 'give').' ('.give_currency_symbol('', true).')', |
|
| 56 | + 'gateway' => __('Payment Method', 'give'), |
|
| 57 | + 'trans_id' => __('Transaction ID', 'give'), |
|
| 58 | + 'key' => __('Key', 'give'), |
|
| 59 | + 'date' => __('Date', 'give'), |
|
| 60 | + 'user' => __('User', 'give'), |
|
| 61 | + 'status' => __('Status', 'give') |
|
| 62 | 62 | ); |
| 63 | 63 | |
| 64 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
| 65 | - unset( $cols['seq_id'] ); |
|
| 64 | + if ( ! give_get_option('enable_sequential')) { |
|
| 65 | + unset($cols['seq_id']); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | return $cols; |
@@ -86,12 +86,12 @@ discard block |
||
| 86 | 86 | 'status' => $this->status |
| 87 | 87 | ); |
| 88 | 88 | |
| 89 | - if ( ! empty( $this->start ) || ! empty( $this->end ) ) { |
|
| 89 | + if ( ! empty($this->start) || ! empty($this->end)) { |
|
| 90 | 90 | |
| 91 | 91 | $args['date_query'] = array( |
| 92 | 92 | array( |
| 93 | - 'after' => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ), |
|
| 94 | - 'before' => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ), |
|
| 93 | + 'after' => date('Y-n-d 00:00:00', strtotime($this->start)), |
|
| 94 | + 'before' => date('Y-n-d 23:59:59', strtotime($this->end)), |
|
| 95 | 95 | 'inclusive' => true |
| 96 | 96 | ) |
| 97 | 97 | ); |
@@ -99,11 +99,11 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // Add category or tag to payment query if any. |
| 102 | - if ( ! empty( $this->categories ) || ! empty( $this->tags ) ) { |
|
| 102 | + if ( ! empty($this->categories) || ! empty($this->tags)) { |
|
| 103 | 103 | $form_args = array( |
| 104 | 104 | 'post_type' => 'give_forms', |
| 105 | 105 | 'post_status' => 'publish', |
| 106 | - 'posts_per_page' => - 1, |
|
| 106 | + 'posts_per_page' => -1, |
|
| 107 | 107 | 'fields' => 'ids', |
| 108 | 108 | 'tax_query' => array( |
| 109 | 109 | 'relation' => 'AND', |
@@ -111,72 +111,72 @@ discard block |
||
| 111 | 111 | ); |
| 112 | 112 | |
| 113 | 113 | |
| 114 | - if ( ! empty( $this->categories ) ) { |
|
| 114 | + if ( ! empty($this->categories)) { |
|
| 115 | 115 | $form_args['tax_query'][] = array( |
| 116 | 116 | 'taxonomy' => 'give_forms_category', |
| 117 | 117 | 'terms' => $this->categories, |
| 118 | 118 | ); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if ( ! empty( $this->tags ) ) { |
|
| 121 | + if ( ! empty($this->tags)) { |
|
| 122 | 122 | $form_args['tax_query'][] = array( |
| 123 | 123 | 'taxonomy' => 'give_forms_tag', |
| 124 | 124 | 'terms' => $this->tags, |
| 125 | 125 | ); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $forms = new WP_Query( $form_args ); |
|
| 128 | + $forms = new WP_Query($form_args); |
|
| 129 | 129 | |
| 130 | - if ( empty( $forms->posts ) ) { |
|
| 130 | + if (empty($forms->posts)) { |
|
| 131 | 131 | return array(); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | $args['give_forms'] = $forms->posts; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - $payments = give_get_payments( $args ); |
|
| 137 | + $payments = give_get_payments($args); |
|
| 138 | 138 | |
| 139 | - if ( $payments ) { |
|
| 139 | + if ($payments) { |
|
| 140 | 140 | |
| 141 | - foreach ( $payments as $payment ) { |
|
| 142 | - $payment_meta = give_get_payment_meta( $payment->ID ); |
|
| 143 | - $user_info = give_get_payment_meta_user_info( $payment->ID ); |
|
| 144 | - $total = give_donation_amount( $payment->ID ); |
|
| 145 | - $user_id = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
| 141 | + foreach ($payments as $payment) { |
|
| 142 | + $payment_meta = give_get_payment_meta($payment->ID); |
|
| 143 | + $user_info = give_get_payment_meta_user_info($payment->ID); |
|
| 144 | + $total = give_donation_amount($payment->ID); |
|
| 145 | + $user_id = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
| 146 | 146 | |
| 147 | - if ( is_numeric( $user_id ) ) { |
|
| 148 | - $user = get_userdata( $user_id ); |
|
| 147 | + if (is_numeric($user_id)) { |
|
| 148 | + $user = get_userdata($user_id); |
|
| 149 | 149 | } else { |
| 150 | 150 | $user = false; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $data[] = array( |
| 154 | 154 | 'id' => $payment->ID, |
| 155 | - 'seq_id' => give_get_payment_number( $payment->ID ), |
|
| 155 | + 'seq_id' => give_get_payment_number($payment->ID), |
|
| 156 | 156 | 'email' => $payment_meta['email'], |
| 157 | 157 | 'first' => $user_info['first_name'], |
| 158 | 158 | 'last' => $user_info['last_name'], |
| 159 | - 'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '', |
|
| 160 | - 'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '', |
|
| 161 | - 'city' => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '', |
|
| 162 | - 'state' => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '', |
|
| 163 | - 'country' => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '', |
|
| 164 | - 'zip' => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '', |
|
| 165 | - 'form_id' => isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : '', |
|
| 166 | - 'form_name' => isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '', |
|
| 167 | - 'amount' => html_entity_decode( give_format_amount( $total, array( 'sanitize' => false ) ) ), |
|
| 168 | - 'gateway' => give_get_gateway_admin_label( give_get_meta( $payment->ID, '_give_payment_gateway', true ) ), |
|
| 169 | - 'trans_id' => give_get_payment_transaction_id( $payment->ID ), |
|
| 159 | + 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', |
|
| 160 | + 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', |
|
| 161 | + 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', |
|
| 162 | + 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', |
|
| 163 | + 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', |
|
| 164 | + 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', |
|
| 165 | + 'form_id' => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '', |
|
| 166 | + 'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '', |
|
| 167 | + 'amount' => html_entity_decode(give_format_amount($total, array('sanitize' => false))), |
|
| 168 | + 'gateway' => give_get_gateway_admin_label(give_get_meta($payment->ID, '_give_payment_gateway', true)), |
|
| 169 | + 'trans_id' => give_get_payment_transaction_id($payment->ID), |
|
| 170 | 170 | 'key' => $payment_meta['key'], |
| 171 | 171 | 'date' => $payment->post_date, |
| 172 | - 'user' => $user ? $user->display_name : __( 'guest', 'give' ), |
|
| 173 | - 'status' => give_get_payment_status( $payment, true ) |
|
| 172 | + 'user' => $user ? $user->display_name : __('guest', 'give'), |
|
| 173 | + 'status' => give_get_payment_status($payment, true) |
|
| 174 | 174 | ); |
| 175 | 175 | |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
| 179 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
| 178 | + $data = apply_filters('give_export_get_data', $data); |
|
| 179 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
| 180 | 180 | |
| 181 | 181 | return $data; |
| 182 | 182 | |
@@ -196,27 +196,27 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $status = $this->status; |
| 198 | 198 | $args = array( |
| 199 | - 'start-date' => date( 'n/d/Y', strtotime( $this->start ) ), |
|
| 200 | - 'end-date' => date( 'n/d/Y', strtotime( $this->end ) ), |
|
| 199 | + 'start-date' => date('n/d/Y', strtotime($this->start)), |
|
| 200 | + 'end-date' => date('n/d/Y', strtotime($this->end)), |
|
| 201 | 201 | ); |
| 202 | 202 | |
| 203 | - if ( 'any' == $status ) { |
|
| 203 | + if ('any' == $status) { |
|
| 204 | 204 | |
| 205 | - $total = array_sum( (array) give_count_payments( $args ) ); |
|
| 205 | + $total = array_sum((array) give_count_payments($args)); |
|
| 206 | 206 | |
| 207 | 207 | } else { |
| 208 | 208 | |
| 209 | - $total = give_count_payments( $args )->$status; |
|
| 209 | + $total = give_count_payments($args)->$status; |
|
| 210 | 210 | |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | $percentage = 100; |
| 214 | 214 | |
| 215 | - if ( $total > 0 ) { |
|
| 216 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
| 215 | + if ($total > 0) { |
|
| 216 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - if ( $percentage > 100 ) { |
|
| 219 | + if ($percentage > 100) { |
|
| 220 | 220 | $percentage = 100; |
| 221 | 221 | } |
| 222 | 222 | |
@@ -230,11 +230,11 @@ discard block |
||
| 230 | 230 | * |
| 231 | 231 | * @param array $request The Form Data passed into the batch processing. |
| 232 | 232 | */ |
| 233 | - public function set_properties( $request ) { |
|
| 234 | - $this->start = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : ''; |
|
| 235 | - $this->end = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : ''; |
|
| 236 | - $this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete'; |
|
| 237 | - $this->categories = isset( $request['give_forms_categories'] ) ? give_clean( $request['give_forms_categories'] ) : array(); |
|
| 238 | - $this->tags = isset( $request['give_forms_tags'] ) ? give_clean( $request['give_forms_tags'] ) : array(); |
|
| 233 | + public function set_properties($request) { |
|
| 234 | + $this->start = isset($request['start']) ? sanitize_text_field($request['start']) : ''; |
|
| 235 | + $this->end = isset($request['end']) ? sanitize_text_field($request['end']) : ''; |
|
| 236 | + $this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete'; |
|
| 237 | + $this->categories = isset($request['give_forms_categories']) ? give_clean($request['give_forms_categories']) : array(); |
|
| 238 | + $this->tags = isset($request['give_forms_tags']) ? give_clean($request['give_forms_tags']) : array(); |
|
| 239 | 239 | } |
| 240 | 240 | } |