@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | //namespace EventEspresso\core\libraries\templates; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * Class EE_Template_Part_PriorityQueue |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | * @param int $priority |
32 | 32 | * @return bool |
33 | 33 | */ |
34 | - public function insert( $object, $priority = 100 ) { |
|
35 | - if ( $object instanceof EE_Template_Part ) { |
|
36 | - parent::insert( $object, $priority ); |
|
34 | + public function insert($object, $priority = 100) { |
|
35 | + if ($object instanceof EE_Template_Part) { |
|
36 | + parent::insert($object, $priority); |
|
37 | 37 | return true; |
38 | 38 | } else { |
39 | 39 | return false; |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | * @param int $priority2 |
53 | 53 | * @return bool |
54 | 54 | */ |
55 | - public function compare( $priority1, $priority2 ) { |
|
56 | - if ( $priority1 === $priority2 ) { |
|
55 | + public function compare($priority1, $priority2) { |
|
56 | + if ($priority1 === $priority2) { |
|
57 | 57 | return 0; |
58 | 58 | } |
59 | 59 | return $priority1 > $priority2 ? -1 : 1; |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | * @return EE_Request_Stack_Builder |
45 | 45 | */ |
46 | 46 | public function unshift( /*$class_name, $args*/ ) { |
47 | - if ( func_num_args() === 0 ) { |
|
48 | - throw new InvalidArgumentException( "Missing argument(s) when calling unshift" ); |
|
47 | + if (func_num_args() === 0) { |
|
48 | + throw new InvalidArgumentException("Missing argument(s) when calling unshift"); |
|
49 | 49 | } |
50 | 50 | $middleware = func_get_args(); |
51 | 51 | //$this->middleware_stack->unshift( $middleware ); |
52 | - array_unshift( $this->_middleware_stack, $middleware ); |
|
52 | + array_unshift($this->_middleware_stack, $middleware); |
|
53 | 53 | return $this; |
54 | 54 | } |
55 | 55 | |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | * @return EE_Request_Stack_Builder |
67 | 67 | */ |
68 | 68 | public function push( /*$class_name, $args...*/ ) { |
69 | - if ( func_num_args() === 0 ) { |
|
70 | - throw new InvalidArgumentException( "Missing argument(s) when calling push" ); |
|
69 | + if (func_num_args() === 0) { |
|
70 | + throw new InvalidArgumentException("Missing argument(s) when calling push"); |
|
71 | 71 | } |
72 | 72 | $middleware = func_get_args(); |
73 | 73 | //$this->middleware_stack->push( $middleware ); |
74 | - array_push( $this->_middleware_stack, $middleware ); |
|
74 | + array_push($this->_middleware_stack, $middleware); |
|
75 | 75 | return $this; |
76 | 76 | } |
77 | 77 | |
@@ -84,20 +84,20 @@ discard block |
||
84 | 84 | * @param EEI_Request_Decorator $application |
85 | 85 | * @return EE_Request_Stack |
86 | 86 | */ |
87 | - public function resolve( EEI_Request_Decorator $application ) { |
|
88 | - $middlewares = array( $application ); |
|
89 | - foreach ( $this->_middleware_stack as $middleware_args ) { |
|
90 | - $class_name = array_shift( $middleware_args ); |
|
91 | - if ( is_callable( $class_name ) ) { |
|
92 | - $application = $class_name( $application ); |
|
87 | + public function resolve(EEI_Request_Decorator $application) { |
|
88 | + $middlewares = array($application); |
|
89 | + foreach ($this->_middleware_stack as $middleware_args) { |
|
90 | + $class_name = array_shift($middleware_args); |
|
91 | + if (is_callable($class_name)) { |
|
92 | + $application = $class_name($application); |
|
93 | 93 | } else { |
94 | - array_unshift( $middleware_args, $application ); |
|
95 | - $reflection = new ReflectionClass( $class_name ); |
|
96 | - $application = $reflection->newInstanceArgs( $middleware_args ); |
|
94 | + array_unshift($middleware_args, $application); |
|
95 | + $reflection = new ReflectionClass($class_name); |
|
96 | + $application = $reflection->newInstanceArgs($middleware_args); |
|
97 | 97 | } |
98 | - array_unshift( $middlewares, $application ); |
|
98 | + array_unshift($middlewares, $application); |
|
99 | 99 | } |
100 | - return new EE_Request_Stack( $application, $middlewares ); |
|
100 | + return new EE_Request_Stack($application, $middlewares); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @return \EE_Response |
41 | 41 | */ |
42 | 42 | public function __construct() { |
43 | - $this->terminate_request( false ); |
|
43 | + $this->terminate_request(false); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * @param $value |
54 | 54 | * @return void |
55 | 55 | */ |
56 | - public function set_notice( $key, $value ) { |
|
57 | - $this->_notice[ $key ] = $value; |
|
56 | + public function set_notice($key, $value) { |
|
57 | + $this->_notice[$key] = $value; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * @param $key |
67 | 67 | * @return mixed |
68 | 68 | */ |
69 | - public function get_notice( $key ) { |
|
70 | - return isset( $this->_notice[ $key ] ) ? $this->_notice[ $key ] : NULL; |
|
69 | + public function get_notice($key) { |
|
70 | + return isset($this->_notice[$key]) ? $this->_notice[$key] : NULL; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | * @param $string |
92 | 92 | * @param bool $append |
93 | 93 | */ |
94 | - public function add_output( $string, $append = true ) { |
|
95 | - $this->_output = $append ? $this->_output . $string : $string . $this->_output; |
|
94 | + public function add_output($string, $append = true) { |
|
95 | + $this->_output = $append ? $this->_output.$string : $string.$this->_output; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | /** |
122 | 122 | * @param boolean $request_terminated |
123 | 123 | */ |
124 | - public function terminate_request( $request_terminated = true ) { |
|
125 | - $this->request_terminated = filter_var( $request_terminated, FILTER_VALIDATE_BOOLEAN ); |
|
124 | + public function terminate_request($request_terminated = true) { |
|
125 | + $this->request_terminated = filter_var($request_terminated, FILTER_VALIDATE_BOOLEAN); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 |
@@ -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 | * class EE_Response |
4 | 6 | * |
@@ -3,7 +3,7 @@ |
||
3 | 3 | /** @type string $events_requiring_pre_approval_msg */ |
4 | 4 | ?> |
5 | 5 | |
6 | -<h4><span class="orange-text"><?php _e('Important Notice: Events Requiring Pre-Approval', 'event_espresso');?></span></h4> |
|
6 | +<h4><span class="orange-text"><?php _e('Important Notice: Events Requiring Pre-Approval', 'event_espresso'); ?></span></h4> |
|
7 | 7 | <p id="events-requiring-pre-approval-pg" class="small-text drk-grey-text"> |
8 | 8 | <?php echo $events_requiring_pre_approval_msg; ?> |
9 | 9 | </p> |
@@ -3,9 +3,9 @@ |
||
3 | 3 | /** @type string $sold_out_events_msg */ |
4 | 4 | ?> |
5 | 5 | |
6 | -<h4 class="ee-status sold-out"><b><?php _e('Sold Out', 'event_espresso');?></b></h4> |
|
6 | +<h4 class="ee-status sold-out"><b><?php _e('Sold Out', 'event_espresso'); ?></b></h4> |
|
7 | 7 | <ul id="spco-sold-out-events-ul"><?php echo $sold_out_events; ?></ul> |
8 | - <h6 class="pink-text"><?php _e("We're Sorry", 'event_espresso');?></h6> |
|
8 | + <h6 class="pink-text"><?php _e("We're Sorry", 'event_espresso'); ?></h6> |
|
9 | 9 | <p id="events-requiring-pre-approval-pg" class="small-text drk-grey-text"> |
10 | 10 | <?php echo $sold_out_events_msg; ?> |
11 | 11 | </p> |
@@ -3,8 +3,8 @@ |
||
3 | 3 | /** @type string $sold_out_tickets_msg */ |
4 | 4 | ?> |
5 | 5 | |
6 | - <h4 ><b><?php _e('Sold Out', 'event_espresso');?></b></h4> |
|
7 | - <h6 class="pink-text"><?php _e("We're Sorry", 'event_espresso');?></h6> |
|
6 | + <h4 ><b><?php _e('Sold Out', 'event_espresso'); ?></b></h4> |
|
7 | + <h6 class="pink-text"><?php _e("We're Sorry", 'event_espresso'); ?></h6> |
|
8 | 8 | <p id="tickets-requiring-pre-approval-pg" class="small-text drk-grey-text"> |
9 | 9 | <?php echo $sold_out_tickets_msg; ?> |
10 | 10 | </p> |
@@ -21,22 +21,22 @@ 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 | //echo '<br/><h6 style="color:#2EA2CC;">'. __FILE__ . ' <span style="font-weight:normal;color:#E76700"> Line #: ' . __LINE__ . '</span></h6>'; |
27 | 27 | |
28 | 28 | global $post; |
29 | -$event_class = has_excerpt( $post->ID ) ? ' has-excerpt' : ''; |
|
30 | -$event_class = apply_filters( 'FHEE__content_espresso_events__event_class', $event_class ); |
|
29 | +$event_class = has_excerpt($post->ID) ? ' has-excerpt' : ''; |
|
30 | +$event_class = apply_filters('FHEE__content_espresso_events__event_class', $event_class); |
|
31 | 31 | ?> |
32 | -<?php do_action( 'AHEE_event_details_before_post', $post ); ?> |
|
33 | -<article id="post-<?php the_ID(); ?>" <?php post_class( $event_class ); ?>> |
|
32 | +<?php do_action('AHEE_event_details_before_post', $post); ?> |
|
33 | +<article id="post-<?php the_ID(); ?>" <?php post_class($event_class); ?>> |
|
34 | 34 | |
35 | -<?php if ( is_single() ) : ?> |
|
35 | +<?php if (is_single()) : ?> |
|
36 | 36 | |
37 | - <div id="espresso-event-header-dv-<?php echo $post->ID;?>" class="espresso-event-header-dv"> |
|
38 | - <?php espresso_get_template_part( 'content', 'espresso_events-thumbnail' ); ?> |
|
39 | - <?php espresso_get_template_part( 'content', 'espresso_events-header' ); ?> |
|
37 | + <div id="espresso-event-header-dv-<?php echo $post->ID; ?>" class="espresso-event-header-dv"> |
|
38 | + <?php espresso_get_template_part('content', 'espresso_events-thumbnail'); ?> |
|
39 | + <?php espresso_get_template_part('content', 'espresso_events-header'); ?> |
|
40 | 40 | </div> |
41 | 41 | |
42 | 42 | <div class="espresso-event-wrapper-dv"> |
@@ -46,16 +46,16 @@ discard block |
||
46 | 46 | <?php //espresso_get_template_part( 'content', 'espresso_events-details' ); ?> |
47 | 47 | <?php //espresso_get_template_part( 'content', 'espresso_events-venues' ); ?> |
48 | 48 | <footer class="event-meta"> |
49 | - <?php do_action( 'AHEE_event_details_footer_top', $post ); ?> |
|
50 | - <?php do_action( 'AHEE_event_details_footer_bottom', $post ); ?> |
|
49 | + <?php do_action('AHEE_event_details_footer_top', $post); ?> |
|
50 | + <?php do_action('AHEE_event_details_footer_bottom', $post); ?> |
|
51 | 51 | </footer> |
52 | 52 | </div> |
53 | 53 | |
54 | -<?php elseif ( is_archive() ) : ?> |
|
54 | +<?php elseif (is_archive()) : ?> |
|
55 | 55 | |
56 | - <div id="espresso-event-list-header-dv-<?php echo $post->ID;?>" class="espresso-event-header-dv"> |
|
57 | - <?php espresso_get_template_part( 'content', 'espresso_events-thumbnail' ); ?> |
|
58 | - <?php espresso_get_template_part( 'content', 'espresso_events-header' ); ?> |
|
56 | + <div id="espresso-event-list-header-dv-<?php echo $post->ID; ?>" class="espresso-event-header-dv"> |
|
57 | + <?php espresso_get_template_part('content', 'espresso_events-thumbnail'); ?> |
|
58 | + <?php espresso_get_template_part('content', 'espresso_events-header'); ?> |
|
59 | 59 | </div> |
60 | 60 | |
61 | 61 | <div class="espresso-event-list-wrapper-dv"> |
@@ -70,5 +70,5 @@ discard block |
||
70 | 70 | |
71 | 71 | </article> |
72 | 72 | <!-- #post --> |
73 | -<?php do_action( 'AHEE_event_details_after_post', $post ); |
|
73 | +<?php do_action('AHEE_event_details_after_post', $post); |
|
74 | 74 |
@@ -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 | - <div id="espresso-event-header-dv-<?php echo $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' ); ?> |
|
34 | + <div id="espresso-event-header-dv-<?php echo $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'); ?> |
|
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 | - <div id="espresso-event-list-header-dv-<?php echo $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' ); ?> |
|
52 | + <div id="espresso-event-list-header-dv-<?php echo $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'); ?> |
|
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 |
@@ -220,8 +220,8 @@ |
||
220 | 220 | //Escape spcial chars within the decription |
221 | 221 | $description = EED_Ical::_escape_ICal_data( $description ); |
222 | 222 | |
223 | - //Remove line breaks and output in iCal format |
|
224 | - $description = str_replace( array( "\r\n", "\n"), '\n', $description ); |
|
223 | + //Remove line breaks and output in iCal format |
|
224 | + $description = str_replace( array( "\r\n", "\n"), '\n', $description ); |
|
225 | 225 | |
226 | 226 | return $description; |
227 | 227 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @return EED_Ical |
33 | 33 | */ |
34 | 34 | public static function instance() { |
35 | - return parent::get_instance( __CLASS__ ); |
|
35 | + return parent::get_instance(__CLASS__); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public static function set_hooks() { |
47 | 47 | // create download buttons |
48 | - add_filter( 'FHEE__espresso_list_of_event_dates__datetime_html', array( 'EED_Ical', 'generate_add_to_iCal_button' ), 10, 2 ); |
|
48 | + add_filter('FHEE__espresso_list_of_event_dates__datetime_html', array('EED_Ical', 'generate_add_to_iCal_button'), 10, 2); |
|
49 | 49 | // process ics download request |
50 | - EE_Config::register_route( 'download_ics_file', 'EED_Ical', 'download_ics_file' ); |
|
50 | + EE_Config::register_route('download_ics_file', 'EED_Ical', 'download_ics_file'); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param WP $WP |
71 | 71 | * @return void |
72 | 72 | */ |
73 | - public function run( $WP ) {} |
|
73 | + public function run($WP) {} |
|
74 | 74 | |
75 | 75 | |
76 | 76 | |
@@ -82,30 +82,30 @@ discard block |
||
82 | 82 | * @param $datetime |
83 | 83 | * @return string |
84 | 84 | */ |
85 | - public static function generate_add_to_iCal_button( $html, $datetime ) { |
|
85 | + public static function generate_add_to_iCal_button($html, $datetime) { |
|
86 | 86 | // first verify a proper datetime object has been received |
87 | - if ( $datetime instanceof EE_Datetime ) { |
|
87 | + if ($datetime instanceof EE_Datetime) { |
|
88 | 88 | // set whether a link or submit button is shown |
89 | - $iCal_type = apply_filters( 'FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit' ); |
|
89 | + $iCal_type = apply_filters('FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit'); |
|
90 | 90 | // generate a link to the route we registered in set_hooks() |
91 | - $URL = add_query_arg( array( 'ee' => 'download_ics_file', 'ics_id' => $datetime->ID() ), site_url() ); |
|
91 | + $URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $datetime->ID()), site_url()); |
|
92 | 92 | // what type ? |
93 | - switch ( $iCal_type ) { |
|
93 | + switch ($iCal_type) { |
|
94 | 94 | // submit buttons appear as buttons and are very compatible with a theme's style |
95 | 95 | case 'submit' : |
96 | - $html .= '<form id="download-iCal-frm-' . $datetime->ID() . '" class="download-iCal-frm" action="' . $URL . '" method="post" >'; |
|
97 | - $html .= '<input type="submit" class="ee-ical-sbmt" value="" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '"/>'; |
|
96 | + $html .= '<form id="download-iCal-frm-'.$datetime->ID().'" class="download-iCal-frm" action="'.$URL.'" method="post" >'; |
|
97 | + $html .= '<input type="submit" class="ee-ical-sbmt" value="" title="'.__('Add to iCal Calendar', 'event_espresso').'"/>'; |
|
98 | 98 | $html .= '</form>'; |
99 | 99 | break; |
100 | 100 | // buttons are just links that have been styled to appear as buttons, but may not be blend with a theme as well as submit buttons |
101 | 101 | case 'button' : |
102 | - $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="' . $URL . '" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '">'; |
|
102 | + $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="'.$URL.'" title="'.__('Add to iCal Calendar', 'event_espresso').'">'; |
|
103 | 103 | $html .= ' <span class="dashicons dashicons-calendar"></span>'; |
104 | 104 | $html .= '</a>'; |
105 | 105 | break; |
106 | 106 | // links are just links that use the calendar dashicon |
107 | 107 | case 'icon' : |
108 | - $html .= '<a class="ee-ical-lnk" href="' . $URL . '" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '">'; |
|
108 | + $html .= '<a class="ee-ical-lnk" href="'.$URL.'" title="'.__('Add to iCal Calendar', 'event_espresso').'">'; |
|
109 | 109 | $html .= ' <span class="dashicons dashicons-calendar"></span>'; |
110 | 110 | $html .= '</a>'; |
111 | 111 | break; |
@@ -123,72 +123,72 @@ discard block |
||
123 | 123 | * @return void |
124 | 124 | */ |
125 | 125 | public static function download_ics_file() { |
126 | - if ( EE_Registry::instance()->REQ->is_set( 'ics_id' )) { |
|
127 | - $DTT_ID = absint( EE_Registry::instance()->REQ->get( 'ics_id' )); |
|
128 | - $datetime = EE_Registry::instance()->load_model( 'Datetime' )->get_one_by_ID( $DTT_ID ); |
|
129 | - if ( $datetime instanceof EE_Datetime ) { |
|
126 | + if (EE_Registry::instance()->REQ->is_set('ics_id')) { |
|
127 | + $DTT_ID = absint(EE_Registry::instance()->REQ->get('ics_id')); |
|
128 | + $datetime = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($DTT_ID); |
|
129 | + if ($datetime instanceof EE_Datetime) { |
|
130 | 130 | // get related event, venues, and event categories |
131 | 131 | $event = $datetime->event(); |
132 | 132 | // get related category Term object and it's name |
133 | 133 | $category = $event->first_event_category(); |
134 | - if ( $category instanceof EE_Term ) { |
|
134 | + if ($category instanceof EE_Term) { |
|
135 | 135 | $category = $category->name(); |
136 | 136 | } |
137 | 137 | $location = ''; |
138 | 138 | // get first related venue and convert to CSV string |
139 | - $venue = $event->venues(array( 'limit'=>1 )); |
|
140 | - if ( is_array( $venue ) && ! empty( $venue )) { |
|
141 | - $venue = array_shift( $venue ); |
|
142 | - if ( $venue instanceof EE_Venue ) { |
|
143 | - $location = espresso_venue_raw_address( 'inline', $venue->ID(), FALSE ); |
|
139 | + $venue = $event->venues(array('limit'=>1)); |
|
140 | + if (is_array($venue) && ! empty($venue)) { |
|
141 | + $venue = array_shift($venue); |
|
142 | + if ($venue instanceof EE_Venue) { |
|
143 | + $location = espresso_venue_raw_address('inline', $venue->ID(), FALSE); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | // set variables, escape strings, convert timestamps to ics format, etc |
147 | - $filename = $event->slug() . '-' . $datetime->start_date( 'Y-m-d' ) . '.ics'; |
|
148 | - $organizer = EED_Ical::_escape_ICal_data( EE_Registry::instance()->CFG->organization->name ); |
|
149 | - $UID = EED_Ical::_escape_ICal_data( md5( $event->name() . $event->ID() . $datetime->ID() )); |
|
150 | - $org_email = EED_Ical::_escape_ICal_data( $datetime->ID() ); |
|
151 | - $timestamp = date( EED_Ical::iCal_datetime_format ); |
|
152 | - $location = EED_Ical::_escape_ICal_data( $location ); |
|
153 | - $summary = EED_Ical::_escape_ICal_data( $event->name() ); |
|
154 | - $description = EED_Ical::_escape_ICal_description( wp_strip_all_tags( $event->description() )); |
|
147 | + $filename = $event->slug().'-'.$datetime->start_date('Y-m-d').'.ics'; |
|
148 | + $organizer = EED_Ical::_escape_ICal_data(EE_Registry::instance()->CFG->organization->name); |
|
149 | + $UID = EED_Ical::_escape_ICal_data(md5($event->name().$event->ID().$datetime->ID())); |
|
150 | + $org_email = EED_Ical::_escape_ICal_data($datetime->ID()); |
|
151 | + $timestamp = date(EED_Ical::iCal_datetime_format); |
|
152 | + $location = EED_Ical::_escape_ICal_data($location); |
|
153 | + $summary = EED_Ical::_escape_ICal_data($event->name()); |
|
154 | + $description = EED_Ical::_escape_ICal_description(wp_strip_all_tags($event->description())); |
|
155 | 155 | $status = $datetime->get_active_status(); |
156 | 156 | $status = $status == EE_Datetime::cancelled ? 'Cancelled' : 'Confirmed'; |
157 | - $status = EED_Ical::_escape_ICal_data( $status ); |
|
158 | - $categories = EED_Ical::_escape_ICal_data( $category ); |
|
159 | - $url = EED_Ical::_escape_ICal_data( get_permalink( $event->ID() )); |
|
160 | - $dtt_start = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->start() )); |
|
161 | - $dtt_end = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->end() )); |
|
157 | + $status = EED_Ical::_escape_ICal_data($status); |
|
158 | + $categories = EED_Ical::_escape_ICal_data($category); |
|
159 | + $url = EED_Ical::_escape_ICal_data(get_permalink($event->ID())); |
|
160 | + $dtt_start = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->start())); |
|
161 | + $dtt_end = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->end())); |
|
162 | 162 | // set headers |
163 | - header( 'Content-type: text/calendar; charset=utf-8' ); |
|
164 | - header( 'Content-Disposition: attachment; filename="' . $filename . '"' ); |
|
165 | - header( 'Cache-Control: private, max-age=0, must-revalidate' ); |
|
166 | - header( 'Pragma: public' ); |
|
167 | - header( 'Content-Type: application/octet-stream' ); |
|
168 | - header( 'Content-Type: application/force-download' ); |
|
169 | - header( 'Cache-Control: no-cache, must-revalidate' ); |
|
170 | - header( 'Content-Transfer-Encoding: binary' ); |
|
171 | - header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); // past date |
|
172 | - ini_set( 'zlib.output_compression', '0' ); |
|
163 | + header('Content-type: text/calendar; charset=utf-8'); |
|
164 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
165 | + header('Cache-Control: private, max-age=0, must-revalidate'); |
|
166 | + header('Pragma: public'); |
|
167 | + header('Content-Type: application/octet-stream'); |
|
168 | + header('Content-Type: application/force-download'); |
|
169 | + header('Cache-Control: no-cache, must-revalidate'); |
|
170 | + header('Content-Transfer-Encoding: binary'); |
|
171 | + header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // past date |
|
172 | + ini_set('zlib.output_compression', '0'); |
|
173 | 173 | // echo the output |
174 | - echo "BEGIN:VCALENDAR" . PHP_EOL; |
|
175 | - echo "VERSION:2.0" . PHP_EOL; |
|
176 | - echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN" . PHP_EOL; |
|
177 | - echo "CALSCALE:GREGORIAN" . PHP_EOL; |
|
178 | - echo "BEGIN:VEVENT" . PHP_EOL; |
|
179 | - echo "UID:{$UID}" . PHP_EOL; |
|
180 | - echo "ORGANIZER:MAILTO:{$org_email}" . PHP_EOL; |
|
181 | - echo "DTSTAMP:{$timestamp}" . PHP_EOL; |
|
182 | - echo "LOCATION:{$location}" . PHP_EOL; |
|
183 | - echo "SUMMARY:{$summary}" . PHP_EOL; |
|
184 | - echo "DESCRIPTION:{$description}" . PHP_EOL; |
|
185 | - echo "STATUS:{$status}" . PHP_EOL; |
|
186 | - echo "CATEGORIES:{$categories}" . PHP_EOL; |
|
187 | - echo "URL;VALUE=URI:{$url}" . PHP_EOL; |
|
188 | - echo "DTSTART:{$dtt_start}" . PHP_EOL; |
|
189 | - echo "DTEND:{$dtt_end}" . PHP_EOL; |
|
190 | - echo "END:VEVENT" . PHP_EOL; |
|
191 | - echo "END:VCALENDAR" . PHP_EOL; |
|
174 | + echo "BEGIN:VCALENDAR".PHP_EOL; |
|
175 | + echo "VERSION:2.0".PHP_EOL; |
|
176 | + echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN".PHP_EOL; |
|
177 | + echo "CALSCALE:GREGORIAN".PHP_EOL; |
|
178 | + echo "BEGIN:VEVENT".PHP_EOL; |
|
179 | + echo "UID:{$UID}".PHP_EOL; |
|
180 | + echo "ORGANIZER:MAILTO:{$org_email}".PHP_EOL; |
|
181 | + echo "DTSTAMP:{$timestamp}".PHP_EOL; |
|
182 | + echo "LOCATION:{$location}".PHP_EOL; |
|
183 | + echo "SUMMARY:{$summary}".PHP_EOL; |
|
184 | + echo "DESCRIPTION:{$description}".PHP_EOL; |
|
185 | + echo "STATUS:{$status}".PHP_EOL; |
|
186 | + echo "CATEGORIES:{$categories}".PHP_EOL; |
|
187 | + echo "URL;VALUE=URI:{$url}".PHP_EOL; |
|
188 | + echo "DTSTART:{$dtt_start}".PHP_EOL; |
|
189 | + echo "DTEND:{$dtt_end}".PHP_EOL; |
|
190 | + echo "END:VEVENT".PHP_EOL; |
|
191 | + echo "END:VCALENDAR".PHP_EOL; |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | die(); |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | * @param string $string |
204 | 204 | * @return string |
205 | 205 | */ |
206 | - private static function _escape_ICal_data( $string = '' ) { |
|
207 | - return preg_replace( '/([\,;])/', '\\\$1', $string ); |
|
206 | + private static function _escape_ICal_data($string = '') { |
|
207 | + return preg_replace('/([\,;])/', '\\\$1', $string); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -214,13 +214,13 @@ discard block |
||
214 | 214 | * @param string $description |
215 | 215 | * @return string |
216 | 216 | */ |
217 | - private static function _escape_ICal_description( $description = '' ) { |
|
217 | + private static function _escape_ICal_description($description = '') { |
|
218 | 218 | |
219 | 219 | //Escape spcial chars within the decription |
220 | - $description = EED_Ical::_escape_ICal_data( $description ); |
|
220 | + $description = EED_Ical::_escape_ICal_data($description); |
|
221 | 221 | |
222 | 222 | //Remove line breaks and output in iCal format |
223 | - $description = str_replace( array( "\r\n", "\n"), '\n', $description ); |
|
223 | + $description = str_replace(array("\r\n", "\n"), '\n', $description); |
|
224 | 224 | |
225 | 225 | return $description; |
226 | 226 | } |
@@ -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 | * Event Espresso |
4 | 6 | * |