| @@ -1,5 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 3 | +// Exit if accessed directly. | |
| 4 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 5 | + exit; | |
| 6 | +} | |
| 7 | + | |
| 2 | 8 | /** |
| 3 | 9 | * The template used to display file form fields. |
| 4 | 10 | * |
| 5 | 11 | * @author WP Charitable LLC |
| @@ -5,8 +11,10 @@ | ||
| 5 | 11 | * @author WP Charitable LLC |
| 6 | 12 | * @package Charitable/Templates/Form Fields |
| 7 | 13 | * @since 1.0.0 |
| 8 | 14 | * @version 1.0.0 |
| 15 | + * @version 1.8.6.1 Added description output. | |
| 16 | + * @version 1.8.8.6 | |
| 9 | 17 | */ |
| 10 | 18 | |
| 11 | 19 | if ( ! isset( $view_args['form'] ) || ! isset( $view_args['field'] ) ) { |
| 12 | 20 | return; |
| @@ -11,17 +19,25 @@ | ||
| 11 | 19 | if ( ! isset( $view_args['form'] ) || ! isset( $view_args['field'] ) ) { |
| 12 | 20 | return; |
| 13 | 21 | } |
| 14 | 22 | |
| 15 | -$form = $view_args['form']; | |
| 16 | -$field = $view_args['field']; | |
| 17 | -$classes = $view_args['classes']; | |
| 18 | -$value = isset( $field['value'] ) ? $field['value'] : ''; | |
| 23 | +$charitable_form = $view_args['form']; | |
| 24 | +$charitable_field = $view_args['field']; | |
| 25 | +$charitable_classes = $view_args['classes']; | |
| 26 | +$charitable_value = isset( $charitable_field['value'] ) ? $charitable_field['value'] : ''; | |
| 19 | 27 | ?> |
| 20 | -<div id="charitable_field_<?php echo $field['key']; ?>" class="<?php echo $classes; ?>"> | |
| 21 | - <?php if ( isset( $field['label'] ) ) : ?> | |
| 22 | - <label for="charitable_field_<?php echo $field['key']; ?>_element"> | |
| 23 | - <?php echo $field['label']; ?> | |
| 28 | +<div id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>" class="<?php echo esc_attr( $charitable_classes ); ?>"> | |
| 29 | + <?php if ( isset( $charitable_field['label'] ) ) : ?> | |
| 30 | + <label for="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_element"> | |
| 31 | + <?php echo wp_kses_post( $charitable_field['label'] ); ?> | |
| 24 | 32 | </label> |
| 25 | 33 | <?php endif ?> |
| 26 | - <input type="file" name="<?php echo $field['key']; ?>" id="charitable_field_<?php echo $field['key']; ?>_element" value="<?php echo $value; ?>" <?php echo charitable_get_arbitrary_attributes( $field ); ?>/> | |
| 27 | -</div> | |
| 34 | + <input type="file" name="<?php echo esc_attr( $charitable_field['key'] ); ?>" id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_element" value="<?php echo esc_attr( $charitable_value ); ?>" <?php echo charitable_get_arbitrary_attributes( $charitable_field ); // phpcs:ignore ?>/> | |
| 35 | + <?php | |
| 36 | + | |
| 37 | + // If there is a description, add it after the input. | |
| 38 | + if ( isset( $charitable_field['description'] ) && ! empty( $charitable_field['description'] ) ) { | |
| 39 | + echo '<p class="charitable-field-description">' . wp_kses_post( $charitable_field['description'] ) . '</p>'; | |
| 40 | + } | |
| 41 | + | |
| 42 | + ?> | |
| 43 | +</div> | |