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.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 1.7.0.9 All 211 releases
← All changes | templates/form-fields/multi-checkbox.php +39 -23 1.6.7 → 1.8.13 View file →
@@ -1,12 +1,20 @@
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 form fields with multiple checkboxes.
4 10 *
5 - * @author Studio 164a
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,41 +19,49 @@
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 -$is_required = isset( $field['required'] ) ? $field['required'] : false;
19 -$options = isset( $field['options'] ) ? $field['options'] : array();
20 -$value = isset( $field['value'] ) ? (array) $field['value'] : array();
23 +$charitable_form = $view_args['form'];
24 +$charitable_field = $view_args['field'];
25 +$charitable_classes = $view_args['classes'];
26 +$charitable_is_required = isset( $charitable_field['required'] ) ? $charitable_field['required'] : false;
27 +$charitable_options = isset( $charitable_field['options'] ) ? $charitable_field['options'] : array();
28 +$charitable_value = isset( $charitable_field['value'] ) ? (array) $charitable_field['value'] : array();
21 29
22 -if ( empty( $options ) ) {
30 +if ( empty( $charitable_options ) ) {
23 31 return;
24 32 }
25 33 ?>
26 -<div id="charitable_field_<?php echo esc_attr( $field['key'] ); ?>" class="<?php echo $classes; ?>">
34 +<div id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>" class="<?php echo esc_attr( $charitable_classes ); ?>">
27 35 <fieldset class="charitable-fieldset-field-wrapper">
28 - <?php if ( isset( $field['label'] ) ) : ?>
29 - <div class="charitable-fieldset-field-header" id="charitable_field_<?php echo esc_attr( $field['key'] ); ?>_label">
30 - <?php echo $field['label']; ?>
31 - <?php if ( $is_required ) : ?>
32 - <abbr class="required" title="required">*</abbr>
36 + <?php if ( isset( $charitable_field['label'] ) ) : ?>
37 + <div class="charitable-fieldset-field-header" id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_label">
38 + <?php echo wp_kses_post( $charitable_field['label'] ); ?>
39 + <?php if ( $charitable_is_required ) : ?>
40 + <abbr class="required" title="<?php esc_html_e( 'Required', 'charitable' ); ?>">*</abbr>
33 41 <?php endif ?>
34 42 </div>
35 43 <?php endif ?>
36 44 <ul class="charitable-checkbox-list options">
37 - <?php foreach ( $options as $val => $label ) : ?>
45 + <?php foreach ( $charitable_options as $charitable_val => $charitable_label ) : ?>
38 46 <li>
39 - <input type="checkbox"
40 - id="<?php echo esc_attr( $field['key'] . '-' . $val ); ?>"
41 - name="<?php echo $field['key']; ?>[]"
42 - value="<?php echo $val; ?>"
43 - aria-describedby="charitable_field_<?php echo esc_attr( $field['key'] ); ?>_label"
44 - <?php checked( in_array( $val, $value ) ); ?>
45 - <?php echo charitable_get_arbitrary_attributes( $field ); ?> />
46 - <label for="<?php echo esc_attr( $field['key'] . '-' . $val ); ?>"><?php echo $label; ?></label>
47 + <input type="checkbox"
48 + id="<?php echo esc_attr( $charitable_field['key'] . '-' . $charitable_val ); ?>"
49 + name="<?php echo esc_attr( $charitable_field['key'] ); ?>[]"
50 + value="<?php echo esc_attr( $charitable_val ); ?>"
51 + aria-describedby="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_label"
52 + <?php checked( in_array( $charitable_val, $charitable_value ) ); // phpcs:ignore ?>
53 + <?php echo charitable_get_arbitrary_attributes( $charitable_field ); // phpcs:ignore ?> />
54 + <label for="<?php echo esc_attr( $charitable_field['key'] . '-' . $charitable_val ); ?>"><?php echo esc_html( $charitable_label ); ?></label>
47 55 </li>
48 56 <?php endforeach ?>
49 57 </ul>
58 + <?php
59 +
60 + // If there is a description, add it after the input.
61 + if ( isset( $charitable_field['description'] ) && ! empty( $charitable_field['description'] ) ) {
62 + echo '<p class="charitable-field-description">' . wp_kses_post( $charitable_field['description'] ) . '</p>';
63 + }
64 +
65 + ?>
50 66 </fieldset>
51 67 </div>