| @@ -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 text form fields. |
| 4 | 10 | * |
| 5 | 11 | * @author WP Charitable LLC |
| @@ -5,8 +11,9 @@ | ||
| 5 | 11 | * @author WP Charitable LLC |
| 6 | 12 | * @package Charitable/Templates/Form Fields |
| 7 | 13 | * @since 1.0.0 |
| 8 | 14 | * @version 1.6.44 |
| 15 | + * @version 1.8.8.6 | |
| 9 | 16 | */ |
| 10 | 17 | |
| 11 | 18 | if ( ! isset( $view_args['form'] ) || ! isset( $view_args['field'] ) ) { |
| 12 | 19 | return; |
| @@ -11,22 +18,22 @@ | ||
| 11 | 18 | if ( ! isset( $view_args['form'] ) || ! isset( $view_args['field'] ) ) { |
| 12 | 19 | return; |
| 13 | 20 | } |
| 14 | 21 | |
| 15 | -$form = $view_args['form']; | |
| 16 | -$field = $view_args['field']; | |
| 17 | -$classes = esc_attr( $view_args['classes'] ); | |
| 18 | -$is_required = isset( $field['required'] ) ? $field['required'] : false; | |
| 19 | -$value = isset( $field['value'] ) ? $field['value'] : ''; | |
| 22 | +$charitable_form = $view_args['form']; | |
| 23 | +$charitable_field = $view_args['field']; | |
| 24 | +$charitable_classes = esc_attr( $view_args['classes'] ); | |
| 25 | +$charitable_is_required = isset( $charitable_field['required'] ) ? $charitable_field['required'] : false; | |
| 26 | +$charitable_value = isset( $charitable_field['value'] ) ? $charitable_field['value'] : ''; | |
| 20 | 27 | |
| 21 | 28 | /* Set the default pattern */ |
| 22 | -if ( ! isset( $field['attrs']['pattern'] ) ) { | |
| 23 | - $field['attrs']['pattern'] = 'https?://.+'; | |
| 29 | +if ( ! isset( $charitable_field['attrs']['pattern'] ) ) { | |
| 30 | + $charitable_field['attrs']['pattern'] = 'https?://.+'; | |
| 24 | 31 | } |
| 25 | 32 | |
| 26 | 33 | /* Set the default onblur attribute */ |
| 27 | -if ( ! isset( $field['attrs']['onblur'] ) ) { | |
| 28 | - $field['attrs']['onblur'] = 'CHARITABLE.SanitizeURL(this)'; | |
| 34 | +if ( ! isset( $charitable_field['attrs']['onblur'] ) ) { | |
| 35 | + $charitable_field['attrs']['onblur'] = 'CHARITABLE.SanitizeURL(this)'; | |
| 29 | 36 | } |
| 30 | 37 | |
| 31 | 38 | if ( ! wp_script_is( 'charitable-url-sanitizer', 'enqueued' ) ) { |
| 32 | 39 | wp_enqueue_script( 'charitable-url-sanitizer' ); |
| @@ -32,15 +39,15 @@ | ||
| 32 | 39 | wp_enqueue_script( 'charitable-url-sanitizer' ); |
| 33 | 40 | } |
| 34 | 41 | |
| 35 | 42 | ?> |
| 36 | -<div id="charitable_field_<?php echo $field['key'] ?>" class="<?php echo $classes ?>"> | |
| 37 | - <?php if ( isset( $field['label'] ) ) : ?> | |
| 38 | - <label for="charitable_field_<?php echo $field['key'] ?>_element"> | |
| 39 | - <?php echo $field['label'] ?> | |
| 40 | - <?php if ( $is_required ) : ?> | |
| 41 | - <abbr class="required" title="required">*</abbr> | |
| 43 | +<div id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>" class="<?php echo esc_attr( $charitable_classes ); ?>"> | |
| 44 | + <?php if ( isset( $charitable_field['label'] ) ) : ?> | |
| 45 | + <label for="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_element"> | |
| 46 | + <?php echo wp_kses_post( $charitable_field['label'] ); ?> | |
| 47 | + <?php if ( $charitable_is_required ) : ?> | |
| 48 | + <abbr class="required" title="<?php esc_html_e( 'Required', 'charitable' ); ?>">*</abbr> | |
| 42 | 49 | <?php endif ?> |
| 43 | 50 | </label> |
| 44 | 51 | <?php endif ?> |
| 45 | - <input type="url" name="<?php echo $field['key'] ?>" id="charitable_field_<?php echo $field['key'] ?>_element" value="<?php echo esc_attr( stripslashes( $value ) ) ?>" <?php echo charitable_get_arbitrary_attributes( $field ) ?>/> | |
| 52 | + <input type="url" name="<?php echo esc_attr( $charitable_field['key'] ); ?>" id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_element" value="<?php echo esc_attr( stripslashes( $charitable_value ) ); ?>" <?php echo charitable_get_arbitrary_attributes( $charitable_field ); // phpcs:ignore ?>/> | |
| 46 | 53 | </div> |