@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php //echo '<h1>' . __FILE__ . '</h1>'; ?> |
2 | 2 | <?php global $post; |
3 | -$wrap_class = has_excerpt( $post->ID ) ? 'has-excerpt' : ''; |
|
3 | +$wrap_class = has_excerpt($post->ID) ? 'has-excerpt' : ''; |
|
4 | 4 | ?> |
5 | 5 | <header class="venue-header <?php echo sanitize_html_class($wrap_class); ?>"> |
6 | 6 | <h1 id="venue-details-h1" class="entry-title"> |
7 | 7 | <a class="" href="<?php the_permalink(); ?>"><?php the_title(); ?></a> |
8 | 8 | </h1> |
9 | - <?php if ( has_excerpt( $post->ID )) { the_excerpt(); } ?> |
|
9 | + <?php if (has_excerpt($post->ID)) { the_excerpt(); } ?> |
|
10 | 10 | </header> |
11 | 11 | <!-- .venue-content --> |
@@ -18,52 +18,52 @@ |
||
18 | 18 | * and/or use any of the template tags functions found in: |
19 | 19 | * \wp-content\plugins\event-espresso-core\public\template_tags.php |
20 | 20 | ************************** IMPORTANT **************************/ |
21 | -add_filter( 'FHEE__content_espresso_events__template_loaded', '__return_true' ); |
|
21 | +add_filter('FHEE__content_espresso_events__template_loaded', '__return_true'); |
|
22 | 22 | |
23 | 23 | //echo '<br/><h6 style="color:#2EA2CC;">'. __FILE__ . ' <span style="font-weight:normal;color:#E76700"> Line #: ' . __LINE__ . '</span></h6>'; |
24 | 24 | |
25 | 25 | global $post; |
26 | -$event_class = has_excerpt( $post->ID ) ? ' has-excerpt' : ''; |
|
27 | -$event_class = apply_filters( 'FHEE__content_espresso_events__event_class', $event_class ); |
|
26 | +$event_class = has_excerpt($post->ID) ? ' has-excerpt' : ''; |
|
27 | +$event_class = apply_filters('FHEE__content_espresso_events__event_class', $event_class); |
|
28 | 28 | ?> |
29 | -<?php do_action( 'AHEE_event_details_before_post', $post ); ?> |
|
30 | -<article id="post-<?php the_ID(); ?>" <?php post_class( $event_class ); ?>> |
|
29 | +<?php do_action('AHEE_event_details_before_post', $post); ?> |
|
30 | +<article id="post-<?php the_ID(); ?>" <?php post_class($event_class); ?>> |
|
31 | 31 | |
32 | -<?php if ( is_single() ) : ?> |
|
32 | +<?php if (is_single()) : ?> |
|
33 | 33 | |
34 | 34 | <div id="espresso-event-header-dv-<?php echo esc_attr($post->ID); ?>" class="espresso-event-header-dv"> |
35 | - <?php espresso_get_template_part( 'content', 'espresso_events-thumbnail' ); ?> |
|
36 | - <?php espresso_get_template_part( 'content', 'espresso_events-header' ); ?> |
|
35 | + <?php espresso_get_template_part('content', 'espresso_events-thumbnail'); ?> |
|
36 | + <?php espresso_get_template_part('content', 'espresso_events-header'); ?> |
|
37 | 37 | </div> |
38 | 38 | |
39 | 39 | <div class="espresso-event-wrapper-dv"> |
40 | - <?php espresso_get_template_part( 'content', 'espresso_events-tickets' ); ?> |
|
41 | - <?php espresso_get_template_part( 'content', 'espresso_events-datetimes' ); ?> |
|
42 | - <?php espresso_get_template_part( 'content', 'espresso_events-details' ); ?> |
|
43 | - <?php espresso_get_template_part( 'content', 'espresso_events-venues' ); ?> |
|
40 | + <?php espresso_get_template_part('content', 'espresso_events-tickets'); ?> |
|
41 | + <?php espresso_get_template_part('content', 'espresso_events-datetimes'); ?> |
|
42 | + <?php espresso_get_template_part('content', 'espresso_events-details'); ?> |
|
43 | + <?php espresso_get_template_part('content', 'espresso_events-venues'); ?> |
|
44 | 44 | <footer class="event-meta"> |
45 | - <?php do_action( 'AHEE_event_details_footer_top', $post ); ?> |
|
46 | - <?php do_action( 'AHEE_event_details_footer_bottom', $post ); ?> |
|
45 | + <?php do_action('AHEE_event_details_footer_top', $post); ?> |
|
46 | + <?php do_action('AHEE_event_details_footer_bottom', $post); ?> |
|
47 | 47 | </footer> |
48 | 48 | </div> |
49 | 49 | |
50 | -<?php elseif ( is_archive() ) : ?> |
|
50 | +<?php elseif (is_archive()) : ?> |
|
51 | 51 | |
52 | 52 | <div id="espresso-event-list-header-dv-<?php echo esc_attr($post->ID); ?>" class="espresso-event-header-dv"> |
53 | - <?php espresso_get_template_part( 'content', 'espresso_events-thumbnail' ); ?> |
|
54 | - <?php espresso_get_template_part( 'content', 'espresso_events-header' ); ?> |
|
53 | + <?php espresso_get_template_part('content', 'espresso_events-thumbnail'); ?> |
|
54 | + <?php espresso_get_template_part('content', 'espresso_events-header'); ?> |
|
55 | 55 | </div> |
56 | 56 | |
57 | 57 | <div class="espresso-event-list-wrapper-dv"> |
58 | - <?php espresso_get_template_part( 'content', 'espresso_events-tickets' ); ?> |
|
59 | - <?php espresso_get_template_part( 'content', 'espresso_events-datetimes' ); ?> |
|
60 | - <?php espresso_get_template_part( 'content', 'espresso_events-details' ); ?> |
|
61 | - <?php espresso_get_template_part( 'content', 'espresso_events-venues' ); ?> |
|
58 | + <?php espresso_get_template_part('content', 'espresso_events-tickets'); ?> |
|
59 | + <?php espresso_get_template_part('content', 'espresso_events-datetimes'); ?> |
|
60 | + <?php espresso_get_template_part('content', 'espresso_events-details'); ?> |
|
61 | + <?php espresso_get_template_part('content', 'espresso_events-venues'); ?> |
|
62 | 62 | </div> |
63 | 63 | |
64 | 64 | <?php endif; ?> |
65 | 65 | |
66 | 66 | </article> |
67 | 67 | <!-- #post --> |
68 | -<?php do_action( 'AHEE_event_details_after_post', $post ); |
|
68 | +<?php do_action('AHEE_event_details_after_post', $post); |
|
69 | 69 |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | global $post; |
4 | -do_action( 'AHEE_event_details_before_featured_img', $post ); |
|
4 | +do_action('AHEE_event_details_before_featured_img', $post); |
|
5 | 5 | |
6 | -if ( has_post_thumbnail( $post->ID )) : |
|
7 | - if ( $img_ID = get_post_thumbnail_id( $post->ID )) : |
|
8 | - if ( $featured_img = wp_get_attachment_image_src( $img_ID, 'large' )) : |
|
9 | - $caption = get_post( get_post( $img_ID ))->post_excerpt; |
|
6 | +if (has_post_thumbnail($post->ID)) : |
|
7 | + if ($img_ID = get_post_thumbnail_id($post->ID)) : |
|
8 | + if ($featured_img = wp_get_attachment_image_src($img_ID, 'large')) : |
|
9 | + $caption = get_post(get_post($img_ID))->post_excerpt; |
|
10 | 10 | ?> |
11 | 11 | <div id="ee-event-img-dv-<?php echo esc_attr($post->ID); ?>" class="ee-event-img-dv"> |
12 | - <a class="ee-event-img-lnk" href="<?php the_permalink(); ?>"<?php echo EED_Events_Archive::link_target();?>> |
|
12 | + <a class="ee-event-img-lnk" href="<?php the_permalink(); ?>"<?php echo EED_Events_Archive::link_target(); ?>> |
|
13 | 13 | <img alt="<?php echo esc_attr($caption); ?>" |
14 | 14 | class="ee-event-img" |
15 | 15 | height="<?php echo esc_attr($featured_img[2]); ?>" |
@@ -23,4 +23,4 @@ discard block |
||
23 | 23 | endif; |
24 | 24 | endif; |
25 | 25 | ?> |
26 | -<?php do_action( 'AHEE_event_details_after_featured_img', $post );?> |
|
26 | +<?php do_action('AHEE_event_details_after_featured_img', $post); ?> |
@@ -11,41 +11,41 @@ |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | global $post; |
14 | -$wrap_class = has_excerpt( $post->ID ) ? ' has-excerpt' : ''; |
|
14 | +$wrap_class = has_excerpt($post->ID) ? ' has-excerpt' : ''; |
|
15 | 15 | ?> |
16 | -<?php do_action( 'AHEE__content_espresso_venues_template__before_post', $post ); ?> |
|
17 | -<article id="post-<?php the_ID(); ?>" <?php post_class( 'espresso-venue-details entry-content ' . $wrap_class ); ?>> |
|
16 | +<?php do_action('AHEE__content_espresso_venues_template__before_post', $post); ?> |
|
17 | +<article id="post-<?php the_ID(); ?>" <?php post_class('espresso-venue-details entry-content '.$wrap_class); ?>> |
|
18 | 18 | |
19 | -<?php if ( is_single() ) : ?> |
|
19 | +<?php if (is_single()) : ?> |
|
20 | 20 | |
21 | 21 | <div id="espresso-venue-header-dv-<?php echo esc_attr($post->ID); ?>" class="espresso-venue-header-dv"> |
22 | - <?php espresso_get_template_part( 'content', 'espresso_venues-thumbnail' ); ?> |
|
23 | - <?php espresso_get_template_part( 'content', 'espresso_venues-header' ); ?> |
|
22 | + <?php espresso_get_template_part('content', 'espresso_venues-thumbnail'); ?> |
|
23 | + <?php espresso_get_template_part('content', 'espresso_venues-header'); ?> |
|
24 | 24 | </div> |
25 | 25 | |
26 | 26 | <div class="espresso-venue-wrapper-dv"> |
27 | - <?php espresso_get_template_part( 'content', 'espresso_venues-details' ); ?> |
|
28 | - <?php espresso_get_template_part( 'content', 'espresso_venues-location' ); ?> |
|
27 | + <?php espresso_get_template_part('content', 'espresso_venues-details'); ?> |
|
28 | + <?php espresso_get_template_part('content', 'espresso_venues-location'); ?> |
|
29 | 29 | <footer class="venue-meta"> |
30 | - <?php do_action( 'AHEE__content_espresso_venues_template__footer_top', $post ); ?> |
|
31 | - <?php do_action( 'AHEE__content_espresso_venues_template__footer_bottom', $post ); ?> |
|
30 | + <?php do_action('AHEE__content_espresso_venues_template__footer_top', $post); ?> |
|
31 | + <?php do_action('AHEE__content_espresso_venues_template__footer_bottom', $post); ?> |
|
32 | 32 | </footer> |
33 | 33 | </div> |
34 | 34 | |
35 | -<?php elseif ( is_archive() ) : ?> |
|
35 | +<?php elseif (is_archive()) : ?> |
|
36 | 36 | |
37 | 37 | <div id="espresso-venue-header-dv-<?php echo esc_attr($post->ID); ?>" class="espresso-venue-header-dv"> |
38 | - <?php espresso_get_template_part( 'content', 'espresso_venues-thumbnail' ); ?> |
|
39 | - <?php espresso_get_template_part( 'content', 'espresso_venues-header' ); ?> |
|
38 | + <?php espresso_get_template_part('content', 'espresso_venues-thumbnail'); ?> |
|
39 | + <?php espresso_get_template_part('content', 'espresso_venues-header'); ?> |
|
40 | 40 | </div> |
41 | 41 | |
42 | 42 | <div class="espresso-venue-wrapper-dv"> |
43 | - <?php espresso_get_template_part( 'content', 'espresso_venues-details' ); ?> |
|
43 | + <?php espresso_get_template_part('content', 'espresso_venues-details'); ?> |
|
44 | 44 | </div> |
45 | 45 | |
46 | 46 | <?php endif; ?> |
47 | 47 | |
48 | 48 | </article> |
49 | 49 | <!-- #post --> |
50 | -<?php do_action( 'AHEE__content_espresso_venues_template__after_post', $post ); |
|
50 | +<?php do_action('AHEE__content_espresso_venues_template__after_post', $post); |
|
51 | 51 |
@@ -21,21 +21,21 @@ discard block |
||
21 | 21 | * and/or use any of the template tags functions found in: |
22 | 22 | * \wp-content\plugins\event-espresso-core\public\template_tags.php |
23 | 23 | ************************** IMPORTANT **************************/ |
24 | -add_filter( 'FHEE__content_espresso_events__template_loaded', '__return_false' ); |
|
24 | +add_filter('FHEE__content_espresso_events__template_loaded', '__return_false'); |
|
25 | 25 | |
26 | 26 | |
27 | 27 | global $post; |
28 | -$event_class = has_excerpt( $post->ID ) ? ' has-excerpt' : ''; |
|
29 | -$event_class = apply_filters( 'FHEE__content_espresso_events__event_class', $event_class ); |
|
28 | +$event_class = has_excerpt($post->ID) ? ' has-excerpt' : ''; |
|
29 | +$event_class = apply_filters('FHEE__content_espresso_events__event_class', $event_class); |
|
30 | 30 | ?> |
31 | -<?php do_action( 'AHEE_event_details_before_post', $post ); ?> |
|
32 | -<article id="post-<?php the_ID(); ?>" <?php post_class( $event_class ); ?>> |
|
31 | +<?php do_action('AHEE_event_details_before_post', $post); ?> |
|
32 | +<article id="post-<?php the_ID(); ?>" <?php post_class($event_class); ?>> |
|
33 | 33 | |
34 | -<?php if ( is_single() ) : ?> |
|
34 | +<?php if (is_single()) : ?> |
|
35 | 35 | |
36 | - <div id="espresso-event-header-dv-<?php echo esc_attr($post->ID);?>" class="espresso-event-header-dv"> |
|
37 | - <?php espresso_get_template_part( 'content', 'espresso_events-thumbnail' ); ?> |
|
38 | - <?php espresso_get_template_part( 'content', 'espresso_events-header' ); ?> |
|
36 | + <div id="espresso-event-header-dv-<?php echo esc_attr($post->ID); ?>" class="espresso-event-header-dv"> |
|
37 | + <?php espresso_get_template_part('content', 'espresso_events-thumbnail'); ?> |
|
38 | + <?php espresso_get_template_part('content', 'espresso_events-header'); ?> |
|
39 | 39 | </div> |
40 | 40 | |
41 | 41 | <div class="espresso-event-wrapper-dv"> |
@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | <?php //espresso_get_template_part( 'content', 'espresso_events-details' ); ?> |
46 | 46 | <?php //espresso_get_template_part( 'content', 'espresso_events-venues' ); ?> |
47 | 47 | <footer class="event-meta"> |
48 | - <?php do_action( 'AHEE_event_details_footer_top', $post ); ?> |
|
49 | - <?php do_action( 'AHEE_event_details_footer_bottom', $post ); ?> |
|
48 | + <?php do_action('AHEE_event_details_footer_top', $post); ?> |
|
49 | + <?php do_action('AHEE_event_details_footer_bottom', $post); ?> |
|
50 | 50 | </footer> |
51 | 51 | </div> |
52 | 52 | |
53 | -<?php elseif ( is_archive() ) : ?> |
|
53 | +<?php elseif (is_archive()) : ?> |
|
54 | 54 | |
55 | 55 | <div id="espresso-event-list-header-dv-<?php echo esc_attr($post->ID); ?>" class="espresso-event-header-dv"> |
56 | - <?php espresso_get_template_part( 'content', 'espresso_events-thumbnail' ); ?> |
|
57 | - <?php espresso_get_template_part( 'content', 'espresso_events-header' ); ?> |
|
56 | + <?php espresso_get_template_part('content', 'espresso_events-thumbnail'); ?> |
|
57 | + <?php espresso_get_template_part('content', 'espresso_events-header'); ?> |
|
58 | 58 | </div> |
59 | 59 | |
60 | 60 | <div class="espresso-event-list-wrapper-dv"> |
@@ -69,5 +69,5 @@ discard block |
||
69 | 69 | |
70 | 70 | </article> |
71 | 71 | <!-- #post --> |
72 | -<?php do_action( 'AHEE_event_details_after_post', $post ); |
|
72 | +<?php do_action('AHEE_event_details_after_post', $post); |
|
73 | 73 |
@@ -12,109 +12,109 @@ discard block |
||
12 | 12 | class EEW_Upcoming_Events extends EspressoWidget |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * @var string |
|
17 | - */ |
|
18 | - private $title; |
|
19 | - /** |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - private $events_category; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var bool |
|
26 | - */ |
|
27 | - private $show_expired; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var string |
|
31 | - */ |
|
32 | - private $image_size; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var bool |
|
36 | - */ |
|
37 | - private $show_desc; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var bool |
|
41 | - */ |
|
42 | - private $show_dates; |
|
43 | - |
|
44 | - /** |
|
45 | - * @var string |
|
46 | - */ |
|
47 | - private $date_limit; |
|
48 | - |
|
49 | - /** |
|
50 | - * @var string |
|
51 | - */ |
|
52 | - private $date_range; |
|
53 | - |
|
54 | - /** |
|
55 | - * @var string |
|
56 | - */ |
|
57 | - private $limit; |
|
58 | - |
|
59 | - /** |
|
60 | - * @var string |
|
61 | - */ |
|
62 | - private $order; |
|
63 | - |
|
64 | - |
|
65 | - /** |
|
66 | - * Register widget with WordPress. |
|
67 | - */ |
|
68 | - public function __construct() |
|
69 | - { |
|
70 | - parent::__construct( |
|
71 | - esc_html__('Event Espresso Upcoming Events', 'event_espresso'), |
|
72 | - ['description' => esc_html__('A widget to display your upcoming events.', 'event_espresso')] |
|
73 | - ); |
|
74 | - } |
|
75 | - |
|
76 | - |
|
77 | - /** |
|
78 | - * Back-end widget form. |
|
79 | - * |
|
80 | - * @param array $instance Previously saved values from database. |
|
81 | - * @return void |
|
82 | - * @throws EE_Error |
|
83 | - * @throws ReflectionException |
|
84 | - * @see WP_Widget::form() |
|
85 | - */ |
|
86 | - public function form($instance) |
|
87 | - { |
|
88 | - |
|
89 | - EE_Registry::instance()->load_class('Question_Option', [], false, false, true); |
|
90 | - // Set up some default widget settings. |
|
91 | - $defaults = [ |
|
92 | - 'title' => esc_html__('Upcoming Events', 'event_espresso'), |
|
93 | - 'category_name' => '', |
|
94 | - 'show_expired' => 0, |
|
95 | - 'show_desc' => true, |
|
96 | - 'show_dates' => true, |
|
97 | - 'show_everywhere' => false, |
|
98 | - 'date_limit' => 2, |
|
99 | - 'limit' => 10, |
|
100 | - 'sort' => 'ASC', |
|
101 | - 'date_range' => false, |
|
102 | - 'image_size' => 'medium', |
|
103 | - ]; |
|
104 | - |
|
105 | - $instance = wp_parse_args((array) $instance, $defaults); |
|
106 | - // don't add HTML labels for EE_Form_Fields generated inputs |
|
107 | - add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
108 | - $yes_no_values = [ |
|
109 | - EE_Question_Option::new_instance(['QSO_value' => false, 'QSO_desc' => esc_html__('No', 'event_espresso')]), |
|
110 | - EE_Question_Option::new_instance(['QSO_value' => true, 'QSO_desc' => esc_html__('Yes', 'event_espresso')]), |
|
111 | - ]; |
|
112 | - $sort_values = [ |
|
113 | - EE_Question_Option::new_instance(['QSO_value' => 'ASC', 'QSO_desc' => esc_html__('ASC', 'event_espresso')]), |
|
114 | - EE_Question_Option::new_instance(['QSO_value' => 'DESC', 'QSO_desc' => esc_html__('DESC', 'event_espresso')]), |
|
115 | - ]; |
|
116 | - |
|
117 | - ?> |
|
15 | + /** |
|
16 | + * @var string |
|
17 | + */ |
|
18 | + private $title; |
|
19 | + /** |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + private $events_category; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var bool |
|
26 | + */ |
|
27 | + private $show_expired; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var string |
|
31 | + */ |
|
32 | + private $image_size; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var bool |
|
36 | + */ |
|
37 | + private $show_desc; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var bool |
|
41 | + */ |
|
42 | + private $show_dates; |
|
43 | + |
|
44 | + /** |
|
45 | + * @var string |
|
46 | + */ |
|
47 | + private $date_limit; |
|
48 | + |
|
49 | + /** |
|
50 | + * @var string |
|
51 | + */ |
|
52 | + private $date_range; |
|
53 | + |
|
54 | + /** |
|
55 | + * @var string |
|
56 | + */ |
|
57 | + private $limit; |
|
58 | + |
|
59 | + /** |
|
60 | + * @var string |
|
61 | + */ |
|
62 | + private $order; |
|
63 | + |
|
64 | + |
|
65 | + /** |
|
66 | + * Register widget with WordPress. |
|
67 | + */ |
|
68 | + public function __construct() |
|
69 | + { |
|
70 | + parent::__construct( |
|
71 | + esc_html__('Event Espresso Upcoming Events', 'event_espresso'), |
|
72 | + ['description' => esc_html__('A widget to display your upcoming events.', 'event_espresso')] |
|
73 | + ); |
|
74 | + } |
|
75 | + |
|
76 | + |
|
77 | + /** |
|
78 | + * Back-end widget form. |
|
79 | + * |
|
80 | + * @param array $instance Previously saved values from database. |
|
81 | + * @return void |
|
82 | + * @throws EE_Error |
|
83 | + * @throws ReflectionException |
|
84 | + * @see WP_Widget::form() |
|
85 | + */ |
|
86 | + public function form($instance) |
|
87 | + { |
|
88 | + |
|
89 | + EE_Registry::instance()->load_class('Question_Option', [], false, false, true); |
|
90 | + // Set up some default widget settings. |
|
91 | + $defaults = [ |
|
92 | + 'title' => esc_html__('Upcoming Events', 'event_espresso'), |
|
93 | + 'category_name' => '', |
|
94 | + 'show_expired' => 0, |
|
95 | + 'show_desc' => true, |
|
96 | + 'show_dates' => true, |
|
97 | + 'show_everywhere' => false, |
|
98 | + 'date_limit' => 2, |
|
99 | + 'limit' => 10, |
|
100 | + 'sort' => 'ASC', |
|
101 | + 'date_range' => false, |
|
102 | + 'image_size' => 'medium', |
|
103 | + ]; |
|
104 | + |
|
105 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
106 | + // don't add HTML labels for EE_Form_Fields generated inputs |
|
107 | + add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
108 | + $yes_no_values = [ |
|
109 | + EE_Question_Option::new_instance(['QSO_value' => false, 'QSO_desc' => esc_html__('No', 'event_espresso')]), |
|
110 | + EE_Question_Option::new_instance(['QSO_value' => true, 'QSO_desc' => esc_html__('Yes', 'event_espresso')]), |
|
111 | + ]; |
|
112 | + $sort_values = [ |
|
113 | + EE_Question_Option::new_instance(['QSO_value' => 'ASC', 'QSO_desc' => esc_html__('ASC', 'event_espresso')]), |
|
114 | + EE_Question_Option::new_instance(['QSO_value' => 'DESC', 'QSO_desc' => esc_html__('DESC', 'event_espresso')]), |
|
115 | + ]; |
|
116 | + |
|
117 | + ?> |
|
118 | 118 | |
119 | 119 | <!-- Widget Title: Text Input --> |
120 | 120 | |
@@ -151,32 +151,32 @@ discard block |
||
151 | 151 | <?php esc_html_e('Show Expired Events:', 'event_espresso'); ?> |
152 | 152 | </label> |
153 | 153 | <?php |
154 | - $show_expired_options = $yes_no_values; |
|
155 | - $show_expired_options[] = EE_Question_Option::new_instance( |
|
156 | - ['QSO_value' => 2, 'QSO_desc' => esc_html__('Show Only Expired', 'event_espresso')] |
|
157 | - ); |
|
158 | - echo EEH_Form_Fields::select( |
|
159 | - esc_html__('Show Expired Events:', 'event_espresso'), |
|
160 | - $instance['show_expired'], |
|
161 | - $show_expired_options, |
|
162 | - $this->fieldName('show_expired'), |
|
163 | - $this->fieldID('show_expired') |
|
164 | - ); |
|
165 | - ?> |
|
154 | + $show_expired_options = $yes_no_values; |
|
155 | + $show_expired_options[] = EE_Question_Option::new_instance( |
|
156 | + ['QSO_value' => 2, 'QSO_desc' => esc_html__('Show Only Expired', 'event_espresso')] |
|
157 | + ); |
|
158 | + echo EEH_Form_Fields::select( |
|
159 | + esc_html__('Show Expired Events:', 'event_espresso'), |
|
160 | + $instance['show_expired'], |
|
161 | + $show_expired_options, |
|
162 | + $this->fieldName('show_expired'), |
|
163 | + $this->fieldID('show_expired') |
|
164 | + ); |
|
165 | + ?> |
|
166 | 166 | </p> |
167 | 167 | <p> |
168 | 168 | <label for="<?php echo esc_attr($this->fieldID('sort')); ?>"> |
169 | 169 | <?php esc_html_e('Sort Events:', 'event_espresso'); ?> |
170 | 170 | </label> |
171 | 171 | <?php |
172 | - echo EEH_Form_Fields::select( |
|
173 | - esc_html__('Sort Events:', 'event_espresso'), |
|
174 | - $instance['sort'], |
|
175 | - $sort_values, |
|
176 | - $this->fieldName('sort'), |
|
177 | - $this->fieldID('sort') |
|
178 | - ); |
|
179 | - ?> |
|
172 | + echo EEH_Form_Fields::select( |
|
173 | + esc_html__('Sort Events:', 'event_espresso'), |
|
174 | + $instance['sort'], |
|
175 | + $sort_values, |
|
176 | + $this->fieldName('sort'), |
|
177 | + $this->fieldID('sort') |
|
178 | + ); |
|
179 | + ?> |
|
180 | 180 | </p> |
181 | 181 | <p> |
182 | 182 | <label for="<?php echo esc_attr($this->fieldID('image_size')); ?>"> |
@@ -190,42 +190,42 @@ discard block |
||
190 | 190 | <?php esc_html_e('Show Description:', 'event_espresso'); ?> |
191 | 191 | </label> |
192 | 192 | <?php |
193 | - echo EEH_Form_Fields::select( |
|
194 | - esc_html__('Show Description:', 'event_espresso'), |
|
195 | - $instance['show_desc'], |
|
196 | - $yes_no_values, |
|
197 | - $this->fieldName('show_desc'), |
|
198 | - $this->fieldID('show_desc') |
|
199 | - ); |
|
200 | - ?> |
|
193 | + echo EEH_Form_Fields::select( |
|
194 | + esc_html__('Show Description:', 'event_espresso'), |
|
195 | + $instance['show_desc'], |
|
196 | + $yes_no_values, |
|
197 | + $this->fieldName('show_desc'), |
|
198 | + $this->fieldID('show_desc') |
|
199 | + ); |
|
200 | + ?> |
|
201 | 201 | </p> |
202 | 202 | <p> |
203 | 203 | <label for="<?php echo esc_attr($this->fieldID('show_dates')); ?>"> |
204 | 204 | <?php esc_html_e('Show Dates:', 'event_espresso'); ?> |
205 | 205 | </label> |
206 | 206 | <?php |
207 | - echo EEH_Form_Fields::select( |
|
208 | - esc_html__('Show Dates:', 'event_espresso'), |
|
209 | - $instance['show_dates'], |
|
210 | - $yes_no_values, |
|
211 | - $this->fieldName('show_dates'), |
|
212 | - $this->fieldID('show_dates') |
|
213 | - ); |
|
214 | - ?> |
|
207 | + echo EEH_Form_Fields::select( |
|
208 | + esc_html__('Show Dates:', 'event_espresso'), |
|
209 | + $instance['show_dates'], |
|
210 | + $yes_no_values, |
|
211 | + $this->fieldName('show_dates'), |
|
212 | + $this->fieldID('show_dates') |
|
213 | + ); |
|
214 | + ?> |
|
215 | 215 | </p> |
216 | 216 | <p> |
217 | 217 | <label for="<?php echo esc_attr($this->fieldID('show_everywhere')); ?>"> |
218 | 218 | <?php esc_html_e('Show on all Pages:', 'event_espresso'); ?> |
219 | 219 | </label> |
220 | 220 | <?php |
221 | - echo EEH_Form_Fields::select( |
|
222 | - esc_html__('Show on all Pages:', 'event_espresso'), |
|
223 | - $instance['show_everywhere'], |
|
224 | - $yes_no_values, |
|
225 | - $this->fieldName('show_everywhere'), |
|
226 | - $this->fieldID('show_everywhere') |
|
227 | - ); |
|
228 | - ?> |
|
221 | + echo EEH_Form_Fields::select( |
|
222 | + esc_html__('Show on all Pages:', 'event_espresso'), |
|
223 | + $instance['show_everywhere'], |
|
224 | + $yes_no_values, |
|
225 | + $this->fieldName('show_everywhere'), |
|
226 | + $this->fieldID('show_everywhere') |
|
227 | + ); |
|
228 | + ?> |
|
229 | 229 | </p> |
230 | 230 | <p> |
231 | 231 | <label for="<?php echo esc_attr($this->fieldID('date_limit')); ?>"> |
@@ -243,278 +243,278 @@ discard block |
||
243 | 243 | <?php esc_html_e('Show Date Range:', 'event_espresso'); ?> |
244 | 244 | </label> |
245 | 245 | <?php |
246 | - echo EEH_Form_Fields::select( |
|
247 | - esc_html__('Show Date Range:', 'event_espresso'), |
|
248 | - $instance['date_range'], |
|
249 | - $yes_no_values, |
|
250 | - $this->fieldName('date_range'), |
|
251 | - $this->fieldID('date_range') |
|
252 | - ); |
|
253 | - ?> |
|
246 | + echo EEH_Form_Fields::select( |
|
247 | + esc_html__('Show Date Range:', 'event_espresso'), |
|
248 | + $instance['date_range'], |
|
249 | + $yes_no_values, |
|
250 | + $this->fieldName('date_range'), |
|
251 | + $this->fieldID('date_range') |
|
252 | + ); |
|
253 | + ?> |
|
254 | 254 | <span class="description"> |
255 | 255 | <br /> |
256 | 256 | <?php esc_html_e( |
257 | - 'This setting will replace the list of dates in the widget.', |
|
258 | - 'event_espresso' |
|
259 | - ); ?> |
|
257 | + 'This setting will replace the list of dates in the widget.', |
|
258 | + 'event_espresso' |
|
259 | + ); ?> |
|
260 | 260 | </span> |
261 | 261 | </p> |
262 | 262 | |
263 | 263 | <?php |
264 | - } |
|
265 | - |
|
266 | - |
|
267 | - /** |
|
268 | - * Sanitize widget form values as they are saved. |
|
269 | - * |
|
270 | - * @param array $new_instance Values just sent to be saved. |
|
271 | - * @param array $old_instance Previously saved values from database. |
|
272 | - * |
|
273 | - * @return array Updated safe values to be saved. |
|
274 | - * @see WP_Widget::update() |
|
275 | - * |
|
276 | - */ |
|
277 | - public function update($new_instance, $old_instance) |
|
278 | - { |
|
279 | - $instance = $old_instance; |
|
280 | - $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
281 | - $instance['category_name'] = $new_instance['category_name']; |
|
282 | - $instance['show_expired'] = $new_instance['show_expired']; |
|
283 | - $instance['limit'] = $new_instance['limit']; |
|
284 | - $instance['sort'] = $new_instance['sort']; |
|
285 | - $instance['image_size'] = $new_instance['image_size']; |
|
286 | - $instance['show_desc'] = $new_instance['show_desc']; |
|
287 | - $instance['show_dates'] = $new_instance['show_dates']; |
|
288 | - $instance['show_everywhere'] = $new_instance['show_everywhere']; |
|
289 | - $instance['date_limit'] = $new_instance['date_limit']; |
|
290 | - $instance['date_range'] = $new_instance['date_range']; |
|
291 | - return $instance; |
|
292 | - } |
|
293 | - |
|
294 | - |
|
295 | - /** |
|
296 | - * Front-end display of widget. |
|
297 | - * |
|
298 | - * @param array $args Widget arguments. |
|
299 | - * @param array $instance Saved values from database. |
|
300 | - * @throws EE_Error |
|
301 | - * @throws ReflectionException |
|
302 | - * @see WP_Widget::widget() |
|
303 | - * |
|
304 | - */ |
|
305 | - public function widget($args, $instance) |
|
306 | - { |
|
307 | - |
|
308 | - global $post; |
|
309 | - // make sure there is some kinda post object |
|
310 | - if ($post instanceof WP_Post) { |
|
311 | - $before_widget = ''; |
|
312 | - $before_title = ''; |
|
313 | - $after_title = ''; |
|
314 | - $after_widget = ''; |
|
315 | - // but NOT an events archives page, cuz that would be like two event lists on the same page |
|
316 | - $show_everywhere = ! isset($instance['show_everywhere']) || absint($instance['show_everywhere']); |
|
317 | - if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) { |
|
318 | - // let's use some of the event helper functions' |
|
319 | - // make separate vars out of attributes |
|
320 | - extract($args); |
|
321 | - |
|
322 | - // grab widget settings |
|
323 | - $this->parseWidgetSettings($instance); |
|
324 | - $title = $this->widgetTitle(); |
|
325 | - |
|
326 | - // Before widget (defined by themes). |
|
327 | - echo $before_widget; |
|
328 | - // Display the widget title if one was input (before and after defined by themes). |
|
329 | - if (! empty($title)) { |
|
330 | - echo $before_title . $title . $after_title; |
|
331 | - } |
|
332 | - echo $this->widgetContent($post); |
|
333 | - // After widget (defined by themes). |
|
334 | - echo $after_widget; |
|
335 | - } |
|
336 | - } |
|
337 | - } |
|
338 | - |
|
339 | - |
|
340 | - /** |
|
341 | - * make_the_title_a_link |
|
342 | - * callback for widget_title filter |
|
343 | - * |
|
344 | - * @param $title |
|
345 | - * @return string |
|
346 | - */ |
|
347 | - public function make_the_title_a_link($title) |
|
348 | - { |
|
349 | - return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
350 | - } |
|
351 | - |
|
352 | - |
|
353 | - /** |
|
354 | - * @param string $field_name |
|
355 | - * @return string |
|
356 | - * @since 4.10.14.p |
|
357 | - */ |
|
358 | - public function fieldID($field_name) |
|
359 | - { |
|
360 | - return parent::get_field_id($field_name); |
|
361 | - } |
|
362 | - |
|
363 | - |
|
364 | - /** |
|
365 | - * @param string $field_name |
|
366 | - * @return string |
|
367 | - * @since 4.10.14.p |
|
368 | - */ |
|
369 | - public function fieldName($field_name) |
|
370 | - { |
|
371 | - return parent::get_field_name($field_name); |
|
372 | - } |
|
373 | - |
|
374 | - |
|
375 | - /** |
|
376 | - * @param array $instance |
|
377 | - * @throws EE_Error |
|
378 | - * @throws ReflectionException |
|
379 | - * @since 4.10.14.p |
|
380 | - */ |
|
381 | - private function eventCategoriesSelector(array $instance) |
|
382 | - { |
|
383 | - $event_categories = []; |
|
384 | - $categories = EEM_Term::instance()->get_all_ee_categories(true); |
|
385 | - if ($categories) { |
|
386 | - foreach ($categories as $category) { |
|
387 | - if ($category instanceof EE_Term) { |
|
388 | - $event_categories[] = |
|
389 | - EE_Question_Option::new_instance( |
|
390 | - [ |
|
391 | - 'QSO_value' => $category->get('slug'), |
|
392 | - 'QSO_desc' => $category->get('name'), |
|
393 | - ] |
|
394 | - ); |
|
395 | - } |
|
396 | - } |
|
397 | - } |
|
398 | - array_unshift( |
|
399 | - $event_categories, |
|
400 | - EE_Question_Option::new_instance( |
|
401 | - [ |
|
402 | - 'QSO_value' => '', |
|
403 | - 'QSO_desc' => esc_html__(' - display all - ', 'event_espresso'), |
|
404 | - ] |
|
405 | - ) |
|
406 | - ); |
|
407 | - echo EEH_Form_Fields::select( |
|
408 | - esc_html__('Event Category:', 'event_espresso'), |
|
409 | - $instance['category_name'], |
|
410 | - $event_categories, |
|
411 | - $this->fieldName('category_name'), |
|
412 | - $this->fieldID('category_name') |
|
413 | - ); |
|
414 | - } |
|
415 | - |
|
416 | - |
|
417 | - /** |
|
418 | - * @param array $instance |
|
419 | - * @since 4.10.14.p |
|
420 | - */ |
|
421 | - private function imageSizeSelector(array $instance) |
|
422 | - { |
|
423 | - $image_sizes = []; |
|
424 | - $sizes = get_intermediate_image_sizes(); |
|
425 | - if ($sizes) { |
|
426 | - // loop thru images and create option objects out of them |
|
427 | - foreach ($sizes as $image_size) { |
|
428 | - $image_size = trim($image_size); |
|
429 | - // no big images plz |
|
430 | - if (! in_array($image_size, ['large', 'post-thumbnail'])) { |
|
431 | - $image_sizes[] = |
|
432 | - EE_Question_Option::new_instance(['QSO_value' => $image_size, 'QSO_desc' => $image_size]); |
|
433 | - } |
|
434 | - } |
|
435 | - $image_sizes[] = |
|
436 | - EE_Question_Option::new_instance( |
|
437 | - ['QSO_value' => 'none', 'QSO_desc' => esc_html__('don\'t show images', 'event_espresso')] |
|
438 | - ); |
|
439 | - } |
|
440 | - echo EEH_Form_Fields::select( |
|
441 | - esc_html__('Image Size:', 'event_espresso'), |
|
442 | - $instance['image_size'], |
|
443 | - $image_sizes, |
|
444 | - $this->fieldName('image_size'), |
|
445 | - $this->fieldID('image_size') |
|
446 | - ); |
|
447 | - } |
|
448 | - |
|
449 | - |
|
450 | - /** |
|
451 | - * @param array $instance |
|
452 | - * @since 4.10.14.p |
|
453 | - */ |
|
454 | - private function parseWidgetSettings(array $instance) |
|
455 | - { |
|
456 | - $this->title = isset($instance['title']) && ! empty($instance['title']) ? $instance['title'] : ''; |
|
457 | - $this->events_category = isset($instance['category_name']) && ! empty($instance['category_name']) |
|
458 | - ? $instance['category_name'] |
|
459 | - : false; |
|
460 | - $this->show_expired = isset($instance['show_expired']) |
|
461 | - ? filter_var($instance['show_expired'], FILTER_VALIDATE_BOOLEAN) |
|
462 | - : 0; |
|
463 | - $this->image_size = isset($instance['image_size']) && ! empty($instance['image_size']) |
|
464 | - ? $instance['image_size'] |
|
465 | - : 'medium'; |
|
466 | - $this->show_desc = ! isset($instance['show_desc']) |
|
467 | - || filter_var($instance['show_desc'], FILTER_VALIDATE_BOOLEAN); |
|
468 | - $this->show_dates = ! isset($instance['show_dates']) |
|
469 | - || filter_var($instance['show_dates'], FILTER_VALIDATE_BOOLEAN); |
|
470 | - $this->date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) |
|
471 | - ? $instance['date_limit'] |
|
472 | - : null; |
|
473 | - $this->date_range = isset($instance['date_range']) && ! empty($instance['date_range']) |
|
474 | - ? $instance['date_range'] |
|
475 | - : false; |
|
476 | - $this->limit = isset($instance['limit']) ? absint($instance['limit']) : 10; |
|
477 | - $this->order = isset($instance['sort']) && $instance['sort'] === 'DESC' |
|
478 | - ? 'DESC' |
|
479 | - : 'ASC'; |
|
480 | - } |
|
481 | - |
|
482 | - |
|
483 | - /** |
|
484 | - * @return mixed|void |
|
485 | - * @since 4.10.14.p |
|
486 | - */ |
|
487 | - private function widgetTitle() |
|
488 | - { |
|
489 | - // add function to make the title a link |
|
490 | - add_filter('widget_title', [$this, 'make_the_title_a_link'], 15); |
|
491 | - // filter the title |
|
492 | - $title = apply_filters('widget_title', $this->title); |
|
493 | - // remove the function from the filter, so it does not affect other widgets |
|
494 | - remove_filter('widget_title', [$this, 'make_the_title_a_link'], 15); |
|
495 | - return $title; |
|
496 | - } |
|
497 | - |
|
498 | - |
|
499 | - /** |
|
500 | - * @param WP_Post $post |
|
501 | - * @return string |
|
502 | - * @throws EE_Error |
|
503 | - * @throws ReflectionException |
|
504 | - * @since 4.10.14.p |
|
505 | - */ |
|
506 | - private function widgetContent(WP_Post $post) |
|
507 | - { |
|
508 | - // run the query |
|
509 | - $events = $this->getUpcomingEvents(); |
|
510 | - if (empty($events)) { |
|
511 | - return ''; |
|
512 | - } |
|
513 | - $list_items = ''; |
|
514 | - foreach ($events as $event) { |
|
515 | - if ($event instanceof EE_Event && (! is_single() || $post->ID != $event->ID())) { |
|
516 | - $event_url = $this->eventUrl($event); |
|
517 | - $list_items .= ' |
|
264 | + } |
|
265 | + |
|
266 | + |
|
267 | + /** |
|
268 | + * Sanitize widget form values as they are saved. |
|
269 | + * |
|
270 | + * @param array $new_instance Values just sent to be saved. |
|
271 | + * @param array $old_instance Previously saved values from database. |
|
272 | + * |
|
273 | + * @return array Updated safe values to be saved. |
|
274 | + * @see WP_Widget::update() |
|
275 | + * |
|
276 | + */ |
|
277 | + public function update($new_instance, $old_instance) |
|
278 | + { |
|
279 | + $instance = $old_instance; |
|
280 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
281 | + $instance['category_name'] = $new_instance['category_name']; |
|
282 | + $instance['show_expired'] = $new_instance['show_expired']; |
|
283 | + $instance['limit'] = $new_instance['limit']; |
|
284 | + $instance['sort'] = $new_instance['sort']; |
|
285 | + $instance['image_size'] = $new_instance['image_size']; |
|
286 | + $instance['show_desc'] = $new_instance['show_desc']; |
|
287 | + $instance['show_dates'] = $new_instance['show_dates']; |
|
288 | + $instance['show_everywhere'] = $new_instance['show_everywhere']; |
|
289 | + $instance['date_limit'] = $new_instance['date_limit']; |
|
290 | + $instance['date_range'] = $new_instance['date_range']; |
|
291 | + return $instance; |
|
292 | + } |
|
293 | + |
|
294 | + |
|
295 | + /** |
|
296 | + * Front-end display of widget. |
|
297 | + * |
|
298 | + * @param array $args Widget arguments. |
|
299 | + * @param array $instance Saved values from database. |
|
300 | + * @throws EE_Error |
|
301 | + * @throws ReflectionException |
|
302 | + * @see WP_Widget::widget() |
|
303 | + * |
|
304 | + */ |
|
305 | + public function widget($args, $instance) |
|
306 | + { |
|
307 | + |
|
308 | + global $post; |
|
309 | + // make sure there is some kinda post object |
|
310 | + if ($post instanceof WP_Post) { |
|
311 | + $before_widget = ''; |
|
312 | + $before_title = ''; |
|
313 | + $after_title = ''; |
|
314 | + $after_widget = ''; |
|
315 | + // but NOT an events archives page, cuz that would be like two event lists on the same page |
|
316 | + $show_everywhere = ! isset($instance['show_everywhere']) || absint($instance['show_everywhere']); |
|
317 | + if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) { |
|
318 | + // let's use some of the event helper functions' |
|
319 | + // make separate vars out of attributes |
|
320 | + extract($args); |
|
321 | + |
|
322 | + // grab widget settings |
|
323 | + $this->parseWidgetSettings($instance); |
|
324 | + $title = $this->widgetTitle(); |
|
325 | + |
|
326 | + // Before widget (defined by themes). |
|
327 | + echo $before_widget; |
|
328 | + // Display the widget title if one was input (before and after defined by themes). |
|
329 | + if (! empty($title)) { |
|
330 | + echo $before_title . $title . $after_title; |
|
331 | + } |
|
332 | + echo $this->widgetContent($post); |
|
333 | + // After widget (defined by themes). |
|
334 | + echo $after_widget; |
|
335 | + } |
|
336 | + } |
|
337 | + } |
|
338 | + |
|
339 | + |
|
340 | + /** |
|
341 | + * make_the_title_a_link |
|
342 | + * callback for widget_title filter |
|
343 | + * |
|
344 | + * @param $title |
|
345 | + * @return string |
|
346 | + */ |
|
347 | + public function make_the_title_a_link($title) |
|
348 | + { |
|
349 | + return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
350 | + } |
|
351 | + |
|
352 | + |
|
353 | + /** |
|
354 | + * @param string $field_name |
|
355 | + * @return string |
|
356 | + * @since 4.10.14.p |
|
357 | + */ |
|
358 | + public function fieldID($field_name) |
|
359 | + { |
|
360 | + return parent::get_field_id($field_name); |
|
361 | + } |
|
362 | + |
|
363 | + |
|
364 | + /** |
|
365 | + * @param string $field_name |
|
366 | + * @return string |
|
367 | + * @since 4.10.14.p |
|
368 | + */ |
|
369 | + public function fieldName($field_name) |
|
370 | + { |
|
371 | + return parent::get_field_name($field_name); |
|
372 | + } |
|
373 | + |
|
374 | + |
|
375 | + /** |
|
376 | + * @param array $instance |
|
377 | + * @throws EE_Error |
|
378 | + * @throws ReflectionException |
|
379 | + * @since 4.10.14.p |
|
380 | + */ |
|
381 | + private function eventCategoriesSelector(array $instance) |
|
382 | + { |
|
383 | + $event_categories = []; |
|
384 | + $categories = EEM_Term::instance()->get_all_ee_categories(true); |
|
385 | + if ($categories) { |
|
386 | + foreach ($categories as $category) { |
|
387 | + if ($category instanceof EE_Term) { |
|
388 | + $event_categories[] = |
|
389 | + EE_Question_Option::new_instance( |
|
390 | + [ |
|
391 | + 'QSO_value' => $category->get('slug'), |
|
392 | + 'QSO_desc' => $category->get('name'), |
|
393 | + ] |
|
394 | + ); |
|
395 | + } |
|
396 | + } |
|
397 | + } |
|
398 | + array_unshift( |
|
399 | + $event_categories, |
|
400 | + EE_Question_Option::new_instance( |
|
401 | + [ |
|
402 | + 'QSO_value' => '', |
|
403 | + 'QSO_desc' => esc_html__(' - display all - ', 'event_espresso'), |
|
404 | + ] |
|
405 | + ) |
|
406 | + ); |
|
407 | + echo EEH_Form_Fields::select( |
|
408 | + esc_html__('Event Category:', 'event_espresso'), |
|
409 | + $instance['category_name'], |
|
410 | + $event_categories, |
|
411 | + $this->fieldName('category_name'), |
|
412 | + $this->fieldID('category_name') |
|
413 | + ); |
|
414 | + } |
|
415 | + |
|
416 | + |
|
417 | + /** |
|
418 | + * @param array $instance |
|
419 | + * @since 4.10.14.p |
|
420 | + */ |
|
421 | + private function imageSizeSelector(array $instance) |
|
422 | + { |
|
423 | + $image_sizes = []; |
|
424 | + $sizes = get_intermediate_image_sizes(); |
|
425 | + if ($sizes) { |
|
426 | + // loop thru images and create option objects out of them |
|
427 | + foreach ($sizes as $image_size) { |
|
428 | + $image_size = trim($image_size); |
|
429 | + // no big images plz |
|
430 | + if (! in_array($image_size, ['large', 'post-thumbnail'])) { |
|
431 | + $image_sizes[] = |
|
432 | + EE_Question_Option::new_instance(['QSO_value' => $image_size, 'QSO_desc' => $image_size]); |
|
433 | + } |
|
434 | + } |
|
435 | + $image_sizes[] = |
|
436 | + EE_Question_Option::new_instance( |
|
437 | + ['QSO_value' => 'none', 'QSO_desc' => esc_html__('don\'t show images', 'event_espresso')] |
|
438 | + ); |
|
439 | + } |
|
440 | + echo EEH_Form_Fields::select( |
|
441 | + esc_html__('Image Size:', 'event_espresso'), |
|
442 | + $instance['image_size'], |
|
443 | + $image_sizes, |
|
444 | + $this->fieldName('image_size'), |
|
445 | + $this->fieldID('image_size') |
|
446 | + ); |
|
447 | + } |
|
448 | + |
|
449 | + |
|
450 | + /** |
|
451 | + * @param array $instance |
|
452 | + * @since 4.10.14.p |
|
453 | + */ |
|
454 | + private function parseWidgetSettings(array $instance) |
|
455 | + { |
|
456 | + $this->title = isset($instance['title']) && ! empty($instance['title']) ? $instance['title'] : ''; |
|
457 | + $this->events_category = isset($instance['category_name']) && ! empty($instance['category_name']) |
|
458 | + ? $instance['category_name'] |
|
459 | + : false; |
|
460 | + $this->show_expired = isset($instance['show_expired']) |
|
461 | + ? filter_var($instance['show_expired'], FILTER_VALIDATE_BOOLEAN) |
|
462 | + : 0; |
|
463 | + $this->image_size = isset($instance['image_size']) && ! empty($instance['image_size']) |
|
464 | + ? $instance['image_size'] |
|
465 | + : 'medium'; |
|
466 | + $this->show_desc = ! isset($instance['show_desc']) |
|
467 | + || filter_var($instance['show_desc'], FILTER_VALIDATE_BOOLEAN); |
|
468 | + $this->show_dates = ! isset($instance['show_dates']) |
|
469 | + || filter_var($instance['show_dates'], FILTER_VALIDATE_BOOLEAN); |
|
470 | + $this->date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) |
|
471 | + ? $instance['date_limit'] |
|
472 | + : null; |
|
473 | + $this->date_range = isset($instance['date_range']) && ! empty($instance['date_range']) |
|
474 | + ? $instance['date_range'] |
|
475 | + : false; |
|
476 | + $this->limit = isset($instance['limit']) ? absint($instance['limit']) : 10; |
|
477 | + $this->order = isset($instance['sort']) && $instance['sort'] === 'DESC' |
|
478 | + ? 'DESC' |
|
479 | + : 'ASC'; |
|
480 | + } |
|
481 | + |
|
482 | + |
|
483 | + /** |
|
484 | + * @return mixed|void |
|
485 | + * @since 4.10.14.p |
|
486 | + */ |
|
487 | + private function widgetTitle() |
|
488 | + { |
|
489 | + // add function to make the title a link |
|
490 | + add_filter('widget_title', [$this, 'make_the_title_a_link'], 15); |
|
491 | + // filter the title |
|
492 | + $title = apply_filters('widget_title', $this->title); |
|
493 | + // remove the function from the filter, so it does not affect other widgets |
|
494 | + remove_filter('widget_title', [$this, 'make_the_title_a_link'], 15); |
|
495 | + return $title; |
|
496 | + } |
|
497 | + |
|
498 | + |
|
499 | + /** |
|
500 | + * @param WP_Post $post |
|
501 | + * @return string |
|
502 | + * @throws EE_Error |
|
503 | + * @throws ReflectionException |
|
504 | + * @since 4.10.14.p |
|
505 | + */ |
|
506 | + private function widgetContent(WP_Post $post) |
|
507 | + { |
|
508 | + // run the query |
|
509 | + $events = $this->getUpcomingEvents(); |
|
510 | + if (empty($events)) { |
|
511 | + return ''; |
|
512 | + } |
|
513 | + $list_items = ''; |
|
514 | + foreach ($events as $event) { |
|
515 | + if ($event instanceof EE_Event && (! is_single() || $post->ID != $event->ID())) { |
|
516 | + $event_url = $this->eventUrl($event); |
|
517 | + $list_items .= ' |
|
518 | 518 | <li id="ee-upcoming-events-widget-li-' . esc_attr($event->ID()) . '" |
519 | 519 | class="ee-upcoming-events-widget-li" |
520 | 520 | > |
@@ -525,194 +525,194 @@ discard block |
||
525 | 525 | </h5> |
526 | 526 | ' . $this->eventWidgetContent($event, $event_url) . ' |
527 | 527 | </li>'; |
528 | - } |
|
529 | - } |
|
530 | - return ' |
|
528 | + } |
|
529 | + } |
|
530 | + return ' |
|
531 | 531 | <ul class="ee-upcoming-events-widget-ul"> |
532 | 532 | ' . $list_items . ' |
533 | 533 | </ul>'; |
534 | - } |
|
535 | - |
|
536 | - |
|
537 | - /** |
|
538 | - * @param EE_Event $event |
|
539 | - * @return string|null |
|
540 | - * @throws EE_Error |
|
541 | - * @since 4.10.14.p |
|
542 | - */ |
|
543 | - private function eventUrl(EE_Event $event) |
|
544 | - { |
|
545 | - return esc_url_raw( |
|
546 | - apply_filters( |
|
547 | - 'FHEE_EEW_Upcoming_Events__widget__event_url', |
|
548 | - $event->get_permalink(), |
|
549 | - $event |
|
550 | - ) |
|
551 | - ); |
|
552 | - } |
|
553 | - |
|
554 | - |
|
555 | - /** |
|
556 | - * @return EE_Base_Class[] |
|
557 | - * @throws EE_Error |
|
558 | - */ |
|
559 | - private function getUpcomingEvents() |
|
560 | - { |
|
561 | - return EEM_Event::instance()->get_all( |
|
562 | - [ |
|
563 | - $this->queryWhereParams(), |
|
564 | - 'limit' => '0,' . $this->limit, |
|
565 | - 'order_by' => 'Datetime.DTT_EVT_start', |
|
566 | - 'order' => $this->order, |
|
567 | - 'group_by' => 'EVT_ID', |
|
568 | - ] |
|
569 | - ); |
|
570 | - } |
|
571 | - |
|
572 | - |
|
573 | - /** |
|
574 | - * @return mixed|void |
|
575 | - * @throws EE_Error |
|
576 | - * @since 4.10.14.p |
|
577 | - */ |
|
578 | - private function queryWhereParams() |
|
579 | - { |
|
580 | - // start to build our where clause |
|
581 | - $where = [ |
|
582 | - 'status' => ['IN', ['publish', 'sold_out']], |
|
583 | - ]; |
|
584 | - // add category |
|
585 | - if ($this->events_category) { |
|
586 | - $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
|
587 | - $where['Term_Taxonomy.Term.slug'] = $this->events_category; |
|
588 | - } |
|
589 | - // if NOT expired then we want events that start today or in the future |
|
590 | - // if NOT show expired then we want events that start today or in the future |
|
591 | - if ($this->show_expired == 0) { |
|
592 | - $where['Datetime.DTT_EVT_end'] = [ |
|
593 | - '>=', |
|
594 | - EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'), |
|
595 | - ]; |
|
596 | - } |
|
597 | - // if show ONLY expired we want events that ended prior to today |
|
598 | - if ($this->show_expired == 2) { |
|
599 | - $where['Datetime.DTT_EVT_end'] = [ |
|
600 | - '<=', |
|
601 | - EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'), |
|
602 | - ]; |
|
603 | - } |
|
604 | - // allow $where to be filtered |
|
605 | - return apply_filters('FHEE__EEW_Upcoming_Events__widget__where', $where, $this->events_category, $this->show_expired); |
|
606 | - } |
|
607 | - |
|
608 | - |
|
609 | - /** |
|
610 | - * @param EE_Event $event |
|
611 | - * @return string |
|
612 | - * @throws EE_Error |
|
613 | - * @throws ReflectionException |
|
614 | - * @since 4.10.14.p |
|
615 | - */ |
|
616 | - private function linkClass(EE_Event $event) |
|
617 | - { |
|
618 | - // how big is the event name ? |
|
619 | - $name_length = strlen($event->name()); |
|
620 | - switch ($name_length) { |
|
621 | - case $name_length > 70: |
|
622 | - return ' three-line'; |
|
623 | - case $name_length > 35: |
|
624 | - return ' two-line'; |
|
625 | - } |
|
626 | - return ' one-line'; |
|
627 | - } |
|
628 | - |
|
629 | - |
|
630 | - /** |
|
631 | - * @param EE_Event $event |
|
632 | - * @param string $event_url |
|
633 | - * @return mixed|string|void |
|
634 | - * @throws EE_Error |
|
635 | - * @throws ReflectionException |
|
636 | - * @since 4.10.14.p |
|
637 | - */ |
|
638 | - private function eventWidgetContent(EE_Event $event, $event_url = '') |
|
639 | - { |
|
640 | - if (post_password_required($event->ID())) { |
|
641 | - return apply_filters( |
|
642 | - 'FHEE_EEW_Upcoming_Events__widget__password_form', |
|
643 | - get_the_password_form($event->ID()), |
|
644 | - $event |
|
645 | - ); |
|
646 | - } |
|
647 | - |
|
648 | - $content = ''; |
|
649 | - if (has_post_thumbnail($event->ID()) && $this->image_size != 'none') { |
|
650 | - $content .= ' |
|
534 | + } |
|
535 | + |
|
536 | + |
|
537 | + /** |
|
538 | + * @param EE_Event $event |
|
539 | + * @return string|null |
|
540 | + * @throws EE_Error |
|
541 | + * @since 4.10.14.p |
|
542 | + */ |
|
543 | + private function eventUrl(EE_Event $event) |
|
544 | + { |
|
545 | + return esc_url_raw( |
|
546 | + apply_filters( |
|
547 | + 'FHEE_EEW_Upcoming_Events__widget__event_url', |
|
548 | + $event->get_permalink(), |
|
549 | + $event |
|
550 | + ) |
|
551 | + ); |
|
552 | + } |
|
553 | + |
|
554 | + |
|
555 | + /** |
|
556 | + * @return EE_Base_Class[] |
|
557 | + * @throws EE_Error |
|
558 | + */ |
|
559 | + private function getUpcomingEvents() |
|
560 | + { |
|
561 | + return EEM_Event::instance()->get_all( |
|
562 | + [ |
|
563 | + $this->queryWhereParams(), |
|
564 | + 'limit' => '0,' . $this->limit, |
|
565 | + 'order_by' => 'Datetime.DTT_EVT_start', |
|
566 | + 'order' => $this->order, |
|
567 | + 'group_by' => 'EVT_ID', |
|
568 | + ] |
|
569 | + ); |
|
570 | + } |
|
571 | + |
|
572 | + |
|
573 | + /** |
|
574 | + * @return mixed|void |
|
575 | + * @throws EE_Error |
|
576 | + * @since 4.10.14.p |
|
577 | + */ |
|
578 | + private function queryWhereParams() |
|
579 | + { |
|
580 | + // start to build our where clause |
|
581 | + $where = [ |
|
582 | + 'status' => ['IN', ['publish', 'sold_out']], |
|
583 | + ]; |
|
584 | + // add category |
|
585 | + if ($this->events_category) { |
|
586 | + $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
|
587 | + $where['Term_Taxonomy.Term.slug'] = $this->events_category; |
|
588 | + } |
|
589 | + // if NOT expired then we want events that start today or in the future |
|
590 | + // if NOT show expired then we want events that start today or in the future |
|
591 | + if ($this->show_expired == 0) { |
|
592 | + $where['Datetime.DTT_EVT_end'] = [ |
|
593 | + '>=', |
|
594 | + EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'), |
|
595 | + ]; |
|
596 | + } |
|
597 | + // if show ONLY expired we want events that ended prior to today |
|
598 | + if ($this->show_expired == 2) { |
|
599 | + $where['Datetime.DTT_EVT_end'] = [ |
|
600 | + '<=', |
|
601 | + EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'), |
|
602 | + ]; |
|
603 | + } |
|
604 | + // allow $where to be filtered |
|
605 | + return apply_filters('FHEE__EEW_Upcoming_Events__widget__where', $where, $this->events_category, $this->show_expired); |
|
606 | + } |
|
607 | + |
|
608 | + |
|
609 | + /** |
|
610 | + * @param EE_Event $event |
|
611 | + * @return string |
|
612 | + * @throws EE_Error |
|
613 | + * @throws ReflectionException |
|
614 | + * @since 4.10.14.p |
|
615 | + */ |
|
616 | + private function linkClass(EE_Event $event) |
|
617 | + { |
|
618 | + // how big is the event name ? |
|
619 | + $name_length = strlen($event->name()); |
|
620 | + switch ($name_length) { |
|
621 | + case $name_length > 70: |
|
622 | + return ' three-line'; |
|
623 | + case $name_length > 35: |
|
624 | + return ' two-line'; |
|
625 | + } |
|
626 | + return ' one-line'; |
|
627 | + } |
|
628 | + |
|
629 | + |
|
630 | + /** |
|
631 | + * @param EE_Event $event |
|
632 | + * @param string $event_url |
|
633 | + * @return mixed|string|void |
|
634 | + * @throws EE_Error |
|
635 | + * @throws ReflectionException |
|
636 | + * @since 4.10.14.p |
|
637 | + */ |
|
638 | + private function eventWidgetContent(EE_Event $event, $event_url = '') |
|
639 | + { |
|
640 | + if (post_password_required($event->ID())) { |
|
641 | + return apply_filters( |
|
642 | + 'FHEE_EEW_Upcoming_Events__widget__password_form', |
|
643 | + get_the_password_form($event->ID()), |
|
644 | + $event |
|
645 | + ); |
|
646 | + } |
|
647 | + |
|
648 | + $content = ''; |
|
649 | + if (has_post_thumbnail($event->ID()) && $this->image_size != 'none') { |
|
650 | + $content .= ' |
|
651 | 651 | <div class="ee-upcoming-events-widget-img-dv"> |
652 | 652 | <a class="ee-upcoming-events-widget-img" href="' . $event_url . '"> |
653 | 653 | ' . get_the_post_thumbnail($event->ID(), $this->image_size) . ' |
654 | 654 | </a> |
655 | 655 | </div>'; |
656 | - } |
|
657 | - |
|
658 | - if ($this->show_dates) { |
|
659 | - $content .= $this->eventDates($event); |
|
660 | - } |
|
661 | - |
|
662 | - if ($this->show_desc) { |
|
663 | - global $allowedtags; |
|
664 | - $desc = $event->short_description(25); |
|
665 | - $content .= $desc ? '<p style="margin-top: .5em">' . wp_kses($desc, $allowedtags) . '</p>' : ''; |
|
666 | - } |
|
667 | - |
|
668 | - return $content; |
|
669 | - } |
|
670 | - |
|
671 | - |
|
672 | - /** |
|
673 | - * @param EE_Event $event |
|
674 | - * @return string |
|
675 | - * @throws EE_Error |
|
676 | - * @throws ReflectionException |
|
677 | - * @since 4.10.14.p |
|
678 | - */ |
|
679 | - private function eventDates(EE_Event $event) |
|
680 | - { |
|
681 | - $date_format = apply_filters( |
|
682 | - 'FHEE__espresso_event_date_range__date_format', |
|
683 | - get_option('date_format') |
|
684 | - ); |
|
685 | - $time_format = apply_filters( |
|
686 | - 'FHEE__espresso_event_date_range__time_format', |
|
687 | - get_option('time_format') |
|
688 | - ); |
|
689 | - $single_date_format = apply_filters( |
|
690 | - 'FHEE__espresso_event_date_range__single_date_format', |
|
691 | - get_option('date_format') |
|
692 | - ); |
|
693 | - $single_time_format = apply_filters( |
|
694 | - 'FHEE__espresso_event_date_range__single_time_format', |
|
695 | - get_option('time_format') |
|
696 | - ); |
|
697 | - if ($this->date_range == true) { |
|
698 | - return espresso_event_date_range( |
|
699 | - $date_format, |
|
700 | - $time_format, |
|
701 | - $single_date_format, |
|
702 | - $single_time_format, |
|
703 | - $event->ID(), |
|
704 | - false |
|
705 | - ); |
|
706 | - } |
|
707 | - return espresso_list_of_event_dates( |
|
708 | - $event->ID(), |
|
709 | - $date_format, |
|
710 | - $time_format, |
|
711 | - false, |
|
712 | - null, |
|
713 | - true, |
|
714 | - true, |
|
715 | - $this->date_limit |
|
716 | - ); |
|
717 | - } |
|
656 | + } |
|
657 | + |
|
658 | + if ($this->show_dates) { |
|
659 | + $content .= $this->eventDates($event); |
|
660 | + } |
|
661 | + |
|
662 | + if ($this->show_desc) { |
|
663 | + global $allowedtags; |
|
664 | + $desc = $event->short_description(25); |
|
665 | + $content .= $desc ? '<p style="margin-top: .5em">' . wp_kses($desc, $allowedtags) . '</p>' : ''; |
|
666 | + } |
|
667 | + |
|
668 | + return $content; |
|
669 | + } |
|
670 | + |
|
671 | + |
|
672 | + /** |
|
673 | + * @param EE_Event $event |
|
674 | + * @return string |
|
675 | + * @throws EE_Error |
|
676 | + * @throws ReflectionException |
|
677 | + * @since 4.10.14.p |
|
678 | + */ |
|
679 | + private function eventDates(EE_Event $event) |
|
680 | + { |
|
681 | + $date_format = apply_filters( |
|
682 | + 'FHEE__espresso_event_date_range__date_format', |
|
683 | + get_option('date_format') |
|
684 | + ); |
|
685 | + $time_format = apply_filters( |
|
686 | + 'FHEE__espresso_event_date_range__time_format', |
|
687 | + get_option('time_format') |
|
688 | + ); |
|
689 | + $single_date_format = apply_filters( |
|
690 | + 'FHEE__espresso_event_date_range__single_date_format', |
|
691 | + get_option('date_format') |
|
692 | + ); |
|
693 | + $single_time_format = apply_filters( |
|
694 | + 'FHEE__espresso_event_date_range__single_time_format', |
|
695 | + get_option('time_format') |
|
696 | + ); |
|
697 | + if ($this->date_range == true) { |
|
698 | + return espresso_event_date_range( |
|
699 | + $date_format, |
|
700 | + $time_format, |
|
701 | + $single_date_format, |
|
702 | + $single_time_format, |
|
703 | + $event->ID(), |
|
704 | + false |
|
705 | + ); |
|
706 | + } |
|
707 | + return espresso_list_of_event_dates( |
|
708 | + $event->ID(), |
|
709 | + $date_format, |
|
710 | + $time_format, |
|
711 | + false, |
|
712 | + null, |
|
713 | + true, |
|
714 | + true, |
|
715 | + $this->date_limit |
|
716 | + ); |
|
717 | + } |
|
718 | 718 | } |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | <label><?php esc_html_e('Amount Owing: ', 'event_espresso'); ?></label> |
27 | 27 | </td> |
28 | 28 | <td class="<?php |
29 | - echo ($transaction->paid() == $transaction->total()) |
|
30 | - ? 'ee-transaction-paid' |
|
31 | - : 'ee-transaction-unpaid' |
|
32 | - ?>" |
|
29 | + echo ($transaction->paid() == $transaction->total()) |
|
30 | + ? 'ee-transaction-paid' |
|
31 | + : 'ee-transaction-unpaid' |
|
32 | + ?>" |
|
33 | 33 | > |
34 | 34 | <?php echo EEH_Template::format_currency($transaction->remaining()); ?> |
35 | 35 | </td> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | </td> |
41 | 41 | <td> |
42 | 42 | <?php $transaction->e_pretty_status(true); |
43 | - if ($show_try_pay_again_link && ! $transaction->is_completed()) { ?> |
|
43 | + if ($show_try_pay_again_link && ! $transaction->is_completed()) { ?> |
|
44 | 44 | <span class="small-text"> |
45 | 45 | <a href='<?php echo esc_url_raw($SPCO_payment_options_url); ?>'> |
46 | 46 | <?php esc_html_e('View Payment Options', 'event_espresso'); ?> |
@@ -58,16 +58,16 @@ discard block |
||
58 | 58 | </td> |
59 | 59 | </tr> |
60 | 60 | <?php do_action( |
61 | - 'AHEE__thank_you_page_transaction_details_template__after_transaction_table_row', |
|
62 | - $transaction |
|
63 | - ); ?> |
|
61 | + 'AHEE__thank_you_page_transaction_details_template__after_transaction_table_row', |
|
62 | + $transaction |
|
63 | + ); ?> |
|
64 | 64 | </tbody> |
65 | 65 | </table> |
66 | 66 | |
67 | 67 | <?php if ($show_try_pay_again_link && ! $transaction->is_completed()) { ?> |
68 | 68 | <p class="small-text jst-rght"> |
69 | 69 | <a href='<?php echo esc_url_raw($SPCO_payment_options_url); ?>'><?php |
70 | - esc_html_e("Click here to view Payment Options", 'event_espresso'); ?></a> |
|
70 | + esc_html_e("Click here to view Payment Options", 'event_espresso'); ?></a> |
|
71 | 71 | </p> |
72 | 72 | <br /> |
73 | 73 |
@@ -38,103 +38,103 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.6.2'); |
|
65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.6.2'); |
|
65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.10.29.rc.022'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.10.29.rc.022'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | - bootstrap_espresso(); |
|
121 | - } |
|
119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | + bootstrap_espresso(); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
124 | - /** |
|
125 | - * deactivate_plugin |
|
126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | - { |
|
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | - } |
|
137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | - deactivate_plugins($plugin_basename); |
|
139 | - } |
|
124 | + /** |
|
125 | + * deactivate_plugin |
|
126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | + { |
|
134 | + if (! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | + } |
|
137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | + deactivate_plugins($plugin_basename); |
|
139 | + } |
|
140 | 140 | } |