@@ -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 | * |
@@ -799,7 +799,6 @@ |
||
799 | 799 | |
800 | 800 | |
801 | 801 | /** |
802 | - |
|
803 | 802 | * |
804 | 803 | * If the the first date starts at midnight on one day, and the next date ends at midnight on the |
805 | 804 | * very next day then this method will return true. |
@@ -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 ''; |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | /** |
6 | 7 | * Event Espresso |
7 | 8 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_Form_Section_HTML_From_Template extends EE_Form_Section_HTML{ |
|
29 | - public function __construct($template_file,$args = array(), $options_array = array()) { |
|
30 | - $html = EEH_Template::locate_template( $template_file, $args ); |
|
28 | +class EE_Form_Section_HTML_From_Template extends EE_Form_Section_HTML { |
|
29 | + public function __construct($template_file, $args = array(), $options_array = array()) { |
|
30 | + $html = EEH_Template::locate_template($template_file, $args); |
|
31 | 31 | |
32 | 32 | // echo " filepath:$template_file html $html"; |
33 | 33 | parent::__construct($html, $options_array); |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | /** |
6 | 7 | * Event Espresso |
7 | 8 | * |
@@ -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 | /** |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * ------------------------------------------------------------------------ |
26 | 26 | */ |
27 | -class EE_Credit_Card_Month_Input extends EE_Month_Input{ |
|
27 | +class EE_Credit_Card_Month_Input extends EE_Month_Input { |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * @param bool $leading_zero |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | $leading_zero = false, |
36 | 36 | $input_settings = array(), |
37 | 37 | $january_is_month_1 = true |
38 | - ){ |
|
39 | - $this->set_sensitive_data_removal_strategy( new EE_All_Sensitive_Data_Removal() ); |
|
38 | + ) { |
|
39 | + $this->set_sensitive_data_removal_strategy(new EE_All_Sensitive_Data_Removal()); |
|
40 | 40 | parent::__construct( |
41 | 41 | $leading_zero, |
42 | 42 | $input_settings, |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -53,7 +54,7 @@ discard block |
||
53 | 54 | EEH_HTML::indent( 1, 'select' ); |
54 | 55 | if( EEH_Array::is_multi_dimensional_array( $this->_input->options() )){ |
55 | 56 | throw new EE_Error(sprintf(__("Select multiple display strategy does not allow for nested arrays of options.", "event_espresso"))); |
56 | - }else{ |
|
57 | + } else{ |
|
57 | 58 | $html.=$this->_display_options( $this->_input->options() ); |
58 | 59 | } |
59 | 60 |
@@ -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 | /** |
@@ -24,18 +24,18 @@ discard block |
||
24 | 24 | * |
25 | 25 | * ------------------------------------------------------------------------ |
26 | 26 | */ |
27 | -class EE_Year_Input extends EE_Select_Input{ |
|
27 | +class EE_Year_Input extends EE_Select_Input { |
|
28 | 28 | |
29 | - function __construct( $input_settings = array(), $four_digit_year = true, $years_behind = 100, $years_ahead = 0 ){ |
|
30 | - if($four_digit_year){ |
|
29 | + function __construct($input_settings = array(), $four_digit_year = true, $years_behind = 100, $years_ahead = 0) { |
|
30 | + if ($four_digit_year) { |
|
31 | 31 | $current_year_int = intval(date('Y')); |
32 | - }else{ |
|
32 | + } else { |
|
33 | 33 | $current_year_int = intval(date('y')); |
34 | 34 | } |
35 | 35 | $answer_options = array(); |
36 | - for( $start = $current_year_int - $years_behind; $start <= ($current_year_int + $years_ahead); $start++){ |
|
36 | + for ($start = $current_year_int - $years_behind; $start <= ($current_year_int + $years_ahead); $start++) { |
|
37 | 37 | $answer_options[$start] = $start; |
38 | 38 | } |
39 | - parent::__construct( $answer_options, $input_settings ); |
|
39 | + parent::__construct($answer_options, $input_settings); |
|
40 | 40 | } |
41 | 41 | } |
@@ -90,7 +90,7 @@ |
||
90 | 90 | //so in case teh IPN is arriving later, let's try to process an IPN! |
91 | 91 | if($_SERVER['REQUEST_METHOD'] == 'POST'){ |
92 | 92 | return $this->handle_ipn($_POST, $transaction ); |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | return parent::finalize_payment_for( $transaction ); |
95 | 95 | } |
96 | 96 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Admin_File_Uploader_Display_Strategy extends EE_Display_Strategy_Base{ |
|
11 | +class EE_Admin_File_Uploader_Display_Strategy extends EE_Display_Strategy_Base { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Its important this media only get enqueued AFTER init, but before the footer... where the |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | * this input displayed. |
21 | 21 | * @deprecated. enqueue_js should be called automatically now |
22 | 22 | */ |
23 | - static function enqueue_scripts(){ |
|
24 | - EE_Error::doing_it_wrong( __FUNCTION__, __( 'EE_Admin_File_Uploader_Display_Strategy::enqueue_scripts() no longer needs to be called in order to display the admin uploader input correctly. This is handled now by EE_Admin_File_Uploader_Display_Strategy::enqueue_js() which is called automatically when enqueueing JS and CSS for the form'), '4.9.8.rc.015' ); |
|
23 | + static function enqueue_scripts() { |
|
24 | + EE_Error::doing_it_wrong(__FUNCTION__, __('EE_Admin_File_Uploader_Display_Strategy::enqueue_scripts() no longer needs to be called in order to display the admin uploader input correctly. This is handled now by EE_Admin_File_Uploader_Display_Strategy::enqueue_js() which is called automatically when enqueueing JS and CSS for the form'), '4.9.8.rc.015'); |
|
25 | 25 | wp_enqueue_media(); |
26 | 26 | wp_enqueue_script('media-upload'); |
27 | - wp_enqueue_script('ee-payments',EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js'); |
|
27 | + wp_enqueue_script('ee-payments', EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function enqueue_js() { |
34 | 34 | wp_enqueue_media(); |
35 | 35 | wp_enqueue_script('media-upload'); |
36 | - wp_enqueue_script('ee-payments',EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js'); |
|
36 | + wp_enqueue_script('ee-payments', EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js'); |
|
37 | 37 | parent::enqueue_js(); |
38 | 38 | } |
39 | 39 | |
@@ -44,19 +44,19 @@ discard block |
||
44 | 44 | * @return string of html to display the field |
45 | 45 | */ |
46 | 46 | |
47 | - function display(){ |
|
47 | + function display() { |
|
48 | 48 | // the actual input |
49 | 49 | $input = '<input type="text" size="34" '; |
50 | - $input .= 'name="' . $this->_input->html_name() . '" '; |
|
51 | - $input .= $this->_input->html_class() != '' ? 'class="large-text ee_media_url ' . $this->_input->html_class() . '" ' : 'class="large-text ee_media_url" '; |
|
52 | - $input .= 'value="' . $this->_input->raw_value_in_form() . '" '; |
|
53 | - $input .= $this->_input->other_html_attributes() . '>'; |
|
50 | + $input .= 'name="'.$this->_input->html_name().'" '; |
|
51 | + $input .= $this->_input->html_class() != '' ? 'class="large-text ee_media_url '.$this->_input->html_class().'" ' : 'class="large-text ee_media_url" '; |
|
52 | + $input .= 'value="'.$this->_input->raw_value_in_form().'" '; |
|
53 | + $input .= $this->_input->other_html_attributes().'>'; |
|
54 | 54 | // image uploader |
55 | - $uploader = EEH_HTML::link( '#', '<img src="' . admin_url( 'images/media-button-image.gif' ) . '" >', __( 'click to add an image', 'event_espresso' ), '', 'ee_media_upload' ); |
|
55 | + $uploader = EEH_HTML::link('#', '<img src="'.admin_url('images/media-button-image.gif').'" >', __('click to add an image', 'event_espresso'), '', 'ee_media_upload'); |
|
56 | 56 | //only attempt to show the image if it at least exists |
57 | - $image = $this->src_exists( $this->_input->raw_value() ) ? EEH_HTML::br(2) . EEH_HTML::img( $this->_input->raw_value(), __( 'logo', 'event_espresso' ), '', 'ee_media_image' ) : ''; |
|
57 | + $image = $this->src_exists($this->_input->raw_value()) ? EEH_HTML::br(2).EEH_HTML::img($this->_input->raw_value(), __('logo', 'event_espresso'), '', 'ee_media_image') : ''; |
|
58 | 58 | // html string |
59 | - return EEH_HTML::div( $input . EEH_HTML::nbsp() . $uploader . $image, '', 'ee_media_uploader_area' ); |
|
59 | + return EEH_HTML::div($input.EEH_HTML::nbsp().$uploader.$image, '', 'ee_media_uploader_area'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | * @param string $src |
68 | 68 | * @return boolean |
69 | 69 | */ |
70 | - protected function src_exists( $src ){ |
|
71 | - $results = wp_remote_head( $src ); |
|
72 | - if( is_array( $results) && ! $results instanceof WP_Error){ |
|
73 | - return strpos($results['headers']['content-type'], "image" ) !== FALSE; |
|
74 | - }else{ |
|
70 | + protected function src_exists($src) { |
|
71 | + $results = wp_remote_head($src); |
|
72 | + if (is_array($results) && ! $results instanceof WP_Error) { |
|
73 | + return strpos($results['headers']['content-type'], "image") !== FALSE; |
|
74 | + } else { |
|
75 | 75 | return FALSE; |
76 | 76 | } |
77 | 77 | } |
@@ -90,7 +90,7 @@ |
||
90 | 90 | //so in case teh IPN is arriving later, let's try to process an IPN! |
91 | 91 | if($_SERVER['REQUEST_METHOD'] == 'POST'){ |
92 | 92 | return $this->handle_ipn($_POST, $transaction ); |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | return parent::finalize_payment_for( $transaction ); |
95 | 95 | } |
96 | 96 | } |
@@ -4,9 +4,9 @@ |
||
4 | 4 | |
5 | 5 | |
6 | 6 | /** |
7 | - * |
|
8 | - * @return string of html to display the field |
|
9 | - */ |
|
7 | + * |
|
8 | + * @return string of html to display the field |
|
9 | + */ |
|
10 | 10 | function display(){ |
11 | 11 | $input = $this->_input; |
12 | 12 | $raw_value = maybe_serialize($input->raw_value()); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -class EE_Text_Area_Display_Strategy extends EE_Display_Strategy_Base{ |
|
2 | +class EE_Text_Area_Display_Strategy extends EE_Display_Strategy_Base { |
|
3 | 3 | |
4 | 4 | |
5 | 5 | |
@@ -7,32 +7,32 @@ discard block |
||
7 | 7 | * |
8 | 8 | * @return string of html to display the field |
9 | 9 | */ |
10 | - function display(){ |
|
10 | + function display() { |
|
11 | 11 | $input = $this->_input; |
12 | 12 | $raw_value = maybe_serialize($input->raw_value()); |
13 | - if( $input instanceof EE_Text_Area_Input ) { |
|
13 | + if ($input instanceof EE_Text_Area_Input) { |
|
14 | 14 | $rows = $input->get_rows(); |
15 | 15 | $cols = $input->get_cols(); |
16 | - }else{ |
|
16 | + } else { |
|
17 | 17 | $rows = 4; |
18 | 18 | $cols = 20; |
19 | 19 | } |
20 | 20 | $html = '<textarea'; |
21 | - $html .= ' id="' . $input->html_id() . '"'; |
|
22 | - $html .= ' name="' . $input->html_name() . '"'; |
|
23 | - $html .= ' class="' . $input->html_class() . '"' ; |
|
24 | - $html .= ' style="' . $input->html_style() . '"'; |
|
21 | + $html .= ' id="'.$input->html_id().'"'; |
|
22 | + $html .= ' name="'.$input->html_name().'"'; |
|
23 | + $html .= ' class="'.$input->html_class().'"'; |
|
24 | + $html .= ' style="'.$input->html_style().'"'; |
|
25 | 25 | $html .= $input->other_html_attributes(); |
26 | - $html .= ' rows= "' . $rows . '" cols="' . $cols . '">'; |
|
26 | + $html .= ' rows= "'.$rows.'" cols="'.$cols.'">'; |
|
27 | 27 | $html .= $raw_value; |
28 | 28 | $html .= '</textarea>'; |
29 | - foreach ( $this->_input->get_validation_strategies() as $validation_strategy ) { |
|
29 | + foreach ($this->_input->get_validation_strategies() as $validation_strategy) { |
|
30 | 30 | if ( |
31 | 31 | $validation_strategy instanceof EE_Simple_HTML_Validation_Strategy |
32 | 32 | || $validation_strategy instanceof EE_Full_HTML_Validation_Strategy |
33 | 33 | ) { |
34 | 34 | $html .= sprintf( |
35 | - __( '%1$s(allowed tags: %2$s)%3$s', 'event_espresso' ), |
|
35 | + __('%1$s(allowed tags: %2$s)%3$s', 'event_espresso'), |
|
36 | 36 | '<p class="ee-question-desc">', |
37 | 37 | $validation_strategy->get_list_of_allowed_tags(), |
38 | 38 | '</p>' |
@@ -90,7 +90,7 @@ |
||
90 | 90 | //so in case teh IPN is arriving later, let's try to process an IPN! |
91 | 91 | if($_SERVER['REQUEST_METHOD'] == 'POST'){ |
92 | 92 | return $this->handle_ipn($_POST, $transaction ); |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | return parent::finalize_payment_for( $transaction ); |
95 | 95 | } |
96 | 96 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * stating where the proper subsections should be placed (but usually leaving them to layout |
9 | 9 | * their own headers and footers etc). |
10 | 10 | */ |
11 | -abstract class EE_Form_Section_Layout_Base{ |
|
11 | +abstract class EE_Form_Section_Layout_Base { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Form form section to lay out |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * __construct |
23 | 23 | */ |
24 | - function __construct(){ |
|
24 | + function __construct() { |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * The form section on which this strategy is to perform |
31 | 31 | * @param EE_Form_Section_Proper $form |
32 | 32 | */ |
33 | - function _construct_finalize(EE_Form_Section_Proper $form){ |
|
33 | + function _construct_finalize(EE_Form_Section_Proper $form) { |
|
34 | 34 | $this->_form_section = $form; |
35 | 35 | } |
36 | 36 | |
@@ -53,28 +53,28 @@ discard block |
||
53 | 53 | * Returns the HTML |
54 | 54 | * @return string HTML for displaying |
55 | 55 | */ |
56 | - function layout_form(){ |
|
56 | + function layout_form() { |
|
57 | 57 | $html = ''; |
58 | 58 | // layout_form_begin |
59 | 59 | $html .= apply_filters( |
60 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_' . $this->_form_section->name(), |
|
60 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_'.$this->_form_section->name(), |
|
61 | 61 | $this->layout_form_begin(), |
62 | 62 | $this->_form_section |
63 | 63 | ); |
64 | 64 | // layout_form_loop |
65 | 65 | $html .= apply_filters( |
66 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_' . $this->_form_section->name(), |
|
66 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_'.$this->_form_section->name(), |
|
67 | 67 | $this->layout_form_loop(), |
68 | 68 | $this->_form_section |
69 | 69 | ); |
70 | 70 | // layout_form_end |
71 | 71 | $html .= apply_filters( |
72 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_' . $this->_form_section->name(), |
|
72 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_'.$this->_form_section->name(), |
|
73 | 73 | $this->layout_form_end(), |
74 | 74 | $this->_form_section |
75 | 75 | ); |
76 | 76 | |
77 | - $html = $this->add_form_section_hooks_and_filters( $html ); |
|
77 | + $html = $this->add_form_section_hooks_and_filters($html); |
|
78 | 78 | return $html; |
79 | 79 | } |
80 | 80 | |
@@ -83,20 +83,20 @@ discard block |
||
83 | 83 | /** |
84 | 84 | * @return string |
85 | 85 | */ |
86 | - function layout_form_loop(){ |
|
86 | + function layout_form_loop() { |
|
87 | 87 | $html = ''; |
88 | - foreach( $this->_form_section->subsections() as $name => $subsection ){ |
|
89 | - if ( $subsection instanceof EE_Form_Input_Base ){ |
|
88 | + foreach ($this->_form_section->subsections() as $name => $subsection) { |
|
89 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
90 | 90 | $html .= apply_filters( |
91 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_' . $name . '__in_' . $this->_form_section->name(), |
|
92 | - $this->layout_input( $subsection ), |
|
91 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_'.$name.'__in_'.$this->_form_section->name(), |
|
92 | + $this->layout_input($subsection), |
|
93 | 93 | $this->_form_section, |
94 | 94 | $subsection |
95 | 95 | ); |
96 | - } elseif ( $subsection instanceof EE_Form_Section_Base ){ |
|
96 | + } elseif ($subsection instanceof EE_Form_Section_Base) { |
|
97 | 97 | $html .= apply_filters( |
98 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_' . $name . '__in_' . $this->_form_section->name(), |
|
99 | - $this->layout_subsection( $subsection ), |
|
98 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_'.$name.'__in_'.$this->_form_section->name(), |
|
99 | + $this->layout_subsection($subsection), |
|
100 | 100 | $this->_form_section, |
101 | 101 | $subsection |
102 | 102 | ); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @param EE_Form_Section_Base $subsection |
145 | 145 | * @return string html |
146 | 146 | */ |
147 | - abstract function layout_subsection( $subsection ); |
|
147 | + abstract function layout_subsection($subsection); |
|
148 | 148 | |
149 | 149 | |
150 | 150 | |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | * @param EE_Form_Input_Base $input |
154 | 154 | * @return string |
155 | 155 | */ |
156 | - public function display_label($input){ |
|
157 | - $class = $input->required() ? 'ee-required-label ' . $input->html_label_class() : $input->html_label_class(); |
|
158 | - $label_text = $input->required() ? $input->html_label_text() . '<span class="ee-asterisk">*</span>' : $input->html_label_text(); |
|
159 | - return '<label id="' . $input->html_label_id() . '" class="' . $class . '" style="' . $input->html_label_style() . '" for="' . $input->html_name() . '">' . $label_text . '</label>'; |
|
156 | + public function display_label($input) { |
|
157 | + $class = $input->required() ? 'ee-required-label '.$input->html_label_class() : $input->html_label_class(); |
|
158 | + $label_text = $input->required() ? $input->html_label_text().'<span class="ee-asterisk">*</span>' : $input->html_label_text(); |
|
159 | + return '<label id="'.$input->html_label_id().'" class="'.$class.'" style="'.$input->html_label_style().'" for="'.$input->html_name().'">'.$label_text.'</label>'; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | * @param EE_Form_Input_Base $input |
170 | 170 | * @return string |
171 | 171 | */ |
172 | - public function display_errors($input){ |
|
173 | - if( $input->get_validation_errors() ){ |
|
174 | - return "<label id='" . $input->html_id() . "-error' class='error' for='{$input->html_name()}'>" . $input->get_validation_error_string() . "</label>"; |
|
175 | - }else{ |
|
172 | + public function display_errors($input) { |
|
173 | + if ($input->get_validation_errors()) { |
|
174 | + return "<label id='".$input->html_id()."-error' class='error' for='{$input->html_name()}'>".$input->get_validation_error_string()."</label>"; |
|
175 | + } else { |
|
176 | 176 | return ''; |
177 | 177 | } |
178 | 178 | } |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | * @param EE_Form_Input_Base $input |
183 | 183 | * @return string |
184 | 184 | */ |
185 | - public function display_help_text( $input ){ |
|
186 | - if ( $input->html_help_text() != '' ) { |
|
185 | + public function display_help_text($input) { |
|
186 | + if ($input->html_help_text() != '') { |
|
187 | 187 | $tag = is_admin() ? 'p' : 'span'; |
188 | - return '<' . $tag . ' id="' . $input->html_id() . '-help" class="' . $input->html_help_class() . '" style="' . $input->html_help_style() . '">' . $input->html_help_text() . '</' . $tag . '>'; |
|
188 | + return '<'.$tag.' id="'.$input->html_id().'-help" class="'.$input->html_help_class().'" style="'.$input->html_help_style().'">'.$input->html_help_text().'</'.$tag.'>'; |
|
189 | 189 | } |
190 | 190 | return ''; |
191 | 191 | } |
@@ -197,13 +197,13 @@ discard block |
||
197 | 197 | * @param string $html |
198 | 198 | * @return string |
199 | 199 | */ |
200 | - public function add_form_section_hooks_and_filters( $html ){ |
|
200 | + public function add_form_section_hooks_and_filters($html) { |
|
201 | 201 | // replace dashes and spaces with underscores |
202 | - $hook_name = str_replace( array( '-', ' ' ), '_', $this->_form_section->html_id() ); |
|
203 | - do_action( 'AHEE__Form_Section_Layout__' . $hook_name, $this->_form_section ); |
|
204 | - $html = apply_filters( 'AFEE__Form_Section_Layout__' . $hook_name . '__html', $html, $this->_form_section ); |
|
205 | - $html .= EEH_HTML::nl() . '<!-- AHEE__Form_Section_Layout__' . $hook_name . '__html -->'; |
|
206 | - $html .= EEH_HTML::nl() . '<!-- AFEE__Form_Section_Layout__' . $hook_name . ' -->'; |
|
202 | + $hook_name = str_replace(array('-', ' '), '_', $this->_form_section->html_id()); |
|
203 | + do_action('AHEE__Form_Section_Layout__'.$hook_name, $this->_form_section); |
|
204 | + $html = apply_filters('AFEE__Form_Section_Layout__'.$hook_name.'__html', $html, $this->_form_section); |
|
205 | + $html .= EEH_HTML::nl().'<!-- AHEE__Form_Section_Layout__'.$hook_name.'__html -->'; |
|
206 | + $html .= EEH_HTML::nl().'<!-- AFEE__Form_Section_Layout__'.$hook_name.' -->'; |
|
207 | 207 | return $html; |
208 | 208 | } |
209 | 209 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $validation_error_message = $default_validation_strategy->get_validation_error_message(); |
43 | 43 | } |
44 | 44 | throw new EE_Validation_Error( $validation_error_message, 'float_only' ); |
45 | - }else{ |
|
45 | + } else{ |
|
46 | 46 | return floatval($normalized_value); |
47 | 47 | } |
48 | 48 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function unnormalize($normalized_value) { |
56 | 56 | if( empty( $normalized_value ) ){ |
57 | 57 | return '0.00'; |
58 | - }else{ |
|
58 | + } else{ |
|
59 | 59 | return "$normalized_value"; |
60 | 60 | } |
61 | 61 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -class EE_Template_Layout extends EE_Div_Per_Section_Layout{ |
|
24 | +class EE_Template_Layout extends EE_Div_Per_Section_Layout { |
|
25 | 25 | |
26 | 26 | protected $_layout_template_file = NULL; |
27 | 27 | protected $_layout_begin_template_file = NULL; |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | * @type array $_template_args |
43 | 43 | * } |
44 | 44 | */ |
45 | - public function __construct( $template_options = array() ) { |
|
45 | + public function __construct($template_options = array()) { |
|
46 | 46 | // loop thru incoming options |
47 | - foreach( $template_options as $key => $value ) { |
|
47 | + foreach ($template_options as $key => $value) { |
|
48 | 48 | // add underscore to $key to match property names |
49 | - $_key = '_' . $key; |
|
50 | - if ( property_exists( $this, $_key )) { |
|
49 | + $_key = '_'.$key; |
|
50 | + if (property_exists($this, $_key)) { |
|
51 | 51 | $this->{$_key} = $value; |
52 | 52 | } |
53 | 53 | } |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | * @return string |
66 | 66 | */ |
67 | 67 | public function layout_form() { |
68 | - if ( $this->_layout_template_file ) { |
|
69 | - return EEH_Template::locate_template( $this->_layout_template_file, $this->template_args(), TRUE, TRUE ); |
|
68 | + if ($this->_layout_template_file) { |
|
69 | + return EEH_Template::locate_template($this->_layout_template_file, $this->template_args(), TRUE, TRUE); |
|
70 | 70 | } else { |
71 | 71 | return parent::layout_form(); |
72 | 72 | } |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return string |
80 | 80 | */ |
81 | 81 | public function layout_form_begin() { |
82 | - if($this->_layout_begin_template_file){ |
|
83 | - return EEH_Template::locate_template( $this->_layout_begin_template_file, $this->template_args(), TRUE, TRUE ); |
|
84 | - }else{ |
|
82 | + if ($this->_layout_begin_template_file) { |
|
83 | + return EEH_Template::locate_template($this->_layout_begin_template_file, $this->template_args(), TRUE, TRUE); |
|
84 | + } else { |
|
85 | 85 | return parent::layout_form_begin(); |
86 | 86 | } |
87 | 87 | } |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | * @param EE_Form_Input_Base $input |
95 | 95 | * @return string |
96 | 96 | */ |
97 | - public function layout_input( $input ) { |
|
98 | - if($this->_input_template_file){ |
|
99 | - return EEH_Template::locate_template( $this->_input_template_file, array( 'input' => $input ), TRUE, TRUE ); |
|
97 | + public function layout_input($input) { |
|
98 | + if ($this->_input_template_file) { |
|
99 | + return EEH_Template::locate_template($this->_input_template_file, array('input' => $input), TRUE, TRUE); |
|
100 | 100 | } |
101 | 101 | return parent::layout_input($input); |
102 | 102 | } |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | * @param EE_Form_Section_Proper $form_section |
110 | 110 | * @return string |
111 | 111 | */ |
112 | - public function layout_subsection( $form_section ) { |
|
113 | - if($this->_subsection_template_file){ |
|
114 | - return EEH_Template::locate_template( $this->_subsection_template_file, $this->template_args(), TRUE, TRUE ); |
|
112 | + public function layout_subsection($form_section) { |
|
113 | + if ($this->_subsection_template_file) { |
|
114 | + return EEH_Template::locate_template($this->_subsection_template_file, $this->template_args(), TRUE, TRUE); |
|
115 | 115 | } |
116 | - return parent::layout_subsection( $form_section ); |
|
116 | + return parent::layout_subsection($form_section); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | * @return string |
124 | 124 | */ |
125 | 125 | public function layout_form_end() { |
126 | - if($this->_layout_end_template_file){ |
|
127 | - return EEH_Template::locate_template( $this->_layout_end_template_file, $this->template_args(), TRUE, TRUE); |
|
128 | - }else{ |
|
126 | + if ($this->_layout_end_template_file) { |
|
127 | + return EEH_Template::locate_template($this->_layout_end_template_file, $this->template_args(), TRUE, TRUE); |
|
128 | + } else { |
|
129 | 129 | return parent::layout_form_end(); |
130 | 130 | } |
131 | 131 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | /** |
136 | 136 | * @param array $template_args |
137 | 137 | */ |
138 | - public function set_template_args( $template_args = array() ) { |
|
138 | + public function set_template_args($template_args = array()) { |
|
139 | 139 | $this->_template_args = $template_args; |
140 | 140 | } |
141 | 141 | |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | /** |
145 | 145 | * @param array $template_args |
146 | 146 | */ |
147 | - public function add_template_args( $template_args = array() ) { |
|
148 | - $this->_template_args = array_merge_recursive( $this->_template_args, $template_args ); |
|
147 | + public function add_template_args($template_args = array()) { |
|
148 | + $this->_template_args = array_merge_recursive($this->_template_args, $template_args); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | * @return array |
155 | 155 | */ |
156 | 156 | public function template_args() { |
157 | - foreach ( $this->form_section()->subsections() as $subsection_name => $subsection ) { |
|
158 | - $subsection_name = self::prep_form_subsection_key_name( $subsection_name ); |
|
159 | - if ( strpos( $subsection_name, '[' ) !== FALSE ) { |
|
160 | - $sub_name = explode( '[', $subsection_name ); |
|
161 | - $this->_template_args[ $sub_name[0] ][ rtrim( $sub_name[1], ']' ) ] = $this->layout_subsection( $subsection ); |
|
157 | + foreach ($this->form_section()->subsections() as $subsection_name => $subsection) { |
|
158 | + $subsection_name = self::prep_form_subsection_key_name($subsection_name); |
|
159 | + if (strpos($subsection_name, '[') !== FALSE) { |
|
160 | + $sub_name = explode('[', $subsection_name); |
|
161 | + $this->_template_args[$sub_name[0]][rtrim($sub_name[1], ']')] = $this->layout_subsection($subsection); |
|
162 | 162 | } else { |
163 | - $this->_template_args[ $subsection_name ] = $this->layout_subsection( $subsection ); |
|
163 | + $this->_template_args[$subsection_name] = $this->layout_subsection($subsection); |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | // d( $this->_template_args ); |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | * @param string $subsection_name |
177 | 177 | * @return string |
178 | 178 | */ |
179 | - public static function prep_form_subsection_key_name( $subsection_name = '' ) { |
|
180 | - $subsection_name = str_replace( array( '-', ' ' ), array( '', '_' ), $subsection_name ); |
|
181 | - return is_numeric( substr( $subsection_name, 0, 1 )) ? 'form_' . $subsection_name : $subsection_name; |
|
179 | + public static function prep_form_subsection_key_name($subsection_name = '') { |
|
180 | + $subsection_name = str_replace(array('-', ' '), array('', '_'), $subsection_name); |
|
181 | + return is_numeric(substr($subsection_name, 0, 1)) ? 'form_'.$subsection_name : $subsection_name; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | * @param string $subsection_name |
191 | 191 | * @return string |
192 | 192 | */ |
193 | - public static function get_subform_name( $subsection_name = '' ) { |
|
194 | - return EE_Template_Layout::prep_form_subsection_key_name( $subsection_name ); |
|
193 | + public static function get_subform_name($subsection_name = '') { |
|
194 | + return EE_Template_Layout::prep_form_subsection_key_name($subsection_name); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 |
@@ -90,7 +90,7 @@ |
||
90 | 90 | //so in case teh IPN is arriving later, let's try to process an IPN! |
91 | 91 | if($_SERVER['REQUEST_METHOD'] == 'POST'){ |
92 | 92 | return $this->handle_ipn($_POST, $transaction ); |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | return parent::finalize_payment_for( $transaction ); |
95 | 95 | } |
96 | 96 | } |
@@ -8,18 +8,18 @@ discard block |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Required_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
11 | +class EE_Required_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
12 | 12 | |
13 | 13 | |
14 | 14 | |
15 | 15 | /** |
16 | 16 | * @param string $validation_error_message |
17 | 17 | */ |
18 | - public function __construct( $validation_error_message = null ) { |
|
19 | - if( ! $validation_error_message ){ |
|
18 | + public function __construct($validation_error_message = null) { |
|
19 | + if ( ! $validation_error_message) { |
|
20 | 20 | $validation_error_message = __("This field is required.", "event_espresso"); |
21 | 21 | } |
22 | - parent::__construct( $validation_error_message ); |
|
22 | + parent::__construct($validation_error_message); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | * @throws \EE_Validation_Error |
35 | 35 | */ |
36 | 36 | public function validate($normalized_value) { |
37 | - if( |
|
37 | + if ( |
|
38 | 38 | $normalized_value === '' |
39 | 39 | || $normalized_value === null |
40 | 40 | || $normalized_value === array() |
41 | 41 | ) { |
42 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'required'); |
|
43 | - }else{ |
|
42 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
43 | + } else { |
|
44 | 44 | return true; |
45 | 45 | } |
46 | 46 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @return array |
52 | 52 | * @throws \EE_Error |
53 | 53 | */ |
54 | - public function get_jquery_validation_rule_array(){ |
|
54 | + public function get_jquery_validation_rule_array() { |
|
55 | 55 | return array( |
56 | 56 | 'required'=> true, |
57 | 57 | 'messages' => array( |