@@ -15,57 +15,57 @@ |
||
15 | 15 | class EE_Full_HTML_Field extends EE_Text_Field_Base |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @param string $table_column |
|
20 | - * @param string $nicename |
|
21 | - * @param bool $nullable |
|
22 | - * @param null $default_value |
|
23 | - */ |
|
24 | - public function __construct($table_column, $nicename, $nullable, $default_value = null) |
|
25 | - { |
|
26 | - parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
27 | - $this->setSchemaType('object'); |
|
28 | - } |
|
18 | + /** |
|
19 | + * @param string $table_column |
|
20 | + * @param string $nicename |
|
21 | + * @param bool $nullable |
|
22 | + * @param null $default_value |
|
23 | + */ |
|
24 | + public function __construct($table_column, $nicename, $nullable, $default_value = null) |
|
25 | + { |
|
26 | + parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
27 | + $this->setSchemaType('object'); |
|
28 | + } |
|
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * Does shortcodes and auto-paragraphs the content (unless schema is 'no_wpautop') |
|
33 | - * |
|
34 | - * @param type $value_on_field_to_be_outputted |
|
35 | - * @param type $schema |
|
36 | - * @return string |
|
37 | - */ |
|
38 | - function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) |
|
39 | - { |
|
40 | - if ($schema == 'form_input') { |
|
41 | - return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema); |
|
42 | - } elseif ($schema == 'no_wpautop') { |
|
43 | - return do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema)); |
|
44 | - } else { |
|
45 | - return wpautop(do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema))); |
|
46 | - } |
|
47 | - } |
|
31 | + /** |
|
32 | + * Does shortcodes and auto-paragraphs the content (unless schema is 'no_wpautop') |
|
33 | + * |
|
34 | + * @param type $value_on_field_to_be_outputted |
|
35 | + * @param type $schema |
|
36 | + * @return string |
|
37 | + */ |
|
38 | + function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) |
|
39 | + { |
|
40 | + if ($schema == 'form_input') { |
|
41 | + return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema); |
|
42 | + } elseif ($schema == 'no_wpautop') { |
|
43 | + return do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema)); |
|
44 | + } else { |
|
45 | + return wpautop(do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema))); |
|
46 | + } |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | 50 | |
51 | - public function getSchemaProperties() |
|
52 | - { |
|
53 | - return array( |
|
54 | - 'raw' => array( |
|
55 | - 'description' => sprintf( |
|
56 | - __('%s - the value in the database.', 'event_espresso'), |
|
57 | - $this->get_nicename() |
|
58 | - ), |
|
59 | - 'type' => 'string' |
|
60 | - ), |
|
61 | - 'rendered' => array( |
|
62 | - 'description' => sprintf( |
|
63 | - __('%s - transformed for display.', 'event_espresso'), |
|
64 | - $this->get_nicename() |
|
65 | - ), |
|
66 | - 'type' => 'string', |
|
67 | - 'readonly' => true |
|
68 | - ) |
|
69 | - ); |
|
70 | - } |
|
51 | + public function getSchemaProperties() |
|
52 | + { |
|
53 | + return array( |
|
54 | + 'raw' => array( |
|
55 | + 'description' => sprintf( |
|
56 | + __('%s - the value in the database.', 'event_espresso'), |
|
57 | + $this->get_nicename() |
|
58 | + ), |
|
59 | + 'type' => 'string' |
|
60 | + ), |
|
61 | + 'rendered' => array( |
|
62 | + 'description' => sprintf( |
|
63 | + __('%s - transformed for display.', 'event_espresso'), |
|
64 | + $this->get_nicename() |
|
65 | + ), |
|
66 | + 'type' => 'string', |
|
67 | + 'readonly' => true |
|
68 | + ) |
|
69 | + ); |
|
70 | + } |
|
71 | 71 | } |
72 | 72 | \ No newline at end of file |
@@ -13,7 +13,7 @@ |
||
13 | 13 | * @param string $table_column |
14 | 14 | * @param string $nicename |
15 | 15 | * @param bool $nullable |
16 | - * @param null $default_value |
|
16 | + * @param string $default_value |
|
17 | 17 | */ |
18 | 18 | public function __construct($table_column, $nicename, $nullable, $default_value = null) |
19 | 19 | { |
@@ -1,6 +1,8 @@ discard block |
||
1 | 1 | <?php use EventEspresso\widgets\EspressoWidget; |
2 | 2 | |
3 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | +} |
|
4 | 6 | /** |
5 | 7 | * Event Espresso |
6 | 8 | * |
@@ -356,7 +358,7 @@ discard block |
||
356 | 358 | $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' )); |
357 | 359 | if ( $date_range == TRUE ) { |
358 | 360 | echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() ); |
359 | - }else{ |
|
361 | + } else{ |
|
360 | 362 | echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit ); |
361 | 363 | } |
362 | 364 | } |
@@ -210,14 +210,14 @@ discard block |
||
210 | 210 | <?php _e('Show on all Pages:', 'event_espresso'); ?> |
211 | 211 | </label> |
212 | 212 | <?php |
213 | - echo EEH_Form_Fields::select( |
|
214 | - __('Show on all Pages:', 'event_espresso'), |
|
215 | - $instance['show_everywhere'], |
|
216 | - $yes_no_values, |
|
217 | - $this->get_field_name('show_everywhere'), |
|
218 | - $this->get_field_id('show_everywhere') |
|
219 | - ); |
|
220 | - ?> |
|
213 | + echo EEH_Form_Fields::select( |
|
214 | + __('Show on all Pages:', 'event_espresso'), |
|
215 | + $instance['show_everywhere'], |
|
216 | + $yes_no_values, |
|
217 | + $this->get_field_name('show_everywhere'), |
|
218 | + $this->get_field_id('show_everywhere') |
|
219 | + ); |
|
220 | + ?> |
|
221 | 221 | </p> |
222 | 222 | <p> |
223 | 223 | <label for="<?php echo $this->get_field_id('date_limit'); ?>"> |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | extract($args); |
301 | 301 | |
302 | 302 | // add function to make the title a link |
303 | - add_filter('widget_title', array($this, 'make_the_title_a_link'), 15); |
|
303 | + add_filter('widget_title', array($this, 'make_the_title_a_link'), 15); |
|
304 | 304 | |
305 | 305 | $title = isset( $instance['title'] ) && ! empty( $instance['title'] ) ? $instance['title'] : ''; |
306 | 306 | // filter the title |
307 | 307 | $title = apply_filters('widget_title', $title); |
308 | 308 | |
309 | 309 | // remove the function from the filter, so it does not affect other widgets |
310 | - remove_filter('widget_title', array($this, 'make_the_title_a_link'), 15); |
|
310 | + remove_filter('widget_title', array($this, 'make_the_title_a_link'), 15); |
|
311 | 311 | |
312 | 312 | // Before widget (defined by themes). |
313 | 313 | echo $before_widget; |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @return string |
420 | 420 | */ |
421 | 421 | public function make_the_title_a_link($title) { |
422 | - return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
422 | + return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | } |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function __construct() { |
33 | 33 | parent::__construct( |
34 | - __( 'Event Espresso Upcoming Events', 'event_espresso' ), |
|
35 | - array( 'description' => __( 'A widget to display your upcoming events.', 'event_espresso' )) |
|
34 | + __('Event Espresso Upcoming Events', 'event_espresso'), |
|
35 | + array('description' => __('A widget to display your upcoming events.', 'event_espresso')) |
|
36 | 36 | ); |
37 | 37 | } |
38 | 38 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | * @param array $instance Previously saved values from database. |
46 | 46 | * @return string|void |
47 | 47 | */ |
48 | - public function form( $instance ) { |
|
48 | + public function form($instance) { |
|
49 | 49 | |
50 | - EE_Registry::instance()->load_class( 'Question_Option', array(), FALSE, FALSE, TRUE ); |
|
50 | + EE_Registry::instance()->load_class('Question_Option', array(), FALSE, FALSE, TRUE); |
|
51 | 51 | // Set up some default widget settings. |
52 | 52 | $defaults = array( |
53 | 53 | 'title' => __('Upcoming Events', 'event_espresso'), |
@@ -63,16 +63,16 @@ discard block |
||
63 | 63 | 'image_size' => 'medium' |
64 | 64 | ); |
65 | 65 | |
66 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
66 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
67 | 67 | // don't add HTML labels for EE_Form_Fields generated inputs |
68 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' ); |
|
68 | + add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
69 | 69 | $yes_no_values = array( |
70 | - EE_Question_Option::new_instance( array( 'QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))), |
|
71 | - EE_Question_Option::new_instance( array( 'QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso'))) |
|
70 | + EE_Question_Option::new_instance(array('QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))), |
|
71 | + EE_Question_Option::new_instance(array('QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso'))) |
|
72 | 72 | ); |
73 | 73 | $sort_values = array( |
74 | - EE_Question_Option::new_instance( array( 'QSO_value' => 'ASC', 'QSO_desc' => __('ASC', 'event_espresso'))), |
|
75 | - EE_Question_Option::new_instance( array( 'QSO_value' => 'DESC', 'QSO_desc' => __('DESC', 'event_espresso'))) |
|
74 | + EE_Question_Option::new_instance(array('QSO_value' => 'ASC', 'QSO_desc' => __('ASC', 'event_espresso'))), |
|
75 | + EE_Question_Option::new_instance(array('QSO_value' => 'DESC', 'QSO_desc' => __('DESC', 'event_espresso'))) |
|
76 | 76 | ); |
77 | 77 | |
78 | 78 | ?> |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | <label for="<?php echo $this->get_field_id('title'); ?>"> |
84 | 84 | <?php _e('Title:', 'event_espresso'); ?> |
85 | 85 | </label> |
86 | - <input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" type="text" /> |
|
86 | + <input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($instance['title']); ?>" type="text" /> |
|
87 | 87 | </p> |
88 | 88 | <p> |
89 | 89 | <label for="<?php echo $this->get_field_id('category_name'); ?>"> |
@@ -92,16 +92,16 @@ discard block |
||
92 | 92 | <?php |
93 | 93 | $event_categories = array(); |
94 | 94 | /** @type EEM_Term $EEM_Term */ |
95 | - $EEM_Term = EE_Registry::instance()->load_model( 'Term' ); |
|
96 | - $categories = $EEM_Term->get_all_ee_categories( TRUE ); |
|
97 | - if ( $categories ) { |
|
98 | - foreach ( $categories as $category ) { |
|
99 | - if ( $category instanceof EE_Term ) { |
|
100 | - $event_categories[] = EE_Question_Option::new_instance( array( 'QSO_value' => $category->get( 'slug' ), 'QSO_desc' => $category->get( 'name' ))); |
|
95 | + $EEM_Term = EE_Registry::instance()->load_model('Term'); |
|
96 | + $categories = $EEM_Term->get_all_ee_categories(TRUE); |
|
97 | + if ($categories) { |
|
98 | + foreach ($categories as $category) { |
|
99 | + if ($category instanceof EE_Term) { |
|
100 | + $event_categories[] = EE_Question_Option::new_instance(array('QSO_value' => $category->get('slug'), 'QSO_desc' => $category->get('name'))); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
104 | - array_unshift( $event_categories, EE_Question_Option::new_instance( array( 'QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso')))); |
|
104 | + array_unshift($event_categories, EE_Question_Option::new_instance(array('QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso')))); |
|
105 | 105 | echo EEH_Form_Fields::select( |
106 | 106 | __('Event Category:', 'event_espresso'), |
107 | 107 | $instance['category_name'], |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | __('Show Expired Events:', 'event_espresso'), |
127 | 127 | $instance['show_expired'], |
128 | 128 | array( |
129 | - EE_Question_Option::new_instance( array( 'QSO_value' => 0, 'QSO_desc' => __('No', 'event_espresso'))), |
|
130 | - EE_Question_Option::new_instance( array( 'QSO_value' => 1, 'QSO_desc' => __('Yes', 'event_espresso'))), |
|
131 | - EE_Question_Option::new_instance( array( 'QSO_value' => 2, 'QSO_desc' => __('Show Only Expired', 'event_espresso'))), |
|
129 | + EE_Question_Option::new_instance(array('QSO_value' => 0, 'QSO_desc' => __('No', 'event_espresso'))), |
|
130 | + EE_Question_Option::new_instance(array('QSO_value' => 1, 'QSO_desc' => __('Yes', 'event_espresso'))), |
|
131 | + EE_Question_Option::new_instance(array('QSO_value' => 2, 'QSO_desc' => __('Show Only Expired', 'event_espresso'))), |
|
132 | 132 | ), |
133 | 133 | $this->get_field_name('show_expired'), |
134 | 134 | $this->get_field_id('show_expired') |
@@ -156,16 +156,16 @@ discard block |
||
156 | 156 | <?php |
157 | 157 | $image_sizes = array(); |
158 | 158 | $sizes = get_intermediate_image_sizes(); |
159 | - if ( $sizes ) { |
|
159 | + if ($sizes) { |
|
160 | 160 | // loop thru images and create option objects out of them |
161 | - foreach ( $sizes as $image_size ) { |
|
162 | - $image_size = trim( $image_size ); |
|
161 | + foreach ($sizes as $image_size) { |
|
162 | + $image_size = trim($image_size); |
|
163 | 163 | // no big images plz |
164 | - if ( ! in_array( $image_size, array( 'large', 'post-thumbnail' ))) { |
|
165 | - $image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => $image_size, 'QSO_desc' => $image_size )); |
|
164 | + if ( ! in_array($image_size, array('large', 'post-thumbnail'))) { |
|
165 | + $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => $image_size, 'QSO_desc' => $image_size)); |
|
166 | 166 | } |
167 | 167 | } |
168 | - $image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => 'none', 'QSO_desc' => __('don\'t show images', 'event_espresso') )); |
|
168 | + $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => 'none', 'QSO_desc' => __('don\'t show images', 'event_espresso'))); |
|
169 | 169 | } |
170 | 170 | echo EEH_Form_Fields::select( |
171 | 171 | __('Image Size:', 'event_espresso'), |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | <label for="<?php echo $this->get_field_id('date_limit'); ?>"> |
224 | 224 | <?php _e('Number of Dates to Display:', 'event_espresso'); ?> |
225 | 225 | </label> |
226 | - <input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr( $instance['date_limit'] ); ?>" size="3" type="text" /> |
|
226 | + <input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr($instance['date_limit']); ?>" size="3" type="text" /> |
|
227 | 227 | </p> |
228 | 228 | <p> |
229 | 229 | <label for="<?php echo $this->get_field_id('date_range'); ?>"> |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | * |
256 | 256 | * @return array Updated safe values to be saved. |
257 | 257 | */ |
258 | - public function update( $new_instance, $old_instance ) { |
|
258 | + public function update($new_instance, $old_instance) { |
|
259 | 259 | $instance = $old_instance; |
260 | - $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
260 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
261 | 261 | $instance['category_name'] = $new_instance['category_name']; |
262 | 262 | $instance['show_expired'] = $new_instance['show_expired']; |
263 | 263 | $instance['limit'] = $new_instance['limit']; |
@@ -281,18 +281,18 @@ discard block |
||
281 | 281 | * @param array $args Widget arguments. |
282 | 282 | * @param array $instance Saved values from database. |
283 | 283 | */ |
284 | - public function widget( $args, $instance ) { |
|
284 | + public function widget($args, $instance) { |
|
285 | 285 | |
286 | 286 | global $post; |
287 | 287 | // make sure there is some kinda post object |
288 | - if ( $post instanceof WP_Post ) { |
|
288 | + if ($post instanceof WP_Post) { |
|
289 | 289 | $before_widget = ''; |
290 | 290 | $before_title = ''; |
291 | 291 | $after_title = ''; |
292 | 292 | $after_widget = ''; |
293 | 293 | // but NOT an events archives page, cuz that would be like two event lists on the same page |
294 | - $show_everywhere = isset( $instance['show_everywhere'] ) ? (bool) absint( $instance['show_everywhere'] ) : TRUE; |
|
295 | - if ( $show_everywhere || ! ( $post->post_type == 'espresso_events' && is_archive() )) { |
|
294 | + $show_everywhere = isset($instance['show_everywhere']) ? (bool) absint($instance['show_everywhere']) : TRUE; |
|
295 | + if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) { |
|
296 | 296 | // let's use some of the event helper functions' |
297 | 297 | // make separate vars out of attributes |
298 | 298 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | // add function to make the title a link |
303 | 303 | add_filter('widget_title', array($this, 'make_the_title_a_link'), 15); |
304 | 304 | |
305 | - $title = isset( $instance['title'] ) && ! empty( $instance['title'] ) ? $instance['title'] : ''; |
|
305 | + $title = isset($instance['title']) && ! empty($instance['title']) ? $instance['title'] : ''; |
|
306 | 306 | // filter the title |
307 | 307 | $title = apply_filters('widget_title', $title); |
308 | 308 | |
@@ -312,90 +312,90 @@ discard block |
||
312 | 312 | // Before widget (defined by themes). |
313 | 313 | echo $before_widget; |
314 | 314 | // Display the widget title if one was input (before and after defined by themes). |
315 | - if ( ! empty( $title )) { |
|
316 | - echo $before_title . $title . $after_title; |
|
315 | + if ( ! empty($title)) { |
|
316 | + echo $before_title.$title.$after_title; |
|
317 | 317 | } |
318 | 318 | // grab widget settings |
319 | - $category = isset( $instance['category_name'] ) && ! empty( $instance['category_name'] ) ? $instance['category_name'] : FALSE; |
|
320 | - $show_expired = isset( $instance['show_expired'] ) ? absint( $instance['show_expired'] ) : 0; |
|
321 | - $image_size = isset( $instance['image_size'] ) && ! empty( $instance['image_size'] ) ? $instance['image_size'] : 'medium'; |
|
322 | - $show_desc = isset( $instance['show_desc'] ) ? (bool) absint( $instance['show_desc'] ) : TRUE; |
|
323 | - $show_dates = isset( $instance['show_dates'] ) ? (bool) absint( $instance['show_dates'] ) : TRUE; |
|
324 | - $date_limit = isset( $instance['date_limit'] ) && ! empty( $instance['date_limit'] ) ? $instance['date_limit'] : NULL; |
|
325 | - $date_range = isset( $instance['date_range'] ) && ! empty( $instance['date_range'] ) ? $instance['date_range'] : FALSE; |
|
319 | + $category = isset($instance['category_name']) && ! empty($instance['category_name']) ? $instance['category_name'] : FALSE; |
|
320 | + $show_expired = isset($instance['show_expired']) ? absint($instance['show_expired']) : 0; |
|
321 | + $image_size = isset($instance['image_size']) && ! empty($instance['image_size']) ? $instance['image_size'] : 'medium'; |
|
322 | + $show_desc = isset($instance['show_desc']) ? (bool) absint($instance['show_desc']) : TRUE; |
|
323 | + $show_dates = isset($instance['show_dates']) ? (bool) absint($instance['show_dates']) : TRUE; |
|
324 | + $date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) ? $instance['date_limit'] : NULL; |
|
325 | + $date_range = isset($instance['date_range']) && ! empty($instance['date_range']) ? $instance['date_range'] : FALSE; |
|
326 | 326 | // start to build our where clause |
327 | 327 | $where = array( |
328 | 328 | // 'Datetime.DTT_is_primary' => 1, |
329 | - 'status' => array( 'IN', array( 'publish', 'sold_out' ) ) |
|
329 | + 'status' => array('IN', array('publish', 'sold_out')) |
|
330 | 330 | ); |
331 | 331 | // add category |
332 | - if ( $category ) { |
|
332 | + if ($category) { |
|
333 | 333 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
334 | 334 | $where['Term_Taxonomy.Term.slug'] = $category; |
335 | 335 | } |
336 | 336 | // if NOT expired then we want events that start today or in the future |
337 | 337 | // if NOT show expired then we want events that start today or in the future |
338 | - if ( $show_expired == 0 ) { |
|
339 | - $where['Datetime.DTT_EVT_end'] = array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ); |
|
338 | + if ($show_expired == 0) { |
|
339 | + $where['Datetime.DTT_EVT_end'] = array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')); |
|
340 | 340 | } |
341 | 341 | // if show ONLY expired we want events that ended prior to today |
342 | - if ( $show_expired == 2 ) { |
|
343 | - $where['Datetime.DTT_EVT_end'] = array( '<=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) ); |
|
342 | + if ($show_expired == 2) { |
|
343 | + $where['Datetime.DTT_EVT_end'] = array('<=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start')); |
|
344 | 344 | } |
345 | 345 | // allow $where to be filtered |
346 | - $where = apply_filters( 'FHEE__EEW_Upcoming_Events__widget__where', $where, $category, $show_expired ); |
|
346 | + $where = apply_filters('FHEE__EEW_Upcoming_Events__widget__where', $where, $category, $show_expired); |
|
347 | 347 | // run the query |
348 | - $events = EE_Registry::instance()->load_model( 'Event' )->get_all( array( |
|
348 | + $events = EE_Registry::instance()->load_model('Event')->get_all(array( |
|
349 | 349 | $where, |
350 | 350 | 'limit' => isset($instance['limit']) && $instance['limit'] > 0 |
351 | - ? '0,' . $instance['limit'] |
|
351 | + ? '0,'.$instance['limit'] |
|
352 | 352 | : '0,10', |
353 | 353 | 'order_by' => 'Datetime.DTT_EVT_start', |
354 | 354 | 'order' => isset($instance['sort']) ? $instance['sort'] : 'ASC', |
355 | 355 | 'group_by' => 'EVT_ID' |
356 | 356 | )); |
357 | 357 | |
358 | - if ( ! empty( $events )) { |
|
358 | + if ( ! empty($events)) { |
|
359 | 359 | echo '<ul class="ee-upcoming-events-widget-ul">'; |
360 | - foreach ( $events as $event ) { |
|
361 | - if ( $event instanceof EE_Event && ( !is_single() || $post->ID != $event->ID() ) ) { |
|
360 | + foreach ($events as $event) { |
|
361 | + if ($event instanceof EE_Event && ( ! is_single() || $post->ID != $event->ID())) { |
|
362 | 362 | //printr( $event, '$event <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
363 | - echo '<li id="ee-upcoming-events-widget-li-' . $event->ID() . '" class="ee-upcoming-events-widget-li">'; |
|
363 | + echo '<li id="ee-upcoming-events-widget-li-'.$event->ID().'" class="ee-upcoming-events-widget-li">'; |
|
364 | 364 | // how big is the event name ? |
365 | - $name_length = strlen( $event->name() ); |
|
366 | - switch( $name_length ) { |
|
365 | + $name_length = strlen($event->name()); |
|
366 | + switch ($name_length) { |
|
367 | 367 | case $name_length > 70 : |
368 | - $len_class = ' three-line'; |
|
368 | + $len_class = ' three-line'; |
|
369 | 369 | break; |
370 | 370 | case $name_length > 35 : |
371 | - $len_class = ' two-line'; |
|
371 | + $len_class = ' two-line'; |
|
372 | 372 | break; |
373 | 373 | default : |
374 | - $len_class = ' one-line'; |
|
374 | + $len_class = ' one-line'; |
|
375 | 375 | } |
376 | - $event_url = apply_filters( 'FHEE_EEW_Upcoming_Events__widget__event_url', $event->get_permalink(), $event ); |
|
377 | - echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a' . $len_class . '" href="' . $event_url . '">' . $event->name() . '</a></h5>'; |
|
378 | - if ( post_password_required( $event->ID() ) ) { |
|
379 | - $pswd_form = apply_filters( 'FHEE_EEW_Upcoming_Events__widget__password_form', get_the_password_form( $event->ID() ), $event ); |
|
376 | + $event_url = apply_filters('FHEE_EEW_Upcoming_Events__widget__event_url', $event->get_permalink(), $event); |
|
377 | + echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a'.$len_class.'" href="'.$event_url.'">'.$event->name().'</a></h5>'; |
|
378 | + if (post_password_required($event->ID())) { |
|
379 | + $pswd_form = apply_filters('FHEE_EEW_Upcoming_Events__widget__password_form', get_the_password_form($event->ID()), $event); |
|
380 | 380 | echo $pswd_form; |
381 | 381 | } else { |
382 | - if ( has_post_thumbnail( $event->ID() ) && $image_size != 'none' ) { |
|
383 | - echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="' . $event_url . '">' . get_the_post_thumbnail( $event->ID(), $image_size ) . '</a></div>'; |
|
382 | + if (has_post_thumbnail($event->ID()) && $image_size != 'none') { |
|
383 | + echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="'.$event_url.'">'.get_the_post_thumbnail($event->ID(), $image_size).'</a></div>'; |
|
384 | 384 | } |
385 | - $desc = $event->short_description( 25 ); |
|
386 | - if ( $show_dates ) { |
|
387 | - $date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', get_option( 'date_format' )); |
|
388 | - $time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', get_option( 'time_format' )); |
|
389 | - $single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', get_option( 'date_format' )); |
|
390 | - $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' )); |
|
391 | - if ( $date_range == TRUE ) { |
|
392 | - echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() ); |
|
393 | - }else{ |
|
394 | - echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit ); |
|
385 | + $desc = $event->short_description(25); |
|
386 | + if ($show_dates) { |
|
387 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', get_option('date_format')); |
|
388 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', get_option('time_format')); |
|
389 | + $single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', get_option('date_format')); |
|
390 | + $single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', get_option('time_format')); |
|
391 | + if ($date_range == TRUE) { |
|
392 | + echo espresso_event_date_range($date_format, $time_format, $single_date_format, $single_time_format, $event->ID()); |
|
393 | + } else { |
|
394 | + echo espresso_list_of_event_dates($event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit); |
|
395 | 395 | } |
396 | 396 | } |
397 | - if ( $show_desc && $desc ) { |
|
398 | - echo '<p style="margin-top: .5em">' . $desc . '</p>'; |
|
397 | + if ($show_desc && $desc) { |
|
398 | + echo '<p style="margin-top: .5em">'.$desc.'</p>'; |
|
399 | 399 | } |
400 | 400 | } |
401 | 401 | echo '</li>'; |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @return string |
420 | 420 | */ |
421 | 421 | public function make_the_title_a_link($title) { |
422 | - return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
422 | + return '<a href="'.EEH_Event_View::event_archive_url().'">'.$title.'</a>'; |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | } |
@@ -18,31 +18,31 @@ |
||
18 | 18 | |
19 | 19 | |
20 | 20 | |
21 | - /** |
|
22 | - * @param string $name |
|
23 | - * @param array $widget_options |
|
24 | - * @param array $control_options |
|
25 | - */ |
|
26 | - public function __construct($name = '', array $widget_options = array(), array $control_options = array()) |
|
27 | - { |
|
28 | - $id_base = EspressoWidget::getIdBase(get_class($this)); |
|
29 | - $control_options['id_base'] = $id_base; |
|
30 | - $control_options['height'] = isset($control_options['height']) ? $control_options['height'] : 300; |
|
31 | - $control_options['width'] = isset($control_options['width']) ? $control_options['width'] : 350; |
|
32 | - // Register widget with WordPress |
|
33 | - parent::__construct($id_base, $name, $widget_options, $control_options); |
|
34 | - } |
|
35 | - |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * @param string $widget_class |
|
40 | - * @return string |
|
41 | - */ |
|
42 | - public static function getIdBase($widget_class) |
|
43 | - { |
|
44 | - return sanitize_title(str_replace(array('EEW_', '_'), array('EE_', '-'), $widget_class)) . '-widget'; |
|
45 | - } |
|
21 | + /** |
|
22 | + * @param string $name |
|
23 | + * @param array $widget_options |
|
24 | + * @param array $control_options |
|
25 | + */ |
|
26 | + public function __construct($name = '', array $widget_options = array(), array $control_options = array()) |
|
27 | + { |
|
28 | + $id_base = EspressoWidget::getIdBase(get_class($this)); |
|
29 | + $control_options['id_base'] = $id_base; |
|
30 | + $control_options['height'] = isset($control_options['height']) ? $control_options['height'] : 300; |
|
31 | + $control_options['width'] = isset($control_options['width']) ? $control_options['width'] : 350; |
|
32 | + // Register widget with WordPress |
|
33 | + parent::__construct($id_base, $name, $widget_options, $control_options); |
|
34 | + } |
|
35 | + |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * @param string $widget_class |
|
40 | + * @return string |
|
41 | + */ |
|
42 | + public static function getIdBase($widget_class) |
|
43 | + { |
|
44 | + return sanitize_title(str_replace(array('EEW_', '_'), array('EE_', '-'), $widget_class)) . '-widget'; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | 48 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | */ |
42 | 42 | public static function getIdBase($widget_class) |
43 | 43 | { |
44 | - return sanitize_title(str_replace(array('EEW_', '_'), array('EE_', '-'), $widget_class)) . '-widget'; |
|
44 | + return sanitize_title(str_replace(array('EEW_', '_'), array('EE_', '-'), $widget_class)).'-widget'; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 |
@@ -2,8 +2,7 @@ |
||
2 | 2 | |
3 | 3 | /** |
4 | 4 | * Goes through all the posts and pages, and converts old shortcodes to new ones |
5 | - |
|
6 | -*/ |
|
5 | + */ |
|
7 | 6 | |
8 | 7 | class EE_DMS_4_1_0_shortcodes extends EE_Data_Migration_Script_Stage{ |
9 | 8 | function __construct() { |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | |
6 | 6 | */ |
7 | 7 | |
8 | -class EE_DMS_4_1_0_shortcodes extends EE_Data_Migration_Script_Stage{ |
|
8 | +class EE_DMS_4_1_0_shortcodes extends EE_Data_Migration_Script_Stage { |
|
9 | 9 | function __construct() { |
10 | 10 | global $wpdb; |
11 | 11 | $this->_pretty_name = __("Shortcodes", "event_espresso"); |
@@ -15,27 +15,27 @@ discard block |
||
15 | 15 | protected function _migrate_old_row($old_row) { |
16 | 16 | $new_post_content = $this->_change_event_list_shortcode($old_row['post_content']); |
17 | 17 | global $wpdb; |
18 | - $wpdb->query($wpdb->prepare("UPDATE ".$this->_old_table." SET post_content=%s WHERE ID=%d",$new_post_content,$old_row['ID'])); |
|
18 | + $wpdb->query($wpdb->prepare("UPDATE ".$this->_old_table." SET post_content=%s WHERE ID=%d", $new_post_content, $old_row['ID'])); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
22 | 22 | * replaces [EVENT_LIST... with [ESPRESSO_EVENTS...] |
23 | 23 | * @param string $old_content |
24 | 24 | */ |
25 | - private function _change_event_list_shortcode($old_content){ |
|
26 | - return str_replace("[EVENT_LIST","[ESPRESSO_EVENTS",$old_content); |
|
25 | + private function _change_event_list_shortcode($old_content) { |
|
26 | + return str_replace("[EVENT_LIST", "[ESPRESSO_EVENTS", $old_content); |
|
27 | 27 | } |
28 | 28 | |
29 | - function _migration_step($num_items=50){ |
|
29 | + function _migration_step($num_items = 50) { |
|
30 | 30 | global $wpdb; |
31 | 31 | $start_at_record = $this->count_records_migrated(); |
32 | - $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table {$this->_sql_to_only_select_non_drafts()} LIMIT %d,%d",$start_at_record,$num_items),ARRAY_A); |
|
32 | + $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table {$this->_sql_to_only_select_non_drafts()} LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A); |
|
33 | 33 | $items_actually_migrated = 0; |
34 | - foreach($rows as $old_row){ |
|
34 | + foreach ($rows as $old_row) { |
|
35 | 35 | $this->_migrate_old_row($old_row); |
36 | 36 | $items_actually_migrated++; |
37 | 37 | } |
38 | - if($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()){ |
|
38 | + if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
39 | 39 | $this->set_completed(); |
40 | 40 | } |
41 | 41 | return $items_actually_migrated; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | return $count; |
47 | 47 | } |
48 | 48 | |
49 | - private function _sql_to_only_select_non_drafts(){ |
|
49 | + private function _sql_to_only_select_non_drafts() { |
|
50 | 50 | return " WHERE post_type NOT IN ('revision','auto-draft') "; |
51 | 51 | } |
52 | 52 |
@@ -13,150 +13,150 @@ |
||
13 | 13 | class PostShortcodeTracking |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @deprecated 4.9.26 |
|
18 | - * @return void |
|
19 | - */ |
|
20 | - public static function set_hooks_admin() |
|
21 | - { |
|
22 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
23 | - } |
|
24 | - |
|
25 | - |
|
26 | - |
|
27 | - /** |
|
28 | - * @deprecated 4.9.26 |
|
29 | - * @param $post_ID |
|
30 | - * @param $post |
|
31 | - * @return void |
|
32 | - */ |
|
33 | - public static function parse_post_content_on_save( $post_ID, $post ) |
|
34 | - { |
|
35 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
36 | - } |
|
37 | - |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * @deprecated 4.9.26 |
|
42 | - * @param $page_for_posts |
|
43 | - * @return void |
|
44 | - */ |
|
45 | - protected static function set_post_shortcodes_for_posts_page( $page_for_posts ) |
|
46 | - { |
|
47 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
48 | - } |
|
49 | - |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * @deprecated 4.9.26 |
|
54 | - * @param $page_for_posts |
|
55 | - * @param $EES_Shortcode |
|
56 | - * @param $post_ID |
|
57 | - * @return void |
|
58 | - */ |
|
59 | - protected static function set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID ) |
|
60 | - { |
|
61 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
62 | - } |
|
63 | - |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * @deprecated 4.9.26 |
|
68 | - * @param $ID |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - public static function unset_post_shortcodes_on_delete( $ID ) |
|
72 | - { |
|
73 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
74 | - } |
|
75 | - |
|
76 | - |
|
77 | - |
|
78 | - /** |
|
79 | - * @deprecated 4.9.26 |
|
80 | - * @param $ID |
|
81 | - * @param $shortcode_class |
|
82 | - * @param $shortcode_posts |
|
83 | - * @param $page_for_posts |
|
84 | - * @param bool $update_post_shortcodes |
|
85 | - * @return void |
|
86 | - */ |
|
87 | - protected static function unset_posts_page_shortcode_for_post( |
|
88 | - $ID, |
|
89 | - $shortcode_class, |
|
90 | - $shortcode_posts, |
|
91 | - $page_for_posts, |
|
92 | - $update_post_shortcodes = false |
|
93 | - ) { |
|
94 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
95 | - } |
|
96 | - |
|
97 | - |
|
98 | - |
|
99 | - /** |
|
100 | - * @deprecated 4.9.26 |
|
101 | - * @param string $page_for_posts |
|
102 | - * @return void |
|
103 | - */ |
|
104 | - public static function update_post_shortcodes( $page_for_posts = '' ) |
|
105 | - { |
|
106 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - |
|
111 | - /** |
|
112 | - * @deprecated 4.9.26 |
|
113 | - * @param $option |
|
114 | - * @param $value |
|
115 | - * @return void |
|
116 | - */ |
|
117 | - public static function reset_page_for_posts_on_initial_set( $option, $value ) |
|
118 | - { |
|
119 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
120 | - } |
|
121 | - |
|
122 | - |
|
123 | - |
|
124 | - /** |
|
125 | - * @deprecated 4.9.26 |
|
126 | - * @param $option |
|
127 | - * @param string $old_value |
|
128 | - * @param string $value |
|
129 | - * @return void |
|
130 | - */ |
|
131 | - public static function reset_page_for_posts_on_change( $option, $old_value = '', $value = '' ) |
|
132 | - { |
|
133 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
134 | - } |
|
135 | - |
|
136 | - |
|
137 | - |
|
138 | - /** |
|
139 | - * @deprecated 4.9.26 |
|
140 | - * @param $option |
|
141 | - * @return void |
|
142 | - */ |
|
143 | - public static function reset_page_for_posts_on_delete( $option ) |
|
144 | - { |
|
145 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - |
|
150 | - /** |
|
151 | - * @deprecated 4.9.26 |
|
152 | - * @param $shortcodes |
|
153 | - * @param bool $index_results |
|
154 | - * @return void |
|
155 | - */ |
|
156 | - public static function get_post_ids_for_shortcode( $shortcodes, $index_results = true ) |
|
157 | - { |
|
158 | - \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
159 | - } |
|
16 | + /** |
|
17 | + * @deprecated 4.9.26 |
|
18 | + * @return void |
|
19 | + */ |
|
20 | + public static function set_hooks_admin() |
|
21 | + { |
|
22 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
23 | + } |
|
24 | + |
|
25 | + |
|
26 | + |
|
27 | + /** |
|
28 | + * @deprecated 4.9.26 |
|
29 | + * @param $post_ID |
|
30 | + * @param $post |
|
31 | + * @return void |
|
32 | + */ |
|
33 | + public static function parse_post_content_on_save( $post_ID, $post ) |
|
34 | + { |
|
35 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
36 | + } |
|
37 | + |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * @deprecated 4.9.26 |
|
42 | + * @param $page_for_posts |
|
43 | + * @return void |
|
44 | + */ |
|
45 | + protected static function set_post_shortcodes_for_posts_page( $page_for_posts ) |
|
46 | + { |
|
47 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
48 | + } |
|
49 | + |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * @deprecated 4.9.26 |
|
54 | + * @param $page_for_posts |
|
55 | + * @param $EES_Shortcode |
|
56 | + * @param $post_ID |
|
57 | + * @return void |
|
58 | + */ |
|
59 | + protected static function set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID ) |
|
60 | + { |
|
61 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
62 | + } |
|
63 | + |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * @deprecated 4.9.26 |
|
68 | + * @param $ID |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + public static function unset_post_shortcodes_on_delete( $ID ) |
|
72 | + { |
|
73 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
74 | + } |
|
75 | + |
|
76 | + |
|
77 | + |
|
78 | + /** |
|
79 | + * @deprecated 4.9.26 |
|
80 | + * @param $ID |
|
81 | + * @param $shortcode_class |
|
82 | + * @param $shortcode_posts |
|
83 | + * @param $page_for_posts |
|
84 | + * @param bool $update_post_shortcodes |
|
85 | + * @return void |
|
86 | + */ |
|
87 | + protected static function unset_posts_page_shortcode_for_post( |
|
88 | + $ID, |
|
89 | + $shortcode_class, |
|
90 | + $shortcode_posts, |
|
91 | + $page_for_posts, |
|
92 | + $update_post_shortcodes = false |
|
93 | + ) { |
|
94 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
95 | + } |
|
96 | + |
|
97 | + |
|
98 | + |
|
99 | + /** |
|
100 | + * @deprecated 4.9.26 |
|
101 | + * @param string $page_for_posts |
|
102 | + * @return void |
|
103 | + */ |
|
104 | + public static function update_post_shortcodes( $page_for_posts = '' ) |
|
105 | + { |
|
106 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + |
|
111 | + /** |
|
112 | + * @deprecated 4.9.26 |
|
113 | + * @param $option |
|
114 | + * @param $value |
|
115 | + * @return void |
|
116 | + */ |
|
117 | + public static function reset_page_for_posts_on_initial_set( $option, $value ) |
|
118 | + { |
|
119 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
120 | + } |
|
121 | + |
|
122 | + |
|
123 | + |
|
124 | + /** |
|
125 | + * @deprecated 4.9.26 |
|
126 | + * @param $option |
|
127 | + * @param string $old_value |
|
128 | + * @param string $value |
|
129 | + * @return void |
|
130 | + */ |
|
131 | + public static function reset_page_for_posts_on_change( $option, $old_value = '', $value = '' ) |
|
132 | + { |
|
133 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
134 | + } |
|
135 | + |
|
136 | + |
|
137 | + |
|
138 | + /** |
|
139 | + * @deprecated 4.9.26 |
|
140 | + * @param $option |
|
141 | + * @return void |
|
142 | + */ |
|
143 | + public static function reset_page_for_posts_on_delete( $option ) |
|
144 | + { |
|
145 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + |
|
150 | + /** |
|
151 | + * @deprecated 4.9.26 |
|
152 | + * @param $shortcodes |
|
153 | + * @param bool $index_results |
|
154 | + * @return void |
|
155 | + */ |
|
156 | + public static function get_post_ids_for_shortcode( $shortcodes, $index_results = true ) |
|
157 | + { |
|
158 | + \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
|
159 | + } |
|
160 | 160 | |
161 | 161 | |
162 | 162 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\admin; |
3 | 3 | |
4 | -defined( 'EVENT_ESPRESSO_VERSION' ) || exit(); |
|
4 | +defined('EVENT_ESPRESSO_VERSION') || exit(); |
|
5 | 5 | |
6 | 6 | |
7 | 7 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param $post |
31 | 31 | * @return void |
32 | 32 | */ |
33 | - public static function parse_post_content_on_save( $post_ID, $post ) |
|
33 | + public static function parse_post_content_on_save($post_ID, $post) |
|
34 | 34 | { |
35 | 35 | \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
36 | 36 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param $page_for_posts |
43 | 43 | * @return void |
44 | 44 | */ |
45 | - protected static function set_post_shortcodes_for_posts_page( $page_for_posts ) |
|
45 | + protected static function set_post_shortcodes_for_posts_page($page_for_posts) |
|
46 | 46 | { |
47 | 47 | \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
48 | 48 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param $post_ID |
57 | 57 | * @return void |
58 | 58 | */ |
59 | - protected static function set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID ) |
|
59 | + protected static function set_post_shortcode_for_posts_page($page_for_posts, $EES_Shortcode, $post_ID) |
|
60 | 60 | { |
61 | 61 | \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
62 | 62 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param $ID |
69 | 69 | * @return void |
70 | 70 | */ |
71 | - public static function unset_post_shortcodes_on_delete( $ID ) |
|
71 | + public static function unset_post_shortcodes_on_delete($ID) |
|
72 | 72 | { |
73 | 73 | \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
74 | 74 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @param string $page_for_posts |
102 | 102 | * @return void |
103 | 103 | */ |
104 | - public static function update_post_shortcodes( $page_for_posts = '' ) |
|
104 | + public static function update_post_shortcodes($page_for_posts = '') |
|
105 | 105 | { |
106 | 106 | \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
107 | 107 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @param $value |
115 | 115 | * @return void |
116 | 116 | */ |
117 | - public static function reset_page_for_posts_on_initial_set( $option, $value ) |
|
117 | + public static function reset_page_for_posts_on_initial_set($option, $value) |
|
118 | 118 | { |
119 | 119 | \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
120 | 120 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @param string $value |
129 | 129 | * @return void |
130 | 130 | */ |
131 | - public static function reset_page_for_posts_on_change( $option, $old_value = '', $value = '' ) |
|
131 | + public static function reset_page_for_posts_on_change($option, $old_value = '', $value = '') |
|
132 | 132 | { |
133 | 133 | \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
134 | 134 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @param $option |
141 | 141 | * @return void |
142 | 142 | */ |
143 | - public static function reset_page_for_posts_on_delete( $option ) |
|
143 | + public static function reset_page_for_posts_on_delete($option) |
|
144 | 144 | { |
145 | 145 | \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
146 | 146 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @param bool $index_results |
154 | 154 | * @return void |
155 | 155 | */ |
156 | - public static function get_post_ids_for_shortcode( $shortcodes, $index_results = true ) |
|
156 | + public static function get_post_ids_for_shortcode($shortcodes, $index_results = true) |
|
157 | 157 | { |
158 | 158 | \EE_Error::doing_it_wrong(__METHOD__, __('Usage is deprecated.', 'event_espresso'), '4.9.26'); |
159 | 159 | } |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | public static function set_hooks() { |
34 | 34 | // create download buttons |
35 | 35 | add_filter( |
36 | - 'FHEE__espresso_list_of_event_dates__datetime_html', |
|
37 | - array( 'EED_Ical', 'generate_add_to_iCal_button' ), |
|
38 | - 10, |
|
39 | - 2 |
|
40 | - ); |
|
36 | + 'FHEE__espresso_list_of_event_dates__datetime_html', |
|
37 | + array( 'EED_Ical', 'generate_add_to_iCal_button' ), |
|
38 | + 10, |
|
39 | + 2 |
|
40 | + ); |
|
41 | 41 | // process ics download request |
42 | 42 | EE_Config::register_route( 'download_ics_file', 'EED_Ical', 'download_ics_file' ); |
43 | 43 | } |
@@ -66,15 +66,15 @@ discard block |
||
66 | 66 | |
67 | 67 | |
68 | 68 | |
69 | - /** |
|
70 | - * generate_add_to_iCal_button |
|
71 | - * |
|
72 | - * @access public |
|
73 | - * @param $html |
|
74 | - * @param $datetime |
|
75 | - * @return string |
|
76 | - * @throws \EE_Error |
|
77 | - */ |
|
69 | + /** |
|
70 | + * generate_add_to_iCal_button |
|
71 | + * |
|
72 | + * @access public |
|
73 | + * @param $html |
|
74 | + * @param $datetime |
|
75 | + * @return string |
|
76 | + * @throws \EE_Error |
|
77 | + */ |
|
78 | 78 | public static function generate_add_to_iCal_button( $html, $datetime ) { |
79 | 79 | // first verify a proper datetime object has been received |
80 | 80 | if ( $datetime instanceof EE_Datetime ) { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $html .= '</form>'; |
94 | 94 | break; |
95 | 95 | // buttons are just links that have been styled to appear as buttons, |
96 | - // but may not be blend with a theme as well as submit buttons |
|
96 | + // but may not be blend with a theme as well as submit buttons |
|
97 | 97 | case 'button' : |
98 | 98 | $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="' . $URL; |
99 | 99 | $html .= '" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '">'; |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | |
115 | 115 | |
116 | 116 | |
117 | - /** |
|
118 | - * download_ics_file |
|
119 | - * |
|
120 | - * @access public |
|
121 | - * @return void |
|
122 | - * @throws \EE_Error |
|
123 | - */ |
|
117 | + /** |
|
118 | + * download_ics_file |
|
119 | + * |
|
120 | + * @access public |
|
121 | + * @return void |
|
122 | + * @throws \EE_Error |
|
123 | + */ |
|
124 | 124 | public static function download_ics_file() { |
125 | 125 | if ( EE_Registry::instance()->REQ->is_set( 'ics_id' )) { |
126 | 126 | $DTT_ID = absint( EE_Registry::instance()->REQ->get( 'ics_id' )); |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | //Escape special chars within the description |
229 | 229 | $description = EED_Ical::_escape_ICal_data( $description ); |
230 | 230 | |
231 | - //Remove line breaks and output in iCal format |
|
232 | - $description = str_replace( array( "\r\n", "\n"), '\n', $description ); |
|
231 | + //Remove line breaks and output in iCal format |
|
232 | + $description = str_replace( array( "\r\n", "\n"), '\n', $description ); |
|
233 | 233 | |
234 | 234 | return $description; |
235 | 235 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /** |
4 | 6 | * EED_Ical Class |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @return EED_Ical|EED_Module |
20 | 20 | */ |
21 | 21 | public static function instance() { |
22 | - return parent::get_instance( __CLASS__ ); |
|
22 | + return parent::get_instance(__CLASS__); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | // create download buttons |
35 | 35 | add_filter( |
36 | 36 | 'FHEE__espresso_list_of_event_dates__datetime_html', |
37 | - array( 'EED_Ical', 'generate_add_to_iCal_button' ), |
|
37 | + array('EED_Ical', 'generate_add_to_iCal_button'), |
|
38 | 38 | 10, |
39 | 39 | 2 |
40 | 40 | ); |
41 | 41 | // process ics download request |
42 | - EE_Config::register_route( 'download_ics_file', 'EED_Ical', 'download_ics_file' ); |
|
42 | + EE_Config::register_route('download_ics_file', 'EED_Ical', 'download_ics_file'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @param WP $WP |
63 | 63 | * @return void |
64 | 64 | */ |
65 | - public function run( $WP ) {} |
|
65 | + public function run($WP) {} |
|
66 | 66 | |
67 | 67 | |
68 | 68 | |
@@ -75,35 +75,35 @@ discard block |
||
75 | 75 | * @return string |
76 | 76 | * @throws \EE_Error |
77 | 77 | */ |
78 | - public static function generate_add_to_iCal_button( $html, $datetime ) { |
|
78 | + public static function generate_add_to_iCal_button($html, $datetime) { |
|
79 | 79 | // first verify a proper datetime object has been received |
80 | - if ( $datetime instanceof EE_Datetime ) { |
|
80 | + if ($datetime instanceof EE_Datetime) { |
|
81 | 81 | // set whether a link or submit button is shown |
82 | - $iCal_type = apply_filters( 'FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit' ); |
|
82 | + $iCal_type = apply_filters('FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit'); |
|
83 | 83 | // generate a link to the route we registered in set_hooks() |
84 | - $URL = add_query_arg( array( 'ee' => 'download_ics_file', 'ics_id' => $datetime->ID() ), site_url() ); |
|
84 | + $URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $datetime->ID()), site_url()); |
|
85 | 85 | // what type ? |
86 | - switch ( $iCal_type ) { |
|
86 | + switch ($iCal_type) { |
|
87 | 87 | // submit buttons appear as buttons and are very compatible with a theme's style |
88 | 88 | case 'submit' : |
89 | - $html .= '<form id="download-iCal-frm-' . $datetime->ID(); |
|
90 | - $html .= '" class="download-iCal-frm" action="' . $URL . '" method="post" >'; |
|
89 | + $html .= '<form id="download-iCal-frm-'.$datetime->ID(); |
|
90 | + $html .= '" class="download-iCal-frm" action="'.$URL.'" method="post" >'; |
|
91 | 91 | $html .= '<input type="submit" class="ee-ical-sbmt" value="" title="'; |
92 | - $html .= __( 'Add to iCal Calendar', 'event_espresso' ) . '"/>'; |
|
92 | + $html .= __('Add to iCal Calendar', 'event_espresso').'"/>'; |
|
93 | 93 | $html .= '</form>'; |
94 | 94 | break; |
95 | 95 | // buttons are just links that have been styled to appear as buttons, |
96 | 96 | // but may not be blend with a theme as well as submit buttons |
97 | 97 | case 'button' : |
98 | - $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="' . $URL; |
|
99 | - $html .= '" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '">'; |
|
98 | + $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="'.$URL; |
|
99 | + $html .= '" title="'.__('Add to iCal Calendar', 'event_espresso').'">'; |
|
100 | 100 | $html .= ' <span class="dashicons dashicons-calendar"></span>'; |
101 | 101 | $html .= '</a>'; |
102 | 102 | break; |
103 | 103 | // links are just links that use the calendar dashicon |
104 | 104 | case 'icon' : |
105 | - $html .= '<a class="ee-ical-lnk" href="' . $URL . '" title="'; |
|
106 | - $html .= __( 'Add to iCal Calendar', 'event_espresso' ) . '">'; |
|
105 | + $html .= '<a class="ee-ical-lnk" href="'.$URL.'" title="'; |
|
106 | + $html .= __('Add to iCal Calendar', 'event_espresso').'">'; |
|
107 | 107 | $html .= ' <span class="dashicons dashicons-calendar"></span>'; |
108 | 108 | $html .= '</a>'; |
109 | 109 | break; |
@@ -122,29 +122,29 @@ discard block |
||
122 | 122 | * @throws \EE_Error |
123 | 123 | */ |
124 | 124 | public static function download_ics_file() { |
125 | - if ( EE_Registry::instance()->REQ->is_set( 'ics_id' )) { |
|
126 | - $DTT_ID = absint( EE_Registry::instance()->REQ->get( 'ics_id' )); |
|
127 | - $datetime = EE_Registry::instance()->load_model( 'Datetime' )->get_one_by_ID( $DTT_ID ); |
|
128 | - if ( $datetime instanceof EE_Datetime ) { |
|
125 | + if (EE_Registry::instance()->REQ->is_set('ics_id')) { |
|
126 | + $DTT_ID = absint(EE_Registry::instance()->REQ->get('ics_id')); |
|
127 | + $datetime = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($DTT_ID); |
|
128 | + if ($datetime instanceof EE_Datetime) { |
|
129 | 129 | // get related event, venues, and event categories |
130 | 130 | $event = $datetime->event(); |
131 | 131 | // get related category Term object and it's name |
132 | 132 | $category = $event->first_event_category(); |
133 | - if ( $category instanceof EE_Term ) { |
|
133 | + if ($category instanceof EE_Term) { |
|
134 | 134 | $category = $category->name(); |
135 | 135 | } |
136 | 136 | $location = ''; |
137 | 137 | // get first related venue and convert to CSV string |
138 | - $venue = $event->venues(array( 'limit'=>1 )); |
|
139 | - if ( is_array( $venue ) && ! empty( $venue )) { |
|
140 | - $venue = array_shift( $venue ); |
|
141 | - if ( $venue instanceof EE_Venue ) { |
|
142 | - $location = espresso_venue_raw_address( 'inline', $venue->ID(), FALSE ); |
|
138 | + $venue = $event->venues(array('limit'=>1)); |
|
139 | + if (is_array($venue) && ! empty($venue)) { |
|
140 | + $venue = array_shift($venue); |
|
141 | + if ($venue instanceof EE_Venue) { |
|
142 | + $location = espresso_venue_raw_address('inline', $venue->ID(), FALSE); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | 146 | //Generate filename |
147 | - $filename = $event->slug() . '-' . $datetime->start_date( 'Y-m-d' ) . '.ics'; |
|
147 | + $filename = $event->slug().'-'.$datetime->start_date('Y-m-d').'.ics'; |
|
148 | 148 | |
149 | 149 | //Check the datetime status has not been cancelled and set the ics value accordingly |
150 | 150 | $status = $datetime->get_active_status(); |
@@ -153,62 +153,62 @@ discard block |
||
153 | 153 | // Create array of ics details, escape strings, convert timestamps to ics format, etc |
154 | 154 | $ics_data = array( |
155 | 155 | 'ORGANIZER_NAME' => EE_Registry::instance()->CFG->organization->name, |
156 | - 'UID' => md5( $event->name() . $event->ID() . $datetime->ID() ), |
|
156 | + 'UID' => md5($event->name().$event->ID().$datetime->ID()), |
|
157 | 157 | 'ORGANIZER' => EE_Registry::instance()->CFG->organization->email, |
158 | - 'DTSTAMP' => date( EED_Ical::iCal_datetime_format ), |
|
158 | + 'DTSTAMP' => date(EED_Ical::iCal_datetime_format), |
|
159 | 159 | 'LOCATION' => $location, |
160 | 160 | 'SUMMARY' => $event->name(), |
161 | - 'DESCRIPTION' => wp_strip_all_tags( $event->description() ), |
|
161 | + 'DESCRIPTION' => wp_strip_all_tags($event->description()), |
|
162 | 162 | 'STATUS' => $status, |
163 | 163 | 'CATEGORIES' => $category, |
164 | - 'URL;VALUE=URI' => get_permalink( $event->ID() ), |
|
165 | - 'DTSTART' => date( EED_Ical::iCal_datetime_format, $datetime->start() ), |
|
166 | - 'DTEND' => date( EED_Ical::iCal_datetime_format, $datetime->end() ), |
|
164 | + 'URL;VALUE=URI' => get_permalink($event->ID()), |
|
165 | + 'DTSTART' => date(EED_Ical::iCal_datetime_format, $datetime->start()), |
|
166 | + 'DTEND' => date(EED_Ical::iCal_datetime_format, $datetime->end()), |
|
167 | 167 | ); |
168 | 168 | |
169 | 169 | //Filter the values used within the ics output. |
170 | 170 | //NOTE - all values within ics_data will be escaped automatically. |
171 | - $ics_data = apply_filters( 'FHEE__EED_Ical__download_ics_file_ics_data', $ics_data, $datetime ); |
|
171 | + $ics_data = apply_filters('FHEE__EED_Ical__download_ics_file_ics_data', $ics_data, $datetime); |
|
172 | 172 | |
173 | 173 | //Escape all ics data |
174 | - foreach( $ics_data as $key => $value ) { |
|
174 | + foreach ($ics_data as $key => $value) { |
|
175 | 175 | //Description is escaped differently from all all values |
176 | - if( $key === 'DESCRIPTION' ) { |
|
177 | - $ics_data[$key] = EED_Ical::_escape_ICal_description( wp_strip_all_tags( $value ) ); |
|
176 | + if ($key === 'DESCRIPTION') { |
|
177 | + $ics_data[$key] = EED_Ical::_escape_ICal_description(wp_strip_all_tags($value)); |
|
178 | 178 | } else { |
179 | - $ics_data[$key] = EED_Ical::_escape_ICal_data( $value ); |
|
179 | + $ics_data[$key] = EED_Ical::_escape_ICal_data($value); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
183 | 183 | //Pull the organizer name from ics_data and remove it from the array. |
184 | - $organizer_name = isset( $ics_data['ORGANIZER_NAME'] ) ? $ics_data['ORGANIZER_NAME'] : ''; |
|
185 | - unset( $ics_data['ORGANIZER_NAME'] ); |
|
184 | + $organizer_name = isset($ics_data['ORGANIZER_NAME']) ? $ics_data['ORGANIZER_NAME'] : ''; |
|
185 | + unset($ics_data['ORGANIZER_NAME']); |
|
186 | 186 | |
187 | 187 | // set headers |
188 | - header( 'Content-type: text/calendar; charset=utf-8' ); |
|
189 | - header( 'Content-Disposition: attachment; filename="' . $filename . '"' ); |
|
190 | - header( 'Cache-Control: private, max-age=0, must-revalidate' ); |
|
191 | - header( 'Pragma: public' ); |
|
192 | - header( 'Content-Type: application/octet-stream' ); |
|
193 | - header( 'Content-Type: application/force-download' ); |
|
194 | - header( 'Cache-Control: no-cache, must-revalidate' ); |
|
195 | - header( 'Content-Transfer-Encoding: binary' ); |
|
196 | - header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); // past date |
|
197 | - ini_set( 'zlib.output_compression', '0' ); |
|
188 | + header('Content-type: text/calendar; charset=utf-8'); |
|
189 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
190 | + header('Cache-Control: private, max-age=0, must-revalidate'); |
|
191 | + header('Pragma: public'); |
|
192 | + header('Content-Type: application/octet-stream'); |
|
193 | + header('Content-Type: application/force-download'); |
|
194 | + header('Cache-Control: no-cache, must-revalidate'); |
|
195 | + header('Content-Transfer-Encoding: binary'); |
|
196 | + header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // past date |
|
197 | + ini_set('zlib.output_compression', '0'); |
|
198 | 198 | // echo the output |
199 | - echo "BEGIN:VCALENDAR" . PHP_EOL; |
|
200 | - echo "VERSION:2.0" . PHP_EOL; |
|
201 | - echo "PRODID:-//{$organizer_name}//NONSGML PDA Calendar Version 1.0//EN" . PHP_EOL; |
|
202 | - echo "CALSCALE:GREGORIAN" . PHP_EOL; |
|
203 | - echo "BEGIN:VEVENT" . PHP_EOL; |
|
199 | + echo "BEGIN:VCALENDAR".PHP_EOL; |
|
200 | + echo "VERSION:2.0".PHP_EOL; |
|
201 | + echo "PRODID:-//{$organizer_name}//NONSGML PDA Calendar Version 1.0//EN".PHP_EOL; |
|
202 | + echo "CALSCALE:GREGORIAN".PHP_EOL; |
|
203 | + echo "BEGIN:VEVENT".PHP_EOL; |
|
204 | 204 | |
205 | 205 | //Output all remaining values from ics_data. |
206 | - foreach( $ics_data as $key => $value ) { |
|
207 | - echo $key . ':' . $value . PHP_EOL; |
|
206 | + foreach ($ics_data as $key => $value) { |
|
207 | + echo $key.':'.$value.PHP_EOL; |
|
208 | 208 | } |
209 | 209 | |
210 | - echo "END:VEVENT" . PHP_EOL; |
|
211 | - echo "END:VCALENDAR" . PHP_EOL; |
|
210 | + echo "END:VEVENT".PHP_EOL; |
|
211 | + echo "END:VCALENDAR".PHP_EOL; |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | die(); |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | * @param string $string |
224 | 224 | * @return string |
225 | 225 | */ |
226 | - private static function _escape_ICal_data( $string = '' ) { |
|
227 | - return preg_replace( '/([\,;])/', '\\\$1', $string ); |
|
226 | + private static function _escape_ICal_data($string = '') { |
|
227 | + return preg_replace('/([\,;])/', '\\\$1', $string); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
@@ -234,13 +234,13 @@ discard block |
||
234 | 234 | * @param string $description |
235 | 235 | * @return string |
236 | 236 | */ |
237 | - private static function _escape_ICal_description( $description = '' ) { |
|
237 | + private static function _escape_ICal_description($description = '') { |
|
238 | 238 | |
239 | 239 | //Escape special chars within the description |
240 | - $description = EED_Ical::_escape_ICal_data( $description ); |
|
240 | + $description = EED_Ical::_escape_ICal_data($description); |
|
241 | 241 | |
242 | 242 | //Remove line breaks and output in iCal format |
243 | - $description = str_replace( array( "\r\n", "\n"), '\n', $description ); |
|
243 | + $description = str_replace(array("\r\n", "\n"), '\n', $description); |
|
244 | 244 | |
245 | 245 | return $description; |
246 | 246 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * @var integer $limit |
29 | 29 | */ |
30 | - private $limit = 10; |
|
30 | + private $limit = 10; |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * @var string $css_class |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function __construct($args = array()) |
70 | 70 | { |
71 | - $args = $this->parseArgs((array)$args); |
|
71 | + $args = $this->parseArgs((array) $args); |
|
72 | 72 | $this->setupEventQueryHelper(); |
73 | 73 | $this->setupFilters(); |
74 | 74 | $args = $this->getQueryArgs($args); |
@@ -19,206 +19,206 @@ |
||
19 | 19 | class EventListQuery extends WP_Query |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * @var string $title |
|
24 | - */ |
|
25 | - private $title; |
|
26 | - |
|
27 | - /** |
|
28 | - * @var integer $limit |
|
29 | - */ |
|
30 | - private $limit = 10; |
|
31 | - |
|
32 | - /** |
|
33 | - * @var string $css_class |
|
34 | - */ |
|
35 | - private $css_class; |
|
36 | - |
|
37 | - /** |
|
38 | - * @var boolean $show_expired |
|
39 | - */ |
|
40 | - private $show_expired = false; |
|
41 | - |
|
42 | - /** |
|
43 | - * @var string $month |
|
44 | - */ |
|
45 | - private $month; |
|
46 | - |
|
47 | - /** |
|
48 | - * @var string $category_slug |
|
49 | - */ |
|
50 | - private $category_slug; |
|
51 | - |
|
52 | - /** |
|
53 | - * @var string $order_by |
|
54 | - */ |
|
55 | - private $order_by; |
|
56 | - |
|
57 | - /** |
|
58 | - * @var string $sort |
|
59 | - */ |
|
60 | - private $sort; |
|
61 | - |
|
62 | - /** |
|
63 | - * @var boolean $show_title |
|
64 | - */ |
|
65 | - private $show_title = true; |
|
66 | - |
|
67 | - |
|
68 | - |
|
69 | - /** |
|
70 | - * EE_Event_List_Query Constructor * |
|
71 | - * |
|
72 | - * @param array $args |
|
73 | - */ |
|
74 | - public function __construct($args = array()) |
|
75 | - { |
|
76 | - $args = $this->parseArgs((array)$args); |
|
77 | - $this->setupEventQueryHelper(); |
|
78 | - $this->setupFilters(); |
|
79 | - $args = $this->getQueryArgs($args); |
|
80 | - // run the query |
|
81 | - parent::__construct($args); |
|
82 | - } |
|
83 | - |
|
84 | - |
|
85 | - |
|
86 | - /** |
|
87 | - * @param array $args |
|
88 | - * @return array |
|
89 | - */ |
|
90 | - private function parseArgs(array $args) |
|
91 | - { |
|
92 | - // incoming args could be a mix of WP query args + EE shortcode args |
|
93 | - foreach ($args as $property => $value) { |
|
94 | - // if the arg is a property of this class, then it's an EE shortcode arg |
|
95 | - if (property_exists($this, $property) && ! property_exists('WP_Query', $property)) { |
|
96 | - // set the property value |
|
97 | - $this->{$property} = $value; |
|
98 | - // then remove it from the array of args that will later be passed to WP_Query() |
|
99 | - unset($args[$property]); |
|
100 | - } |
|
101 | - } |
|
102 | - return $args; |
|
103 | - } |
|
104 | - |
|
105 | - |
|
106 | - |
|
107 | - private function setupEventQueryHelper() |
|
108 | - { |
|
109 | - //add query filters |
|
110 | - EEH_Event_Query::add_query_filters(); |
|
111 | - // set params that will get used by the filters |
|
112 | - EEH_Event_Query::set_query_params( |
|
113 | - $this->month, |
|
114 | - $this->category_slug, |
|
115 | - $this->show_expired, |
|
116 | - $this->order_by, |
|
117 | - $this->sort |
|
118 | - ); |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - |
|
123 | - private function setupFilters() |
|
124 | - { |
|
125 | - // first off, let's remove any filters from previous queries |
|
126 | - remove_filter( |
|
127 | - 'FHEE__archive_espresso_events_template__show_header', |
|
128 | - array($this, 'show_event_list_title') |
|
129 | - ); |
|
130 | - remove_filter( |
|
131 | - 'FHEE__archive_espresso_events_template__upcoming_events_h1', |
|
132 | - array($this, 'event_list_title') |
|
133 | - ); |
|
134 | - remove_all_filters('FHEE__content_espresso_events__event_class'); |
|
135 | - // Event List Title ? |
|
136 | - add_filter( |
|
137 | - 'FHEE__archive_espresso_events_template__show_header', |
|
138 | - array($this, 'show_event_list_title') |
|
139 | - ); |
|
140 | - add_filter( |
|
141 | - 'FHEE__archive_espresso_events_template__upcoming_events_h1', |
|
142 | - array($this, 'event_list_title'), |
|
143 | - 10, |
|
144 | - 1 |
|
145 | - ); |
|
146 | - // add the css class |
|
147 | - add_filter( |
|
148 | - 'FHEE__content_espresso_events__event_class', |
|
149 | - array($this, 'event_list_css'), |
|
150 | - 10, |
|
151 | - 1 |
|
152 | - ); |
|
153 | - } |
|
154 | - |
|
155 | - |
|
156 | - |
|
157 | - private function getQueryArgs(array $args) |
|
158 | - { |
|
159 | - // the current "page" we are viewing |
|
160 | - $paged = max(1, get_query_var('paged')); |
|
161 | - // Force these args |
|
162 | - return array_merge( |
|
163 | - $args, |
|
164 | - array( |
|
165 | - 'post_type' => 'espresso_events', |
|
166 | - 'posts_per_page' => $this->limit, |
|
167 | - 'update_post_term_cache' => false, |
|
168 | - 'update_post_meta_cache' => false, |
|
169 | - 'paged' => $paged, |
|
170 | - 'offset' => ($paged - 1) * $this->limit, |
|
171 | - ) |
|
172 | - ); |
|
173 | - } |
|
174 | - |
|
175 | - |
|
176 | - |
|
177 | - /** |
|
178 | - * show_event_list_title |
|
179 | - * |
|
180 | - * @return boolean |
|
181 | - */ |
|
182 | - public function show_event_list_title() |
|
183 | - { |
|
184 | - return filter_var( |
|
185 | - $this->show_title, |
|
186 | - FILTER_VALIDATE_BOOLEAN |
|
187 | - ); |
|
188 | - } |
|
189 | - |
|
190 | - |
|
191 | - |
|
192 | - /** |
|
193 | - * callback for FHEE__archive_espresso_events_template__upcoming_events_h1 filter |
|
194 | - * |
|
195 | - * @param string $event_list_title |
|
196 | - * @return string |
|
197 | - */ |
|
198 | - public function event_list_title($event_list_title = '') |
|
199 | - { |
|
200 | - if ( ! empty($this->title)) { |
|
201 | - return $this->title; |
|
202 | - } |
|
203 | - return $event_list_title; |
|
204 | - } |
|
205 | - |
|
206 | - |
|
207 | - |
|
208 | - /** |
|
209 | - * callback for FHEE__content_espresso_events__event_class filter |
|
210 | - * |
|
211 | - * @param string $event_list_css |
|
212 | - * @return string |
|
213 | - */ |
|
214 | - public function event_list_css($event_list_css = '') |
|
215 | - { |
|
216 | - $event_list_css .= ! empty($event_list_css) ? ' ' : ''; |
|
217 | - $event_list_css .= ! empty($this->css_class) ? $this->css_class : ''; |
|
218 | - $event_list_css .= ! empty($event_list_css) ? ' ' : ''; |
|
219 | - $event_list_css .= ! empty($this->category_slug) ? $this->category_slug : ''; |
|
220 | - return $event_list_css; |
|
221 | - } |
|
22 | + /** |
|
23 | + * @var string $title |
|
24 | + */ |
|
25 | + private $title; |
|
26 | + |
|
27 | + /** |
|
28 | + * @var integer $limit |
|
29 | + */ |
|
30 | + private $limit = 10; |
|
31 | + |
|
32 | + /** |
|
33 | + * @var string $css_class |
|
34 | + */ |
|
35 | + private $css_class; |
|
36 | + |
|
37 | + /** |
|
38 | + * @var boolean $show_expired |
|
39 | + */ |
|
40 | + private $show_expired = false; |
|
41 | + |
|
42 | + /** |
|
43 | + * @var string $month |
|
44 | + */ |
|
45 | + private $month; |
|
46 | + |
|
47 | + /** |
|
48 | + * @var string $category_slug |
|
49 | + */ |
|
50 | + private $category_slug; |
|
51 | + |
|
52 | + /** |
|
53 | + * @var string $order_by |
|
54 | + */ |
|
55 | + private $order_by; |
|
56 | + |
|
57 | + /** |
|
58 | + * @var string $sort |
|
59 | + */ |
|
60 | + private $sort; |
|
61 | + |
|
62 | + /** |
|
63 | + * @var boolean $show_title |
|
64 | + */ |
|
65 | + private $show_title = true; |
|
66 | + |
|
67 | + |
|
68 | + |
|
69 | + /** |
|
70 | + * EE_Event_List_Query Constructor * |
|
71 | + * |
|
72 | + * @param array $args |
|
73 | + */ |
|
74 | + public function __construct($args = array()) |
|
75 | + { |
|
76 | + $args = $this->parseArgs((array)$args); |
|
77 | + $this->setupEventQueryHelper(); |
|
78 | + $this->setupFilters(); |
|
79 | + $args = $this->getQueryArgs($args); |
|
80 | + // run the query |
|
81 | + parent::__construct($args); |
|
82 | + } |
|
83 | + |
|
84 | + |
|
85 | + |
|
86 | + /** |
|
87 | + * @param array $args |
|
88 | + * @return array |
|
89 | + */ |
|
90 | + private function parseArgs(array $args) |
|
91 | + { |
|
92 | + // incoming args could be a mix of WP query args + EE shortcode args |
|
93 | + foreach ($args as $property => $value) { |
|
94 | + // if the arg is a property of this class, then it's an EE shortcode arg |
|
95 | + if (property_exists($this, $property) && ! property_exists('WP_Query', $property)) { |
|
96 | + // set the property value |
|
97 | + $this->{$property} = $value; |
|
98 | + // then remove it from the array of args that will later be passed to WP_Query() |
|
99 | + unset($args[$property]); |
|
100 | + } |
|
101 | + } |
|
102 | + return $args; |
|
103 | + } |
|
104 | + |
|
105 | + |
|
106 | + |
|
107 | + private function setupEventQueryHelper() |
|
108 | + { |
|
109 | + //add query filters |
|
110 | + EEH_Event_Query::add_query_filters(); |
|
111 | + // set params that will get used by the filters |
|
112 | + EEH_Event_Query::set_query_params( |
|
113 | + $this->month, |
|
114 | + $this->category_slug, |
|
115 | + $this->show_expired, |
|
116 | + $this->order_by, |
|
117 | + $this->sort |
|
118 | + ); |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + |
|
123 | + private function setupFilters() |
|
124 | + { |
|
125 | + // first off, let's remove any filters from previous queries |
|
126 | + remove_filter( |
|
127 | + 'FHEE__archive_espresso_events_template__show_header', |
|
128 | + array($this, 'show_event_list_title') |
|
129 | + ); |
|
130 | + remove_filter( |
|
131 | + 'FHEE__archive_espresso_events_template__upcoming_events_h1', |
|
132 | + array($this, 'event_list_title') |
|
133 | + ); |
|
134 | + remove_all_filters('FHEE__content_espresso_events__event_class'); |
|
135 | + // Event List Title ? |
|
136 | + add_filter( |
|
137 | + 'FHEE__archive_espresso_events_template__show_header', |
|
138 | + array($this, 'show_event_list_title') |
|
139 | + ); |
|
140 | + add_filter( |
|
141 | + 'FHEE__archive_espresso_events_template__upcoming_events_h1', |
|
142 | + array($this, 'event_list_title'), |
|
143 | + 10, |
|
144 | + 1 |
|
145 | + ); |
|
146 | + // add the css class |
|
147 | + add_filter( |
|
148 | + 'FHEE__content_espresso_events__event_class', |
|
149 | + array($this, 'event_list_css'), |
|
150 | + 10, |
|
151 | + 1 |
|
152 | + ); |
|
153 | + } |
|
154 | + |
|
155 | + |
|
156 | + |
|
157 | + private function getQueryArgs(array $args) |
|
158 | + { |
|
159 | + // the current "page" we are viewing |
|
160 | + $paged = max(1, get_query_var('paged')); |
|
161 | + // Force these args |
|
162 | + return array_merge( |
|
163 | + $args, |
|
164 | + array( |
|
165 | + 'post_type' => 'espresso_events', |
|
166 | + 'posts_per_page' => $this->limit, |
|
167 | + 'update_post_term_cache' => false, |
|
168 | + 'update_post_meta_cache' => false, |
|
169 | + 'paged' => $paged, |
|
170 | + 'offset' => ($paged - 1) * $this->limit, |
|
171 | + ) |
|
172 | + ); |
|
173 | + } |
|
174 | + |
|
175 | + |
|
176 | + |
|
177 | + /** |
|
178 | + * show_event_list_title |
|
179 | + * |
|
180 | + * @return boolean |
|
181 | + */ |
|
182 | + public function show_event_list_title() |
|
183 | + { |
|
184 | + return filter_var( |
|
185 | + $this->show_title, |
|
186 | + FILTER_VALIDATE_BOOLEAN |
|
187 | + ); |
|
188 | + } |
|
189 | + |
|
190 | + |
|
191 | + |
|
192 | + /** |
|
193 | + * callback for FHEE__archive_espresso_events_template__upcoming_events_h1 filter |
|
194 | + * |
|
195 | + * @param string $event_list_title |
|
196 | + * @return string |
|
197 | + */ |
|
198 | + public function event_list_title($event_list_title = '') |
|
199 | + { |
|
200 | + if ( ! empty($this->title)) { |
|
201 | + return $this->title; |
|
202 | + } |
|
203 | + return $event_list_title; |
|
204 | + } |
|
205 | + |
|
206 | + |
|
207 | + |
|
208 | + /** |
|
209 | + * callback for FHEE__content_espresso_events__event_class filter |
|
210 | + * |
|
211 | + * @param string $event_list_css |
|
212 | + * @return string |
|
213 | + */ |
|
214 | + public function event_list_css($event_list_css = '') |
|
215 | + { |
|
216 | + $event_list_css .= ! empty($event_list_css) ? ' ' : ''; |
|
217 | + $event_list_css .= ! empty($this->css_class) ? $this->css_class : ''; |
|
218 | + $event_list_css .= ! empty($event_list_css) ? ' ' : ''; |
|
219 | + $event_list_css .= ! empty($this->category_slug) ? $this->category_slug : ''; |
|
220 | + return $event_list_css; |
|
221 | + } |
|
222 | 222 | |
223 | 223 | } |
224 | 224 | // End of file EventListQuery.php |
@@ -8,45 +8,45 @@ |
||
8 | 8 | interface EnqueueAssetsInterface |
9 | 9 | { |
10 | 10 | |
11 | - /** |
|
12 | - * a place to register scripts and stylesheets with WordPress core |
|
13 | - * IMPORTANT !!! |
|
14 | - * ALL JavaScript files need to be registered for loading in the footer |
|
15 | - * by setting the 5th parameter of wp_register_script() to ` true ` |
|
16 | - * |
|
17 | - * @return void |
|
18 | - */ |
|
19 | - public function registerScriptsAndStylesheets(); |
|
20 | - |
|
21 | - /** |
|
22 | - * a place to enqueue previously registered stylesheets |
|
23 | - * this will be called during the wp_enqueue_scripts hook for frontend requests |
|
24 | - * |
|
25 | - * @return void |
|
26 | - */ |
|
27 | - public function enqueueStylesheets(); |
|
28 | - |
|
29 | - /** |
|
30 | - * a place to enqueue previously registered stylesheets |
|
31 | - * this will be called during the admin_enqueue_scripts hook for admin requests |
|
32 | - * |
|
33 | - * @return void |
|
34 | - */ |
|
35 | - public function enqueueAdminStylesheets(); |
|
36 | - |
|
37 | - /** |
|
38 | - * a place to enqueue previously registered scripts for frontend requests |
|
39 | - * |
|
40 | - * @return void |
|
41 | - */ |
|
42 | - public function enqueueScripts(); |
|
43 | - |
|
44 | - /** |
|
45 | - * a place to enqueue previously registered scripts for admin requests |
|
46 | - * |
|
47 | - * @return void |
|
48 | - */ |
|
49 | - public function enqueueAdminScripts(); |
|
11 | + /** |
|
12 | + * a place to register scripts and stylesheets with WordPress core |
|
13 | + * IMPORTANT !!! |
|
14 | + * ALL JavaScript files need to be registered for loading in the footer |
|
15 | + * by setting the 5th parameter of wp_register_script() to ` true ` |
|
16 | + * |
|
17 | + * @return void |
|
18 | + */ |
|
19 | + public function registerScriptsAndStylesheets(); |
|
20 | + |
|
21 | + /** |
|
22 | + * a place to enqueue previously registered stylesheets |
|
23 | + * this will be called during the wp_enqueue_scripts hook for frontend requests |
|
24 | + * |
|
25 | + * @return void |
|
26 | + */ |
|
27 | + public function enqueueStylesheets(); |
|
28 | + |
|
29 | + /** |
|
30 | + * a place to enqueue previously registered stylesheets |
|
31 | + * this will be called during the admin_enqueue_scripts hook for admin requests |
|
32 | + * |
|
33 | + * @return void |
|
34 | + */ |
|
35 | + public function enqueueAdminStylesheets(); |
|
36 | + |
|
37 | + /** |
|
38 | + * a place to enqueue previously registered scripts for frontend requests |
|
39 | + * |
|
40 | + * @return void |
|
41 | + */ |
|
42 | + public function enqueueScripts(); |
|
43 | + |
|
44 | + /** |
|
45 | + * a place to enqueue previously registered scripts for admin requests |
|
46 | + * |
|
47 | + * @return void |
|
48 | + */ |
|
49 | + public function enqueueAdminScripts(); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | // End of file EnqueueAssetsInterface.php |
@@ -8,33 +8,33 @@ |
||
8 | 8 | interface SetHooksInterface |
9 | 9 | { |
10 | 10 | |
11 | - /** |
|
12 | - * a place to add action and filter hooks for regular frontend requests |
|
13 | - * |
|
14 | - * @return void |
|
15 | - */ |
|
16 | - public function setHooks(); |
|
17 | - |
|
18 | - /** |
|
19 | - * a place to add action and filter hooks for regular WP admin requests |
|
20 | - * |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function setAdminHooks(); |
|
24 | - |
|
25 | - /** |
|
26 | - * a place to add action and filter hooks for AJAX requests |
|
27 | - * |
|
28 | - * @return void |
|
29 | - */ |
|
30 | - public function setAjaxHooks(); |
|
31 | - |
|
32 | - /** |
|
33 | - * a place to add action and filter hooks for REST API requests |
|
34 | - * |
|
35 | - * @return void |
|
36 | - */ |
|
37 | - public function setApiHooks(); |
|
11 | + /** |
|
12 | + * a place to add action and filter hooks for regular frontend requests |
|
13 | + * |
|
14 | + * @return void |
|
15 | + */ |
|
16 | + public function setHooks(); |
|
17 | + |
|
18 | + /** |
|
19 | + * a place to add action and filter hooks for regular WP admin requests |
|
20 | + * |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function setAdminHooks(); |
|
24 | + |
|
25 | + /** |
|
26 | + * a place to add action and filter hooks for AJAX requests |
|
27 | + * |
|
28 | + * @return void |
|
29 | + */ |
|
30 | + public function setAjaxHooks(); |
|
31 | + |
|
32 | + /** |
|
33 | + * a place to add action and filter hooks for REST API requests |
|
34 | + * |
|
35 | + * @return void |
|
36 | + */ |
|
37 | + public function setApiHooks(); |
|
38 | 38 | |
39 | 39 | } |
40 | 40 | // End of file SetHooksInterface.php |