@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @access public |
99 | 99 | * @param string $title |
100 | - * @return void |
|
100 | + * @return string |
|
101 | 101 | */ |
102 | 102 | public function the_title( $title = '', $id = '' ) { |
103 | 103 | return $title; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @access public |
139 | 139 | * @param string $content |
140 | - * @return void |
|
140 | + * @return string |
|
141 | 141 | */ |
142 | 142 | public function venue_location( $content ) { |
143 | 143 | return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return EED_Venues_Archive |
28 | 28 | */ |
29 | 29 | public static function instance() { |
30 | - return parent::get_instance( __CLASS__ ); |
|
30 | + return parent::get_instance(__CLASS__); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | public static function set_hooks() { |
40 | - EE_Config::register_route( 'venues', 'Venues_Archive', 'run' ); |
|
40 | + EE_Config::register_route('venues', 'Venues_Archive', 'run'); |
|
41 | 41 | // EE_Config::register_view( 'venues', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_venues.php' ); |
42 | 42 | } |
43 | 43 | |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | * @access public |
59 | 59 | * @return void |
60 | 60 | */ |
61 | - public function run( $WP ) { |
|
61 | + public function run($WP) { |
|
62 | 62 | // check what template is loaded |
63 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
64 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
63 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
64 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -72,20 +72,20 @@ discard block |
||
72 | 72 | * @access public |
73 | 73 | * @return void |
74 | 74 | */ |
75 | - public function template_include( $template ) { |
|
75 | + public function template_include($template) { |
|
76 | 76 | // not a custom template? |
77 | - if ( EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_venues.php' ) { |
|
77 | + if (EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_venues.php') { |
|
78 | 78 | EEH_Template::load_espresso_theme_functions(); |
79 | 79 | // then add extra event data via hooks |
80 | - add_filter( 'the_title', array( $this, 'the_title' ), 100, 2 ); |
|
80 | + add_filter('the_title', array($this, 'the_title'), 100, 2); |
|
81 | 81 | // don't know if theme uses the_excerpt |
82 | - add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
83 | - add_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 ); |
|
82 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
83 | + add_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
84 | 84 | // or the_content |
85 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
86 | - add_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
85 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
86 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
87 | 87 | // don't diplay entry meta because the existing theme will take car of that |
88 | - add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' ); |
|
88 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
89 | 89 | } |
90 | 90 | return $template; |
91 | 91 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param string $title |
100 | 100 | * @return void |
101 | 101 | */ |
102 | - public function the_title( $title = '', $id = '' ) { |
|
102 | + public function the_title($title = '', $id = '') { |
|
103 | 103 | return $title; |
104 | 104 | // global $post; |
105 | 105 | // return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
@@ -113,21 +113,21 @@ discard block |
||
113 | 113 | * @param string $content |
114 | 114 | * @return void |
115 | 115 | */ |
116 | - public function venue_details( $content ) { |
|
116 | + public function venue_details($content) { |
|
117 | 117 | global $post; |
118 | 118 | // since the 'content-espresso_venues-details.php' template might be used directly from within a theme, |
119 | 119 | // it uses the_content() for displaying the $post->post_content |
120 | 120 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
121 | 121 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
122 | - remove_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
123 | - remove_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
122 | + remove_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
123 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
124 | 124 | // now load our template |
125 | - $template = EEH_Template::locate_template( 'content-espresso_venues-details.php' ); |
|
125 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
126 | 126 | //now add our filter back in, plus some others |
127 | - add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
128 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
127 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
128 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
129 | 129 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
130 | - return ! empty( $template ) ? $template : $content; |
|
130 | + return ! empty($template) ? $template : $content; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | * @param string $content |
140 | 140 | * @return void |
141 | 141 | */ |
142 | - public function venue_location( $content ) { |
|
143 | - return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
|
142 | + public function venue_location($content) { |
|
143 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | |
@@ -154,19 +154,19 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function wp_enqueue_scripts() { |
156 | 156 | // get some style |
157 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_archive() ) { |
|
157 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_archive()) { |
|
158 | 158 | // first check theme folder |
159 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
160 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
161 | - } else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) { |
|
162 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
159 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
160 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
161 | + } else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) { |
|
162 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
163 | 163 | } |
164 | 164 | // if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'archive-espresso_venues.js' )) { |
165 | 165 | // wp_register_script( 'archive-espresso_venues', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'archive-espresso_venues.js', array('espresso_core'), '1.0', TRUE ); |
166 | 166 | // } else if ( is_readable( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_venues.js' )) { |
167 | 167 | // wp_register_script( 'archive-espresso_venues', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'archive-espresso_venues.js', array('espresso_core'), '1.0', TRUE ); |
168 | 168 | // } |
169 | - wp_enqueue_style( $this->theme ); |
|
169 | + wp_enqueue_style($this->theme); |
|
170 | 170 | // wp_enqueue_script( 'archive-espresso_venues' ); |
171 | 171 | |
172 | 172 | } |
@@ -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 | * |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * can_use_espresso_conditionals |
148 | 148 | * tests whether the Espresso Conditional tags like is_espresso_event_single() can be called |
149 | 149 | * |
150 | - * @param $conditional_tag |
|
150 | + * @param string $conditional_tag |
|
151 | 151 | * @return bool |
152 | 152 | */ |
153 | 153 | function can_use_espresso_conditionals( $conditional_tag ) { |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | /** |
876 | 876 | * espresso_event_venues |
877 | 877 | * |
878 | - * @return array all venues related to an event |
|
878 | + * @return EE_Venue[] all venues related to an event |
|
879 | 879 | */ |
880 | 880 | function espresso_event_venues() { |
881 | 881 | EE_Registry::instance()->load_helper( 'Venue_View' ); |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | * |
911 | 911 | * @param int $VNU_ID optional, the venue id to check. |
912 | 912 | * |
913 | - * @return bool | null |
|
913 | + * @return null|boolean | null |
|
914 | 914 | */ |
915 | 915 | function espresso_is_venue_private( $VNU_ID = 0 ) { |
916 | 916 | EE_Registry::instance()->load_helper( 'Venue_View' ); |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | * @param int | \EE_Event $event |
28 | 28 | * @return bool |
29 | 29 | */ |
30 | -function is_espresso_event( $event = NULL ) { |
|
31 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
30 | +function is_espresso_event($event = NULL) { |
|
31 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
32 | 32 | // load event view helper |
33 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
33 | + EE_Registry::instance()->load_helper('Event_View'); |
|
34 | 34 | // extract EE_Event object from passed param regardless of what it is (within reason of course) |
35 | - $event = EEH_Event_View::get_event( $event ); |
|
35 | + $event = EEH_Event_View::get_event($event); |
|
36 | 36 | // do we have a valid event ? |
37 | - return $event instanceof EE_Event ? TRUE : FALSE; |
|
37 | + return $event instanceof EE_Event ? TRUE : FALSE; |
|
38 | 38 | } |
39 | 39 | return FALSE; |
40 | 40 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @return bool |
47 | 47 | */ |
48 | 48 | function is_espresso_event_single() { |
49 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
49 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
50 | 50 | global $wp_query; |
51 | 51 | // return conditionals set by CPTs |
52 | 52 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : FALSE; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @return bool |
62 | 62 | */ |
63 | 63 | function is_espresso_event_archive() { |
64 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
64 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
65 | 65 | global $wp_query; |
66 | 66 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : FALSE; |
67 | 67 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @return bool |
76 | 76 | */ |
77 | 77 | function is_espresso_event_taxonomy() { |
78 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
78 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
79 | 79 | global $wp_query; |
80 | 80 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : FALSE; |
81 | 81 | } |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | * @param int | \EE_Venue $venue |
90 | 90 | * @return bool |
91 | 91 | */ |
92 | -function is_espresso_venue( $venue = NULL ) { |
|
93 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
92 | +function is_espresso_venue($venue = NULL) { |
|
93 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
94 | 94 | // load event view helper |
95 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
95 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
96 | 96 | // extract EE_Venue object from passed param regardless of what it is (within reason of course) |
97 | - $venue = EEH_Venue_View::get_venue( $venue, FALSE ); |
|
97 | + $venue = EEH_Venue_View::get_venue($venue, FALSE); |
|
98 | 98 | // do we have a valid event ? |
99 | 99 | return $venue instanceof EE_Venue ? TRUE : FALSE; |
100 | 100 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @return bool |
109 | 109 | */ |
110 | 110 | function is_espresso_venue_single() { |
111 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
111 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
112 | 112 | global $wp_query; |
113 | 113 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : FALSE; |
114 | 114 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @return bool |
123 | 123 | */ |
124 | 124 | function is_espresso_venue_archive() { |
125 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
125 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
126 | 126 | global $wp_query; |
127 | 127 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : FALSE; |
128 | 128 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @return bool |
137 | 137 | */ |
138 | 138 | function is_espresso_venue_taxonomy() { |
139 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
139 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
140 | 140 | global $wp_query; |
141 | 141 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : FALSE; |
142 | 142 | } |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | * @param $conditional_tag |
151 | 151 | * @return bool |
152 | 152 | */ |
153 | -function can_use_espresso_conditionals( $conditional_tag ) { |
|
154 | - if ( ! did_action( 'AHEE__EE_System__initialize' )) { |
|
153 | +function can_use_espresso_conditionals($conditional_tag) { |
|
154 | + if ( ! did_action('AHEE__EE_System__initialize')) { |
|
155 | 155 | EE_Error::doing_it_wrong( |
156 | 156 | __FUNCTION__, |
157 | 157 | sprintf( |
158 | - __( 'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.','event_espresso'), |
|
158 | + __('The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.', 'event_espresso'), |
|
159 | 159 | $conditional_tag |
160 | 160 | ), |
161 | 161 | '4.4.0' |
@@ -170,13 +170,13 @@ discard block |
||
170 | 170 | |
171 | 171 | /*************************** Event Queries ***************************/ |
172 | 172 | |
173 | -if ( ! function_exists( 'espresso_get_events' )) { |
|
173 | +if ( ! function_exists('espresso_get_events')) { |
|
174 | 174 | /** |
175 | 175 | * espresso_get_events |
176 | 176 | * @param array $params |
177 | 177 | * @return array |
178 | 178 | */ |
179 | - function espresso_get_events( $params = array() ) { |
|
179 | + function espresso_get_events($params = array()) { |
|
180 | 180 | //set default params |
181 | 181 | $default_espresso_events_params = array( |
182 | 182 | 'limit' => 10, |
@@ -187,18 +187,18 @@ discard block |
||
187 | 187 | 'sort' => 'ASC' |
188 | 188 | ); |
189 | 189 | // allow the defaults to be filtered |
190 | - $default_espresso_events_params = apply_filters( 'espresso_get_events__default_espresso_events_params', $default_espresso_events_params ); |
|
190 | + $default_espresso_events_params = apply_filters('espresso_get_events__default_espresso_events_params', $default_espresso_events_params); |
|
191 | 191 | // grab params and merge with defaults, then extract |
192 | - $params = array_merge( $default_espresso_events_params, $params ); |
|
192 | + $params = array_merge($default_espresso_events_params, $params); |
|
193 | 193 | // run the query |
194 | - $events_query = new EE_Event_List_Query( $params ); |
|
194 | + $events_query = new EE_Event_List_Query($params); |
|
195 | 195 | // assign results to a variable so we can return it |
196 | 196 | $events = $events_query->have_posts() ? $events_query->posts : array(); |
197 | 197 | // but first reset the query and postdata |
198 | 198 | wp_reset_query(); |
199 | 199 | wp_reset_postdata(); |
200 | 200 | EED_Events_Archive::remove_all_events_archive_filters(); |
201 | - unset( $events_query ); |
|
201 | + unset($events_query); |
|
202 | 202 | return $events; |
203 | 203 | } |
204 | 204 | } |
@@ -212,32 +212,32 @@ discard block |
||
212 | 212 | * espresso_load_ticket_selector |
213 | 213 | */ |
214 | 214 | function espresso_load_ticket_selector() { |
215 | - EE_Registry::instance()->load_file( EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module' ); |
|
215 | + EE_Registry::instance()->load_file(EE_MODULES.'ticket_selector', 'EED_Ticket_Selector', 'module'); |
|
216 | 216 | } |
217 | 217 | |
218 | -if ( ! function_exists( 'espresso_ticket_selector' )) { |
|
218 | +if ( ! function_exists('espresso_ticket_selector')) { |
|
219 | 219 | /** |
220 | 220 | * espresso_ticket_selector |
221 | 221 | * @param null $event |
222 | 222 | */ |
223 | - function espresso_ticket_selector( $event = NULL ) { |
|
224 | - if ( ! apply_filters( 'FHEE_disable_espresso_ticket_selector', FALSE ) ) { |
|
223 | + function espresso_ticket_selector($event = NULL) { |
|
224 | + if ( ! apply_filters('FHEE_disable_espresso_ticket_selector', FALSE)) { |
|
225 | 225 | espresso_load_ticket_selector(); |
226 | - echo EED_Ticket_Selector::display_ticket_selector( $event ); |
|
226 | + echo EED_Ticket_Selector::display_ticket_selector($event); |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
231 | 231 | |
232 | - if ( ! function_exists( 'espresso_view_details_btn' )) { |
|
232 | + if ( ! function_exists('espresso_view_details_btn')) { |
|
233 | 233 | /** |
234 | 234 | * espresso_view_details_btn |
235 | 235 | * @param null $event |
236 | 236 | */ |
237 | - function espresso_view_details_btn( $event = NULL ) { |
|
238 | - if ( ! apply_filters( 'FHEE_disable_espresso_view_details_btn', FALSE ) ) { |
|
237 | + function espresso_view_details_btn($event = NULL) { |
|
238 | + if ( ! apply_filters('FHEE_disable_espresso_view_details_btn', FALSE)) { |
|
239 | 239 | espresso_load_ticket_selector(); |
240 | - echo EED_Ticket_Selector::display_ticket_selector( $event, TRUE ); |
|
240 | + echo EED_Ticket_Selector::display_ticket_selector($event, TRUE); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | /*************************** EEH_Event_View ***************************/ |
249 | 249 | |
250 | -if ( ! function_exists( 'espresso_load_event_list_assets' )) { |
|
250 | +if ( ! function_exists('espresso_load_event_list_assets')) { |
|
251 | 251 | /** |
252 | 252 | * espresso_load_event_list_assets |
253 | 253 | * ensures that event list styles and scripts are loaded |
@@ -256,13 +256,13 @@ discard block |
||
256 | 256 | */ |
257 | 257 | function espresso_load_event_list_assets() { |
258 | 258 | $event_list = EED_Events_Archive::instance(); |
259 | - add_action( 'AHEE__EE_System__initialize_last', array( $event_list, 'load_event_list_assets' ), 10 ); |
|
260 | - add_filter( 'FHEE_enable_default_espresso_css', '__return_true' ); |
|
259 | + add_action('AHEE__EE_System__initialize_last', array($event_list, 'load_event_list_assets'), 10); |
|
260 | + add_filter('FHEE_enable_default_espresso_css', '__return_true'); |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
264 | 264 | |
265 | -if ( ! function_exists( 'espresso_event_reg_button' )) { |
|
265 | +if ( ! function_exists('espresso_event_reg_button')) { |
|
266 | 266 | /** |
267 | 267 | * espresso_event_reg_button |
268 | 268 | * returns the "Register Now" button if event is active, |
@@ -274,10 +274,10 @@ discard block |
||
274 | 274 | * @param bool $EVT_ID |
275 | 275 | * @return string |
276 | 276 | */ |
277 | - function espresso_event_reg_button( $btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE ) { |
|
278 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
279 | - $event_status = EEH_Event_View::event_active_status( $EVT_ID ); |
|
280 | - switch ( $event_status ) { |
|
277 | + function espresso_event_reg_button($btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE) { |
|
278 | + EE_Registry::instance()->load_helper('Event_View'); |
|
279 | + $event_status = EEH_Event_View::event_active_status($EVT_ID); |
|
280 | + switch ($event_status) { |
|
281 | 281 | case EE_Datetime::sold_out : |
282 | 282 | $btn_text = __('Sold Out', 'event_espresso'); |
283 | 283 | $class = 'ee-pink'; |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | case EE_Datetime::upcoming : |
294 | 294 | case EE_Datetime::active : |
295 | 295 | default : |
296 | - $btn_text =! empty( $btn_text_if_active ) ? $btn_text_if_active : __( 'Register Now', 'event_espresso' ); |
|
296 | + $btn_text = ! empty($btn_text_if_active) ? $btn_text_if_active : __('Register Now', 'event_espresso'); |
|
297 | 297 | $class = 'ee-green'; |
298 | 298 | } |
299 | - if ( $event_status < 1 && ! empty( $btn_text_if_inactive )) { |
|
299 | + if ($event_status < 1 && ! empty($btn_text_if_inactive)) { |
|
300 | 300 | $btn_text = $btn_text_if_inactive; |
301 | 301 | $class = 'ee-grey'; |
302 | 302 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | |
311 | 311 | |
312 | 312 | |
313 | -if ( ! function_exists( 'espresso_display_ticket_selector' )) { |
|
313 | +if ( ! function_exists('espresso_display_ticket_selector')) { |
|
314 | 314 | /** |
315 | 315 | * espresso_display_ticket_selector |
316 | 316 | * whether or not to display the Ticket Selector for an event |
@@ -318,15 +318,15 @@ discard block |
||
318 | 318 | * @param bool $EVT_ID |
319 | 319 | * @return boolean |
320 | 320 | */ |
321 | - function espresso_display_ticket_selector( $EVT_ID = FALSE ) { |
|
322 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
323 | - return EEH_Event_View::display_ticket_selector( $EVT_ID ); |
|
321 | + function espresso_display_ticket_selector($EVT_ID = FALSE) { |
|
322 | + EE_Registry::instance()->load_helper('Event_View'); |
|
323 | + return EEH_Event_View::display_ticket_selector($EVT_ID); |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
327 | 327 | |
328 | 328 | |
329 | -if ( ! function_exists( 'espresso_event_status_banner' )) { |
|
329 | +if ( ! function_exists('espresso_event_status_banner')) { |
|
330 | 330 | /** |
331 | 331 | * espresso_event_status |
332 | 332 | * returns a banner showing the event status if it is sold out, expired, or inactive |
@@ -334,14 +334,14 @@ discard block |
||
334 | 334 | * @param bool $EVT_ID |
335 | 335 | * @return string |
336 | 336 | */ |
337 | - function espresso_event_status_banner( $EVT_ID = FALSE ) { |
|
338 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
339 | - return EEH_Event_View::event_status( $EVT_ID ); |
|
337 | + function espresso_event_status_banner($EVT_ID = FALSE) { |
|
338 | + EE_Registry::instance()->load_helper('Event_View'); |
|
339 | + return EEH_Event_View::event_status($EVT_ID); |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | |
343 | 343 | |
344 | -if ( ! function_exists( 'espresso_event_status' )) { |
|
344 | +if ( ! function_exists('espresso_event_status')) { |
|
345 | 345 | /** |
346 | 346 | * espresso_event_status |
347 | 347 | * returns the event status if it is sold out, expired, or inactive |
@@ -350,18 +350,18 @@ discard block |
||
350 | 350 | * @param bool $echo |
351 | 351 | * @return string |
352 | 352 | */ |
353 | - function espresso_event_status( $EVT_ID = 0, $echo = TRUE ) { |
|
354 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
355 | - if ( $echo ) { |
|
356 | - echo EEH_Event_View::event_active_status( $EVT_ID ); |
|
353 | + function espresso_event_status($EVT_ID = 0, $echo = TRUE) { |
|
354 | + EE_Registry::instance()->load_helper('Event_View'); |
|
355 | + if ($echo) { |
|
356 | + echo EEH_Event_View::event_active_status($EVT_ID); |
|
357 | 357 | return ''; |
358 | 358 | } |
359 | - return EEH_Event_View::event_active_status( $EVT_ID ); |
|
359 | + return EEH_Event_View::event_active_status($EVT_ID); |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | |
363 | 363 | |
364 | -if ( ! function_exists( 'espresso_event_categories' )) { |
|
364 | +if ( ! function_exists('espresso_event_categories')) { |
|
365 | 365 | /** |
366 | 366 | * espresso_event_categories |
367 | 367 | * returns the terms associated with an event |
@@ -371,18 +371,18 @@ discard block |
||
371 | 371 | * @param bool $echo |
372 | 372 | * @return string |
373 | 373 | */ |
374 | - function espresso_event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) { |
|
375 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
376 | - if ( $echo ) { |
|
377 | - echo EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized ); |
|
374 | + function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) { |
|
375 | + EE_Registry::instance()->load_helper('Event_View'); |
|
376 | + if ($echo) { |
|
377 | + echo EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
378 | 378 | return ''; |
379 | 379 | } |
380 | - return EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized ); |
|
380 | + return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
381 | 381 | } |
382 | 382 | } |
383 | 383 | |
384 | 384 | |
385 | -if ( ! function_exists( 'espresso_event_tickets_available' )) { |
|
385 | +if ( ! function_exists('espresso_event_tickets_available')) { |
|
386 | 386 | /** |
387 | 387 | * espresso_event_tickets_available |
388 | 388 | * returns the ticket types available for purchase for an event |
@@ -392,27 +392,27 @@ discard block |
||
392 | 392 | * @param bool $format |
393 | 393 | * @return string |
394 | 394 | */ |
395 | - function espresso_event_tickets_available( $EVT_ID = 0, $echo = TRUE, $format = TRUE ) { |
|
396 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
397 | - $tickets = EEH_Event_View::event_tickets_available( $EVT_ID ); |
|
398 | - if ( is_array( $tickets ) && ! empty( $tickets )) { |
|
395 | + function espresso_event_tickets_available($EVT_ID = 0, $echo = TRUE, $format = TRUE) { |
|
396 | + EE_Registry::instance()->load_helper('Event_View'); |
|
397 | + $tickets = EEH_Event_View::event_tickets_available($EVT_ID); |
|
398 | + if (is_array($tickets) && ! empty($tickets)) { |
|
399 | 399 | // if formatting then $html will be a string, else it will be an array of ticket objects |
400 | - $html = $format ? '<ul id="ee-event-tickets-ul-' . $EVT_ID . '" class="ee-event-tickets-ul">' : array(); |
|
401 | - foreach ( $tickets as $ticket ) { |
|
402 | - if ( $ticket instanceof EE_Ticket ) { |
|
403 | - if ( $format ) { |
|
404 | - $html .= '<li id="ee-event-tickets-li-' . $ticket->ID() . '" class="ee-event-tickets-li">'; |
|
405 | - $html .= $ticket->name() . ' ' . EEH_Template::format_currency( $ticket->get_ticket_total_with_taxes() ); |
|
400 | + $html = $format ? '<ul id="ee-event-tickets-ul-'.$EVT_ID.'" class="ee-event-tickets-ul">' : array(); |
|
401 | + foreach ($tickets as $ticket) { |
|
402 | + if ($ticket instanceof EE_Ticket) { |
|
403 | + if ($format) { |
|
404 | + $html .= '<li id="ee-event-tickets-li-'.$ticket->ID().'" class="ee-event-tickets-li">'; |
|
405 | + $html .= $ticket->name().' '.EEH_Template::format_currency($ticket->get_ticket_total_with_taxes()); |
|
406 | 406 | $html .= '</li>'; |
407 | 407 | } else { |
408 | 408 | $html[] = $ticket; |
409 | 409 | } |
410 | 410 | } |
411 | 411 | } |
412 | - if ( $format ) { |
|
412 | + if ($format) { |
|
413 | 413 | $html .= '</ul>'; |
414 | 414 | } |
415 | - if ( $echo && ! $format ) { |
|
415 | + if ($echo && ! $format) { |
|
416 | 416 | echo $html; |
417 | 417 | return ''; |
418 | 418 | } |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | } |
423 | 423 | } |
424 | 424 | |
425 | -if ( ! function_exists( 'espresso_event_date_obj' )) { |
|
425 | +if ( ! function_exists('espresso_event_date_obj')) { |
|
426 | 426 | /** |
427 | 427 | * espresso_event_date_obj |
428 | 428 | * returns the primary date object for an event |
@@ -430,14 +430,14 @@ discard block |
||
430 | 430 | * @param bool $EVT_ID |
431 | 431 | * @return object |
432 | 432 | */ |
433 | - function espresso_event_date_obj( $EVT_ID = FALSE ) { |
|
434 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
435 | - return EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
433 | + function espresso_event_date_obj($EVT_ID = FALSE) { |
|
434 | + EE_Registry::instance()->load_helper('Event_View'); |
|
435 | + return EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
436 | 436 | } |
437 | 437 | } |
438 | 438 | |
439 | 439 | |
440 | -if ( ! function_exists( 'espresso_event_date' )) { |
|
440 | +if ( ! function_exists('espresso_event_date')) { |
|
441 | 441 | /** |
442 | 442 | * espresso_event_date |
443 | 443 | * returns the primary date for an event |
@@ -448,23 +448,23 @@ discard block |
||
448 | 448 | * @param bool $echo |
449 | 449 | * @return string |
450 | 450 | */ |
451 | - function espresso_event_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
452 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
453 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
454 | - $date_format = apply_filters( 'FHEE__espresso_event_date__date_format', $date_format ); |
|
455 | - $time_format = apply_filters( 'FHEE__espresso_event_date__time_format', $time_format ); |
|
456 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
457 | - if($echo){ |
|
458 | - echo date_i18n( $date_format . ' ' . $time_format, strtotime( EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID ))); |
|
451 | + function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
452 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
453 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
454 | + $date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format); |
|
455 | + $time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format); |
|
456 | + EE_Registry::instance()->load_helper('Event_View'); |
|
457 | + if ($echo) { |
|
458 | + echo date_i18n($date_format.' '.$time_format, strtotime(EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID))); |
|
459 | 459 | return ''; |
460 | 460 | } |
461 | - return date_i18n( $date_format . ' ' . $time_format, strtotime( EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID ))); |
|
461 | + return date_i18n($date_format.' '.$time_format, strtotime(EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID))); |
|
462 | 462 | |
463 | 463 | } |
464 | 464 | } |
465 | 465 | |
466 | 466 | |
467 | -if ( ! function_exists( 'espresso_list_of_event_dates' )) { |
|
467 | +if ( ! function_exists('espresso_list_of_event_dates')) { |
|
468 | 468 | /** |
469 | 469 | * espresso_list_of_event_dates |
470 | 470 | * returns a unordered list of dates for an event |
@@ -479,40 +479,40 @@ discard block |
||
479 | 479 | * @param null $limit |
480 | 480 | * @return string |
481 | 481 | */ |
482 | - function espresso_list_of_event_dates( $EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL ) { |
|
483 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
484 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
485 | - $date_format = apply_filters( 'FHEE__espresso_list_of_event_dates__date_format', $date_format ); |
|
486 | - $time_format = apply_filters( 'FHEE__espresso_list_of_event_dates__time_format', $time_format ); |
|
487 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
488 | - $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, $show_expired, FALSE, $limit ); |
|
489 | - if ( ! $format ) { |
|
490 | - return apply_filters( 'FHEE__espresso_list_of_event_dates__datetimes', $datetimes ); |
|
482 | + function espresso_list_of_event_dates($EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL) { |
|
483 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
484 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
485 | + $date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format); |
|
486 | + $time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format); |
|
487 | + EE_Registry::instance()->load_helper('Event_View'); |
|
488 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, FALSE, $limit); |
|
489 | + if ( ! $format) { |
|
490 | + return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes); |
|
491 | 491 | } |
492 | 492 | //d( $datetimes ); |
493 | - if ( is_array( $datetimes ) && ! empty( $datetimes )) { |
|
493 | + if (is_array($datetimes) && ! empty($datetimes)) { |
|
494 | 494 | global $post; |
495 | - $html = $format ? '<ul id="ee-event-datetimes-ul-' . $post->ID . '" class="ee-event-datetimes-ul">' : ''; |
|
496 | - foreach ( $datetimes as $datetime ) { |
|
497 | - if ( $datetime instanceof EE_Datetime ) { |
|
498 | - $html .= '<li id="ee-event-datetimes-li-' . $datetime->ID() . '" class="ee-event-datetimes-li">'; |
|
495 | + $html = $format ? '<ul id="ee-event-datetimes-ul-'.$post->ID.'" class="ee-event-datetimes-ul">' : ''; |
|
496 | + foreach ($datetimes as $datetime) { |
|
497 | + if ($datetime instanceof EE_Datetime) { |
|
498 | + $html .= '<li id="ee-event-datetimes-li-'.$datetime->ID().'" class="ee-event-datetimes-li">'; |
|
499 | 499 | $datetime_name = $datetime->name(); |
500 | - $html .= ! empty( $datetime_name ) ? '<strong>' . $datetime_name . '</strong>' : ''; |
|
501 | - $html .= ! empty( $datetime_name ) && $add_breaks ? '<br />' : ''; |
|
502 | - $html .= '<span class="dashicons dashicons-calendar"></span>' . $datetime->date_range( $date_format ) . '<br/>'; |
|
503 | - $html .= '<span class="dashicons dashicons-clock"></span>' . $datetime->time_range( $time_format ); |
|
500 | + $html .= ! empty($datetime_name) ? '<strong>'.$datetime_name.'</strong>' : ''; |
|
501 | + $html .= ! empty($datetime_name) && $add_breaks ? '<br />' : ''; |
|
502 | + $html .= '<span class="dashicons dashicons-calendar"></span>'.$datetime->date_range($date_format).'<br/>'; |
|
503 | + $html .= '<span class="dashicons dashicons-clock"></span>'.$datetime->time_range($time_format); |
|
504 | 504 | $datetime_description = $datetime->description(); |
505 | - $html .= ! empty( $datetime_description ) && $add_breaks ? '<br />' : ''; |
|
506 | - $html .= ! empty( $datetime_description ) ? ' - ' . $datetime_description : ''; |
|
507 | - $html = apply_filters( 'FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime ); |
|
505 | + $html .= ! empty($datetime_description) && $add_breaks ? '<br />' : ''; |
|
506 | + $html .= ! empty($datetime_description) ? ' - '.$datetime_description : ''; |
|
507 | + $html = apply_filters('FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime); |
|
508 | 508 | $html .= '</li>'; |
509 | 509 | } |
510 | 510 | } |
511 | 511 | $html .= $format ? '</ul>' : ''; |
512 | 512 | } else { |
513 | - $html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>' . __( 'There are no upcoming dates for this event.', 'event_espresso' ) . '</p><br/>' : ''; |
|
513 | + $html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>'.__('There are no upcoming dates for this event.', 'event_espresso').'</p><br/>' : ''; |
|
514 | 514 | } |
515 | - if ( $echo ) { |
|
515 | + if ($echo) { |
|
516 | 516 | echo $html; |
517 | 517 | return ''; |
518 | 518 | } |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | } |
522 | 522 | |
523 | 523 | |
524 | -if ( ! function_exists( 'espresso_event_end_date' )) { |
|
524 | +if ( ! function_exists('espresso_event_end_date')) { |
|
525 | 525 | /** |
526 | 526 | * espresso_event_end_date |
527 | 527 | * returns the last date for an event |
@@ -532,21 +532,21 @@ discard block |
||
532 | 532 | * @param bool $echo |
533 | 533 | * @return string |
534 | 534 | */ |
535 | - function espresso_event_end_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
536 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
537 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
538 | - $date_format = apply_filters( 'FHEE__espresso_event_end_date__date_format', $date_format ); |
|
539 | - $time_format = apply_filters( 'FHEE__espresso_event_end_date__time_format', $time_format ); |
|
540 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
541 | - if($echo){ |
|
542 | - echo date_i18n( $date_format . ' ' . $time_format, strtotime( EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID ))); |
|
535 | + function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
536 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
537 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
538 | + $date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format); |
|
539 | + $time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format); |
|
540 | + EE_Registry::instance()->load_helper('Event_View'); |
|
541 | + if ($echo) { |
|
542 | + echo date_i18n($date_format.' '.$time_format, strtotime(EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID))); |
|
543 | 543 | return ''; |
544 | 544 | } |
545 | - return date_i18n( $date_format . ' ' . $time_format, strtotime( EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID ))); |
|
545 | + return date_i18n($date_format.' '.$time_format, strtotime(EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID))); |
|
546 | 546 | } |
547 | 547 | } |
548 | 548 | |
549 | -if ( ! function_exists( 'espresso_event_date_range' )) { |
|
549 | +if ( ! function_exists('espresso_event_date_range')) { |
|
550 | 550 | /** |
551 | 551 | * espresso_event_date_range |
552 | 552 | * returns the first and last chronologically ordered dates for an event (if different) |
@@ -558,22 +558,22 @@ discard block |
||
558 | 558 | * @param bool $EVT_ID |
559 | 559 | * @return string |
560 | 560 | */ |
561 | - function espresso_event_date_range( $date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE ) { |
|
561 | + function espresso_event_date_range($date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE) { |
|
562 | 562 | // set and filter date and time formats when a range is returned |
563 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
564 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
565 | - $date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', $date_format ); |
|
566 | - $time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', $time_format ); |
|
563 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
564 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
565 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format); |
|
566 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format); |
|
567 | 567 | // set and filter date and time formats when only a single datetime is returned |
568 | - $single_date_format = ! empty( $single_date_format ) ? $single_date_format : get_option( 'date_format' ); |
|
569 | - $single_time_format = ! empty( $single_time_format ) ? $single_time_format : get_option( 'time_format' ); |
|
570 | - $single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', $single_date_format ); |
|
571 | - $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', $single_time_format ); |
|
572 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
573 | - $the_event_date = date_i18n( $date_format . ' ' . $time_format, strtotime( EEH_Event_View::the_earliest_event_date( $date_format, $time_format, $EVT_ID ))); |
|
574 | - $the_event_end_date = date_i18n( $date_format . ' ' . $time_format, strtotime( EEH_Event_View::the_latest_event_date( $date_format, $time_format, $EVT_ID ))); |
|
575 | - if ( $the_event_date != $the_event_end_date ) { |
|
576 | - echo $the_event_date . __( ' - ', 'event_espresso' ) . $the_event_end_date; |
|
568 | + $single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format'); |
|
569 | + $single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format'); |
|
570 | + $single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format); |
|
571 | + $single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format); |
|
572 | + EE_Registry::instance()->load_helper('Event_View'); |
|
573 | + $the_event_date = date_i18n($date_format.' '.$time_format, strtotime(EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID))); |
|
574 | + $the_event_end_date = date_i18n($date_format.' '.$time_format, strtotime(EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID))); |
|
575 | + if ($the_event_date != $the_event_end_date) { |
|
576 | + echo $the_event_date.__(' - ', 'event_espresso').$the_event_end_date; |
|
577 | 577 | } else { |
578 | 578 | echo $the_event_date; |
579 | 579 | } |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | } |
582 | 582 | |
583 | 583 | |
584 | -if ( ! function_exists( 'espresso_event_date_as_calendar_page' )) { |
|
584 | +if ( ! function_exists('espresso_event_date_as_calendar_page')) { |
|
585 | 585 | /** |
586 | 586 | * espresso_event_date_as_calendar_page |
587 | 587 | * returns the primary date for an event, stylized to appear as the page of a calendar |
@@ -589,16 +589,16 @@ discard block |
||
589 | 589 | * @param bool $EVT_ID |
590 | 590 | * @return string |
591 | 591 | */ |
592 | - function espresso_event_date_as_calendar_page( $EVT_ID = FALSE ) { |
|
593 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
594 | - EEH_Event_View::event_date_as_calendar_page( $EVT_ID ); |
|
592 | + function espresso_event_date_as_calendar_page($EVT_ID = FALSE) { |
|
593 | + EE_Registry::instance()->load_helper('Event_View'); |
|
594 | + EEH_Event_View::event_date_as_calendar_page($EVT_ID); |
|
595 | 595 | } |
596 | 596 | } |
597 | 597 | |
598 | 598 | |
599 | 599 | |
600 | 600 | |
601 | -if ( ! function_exists( 'espresso_event_link_url' )) { |
|
601 | +if ( ! function_exists('espresso_event_link_url')) { |
|
602 | 602 | /** |
603 | 603 | * espresso_event_link_url |
604 | 604 | * |
@@ -606,19 +606,19 @@ discard block |
||
606 | 606 | * @param bool $echo |
607 | 607 | * @return string |
608 | 608 | */ |
609 | - function espresso_event_link_url( $EVT_ID = 0, $echo = TRUE ) { |
|
610 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
611 | - if ( $echo ) { |
|
612 | - echo EEH_Event_View::event_link_url( $EVT_ID ); |
|
609 | + function espresso_event_link_url($EVT_ID = 0, $echo = TRUE) { |
|
610 | + EE_Registry::instance()->load_helper('Event_View'); |
|
611 | + if ($echo) { |
|
612 | + echo EEH_Event_View::event_link_url($EVT_ID); |
|
613 | 613 | return ''; |
614 | 614 | } |
615 | - return EEH_Event_View::event_link_url( $EVT_ID ); |
|
615 | + return EEH_Event_View::event_link_url($EVT_ID); |
|
616 | 616 | } |
617 | 617 | } |
618 | 618 | |
619 | 619 | |
620 | 620 | |
621 | -if ( ! function_exists( 'espresso_event_has_content_or_excerpt' )) { |
|
621 | +if ( ! function_exists('espresso_event_has_content_or_excerpt')) { |
|
622 | 622 | /** |
623 | 623 | * espresso_event_has_content_or_excerpt |
624 | 624 | * |
@@ -626,16 +626,16 @@ discard block |
||
626 | 626 | * @param bool $EVT_ID |
627 | 627 | * @return boolean |
628 | 628 | */ |
629 | - function espresso_event_has_content_or_excerpt( $EVT_ID = FALSE ) { |
|
630 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
631 | - return EEH_Event_View::event_has_content_or_excerpt( $EVT_ID ); |
|
629 | + function espresso_event_has_content_or_excerpt($EVT_ID = FALSE) { |
|
630 | + EE_Registry::instance()->load_helper('Event_View'); |
|
631 | + return EEH_Event_View::event_has_content_or_excerpt($EVT_ID); |
|
632 | 632 | } |
633 | 633 | } |
634 | 634 | |
635 | 635 | |
636 | 636 | |
637 | 637 | |
638 | -if ( ! function_exists( 'espresso_event_content_or_excerpt' )) { |
|
638 | +if ( ! function_exists('espresso_event_content_or_excerpt')) { |
|
639 | 639 | /** |
640 | 640 | * espresso_event_content_or_excerpt |
641 | 641 | * |
@@ -644,19 +644,19 @@ discard block |
||
644 | 644 | * @param bool $echo |
645 | 645 | * @return string |
646 | 646 | */ |
647 | - function espresso_event_content_or_excerpt( $num_words = 55, $more = NULL, $echo = TRUE ) { |
|
648 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
649 | - if ( $echo ) { |
|
650 | - echo EEH_Event_View::event_content_or_excerpt( $num_words, $more ); |
|
647 | + function espresso_event_content_or_excerpt($num_words = 55, $more = NULL, $echo = TRUE) { |
|
648 | + EE_Registry::instance()->load_helper('Event_View'); |
|
649 | + if ($echo) { |
|
650 | + echo EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
651 | 651 | return ''; |
652 | 652 | } |
653 | - return EEH_Event_View::event_content_or_excerpt( $num_words, $more ); |
|
653 | + return EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
654 | 654 | } |
655 | 655 | } |
656 | 656 | |
657 | 657 | |
658 | 658 | |
659 | -if ( ! function_exists( 'espresso_event_phone' )) { |
|
659 | +if ( ! function_exists('espresso_event_phone')) { |
|
660 | 660 | /** |
661 | 661 | * espresso_event_phone |
662 | 662 | * |
@@ -664,19 +664,19 @@ discard block |
||
664 | 664 | * @param bool $echo |
665 | 665 | * @return string |
666 | 666 | */ |
667 | - function espresso_event_phone( $EVT_ID = 0, $echo = TRUE ) { |
|
668 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
669 | - if ( $echo ) { |
|
670 | - echo EEH_Event_View::event_phone( $EVT_ID ); |
|
667 | + function espresso_event_phone($EVT_ID = 0, $echo = TRUE) { |
|
668 | + EE_Registry::instance()->load_helper('Event_View'); |
|
669 | + if ($echo) { |
|
670 | + echo EEH_Event_View::event_phone($EVT_ID); |
|
671 | 671 | return ''; |
672 | 672 | } |
673 | - return EEH_Event_View::event_phone( $EVT_ID ); |
|
673 | + return EEH_Event_View::event_phone($EVT_ID); |
|
674 | 674 | } |
675 | 675 | } |
676 | 676 | |
677 | 677 | |
678 | 678 | |
679 | -if ( ! function_exists( 'espresso_edit_event_link' )) { |
|
679 | +if ( ! function_exists('espresso_edit_event_link')) { |
|
680 | 680 | /** |
681 | 681 | * espresso_edit_event_link |
682 | 682 | * returns a link to edit an event |
@@ -685,41 +685,41 @@ discard block |
||
685 | 685 | * @param bool $echo |
686 | 686 | * @return string |
687 | 687 | */ |
688 | - function espresso_edit_event_link( $EVT_ID = 0, $echo = TRUE ) { |
|
689 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
690 | - if ( $echo ) { |
|
691 | - echo EEH_Event_View::edit_event_link( $EVT_ID ); |
|
688 | + function espresso_edit_event_link($EVT_ID = 0, $echo = TRUE) { |
|
689 | + EE_Registry::instance()->load_helper('Event_View'); |
|
690 | + if ($echo) { |
|
691 | + echo EEH_Event_View::edit_event_link($EVT_ID); |
|
692 | 692 | return ''; |
693 | 693 | } |
694 | - return EEH_Event_View::edit_event_link( $EVT_ID ); |
|
694 | + return EEH_Event_View::edit_event_link($EVT_ID); |
|
695 | 695 | } |
696 | 696 | } |
697 | 697 | |
698 | 698 | |
699 | -if ( ! function_exists( 'espresso_organization_name' )) { |
|
699 | +if ( ! function_exists('espresso_organization_name')) { |
|
700 | 700 | /** |
701 | 701 | * espresso_organization_name |
702 | 702 | * @param bool $echo |
703 | 703 | * @return string |
704 | 704 | */ |
705 | 705 | function espresso_organization_name($echo = TRUE) { |
706 | - if($echo){ |
|
707 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
706 | + if ($echo) { |
|
707 | + echo EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
708 | 708 | return ''; |
709 | 709 | } |
710 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
710 | + return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
711 | 711 | } |
712 | 712 | } |
713 | 713 | |
714 | -if ( ! function_exists( 'espresso_organization_address' )) { |
|
714 | +if ( ! function_exists('espresso_organization_address')) { |
|
715 | 715 | /** |
716 | 716 | * espresso_organization_address |
717 | 717 | * @param string $type |
718 | 718 | * @return string |
719 | 719 | */ |
720 | - function espresso_organization_address( $type = 'inline' ) { |
|
721 | - if ( EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ) { |
|
722 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
720 | + function espresso_organization_address($type = 'inline') { |
|
721 | + if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) { |
|
722 | + EE_Registry::instance()->load_helper('Formatter'); |
|
723 | 723 | $address = new EE_Generic_Address( |
724 | 724 | EE_Registry::instance()->CFG->organization->address_1, |
725 | 725 | EE_Registry::instance()->CFG->organization->address_2, |
@@ -728,129 +728,129 @@ discard block |
||
728 | 728 | EE_Registry::instance()->CFG->organization->CNT_ISO, |
729 | 729 | EE_Registry::instance()->CFG->organization->zip |
730 | 730 | ); |
731 | - return EEH_Address::format( $address, $type ); |
|
731 | + return EEH_Address::format($address, $type); |
|
732 | 732 | } |
733 | 733 | return ''; |
734 | 734 | } |
735 | 735 | } |
736 | 736 | |
737 | -if ( ! function_exists( 'espresso_organization_email' )) { |
|
737 | +if ( ! function_exists('espresso_organization_email')) { |
|
738 | 738 | /** |
739 | 739 | * espresso_organization_email |
740 | 740 | * @param bool $echo |
741 | 741 | * @return string |
742 | 742 | */ |
743 | - function espresso_organization_email( $echo = TRUE ) { |
|
744 | - if($echo){ |
|
745 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
743 | + function espresso_organization_email($echo = TRUE) { |
|
744 | + if ($echo) { |
|
745 | + echo EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
746 | 746 | return ''; |
747 | 747 | } |
748 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
748 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
749 | 749 | } |
750 | 750 | } |
751 | 751 | |
752 | -if ( ! function_exists( 'espresso_organization_logo_url' )) { |
|
752 | +if ( ! function_exists('espresso_organization_logo_url')) { |
|
753 | 753 | /** |
754 | 754 | * espresso_organization_logo_url |
755 | 755 | * @param bool $echo |
756 | 756 | * @return string |
757 | 757 | */ |
758 | - function espresso_organization_logo_url( $echo = TRUE ) { |
|
759 | - if($echo){ |
|
760 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
758 | + function espresso_organization_logo_url($echo = TRUE) { |
|
759 | + if ($echo) { |
|
760 | + echo EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
761 | 761 | return ''; |
762 | 762 | } |
763 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
763 | + return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
764 | 764 | } |
765 | 765 | } |
766 | 766 | |
767 | -if ( ! function_exists( 'espresso_organization_facebook' )) { |
|
767 | +if ( ! function_exists('espresso_organization_facebook')) { |
|
768 | 768 | /** |
769 | 769 | * espresso_organization_facebook |
770 | 770 | * @param bool $echo |
771 | 771 | * @return string |
772 | 772 | */ |
773 | - function espresso_organization_facebook( $echo = TRUE ) { |
|
774 | - if($echo){ |
|
775 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
773 | + function espresso_organization_facebook($echo = TRUE) { |
|
774 | + if ($echo) { |
|
775 | + echo EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
776 | 776 | return ''; |
777 | 777 | } |
778 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
778 | + return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
779 | 779 | } |
780 | 780 | } |
781 | 781 | |
782 | -if ( ! function_exists( 'espresso_organization_twitter' )) { |
|
782 | +if ( ! function_exists('espresso_organization_twitter')) { |
|
783 | 783 | /** |
784 | 784 | * espresso_organization_twitter |
785 | 785 | * @param bool $echo |
786 | 786 | * @return string |
787 | 787 | */ |
788 | - function espresso_organization_twitter( $echo = TRUE ) { |
|
789 | - if($echo){ |
|
790 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
788 | + function espresso_organization_twitter($echo = TRUE) { |
|
789 | + if ($echo) { |
|
790 | + echo EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
791 | 791 | return ''; |
792 | 792 | } |
793 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
793 | + return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
794 | 794 | } |
795 | 795 | } |
796 | 796 | |
797 | -if ( ! function_exists( 'espresso_organization_linkedin' )) { |
|
797 | +if ( ! function_exists('espresso_organization_linkedin')) { |
|
798 | 798 | /** |
799 | 799 | * espresso_organization_linkedin |
800 | 800 | * @param bool $echo |
801 | 801 | * @return string |
802 | 802 | */ |
803 | - function espresso_organization_linkedin( $echo = TRUE ) { |
|
804 | - if($echo){ |
|
805 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
803 | + function espresso_organization_linkedin($echo = TRUE) { |
|
804 | + if ($echo) { |
|
805 | + echo EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
806 | 806 | return ''; |
807 | 807 | } |
808 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
808 | + return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
809 | 809 | } |
810 | 810 | } |
811 | 811 | |
812 | -if ( ! function_exists( 'espresso_organization_pinterest' )) { |
|
812 | +if ( ! function_exists('espresso_organization_pinterest')) { |
|
813 | 813 | /** |
814 | 814 | * espresso_organization_pinterest |
815 | 815 | * @param bool $echo |
816 | 816 | * @return string |
817 | 817 | */ |
818 | - function espresso_organization_pinterest( $echo = TRUE ) { |
|
819 | - if($echo){ |
|
820 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
818 | + function espresso_organization_pinterest($echo = TRUE) { |
|
819 | + if ($echo) { |
|
820 | + echo EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
821 | 821 | return ''; |
822 | 822 | } |
823 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
823 | + return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
824 | 824 | } |
825 | 825 | } |
826 | 826 | |
827 | -if ( ! function_exists( 'espresso_organization_google' )) { |
|
827 | +if ( ! function_exists('espresso_organization_google')) { |
|
828 | 828 | /** |
829 | 829 | * espresso_organization_google |
830 | 830 | * @param bool $echo |
831 | 831 | * @return string |
832 | 832 | */ |
833 | - function espresso_organization_google( $echo = TRUE ) { |
|
834 | - if($echo){ |
|
835 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
833 | + function espresso_organization_google($echo = TRUE) { |
|
834 | + if ($echo) { |
|
835 | + echo EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
836 | 836 | return ''; |
837 | 837 | } |
838 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
838 | + return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
839 | 839 | } |
840 | 840 | } |
841 | 841 | |
842 | -if ( ! function_exists( 'espresso_organization_instagram' )) { |
|
842 | +if ( ! function_exists('espresso_organization_instagram')) { |
|
843 | 843 | /** |
844 | 844 | * espresso_organization_instagram |
845 | 845 | * @param bool $echo |
846 | 846 | * @return string |
847 | 847 | */ |
848 | - function espresso_organization_instagram( $echo = TRUE ) { |
|
849 | - if($echo){ |
|
850 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
848 | + function espresso_organization_instagram($echo = TRUE) { |
|
849 | + if ($echo) { |
|
850 | + echo EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
851 | 851 | return ''; |
852 | 852 | } |
853 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
853 | + return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
854 | 854 | } |
855 | 855 | } |
856 | 856 | |
@@ -860,14 +860,14 @@ discard block |
||
860 | 860 | |
861 | 861 | |
862 | 862 | |
863 | -if ( ! function_exists( 'espresso_event_venues' )) { |
|
863 | +if ( ! function_exists('espresso_event_venues')) { |
|
864 | 864 | /** |
865 | 865 | * espresso_event_venues |
866 | 866 | * |
867 | 867 | * @return array all venues related to an event |
868 | 868 | */ |
869 | 869 | function espresso_event_venues() { |
870 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
870 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
871 | 871 | return EEH_Venue_View::get_event_venues(); |
872 | 872 | } |
873 | 873 | } |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | |
876 | 876 | |
877 | 877 | |
878 | -if ( ! function_exists( 'espresso_venue_id' )) { |
|
878 | +if ( ! function_exists('espresso_venue_id')) { |
|
879 | 879 | /** |
880 | 880 | * espresso_venue_name |
881 | 881 | * |
@@ -883,16 +883,16 @@ discard block |
||
883 | 883 | * @param int $EVT_ID |
884 | 884 | * @return string |
885 | 885 | */ |
886 | - function espresso_venue_id( $EVT_ID = 0 ) { |
|
887 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
888 | - $venue = EEH_Venue_View::get_venue( $EVT_ID ); |
|
886 | + function espresso_venue_id($EVT_ID = 0) { |
|
887 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
888 | + $venue = EEH_Venue_View::get_venue($EVT_ID); |
|
889 | 889 | return $venue instanceof EE_Venue ? $venue->ID() : 0; |
890 | 890 | } |
891 | 891 | } |
892 | 892 | |
893 | 893 | |
894 | 894 | |
895 | -if ( ! function_exists( 'espresso_is_venue_private' ) ) { |
|
895 | +if ( ! function_exists('espresso_is_venue_private')) { |
|
896 | 896 | /** |
897 | 897 | * Return whether a venue is private or not. |
898 | 898 | * @see EEH_Venue_View::get_venue() for more info on expected return results. |
@@ -901,16 +901,16 @@ discard block |
||
901 | 901 | * |
902 | 902 | * @return bool | null |
903 | 903 | */ |
904 | - function espresso_is_venue_private( $VNU_ID = 0 ) { |
|
905 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
906 | - return EEH_Venue_View::is_venue_private( $VNU_ID ); |
|
904 | + function espresso_is_venue_private($VNU_ID = 0) { |
|
905 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
906 | + return EEH_Venue_View::is_venue_private($VNU_ID); |
|
907 | 907 | } |
908 | 908 | } |
909 | 909 | |
910 | 910 | |
911 | 911 | |
912 | 912 | |
913 | -if ( ! function_exists( 'espresso_venue_name' )) { |
|
913 | +if ( ! function_exists('espresso_venue_name')) { |
|
914 | 914 | /** |
915 | 915 | * espresso_venue_name |
916 | 916 | * |
@@ -920,20 +920,20 @@ discard block |
||
920 | 920 | * @param bool $echo |
921 | 921 | * @return string |
922 | 922 | */ |
923 | - function espresso_venue_name( $VNU_ID = 0, $link_to = 'details', $echo = TRUE ) { |
|
924 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
925 | - if($echo){ |
|
926 | - echo EEH_Venue_View::venue_name( $link_to, $VNU_ID ); |
|
923 | + function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = TRUE) { |
|
924 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
925 | + if ($echo) { |
|
926 | + echo EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
927 | 927 | return ''; |
928 | 928 | } |
929 | - return EEH_Venue_View::venue_name( $link_to, $VNU_ID ); |
|
929 | + return EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
930 | 930 | } |
931 | 931 | } |
932 | 932 | |
933 | 933 | |
934 | 934 | |
935 | 935 | |
936 | -if ( ! function_exists( 'espresso_venue_link' )) { |
|
936 | +if ( ! function_exists('espresso_venue_link')) { |
|
937 | 937 | /** |
938 | 938 | * espresso_venue_link |
939 | 939 | * |
@@ -942,15 +942,15 @@ discard block |
||
942 | 942 | * @param string $text |
943 | 943 | * @return string |
944 | 944 | */ |
945 | - function espresso_venue_link( $VNU_ID = 0, $text = '' ) { |
|
946 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
947 | - return EEH_Venue_View::venue_details_link( $VNU_ID, $text ); |
|
945 | + function espresso_venue_link($VNU_ID = 0, $text = '') { |
|
946 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
947 | + return EEH_Venue_View::venue_details_link($VNU_ID, $text); |
|
948 | 948 | } |
949 | 949 | } |
950 | 950 | |
951 | 951 | |
952 | 952 | |
953 | -if ( ! function_exists( 'espresso_venue_description' )) { |
|
953 | +if ( ! function_exists('espresso_venue_description')) { |
|
954 | 954 | /** |
955 | 955 | * espresso_venue_description |
956 | 956 | * |
@@ -959,18 +959,18 @@ discard block |
||
959 | 959 | * @param bool $echo |
960 | 960 | * @return string |
961 | 961 | */ |
962 | - function espresso_venue_description( $VNU_ID = FALSE, $echo = TRUE ) { |
|
963 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
964 | - if($echo){ |
|
965 | - echo EEH_Venue_View::venue_description( $VNU_ID ); |
|
962 | + function espresso_venue_description($VNU_ID = FALSE, $echo = TRUE) { |
|
963 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
964 | + if ($echo) { |
|
965 | + echo EEH_Venue_View::venue_description($VNU_ID); |
|
966 | 966 | return ''; |
967 | 967 | } |
968 | - return EEH_Venue_View::venue_description( $VNU_ID ); |
|
968 | + return EEH_Venue_View::venue_description($VNU_ID); |
|
969 | 969 | } |
970 | 970 | } |
971 | 971 | |
972 | 972 | |
973 | -if ( ! function_exists( 'espresso_venue_excerpt' )) { |
|
973 | +if ( ! function_exists('espresso_venue_excerpt')) { |
|
974 | 974 | /** |
975 | 975 | * espresso_venue_excerpt |
976 | 976 | * |
@@ -979,19 +979,19 @@ discard block |
||
979 | 979 | * @param bool $echo |
980 | 980 | * @return string |
981 | 981 | */ |
982 | - function espresso_venue_excerpt( $VNU_ID = 0, $echo = TRUE ) { |
|
983 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
984 | - if ( $echo ) { |
|
985 | - echo EEH_Venue_View::venue_excerpt( $VNU_ID, $echo ); |
|
982 | + function espresso_venue_excerpt($VNU_ID = 0, $echo = TRUE) { |
|
983 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
984 | + if ($echo) { |
|
985 | + echo EEH_Venue_View::venue_excerpt($VNU_ID, $echo); |
|
986 | 986 | return ''; |
987 | 987 | } |
988 | - return EEH_Venue_View::venue_excerpt( $VNU_ID, $echo ); |
|
988 | + return EEH_Venue_View::venue_excerpt($VNU_ID, $echo); |
|
989 | 989 | } |
990 | 990 | } |
991 | 991 | |
992 | 992 | |
993 | 993 | |
994 | -if ( ! function_exists( 'espresso_venue_categories' )) { |
|
994 | +if ( ! function_exists('espresso_venue_categories')) { |
|
995 | 995 | /** |
996 | 996 | * espresso_venue_categories |
997 | 997 | * returns the terms associated with a venue |
@@ -1001,18 +1001,18 @@ discard block |
||
1001 | 1001 | * @param bool $echo |
1002 | 1002 | * @return string |
1003 | 1003 | */ |
1004 | - function espresso_venue_categories( $VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) { |
|
1005 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
1006 | - if ( $echo ) { |
|
1007 | - echo EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized ); |
|
1004 | + function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) { |
|
1005 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1006 | + if ($echo) { |
|
1007 | + echo EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
1008 | 1008 | return ''; |
1009 | 1009 | } |
1010 | - return EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized ); |
|
1010 | + return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
1011 | 1011 | } |
1012 | 1012 | } |
1013 | 1013 | |
1014 | 1014 | |
1015 | -if ( ! function_exists( 'espresso_venue_address' )) { |
|
1015 | +if ( ! function_exists('espresso_venue_address')) { |
|
1016 | 1016 | /** |
1017 | 1017 | * espresso_venue_address |
1018 | 1018 | * returns a formatted block of html for displaying a venue's address |
@@ -1022,18 +1022,18 @@ discard block |
||
1022 | 1022 | * @param bool $echo |
1023 | 1023 | * @return string |
1024 | 1024 | */ |
1025 | - function espresso_venue_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) { |
|
1026 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
1027 | - if ( $echo ) { |
|
1028 | - echo EEH_Venue_View::venue_address( $type, $VNU_ID ); |
|
1025 | + function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) { |
|
1026 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1027 | + if ($echo) { |
|
1028 | + echo EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1029 | 1029 | return ''; |
1030 | 1030 | } |
1031 | - return EEH_Venue_View::venue_address( $type, $VNU_ID ); |
|
1031 | + return EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1032 | 1032 | } |
1033 | 1033 | } |
1034 | 1034 | |
1035 | 1035 | |
1036 | -if ( ! function_exists( 'espresso_venue_raw_address' )) { |
|
1036 | +if ( ! function_exists('espresso_venue_raw_address')) { |
|
1037 | 1037 | /** |
1038 | 1038 | * espresso_venue_address |
1039 | 1039 | * returns an UN-formatted string containing a venue's address |
@@ -1043,18 +1043,18 @@ discard block |
||
1043 | 1043 | * @param bool $echo |
1044 | 1044 | * @return string |
1045 | 1045 | */ |
1046 | - function espresso_venue_raw_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) { |
|
1047 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
1048 | - if ( $echo ) { |
|
1049 | - echo EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE ); |
|
1046 | + function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) { |
|
1047 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1048 | + if ($echo) { |
|
1049 | + echo EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE); |
|
1050 | 1050 | return ''; |
1051 | 1051 | } |
1052 | - return EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE ); |
|
1052 | + return EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE); |
|
1053 | 1053 | } |
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | |
1057 | -if ( ! function_exists( 'espresso_venue_has_address' )) { |
|
1057 | +if ( ! function_exists('espresso_venue_has_address')) { |
|
1058 | 1058 | /** |
1059 | 1059 | * espresso_venue_has_address |
1060 | 1060 | * returns TRUE or FALSE if a Venue has address information |
@@ -1062,14 +1062,14 @@ discard block |
||
1062 | 1062 | * @param int $VNU_ID |
1063 | 1063 | * @return bool |
1064 | 1064 | */ |
1065 | - function espresso_venue_has_address( $VNU_ID = 0 ) { |
|
1066 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
1067 | - return EEH_Venue_View::venue_has_address( $VNU_ID ); |
|
1065 | + function espresso_venue_has_address($VNU_ID = 0) { |
|
1066 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1067 | + return EEH_Venue_View::venue_has_address($VNU_ID); |
|
1068 | 1068 | } |
1069 | 1069 | } |
1070 | 1070 | |
1071 | 1071 | |
1072 | -if ( ! function_exists( 'espresso_venue_gmap' )) { |
|
1072 | +if ( ! function_exists('espresso_venue_gmap')) { |
|
1073 | 1073 | /** |
1074 | 1074 | * espresso_venue_gmap |
1075 | 1075 | * returns a google map for the venue address |
@@ -1080,18 +1080,18 @@ discard block |
||
1080 | 1080 | * @param bool $echo |
1081 | 1081 | * @return string |
1082 | 1082 | */ |
1083 | - function espresso_venue_gmap( $VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE ) { |
|
1084 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
1085 | - if ( $echo ) { |
|
1086 | - echo EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap ); |
|
1083 | + function espresso_venue_gmap($VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE) { |
|
1084 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1085 | + if ($echo) { |
|
1086 | + echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1087 | 1087 | return ''; |
1088 | 1088 | } |
1089 | - return EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap ); |
|
1089 | + return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1090 | 1090 | } |
1091 | 1091 | } |
1092 | 1092 | |
1093 | 1093 | |
1094 | -if ( ! function_exists( 'espresso_venue_phone' )) { |
|
1094 | +if ( ! function_exists('espresso_venue_phone')) { |
|
1095 | 1095 | /** |
1096 | 1096 | * espresso_venue_phone |
1097 | 1097 | * |
@@ -1099,19 +1099,19 @@ discard block |
||
1099 | 1099 | * @param bool $echo |
1100 | 1100 | * @return string |
1101 | 1101 | */ |
1102 | - function espresso_venue_phone( $VNU_ID = 0, $echo = TRUE ) { |
|
1103 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
1104 | - if ( $echo ) { |
|
1105 | - echo EEH_Venue_View::venue_phone( $VNU_ID ); |
|
1102 | + function espresso_venue_phone($VNU_ID = 0, $echo = TRUE) { |
|
1103 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1104 | + if ($echo) { |
|
1105 | + echo EEH_Venue_View::venue_phone($VNU_ID); |
|
1106 | 1106 | return ''; |
1107 | 1107 | } |
1108 | - return EEH_Venue_View::venue_phone( $VNU_ID ); |
|
1108 | + return EEH_Venue_View::venue_phone($VNU_ID); |
|
1109 | 1109 | } |
1110 | 1110 | } |
1111 | 1111 | |
1112 | 1112 | |
1113 | 1113 | |
1114 | -if ( ! function_exists( 'espresso_venue_website' )) { |
|
1114 | +if ( ! function_exists('espresso_venue_website')) { |
|
1115 | 1115 | /** |
1116 | 1116 | * espresso_venue_website |
1117 | 1117 | * |
@@ -1119,19 +1119,19 @@ discard block |
||
1119 | 1119 | * @param bool $echo |
1120 | 1120 | * @return string |
1121 | 1121 | */ |
1122 | - function espresso_venue_website( $VNU_ID = 0, $echo = TRUE ) { |
|
1123 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
1124 | - if ( $echo ) { |
|
1125 | - echo EEH_Venue_View::venue_website_link( $VNU_ID ); |
|
1122 | + function espresso_venue_website($VNU_ID = 0, $echo = TRUE) { |
|
1123 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1124 | + if ($echo) { |
|
1125 | + echo EEH_Venue_View::venue_website_link($VNU_ID); |
|
1126 | 1126 | return ''; |
1127 | 1127 | } |
1128 | - return EEH_Venue_View::venue_website_link( $VNU_ID ); |
|
1128 | + return EEH_Venue_View::venue_website_link($VNU_ID); |
|
1129 | 1129 | } |
1130 | 1130 | } |
1131 | 1131 | |
1132 | 1132 | |
1133 | 1133 | |
1134 | -if ( ! function_exists( 'espresso_edit_venue_link' )) { |
|
1134 | +if ( ! function_exists('espresso_edit_venue_link')) { |
|
1135 | 1135 | /** |
1136 | 1136 | * espresso_edit_venue_link |
1137 | 1137 | * |
@@ -1139,13 +1139,13 @@ discard block |
||
1139 | 1139 | * @param bool $echo |
1140 | 1140 | * @return string |
1141 | 1141 | */ |
1142 | - function espresso_edit_venue_link( $VNU_ID = 0, $echo = TRUE ) { |
|
1143 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
1144 | - if($echo){ |
|
1145 | - echo EEH_Venue_View::edit_venue_link( $VNU_ID ); |
|
1142 | + function espresso_edit_venue_link($VNU_ID = 0, $echo = TRUE) { |
|
1143 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1144 | + if ($echo) { |
|
1145 | + echo EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1146 | 1146 | return ''; |
1147 | 1147 | } |
1148 | - return EEH_Venue_View::edit_venue_link( $VNU_ID ); |
|
1148 | + return EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1149 | 1149 | } |
1150 | 1150 | } |
1151 | 1151 |
@@ -229,7 +229,7 @@ |
||
229 | 229 | * |
230 | 230 | * @access public |
231 | 231 | * @param string $event_list_css |
232 | - * @return array |
|
232 | + * @return string |
|
233 | 233 | */ |
234 | 234 | public function event_list_css( $event_list_css = '' ) { |
235 | 235 | $event_list_css .= ! empty( $event_list_css ) ? ' ' : ''; |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | * @param WP $WP |
51 | 51 | * @return void |
52 | 52 | */ |
53 | - public function run( WP $WP ) { |
|
54 | - if ( ! did_action( 'pre_get_posts' )) { |
|
53 | + public function run(WP $WP) { |
|
54 | + if ( ! did_action('pre_get_posts')) { |
|
55 | 55 | // this will trigger the EED_Events_Archive module's event_list() method during the pre_get_posts hook point, |
56 | 56 | // this allows us to initialize things, enqueue assets, etc, |
57 | 57 | // as well, this saves an instantiation of the module in an array using 'espresso_events' as the key, so that we can retrieve it |
58 | - add_action( 'pre_get_posts', array( EED_Events_Archive::instance(), 'event_list' )); |
|
58 | + add_action('pre_get_posts', array(EED_Events_Archive::instance(), 'event_list')); |
|
59 | 59 | } else { |
60 | 60 | EED_Events_Archive::instance()->event_list(); |
61 | 61 | } |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | * @param array $attributes |
80 | 80 | * @return string |
81 | 81 | */ |
82 | - public function process_shortcode( $attributes = array() ) { |
|
82 | + public function process_shortcode($attributes = array()) { |
|
83 | 83 | // make sure EED_Events_Archive is setup properly |
84 | - if ( apply_filters( 'FHEE__fallback_shortcode_processor__EES_Espresso_Events', FALSE )) { |
|
84 | + if (apply_filters('FHEE__fallback_shortcode_processor__EES_Espresso_Events', FALSE)) { |
|
85 | 85 | EED_Events_Archive::instance()->event_list(); |
86 | 86 | } |
87 | 87 | // merge in any attributes passed via fallback shortcode processor |
88 | - $attributes = array_merge( (array)$attributes, (array)$this->_attributes ); |
|
88 | + $attributes = array_merge((array) $attributes, (array) $this->_attributes); |
|
89 | 89 | //set default attributes |
90 | 90 | $default_espresso_events_shortcode_atts = array( |
91 | 91 | 'title' => NULL, |
@@ -99,26 +99,26 @@ discard block |
||
99 | 99 | 'fallback_shortcode_processor' => FALSE |
100 | 100 | ); |
101 | 101 | // allow the defaults to be filtered |
102 | - $default_espresso_events_shortcode_atts = apply_filters( 'EES_Espresso_Events__process_shortcode__default_espresso_events_shortcode_atts', $default_espresso_events_shortcode_atts ); |
|
102 | + $default_espresso_events_shortcode_atts = apply_filters('EES_Espresso_Events__process_shortcode__default_espresso_events_shortcode_atts', $default_espresso_events_shortcode_atts); |
|
103 | 103 | // grab attributes and merge with defaults, then extract |
104 | - $attributes = array_merge( $default_espresso_events_shortcode_atts, $attributes ); |
|
104 | + $attributes = array_merge($default_espresso_events_shortcode_atts, $attributes); |
|
105 | 105 | // make sure we use the_excerpt() |
106 | - add_filter( 'FHEE__EES_Espresso_Events__process_shortcode__true', '__return_true' ); |
|
106 | + add_filter('FHEE__EES_Espresso_Events__process_shortcode__true', '__return_true'); |
|
107 | 107 | // apply query filters |
108 | - add_filter( 'FHEE__EEH_Event_Query__apply_query_filters', '__return_true' ); |
|
108 | + add_filter('FHEE__EEH_Event_Query__apply_query_filters', '__return_true'); |
|
109 | 109 | // run the query |
110 | 110 | global $wp_query; |
111 | - $wp_query = new EE_Event_List_Query( $attributes ); |
|
111 | + $wp_query = new EE_Event_List_Query($attributes); |
|
112 | 112 | // check what template is loaded and load filters accordingly |
113 | - EED_Events_Archive::instance()->template_include( 'loop-espresso_events.php' ); |
|
113 | + EED_Events_Archive::instance()->template_include('loop-espresso_events.php'); |
|
114 | 114 | // load our template |
115 | - $event_list = EEH_Template::locate_template( 'loop-espresso_events.php', array(), TRUE, TRUE ); |
|
115 | + $event_list = EEH_Template::locate_template('loop-espresso_events.php', array(), TRUE, TRUE); |
|
116 | 116 | // now reset the query and postdata |
117 | 117 | wp_reset_query(); |
118 | 118 | wp_reset_postdata(); |
119 | 119 | EED_Events_Archive::remove_all_events_archive_filters(); |
120 | 120 | // remove query filters |
121 | - remove_filter( 'FHEE__EEH_Event_Query__apply_query_filters', '__return_true' ); |
|
121 | + remove_filter('FHEE__EEH_Event_Query__apply_query_filters', '__return_true'); |
|
122 | 122 | // pull our content from the output buffer and return it |
123 | 123 | return $event_list; |
124 | 124 | } |
@@ -163,46 +163,46 @@ discard block |
||
163 | 163 | * @param array $args |
164 | 164 | * @return \EE_Event_List_Query |
165 | 165 | */ |
166 | - function __construct( $args = array() ) { |
|
166 | + function __construct($args = array()) { |
|
167 | 167 | // EEH_Debug_Tools::printr( $args, '$args <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
168 | 168 | // incoming args could be a mix of WP query args + EE shortcode args |
169 | - foreach ( $args as $key =>$value ) { |
|
170 | - $property = '_' . $key; |
|
169 | + foreach ($args as $key =>$value) { |
|
170 | + $property = '_'.$key; |
|
171 | 171 | // if the arg is a property of this class, then it's an EE shortcode arg |
172 | - if ( property_exists( $this, $property )) { |
|
172 | + if (property_exists($this, $property)) { |
|
173 | 173 | // set the property value |
174 | 174 | $this->$property = $value; |
175 | 175 | // then remove it from the array of args that will later be passed to WP_Query() |
176 | - unset( $args[ $key ] ); |
|
176 | + unset($args[$key]); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | // setup the events list query |
180 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
180 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
181 | 181 | //add query filters |
182 | 182 | EEH_Event_Query::add_query_filters(); |
183 | 183 | // set params that will get used by the filters |
184 | - EEH_Event_Query::set_query_params( $this->_month, $this->_category_slug, $this->_show_expired, $this->_order_by, $this->_sort ); |
|
184 | + EEH_Event_Query::set_query_params($this->_month, $this->_category_slug, $this->_show_expired, $this->_order_by, $this->_sort); |
|
185 | 185 | // first off, let's remove any filters from previous queries |
186 | - remove_filter( 'FHEE__archive_espresso_events_template__upcoming_events_h1', array( $this, 'event_list_title' )); |
|
187 | - remove_all_filters( 'FHEE__content_espresso_events__event_class' ); |
|
186 | + remove_filter('FHEE__archive_espresso_events_template__upcoming_events_h1', array($this, 'event_list_title')); |
|
187 | + remove_all_filters('FHEE__content_espresso_events__event_class'); |
|
188 | 188 | // Event List Title ? |
189 | - add_filter( 'FHEE__archive_espresso_events_template__upcoming_events_h1', array( $this, 'event_list_title' ), 10, 1 ); |
|
189 | + add_filter('FHEE__archive_espresso_events_template__upcoming_events_h1', array($this, 'event_list_title'), 10, 1); |
|
190 | 190 | // add the css class |
191 | - add_filter( 'FHEE__content_espresso_events__event_class', array( $this, 'event_list_css' ), 10, 1 ); |
|
191 | + add_filter('FHEE__content_espresso_events__event_class', array($this, 'event_list_css'), 10, 1); |
|
192 | 192 | // the current "page" we are viewing |
193 | - $paged = max( 1, get_query_var( 'paged' )); |
|
193 | + $paged = max(1, get_query_var('paged')); |
|
194 | 194 | // Force these args |
195 | - $args = array_merge( $args, array( |
|
195 | + $args = array_merge($args, array( |
|
196 | 196 | 'post_type' => 'espresso_events', |
197 | 197 | 'posts_per_page' => $this->_limit, |
198 | 198 | 'update_post_term_cache' => FALSE, |
199 | 199 | 'update_post_meta_cache' => FALSE, |
200 | 200 | 'paged' => $paged, |
201 | - 'offset' => ( $paged - 1 ) * $this->_limit |
|
201 | + 'offset' => ($paged - 1) * $this->_limit |
|
202 | 202 | )); |
203 | 203 | |
204 | 204 | // run the query |
205 | - parent::__construct( $args ); |
|
205 | + parent::__construct($args); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | * @param string $event_list_title |
216 | 216 | * @return string |
217 | 217 | */ |
218 | - public function event_list_title( $event_list_title = '' ) { |
|
219 | - if ( ! empty( $this->_title )) { |
|
218 | + public function event_list_title($event_list_title = '') { |
|
219 | + if ( ! empty($this->_title)) { |
|
220 | 220 | return $this->_title; |
221 | 221 | } |
222 | 222 | return $event_list_title; |
@@ -231,11 +231,11 @@ discard block |
||
231 | 231 | * @param string $event_list_css |
232 | 232 | * @return array |
233 | 233 | */ |
234 | - public function event_list_css( $event_list_css = '' ) { |
|
235 | - $event_list_css .= ! empty( $event_list_css ) ? ' ' : ''; |
|
236 | - $event_list_css .= ! empty( $this->_css_class ) ? $this->_css_class : ''; |
|
237 | - $event_list_css .= ! empty( $event_list_css ) ? ' ' : ''; |
|
238 | - $event_list_css .= ! empty( $this->_category_slug ) ? $this->_category_slug : ''; |
|
234 | + public function event_list_css($event_list_css = '') { |
|
235 | + $event_list_css .= ! empty($event_list_css) ? ' ' : ''; |
|
236 | + $event_list_css .= ! empty($this->_css_class) ? $this->_css_class : ''; |
|
237 | + $event_list_css .= ! empty($event_list_css) ? ' ' : ''; |
|
238 | + $event_list_css .= ! empty($this->_category_slug) ? $this->_category_slug : ''; |
|
239 | 239 | return $event_list_css; |
240 | 240 | } |
241 | 241 |
@@ -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 | * |
@@ -56,7 +56,7 @@ |
||
56 | 56 | * |
57 | 57 | * @access public |
58 | 58 | * @param array $attributes |
59 | - * @return void |
|
59 | + * @return string |
|
60 | 60 | */ |
61 | 61 | public function process_shortcode( $attributes = array() ) { |
62 | 62 | extract( $attributes ); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @access public |
49 | 49 | * @return void |
50 | 50 | */ |
51 | - public function run( WP $WP ) { |
|
51 | + public function run(WP $WP) { |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | * @param array $attributes |
59 | 59 | * @return void |
60 | 60 | */ |
61 | - public function process_shortcode( $attributes = array() ) { |
|
62 | - extract( $attributes ); |
|
63 | - $event = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $event_id ); |
|
61 | + public function process_shortcode($attributes = array()) { |
|
62 | + extract($attributes); |
|
63 | + $event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($event_id); |
|
64 | 64 | ob_start(); |
65 | - do_action( 'AHEE_event_details_before_post', $event_id ); |
|
66 | - espresso_ticket_selector( $event ); |
|
67 | - do_action( 'AHEE_event_details_after_post' ); |
|
65 | + do_action('AHEE_event_details_before_post', $event_id); |
|
66 | + espresso_ticket_selector($event); |
|
67 | + do_action('AHEE_event_details_after_post'); |
|
68 | 68 | return ob_get_clean(); |
69 | 69 | } |
70 | 70 |
@@ -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 | * |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | //Copied from _whats_new() |
118 | 118 | $steps = EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ? $this->_get_started_steps() : FALSE; |
119 | 119 | $steps = $steps !== FALSE ? $steps : ''; |
120 | - $this->_admin_page_title = sprintf( __('Welcome to Event Espresso %s', 'event_espresso'), EVENT_ESPRESSO_VERSION ); |
|
120 | + $this->_admin_page_title = sprintf(__('Welcome to Event Espresso %s', 'event_espresso'), EVENT_ESPRESSO_VERSION); |
|
121 | 121 | $settings_message = $steps; |
122 | - $this->_template_args['admin_page_subtitle'] = __('Thank you for choosing Event Espresso, the most powerful, and free, Event Management plugin for WordPress.', 'event_espresso' ) . $settings_message; |
|
123 | - $template = EE_ABOUT_TEMPLATE_PATH . 'ee4-overview.template.php'; |
|
124 | - $this->_template_args['about_admin_page_content'] = EEH_Template::display_template( $template, $this->_template_args, TRUE ); |
|
122 | + $this->_template_args['admin_page_subtitle'] = __('Thank you for choosing Event Espresso, the most powerful, and free, Event Management plugin for WordPress.', 'event_espresso').$settings_message; |
|
123 | + $template = EE_ABOUT_TEMPLATE_PATH.'ee4-overview.template.php'; |
|
124 | + $this->_template_args['about_admin_page_content'] = EEH_Template::display_template($template, $this->_template_args, TRUE); |
|
125 | 125 | $this->display_about_admin_page(); |
126 | 126 | } |
127 | 127 | |
@@ -129,36 +129,36 @@ discard block |
||
129 | 129 | |
130 | 130 | protected function _get_started_steps() { |
131 | 131 | $steps = '<h3>'.__('Getting Started').'</h3>'; |
132 | - $step_one = '<p>'.sprintf( __('%sStep 1%s: Visit your %sOrganization Settings%s and add/update your details.', 'event_espresso'), '<strong>', '</strong>', '<a href="admin.php?page=espresso_general_settings">', '</a>') .'</strong></p>'; |
|
133 | - $step_two = '<p>'.sprintf( __('%sStep 2%s: Setup your %sPayment Methods%s.', 'event_espresso'), '<strong>', '</strong>', '<a href="admin.php?page=espresso_payment_settings">', '</a>') .'</strong></p>'; |
|
134 | - $step_three = '<p>'.sprintf( __('%sStep 3%s: Create your %sFirst Event%s.', 'event_espresso'), '<strong>', '</strong>', '<a href="admin.php?page=espresso_events&action=create_new">', '</a>') .'</strong></p>'; |
|
132 | + $step_one = '<p>'.sprintf(__('%sStep 1%s: Visit your %sOrganization Settings%s and add/update your details.', 'event_espresso'), '<strong>', '</strong>', '<a href="admin.php?page=espresso_general_settings">', '</a>').'</strong></p>'; |
|
133 | + $step_two = '<p>'.sprintf(__('%sStep 2%s: Setup your %sPayment Methods%s.', 'event_espresso'), '<strong>', '</strong>', '<a href="admin.php?page=espresso_payment_settings">', '</a>').'</strong></p>'; |
|
134 | + $step_three = '<p>'.sprintf(__('%sStep 3%s: Create your %sFirst Event%s.', 'event_espresso'), '<strong>', '</strong>', '<a href="admin.php?page=espresso_events&action=create_new">', '</a>').'</strong></p>'; |
|
135 | 135 | |
136 | 136 | //done? |
137 | 137 | $done_step_one = EE_Registry::instance()->CFG->organization->address_1 == '123 Onna Road' ? FALSE : TRUE; |
138 | - $active_invoice_pm = EEM_Payment_Method::instance()->get_one_active( EEM_Payment_Method::scope_cart, array( array( 'PMD_type' => 'Invoice' ) ) ); |
|
139 | - $active_pms_count = EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ); |
|
138 | + $active_invoice_pm = EEM_Payment_Method::instance()->get_one_active(EEM_Payment_Method::scope_cart, array(array('PMD_type' => 'Invoice'))); |
|
139 | + $active_pms_count = EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart); |
|
140 | 140 | //done step two if a non-invoice paymetn method is active; or there is more than one PM active, or |
141 | 141 | //if only teh invoice is active but it's clearly been updated |
142 | - $done_step_two = $active_pms_count > 1 || |
|
143 | - ( $active_pms_count === 1 && ! $active_invoice_pm ) || |
|
144 | - ( $active_invoice_pm instanceof EE_Payment_Method && ( |
|
145 | - $active_invoice_pm->get_extra_meta( 'pdf_payee_name', TRUE, '' ) || |
|
146 | - $active_invoice_pm->get_extra_meta( 'pdf_payee_email', TRUE, '' ) || |
|
147 | - $active_invoice_pm->get_extra_meta( 'pdf_payee_tax_number', TRUE, '' ) || |
|
148 | - $active_invoice_pm->get_extra_meta( 'pdf_payee_address', TRUE, '' ) || |
|
149 | - $active_invoice_pm->get_extra_meta( 'page_extra_info', TRUE, '' ) |
|
142 | + $done_step_two = $active_pms_count > 1 || |
|
143 | + ($active_pms_count === 1 && ! $active_invoice_pm) || |
|
144 | + ($active_invoice_pm instanceof EE_Payment_Method && ( |
|
145 | + $active_invoice_pm->get_extra_meta('pdf_payee_name', TRUE, '') || |
|
146 | + $active_invoice_pm->get_extra_meta('pdf_payee_email', TRUE, '') || |
|
147 | + $active_invoice_pm->get_extra_meta('pdf_payee_tax_number', TRUE, '') || |
|
148 | + $active_invoice_pm->get_extra_meta('pdf_payee_address', TRUE, '') || |
|
149 | + $active_invoice_pm->get_extra_meta('page_extra_info', TRUE, '') |
|
150 | 150 | ) |
151 | 151 | ); |
152 | 152 | $done_step_three = EE_Registry::instance()->load_model('Event')->count() > 0 ? TRUE : FALSE; |
153 | 153 | |
154 | 154 | //if ALL steps are done, let's just return FALSE so we don't display anything |
155 | - if ( $done_step_one && $done_step_two && $done_step_three ) |
|
155 | + if ($done_step_one && $done_step_two && $done_step_three) |
|
156 | 156 | return FALSE; |
157 | 157 | |
158 | 158 | //now let's put it together |
159 | - $steps .= sprintf( '%s' . $step_one . '%s', $done_step_one ? '<strike>' : '', $done_step_one ? '</strike>': '' ); |
|
160 | - $steps .= sprintf( '%s' . $step_two . '%s', $done_step_two ? '<strike>' : '', $done_step_two ? '</strike>': '' ); |
|
161 | - $steps .= sprintf( '%s' . $step_three . '%s', $done_step_three ? '<strike>' : '', $done_step_three ? '</strike>': '' ); |
|
159 | + $steps .= sprintf('%s'.$step_one.'%s', $done_step_one ? '<strike>' : '', $done_step_one ? '</strike>' : ''); |
|
160 | + $steps .= sprintf('%s'.$step_two.'%s', $done_step_two ? '<strike>' : '', $done_step_two ? '</strike>' : ''); |
|
161 | + $steps .= sprintf('%s'.$step_three.'%s', $done_step_three ? '<strike>' : '', $done_step_three ? '</strike>' : ''); |
|
162 | 162 | |
163 | 163 | return $steps; |
164 | 164 | } |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | |
167 | 167 | |
168 | 168 | protected function _credits() { |
169 | - $this->_template_args['admin_page_title'] = sprintf( __('Welcome to Event Espresso %s', 'event_espresso'), EVENT_ESPRESSO_VERSION ); |
|
169 | + $this->_template_args['admin_page_title'] = sprintf(__('Welcome to Event Espresso %s', 'event_espresso'), EVENT_ESPRESSO_VERSION); |
|
170 | 170 | $this->_template_args['admin_page_subtitle'] = __('Thank you for choosing Event Espresso Decaf, the most powerful, and free, Event Management plugin for WordPress.', 'event_espresso'); |
171 | - $template = EE_ABOUT_TEMPLATE_PATH . 'credits.template.php'; |
|
172 | - $this->_template_args['about_admin_page_content'] = EEH_Template::display_template( $template, $this->_template_args, TRUE ); |
|
171 | + $template = EE_ABOUT_TEMPLATE_PATH.'credits.template.php'; |
|
172 | + $this->_template_args['about_admin_page_content'] = EEH_Template::display_template($template, $this->_template_args, TRUE); |
|
173 | 173 | $this->display_about_admin_page(); |
174 | 174 | } |
175 | 175 |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * |
@@ -152,8 +153,9 @@ discard block |
||
152 | 153 | $done_step_three = EE_Registry::instance()->load_model('Event')->count() > 0 ? TRUE : FALSE; |
153 | 154 | |
154 | 155 | //if ALL steps are done, let's just return FALSE so we don't display anything |
155 | - if ( $done_step_one && $done_step_two && $done_step_three ) |
|
156 | - return FALSE; |
|
156 | + if ( $done_step_one && $done_step_two && $done_step_three ) { |
|
157 | + return FALSE; |
|
158 | + } |
|
157 | 159 | |
158 | 160 | //now let's put it together |
159 | 161 | $steps .= sprintf( '%s' . $step_one . '%s', $done_step_one ? '<strike>' : '', $done_step_one ? '</strike>': '' ); |
@@ -1,25 +1,25 @@ |
||
1 | 1 | <div class="changelog point-releases"> |
2 | - <h3><?php echo _n( 'Minor Release Information', 'Minor Releases', 1 ); ?></h3> |
|
3 | - <!-- <h3><?php echo _n( 'Major Release Information', 'Major Releases', 1 ); ?></h3>--> |
|
2 | + <h3><?php echo _n('Minor Release Information', 'Minor Releases', 1); ?></h3> |
|
3 | + <!-- <h3><?php echo _n('Major Release Information', 'Major Releases', 1); ?></h3>--> |
|
4 | 4 | <?php $type = 'minor'; ?> |
5 | 5 | <?php //$type = 'major'; ?> |
6 | - <p><?php printf( __( '<strong>Version %1$s</strong> is a %2$s bug fix/enhancement release.', 'event_espresso'), EVENT_ESPRESSO_VERSION, $type ); ?> |
|
6 | + <p><?php printf(__('<strong>Version %1$s</strong> is a %2$s bug fix/enhancement release.', 'event_espresso'), EVENT_ESPRESSO_VERSION, $type); ?> |
|
7 | 7 | <?php |
8 | - $ver = explode( '.', EVENT_ESPRESSO_VERSION ); |
|
9 | - array_pop( $ver ); |
|
10 | - $ver = implode( '.', $ver ); |
|
8 | + $ver = explode('.', EVENT_ESPRESSO_VERSION); |
|
9 | + array_pop($ver); |
|
10 | + $ver = implode('.', $ver); |
|
11 | 11 | ?> |
12 | - <?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'http://eventespresso.com/wiki/ee4-changelog/#' . $ver ); ?> |
|
12 | + <?php printf(__('For more information, see <a href="%s">the release notes</a>.'), 'http://eventespresso.com/wiki/ee4-changelog/#'.$ver); ?> |
|
13 | 13 | </p> |
14 | 14 | </div> |
15 | 15 | |
16 | 16 | <div class="changelog"> |
17 | 17 | <?php |
18 | 18 | //maintenance mode on? |
19 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
19 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
20 | 20 | ?> |
21 | 21 | <div class="ee-attention"> |
22 | - <h2 class="ee-maintenance-mode-callout"><?php _e('Event Espresso is in full maintenance mode.' , 'event_espresso'); ?></h2> |
|
22 | + <h2 class="ee-maintenance-mode-callout"><?php _e('Event Espresso is in full maintenance mode.', 'event_espresso'); ?></h2> |
|
23 | 23 | <p> |
24 | 24 | <?php |
25 | 25 | printf( |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | class Event_Categories_Admin_List_Table extends EE_Admin_List_Table { |
33 | 33 | |
34 | - public function __construct( $admin_page ) { |
|
34 | + public function __construct($admin_page) { |
|
35 | 35 | parent::__construct($admin_page); |
36 | 36 | } |
37 | 37 | |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | |
40 | 40 | |
41 | 41 | protected function _setup_data() { |
42 | - $this->_data = $this->_admin_page->get_categories( $this->_per_page, $this->_current_page); |
|
43 | - $this->_all_data_count = EEM_Term_Taxonomy::instance()->count( array( array( 'taxonomy' => 'espresso_event_categories' ) ) ); |
|
42 | + $this->_data = $this->_admin_page->get_categories($this->_per_page, $this->_current_page); |
|
43 | + $this->_all_data_count = EEM_Term_Taxonomy::instance()->count(array(array('taxonomy' => 'espresso_event_categories'))); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | |
50 | 50 | protected function _set_properties() { |
51 | 51 | $this->_wp_list_args = array( |
52 | - 'singular' => __('event category', 'event_espresso' ), |
|
53 | - 'plural' => __('event categories', 'event_espresso' ), |
|
52 | + 'singular' => __('event category', 'event_espresso'), |
|
53 | + 'plural' => __('event categories', 'event_espresso'), |
|
54 | 54 | 'ajax' => TRUE, //for now, |
55 | 55 | 'screen' => $this->_admin_page->get_current_screen()->id |
56 | 56 | ); |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | ); |
65 | 65 | |
66 | 66 | $this->_sortable_columns = array( |
67 | - 'id' => array( 'Term.term_id' => true ), |
|
68 | - 'name' => array( 'Term.slug' => false ), |
|
69 | - 'count' => array( 'term_count' => false ) |
|
67 | + 'id' => array('Term.term_id' => true), |
|
68 | + 'name' => array('Term.slug' => false), |
|
69 | + 'count' => array('term_count' => false) |
|
70 | 70 | ); |
71 | 71 | |
72 | 72 | $this->_hidden_columns = array(); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | |
98 | 98 | public function column_cb($item) { |
99 | - return sprintf( '<input type="checkbox" name="EVT_CAT_ID[]" value="%s" />', $item->get('term_id') ); |
|
99 | + return sprintf('<input type="checkbox" name="EVT_CAT_ID[]" value="%s" />', $item->get('term_id')); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | |
@@ -123,17 +123,17 @@ discard block |
||
123 | 123 | 'EVT_CAT_ID' => $item->get('term_id') |
124 | 124 | ); |
125 | 125 | |
126 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
127 | - $delete_link = EE_Admin_Page::add_query_args_and_nonce( $delete_query_args, EVENTS_ADMIN_URL ); |
|
126 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
127 | + $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EVENTS_ADMIN_URL); |
|
128 | 128 | |
129 | 129 | $actions = array( |
130 | - 'edit' => '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Category', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>' |
|
130 | + 'edit' => '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Category', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>' |
|
131 | 131 | ); |
132 | 132 | |
133 | 133 | |
134 | - $actions['delete'] = '<a href="' . $delete_link . '" title="' . esc_attr__('Delete Category', 'event_espresso') . '">' . __('Delete', 'event_espresso') . '</a>'; |
|
134 | + $actions['delete'] = '<a href="'.$delete_link.'" title="'.esc_attr__('Delete Category', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>'; |
|
135 | 135 | |
136 | - $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->get_first_related('Term')->get('name') . '</a></strong>'; |
|
136 | + $content = '<strong><a class="row-title" href="'.$edit_link.'">'.$item->get_first_related('Term')->get('name').'</a></strong>'; |
|
137 | 137 | $content .= $this->row_actions($actions); |
138 | 138 | return $content; |
139 | 139 | } |
@@ -142,20 +142,20 @@ discard block |
||
142 | 142 | |
143 | 143 | |
144 | 144 | public function column_shortcode($item) { |
145 | - $content = '[ESPRESSO_EVENTS category_slug="' . $item->get_first_related('Term')->get('slug') . '"]'; |
|
145 | + $content = '[ESPRESSO_EVENTS category_slug="'.$item->get_first_related('Term')->get('slug').'"]'; |
|
146 | 146 | return $content; |
147 | 147 | } |
148 | 148 | |
149 | 149 | |
150 | 150 | |
151 | 151 | |
152 | - public function column_count( $item ) { |
|
152 | + public function column_count($item) { |
|
153 | 153 | $e_args = array( |
154 | 154 | 'action' => 'default', |
155 | 155 | 'EVT_CAT' => $item->get_first_related('Term')->ID() |
156 | 156 | ); |
157 | - $e_link = EE_Admin_Page::add_query_args_and_nonce( $e_args, EVENTS_ADMIN_URL ); |
|
158 | - $content = '<a href="' . $e_link . '">' . $item->get('term_count') . '</a>'; |
|
157 | + $e_link = EE_Admin_Page::add_query_args_and_nonce($e_args, EVENTS_ADMIN_URL); |
|
158 | + $content = '<a href="'.$e_link.'">'.$item->get('term_count').'</a>'; |
|
159 | 159 | return $content; |
160 | 160 | } |
161 | 161 | } |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -111,8 +111,8 @@ |
||
111 | 111 | $regs = $item->count_related('Registration'); |
112 | 112 | return $regs > 0 && $this->_view == 'trash' ? '<span class="ee-lock-icon"></span>' : sprintf( |
113 | 113 | '<input type="checkbox" name="EVT_IDs[]" value="%s" />', $item->ID() |
114 | - ); |
|
115 | - } |
|
114 | + ); |
|
115 | + } |
|
116 | 116 | |
117 | 117 | |
118 | 118 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | |
34 | 34 | private $_dtt; |
35 | 35 | |
36 | - public function __construct( $admin_page ) { |
|
36 | + public function __construct($admin_page) { |
|
37 | 37 | parent::__construct($admin_page); |
38 | - require_once( EE_HELPERS . 'EEH_DTT_Helper.helper.php' ); |
|
38 | + require_once(EE_HELPERS.'EEH_DTT_Helper.helper.php'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | protected function _setup_data() { |
42 | 42 | $this->_data = $this->_admin_page->get_events($this->_per_page, $this->_current_page); |
43 | - $this->_all_data_count = $this->_admin_page->get_events(0,0, TRUE); |
|
43 | + $this->_all_data_count = $this->_admin_page->get_events(0, 0, TRUE); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | protected function _set_properties() { |
@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | |
69 | 69 | |
70 | 70 | $this->_sortable_columns = array( |
71 | - 'id' => array( 'EVT_ID' => true ), |
|
72 | - 'name' => array( 'EVT_name' => false ), |
|
73 | - 'author' => array( 'EVT_wp_user' => false ), |
|
74 | - 'venue' => array( 'Venue.VNU_name' => false ), |
|
71 | + 'id' => array('EVT_ID' => true), |
|
72 | + 'name' => array('EVT_name' => false), |
|
73 | + 'author' => array('EVT_wp_user' => false), |
|
74 | + 'venue' => array('Venue.VNU_name' => false), |
|
75 | 75 | 'start_date_time' => array('Datetime.DTT_EVT_start' => false), |
76 | 76 | 'reg_begins' => array('Datetime.Ticket.TKT_start_date' => false), |
77 | 77 | ); |
78 | 78 | |
79 | - $this->_hidden_columns = array( 'author' ); |
|
79 | + $this->_hidden_columns = array('author'); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -91,15 +91,15 @@ discard block |
||
91 | 91 | protected function _add_view_counts() { |
92 | 92 | $this->_views['all']['count'] = $this->_admin_page->total_events(); |
93 | 93 | $this->_views['draft']['count'] = $this->_admin_page->total_events_draft(); |
94 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
94 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
95 | 95 | $this->_views['trash']['count'] = $this->_admin_page->total_trashed_events(); |
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | 99 | |
100 | 100 | |
101 | - public function column_status( EE_Event $item ) { |
|
102 | - return '<span class="ee-status-strip ee-status-strip-td event-status-' . $item->get_active_status() . '"></span>'; |
|
101 | + public function column_status(EE_Event $item) { |
|
102 | + return '<span class="ee-status-strip ee-status-strip-td event-status-'.$item->get_active_status().'"></span>'; |
|
103 | 103 | }/**/ |
104 | 104 | |
105 | 105 | |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | 'action' => 'edit', |
129 | 129 | 'post' => $item->ID() |
130 | 130 | ); |
131 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
132 | - $actions = $this->_column_name_action_setup( $item ); |
|
131 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
132 | + $actions = $this->_column_name_action_setup($item); |
|
133 | 133 | $status = ''; //$item->status() !== 'publish' ? ' (' . $item->status() . ')' : ''; |
134 | - $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' . $status; |
|
134 | + $content = '<strong><a class="row-title" href="'.$edit_link.'">'.$item->name().'</a></strong>'.$status; |
|
135 | 135 | $content .= $this->row_actions($actions); |
136 | 136 | return $content; |
137 | 137 | |
@@ -148,72 +148,72 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return array array of actions |
150 | 150 | */ |
151 | - protected function _column_name_action_setup( EE_Event $item ) { |
|
151 | + protected function _column_name_action_setup(EE_Event $item) { |
|
152 | 152 | //todo: remove when attendees is active |
153 | - if ( !defined('REG_ADMIN_URL') ) |
|
153 | + if ( ! defined('REG_ADMIN_URL')) |
|
154 | 154 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
155 | 155 | |
156 | 156 | $actions = array(); |
157 | 157 | |
158 | - if ( EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID() ) ) { |
|
158 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID())) { |
|
159 | 159 | $edit_query_args = array( |
160 | 160 | 'action' => 'edit', |
161 | 161 | 'post' => $item->ID() |
162 | 162 | ); |
163 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
164 | - $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Event', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>'; |
|
163 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
164 | + $actions['edit'] = '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Event', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'; |
|
165 | 165 | |
166 | 166 | } |
167 | 167 | |
168 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ) { |
|
168 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID())) { |
|
169 | 169 | $attendees_query_args = array( |
170 | 170 | 'action' => 'default', |
171 | 171 | 'event_id' => $item->ID() |
172 | 172 | ); |
173 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
174 | - $actions['attendees'] = '<a href="' . $attendees_link . '" title="' . esc_attr__('View Registrations', 'event_espresso') . '">' . __('Registrations', 'event_espresso') . '</a>'; |
|
173 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
174 | + $actions['attendees'] = '<a href="'.$attendees_link.'" title="'.esc_attr__('View Registrations', 'event_espresso').'">'.__('Registrations', 'event_espresso').'</a>'; |
|
175 | 175 | } |
176 | 176 | |
177 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_trash_event', $item->ID() ) ) { |
|
177 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_trash_event', $item->ID())) { |
|
178 | 178 | $trash_event_query_args = array( |
179 | 179 | 'action' => 'trash_event', |
180 | 180 | 'EVT_ID' => $item->ID() |
181 | 181 | ); |
182 | - $trash_event_link = EE_Admin_Page::add_query_args_and_nonce( $trash_event_query_args, EVENTS_ADMIN_URL ); |
|
182 | + $trash_event_link = EE_Admin_Page::add_query_args_and_nonce($trash_event_query_args, EVENTS_ADMIN_URL); |
|
183 | 183 | } |
184 | 184 | |
185 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_restore_event', $item->ID() ) ) { |
|
185 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_restore_event', $item->ID())) { |
|
186 | 186 | $restore_event_query_args = array( |
187 | 187 | 'action' => 'restore_event', |
188 | 188 | 'EVT_ID' => $item->ID() |
189 | 189 | ); |
190 | - $restore_event_link = EE_Admin_Page::add_query_args_and_nonce( $restore_event_query_args, EVENTS_ADMIN_URL ); |
|
190 | + $restore_event_link = EE_Admin_Page::add_query_args_and_nonce($restore_event_query_args, EVENTS_ADMIN_URL); |
|
191 | 191 | } |
192 | 192 | |
193 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_delete_event', $item->ID() ) ) { |
|
193 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_delete_event', $item->ID())) { |
|
194 | 194 | $delete_event_query_args = array( |
195 | 195 | 'action' => 'delete_event', |
196 | 196 | 'EVT_ID' => $item->ID() |
197 | 197 | ); |
198 | - $delete_event_link = EE_Admin_Page::add_query_args_and_nonce( $delete_event_query_args, EVENTS_ADMIN_URL ); |
|
198 | + $delete_event_link = EE_Admin_Page::add_query_args_and_nonce($delete_event_query_args, EVENTS_ADMIN_URL); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | $view_link = get_permalink($item->ID()); |
202 | 202 | |
203 | - $actions['view'] = '<a href="' . $view_link . '" title="' . esc_attr__('View Event', 'event_espresso') . '">' . __('View', 'event_espresso') . '</a>'; |
|
203 | + $actions['view'] = '<a href="'.$view_link.'" title="'.esc_attr__('View Event', 'event_espresso').'">'.__('View', 'event_espresso').'</a>'; |
|
204 | 204 | |
205 | - switch ( $item->get( 'status' ) ) { |
|
205 | + switch ($item->get('status')) { |
|
206 | 206 | case 'trash' : |
207 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_restore_event', $item->ID() ) ) { |
|
208 | - $actions['restore_from_trash'] = '<a href="' . $restore_event_link . '" title="' . esc_attr__('Restore from Trash', 'event_espresso') . '">' . __('Restore from Trash', 'event_espresso') . '</a>'; |
|
207 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_restore_event', $item->ID())) { |
|
208 | + $actions['restore_from_trash'] = '<a href="'.$restore_event_link.'" title="'.esc_attr__('Restore from Trash', 'event_espresso').'">'.__('Restore from Trash', 'event_espresso').'</a>'; |
|
209 | 209 | } |
210 | - if ( $item->count_related('Registration') === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_delete_event', $item->ID() ) ) { |
|
211 | - $actions['delete permanently'] = '<a href="' . $delete_event_link . '" title="' . esc_attr__('Delete Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
210 | + if ($item->count_related('Registration') === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_delete_event', $item->ID())) { |
|
211 | + $actions['delete permanently'] = '<a href="'.$delete_event_link.'" title="'.esc_attr__('Delete Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
212 | 212 | } |
213 | 213 | break; |
214 | 214 | default : |
215 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_trash_event', $item->ID() ) ) { |
|
216 | - $actions['move to trash'] = '<a href="' . $trash_event_link . '" title="' . esc_attr__('Trash Event', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
215 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_trash_event', $item->ID())) { |
|
216 | + $actions['move to trash'] = '<a href="'.$trash_event_link.'" title="'.esc_attr__('Trash Event', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | return $actions; |
@@ -222,34 +222,34 @@ discard block |
||
222 | 222 | |
223 | 223 | |
224 | 224 | |
225 | - public function column_author( EE_Event $item ) { |
|
225 | + public function column_author(EE_Event $item) { |
|
226 | 226 | //user author info |
227 | - $event_author = get_userdata( $item->wp_user() ); |
|
228 | - $gravatar = get_avatar( $item->wp_user(), '15' ); |
|
227 | + $event_author = get_userdata($item->wp_user()); |
|
228 | + $gravatar = get_avatar($item->wp_user(), '15'); |
|
229 | 229 | //filter link |
230 | 230 | $query_args = array( |
231 | 231 | 'action' => 'default', |
232 | 232 | 'EVT_wp_user' => $item->wp_user() |
233 | 233 | ); |
234 | - $filter_url = EE_Admin_Page::add_query_args_and_nonce( $query_args, EVENTS_ADMIN_URL ); |
|
235 | - return $gravatar . ' <a href="' . $filter_url . '" title="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">' . $event_author->display_name . '</a>'; |
|
234 | + $filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL); |
|
235 | + return $gravatar.' <a href="'.$filter_url.'" title="'.esc_attr__('Click to filter events by this author.', 'event_espresso').'">'.$event_author->display_name.'</a>'; |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
239 | 239 | |
240 | 240 | |
241 | 241 | public function column_venue($item) { |
242 | - $venue = $item->get_first_related( 'Venue' ); |
|
243 | - return !empty( $venue ) ? $venue->name() : ''; |
|
242 | + $venue = $item->get_first_related('Venue'); |
|
243 | + return ! empty($venue) ? $venue->name() : ''; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | |
247 | 247 | |
248 | 248 | |
249 | 249 | public function column_start_date_time($item) { |
250 | - echo !empty( $this->_dtt ) ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') : __('No Date was saved for this Event', 'event_espresso'); |
|
250 | + echo ! empty($this->_dtt) ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') : __('No Date was saved for this Event', 'event_espresso'); |
|
251 | 251 | //display in user's timezone? |
252 | - echo !empty( $this->_dtt ) ? $this->_dtt->display_in_my_timezone('DTT_EVT_start', 'get_i18n_datetime', '', 'My Timezone: ' ) : ''; |
|
252 | + echo ! empty($this->_dtt) ? $this->_dtt->display_in_my_timezone('DTT_EVT_start', 'get_i18n_datetime', '', 'My Timezone: ') : ''; |
|
253 | 253 | |
254 | 254 | } |
255 | 255 | |
@@ -258,9 +258,9 @@ discard block |
||
258 | 258 | |
259 | 259 | public function column_reg_begins($item) { |
260 | 260 | $reg_start = $item->get_ticket_with_earliest_start_time(); |
261 | - echo !empty( $reg_start ) ? $reg_start->get_i18n_datetime('TKT_start_date') : __('No Tickets have been setup for this Event', 'event_espresso'); |
|
261 | + echo ! empty($reg_start) ? $reg_start->get_i18n_datetime('TKT_start_date') : __('No Tickets have been setup for this Event', 'event_espresso'); |
|
262 | 262 | //display in user's timezone? |
263 | - echo !empty( $reg_start ) ? $reg_start->display_in_my_timezone('TKT_start_date', 'get_i18n_datetime', '', 'My Timezone: ' ) : '';/**/ |
|
263 | + echo ! empty($reg_start) ? $reg_start->display_in_my_timezone('TKT_start_date', 'get_i18n_datetime', '', 'My Timezone: ') : ''; /**/ |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
@@ -278,51 +278,51 @@ discard block |
||
278 | 278 | 'action' => 'default', |
279 | 279 | 'event_id' => $item->ID() |
280 | 280 | ); |
281 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
282 | - $registered_attendees = EEM_Registration::instance()->get_event_registration_count( $item->ID() ); |
|
283 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>' : $registered_attendees; |
|
281 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
282 | + $registered_attendees = EEM_Registration::instance()->get_event_registration_count($item->ID()); |
|
283 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$attendees_link.'">'.$registered_attendees.'</a>' : $registered_attendees; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | |
287 | 287 | |
288 | 288 | public function column_tkts_sold($item) { |
289 | - return EEM_Ticket::instance()->sum(array( array('Datetime.EVT_ID' => $item->ID() )), 'TKT_sold' ); |
|
289 | + return EEM_Ticket::instance()->sum(array(array('Datetime.EVT_ID' => $item->ID())), 'TKT_sold'); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | |
293 | 293 | |
294 | 294 | public function column_actions($item) { |
295 | 295 | //todo: remove when attendees is active |
296 | - if ( !defined('REG_ADMIN_URL') ) |
|
296 | + if ( ! defined('REG_ADMIN_URL')) |
|
297 | 297 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
298 | 298 | $actionlinks = array(); |
299 | 299 | |
300 | 300 | $view_link = get_permalink($item->ID()); |
301 | 301 | |
302 | - $actionlinks[] = '<a href="' . $view_link . '" title="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">'; |
|
302 | + $actionlinks[] = '<a href="'.$view_link.'" title="'.esc_attr__('View Event', 'event_espresso').'" target="_blank">'; |
|
303 | 303 | $actionlinks[] = '<div class="dashicons dashicons-search"></div></a>'; |
304 | 304 | |
305 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $item->ID() ) ) { |
|
305 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID())) { |
|
306 | 306 | $edit_query_args = array( |
307 | 307 | 'action' => 'edit', |
308 | 308 | 'post' => $item->ID() |
309 | 309 | ); |
310 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
311 | - $actionlinks[] = '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Event', 'event_espresso') . '"><div class="ee-icon ee-icon-calendar-edit"></div></a>'; |
|
310 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
311 | + $actionlinks[] = '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Event', 'event_espresso').'"><div class="ee-icon ee-icon-calendar-edit"></div></a>'; |
|
312 | 312 | } |
313 | 313 | |
314 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ) { |
|
314 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID())) { |
|
315 | 315 | $attendees_query_args = array( |
316 | 316 | 'action' => 'default', |
317 | 317 | 'event_id' => $item->ID() |
318 | 318 | ); |
319 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
320 | - $actionlinks[] = '<a href="' . $attendees_link . '" title="' . esc_attr__('View Registrants', 'event_espresso') . '"><div class="dashicons dashicons-groups"></div></a>'; |
|
319 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
320 | + $actionlinks[] = '<a href="'.$attendees_link.'" title="'.esc_attr__('View Registrants', 'event_espresso').'"><div class="dashicons dashicons-groups"></div></a>'; |
|
321 | 321 | } |
322 | 322 | |
323 | - $actionlinks = apply_filters( 'FHEE__Events_Admin_List_Table__column_actions__action_links', $actionlinks, $item ); |
|
323 | + $actionlinks = apply_filters('FHEE__Events_Admin_List_Table__column_actions__action_links', $actionlinks, $item); |
|
324 | 324 | |
325 | - return $this->_action_string( implode( "\n\t", $actionlinks ), $item, 'div' ); |
|
325 | + return $this->_action_string(implode("\n\t", $actionlinks), $item, 'div'); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -150,8 +151,9 @@ discard block |
||
150 | 151 | */ |
151 | 152 | protected function _column_name_action_setup( EE_Event $item ) { |
152 | 153 | //todo: remove when attendees is active |
153 | - if ( !defined('REG_ADMIN_URL') ) |
|
154 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
154 | + if ( !defined('REG_ADMIN_URL') ) { |
|
155 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
156 | + } |
|
155 | 157 | |
156 | 158 | $actions = array(); |
157 | 159 | |
@@ -293,8 +295,9 @@ discard block |
||
293 | 295 | |
294 | 296 | public function column_actions($item) { |
295 | 297 | //todo: remove when attendees is active |
296 | - if ( !defined('REG_ADMIN_URL') ) |
|
297 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
298 | + if ( !defined('REG_ADMIN_URL') ) { |
|
299 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
300 | + } |
|
298 | 301 | $actionlinks = array(); |
299 | 302 | |
300 | 303 | $view_link = get_permalink($item->ID()); |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -871,8 +872,9 @@ discard block |
||
871 | 872 | $venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL; |
872 | 873 | |
873 | 874 | //very important. If we don't have a venue name then we'll get out because not necessary to create empty venue |
874 | - if ( empty( $data['venue_title'] ) ) |
|
875 | - return; |
|
875 | + if ( empty( $data['venue_title'] ) ) { |
|
876 | + return; |
|
877 | + } |
|
876 | 878 | |
877 | 879 | $venue_array = array( |
878 | 880 | 'VNU_wp_user' => $evtobj->get('EVT_wp_user'), |
@@ -1194,7 +1196,9 @@ discard block |
||
1194 | 1196 | |
1195 | 1197 | |
1196 | 1198 | //if no postid then get out cause we need it for stuff in here |
1197 | - if ( empty( $postid ) ) return; |
|
1199 | + if ( empty( $postid ) ) { |
|
1200 | + return; |
|
1201 | + } |
|
1198 | 1202 | |
1199 | 1203 | |
1200 | 1204 | //handle datetime saves |
@@ -1436,10 +1440,11 @@ discard block |
||
1436 | 1440 | //get the earliest datetime (if present); |
1437 | 1441 | $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
1438 | 1442 | |
1439 | - if ( !empty( $earliest_dtt ) ) |
|
1440 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
|
1441 | - else |
|
1442 | - $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1443 | + if ( !empty( $earliest_dtt ) ) { |
|
1444 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
|
1445 | + } else { |
|
1446 | + $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1447 | + } |
|
1443 | 1448 | } |
1444 | 1449 | |
1445 | 1450 | $template_args = array_merge( $template_args, $price_args ); |
@@ -1715,8 +1720,9 @@ discard block |
||
1715 | 1720 | } |
1716 | 1721 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1717 | 1722 | |
1718 | - if ( $redirect_after ) |
|
1719 | - $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
1723 | + if ( $redirect_after ) { |
|
1724 | + $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
1725 | + } |
|
1720 | 1726 | } |
1721 | 1727 | |
1722 | 1728 | /** |
@@ -1841,8 +1847,9 @@ discard block |
||
1841 | 1847 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1842 | 1848 | } |
1843 | 1849 | |
1844 | - if ( $redirect_after ) |
|
1845 | - $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
|
1850 | + if ( $redirect_after ) { |
|
1851 | + $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
|
1852 | + } |
|
1846 | 1853 | } |
1847 | 1854 | |
1848 | 1855 | /** |
@@ -2074,8 +2081,10 @@ discard block |
||
2074 | 2081 | * @return void |
2075 | 2082 | */ |
2076 | 2083 | private function _set_category_object() { |
2077 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
2078 | - return; //already have the category object so get out. |
|
2084 | + if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) { |
|
2085 | + return; |
|
2086 | + } |
|
2087 | + //already have the category object so get out. |
|
2079 | 2088 | |
2080 | 2089 | //set default category object |
2081 | 2090 | $this->_set_empty_category_object(); |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | * Handles saving everything related to Tickets (datetimes, tickets, prices) |
917 | 917 | * @param EE_Event $evtobj The Event object we're attaching data to |
918 | 918 | * @param array $data The request data from the form |
919 | - * @return bool success or fail |
|
919 | + * @return boolean|null success or fail |
|
920 | 920 | */ |
921 | 921 | protected function _default_tickets_update( $evtobj, $data ) { |
922 | 922 | $success = TRUE; |
@@ -1251,7 +1251,7 @@ discard block |
||
1251 | 1251 | * This just returns whatever is set as the _event object property |
1252 | 1252 | * |
1253 | 1253 | * //todo this will become obsolete once the models are in place |
1254 | - * @return object |
|
1254 | + * @return EE_CPT_Base |
|
1255 | 1255 | */ |
1256 | 1256 | public function get_event_object() { |
1257 | 1257 | return $this->_cpt_model_obj; |
@@ -1707,9 +1707,8 @@ discard block |
||
1707 | 1707 | * _trash_or_restore_events |
1708 | 1708 | * |
1709 | 1709 | * @access private |
1710 | - * @param int $event_id |
|
1711 | 1710 | * @param string $event_status |
1712 | - * @return void |
|
1711 | + * @return boolean |
|
1713 | 1712 | */ |
1714 | 1713 | private function _change_event_status($EVT_ID = FALSE, $event_status = FALSE) { |
1715 | 1714 | // grab event id |
@@ -1829,7 +1828,7 @@ discard block |
||
1829 | 1828 | * |
1830 | 1829 | * @access private |
1831 | 1830 | * @param int $EVT_ID |
1832 | - * @return void |
|
1831 | + * @return boolean |
|
1833 | 1832 | */ |
1834 | 1833 | private function _permanently_delete_event($EVT_ID = FALSE) { |
1835 | 1834 | // grab event id |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 'espresso_events' => 'edit' |
68 | 68 | ); |
69 | 69 | |
70 | - add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) ); |
|
70 | + add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | protected function _ajax_hooks() { |
@@ -93,20 +93,20 @@ discard block |
||
93 | 93 | 'edit' => __('Update Event', 'event_espresso'), |
94 | 94 | 'add_category' => __('Save New Category', 'event_espresso'), |
95 | 95 | 'edit_category' => __('Update Category', 'event_espresso'), |
96 | - 'template_settings' => __( 'Update Settings', 'event_espresso' ) |
|
96 | + 'template_settings' => __('Update Settings', 'event_espresso') |
|
97 | 97 | ) |
98 | 98 | ); |
99 | 99 | } |
100 | 100 | |
101 | 101 | protected function _set_page_routes() { |
102 | 102 | //load formatter helper |
103 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
103 | + EE_Registry::instance()->load_helper('Formatter'); |
|
104 | 104 | //load field generator helper |
105 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
105 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
106 | 106 | |
107 | 107 | //is there a evt_id in the request? |
108 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0; |
|
109 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
108 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0; |
|
109 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
110 | 110 | |
111 | 111 | |
112 | 112 | $this->_page_routes = array( |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | 'help_tour' => array( |
321 | 321 | 'Event_Editor_Help_Tour' |
322 | 322 | ), |
323 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
323 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
324 | 324 | 'require_nonce' => FALSE |
325 | 325 | ), |
326 | 326 | 'edit' => array( |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | 'help_tour' => array( |
377 | 377 | 'Event_Edit_Help_Tour' |
378 | 378 | ), |
379 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
379 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
380 | 380 | 'require_nonce' => FALSE |
381 | 381 | ), |
382 | 382 | 'default_event_settings' => array( |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | 'filename' => 'events_default_settings_status' |
399 | 399 | ) |
400 | 400 | ), |
401 | - 'help_tour' => array( 'Event_Default_Settings_Help_Tour'), |
|
401 | + 'help_tour' => array('Event_Default_Settings_Help_Tour'), |
|
402 | 402 | 'require_nonce' => FALSE |
403 | 403 | ), |
404 | 404 | //template settings |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | 'filename' => 'general_settings_templates' |
415 | 415 | ) |
416 | 416 | ), |
417 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
417 | + 'help_tour' => array('Templates_Help_Tour'), |
|
418 | 418 | 'require_nonce' => FALSE |
419 | 419 | ), |
420 | 420 | //event category stuff |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | 'label' => __('Edit Category', 'event_espresso'), |
439 | 439 | 'order' => 15, |
440 | 440 | 'persistent' => FALSE, |
441 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
441 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
442 | 442 | ), |
443 | 443 | 'help_tabs' => array( |
444 | 444 | 'edit_category_help_tab' => array( |
@@ -508,14 +508,14 @@ discard block |
||
508 | 508 | |
509 | 509 | public function load_scripts_styles() { |
510 | 510 | |
511 | - wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
512 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
511 | + wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
512 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
513 | 513 | wp_enqueue_style('events-admin-css'); |
514 | 514 | wp_enqueue_style('ee-cat-admin'); |
515 | 515 | //todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details |
516 | 516 | //registers for all views |
517 | 517 | //scripts |
518 | - wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE); |
|
518 | + wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | /** |
@@ -533,11 +533,11 @@ discard block |
||
533 | 533 | public function load_scripts_styles_edit() { |
534 | 534 | //styles |
535 | 535 | wp_enqueue_style('espresso-ui-theme'); |
536 | - wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
536 | + wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
537 | 537 | wp_enqueue_style('event-editor-css'); |
538 | 538 | |
539 | 539 | //scripts |
540 | - wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION ); |
|
540 | + wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION); |
|
541 | 541 | wp_enqueue_script('event-datetime-metabox'); |
542 | 542 | |
543 | 543 | EE_Registry::$i18n_js_strings['image_confirm'] = __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso'); |
@@ -590,35 +590,35 @@ discard block |
||
590 | 590 | */ |
591 | 591 | public function verify_event_edit($event = NULL) { |
592 | 592 | // no event? |
593 | - if ( empty( $event )) { |
|
593 | + if (empty($event)) { |
|
594 | 594 | // set event |
595 | 595 | $event = $this->_cpt_model_obj; |
596 | 596 | } |
597 | 597 | // STILL no event? |
598 | - if ( empty ( $event )) { |
|
598 | + if (empty ($event)) { |
|
599 | 599 | return; |
600 | 600 | } |
601 | 601 | // first check if event is active. |
602 | - if ( $event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed ) { |
|
602 | + if ($event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed) { |
|
603 | 603 | return; |
604 | 604 | } |
605 | 605 | $orig_status = $event->status(); |
606 | 606 | //made it here so it IS active... next check that any of the tickets are sold. |
607 | - if ( $event->is_sold_out() || $event->is_sold_out(TRUE ) ) { |
|
608 | - if ( $event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out ) { |
|
609 | - EE_Error::add_attention( sprintf( |
|
610 | - __( 'Please note that the Event Status has automaticallly been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You <em>can</em> change the status back to something else before updating if you wish.', 'event_espresso' ), |
|
611 | - EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' ) |
|
607 | + if ($event->is_sold_out() || $event->is_sold_out(TRUE)) { |
|
608 | + if ($event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out) { |
|
609 | + EE_Error::add_attention(sprintf( |
|
610 | + __('Please note that the Event Status has automaticallly been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You <em>can</em> change the status back to something else before updating if you wish.', 'event_espresso'), |
|
611 | + EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence') |
|
612 | 612 | )); |
613 | 613 | } |
614 | 614 | return; |
615 | 615 | } |
616 | 616 | //now we need to determine if the event has any tickets on sale. If not then we dont' show the error |
617 | - if ( ! $event->tickets_on_sale() ) { |
|
617 | + if ( ! $event->tickets_on_sale()) { |
|
618 | 618 | return; |
619 | 619 | } |
620 | 620 | //made it here so show warning |
621 | - EE_Error::add_attention( $this->_edit_event_warning() ); |
|
621 | + EE_Error::add_attention($this->_edit_event_warning()); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | ), |
659 | 659 | ); |
660 | 660 | |
661 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
661 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
662 | 662 | $this->_views['trash'] = array( |
663 | 663 | 'slug' => 'trash', |
664 | 664 | 'label' => __('Trash', 'event_espresso'), |
@@ -688,39 +688,39 @@ discard block |
||
688 | 688 | 'desc' => __('View Registrations for Event', 'event_espresso') |
689 | 689 | ) |
690 | 690 | ); |
691 | - $items = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items ); |
|
691 | + $items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items); |
|
692 | 692 | $statuses = array( |
693 | 693 | 'sold_out_status' => array( |
694 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out, |
|
695 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' ) |
|
694 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out, |
|
695 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence') |
|
696 | 696 | ), |
697 | 697 | 'active_status' => array( |
698 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active, |
|
699 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' ) |
|
698 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active, |
|
699 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence') |
|
700 | 700 | ), |
701 | 701 | 'upcoming_status' => array( |
702 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming, |
|
703 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' ) |
|
702 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming, |
|
703 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence') |
|
704 | 704 | ), |
705 | 705 | 'postponed_status' => array( |
706 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed, |
|
707 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' ) |
|
706 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed, |
|
707 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence') |
|
708 | 708 | ), |
709 | 709 | 'cancelled_status' => array( |
710 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled, |
|
711 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' ) |
|
710 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled, |
|
711 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence') |
|
712 | 712 | ), |
713 | 713 | 'expired_status' => array( |
714 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired, |
|
715 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' ) |
|
714 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired, |
|
715 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence') |
|
716 | 716 | ), |
717 | 717 | 'inactive_status' => array( |
718 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive, |
|
719 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' ) |
|
718 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive, |
|
719 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence') |
|
720 | 720 | ) |
721 | 721 | ); |
722 | - $statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses ); |
|
723 | - return array_merge( $items, $statuses ); |
|
722 | + $statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses); |
|
723 | + return array_merge($items, $statuses); |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | |
@@ -732,8 +732,8 @@ discard block |
||
732 | 732 | * @return EEM_Event |
733 | 733 | */ |
734 | 734 | private function _event_model() { |
735 | - if ( ! $this->_event_model instanceof EEM_Event ) { |
|
736 | - $this->_event_model = EE_Registry::instance()->load_model( 'Event' ); |
|
735 | + if ( ! $this->_event_model instanceof EEM_Event) { |
|
736 | + $this->_event_model = EE_Registry::instance()->load_model('Event'); |
|
737 | 737 | } |
738 | 738 | return $this->_event_model; |
739 | 739 | } |
@@ -752,12 +752,12 @@ discard block |
||
752 | 752 | * @param string $new_slug what the slug is |
753 | 753 | * @return string The new html string for the permalink area |
754 | 754 | */ |
755 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
755 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
756 | 756 | //make sure this is only when editing |
757 | - if ( !empty( $id ) ) { |
|
758 | - $post = get_post( $id ); |
|
759 | - $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> '; |
|
760 | - $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=\'' . $post->ID . '\']"">'; |
|
757 | + if ( ! empty($id)) { |
|
758 | + $post = get_post($id); |
|
759 | + $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> '; |
|
760 | + $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=\''.$post->ID.'\']"">'; |
|
761 | 761 | } |
762 | 762 | return $return; |
763 | 763 | } |
@@ -773,8 +773,8 @@ discard block |
||
773 | 773 | * @return string html for generated table |
774 | 774 | */ |
775 | 775 | protected function _events_overview_list_table() { |
776 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
777 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button' ) . |
|
776 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
777 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button'). |
|
778 | 778 | $this->_display_legend($this->_event_legend_items()); |
779 | 779 | $this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
780 | 780 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -792,46 +792,46 @@ discard block |
||
792 | 792 | |
793 | 793 | |
794 | 794 | |
795 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
795 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
796 | 796 | |
797 | 797 | $event_values = array( |
798 | - 'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0, |
|
799 | - 'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0, |
|
798 | + 'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0, |
|
799 | + 'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0, |
|
800 | 800 | 'EVT_additional_limit' => min( |
801 | - apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ), |
|
802 | - !empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ), |
|
803 | - 'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID, |
|
804 | - 'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0, |
|
805 | - 'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0, |
|
806 | - 'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL, |
|
807 | - 'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL, |
|
808 | - 'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL |
|
801 | + apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255), |
|
802 | + ! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ), |
|
803 | + 'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID, |
|
804 | + 'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0, |
|
805 | + 'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0, |
|
806 | + 'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL, |
|
807 | + 'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL, |
|
808 | + 'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL |
|
809 | 809 | ); |
810 | 810 | |
811 | 811 | //update event |
812 | - $success = $this->_event_model()->update_by_ID( $event_values, $post_id ); |
|
812 | + $success = $this->_event_model()->update_by_ID($event_values, $post_id); |
|
813 | 813 | |
814 | 814 | |
815 | 815 | //get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
816 | - $get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
817 | - $event = $this->_event_model()->get_one( array($get_one_where) ); |
|
816 | + $get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
817 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
818 | 818 | |
819 | 819 | |
820 | 820 | //the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons. |
821 | - $event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) ); |
|
821 | + $event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update'))); |
|
822 | 822 | |
823 | 823 | $att_success = TRUE; |
824 | 824 | |
825 | - foreach ( $event_update_callbacks as $e_callback ) { |
|
826 | - $_succ = call_user_func_array( $e_callback, array( $event, $this->_req_data ) ); |
|
827 | - $att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
825 | + foreach ($event_update_callbacks as $e_callback) { |
|
826 | + $_succ = call_user_func_array($e_callback, array($event, $this->_req_data)); |
|
827 | + $att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
828 | 828 | } |
829 | 829 | |
830 | 830 | //any errors? |
831 | - if ( $success && FALSE === $att_success ) { |
|
832 | - EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
833 | - } else if ( $success === FALSE ) { |
|
834 | - EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
831 | + if ($success && FALSE === $att_success) { |
|
832 | + EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
833 | + } else if ($success === FALSE) { |
|
834 | + EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
835 | 835 | } |
836 | 836 | } |
837 | 837 | |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | /** |
842 | 842 | * @see parent::restore_item() |
843 | 843 | */ |
844 | - protected function _restore_cpt_item( $post_id, $revision_id ) { |
|
844 | + protected function _restore_cpt_item($post_id, $revision_id) { |
|
845 | 845 | //copy existing event meta to new post |
846 | 846 | $post_evt = $this->_event_model()->get_one_by_ID($post_id); |
847 | 847 | |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | $post_evt->restore_revision($revision_id); |
850 | 850 | |
851 | 851 | //related objs restore |
852 | - $post_evt->restore_revision($revision_id, array( 'Venue', 'Datetime', 'Price' ) ); |
|
852 | + $post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price')); |
|
853 | 853 | } |
854 | 854 | |
855 | 855 | |
@@ -861,50 +861,50 @@ discard block |
||
861 | 861 | * @param array $data The request data from the form |
862 | 862 | * @return bool Success or fail. |
863 | 863 | */ |
864 | - protected function _default_venue_update( $evtobj, $data ) { |
|
865 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
864 | + protected function _default_venue_update($evtobj, $data) { |
|
865 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
866 | 866 | $venue_model = EE_Registry::instance()->load_model('Venue'); |
867 | 867 | $rows_affected = NULL; |
868 | - $venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL; |
|
868 | + $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL; |
|
869 | 869 | |
870 | 870 | //very important. If we don't have a venue name then we'll get out because not necessary to create empty venue |
871 | - if ( empty( $data['venue_title'] ) ) |
|
871 | + if (empty($data['venue_title'])) |
|
872 | 872 | return; |
873 | 873 | |
874 | 874 | $venue_array = array( |
875 | 875 | 'VNU_wp_user' => $evtobj->get('EVT_wp_user'), |
876 | - 'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL, |
|
877 | - 'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL, |
|
878 | - 'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL, |
|
879 | - 'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL, |
|
880 | - 'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL, |
|
881 | - 'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL, |
|
882 | - 'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL, |
|
883 | - 'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL, |
|
884 | - 'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL, |
|
885 | - 'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL, |
|
886 | - 'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL, |
|
887 | - 'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL, |
|
888 | - 'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL, |
|
889 | - 'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL, |
|
890 | - 'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL, |
|
891 | - 'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0, |
|
876 | + 'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL, |
|
877 | + 'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL, |
|
878 | + 'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL, |
|
879 | + 'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL, |
|
880 | + 'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL, |
|
881 | + 'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL, |
|
882 | + 'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL, |
|
883 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL, |
|
884 | + 'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL, |
|
885 | + 'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL, |
|
886 | + 'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL, |
|
887 | + 'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL, |
|
888 | + 'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL, |
|
889 | + 'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL, |
|
890 | + 'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL, |
|
891 | + 'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0, |
|
892 | 892 | 'status' => 'publish' |
893 | 893 | ); |
894 | 894 | |
895 | 895 | |
896 | 896 | //if we've got the venue_id then we're just updating the existing venue so let's do that and then get out. |
897 | - if ( !empty( $venue_id ) ) { |
|
898 | - $update_where = array( $venue_model->primary_key_name() => $venue_id ); |
|
899 | - $rows_affected = $venue_model->update( $venue_array, array( $update_where ) ); |
|
897 | + if ( ! empty($venue_id)) { |
|
898 | + $update_where = array($venue_model->primary_key_name() => $venue_id); |
|
899 | + $rows_affected = $venue_model->update($venue_array, array($update_where)); |
|
900 | 900 | //we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present. |
901 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
901 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
902 | 902 | return $rows_affected > 0 ? TRUE : FALSE; |
903 | 903 | } else { |
904 | 904 | //we insert the venue |
905 | - $venue_id = $venue_model->insert( $venue_array ); |
|
906 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
907 | - return !empty( $venue_id ) ? TRUE : FALSE; |
|
905 | + $venue_id = $venue_model->insert($venue_array); |
|
906 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
907 | + return ! empty($venue_id) ? TRUE : FALSE; |
|
908 | 908 | } |
909 | 909 | return TRUE; //when we have the ancestor come in it's already been handled by the revision save. |
910 | 910 | } |
@@ -918,41 +918,41 @@ discard block |
||
918 | 918 | * @param array $data The request data from the form |
919 | 919 | * @return bool success or fail |
920 | 920 | */ |
921 | - protected function _default_tickets_update( $evtobj, $data ) { |
|
921 | + protected function _default_tickets_update($evtobj, $data) { |
|
922 | 922 | $success = TRUE; |
923 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
924 | - $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
923 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
924 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
925 | 925 | $datetime_values = array( |
926 | - 'DTT_ID' => !empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL, |
|
926 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL, |
|
927 | 927 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
928 | 928 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
929 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? INF : $dtt['DTT_reg_limit'], |
|
929 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? INF : $dtt['DTT_reg_limit'], |
|
930 | 930 | 'DTT_order' => $row, |
931 | 931 | ); |
932 | 932 | |
933 | 933 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
934 | 934 | |
935 | - if ( !empty( $dtt['DTT_ID'] ) ) { |
|
936 | - $DTM = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($dtt['DTT_ID'] ); |
|
937 | - foreach ( $datetime_values as $field => $value ) { |
|
938 | - $DTM->set( $field, $value ); |
|
935 | + if ( ! empty($dtt['DTT_ID'])) { |
|
936 | + $DTM = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($dtt['DTT_ID']); |
|
937 | + foreach ($datetime_values as $field => $value) { |
|
938 | + $DTM->set($field, $value); |
|
939 | 939 | } |
940 | 940 | |
941 | 941 | $DTM->save(); |
942 | 942 | //make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. We need to do this so we dont' TRASH the parent DTT. |
943 | 943 | $saved_dtts[$DTM->ID()] = $DTM; |
944 | 944 | } else { |
945 | - $DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE ); |
|
945 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE); |
|
946 | 946 | } |
947 | 947 | |
948 | - $DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' ); |
|
948 | + $DTT = $evtobj->_add_relation_to($DTM, 'Datetime'); |
|
949 | 949 | |
950 | 950 | //load DTT helper |
951 | 951 | EE_Registry::instance()->load_helper('DTT_Helper'); |
952 | 952 | |
953 | 953 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
954 | - if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) { |
|
955 | - $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') ); |
|
954 | + if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) { |
|
955 | + $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start')); |
|
956 | 956 | $DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days'); |
957 | 957 | $DTT->save(); |
958 | 958 | } |
@@ -960,29 +960,29 @@ discard block |
||
960 | 960 | //now we got to make sure we add the new DTT_ID to the $saved_dtts array because it is possible there was a new one created for the autosave. |
961 | 961 | $saved_dtt = $DTT; |
962 | 962 | |
963 | - $success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
963 | + $success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
964 | 964 | } |
965 | 965 | |
966 | 966 | //no dtts get deleted so we don't do any of that logic here. |
967 | 967 | //update tickets next |
968 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array(); |
|
969 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
968 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
969 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
970 | 970 | $update_prices = false; |
971 | - $ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
971 | + $ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
972 | 972 | |
973 | 973 | $TKT_values = array( |
974 | - 'TKT_ID' => !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL, |
|
975 | - 'TTM_ID' => !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
976 | - 'TKT_name' => !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
977 | - 'TKT_description' => !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '', |
|
978 | - 'TKT_start_date' => isset( $tkt['TKT_start_date'] ) ? $tkt['TKT_start_date'] : current_time('mysql'), |
|
979 | - 'TKT_end_date' => isset( $tkt['TKT_end_date'] ) ? $tkt['TKT_end_date'] : current_time('mysql'), |
|
980 | - 'TKT_qty' => empty( $tkt['TKT_qty'] ) ? INF : $tkt['TKT_qty'], |
|
981 | - 'TKT_uses' => empty( $tkt['TKT_uses'] ) ? INF : $tkt['TKT_uses'], |
|
982 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
983 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? INF : $tkt['TKT_max'], |
|
974 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL, |
|
975 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
976 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
977 | + 'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '', |
|
978 | + 'TKT_start_date' => isset($tkt['TKT_start_date']) ? $tkt['TKT_start_date'] : current_time('mysql'), |
|
979 | + 'TKT_end_date' => isset($tkt['TKT_end_date']) ? $tkt['TKT_end_date'] : current_time('mysql'), |
|
980 | + 'TKT_qty' => empty($tkt['TKT_qty']) ? INF : $tkt['TKT_qty'], |
|
981 | + 'TKT_uses' => empty($tkt['TKT_uses']) ? INF : $tkt['TKT_uses'], |
|
982 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
983 | + 'TKT_max' => empty($tkt['TKT_max']) ? INF : $tkt['TKT_max'], |
|
984 | 984 | 'TKT_row' => $row, |
985 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row, |
|
985 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row, |
|
986 | 986 | 'TKT_price' => $ticket_price |
987 | 987 | ); |
988 | 988 | |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | |
991 | 991 | |
992 | 992 | //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well. |
993 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
993 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
994 | 994 | $TKT_values['TKT_ID'] = 0; |
995 | 995 | $TKT_values['TKT_is_default'] = 0; |
996 | 996 | $TKT_values['TKT_price'] = $ticket_price; |
@@ -1001,22 +1001,22 @@ discard block |
||
1001 | 1001 | //we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified. |
1002 | 1002 | //keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
1003 | 1003 | |
1004 | - if ( !empty( $tkt['TKT_ID'] ) ) { |
|
1005 | - $TKT = EE_Registry::instance()->load_model( 'Ticket')->get_one_by_ID( $tkt['TKT_ID'] ); |
|
1004 | + if ( ! empty($tkt['TKT_ID'])) { |
|
1005 | + $TKT = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($tkt['TKT_ID']); |
|
1006 | 1006 | |
1007 | 1007 | |
1008 | - $ticket_sold = $TKT->count_related('Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false; |
|
1008 | + $ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false; |
|
1009 | 1009 | |
1010 | 1010 | //let's just check the total price for the existing ticket and determine if it matches the new total price. if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket. |
1011 | - $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && !$TKT->get('TKT_deleted') ? TRUE : FALSE; |
|
1011 | + $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? TRUE : FALSE; |
|
1012 | 1012 | |
1013 | 1013 | //set new values |
1014 | - foreach ( $TKT_values as $field => $value ) { |
|
1015 | - $TKT->set( $field, $value ); |
|
1014 | + foreach ($TKT_values as $field => $value) { |
|
1015 | + $TKT->set($field, $value); |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
1019 | - if ( $create_new_TKT ) { |
|
1019 | + if ($create_new_TKT) { |
|
1020 | 1020 | //archive the old ticket first |
1021 | 1021 | $TKT->set('TKT_deleted', 1); |
1022 | 1022 | $TKT->save(); |
@@ -1027,22 +1027,22 @@ discard block |
||
1027 | 1027 | |
1028 | 1028 | //create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it. |
1029 | 1029 | $TKT = clone $TKT; |
1030 | - $TKT->set( 'TKT_ID', 0 ); |
|
1031 | - $TKT->set( 'TKT_deleted', 0 ); |
|
1032 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1033 | - $TKT->set( 'TKT_sold', 0 ); |
|
1030 | + $TKT->set('TKT_ID', 0); |
|
1031 | + $TKT->set('TKT_deleted', 0); |
|
1032 | + $TKT->set('TKT_price', $ticket_price); |
|
1033 | + $TKT->set('TKT_sold', 0); |
|
1034 | 1034 | |
1035 | 1035 | //now we need to make sure that $new prices are created as well and attached to new ticket. |
1036 | 1036 | $update_prices = TRUE; |
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | //make sure price is set if it hasn't been already |
1040 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1040 | + $TKT->set('TKT_price', $ticket_price); |
|
1041 | 1041 | |
1042 | 1042 | } else { |
1043 | 1043 | //no TKT_id so a new TKT |
1044 | 1044 | $TKT_values['TKT_price'] = $ticket_price; |
1045 | - $TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE ); |
|
1045 | + $TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE); |
|
1046 | 1046 | $update_prices = TRUE; |
1047 | 1047 | } |
1048 | 1048 | |
@@ -1050,27 +1050,27 @@ discard block |
||
1050 | 1050 | $TKT->save(); |
1051 | 1051 | |
1052 | 1052 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
1053 | - if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) { |
|
1054 | - $TKT->set('TKT_end_date', $TKT->get('TKT_start_date') ); |
|
1053 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
1054 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
1055 | 1055 | EE_Registry::instance()->load_helper('DTT_Helper'); |
1056 | 1056 | $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
1057 | 1057 | $TKT->save(); |
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | //initially let's add the ticket to the dtt |
1061 | - $saved_dtt->_add_relation_to( $TKT, 'Ticket' ); |
|
1061 | + $saved_dtt->_add_relation_to($TKT, 'Ticket'); |
|
1062 | 1062 | |
1063 | 1063 | $saved_tickets[$TKT->ID()] = $TKT; |
1064 | 1064 | |
1065 | 1065 | //add prices to ticket |
1066 | - $this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices ); |
|
1066 | + $this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices); |
|
1067 | 1067 | } |
1068 | 1068 | //however now we need to handle permanantly deleting tickets via the ui. Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold. However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanantely because there is no need to save in db. |
1069 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1070 | - $tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) ); |
|
1069 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1070 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
1071 | 1071 | |
1072 | - foreach ( $tickets_removed as $id ) { |
|
1073 | - $id = absint( $id ); |
|
1072 | + foreach ($tickets_removed as $id) { |
|
1073 | + $id = absint($id); |
|
1074 | 1074 | |
1075 | 1075 | //get the ticket for this id |
1076 | 1076 | $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | //need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold) |
1079 | 1079 | $dtts = $tkt_to_remove->get_many_related('Datetime'); |
1080 | 1080 | |
1081 | - foreach( $dtts as $dtt ) { |
|
1081 | + foreach ($dtts as $dtt) { |
|
1082 | 1082 | $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
1083 | 1083 | } |
1084 | 1084 | |
@@ -1103,31 +1103,31 @@ discard block |
||
1103 | 1103 | * @param bool $new_prices Whether attach existing incoming prices or create new ones. |
1104 | 1104 | * @return void |
1105 | 1105 | */ |
1106 | - private function _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) { |
|
1107 | - foreach ( $prices as $row => $prc ) { |
|
1106 | + private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) { |
|
1107 | + foreach ($prices as $row => $prc) { |
|
1108 | 1108 | $PRC_values = array( |
1109 | - 'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL, |
|
1110 | - 'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL, |
|
1111 | - 'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
1112 | - 'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
1113 | - 'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
1109 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL, |
|
1110 | + 'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL, |
|
1111 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
1112 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
1113 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
1114 | 1114 | 'PRC_is_default' => 0, //make sure prices are NOT set as default from this context |
1115 | 1115 | 'PRC_order' => $row |
1116 | 1116 | ); |
1117 | 1117 | |
1118 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
1118 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
1119 | 1119 | $PRC_values['PRC_ID'] = 0; |
1120 | - $PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE); |
|
1120 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE); |
|
1121 | 1121 | } else { |
1122 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
1122 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
1123 | 1123 | //update this price with new values |
1124 | - foreach ( $PRC_values as $field => $newprc ) { |
|
1125 | - $PRC->set( $field, $newprc ); |
|
1124 | + foreach ($PRC_values as $field => $newprc) { |
|
1125 | + $PRC->set($field, $newprc); |
|
1126 | 1126 | } |
1127 | 1127 | $PRC->save(); |
1128 | 1128 | } |
1129 | 1129 | |
1130 | - $PRC = $ticket->_add_relation_to( $PRC, 'Price' ); |
|
1130 | + $PRC = $ticket->_add_relation_to($PRC, 'Price'); |
|
1131 | 1131 | } |
1132 | 1132 | } |
1133 | 1133 | |
@@ -1150,33 +1150,33 @@ discard block |
||
1150 | 1150 | |
1151 | 1151 | return; //TEMPORARILY EXITING CAUSE THIS IS A TODO |
1152 | 1152 | |
1153 | - $postid = isset( $this->_req_data['post_ID'] ) ? $this->_req_data['post_ID'] : NULL; |
|
1153 | + $postid = isset($this->_req_data['post_ID']) ? $this->_req_data['post_ID'] : NULL; |
|
1154 | 1154 | |
1155 | 1155 | |
1156 | 1156 | //if no postid then get out cause we need it for stuff in here |
1157 | - if ( empty( $postid ) ) return; |
|
1157 | + if (empty($postid)) return; |
|
1158 | 1158 | |
1159 | 1159 | |
1160 | 1160 | //handle datetime saves |
1161 | 1161 | $items = array(); |
1162 | 1162 | |
1163 | - $get_one_where = array( $this->_event_model()->primary_key_name() => $postid ); |
|
1164 | - $event = $this->_event_model()->get_one( array($get_one_where) ); |
|
1163 | + $get_one_where = array($this->_event_model()->primary_key_name() => $postid); |
|
1164 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
1165 | 1165 | |
1166 | 1166 | //now let's get the attached datetimes from the most recent autosave |
1167 | 1167 | $dtts = $event->get_many_related('Datetime'); |
1168 | 1168 | |
1169 | 1169 | $dtt_ids = array(); |
1170 | - foreach( $dtts as $dtt ) { |
|
1170 | + foreach ($dtts as $dtt) { |
|
1171 | 1171 | $dtt_ids[] = $dtt->ID(); |
1172 | 1172 | $order = $dtt->order(); |
1173 | 1173 | $this->_template_args['data']['items']['ID-'.$order] = $dtt->ID(); |
1174 | 1174 | } |
1175 | - $this->_template_args['data']['items']['datetime_IDS'] = serialize( $dtt_ids ); |
|
1175 | + $this->_template_args['data']['items']['datetime_IDS'] = serialize($dtt_ids); |
|
1176 | 1176 | |
1177 | 1177 | //handle DECAF venues |
1178 | 1178 | //we need to make sure that the venue_id gets updated in the form so that future autosaves will properly conntect that venue to the event. |
1179 | - if ( $do_venue_autosaves = apply_filters( 'FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE ) ) { |
|
1179 | + if ($do_venue_autosaves = apply_filters('FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE)) { |
|
1180 | 1180 | $venue = $event->get_first_related('Venue'); |
1181 | 1181 | $this->_template_args['data']['items']['venue-id'] = $venue->ID(); |
1182 | 1182 | } |
@@ -1187,23 +1187,23 @@ discard block |
||
1187 | 1187 | |
1188 | 1188 | $ticket_ids = array(); |
1189 | 1189 | $price_ids = array(); |
1190 | - foreach ( $tickets as $ticket ) { |
|
1190 | + foreach ($tickets as $ticket) { |
|
1191 | 1191 | $ticket_ids[] = $price->ID(); |
1192 | 1192 | $ticket_order = $price->get('TKT_order'); |
1193 | - $this->_template_args['data']['items']['edit-ticket-id-' . $ticket_order] = $ticket->ID(); |
|
1194 | - $this->_template_args['data']['items']['edit-ticket-event-id-' . $order] = $event->ID(); |
|
1193 | + $this->_template_args['data']['items']['edit-ticket-id-'.$ticket_order] = $ticket->ID(); |
|
1194 | + $this->_template_args['data']['items']['edit-ticket-event-id-'.$order] = $event->ID(); |
|
1195 | 1195 | |
1196 | 1196 | //now we have to make sure the prices are updated appropriately |
1197 | 1197 | $prices = $ticket->get_many_related('Prices'); |
1198 | 1198 | |
1199 | - foreach ( $prices as $price ) { |
|
1199 | + foreach ($prices as $price) { |
|
1200 | 1200 | $price_ids[] = $price->ID(); |
1201 | 1201 | $price_order = $price->get('PRC_order'); |
1202 | - $this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-' . $ticket_order . '-' . $price_order] = $price->ID(); |
|
1203 | - $this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-' . $ticket_row . '-' . $price_row] = $price->ID(); |
|
1204 | - $this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-' . $ticket_row . '-' . $price_row] = $price->get('PRC_is_default'); |
|
1202 | + $this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-'.$ticket_order.'-'.$price_order] = $price->ID(); |
|
1203 | + $this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-'.$ticket_row.'-'.$price_row] = $price->ID(); |
|
1204 | + $this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-'.$ticket_row.'-'.$price_row] = $price->get('PRC_is_default'); |
|
1205 | 1205 | } |
1206 | - $this->_template_args['data']['items']['price-IDs-ticketrow-' . $ticket_row] = implode(',', $price_ids); |
|
1206 | + $this->_template_args['data']['items']['price-IDs-ticketrow-'.$ticket_row] = implode(',', $price_ids); |
|
1207 | 1207 | } |
1208 | 1208 | $this->_template_args['data']['items']['ticket-IDs'] = implode(',', $ticket_ids); |
1209 | 1209 | } |
@@ -1221,26 +1221,26 @@ discard block |
||
1221 | 1221 | private function _generate_publish_box_extra_content() { |
1222 | 1222 | |
1223 | 1223 | //load formatter helper |
1224 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1224 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1225 | 1225 | |
1226 | 1226 | //args for getting related registrations |
1227 | - $approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) ); |
|
1228 | - $not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) ); |
|
1229 | - $pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) ); |
|
1227 | + $approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved)); |
|
1228 | + $not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved)); |
|
1229 | + $pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment)); |
|
1230 | 1230 | |
1231 | 1231 | |
1232 | 1232 | // publish box |
1233 | - $publish_box_extra_args['view_approved_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_approved ), REG_ADMIN_URL); |
|
1234 | - $publish_box_extra_args['view_not_approved_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_not_approved ), REG_ADMIN_URL); |
|
1235 | - $publish_box_extra_args['view_pending_payment_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_pending_payment ), REG_ADMIN_URL); |
|
1233 | + $publish_box_extra_args['view_approved_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_approved), REG_ADMIN_URL); |
|
1234 | + $publish_box_extra_args['view_not_approved_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_not_approved), REG_ADMIN_URL); |
|
1235 | + $publish_box_extra_args['view_pending_payment_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_pending_payment), REG_ADMIN_URL); |
|
1236 | 1236 | $publish_box_extra_args['approved_regs'] = $this->_cpt_model_obj->count_related('Registration', $approved_query_args); |
1237 | 1237 | $publish_box_extra_args['not_approved_regs'] = $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args); |
1238 | 1238 | $publish_box_extra_args['pending_payment_regs'] = $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args); |
1239 | - $publish_box_extra_args['misc_pub_section_class'] = apply_filters( 'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class', 'misc-pub-section'); |
|
1239 | + $publish_box_extra_args['misc_pub_section_class'] = apply_filters('FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class', 'misc-pub-section'); |
|
1240 | 1240 | //$publish_box_extra_args['email_attendees_url'] = add_query_arg(array('event_admin_reports' => 'event_newsletter', 'event_id' => $this->_cpt_model_obj->id), 'admin.php?page=espresso_registrations'); |
1241 | - $publish_box_extra_args['event_editor_overview_add'] = do_action( 'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add', $this->_cpt_model_obj ); |
|
1241 | + $publish_box_extra_args['event_editor_overview_add'] = do_action('AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add', $this->_cpt_model_obj); |
|
1242 | 1242 | // load template |
1243 | - EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args ); |
|
1243 | + EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args); |
|
1244 | 1244 | } |
1245 | 1245 | |
1246 | 1246 | |
@@ -1272,7 +1272,7 @@ discard block |
||
1272 | 1272 | $this->verify_cpt_object(); |
1273 | 1273 | add_meta_box('espresso_event_editor_tickets', __('Event Datetime & Ticket', 'event_espresso'), array($this, 'ticket_metabox'), $this->page_slug, 'normal', 'high'); |
1274 | 1274 | add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array($this, 'registration_options_meta_box'), $this->page_slug, 'side', 'default'); |
1275 | - add_meta_box('espresso_event_editor_venue', __('Venue Details', 'event_espresso'), array( $this, 'venue_metabox' ), $this->page_slug, 'normal', 'core'); |
|
1275 | + add_meta_box('espresso_event_editor_venue', __('Venue Details', 'event_espresso'), array($this, 'venue_metabox'), $this->page_slug, 'normal', 'core'); |
|
1276 | 1276 | //note if you're looking for other metaboxes in here, where a metabox has a related management page in the admin you will find it setup in the related management page's "_Hooks" file. i.e. messages metabox is found in "espresso_events_Messages_Hooks.class.php". |
1277 | 1277 | } |
1278 | 1278 | |
@@ -1297,53 +1297,53 @@ discard block |
||
1297 | 1297 | 'disabled' => '' |
1298 | 1298 | ); |
1299 | 1299 | |
1300 | - $event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL; |
|
1300 | + $event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL; |
|
1301 | 1301 | |
1302 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1302 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1303 | 1303 | |
1304 | 1304 | /** |
1305 | 1305 | * 1. Start with retrieving Datetimes |
1306 | 1306 | * 2. Fore each datetime get related tickets |
1307 | 1307 | * 3. For each ticket get related prices |
1308 | 1308 | */ |
1309 | - $times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id ); |
|
1310 | - EE_Registry::instance()->load_helper('DTT_Helper' ); |
|
1309 | + $times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id); |
|
1310 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
1311 | 1311 | |
1312 | 1312 | $firstdtt = array_slice($times, 0, 1); |
1313 | 1313 | //do we get related tickets? |
1314 | - if ( $firstdtt[0]->get('DTT_ID') !== 0 ) { |
|
1315 | - foreach ( $times as $time ) { |
|
1314 | + if ($firstdtt[0]->get('DTT_ID') !== 0) { |
|
1315 | + foreach ($times as $time) { |
|
1316 | 1316 | $existing_datetime_ids[] = $time->get('DTT_ID'); |
1317 | 1317 | $template_args['time'] = $time; |
1318 | - $related_tickets = $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none' ) ); |
|
1318 | + $related_tickets = $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none')); |
|
1319 | 1319 | |
1320 | - if ( !empty($related_tickets) ) { |
|
1320 | + if ( ! empty($related_tickets)) { |
|
1321 | 1321 | $template_args['total_ticket_rows'] = count($related_tickets); |
1322 | 1322 | $row = 0; |
1323 | - foreach ( $related_tickets as $ticket ) { |
|
1323 | + foreach ($related_tickets as $ticket) { |
|
1324 | 1324 | $existing_ticket_ids[] = $ticket->get('TKT_ID'); |
1325 | - $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row ); |
|
1325 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row); |
|
1326 | 1326 | |
1327 | 1327 | $row++; |
1328 | 1328 | } |
1329 | 1329 | } else { |
1330 | 1330 | $template_args['total_ticket_rows'] = 1; |
1331 | 1331 | $ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object(); |
1332 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket ); |
|
1332 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket); |
|
1333 | 1333 | } |
1334 | 1334 | } |
1335 | 1335 | } else { |
1336 | 1336 | $template_args['time'] = $times[0]; |
1337 | 1337 | $ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
1338 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] ); //note we're just sending the first default row (decaf can't manage default tickets so this should be sufficent); |
|
1338 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]); //note we're just sending the first default row (decaf can't manage default tickets so this should be sufficent); |
|
1339 | 1339 | } |
1340 | 1340 | |
1341 | 1341 | $template_args['event_datetime_help_link'] = $this->_get_help_tab_link('event_editor_event_datetimes_help_tab'); |
1342 | 1342 | $template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info'); |
1343 | 1343 | $template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
1344 | 1344 | $template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
1345 | - $template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE ); |
|
1346 | - $template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' ); |
|
1345 | + $template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE); |
|
1346 | + $template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'); |
|
1347 | 1347 | EEH_Template::display_template($template, $template_args); |
1348 | 1348 | } |
1349 | 1349 | |
@@ -1357,21 +1357,21 @@ discard block |
||
1357 | 1357 | * @param boolean $skeleton whether we're generating a skeleton for js manipulation |
1358 | 1358 | * @return string generated html for the ticket row. |
1359 | 1359 | */ |
1360 | - private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) { |
|
1360 | + private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) { |
|
1361 | 1361 | $template_args = array( |
1362 | - 'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(), |
|
1363 | - 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '', |
|
1362 | + 'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(), |
|
1363 | + 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '', |
|
1364 | 1364 | 'ticketrow' => $skeleton ? 'TICKETNUM' : $row, |
1365 | 1365 | 'TKT_ID' => $ticket->get('TKT_ID'), |
1366 | 1366 | 'TKT_name' => $ticket->get('TKT_name'), |
1367 | 1367 | 'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'), |
1368 | 1368 | 'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'), |
1369 | 1369 | 'TKT_is_default' => $ticket->get('TKT_is_default'), |
1370 | - 'TKT_qty' => $ticket->get_pretty('TKT_qty','input'), |
|
1370 | + 'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'), |
|
1371 | 1371 | 'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets', |
1372 | 1372 | 'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'), |
1373 | - 'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
|
1374 | - 'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled' |
|
1373 | + 'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
|
1374 | + 'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled' |
|
1375 | 1375 | ); |
1376 | 1376 | |
1377 | 1377 | $price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object(); |
@@ -1387,23 +1387,23 @@ discard block |
||
1387 | 1387 | |
1388 | 1388 | //make sure we have default start and end dates if skeleton |
1389 | 1389 | //handle rows that should NOT be empty |
1390 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1390 | + if (empty($template_args['TKT_start_date'])) { |
|
1391 | 1391 | //if empty then the start date will be now. |
1392 | 1392 | $template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp')); |
1393 | 1393 | } |
1394 | 1394 | |
1395 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1395 | + if (empty($template_args['TKT_end_date'])) { |
|
1396 | 1396 | //get the earliest datetime (if present); |
1397 | - $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
|
1397 | + $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL; |
|
1398 | 1398 | |
1399 | - if ( !empty( $earliest_dtt ) ) |
|
1399 | + if ( ! empty($earliest_dtt)) |
|
1400 | 1400 | $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
1401 | 1401 | else |
1402 | - $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1402 | + $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y"))); |
|
1403 | 1403 | } |
1404 | 1404 | |
1405 | - $template_args = array_merge( $template_args, $price_args ); |
|
1406 | - $template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket); |
|
1405 | + $template_args = array_merge($template_args, $price_args); |
|
1406 | + $template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket); |
|
1407 | 1407 | return EEH_Template::display_template($template, $template_args, TRUE); |
1408 | 1408 | } |
1409 | 1409 | |
@@ -1416,7 +1416,7 @@ discard block |
||
1416 | 1416 | array('id' => false, 'text' => __('No', 'event_espresso')) |
1417 | 1417 | ); |
1418 | 1418 | |
1419 | - $default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete ), TRUE); |
|
1419 | + $default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete), TRUE); |
|
1420 | 1420 | |
1421 | 1421 | //$template_args['is_active_select'] = EEH_Form_Fields::select_input('is_active', $yes_no_values, $this->_cpt_model_obj->is_active()); |
1422 | 1422 | $template_args['_event'] = $this->_cpt_model_obj; |
@@ -1425,8 +1425,8 @@ discard block |
||
1425 | 1425 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
1426 | 1426 | $template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description()); |
1427 | 1427 | $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false); |
1428 | - $template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values ); |
|
1429 | - $templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php'; |
|
1428 | + $template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values); |
|
1429 | + $templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php'; |
|
1430 | 1430 | EEH_Template::display_template($templatepath, $template_args); |
1431 | 1431 | } |
1432 | 1432 | |
@@ -1440,14 +1440,14 @@ discard block |
||
1440 | 1440 | |
1441 | 1441 | //first let's see if we have a venue already |
1442 | 1442 | $event_id = $this->_cpt_model_obj->ID(); |
1443 | - $venue = !empty( $event_id ) ? $this->_cpt_model_obj->venues() : NULL; |
|
1444 | - $venue = empty( $venue ) ? EE_Registry::instance()->load_model('Venue')->create_default_object() : array_shift( $venue ); |
|
1443 | + $venue = ! empty($event_id) ? $this->_cpt_model_obj->venues() : NULL; |
|
1444 | + $venue = empty($venue) ? EE_Registry::instance()->load_model('Venue')->create_default_object() : array_shift($venue); |
|
1445 | 1445 | $template_args['_venue'] = $venue; |
1446 | 1446 | |
1447 | 1447 | $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
1448 | 1448 | $QFI = new EE_Question_Form_Input( |
1449 | - EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )), |
|
1450 | - EE_Answer::new_instance( array( 'ANS_value'=> $venue->state_ID() )), |
|
1449 | + EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')), |
|
1450 | + EE_Answer::new_instance(array('ANS_value'=> $venue->state_ID())), |
|
1451 | 1451 | array( |
1452 | 1452 | 'input_name' => 'state', |
1453 | 1453 | 'input_id' => 'phys-state', |
@@ -1459,8 +1459,8 @@ discard block |
||
1459 | 1459 | ); |
1460 | 1460 | $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
1461 | 1461 | $QFI = new EE_Question_Form_Input( |
1462 | - EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )), |
|
1463 | - EE_Answer::new_instance( array( 'ANS_value'=> $venue->country_ID() )), |
|
1462 | + EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')), |
|
1463 | + EE_Answer::new_instance(array('ANS_value'=> $venue->country_ID())), |
|
1464 | 1464 | array( |
1465 | 1465 | 'input_name' => 'countries', |
1466 | 1466 | 'input_id' => 'phys-country', |
@@ -1471,8 +1471,8 @@ discard block |
||
1471 | 1471 | ) |
1472 | 1472 | ); |
1473 | 1473 | |
1474 | - $template_path = EVENTS_TEMPLATE_PATH . 'event_venues_metabox_content.template.php'; |
|
1475 | - EEH_Template::display_template( $template_path, $template_args ); |
|
1474 | + $template_path = EVENTS_TEMPLATE_PATH.'event_venues_metabox_content.template.php'; |
|
1475 | + EEH_Template::display_template($template_path, $template_args); |
|
1476 | 1476 | } |
1477 | 1477 | |
1478 | 1478 | |
@@ -1499,21 +1499,21 @@ discard block |
||
1499 | 1499 | $EEME = $this->_event_model(); |
1500 | 1500 | |
1501 | 1501 | $offset = ($current_page - 1) * $per_page; |
1502 | - $limit = $count ? NULL : $offset . ',' . $per_page; |
|
1502 | + $limit = $count ? NULL : $offset.','.$per_page; |
|
1503 | 1503 | $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID'; |
1504 | 1504 | $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC"; |
1505 | 1505 | |
1506 | 1506 | if (isset($this->_req_data['month_range'])) { |
1507 | 1507 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
1508 | - $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1509 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
1508 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1509 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | $where = array(); |
1513 | 1513 | |
1514 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
1514 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
1515 | 1515 | //determine what post_status our condition will have for the query. |
1516 | - switch ( $status ) { |
|
1516 | + switch ($status) { |
|
1517 | 1517 | case 'month' : |
1518 | 1518 | case 'today' : |
1519 | 1519 | case NULL : |
@@ -1521,7 +1521,7 @@ discard block |
||
1521 | 1521 | break; |
1522 | 1522 | |
1523 | 1523 | case 'draft' : |
1524 | - $where['status'] = array( 'IN', array('draft', 'auto-draft') ); |
|
1524 | + $where['status'] = array('IN', array('draft', 'auto-draft')); |
|
1525 | 1525 | break; |
1526 | 1526 | |
1527 | 1527 | default : |
@@ -1529,46 +1529,46 @@ discard block |
||
1529 | 1529 | } |
1530 | 1530 | |
1531 | 1531 | //categories? |
1532 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
1532 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
1533 | 1533 | |
1534 | - if ( !empty ( $category ) ) { |
|
1534 | + if ( ! empty ($category)) { |
|
1535 | 1535 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
1536 | 1536 | $where['Term_Taxonomy.term_id'] = $category; |
1537 | 1537 | } |
1538 | 1538 | |
1539 | 1539 | //date where conditions |
1540 | 1540 | if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') { |
1541 | - $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( strtotime($year_r . '-' . $month_r . '-01 00:00:00'), strtotime($year_r . '-' . $month_r . '-31 23:59:59' ) ) ); |
|
1541 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array(strtotime($year_r.'-'.$month_r.'-01 00:00:00'), strtotime($year_r.'-'.$month_r.'-31 23:59:59'))); |
|
1542 | 1542 | } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') { |
1543 | - $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( strtotime(date('Y-m-d') . ' 0:00:00'), strtotime(date('Y-m-d') . ' 23:59:59') ) ); |
|
1544 | - } else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) { |
|
1543 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array(strtotime(date('Y-m-d').' 0:00:00'), strtotime(date('Y-m-d').' 23:59:59'))); |
|
1544 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') { |
|
1545 | 1545 | $this_year_r = date('Y'); |
1546 | 1546 | $this_month_r = date('m'); |
1547 | 1547 | $days_this_month = date('t'); |
1548 | 1548 | $start = ' 00:00:00'; |
1549 | 1549 | $end = ' 23:59:59'; |
1550 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( strtotime($this_year_r . '-' . $this_month_r . '-01' . $start), strtotime($this_year_r . '-' . $this_month_r . '-' . $days_this_month . $end) ) ); |
|
1550 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array(strtotime($this_year_r.'-'.$this_month_r.'-01'.$start), strtotime($this_year_r.'-'.$this_month_r.'-'.$days_this_month.$end))); |
|
1551 | 1551 | } |
1552 | 1552 | |
1553 | 1553 | //possible conditions for capability checks |
1554 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events') ) { |
|
1555 | - $where['status**'] = array( '!=', 'private' ); |
|
1554 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
1555 | + $where['status**'] = array('!=', 'private'); |
|
1556 | 1556 | } |
1557 | 1557 | |
1558 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1559 | - $where['EVT_wp_user'] = get_current_user_id(); |
|
1558 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1559 | + $where['EVT_wp_user'] = get_current_user_id(); |
|
1560 | 1560 | } |
1561 | 1561 | |
1562 | - if ( isset( $this->_req_data['EVT_wp_user'] ) ) { |
|
1563 | - if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1562 | + if (isset($this->_req_data['EVT_wp_user'])) { |
|
1563 | + if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1564 | 1564 | $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user']; |
1565 | 1565 | } |
1566 | 1566 | } |
1567 | 1567 | |
1568 | 1568 | |
1569 | 1569 | //search query handling |
1570 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1571 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1570 | + if (isset($this->_req_data['s'])) { |
|
1571 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1572 | 1572 | $where['OR'] = array( |
1573 | 1573 | 'EVT_name' => array('LIKE', $search_string), |
1574 | 1574 | 'EVT_desc' => array('LIKE', $search_string), |
@@ -1577,32 +1577,32 @@ discard block |
||
1577 | 1577 | } |
1578 | 1578 | |
1579 | 1579 | |
1580 | - $where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data ); |
|
1581 | - $query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data ); |
|
1580 | + $where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data); |
|
1581 | + $query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data); |
|
1582 | 1582 | |
1583 | 1583 | |
1584 | 1584 | //let's first check if we have special requests coming in. |
1585 | - if ( isset( $this->_req_data['active_status'] ) ) { |
|
1586 | - switch ( $this->_req_data['active_status'] ) { |
|
1585 | + if (isset($this->_req_data['active_status'])) { |
|
1586 | + switch ($this->_req_data['active_status']) { |
|
1587 | 1587 | case 'upcoming' : |
1588 | - return $EEME->get_upcoming_events( $query_params, $count ); |
|
1588 | + return $EEME->get_upcoming_events($query_params, $count); |
|
1589 | 1589 | break; |
1590 | 1590 | |
1591 | 1591 | case 'expired' : |
1592 | - return $EEME->get_expired_events( $query_params, $count ); |
|
1592 | + return $EEME->get_expired_events($query_params, $count); |
|
1593 | 1593 | break; |
1594 | 1594 | |
1595 | 1595 | case 'active' : |
1596 | - return $EEME->get_active_events( $query_params, $count ); |
|
1596 | + return $EEME->get_active_events($query_params, $count); |
|
1597 | 1597 | break; |
1598 | 1598 | |
1599 | 1599 | case 'inactive' : |
1600 | - return $EEME->get_inactive_events( $query_params, $count ); |
|
1600 | + return $EEME->get_inactive_events($query_params, $count); |
|
1601 | 1601 | break; |
1602 | 1602 | } |
1603 | 1603 | } |
1604 | 1604 | |
1605 | - $events = $count ? $EEME->count( array( $where ), 'EVT_ID' ) : $EEME->get_all( $query_params ); |
|
1605 | + $events = $count ? $EEME->count(array($where), 'EVT_ID') : $EEME->get_all($query_params); |
|
1606 | 1606 | |
1607 | 1607 | return $events; |
1608 | 1608 | } |
@@ -1611,23 +1611,23 @@ discard block |
||
1611 | 1611 | |
1612 | 1612 | |
1613 | 1613 | //handling for WordPress CPT actions (trash, restore, delete) |
1614 | - public function trash_cpt_item( $post_id ) { |
|
1614 | + public function trash_cpt_item($post_id) { |
|
1615 | 1615 | $this->_req_data['EVT_ID'] = $post_id; |
1616 | - $this->_trash_or_restore_event( 'trash', FALSE ); |
|
1616 | + $this->_trash_or_restore_event('trash', FALSE); |
|
1617 | 1617 | } |
1618 | 1618 | |
1619 | 1619 | |
1620 | 1620 | |
1621 | 1621 | |
1622 | - public function restore_cpt_item( $post_id ) { |
|
1622 | + public function restore_cpt_item($post_id) { |
|
1623 | 1623 | $this->_req_data['EVT_ID'] = $post_id; |
1624 | - $this->_trash_or_restore_event( 'draft', FALSE ); |
|
1624 | + $this->_trash_or_restore_event('draft', FALSE); |
|
1625 | 1625 | } |
1626 | 1626 | |
1627 | 1627 | |
1628 | - public function delete_cpt_item( $post_id ) { |
|
1628 | + public function delete_cpt_item($post_id) { |
|
1629 | 1629 | $this->_req_data['EVT_ID'] = $post_id; |
1630 | - $this->_delete_event( FALSE ); |
|
1630 | + $this->_delete_event(FALSE); |
|
1631 | 1631 | } |
1632 | 1632 | |
1633 | 1633 | |
@@ -1639,7 +1639,7 @@ discard block |
||
1639 | 1639 | * @param string $event_status |
1640 | 1640 | * @return void |
1641 | 1641 | */ |
1642 | - protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) { |
|
1642 | + protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) { |
|
1643 | 1643 | //determine the event id and set to array. |
1644 | 1644 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE; |
1645 | 1645 | // loop thru events |
@@ -1647,7 +1647,7 @@ discard block |
||
1647 | 1647 | // clean status |
1648 | 1648 | $event_status = sanitize_key($event_status); |
1649 | 1649 | // grab status |
1650 | - if (!empty($event_status)) { |
|
1650 | + if ( ! empty($event_status)) { |
|
1651 | 1651 | $success = $this->_change_event_status($EVT_ID, $event_status); |
1652 | 1652 | } else { |
1653 | 1653 | $success = FALSE; |
@@ -1661,7 +1661,7 @@ discard block |
||
1661 | 1661 | } |
1662 | 1662 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1663 | 1663 | |
1664 | - if ( $redirect_after ) |
|
1664 | + if ($redirect_after) |
|
1665 | 1665 | $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
1666 | 1666 | } |
1667 | 1667 | |
@@ -1676,7 +1676,7 @@ discard block |
||
1676 | 1676 | // clean status |
1677 | 1677 | $event_status = sanitize_key($event_status); |
1678 | 1678 | // grab status |
1679 | - if (!empty($event_status)) { |
|
1679 | + if ( ! empty($event_status)) { |
|
1680 | 1680 | $success = TRUE; |
1681 | 1681 | //determine the event id and set to array. |
1682 | 1682 | $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
@@ -1713,13 +1713,13 @@ discard block |
||
1713 | 1713 | */ |
1714 | 1714 | private function _change_event_status($EVT_ID = FALSE, $event_status = FALSE) { |
1715 | 1715 | // grab event id |
1716 | - if (!$EVT_ID) { |
|
1716 | + if ( ! $EVT_ID) { |
|
1717 | 1717 | $msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso'); |
1718 | 1718 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1719 | 1719 | return FALSE; |
1720 | 1720 | } |
1721 | 1721 | |
1722 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1722 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1723 | 1723 | |
1724 | 1724 | // clean status |
1725 | 1725 | $event_status = sanitize_key($event_status); |
@@ -1745,7 +1745,7 @@ discard block |
||
1745 | 1745 | $hook = FALSE; |
1746 | 1746 | } |
1747 | 1747 | //use class to change status |
1748 | - $this->_cpt_model_obj->set_status( $event_status ); |
|
1748 | + $this->_cpt_model_obj->set_status($event_status); |
|
1749 | 1749 | $success = $this->_cpt_model_obj->save(); |
1750 | 1750 | |
1751 | 1751 | if ($success === FALSE) { |
@@ -1765,15 +1765,15 @@ discard block |
||
1765 | 1765 | * @access protected |
1766 | 1766 | * @return void |
1767 | 1767 | */ |
1768 | - protected function _delete_event( $redirect_after = TRUE ) { |
|
1768 | + protected function _delete_event($redirect_after = TRUE) { |
|
1769 | 1769 | //determine the event id and set to array. |
1770 | 1770 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL; |
1771 | - $EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID; |
|
1771 | + $EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID; |
|
1772 | 1772 | |
1773 | 1773 | |
1774 | 1774 | // loop thru events |
1775 | 1775 | if ($EVT_ID) { |
1776 | - $success = $this->_permanently_delete_event( $EVT_ID ); |
|
1776 | + $success = $this->_permanently_delete_event($EVT_ID); |
|
1777 | 1777 | // get list of events with no prices |
1778 | 1778 | $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
1779 | 1779 | // remove this event from the list of events with no prices |
@@ -1787,7 +1787,7 @@ discard block |
||
1787 | 1787 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1788 | 1788 | } |
1789 | 1789 | |
1790 | - if ( $redirect_after ) |
|
1790 | + if ($redirect_after) |
|
1791 | 1791 | $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
1792 | 1792 | } |
1793 | 1793 | |
@@ -1833,7 +1833,7 @@ discard block |
||
1833 | 1833 | */ |
1834 | 1834 | private function _permanently_delete_event($EVT_ID = FALSE) { |
1835 | 1835 | // grab event id |
1836 | - if (!$EVT_ID = absint($EVT_ID)) { |
|
1836 | + if ( ! $EVT_ID = absint($EVT_ID)) { |
|
1837 | 1837 | $msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso'); |
1838 | 1838 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1839 | 1839 | return FALSE; |
@@ -1844,10 +1844,10 @@ discard block |
||
1844 | 1844 | |
1845 | 1845 | //need to delete related tickets and prices first. |
1846 | 1846 | $datetimes = $this->_cpt_model_obj->get_many_related('Datetime'); |
1847 | - foreach ( $datetimes as $datetime ) { |
|
1847 | + foreach ($datetimes as $datetime) { |
|
1848 | 1848 | $this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime'); |
1849 | 1849 | $tickets = $datetime->get_many_related('Ticket'); |
1850 | - foreach ( $tickets as $ticket ) { |
|
1850 | + foreach ($tickets as $ticket) { |
|
1851 | 1851 | $ticket->_remove_relation_to($datetime, 'Datetime'); |
1852 | 1852 | $ticket->delete_related_permanently('Price'); |
1853 | 1853 | $ticket->delete_permanently(); |
@@ -1857,14 +1857,14 @@ discard block |
||
1857 | 1857 | |
1858 | 1858 | //what about related venues or terms? |
1859 | 1859 | $venues = $this->_cpt_model_obj->get_many_related('Venue'); |
1860 | - foreach ( $venues as $venue ) { |
|
1860 | + foreach ($venues as $venue) { |
|
1861 | 1861 | $this->_cpt_model_obj->_remove_relation_to($venue, 'Venue'); |
1862 | 1862 | } |
1863 | 1863 | |
1864 | 1864 | //any attached question groups? |
1865 | 1865 | $question_groups = $this->_cpt_model_obj->get_many_related('Question_Group'); |
1866 | - if ( !empty( $question_groups ) ) { |
|
1867 | - foreach ( $question_groups as $question_group ) { |
|
1866 | + if ( ! empty($question_groups)) { |
|
1867 | + foreach ($question_groups as $question_group) { |
|
1868 | 1868 | $this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group'); |
1869 | 1869 | } |
1870 | 1870 | } |
@@ -1873,13 +1873,13 @@ discard block |
||
1873 | 1873 | |
1874 | 1874 | |
1875 | 1875 | //Message Template Groups |
1876 | - $this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' ); |
|
1876 | + $this->_cpt_model_obj->_remove_relations('Message_Template_Group'); |
|
1877 | 1877 | |
1878 | 1878 | |
1879 | 1879 | //term taxonomies |
1880 | 1880 | $term_taxonomies = $this->_cpt_model_obj->term_taxonomies(); |
1881 | 1881 | |
1882 | - foreach ( $term_taxonomies as $term_taxonomy ) { |
|
1882 | + foreach ($term_taxonomies as $term_taxonomy) { |
|
1883 | 1883 | $this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy); |
1884 | 1884 | } |
1885 | 1885 | |
@@ -1893,7 +1893,7 @@ discard block |
||
1893 | 1893 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1894 | 1894 | return FALSE; |
1895 | 1895 | } |
1896 | - do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted' ); |
|
1896 | + do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted'); |
|
1897 | 1897 | return TRUE; |
1898 | 1898 | } |
1899 | 1899 | |
@@ -1910,7 +1910,7 @@ discard block |
||
1910 | 1910 | */ |
1911 | 1911 | public function total_events() { |
1912 | 1912 | |
1913 | - $count = EEM_Event::instance()->count( array(), 'EVT_ID' ); |
|
1913 | + $count = EEM_Event::instance()->count(array(), 'EVT_ID'); |
|
1914 | 1914 | return $count; |
1915 | 1915 | } |
1916 | 1916 | |
@@ -1925,10 +1925,10 @@ discard block |
||
1925 | 1925 | */ |
1926 | 1926 | public function total_events_draft() { |
1927 | 1927 | $where = array( |
1928 | - 'status' => array( 'IN', array('draft', 'auto-draft' ) ) |
|
1928 | + 'status' => array('IN', array('draft', 'auto-draft')) |
|
1929 | 1929 | ); |
1930 | 1930 | |
1931 | - $count = EEM_Event::instance()->count( array( $where ), 'EVT_ID' ); |
|
1931 | + $count = EEM_Event::instance()->count(array($where), 'EVT_ID'); |
|
1932 | 1932 | return $count; |
1933 | 1933 | } |
1934 | 1934 | |
@@ -1947,7 +1947,7 @@ discard block |
||
1947 | 1947 | 'status' => 'trash' |
1948 | 1948 | ); |
1949 | 1949 | |
1950 | - $count = EEM_Event::instance()->count( array( $where ), 'EVT_ID' ); |
|
1950 | + $count = EEM_Event::instance()->count(array($where), 'EVT_ID'); |
|
1951 | 1951 | return $count; |
1952 | 1952 | } |
1953 | 1953 | |
@@ -1975,11 +1975,11 @@ discard block |
||
1975 | 1975 | // translated |
1976 | 1976 | TRUE |
1977 | 1977 | ); |
1978 | - $this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment; |
|
1978 | + $this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment; |
|
1979 | 1979 | |
1980 | 1980 | $this->_set_add_edit_form_tags('update_default_event_settings'); |
1981 | 1981 | $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
1982 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE); |
|
1982 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE); |
|
1983 | 1983 | $this->display_admin_page_with_sidebar(); |
1984 | 1984 | } |
1985 | 1985 | |
@@ -2005,9 +2005,9 @@ discard block |
||
2005 | 2005 | |
2006 | 2006 | protected function _template_settings() { |
2007 | 2007 | $this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso'); |
2008 | - $this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />'; |
|
2009 | - $this->_template_args['preview_text'] = '<strong>'.__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>'; |
|
2010 | - $this->display_admin_caf_preview_page( 'template_settings_tab' ); |
|
2008 | + $this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />'; |
|
2009 | + $this->_template_args['preview_text'] = '<strong>'.__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>'; |
|
2010 | + $this->display_admin_caf_preview_page('template_settings_tab'); |
|
2011 | 2011 | } |
2012 | 2012 | |
2013 | 2013 | |
@@ -2020,22 +2020,22 @@ discard block |
||
2020 | 2020 | * @return void |
2021 | 2021 | */ |
2022 | 2022 | private function _set_category_object() { |
2023 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
2023 | + if (isset($this->_category->id) && ! empty($this->_category->id)) |
|
2024 | 2024 | return; //already have the category object so get out. |
2025 | 2025 | |
2026 | 2026 | //set default category object |
2027 | 2027 | $this->_set_empty_category_object(); |
2028 | 2028 | |
2029 | 2029 | //only set if we've got an id |
2030 | - if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) { |
|
2030 | + if ( ! isset($this->_req_data['EVT_CAT_ID'])) { |
|
2031 | 2031 | return; |
2032 | 2032 | } |
2033 | 2033 | |
2034 | 2034 | $category_id = absint($this->_req_data['EVT_CAT_ID']); |
2035 | 2035 | |
2036 | - $term = get_term( $category_id, 'espresso_event_categories' ); |
|
2036 | + $term = get_term($category_id, 'espresso_event_categories'); |
|
2037 | 2037 | |
2038 | - if ( !empty( $term ) ) { |
|
2038 | + if ( ! empty($term)) { |
|
2039 | 2039 | $this->_category->category_name = $term->name; |
2040 | 2040 | $this->_category->category_identifier = $term->slug; |
2041 | 2041 | $this->_category->category_desc = $term->description; |
@@ -2049,13 +2049,13 @@ discard block |
||
2049 | 2049 | |
2050 | 2050 | private function _set_empty_category_object() { |
2051 | 2051 | $this->_category = new stdClass(); |
2052 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
2052 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
2053 | 2053 | $this->_category->id = $this->_category->parent = 0; |
2054 | 2054 | } |
2055 | 2055 | |
2056 | 2056 | |
2057 | 2057 | protected function _category_list_table() { |
2058 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2058 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2059 | 2059 | $this->_search_btn_label = __('Categories', 'event_espresso'); |
2060 | 2060 | $this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2'); |
2061 | 2061 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -2065,22 +2065,22 @@ discard block |
||
2065 | 2065 | protected function _category_details($view) { |
2066 | 2066 | |
2067 | 2067 | //load formatter helper |
2068 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
2068 | + EE_Registry::instance()->load_helper('Formatter'); |
|
2069 | 2069 | //load field generator helper |
2070 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
2070 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
2071 | 2071 | |
2072 | 2072 | $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
2073 | 2073 | $this->_set_add_edit_form_tags($route); |
2074 | 2074 | |
2075 | 2075 | $this->_set_category_object(); |
2076 | - $id = !empty($this->_category->id) ? $this->_category->id : ''; |
|
2076 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
2077 | 2077 | |
2078 | 2078 | $delete_action = 'delete_category'; |
2079 | 2079 | |
2080 | 2080 | //custom redirect |
2081 | - $redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url ); |
|
2081 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
2082 | 2082 | |
2083 | - $this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect ); |
|
2083 | + $this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect); |
|
2084 | 2084 | |
2085 | 2085 | //take care of contents |
2086 | 2086 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
@@ -2094,25 +2094,25 @@ discard block |
||
2094 | 2094 | 'type' => 'wp_editor', |
2095 | 2095 | 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
2096 | 2096 | 'class' => 'my_editor_custom', |
2097 | - 'wpeditor_args' => array('media_buttons' => FALSE ) |
|
2097 | + 'wpeditor_args' => array('media_buttons' => FALSE) |
|
2098 | 2098 | ); |
2099 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
2099 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
2100 | 2100 | |
2101 | - $all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) ); |
|
2101 | + $all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id))); |
|
2102 | 2102 | |
2103 | 2103 | //setup category select for term parents. |
2104 | 2104 | $category_select_values[] = array( |
2105 | 2105 | 'text' => __('No Parent', 'event_espresso'), |
2106 | 2106 | 'id' => 0 |
2107 | 2107 | ); |
2108 | - foreach ( $all_terms as $term ) { |
|
2108 | + foreach ($all_terms as $term) { |
|
2109 | 2109 | $category_select_values[] = array( |
2110 | 2110 | 'text' => $term->name, |
2111 | 2111 | 'id' => $term->term_id |
2112 | 2112 | ); |
2113 | 2113 | } |
2114 | 2114 | |
2115 | - $category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent ); |
|
2115 | + $category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent); |
|
2116 | 2116 | |
2117 | 2117 | $template_args = array( |
2118 | 2118 | 'category' => $this->_category, |
@@ -2122,15 +2122,15 @@ discard block |
||
2122 | 2122 | 'disable' => '', |
2123 | 2123 | 'disabled_message' => FALSE |
2124 | 2124 | ); |
2125 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
2126 | - return EEH_Template::display_template($template, $template_args, TRUE ); |
|
2125 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
2126 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
2127 | 2127 | } |
2128 | 2128 | |
2129 | 2129 | |
2130 | 2130 | protected function _delete_categories() { |
2131 | - $cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
2131 | + $cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
2132 | 2132 | |
2133 | - foreach ( $cat_ids as $cat_id ) { |
|
2133 | + foreach ($cat_ids as $cat_id) { |
|
2134 | 2134 | $this->_delete_category($cat_id); |
2135 | 2135 | } |
2136 | 2136 | |
@@ -2138,7 +2138,7 @@ discard block |
||
2138 | 2138 | $query_args = array( |
2139 | 2139 | 'action' => 'category_list' |
2140 | 2140 | ); |
2141 | - $this->_redirect_after_action(0,'','',$query_args); |
|
2141 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
2142 | 2142 | |
2143 | 2143 | } |
2144 | 2144 | |
@@ -2148,61 +2148,61 @@ discard block |
||
2148 | 2148 | |
2149 | 2149 | protected function _delete_category($cat_id) { |
2150 | 2150 | global $wpdb; |
2151 | - $cat_id = absint( $cat_id ); |
|
2152 | - wp_delete_term( $cat_id, 'espresso_event_categories' ); |
|
2151 | + $cat_id = absint($cat_id); |
|
2152 | + wp_delete_term($cat_id, 'espresso_event_categories'); |
|
2153 | 2153 | } |
2154 | 2154 | |
2155 | 2155 | |
2156 | 2156 | |
2157 | 2157 | protected function _insert_or_update_category($new_category) { |
2158 | 2158 | |
2159 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE ); |
|
2159 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE); |
|
2160 | 2160 | $success = 0; //we already have a success message so lets not send another. |
2161 | 2161 | |
2162 | - if ( $cat_id ) { |
|
2162 | + if ($cat_id) { |
|
2163 | 2163 | $query_args = array( |
2164 | 2164 | 'action' => 'edit_category', |
2165 | 2165 | 'EVT_CAT_ID' => $cat_id |
2166 | 2166 | ); |
2167 | 2167 | } else { |
2168 | - $query_args = array( 'action' => 'add_category' ); |
|
2168 | + $query_args = array('action' => 'add_category'); |
|
2169 | 2169 | } |
2170 | - $this->_redirect_after_action( $success, '','', $query_args, TRUE ); |
|
2170 | + $this->_redirect_after_action($success, '', '', $query_args, TRUE); |
|
2171 | 2171 | |
2172 | 2172 | } |
2173 | 2173 | |
2174 | 2174 | |
2175 | 2175 | |
2176 | - private function _insert_category( $update = FALSE ) { |
|
2176 | + private function _insert_category($update = FALSE) { |
|
2177 | 2177 | $cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : ''; |
2178 | - $category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
2179 | - $category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
2180 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
2178 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
2179 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
2180 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
2181 | 2181 | |
2182 | - if ( empty( $category_name ) ) { |
|
2183 | - $msg = __( 'You must add a name for the category.', 'event_espresso' ); |
|
2184 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2182 | + if (empty($category_name)) { |
|
2183 | + $msg = __('You must add a name for the category.', 'event_espresso'); |
|
2184 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2185 | 2185 | return false; |
2186 | 2186 | } |
2187 | 2187 | |
2188 | - $term_args=array( |
|
2188 | + $term_args = array( |
|
2189 | 2189 | 'name'=>$category_name, |
2190 | 2190 | 'description'=>$category_desc, |
2191 | 2191 | 'parent'=>$category_parent |
2192 | 2192 | ); |
2193 | 2193 | //was the category_identifier input disabled? |
2194 | - if(isset($this->_req_data['category_identifier'])){ |
|
2194 | + if (isset($this->_req_data['category_identifier'])) { |
|
2195 | 2195 | $term_args['slug'] = $this->_req_data['category_identifier']; |
2196 | 2196 | } |
2197 | - $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args ); |
|
2197 | + $insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args); |
|
2198 | 2198 | |
2199 | - if ( !is_array( $insert_ids ) ) { |
|
2200 | - $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
2201 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2199 | + if ( ! is_array($insert_ids)) { |
|
2200 | + $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
2201 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2202 | 2202 | } else { |
2203 | 2203 | $cat_id = $insert_ids['term_id']; |
2204 | - $msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name ); |
|
2205 | - EE_Error::add_success( $msg ); |
|
2204 | + $msg = sprintf(__('The category %s was successfuly saved', 'event_espresso'), $category_name); |
|
2205 | + EE_Error::add_success($msg); |
|
2206 | 2206 | } |
2207 | 2207 | |
2208 | 2208 | return $cat_id; |
@@ -2211,32 +2211,32 @@ discard block |
||
2211 | 2211 | |
2212 | 2212 | |
2213 | 2213 | |
2214 | - public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
2214 | + public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) { |
|
2215 | 2215 | global $wpdb; |
2216 | 2216 | |
2217 | 2217 | //testing term stuff |
2218 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2219 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
2220 | - $limit = ($current_page-1)*$per_page; |
|
2218 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2219 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
2220 | + $limit = ($current_page - 1) * $per_page; |
|
2221 | 2221 | |
2222 | - $where = array( 'taxonomy' => 'espresso_event_categories' ); |
|
2222 | + $where = array('taxonomy' => 'espresso_event_categories'); |
|
2223 | 2223 | |
2224 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2225 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2224 | + if (isset($this->_req_data['s'])) { |
|
2225 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2226 | 2226 | $where['OR'] = array( |
2227 | - 'Term.name' => array( 'LIKE', $sstr), |
|
2228 | - 'description' => array( 'LIKE', $sstr ) |
|
2227 | + 'Term.name' => array('LIKE', $sstr), |
|
2228 | + 'description' => array('LIKE', $sstr) |
|
2229 | 2229 | ); |
2230 | 2230 | } |
2231 | 2231 | |
2232 | 2232 | $query_params = array( |
2233 | - $where , |
|
2234 | - 'order_by' => array( $orderby => $order ), |
|
2235 | - 'limit' => $limit . ',' . $per_page, |
|
2233 | + $where, |
|
2234 | + 'order_by' => array($orderby => $order), |
|
2235 | + 'limit' => $limit.','.$per_page, |
|
2236 | 2236 | 'force_join' => array('Term') |
2237 | 2237 | ); |
2238 | 2238 | |
2239 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
2239 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
2240 | 2240 | |
2241 | 2241 | return $categories; |
2242 | 2242 | } |