@@ -1,4 +1,6 @@ discard block |
||
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 | * |
@@ -432,7 +434,7 @@ discard block |
||
432 | 434 | if($include_expired === null){ |
433 | 435 | if($event instanceof EE_Event && $event->is_expired()){ |
434 | 436 | $include_expired = true; |
435 | - }else{ |
|
437 | + } else{ |
|
436 | 438 | $include_expired = false; |
437 | 439 | } |
438 | 440 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * get_event |
37 | 37 | * attempts to retrieve an EE_Event object any way it can |
38 | 38 | * |
39 | - * @param int|WP_Post $EVT_ID |
|
39 | + * @param integer $EVT_ID |
|
40 | 40 | * @return EE_Event|null |
41 | 41 | * @throws \EE_Error |
42 | 42 | */ |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @access public |
115 | 115 | * @param int $EVT_ID |
116 | - * @return string |
|
116 | + * @return boolean |
|
117 | 117 | */ |
118 | 118 | public static function event_has_content_or_excerpt( $EVT_ID = 0 ) { |
119 | 119 | $event = EEH_Event_View::get_event( $EVT_ID ); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * event_active_status |
134 | 134 | * |
135 | 135 | * @access public |
136 | - * @param null $num_words |
|
136 | + * @param integer $num_words |
|
137 | 137 | * @param null $more |
138 | 138 | * @return string |
139 | 139 | */ |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * |
445 | 445 | * @access public |
446 | 446 | * @param int $EVT_ID |
447 | - * @param null $include_expired |
|
447 | + * @param false|null $include_expired |
|
448 | 448 | * @param bool $include_deleted |
449 | 449 | * @param null $limit |
450 | 450 | * @return EE_Datetime[] |
@@ -32,51 +32,51 @@ discard block |
||
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * get_event |
|
37 | - * attempts to retrieve an EE_Event object any way it can |
|
38 | - * |
|
39 | - * @param int|WP_Post $EVT_ID |
|
40 | - * @return EE_Event|null |
|
41 | - * @throws \EE_Error |
|
42 | - */ |
|
43 | - public static function get_event($EVT_ID = 0) |
|
44 | - { |
|
45 | - // international newspaper? |
|
46 | - global $post; |
|
47 | - $EVT_ID = $EVT_ID instanceof WP_Post && $EVT_ID->post_type === 'espresso_events' |
|
48 | - ? $EVT_ID->ID |
|
49 | - : absint($EVT_ID); |
|
50 | - // do we already have the Event you are looking for? |
|
51 | - if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) { |
|
52 | - return EEH_Event_View::$_event; |
|
53 | - } |
|
54 | - //reset property so that the new event is cached. |
|
55 | - EEH_Event_View::$_event = null; |
|
56 | - if (! $EVT_ID && $post instanceof EE_Event) { |
|
57 | - EEH_Event_View::$_event = $post; |
|
58 | - return EEH_Event_View::$_event; |
|
59 | - } |
|
60 | - //if the post type is for an event and it has a cached event and we don't have a different incoming $EVT_ID |
|
61 | - //then let's just use that cached event on the $post object. |
|
62 | - if ( |
|
63 | - $post instanceof WP_Post |
|
64 | - && $post->post_type === 'espresso_events' |
|
65 | - && isset($post->EE_Event) |
|
66 | - && ( |
|
67 | - $EVT_ID === 0 |
|
68 | - || $EVT_ID === $post->ID |
|
69 | - ) |
|
70 | - ) { |
|
71 | - EEH_Event_View::$_event = $post->EE_Event; |
|
72 | - return EEH_Event_View::$_event; |
|
73 | - } |
|
74 | - //If the event we have isn't an event but we do have an EVT_ID, let's try getting the event using the ID. |
|
75 | - if (! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
76 | - EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
77 | - } |
|
78 | - return EEH_Event_View::$_event; |
|
79 | - } |
|
35 | + /** |
|
36 | + * get_event |
|
37 | + * attempts to retrieve an EE_Event object any way it can |
|
38 | + * |
|
39 | + * @param int|WP_Post $EVT_ID |
|
40 | + * @return EE_Event|null |
|
41 | + * @throws \EE_Error |
|
42 | + */ |
|
43 | + public static function get_event($EVT_ID = 0) |
|
44 | + { |
|
45 | + // international newspaper? |
|
46 | + global $post; |
|
47 | + $EVT_ID = $EVT_ID instanceof WP_Post && $EVT_ID->post_type === 'espresso_events' |
|
48 | + ? $EVT_ID->ID |
|
49 | + : absint($EVT_ID); |
|
50 | + // do we already have the Event you are looking for? |
|
51 | + if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) { |
|
52 | + return EEH_Event_View::$_event; |
|
53 | + } |
|
54 | + //reset property so that the new event is cached. |
|
55 | + EEH_Event_View::$_event = null; |
|
56 | + if (! $EVT_ID && $post instanceof EE_Event) { |
|
57 | + EEH_Event_View::$_event = $post; |
|
58 | + return EEH_Event_View::$_event; |
|
59 | + } |
|
60 | + //if the post type is for an event and it has a cached event and we don't have a different incoming $EVT_ID |
|
61 | + //then let's just use that cached event on the $post object. |
|
62 | + if ( |
|
63 | + $post instanceof WP_Post |
|
64 | + && $post->post_type === 'espresso_events' |
|
65 | + && isset($post->EE_Event) |
|
66 | + && ( |
|
67 | + $EVT_ID === 0 |
|
68 | + || $EVT_ID === $post->ID |
|
69 | + ) |
|
70 | + ) { |
|
71 | + EEH_Event_View::$_event = $post->EE_Event; |
|
72 | + return EEH_Event_View::$_event; |
|
73 | + } |
|
74 | + //If the event we have isn't an event but we do have an EVT_ID, let's try getting the event using the ID. |
|
75 | + if (! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
76 | + EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
77 | + } |
|
78 | + return EEH_Event_View::$_event; |
|
79 | + } |
|
80 | 80 | |
81 | 81 | |
82 | 82 | |
@@ -152,58 +152,58 @@ discard block |
||
152 | 152 | * @return string |
153 | 153 | */ |
154 | 154 | public static function event_content_or_excerpt( $num_words = NULL, $more = NULL ) { |
155 | - global $post; |
|
155 | + global $post; |
|
156 | 156 | ob_start(); |
157 | 157 | if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) { |
158 | 158 | // admin has chosen "full description" |
159 | - // for the "Event Espresso - Events > Templates > Display Description" option |
|
159 | + // for the "Event Espresso - Events > Templates > Display Description" option |
|
160 | 160 | the_content(); |
161 | 161 | } else if (( is_archive() && espresso_display_excerpt_in_event_list() ) ) { |
162 | - if ( has_excerpt( $post->ID )) { |
|
163 | - // admin has chosen "excerpt (short desc)" |
|
164 | - // for the "Event Espresso - Events > Templates > Display Description" option |
|
165 | - // AND an excerpt actually exists |
|
166 | - the_excerpt(); |
|
167 | - } else { |
|
168 | - // admin has chosen "excerpt (short desc)" |
|
169 | - // for the "Event Espresso - Events > Templates > Display Description" option |
|
170 | - // but NO excerpt actually exists, so we need to create one |
|
171 | - if ( ! empty( $num_words )) { |
|
172 | - if ( empty( $more )) { |
|
173 | - $more_link_text = __( '(more…)' ); |
|
174 | - $more = ' <a href="' . get_permalink() . '"'; |
|
175 | - $more .= ' class="more-link"'; |
|
176 | - $more .= \EED_Events_Archive::link_target(); |
|
177 | - $more .= '>' . $more_link_text . '</a>'; |
|
178 | - $more = apply_filters( 'the_content_more_link', $more, $more_link_text ); |
|
179 | - } |
|
180 | - $content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' )); |
|
181 | - |
|
182 | - $content = wp_trim_words( $content, $num_words, ' ' ) . $more; |
|
183 | - } else { |
|
184 | - $content = get_the_content(); |
|
185 | - } |
|
186 | - global $allowedtags; |
|
187 | - // make sure links are allowed |
|
188 | - $allowedtags['a'] = isset($allowedtags['a']) |
|
189 | - ? $allowedtags['a'] |
|
190 | - : array(); |
|
191 | - // as well as target attribute |
|
192 | - $allowedtags['a']['target'] = isset($allowedtags['a']['target']) |
|
193 | - ? $allowedtags['a']['target'] |
|
194 | - : false; |
|
195 | - // but get previous value so we can reset it |
|
196 | - $prev_value = $allowedtags['a']['target']; |
|
197 | - $allowedtags['a']['target'] = true; |
|
198 | - $content = wp_kses( $content, $allowedtags ); |
|
199 | - $content = strip_shortcodes( $content ); |
|
200 | - echo apply_filters( 'the_content', $content ); |
|
201 | - $allowedtags['a']['target'] = $prev_value; |
|
202 | - } |
|
203 | - } else { |
|
204 | - // admin has chosen "none" |
|
205 | - // for the "Event Espresso - Events > Templates > Display Description" option |
|
206 | - echo apply_filters( 'the_content', '' ); |
|
162 | + if ( has_excerpt( $post->ID )) { |
|
163 | + // admin has chosen "excerpt (short desc)" |
|
164 | + // for the "Event Espresso - Events > Templates > Display Description" option |
|
165 | + // AND an excerpt actually exists |
|
166 | + the_excerpt(); |
|
167 | + } else { |
|
168 | + // admin has chosen "excerpt (short desc)" |
|
169 | + // for the "Event Espresso - Events > Templates > Display Description" option |
|
170 | + // but NO excerpt actually exists, so we need to create one |
|
171 | + if ( ! empty( $num_words )) { |
|
172 | + if ( empty( $more )) { |
|
173 | + $more_link_text = __( '(more…)' ); |
|
174 | + $more = ' <a href="' . get_permalink() . '"'; |
|
175 | + $more .= ' class="more-link"'; |
|
176 | + $more .= \EED_Events_Archive::link_target(); |
|
177 | + $more .= '>' . $more_link_text . '</a>'; |
|
178 | + $more = apply_filters( 'the_content_more_link', $more, $more_link_text ); |
|
179 | + } |
|
180 | + $content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' )); |
|
181 | + |
|
182 | + $content = wp_trim_words( $content, $num_words, ' ' ) . $more; |
|
183 | + } else { |
|
184 | + $content = get_the_content(); |
|
185 | + } |
|
186 | + global $allowedtags; |
|
187 | + // make sure links are allowed |
|
188 | + $allowedtags['a'] = isset($allowedtags['a']) |
|
189 | + ? $allowedtags['a'] |
|
190 | + : array(); |
|
191 | + // as well as target attribute |
|
192 | + $allowedtags['a']['target'] = isset($allowedtags['a']['target']) |
|
193 | + ? $allowedtags['a']['target'] |
|
194 | + : false; |
|
195 | + // but get previous value so we can reset it |
|
196 | + $prev_value = $allowedtags['a']['target']; |
|
197 | + $allowedtags['a']['target'] = true; |
|
198 | + $content = wp_kses( $content, $allowedtags ); |
|
199 | + $content = strip_shortcodes( $content ); |
|
200 | + echo apply_filters( 'the_content', $content ); |
|
201 | + $allowedtags['a']['target'] = $prev_value; |
|
202 | + } |
|
203 | + } else { |
|
204 | + // admin has chosen "none" |
|
205 | + // for the "Event Espresso - Events > Templates > Display Description" option |
|
206 | + echo apply_filters( 'the_content', '' ); |
|
207 | 207 | } |
208 | 208 | return ob_get_clean(); |
209 | 209 | } |
@@ -250,11 +250,11 @@ discard block |
||
250 | 250 | $url = get_term_link( $term, 'espresso_venue_categories' ); |
251 | 251 | if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) { |
252 | 252 | $category_links[] = '<a href="' . esc_url( $url ) |
253 | - . '" rel="tag"' |
|
254 | - . \EED_Events_Archive::link_target() |
|
255 | - .'>' |
|
256 | - . $term->name |
|
257 | - . '</a>'; |
|
253 | + . '" rel="tag"' |
|
254 | + . \EED_Events_Archive::link_target() |
|
255 | + .'>' |
|
256 | + . $term->name |
|
257 | + . '</a>'; |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | } |
54 | 54 | //reset property so that the new event is cached. |
55 | 55 | EEH_Event_View::$_event = null; |
56 | - if (! $EVT_ID && $post instanceof EE_Event) { |
|
56 | + if ( ! $EVT_ID && $post instanceof EE_Event) { |
|
57 | 57 | EEH_Event_View::$_event = $post; |
58 | 58 | return EEH_Event_View::$_event; |
59 | 59 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | return EEH_Event_View::$_event; |
73 | 73 | } |
74 | 74 | //If the event we have isn't an event but we do have an EVT_ID, let's try getting the event using the ID. |
75 | - if (! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
75 | + if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
76 | 76 | EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
77 | 77 | } |
78 | 78 | return EEH_Event_View::$_event; |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * @param int $EVT_ID |
88 | 88 | * @return boolean |
89 | 89 | */ |
90 | - public static function display_ticket_selector( $EVT_ID = 0 ) { |
|
91 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
90 | + public static function display_ticket_selector($EVT_ID = 0) { |
|
91 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
92 | 92 | return $event instanceof EE_Event ? $event->display_ticket_selector() : FALSE; |
93 | 93 | } |
94 | 94 | |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | * @param int $EVT_ID |
102 | 102 | * @return string |
103 | 103 | */ |
104 | - public static function event_status( $EVT_ID = 0 ) { |
|
105 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
106 | - return $event instanceof EE_Event ? $event->pretty_active_status( FALSE ) : ''; |
|
104 | + public static function event_status($EVT_ID = 0) { |
|
105 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
106 | + return $event instanceof EE_Event ? $event->pretty_active_status(FALSE) : ''; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * @param int $EVT_ID |
116 | 116 | * @return string |
117 | 117 | */ |
118 | - public static function event_active_status( $EVT_ID = 0 ) { |
|
119 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
118 | + public static function event_active_status($EVT_ID = 0) { |
|
119 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
120 | 120 | return $event instanceof EE_Event ? $event->pretty_active_status() : 'inactive'; |
121 | 121 | } |
122 | 122 | |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | * @param int $EVT_ID |
130 | 130 | * @return string |
131 | 131 | */ |
132 | - public static function event_has_content_or_excerpt( $EVT_ID = 0 ) { |
|
133 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
132 | + public static function event_has_content_or_excerpt($EVT_ID = 0) { |
|
133 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
134 | 134 | $has_content_or_excerpt = FALSE; |
135 | - if ( $event instanceof EE_Event ) { |
|
136 | - $has_content_or_excerpt = $event->description() != '' || $event->short_description( NULL, NULL, TRUE ) != '' ? TRUE : FALSE; |
|
135 | + if ($event instanceof EE_Event) { |
|
136 | + $has_content_or_excerpt = $event->description() != '' || $event->short_description(NULL, NULL, TRUE) != '' ? TRUE : FALSE; |
|
137 | 137 | } |
138 | - if ( is_archive() && ! ( espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list() )) { |
|
138 | + if (is_archive() && ! (espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list())) { |
|
139 | 139 | $has_content_or_excerpt = FALSE; |
140 | 140 | } |
141 | 141 | return $has_content_or_excerpt; |
@@ -151,15 +151,15 @@ discard block |
||
151 | 151 | * @param null $more |
152 | 152 | * @return string |
153 | 153 | */ |
154 | - public static function event_content_or_excerpt( $num_words = NULL, $more = NULL ) { |
|
154 | + public static function event_content_or_excerpt($num_words = NULL, $more = NULL) { |
|
155 | 155 | global $post; |
156 | 156 | ob_start(); |
157 | - if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) { |
|
157 | + if ((is_single()) || (is_archive() && espresso_display_full_description_in_event_list())) { |
|
158 | 158 | // admin has chosen "full description" |
159 | 159 | // for the "Event Espresso - Events > Templates > Display Description" option |
160 | 160 | the_content(); |
161 | - } else if (( is_archive() && espresso_display_excerpt_in_event_list() ) ) { |
|
162 | - if ( has_excerpt( $post->ID )) { |
|
161 | + } else if ((is_archive() && espresso_display_excerpt_in_event_list())) { |
|
162 | + if (has_excerpt($post->ID)) { |
|
163 | 163 | // admin has chosen "excerpt (short desc)" |
164 | 164 | // for the "Event Espresso - Events > Templates > Display Description" option |
165 | 165 | // AND an excerpt actually exists |
@@ -168,20 +168,20 @@ discard block |
||
168 | 168 | // admin has chosen "excerpt (short desc)" |
169 | 169 | // for the "Event Espresso - Events > Templates > Display Description" option |
170 | 170 | // but NO excerpt actually exists, so we need to create one |
171 | - if ( ! empty( $num_words )) { |
|
172 | - if ( empty( $more )) { |
|
173 | - $more_link_text = __( '(more…)' ); |
|
174 | - $more = ' <a href="' . get_permalink() . '"'; |
|
171 | + if ( ! empty($num_words)) { |
|
172 | + if (empty($more)) { |
|
173 | + $more_link_text = __('(more…)'); |
|
174 | + $more = ' <a href="'.get_permalink().'"'; |
|
175 | 175 | $more .= ' class="more-link"'; |
176 | 176 | $more .= \EED_Events_Archive::link_target(); |
177 | - $more .= '>' . $more_link_text . '</a>'; |
|
178 | - $more = apply_filters( 'the_content_more_link', $more, $more_link_text ); |
|
177 | + $more .= '>'.$more_link_text.'</a>'; |
|
178 | + $more = apply_filters('the_content_more_link', $more, $more_link_text); |
|
179 | 179 | } |
180 | - $content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' )); |
|
180 | + $content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK')); |
|
181 | 181 | |
182 | - $content = wp_trim_words( $content, $num_words, ' ' ) . $more; |
|
182 | + $content = wp_trim_words($content, $num_words, ' ').$more; |
|
183 | 183 | } else { |
184 | - $content = get_the_content(); |
|
184 | + $content = get_the_content(); |
|
185 | 185 | } |
186 | 186 | global $allowedtags; |
187 | 187 | // make sure links are allowed |
@@ -195,15 +195,15 @@ discard block |
||
195 | 195 | // but get previous value so we can reset it |
196 | 196 | $prev_value = $allowedtags['a']['target']; |
197 | 197 | $allowedtags['a']['target'] = true; |
198 | - $content = wp_kses( $content, $allowedtags ); |
|
199 | - $content = strip_shortcodes( $content ); |
|
200 | - echo apply_filters( 'the_content', $content ); |
|
198 | + $content = wp_kses($content, $allowedtags); |
|
199 | + $content = strip_shortcodes($content); |
|
200 | + echo apply_filters('the_content', $content); |
|
201 | 201 | $allowedtags['a']['target'] = $prev_value; |
202 | 202 | } |
203 | 203 | } else { |
204 | 204 | // admin has chosen "none" |
205 | 205 | // for the "Event Espresso - Events > Templates > Display Description" option |
206 | - echo apply_filters( 'the_content', '' ); |
|
206 | + echo apply_filters('the_content', ''); |
|
207 | 207 | } |
208 | 208 | return ob_get_clean(); |
209 | 209 | } |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | * @param int $EVT_ID |
218 | 218 | * @return EE_Ticket[] |
219 | 219 | */ |
220 | - public static function event_tickets_available( $EVT_ID = 0 ) { |
|
221 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
220 | + public static function event_tickets_available($EVT_ID = 0) { |
|
221 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
222 | 222 | $tickets_available_for_purchase = array(); |
223 | - if( $event instanceof EE_Event ) { |
|
224 | - $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, FALSE ); |
|
225 | - foreach( $datetimes as $datetime ) { |
|
226 | - $tickets_available_for_purchase = array_merge( $tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase() ); |
|
223 | + if ($event instanceof EE_Event) { |
|
224 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, FALSE); |
|
225 | + foreach ($datetimes as $datetime) { |
|
226 | + $tickets_available_for_purchase = array_merge($tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase()); |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | return $tickets_available_for_purchase; |
@@ -239,17 +239,17 @@ discard block |
||
239 | 239 | * @param bool $hide_uncategorized |
240 | 240 | * @return string |
241 | 241 | */ |
242 | - public static function event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE ) { |
|
242 | + public static function event_categories($EVT_ID = 0, $hide_uncategorized = TRUE) { |
|
243 | 243 | $category_links = array(); |
244 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
245 | - if ( $event instanceof EE_Event ) { |
|
246 | - $event_categories = get_the_terms( $event->ID(), 'espresso_event_categories' ); |
|
247 | - if ( $event_categories ) { |
|
244 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
245 | + if ($event instanceof EE_Event) { |
|
246 | + $event_categories = get_the_terms($event->ID(), 'espresso_event_categories'); |
|
247 | + if ($event_categories) { |
|
248 | 248 | // loop thru terms and create links |
249 | - foreach ( $event_categories as $term ) { |
|
250 | - $url = get_term_link( $term, 'espresso_venue_categories' ); |
|
251 | - if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) { |
|
252 | - $category_links[] = '<a href="' . esc_url( $url ) |
|
249 | + foreach ($event_categories as $term) { |
|
250 | + $url = get_term_link($term, 'espresso_venue_categories'); |
|
251 | + if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) { |
|
252 | + $category_links[] = '<a href="'.esc_url($url) |
|
253 | 253 | . '" rel="tag"' |
254 | 254 | . \EED_Events_Archive::link_target() |
255 | 255 | .'>' |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | } |
260 | 260 | } |
261 | 261 | } |
262 | - return implode( ', ', $category_links ); |
|
262 | + return implode(', ', $category_links); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | * @param int $EVT_ID |
274 | 274 | * @return string |
275 | 275 | */ |
276 | - public static function the_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
277 | - $datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
278 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
279 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) : ''; |
|
276 | + public static function the_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
277 | + $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
278 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
279 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : ''; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -290,10 +290,10 @@ discard block |
||
290 | 290 | * @param int $EVT_ID |
291 | 291 | * @return string |
292 | 292 | */ |
293 | - public static function the_event_end_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
294 | - $datetime = EEH_Event_View::get_last_date_obj( $EVT_ID ); |
|
295 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
296 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : ''; |
|
293 | + public static function the_event_end_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
294 | + $datetime = EEH_Event_View::get_last_date_obj($EVT_ID); |
|
295 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
296 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : ''; |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | |
@@ -307,10 +307,10 @@ discard block |
||
307 | 307 | * @param int $EVT_ID |
308 | 308 | * @return string |
309 | 309 | */ |
310 | - public static function the_earliest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
311 | - $datetime = EEH_Event_View::get_earliest_date_obj( $EVT_ID ); |
|
312 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
313 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) : ''; |
|
310 | + public static function the_earliest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
311 | + $datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID); |
|
312 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
313 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : ''; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | * @param int $EVT_ID |
325 | 325 | * @return string |
326 | 326 | */ |
327 | - public static function the_latest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
328 | - $datetime = EEH_Event_View::get_latest_date_obj( $EVT_ID ); |
|
329 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
330 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : ''; |
|
327 | + public static function the_latest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
328 | + $datetime = EEH_Event_View::get_latest_date_obj($EVT_ID); |
|
329 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
330 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : ''; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
@@ -339,13 +339,13 @@ discard block |
||
339 | 339 | * @param int $EVT_ID |
340 | 340 | * @return string |
341 | 341 | */ |
342 | - public static function event_date_as_calendar_page( $EVT_ID = 0 ) { |
|
343 | - $datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
344 | - if ( $datetime instanceof EE_Datetime ) { |
|
342 | + public static function event_date_as_calendar_page($EVT_ID = 0) { |
|
343 | + $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
344 | + if ($datetime instanceof EE_Datetime) { |
|
345 | 345 | ?> |
346 | 346 | <div class="event-date-calendar-page-dv"> |
347 | - <div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime( 'DTT_EVT_start', 'M' );?></div> |
|
348 | - <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date( 'd' );?></div> |
|
347 | + <div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime('DTT_EVT_start', 'M'); ?></div> |
|
348 | + <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date('d'); ?></div> |
|
349 | 349 | </div> |
350 | 350 | <?php |
351 | 351 | } |
@@ -360,17 +360,17 @@ discard block |
||
360 | 360 | * @param int $EVT_ID |
361 | 361 | * @return string |
362 | 362 | */ |
363 | - public static function get_primary_date_obj( $EVT_ID = 0 ) { |
|
364 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
365 | - if ( $event instanceof EE_Event ) { |
|
363 | + public static function get_primary_date_obj($EVT_ID = 0) { |
|
364 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
365 | + if ($event instanceof EE_Event) { |
|
366 | 366 | $datetimes = $event->get_many_related( |
367 | 367 | 'Datetime', |
368 | 368 | array( |
369 | 369 | 'limit' => 1, |
370 | - 'order_by' => array( 'DTT_order' => 'ASC' ) |
|
370 | + 'order_by' => array('DTT_order' => 'ASC') |
|
371 | 371 | ) |
372 | 372 | ); |
373 | - return reset( $datetimes ); |
|
373 | + return reset($datetimes); |
|
374 | 374 | } else { |
375 | 375 | return FALSE; |
376 | 376 | } |
@@ -385,17 +385,17 @@ discard block |
||
385 | 385 | * @param int $EVT_ID |
386 | 386 | * @return string |
387 | 387 | */ |
388 | - public static function get_last_date_obj( $EVT_ID = 0 ) { |
|
389 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
390 | - if ( $event instanceof EE_Event ) { |
|
388 | + public static function get_last_date_obj($EVT_ID = 0) { |
|
389 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
390 | + if ($event instanceof EE_Event) { |
|
391 | 391 | $datetimes = $event->get_many_related( |
392 | 392 | 'Datetime', |
393 | 393 | array( |
394 | 394 | 'limit' => 1, |
395 | - 'order_by' => array( 'DTT_order' => 'DESC' ) |
|
395 | + 'order_by' => array('DTT_order' => 'DESC') |
|
396 | 396 | ) |
397 | 397 | ); |
398 | - return end( $datetimes ); |
|
398 | + return end($datetimes); |
|
399 | 399 | } else { |
400 | 400 | return FALSE; |
401 | 401 | } |
@@ -410,17 +410,17 @@ discard block |
||
410 | 410 | * @param int $EVT_ID |
411 | 411 | * @return string |
412 | 412 | */ |
413 | - public static function get_earliest_date_obj( $EVT_ID = 0 ) { |
|
414 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
415 | - if ( $event instanceof EE_Event ) { |
|
413 | + public static function get_earliest_date_obj($EVT_ID = 0) { |
|
414 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
415 | + if ($event instanceof EE_Event) { |
|
416 | 416 | $datetimes = $event->get_many_related( |
417 | 417 | 'Datetime', |
418 | 418 | array( |
419 | 419 | 'limit' => 1, |
420 | - 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) |
|
420 | + 'order_by' => array('DTT_EVT_start' => 'ASC') |
|
421 | 421 | ) |
422 | 422 | ); |
423 | - return reset( $datetimes ); |
|
423 | + return reset($datetimes); |
|
424 | 424 | } else { |
425 | 425 | return FALSE; |
426 | 426 | } |
@@ -435,17 +435,17 @@ discard block |
||
435 | 435 | * @param int $EVT_ID |
436 | 436 | * @return string |
437 | 437 | */ |
438 | - public static function get_latest_date_obj( $EVT_ID = 0 ) { |
|
439 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
440 | - if ( $event instanceof EE_Event ) { |
|
438 | + public static function get_latest_date_obj($EVT_ID = 0) { |
|
439 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
440 | + if ($event instanceof EE_Event) { |
|
441 | 441 | $datetimes = $event->get_many_related( |
442 | 442 | 'Datetime', |
443 | 443 | array( |
444 | 444 | 'limit' => 1, |
445 | - 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) |
|
445 | + 'order_by' => array('DTT_EVT_start' => 'DESC') |
|
446 | 446 | ) |
447 | 447 | ); |
448 | - return end( $datetimes ); |
|
448 | + return end($datetimes); |
|
449 | 449 | } else { |
450 | 450 | return FALSE; |
451 | 451 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | * @param int $EVT_ID |
459 | 459 | * @return EE_Datetime|null |
460 | 460 | */ |
461 | - public static function get_next_upcoming_date_obj( $EVT_ID = 0 ) { |
|
461 | + public static function get_next_upcoming_date_obj($EVT_ID = 0) { |
|
462 | 462 | $datetime = EEM_Datetime::instance()->get_one( |
463 | 463 | array( |
464 | 464 | array( |
@@ -481,17 +481,17 @@ discard block |
||
481 | 481 | * @param null $limit |
482 | 482 | * @return EE_Datetime[] |
483 | 483 | */ |
484 | - public static function get_all_date_obj( $EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL ) { |
|
485 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
486 | - if($include_expired === null){ |
|
487 | - if($event instanceof EE_Event && $event->is_expired()){ |
|
484 | + public static function get_all_date_obj($EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL) { |
|
485 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
486 | + if ($include_expired === null) { |
|
487 | + if ($event instanceof EE_Event && $event->is_expired()) { |
|
488 | 488 | $include_expired = true; |
489 | - }else{ |
|
489 | + } else { |
|
490 | 490 | $include_expired = false; |
491 | 491 | } |
492 | 492 | } |
493 | 493 | |
494 | - if ( $event instanceof EE_Event ) { |
|
494 | + if ($event instanceof EE_Event) { |
|
495 | 495 | return $event->datetimes_ordered($include_expired, $include_deleted, $limit); |
496 | 496 | } else { |
497 | 497 | return array(); |
@@ -507,11 +507,11 @@ discard block |
||
507 | 507 | * @param int $EVT_ID |
508 | 508 | * @return string |
509 | 509 | */ |
510 | - public static function event_link_url( $EVT_ID = 0 ) { |
|
511 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
512 | - if ( $event instanceof EE_Event ) { |
|
513 | - $url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink( $event->ID() ); |
|
514 | - return preg_match( "~^(?:f|ht)tps?://~i", $url ) ? $url : 'http://' . $url; |
|
510 | + public static function event_link_url($EVT_ID = 0) { |
|
511 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
512 | + if ($event instanceof EE_Event) { |
|
513 | + $url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink($event->ID()); |
|
514 | + return preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'http://'.$url; |
|
515 | 515 | } |
516 | 516 | return NULL; |
517 | 517 | } |
@@ -525,10 +525,10 @@ discard block |
||
525 | 525 | * @param int $EVT_ID |
526 | 526 | * @return string |
527 | 527 | */ |
528 | - public static function event_phone( $EVT_ID = 0 ) { |
|
529 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
530 | - if ( $event instanceof EE_Event ) { |
|
531 | - return EEH_Schema::telephone( $event->phone() ); |
|
528 | + public static function event_phone($EVT_ID = 0) { |
|
529 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
530 | + if ($event instanceof EE_Event) { |
|
531 | + return EEH_Schema::telephone($event->phone()); |
|
532 | 532 | } |
533 | 533 | return NULL; |
534 | 534 | } |
@@ -545,26 +545,26 @@ discard block |
||
545 | 545 | * @param string $after |
546 | 546 | * @return string |
547 | 547 | */ |
548 | - public static function edit_event_link( $EVT_ID = 0, $link = '', $before = '', $after = '' ) { |
|
549 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
550 | - if ( $event instanceof EE_Event ) { |
|
548 | + public static function edit_event_link($EVT_ID = 0, $link = '', $before = '', $after = '') { |
|
549 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
550 | + if ($event instanceof EE_Event) { |
|
551 | 551 | // can the user edit this post ? |
552 | - if ( current_user_can( 'edit_post', $event->ID() )) { |
|
552 | + if (current_user_can('edit_post', $event->ID())) { |
|
553 | 553 | // set link text |
554 | - $link_text = ! empty( $link ) ? $link : __('edit this event'); |
|
554 | + $link_text = ! empty($link) ? $link : __('edit this event'); |
|
555 | 555 | // generate nonce |
556 | - $nonce = wp_create_nonce( 'edit_nonce' ); |
|
556 | + $nonce = wp_create_nonce('edit_nonce'); |
|
557 | 557 | // generate url to event editor for this event |
558 | - $url = add_query_arg( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce ), admin_url() ); |
|
558 | + $url = add_query_arg(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce), admin_url()); |
|
559 | 559 | // get edit CPT text |
560 | - $post_type_obj = get_post_type_object( 'espresso_events' ); |
|
560 | + $post_type_obj = get_post_type_object('espresso_events'); |
|
561 | 561 | // build final link html |
562 | - $link = '<a class="post-edit-link" href="' . $url . '" '; |
|
563 | - $link .= ' title="' . esc_attr( $post_type_obj->labels->edit_item ) . '"'; |
|
562 | + $link = '<a class="post-edit-link" href="'.$url.'" '; |
|
563 | + $link .= ' title="'.esc_attr($post_type_obj->labels->edit_item).'"'; |
|
564 | 564 | $link .= \EED_Events_Archive::link_target(); |
565 | - $link .='>' . $link_text . '</a>'; |
|
565 | + $link .= '>'.$link_text.'</a>'; |
|
566 | 566 | // put it all together |
567 | - return $before . apply_filters( 'edit_post_link', $link, $event->ID() ) . $after; |
|
567 | + return $before.apply_filters('edit_post_link', $link, $event->ID()).$after; |
|
568 | 568 | } |
569 | 569 | } |
570 | 570 | return ''; |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | |
394 | 394 | /** |
395 | 395 | * generate_question_groups_html |
396 | - * |
|
396 | + * |
|
397 | 397 | * @param string $question_groups |
398 | 398 | * @return string HTML |
399 | 399 | */ |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | |
538 | 538 | /** |
539 | 539 | * generate_form_input |
540 | - * |
|
540 | + * |
|
541 | 541 | * @param EE_Question_Form_Input $QFI |
542 | 542 | * @return string HTML |
543 | 543 | */ |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | |
613 | 613 | /** |
614 | 614 | * generates HTML for a form text input |
615 | - * |
|
615 | + * |
|
616 | 616 | * @param string $question label content |
617 | 617 | * @param string $answer form input value attribute |
618 | 618 | * @param string $name form input name attribute |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | |
658 | 658 | /** |
659 | 659 | * generates HTML for a form textarea |
660 | - * |
|
660 | + * |
|
661 | 661 | * @param string $question label content |
662 | 662 | * @param string $answer form input value attribute |
663 | 663 | * @param string $name form input name attribute |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | |
709 | 709 | /** |
710 | 710 | * generates HTML for a form select input |
711 | - * |
|
711 | + * |
|
712 | 712 | * @param string $question label content |
713 | 713 | * @param string $answer form input value attribute |
714 | 714 | * @param array $options array of answer options where array key = option value and array value = option display text |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | |
886 | 886 | /** |
887 | 887 | * generates HTML for form checkbox inputs |
888 | - * |
|
888 | + * |
|
889 | 889 | * @param string $question label content |
890 | 890 | * @param string $answer form input value attribute |
891 | 891 | * @param array $options array of options where array key = option value and array value = option display text |
@@ -966,7 +966,7 @@ discard block |
||
966 | 966 | |
967 | 967 | /** |
968 | 968 | * generates HTML for a form datepicker input |
969 | - * |
|
969 | + * |
|
970 | 970 | * @param string $question label content |
971 | 971 | * @param string $answer form input value attribute |
972 | 972 | * @param string $name form input name attribute |
@@ -366,14 +366,16 @@ discard block |
||
366 | 366 | $field = '<select id="' . EEH_Formatter::ee_tep_output_string($name) . '" name="' . EEH_Formatter::ee_tep_output_string($name) . '"'; |
367 | 367 | //Debug |
368 | 368 | //EEH_Debug_Tools::printr( $values, '$values <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
369 | - if ( EEH_Formatter::ee_tep_not_null($parameters)) |
|
370 | - $field .= ' ' . $parameters; |
|
369 | + if ( EEH_Formatter::ee_tep_not_null($parameters)) { |
|
370 | + $field .= ' ' . $parameters; |
|
371 | + } |
|
371 | 372 | if ($autosize) { |
372 | 373 | $size = 'med'; |
373 | 374 | for ($ii = 0, $ni = sizeof($values); $ii < $ni; $ii++) { |
374 | 375 | if ($values[$ii]['text']) { |
375 | - if (strlen($values[$ii]['text']) > 5) |
|
376 | - $size = 'wide'; |
|
376 | + if (strlen($values[$ii]['text']) > 5) { |
|
377 | + $size = 'wide'; |
|
378 | + } |
|
377 | 379 | } |
378 | 380 | } |
379 | 381 | } else { |
@@ -382,8 +384,9 @@ discard block |
||
382 | 384 | |
383 | 385 | $field .= ' class="' . $class . ' ' . $size . '">'; |
384 | 386 | |
385 | - if (empty($default) && isset($GLOBALS[$name])) |
|
386 | - $default = stripslashes($GLOBALS[$name]); |
|
387 | + if (empty($default) && isset($GLOBALS[$name])) { |
|
388 | + $default = stripslashes($GLOBALS[$name]); |
|
389 | + } |
|
387 | 390 | |
388 | 391 | |
389 | 392 | for ($i = 0, $n = sizeof($values); $i < $n; $i++) { |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | * |
798 | 798 | * @param mixed $opt_group |
799 | 799 | * @param mixed $QSOs |
800 | - * @param mixed $answer |
|
800 | + * @param string $answer |
|
801 | 801 | * @param boolean $use_html_entities |
802 | 802 | * @return string |
803 | 803 | */ |
@@ -1147,7 +1147,7 @@ discard block |
||
1147 | 1147 | /** |
1148 | 1148 | * prep_required |
1149 | 1149 | * @param string|array $required |
1150 | - * @return array |
|
1150 | + * @return string |
|
1151 | 1151 | */ |
1152 | 1152 | static function prep_required( $required = array() ){ |
1153 | 1153 | // make sure required is an array |
@@ -1198,8 +1198,8 @@ discard block |
||
1198 | 1198 | |
1199 | 1199 | /** |
1200 | 1200 | * _load_system_dropdowns |
1201 | - * @param array $QFI |
|
1202 | - * @return array |
|
1201 | + * @param EE_Question_Form_Input $QFI |
|
1202 | + * @return EE_Question_Form_Input |
|
1203 | 1203 | */ |
1204 | 1204 | private static function _load_system_dropdowns( $QFI ){ |
1205 | 1205 | $QST_system = $QFI->get('QST_system'); |
@@ -1490,7 +1490,7 @@ discard block |
||
1490 | 1490 | * @param string $nonce_action - if using nonces |
1491 | 1491 | * @param bool|string $input_only - whether to print form header and footer. TRUE returns the input without the form |
1492 | 1492 | * @param string $extra_attributes - any extra attributes that need to be attached to the form input |
1493 | - * @return void |
|
1493 | + * @return string |
|
1494 | 1494 | */ |
1495 | 1495 | public static function submit_button( $url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '' ) { |
1496 | 1496 | $btn = ''; |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | * @return string |
70 | 70 | * @todo: at some point we can break this down into other static methods to abstract it a bit better. |
71 | 71 | */ |
72 | - static public function get_form_fields( $input_vars = array(), $id = FALSE ) { |
|
72 | + static public function get_form_fields($input_vars = array(), $id = FALSE) { |
|
73 | 73 | |
74 | - if ( empty($input_vars) ) { |
|
75 | - EE_Error::add_error( __('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
74 | + if (empty($input_vars)) { |
|
75 | + EE_Error::add_error(__('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
76 | 76 | return FALSE; |
77 | 77 | } |
78 | 78 | |
@@ -98,25 +98,25 @@ discard block |
||
98 | 98 | 'append_content' => '' |
99 | 99 | ); |
100 | 100 | |
101 | - $input_value = wp_parse_args( $input_value, $defaults ); |
|
101 | + $input_value = wp_parse_args($input_value, $defaults); |
|
102 | 102 | |
103 | 103 | // required fields get a * |
104 | 104 | $required = isset($input_value['required']) && $input_value['required'] ? ' <span>*</span>: ' : ': '; |
105 | 105 | // and the css class "required" |
106 | - $css_class = isset( $input_value['css_class'] ) ? $input_value['css_class'] : ''; |
|
107 | - $styles = $input_value['required'] ? 'required ' . $css_class : $css_class; |
|
106 | + $css_class = isset($input_value['css_class']) ? $input_value['css_class'] : ''; |
|
107 | + $styles = $input_value['required'] ? 'required '.$css_class : $css_class; |
|
108 | 108 | |
109 | - $field_id = ($id) ? $id . '-' . $input_key : $input_key; |
|
110 | - $tabindex = !empty($input_value['tabindex']) ? ' tabindex="' . $input_value['tabindex'] . '"' : ''; |
|
109 | + $field_id = ($id) ? $id.'-'.$input_key : $input_key; |
|
110 | + $tabindex = ! empty($input_value['tabindex']) ? ' tabindex="'.$input_value['tabindex'].'"' : ''; |
|
111 | 111 | |
112 | 112 | //rows or cols? |
113 | - $rows = isset($input_value['rows'] ) ? $input_value['rows'] : '10'; |
|
114 | - $cols = isset($input_value['cols'] ) ? $input_value['cols'] : '80'; |
|
113 | + $rows = isset($input_value['rows']) ? $input_value['rows'] : '10'; |
|
114 | + $cols = isset($input_value['cols']) ? $input_value['cols'] : '80'; |
|
115 | 115 | |
116 | 116 | //any content? |
117 | 117 | $append_content = $input_value['append_content']; |
118 | 118 | |
119 | - $output .= (!$close) ? '<ul>' : ''; |
|
119 | + $output .= ( ! $close) ? '<ul>' : ''; |
|
120 | 120 | $output .= '<li>'; |
121 | 121 | |
122 | 122 | // what type of input are we dealing with ? |
@@ -124,15 +124,15 @@ discard block |
||
124 | 124 | |
125 | 125 | // text inputs |
126 | 126 | case 'text' : |
127 | - $output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>'; |
|
128 | - $output .= "\n\t\t\t" . '<input id="' . $field_id . '" class="' . $styles . '" type="text" value="' . esc_textarea($input_value['value']) . '" name="' . $input_value['name'] . '"' . $tabindex . '>'; |
|
127 | + $output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>'; |
|
128 | + $output .= "\n\t\t\t".'<input id="'.$field_id.'" class="'.$styles.'" type="text" value="'.esc_textarea($input_value['value']).'" name="'.$input_value['name'].'"'.$tabindex.'>'; |
|
129 | 129 | break; |
130 | 130 | |
131 | 131 | // dropdowns |
132 | 132 | case 'select' : |
133 | 133 | |
134 | - $output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>'; |
|
135 | - $output .= "\n\t\t\t" . '<select id="' . $field_id . '" class="' . $styles . '" name="' . $input_value['name'] . '"' . $tabindex . '>'; |
|
134 | + $output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>'; |
|
135 | + $output .= "\n\t\t\t".'<select id="'.$field_id.'" class="'.$styles.'" name="'.$input_value['name'].'"'.$tabindex.'>'; |
|
136 | 136 | |
137 | 137 | if (is_array($input_value['options'])) { |
138 | 138 | $options = $input_value['options']; |
@@ -141,30 +141,30 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | foreach ($options as $key => $value) { |
144 | - $selected = isset( $input_value['value'] ) && $input_value['value'] == $key ? 'selected=selected' : ''; |
|
144 | + $selected = isset($input_value['value']) && $input_value['value'] == $key ? 'selected=selected' : ''; |
|
145 | 145 | //$key = str_replace( ' ', '_', sanitize_key( $value )); |
146 | - $output .= "\n\t\t\t\t" . '<option '. $selected . ' value="' . $key . '">' . $value . '</option>'; |
|
146 | + $output .= "\n\t\t\t\t".'<option '.$selected.' value="'.$key.'">'.$value.'</option>'; |
|
147 | 147 | } |
148 | - $output .= "\n\t\t\t" . '</select>'; |
|
148 | + $output .= "\n\t\t\t".'</select>'; |
|
149 | 149 | |
150 | 150 | break; |
151 | 151 | |
152 | 152 | case 'textarea' : |
153 | 153 | |
154 | - $output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>'; |
|
155 | - $output .= "\n\t\t\t" . '<textarea id="' . $field_id . '" class="' . $styles . '" rows="'.$rows.'" cols="'.$cols.'" name="' . $input_value['name'] . '"' . $tabindex . '>' . esc_textarea($input_value['value']) . '</textarea>'; |
|
154 | + $output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>'; |
|
155 | + $output .= "\n\t\t\t".'<textarea id="'.$field_id.'" class="'.$styles.'" rows="'.$rows.'" cols="'.$cols.'" name="'.$input_value['name'].'"'.$tabindex.'>'.esc_textarea($input_value['value']).'</textarea>'; |
|
156 | 156 | break; |
157 | 157 | |
158 | 158 | case 'hidden' : |
159 | 159 | $close = false; |
160 | 160 | $output .= "</li></ul>"; |
161 | - $output .= "\n\t\t\t" . '<input id="' . $field_id . '" type="hidden" name="' . $input_value['name'] . '" value="' . $input_value['value'] . '">'; |
|
161 | + $output .= "\n\t\t\t".'<input id="'.$field_id.'" type="hidden" name="'.$input_value['name'].'" value="'.$input_value['value'].'">'; |
|
162 | 162 | break; |
163 | 163 | |
164 | 164 | case 'checkbox' : |
165 | - $checked = ( $input_value['value'] == 1 ) ? 'checked="checked"' : ''; |
|
166 | - $output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>'; |
|
167 | - $output .= "\n\t\t\t" . '<input id="' . $field_id. '" type="checkbox" name="' . $input_value['name'] . '" value="1"' . $checked . $tabindex . ' />'; |
|
165 | + $checked = ($input_value['value'] == 1) ? 'checked="checked"' : ''; |
|
166 | + $output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>'; |
|
167 | + $output .= "\n\t\t\t".'<input id="'.$field_id.'" type="checkbox" name="'.$input_value['name'].'" value="1"'.$checked.$tabindex.' />'; |
|
168 | 168 | break; |
169 | 169 | |
170 | 170 | case 'wp_editor' : |
@@ -177,19 +177,19 @@ discard block |
||
177 | 177 | ); |
178 | 178 | $output .= '</li>'; |
179 | 179 | $output .= '</ul>'; |
180 | - $output .= '<h4>' . $input_value['label'] . '</h4>'; |
|
181 | - if ( $append_content ) { |
|
180 | + $output .= '<h4>'.$input_value['label'].'</h4>'; |
|
181 | + if ($append_content) { |
|
182 | 182 | $output .= $append_content; |
183 | 183 | } |
184 | 184 | ob_start(); |
185 | - wp_editor( $input_value['value'], $field_id, $editor_settings); |
|
185 | + wp_editor($input_value['value'], $field_id, $editor_settings); |
|
186 | 186 | $editor = ob_get_contents(); |
187 | 187 | ob_end_clean(); |
188 | 188 | $output .= $editor; |
189 | 189 | break; |
190 | 190 | |
191 | 191 | } |
192 | - if ( $append_content && $input_value['input'] !== 'wp_editor' ) { |
|
192 | + if ($append_content && $input_value['input'] !== 'wp_editor') { |
|
193 | 193 | $output .= $append_content; |
194 | 194 | } |
195 | 195 | $output .= ($close) ? '</li>' : ''; |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $form_fields = array(); |
231 | 231 | $fields = (array) $fields; |
232 | 232 | |
233 | - foreach ( $fields as $field_name => $field_atts ) { |
|
233 | + foreach ($fields as $field_name => $field_atts) { |
|
234 | 234 | //defaults: |
235 | 235 | $defaults = array( |
236 | 236 | 'label' => '', |
@@ -248,67 +248,67 @@ discard block |
||
248 | 248 | 'wpeditor_args' => array() |
249 | 249 | ); |
250 | 250 | // merge defaults with passed arguments |
251 | - $_fields = wp_parse_args( $field_atts, $defaults); |
|
252 | - extract( $_fields ); |
|
251 | + $_fields = wp_parse_args($field_atts, $defaults); |
|
252 | + extract($_fields); |
|
253 | 253 | // generate label |
254 | - $label = empty($label) ? '' : '<label for="' . $id . '">' . $label . '</label>'; |
|
254 | + $label = empty($label) ? '' : '<label for="'.$id.'">'.$label.'</label>'; |
|
255 | 255 | // generate field name |
256 | - $f_name = !empty($unique_id) ? $field_name . '[' . $unique_id . ']' : $field_name; |
|
256 | + $f_name = ! empty($unique_id) ? $field_name.'['.$unique_id.']' : $field_name; |
|
257 | 257 | |
258 | 258 | //tabindex |
259 | - $tabindex_str = !empty( $tabindex ) ? ' tabindex="' . $tabindex . '"' : ''; |
|
259 | + $tabindex_str = ! empty($tabindex) ? ' tabindex="'.$tabindex.'"' : ''; |
|
260 | 260 | |
261 | 261 | //we determine what we're building based on the type |
262 | - switch ( $type ) { |
|
262 | + switch ($type) { |
|
263 | 263 | |
264 | 264 | case 'textarea' : |
265 | - $fld = '<textarea id="' . $id . '" class="' . $class . '" rows="' . $dimensions[1] . '" cols="' . $dimensions[0] . '" name="' . $f_name . '"' . $tabindex_str . '>' . $value . '</textarea>'; |
|
265 | + $fld = '<textarea id="'.$id.'" class="'.$class.'" rows="'.$dimensions[1].'" cols="'.$dimensions[0].'" name="'.$f_name.'"'.$tabindex_str.'>'.$value.'</textarea>'; |
|
266 | 266 | $fld .= $extra_desc; |
267 | 267 | break; |
268 | 268 | |
269 | 269 | case 'checkbox' : |
270 | 270 | $c_input = ''; |
271 | - if ( is_array($value) ) { |
|
272 | - foreach ( $value as $key => $val ) { |
|
273 | - $c_id = $field_name . '_' . $value; |
|
274 | - $c_class = isset($classes[$key]) ? ' class="' . $classes[$key] . '" ' : ''; |
|
275 | - $c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : ''; |
|
276 | - $checked = !empty($default) && $default == $val ? ' checked="checked" ' : ''; |
|
277 | - $c_input .= '<input name="' . $f_name . '[]" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label; |
|
271 | + if (is_array($value)) { |
|
272 | + foreach ($value as $key => $val) { |
|
273 | + $c_id = $field_name.'_'.$value; |
|
274 | + $c_class = isset($classes[$key]) ? ' class="'.$classes[$key].'" ' : ''; |
|
275 | + $c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : ''; |
|
276 | + $checked = ! empty($default) && $default == $val ? ' checked="checked" ' : ''; |
|
277 | + $c_input .= '<input name="'.$f_name.'[]" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label; |
|
278 | 278 | } |
279 | 279 | $fld = $c_input; |
280 | 280 | } else { |
281 | - $checked = !empty($default) && $default == $val ? 'checked="checked" ' : ''; |
|
282 | - $fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n"; |
|
281 | + $checked = ! empty($default) && $default == $val ? 'checked="checked" ' : ''; |
|
282 | + $fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n"; |
|
283 | 283 | } |
284 | 284 | break; |
285 | 285 | |
286 | 286 | case 'radio' : |
287 | 287 | $c_input = ''; |
288 | - if ( is_array($value) ) { |
|
289 | - foreach ( $value as $key => $val ) { |
|
290 | - $c_id = $field_name . '_' . $value; |
|
291 | - $c_class = isset($classes[$key]) ? 'class="' . $classes[$key] . '" ' : ''; |
|
292 | - $c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : ''; |
|
293 | - $checked = !empty($default) && $default == $val ? ' checked="checked" ' : ''; |
|
294 | - $c_input .= '<input name="' . $f_name . '" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label; |
|
288 | + if (is_array($value)) { |
|
289 | + foreach ($value as $key => $val) { |
|
290 | + $c_id = $field_name.'_'.$value; |
|
291 | + $c_class = isset($classes[$key]) ? 'class="'.$classes[$key].'" ' : ''; |
|
292 | + $c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : ''; |
|
293 | + $checked = ! empty($default) && $default == $val ? ' checked="checked" ' : ''; |
|
294 | + $c_input .= '<input name="'.$f_name.'" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label; |
|
295 | 295 | } |
296 | 296 | $fld = $c_input; |
297 | 297 | } else { |
298 | - $checked = !empty($default) && $default == $val ? 'checked="checked" ' : ''; |
|
299 | - $fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n"; |
|
298 | + $checked = ! empty($default) && $default == $val ? 'checked="checked" ' : ''; |
|
299 | + $fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n"; |
|
300 | 300 | } |
301 | 301 | break; |
302 | 302 | |
303 | 303 | case 'hidden' : |
304 | - $fld = '<input name="' . $f_name . '" type="hidden" id="' . $id . '" class="' . $class . '" value="' . $value . '" />' . "\n"; |
|
304 | + $fld = '<input name="'.$f_name.'" type="hidden" id="'.$id.'" class="'.$class.'" value="'.$value.'" />'."\n"; |
|
305 | 305 | break; |
306 | 306 | |
307 | 307 | case 'select' : |
308 | - $fld = '<select name="' . $f_name . '" class="' . $class . '" id="' . $id . '"' . $tabindex_str . '>' . "\n"; |
|
309 | - foreach ( $value as $key => $val ) { |
|
310 | - $checked = !empty($default) && $default == $val ? ' selected="selected"' : ''; |
|
311 | - $fld .= "\t" . '<option value="' . $val . '"' . $checked . '>' . $labels[$key] . '</option>' . "\n"; |
|
308 | + $fld = '<select name="'.$f_name.'" class="'.$class.'" id="'.$id.'"'.$tabindex_str.'>'."\n"; |
|
309 | + foreach ($value as $key => $val) { |
|
310 | + $checked = ! empty($default) && $default == $val ? ' selected="selected"' : ''; |
|
311 | + $fld .= "\t".'<option value="'.$val.'"'.$checked.'>'.$labels[$key].'</option>'."\n"; |
|
312 | 312 | } |
313 | 313 | $fld .= '</select>'; |
314 | 314 | break; |
@@ -320,21 +320,21 @@ discard block |
||
320 | 320 | 'editor_class' => $class, |
321 | 321 | 'tabindex' => $tabindex |
322 | 322 | ); |
323 | - $editor_settings = array_merge( $wpeditor_args, $editor_settings ); |
|
323 | + $editor_settings = array_merge($wpeditor_args, $editor_settings); |
|
324 | 324 | ob_start(); |
325 | - wp_editor( $value, $id, $editor_settings ); |
|
325 | + wp_editor($value, $id, $editor_settings); |
|
326 | 326 | $editor = ob_get_contents(); |
327 | 327 | ob_end_clean(); |
328 | 328 | $fld = $editor; |
329 | 329 | break; |
330 | 330 | |
331 | 331 | default : //'text fields' |
332 | - $fld = '<input name="' . $f_name . '" type="text" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $tabindex_str . ' />' . "\n"; |
|
332 | + $fld = '<input name="'.$f_name.'" type="text" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$tabindex_str.' />'."\n"; |
|
333 | 333 | $fld .= $extra_desc; |
334 | 334 | |
335 | 335 | } |
336 | 336 | |
337 | - $form_fields[ $field_name ] = array( 'label' => $label, 'field' => $fld ); |
|
337 | + $form_fields[$field_name] = array('label' => $label, 'field' => $fld); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | return $form_fields; |
@@ -363,19 +363,19 @@ discard block |
||
363 | 363 | */ |
364 | 364 | static public function select_input($name, $values, $default = '', $parameters = '', $class = '', $autosize = true) { |
365 | 365 | //if $values was submitted in the wrong format, convert it over |
366 | - if(!empty($values) && (!array_key_exists(0,$values) || !is_array($values[0]))){ |
|
367 | - $converted_values=array(); |
|
368 | - foreach($values as $id=>$text){ |
|
369 | - $converted_values[]=array('id'=>$id,'text'=>$text); |
|
366 | + if ( ! empty($values) && ( ! array_key_exists(0, $values) || ! is_array($values[0]))) { |
|
367 | + $converted_values = array(); |
|
368 | + foreach ($values as $id=>$text) { |
|
369 | + $converted_values[] = array('id'=>$id, 'text'=>$text); |
|
370 | 370 | } |
371 | - $values=$converted_values; |
|
371 | + $values = $converted_values; |
|
372 | 372 | } |
373 | 373 | |
374 | - $field = '<select id="' . EEH_Formatter::ee_tep_output_string($name) . '" name="' . EEH_Formatter::ee_tep_output_string($name) . '"'; |
|
374 | + $field = '<select id="'.EEH_Formatter::ee_tep_output_string($name).'" name="'.EEH_Formatter::ee_tep_output_string($name).'"'; |
|
375 | 375 | //Debug |
376 | 376 | //EEH_Debug_Tools::printr( $values, '$values <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
377 | - if ( EEH_Formatter::ee_tep_not_null($parameters)) |
|
378 | - $field .= ' ' . $parameters; |
|
377 | + if (EEH_Formatter::ee_tep_not_null($parameters)) |
|
378 | + $field .= ' '.$parameters; |
|
379 | 379 | if ($autosize) { |
380 | 380 | $size = 'med'; |
381 | 381 | for ($ii = 0, $ni = sizeof($values); $ii < $ni; $ii++) { |
@@ -388,21 +388,21 @@ discard block |
||
388 | 388 | $size = ''; |
389 | 389 | } |
390 | 390 | |
391 | - $field .= ' class="' . $class . ' ' . $size . '">'; |
|
391 | + $field .= ' class="'.$class.' '.$size.'">'; |
|
392 | 392 | |
393 | 393 | if (empty($default) && isset($GLOBALS[$name])) |
394 | 394 | $default = stripslashes($GLOBALS[$name]); |
395 | 395 | |
396 | 396 | |
397 | 397 | for ($i = 0, $n = sizeof($values); $i < $n; $i++) { |
398 | - $field .= '<option value="' . $values[$i]['id'] . '"'; |
|
398 | + $field .= '<option value="'.$values[$i]['id'].'"'; |
|
399 | 399 | if ($default == $values[$i]['id']) { |
400 | 400 | $field .= ' selected = "selected"'; |
401 | 401 | } |
402 | - if ( isset( $values[$i]['class'] ) ) { |
|
403 | - $field .= ' class="' . $values[$i]['class'] . '"'; |
|
402 | + if (isset($values[$i]['class'])) { |
|
403 | + $field .= ' class="'.$values[$i]['class'].'"'; |
|
404 | 404 | } |
405 | - $field .= '>' . $values[$i]['text'] . '</option>'; |
|
405 | + $field .= '>'.$values[$i]['text'].'</option>'; |
|
406 | 406 | } |
407 | 407 | $field .= '</select>'; |
408 | 408 | |
@@ -420,38 +420,38 @@ discard block |
||
420 | 420 | * @param string $question_groups |
421 | 421 | * @return string HTML |
422 | 422 | */ |
423 | - static function generate_question_groups_html( $question_groups = array(), $group_wrapper = 'fieldset' ) { |
|
423 | + static function generate_question_groups_html($question_groups = array(), $group_wrapper = 'fieldset') { |
|
424 | 424 | |
425 | 425 | $html = ''; |
426 | - $before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' ); |
|
427 | - $after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' ); |
|
426 | + $before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', ''); |
|
427 | + $after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', ''); |
|
428 | 428 | |
429 | - if ( ! empty( $question_groups )) { |
|
429 | + if ( ! empty($question_groups)) { |
|
430 | 430 | //EEH_Debug_Tools::printr( $question_groups, '$question_groups <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
431 | 431 | // loop thru question groups |
432 | - foreach ( $question_groups as $QSG ) { |
|
432 | + foreach ($question_groups as $QSG) { |
|
433 | 433 | // check that questions exist |
434 | - if ( ! empty( $QSG['QSG_questions'] )) { |
|
434 | + if ( ! empty($QSG['QSG_questions'])) { |
|
435 | 435 | // use fieldsets |
436 | - $html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG['QSG_identifier'] . '">'; |
|
436 | + $html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG['QSG_identifier'].'">'; |
|
437 | 437 | // group_name |
438 | - $html .= $QSG['QSG_show_group_name'] ? "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . self::prep_answer( $QSG['QSG_name'] ) . '</h5>' : ''; |
|
438 | + $html .= $QSG['QSG_show_group_name'] ? "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.self::prep_answer($QSG['QSG_name']).'</h5>' : ''; |
|
439 | 439 | // group_desc |
440 | - $html .= $QSG['QSG_show_group_desc'] && ! empty( $QSG['QSG_desc'] ) ? '<div class="espresso-question-group-desc-pg">' . self::prep_answer( $QSG['QSG_desc'] ) . '</div>' : ''; |
|
440 | + $html .= $QSG['QSG_show_group_desc'] && ! empty($QSG['QSG_desc']) ? '<div class="espresso-question-group-desc-pg">'.self::prep_answer($QSG['QSG_desc']).'</div>' : ''; |
|
441 | 441 | |
442 | 442 | $html .= $before_question_group_questions; |
443 | 443 | // loop thru questions |
444 | - foreach ( $QSG['QSG_questions'] as $question ) { |
|
444 | + foreach ($QSG['QSG_questions'] as $question) { |
|
445 | 445 | // EEH_Debug_Tools::printr( $question, '$question <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
446 | 446 | $QFI = new EE_Question_Form_Input( |
447 | 447 | $question['qst_obj'], |
448 | 448 | $question['ans_obj'], |
449 | 449 | $question |
450 | 450 | ); |
451 | - $html .= self::generate_form_input( $QFI ); |
|
451 | + $html .= self::generate_form_input($QFI); |
|
452 | 452 | } |
453 | 453 | $html .= $after_question_group_questions; |
454 | - $html .= "\n\t" . '</' . $group_wrapper . '>'; |
|
454 | + $html .= "\n\t".'</'.$group_wrapper.'>'; |
|
455 | 455 | } |
456 | 456 | } |
457 | 457 | } |
@@ -471,11 +471,11 @@ discard block |
||
471 | 471 | * @param string $group_wrapper |
472 | 472 | * @return string HTML |
473 | 473 | */ |
474 | - static function generate_question_groups_html2( $question_groups = array(), $q_meta = array(), $from_admin = FALSE, $group_wrapper = 'fieldset' ) { |
|
474 | + static function generate_question_groups_html2($question_groups = array(), $q_meta = array(), $from_admin = FALSE, $group_wrapper = 'fieldset') { |
|
475 | 475 | |
476 | 476 | $html = ''; |
477 | - $before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' ); |
|
478 | - $after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' ); |
|
477 | + $before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', ''); |
|
478 | + $after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', ''); |
|
479 | 479 | |
480 | 480 | $default_q_meta = array( |
481 | 481 | 'att_nmbr' => 1, |
@@ -484,55 +484,55 @@ discard block |
||
484 | 484 | 'input_id' => '', |
485 | 485 | 'input_class' => '' |
486 | 486 | ); |
487 | - $q_meta = array_merge( $default_q_meta, $q_meta ); |
|
487 | + $q_meta = array_merge($default_q_meta, $q_meta); |
|
488 | 488 | //EEH_Debug_Tools::printr( $q_meta, '$q_meta <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
489 | 489 | |
490 | - if ( ! empty( $question_groups )) { |
|
490 | + if ( ! empty($question_groups)) { |
|
491 | 491 | // EEH_Debug_Tools::printr( $question_groups, '$question_groups <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
492 | 492 | // loop thru question groups |
493 | - foreach ( $question_groups as $QSG ) { |
|
494 | - if ( $QSG instanceof EE_Question_Group ) { |
|
493 | + foreach ($question_groups as $QSG) { |
|
494 | + if ($QSG instanceof EE_Question_Group) { |
|
495 | 495 | // check that questions exist |
496 | 496 | |
497 | - $where = array( 'QST_deleted' => 0 ); |
|
498 | - if ( ! $from_admin ) { |
|
497 | + $where = array('QST_deleted' => 0); |
|
498 | + if ( ! $from_admin) { |
|
499 | 499 | $where['QST_admin_only'] = 0; |
500 | 500 | } |
501 | - $questions = $QSG->questions( array( $where, 'order_by' => array( 'Question_Group_Question.QGQ_order' => 'ASC' ))); |
|
502 | - if ( ! empty( $questions )) { |
|
501 | + $questions = $QSG->questions(array($where, 'order_by' => array('Question_Group_Question.QGQ_order' => 'ASC'))); |
|
502 | + if ( ! empty($questions)) { |
|
503 | 503 | // use fieldsets |
504 | - $html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG->get( 'QSG_identifier' ) . '">'; |
|
504 | + $html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG->get('QSG_identifier').'">'; |
|
505 | 505 | // group_name |
506 | - if ( $QSG->show_group_name() ) { |
|
507 | - $html .= "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . $QSG->get_pretty( 'QSG_name' ) . '</h5>'; |
|
506 | + if ($QSG->show_group_name()) { |
|
507 | + $html .= "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.$QSG->get_pretty('QSG_name').'</h5>'; |
|
508 | 508 | } |
509 | 509 | // group_desc |
510 | - if ( $QSG->show_group_desc() ) { |
|
511 | - $html .= '<div class="espresso-question-group-desc-pg">' . $QSG->get_pretty( 'QSG_desc' ) . '</div>'; |
|
510 | + if ($QSG->show_group_desc()) { |
|
511 | + $html .= '<div class="espresso-question-group-desc-pg">'.$QSG->get_pretty('QSG_desc').'</div>'; |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | $html .= $before_question_group_questions; |
515 | 515 | // loop thru questions |
516 | - foreach ( $questions as $QST ) { |
|
516 | + foreach ($questions as $QST) { |
|
517 | 517 | $qstn_id = $QST->is_system_question() ? $QST->system_ID() : $QST->ID(); |
518 | 518 | |
519 | 519 | $answer = NULL; |
520 | 520 | |
521 | - if ( isset( $_GET['qstn'] ) && isset( $q_meta['input_id'] ) && isset( $q_meta['att_nmbr'] )) { |
|
521 | + if (isset($_GET['qstn']) && isset($q_meta['input_id']) && isset($q_meta['att_nmbr'])) { |
|
522 | 522 | // check for answer in $_GET in case we are reprocessing a form after an error |
523 | - if ( isset( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] )) { |
|
524 | - $answer = is_array( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] ) ? $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] : sanitize_text_field( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] ); |
|
523 | + if (isset($_GET['qstn'][$q_meta['input_id']][$qstn_id])) { |
|
524 | + $answer = is_array($_GET['qstn'][$q_meta['input_id']][$qstn_id]) ? $_GET['qstn'][$q_meta['input_id']][$qstn_id] : sanitize_text_field($_GET['qstn'][$q_meta['input_id']][$qstn_id]); |
|
525 | 525 | } |
526 | - } else if ( isset( $q_meta['attendee'] ) && $q_meta['attendee'] ) { |
|
526 | + } else if (isset($q_meta['attendee']) && $q_meta['attendee']) { |
|
527 | 527 | //attendee data from the session |
528 | - $answer = isset( $q_meta['attendee'][ $qstn_id ] ) ? $q_meta['attendee'][ $qstn_id ] : NULL; |
|
528 | + $answer = isset($q_meta['attendee'][$qstn_id]) ? $q_meta['attendee'][$qstn_id] : NULL; |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | |
532 | 532 | |
533 | 533 | $QFI = new EE_Question_Form_Input( |
534 | 534 | $QST, |
535 | - EE_Answer::new_instance ( array( |
|
535 | + EE_Answer::new_instance(array( |
|
536 | 536 | 'ANS_ID'=> 0, |
537 | 537 | 'QST_ID'=> 0, |
538 | 538 | 'REG_ID'=> 0, |
@@ -541,10 +541,10 @@ discard block |
||
541 | 541 | $q_meta |
542 | 542 | ); |
543 | 543 | //EEH_Debug_Tools::printr( $QFI, '$QFI <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
544 | - $html .= self::generate_form_input( $QFI ); |
|
544 | + $html .= self::generate_form_input($QFI); |
|
545 | 545 | } |
546 | 546 | $html .= $after_question_group_questions; |
547 | - $html .= "\n\t" . '</' . $group_wrapper . '>'; |
|
547 | + $html .= "\n\t".'</'.$group_wrapper.'>'; |
|
548 | 548 | } |
549 | 549 | } |
550 | 550 | } |
@@ -564,63 +564,63 @@ discard block |
||
564 | 564 | * @param EE_Question_Form_Input $QFI |
565 | 565 | * @return string HTML |
566 | 566 | */ |
567 | - static function generate_form_input( EE_Question_Form_Input $QFI ) { |
|
568 | - if ( isset( $QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin() ) { |
|
567 | + static function generate_form_input(EE_Question_Form_Input $QFI) { |
|
568 | + if (isset($QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin()) { |
|
569 | 569 | return ''; |
570 | 570 | } |
571 | 571 | |
572 | - $QFI = self::_load_system_dropdowns( $QFI ); |
|
573 | - $QFI = self::_load_specialized_dropdowns( $QFI ); |
|
572 | + $QFI = self::_load_system_dropdowns($QFI); |
|
573 | + $QFI = self::_load_specialized_dropdowns($QFI); |
|
574 | 574 | |
575 | 575 | //we also need to verify |
576 | 576 | |
577 | 577 | $display_text = $QFI->get('QST_display_text'); |
578 | 578 | $input_name = $QFI->get('QST_input_name'); |
579 | - $answer = EE_Registry::instance()->REQ->is_set( $input_name ) ? EE_Registry::instance()->REQ->get( $input_name ) : $QFI->get('ANS_value'); |
|
579 | + $answer = EE_Registry::instance()->REQ->is_set($input_name) ? EE_Registry::instance()->REQ->get($input_name) : $QFI->get('ANS_value'); |
|
580 | 580 | $input_id = $QFI->get('QST_input_id'); |
581 | 581 | $input_class = $QFI->get('QST_input_class'); |
582 | 582 | // $disabled = $QFI->get('QST_disabled') ? ' disabled="disabled"' : ''; |
583 | 583 | $disabled = $QFI->get('QST_disabled') ? TRUE : FALSE; |
584 | - $required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>' ); |
|
584 | + $required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>'); |
|
585 | 585 | $QST_required = $QFI->get('QST_required'); |
586 | - $required = $QST_required ? array( 'label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required ) : array(); |
|
587 | - $use_html_entities = $QFI->get_meta( 'htmlentities' ); |
|
588 | - $required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __( 'This field is required', 'event_espresso' ); |
|
589 | - $required_text = $QST_required ? "\n\t\t\t" . '<div class="required-text hidden">' . self::prep_answer( $required_text, $use_html_entities ) . '</div>' : ''; |
|
586 | + $required = $QST_required ? array('label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required) : array(); |
|
587 | + $use_html_entities = $QFI->get_meta('htmlentities'); |
|
588 | + $required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __('This field is required', 'event_espresso'); |
|
589 | + $required_text = $QST_required ? "\n\t\t\t".'<div class="required-text hidden">'.self::prep_answer($required_text, $use_html_entities).'</div>' : ''; |
|
590 | 590 | $label_class = 'espresso-form-input-lbl'; |
591 | - $QST_options = $QFI->options(true,$answer); |
|
592 | - $options = is_array( $QST_options ) ? self::prep_answer_options( $QST_options ) : array(); |
|
591 | + $QST_options = $QFI->options(true, $answer); |
|
592 | + $options = is_array($QST_options) ? self::prep_answer_options($QST_options) : array(); |
|
593 | 593 | $system_ID = $QFI->get('QST_system'); |
594 | - $label_b4 = $QFI->get_meta( 'label_b4' ); |
|
595 | - $use_desc_4_label = $QFI->get_meta( 'use_desc_4_label' ); |
|
594 | + $label_b4 = $QFI->get_meta('label_b4'); |
|
595 | + $use_desc_4_label = $QFI->get_meta('use_desc_4_label'); |
|
596 | 596 | |
597 | 597 | |
598 | - switch ( $QFI->get('QST_type') ){ |
|
598 | + switch ($QFI->get('QST_type')) { |
|
599 | 599 | |
600 | 600 | case 'TEXTAREA' : |
601 | - return EEH_Form_Fields::textarea( $display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities ); |
|
601 | + return EEH_Form_Fields::textarea($display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities); |
|
602 | 602 | break; |
603 | 603 | |
604 | 604 | case 'DROPDOWN' : |
605 | - return EEH_Form_Fields::select( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE ); |
|
605 | + return EEH_Form_Fields::select($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE); |
|
606 | 606 | break; |
607 | 607 | |
608 | 608 | |
609 | 609 | case 'RADIO_BTN' : |
610 | - return EEH_Form_Fields::radio( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label ); |
|
610 | + return EEH_Form_Fields::radio($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label); |
|
611 | 611 | break; |
612 | 612 | |
613 | 613 | case 'CHECKBOX' : |
614 | - return EEH_Form_Fields::checkbox( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $label_b4, $system_ID, $use_html_entities ); |
|
614 | + return EEH_Form_Fields::checkbox($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $label_b4, $system_ID, $use_html_entities); |
|
615 | 615 | break; |
616 | 616 | |
617 | 617 | case 'DATE' : |
618 | - return EEH_Form_Fields::datepicker( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities ); |
|
618 | + return EEH_Form_Fields::datepicker($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities); |
|
619 | 619 | break; |
620 | 620 | |
621 | 621 | case 'TEXT' : |
622 | 622 | default: |
623 | - return EEH_Form_Fields::text( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities ); |
|
623 | + return EEH_Form_Fields::text($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities); |
|
624 | 624 | break; |
625 | 625 | |
626 | 626 | } |
@@ -646,31 +646,31 @@ discard block |
||
646 | 646 | * @param string $disabled disabled="disabled" or null |
647 | 647 | * @return string HTML |
648 | 648 | */ |
649 | - static function text( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) { |
|
649 | + static function text($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) { |
|
650 | 650 | // need these |
651 | - if ( ! $question || ! $name ) { |
|
651 | + if ( ! $question || ! $name) { |
|
652 | 652 | return NULL; |
653 | 653 | } |
654 | 654 | // prep the answer |
655 | - $answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities ); |
|
655 | + $answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities); |
|
656 | 656 | // prep the required array |
657 | - $required = self::prep_required( $required ); |
|
657 | + $required = self::prep_required($required); |
|
658 | 658 | // set disabled tag |
659 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
659 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
660 | 660 | // ya gots ta have style man!!! |
661 | 661 | $txt_class = is_admin() ? 'regular-text' : 'espresso-text-inp'; |
662 | - $class = empty( $class ) ? $txt_class : $class; |
|
663 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
664 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
662 | + $class = empty($class) ? $txt_class : $class; |
|
663 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
664 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
665 | 665 | |
666 | - $label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>'; |
|
666 | + $label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>'; |
|
667 | 667 | // filter label but ensure required text comes before it |
668 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
668 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
669 | 669 | |
670 | - $input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" value="' . esc_attr( $answer ) . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled .' ' . $extra . '/>'; |
|
670 | + $input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" value="'.esc_attr($answer).'" title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>'; |
|
671 | 671 | |
672 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
673 | - return $label_html . $input_html; |
|
672 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
673 | + return $label_html.$input_html; |
|
674 | 674 | |
675 | 675 | } |
676 | 676 | |
@@ -692,35 +692,35 @@ discard block |
||
692 | 692 | * @param string $disabled disabled="disabled" or null |
693 | 693 | * @return string HTML |
694 | 694 | */ |
695 | - static function textarea( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) { |
|
695 | + static function textarea($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) { |
|
696 | 696 | // need these |
697 | - if ( ! $question || ! $name ) { |
|
697 | + if ( ! $question || ! $name) { |
|
698 | 698 | return NULL; |
699 | 699 | } |
700 | 700 | // prep the answer |
701 | - $answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities ); |
|
701 | + $answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities); |
|
702 | 702 | // prep the required array |
703 | - $required = self::prep_required( $required ); |
|
703 | + $required = self::prep_required($required); |
|
704 | 704 | // make sure $dimensions is an array |
705 | - $dimensions = is_array( $dimensions ) ? $dimensions : array(); |
|
705 | + $dimensions = is_array($dimensions) ? $dimensions : array(); |
|
706 | 706 | // and set some defaults |
707 | - $dimensions = array_merge( array( 'rows' => 3, 'cols' => 40 ), $dimensions ); |
|
707 | + $dimensions = array_merge(array('rows' => 3, 'cols' => 40), $dimensions); |
|
708 | 708 | // set disabled tag |
709 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
709 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
710 | 710 | // ya gots ta have style man!!! |
711 | 711 | $txt_class = is_admin() ? 'regular-text' : 'espresso-textarea-inp'; |
712 | - $class = empty( $class ) ? $txt_class : $class; |
|
713 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
714 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
712 | + $class = empty($class) ? $txt_class : $class; |
|
713 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
714 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
715 | 715 | |
716 | - $label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>'; |
|
716 | + $label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>'; |
|
717 | 717 | // filter label but ensure required text comes before it |
718 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
718 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
719 | 719 | |
720 | - $input_html = "\n\t\t\t" . '<textarea name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" rows="' . $dimensions['rows'] . '" cols="' . $dimensions['cols'] . '" title="' . $required['msg'] . '" ' . $disabled . ' ' . $extra . '>' . $answer . '</textarea>'; |
|
720 | + $input_html = "\n\t\t\t".'<textarea name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" rows="'.$dimensions['rows'].'" cols="'.$dimensions['cols'].'" title="'.$required['msg'].'" '.$disabled.' '.$extra.'>'.$answer.'</textarea>'; |
|
721 | 721 | |
722 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
723 | - return $label_html . $input_html; |
|
722 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
723 | + return $label_html.$input_html; |
|
724 | 724 | |
725 | 725 | } |
726 | 726 | |
@@ -743,47 +743,47 @@ discard block |
||
743 | 743 | * @param string $disabled disabled="disabled" or null |
744 | 744 | * @return string HTML |
745 | 745 | */ |
746 | - static function select( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE ) { |
|
746 | + static function select($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE) { |
|
747 | 747 | |
748 | 748 | // need these |
749 | - if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) { |
|
749 | + if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) { |
|
750 | 750 | return NULL; |
751 | 751 | } |
752 | 752 | // prep the answer |
753 | - $answer = is_array( $answer ) ? self::prep_answer( array_shift( $answer ), $use_html_entities) : self::prep_answer( $answer, $use_html_entities ); |
|
753 | + $answer = is_array($answer) ? self::prep_answer(array_shift($answer), $use_html_entities) : self::prep_answer($answer, $use_html_entities); |
|
754 | 754 | // prep the required array |
755 | - $required = self::prep_required( $required ); |
|
755 | + $required = self::prep_required($required); |
|
756 | 756 | // set disabled tag |
757 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
757 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
758 | 758 | // ya gots ta have style man!!! |
759 | 759 | $txt_class = is_admin() ? 'wide' : 'espresso-select-inp'; |
760 | - $class = empty( $class ) ? $txt_class : $class; |
|
761 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
762 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
760 | + $class = empty($class) ? $txt_class : $class; |
|
761 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
762 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
763 | 763 | |
764 | - $label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>'; |
|
764 | + $label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>'; |
|
765 | 765 | // filter label but ensure required text comes before it |
766 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
766 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
767 | 767 | |
768 | - $input_html = "\n\t\t\t" . '<select name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" title="' . esc_attr( $required['msg'] ) . '"' . $disabled . ' ' . $extra . '>'; |
|
768 | + $input_html = "\n\t\t\t".'<select name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" title="'.esc_attr($required['msg']).'"'.$disabled.' '.$extra.'>'; |
|
769 | 769 | // recursively count array elements, to determine total number of options |
770 | - $only_option = count( $options, 1 ) == 1 ? TRUE : FALSE; |
|
771 | - if ( ! $only_option ) { |
|
770 | + $only_option = count($options, 1) == 1 ? TRUE : FALSE; |
|
771 | + if ( ! $only_option) { |
|
772 | 772 | // if there is NO answer set and there are multiple options to choose from, then set the "please select" message as selected |
773 | 773 | $selected = $answer === NULL ? ' selected="selected"' : ''; |
774 | - $input_html .= $add_please_select_option ? "\n\t\t\t\t" . '<option value=""' . $selected . '>' . __(' - please select - ', 'event_espresso') . '</option>' : ''; |
|
774 | + $input_html .= $add_please_select_option ? "\n\t\t\t\t".'<option value=""'.$selected.'>'.__(' - please select - ', 'event_espresso').'</option>' : ''; |
|
775 | 775 | } |
776 | - foreach ( $options as $key => $value ) { |
|
776 | + foreach ($options as $key => $value) { |
|
777 | 777 | // if value is an array, then create option groups, else create regular ol' options |
778 | - $input_html .= is_array( $value ) ? self::_generate_select_option_group( $key, $value, $answer, $use_html_entities ) : self::_generate_select_option( $value->value(), $value->desc(), $answer, $only_option, $use_html_entities ); |
|
778 | + $input_html .= is_array($value) ? self::_generate_select_option_group($key, $value, $answer, $use_html_entities) : self::_generate_select_option($value->value(), $value->desc(), $answer, $only_option, $use_html_entities); |
|
779 | 779 | } |
780 | 780 | |
781 | - $input_html .= "\n\t\t\t" . '</select>'; |
|
781 | + $input_html .= "\n\t\t\t".'</select>'; |
|
782 | 782 | |
783 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID ); |
|
783 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID); |
|
784 | 784 | |
785 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
786 | - return $label_html . $input_html; |
|
785 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
786 | + return $label_html.$input_html; |
|
787 | 787 | |
788 | 788 | } |
789 | 789 | |
@@ -801,12 +801,12 @@ discard block |
||
801 | 801 | * @param boolean $use_html_entities |
802 | 802 | * @return string |
803 | 803 | */ |
804 | - private static function _generate_select_option_group( $opt_group, $QSOs, $answer, $use_html_entities = true ){ |
|
805 | - $html = "\n\t\t\t\t" . '<optgroup label="' . self::prep_option_value( $opt_group ) . '">'; |
|
806 | - foreach ( $QSOs as $QSO ) { |
|
807 | - $html .= self::_generate_select_option( $QSO->value(), $QSO->desc(), $answer, false, $use_html_entities ); |
|
804 | + private static function _generate_select_option_group($opt_group, $QSOs, $answer, $use_html_entities = true) { |
|
805 | + $html = "\n\t\t\t\t".'<optgroup label="'.self::prep_option_value($opt_group).'">'; |
|
806 | + foreach ($QSOs as $QSO) { |
|
807 | + $html .= self::_generate_select_option($QSO->value(), $QSO->desc(), $answer, false, $use_html_entities); |
|
808 | 808 | } |
809 | - $html .= "\n\t\t\t\t" . '</optgroup>'; |
|
809 | + $html .= "\n\t\t\t\t".'</optgroup>'; |
|
810 | 810 | return $html; |
811 | 811 | } |
812 | 812 | |
@@ -821,12 +821,12 @@ discard block |
||
821 | 821 | * @param boolean $use_html_entities |
822 | 822 | * @return string |
823 | 823 | */ |
824 | - private static function _generate_select_option( $key, $value, $answer, $only_option = FALSE, $use_html_entities = true ){ |
|
825 | - $key = self::prep_answer( $key, $use_html_entities ); |
|
826 | - $value = self::prep_answer( $value, $use_html_entities ); |
|
827 | - $value = ! empty( $value ) ? $value : $key; |
|
828 | - $selected = ( $answer == $key || $only_option ) ? ' selected="selected"' : ''; |
|
829 | - return "\n\t\t\t\t" . '<option value="' . self::prep_option_value( $key ) . '"' . $selected . '> ' . $value . ' </option>'; |
|
824 | + private static function _generate_select_option($key, $value, $answer, $only_option = FALSE, $use_html_entities = true) { |
|
825 | + $key = self::prep_answer($key, $use_html_entities); |
|
826 | + $value = self::prep_answer($value, $use_html_entities); |
|
827 | + $value = ! empty($value) ? $value : $key; |
|
828 | + $selected = ($answer == $key || $only_option) ? ' selected="selected"' : ''; |
|
829 | + return "\n\t\t\t\t".'<option value="'.self::prep_option_value($key).'"'.$selected.'> '.$value.' </option>'; |
|
830 | 830 | } |
831 | 831 | |
832 | 832 | |
@@ -850,56 +850,56 @@ discard block |
||
850 | 850 | * @param bool $use_desc_4_label |
851 | 851 | * @return string HTML |
852 | 852 | */ |
853 | - static function radio( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE ) { |
|
853 | + static function radio($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE) { |
|
854 | 854 | // need these |
855 | - if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) { |
|
855 | + if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) { |
|
856 | 856 | return NULL; |
857 | 857 | } |
858 | 858 | // prep the answer |
859 | - $answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities ); |
|
859 | + $answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities); |
|
860 | 860 | // prep the required array |
861 | - $required = self::prep_required( $required ); |
|
861 | + $required = self::prep_required($required); |
|
862 | 862 | // set disabled tag |
863 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
863 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
864 | 864 | // ya gots ta have style man!!! |
865 | 865 | $radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class; |
866 | - $class = ! empty( $class ) ? $class : 'espresso-radio-btn-inp'; |
|
867 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
866 | + $class = ! empty($class) ? $class : 'espresso-radio-btn-inp'; |
|
867 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
868 | 868 | |
869 | - $label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> '; |
|
869 | + $label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> '; |
|
870 | 870 | // filter label but ensure required text comes before it |
871 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
871 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
872 | 872 | |
873 | - $input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-radio-btn-options-ul ' . $label_class . ' ' . $class . '-ul">'; |
|
873 | + $input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-radio-btn-options-ul '.$label_class.' '.$class.'-ul">'; |
|
874 | 874 | |
875 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
876 | - $class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : ''; |
|
875 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
876 | + $class .= ! empty($required['class']) ? ' '.$required['class'] : ''; |
|
877 | 877 | |
878 | - foreach ( $options as $OPT ) { |
|
879 | - if ( $OPT instanceof EE_Question_Option ) { |
|
880 | - $value = self::prep_option_value( $OPT->value() ); |
|
878 | + foreach ($options as $OPT) { |
|
879 | + if ($OPT instanceof EE_Question_Option) { |
|
880 | + $value = self::prep_option_value($OPT->value()); |
|
881 | 881 | $label = $use_desc_4_label ? $OPT->desc() : $OPT->value(); |
882 | - $size = $use_desc_4_label ? self::get_label_size_class( $OPT->value() . ' ' . $OPT->desc() ) : self::get_label_size_class( $OPT->value() ); |
|
883 | - $desc = $OPT->desc();//no self::prep_answer |
|
884 | - $answer = is_numeric( $value ) && empty( $answer ) ? 0 : $answer; |
|
885 | - $checked = (string)$value == (string)$answer ? ' checked="checked"' : ''; |
|
886 | - $opt = '-' . sanitize_key( $value ); |
|
887 | - |
|
888 | - $input_html .= "\n\t\t\t\t" . '<li' . $size . '>'; |
|
889 | - $input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-radio-btn-lbl">'; |
|
890 | - $input_html .= $label_b4 ? "\n\t\t\t\t\t\t" . '<span>' . $label . '</span>' : ''; |
|
891 | - $input_html .= "\n\t\t\t\t\t\t" . '<input type="radio" name="' . $name . '" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>'; |
|
892 | - $input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t" . '<span class="espresso-radio-btn-desc">' . $label . '</span>' : ''; |
|
893 | - $input_html .= "\n\t\t\t\t\t" . '</label>'; |
|
894 | - $input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">' . $desc . '</span>'; |
|
895 | - $input_html .= "\n\t\t\t\t" . '</li>'; |
|
882 | + $size = $use_desc_4_label ? self::get_label_size_class($OPT->value().' '.$OPT->desc()) : self::get_label_size_class($OPT->value()); |
|
883 | + $desc = $OPT->desc(); //no self::prep_answer |
|
884 | + $answer = is_numeric($value) && empty($answer) ? 0 : $answer; |
|
885 | + $checked = (string) $value == (string) $answer ? ' checked="checked"' : ''; |
|
886 | + $opt = '-'.sanitize_key($value); |
|
887 | + |
|
888 | + $input_html .= "\n\t\t\t\t".'<li'.$size.'>'; |
|
889 | + $input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-radio-btn-lbl">'; |
|
890 | + $input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$label.'</span>' : ''; |
|
891 | + $input_html .= "\n\t\t\t\t\t\t".'<input type="radio" name="'.$name.'" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>'; |
|
892 | + $input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span class="espresso-radio-btn-desc">'.$label.'</span>' : ''; |
|
893 | + $input_html .= "\n\t\t\t\t\t".'</label>'; |
|
894 | + $input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">'.$desc.'</span>'; |
|
895 | + $input_html .= "\n\t\t\t\t".'</li>'; |
|
896 | 896 | } |
897 | 897 | } |
898 | 898 | |
899 | - $input_html .= "\n\t\t\t" . '</ul>'; |
|
899 | + $input_html .= "\n\t\t\t".'</ul>'; |
|
900 | 900 | |
901 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
902 | - return $label_html . $input_html; |
|
901 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
902 | + return $label_html.$input_html; |
|
903 | 903 | |
904 | 904 | } |
905 | 905 | |
@@ -922,65 +922,65 @@ discard block |
||
922 | 922 | * @param string $disabled disabled="disabled" or null |
923 | 923 | * @return string HTML |
924 | 924 | */ |
925 | - static function checkbox( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) { |
|
925 | + static function checkbox($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) { |
|
926 | 926 | // need these |
927 | - if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) { |
|
927 | + if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) { |
|
928 | 928 | return NULL; |
929 | 929 | } |
930 | - $answer = maybe_unserialize( $answer ); |
|
930 | + $answer = maybe_unserialize($answer); |
|
931 | 931 | |
932 | 932 | // prep the answer(s) |
933 | - $answer = is_array( $answer ) ? $answer : array( sanitize_key( $answer ) => $answer ); |
|
933 | + $answer = is_array($answer) ? $answer : array(sanitize_key($answer) => $answer); |
|
934 | 934 | |
935 | - foreach ( $answer as $key => $value ) { |
|
936 | - $key = self::prep_option_value( $key ); |
|
937 | - $answer[$key] = self::prep_answer( $value, $use_html_entities ); |
|
935 | + foreach ($answer as $key => $value) { |
|
936 | + $key = self::prep_option_value($key); |
|
937 | + $answer[$key] = self::prep_answer($value, $use_html_entities); |
|
938 | 938 | } |
939 | 939 | |
940 | 940 | // prep the required array |
941 | - $required = self::prep_required( $required ); |
|
941 | + $required = self::prep_required($required); |
|
942 | 942 | // set disabled tag |
943 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
943 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
944 | 944 | // ya gots ta have style man!!! |
945 | 945 | $radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class; |
946 | - $class = empty( $class ) ? 'espresso-radio-btn-inp' : $class; |
|
947 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
946 | + $class = empty($class) ? 'espresso-radio-btn-inp' : $class; |
|
947 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
948 | 948 | |
949 | - $label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> '; |
|
949 | + $label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> '; |
|
950 | 950 | // filter label but ensure required text comes before it |
951 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
952 | - |
|
953 | - $input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-checkbox-options-ul ' . $label_class . ' ' . $class . '-ul">'; |
|
954 | - |
|
955 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
956 | - $class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : ''; |
|
957 | - |
|
958 | - foreach ( $options as $OPT ) { |
|
959 | - $value = $OPT->value();//self::prep_option_value( $OPT->value() ); |
|
960 | - $size = self::get_label_size_class( $OPT->value() . ' ' . $OPT->desc() ); |
|
961 | - $text = self::prep_answer( $OPT->value() ); |
|
962 | - $desc = $OPT->desc() ; |
|
963 | - $opt = '-' . sanitize_key( $value ); |
|
964 | - |
|
965 | - $checked = is_array( $answer ) && in_array( $text, $answer ) ? ' checked="checked"' : ''; |
|
966 | - |
|
967 | - $input_html .= "\n\t\t\t\t" . '<li' . $size . '>'; |
|
968 | - $input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-checkbox-lbl">'; |
|
969 | - $input_html .= $label_b4 ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : ''; |
|
970 | - $input_html .= "\n\t\t\t\t\t\t" . '<input type="checkbox" name="' . $name . '[' . $OPT->ID() . ']" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>'; |
|
971 | - $input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : ''; |
|
972 | - $input_html .= "\n\t\t\t\t\t" . '</label>'; |
|
973 | - if ( ! empty( $desc ) && $desc != $text ) { |
|
974 | - $input_html .= "\n\t\t\t\t\t" . ' <br/><div class="espresso-checkbox-option-desc small-text grey-text">' . $desc . '</div>'; |
|
951 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
952 | + |
|
953 | + $input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-checkbox-options-ul '.$label_class.' '.$class.'-ul">'; |
|
954 | + |
|
955 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
956 | + $class .= ! empty($required['class']) ? ' '.$required['class'] : ''; |
|
957 | + |
|
958 | + foreach ($options as $OPT) { |
|
959 | + $value = $OPT->value(); //self::prep_option_value( $OPT->value() ); |
|
960 | + $size = self::get_label_size_class($OPT->value().' '.$OPT->desc()); |
|
961 | + $text = self::prep_answer($OPT->value()); |
|
962 | + $desc = $OPT->desc(); |
|
963 | + $opt = '-'.sanitize_key($value); |
|
964 | + |
|
965 | + $checked = is_array($answer) && in_array($text, $answer) ? ' checked="checked"' : ''; |
|
966 | + |
|
967 | + $input_html .= "\n\t\t\t\t".'<li'.$size.'>'; |
|
968 | + $input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-checkbox-lbl">'; |
|
969 | + $input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : ''; |
|
970 | + $input_html .= "\n\t\t\t\t\t\t".'<input type="checkbox" name="'.$name.'['.$OPT->ID().']" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>'; |
|
971 | + $input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : ''; |
|
972 | + $input_html .= "\n\t\t\t\t\t".'</label>'; |
|
973 | + if ( ! empty($desc) && $desc != $text) { |
|
974 | + $input_html .= "\n\t\t\t\t\t".' <br/><div class="espresso-checkbox-option-desc small-text grey-text">'.$desc.'</div>'; |
|
975 | 975 | } |
976 | - $input_html .= "\n\t\t\t\t" . '</li>'; |
|
976 | + $input_html .= "\n\t\t\t\t".'</li>'; |
|
977 | 977 | |
978 | 978 | } |
979 | 979 | |
980 | - $input_html .= "\n\t\t\t" . '</ul>'; |
|
980 | + $input_html .= "\n\t\t\t".'</ul>'; |
|
981 | 981 | |
982 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
983 | - return $label_html . $input_html; |
|
982 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
983 | + return $label_html.$input_html; |
|
984 | 984 | |
985 | 985 | } |
986 | 986 | |
@@ -1002,36 +1002,36 @@ discard block |
||
1002 | 1002 | * @param string $disabled disabled="disabled" or null |
1003 | 1003 | * @return string HTML |
1004 | 1004 | */ |
1005 | - static function datepicker( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) { |
|
1005 | + static function datepicker($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) { |
|
1006 | 1006 | // need these |
1007 | - if ( ! $question || ! $name ) { |
|
1007 | + if ( ! $question || ! $name) { |
|
1008 | 1008 | return NULL; |
1009 | 1009 | } |
1010 | 1010 | // prep the answer |
1011 | - $answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities ); |
|
1011 | + $answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities); |
|
1012 | 1012 | // prep the required array |
1013 | - $required = self::prep_required( $required ); |
|
1013 | + $required = self::prep_required($required); |
|
1014 | 1014 | // set disabled tag |
1015 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
1015 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
1016 | 1016 | // ya gots ta have style man!!! |
1017 | 1017 | $txt_class = is_admin() ? 'regular-text' : 'espresso-datepicker-inp'; |
1018 | - $class = empty( $class ) ? $txt_class : $class; |
|
1019 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
1020 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
1018 | + $class = empty($class) ? $txt_class : $class; |
|
1019 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
1020 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
1021 | 1021 | |
1022 | - $label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>'; |
|
1022 | + $label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>'; |
|
1023 | 1023 | // filter label but ensure required text comes before it |
1024 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
1024 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
1025 | 1025 | |
1026 | - $input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . ' datepicker" value="' . $answer . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . ' ' . $extra . '/>'; |
|
1026 | + $input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].' datepicker" value="'.$answer.'" title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>'; |
|
1027 | 1027 | |
1028 | 1028 | // enqueue scripts |
1029 | - wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1030 | - wp_enqueue_style( 'espresso-ui-theme'); |
|
1031 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
1029 | + wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION); |
|
1030 | + wp_enqueue_style('espresso-ui-theme'); |
|
1031 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
1032 | 1032 | |
1033 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
1034 | - return $label_html . $input_html; |
|
1033 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
1034 | + return $label_html.$input_html; |
|
1035 | 1035 | |
1036 | 1036 | } |
1037 | 1037 | |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | * @access public |
1044 | 1044 | * @return string |
1045 | 1045 | */ |
1046 | - public static function remove_label_keep_required_msg( $label_html, $required_text ) { |
|
1046 | + public static function remove_label_keep_required_msg($label_html, $required_text) { |
|
1047 | 1047 | return $required_text; |
1048 | 1048 | } |
1049 | 1049 | |
@@ -1057,9 +1057,9 @@ discard block |
||
1057 | 1057 | * @param string $value |
1058 | 1058 | * @return string HTML |
1059 | 1059 | */ |
1060 | - static function hidden_input( $name, $value, $id = '' ){ |
|
1061 | - $id = ! empty( $id ) ? $id : $name; |
|
1062 | - return '<input id="' . $id . '" type="hidden" name="'.$name.'" value="' . $value . '"/>'; |
|
1060 | + static function hidden_input($name, $value, $id = '') { |
|
1061 | + $id = ! empty($id) ? $id : $name; |
|
1062 | + return '<input id="'.$id.'" type="hidden" name="'.$name.'" value="'.$value.'"/>'; |
|
1063 | 1063 | } |
1064 | 1064 | |
1065 | 1065 | |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | * @param string $question |
1072 | 1072 | * @return string |
1073 | 1073 | */ |
1074 | - static function prep_question( $question ){ |
|
1074 | + static function prep_question($question) { |
|
1075 | 1075 | return $question; |
1076 | 1076 | // $link = ''; |
1077 | 1077 | // // does this label have a help link attached ? |
@@ -1094,13 +1094,13 @@ discard block |
||
1094 | 1094 | * @param mixed $answer |
1095 | 1095 | * @return string |
1096 | 1096 | */ |
1097 | - static function prep_answer( $answer, $use_html_entities = TRUE ){ |
|
1097 | + static function prep_answer($answer, $use_html_entities = TRUE) { |
|
1098 | 1098 | //make sure we convert bools first. Otherwise (bool) false becomes an empty string which is NOT desired, we want "0". |
1099 | - if ( is_bool( $answer ) ) { |
|
1099 | + if (is_bool($answer)) { |
|
1100 | 1100 | $answer = $answer ? 1 : 0; |
1101 | 1101 | } |
1102 | - $answer = trim( stripslashes( str_replace( ''', "'", $answer ))); |
|
1103 | - return $use_html_entities ? htmlentities( $answer, ENT_QUOTES, 'UTF-8' ) : $answer; |
|
1102 | + $answer = trim(stripslashes(str_replace(''', "'", $answer))); |
|
1103 | + return $use_html_entities ? htmlentities($answer, ENT_QUOTES, 'UTF-8') : $answer; |
|
1104 | 1104 | } |
1105 | 1105 | |
1106 | 1106 | |
@@ -1110,18 +1110,18 @@ discard block |
||
1110 | 1110 | * @param array $QSOs array of EE_Question_Option objects |
1111 | 1111 | * @return array |
1112 | 1112 | */ |
1113 | - public static function prep_answer_options( $QSOs = array() ){ |
|
1113 | + public static function prep_answer_options($QSOs = array()) { |
|
1114 | 1114 | $prepped_answer_options = array(); |
1115 | - if ( is_array( $QSOs ) && ! empty( $QSOs )) { |
|
1116 | - foreach( $QSOs as $key => $QSO ) { |
|
1117 | - if ( ! $QSO instanceof EE_Question_Option ) { |
|
1118 | - $QSO = EE_Question_Option::new_instance( array( |
|
1119 | - 'QSO_value' => is_array( $QSO ) && isset( $QSO['id'] ) ? (string)$QSO['id'] : (string)$key, |
|
1120 | - 'QSO_desc' => is_array( $QSO ) && isset( $QSO['text'] ) ? (string)$QSO['text'] : (string)$QSO |
|
1115 | + if (is_array($QSOs) && ! empty($QSOs)) { |
|
1116 | + foreach ($QSOs as $key => $QSO) { |
|
1117 | + if ( ! $QSO instanceof EE_Question_Option) { |
|
1118 | + $QSO = EE_Question_Option::new_instance(array( |
|
1119 | + 'QSO_value' => is_array($QSO) && isset($QSO['id']) ? (string) $QSO['id'] : (string) $key, |
|
1120 | + 'QSO_desc' => is_array($QSO) && isset($QSO['text']) ? (string) $QSO['text'] : (string) $QSO |
|
1121 | 1121 | )); |
1122 | 1122 | } |
1123 | - if ( $QSO->opt_group() ) { |
|
1124 | - $prepped_answer_options[ $QSO->opt_group() ][] = $QSO; |
|
1123 | + if ($QSO->opt_group()) { |
|
1124 | + $prepped_answer_options[$QSO->opt_group()][] = $QSO; |
|
1125 | 1125 | } else { |
1126 | 1126 | $prepped_answer_options[] = $QSO; |
1127 | 1127 | } |
@@ -1137,8 +1137,8 @@ discard block |
||
1137 | 1137 | * @param string $option_value |
1138 | 1138 | * @return string |
1139 | 1139 | */ |
1140 | - static function prep_option_value( $option_value ){ |
|
1141 | - return esc_attr( trim( stripslashes( $option_value ) ) ); |
|
1140 | + static function prep_option_value($option_value) { |
|
1141 | + return esc_attr(trim(stripslashes($option_value))); |
|
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | |
@@ -1149,11 +1149,11 @@ discard block |
||
1149 | 1149 | * @param string|array $required |
1150 | 1150 | * @return array |
1151 | 1151 | */ |
1152 | - static function prep_required( $required = array() ){ |
|
1152 | + static function prep_required($required = array()) { |
|
1153 | 1153 | // make sure required is an array |
1154 | - $required = is_array( $required ) ? $required : array(); |
|
1154 | + $required = is_array($required) ? $required : array(); |
|
1155 | 1155 | // and set some defaults |
1156 | - $required = array_merge( array( 'label' => '', 'class' => '', 'msg' => '' ), $required ); |
|
1156 | + $required = array_merge(array('label' => '', 'class' => '', 'msg' => ''), $required); |
|
1157 | 1157 | return $required; |
1158 | 1158 | } |
1159 | 1159 | |
@@ -1164,30 +1164,30 @@ discard block |
||
1164 | 1164 | * @param string $value |
1165 | 1165 | * @return string |
1166 | 1166 | */ |
1167 | - static function get_label_size_class( $value = FALSE ){ |
|
1168 | - if ( $value === FALSE || $value == '' ) { |
|
1167 | + static function get_label_size_class($value = FALSE) { |
|
1168 | + if ($value === FALSE || $value == '') { |
|
1169 | 1169 | return ' class="medium-lbl"'; |
1170 | 1170 | } |
1171 | 1171 | // determine length of option value |
1172 | - $val_size = strlen( $value ); |
|
1173 | - switch( $val_size ){ |
|
1172 | + $val_size = strlen($value); |
|
1173 | + switch ($val_size) { |
|
1174 | 1174 | case $val_size < 3 : |
1175 | - $size = ' class="nano-lbl"'; |
|
1175 | + $size = ' class="nano-lbl"'; |
|
1176 | 1176 | break; |
1177 | 1177 | case $val_size < 6 : |
1178 | - $size = ' class="micro-lbl"'; |
|
1178 | + $size = ' class="micro-lbl"'; |
|
1179 | 1179 | break; |
1180 | 1180 | case $val_size < 12 : |
1181 | - $size = ' class="tiny-lbl"'; |
|
1181 | + $size = ' class="tiny-lbl"'; |
|
1182 | 1182 | break; |
1183 | 1183 | case $val_size < 25 : |
1184 | - $size = ' class="small-lbl"'; |
|
1184 | + $size = ' class="small-lbl"'; |
|
1185 | 1185 | break; |
1186 | 1186 | case $val_size > 100 : |
1187 | - $size = ' class="big-lbl"'; |
|
1187 | + $size = ' class="big-lbl"'; |
|
1188 | 1188 | break; |
1189 | 1189 | default: |
1190 | - $size = ' class="medium-lbl"'; |
|
1190 | + $size = ' class="medium-lbl"'; |
|
1191 | 1191 | break; |
1192 | 1192 | } |
1193 | 1193 | return $size; |
@@ -1201,20 +1201,20 @@ discard block |
||
1201 | 1201 | * @param array $QFI |
1202 | 1202 | * @return array |
1203 | 1203 | */ |
1204 | - private static function _load_system_dropdowns( $QFI ){ |
|
1204 | + private static function _load_system_dropdowns($QFI) { |
|
1205 | 1205 | $QST_system = $QFI->get('QST_system'); |
1206 | - switch ( $QST_system ) { |
|
1206 | + switch ($QST_system) { |
|
1207 | 1207 | case 'state' : |
1208 | - $QFI = self::generate_state_dropdown( $QFI ); |
|
1208 | + $QFI = self::generate_state_dropdown($QFI); |
|
1209 | 1209 | break; |
1210 | 1210 | case 'country' : |
1211 | - $QFI = self::generate_country_dropdown( $QFI ); |
|
1211 | + $QFI = self::generate_country_dropdown($QFI); |
|
1212 | 1212 | break; |
1213 | 1213 | case 'admin-state' : |
1214 | - $QFI = self::generate_state_dropdown( $QFI, TRUE ); |
|
1214 | + $QFI = self::generate_state_dropdown($QFI, TRUE); |
|
1215 | 1215 | break; |
1216 | 1216 | case 'admin-country' : |
1217 | - $QFI = self::generate_country_dropdown( $QFI, TRUE ); |
|
1217 | + $QFI = self::generate_country_dropdown($QFI, TRUE); |
|
1218 | 1218 | break; |
1219 | 1219 | } |
1220 | 1220 | return $QFI; |
@@ -1231,13 +1231,13 @@ discard block |
||
1231 | 1231 | * |
1232 | 1232 | * @return EE_Question_Form_Input |
1233 | 1233 | */ |
1234 | - protected static function _load_specialized_dropdowns( $QFI ) { |
|
1235 | - switch( $QFI->get( 'QST_type' ) ) { |
|
1234 | + protected static function _load_specialized_dropdowns($QFI) { |
|
1235 | + switch ($QFI->get('QST_type')) { |
|
1236 | 1236 | case 'STATE' : |
1237 | - $QFI = self::generate_state_dropdown( $QFI ); |
|
1237 | + $QFI = self::generate_state_dropdown($QFI); |
|
1238 | 1238 | break; |
1239 | 1239 | case 'COUNTRY' : |
1240 | - $QFI = self::generate_country_dropdown( $QFI ); |
|
1240 | + $QFI = self::generate_country_dropdown($QFI); |
|
1241 | 1241 | break; |
1242 | 1242 | } |
1243 | 1243 | return $QFI; |
@@ -1251,23 +1251,23 @@ discard block |
||
1251 | 1251 | * @param bool $get_all |
1252 | 1252 | * @return array |
1253 | 1253 | */ |
1254 | - public static function generate_state_dropdown( $QST, $get_all = FALSE ){ |
|
1254 | + public static function generate_state_dropdown($QST, $get_all = FALSE) { |
|
1255 | 1255 | $states = $get_all ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_states_of_active_countries(); |
1256 | - if ( $states && count( $states ) != count( $QST->options() )) { |
|
1257 | - $QST->set( 'QST_type', 'DROPDOWN' ); |
|
1256 | + if ($states && count($states) != count($QST->options())) { |
|
1257 | + $QST->set('QST_type', 'DROPDOWN'); |
|
1258 | 1258 | // if multiple countries, we'll create option groups within the dropdown |
1259 | - foreach ( $states as $state ) { |
|
1260 | - if ( $state instanceof EE_State ) { |
|
1261 | - $QSO = EE_Question_Option::new_instance ( array ( |
|
1259 | + foreach ($states as $state) { |
|
1260 | + if ($state instanceof EE_State) { |
|
1261 | + $QSO = EE_Question_Option::new_instance(array( |
|
1262 | 1262 | 'QSO_value' => $state->ID(), |
1263 | 1263 | 'QSO_desc' => $state->name(), |
1264 | - 'QST_ID' => $QST->get( 'QST_ID' ), |
|
1264 | + 'QST_ID' => $QST->get('QST_ID'), |
|
1265 | 1265 | 'QSO_deleted' => FALSE |
1266 | 1266 | )); |
1267 | 1267 | // set option group |
1268 | - $QSO->set_opt_group( $state->country()->name() ); |
|
1268 | + $QSO->set_opt_group($state->country()->name()); |
|
1269 | 1269 | // add option to question |
1270 | - $QST->add_temp_option( $QSO ); |
|
1270 | + $QST->add_temp_option($QSO); |
|
1271 | 1271 | } |
1272 | 1272 | } |
1273 | 1273 | } |
@@ -1283,20 +1283,20 @@ discard block |
||
1283 | 1283 | * @internal param array $question |
1284 | 1284 | * @return array |
1285 | 1285 | */ |
1286 | - public static function generate_country_dropdown( $QST, $get_all = FALSE ){ |
|
1286 | + public static function generate_country_dropdown($QST, $get_all = FALSE) { |
|
1287 | 1287 | $countries = $get_all ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries(); |
1288 | - if ( $countries && count( $countries ) != count( $QST->options() ) ) { |
|
1289 | - $QST->set( 'QST_type', 'DROPDOWN' ); |
|
1288 | + if ($countries && count($countries) != count($QST->options())) { |
|
1289 | + $QST->set('QST_type', 'DROPDOWN'); |
|
1290 | 1290 | // now add countries |
1291 | - foreach ( $countries as $country ) { |
|
1292 | - if ( $country instanceof EE_Country ) { |
|
1293 | - $QSO = EE_Question_Option::new_instance ( array ( |
|
1291 | + foreach ($countries as $country) { |
|
1292 | + if ($country instanceof EE_Country) { |
|
1293 | + $QSO = EE_Question_Option::new_instance(array( |
|
1294 | 1294 | 'QSO_value' => $country->ID(), |
1295 | 1295 | 'QSO_desc' => $country->name(), |
1296 | - 'QST_ID' => $QST->get( 'QST_ID' ), |
|
1296 | + 'QST_ID' => $QST->get('QST_ID'), |
|
1297 | 1297 | 'QSO_deleted' => FALSE |
1298 | 1298 | )); |
1299 | - $QST->add_temp_option( $QSO ); |
|
1299 | + $QST->add_temp_option($QSO); |
|
1300 | 1300 | } |
1301 | 1301 | } |
1302 | 1302 | } |
@@ -1313,11 +1313,11 @@ discard block |
||
1313 | 1313 | */ |
1314 | 1314 | public static function two_digit_months_dropdown_options() { |
1315 | 1315 | $options = array(); |
1316 | - for ( $x = 1; $x <= 12; $x++ ) { |
|
1317 | - $mm = str_pad( $x, 2, '0', STR_PAD_LEFT ); |
|
1318 | - $options[ (string)$mm ] = (string)$mm; |
|
1316 | + for ($x = 1; $x <= 12; $x++) { |
|
1317 | + $mm = str_pad($x, 2, '0', STR_PAD_LEFT); |
|
1318 | + $options[(string) $mm] = (string) $mm; |
|
1319 | 1319 | } |
1320 | - return EEH_Form_Fields::prep_answer_options( $options ); |
|
1320 | + return EEH_Form_Fields::prep_answer_options($options); |
|
1321 | 1321 | } |
1322 | 1322 | |
1323 | 1323 | |
@@ -1332,11 +1332,11 @@ discard block |
||
1332 | 1332 | $options = array(); |
1333 | 1333 | $current_year = date('y'); |
1334 | 1334 | $next_decade = $current_year + 10; |
1335 | - for ( $x = $current_year; $x <= $next_decade; $x++ ) { |
|
1336 | - $yy = str_pad( $x, 2, '0', STR_PAD_LEFT ); |
|
1337 | - $options[ (string)$yy ] = (string)$yy; |
|
1335 | + for ($x = $current_year; $x <= $next_decade; $x++) { |
|
1336 | + $yy = str_pad($x, 2, '0', STR_PAD_LEFT); |
|
1337 | + $options[(string) $yy] = (string) $yy; |
|
1338 | 1338 | } |
1339 | - return EEH_Form_Fields::prep_answer_options( $options ); |
|
1339 | + return EEH_Form_Fields::prep_answer_options($options); |
|
1340 | 1340 | } |
1341 | 1341 | |
1342 | 1342 | |
@@ -1350,17 +1350,17 @@ discard block |
||
1350 | 1350 | * @param integer $evt_category Event Category ID if the Event Category filter is selected |
1351 | 1351 | * @return string html |
1352 | 1352 | */ |
1353 | - public static function generate_registration_months_dropdown( $cur_date = '', $status = '', $evt_category = 0 ) { |
|
1353 | + public static function generate_registration_months_dropdown($cur_date = '', $status = '', $evt_category = 0) { |
|
1354 | 1354 | $_where = array(); |
1355 | - if ( !empty( $status ) ) { |
|
1355 | + if ( ! empty($status)) { |
|
1356 | 1356 | $_where['STS_ID'] = $status; |
1357 | 1357 | } |
1358 | 1358 | |
1359 | - if ( $evt_category > 0 ) { |
|
1359 | + if ($evt_category > 0) { |
|
1360 | 1360 | $_where['Event.Term_Taxonomy.term_id'] = $evt_category; |
1361 | 1361 | } |
1362 | 1362 | |
1363 | - $regdtts = EEM_Registration::instance()->get_reg_months_and_years( $_where ); |
|
1363 | + $regdtts = EEM_Registration::instance()->get_reg_months_and_years($_where); |
|
1364 | 1364 | |
1365 | 1365 | //setup vals for select input helper |
1366 | 1366 | $options = array( |
@@ -1370,15 +1370,15 @@ discard block |
||
1370 | 1370 | ) |
1371 | 1371 | ); |
1372 | 1372 | |
1373 | - foreach ( $regdtts as $regdtt ) { |
|
1374 | - $date = $regdtt->reg_month. ' ' . $regdtt->reg_year; |
|
1373 | + foreach ($regdtts as $regdtt) { |
|
1374 | + $date = $regdtt->reg_month.' '.$regdtt->reg_year; |
|
1375 | 1375 | $options[] = array( |
1376 | 1376 | 'text' => $date, |
1377 | 1377 | 'id' => $date |
1378 | 1378 | ); |
1379 | 1379 | } |
1380 | 1380 | |
1381 | - return self::select_input('month_range', $options, $cur_date, '', 'wide' ); |
|
1381 | + return self::select_input('month_range', $options, $cur_date, '', 'wide'); |
|
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | |
@@ -1392,18 +1392,18 @@ discard block |
||
1392 | 1392 | * @param string $evt_active_status "upcoming", "expired", "active", or "inactive" |
1393 | 1393 | * @return string html |
1394 | 1394 | */ |
1395 | - public static function generate_event_months_dropdown( $cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL ) { |
|
1395 | + public static function generate_event_months_dropdown($cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL) { |
|
1396 | 1396 | //determine what post_status our condition will have for the query. |
1397 | - switch ( $status ) { |
|
1397 | + switch ($status) { |
|
1398 | 1398 | case 'month' : |
1399 | 1399 | case 'today' : |
1400 | 1400 | case NULL : |
1401 | 1401 | case 'all' : |
1402 | - $where['Event.status'] = array( 'NOT IN', array('trash') ); |
|
1402 | + $where['Event.status'] = array('NOT IN', array('trash')); |
|
1403 | 1403 | break; |
1404 | 1404 | |
1405 | 1405 | case 'draft' : |
1406 | - $where['Event.status'] = array( 'IN', array('draft', 'auto-draft') ); |
|
1406 | + $where['Event.status'] = array('IN', array('draft', 'auto-draft')); |
|
1407 | 1407 | |
1408 | 1408 | default : |
1409 | 1409 | $where['Event.status'] = $status; |
@@ -1412,7 +1412,7 @@ discard block |
||
1412 | 1412 | //categories? |
1413 | 1413 | |
1414 | 1414 | |
1415 | - if ( !empty ( $evt_category ) ) { |
|
1415 | + if ( ! empty ($evt_category)) { |
|
1416 | 1416 | $where['Event.Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
1417 | 1417 | $where['Event.Term_Taxonomy.term_id'] = $evt_category; |
1418 | 1418 | } |
@@ -1420,7 +1420,7 @@ discard block |
||
1420 | 1420 | |
1421 | 1421 | // $where['DTT_is_primary'] = 1; |
1422 | 1422 | |
1423 | - $DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status ); |
|
1423 | + $DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status); |
|
1424 | 1424 | |
1425 | 1425 | //let's setup vals for select input helper |
1426 | 1426 | $options = array( |
@@ -1435,9 +1435,9 @@ discard block |
||
1435 | 1435 | //translate month and date |
1436 | 1436 | global $wp_locale; |
1437 | 1437 | |
1438 | - foreach ( $DTTS as $DTT ) { |
|
1439 | - $localized_date = $wp_locale->get_month( $DTT->dtt_month_num ) . ' ' . $DTT->dtt_year; |
|
1440 | - $id = $DTT->dtt_month . ' ' . $DTT->dtt_year; |
|
1438 | + foreach ($DTTS as $DTT) { |
|
1439 | + $localized_date = $wp_locale->get_month($DTT->dtt_month_num).' '.$DTT->dtt_year; |
|
1440 | + $id = $DTT->dtt_month.' '.$DTT->dtt_year; |
|
1441 | 1441 | $options[] = array( |
1442 | 1442 | 'text' => $localized_date, |
1443 | 1443 | 'id' => $id |
@@ -1445,7 +1445,7 @@ discard block |
||
1445 | 1445 | } |
1446 | 1446 | |
1447 | 1447 | |
1448 | - return self::select_input( 'month_range', $options, $cur_date, '', 'wide' ); |
|
1448 | + return self::select_input('month_range', $options, $cur_date, '', 'wide'); |
|
1449 | 1449 | } |
1450 | 1450 | |
1451 | 1451 | |
@@ -1456,7 +1456,7 @@ discard block |
||
1456 | 1456 | * @param integer $current_cat currently selected category |
1457 | 1457 | * @return string html for dropdown |
1458 | 1458 | */ |
1459 | - public static function generate_event_category_dropdown( $current_cat = -1 ) { |
|
1459 | + public static function generate_event_category_dropdown($current_cat = -1) { |
|
1460 | 1460 | $categories = EEM_Term::instance()->get_all_ee_categories(TRUE); |
1461 | 1461 | $options = array( |
1462 | 1462 | '0' => array( |
@@ -1466,14 +1466,14 @@ discard block |
||
1466 | 1466 | ); |
1467 | 1467 | |
1468 | 1468 | //setup categories for dropdown |
1469 | - foreach ( $categories as $category ) { |
|
1469 | + foreach ($categories as $category) { |
|
1470 | 1470 | $options[] = array( |
1471 | 1471 | 'text' => $category->get('name'), |
1472 | 1472 | 'id' => $category->ID() |
1473 | 1473 | ); |
1474 | 1474 | } |
1475 | 1475 | |
1476 | - return self::select_input( 'EVT_CAT', $options, $current_cat ); |
|
1476 | + return self::select_input('EVT_CAT', $options, $current_cat); |
|
1477 | 1477 | } |
1478 | 1478 | |
1479 | 1479 | |
@@ -1492,20 +1492,20 @@ discard block |
||
1492 | 1492 | * @param string $extra_attributes - any extra attributes that need to be attached to the form input |
1493 | 1493 | * @return void |
1494 | 1494 | */ |
1495 | - public static function submit_button( $url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '' ) { |
|
1495 | + public static function submit_button($url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '') { |
|
1496 | 1496 | $btn = ''; |
1497 | - if ( empty( $url ) || empty( $ID )) { |
|
1497 | + if (empty($url) || empty($ID)) { |
|
1498 | 1498 | return $btn; |
1499 | 1499 | } |
1500 | - $text = ! empty( $text ) ? $text : __('Submit', 'event_espresso' ); |
|
1501 | - $btn .= '<input id="' . $ID . '-btn" class="' . $class . '" type="submit" value="' . $text . '" ' . $extra_attributes . '/>'; |
|
1502 | - if ( ! $input_only ) { |
|
1503 | - $btn_frm = '<form id="' . $ID . '-frm" method="POST" action="' . $url . '">'; |
|
1504 | - $btn_frm .= ! empty( $nonce_action ) ? wp_nonce_field( $nonce_action, $nonce_action . '_nonce', TRUE, FALSE ) : ''; |
|
1500 | + $text = ! empty($text) ? $text : __('Submit', 'event_espresso'); |
|
1501 | + $btn .= '<input id="'.$ID.'-btn" class="'.$class.'" type="submit" value="'.$text.'" '.$extra_attributes.'/>'; |
|
1502 | + if ( ! $input_only) { |
|
1503 | + $btn_frm = '<form id="'.$ID.'-frm" method="POST" action="'.$url.'">'; |
|
1504 | + $btn_frm .= ! empty($nonce_action) ? wp_nonce_field($nonce_action, $nonce_action.'_nonce', TRUE, FALSE) : ''; |
|
1505 | 1505 | $btn_frm .= $btn; |
1506 | 1506 | $btn_frm .= '</form>'; |
1507 | 1507 | $btn = $btn_frm; |
1508 | - unset ( $btn_frm ); |
|
1508 | + unset ($btn_frm); |
|
1509 | 1509 | } |
1510 | 1510 | return $btn; |
1511 | 1511 | } |
@@ -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 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @param mixed $info |
26 | 26 | * @return bool |
27 | 27 | */ |
28 | - public function add( $object, $info = null ); |
|
28 | + public function add($object, $info = null); |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param mixed $info |
40 | 40 | * @return bool |
41 | 41 | */ |
42 | - public function set_info( $object, $info = null ); |
|
42 | + public function set_info($object, $info = null); |
|
43 | 43 | |
44 | 44 | |
45 | 45 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param mixed |
53 | 53 | * @return null | object |
54 | 54 | */ |
55 | - public function get_by_info( $info ); |
|
55 | + public function get_by_info($info); |
|
56 | 56 | |
57 | 57 | |
58 | 58 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param object $object |
66 | 66 | * @return bool |
67 | 67 | */ |
68 | - public function has( $object ); |
|
68 | + public function has($object); |
|
69 | 69 | |
70 | 70 | |
71 | 71 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param $object |
79 | 79 | * @return void |
80 | 80 | */ |
81 | - public function remove( $object ); |
|
81 | + public function remove($object); |
|
82 | 82 | |
83 | 83 | |
84 | 84 |
@@ -1,6 +1,6 @@ |
||
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 | /** |
@@ -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 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @return bool | int |
31 | 31 | * @throws \EE_Error |
32 | 32 | */ |
33 | - public function persist( $persistence_callback = '', $persistence_arguments = array() ); |
|
33 | + public function persist($persistence_callback = '', $persistence_arguments = array()); |
|
34 | 34 | |
35 | 35 | |
36 | 36 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param string $persistence_callback name of method found on object that can be used for persisting it |
44 | 44 | * @return bool | int |
45 | 45 | */ |
46 | - public function persist_all( $persistence_callback = '' ); |
|
46 | + public function persist_all($persistence_callback = ''); |
|
47 | 47 | |
48 | 48 | } |
49 | 49 | // End of file EEI_Repository.interface.php |
@@ -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 | * Class EEI_Line_Item |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @param mixed $field_value |
19 | 19 | * @param bool $use_default |
20 | 20 | */ |
21 | - public function set( $field_name, $field_value, $use_default = false ); |
|
21 | + public function set($field_name, $field_value, $use_default = false); |
|
22 | 22 | |
23 | 23 | |
24 | 24 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * Sets quantity |
57 | 57 | * @param int $quantity |
58 | 58 | */ |
59 | - function set_quantity( $quantity ); |
|
59 | + function set_quantity($quantity); |
|
60 | 60 | |
61 | 61 | |
62 | 62 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @param int $txn_id if none is provided, assumes $this->TXN_ID() |
116 | 116 | * @return int count of items saved |
117 | 117 | */ |
118 | - function save_this_and_descendants_to_txn( $txn_id = null ); |
|
118 | + function save_this_and_descendants_to_txn($txn_id = null); |
|
119 | 119 | |
120 | 120 | |
121 | 121 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param bool $set_order |
143 | 143 | * @return bool true for success, false for fail |
144 | 144 | */ |
145 | - function add_child_line_item( EEI_Line_Item $line_item, $set_order = true ); |
|
145 | + function add_child_line_item(EEI_Line_Item $line_item, $set_order = true); |
|
146 | 146 | |
147 | 147 | |
148 | 148 | |
@@ -197,14 +197,14 @@ discard block |
||
197 | 197 | * @param float $total |
198 | 198 | * @return boolean |
199 | 199 | */ |
200 | - function set_total( $total ); |
|
200 | + function set_total($total); |
|
201 | 201 | |
202 | 202 | /** |
203 | 203 | * Sets unit_price |
204 | 204 | * @param float $unit_price |
205 | 205 | * @return boolean |
206 | 206 | */ |
207 | - function set_unit_price( $unit_price ); |
|
207 | + function set_unit_price($unit_price); |
|
208 | 208 | |
209 | 209 | /** |
210 | 210 | * If this line item has been saved to the DB, deletes its child with LIN_code == $code. If this line |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * @param bool $stop_search_once_found |
216 | 216 | * @return int count of items deleted (or simply removed from the line item's cache, if not has not been saved to the DB yet) |
217 | 217 | */ |
218 | - function delete_child_line_item( $code, $stop_search_once_found = true ); |
|
218 | + function delete_child_line_item($code, $stop_search_once_found = true); |
|
219 | 219 | |
220 | 220 | /** |
221 | 221 | * Forgets the cached model of the given relation Name. So the next time we request it, |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * @param boolean $allow_persist |
239 | 239 | * @return boolean |
240 | 240 | */ |
241 | - function set_allow_persist( $allow_persist ); |
|
241 | + function set_allow_persist($allow_persist); |
|
242 | 242 | |
243 | 243 | |
244 | 244 | } |
@@ -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 | /** |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param \EEI_Line_Item $line_item |
27 | 27 | * @return \EEI_Line_Item |
28 | 28 | */ |
29 | - public function process( EEI_Line_Item $line_item ); |
|
29 | + public function process(EEI_Line_Item $line_item); |
|
30 | 30 | |
31 | 31 | |
32 | 32 |
@@ -1,20 +1,20 @@ discard block |
||
1 | 1 | <?php |
2 | -class EE_Sample_Form extends EE_Form_Section_Proper{ |
|
3 | - function __construct(){ |
|
2 | +class EE_Sample_Form extends EE_Form_Section_Proper { |
|
3 | + function __construct() { |
|
4 | 4 | $this->_subsections = array( |
5 | 5 | 'h1'=>new EE_Form_Section_HTML('hello wordl'), |
6 | - 'name'=>new EE_Text_Input(array('required'=>true,'default'=>'your name here')), |
|
6 | + 'name'=>new EE_Text_Input(array('required'=>true, 'default'=>'your name here')), |
|
7 | 7 | 'email'=>new EE_Email_Input(array('required'=>false)), |
8 | - 'shirt_size'=>new EE_Select_Input(array(''=>'Please select...', 's'=> __("Small", "event_espresso"),'m'=> __("Medium", "event_espresso"),'l'=> __("Large", "event_espresso")),array('required'=>true,'default'=>'s')), |
|
8 | + 'shirt_size'=>new EE_Select_Input(array(''=>'Please select...', 's'=> __("Small", "event_espresso"), 'm'=> __("Medium", "event_espresso"), 'l'=> __("Large", "event_espresso")), array('required'=>true, 'default'=>'s')), |
|
9 | 9 | 'month_normal'=>new EE_Month_Input(), |
10 | 10 | 'month_leading_zero'=>new EE_Month_Input(true), |
11 | 11 | 'year_2'=>new EE_Year_Input(false, 1, 1), |
12 | - 'year_4'=>new EE_Year_Input(true, 0,10,array('default'=>'2017')), |
|
12 | + 'year_4'=>new EE_Year_Input(true, 0, 10, array('default'=>'2017')), |
|
13 | 13 | 'yes_no'=>new EE_Yes_No_Input(array('html_label_text'=> __("Yes or No", "event_espresso"))), |
14 | 14 | 'credit_card'=>new EE_Credit_Card_Input(), |
15 | 15 | 'image_1'=>new EE_Admin_File_Uploader_Input(), |
16 | 16 | 'image_2'=>new EE_Admin_File_Uploader_Input(), |
17 | - 'skillz'=>new EE_Checkbox_Multi_Input(array('php'=>'PHP','mysql'=>'MYSQL'),array('default'=>array('php'))), |
|
17 | + 'skillz'=>new EE_Checkbox_Multi_Input(array('php'=>'PHP', 'mysql'=>'MYSQL'), array('default'=>array('php'))), |
|
18 | 18 | 'float'=>new EE_Float_Input(), |
19 | 19 | 'essay'=>new EE_Text_Area_Input(), |
20 | 20 | 'amenities'=>new EE_Select_Multiple_Input( |
@@ -40,16 +40,16 @@ discard block |
||
40 | 40 | * Extra validation for the 'name' input. |
41 | 41 | * @param EE_Text_Input $form_input |
42 | 42 | */ |
43 | - function _validate_name($form_input){ |
|
44 | - if($form_input->raw_value() != 'Mike'){ |
|
43 | + function _validate_name($form_input) { |
|
44 | + if ($form_input->raw_value() != 'Mike') { |
|
45 | 45 | $form_input->add_validation_error(__("You are not mike. You must be brent or darren. Thats ok, I guess", 'event_espresso'), 'not-mike'); |
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | - function _validate(){ |
|
49 | + function _validate() { |
|
50 | 50 | parent::_validate(); |
51 | - if($this->_subsections['shirt_size']->normalized_value() =='s' |
|
52 | - && $this->_subsections['year_4']->normalized_value() < 2010){ |
|
51 | + if ($this->_subsections['shirt_size']->normalized_value() == 's' |
|
52 | + && $this->_subsections['year_4']->normalized_value() < 2010) { |
|
53 | 53 | $this->add_validation_error(__("If you want a small shirt, you should be born after 2010. Otherwise theyre just too big", 'event_espresso'), 'too-old'); |
54 | 54 | } |
55 | 55 | } |
@@ -2,16 +2,16 @@ |
||
2 | 2 | if (!defined('EVENT_ESPRESSO_VERSION')) |
3 | 3 | exit('No direct script access allowed'); |
4 | 4 | /** |
5 | - * EE_Form_Section_HTML |
|
6 | - * HTML to be laid out like a proper subsection |
|
7 | - * |
|
8 | - * |
|
9 | - * @package Event Espresso |
|
10 | - * @subpackage |
|
11 | - * @author Mike Nelson |
|
12 | - * |
|
13 | - * ------------------------------------------------------------------------ |
|
14 | - */ |
|
5 | + * EE_Form_Section_HTML |
|
6 | + * HTML to be laid out like a proper subsection |
|
7 | + * |
|
8 | + * |
|
9 | + * @package Event Espresso |
|
10 | + * @subpackage |
|
11 | + * @author Mike Nelson |
|
12 | + * |
|
13 | + * ------------------------------------------------------------------------ |
|
14 | + */ |
|
15 | 15 | class EE_Form_Section_HTML extends EE_Form_Section_Base{ |
16 | 16 | |
17 | 17 | protected $_html = ''; |
@@ -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 | * EE_Form_Section_HTML |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * |
13 | 13 | * ------------------------------------------------------------------------ |
14 | 14 | */ |
15 | -class EE_Form_Section_HTML extends EE_Form_Section_Base{ |
|
15 | +class EE_Form_Section_HTML extends EE_Form_Section_Base { |
|
16 | 16 | |
17 | 17 | protected $_html = ''; |
18 | 18 | |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | * @param string $html |
23 | 23 | * @param array $options_array |
24 | 24 | */ |
25 | - public function __construct( $html = '', $options_array = array() ) { |
|
25 | + public function __construct($html = '', $options_array = array()) { |
|
26 | 26 | $this->_html = $html; |
27 | - parent::__construct( $options_array ); |
|
27 | + parent::__construct($options_array); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 |
@@ -1,6 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('No direct script access allowed'); |
4 | +} |
|
4 | 5 | /** |
5 | 6 | * EE_Form_Section_HTML |
6 | 7 | * HTML to be laid out like a proper subsection |