| @@ -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 campaigns. |
| 4 | 10 | * |
| 5 | 11 | * Override this template by copying it to yourtheme/charitable/widgets/campaigns.php |
| @@ -7,52 +13,53 @@ | ||
| 7 | 13 | * @package Charitable/Templates/Widgets |
| 8 | 14 | * @author WP Charitable LLC |
| 9 | 15 | * @since 1.0.0 |
| 10 | 16 | * @version 1.4.18 |
| 17 | + * @version 1.8.8.6 | |
| 11 | 18 | */ |
| 12 | 19 | |
| 13 | -$campaigns = $view_args['campaigns']; | |
| 14 | -$show_thumbnail = isset( $view_args['show_thumbnail'] ) ? $view_args['show_thumbnail'] : true; | |
| 15 | -$thumbnail_size = apply_filters( 'charitable_campaign_widget_thumbnail_size', 'medium' ); | |
| 20 | +$charitable_campaigns = $view_args['campaigns']; | |
| 21 | +$charitable_show_thumbnail = isset( $view_args['show_thumbnail'] ) ? $view_args['show_thumbnail'] : true; | |
| 22 | +$charitable_thumbnail_size = apply_filters( 'charitable_campaign_widget_thumbnail_size', 'medium' ); | |
| 16 | 23 | |
| 17 | -if ( ! $campaigns->have_posts() ) : | |
| 24 | +if ( ! $charitable_campaigns->have_posts() ) : | |
| 18 | 25 | return; |
| 19 | 26 | endif; |
| 20 | 27 | |
| 21 | -echo $view_args['before_widget']; | |
| 28 | +echo $view_args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 22 | 29 | |
| 23 | 30 | if ( ! empty( $view_args['title'] ) ) : |
| 24 | 31 | |
| 25 | - echo $view_args['before_title'] . $view_args['title'] . $view_args['after_title']; | |
| 32 | + echo $view_args['before_title'] . $view_args['title'] . $view_args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 26 | 33 | |
| 27 | 34 | endif; |
| 28 | 35 | ?> |
| 29 | 36 | <ol class="campaigns"> |
| 30 | 37 | <?php |
| 31 | -while ( $campaigns->have_posts() ) : | |
| 38 | +while ( $charitable_campaigns->have_posts() ) : | |
| 32 | 39 | |
| 33 | - $campaigns->the_post(); | |
| 40 | + $charitable_campaigns->the_post(); | |
| 34 | 41 | |
| 35 | - $campaign = new Charitable_Campaign( get_the_ID() ); | |
| 42 | + $charitable_campaign = new Charitable_Campaign( get_the_ID() ); | |
| 36 | 43 | ?> |
| 37 | 44 | <li class="campaign"> |
| 38 | 45 | <?php |
| 39 | - if ( $show_thumbnail && has_post_thumbnail() ) : | |
| 46 | + if ( $charitable_show_thumbnail && has_post_thumbnail() ) : | |
| 40 | 47 | |
| 41 | - the_post_thumbnail( $thumbnail_size ); | |
| 48 | + the_post_thumbnail( $charitable_thumbnail_size ); | |
| 42 | 49 | |
| 43 | 50 | endif; |
| 44 | 51 | ?> |
| 45 | - <h6 class="campaign-title"><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h6> | |
| 46 | - <?php if ( ! $campaign->is_endless() ) : ?> | |
| 47 | - <div class="campaign-time-left"><?php echo $campaign->get_time_left() ?></div> | |
| 52 | + <h6 class="campaign-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h6> | |
| 53 | + <?php if ( ! $charitable_campaign->is_endless() ) : ?> | |
| 54 | + <div class="campaign-time-left"><?php echo wp_kses_post( $charitable_campaign->get_time_left() ); ?></div> | |
| 48 | 55 | <?php endif ?> |
| 49 | 56 | </li> |
| 50 | -<?php | |
| 57 | + <?php | |
| 51 | 58 | endwhile; |
| 52 | 59 | ?> |
| 53 | 60 | </ol> |
| 54 | 61 | <?php |
| 55 | 62 | |
| 56 | -echo $view_args['after_widget']; | |
| 63 | +echo $view_args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 57 | 64 | |
| 58 | 65 | wp_reset_postdata(); |