PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
← All changes | templates/form-fields/radio.php +58 -24 1.6.8 → 1.8.13 View file →
@@ -3,54 +3,88 @@
3 3 * The template used to display radio form fields.
4 4 *
5 5 * Override this template by copying it to yourtheme/charitable/form-fields/radio.php
6 6 *
7 - * @author Studio 164a
7 + * @author WP Charitable LLC
8 8 * @package Charitable/Templates/Form Fields
9 9 * @since 1.0.0
10 10 * @version 1.0.0
11 + * @version 1.8.6.1 Added description output.
12 + * @version 1.8.6.1 Added SVG support to label.
13 + * @version 1.8.8.6
11 14 */
12 15
13 16 // Exit if accessed directly.
14 -if ( ! defined( 'ABSPATH' ) ) { exit; }
17 +if ( ! defined( 'ABSPATH' ) ) {
18 + exit;
19 +}
15 20
16 21 if ( ! isset( $view_args['form'] ) || ! isset( $view_args['field'] ) ) {
17 22 return;
18 23 }
19 24
20 -$form = $view_args['form'];
21 -$field = $view_args['field'];
22 -$classes = $view_args['classes'];
23 -$is_required = isset( $field['required'] ) ? $field['required'] : false;
24 -$options = isset( $field['options'] ) ? $field['options'] : array();
25 -$value = isset( $field['value'] ) ? $field['value'] : '';
25 +$charitable_form = $view_args['form'];
26 +$charitable_field = $view_args['field'];
27 +$charitable_classes = $view_args['classes'];
28 +$charitable_is_required = isset( $charitable_field['required'] ) ? $charitable_field['required'] : false;
29 +$charitable_options = isset( $charitable_field['options'] ) ? $charitable_field['options'] : array();
30 +$charitable_value = isset( $charitable_field['value'] ) ? $charitable_field['value'] : '';
26 31
27 -if ( empty( $options ) ) {
32 +if ( empty( $charitable_options ) ) {
28 33 return;
29 34 }
30 35
31 36 ?>
32 -<div id="charitable_field_<?php echo esc_attr( $field['key'] ); ?>" class="<?php echo $classes; ?>">
37 +<div id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>" class="<?php echo esc_attr( $charitable_classes ); ?>">
33 38 <fieldset class="charitable-fieldset-field-wrapper">
34 - <?php if ( isset( $field['label'] ) ) : ?>
35 - <div class="charitable-fieldset-field-header" id="charitable_field_<?php echo esc_attr( $field['key'] ); ?>_label">
36 - <?php echo $field['label']; ?>
37 - <?php if ( $is_required ) : ?>
38 - <abbr class="required" title="required">*</abbr>
39 + <?php if ( isset( $charitable_field['label'] ) ) : ?>
40 + <div class="charitable-fieldset-field-header" id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_label">
41 + <?php echo wp_kses_post( $charitable_field['label'] ); ?>
42 + <?php if ( $charitable_is_required ) : ?>
43 + <abbr class="required" title="<?php esc_html_e( 'Required', 'charitable' ); ?>">*</abbr>
39 44 <?php endif ?>
40 45 </div>
41 46 <?php endif ?>
42 47 <ul class="charitable-radio-list <?php echo esc_attr( $view_args['classes'] ); ?>">
43 - <?php foreach ( $options as $option => $label ) : ?>
44 - <li><input type="radio"
45 - id="<?php echo esc_attr( $field['key'] . '-' . $option ); ?>"
46 - name="<?php echo esc_attr( $field['key'] ); ?>"
47 - value="<?php echo esc_attr( $option ); ?>"
48 - aria-describedby="charitable_field_<?php echo esc_attr( $field['key'] ); ?>_label"
49 - <?php checked( $value, $option ); ?>
50 - <?php echo charitable_get_arbitrary_attributes( $field ); ?> />
51 - <label for="<?php echo esc_attr( $field['key'] . '-' . $option ); ?>"><?php echo $label; ?></label>
48 + <?php foreach ( $charitable_options as $charitable_option => $charitable_label ) : ?>
49 + <li><input type="radio"
50 + id="<?php echo esc_attr( $charitable_field['key'] . '-' . $charitable_option ); ?>"
51 + name="<?php echo esc_attr( $charitable_field['key'] ); ?>"
52 + value="<?php echo esc_attr( $charitable_option ); ?>"
53 + aria-describedby="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_label"
54 + <?php checked( $charitable_value, $charitable_option ); ?>
55 + <?php echo charitable_get_arbitrary_attributes( $charitable_field ); // phpcs:ignore ?> />
56 + <?php
57 + $charitable_allowed_html = array_merge(
58 + wp_kses_allowed_html( 'post' ),
59 + array(
60 + 'svg' => array(
61 + 'class' => true,
62 + 'aria-hidden' => true,
63 + 'aria-labelledby' => true,
64 + 'role' => true,
65 + 'xmlns' => true,
66 + 'width' => true,
67 + 'height' => true,
68 + 'viewbox' => true
69 + ),
70 + 'path' => array(
71 + 'd' => true,
72 + 'fill' => true
73 + )
74 + )
75 + );
76 + ?>
77 + <label for="<?php echo esc_attr( $charitable_field['key'] . '-' . $charitable_option ); ?>"><?php echo wp_kses( $charitable_label, $charitable_allowed_html ); ?></label>
52 78 </li>
53 79 <?php endforeach ?>
54 80 </ul>
81 + <?php
82 +
83 + // If there is a description, add it after the input.
84 + if ( isset( $charitable_field['description'] ) && ! empty( $charitable_field['description'] ) ) {
85 + echo '<p class="charitable-field-description">' . wp_kses_post( $charitable_field['description'] ) . '</p>';
86 + }
87 +
88 + ?>
55 89 </fieldset>
56 90 </div>