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/widgets/campaign-terms-dropdown.php +30 -18 1.6.7 → 1.8.13 View file →
@@ -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 * Display a list of campaign categories or tags.
4 10 *
5 11 * Override this template by copying it to yourtheme/charitable/widgets/campaign-terms.php
@@ -4,43 +10,49 @@
4 10 *
5 11 * Override this template by copying it to yourtheme/charitable/widgets/campaign-terms.php
6 12 *
7 13 * @package Charitable/Templates/Widgets
8 - * @author Studio 164a
14 + * @author WP Charitable LLC
9 15 * @since 1.5.4
10 - * @version 1.5.4
16 + * @version 1.6.54
17 + * @version 1.8.8.6
11 18 */
12 19
13 -$taxonomy = isset( $view_args['taxonomy'] ) ? $view_args['taxonomy'] : 'campaign_category';
14 -$title = ! empty( $view_args['title'] ) ? $view_args['title'] : '';
15 -$dropdown_id = $view_args['widget_id'] . '-dropdown';
16 -$dropdown_args = array(
17 - 'taxonomy' => $taxonomy,
18 - 'name' => $taxonomy,
20 +$taxonomy_name = isset( $view_args['taxonomy'] ) ? $view_args['taxonomy'] : 'campaign_category'; // phpcs:ignore
21 +$taxonomy = get_taxonomies( array( 'name' => $taxonomy_name ), 'objects' ); // phpcs:ignore
22 +$title = ! empty( $view_args['title'] ) ? $view_args['title'] : ''; // phpcs:ignore
23 +$charitable_dropdown_id = $view_args['widget_id'] . '-dropdown';
24 +$charitable_dropdown_args = array(
25 + 'taxonomy' => $taxonomy_name,
26 + 'name' => $taxonomy_name,
19 27 'show_count' => isset( $view_args['show_count'] ) && $view_args['show_count'],
20 28 'hide_empty' => isset( $view_args['hide_empty'] ) && $view_args['hide_empty'],
21 - 'id' => $dropdown_id,
22 - 'show_option_none' => sprintf( _x( 'Select %s', 'select campaign category/tag', 'charitable' ), ucwords( str_replace( '_', ' ', $taxonomy ) ) ),
29 + 'id' => $charitable_dropdown_id,
30 + 'show_option_none' => sprintf(
31 + /* translators: %s: taxonomy label */
32 + _x( 'Select %s', 'select campaign category/tag', 'charitable' ),
33 + $taxonomy[ $taxonomy_name ]->label
34 + ),
23 35 'value_field' => 'slug',
24 - 'selected' => is_tax( $taxonomy ) ? get_query_var( $taxonomy ) : 0,
36 + 'selected' => is_tax( $taxonomy_name ) ? get_query_var( $taxonomy_name ) : 0,
25 37 );
26 38
27 -echo $view_args['before_widget'];
39 +echo $view_args['before_widget']; // phpcs:ignore
28 40
29 41 if ( ! empty( $title ) ) :
30 42
31 - echo $view_args['before_title'] . $title . $view_args['after_title'];
43 + echo $view_args['before_title'] . esc_html( $title ) . $view_args['after_title']; // phpcs:ignore
32 44
33 45 endif;
34 46 ?>
35 -<form action="<?php echo esc_url( home_url() ) ?>" method="get">
36 - <label class="screen-reader-text" for="<?php echo esc_attr( $dropdown_id ) ?>"><?php echo $title ?></label>
37 - <?php wp_dropdown_categories( $dropdown_args ) ?>
47 +<form action="<?php echo esc_url( home_url() ); ?>" method="get">
48 + <label class="screen-reader-text" for="<?php echo esc_attr( $charitable_dropdown_id ); ?>"><?php echo esc_html( $title ); ?></label>
49 + <?php wp_dropdown_categories( $charitable_dropdown_args ); ?>
38 50 </form>
39 51 <script type='text/javascript'>
40 52 /* <![CDATA[ */
41 53 (function() {
42 - var dropdown = document.getElementById( "<?php echo esc_js( $dropdown_id ); ?>" );
54 + var dropdown = document.getElementById( "<?php echo esc_js( $charitable_dropdown_id ); ?>" );
43 55 function onCatChange() {
44 56 if ( dropdown.options[ dropdown.selectedIndex ].value !== -1 ) {
45 57 dropdown.parentNode.submit();
46 58 }
@@ -50,5 +62,5 @@
50 62 /* ]]> */
51 63 </script>
52 64 <?php
53 65
54 -echo $view_args['after_widget'];
66 +echo $view_args['after_widget']; // phpcs:ignore