@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | * @param bool $password_check |
46 | 46 | * @return \EE_Venue|null |
47 | 47 | */ |
48 | - public static function get_venue( $VNU_ID = 0, $look_in_event = TRUE, $privacy_check = true, $password_check = true ) { |
|
49 | - $VNU_ID = absint( $VNU_ID ); |
|
48 | + public static function get_venue($VNU_ID = 0, $look_in_event = TRUE, $privacy_check = true, $password_check = true) { |
|
49 | + $VNU_ID = absint($VNU_ID); |
|
50 | 50 | // do we already have the Venue you are looking for? |
51 | - if ( EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->ID() == $VNU_ID ) { |
|
52 | - return EEH_Venue_View::_get_venue( $privacy_check ); |
|
51 | + if (EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->ID() == $VNU_ID) { |
|
52 | + return EEH_Venue_View::_get_venue($privacy_check); |
|
53 | 53 | } |
54 | 54 | // international newspaper? |
55 | 55 | global $post; |
56 | - if ( $post instanceof WP_Post ) { |
|
57 | - switch ( $post->post_type ) { |
|
56 | + if ($post instanceof WP_Post) { |
|
57 | + switch ($post->post_type) { |
|
58 | 58 | // if this is being called from an EE_Venue post, |
59 | 59 | // and the EE_Venue post corresponds to the EE_Venue that is being asked for, |
60 | 60 | // then we can try to just grab the attached EE_Venue object |
@@ -62,31 +62,31 @@ discard block |
||
62 | 62 | // the post already contains the related EE_Venue object AND one of the following is TRUE: |
63 | 63 | // the requested Venue ID matches the post ID OR... |
64 | 64 | // there was no specific Venue ID requested |
65 | - if ( isset( $post->EE_Venue ) && ( $VNU_ID == $post->ID || ! $VNU_ID )) { |
|
65 | + if (isset($post->EE_Venue) && ($VNU_ID == $post->ID || ! $VNU_ID)) { |
|
66 | 66 | // use existing related EE_Venue object |
67 | - EEH_Venue_View::$_venue = $post->EE_Venue; |
|
68 | - } else if ( $VNU_ID ) { |
|
67 | + EEH_Venue_View::$_venue = $post->EE_Venue; |
|
68 | + } else if ($VNU_ID) { |
|
69 | 69 | // there WAS a specific Venue ID requested, but it's NOT the current post object |
70 | - EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $VNU_ID ); |
|
70 | + EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
71 | 71 | } else { |
72 | 72 | // no specific Venue ID requested, so use post ID to generate EE_Venue object |
73 | - EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $post->ID ); |
|
73 | + EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($post->ID); |
|
74 | 74 | } |
75 | 75 | break; |
76 | 76 | |
77 | 77 | case 'espresso_events': |
78 | - if ( $look_in_event ) { |
|
78 | + if ($look_in_event) { |
|
79 | 79 | // grab the events related venues |
80 | 80 | $venues = EEH_Venue_View::get_event_venues(); |
81 | 81 | // make sure the result is an array |
82 | - $venues = is_array( $venues ) ? $venues : array(); |
|
82 | + $venues = is_array($venues) ? $venues : array(); |
|
83 | 83 | // do we have an ID for a specific venue? |
84 | - if ( $VNU_ID ) { |
|
84 | + if ($VNU_ID) { |
|
85 | 85 | // loop thru the related venues |
86 | - foreach( $venues as $venue ) { |
|
87 | - if ( $venue instanceof EE_Venue ) { |
|
86 | + foreach ($venues as $venue) { |
|
87 | + if ($venue instanceof EE_Venue) { |
|
88 | 88 | // until we find the venue we're looking for |
89 | - if ( $venue->ID() == $VNU_ID ) { |
|
89 | + if ($venue->ID() == $VNU_ID) { |
|
90 | 90 | EEH_Venue_View::$_venue = $venue; |
91 | 91 | break; |
92 | 92 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | // then the global post is an events post and this function was called with no argument |
99 | 99 | } else { |
100 | 100 | // just grab the first related event venue |
101 | - EEH_Venue_View::$_venue = reset( $venues ); |
|
101 | + EEH_Venue_View::$_venue = reset($venues); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | break; |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | } |
107 | 107 | } |
108 | 108 | // now if we STILL do NOT have an EE_Venue model object, BUT we have a Venue ID... |
109 | - if ( ! EEH_Venue_View::$_venue instanceof EE_Venue && $VNU_ID ) { |
|
109 | + if ( ! EEH_Venue_View::$_venue instanceof EE_Venue && $VNU_ID) { |
|
110 | 110 | // sigh... pull it from the db |
111 | - EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $VNU_ID ); |
|
111 | + EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
112 | 112 | } |
113 | - return EEH_Venue_View::_get_venue( $privacy_check, $password_check ); |
|
113 | + return EEH_Venue_View::_get_venue($privacy_check, $password_check); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -123,13 +123,13 @@ discard block |
||
123 | 123 | * @param bool $password_check |
124 | 124 | * @return EE_Venue |
125 | 125 | */ |
126 | - protected static function _get_venue( $privacy_check = true, $password_check = true ) { |
|
126 | + protected static function _get_venue($privacy_check = true, $password_check = true) { |
|
127 | 127 | // check for private venues. |
128 | 128 | if ( |
129 | 129 | EEH_Venue_View::$_venue instanceof EE_Venue |
130 | 130 | && EEH_Venue_View::$_venue->status() == 'private' |
131 | 131 | && $privacy_check |
132 | - && ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) |
|
132 | + && ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues') |
|
133 | 133 | ) { |
134 | 134 | return null; |
135 | 135 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | if ( |
138 | 138 | EEH_Venue_View::$_venue instanceof EE_Venue |
139 | 139 | && $password_check |
140 | - && post_password_required( EEH_Venue_View::$_venue->ID() ) |
|
140 | + && post_password_required(EEH_Venue_View::$_venue->ID()) |
|
141 | 141 | ) { |
142 | 142 | return null; |
143 | 143 | } |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public static function get_event_venues() { |
156 | 156 | global $post; |
157 | - if ( $post->post_type == 'espresso_events' ) { |
|
158 | - if ( isset( $post->EE_Event ) && $post->EE_Event instanceof EE_Event ) { |
|
157 | + if ($post->post_type == 'espresso_events') { |
|
158 | + if (isset($post->EE_Event) && $post->EE_Event instanceof EE_Event) { |
|
159 | 159 | return $post->EE_Event->venues(); |
160 | 160 | } |
161 | 161 | } |
@@ -175,9 +175,9 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return bool|null |
177 | 177 | */ |
178 | - public static function is_venue_private( $VNU_ID = false ) { |
|
179 | - $venue = EEH_Venue_View::get_venue( $VNU_ID, true, true ); |
|
180 | - if ( ! $venue instanceof EE_Venue ) { |
|
178 | + public static function is_venue_private($VNU_ID = false) { |
|
179 | + $venue = EEH_Venue_View::get_venue($VNU_ID, true, true); |
|
180 | + if ( ! $venue instanceof EE_Venue) { |
|
181 | 181 | return null; |
182 | 182 | } |
183 | 183 | |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | * @param bool $VNU_ID venue to check (optional). If not included will use internally derived venue object. |
193 | 193 | * @return bool |
194 | 194 | */ |
195 | - public static function is_venue_password_protected( $VNU_ID = false ) { |
|
196 | - $venue = EEH_Venue_View::get_venue( $VNU_ID, true, true, false ); |
|
195 | + public static function is_venue_password_protected($VNU_ID = false) { |
|
196 | + $venue = EEH_Venue_View::get_venue($VNU_ID, true, true, false); |
|
197 | 197 | if ( |
198 | 198 | $venue instanceof EE_Venue |
199 | - && post_password_required( $venue->ID() ) |
|
199 | + && post_password_required($venue->ID()) |
|
200 | 200 | ) { |
201 | 201 | return true; |
202 | 202 | } |
@@ -213,13 +213,13 @@ discard block |
||
213 | 213 | * |
214 | 214 | * @return string |
215 | 215 | */ |
216 | - public static function password_protected_venue_form( $VNU_ID = false ) { |
|
217 | - $venue = EEH_Venue_View::get_venue( $VNU_ID, true, true, false ); |
|
216 | + public static function password_protected_venue_form($VNU_ID = false) { |
|
217 | + $venue = EEH_Venue_View::get_venue($VNU_ID, true, true, false); |
|
218 | 218 | if ( |
219 | 219 | $venue instanceof EE_Venue |
220 | - && post_password_required( $venue->ID() ) |
|
220 | + && post_password_required($venue->ID()) |
|
221 | 221 | ) { |
222 | - return get_the_password_form( $venue->ID() ); |
|
222 | + return get_the_password_form($venue->ID()); |
|
223 | 223 | } |
224 | 224 | return ''; |
225 | 225 | } |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | * @param int $VNU_ID |
234 | 234 | * @return string |
235 | 235 | */ |
236 | - public static function venue_description( $VNU_ID = 0 ) { |
|
237 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
238 | - if ( $venue instanceof EE_Venue ) { |
|
236 | + public static function venue_description($VNU_ID = 0) { |
|
237 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
238 | + if ($venue instanceof EE_Venue) { |
|
239 | 239 | return$venue->description(); |
240 | 240 | } |
241 | 241 | return ''; |
@@ -250,12 +250,12 @@ discard block |
||
250 | 250 | * @param int $VNU_ID |
251 | 251 | * @return string |
252 | 252 | */ |
253 | - public static function venue_excerpt( $VNU_ID = 0 ) { |
|
254 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
255 | - if ( $venue instanceof EE_Venue ) { |
|
253 | + public static function venue_excerpt($VNU_ID = 0) { |
|
254 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
255 | + if ($venue instanceof EE_Venue) { |
|
256 | 256 | $excerpt = $venue->excerpt() != NULL && $venue->excerpt() ? $venue->excerpt() : $venue->description(); |
257 | - $venue_link = ' ' . EEH_Venue_View::venue_details_link( $venue->ID(), __( 'more', 'event_espresso' ) . '…' ); |
|
258 | - return ! empty( $excerpt ) ? wp_trim_words( $excerpt, 25, '' ) . $venue_link : ''; |
|
257 | + $venue_link = ' '.EEH_Venue_View::venue_details_link($venue->ID(), __('more', 'event_espresso').'…'); |
|
258 | + return ! empty($excerpt) ? wp_trim_words($excerpt, 25, '').$venue_link : ''; |
|
259 | 259 | } |
260 | 260 | return ''; |
261 | 261 | } |
@@ -270,22 +270,22 @@ discard block |
||
270 | 270 | * @param bool $hide_uncategorized |
271 | 271 | * @return string |
272 | 272 | */ |
273 | - public static function venue_categories( $VNU_ID = 0, $hide_uncategorized = TRUE ) { |
|
273 | + public static function venue_categories($VNU_ID = 0, $hide_uncategorized = TRUE) { |
|
274 | 274 | $category_links = array(); |
275 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
276 | - if ( $venue instanceof EE_Venue ) { |
|
275 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
276 | + if ($venue instanceof EE_Venue) { |
|
277 | 277 | // get category terms |
278 | - if ( $venue_categories = get_the_terms( $venue->ID(), 'espresso_venue_categories' )) { |
|
278 | + if ($venue_categories = get_the_terms($venue->ID(), 'espresso_venue_categories')) { |
|
279 | 279 | // loop thru terms and create links |
280 | - foreach ( $venue_categories as $term ) { |
|
281 | - $url = get_term_link( $term, 'espresso_venue_categories' ); |
|
282 | - if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) { |
|
283 | - $category_links[] = '<a href="' . esc_url( $url ) . '" rel="tag">' . $term->name . '</a> '; |
|
280 | + foreach ($venue_categories as $term) { |
|
281 | + $url = get_term_link($term, 'espresso_venue_categories'); |
|
282 | + if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) { |
|
283 | + $category_links[] = '<a href="'.esc_url($url).'" rel="tag">'.$term->name.'</a> '; |
|
284 | 284 | } |
285 | 285 | } |
286 | 286 | } |
287 | 287 | } |
288 | - return implode( ', ', $category_links ); |
|
288 | + return implode(', ', $category_links); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | |
@@ -300,10 +300,10 @@ discard block |
||
300 | 300 | * @param bool $add_wrapper |
301 | 301 | * @return string |
302 | 302 | */ |
303 | - public static function venue_address( $type = 'multiline', $VNU_ID = 0, $use_schema = true, $add_wrapper = true ) { |
|
304 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
305 | - if ( $venue instanceof EE_Venue ) { |
|
306 | - return EEH_Address::format( $venue, $type, $use_schema, $add_wrapper ); |
|
303 | + public static function venue_address($type = 'multiline', $VNU_ID = 0, $use_schema = true, $add_wrapper = true) { |
|
304 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
305 | + if ($venue instanceof EE_Venue) { |
|
306 | + return EEH_Address::format($venue, $type, $use_schema, $add_wrapper); |
|
307 | 307 | } |
308 | 308 | return ''; |
309 | 309 | } |
@@ -317,10 +317,10 @@ discard block |
||
317 | 317 | * @param int $VNU_ID |
318 | 318 | * @return bool|string |
319 | 319 | */ |
320 | - public static function venue_has_address( $VNU_ID = 0 ) { |
|
321 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
322 | - if ( $venue instanceof EE_Venue ) { |
|
323 | - return EEH_Address::format( $venue, 'inline', FALSE, FALSE ); |
|
320 | + public static function venue_has_address($VNU_ID = 0) { |
|
321 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
322 | + if ($venue instanceof EE_Venue) { |
|
323 | + return EEH_Address::format($venue, 'inline', FALSE, FALSE); |
|
324 | 324 | } |
325 | 325 | return false; |
326 | 326 | } |
@@ -335,30 +335,30 @@ discard block |
||
335 | 335 | * @param int $VNU_ID |
336 | 336 | * @return string |
337 | 337 | */ |
338 | - public static function venue_name( $link_to = 'details', $VNU_ID = 0 ) { |
|
339 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
340 | - if ( $venue instanceof EE_Venue ) { |
|
338 | + public static function venue_name($link_to = 'details', $VNU_ID = 0) { |
|
339 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
340 | + if ($venue instanceof EE_Venue) { |
|
341 | 341 | $venue_name = apply_filters( |
342 | 342 | 'FHEE__EEH_Venue__venue_name__append_private_venue_name', |
343 | 343 | EEH_Venue_View::is_venue_private() |
344 | - ? EEH_Venue_View::$_venue->name() . " " . __( '(Private)', 'event_espresso' ) |
|
344 | + ? EEH_Venue_View::$_venue->name()." ".__('(Private)', 'event_espresso') |
|
345 | 345 | : EEH_Venue_View::$_venue->name(), |
346 | 346 | EEH_Venue_View::$_venue |
347 | 347 | ); |
348 | - $venue_name = EEH_Schema::name( $venue_name ); |
|
348 | + $venue_name = EEH_Schema::name($venue_name); |
|
349 | 349 | |
350 | 350 | //if venue is trashed then ignore the "link to" setting because the venue is trashed. |
351 | - if ( $venue->get('status') == 'trash' ) { |
|
351 | + if ($venue->get('status') == 'trash') { |
|
352 | 352 | $link_to = ''; |
353 | 353 | } |
354 | - switch( $link_to ) { |
|
354 | + switch ($link_to) { |
|
355 | 355 | |
356 | 356 | case 'details' : |
357 | - return EEH_Venue_View::venue_details_link( $venue->ID(), $venue_name ); |
|
357 | + return EEH_Venue_View::venue_details_link($venue->ID(), $venue_name); |
|
358 | 358 | break; |
359 | 359 | |
360 | 360 | case 'website' : |
361 | - return EEH_Venue_View::venue_website_link( $venue->ID(), $venue_name ); |
|
361 | + return EEH_Venue_View::venue_website_link($venue->ID(), $venue_name); |
|
362 | 362 | break; |
363 | 363 | |
364 | 364 | default : |
@@ -378,10 +378,10 @@ discard block |
||
378 | 378 | * @param string $text |
379 | 379 | * @return string |
380 | 380 | */ |
381 | - public static function venue_details_link( $VNU_ID = 0, $text = '' ) { |
|
382 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
383 | - if ( $venue instanceof EE_Venue ) { |
|
384 | - return EEH_Schema::url( get_permalink( $venue->ID() ), $text ); |
|
381 | + public static function venue_details_link($VNU_ID = 0, $text = '') { |
|
382 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
383 | + if ($venue instanceof EE_Venue) { |
|
384 | + return EEH_Schema::url(get_permalink($venue->ID()), $text); |
|
385 | 385 | } |
386 | 386 | return ''; |
387 | 387 | } |
@@ -396,12 +396,12 @@ discard block |
||
396 | 396 | * @param string $text |
397 | 397 | * @return string |
398 | 398 | */ |
399 | - public static function venue_website_link( $VNU_ID = 0, $text = '' ) { |
|
400 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
401 | - if ( $venue instanceof EE_Venue ) { |
|
399 | + public static function venue_website_link($VNU_ID = 0, $text = '') { |
|
400 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
401 | + if ($venue instanceof EE_Venue) { |
|
402 | 402 | $url = $venue->venue_url(); |
403 | - $text = ! empty( $text ) ? $text : $url; |
|
404 | - return ! empty( $url ) ? EEH_Schema::url( $url, $text ) : ''; |
|
403 | + $text = ! empty($text) ? $text : $url; |
|
404 | + return ! empty($url) ? EEH_Schema::url($url, $text) : ''; |
|
405 | 405 | } |
406 | 406 | return ''; |
407 | 407 | } |
@@ -415,10 +415,10 @@ discard block |
||
415 | 415 | * @param int $VNU_ID |
416 | 416 | * @return string |
417 | 417 | */ |
418 | - public static function venue_phone( $VNU_ID = 0) { |
|
419 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
420 | - if ( $venue instanceof EE_Venue ) { |
|
421 | - return EEH_Schema::telephone( $venue->phone() ); |
|
418 | + public static function venue_phone($VNU_ID = 0) { |
|
419 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
420 | + if ($venue instanceof EE_Venue) { |
|
421 | + return EEH_Schema::telephone($venue->phone()); |
|
422 | 422 | } |
423 | 423 | return ''; |
424 | 424 | } |
@@ -434,48 +434,48 @@ discard block |
||
434 | 434 | * @param array $gmap map options |
435 | 435 | * @return string |
436 | 436 | */ |
437 | - public static function venue_gmap( $VNU_ID = 0, $map_ID = FALSE, $gmap = array() ) { |
|
437 | + public static function venue_gmap($VNU_ID = 0, $map_ID = FALSE, $gmap = array()) { |
|
438 | 438 | |
439 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
440 | - if ( $venue instanceof EE_Venue ) { |
|
439 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
440 | + if ($venue instanceof EE_Venue) { |
|
441 | 441 | // check for global espresso_events post and use it's ID if no map_ID is set |
442 | 442 | global $post; |
443 | - $map_ID = empty( $map_ID ) && $post->post_type == 'espresso_events' ? $post->ID : $map_ID; |
|
443 | + $map_ID = empty($map_ID) && $post->post_type == 'espresso_events' ? $post->ID : $map_ID; |
|
444 | 444 | // grab map settings |
445 | 445 | $map_cfg = EE_Registry::instance()->CFG->map_settings; |
446 | 446 | // are maps enabled ? |
447 | - if ( $map_cfg->use_google_maps && $venue->enable_for_gmap() ) { |
|
447 | + if ($map_cfg->use_google_maps && $venue->enable_for_gmap()) { |
|
448 | 448 | |
449 | 449 | $details_page = is_single(); |
450 | 450 | $options = array(); |
451 | - $options['map_ID'] = $map_ID && $map_ID != $venue->ID() ? $map_ID . '-' . $venue->ID()/* . '-' . $static_map_id*/ : $venue->ID()/* . '-' . $static_map_id*/; |
|
451 | + $options['map_ID'] = $map_ID && $map_ID != $venue->ID() ? $map_ID.'-'.$venue->ID()/* . '-' . $static_map_id*/ : $venue->ID()/* . '-' . $static_map_id*/; |
|
452 | 452 | |
453 | - $options['location'] = EEH_Address::format( $venue, 'inline', FALSE, FALSE ); |
|
453 | + $options['location'] = EEH_Address::format($venue, 'inline', FALSE, FALSE); |
|
454 | 454 | |
455 | 455 | $options['ee_map_width'] = $details_page ? $map_cfg->event_details_map_width : $map_cfg->event_list_map_width; |
456 | - $options['ee_map_width'] = isset( $gmap['ee_map_width'] ) && ! empty( $gmap['ee_map_width'] ) ? $gmap['ee_map_width'] : $options['ee_map_width']; |
|
456 | + $options['ee_map_width'] = isset($gmap['ee_map_width']) && ! empty($gmap['ee_map_width']) ? $gmap['ee_map_width'] : $options['ee_map_width']; |
|
457 | 457 | |
458 | 458 | $options['ee_map_height'] = $details_page ? $map_cfg->event_details_map_height : $map_cfg->event_list_map_height; |
459 | - $options['ee_map_height'] = isset( $gmap['ee_map_height'] ) && ! empty( $gmap['ee_map_height'] ) ? $gmap['ee_map_height'] : $options['ee_map_height']; |
|
459 | + $options['ee_map_height'] = isset($gmap['ee_map_height']) && ! empty($gmap['ee_map_height']) ? $gmap['ee_map_height'] : $options['ee_map_height']; |
|
460 | 460 | |
461 | 461 | $options['ee_map_zoom'] = $details_page ? $map_cfg->event_details_map_zoom : $map_cfg->event_list_map_zoom; |
462 | - $options['ee_map_zoom'] = isset( $gmap['ee_map_zoom'] ) && ! empty( $gmap['ee_map_zoom'] ) ? $gmap['ee_map_zoom'] : $options['ee_map_zoom']; |
|
462 | + $options['ee_map_zoom'] = isset($gmap['ee_map_zoom']) && ! empty($gmap['ee_map_zoom']) ? $gmap['ee_map_zoom'] : $options['ee_map_zoom']; |
|
463 | 463 | |
464 | 464 | $options['ee_map_nav_display'] = $details_page ? $map_cfg->event_details_display_nav : $map_cfg->event_list_display_nav; |
465 | - $options['ee_map_nav_display'] = isset( $gmap['ee_map_nav_display'] ) && ! empty( $gmap['ee_map_nav_display'] ) ? 'true' : $options['ee_map_nav_display'];; |
|
465 | + $options['ee_map_nav_display'] = isset($gmap['ee_map_nav_display']) && ! empty($gmap['ee_map_nav_display']) ? 'true' : $options['ee_map_nav_display']; ; |
|
466 | 466 | |
467 | 467 | $options['ee_map_nav_size'] = $details_page ? $map_cfg->event_details_nav_size : $map_cfg->event_list_nav_size; |
468 | - $options['ee_map_nav_size'] = isset( $gmap['ee_map_nav_size'] ) && ! empty( $gmap['ee_map_nav_size'] )? $gmap['ee_map_nav_size'] : $options['ee_map_nav_size']; |
|
468 | + $options['ee_map_nav_size'] = isset($gmap['ee_map_nav_size']) && ! empty($gmap['ee_map_nav_size']) ? $gmap['ee_map_nav_size'] : $options['ee_map_nav_size']; |
|
469 | 469 | |
470 | 470 | $options['ee_map_type_control'] = $details_page ? $map_cfg->event_details_control_type : $map_cfg->event_list_control_type; |
471 | - $options['ee_map_type_control'] = isset( $gmap['ee_map_type_control'] ) && ! empty( $gmap['ee_map_type_control'] )? $gmap['ee_map_type_control'] : $options['ee_map_type_control']; |
|
471 | + $options['ee_map_type_control'] = isset($gmap['ee_map_type_control']) && ! empty($gmap['ee_map_type_control']) ? $gmap['ee_map_type_control'] : $options['ee_map_type_control']; |
|
472 | 472 | |
473 | 473 | $options['ee_map_align'] = $details_page ? $map_cfg->event_details_map_align : $map_cfg->event_list_map_align; |
474 | - $options['ee_map_align'] = isset( $gmap['ee_map_align'] ) && ! empty( $gmap['ee_map_align'] )? $gmap['ee_map_align'] : $options['ee_map_align']; |
|
474 | + $options['ee_map_align'] = isset($gmap['ee_map_align']) && ! empty($gmap['ee_map_align']) ? $gmap['ee_map_align'] : $options['ee_map_align']; |
|
475 | 475 | |
476 | - $options['ee_static_url'] = isset( $gmap['ee_static_url'] ) && ! empty( $gmap['ee_static_url'] ) ? (bool)absint( $gmap['ee_static_url'] ) : $venue->google_map_link(); |
|
476 | + $options['ee_static_url'] = isset($gmap['ee_static_url']) && ! empty($gmap['ee_static_url']) ? (bool) absint($gmap['ee_static_url']) : $venue->google_map_link(); |
|
477 | 477 | |
478 | - return EEH_Maps::google_map( $options ); |
|
478 | + return EEH_Maps::google_map($options); |
|
479 | 479 | |
480 | 480 | } |
481 | 481 | } |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | * @param array $atts like EEH_Maps::google_map_link |
491 | 491 | * @return string |
492 | 492 | */ |
493 | - public static function espresso_google_static_map( EE_Venue $venue, $atts = array() ){ |
|
493 | + public static function espresso_google_static_map(EE_Venue $venue, $atts = array()) { |
|
494 | 494 | $state = $venue->state_obj(); |
495 | 495 | $country = $venue->country_obj(); |
496 | 496 | $atts = shortcode_atts( |
@@ -521,23 +521,23 @@ discard block |
||
521 | 521 | * @param string $after |
522 | 522 | * @return string |
523 | 523 | */ |
524 | - public static function edit_venue_link( $VNU_ID = 0, $link = '', $before = '<p class="edit-venue-lnk small-txt">', $after = '</p>' ) { |
|
525 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
526 | - if ( $venue instanceof EE_Venue ) { |
|
524 | + public static function edit_venue_link($VNU_ID = 0, $link = '', $before = '<p class="edit-venue-lnk small-txt">', $after = '</p>') { |
|
525 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
526 | + if ($venue instanceof EE_Venue) { |
|
527 | 527 | // can the user edit this post ? |
528 | - if ( current_user_can( 'edit_post', $venue->ID() )) { |
|
528 | + if (current_user_can('edit_post', $venue->ID())) { |
|
529 | 529 | // set link text |
530 | - $link = ! empty( $link ) ? $link : __('edit this venue'); |
|
530 | + $link = ! empty($link) ? $link : __('edit this venue'); |
|
531 | 531 | // generate nonce |
532 | - $nonce = wp_create_nonce( 'edit_nonce' ); |
|
532 | + $nonce = wp_create_nonce('edit_nonce'); |
|
533 | 533 | // generate url to venue editor for this venue |
534 | - $url = add_query_arg( array( 'page' => 'espresso_venues', 'action' => 'edit', 'post' => $venue->ID(), 'edit_nonce' => $nonce ), admin_url( 'admin.php' ) ); |
|
534 | + $url = add_query_arg(array('page' => 'espresso_venues', 'action' => 'edit', 'post' => $venue->ID(), 'edit_nonce' => $nonce), admin_url('admin.php')); |
|
535 | 535 | // get edit CPT text |
536 | - $post_type_obj = get_post_type_object( 'espresso_venues' ); |
|
536 | + $post_type_obj = get_post_type_object('espresso_venues'); |
|
537 | 537 | // build final link html |
538 | - $link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( $post_type_obj->labels->edit_item ) . '">' . $link . '</a>'; |
|
538 | + $link = '<a class="post-edit-link" href="'.$url.'" title="'.esc_attr($post_type_obj->labels->edit_item).'">'.$link.'</a>'; |
|
539 | 539 | // put it all together |
540 | - return $before . apply_filters( 'edit_post_link', $link, $venue->ID() ) . $after; |
|
540 | + return $before.apply_filters('edit_post_link', $link, $venue->ID()).$after; |
|
541 | 541 | } |
542 | 542 | } |
543 | 543 | return ''; |
@@ -208,7 +208,6 @@ |
||
208 | 208 | /** |
209 | 209 | * If a venue is password protected, this will return the password form for gaining access |
210 | 210 | * returns an empty string otherwise |
211 | - |
|
212 | 211 | * @param bool $VNU_ID venue to check (optional). If not included will use internally derived venue object. |
213 | 212 | * |
214 | 213 | * @return string |
@@ -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 | * |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return EED_Venue_Single |
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( 'venue', 'Venue_Single', 'run' ); |
|
40 | + EE_Config::register_route('venue', 'Venue_Single', 'run'); |
|
41 | 41 | // EE_Config::register_view( 'venue', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'single-espresso_venues.php' ); |
42 | 42 | } |
43 | 43 | |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | * @access public |
59 | 59 | * @param \WP $WP |
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 | |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | * @param string $template |
74 | 74 | * @return string |
75 | 75 | */ |
76 | - public function template_include( $template ) { |
|
76 | + public function template_include($template) { |
|
77 | 77 | // not a custom template? |
78 | - if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'single-espresso_venues.php' ) { |
|
78 | + if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'single-espresso_venues.php') { |
|
79 | 79 | EEH_Template::load_espresso_theme_functions(); |
80 | 80 | // then add extra event data via hooks |
81 | - add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 ); |
|
82 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
81 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
82 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
83 | 83 | // don't display entry meta because the existing theme will take car of that |
84 | - add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' ); |
|
84 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
85 | 85 | } |
86 | 86 | return $template; |
87 | 87 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param string $title |
96 | 96 | * @return string |
97 | 97 | */ |
98 | - public function the_title( $title = '' ) { |
|
98 | + public function the_title($title = '') { |
|
99 | 99 | return $title; |
100 | 100 | } |
101 | 101 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @param string $content |
108 | 108 | * @return string |
109 | 109 | */ |
110 | - public function venue_details( $content ) { |
|
110 | + public function venue_details($content) { |
|
111 | 111 | global $post; |
112 | 112 | if ( |
113 | 113 | $post->post_type == 'espresso_venues' |
@@ -117,16 +117,16 @@ discard block |
||
117 | 117 | // it uses the_content() for displaying the $post->post_content |
118 | 118 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
119 | 119 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
120 | - remove_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
120 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
121 | 121 | // add filters we want |
122 | - add_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
122 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
123 | 123 | // now load our template |
124 | - $template = EEH_Template::locate_template( 'content-espresso_venues-details.php' ); |
|
124 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
125 | 125 | // remove other filters we added so they won't get applied to the next post |
126 | - remove_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
126 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
127 | 127 | } |
128 | 128 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
129 | - return ! empty( $template ) ? $template : $content; |
|
129 | + return ! empty($template) ? $template : $content; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | * @param string $content |
139 | 139 | * @return string |
140 | 140 | */ |
141 | - public function venue_location( $content ) { |
|
142 | - return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
|
141 | + public function venue_location($content) { |
|
142 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -152,16 +152,16 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function wp_enqueue_scripts() { |
154 | 154 | // get some style |
155 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_single() ) { |
|
155 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_single()) { |
|
156 | 156 | // first check theme folder |
157 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
158 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
159 | - } else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) { |
|
160 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
157 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
158 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
159 | + } else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) { |
|
160 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
161 | 161 | } |
162 | - wp_enqueue_style( $this->theme ); |
|
163 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
164 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
162 | + wp_enqueue_style($this->theme); |
|
163 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
164 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
@@ -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 | * |
@@ -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 | * @param \WP $WP |
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 | |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | * @param string $template |
74 | 74 | * @return string |
75 | 75 | */ |
76 | - public function template_include( $template ) { |
|
76 | + public function template_include($template) { |
|
77 | 77 | // not a custom template? |
78 | - if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'archive-espresso_venues.php' ) { |
|
78 | + if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'archive-espresso_venues.php') { |
|
79 | 79 | EEH_Template::load_espresso_theme_functions(); |
80 | 80 | // then add extra event data via hooks |
81 | - add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 ); |
|
81 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
82 | 82 | // don't know if theme uses the_excerpt |
83 | - add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
83 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
84 | 84 | // or the_content |
85 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
85 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
86 | 86 | // don't display entry meta because the existing theme will take care of that |
87 | - add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' ); |
|
87 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
88 | 88 | } |
89 | 89 | return $template; |
90 | 90 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param string $title |
99 | 99 | * @return string |
100 | 100 | */ |
101 | - public function the_title( $title = '' ) { |
|
101 | + public function the_title($title = '') { |
|
102 | 102 | return $title; |
103 | 103 | } |
104 | 104 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @param string $content |
111 | 111 | * @return string |
112 | 112 | */ |
113 | - public function venue_details( $content ) { |
|
113 | + public function venue_details($content) { |
|
114 | 114 | global $post; |
115 | 115 | if ( |
116 | 116 | $post->post_type == 'espresso_venues' |
@@ -120,22 +120,22 @@ discard block |
||
120 | 120 | // it uses the_content() for displaying the $post->post_content |
121 | 121 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
122 | 122 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
123 | - remove_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
124 | - remove_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
123 | + remove_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
124 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
125 | 125 | // add filters we want |
126 | - add_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
127 | - add_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 ); |
|
126 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
127 | + add_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
128 | 128 | // now load our template |
129 | - $template = EEH_Template::locate_template( 'content-espresso_venues-details.php' ); |
|
129 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
130 | 130 | //now add our filter back in, plus some others |
131 | - add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
132 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
131 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
132 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
133 | 133 | // remove other filters we added so they won't get applied to the next post |
134 | - remove_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
135 | - remove_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 ); |
|
134 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
135 | + remove_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
136 | 136 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
137 | 137 | } |
138 | - return ! empty( $template ) ? $template : $content; |
|
138 | + return ! empty($template) ? $template : $content; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @param string $content |
148 | 148 | * @return string |
149 | 149 | */ |
150 | - public function venue_location( $content ) { |
|
151 | - return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
|
150 | + public function venue_location($content) { |
|
151 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function wp_enqueue_scripts() { |
164 | 164 | // get some style |
165 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_archive() ) { |
|
165 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_archive()) { |
|
166 | 166 | // first check theme folder |
167 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
168 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
169 | - } else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) { |
|
170 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
167 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
168 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
169 | + } else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) { |
|
170 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
171 | 171 | } |
172 | - wp_enqueue_style( $this->theme ); |
|
172 | + wp_enqueue_style($this->theme); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 |
@@ -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 | * |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | <?php _e('Adjust the settings for the Authorize.net AIM payment gateway.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | 5 | <p> |
6 | -<?php printf( __( 'See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso' ), "<a href='http://www.authorize.net/international/' target='_blank'>","</a>" ); ?> |
|
6 | +<?php printf(__('See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso'), "<a href='http://www.authorize.net/international/' target='_blank'>", "</a>"); ?> |
|
7 | 7 | </p> |
8 | 8 | <p><strong><?php _e('Authorize.net AIM Settings', 'event_espresso'); ?></strong></p> |
9 | 9 | <ul> |
@@ -28,16 +28,16 @@ discard block |
||
28 | 28 | <?php _e('By logging into Authorize.net, you can change which payment fields are required by Authorize.net when processing payments. These settings affect both the Advanced Integration Method (AIM, this) and the Simple Integration Method (SIM, different). The payment method settings "Excluded Payment Form Fields" and "Required Payment Form Fields" allow you to change the billing form in Event Espresso to reflect your payment form settings in Authorize.net.', 'event_espresso'); ?> |
29 | 29 | <br> |
30 | 30 | <?php printf( |
31 | - __( 'To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.'), |
|
31 | + __('To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.'), |
|
32 | 32 | '<a href="http://authorize.net" target="_blank">', |
33 | 33 | '</a>', |
34 | 34 | '<a href="https://monosnap.com/file/nebVteOkEXcdDIos88SojStWOifP23" target="_blank">', |
35 | 35 | '<a href="https://monosnap.com/file/WyxGJtev87TcDmdGBEZ2oi1xaBIQAm" target="_blank">', |
36 | - '<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank">');?> |
|
36 | + '<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank">'); ?> |
|
37 | 37 | </li> |
38 | 38 | <li> |
39 | - <strong><?php _e( 'Server', 'event_espresso');?></strong> |
|
40 | - <?php _e( 'Use this setting to change the server where Authorize.net AIM requests are sent. Change this to "Authorize.net/Akamai" before June 30th 2016 to verify your server wil work with Authorize.net\'s servers which will be in use after that date.', 'event_espresso' );?> |
|
39 | + <strong><?php _e('Server', 'event_espresso'); ?></strong> |
|
40 | + <?php _e('Use this setting to change the server where Authorize.net AIM requests are sent. Change this to "Authorize.net/Akamai" before June 30th 2016 to verify your server wil work with Authorize.net\'s servers which will be in use after that date.', 'event_espresso'); ?> |
|
41 | 41 | </li> |
42 | 42 | <li> |
43 | 43 | <strong><?php _e('Button Image URL', 'event_espresso'); ?></strong><br /> |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * @param array $arguments |
36 | 36 | * @return \EE_CPT_Default_Strategy |
37 | 37 | */ |
38 | - public function __construct( $arguments = array() ) { |
|
39 | - $this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : null; |
|
38 | + public function __construct($arguments = array()) { |
|
39 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : null; |
|
40 | 40 | // $WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : null; |
41 | 41 | //EEH_Debug_Tools::printr( $this->CPT, '$this->CPT <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
42 | 42 | // add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ), 999 ); |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @param \WP_Query $WP_Query |
53 | 53 | * @return \WP_Query |
54 | 54 | */ |
55 | - public function pre_get_posts( WP_Query $WP_Query ) { |
|
55 | + public function pre_get_posts(WP_Query $WP_Query) { |
|
56 | 56 | //EEH_Debug_Tools::printr( $WP_Query, '$WP_Query <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
57 | - if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive() ) { |
|
57 | + if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
58 | 58 | return $WP_Query; |
59 | 59 | } |
60 | 60 | // $WP_Query->set( 'post_type', array( $this->CPT['post_type'] )); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param \WP_Query $WP_Query |
73 | 73 | * @return \WP_Post[] |
74 | 74 | */ |
75 | - public function the_posts( $posts, WP_Query $WP_Query ) { |
|
75 | + public function the_posts($posts, WP_Query $WP_Query) { |
|
76 | 76 | return $posts; |
77 | 77 | } |
78 | 78 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @param string $single |
89 | 89 | * @return mixed |
90 | 90 | */ |
91 | - public function get_EE_post_type_metadata( $meta_value = null, $post_id, $meta_key, $single ) { |
|
91 | + public function get_EE_post_type_metadata($meta_value = null, $post_id, $meta_key, $single) { |
|
92 | 92 | return $meta_value; |
93 | 93 | } |
94 | 94 |
@@ -447,14 +447,14 @@ |
||
447 | 447 | global $wpdb; |
448 | 448 | // adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement |
449 | 449 | $SQL .= ' LEFT JOIN ' |
450 | - . $this->meta_table->get_table_name() |
|
451 | - . ' ON ( ' |
|
452 | - . $this->meta_table->get_table_name() |
|
453 | - . '.' |
|
454 | - . $this->meta_table->get_fk_on_table() |
|
455 | - . ' = ' |
|
456 | - . $wpdb->posts |
|
457 | - . '.ID ) '; |
|
450 | + . $this->meta_table->get_table_name() |
|
451 | + . ' ON ( ' |
|
452 | + . $this->meta_table->get_table_name() |
|
453 | + . '.' |
|
454 | + . $this->meta_table->get_fk_on_table() |
|
455 | + . ' = ' |
|
456 | + . $wpdb->posts |
|
457 | + . '.ID ) '; |
|
458 | 458 | } |
459 | 459 | remove_filter( 'posts_join', array( $this, 'postsJoin' ) ); |
460 | 460 | return $SQL; |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\CPTs; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | \WP_Query $WP_Query, |
81 | 81 | \EE_Request_Handler $request |
82 | 82 | ) { |
83 | - $this->setRequest( $request ); |
|
84 | - $this->setWpQuery( $WP_Query ); |
|
85 | - $this->setPostType( $post_type ); |
|
86 | - $this->setCptDetails( $cpt_details ); |
|
83 | + $this->setRequest($request); |
|
84 | + $this->setWpQuery($WP_Query); |
|
85 | + $this->setPostType($post_type); |
|
86 | + $this->setCptDetails($cpt_details); |
|
87 | 87 | $this->init(); |
88 | 88 | } |
89 | 89 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * @param string $post_type |
103 | 103 | */ |
104 | - protected function setPostType( $post_type ) { |
|
104 | + protected function setPostType($post_type) { |
|
105 | 105 | $this->post_type = $post_type; |
106 | 106 | } |
107 | 107 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | /** |
120 | 120 | * @param array $cpt_details |
121 | 121 | */ |
122 | - protected function setCptDetails( $cpt_details ) { |
|
122 | + protected function setCptDetails($cpt_details) { |
|
123 | 123 | $this->cpt_details = $cpt_details; |
124 | 124 | } |
125 | 125 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | /** |
138 | 138 | * @param \EE_Table_Base[] $model_tables |
139 | 139 | */ |
140 | - protected function setModelTables( $model_tables ) { |
|
140 | + protected function setModelTables($model_tables) { |
|
141 | 141 | $this->model_tables = $model_tables; |
142 | 142 | } |
143 | 143 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @return array |
148 | 148 | */ |
149 | 149 | public function taxonomies() { |
150 | - if ( empty( $this->taxonomies ) ) { |
|
150 | + if (empty($this->taxonomies)) { |
|
151 | 151 | $this->initializeTaxonomies(); |
152 | 152 | } |
153 | 153 | return $this->taxonomies; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | /** |
159 | 159 | * @param array $taxonomies |
160 | 160 | */ |
161 | - protected function setTaxonomies( array $taxonomies ) { |
|
161 | + protected function setTaxonomies(array $taxonomies) { |
|
162 | 162 | $this->taxonomies = $taxonomies; |
163 | 163 | } |
164 | 164 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | /** |
177 | 177 | * @param \EE_Secondary_Table $meta_table |
178 | 178 | */ |
179 | - public function setMetaTable( \EE_Secondary_Table $meta_table ) { |
|
179 | + public function setMetaTable(\EE_Secondary_Table $meta_table) { |
|
180 | 180 | $this->meta_table = $meta_table; |
181 | 181 | } |
182 | 182 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | /** |
195 | 195 | * @param \EEM_Base $CPT_model |
196 | 196 | */ |
197 | - protected function setModel( \EEM_Base $CPT_model ) { |
|
197 | + protected function setModel(\EEM_Base $CPT_model) { |
|
198 | 198 | $this->model = $CPT_model; |
199 | 199 | } |
200 | 200 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | /** |
213 | 213 | * @param \EE_Request_Handler $request |
214 | 214 | */ |
215 | - protected function setRequest( \EE_Request_Handler $request ) { |
|
215 | + protected function setRequest(\EE_Request_Handler $request) { |
|
216 | 216 | $this->request = $request; |
217 | 217 | } |
218 | 218 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | /** |
231 | 231 | * @param \WP_Query $wp_query |
232 | 232 | */ |
233 | - public function setWpQuery( \WP_Query $wp_query ) { |
|
233 | + public function setWpQuery(\WP_Query $wp_query) { |
|
234 | 234 | $this->wp_query = $wp_query; |
235 | 235 | } |
236 | 236 | |
@@ -245,22 +245,22 @@ discard block |
||
245 | 245 | protected function initializeTaxonomies() { |
246 | 246 | // check if taxonomies have already been set and that this CPT has taxonomies registered for it |
247 | 247 | if ( |
248 | - empty( $this->taxonomies ) |
|
249 | - && isset( $this->cpt_details['args'], $this->cpt_details['args']['taxonomies'] ) |
|
248 | + empty($this->taxonomies) |
|
249 | + && isset($this->cpt_details['args'], $this->cpt_details['args']['taxonomies']) |
|
250 | 250 | ) { |
251 | 251 | // if so then grab them, but we want the taxonomy name as the key |
252 | - $taxonomies = array_flip( $this->cpt_details['args']['taxonomies'] ); |
|
252 | + $taxonomies = array_flip($this->cpt_details['args']['taxonomies']); |
|
253 | 253 | // then grab the list of ALL taxonomies |
254 | 254 | $all_taxonomies = \EE_Register_CPTs::get_taxonomies(); |
255 | - foreach ( $taxonomies as $taxonomy => &$details ) { |
|
255 | + foreach ($taxonomies as $taxonomy => &$details) { |
|
256 | 256 | // add details to our taxonomies if they exist |
257 | - $details = isset( $all_taxonomies[ $taxonomy ] ) |
|
258 | - ? $all_taxonomies[ $taxonomy ] |
|
257 | + $details = isset($all_taxonomies[$taxonomy]) |
|
258 | + ? $all_taxonomies[$taxonomy] |
|
259 | 259 | : array(); |
260 | 260 | } |
261 | 261 | // ALWAYS unset() variables that were passed by reference |
262 | - unset( $details ); |
|
263 | - $this->setTaxonomies( $taxonomies ); |
|
262 | + unset($details); |
|
263 | + $this->setTaxonomies($taxonomies); |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | $this->setAdditionalCptDetails(); |
271 | 271 | $this->setRequestVarsIfCpt(); |
272 | 272 | // convert post_type to model name |
273 | - $model_name = str_replace( 'EE_', '', $this->cpt_details['class_name'] ); |
|
273 | + $model_name = str_replace('EE_', '', $this->cpt_details['class_name']); |
|
274 | 274 | // load all tables related to CPT |
275 | - $this->setupModelsAndTables( $model_name ); |
|
275 | + $this->setupModelsAndTables($model_name); |
|
276 | 276 | // load and instantiate CPT_*_Strategy |
277 | - $CPT_Strategy = $this->cptStrategyClass( $model_name ); |
|
277 | + $CPT_Strategy = $this->cptStrategyClass($model_name); |
|
278 | 278 | // !!!!!!!!!! IMPORTANT !!!!!!!!!!!! |
279 | 279 | // here's the list of available filters in the WP_Query object |
280 | 280 | // 'posts_where_paged' |
@@ -285,17 +285,17 @@ discard block |
||
285 | 285 | // 'post_limits' |
286 | 286 | // 'posts_fields' |
287 | 287 | // 'posts_join' |
288 | - add_filter( 'posts_fields', array( $this, 'postsFields' ) ); |
|
289 | - add_filter( 'posts_join', array( $this, 'postsJoin' ) ); |
|
288 | + add_filter('posts_fields', array($this, 'postsFields')); |
|
289 | + add_filter('posts_join', array($this, 'postsJoin')); |
|
290 | 290 | add_filter( |
291 | - 'get_' . $this->post_type . '_metadata', |
|
292 | - array( $CPT_Strategy, 'get_EE_post_type_metadata' ), |
|
291 | + 'get_'.$this->post_type.'_metadata', |
|
292 | + array($CPT_Strategy, 'get_EE_post_type_metadata'), |
|
293 | 293 | 1, |
294 | 294 | 4 |
295 | 295 | ); |
296 | - add_filter( 'the_posts', array( $this, 'thePosts' ), 1, 1 ); |
|
297 | - if ( $this->wp_query->is_main_query() ) { |
|
298 | - add_filter( 'get_edit_post_link', array( $this, 'getEditPostLink' ), 10, 2 ); |
|
296 | + add_filter('the_posts', array($this, 'thePosts'), 1, 1); |
|
297 | + if ($this->wp_query->is_main_query()) { |
|
298 | + add_filter('get_edit_post_link', array($this, 'getEditPostLink'), 10, 2); |
|
299 | 299 | $this->addTemplateFilters(); |
300 | 300 | } |
301 | 301 | } |
@@ -312,18 +312,18 @@ discard block |
||
312 | 312 | // the post or category or term that is triggering EE |
313 | 313 | $this->cpt_details['espresso_page'] = $this->request->is_espresso_page(); |
314 | 314 | // requested post name |
315 | - $this->cpt_details['post_name'] = $this->request->get( 'post_name' ); |
|
315 | + $this->cpt_details['post_name'] = $this->request->get('post_name'); |
|
316 | 316 | // add support for viewing 'private', 'draft', or 'pending' posts |
317 | 317 | if ( |
318 | - isset( $this->wp_query->query_vars['p'] ) |
|
318 | + isset($this->wp_query->query_vars['p']) |
|
319 | 319 | && $this->wp_query->query_vars['p'] !== 0 |
320 | 320 | && is_user_logged_in() |
321 | - && current_user_can( 'edit_post', $this->wp_query->query_vars['p'] ) |
|
321 | + && current_user_can('edit_post', $this->wp_query->query_vars['p']) |
|
322 | 322 | ) { |
323 | 323 | // we can just inject directly into the WP_Query object |
324 | - $this->wp_query->query['post_status'] = array( 'publish', 'private', 'draft', 'pending' ); |
|
324 | + $this->wp_query->query['post_status'] = array('publish', 'private', 'draft', 'pending'); |
|
325 | 325 | // now set the main 'ee' request var so that the appropriate module can load the appropriate template(s) |
326 | - $this->request->set( 'ee', $this->cpt_details['singular_slug'] ); |
|
326 | + $this->request->set('ee', $this->cpt_details['singular_slug']); |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | |
@@ -340,15 +340,15 @@ discard block |
||
340 | 340 | */ |
341 | 341 | public function setRequestVarsIfCpt() { |
342 | 342 | // check if ee action var has been set |
343 | - if ( ! $this->request->is_set( 'ee' ) ) { |
|
343 | + if ( ! $this->request->is_set('ee')) { |
|
344 | 344 | // check that route exists for CPT archive slug |
345 | - if ( is_archive() && \EE_Config::get_route( $this->cpt_details['plural_slug'] ) ) { |
|
345 | + if (is_archive() && \EE_Config::get_route($this->cpt_details['plural_slug'])) { |
|
346 | 346 | // ie: set "ee" to "events" |
347 | - $this->request->set( 'ee', $this->cpt_details['plural_slug'] ); |
|
347 | + $this->request->set('ee', $this->cpt_details['plural_slug']); |
|
348 | 348 | // or does it match a single page CPT like /event/ |
349 | - } else if ( is_single() && \EE_Config::get_route( $this->cpt_details['singular_slug'] ) ) { |
|
349 | + } else if (is_single() && \EE_Config::get_route($this->cpt_details['singular_slug'])) { |
|
350 | 350 | // ie: set "ee" to "event" |
351 | - $this->request->set( 'ee', $this->cpt_details['singular_slug'] ); |
|
351 | + $this->request->set('ee', $this->cpt_details['singular_slug']); |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | } |
@@ -362,11 +362,11 @@ discard block |
||
362 | 362 | * @param string $model_name |
363 | 363 | * @throws \EE_Error |
364 | 364 | */ |
365 | - protected function setupModelsAndTables( $model_name ) { |
|
365 | + protected function setupModelsAndTables($model_name) { |
|
366 | 366 | // get CPT table data via CPT Model |
367 | - $model = \EE_Registry::instance()->load_model( $model_name ); |
|
368 | - if ( ! $model instanceof \EEM_Base ) { |
|
369 | - throw new \EE_Error ( |
|
367 | + $model = \EE_Registry::instance()->load_model($model_name); |
|
368 | + if ( ! $model instanceof \EEM_Base) { |
|
369 | + throw new \EE_Error( |
|
370 | 370 | sprintf( |
371 | 371 | __( |
372 | 372 | 'The "%1$s" model could not be loaded.', |
@@ -376,14 +376,14 @@ discard block |
||
376 | 376 | ) |
377 | 377 | ); |
378 | 378 | } |
379 | - $this->setModel( $model ); |
|
380 | - $this->setModelTables( $this->model->get_tables() ); |
|
379 | + $this->setModel($model); |
|
380 | + $this->setModelTables($this->model->get_tables()); |
|
381 | 381 | // is there a Meta Table for this CPT? |
382 | 382 | if ( |
383 | - isset( $this->cpt_details['tables'][ $model_name . '_Meta' ] ) |
|
384 | - && $this->cpt_details['tables'][ $model_name . '_Meta' ] instanceof \EE_Secondary_Table |
|
383 | + isset($this->cpt_details['tables'][$model_name.'_Meta']) |
|
384 | + && $this->cpt_details['tables'][$model_name.'_Meta'] instanceof \EE_Secondary_Table |
|
385 | 385 | ) { |
386 | - $this->setMetaTable( $this->cpt_details['tables'][ $model_name . '_Meta' ] ); |
|
386 | + $this->setMetaTable($this->cpt_details['tables'][$model_name.'_Meta']); |
|
387 | 387 | } |
388 | 388 | } |
389 | 389 | |
@@ -396,18 +396,18 @@ discard block |
||
396 | 396 | * @param string $model_name |
397 | 397 | * @return string |
398 | 398 | */ |
399 | - protected function cptStrategyClass( $model_name ) { |
|
399 | + protected function cptStrategyClass($model_name) { |
|
400 | 400 | // creates classname like: CPT_Event_Strategy |
401 | - $CPT_Strategy_class_name = 'CPT_' . $model_name . '_Strategy'; |
|
401 | + $CPT_Strategy_class_name = 'CPT_'.$model_name.'_Strategy'; |
|
402 | 402 | // load and instantiate |
403 | 403 | $CPT_Strategy = \EE_Registry::instance()->load_core( |
404 | 404 | $CPT_Strategy_class_name, |
405 | - array( 'WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details ) |
|
405 | + array('WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details) |
|
406 | 406 | ); |
407 | - if ( $CPT_Strategy === null ) { |
|
407 | + if ($CPT_Strategy === null) { |
|
408 | 408 | $CPT_Strategy = \EE_Registry::instance()->load_core( |
409 | 409 | 'CPT_Default_Strategy', |
410 | - array( 'WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details ) |
|
410 | + array('WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details) |
|
411 | 411 | ); |
412 | 412 | } |
413 | 413 | return $CPT_Strategy; |
@@ -422,13 +422,13 @@ discard block |
||
422 | 422 | * @param $SQL |
423 | 423 | * @return string |
424 | 424 | */ |
425 | - public function postsFields( $SQL ) { |
|
425 | + public function postsFields($SQL) { |
|
426 | 426 | // does this CPT have a meta table ? |
427 | - if ( $this->meta_table instanceof \EE_Secondary_Table ) { |
|
427 | + if ($this->meta_table instanceof \EE_Secondary_Table) { |
|
428 | 428 | // adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement |
429 | - $SQL .= ', ' . $this->meta_table->get_table_name() . '.* '; |
|
429 | + $SQL .= ', '.$this->meta_table->get_table_name().'.* '; |
|
430 | 430 | } |
431 | - remove_filter( 'posts_fields', array( $this, 'postsFields' ) ); |
|
431 | + remove_filter('posts_fields', array($this, 'postsFields')); |
|
432 | 432 | return $SQL; |
433 | 433 | } |
434 | 434 | |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | * @param $SQL |
442 | 442 | * @return string |
443 | 443 | */ |
444 | - public function postsJoin( $SQL ) { |
|
444 | + public function postsJoin($SQL) { |
|
445 | 445 | // does this CPT have a meta table ? |
446 | - if ( $this->meta_table instanceof \EE_Secondary_Table ) { |
|
446 | + if ($this->meta_table instanceof \EE_Secondary_Table) { |
|
447 | 447 | global $wpdb; |
448 | 448 | // adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement |
449 | 449 | $SQL .= ' LEFT JOIN ' |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | . $wpdb->posts |
457 | 457 | . '.ID ) '; |
458 | 458 | } |
459 | - remove_filter( 'posts_join', array( $this, 'postsJoin' ) ); |
|
459 | + remove_filter('posts_join', array($this, 'postsJoin')); |
|
460 | 460 | return $SQL; |
461 | 461 | } |
462 | 462 | |
@@ -469,17 +469,17 @@ discard block |
||
469 | 469 | * @param \WP_Post[] $posts |
470 | 470 | * @return \WP_Post[] |
471 | 471 | */ |
472 | - public function thePosts( $posts ) { |
|
472 | + public function thePosts($posts) { |
|
473 | 473 | $CPT_class = $this->cpt_details['class_name']; |
474 | 474 | // loop thru posts |
475 | - if ( is_array( $posts ) && $this->model instanceof \EEM_CPT_Base ) { |
|
476 | - foreach ( $posts as $key => $post ) { |
|
477 | - if ( $post->post_type === $this->post_type ) { |
|
478 | - $post->{$CPT_class} = $this->model->instantiate_class_from_post_object( $post ); |
|
475 | + if (is_array($posts) && $this->model instanceof \EEM_CPT_Base) { |
|
476 | + foreach ($posts as $key => $post) { |
|
477 | + if ($post->post_type === $this->post_type) { |
|
478 | + $post->{$CPT_class} = $this->model->instantiate_class_from_post_object($post); |
|
479 | 479 | } |
480 | 480 | } |
481 | 481 | } |
482 | - remove_filter( 'the_posts', array( $this, 'thePosts' ), 1 ); |
|
482 | + remove_filter('the_posts', array($this, 'thePosts'), 1); |
|
483 | 483 | return $posts; |
484 | 484 | } |
485 | 485 | |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | * @param $ID |
491 | 491 | * @return string |
492 | 492 | */ |
493 | - public function getEditPostLink( $url, $ID ) { |
|
493 | + public function getEditPostLink($url, $ID) { |
|
494 | 494 | // need to make sure we only edit links if our cpt |
495 | 495 | global $post; |
496 | 496 | //notice if the cpt is registered with `show_ee_ui` set to false, we take that to mean that the WordPress core ui |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | ! $post instanceof \WP_Post |
500 | 500 | || $post->post_type !== $this->post_type |
501 | 501 | || ( |
502 | - isset( $this->cpt_details['args']['show_ee_ui'] ) |
|
502 | + isset($this->cpt_details['args']['show_ee_ui']) |
|
503 | 503 | && ! $this->cpt_details['args']['show_ee_ui'] |
504 | 504 | ) |
505 | 505 | ) { |
@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | //k made it here so all is good. |
509 | 509 | return wp_nonce_url( |
510 | 510 | add_query_arg( |
511 | - array( 'page' => $this->post_type, 'post' => $ID, 'action' => 'edit' ), |
|
512 | - admin_url( 'admin.php' ) |
|
511 | + array('page' => $this->post_type, 'post' => $ID, 'action' => 'edit'), |
|
512 | + admin_url('admin.php') |
|
513 | 513 | ), |
514 | 514 | 'edit', |
515 | 515 | 'edit_nonce' |
@@ -526,9 +526,9 @@ discard block |
||
526 | 526 | */ |
527 | 527 | public function addTemplateFilters() { |
528 | 528 | // if requested cpt supports page_templates and it's the main query |
529 | - if ( ! empty( $this->cpt_details['args']['page_templates'] ) && $this->wp_query->is_main_query() ) { |
|
529 | + if ( ! empty($this->cpt_details['args']['page_templates']) && $this->wp_query->is_main_query()) { |
|
530 | 530 | // then let's hook into the appropriate query_template hook |
531 | - add_filter( 'single_template', array( $this, 'singleCptTemplate' ) ); |
|
531 | + add_filter('single_template', array($this, 'singleCptTemplate')); |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | |
@@ -542,20 +542,20 @@ discard block |
||
542 | 542 | * @param string $current_template Existing default template path derived for this page call. |
543 | 543 | * @return string the path to the full template file. |
544 | 544 | */ |
545 | - public function singleCptTemplate( $current_template ) { |
|
545 | + public function singleCptTemplate($current_template) { |
|
546 | 546 | $object = get_queried_object(); |
547 | 547 | //does this called object HAVE a page template set that is something other than the default. |
548 | - $template = get_post_meta( $object->ID, '_wp_page_template', true ); |
|
548 | + $template = get_post_meta($object->ID, '_wp_page_template', true); |
|
549 | 549 | //exit early if default or not set or invalid path (accounts for theme changes) |
550 | 550 | if ( |
551 | 551 | $template === 'default' |
552 | - || empty( $template ) |
|
553 | - || ! is_readable( get_stylesheet_directory() . '/' . $template ) |
|
552 | + || empty($template) |
|
553 | + || ! is_readable(get_stylesheet_directory().'/'.$template) |
|
554 | 554 | ) { |
555 | 555 | return $current_template; |
556 | 556 | } |
557 | 557 | //made it here so we SHOULD be able to just locate the template and then return it. |
558 | - return locate_template( array( $template ) ); |
|
558 | + return locate_template(array($template)); |
|
559 | 559 | } |
560 | 560 | |
561 | 561 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * Class EE_Select_Reveal_Input |
4 | 4 | * |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @since 4.6 |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Select_Reveal_Input extends EE_Select_Input{ |
|
14 | +class EE_Select_Reveal_Input extends EE_Select_Input { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @param array $answer_options Array keys which match a sibling section's name |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param array $input_settings |
28 | 28 | */ |
29 | - public function __construct( $answer_options, $input_settings = array() ){ |
|
30 | - parent::__construct( $answer_options, $input_settings ); |
|
29 | + public function __construct($answer_options, $input_settings = array()) { |
|
30 | + parent::__construct($answer_options, $input_settings); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function sibling_sections_controlled() { |
38 | 38 | $sibling_sections = array(); |
39 | - foreach( $this->options() as $sibling_section_name => $sibling_section ) { |
|
39 | + foreach ($this->options() as $sibling_section_name => $sibling_section) { |
|
40 | 40 | //if it's an empty string just leave it alone |
41 | - if( empty( $sibling_section_name ) ) { |
|
41 | + if (empty($sibling_section_name)) { |
|
42 | 42 | continue; |
43 | 43 | } |
44 | - $sibling_section = $this->find_section_from_path( '../' . $sibling_section_name ); |
|
45 | - if( |
|
44 | + $sibling_section = $this->find_section_from_path('../'.$sibling_section_name); |
|
45 | + if ( |
|
46 | 46 | $sibling_section instanceof EE_Form_Section_Base |
47 | - && ! empty( $sibling_section_name ) |
|
47 | + && ! empty($sibling_section_name) |
|
48 | 48 | ) { |
49 | - $sibling_sections[ $sibling_section_name ] = $sibling_section; |
|
49 | + $sibling_sections[$sibling_section_name] = $sibling_section; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | return $sibling_sections; |
@@ -59,16 +59,16 @@ discard block |
||
59 | 59 | * @param array $form_other_js_data |
60 | 60 | * @return array |
61 | 61 | */ |
62 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
63 | - $form_other_js_data = parent::get_other_js_data( $form_other_js_data ); |
|
64 | - if( ! isset($form_other_js_data[ 'select_reveal_inputs' ] ) ) { |
|
65 | - $form_other_js_data[ 'select_reveal_inputs' ] = array(); |
|
62 | + public function get_other_js_data($form_other_js_data = array()) { |
|
63 | + $form_other_js_data = parent::get_other_js_data($form_other_js_data); |
|
64 | + if ( ! isset($form_other_js_data['select_reveal_inputs'])) { |
|
65 | + $form_other_js_data['select_reveal_inputs'] = array(); |
|
66 | 66 | } |
67 | 67 | $sibling_input_to_html_id_map = array(); |
68 | - foreach( $this->sibling_sections_controlled() as $sibling_section_path => $sibling_section ) { |
|
69 | - $sibling_input_to_html_id_map[ $sibling_section_path ] = $sibling_section->html_id(); |
|
68 | + foreach ($this->sibling_sections_controlled() as $sibling_section_path => $sibling_section) { |
|
69 | + $sibling_input_to_html_id_map[$sibling_section_path] = $sibling_section->html_id(); |
|
70 | 70 | } |
71 | - $form_other_js_data[ 'select_reveal_inputs' ][ $this->html_id() ] = $sibling_input_to_html_id_map; |
|
71 | + $form_other_js_data['select_reveal_inputs'][$this->html_id()] = $sibling_input_to_html_id_map; |
|
72 | 72 | return $form_other_js_data; |
73 | 73 | } |
74 | 74 |
@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class EE_Two_Column_Layout extends EE_Form_Section_Layout_Base{ |
|
3 | +class EE_Two_Column_Layout extends EE_Form_Section_Layout_Base { |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Should be used to start teh form section (Eg a table tag, or a div tag, etc.) |
7 | 7 | * @param array $additional_args |
8 | 8 | * @return string |
9 | 9 | */ |
10 | - public function layout_form_begin( $additional_args = array() ) { |
|
11 | - return EEH_HTML::table( '', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style() ) . EEH_HTML::tbody(); |
|
10 | + public function layout_form_begin($additional_args = array()) { |
|
11 | + return EEH_HTML::table('', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style()).EEH_HTML::tbody(); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | * @param array $additional_args |
19 | 19 | * @return string |
20 | 20 | */ |
21 | - public function layout_form_end( $additional_args = array() ) { |
|
22 | - return EEH_HTML::tbodyx() . EEH_HTML::tablex( $this->_form_section->html_id() ); |
|
21 | + public function layout_form_end($additional_args = array()) { |
|
22 | + return EEH_HTML::tbodyx().EEH_HTML::tablex($this->_form_section->html_id()); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
@@ -29,17 +29,17 @@ discard block |
||
29 | 29 | * @param EE_Form_Input_Base $input |
30 | 30 | * @return string |
31 | 31 | */ |
32 | - public function layout_input( $input ) { |
|
32 | + public function layout_input($input) { |
|
33 | 33 | $html = ''; |
34 | - if ( $input instanceof EE_Hidden_Input ) { |
|
34 | + if ($input instanceof EE_Hidden_Input) { |
|
35 | 35 | $html .= $input->get_html_for_input(); |
36 | 36 | } else { |
37 | 37 | $html_for_input = $input->get_html_for_input(); |
38 | - $html_for_input .= $input->get_html_for_errors() != '' ? EEH_HTML::nl() . $input->get_html_for_errors() : ''; |
|
39 | - $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : ''; |
|
38 | + $html_for_input .= $input->get_html_for_errors() != '' ? EEH_HTML::nl().$input->get_html_for_errors() : ''; |
|
39 | + $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl().$input->get_html_for_help() : ''; |
|
40 | 40 | $html .= EEH_HTML::tr( |
41 | - EEH_HTML::th( $input->get_html_for_label() ) . |
|
42 | - EEH_HTML::td( $html_for_input ) |
|
41 | + EEH_HTML::th($input->get_html_for_label()). |
|
42 | + EEH_HTML::td($html_for_input) |
|
43 | 43 | ); |
44 | 44 | } |
45 | 45 | return $html; |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | * @param EE_Form_Section_Proper $form_section |
53 | 53 | * @return string |
54 | 54 | */ |
55 | - public function layout_subsection( $form_section ){ |
|
55 | + public function layout_subsection($form_section) { |
|
56 | 56 | $html = ''; |
57 | - if ( $form_section instanceof EE_Form_Section_HTML ) { |
|
57 | + if ($form_section instanceof EE_Form_Section_HTML) { |
|
58 | 58 | $html .= $form_section->get_html(); |
59 | 59 | } else { |
60 | 60 | $html .= EEH_HTML::tr( |
61 | - EEH_HTML::td( $form_section->get_html(), '', '', '', 'colspan="2"' ) |
|
61 | + EEH_HTML::td($form_section->get_html(), '', '', '', 'colspan="2"') |
|
62 | 62 | ); |
63 | 63 | } |
64 | 64 | return $html; |
@@ -10,14 +10,14 @@ discard block |
||
10 | 10 | * @since 4.6.0 |
11 | 11 | * |
12 | 12 | */ |
13 | -class EE_Div_Per_Section_Layout extends EE_Form_Section_Layout_Base{ |
|
13 | +class EE_Div_Per_Section_Layout extends EE_Form_Section_Layout_Base { |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * opening div tag for a form |
17 | 17 | * @return string |
18 | 18 | */ |
19 | 19 | public function layout_form_begin() { |
20 | - return EEH_HTML::div( '', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style() ); |
|
20 | + return EEH_HTML::div('', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style()); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -26,38 +26,38 @@ discard block |
||
26 | 26 | * @param EE_Form_Input_Base $input |
27 | 27 | * @return string |
28 | 28 | */ |
29 | - public function layout_input( $input ) { |
|
29 | + public function layout_input($input) { |
|
30 | 30 | $html = ''; |
31 | - if ( $input instanceof EE_Hidden_Input ) { |
|
32 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
33 | - } else if ( $input instanceof EE_Submit_Input ) { |
|
34 | - $html .= EEH_HTML::div( $input->get_html_for_input(), $input->html_id() . '-submit-dv', $input->html_class() . '-submit-dv' ); |
|
35 | - } else if ( $input instanceof EE_Select_Input ) { |
|
31 | + if ($input instanceof EE_Hidden_Input) { |
|
32 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
33 | + } else if ($input instanceof EE_Submit_Input) { |
|
34 | + $html .= EEH_HTML::div($input->get_html_for_input(), $input->html_id().'-submit-dv', $input->html_class().'-submit-dv'); |
|
35 | + } else if ($input instanceof EE_Select_Input) { |
|
36 | 36 | $html .= EEH_HTML::div( |
37 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
38 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
39 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
40 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
41 | - $input->html_id() . '-input-dv', |
|
42 | - $input->html_class() . '-input-dv' |
|
37 | + EEH_HTML::nl(1).$input->get_html_for_label(). |
|
38 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
39 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
40 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
41 | + $input->html_id().'-input-dv', |
|
42 | + $input->html_class().'-input-dv' |
|
43 | 43 | ); |
44 | - } else if ( $input instanceof EE_Form_Input_With_Options_Base ) { |
|
44 | + } else if ($input instanceof EE_Form_Input_With_Options_Base) { |
|
45 | 45 | $html .= EEH_HTML::div( |
46 | - EEH_HTML::nl() . $this->_display_label_for_option_type_question( $input ) . |
|
47 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
48 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
49 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
50 | - $input->html_id() . '-input-dv', |
|
51 | - $input->html_class() . '-input-dv' |
|
46 | + EEH_HTML::nl().$this->_display_label_for_option_type_question($input). |
|
47 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
48 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
49 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
50 | + $input->html_id().'-input-dv', |
|
51 | + $input->html_class().'-input-dv' |
|
52 | 52 | ); |
53 | 53 | } else { |
54 | 54 | $html .= EEH_HTML::div( |
55 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
56 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
57 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
58 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
59 | - $input->html_id() . '-input-dv', |
|
60 | - $input->html_class() . '-input-dv' |
|
55 | + EEH_HTML::nl(1).$input->get_html_for_label(). |
|
56 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
57 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
58 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
59 | + $input->html_id().'-input-dv', |
|
60 | + $input->html_class().'-input-dv' |
|
61 | 61 | ); |
62 | 62 | } |
63 | 63 | return $html; |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | * @param EE_Form_Input_With_Options_Base $input |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - protected function _display_label_for_option_type_question( EE_Form_Input_With_Options_Base $input ){ |
|
78 | - if ( $input->display_html_label_text() != '' ) { |
|
79 | - $class = $input->required() ? 'ee-required-label ' . $input->html_label_class() : $input->html_label_class(); |
|
80 | - $label_text = $input->required() ? $input->html_label_text() . '<span class="ee-asterisk">*</span>' : $input->html_label_text(); |
|
81 | - $html = '<div id="' . $input->html_label_id() . '"'; |
|
82 | - $html .= ' class="' . $class . '"'; |
|
83 | - $html .= ' style="' . $input->html_label_style() . '">'; |
|
84 | - $html .= $label_text . '</div>'; |
|
77 | + protected function _display_label_for_option_type_question(EE_Form_Input_With_Options_Base $input) { |
|
78 | + if ($input->display_html_label_text() != '') { |
|
79 | + $class = $input->required() ? 'ee-required-label '.$input->html_label_class() : $input->html_label_class(); |
|
80 | + $label_text = $input->required() ? $input->html_label_text().'<span class="ee-asterisk">*</span>' : $input->html_label_text(); |
|
81 | + $html = '<div id="'.$input->html_label_id().'"'; |
|
82 | + $html .= ' class="'.$class.'"'; |
|
83 | + $html .= ' style="'.$input->html_label_style().'">'; |
|
84 | + $html .= $label_text.'</div>'; |
|
85 | 85 | return $html; |
86 | 86 | } else { |
87 | 87 | return ''; |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @param EE_Form_Section_Proper $form_section |
96 | 96 | * @return string |
97 | 97 | */ |
98 | - public function layout_subsection( $form_section ){ |
|
98 | + public function layout_subsection($form_section) { |
|
99 | 99 | // d( $form_section ); |
100 | - return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
100 | + return EEH_HTML::nl(1).$form_section->get_html().EEH_HTML::nl(-1); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * closing div tag for a form |
106 | 106 | * @return string |
107 | 107 | */ |
108 | - public function layout_form_end(){ |
|
109 | - return EEH_HTML::divx( $this->_form_section->html_id(), $this->_form_section->html_class() ); |
|
108 | + public function layout_form_end() { |
|
109 | + return EEH_HTML::divx($this->_form_section->html_id(), $this->_form_section->html_class()); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | \ No newline at end of file |