Completed
Branch BETA-4.9-messages-queue-fixed (941081)
by
unknown
30:24 queued 05:56
created
core/helpers/EEH_Array.helper.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('NO direct script access allowed'); }
3 3
 
4
-require_once( EE_HELPERS . 'EEH_Base.helper.php' );
4
+require_once(EE_HELPERS.'EEH_Base.helper.php');
5 5
 
6 6
 /**
7 7
  * EE_Array
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	 * @param  array $array2 an array of objects
27 27
 	 * @return array         an array of objects found in array 1 that aren't found in array 2.
28 28
 	 */
29
-	public static function object_array_diff( $array1, $array2 ) {
30
-		return array_udiff( $array1, $array2, array('self', '_compare_objects' ));
29
+	public static function object_array_diff($array1, $array2) {
30
+		return array_udiff($array1, $array2, array('self', '_compare_objects'));
31 31
 	}
32 32
 
33 33
 	/**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @param array $arr
36 36
 	 * @return boolean
37 37
 	 */
38
-	public static function is_associative_array($arr){
38
+	public static function is_associative_array($arr) {
39 39
 		return  array_keys($arr) !== range(0, count($arr) - 1);
40 40
 	}
41 41
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * @param array $arr
46 46
 	 * @return mixed what ever is in the array
47 47
 	 */
48
-	public static function get_one_item_from_array($arr){
48
+	public static function get_one_item_from_array($arr) {
49 49
 		$item = end($arr);
50 50
 		reset($arr);
51 51
 		return $item;
@@ -56,16 +56,16 @@  discard block
 block discarded – undo
56 56
 	 * @param mixed $arr
57 57
 	 * @return boolean
58 58
 	 */
59
-	public static function is_multi_dimensional_array($arr){
60
-		if(is_array($arr)){
59
+	public static function is_multi_dimensional_array($arr) {
60
+		if (is_array($arr)) {
61 61
 			$first_item = reset($arr);
62
-			if(is_array($first_item)){
63
-				return true;//yep, there's at least 2 levels to this array
64
-			}else{
65
-				return false;//nope, only 1 level
62
+			if (is_array($first_item)) {
63
+				return true; //yep, there's at least 2 levels to this array
64
+			} else {
65
+				return false; //nope, only 1 level
66 66
 			}
67
-		}else{
68
-			return false;//its not an array at all!
67
+		} else {
68
+			return false; //its not an array at all!
69 69
 		}
70 70
 	}
71 71
 
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 	 * @param mixed $default
77 77
 	 * @return mixed
78 78
 	 */
79
-	public static function is_set( $arr, $index, $default ) {
80
-		return isset( $arr[ $index ] ) ? $arr[ $index ] : $default;
79
+	public static function is_set($arr, $index, $default) {
80
+		return isset($arr[$index]) ? $arr[$index] : $default;
81 81
 	}
82 82
 
83 83
 	/**
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 	 * @param mixed $value usually a string, but could be an array or object
86 86
 	 * @return mixed the UNserialized data
87 87
 	 */
88
-	public static function maybe_unserialize( $value ) {
88
+	public static function maybe_unserialize($value) {
89 89
 		$data = maybe_unserialize($value);
90 90
 		//it's possible that this still has serialized data if its the session.  WP has a bug, http://core.trac.wordpress.org/ticket/26118 that doesnt' unserialize this automatically.
91 91
 		$token = 'C';
92 92
 		$data = is_string($data) ? trim($data) : $data;
93
-		if ( is_string($data) && strlen($data) > 1 && $data[0] == $token  && preg_match( "/^{$token}:[0-9]+:/s", $data ) ) {
93
+		if (is_string($data) && strlen($data) > 1 && $data[0] == $token && preg_match("/^{$token}:[0-9]+:/s", $data)) {
94 94
 			return unserialize($data);
95 95
 		} else {
96 96
 			return $data;
@@ -109,30 +109,30 @@  discard block
 block discarded – undo
109 109
 	 * @param bool $preserve_keys 		whether or not to reset numerically indexed arrays
110 110
 	 * @return array
111 111
 	 */
112
-	public static function insert_into_array( $target_array = array(), $array_to_insert = array(), $offset = null, $add_before = true, $preserve_keys = true ) {
112
+	public static function insert_into_array($target_array = array(), $array_to_insert = array(), $offset = null, $add_before = true, $preserve_keys = true) {
113 113
 		// ensure incoming arrays are actually arrays
114
-		$target_array 		= (array)$target_array;
115
-		$array_to_insert	= (array)$array_to_insert;
114
+		$target_array = (array) $target_array;
115
+		$array_to_insert = (array) $array_to_insert;
116 116
 		// if no offset key was supplied
117
-		if ( empty( $offset )) {
117
+		if (empty($offset)) {
118 118
 			// use start or end of $target_array based on whether we are adding before or not
119
-			$offset = $add_before ? 0 : count( $target_array );
119
+			$offset = $add_before ? 0 : count($target_array);
120 120
 		}
121 121
 		// if offset key is a string, then find the corresponding numeric location for that element
122
-		$offset = is_int( $offset ) ? $offset : array_search( $offset, array_keys( $target_array ) );
122
+		$offset = is_int($offset) ? $offset : array_search($offset, array_keys($target_array));
123 123
 		// add one to the offset if adding after
124 124
 		$offset = $add_before ? $offset : $offset + 1;
125 125
 		// but ensure offset does not exceed the length of the array
126
-		$offset = $offset > count( $target_array ) ? count( $target_array ) : $offset;
126
+		$offset = $offset > count($target_array) ? count($target_array) : $offset;
127 127
 		// reindex array ???
128
-		if ( $preserve_keys ) {
128
+		if ($preserve_keys) {
129 129
 			// take a slice of the target array from the beginning till the offset,
130 130
 			// then add the new data
131 131
 			// then add another slice that starts at the offset and goes till the end
132
-			return array_slice( $target_array, 0, $offset, true ) + $array_to_insert + array_slice( $target_array, $offset, null, true );
132
+			return array_slice($target_array, 0, $offset, true) + $array_to_insert + array_slice($target_array, $offset, null, true);
133 133
 		} else {
134 134
 			// since we don't want to preserve keys, we can use array_splice
135
-			array_splice( $target_array, $offset, 0, $array_to_insert );
135
+			array_splice($target_array, $offset, 0, $array_to_insert);
136 136
 			return $target_array;
137 137
 		}
138 138
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Event_Query.helper.php 1 patch
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public static function add_query_filters() {
87 87
 		//add query filters
88
-		add_action( 'pre_get_posts', array( 'EEH_Event_Query', 'filter_query_parts' ), 10, 1 );
88
+		add_action('pre_get_posts', array('EEH_Event_Query', 'filter_query_parts'), 10, 1);
89 89
 	}
90 90
 
91 91
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	 * @param \WP_Query $WP_Query
98 98
 	 * @return bool
99 99
 	 */
100
-	public static function apply_query_filters( WP_Query $WP_Query ) {
101
-		return ( isset( $WP_Query->query, $WP_Query->query['post_type'] ) && $WP_Query->query['post_type'] == 'espresso_events' ) ||  apply_filters( 'FHEE__EEH_Event_Query__apply_query_filters', false ) ? true : false;
100
+	public static function apply_query_filters(WP_Query $WP_Query) {
101
+		return (isset($WP_Query->query, $WP_Query->query['post_type']) && $WP_Query->query['post_type'] == 'espresso_events') || apply_filters('FHEE__EEH_Event_Query__apply_query_filters', false) ? true : false;
102 102
 	}
103 103
 
104 104
 
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
 	 * @access    public
109 109
 	 * @param \WP_Query $WP_Query
110 110
 	 */
111
-	public static function filter_query_parts( WP_Query $WP_Query ) {
111
+	public static function filter_query_parts(WP_Query $WP_Query) {
112 112
 		//ONLY add our filters if this isn't the main wp_query, because if this is the main wp_query we already have our cpt strategies take care of adding things in.
113
-		if ( $WP_Query instanceof WP_Query && ! $WP_Query->is_main_query() ) {
113
+		if ($WP_Query instanceof WP_Query && ! $WP_Query->is_main_query()) {
114 114
 			// build event list query
115
-			add_filter( 'posts_fields', array( 'EEH_Event_Query', 'posts_fields' ), 10, 2 );
116
-			add_filter( 'posts_join', array( 'EEH_Event_Query', 'posts_join' ), 10, 2 );
117
-			add_filter( 'posts_where', array( 'EEH_Event_Query', 'posts_where' ), 10, 2 );
118
-			add_filter( 'posts_orderby', array( 'EEH_Event_Query', 'posts_orderby' ), 10, 2 );
119
-			add_filter( 'posts_clauses_request', array( 'EEH_Event_Query', 'posts_clauses' ), 10, 2 );
115
+			add_filter('posts_fields', array('EEH_Event_Query', 'posts_fields'), 10, 2);
116
+			add_filter('posts_join', array('EEH_Event_Query', 'posts_join'), 10, 2);
117
+			add_filter('posts_where', array('EEH_Event_Query', 'posts_where'), 10, 2);
118
+			add_filter('posts_orderby', array('EEH_Event_Query', 'posts_orderby'), 10, 2);
119
+			add_filter('posts_clauses_request', array('EEH_Event_Query', 'posts_clauses'), 10, 2);
120 120
 		}
121 121
 	}
122 122
 
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
 	 * @param string $orderby
132 132
 	 * @param string $sort
133 133
 	 */
134
-	public static function set_query_params( $month = '', $category = '', $show_expired = FALSE, $orderby = 'start_date', $sort = 'ASC' ) {
134
+	public static function set_query_params($month = '', $category = '', $show_expired = FALSE, $orderby = 'start_date', $sort = 'ASC') {
135 135
 		self::$_query_params = array();
136
-		EEH_Event_Query::$_event_query_month = EEH_Event_Query::_display_month( $month );
137
-		EEH_Event_Query::$_event_query_category = EEH_Event_Query::_event_category_slug( $category );
138
-		EEH_Event_Query::$_event_query_show_expired = EEH_Event_Query::_show_expired( $show_expired );
139
-		EEH_Event_Query::$_event_query_orderby = EEH_Event_Query::_orderby( $orderby );
140
-		EEH_Event_Query::$_event_query_sort = EEH_Event_Query::_sort( $sort );
136
+		EEH_Event_Query::$_event_query_month = EEH_Event_Query::_display_month($month);
137
+		EEH_Event_Query::$_event_query_category = EEH_Event_Query::_event_category_slug($category);
138
+		EEH_Event_Query::$_event_query_show_expired = EEH_Event_Query::_show_expired($show_expired);
139
+		EEH_Event_Query::$_event_query_orderby = EEH_Event_Query::_orderby($orderby);
140
+		EEH_Event_Query::$_event_query_sort = EEH_Event_Query::_sort($sort);
141 141
 	}
142 142
 
143 143
 
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 * @param string $month
150 150
 	 * @return    string
151 151
 	 */
152
-	private static function _display_month( $month = '' ) {
153
-		return EE_Registry::instance()->REQ->is_set( 'event_query_month' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_month' ) ) : $month;
152
+	private static function _display_month($month = '') {
153
+		return EE_Registry::instance()->REQ->is_set('event_query_month') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_month')) : $month;
154 154
 	}
155 155
 
156 156
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 	 * @param string $category
163 163
 	 * @return    string
164 164
 	 */
165
-	private static function _event_category_slug( $category = '' ) {
166
-		return EE_Registry::instance()->REQ->is_set( 'event_query_category' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_category' ) ) : $category;
165
+	private static function _event_category_slug($category = '') {
166
+		return EE_Registry::instance()->REQ->is_set('event_query_category') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_category')) : $category;
167 167
 	}
168 168
 
169 169
 
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
 	 * @param bool $show_expired
176 176
 	 * @return    boolean
177 177
 	 */
178
-	private static function _show_expired( $show_expired = FALSE ) {
178
+	private static function _show_expired($show_expired = FALSE) {
179 179
 		// override default expired option if set via filter
180
-		$_event_query_show_expired =EE_Registry::instance()->REQ->is_set( 'event_query_show_expired' ) ? EE_Registry::instance()->REQ->get( 'event_query_show_expired' ) : $show_expired;
181
-		return filter_var( $_event_query_show_expired, FILTER_VALIDATE_BOOLEAN );
180
+		$_event_query_show_expired = EE_Registry::instance()->REQ->is_set('event_query_show_expired') ? EE_Registry::instance()->REQ->get('event_query_show_expired') : $show_expired;
181
+		return filter_var($_event_query_show_expired, FILTER_VALIDATE_BOOLEAN);
182 182
 	}
183 183
 
184 184
 
@@ -190,10 +190,10 @@  discard block
 block discarded – undo
190 190
 	 * @param    string $orderby
191 191
 	 * @return    array
192 192
 	 */
193
-	private static function _orderby( $orderby = 'start_date' ) {
194
-		$event_query_orderby = EE_Registry::instance()->REQ->is_set( 'event_query_orderby' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_orderby' ) ) : $orderby;
195
-		$event_query_orderby = is_array( $event_query_orderby ) ? $event_query_orderby : explode( ',', $event_query_orderby );
196
-		$event_query_orderby = array_map( 'trim', $event_query_orderby );
193
+	private static function _orderby($orderby = 'start_date') {
194
+		$event_query_orderby = EE_Registry::instance()->REQ->is_set('event_query_orderby') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_orderby')) : $orderby;
195
+		$event_query_orderby = is_array($event_query_orderby) ? $event_query_orderby : explode(',', $event_query_orderby);
196
+		$event_query_orderby = array_map('trim', $event_query_orderby);
197 197
 		return $event_query_orderby;
198 198
 	}
199 199
 
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
 	 * @param string $sort
207 207
 	 * @return    array
208 208
 	 */
209
-	private static function _sort( $sort = 'ASC' ) {
210
-		$sort = EE_Registry::instance()->REQ->is_set( 'event_query_sort' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_sort' ) ) : $sort;
211
-		return in_array( $sort, array( 'ASC', 'asc', 'DESC', 'desc' )) ? strtoupper( $sort ) : 'ASC';
209
+	private static function _sort($sort = 'ASC') {
210
+		$sort = EE_Registry::instance()->REQ->is_set('event_query_sort') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_sort')) : $sort;
211
+		return in_array($sort, array('ASC', 'asc', 'DESC', 'desc')) ? strtoupper($sort) : 'ASC';
212 212
 	}
213 213
 
214 214
 
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @return array   array of clauses
223 223
 	 */
224
-	public static function posts_clauses( $clauses, WP_Query $wp_query ) {
225
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
224
+	public static function posts_clauses($clauses, WP_Query $wp_query) {
225
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
226 226
 			global $wpdb;
227
-			$clauses['groupby'] = $wpdb->posts . '.ID ';
227
+			$clauses['groupby'] = $wpdb->posts.'.ID ';
228 228
 		}
229 229
 		return $clauses;
230 230
 	}
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 	 * @param WP_Query $wp_query
240 240
 	 * @return    string
241 241
 	 */
242
-	public static function posts_fields( $SQL, WP_Query $wp_query ) {
243
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
242
+	public static function posts_fields($SQL, WP_Query $wp_query) {
243
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
244 244
 			// adds something like ", wp_esp_datetime.* " to WP Query SELECT statement
245
-			$SQL .= EEH_Event_Query::posts_fields_sql_for_orderby( EEH_Event_Query::$_event_query_orderby );
245
+			$SQL .= EEH_Event_Query::posts_fields_sql_for_orderby(EEH_Event_Query::$_event_query_orderby);
246 246
 		}
247 247
 		return $SQL;
248 248
 	}
@@ -257,29 +257,29 @@  discard block
 block discarded – undo
257 257
 	 * @internal  param bool|string $mixed $join_terms pass TRUE or term string, doesn't really matter since this value doesn't really get used for anything yet
258 258
 	 * @return    string
259 259
 	 */
260
-	public static function posts_fields_sql_for_orderby( $orderby_params = array() ) {
261
-		$SQL = ', MIN( ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start ) as event_start_date ' ;
262
-		foreach( (array)$orderby_params as $orderby ) {
263
-			switch ( $orderby ) {
260
+	public static function posts_fields_sql_for_orderby($orderby_params = array()) {
261
+		$SQL = ', MIN( '.EEM_Datetime::instance()->table().'.DTT_EVT_start ) as event_start_date ';
262
+		foreach ((array) $orderby_params as $orderby) {
263
+			switch ($orderby) {
264 264
 
265 265
 				case 'ticket_start' :
266
-					$SQL .= ', ' . EEM_Ticket::instance()->table() . '.TKT_start_date' ;
266
+					$SQL .= ', '.EEM_Ticket::instance()->table().'.TKT_start_date';
267 267
 					break;
268 268
 
269 269
 				case 'ticket_end' :
270
-					$SQL .= ', ' . EEM_Ticket::instance()->table() . '.TKT_end_date' ;
270
+					$SQL .= ', '.EEM_Ticket::instance()->table().'.TKT_end_date';
271 271
 					break;
272 272
 
273 273
 				case 'venue_title' :
274
-					$SQL .= ', Venue.post_title AS venue_title' ;
274
+					$SQL .= ', Venue.post_title AS venue_title';
275 275
 					break;
276 276
 
277 277
 				case 'city' :
278
-					$SQL .= ', ' . EEM_Venue::instance()->second_table() . '.VNU_city' ;
278
+					$SQL .= ', '.EEM_Venue::instance()->second_table().'.VNU_city';
279 279
 					break;
280 280
 
281 281
 				case 'state' :
282
-					$SQL .= ', ' . EEM_State::instance()->table() . '.STA_name' ;
282
+					$SQL .= ', '.EEM_State::instance()->table().'.STA_name';
283 283
 					break;
284 284
 
285 285
 			}
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 	 * @param WP_Query $wp_query
298 298
 	 * @return    string
299 299
 	 */
300
-	public static function posts_join( $SQL = '', WP_Query $wp_query ) {
301
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
300
+	public static function posts_join($SQL = '', WP_Query $wp_query) {
301
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
302 302
 			// Category
303
-			$SQL = EEH_Event_Query::posts_join_sql_for_show_expired( $SQL, EEH_Event_Query::$_event_query_show_expired );
304
-			$SQL = EEH_Event_Query::posts_join_sql_for_terms( $SQL, EEH_Event_Query::$_event_query_category );
305
-			$SQL = EEH_Event_Query::posts_join_for_orderby( $SQL, EEH_Event_Query::$_event_query_orderby );
303
+			$SQL = EEH_Event_Query::posts_join_sql_for_show_expired($SQL, EEH_Event_Query::$_event_query_show_expired);
304
+			$SQL = EEH_Event_Query::posts_join_sql_for_terms($SQL, EEH_Event_Query::$_event_query_category);
305
+			$SQL = EEH_Event_Query::posts_join_for_orderby($SQL, EEH_Event_Query::$_event_query_orderby);
306 306
 		}
307 307
 		return $SQL;
308 308
 	}
@@ -317,11 +317,11 @@  discard block
 block discarded – undo
317 317
 	 * @param    boolean $show_expired if TRUE, then displayed past events
318 318
 	 * @return string
319 319
 	 */
320
-	public static function posts_join_sql_for_show_expired( $SQL = '', $show_expired = FALSE ) {
321
-		if ( ! $show_expired ) {
322
-			$join = EEM_Event::instance()->table() . '.ID = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name();
323
-			if ( strpos( $SQL, $join ) === FALSE ) {
324
-				$SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . $join . ' ) ';
320
+	public static function posts_join_sql_for_show_expired($SQL = '', $show_expired = FALSE) {
321
+		if ( ! $show_expired) {
322
+			$join = EEM_Event::instance()->table().'.ID = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name();
323
+			if (strpos($SQL, $join) === FALSE) {
324
+				$SQL .= ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.$join.' ) ';
325 325
 			}
326 326
 		}
327 327
 		return $SQL;
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 	 * @param 	string $join_terms pass TRUE or term string, doesn't really matter since this value doesn't really get used for anything yet
338 338
 	 * @return 	string
339 339
 	 */
340
-	public static function posts_join_sql_for_terms( $SQL = '', $join_terms = '' ) {
341
-		if ( ! empty( $join_terms ) ) {
340
+	public static function posts_join_sql_for_terms($SQL = '', $join_terms = '') {
341
+		if ( ! empty($join_terms)) {
342 342
 			global $wpdb;
343 343
 			$SQL .= " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)";
344 344
 			$SQL .= " LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)";
@@ -358,25 +358,25 @@  discard block
 block discarded – undo
358 358
 	 * @param 	array $orderby_params
359 359
 	 * @return 	string
360 360
 	 */
361
-	public static function posts_join_for_orderby( $SQL = '', $orderby_params = array() ) {
362
-		foreach ( (array)$orderby_params as $orderby ) {
363
-			switch ( $orderby ) {
361
+	public static function posts_join_for_orderby($SQL = '', $orderby_params = array()) {
362
+		foreach ((array) $orderby_params as $orderby) {
363
+			switch ($orderby) {
364 364
 				case 'ticket_start' :
365 365
 				case 'ticket_end' :
366
-					$SQL .= EEH_Event_Query::_posts_join_for_datetime( $SQL, EEM_Datetime_Ticket::instance()->table() . '.' . EEM_Datetime::instance()->primary_key_name() );
367
-					$SQL .= ' LEFT JOIN ' . EEM_Ticket::instance()->table() . ' ON (' . EEM_Datetime_Ticket::instance()->table() . '.' . EEM_Ticket::instance()->primary_key_name() . ' = ' . EEM_Ticket::instance()->table() . '.' . EEM_Ticket::instance()->primary_key_name() . ' )';
366
+					$SQL .= EEH_Event_Query::_posts_join_for_datetime($SQL, EEM_Datetime_Ticket::instance()->table().'.'.EEM_Datetime::instance()->primary_key_name());
367
+					$SQL .= ' LEFT JOIN '.EEM_Ticket::instance()->table().' ON ('.EEM_Datetime_Ticket::instance()->table().'.'.EEM_Ticket::instance()->primary_key_name().' = '.EEM_Ticket::instance()->table().'.'.EEM_Ticket::instance()->primary_key_name().' )';
368 368
 					break;
369 369
 				case 'venue_title' :
370 370
 				case 'city' :
371
-					$SQL .= EEH_Event_Query::_posts_join_for_event_venue( $SQL );
371
+					$SQL .= EEH_Event_Query::_posts_join_for_event_venue($SQL);
372 372
 					break;
373 373
 				case 'state' :
374
-					$SQL .= EEH_Event_Query::_posts_join_for_event_venue( $SQL );
375
-					$SQL .= EEH_Event_Query::_posts_join_for_venue_state( $SQL );
374
+					$SQL .= EEH_Event_Query::_posts_join_for_event_venue($SQL);
375
+					$SQL .= EEH_Event_Query::_posts_join_for_venue_state($SQL);
376 376
 					break;
377 377
 				case 'start_date' :
378 378
 				default :
379
-					$SQL .= EEH_Event_Query::_posts_join_for_datetime( $SQL, EEM_Event::instance()->table() . '.ID' );
379
+					$SQL .= EEH_Event_Query::_posts_join_for_datetime($SQL, EEM_Event::instance()->table().'.ID');
380 380
 					break;
381 381
 
382 382
 			}
@@ -394,11 +394,11 @@  discard block
 block discarded – undo
394 394
 	 * @param string $join
395 395
 	 * @return string
396 396
 	 */
397
-	protected static function _posts_join_for_datetime( $SQL = '', $join = '' ) {
398
-		if ( ! empty( $join )) {
399
-			$join .= ' = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name();
400
-			if ( strpos( $SQL, $join ) === FALSE ) {
401
-				return ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . $join . ' )';
397
+	protected static function _posts_join_for_datetime($SQL = '', $join = '') {
398
+		if ( ! empty($join)) {
399
+			$join .= ' = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name();
400
+			if (strpos($SQL, $join) === FALSE) {
401
+				return ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.$join.' )';
402 402
 			}
403 403
 		}
404 404
 		return '';
@@ -413,13 +413,13 @@  discard block
 block discarded – undo
413 413
 	 * @param string $SQL
414 414
 	 * @return string
415 415
 	 */
416
-	protected static function _posts_join_for_event_venue( $SQL = '' ) {
416
+	protected static function _posts_join_for_event_venue($SQL = '') {
417 417
 		// Event Venue table name
418 418
 		$event_venue_table = EEM_Event_Venue::instance()->table();
419 419
 		// generate conditions for:  Event <=> Event Venue  JOIN clause
420
-		$event_to_event_venue_join = EEM_Event::instance()->table() . '.ID = ' . $event_venue_table . '.' . EEM_Event::instance()->primary_key_name();
420
+		$event_to_event_venue_join = EEM_Event::instance()->table().'.ID = '.$event_venue_table.'.'.EEM_Event::instance()->primary_key_name();
421 421
 		// don't add joins if they have already been added
422
-		if ( strpos( $SQL, $event_to_event_venue_join ) === FALSE ) {
422
+		if (strpos($SQL, $event_to_event_venue_join) === FALSE) {
423 423
 			// Venue table name
424 424
 			$venue_table = EEM_Venue::instance()->table();
425 425
 			// Venue table pk
@@ -432,10 +432,10 @@  discard block
 block discarded – undo
432 432
 			$venue_SQL .= " LEFT JOIN $venue_table as Venue ON ( $event_venue_table.$venue_table_pk = Venue.ID )";
433 433
 			// generate JOIN clause for: Venue <=> Venue Meta
434 434
 			$venue_SQL .= " LEFT JOIN $venue_meta_table ON ( Venue.ID = $venue_meta_table.$venue_table_pk )";
435
-			unset( $event_venue_table, $event_to_event_venue_join, $venue_table, $venue_table_pk, $venue_meta_table );
435
+			unset($event_venue_table, $event_to_event_venue_join, $venue_table, $venue_table_pk, $venue_meta_table);
436 436
 			return $venue_SQL;
437 437
 		}
438
-		unset( $event_venue_table, $event_to_event_venue_join );
438
+		unset($event_venue_table, $event_to_event_venue_join);
439 439
 		return '';
440 440
 	}
441 441
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	 * @param string $SQL
449 449
 	 * @return string
450 450
 	 */
451
-	protected static function _posts_join_for_venue_state( $SQL = '' ) {
451
+	protected static function _posts_join_for_venue_state($SQL = '') {
452 452
 		// Venue Meta table name
453 453
 		$venue_meta_table = EEM_Venue::instance()->second_table();
454 454
 		// State table name
@@ -456,16 +456,16 @@  discard block
 block discarded – undo
456 456
 		// State table pk
457 457
 		$state_table_pk = EEM_State::instance()->primary_key_name();
458 458
 		// verify vars
459
-		if ( $venue_meta_table && $state_table && $state_table_pk ) {
459
+		if ($venue_meta_table && $state_table && $state_table_pk) {
460 460
 			// like: wp_esp_venue_meta.STA_ID = wp_esp_state.STA_ID
461 461
 			$join = "$venue_meta_table.$state_table_pk = $state_table.$state_table_pk";
462 462
 			// don't add join if it has already been added
463
-			if ( strpos( $SQL, $join ) === FALSE ) {
464
-				unset( $state_table_pk, $venue_meta_table, $venue_table_pk );
463
+			if (strpos($SQL, $join) === FALSE) {
464
+				unset($state_table_pk, $venue_meta_table, $venue_table_pk);
465 465
 				return " LEFT JOIN $state_table ON ( $join )";
466 466
 			}
467 467
 		}
468
-		unset( $join, $state_table, $state_table_pk, $venue_meta_table, $venue_table_pk );
468
+		unset($join, $state_table, $state_table_pk, $venue_meta_table, $venue_table_pk);
469 469
 		return '';
470 470
 	}
471 471
 
@@ -479,14 +479,14 @@  discard block
 block discarded – undo
479 479
 	 * @param WP_Query $wp_query
480 480
 	 * @return    string
481 481
 	 */
482
-	public static function posts_where( $SQL = '', WP_Query $wp_query ) {
483
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
482
+	public static function posts_where($SQL = '', WP_Query $wp_query) {
483
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
484 484
 			// Show Expired ?
485
-			$SQL .= EEH_Event_Query::posts_where_sql_for_show_expired( EEH_Event_Query::$_event_query_show_expired  );
485
+			$SQL .= EEH_Event_Query::posts_where_sql_for_show_expired(EEH_Event_Query::$_event_query_show_expired);
486 486
 			// Category
487
-			$SQL .= EEH_Event_Query::posts_where_sql_for_event_category_slug( EEH_Event_Query::$_event_query_category  );
487
+			$SQL .= EEH_Event_Query::posts_where_sql_for_event_category_slug(EEH_Event_Query::$_event_query_category);
488 488
 			// Start Date
489
-			$SQL .= EEH_Event_Query::posts_where_sql_for_event_list_month( EEH_Event_Query::$_event_query_month );
489
+			$SQL .= EEH_Event_Query::posts_where_sql_for_event_list_month(EEH_Event_Query::$_event_query_month);
490 490
 		}
491 491
 		return $SQL;
492 492
 	}
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
 	 * @param    boolean $show_expired if TRUE, then displayed past events
501 501
 	 * @return    string
502 502
 	 */
503
-	public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) {
504
-		return ! $show_expired ? ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . current_time( 'mysql', TRUE ) . '" ' : '';
503
+	public static function posts_where_sql_for_show_expired($show_expired = FALSE) {
504
+		return ! $show_expired ? ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end > "'.current_time('mysql', TRUE).'" ' : '';
505 505
 	}
506 506
 
507 507
 
@@ -513,9 +513,9 @@  discard block
 block discarded – undo
513 513
 	 * @param    boolean $event_category_slug
514 514
 	 * @return    string
515 515
 	 */
516
-	public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) {
516
+	public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) {
517 517
 		global $wpdb;
518
-		return ! empty( $event_category_slug ) ? ' AND ' . $wpdb->terms . '.slug = "' . $event_category_slug . '" ' : '';
518
+		return ! empty($event_category_slug) ? ' AND '.$wpdb->terms.'.slug = "'.$event_category_slug.'" ' : '';
519 519
 	}
520 520
 
521 521
 
@@ -527,13 +527,13 @@  discard block
 block discarded – undo
527 527
 	 * @param    boolean $month
528 528
 	 * @return    string
529 529
 	 */
530
-	public static function posts_where_sql_for_event_list_month( $month = NULL ) {
530
+	public static function posts_where_sql_for_event_list_month($month = NULL) {
531 531
 		$SQL = '';
532
-		if ( ! empty( $month ) ) {
532
+		if ( ! empty($month)) {
533 533
 			// event start date is LESS than the end of the month ( so nothing that doesn't start until next month )
534
-			$SQL = ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start <= "' . gmdate( 'Y-m-t 23:59:59', strtotime( $month ) ) . '"';
534
+			$SQL = ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_start <= "'.gmdate('Y-m-t 23:59:59', strtotime($month)).'"';
535 535
 			// event end date is GREATER than the start of the month ( so nothing that ended before this month )
536
-			$SQL .= ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end >= "' . gmdate( 'Y-m-01 0:0:00', strtotime( $month ) ) . '" ';
536
+			$SQL .= ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end >= "'.gmdate('Y-m-01 0:0:00', strtotime($month)).'" ';
537 537
 		}
538 538
 		return $SQL;
539 539
 	}
@@ -548,9 +548,9 @@  discard block
 block discarded – undo
548 548
 	 * @param WP_Query $wp_query
549 549
 	 * @return    string
550 550
 	 */
551
-	public static function posts_orderby( $SQL = '', WP_Query $wp_query ) {
552
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
553
-			$SQL = EEH_Event_Query::posts_orderby_sql( EEH_Event_Query::$_event_query_orderby, EEH_Event_Query::$_event_query_sort );
551
+	public static function posts_orderby($SQL = '', WP_Query $wp_query) {
552
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
553
+			$SQL = EEH_Event_Query::posts_orderby_sql(EEH_Event_Query::$_event_query_orderby, EEH_Event_Query::$_event_query_sort);
554 554
 		}
555 555
 		return $SQL;
556 556
 	}
@@ -581,63 +581,63 @@  discard block
 block discarded – undo
581 581
 	 * @param string     $sort
582 582
 	 * @return string
583 583
 	 */
584
-	public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) {
584
+	public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') {
585 585
 		global $wpdb;
586 586
 		$SQL = '';
587 587
 		$counter = 0;
588 588
 		//make sure 'orderby' is set in query params
589
-		if ( ! isset( self::$_query_params['orderby'] )) {
589
+		if ( ! isset(self::$_query_params['orderby'])) {
590 590
 			self::$_query_params['orderby'] = array();
591 591
 		}
592 592
 		// loop thru $orderby_params (type cast as array)
593
-		foreach ( (array)$orderby_params as $orderby ) {
593
+		foreach ((array) $orderby_params as $orderby) {
594 594
 			// check if we have already added this param
595
-			if ( isset( self::$_query_params['orderby'][ $orderby ] )) {
595
+			if (isset(self::$_query_params['orderby'][$orderby])) {
596 596
 				// if so then remove from the $orderby_params so that the count() method below is accurate
597
-				unset( $orderby_params[ $orderby ] );
597
+				unset($orderby_params[$orderby]);
598 598
 				// then bump ahead to the next param
599 599
 				continue;
600 600
 			}
601 601
 			// this will ad a comma depending on whether this is the first or last param
602
-			$glue = $counter == 0 || $counter == count( $orderby_params ) ? ' ' : ', ';
602
+			$glue = $counter == 0 || $counter == count($orderby_params) ? ' ' : ', ';
603 603
 			// ok what's we dealing with?
604
-			switch ( $orderby ) {
604
+			switch ($orderby) {
605 605
 				case 'id' :
606 606
 				case 'ID' :
607
-					$SQL .= $glue . $wpdb->posts . '.ID ' . $sort;
607
+					$SQL .= $glue.$wpdb->posts.'.ID '.$sort;
608 608
 					break;
609 609
 				case 'end_date' :
610
-					$SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_end ' . $sort;
610
+					$SQL .= $glue.EEM_Datetime::instance()->table().'.DTT_EVT_end '.$sort;
611 611
 					break;
612 612
 				case 'event_name' :
613
-					$SQL .= $glue . $wpdb->posts . '.post_title ' . $sort;
613
+					$SQL .= $glue.$wpdb->posts.'.post_title '.$sort;
614 614
 					break;
615 615
 				case 'category_slug' :
616
-					$SQL .= $glue . $wpdb->terms . '.slug ' . $sort;
616
+					$SQL .= $glue.$wpdb->terms.'.slug '.$sort;
617 617
 					break;
618 618
 				case 'ticket_start' :
619
-					$SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_start_date ' . $sort;
619
+					$SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_start_date '.$sort;
620 620
 					break;
621 621
 				case 'ticket_end' :
622
-					$SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_end_date ' . $sort;
622
+					$SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_end_date '.$sort;
623 623
 					break;
624 624
 				case 'venue_title' :
625
-					$SQL .= $glue . 'venue_title ' . $sort;
625
+					$SQL .= $glue.'venue_title '.$sort;
626 626
 					break;
627 627
 				case 'city' :
628
-					$SQL .= $glue . EEM_Venue::instance()->second_table() . '.VNU_city ' . $sort;
628
+					$SQL .= $glue.EEM_Venue::instance()->second_table().'.VNU_city '.$sort;
629 629
 					break;
630 630
 				case 'state' :
631
-					$SQL .= $glue . EEM_State::instance()->table() . '.STA_name ' . $sort;
631
+					$SQL .= $glue.EEM_State::instance()->table().'.STA_name '.$sort;
632 632
 					break;
633 633
 				case 'start_date' :
634 634
 				default :
635
-					$SQL .= $glue . ' event_start_date ' . $sort;
635
+					$SQL .= $glue.' event_start_date '.$sort;
636 636
 					break;
637 637
 			}
638 638
 			// add to array of orderby params that have been added
639
-			self::$_query_params['orderby'][ $orderby ] = TRUE;
640
-			$counter ++;
639
+			self::$_query_params['orderby'][$orderby] = TRUE;
640
+			$counter++;
641 641
 		}
642 642
 		return $SQL;
643 643
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Form_Fields.helper.php 2 patches
Spacing   +378 added lines, -378 removed lines patch added patch discarded remove patch
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 * 	@return string
59 59
 	 * 	@todo: at some point we can break this down into other static methods to abstract it a bit better.
60 60
 	 */
61
-	static public function get_form_fields( $input_vars = array(), $id = FALSE ) {
61
+	static public function get_form_fields($input_vars = array(), $id = FALSE) {
62 62
 
63
-		if ( empty($input_vars) ) {
64
-			EE_Error::add_error( __('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
63
+		if (empty($input_vars)) {
64
+			EE_Error::add_error(__('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
65 65
 			return FALSE;
66 66
 		}
67 67
 
@@ -87,25 +87,25 @@  discard block
 block discarded – undo
87 87
 				'append_content' => ''
88 88
 				);
89 89
 
90
-			$input_value = wp_parse_args( $input_value, $defaults );
90
+			$input_value = wp_parse_args($input_value, $defaults);
91 91
 
92 92
 			// required fields get a *
93 93
 			$required = isset($input_value['required']) && $input_value['required'] ? ' <span>*</span>: ' : ': ';
94 94
 			// and the css class "required"
95
-			$css_class = isset( $input_value['css_class'] ) ? $input_value['css_class'] : '';
96
-			$styles = $input_value['required'] ? 'required ' . $css_class : $css_class;
95
+			$css_class = isset($input_value['css_class']) ? $input_value['css_class'] : '';
96
+			$styles = $input_value['required'] ? 'required '.$css_class : $css_class;
97 97
 
98
-			$field_id = ($id) ? $id . '-' . $input_key : $input_key;
99
-			$tabindex = !empty($input_value['tabindex']) ? ' tabindex="' . $input_value['tabindex'] . '"' : '';
98
+			$field_id = ($id) ? $id.'-'.$input_key : $input_key;
99
+			$tabindex = ! empty($input_value['tabindex']) ? ' tabindex="'.$input_value['tabindex'].'"' : '';
100 100
 
101 101
 			//rows or cols?
102
-			$rows = isset($input_value['rows'] ) ? $input_value['rows'] : '10';
103
-			$cols = isset($input_value['cols'] ) ? $input_value['cols'] : '80';
102
+			$rows = isset($input_value['rows']) ? $input_value['rows'] : '10';
103
+			$cols = isset($input_value['cols']) ? $input_value['cols'] : '80';
104 104
 
105 105
 			//any content?
106 106
 			$append_content = $input_value['append_content'];
107 107
 
108
-			$output .= (!$close) ? '<ul>' : '';
108
+			$output .= ( ! $close) ? '<ul>' : '';
109 109
 			$output .= '<li>';
110 110
 
111 111
 			// what type of input are we dealing with ?
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
 
114 114
 				// text inputs
115 115
 				case 'text' :
116
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
117
-					$output .= "\n\t\t\t" . '<input id="' . $field_id . '" class="' . $styles . '" type="text" value="' . $input_value['value'] . '" name="' . $input_value['name'] . '"' . $tabindex . '>';
116
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
117
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" class="'.$styles.'" type="text" value="'.$input_value['value'].'" name="'.$input_value['name'].'"'.$tabindex.'>';
118 118
 					break;
119 119
 
120 120
 				// dropdowns
121 121
 				case 'select' :
122 122
 
123
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
124
-					$output .= "\n\t\t\t" . '<select id="' . $field_id . '" class="' . $styles . '" name="' . $input_value['name'] . '"' . $tabindex . '>';
123
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
124
+					$output .= "\n\t\t\t".'<select id="'.$field_id.'" class="'.$styles.'" name="'.$input_value['name'].'"'.$tabindex.'>';
125 125
 
126 126
 					if (is_array($input_value['options'])) {
127 127
 						$options = $input_value['options'];
@@ -130,30 +130,30 @@  discard block
 block discarded – undo
130 130
 					}
131 131
 
132 132
 					foreach ($options as $key => $value) {
133
-						$selected = isset( $input_value['value'] ) && $input_value['value'] == $key ? 'selected=selected' : '';
133
+						$selected = isset($input_value['value']) && $input_value['value'] == $key ? 'selected=selected' : '';
134 134
 						//$key = str_replace( ' ', '_', sanitize_key( $value ));
135
-						$output .= "\n\t\t\t\t" . '<option '. $selected . ' value="' . $key . '">' . $value . '</option>';
135
+						$output .= "\n\t\t\t\t".'<option '.$selected.' value="'.$key.'">'.$value.'</option>';
136 136
 					}
137
-					$output .= "\n\t\t\t" . '</select>';
137
+					$output .= "\n\t\t\t".'</select>';
138 138
 
139 139
 					break;
140 140
 
141 141
 				case 'textarea' :
142 142
 
143
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
144
-					$output .= "\n\t\t\t" . '<textarea id="' . $field_id . '" class="' . $styles . '" rows="'.$rows.'" cols="'.$cols.'" name="' . $input_value['name'] . '"' . $tabindex . '>' . $input_value['value'] . '</textarea>';
143
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
144
+					$output .= "\n\t\t\t".'<textarea id="'.$field_id.'" class="'.$styles.'" rows="'.$rows.'" cols="'.$cols.'" name="'.$input_value['name'].'"'.$tabindex.'>'.$input_value['value'].'</textarea>';
145 145
 					break;
146 146
 
147 147
 				case 'hidden' :
148 148
 					$close = false;
149 149
 					$output .= "</li></ul>";
150
-					$output .= "\n\t\t\t" . '<input id="' . $field_id . '" type="hidden" name="' . $input_value['name'] . '" value="' . $input_value['value'] . '">';
150
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" type="hidden" name="'.$input_value['name'].'" value="'.$input_value['value'].'">';
151 151
 					break;
152 152
 
153 153
 				case 'checkbox' :
154
-					$checked = ( $input_value['value'] == 1 ) ? 'checked="checked"' : '';
155
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
156
-					$output .= "\n\t\t\t" . '<input id="' . $field_id. '" type="checkbox" name="' . $input_value['name'] . '" value="1"' . $checked . $tabindex . ' />';
154
+					$checked = ($input_value['value'] == 1) ? 'checked="checked"' : '';
155
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
156
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" type="checkbox" name="'.$input_value['name'].'" value="1"'.$checked.$tabindex.' />';
157 157
 					break;
158 158
 
159 159
 				case 'wp_editor' :
@@ -166,19 +166,19 @@  discard block
 block discarded – undo
166 166
 					);
167 167
 					$output .= '</li>';
168 168
 					$output .= '</ul>';
169
-					$output .= '<h4>' . $input_value['label'] . '</h4>';
170
-					if ( $append_content ) {
169
+					$output .= '<h4>'.$input_value['label'].'</h4>';
170
+					if ($append_content) {
171 171
 						$output .= $append_content;
172 172
 					}
173 173
 					ob_start();
174
-					wp_editor( $input_value['value'], $field_id, $editor_settings);
174
+					wp_editor($input_value['value'], $field_id, $editor_settings);
175 175
 					$editor = ob_get_contents();
176 176
 					ob_end_clean();
177 177
 					$output .= $editor;
178 178
 					break;
179 179
 
180 180
 				}
181
-				if ( $append_content && $input_value['input'] !== 'wp_editor' ) {
181
+				if ($append_content && $input_value['input'] !== 'wp_editor') {
182 182
 					$output .= $append_content;
183 183
 				}
184 184
 				$output .= ($close) ? '</li>' : '';
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 		$form_fields = array();
220 220
 		$fields = (array) $fields;
221 221
 
222
-		foreach ( $fields as $field_name => $field_atts ) {
222
+		foreach ($fields as $field_name => $field_atts) {
223 223
 			//defaults:
224 224
 			$defaults = array(
225 225
 				'label' => '',
@@ -237,67 +237,67 @@  discard block
 block discarded – undo
237 237
 				'wpeditor_args' => array()
238 238
 				);
239 239
 			// merge defaults with passed arguments
240
-			$_fields = wp_parse_args( $field_atts, $defaults);
241
-			extract( $_fields );
240
+			$_fields = wp_parse_args($field_atts, $defaults);
241
+			extract($_fields);
242 242
 			// generate label
243
-			$label = empty($label) ? '' : '<label for="' . $id . '">' . $label . '</label>';
243
+			$label = empty($label) ? '' : '<label for="'.$id.'">'.$label.'</label>';
244 244
 			// generate field name
245
-			$f_name = !empty($unique_id) ? $field_name . '[' . $unique_id . ']' : $field_name;
245
+			$f_name = ! empty($unique_id) ? $field_name.'['.$unique_id.']' : $field_name;
246 246
 
247 247
 			//tabindex
248
-			$tabindex_str = !empty( $tabindex ) ? ' tabindex="' . $tabindex . '"' : '';
248
+			$tabindex_str = ! empty($tabindex) ? ' tabindex="'.$tabindex.'"' : '';
249 249
 
250 250
 			//we determine what we're building based on the type
251
-			switch ( $type ) {
251
+			switch ($type) {
252 252
 
253 253
 				case 'textarea' :
254
-						$fld = '<textarea id="' . $id . '" class="' . $class . '" rows="' . $dimensions[1] . '" cols="' . $dimensions[0] . '" name="' . $f_name . '"' . $tabindex_str . '>' . $value . '</textarea>';
254
+						$fld = '<textarea id="'.$id.'" class="'.$class.'" rows="'.$dimensions[1].'" cols="'.$dimensions[0].'" name="'.$f_name.'"'.$tabindex_str.'>'.$value.'</textarea>';
255 255
 						$fld .= $extra_desc;
256 256
 					break;
257 257
 
258 258
 				case 'checkbox' :
259 259
 						$c_input = '';
260
-						if ( is_array($value) ) {
261
-							foreach ( $value as $key => $val ) {
262
-								$c_id = $field_name . '_' . $value;
263
-								$c_class = isset($classes[$key]) ? ' class="' . $classes[$key] . '" ' : '';
264
-								$c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : '';
265
-								$checked = !empty($default) && $default == $val ? ' checked="checked" ' : '';
266
-								$c_input .= '<input name="' . $f_name . '[]" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label;
260
+						if (is_array($value)) {
261
+							foreach ($value as $key => $val) {
262
+								$c_id = $field_name.'_'.$value;
263
+								$c_class = isset($classes[$key]) ? ' class="'.$classes[$key].'" ' : '';
264
+								$c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : '';
265
+								$checked = ! empty($default) && $default == $val ? ' checked="checked" ' : '';
266
+								$c_input .= '<input name="'.$f_name.'[]" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label;
267 267
 							}
268 268
 							$fld = $c_input;
269 269
 						} else {
270
-							$checked = !empty($default) && $default == $val ? 'checked="checked" ' : '';
271
-							$fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n";
270
+							$checked = ! empty($default) && $default == $val ? 'checked="checked" ' : '';
271
+							$fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n";
272 272
 						}
273 273
 					break;
274 274
 
275 275
 				case 'radio' :
276 276
 						$c_input = '';
277
-						if ( is_array($value) ) {
278
-							foreach ( $value as $key => $val ) {
279
-								$c_id = $field_name . '_' . $value;
280
-								$c_class = isset($classes[$key]) ? 'class="' . $classes[$key] . '" ' : '';
281
-								$c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : '';
282
-								$checked = !empty($default) && $default == $val ? ' checked="checked" ' : '';
283
-								$c_input .= '<input name="' . $f_name . '" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label;
277
+						if (is_array($value)) {
278
+							foreach ($value as $key => $val) {
279
+								$c_id = $field_name.'_'.$value;
280
+								$c_class = isset($classes[$key]) ? 'class="'.$classes[$key].'" ' : '';
281
+								$c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : '';
282
+								$checked = ! empty($default) && $default == $val ? ' checked="checked" ' : '';
283
+								$c_input .= '<input name="'.$f_name.'" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label;
284 284
 							}
285 285
 							$fld = $c_input;
286 286
 						} else {
287
-							$checked = !empty($default) && $default == $val ? 'checked="checked" ' : '';
288
-							$fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n";
287
+							$checked = ! empty($default) && $default == $val ? 'checked="checked" ' : '';
288
+							$fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n";
289 289
 						}
290 290
 					break;
291 291
 
292 292
 				case 'hidden' :
293
-						$fld = '<input name="' . $f_name . '" type="hidden" id="' . $id . '" class="' . $class . '" value="' . $value . '" />' . "\n";
293
+						$fld = '<input name="'.$f_name.'" type="hidden" id="'.$id.'" class="'.$class.'" value="'.$value.'" />'."\n";
294 294
 					break;
295 295
 
296 296
 				case 'select' :
297
-						$fld = '<select name="' . $f_name . '" class="' . $class . '" id="' . $id . '"' . $tabindex_str . '>' . "\n";
298
-						foreach ( $value as $key => $val ) {
299
-							$checked = !empty($default) && $default == $val ? ' selected="selected"' : '';
300
-							$fld .= "\t" . '<option value="' . $val . '"' . $checked . '>' . $labels[$key] . '</option>' . "\n";
297
+						$fld = '<select name="'.$f_name.'" class="'.$class.'" id="'.$id.'"'.$tabindex_str.'>'."\n";
298
+						foreach ($value as $key => $val) {
299
+							$checked = ! empty($default) && $default == $val ? ' selected="selected"' : '';
300
+							$fld .= "\t".'<option value="'.$val.'"'.$checked.'>'.$labels[$key].'</option>'."\n";
301 301
 						}
302 302
 						$fld .= '</select>';
303 303
 					break;
@@ -309,21 +309,21 @@  discard block
 block discarded – undo
309 309
 							'editor_class' => $class,
310 310
 							'tabindex' => $tabindex
311 311
 							);
312
-						$editor_settings = array_merge( $wpeditor_args, $editor_settings );
312
+						$editor_settings = array_merge($wpeditor_args, $editor_settings);
313 313
 						ob_start();
314
-						wp_editor( $value, $id, $editor_settings );
314
+						wp_editor($value, $id, $editor_settings);
315 315
 						$editor = ob_get_contents();
316 316
 						ob_end_clean();
317 317
 						$fld = $editor;
318 318
 					break;
319 319
 
320 320
 				default : //'text fields'
321
-						$fld = '<input name="' . $f_name . '" type="text" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $tabindex_str . ' />' . "\n";
321
+						$fld = '<input name="'.$f_name.'" type="text" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$tabindex_str.' />'."\n";
322 322
 						$fld .= $extra_desc;
323 323
 
324 324
 			}
325 325
 
326
-			$form_fields[ $field_name ] = array( 'label' => $label, 'field' => $fld );
326
+			$form_fields[$field_name] = array('label' => $label, 'field' => $fld);
327 327
 		}
328 328
 
329 329
 		return $form_fields;
@@ -352,22 +352,22 @@  discard block
 block discarded – undo
352 352
 	 */
353 353
 	static public function select_input($name, $values, $default = '', $parameters = '', $class = '', $autosize = true) {
354 354
 		//if $values was submitted in the wrong format, convert it over
355
-		if(!empty($values) && (!array_key_exists(0,$values) || !is_array($values[0]))){
356
-			$converted_values=array();
357
-			foreach($values as $id=>$text){
358
-				$converted_values[]=array('id'=>$id,'text'=>$text);
355
+		if ( ! empty($values) && ( ! array_key_exists(0, $values) || ! is_array($values[0]))) {
356
+			$converted_values = array();
357
+			foreach ($values as $id=>$text) {
358
+				$converted_values[] = array('id'=>$id, 'text'=>$text);
359 359
 			}
360
-			$values=$converted_values;
360
+			$values = $converted_values;
361 361
 		}
362 362
 		//load formatter helper
363
-		EE_Registry::instance()->load_helper( 'Formatter' );
363
+		EE_Registry::instance()->load_helper('Formatter');
364 364
 		//EE_Registry::instance()->load_helper( 'Formatter' );
365 365
 
366
-		$field = '<select id="' . EEH_Formatter::ee_tep_output_string($name) . '" name="' . EEH_Formatter::ee_tep_output_string($name) . '"';
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
 		if ($autosize) {
372 372
 			$size = 'med';
373 373
 			for ($ii = 0, $ni = sizeof($values); $ii < $ni; $ii++) {
@@ -380,21 +380,21 @@  discard block
 block discarded – undo
380 380
 			$size = '';
381 381
 		}
382 382
 
383
-		$field .= ' class="' . $class . ' ' . $size . '">';
383
+		$field .= ' class="'.$class.' '.$size.'">';
384 384
 
385 385
 		if (empty($default) && isset($GLOBALS[$name]))
386 386
 			$default = stripslashes($GLOBALS[$name]);
387 387
 
388 388
 
389 389
 		for ($i = 0, $n = sizeof($values); $i < $n; $i++) {
390
-			$field .= '<option value="' . $values[$i]['id'] . '"';
390
+			$field .= '<option value="'.$values[$i]['id'].'"';
391 391
 			if ($default == $values[$i]['id']) {
392 392
 				$field .= ' selected = "selected"';
393 393
 			}
394
-			if ( isset( $values[$i]['class'] ) ) {
395
-				$field .= ' class="' . $values[$i]['class'] . '"';
394
+			if (isset($values[$i]['class'])) {
395
+				$field .= ' class="'.$values[$i]['class'].'"';
396 396
 			}
397
-			$field .= '>' . $values[$i]['text'] . '</option>';
397
+			$field .= '>'.$values[$i]['text'].'</option>';
398 398
 		}
399 399
 		$field .= '</select>';
400 400
 
@@ -412,38 +412,38 @@  discard block
 block discarded – undo
412 412
 	 * @param string $question_groups
413 413
 	 * @return string HTML
414 414
 	 */
415
-	static function generate_question_groups_html( $question_groups = array(), $group_wrapper = 'fieldset' ) {
415
+	static function generate_question_groups_html($question_groups = array(), $group_wrapper = 'fieldset') {
416 416
 
417 417
 		$html = '';
418
-		$before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' );
419
-		$after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' );
418
+		$before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
419
+		$after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
420 420
 
421
-		if ( ! empty( $question_groups )) {
421
+		if ( ! empty($question_groups)) {
422 422
 			//EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
423 423
 			// loop thru question groups
424
-			foreach ( $question_groups as $QSG ) {
424
+			foreach ($question_groups as $QSG) {
425 425
 				// check that questions exist
426
-				if ( ! empty( $QSG['QSG_questions'] )) {
426
+				if ( ! empty($QSG['QSG_questions'])) {
427 427
 					// use fieldsets
428
-					$html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG['QSG_identifier'] . '">';
428
+					$html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG['QSG_identifier'].'">';
429 429
 					// group_name
430
-					$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>' : '';
430
+					$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>' : '';
431 431
 					// group_desc
432
-					$html .= $QSG['QSG_show_group_desc'] && ! empty( $QSG['QSG_desc'] ) ? '<div class="espresso-question-group-desc-pg">' . self::prep_answer( $QSG['QSG_desc'] ) . '</div>' : '';
432
+					$html .= $QSG['QSG_show_group_desc'] && ! empty($QSG['QSG_desc']) ? '<div class="espresso-question-group-desc-pg">'.self::prep_answer($QSG['QSG_desc']).'</div>' : '';
433 433
 
434 434
 					$html .= $before_question_group_questions;
435 435
 					// loop thru questions
436
-					foreach ( $QSG['QSG_questions'] as $question ) {
436
+					foreach ($QSG['QSG_questions'] as $question) {
437 437
 //						EEH_Debug_Tools::printr( $question, '$question  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
438 438
 						$QFI = new EE_Question_Form_Input(
439 439
 							$question['qst_obj'],
440 440
 							$question['ans_obj'],
441 441
 							$question
442 442
 						);
443
-						$html .= self::generate_form_input( $QFI );
443
+						$html .= self::generate_form_input($QFI);
444 444
 					}
445 445
 					$html .= $after_question_group_questions;
446
-					$html .= "\n\t" . '</' . $group_wrapper . '>';
446
+					$html .= "\n\t".'</'.$group_wrapper.'>';
447 447
 				}
448 448
 			}
449 449
 		}
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
 	 * @param string       $group_wrapper
464 464
 	 * @return string HTML
465 465
 	 */
466
-	static function generate_question_groups_html2( $question_groups = array(), $q_meta = array(), 	$from_admin = FALSE, $group_wrapper = 'fieldset' ) {
466
+	static function generate_question_groups_html2($question_groups = array(), $q_meta = array(), $from_admin = FALSE, $group_wrapper = 'fieldset') {
467 467
 
468 468
 		$html = '';
469
-		$before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' );
470
-		$after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' );
469
+		$before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
470
+		$after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
471 471
 
472 472
 		$default_q_meta = array(
473 473
 				'att_nmbr' => 1,
@@ -476,55 +476,55 @@  discard block
 block discarded – undo
476 476
 				'input_id' => '',
477 477
 				'input_class' => ''
478 478
 		);
479
-		$q_meta = array_merge( $default_q_meta, $q_meta );
479
+		$q_meta = array_merge($default_q_meta, $q_meta);
480 480
 		//EEH_Debug_Tools::printr( $q_meta, '$q_meta  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
481 481
 
482
-		if ( ! empty( $question_groups )) {
482
+		if ( ! empty($question_groups)) {
483 483
 //			EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
484 484
 			// loop thru question groups
485
-			foreach ( $question_groups as $QSG ) {
486
-				if ( $QSG instanceof EE_Question_Group ) {
485
+			foreach ($question_groups as $QSG) {
486
+				if ($QSG instanceof EE_Question_Group) {
487 487
 					// check that questions exist
488 488
 
489
-					$where = array( 'QST_deleted' => 0 );
490
-					if ( ! $from_admin ) {
489
+					$where = array('QST_deleted' => 0);
490
+					if ( ! $from_admin) {
491 491
 						$where['QST_admin_only'] = 0;
492 492
 					}
493
-					$questions = $QSG->questions( array( $where, 'order_by' => array( 'Question_Group_Question.QGQ_order' => 'ASC' )));
494
-					if ( ! empty( $questions )) {
493
+					$questions = $QSG->questions(array($where, 'order_by' => array('Question_Group_Question.QGQ_order' => 'ASC')));
494
+					if ( ! empty($questions)) {
495 495
 						// use fieldsets
496
-						$html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG->get( 'QSG_identifier' ) . '">';
496
+						$html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG->get('QSG_identifier').'">';
497 497
 						// group_name
498
-						if ( $QSG->show_group_name() ) {
499
-							$html .=  "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . $QSG->get_pretty( 'QSG_name' ) . '</h5>';
498
+						if ($QSG->show_group_name()) {
499
+							$html .= "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.$QSG->get_pretty('QSG_name').'</h5>';
500 500
 						}
501 501
 						// group_desc
502
-						if ( $QSG->show_group_desc() ) {
503
-							$html .=  '<div class="espresso-question-group-desc-pg">' . $QSG->get_pretty( 'QSG_desc'  ) . '</div>';
502
+						if ($QSG->show_group_desc()) {
503
+							$html .= '<div class="espresso-question-group-desc-pg">'.$QSG->get_pretty('QSG_desc').'</div>';
504 504
 						}
505 505
 
506 506
 						$html .= $before_question_group_questions;
507 507
 						// loop thru questions
508
-						foreach ( $questions as $QST ) {
508
+						foreach ($questions as $QST) {
509 509
 							$qstn_id = $QST->is_system_question() ? $QST->system_ID() : $QST->ID();
510 510
 
511 511
 							$answer = NULL;
512 512
 
513
-							if (  isset( $_GET['qstn'] ) && isset( $q_meta['input_id'] ) && isset( $q_meta['att_nmbr'] )) {
513
+							if (isset($_GET['qstn']) && isset($q_meta['input_id']) && isset($q_meta['att_nmbr'])) {
514 514
 								// check for answer in $_GET in case we are reprocessing a form after an error
515
-								if ( isset( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] )) {
516
-									$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 ] );
515
+								if (isset($_GET['qstn'][$q_meta['input_id']][$qstn_id])) {
516
+									$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]);
517 517
 								}
518
-							} else if ( isset( $q_meta['attendee'] ) && $q_meta['attendee'] ) {
518
+							} else if (isset($q_meta['attendee']) && $q_meta['attendee']) {
519 519
 								//attendee data from the session
520
-								$answer = isset( $q_meta['attendee'][ $qstn_id ] ) ? $q_meta['attendee'][ $qstn_id ] : NULL;
520
+								$answer = isset($q_meta['attendee'][$qstn_id]) ? $q_meta['attendee'][$qstn_id] : NULL;
521 521
 							}
522 522
 
523 523
 
524 524
 
525 525
 							$QFI = new EE_Question_Form_Input(
526 526
 									$QST,
527
-									EE_Answer::new_instance ( array(
527
+									EE_Answer::new_instance(array(
528 528
 											'ANS_ID'=> 0,
529 529
 											'QST_ID'=> 0,
530 530
 											'REG_ID'=> 0,
@@ -533,10 +533,10 @@  discard block
 block discarded – undo
533 533
 									$q_meta
534 534
 							);
535 535
 							//EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
536
-							$html .= self::generate_form_input( $QFI );
536
+							$html .= self::generate_form_input($QFI);
537 537
 						}
538 538
 						$html .= $after_question_group_questions;
539
-						$html .= "\n\t" . '</' . $group_wrapper . '>';
539
+						$html .= "\n\t".'</'.$group_wrapper.'>';
540 540
 					}
541 541
 				}
542 542
 			}
@@ -556,63 +556,63 @@  discard block
 block discarded – undo
556 556
 	 * @param EE_Question_Form_Input $QFI
557 557
 	 * @return string HTML
558 558
 	 */
559
-	static function generate_form_input( EE_Question_Form_Input $QFI ) {
560
-		if ( isset( $QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin() ) {
559
+	static function generate_form_input(EE_Question_Form_Input $QFI) {
560
+		if (isset($QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin()) {
561 561
 			return '';
562 562
 		}
563 563
 
564
-		$QFI = self::_load_system_dropdowns( $QFI );
565
-		$QFI = self::_load_specialized_dropdowns( $QFI );
564
+		$QFI = self::_load_system_dropdowns($QFI);
565
+		$QFI = self::_load_specialized_dropdowns($QFI);
566 566
 
567 567
 		//we also need to verify
568 568
 
569 569
 		$display_text = $QFI->get('QST_display_text');
570 570
 		$input_name = $QFI->get('QST_input_name');
571
-		$answer = EE_Registry::instance()->REQ->is_set( $input_name ) ? EE_Registry::instance()->REQ->get( $input_name ) : $QFI->get('ANS_value');
571
+		$answer = EE_Registry::instance()->REQ->is_set($input_name) ? EE_Registry::instance()->REQ->get($input_name) : $QFI->get('ANS_value');
572 572
 		$input_id = $QFI->get('QST_input_id');
573 573
 		$input_class = $QFI->get('QST_input_class');
574 574
 //		$disabled = $QFI->get('QST_disabled') ? ' disabled="disabled"' : '';
575 575
 		$disabled = $QFI->get('QST_disabled') ? TRUE : FALSE;
576
-		$required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>' );
576
+		$required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>');
577 577
 		$QST_required = $QFI->get('QST_required');
578
-		$required = $QST_required ? array( 'label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required ) : array();
579
-		$use_html_entities = $QFI->get_meta( 'htmlentities' );
580
-		$required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __( 'This field is required', 'event_espresso' );
581
-		$required_text = $QST_required ? "\n\t\t\t" . '<div class="required-text hidden">' . self::prep_answer( $required_text, $use_html_entities ) . '</div>' : '';
578
+		$required = $QST_required ? array('label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required) : array();
579
+		$use_html_entities = $QFI->get_meta('htmlentities');
580
+		$required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __('This field is required', 'event_espresso');
581
+		$required_text = $QST_required ? "\n\t\t\t".'<div class="required-text hidden">'.self::prep_answer($required_text, $use_html_entities).'</div>' : '';
582 582
 		$label_class = 'espresso-form-input-lbl';
583
-		$QST_options = $QFI->options(true,$answer);
584
-		$options = is_array( $QST_options ) ? self::prep_answer_options( $QST_options ) : array();
583
+		$QST_options = $QFI->options(true, $answer);
584
+		$options = is_array($QST_options) ? self::prep_answer_options($QST_options) : array();
585 585
 		$system_ID = $QFI->get('QST_system');
586
-		$label_b4 = $QFI->get_meta( 'label_b4' );
587
-		$use_desc_4_label = $QFI->get_meta( 'use_desc_4_label' );
586
+		$label_b4 = $QFI->get_meta('label_b4');
587
+		$use_desc_4_label = $QFI->get_meta('use_desc_4_label');
588 588
 
589 589
 
590
-		switch ( $QFI->get('QST_type') ){
590
+		switch ($QFI->get('QST_type')) {
591 591
 
592 592
 			case 'TEXTAREA' :
593
-					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 );
593
+					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);
594 594
 				break;
595 595
 
596 596
 			case 'DROPDOWN' :
597
-					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 );
597
+					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);
598 598
 				break;
599 599
 
600 600
 
601 601
 			case 'RADIO_BTN' :
602
-					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 );
602
+					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);
603 603
 				break;
604 604
 
605 605
 			case 'CHECKBOX' :
606
-					return EEH_Form_Fields::checkbox( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
606
+					return EEH_Form_Fields::checkbox($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
607 607
 				break;
608 608
 
609 609
 			case 'DATE' :
610
-					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 );
610
+					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);
611 611
 				break;
612 612
 
613 613
 			case 'TEXT' :
614 614
 			default:
615
-					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 );
615
+					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);
616 616
 				break;
617 617
 
618 618
 		}
@@ -638,31 +638,31 @@  discard block
 block discarded – undo
638 638
 	 * @param string $disabled 		disabled="disabled" or null
639 639
 	 * @return string HTML
640 640
 	 */
641
-	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 ) {
641
+	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) {
642 642
 		// need these
643
-		if ( ! $question || ! $name ) {
643
+		if ( ! $question || ! $name) {
644 644
 			return NULL;
645 645
 		}
646 646
 		// prep the answer
647
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
647
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
648 648
 		// prep the required array
649
-		$required = self::prep_required( $required );
649
+		$required = self::prep_required($required);
650 650
 		// set disabled tag
651
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
651
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
652 652
 		// ya gots ta have style man!!!
653 653
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-text-inp';
654
-		$class = empty( $class ) ? $txt_class : $class;
655
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
656
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
654
+		$class = empty($class) ? $txt_class : $class;
655
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
656
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
657 657
 
658
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
658
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
659 659
 		// filter label but ensure required text comes before it
660
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
660
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
661 661
 
662
-		$input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" value="' . $answer . '"  title="' . esc_attr( $required['msg'] ) . '" ' . $disabled .' ' . $extra . '/>';
662
+		$input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" value="'.$answer.'"  title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>';
663 663
 
664
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
665
-		return  $label_html . $input_html;
664
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
665
+		return  $label_html.$input_html;
666 666
 
667 667
 	}
668 668
 
@@ -684,35 +684,35 @@  discard block
 block discarded – undo
684 684
 	 * @param string $disabled 		disabled="disabled" or null
685 685
 	 * @return string HTML
686 686
 	 */
687
-	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 ) {
687
+	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) {
688 688
 		// need these
689
-		if ( ! $question || ! $name ) {
689
+		if ( ! $question || ! $name) {
690 690
 			return NULL;
691 691
 		}
692 692
 		// prep the answer
693
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
693
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
694 694
 		// prep the required array
695
-		$required = self::prep_required( $required );
695
+		$required = self::prep_required($required);
696 696
 		// make sure $dimensions is an array
697
-		$dimensions = is_array( $dimensions ) ? $dimensions : array();
697
+		$dimensions = is_array($dimensions) ? $dimensions : array();
698 698
 		// and set some defaults
699
-		$dimensions = array_merge( array( 'rows' => 3, 'cols' => 40 ), $dimensions );
699
+		$dimensions = array_merge(array('rows' => 3, 'cols' => 40), $dimensions);
700 700
 		// set disabled tag
701
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
701
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
702 702
 		// ya gots ta have style man!!!
703 703
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-textarea-inp';
704
-		$class = empty( $class ) ? $txt_class : $class;
705
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
706
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
704
+		$class = empty($class) ? $txt_class : $class;
705
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
706
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
707 707
 
708
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
708
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
709 709
 		// filter label but ensure required text comes before it
710
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
710
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
711 711
 
712
-		$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>';
712
+		$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>';
713 713
 
714
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
715
-		return  $label_html . $input_html;
714
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
715
+		return  $label_html.$input_html;
716 716
 
717 717
 	}
718 718
 
@@ -735,47 +735,47 @@  discard block
 block discarded – undo
735 735
 	 * @param string $disabled 		disabled="disabled" or null
736 736
 	 * @return string HTML
737 737
 	 */
738
-	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 ) {
738
+	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) {
739 739
 
740 740
 		// need these
741
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
741
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
742 742
 			return NULL;
743 743
 		}
744 744
 		// prep the answer
745
-		$answer = is_array( $answer ) ? self::prep_answer( array_shift( $answer )) : self::prep_answer( $answer, $use_html_entities );
745
+		$answer = is_array($answer) ? self::prep_answer(array_shift($answer)) : self::prep_answer($answer, $use_html_entities);
746 746
 		// prep the required array
747
-		$required = self::prep_required( $required );
747
+		$required = self::prep_required($required);
748 748
 		// set disabled tag
749
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
749
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
750 750
 		// ya gots ta have style man!!!
751 751
 		$txt_class = is_admin() ? 'wide' : 'espresso-select-inp';
752
-		$class = empty( $class ) ? $txt_class : $class;
753
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
754
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
752
+		$class = empty($class) ? $txt_class : $class;
753
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
754
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
755 755
 
756
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
756
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
757 757
 		// filter label but ensure required text comes before it
758
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
758
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
759 759
 
760
-		$input_html = "\n\t\t\t" . '<select name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" title="' . esc_attr( $required['msg'] ) . '"' . $disabled . ' ' . $extra . '>';
760
+		$input_html = "\n\t\t\t".'<select name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" title="'.esc_attr($required['msg']).'"'.$disabled.' '.$extra.'>';
761 761
 		// recursively count array elements, to determine total number of options
762
-		$only_option = count( $options, 1 ) == 1 ? TRUE : FALSE;
763
-		if ( ! $only_option ) {
762
+		$only_option = count($options, 1) == 1 ? TRUE : FALSE;
763
+		if ( ! $only_option) {
764 764
 			// if there is NO answer set and there are multiple options to choose from, then set the "please select" message as selected
765 765
 			$selected = $answer === NULL ? ' selected="selected"' : '';
766
-			$input_html .= $add_please_select_option ? "\n\t\t\t\t" . '<option value=""' . $selected . '>' . __(' - please select - ', 'event_espresso') . '</option>' : '';
766
+			$input_html .= $add_please_select_option ? "\n\t\t\t\t".'<option value=""'.$selected.'>'.__(' - please select - ', 'event_espresso').'</option>' : '';
767 767
 		}
768
-		foreach ( $options as $key => $value ) {
768
+		foreach ($options as $key => $value) {
769 769
 			// if value is an array, then create option groups, else create regular ol' options
770
-			$input_html .= is_array( $value ) ? self::_generate_select_option_group( $key, $value, $answer ) : self::_generate_select_option( $value->value(), $value->desc(), $answer, $only_option );
770
+			$input_html .= is_array($value) ? self::_generate_select_option_group($key, $value, $answer) : self::_generate_select_option($value->value(), $value->desc(), $answer, $only_option);
771 771
 		}
772 772
 
773
-		$input_html .= "\n\t\t\t" . '</select>';
773
+		$input_html .= "\n\t\t\t".'</select>';
774 774
 
775
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID );
775
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID);
776 776
 
777
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
778
-		return  $label_html . $input_html;
777
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
778
+		return  $label_html.$input_html;
779 779
 
780 780
 	}
781 781
 
@@ -792,12 +792,12 @@  discard block
 block discarded – undo
792 792
 	 * @param mixed $answer
793 793
 	 * @return string
794 794
 	 */
795
-	private static function _generate_select_option_group( $opt_group, $QSOs, $answer ){
796
-		$html = "\n\t\t\t\t" . '<optgroup label="' . self::prep_option_value( $opt_group ) . '">';
797
-		foreach ( $QSOs as $QSO ) {
798
-			$html .= self::_generate_select_option( $QSO->value(), $QSO->desc(), $answer );
795
+	private static function _generate_select_option_group($opt_group, $QSOs, $answer) {
796
+		$html = "\n\t\t\t\t".'<optgroup label="'.self::prep_option_value($opt_group).'">';
797
+		foreach ($QSOs as $QSO) {
798
+			$html .= self::_generate_select_option($QSO->value(), $QSO->desc(), $answer);
799 799
 		}
800
-		$html .= "\n\t\t\t\t" . '</optgroup>';
800
+		$html .= "\n\t\t\t\t".'</optgroup>';
801 801
 		return $html;
802 802
 	}
803 803
 
@@ -811,12 +811,12 @@  discard block
 block discarded – undo
811 811
 	 * @param int $only_option
812 812
 	 * @return string
813 813
 	 */
814
-	private static function _generate_select_option( $key, $value, $answer, $only_option = FALSE ){
815
-		$key = self::prep_answer( $key );
816
-		$value = self::prep_answer( $value );
817
-		$value = ! empty( $value ) ? $value : $key;
818
-		$selected = ( $answer == $key || $only_option ) ? ' selected="selected"' : '';
819
-		return "\n\t\t\t\t" . '<option value="' . self::prep_option_value( $key ) . '"' . $selected . '> ' . $value . '&nbsp;&nbsp;&nbsp;</option>';
814
+	private static function _generate_select_option($key, $value, $answer, $only_option = FALSE) {
815
+		$key = self::prep_answer($key);
816
+		$value = self::prep_answer($value);
817
+		$value = ! empty($value) ? $value : $key;
818
+		$selected = ($answer == $key || $only_option) ? ' selected="selected"' : '';
819
+		return "\n\t\t\t\t".'<option value="'.self::prep_option_value($key).'"'.$selected.'> '.$value.'&nbsp;&nbsp;&nbsp;</option>';
820 820
 	}
821 821
 
822 822
 
@@ -840,56 +840,56 @@  discard block
 block discarded – undo
840 840
 	 * @param bool        $use_desc_4_label
841 841
 	 * @return string HTML
842 842
 	 */
843
-	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 ) {
843
+	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) {
844 844
 		// need these
845
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
845
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
846 846
 			return NULL;
847 847
 		}
848 848
 		// prep the answer
849
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
849
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
850 850
 		// prep the required array
851
-		$required = self::prep_required( $required );
851
+		$required = self::prep_required($required);
852 852
 		// set disabled tag
853
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
853
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
854 854
 		// ya gots ta have style man!!!
855 855
 		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
856
-		$class = ! empty( $class ) ? $class : 'espresso-radio-btn-inp';
857
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
856
+		$class = ! empty($class) ? $class : 'espresso-radio-btn-inp';
857
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
858 858
 
859
-		$label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> ';
859
+		$label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> ';
860 860
 		// filter label but ensure required text comes before it
861
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
861
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
862 862
 
863
-		$input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-radio-btn-options-ul ' . $label_class . ' ' . $class . '-ul">';
863
+		$input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-radio-btn-options-ul '.$label_class.' '.$class.'-ul">';
864 864
 
865
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
866
-		$class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : '';
865
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
866
+		$class .= ! empty($required['class']) ? ' '.$required['class'] : '';
867 867
 
868
-		foreach ( $options as $OPT ) {
869
-			if ( $OPT instanceof EE_Question_Option ) {
870
-				$value = self::prep_option_value( $OPT->value() );
868
+		foreach ($options as $OPT) {
869
+			if ($OPT instanceof EE_Question_Option) {
870
+				$value = self::prep_option_value($OPT->value());
871 871
 				$label = $use_desc_4_label ? $OPT->desc() : $OPT->value();
872
-				$size = $use_desc_4_label ? self::get_label_size_class( $OPT->value() . ' ' . $OPT->desc() ) : self::get_label_size_class( $OPT->value() );
873
-				$desc = $OPT->desc();//no self::prep_answer
874
-				$answer = is_numeric( $value ) && empty( $answer ) ? 0 : $answer;
875
-				$checked = (string)$value == (string)$answer ? ' checked="checked"' : '';
876
-				$opt = '-' . sanitize_key( $value );
877
-
878
-				$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
879
-				$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-radio-btn-lbl">';
880
-				$input_html .= $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $label . '</span>' : '';
881
-				$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 . '/>';
882
-				$input_html .= ! $label_b4  ? "\n\t\t\t\t\t\t" . '<span class="espresso-radio-btn-desc">' . $label . '</span>' : '';
883
-				$input_html .= "\n\t\t\t\t\t" . '</label>';
884
-				$input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">' . $desc . '</span>';
885
-				$input_html .= "\n\t\t\t\t" . '</li>';
872
+				$size = $use_desc_4_label ? self::get_label_size_class($OPT->value().' '.$OPT->desc()) : self::get_label_size_class($OPT->value());
873
+				$desc = $OPT->desc(); //no self::prep_answer
874
+				$answer = is_numeric($value) && empty($answer) ? 0 : $answer;
875
+				$checked = (string) $value == (string) $answer ? ' checked="checked"' : '';
876
+				$opt = '-'.sanitize_key($value);
877
+
878
+				$input_html .= "\n\t\t\t\t".'<li'.$size.'>';
879
+				$input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-radio-btn-lbl">';
880
+				$input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$label.'</span>' : '';
881
+				$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.'/>';
882
+				$input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span class="espresso-radio-btn-desc">'.$label.'</span>' : '';
883
+				$input_html .= "\n\t\t\t\t\t".'</label>';
884
+				$input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">'.$desc.'</span>';
885
+				$input_html .= "\n\t\t\t\t".'</li>';
886 886
 			}
887 887
 		}
888 888
 
889
-		$input_html .= "\n\t\t\t" . '</ul>';
889
+		$input_html .= "\n\t\t\t".'</ul>';
890 890
 
891
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
892
-		return  $label_html . $input_html;
891
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
892
+		return  $label_html.$input_html;
893 893
 
894 894
 	}
895 895
 
@@ -912,65 +912,65 @@  discard block
 block discarded – undo
912 912
 	 * @param string $disabled 		disabled="disabled" or null
913 913
 	 * @return string HTML
914 914
 	 */
915
-	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 ) {
915
+	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) {
916 916
 		// need these
917
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
917
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
918 918
 			return NULL;
919 919
 		}
920
-		$answer = maybe_unserialize( $answer );
920
+		$answer = maybe_unserialize($answer);
921 921
 
922 922
 		// prep the answer(s)
923
-		$answer = is_array( $answer ) ? $answer : array( sanitize_key( $answer ) => $answer );
923
+		$answer = is_array($answer) ? $answer : array(sanitize_key($answer) => $answer);
924 924
 
925
-		foreach ( $answer as $key => $value ) {
926
-			$key = self::prep_option_value( $key );
927
-			$answer[$key] = self::prep_answer( $value );
925
+		foreach ($answer as $key => $value) {
926
+			$key = self::prep_option_value($key);
927
+			$answer[$key] = self::prep_answer($value);
928 928
 		}
929 929
 
930 930
 		// prep the required array
931
-		$required = self::prep_required( $required );
931
+		$required = self::prep_required($required);
932 932
 		// set disabled tag
933
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
933
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
934 934
 		// ya gots ta have style man!!!
935 935
 		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
936
-		$class = empty( $class ) ? 'espresso-radio-btn-inp' : $class;
937
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
936
+		$class = empty($class) ? 'espresso-radio-btn-inp' : $class;
937
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
938 938
 
939
-		$label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> ';
939
+		$label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> ';
940 940
 		// filter label but ensure required text comes before it
941
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
942
-
943
-		$input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-checkbox-options-ul ' . $label_class . ' ' . $class . '-ul">';
944
-
945
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
946
-		$class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : '';
947
-
948
-		foreach ( $options as $OPT ) {
949
-			$value = $OPT->value();//self::prep_option_value( $OPT->value() );
950
-			$size = self::get_label_size_class(  $OPT->value() . ' ' . $OPT->desc() );
951
-			$text = self::prep_answer( $OPT->value() );
952
-			$desc = $OPT->desc() ;
953
-			$opt = '-' . sanitize_key( $value );
954
-
955
-			$checked = is_array( $answer ) && in_array( $text, $answer ) ? ' checked="checked"' : '';
956
-
957
-			$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
958
-			$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-checkbox-lbl">';
959
-			$input_html .= $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : '';
960
-			$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 . '/>';
961
-			$input_html .= ! $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : '';
962
- 			$input_html .= "\n\t\t\t\t\t" . '</label>';
963
-			if ( ! empty( $desc ) && $desc != $text ) {
964
-	 			$input_html .= "\n\t\t\t\t\t" . ' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">' . $desc . '</div>';
941
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
942
+
943
+		$input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-checkbox-options-ul '.$label_class.' '.$class.'-ul">';
944
+
945
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
946
+		$class .= ! empty($required['class']) ? ' '.$required['class'] : '';
947
+
948
+		foreach ($options as $OPT) {
949
+			$value = $OPT->value(); //self::prep_option_value( $OPT->value() );
950
+			$size = self::get_label_size_class($OPT->value().' '.$OPT->desc());
951
+			$text = self::prep_answer($OPT->value());
952
+			$desc = $OPT->desc();
953
+			$opt = '-'.sanitize_key($value);
954
+
955
+			$checked = is_array($answer) && in_array($text, $answer) ? ' checked="checked"' : '';
956
+
957
+			$input_html .= "\n\t\t\t\t".'<li'.$size.'>';
958
+			$input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-checkbox-lbl">';
959
+			$input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : '';
960
+			$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.'/>';
961
+			$input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : '';
962
+ 			$input_html .= "\n\t\t\t\t\t".'</label>';
963
+			if ( ! empty($desc) && $desc != $text) {
964
+	 			$input_html .= "\n\t\t\t\t\t".' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">'.$desc.'</div>';
965 965
 			}
966
-			$input_html .= "\n\t\t\t\t" . '</li>';
966
+			$input_html .= "\n\t\t\t\t".'</li>';
967 967
 
968 968
 		}
969 969
 
970
-		$input_html .= "\n\t\t\t" . '</ul>';
970
+		$input_html .= "\n\t\t\t".'</ul>';
971 971
 
972
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
973
-		return  $label_html . $input_html;
972
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
973
+		return  $label_html.$input_html;
974 974
 
975 975
 	}
976 976
 
@@ -992,36 +992,36 @@  discard block
 block discarded – undo
992 992
 	 * @param string $disabled 		disabled="disabled" or null
993 993
 	 * @return string HTML
994 994
 	 */
995
-	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 ) {
995
+	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) {
996 996
 		// need these
997
-		if ( ! $question || ! $name ) {
997
+		if ( ! $question || ! $name) {
998 998
 			return NULL;
999 999
 		}
1000 1000
 		// prep the answer
1001
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
1001
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
1002 1002
 		// prep the required array
1003
-		$required = self::prep_required( $required );
1003
+		$required = self::prep_required($required);
1004 1004
 		// set disabled tag
1005
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
1005
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
1006 1006
 		// ya gots ta have style man!!!
1007 1007
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-datepicker-inp';
1008
-		$class = empty( $class ) ? $txt_class : $class;
1009
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
1010
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
1008
+		$class = empty($class) ? $txt_class : $class;
1009
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
1010
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1011 1011
 
1012
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
1012
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
1013 1013
 		// filter label but ensure required text comes before it
1014
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
1014
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
1015 1015
 
1016
-		$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 . '/>';
1016
+		$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.'/>';
1017 1017
 
1018 1018
 		// enqueue scripts
1019
-		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 );
1020
-		wp_enqueue_style( 'espresso-ui-theme');
1021
-		wp_enqueue_script( 'jquery-ui-datepicker' );
1019
+		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);
1020
+		wp_enqueue_style('espresso-ui-theme');
1021
+		wp_enqueue_script('jquery-ui-datepicker');
1022 1022
 
1023
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
1024
-		return  $label_html . $input_html;
1023
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1024
+		return  $label_html.$input_html;
1025 1025
 
1026 1026
 	}
1027 1027
 
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 	 * 	@access public
1034 1034
 	 * 	@return 	string
1035 1035
 	 */
1036
-	public static function remove_label_keep_required_msg( $label_html, $required_text ) {
1036
+	public static function remove_label_keep_required_msg($label_html, $required_text) {
1037 1037
 		return $required_text;
1038 1038
 	}
1039 1039
 
@@ -1047,9 +1047,9 @@  discard block
 block discarded – undo
1047 1047
 	 * @param string $value
1048 1048
 	 * @return string HTML
1049 1049
 	 */
1050
-	static function hidden_input( $name, $value, $id = '' ){
1051
-		$id = ! empty( $id ) ? $id : $name;
1052
-		return '<input id="' . $id . '" type="hidden" name="'.$name.'" value="' .  $value . '"/>';
1050
+	static function hidden_input($name, $value, $id = '') {
1051
+		$id = ! empty($id) ? $id : $name;
1052
+		return '<input id="'.$id.'" type="hidden" name="'.$name.'" value="'.$value.'"/>';
1053 1053
 	}
1054 1054
 
1055 1055
 
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
 	 * @param string $question
1062 1062
 	 * @return string
1063 1063
 	 */
1064
-	static function prep_question( $question ){
1064
+	static function prep_question($question) {
1065 1065
 		return $question;
1066 1066
 //		$link = '';
1067 1067
 //		// does this label have a help link attached ?
@@ -1084,13 +1084,13 @@  discard block
 block discarded – undo
1084 1084
 	 * @param mixed $answer
1085 1085
 	 * @return string
1086 1086
 	 */
1087
-	static function prep_answer( $answer, $use_html_entities = TRUE ){
1087
+	static function prep_answer($answer, $use_html_entities = TRUE) {
1088 1088
 		//make sure we convert bools first.  Otherwise (bool) false becomes an empty string which is NOT desired, we want "0".
1089
-		if ( is_bool( $answer ) ) {
1089
+		if (is_bool($answer)) {
1090 1090
 			$answer = $answer ? 1 : 0;
1091 1091
 		}
1092
-		$answer = trim( stripslashes( str_replace( '&#039;', "'", $answer )));
1093
-		return $use_html_entities ? htmlentities( $answer, ENT_QUOTES, 'UTF-8' ) : $answer;
1092
+		$answer = trim(stripslashes(str_replace('&#039;', "'", $answer)));
1093
+		return $use_html_entities ? htmlentities($answer, ENT_QUOTES, 'UTF-8') : $answer;
1094 1094
 	}
1095 1095
 
1096 1096
 
@@ -1100,18 +1100,18 @@  discard block
 block discarded – undo
1100 1100
 	 * 	@param array $QSOs  array of EE_Question_Option objects
1101 1101
 	 * 	@return array
1102 1102
 	 */
1103
-	public static function prep_answer_options( $QSOs = array() ){
1103
+	public static function prep_answer_options($QSOs = array()) {
1104 1104
 		$prepped_answer_options = array();
1105
-		if ( is_array( $QSOs ) && ! empty( $QSOs )) {
1106
-			foreach( $QSOs as $key => $QSO ) {
1107
-				if ( ! $QSO instanceof EE_Question_Option ) {
1108
-					$QSO = EE_Question_Option::new_instance( array(
1109
-						'QSO_value' => is_array( $QSO ) && isset( $QSO['id'] ) ? (string)$QSO['id'] : (string)$key,
1110
-						'QSO_desc' => is_array( $QSO ) && isset( $QSO['text'] ) ? (string)$QSO['text'] : (string)$QSO
1105
+		if (is_array($QSOs) && ! empty($QSOs)) {
1106
+			foreach ($QSOs as $key => $QSO) {
1107
+				if ( ! $QSO instanceof EE_Question_Option) {
1108
+					$QSO = EE_Question_Option::new_instance(array(
1109
+						'QSO_value' => is_array($QSO) && isset($QSO['id']) ? (string) $QSO['id'] : (string) $key,
1110
+						'QSO_desc' => is_array($QSO) && isset($QSO['text']) ? (string) $QSO['text'] : (string) $QSO
1111 1111
 					));
1112 1112
 				}
1113
-				if ( $QSO->opt_group() ) {
1114
-					$prepped_answer_options[ $QSO->opt_group() ][] = $QSO;
1113
+				if ($QSO->opt_group()) {
1114
+					$prepped_answer_options[$QSO->opt_group()][] = $QSO;
1115 1115
 				} else {
1116 1116
 					$prepped_answer_options[] = $QSO;
1117 1117
 				}
@@ -1127,8 +1127,8 @@  discard block
 block discarded – undo
1127 1127
 	 * @param string $option_value
1128 1128
 	 * @return string
1129 1129
 	 */
1130
-	static function prep_option_value( $option_value ){
1131
-		return trim( stripslashes( $option_value ));
1130
+	static function prep_option_value($option_value) {
1131
+		return trim(stripslashes($option_value));
1132 1132
 	}
1133 1133
 
1134 1134
 
@@ -1139,11 +1139,11 @@  discard block
 block discarded – undo
1139 1139
 	 * @param string|array 	$required
1140 1140
 	 * @return array
1141 1141
 	 */
1142
-	static function prep_required( $required = array() ){
1142
+	static function prep_required($required = array()) {
1143 1143
 		// make sure required is an array
1144
-		$required = is_array( $required ) ? $required : array();
1144
+		$required = is_array($required) ? $required : array();
1145 1145
 		// and set some defaults
1146
-		$required = array_merge( array( 'label' => '', 'class' => '', 'msg' => '' ), $required );
1146
+		$required = array_merge(array('label' => '', 'class' => '', 'msg' => ''), $required);
1147 1147
 		return $required;
1148 1148
 	}
1149 1149
 
@@ -1154,30 +1154,30 @@  discard block
 block discarded – undo
1154 1154
 	 * @param string 	$value
1155 1155
 	 * @return string
1156 1156
 	 */
1157
-	static function get_label_size_class( $value = FALSE ){
1158
-			if ( $value === FALSE || $value == '' ) {
1157
+	static function get_label_size_class($value = FALSE) {
1158
+			if ($value === FALSE || $value == '') {
1159 1159
 				return ' class="medium-lbl"';
1160 1160
 			}
1161 1161
 			// determine length of option value
1162
-			$val_size = strlen( $value );
1163
-			switch( $val_size ){
1162
+			$val_size = strlen($value);
1163
+			switch ($val_size) {
1164 1164
 				case $val_size < 3 :
1165
-					$size =  ' class="nano-lbl"';
1165
+					$size = ' class="nano-lbl"';
1166 1166
 					break;
1167 1167
 				case $val_size < 6 :
1168
-					$size =  ' class="micro-lbl"';
1168
+					$size = ' class="micro-lbl"';
1169 1169
 					break;
1170 1170
 				case $val_size < 12 :
1171
-					$size =  ' class="tiny-lbl"';
1171
+					$size = ' class="tiny-lbl"';
1172 1172
 					break;
1173 1173
 				case $val_size < 25 :
1174
-					$size =  ' class="small-lbl"';
1174
+					$size = ' class="small-lbl"';
1175 1175
 					break;
1176 1176
 				case $val_size > 100 :
1177
-					$size =  ' class="big-lbl"';
1177
+					$size = ' class="big-lbl"';
1178 1178
 					break;
1179 1179
 				default:
1180
-					$size =  ' class="medium-lbl"';
1180
+					$size = ' class="medium-lbl"';
1181 1181
 					break;
1182 1182
 			}
1183 1183
 		return $size;
@@ -1191,20 +1191,20 @@  discard block
 block discarded – undo
1191 1191
 	 * @param array 	$QFI
1192 1192
 	 * @return array
1193 1193
 	 */
1194
-	private static function _load_system_dropdowns( $QFI ){
1194
+	private static function _load_system_dropdowns($QFI) {
1195 1195
 		$QST_system = $QFI->get('QST_system');
1196
-		switch ( $QST_system ) {
1196
+		switch ($QST_system) {
1197 1197
 			case 'state' :
1198
-				$QFI = self::generate_state_dropdown( $QFI );
1198
+				$QFI = self::generate_state_dropdown($QFI);
1199 1199
 				break;
1200 1200
 			case 'country' :
1201
-				$QFI = self::generate_country_dropdown( $QFI );
1201
+				$QFI = self::generate_country_dropdown($QFI);
1202 1202
 				break;
1203 1203
 			case 'admin-state' :
1204
-				$QFI = self::generate_state_dropdown( $QFI, TRUE );
1204
+				$QFI = self::generate_state_dropdown($QFI, TRUE);
1205 1205
 				break;
1206 1206
 			case 'admin-country' :
1207
-				$QFI = self::generate_country_dropdown( $QFI, TRUE );
1207
+				$QFI = self::generate_country_dropdown($QFI, TRUE);
1208 1208
 				break;
1209 1209
 		}
1210 1210
 		return $QFI;
@@ -1221,13 +1221,13 @@  discard block
 block discarded – undo
1221 1221
 	 *
1222 1222
 	 * @return EE_Question_Form_Input
1223 1223
 	 */
1224
-	protected static function _load_specialized_dropdowns( $QFI ) {
1225
-		switch( $QFI->get( 'QST_type' ) ) {
1224
+	protected static function _load_specialized_dropdowns($QFI) {
1225
+		switch ($QFI->get('QST_type')) {
1226 1226
 			case 'STATE' :
1227
-				$QFI = self::generate_state_dropdown( $QFI );
1227
+				$QFI = self::generate_state_dropdown($QFI);
1228 1228
 				break;
1229 1229
 			case 'COUNTRY' :
1230
-				$QFI = self::generate_country_dropdown( $QFI );
1230
+				$QFI = self::generate_country_dropdown($QFI);
1231 1231
 				break;
1232 1232
 		}
1233 1233
 		return $QFI;
@@ -1241,23 +1241,23 @@  discard block
 block discarded – undo
1241 1241
 	 * @param bool  $get_all
1242 1242
 	 * @return array
1243 1243
 	 */
1244
-	public static function generate_state_dropdown( $QST, $get_all = FALSE ){
1244
+	public static function generate_state_dropdown($QST, $get_all = FALSE) {
1245 1245
 		$states = $get_all ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_states_of_active_countries();
1246
-		if ( $states && count( $states ) != count( $QST->options() )) {
1247
-			$QST->set( 'QST_type', 'DROPDOWN' );
1246
+		if ($states && count($states) != count($QST->options())) {
1247
+			$QST->set('QST_type', 'DROPDOWN');
1248 1248
 			// if multiple countries, we'll create option groups within the dropdown
1249
-			foreach ( $states as $state ) {
1250
-				if ( $state instanceof EE_State ) {
1251
-					$QSO = EE_Question_Option::new_instance ( array (
1249
+			foreach ($states as $state) {
1250
+				if ($state instanceof EE_State) {
1251
+					$QSO = EE_Question_Option::new_instance(array(
1252 1252
 						'QSO_value' => $state->ID(),
1253 1253
 						'QSO_desc' => $state->name(),
1254
-						'QST_ID' => $QST->get( 'QST_ID' ),
1254
+						'QST_ID' => $QST->get('QST_ID'),
1255 1255
 						'QSO_deleted' => FALSE
1256 1256
 					));
1257 1257
 					// set option group
1258
-					$QSO->set_opt_group( $state->country()->name() );
1258
+					$QSO->set_opt_group($state->country()->name());
1259 1259
 					// add option to question
1260
-					$QST->add_temp_option( $QSO );
1260
+					$QST->add_temp_option($QSO);
1261 1261
 				}
1262 1262
 			}
1263 1263
 		}
@@ -1273,20 +1273,20 @@  discard block
 block discarded – undo
1273 1273
 	 * @internal param array $question
1274 1274
 	 * @return array
1275 1275
 	 */
1276
-	public static function generate_country_dropdown( $QST, $get_all = FALSE ){
1276
+	public static function generate_country_dropdown($QST, $get_all = FALSE) {
1277 1277
 		$countries = $get_all ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries();
1278
-		if ( $countries && count( $countries ) != count( $QST->options() ) ) {
1279
-			$QST->set( 'QST_type', 'DROPDOWN' );
1278
+		if ($countries && count($countries) != count($QST->options())) {
1279
+			$QST->set('QST_type', 'DROPDOWN');
1280 1280
 			// now add countries
1281
-			foreach ( $countries as $country ) {
1282
-				if ( $country instanceof EE_Country ) {
1283
-					$QSO = EE_Question_Option::new_instance ( array (
1281
+			foreach ($countries as $country) {
1282
+				if ($country instanceof EE_Country) {
1283
+					$QSO = EE_Question_Option::new_instance(array(
1284 1284
 						'QSO_value' => $country->ID(),
1285 1285
 						'QSO_desc' => $country->name(),
1286
-						'QST_ID' => $QST->get( 'QST_ID' ),
1286
+						'QST_ID' => $QST->get('QST_ID'),
1287 1287
 						'QSO_deleted' => FALSE
1288 1288
 					));
1289
-					$QST->add_temp_option( $QSO );
1289
+					$QST->add_temp_option($QSO);
1290 1290
 				}
1291 1291
 			}
1292 1292
 		}
@@ -1303,11 +1303,11 @@  discard block
 block discarded – undo
1303 1303
 	 */
1304 1304
 	public static function two_digit_months_dropdown_options() {
1305 1305
 		$options = array();
1306
-		for ( $x = 1; $x <= 12; $x++ ) {
1307
-			$mm = str_pad( $x, 2, '0', STR_PAD_LEFT );
1308
-			$options[ (string)$mm ] = (string)$mm;
1306
+		for ($x = 1; $x <= 12; $x++) {
1307
+			$mm = str_pad($x, 2, '0', STR_PAD_LEFT);
1308
+			$options[(string) $mm] = (string) $mm;
1309 1309
 		}
1310
-		return EEH_Form_Fields::prep_answer_options( $options );
1310
+		return EEH_Form_Fields::prep_answer_options($options);
1311 1311
 	}
1312 1312
 
1313 1313
 
@@ -1322,11 +1322,11 @@  discard block
 block discarded – undo
1322 1322
 		$options = array();
1323 1323
 		$current_year = date('y');
1324 1324
 		$next_decade = $current_year + 10;
1325
-		for ( $x = $current_year; $x <= $next_decade; $x++ ) {
1326
-			$yy = str_pad( $x, 2, '0', STR_PAD_LEFT );
1327
-			$options[ (string)$yy ] = (string)$yy;
1325
+		for ($x = $current_year; $x <= $next_decade; $x++) {
1326
+			$yy = str_pad($x, 2, '0', STR_PAD_LEFT);
1327
+			$options[(string) $yy] = (string) $yy;
1328 1328
 		}
1329
-		return EEH_Form_Fields::prep_answer_options( $options );
1329
+		return EEH_Form_Fields::prep_answer_options($options);
1330 1330
 	}
1331 1331
 
1332 1332
 
@@ -1340,17 +1340,17 @@  discard block
 block discarded – undo
1340 1340
 	 * @param  integer $evt_category Event Category ID if the Event Category filter is selected
1341 1341
 	 * @return string                html
1342 1342
 	 */
1343
-	public static function generate_registration_months_dropdown( $cur_date = '', $status = '', $evt_category = 0 ) {
1343
+	public static function generate_registration_months_dropdown($cur_date = '', $status = '', $evt_category = 0) {
1344 1344
 		$_where = array();
1345
-		if ( !empty( $status ) ) {
1345
+		if ( ! empty($status)) {
1346 1346
 			$_where['STS_ID'] = $status;
1347 1347
 		}
1348 1348
 
1349
-		if ( $evt_category > 0 ) {
1349
+		if ($evt_category > 0) {
1350 1350
 			$_where['Event.Term_Taxonomy.term_id'] = $evt_category;
1351 1351
 		}
1352 1352
 
1353
-		$regdtts = EEM_Registration::instance()->get_reg_months_and_years( $_where );
1353
+		$regdtts = EEM_Registration::instance()->get_reg_months_and_years($_where);
1354 1354
 
1355 1355
 		//setup vals for select input helper
1356 1356
 		$options = array(
@@ -1360,15 +1360,15 @@  discard block
 block discarded – undo
1360 1360
 				)
1361 1361
 			);
1362 1362
 
1363
-		foreach ( $regdtts as $regdtt ) {
1364
-			$date = $regdtt->reg_month. ' ' . $regdtt->reg_year;
1363
+		foreach ($regdtts as $regdtt) {
1364
+			$date = $regdtt->reg_month.' '.$regdtt->reg_year;
1365 1365
 			$options[] = array(
1366 1366
 				'text' => $date,
1367 1367
 				'id' => $date
1368 1368
 				);
1369 1369
 		}
1370 1370
 
1371
-		return self::select_input('month_range', $options, $cur_date, '', 'wide' );
1371
+		return self::select_input('month_range', $options, $cur_date, '', 'wide');
1372 1372
 	}
1373 1373
 
1374 1374
 
@@ -1382,18 +1382,18 @@  discard block
 block discarded – undo
1382 1382
 	 * @param  string $evt_active_status "upcoming", "expired", "active", or "inactive"
1383 1383
 	 * @return string                    html
1384 1384
 	 */
1385
-	public static function generate_event_months_dropdown( $cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL ) {
1385
+	public static function generate_event_months_dropdown($cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL) {
1386 1386
 		//determine what post_status our condition will have for the query.
1387
-		switch ( $status ) {
1387
+		switch ($status) {
1388 1388
 			case 'month' :
1389 1389
 			case 'today' :
1390 1390
 			case NULL :
1391 1391
 			case 'all' :
1392
-				$where['Event.status'] = array( 'NOT IN', array('trash') );
1392
+				$where['Event.status'] = array('NOT IN', array('trash'));
1393 1393
 				break;
1394 1394
 
1395 1395
 			case 'draft' :
1396
-				$where['Event.status'] = array( 'IN', array('draft', 'auto-draft') );
1396
+				$where['Event.status'] = array('IN', array('draft', 'auto-draft'));
1397 1397
 
1398 1398
 			default :
1399 1399
 				$where['Event.status'] = $status;
@@ -1402,7 +1402,7 @@  discard block
 block discarded – undo
1402 1402
 		//categories?
1403 1403
 
1404 1404
 
1405
-		if ( !empty ( $evt_category ) ) {
1405
+		if ( ! empty ($evt_category)) {
1406 1406
 			$where['Event.Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1407 1407
 			$where['Event.Term_Taxonomy.term_id'] = $evt_category;
1408 1408
 		}
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
 
1411 1411
 //		$where['DTT_is_primary'] = 1;
1412 1412
 
1413
-		$DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status );
1413
+		$DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status);
1414 1414
 
1415 1415
 		//let's setup vals for select input helper
1416 1416
 		$options = array(
@@ -1423,9 +1423,9 @@  discard block
 block discarded – undo
1423 1423
 		//translate month and date
1424 1424
 		global $wp_locale;
1425 1425
 
1426
-		foreach ( $DTTS as $DTT ) {
1427
-			$localized_date = $wp_locale->get_month( date('m', strtotime($DTT->dtt_month)) ) . ' ' . $DTT->dtt_year;
1428
-			$id = $DTT->dtt_month . ' ' . $DTT->dtt_year;
1426
+		foreach ($DTTS as $DTT) {
1427
+			$localized_date = $wp_locale->get_month(date('m', strtotime($DTT->dtt_month))).' '.$DTT->dtt_year;
1428
+			$id = $DTT->dtt_month.' '.$DTT->dtt_year;
1429 1429
 			$options[] = array(
1430 1430
 				'text' => $localized_date,
1431 1431
 				'id' => $id
@@ -1433,7 +1433,7 @@  discard block
 block discarded – undo
1433 1433
 		}
1434 1434
 
1435 1435
 
1436
-		return self::select_input( 'month_range', $options, $cur_date, '', 'wide' );
1436
+		return self::select_input('month_range', $options, $cur_date, '', 'wide');
1437 1437
 	}
1438 1438
 
1439 1439
 
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
 	 * @param  integer $current_cat currently selected category
1445 1445
 	 * @return string               html for dropdown
1446 1446
 	 */
1447
-	public static function generate_event_category_dropdown( $current_cat = -1 ) {
1447
+	public static function generate_event_category_dropdown($current_cat = -1) {
1448 1448
 		$categories = EEM_Term::instance()->get_all_ee_categories(TRUE);
1449 1449
 		$options = array(
1450 1450
 			'0' => array(
@@ -1454,14 +1454,14 @@  discard block
 block discarded – undo
1454 1454
 			);
1455 1455
 
1456 1456
 		//setup categories for dropdown
1457
-		foreach ( $categories as $category ) {
1457
+		foreach ($categories as $category) {
1458 1458
 			$options[] = array(
1459 1459
 				'text' => $category->get('name'),
1460 1460
 				'id' => $category->ID()
1461 1461
 				);
1462 1462
 		}
1463 1463
 
1464
-		return self::select_input( 'EVT_CAT', $options, $current_cat );
1464
+		return self::select_input('EVT_CAT', $options, $current_cat);
1465 1465
 	}
1466 1466
 
1467 1467
 
@@ -1480,20 +1480,20 @@  discard block
 block discarded – undo
1480 1480
 	 * @param    string   $extra_attributes - any extra attributes that need to be attached to the form input
1481 1481
 	 * @return    void
1482 1482
 	 */
1483
-	public static function submit_button( $url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '' ) {
1483
+	public static function submit_button($url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '') {
1484 1484
 		$btn = '';
1485
-		if ( empty( $url ) || empty( $ID )) {
1485
+		if (empty($url) || empty($ID)) {
1486 1486
 			return $btn;
1487 1487
 		}
1488
-		$text = ! empty( $text ) ? $text : __('Submit', 'event_espresso' );
1489
-		$btn .= '<input id="' . $ID . '-btn" class="' . $class . '" type="submit" value="' . $text . '" ' . $extra_attributes . '/>';
1490
-		if ( ! $input_only ) {
1491
-			$btn_frm = '<form id="' . $ID . '-frm" method="POST" action="' . $url . '">';
1492
-			$btn_frm .= ! empty( $nonce_action ) ? wp_nonce_field( $nonce_action, $nonce_action . '_nonce', TRUE, FALSE ) : '';
1488
+		$text = ! empty($text) ? $text : __('Submit', 'event_espresso');
1489
+		$btn .= '<input id="'.$ID.'-btn" class="'.$class.'" type="submit" value="'.$text.'" '.$extra_attributes.'/>';
1490
+		if ( ! $input_only) {
1491
+			$btn_frm = '<form id="'.$ID.'-frm" method="POST" action="'.$url.'">';
1492
+			$btn_frm .= ! empty($nonce_action) ? wp_nonce_field($nonce_action, $nonce_action.'_nonce', TRUE, FALSE) : '';
1493 1493
 			$btn_frm .= $btn;
1494 1494
 			$btn_frm .= '</form>';
1495 1495
 			$btn = $btn_frm;
1496
-			unset ( $btn_frm );
1496
+			unset ($btn_frm);
1497 1497
 		}
1498 1498
 		return $btn;
1499 1499
 	}
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -366,14 +366,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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++) {
Please login to merge, or discard this patch.
core/helpers/EEH_Money.helper.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  *
21 21
  * ------------------------------------------------------------------------
22 22
  */
23
-class EEH_Money extends EEH_Base  {
23
+class EEH_Money extends EEH_Base {
24 24
 
25 25
 
26 26
 	/**
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	 * @param int|string $incoming_value
30 30
 	 * @return float
31 31
 	 */
32
-	public static function convert_to_float_from_localized_money( $incoming_value ) {
32
+	public static function convert_to_float_from_localized_money($incoming_value) {
33 33
 		//remove thousands separator
34
-		$money_value = str_replace( EE_Registry::instance()->CFG->currency->thsnds, '', $incoming_value );
34
+		$money_value = str_replace(EE_Registry::instance()->CFG->currency->thsnds, '', $incoming_value);
35 35
 
36 36
 		//replace decimal place with standard decimal.
37
-		$money_value = str_replace( EE_Registry::instance()->CFG->currency->dec_mrk, '.', $money_value );
37
+		$money_value = str_replace(EE_Registry::instance()->CFG->currency->dec_mrk, '.', $money_value);
38 38
 
39 39
 		//float it! and round to three decimal places
40
-		$money_value = round ( (float) $money_value, 3 );
40
+		$money_value = round((float) $money_value, 3);
41 41
 		return $money_value;
42 42
 	}
43 43
 
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	 * @throws \EE_Error
58 58
 	 */
59 59
 
60
-	public static function compare_floats( $float1, $float2, $operator='=' ) {
60
+	public static function compare_floats($float1, $float2, $operator = '=') {
61 61
 		// Check numbers to 5 digits of precision
62 62
 		$epsilon = 0.00001;
63 63
 
64
-		$float1 = (float)$float1;
65
-		$float2 = (float)$float2;
64
+		$float1 = (float) $float1;
65
+		$float2 = (float) $float2;
66 66
 
67 67
 		switch ($operator) {
68 68
 			// equal
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 				}
117 117
 				break;
118 118
 			default:
119
-				throw new EE_Error(__( "Unknown operator '" . $operator . "' in EEH_Money::compare_floats()", 'event_espresso' ) );
119
+				throw new EE_Error(__("Unknown operator '".$operator."' in EEH_Money::compare_floats()", 'event_espresso'));
120 120
 		}
121 121
 
122 122
 		return false;
@@ -131,21 +131,21 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @return string
133 133
 	 */
134
-	public static function get_format_for_jqplot( $CNT_ISO = '') {
134
+	public static function get_format_for_jqplot($CNT_ISO = '') {
135 135
 		//default format
136 136
 		$format = 'f';
137 137
 		//if CNT_ISO passed lets try to get currency settings for it.
138
-		$currency_config = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : null;
138
+		$currency_config = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null;
139 139
 		//default currency settings for site if not set
140
-		if ( ! $currency_config instanceof EE_Currency_Config ) {
140
+		if ( ! $currency_config instanceof EE_Currency_Config) {
141 141
 			$currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config();
142 142
 		}
143 143
 
144 144
 		//first get the decimal place and number of places
145
-		$format = "%'." . $currency_config->dec_plc . $format;
145
+		$format = "%'.".$currency_config->dec_plc.$format;
146 146
 
147 147
 		//currency symbol on right side.
148
-		$format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign;
148
+		$format = $currency_config->sign_b4 ? $currency_config->sign.$format : $format.$currency_config->sign;
149 149
 		return $format;
150 150
 	}
151 151
 
Please login to merge, or discard this patch.
core/interfaces/EEI_Duplicatable.interface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
26 26
 	 *	with the exception of a particular attribute
27 27
 	 * @return object of the same class as what was called on
28 28
 	 */
29
-	public function duplicate( $options = array() );
29
+	public function duplicate($options = array());
30 30
 
31 31
 
32 32
 
Please login to merge, or discard this patch.
core/libraries/form_sections/base/EE_Form_Section_Proper.form.php 2 patches
Spacing   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * before the hook wp_enqueue_scripts is called (so that the form section can enqueue its needed scripts).
8 8
  * However, you may output the form (usually by calling get_html_and_js) anywhere you like.
9 9
  */
10
-class EE_Form_Section_Proper extends EE_Form_Section_Validatable{
10
+class EE_Form_Section_Proper extends EE_Form_Section_Validatable {
11 11
 
12 12
 	/**
13 13
 	 * Subsections
@@ -68,38 +68,38 @@  discard block
 block discarded – undo
68 68
 	 * } @see EE_Form_Section_Validatable::__construct()
69 69
 	 *
70 70
 	 */
71
-	public function __construct( $options_array = array() ){
71
+	public function __construct($options_array = array()) {
72 72
 		EE_Registry::instance()->load_helper('Formatter');
73
-		$options_array = apply_filters( 'FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this );
73
+		$options_array = apply_filters('FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this);
74 74
 		//call parent first, as it may be setting the name
75 75
 		parent::__construct($options_array);
76 76
 		//if they've included subsections in the constructor, add them now
77
-		if( isset( $options_array['include'] )){
77
+		if (isset($options_array['include'])) {
78 78
 			//we are going to make sure we ONLY have those subsections to include
79 79
 			//AND we are going to make sure they're in that specified order
80 80
 			$reordered_subsections = array();
81
-			foreach($options_array['include'] as $input_name){
82
-				if(isset($this->_subsections[$input_name])){
81
+			foreach ($options_array['include'] as $input_name) {
82
+				if (isset($this->_subsections[$input_name])) {
83 83
 					$reordered_subsections[$input_name] = $this->_subsections[$input_name];
84 84
 				}
85 85
 			}
86 86
 			$this->_subsections = $reordered_subsections;
87 87
 		}
88
-		if(isset($options_array['exclude'])){
88
+		if (isset($options_array['exclude'])) {
89 89
 			$exclude = $options_array['exclude'];
90 90
 			$this->_subsections = array_diff_key($this->_subsections, array_flip($exclude));
91 91
 		}
92
-		if(isset($options_array['layout_strategy'])){
92
+		if (isset($options_array['layout_strategy'])) {
93 93
 			$this->_layout_strategy = $options_array['layout_strategy'];
94 94
 		}
95
-		if( ! $this->_layout_strategy){
95
+		if ( ! $this->_layout_strategy) {
96 96
 			$this->_layout_strategy = new EE_Two_Column_Layout();
97 97
 		}
98 98
 		$this->_layout_strategy->_construct_finalize($this);
99 99
 
100
-		add_action( 'wp_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
101
-		add_action( 'admin_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
102
-		add_action( 'wp_footer', array( $this, 'ensure_scripts_localized' ), 1 );
100
+		add_action('wp_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
101
+		add_action('admin_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
102
+		add_action('wp_footer', array($this, 'ensure_scripts_localized'), 1);
103 103
 	}
104 104
 
105 105
 
@@ -111,25 +111,25 @@  discard block
 block discarded – undo
111 111
 	 * @param string                 $name
112 112
 	 * @throws \EE_Error
113 113
 	 */
114
-	public function _construct_finalize( $parent_form_section, $name ) {
114
+	public function _construct_finalize($parent_form_section, $name) {
115 115
 		parent::_construct_finalize($parent_form_section, $name);
116 116
 		$this->_set_default_name_if_empty();
117 117
 		$this->_set_default_html_id_if_empty();
118
-		foreach( $this->_subsections as $subsection_name => $subsection ){
119
-			if ( $subsection instanceof EE_Form_Section_Base ) {
120
-				$subsection->_construct_finalize( $this, $subsection_name );
118
+		foreach ($this->_subsections as $subsection_name => $subsection) {
119
+			if ($subsection instanceof EE_Form_Section_Base) {
120
+				$subsection->_construct_finalize($this, $subsection_name);
121 121
 			} else {
122 122
 				throw new EE_Error(
123 123
 					sprintf(
124
-						__( 'Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso' ),
124
+						__('Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso'),
125 125
 						$subsection_name,
126 126
 						get_class($this),
127
-						$subsection ? get_class($subsection) : __( 'NULL', 'event_espresso' )
127
+						$subsection ? get_class($subsection) : __('NULL', 'event_espresso')
128 128
 					)
129 129
 				);
130 130
 			}
131 131
 		}
132
-		do_action( 'AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name );
132
+		do_action('AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name);
133 133
 	}
134 134
 
135 135
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * Gets the layout strategy for this form section
139 139
 	 * @return EE_Form_Section_Layout_Base
140 140
 	 */
141
-	public function get_layout_strategy(){
141
+	public function get_layout_strategy() {
142 142
 		return $this->_layout_strategy;
143 143
 	}
144 144
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 * @param EE_Form_Input_Base $input
151 151
 	 * @return string
152 152
 	 */
153
-	public function get_html_for_input($input){
153
+	public function get_html_for_input($input) {
154 154
 		return $this->_layout_strategy->layout_input($input);
155 155
 	}
156 156
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @param null $form_data
164 164
 	 * @return boolean
165 165
 	 */
166
-	public function was_submitted($form_data = NULL){
166
+	public function was_submitted($form_data = NULL) {
167 167
 		return $this->form_data_present_in($form_data);
168 168
 	}
169 169
 
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
 	 * to skip this step.
185 185
 	 * @return void
186 186
 	 */
187
-	public function receive_form_submission($req_data = NULL, $validate = TRUE){
188
-		if( $req_data === NULL){
187
+	public function receive_form_submission($req_data = NULL, $validate = TRUE) {
188
+		if ($req_data === NULL) {
189 189
 			$req_data = $_REQUEST;
190 190
 		}
191 191
 		$this->_normalize($req_data);
192
-		if( $validate ){
192
+		if ($validate) {
193 193
 			$this->_validate();
194 194
 		}
195 195
 	}
@@ -204,12 +204,12 @@  discard block
 block discarded – undo
204 204
 	 * the value being an array formatted in teh same way
205 205
 	 * @param array $default_data
206 206
 	 */
207
-	public function populate_defaults($default_data){
208
-		foreach($this->subsections() as $subsection_name => $subsection){
209
-			if(isset($default_data[$subsection_name])){
210
-				if($subsection instanceof EE_Form_Input_Base){
207
+	public function populate_defaults($default_data) {
208
+		foreach ($this->subsections() as $subsection_name => $subsection) {
209
+			if (isset($default_data[$subsection_name])) {
210
+				if ($subsection instanceof EE_Form_Input_Base) {
211 211
 					$subsection->set_default($default_data[$subsection_name]);
212
-				}elseif($subsection instanceof EE_Form_Section_Proper){
212
+				}elseif ($subsection instanceof EE_Form_Section_Proper) {
213 213
 					$subsection->populate_defaults($default_data[$subsection_name]);
214 214
 				}
215 215
 			}
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 	 * (realizing that the subsections' html names might not be set yet, etc.)
228 228
 	 * @return EE_Form_Section_Base
229 229
 	 */
230
-	public function get_subsection($name, $require_construction_to_be_finalized = TRUE ){
231
-		if( $require_construction_to_be_finalized ){
230
+	public function get_subsection($name, $require_construction_to_be_finalized = TRUE) {
231
+		if ($require_construction_to_be_finalized) {
232 232
 			$this->ensure_construct_finalized_called();
233 233
 		}
234 234
 		return isset($this->_subsections[$name]) ? $this->_subsections[$name] : NULL;
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
 	 * Gets all the validatable subsections of this form section
241 241
 	 * @return EE_Form_Section_Validatable[]
242 242
 	 */
243
-	public function get_validatable_subsections(){
243
+	public function get_validatable_subsections() {
244 244
 		$validatable_subsections = array();
245
-		foreach($this->subsections() as $name=>$obj){
246
-			if($obj instanceof EE_Form_Section_Validatable){
245
+		foreach ($this->subsections() as $name=>$obj) {
246
+			if ($obj instanceof EE_Form_Section_Validatable) {
247 247
 				$validatable_subsections[$name] = $obj;
248 248
 			}
249 249
 		}
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
 	 * @return EE_Form_Input_Base
264 264
 	 * @throws EE_Error
265 265
 	 */
266
-	public function get_input($name, $require_construction_to_be_finalized = TRUE ){
266
+	public function get_input($name, $require_construction_to_be_finalized = TRUE) {
267 267
 		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
268
-		if( ! $subsection instanceof EE_Form_Input_Base){
269
-			throw new EE_Error(sprintf(__("Subsection '%s' is not an instanceof EE_Form_Input_Base on form '%s'. It is a '%s'", 'event_espresso'),$name, get_class($this),$subsection ? get_class($subsection) : __("NULL", 'event_espresso')));
268
+		if ( ! $subsection instanceof EE_Form_Input_Base) {
269
+			throw new EE_Error(sprintf(__("Subsection '%s' is not an instanceof EE_Form_Input_Base on form '%s'. It is a '%s'", 'event_espresso'), $name, get_class($this), $subsection ? get_class($subsection) : __("NULL", 'event_espresso')));
270 270
 		}
271 271
 		return $subsection;
272 272
 	}
@@ -284,10 +284,10 @@  discard block
 block discarded – undo
284 284
 	 * @return EE_Form_Section_Proper
285 285
 	 * @throws EE_Error
286 286
 	 */
287
-	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE ){
288
-		$subsection = $this->get_subsection( $name, $require_construction_to_be_finalized );
289
-		if( ! $subsection instanceof EE_Form_Section_Proper){
290
-			throw new EE_Error(sprintf(__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'),$name, get_class($this)));
287
+	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE) {
288
+		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
289
+		if ( ! $subsection instanceof EE_Form_Section_Proper) {
290
+			throw new EE_Error(sprintf(__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'), $name, get_class($this)));
291 291
 		}
292 292
 		return $subsection;
293 293
 	}
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * @param string $name
301 301
 	 * @return mixed depending on the input's type and its normalization strategy
302 302
 	 */
303
-	public function get_input_value($name){
303
+	public function get_input_value($name) {
304 304
 		$input = $this->get_input($name);
305 305
 		return $input->normalized_value();
306 306
 	}
@@ -313,16 +313,16 @@  discard block
 block discarded – undo
313 313
 	 * @return boolean
314 314
 	 */
315 315
 	public function is_valid() {
316
-		if( ! $this->has_received_submission()){
316
+		if ( ! $this->has_received_submission()) {
317 317
 			throw new EE_Error(sprintf(__("You cannot check if a form is valid before receiving the form submission using receive_form_submission", "event_espresso")));
318 318
 		}
319
-		if( ! parent::is_valid()){
319
+		if ( ! parent::is_valid()) {
320 320
 			return false;
321 321
 		}
322 322
 		//ok so no errors general to this entire form section. so let's check the subsections
323
-		foreach( $this->get_validatable_subsections() as $subsection ){
324
-			if( ! $subsection->is_valid() || $subsection->get_validation_error_string() != '' ){
325
-				$this->set_submission_error_message( $subsection->get_validation_error_string() );
323
+		foreach ($this->get_validatable_subsections() as $subsection) {
324
+			if ( ! $subsection->is_valid() || $subsection->get_validation_error_string() != '') {
325
+				$this->set_submission_error_message($subsection->get_validation_error_string());
326 326
 				return false;
327 327
 			}
328 328
 		}
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
 	 * gets teh default name of this form section if none is specified
336 336
 	 * @return string
337 337
 	 */
338
-	protected function _set_default_name_if_empty(){
339
-		if( ! $this->_name ){
338
+	protected function _set_default_name_if_empty() {
339
+		if ( ! $this->_name) {
340 340
 			$classname = get_class($this);
341 341
 			$default_name = str_replace("EE_", "", $classname);
342
-			$this->_name =  $default_name;
342
+			$this->_name = $default_name;
343 343
 		}
344 344
 	}
345 345
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	 * Also returns the HTML for the form, except for the form opening and closing tags
351 351
 	 * (as the form section doesn't know where you necessarily want to send the information to), and except for a submit button.
352 352
 	 */
353
-	public function get_html_and_js(){
353
+	public function get_html_and_js() {
354 354
 		$this->enqueue_js();
355 355
 		return $this->get_html();
356 356
 	}
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 	 * returns HTML for displaying this form section. recursively calls display_section() on all subsections
362 362
 	 * @return string
363 363
 	 */
364
-	public function get_html(){
364
+	public function get_html() {
365 365
 		$this->ensure_construct_finalized_called();
366 366
 		return $this->_layout_strategy->layout_form();
367 367
 	}
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 * enqueues JS for the form
373 373
 	 * @return string
374 374
 	 */
375
-	public function enqueue_js(){
375
+	public function enqueue_js() {
376 376
 		$this->_enqueue_and_localize_form_js();
377 377
 	}
378 378
 
@@ -387,9 +387,9 @@  discard block
 block discarded – undo
387 387
 	 * could change until it's actually outputted)
388 388
 	 * @return void
389 389
 	 */
390
-	public static function wp_enqueue_scripts(){
391
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
392
-		wp_register_script( 'ee_form_section_validation', EE_GLOBAL_ASSETS_URL . 'scripts' . DS . 'form_section_validation.js', array( 'jquery-validate', 'jquery-ui-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE );
390
+	public static function wp_enqueue_scripts() {
391
+		add_filter('FHEE_load_jquery_validate', '__return_true');
392
+		wp_register_script('ee_form_section_validation', EE_GLOBAL_ASSETS_URL.'scripts'.DS.'form_section_validation.js', array('jquery-validate', 'jquery-ui-datepicker'), EVENT_ESPRESSO_VERSION, TRUE);
393 393
 	}
394 394
 
395 395
 
@@ -399,14 +399,14 @@  discard block
 block discarded – undo
399 399
 	 * This needs to be called AFTER we've called $this->_enqueue_jquery_validate_script,
400 400
 	 * but before the wordpress hook wp_loaded
401 401
 	 */
402
-	public function _enqueue_and_localize_form_js(){
402
+	public function _enqueue_and_localize_form_js() {
403 403
 		$this->ensure_construct_finalized_called();
404 404
 		//actually, we don't want to localize just yet. There may be other forms on the page.
405 405
 		//so we need to add our form section data to a static variable accessible by all form sections
406 406
 		//and localize it just before the footer
407 407
 		$this->localize_validation_rules();
408
-		add_action( 'wp_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ), 2 );
409
-		add_action( 'admin_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ) );
408
+		add_action('wp_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'), 2);
409
+		add_action('admin_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'));
410 410
 	}
411 411
 
412 412
 
@@ -416,11 +416,11 @@  discard block
 block discarded – undo
416 416
 	 * @param bool $return_for_subsection
417 417
 	 * @return void
418 418
 	 */
419
-	public function localize_validation_rules( $return_for_subsection = FALSE ){
419
+	public function localize_validation_rules($return_for_subsection = FALSE) {
420 420
 		// we only want to localize vars ONCE for the entire form, so if the form section doesn't have a parent, then it must be the top dog
421
-		if ( ! $this->parent_section() || $return_for_subsection ) {
422
-			EE_Form_Section_Proper::$_js_localization['form_data'][ $this->html_id() ] = array(
423
-				'form_section_id'=> $this->html_id( TRUE ),
421
+		if ( ! $this->parent_section() || $return_for_subsection) {
422
+			EE_Form_Section_Proper::$_js_localization['form_data'][$this->html_id()] = array(
423
+				'form_section_id'=> $this->html_id(TRUE),
424 424
 				'validation_rules'=> $this->get_jquery_validation_rules(),
425 425
 				'errors'=> $this->subsection_validation_errors_by_html_name()
426 426
 			);
@@ -435,12 +435,12 @@  discard block
 block discarded – undo
435 435
 	 * Keys are their form names, and values are the inputs themselves
436 436
 	 * @return EE_Form_Input_Base
437 437
 	 */
438
-	public function inputs_in_subsections(){
438
+	public function inputs_in_subsections() {
439 439
 		$inputs = array();
440
-		foreach($this->subsections() as $subsection){
441
-			if( $subsection instanceof EE_Form_Input_Base ){
442
-				$inputs[ $subsection->html_name() ] = $subsection;
443
-			}elseif($subsection instanceof EE_Form_Section_Proper ){
440
+		foreach ($this->subsections() as $subsection) {
441
+			if ($subsection instanceof EE_Form_Input_Base) {
442
+				$inputs[$subsection->html_name()] = $subsection;
443
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
444 444
 				$inputs += $subsection->inputs_in_subsections();
445 445
 			}
446 446
 		}
@@ -453,12 +453,12 @@  discard block
 block discarded – undo
453 453
 	 * and values are a string of all their validation errors
454 454
 	 * @return string[]
455 455
 	 */
456
-	public function subsection_validation_errors_by_html_name(){
456
+	public function subsection_validation_errors_by_html_name() {
457 457
 		$inputs = $this->inputs();
458 458
 		$errors = array();
459
-		foreach( $inputs as $form_input ){
460
-			if ( $form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors() ){
461
-				$errors[ $form_input->html_name() ] = $form_input->get_validation_error_string();
459
+		foreach ($inputs as $form_input) {
460
+			if ($form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors()) {
461
+				$errors[$form_input->html_name()] = $form_input->get_validation_error_string();
462 462
 			}
463 463
 		}
464 464
 		return $errors;
@@ -470,12 +470,12 @@  discard block
 block discarded – undo
470 470
 	 * passes all the form data required by the JS to the JS, and enqueues the few required JS files.
471 471
 	 * Should be setup by each form during the _enqueues_and_localize_form_js
472 472
 	 */
473
-	public static function localize_script_for_all_forms(){
473
+	public static function localize_script_for_all_forms() {
474 474
 		//allow inputs and stuff to hook in their JS and stuff here
475 475
 		do_action('AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin');
476 476
 		EE_Form_Section_Proper::$_js_localization['localized_error_messages'] = EE_Form_Section_Proper::_get_localized_error_messages();
477
-		wp_enqueue_script( 'ee_form_section_validation' );
478
-		wp_localize_script( 'ee_form_section_validation', 'ee_form_section_vars', EE_Form_Section_Proper::$_js_localization );
477
+		wp_enqueue_script('ee_form_section_validation');
478
+		wp_localize_script('ee_form_section_validation', 'ee_form_section_vars', EE_Form_Section_Proper::$_js_localization);
479 479
 	}
480 480
 
481 481
 
@@ -483,8 +483,8 @@  discard block
 block discarded – undo
483 483
 	/**
484 484
 	 * ensure_scripts_localized
485 485
 	 */
486
-	public function ensure_scripts_localized(){
487
-		if ( ! EE_Form_Section_Proper::$_scripts_localized ) {
486
+	public function ensure_scripts_localized() {
487
+		if ( ! EE_Form_Section_Proper::$_scripts_localized) {
488 488
 			$this->_enqueue_and_localize_form_js();
489 489
 		}
490 490
 	}
@@ -496,10 +496,10 @@  discard block
 block discarded – undo
496 496
 	 * is that the key here should be the same as the custom validation rule put in the JS file
497 497
 	 * @return array keys are custom validation rules, and values are internationalized strings
498 498
 	 */
499
-	private static function _get_localized_error_messages(){
499
+	private static function _get_localized_error_messages() {
500 500
 		return array(
501 501
 			'validUrl'=>  __("This is not a valid absolute URL. Eg, http://domain.com/monkey.jpg", "event_espresso"),
502
-			'regex' => __( 'Please check your input', 'event_espresso' ),
502
+			'regex' => __('Please check your input', 'event_espresso'),
503 503
 		);
504 504
 	}
505 505
 
@@ -527,10 +527,10 @@  discard block
 block discarded – undo
527 527
 	 * Gets the JS to put inside the jquery validation rules for subsection of this form section. See parent function for more...
528 528
 	 * @return array
529 529
 	 */
530
-	function get_jquery_validation_rules(){
530
+	function get_jquery_validation_rules() {
531 531
 		$jquery_validation_rules = array();
532
-		foreach($this->get_validatable_subsections() as $subsection){
533
-			$jquery_validation_rules = array_merge( $jquery_validation_rules,  $subsection->get_jquery_validation_rules() );
532
+		foreach ($this->get_validatable_subsections() as $subsection) {
533
+			$jquery_validation_rules = array_merge($jquery_validation_rules, $subsection->get_jquery_validation_rules());
534 534
 		}
535 535
 		return $jquery_validation_rules;
536 536
 	}
@@ -545,11 +545,11 @@  discard block
 block discarded – undo
545 545
 	protected function _normalize($req_data) {
546 546
 		$this->_received_submission = TRUE;
547 547
 		$this->_validation_errors = array();
548
-		foreach($this->get_validatable_subsections() as $subsection){
549
-			try{
548
+		foreach ($this->get_validatable_subsections() as $subsection) {
549
+			try {
550 550
 				$subsection->_normalize($req_data);
551
-			}catch( EE_Validation_Error $e ){
552
-				$subsection->add_validation_error( $e );
551
+			} catch (EE_Validation_Error $e) {
552
+				$subsection->add_validation_error($e);
553 553
 			}
554 554
 		}
555 555
 	}
@@ -563,9 +563,9 @@  discard block
 block discarded – undo
563 563
 	 * calling parent::_validate() first.
564 564
 	 */
565 565
 	protected function _validate() {
566
-		foreach($this->get_validatable_subsections() as $subsection_name => $subsection){
567
-			if(method_exists($this,'_validate_'.$subsection_name)){
568
-				call_user_func_array(array($this,'_validate_'.$subsection_name), array($subsection));
566
+		foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) {
567
+			if (method_exists($this, '_validate_'.$subsection_name)) {
568
+				call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection));
569 569
 			}
570 570
 			$subsection->_validate();
571 571
 		}
@@ -577,13 +577,13 @@  discard block
 block discarded – undo
577 577
 	 * Gets all the validated inputs for the form section
578 578
 	 * @return array
579 579
 	 */
580
-	public function valid_data(){
580
+	public function valid_data() {
581 581
 		$inputs = array();
582
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
583
-			if ( $subsection instanceof EE_Form_Section_Proper ) {
584
-				$inputs[ $subsection_name ] = $subsection->valid_data();
585
-			} else if ( $subsection instanceof EE_Form_Input_Base ){
586
-				$inputs[ $subsection_name ] = $subsection->normalized_value();
582
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
583
+			if ($subsection instanceof EE_Form_Section_Proper) {
584
+				$inputs[$subsection_name] = $subsection->valid_data();
585
+			} else if ($subsection instanceof EE_Form_Input_Base) {
586
+				$inputs[$subsection_name] = $subsection->normalized_value();
587 587
 			}
588 588
 		}
589 589
 		return $inputs;
@@ -595,11 +595,11 @@  discard block
 block discarded – undo
595 595
 	 * Gets all the inputs on this form section
596 596
 	 * @return EE_Form_Input_Base[]
597 597
 	 */
598
-	public function inputs(){
598
+	public function inputs() {
599 599
 		$inputs = array();
600
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
601
-			if ( $subsection instanceof EE_Form_Input_Base ){
602
-				$inputs[ $subsection_name ] = $subsection;
600
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
601
+			if ($subsection instanceof EE_Form_Input_Base) {
602
+				$inputs[$subsection_name] = $subsection;
603 603
 			}
604 604
 		}
605 605
 		return $inputs;
@@ -611,10 +611,10 @@  discard block
 block discarded – undo
611 611
 	 * Gets all the subsections which are a proper form
612 612
 	 * @return EE_Form_Section_Proper[]
613 613
 	 */
614
-	public function subforms(){
614
+	public function subforms() {
615 615
 		$form_sections = array();
616
-		foreach($this->subsections() as $name=>$obj){
617
-			if($obj instanceof EE_Form_Section_Proper){
616
+		foreach ($this->subsections() as $name=>$obj) {
617
+			if ($obj instanceof EE_Form_Section_Proper) {
618 618
 				$form_sections[$name] = $obj;
619 619
 			}
620 620
 		}
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 	 * if you only want form inputs or proper form sections.
630 630
 	 * @return EE_Form_Section_Proper[]
631 631
 	 */
632
-	public function subsections(){
632
+	public function subsections() {
633 633
 		$this->ensure_construct_finalized_called();
634 634
 		return $this->_subsections;
635 635
 	}
@@ -647,8 +647,8 @@  discard block
 block discarded – undo
647 647
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
648 648
 	 * input's normalized value, or an array like the top-level array
649 649
 	 */
650
-	public function input_values( $include_subform_inputs = false, $flatten = false ){
651
-		return $this->_input_values( false, $include_subform_inputs, $flatten );
650
+	public function input_values($include_subform_inputs = false, $flatten = false) {
651
+		return $this->_input_values(false, $include_subform_inputs, $flatten);
652 652
 	}
653 653
 
654 654
 	/**
@@ -664,8 +664,8 @@  discard block
 block discarded – undo
664 664
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
665 665
 	 * input's normalized value, or an array like the top-level array
666 666
 	 */
667
-	public function input_pretty_values(  $include_subform_inputs = false, $flatten = false ){
668
-		return $this->_input_values( true, $include_subform_inputs, $flatten );
667
+	public function input_pretty_values($include_subform_inputs = false, $flatten = false) {
668
+		return $this->_input_values(true, $include_subform_inputs, $flatten);
669 669
 	}
670 670
 
671 671
 	/**
@@ -678,17 +678,17 @@  discard block
 block discarded – undo
678 678
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
679 679
 	 * input's normalized value, or an array like the top-level array
680 680
 	 */
681
-	public function _input_values( $pretty = false, $include_subform_inputs = false, $flatten = false ) {
681
+	public function _input_values($pretty = false, $include_subform_inputs = false, $flatten = false) {
682 682
 		$input_values = array();
683
-		foreach( $this->subsections() as $subsection_name => $subsection ) {
684
-			if( $subsection instanceof EE_Form_Input_Base ) {
685
-				$input_values[ $subsection_name ] = $pretty ? $subsection->pretty_value() : $subsection->normalized_value();
686
-			} else if( $subsection instanceof EE_Form_Section_Proper && $include_subform_inputs ) {
687
-				$subform_input_values = $subsection->_input_values( $pretty, $include_subform_inputs, $flatten );
688
-				if( $flatten ) {
689
-					$input_values = array_merge( $input_values, $subform_input_values );
683
+		foreach ($this->subsections() as $subsection_name => $subsection) {
684
+			if ($subsection instanceof EE_Form_Input_Base) {
685
+				$input_values[$subsection_name] = $pretty ? $subsection->pretty_value() : $subsection->normalized_value();
686
+			} else if ($subsection instanceof EE_Form_Section_Proper && $include_subform_inputs) {
687
+				$subform_input_values = $subsection->_input_values($pretty, $include_subform_inputs, $flatten);
688
+				if ($flatten) {
689
+					$input_values = array_merge($input_values, $subform_input_values);
690 690
 				} else {
691
-					$input_values[ $subsection_name ] = $subform_input_values;
691
+					$input_values[$subsection_name] = $subform_input_values;
692 692
 				}
693 693
 			}
694 694
 		}
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 	 * (ie, had receive_form_submission called on it yet)
703 703
 	 * @return boolean
704 704
 	 */
705
-	public function has_received_submission(){
705
+	public function has_received_submission() {
706 706
 		$this->ensure_construct_finalized_called();
707 707
 		return $this->_received_submission;
708 708
 	}
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 	 * @param array $inputs_to_exclude values are the input names
716 716
 	 * @return void
717 717
 	 */
718
-	public function exclude($inputs_to_exclude = array()){
719
-		foreach($inputs_to_exclude as $input_to_exclude_name){
718
+	public function exclude($inputs_to_exclude = array()) {
719
+		foreach ($inputs_to_exclude as $input_to_exclude_name) {
720 720
 			unset($this->_subsections[$input_to_exclude_name]);
721 721
 		}
722 722
 	}
@@ -726,8 +726,8 @@  discard block
 block discarded – undo
726 726
 	/**
727 727
 	 * @param array $inputs_to_hide
728 728
 	 */
729
-	public function hide($inputs_to_hide= array()){
730
-		foreach($inputs_to_hide as $input_to_hide){
729
+	public function hide($inputs_to_hide = array()) {
730
+		foreach ($inputs_to_hide as $input_to_hide) {
731 731
 			$input = $this->get_input($input_to_hide);
732 732
 
733 733
 			$input->set_display_strategy(new EE_Hidden_Display_Strategy());
@@ -752,13 +752,13 @@  discard block
 block discarded – undo
752 752
 	 * 																								or if $subsection_name_to_target is null, before or after entire subsections array
753 753
 	 * @return void
754 754
 	 */
755
-	public function add_subsections( $new_subsections, $subsection_name_to_target = NULL, $add_before = true ){
756
-		foreach($new_subsections as $subsection_name => $subsection){
757
-			if( ! $subsection instanceof EE_Form_Section_Base){
755
+	public function add_subsections($new_subsections, $subsection_name_to_target = NULL, $add_before = true) {
756
+		foreach ($new_subsections as $subsection_name => $subsection) {
757
+			if ( ! $subsection instanceof EE_Form_Section_Base) {
758 758
 				EE_Error::add_error(
759 759
 					sprintf(
760 760
 						__("Trying to add a %s as a subsection (it was named '%s') to the form section '%s'. It was removed.", "event_espresso"),
761
-						get_class( $subsection ),
761
+						get_class($subsection),
762 762
 						$subsection_name,
763 763
 						$this->name()
764 764
 					)
@@ -767,8 +767,8 @@  discard block
 block discarded – undo
767 767
 			}
768 768
 		}
769 769
 
770
-		EE_Registry::instance()->load_helper( 'Array' );
771
-		$this->_subsections = EEH_Array::insert_into_array( $this->_subsections, $new_subsections, $subsection_name_to_target, $add_before );
770
+		EE_Registry::instance()->load_helper('Array');
771
+		$this->_subsections = EEH_Array::insert_into_array($this->_subsections, $new_subsections, $subsection_name_to_target, $add_before);
772 772
 
773 773
 		/*$subsections_before = array();
774 774
 		if( $subsection_name_to_target ){
@@ -799,8 +799,8 @@  discard block
 block discarded – undo
799 799
 				$this->_subsections = $new_subsections;
800 800
 			}
801 801
 		}*/
802
-		if( $this->_construction_finalized ){
803
-			foreach($this->_subsections as $name => $subsection){
802
+		if ($this->_construction_finalized) {
803
+			foreach ($this->_subsections as $name => $subsection) {
804 804
 				$subsection->_construct_finalize($this, $name);
805 805
 			}
806 806
 		}
@@ -811,8 +811,8 @@  discard block
 block discarded – undo
811 811
 	/**
812 812
 	 * Just gets all validatable subsections to clean their sensitive data
813 813
 	 */
814
-	public function clean_sensitive_data(){
815
-		foreach($this->get_validatable_subsections() as $subsection){
814
+	public function clean_sensitive_data() {
815
+		foreach ($this->get_validatable_subsections() as $subsection) {
816 816
 			$subsection->clean_sensitive_data();
817 817
 		}
818 818
 	}
@@ -822,8 +822,8 @@  discard block
 block discarded – undo
822 822
 	/**
823 823
 	 * @param string $form_submission_error_message
824 824
 	 */
825
-	public function set_submission_error_message( $form_submission_error_message = '' ) {
826
-		$this->_form_submission_error_message .= ! empty( $form_submission_error_message ) ? $form_submission_error_message : __( 'Form submission failed due to errors', 'event_espresso' );
825
+	public function set_submission_error_message($form_submission_error_message = '') {
826
+		$this->_form_submission_error_message .= ! empty($form_submission_error_message) ? $form_submission_error_message : __('Form submission failed due to errors', 'event_espresso');
827 827
 	}
828 828
 
829 829
 
@@ -840,8 +840,8 @@  discard block
 block discarded – undo
840 840
 	/**
841 841
 	 * @param string $form_submission_success_message
842 842
 	 */
843
-	public function set_submission_success_message( $form_submission_success_message ) {
844
-		$this->_form_submission_success_message .= ! empty( $form_submission_success_message ) ? $form_submission_success_message : __( 'Form submitted successfully', 'event_espresso' );
843
+	public function set_submission_success_message($form_submission_success_message) {
844
+		$this->_form_submission_success_message .= ! empty($form_submission_success_message) ? $form_submission_success_message : __('Form submitted successfully', 'event_espresso');
845 845
 	}
846 846
 
847 847
 
@@ -863,10 +863,10 @@  discard block
 block discarded – undo
863 863
 	 * EE_Form_Input_Base::_set_default_html_name_if_empty
864 864
 	 * @return string
865 865
 	 */
866
-	public function html_name_prefix(){
867
-		if( $this->parent_section() instanceof EE_Form_Section_Proper ){
868
-			return $this->parent_section()->html_name_prefix() . '[' . $this->name() . ']';
869
-		}else{
866
+	public function html_name_prefix() {
867
+		if ($this->parent_section() instanceof EE_Form_Section_Proper) {
868
+			return $this->parent_section()->html_name_prefix().'['.$this->name().']';
869
+		} else {
870 870
 			return $this->name();
871 871
 		}
872 872
 	}
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
 	 * was set, which is probably nothing, or the classname)
878 878
 	 * @return string
879 879
 	 */
880
-	public function name(){
880
+	public function name() {
881 881
 		$this->ensure_construct_finalized_called();
882 882
 		return parent::name();
883 883
 	}
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 	 *
887 887
 	 * @return EE_Form_Section_Proper
888 888
 	 */
889
-	public function parent_section(){
889
+	public function parent_section() {
890 890
 		$this->ensure_construct_finalized_called();
891 891
 		return parent::parent_section();
892 892
 	}
@@ -895,9 +895,9 @@  discard block
 block discarded – undo
895 895
 	 * make sure construction finalized was called, otherwise children might not be ready
896 896
 	 * @return void
897 897
 	 */
898
-	public function ensure_construct_finalized_called(){
899
-		if( ! $this->_construction_finalized ){
900
-			$this->_construct_finalize($this->_parent_section, $this->_name );
898
+	public function ensure_construct_finalized_called() {
899
+		if ( ! $this->_construction_finalized) {
900
+			$this->_construct_finalize($this->_parent_section, $this->_name);
901 901
 		}
902 902
 	}
903 903
 
@@ -909,17 +909,17 @@  discard block
 block discarded – undo
909 909
 	 * @param array $req_data
910 910
 	 * @return boolean
911 911
 	 */
912
-	public function form_data_present_in( $req_data = NULL ) {
913
-		if( $req_data === NULL){
912
+	public function form_data_present_in($req_data = NULL) {
913
+		if ($req_data === NULL) {
914 914
 			$req_data = $_POST;
915 915
 		}
916
-		foreach( $this->subsections() as $subsection ) {
917
-			if($subsection instanceof EE_Form_Input_Base ) {
918
-				if( $subsection->form_data_present_in( $req_data ) ) {
916
+		foreach ($this->subsections() as $subsection) {
917
+			if ($subsection instanceof EE_Form_Input_Base) {
918
+				if ($subsection->form_data_present_in($req_data)) {
919 919
 					return TRUE;
920 920
 				}
921
-			}elseif( $subsection instanceof EE_Form_Section_Proper ) {
922
-				if( $subsection->form_data_present_in( $req_data ) ) {
921
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
922
+				if ($subsection->form_data_present_in($req_data)) {
923 923
 					return TRUE;
924 924
 				}
925 925
 			}
@@ -936,14 +936,14 @@  discard block
 block discarded – undo
936 936
 	 */
937 937
 	public function get_validation_errors_accumulated() {
938 938
 		$validation_errors = $this->get_validation_errors();
939
-		foreach($this->get_validatable_subsections() as $subsection ) {
940
-			if( $subsection instanceof EE_Form_Section_Proper ) {
939
+		foreach ($this->get_validatable_subsections() as $subsection) {
940
+			if ($subsection instanceof EE_Form_Section_Proper) {
941 941
 				$validation_errors_on_this_subsection = $subsection->get_validation_errors_accumulated();
942 942
 			} else {
943
-				$validation_errors_on_this_subsection =  $subsection->get_validation_errors();
943
+				$validation_errors_on_this_subsection = $subsection->get_validation_errors();
944 944
 			}
945
-			if( $validation_errors_on_this_subsection ){
946
-				$validation_errors = array_merge( $validation_errors, $validation_errors_on_this_subsection );
945
+			if ($validation_errors_on_this_subsection) {
946
+				$validation_errors = array_merge($validation_errors, $validation_errors_on_this_subsection);
947 947
 			}
948 948
 		}
949 949
 		return $validation_errors;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -225,7 +225,7 @@
 block discarded – undo
225 225
 	 * leave this as TRUE so that the inputs will be properly configured. However,
226 226
 	 * some client code may be ok with construction finalize being called later
227 227
 	 * (realizing that the subsections' html names might not be set yet, etc.)
228
-	 * @return EE_Form_Section_Base
228
+	 * @return EE_Form_Section_Validatable|null
229 229
 	 */
230 230
 	public function get_subsection($name, $require_construction_to_be_finalized = TRUE ){
231 231
 		if( $require_construction_to_be_finalized ){
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Form_Input_Base.input.php 1 patch
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @subpackage
9 9
  * @author				Mike Nelson
10 10
  */
11
-abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{
11
+abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable {
12 12
 
13 13
 	/**
14 14
 	 * the input's name attribute
@@ -141,67 +141,67 @@  discard block
 block discarded – undo
141 141
 	 *		@type EE_Validation_Strategy_Base[] $validation_strategies
142 142
 	 * }
143 143
 	 */
144
-	public function __construct( $input_args = array() ){
145
-		$input_args = apply_filters( 'FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this );
144
+	public function __construct($input_args = array()) {
145
+		$input_args = apply_filters('FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this);
146 146
 		// the following properties must be cast as arrays
147 147
 		$set_as_array = array(
148 148
 			'validation_strategies'
149 149
 		);
150 150
 		// loop thru incoming options
151
-		foreach( $input_args as $key => $value ) {
151
+		foreach ($input_args as $key => $value) {
152 152
 			// add underscore to $key to match property names
153
-			$_key = '_' . $key;
154
-			if ( property_exists( $this, $_key )) {
153
+			$_key = '_'.$key;
154
+			if (property_exists($this, $_key)) {
155 155
 				// first check if this property needs to be set as an array
156
-				if ( isset( $set_as_array[ $key ] )) {
156
+				if (isset($set_as_array[$key])) {
157 157
 					// ensure value is an array
158
-					$value = is_array( $value ) ? $value : array( $value );
158
+					$value = is_array($value) ? $value : array($value);
159 159
 					// and merge with existing values
160
-					$this->$_key = array_merge( $this->$_key, $value );
160
+					$this->$_key = array_merge($this->$_key, $value);
161 161
 				} else {
162 162
 					$this->$_key = $value;
163 163
 				}
164 164
 			}
165 165
 		}
166 166
 		// ensure that "required" is set correctly
167
-		$this->set_required( $this->_required, isset( $input_args[ 'required_validation_error_message' ] ) ? $input_args[ 'required_validation_error_message' ] : NULL );
167
+		$this->set_required($this->_required, isset($input_args['required_validation_error_message']) ? $input_args['required_validation_error_message'] : NULL);
168 168
 
169
-		$this->_html_name_specified = isset( $input_args['html_name'] ) ? TRUE : FALSE;
169
+		$this->_html_name_specified = isset($input_args['html_name']) ? TRUE : FALSE;
170 170
 
171 171
 		$this->_display_strategy->_construct_finalize($this);
172 172
 
173
-		if ( $this->_validation_strategies ){
174
-			foreach( $this->_validation_strategies as $validation_strategy ){
173
+		if ($this->_validation_strategies) {
174
+			foreach ($this->_validation_strategies as $validation_strategy) {
175 175
 				$validation_strategy->_construct_finalize($this);
176 176
 			}
177 177
 		}
178 178
 
179
-		if( ! $this->_normalization_strategy){
179
+		if ( ! $this->_normalization_strategy) {
180 180
 			$this->_normalization_strategy = new EE_Text_Normalization();
181 181
 		}
182 182
 		$this->_normalization_strategy->_construct_finalize($this);
183 183
 
184 184
 		//at least we can use the normalization strategy to populate the default
185
-		if( isset( $input_args[ 'default' ] ) ) {
186
-			$this->set_default( $input_args[ 'default' ] );
185
+		if (isset($input_args['default'])) {
186
+			$this->set_default($input_args['default']);
187 187
 		}
188 188
 
189
-		if( ! $this->_sensitive_data_removal_strategy){
189
+		if ( ! $this->_sensitive_data_removal_strategy) {
190 190
 			$this->_sensitive_data_removal_strategy = new EE_No_Sensitive_Data_Removal();
191 191
 		}
192 192
 		$this->_sensitive_data_removal_strategy->_construct_finalize($this);
193
-		parent::__construct( $input_args );
193
+		parent::__construct($input_args);
194 194
 	}
195 195
 
196 196
 	/**
197 197
 	 * Sets the html_name to its default value, if none was specified in teh constructor.
198 198
 	 * Calculation involves using the name and the parent's html_name
199 199
 	 */
200
-	protected function _set_default_html_name_if_empty(){
201
-		if( ! $this->_html_name){
202
-			if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){
203
-				$this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]";
204
-			}else{
200
+	protected function _set_default_html_name_if_empty() {
201
+		if ( ! $this->_html_name) {
202
+			if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) {
203
+				$this->_html_name = $this->_parent_section->html_name_prefix()."[{$this->name()}]";
204
+			} else {
205 205
 				$this->_html_name = $this->name();
206 206
 			}
207 207
 		}
@@ -216,12 +216,12 @@  discard block
 block discarded – undo
216 216
 	function _construct_finalize($parent_form_section, $name) {
217 217
 		parent::_construct_finalize($parent_form_section, $name);
218 218
 		$this->_set_default_html_name_if_empty();
219
-		if( ! $this->_html_label ){
220
-			if( ! $this->_html_label_text){
221
-				$this->_html_label_text = ucwords( str_replace("_"," ",$name));
219
+		if ( ! $this->_html_label) {
220
+			if ( ! $this->_html_label_text) {
221
+				$this->_html_label_text = ucwords(str_replace("_", " ", $name));
222 222
 			}
223 223
 		}
224
-		do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name );
224
+		do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name);
225 225
 	}
226 226
 
227 227
 	 /**
@@ -229,10 +229,10 @@  discard block
 block discarded – undo
229 229
 	  * @return EE_Display_Strategy_Base
230 230
 	  * @throws EE_Error
231 231
 	  */
232
-	protected function _get_display_strategy(){
233
-		if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){
234
-			throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"),$this->html_name(),$this->html_id()));
235
-		}else{
232
+	protected function _get_display_strategy() {
233
+		if ( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base) {
234
+			throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"), $this->html_name(), $this->html_id()));
235
+		} else {
236 236
 			return $this->_display_strategy;
237 237
 		}
238 238
 	}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 * Sets the display strategy.
241 241
 	 * @param EE_Display_Strategy_Base $strategy
242 242
 	 */
243
-	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy){
243
+	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy) {
244 244
 		$this->_display_strategy = $strategy;
245 245
 	}
246 246
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 * Sets the sanitization strategy
249 249
 	 * @param EE_Normalization_Strategy_Base $strategy
250 250
 	 */
251
-	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy){
251
+	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy) {
252 252
 		$this->_normalization_strategy = $strategy;
253 253
 	}
254 254
 
@@ -274,14 +274,14 @@  discard block
 block discarded – undo
274 274
 	 * Gets the display strategy for this input
275 275
 	 * @return EE_Display_Strategy_Base
276 276
 	 */
277
-	public function get_display_strategy(){
277
+	public function get_display_strategy() {
278 278
 		return $this->_display_strategy;
279 279
 	}
280 280
 	/**
281 281
 	 * Overwrites the display strategy
282 282
 	 * @param EE_Display_Strategy_Base $display_strategy
283 283
 	 */
284
-	public function set_display_strategy($display_strategy){
284
+	public function set_display_strategy($display_strategy) {
285 285
 		$this->_display_strategy = $display_strategy;
286 286
 		$this->_display_strategy->_construct_finalize($this);
287 287
 	}
@@ -289,14 +289,14 @@  discard block
 block discarded – undo
289 289
 	 * Gets the normalization strategy set on this input
290 290
 	 * @return EE_Normalization_Strategy_Base
291 291
 	 */
292
-	public function get_normalization_strategy(){
292
+	public function get_normalization_strategy() {
293 293
 		return $this->_normalization_strategy;
294 294
 	}
295 295
 	/**
296 296
 	 * Overwrites the normalization strategy
297 297
 	 * @param EE_Normalization_Strategy_Base $normalization_strategy
298 298
 	 */
299
-	public function set_normalization_strategy($normalization_strategy){
299
+	public function set_normalization_strategy($normalization_strategy) {
300 300
 		$this->_normalization_strategy = $normalization_strategy;
301 301
 		$this->_normalization_strategy->_construct_finalize($this);
302 302
 	}
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
 	 * Returns all teh validation strategies which apply to this field, numerically indexed
306 306
 	 * @return EE_Validation_Strategy_Base[]
307 307
 	 */
308
-	public function get_validation_strategies(){
309
-		if(is_array($this->_validation_strategies)){
308
+	public function get_validation_strategies() {
309
+		if (is_array($this->_validation_strategies)) {
310 310
 			return $this->_validation_strategies;
311
-		}else{
311
+		} else {
312 312
 			return array();
313 313
 		}
314 314
 
@@ -318,9 +318,9 @@  discard block
 block discarded – undo
318 318
 	 * @param EE_Validation_Strategy_Base $validation_strategy
319 319
 	 * @return void
320 320
 	 */
321
-	protected function _add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ){
322
-		$validation_strategy->_construct_finalize( $this );
323
-		$this->_validation_strategies[ get_class($validation_strategy) ] = $validation_strategy;
321
+	protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
322
+		$validation_strategy->_construct_finalize($this);
323
+		$this->_validation_strategies[get_class($validation_strategy)] = $validation_strategy;
324 324
 
325 325
 	}
326 326
 
@@ -329,18 +329,18 @@  discard block
 block discarded – undo
329 329
 	 * @param EE_Validation_Strategy_Base $validation_strategy
330 330
 	 * @return void
331 331
 	 */
332
-	public function add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ) {
333
-		$this->_add_validation_strategy( $validation_strategy );
332
+	public function add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
333
+		$this->_add_validation_strategy($validation_strategy);
334 334
 	}
335 335
 
336 336
 	/**
337 337
 	 * The classname of the validation strategy to remove
338 338
 	 * @param string $validation_strategy_classname
339 339
 	 */
340
-	public function remove_validation_strategy( $validation_strategy_classname ) {
341
-		foreach( $this->_validation_strategies as $key => $validation_strategy ){
342
-			if( is_subclass_of( $validation_strategy, $validation_strategy_classname ) ){
343
-				unset( $this->_validation_strategies[ $key ] );
340
+	public function remove_validation_strategy($validation_strategy_classname) {
341
+		foreach ($this->_validation_strategies as $key => $validation_strategy) {
342
+			if (is_subclass_of($validation_strategy, $validation_strategy_classname)) {
343
+				unset($this->_validation_strategies[$key]);
344 344
 			}
345 345
 		}
346 346
 	}
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 	 * to the parent form's layout strategy
350 350
 	 * @return string
351 351
 	 */
352
-	public function get_html_and_js(){
352
+	public function get_html_and_js() {
353 353
 		return $this->_parent_section->get_html_for_input($this);
354 354
 	}
355 355
 	/**
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 	 * Makes sure the JS and CSS are enqueued for it
359 359
 	 * @return string
360 360
 	 */
361
-	public function get_html_for_input(){
361
+	public function get_html_for_input() {
362 362
 		return  $this->_get_display_strategy()->display();
363 363
 	}
364 364
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	 * @return string
369 369
 	 */
370 370
 	public function html_other_attributes() {
371
-		return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : '';
371
+		return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : '';
372 372
 	}
373 373
 
374 374
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	/**
377 377
 	 * @param string $html_other_attributes
378 378
 	 */
379
-	public function set_html_other_attributes( $html_other_attributes ) {
379
+	public function set_html_other_attributes($html_other_attributes) {
380 380
 		$this->_html_other_attributes = $html_other_attributes;
381 381
 	}
382 382
 
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 	 * according to the form section's layout strategy
386 386
 	 * @return string
387 387
 	 */
388
-	public function get_html_for_label(){
388
+	public function get_html_for_label() {
389 389
 		return $this->_parent_section->get_layout_strategy()->display_label($this);
390 390
 	}
391 391
 	/**
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 	 * according to the form section's layout strategy
394 394
 	 * @return string
395 395
 	 */
396
-	public function get_html_for_errors(){
396
+	public function get_html_for_errors() {
397 397
 		return $this->_parent_section->get_layout_strategy()->display_errors($this);
398 398
 	}
399 399
 	/**
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 	 * according to the form section's layout strategy
402 402
 	 * @return string
403 403
 	 */
404
-	public function get_html_for_help(){
404
+	public function get_html_for_help() {
405 405
 		return $this->_parent_section->get_layout_strategy()->display_help_text($this);
406 406
 	}
407 407
 	/**
@@ -410,20 +410,20 @@  discard block
 block discarded – undo
410 410
 	 * @return boolean
411 411
 	 */
412 412
 	protected function _validate() {
413
-		if(is_array($this->_validation_strategies)){
414
-			foreach($this->_validation_strategies as $validation_strategy){
415
-				if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
416
-					try{
413
+		if (is_array($this->_validation_strategies)) {
414
+			foreach ($this->_validation_strategies as $validation_strategy) {
415
+				if ($validation_strategy instanceof EE_Validation_Strategy_Base) {
416
+					try {
417 417
 						$validation_strategy->validate($this->normalized_value());
418
-					}catch(EE_Validation_Error $e){
418
+					} catch (EE_Validation_Error $e) {
419 419
 						$this->add_validation_error($e);
420 420
 					}
421 421
 				}
422 422
 			}
423 423
 		}
424
-		if( $this->get_validation_errors()){
424
+		if ($this->get_validation_errors()) {
425 425
 			return false;
426
-		}else{
426
+		} else {
427 427
 			return true;
428 428
 		}
429 429
 	}
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
 	 * @param string $value
437 437
 	 * @return null|string
438 438
 	 */
439
-	private function _sanitize($value){
440
-		return $value !== NULL ?stripslashes(html_entity_decode($value)) : NULL;//don't sanitize_text_field
439
+	private function _sanitize($value) {
440
+		return $value !== NULL ? stripslashes(html_entity_decode($value)) : NULL; //don't sanitize_text_field
441 441
 	}
442 442
 
443 443
 
@@ -449,24 +449,24 @@  discard block
 block discarded – undo
449 449
 	 * @param array $req_data like $_POST
450 450
 	 * @return boolean whether or not there was an error
451 451
 	 */
452
-	protected function _normalize( $req_data ) {
452
+	protected function _normalize($req_data) {
453 453
 		//any existing validation errors don't apply so clear them
454 454
 		$this->_validation_errors = array();
455 455
 		try {
456
-			$raw_input = $this->find_form_data_for_this_section( $req_data );
456
+			$raw_input = $this->find_form_data_for_this_section($req_data);
457 457
 			//super simple sanitization for now
458
-			if ( is_array( $raw_input )) {
458
+			if (is_array($raw_input)) {
459 459
 				$this->_raw_value = array();
460
-				foreach( $raw_input as $key => $value ) {
461
-					$this->_raw_value[ $key ] = $this->_sanitize( $value );
460
+				foreach ($raw_input as $key => $value) {
461
+					$this->_raw_value[$key] = $this->_sanitize($value);
462 462
 				}
463 463
 			} else {
464
-				$this->_raw_value = $this->_sanitize( $raw_input );
464
+				$this->_raw_value = $this->_sanitize($raw_input);
465 465
 			}
466 466
 			//we want ot mostly leave the input alone in case we need to re-display it to the user
467
-			$this->_normalized_value = $this->_normalization_strategy->normalize( $this->raw_value() );
468
-		} catch ( EE_Validation_Error $e ) {
469
-			$this->add_validation_error( $e );
467
+			$this->_normalized_value = $this->_normalization_strategy->normalize($this->raw_value());
468
+		} catch (EE_Validation_Error $e) {
469
+			$this->add_validation_error($e);
470 470
 		}
471 471
 	}
472 472
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 	/**
476 476
 	 * @return string
477 477
 	 */
478
-	public function html_name(){
478
+	public function html_name() {
479 479
 		return $this->_html_name;
480 480
 	}
481 481
 
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 	/**
485 485
 	 * @return string
486 486
 	 */
487
-	function html_label_id(){
488
-		return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl';
487
+	function html_label_id() {
488
+		return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl';
489 489
 	}
490 490
 
491 491
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	/**
494 494
 	 * @return string
495 495
 	 */
496
-	function html_label_class(){
496
+	function html_label_class() {
497 497
 		return $this->_html_label_class;
498 498
 	}
499 499
 
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	/**
503 503
 	 * @return string
504 504
 	 */
505
-	function html_label_style(){
505
+	function html_label_style() {
506 506
 		return $this->_html_label_style;
507 507
 	}
508 508
 
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	/**
512 512
 	 * @return string
513 513
 	 */
514
-	function html_label_text(){
514
+	function html_label_text() {
515 515
 		return $this->_html_label_text;
516 516
 	}
517 517
 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	/**
521 521
 	 * @return string
522 522
 	 */
523
-	function html_help_text(){
523
+	function html_help_text() {
524 524
 		return $this->_html_help_text;
525 525
 	}
526 526
 
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 	/**
530 530
 	 * @return string
531 531
 	 */
532
-	function html_help_class(){
532
+	function html_help_class() {
533 533
 		return $this->_html_help_class;
534 534
 	}
535 535
 
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 	/**
539 539
 	 * @return string
540 540
 	 */
541
-	function html_help_style(){
541
+	function html_help_style() {
542 542
 		return $this->_html_style;
543 543
 	}
544 544
 	/**
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 	 * in which case, we would have stored the malicious content to our database.
552 552
 	 * @return string
553 553
 	 */
554
-	function raw_value(){
554
+	function raw_value() {
555 555
 		return $this->_raw_value;
556 556
 	}
557 557
 	/**
@@ -559,15 +559,15 @@  discard block
 block discarded – undo
559 559
 	 * it escapes all html entities
560 560
 	 * @return string
561 561
 	 */
562
-	function raw_value_in_form(){
563
-		return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8');
562
+	function raw_value_in_form() {
563
+		return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8');
564 564
 	}
565 565
 	/**
566 566
 	 * returns the value after it's been sanitized, and then converted into it's proper type
567 567
 	 * in PHP. Eg, a string, an int, an array,
568 568
 	 * @return mixed
569 569
 	 */
570
-	function normalized_value(){
570
+	function normalized_value() {
571 571
 		return $this->_normalized_value;
572 572
 	}
573 573
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	 * the best thing to display
578 578
 	 * @return string
579 579
 	 */
580
-	function pretty_value(){
580
+	function pretty_value() {
581 581
 		return $this->_normalized_value;
582 582
 	}
583 583
 	/**
@@ -596,15 +596,15 @@  discard block
 block discarded – undo
596 596
 		  }</code>
597 597
 	 * @return array
598 598
 	 */
599
-	function get_jquery_validation_rules(){
599
+	function get_jquery_validation_rules() {
600 600
 		$jquery_validation_rules = array();
601
-		foreach($this->get_validation_strategies() as $validation_strategy){
602
-			$jquery_validation_rules = array_replace_recursive( $jquery_validation_rules, $validation_strategy->get_jquery_validation_rule_array());
601
+		foreach ($this->get_validation_strategies() as $validation_strategy) {
602
+			$jquery_validation_rules = array_replace_recursive($jquery_validation_rules, $validation_strategy->get_jquery_validation_rule_array());
603 603
 		}
604 604
 
605
-		if(! empty($jquery_validation_rules)){
606
-			$jquery_validation_js[ $this->html_id( TRUE ) ] = $jquery_validation_rules;
607
-		}else{
605
+		if ( ! empty($jquery_validation_rules)) {
606
+			$jquery_validation_js[$this->html_id(TRUE)] = $jquery_validation_rules;
607
+		} else {
608 608
 			return array();
609 609
 		}
610 610
 		return $jquery_validation_js;
@@ -616,9 +616,9 @@  discard block
 block discarded – undo
616 616
 	 * @param mixed $value
617 617
 	 * @return void
618 618
 	 */
619
-	function set_default($value){
619
+	function set_default($value) {
620 620
 		$this->_normalized_value = $value;
621
-		$this->_raw_value = $this->_normalization_strategy->unnormalize( $value );
621
+		$this->_raw_value = $this->_normalization_strategy->unnormalize($value);
622 622
 	}
623 623
 
624 624
 	/**
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 	 * @param string $label
627 627
 	 * @return void
628 628
 	 */
629
-	function set_html_label_text($label){
629
+	function set_html_label_text($label) {
630 630
 		$this->_html_label_text = $label;
631 631
 	}
632 632
 
@@ -638,12 +638,12 @@  discard block
 block discarded – undo
638 638
 	 * @param boolean $required
639 639
 	 * @param null    $required_text
640 640
 	 */
641
-	function set_required($required = true, $required_text = NULL ){
642
-		$required = filter_var( $required, FILTER_VALIDATE_BOOLEAN );
643
-		if ( $required ) {
644
-			$this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) );
641
+	function set_required($required = true, $required_text = NULL) {
642
+		$required = filter_var($required, FILTER_VALIDATE_BOOLEAN);
643
+		if ($required) {
644
+			$this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text));
645 645
 		} else {
646
-			unset( $this->_validation_strategies[ get_class( new EE_Required_Validation_Strategy() ) ] );
646
+			unset($this->_validation_strategies[get_class(new EE_Required_Validation_Strategy())]);
647 647
 		}
648 648
 		$this->_required = $required;
649 649
 	}
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 	 * Returns whether or not this field is required
652 652
 	 * @return boolean
653 653
 	 */
654
-	public function required(){
654
+	public function required() {
655 655
 		return $this->_required;
656 656
 	}
657 657
 
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 	/**
661 661
 	 * @param string $required_css_class
662 662
 	 */
663
-	public function set_required_css_class( $required_css_class ) {
663
+	public function set_required_css_class($required_css_class) {
664 664
 		$this->_required_css_class = $required_css_class;
665 665
 	}
666 666
 
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 	 * Sets the help text, in case
680 680
 	 * @param string $text
681 681
 	 */
682
-	public function set_html_help_text($text){
682
+	public function set_html_help_text($text) {
683 683
 		$this->_html_help_text = $text;
684 684
 	}
685 685
 	/**
@@ -691,8 +691,8 @@  discard block
 block discarded – undo
691 691
 	public function clean_sensitive_data() {
692 692
 		//if we do ANY kind of sensitive data removal on this, then just clear out the raw value
693 693
 		//if we need more logic than this we'll make a strategy for it
694
-		if( $this->_sensitive_data_removal_strategy &&
695
-				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){
694
+		if ($this->_sensitive_data_removal_strategy &&
695
+				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) {
696 696
 			$this->_raw_value = NULL;
697 697
 		}
698 698
 		//and clean the normalized value according to the appropriate strategy
@@ -706,10 +706,10 @@  discard block
 block discarded – undo
706 706
 	 * @param string $button_size
707 707
 	 * @param string $other_attributes
708 708
 	 */
709
-	public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) {
709
+	public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') {
710 710
 		$button_css_attributes = 'button';
711 711
 		$button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary';
712
-		switch ( $button_size ) {
712
+		switch ($button_size) {
713 713
 			case 'xs' :
714 714
 			case 'extra-small' :
715 715
 				$button_css_attributes .= ' button-xs';
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 			default :
731 731
 				$button_css_attributes .= '';
732 732
 		}
733
-		$this->_button_css_attributes .= ! empty( $other_attributes ) ? $button_css_attributes . ' ' . $other_attributes : $button_css_attributes;
733
+		$this->_button_css_attributes .= ! empty($other_attributes) ? $button_css_attributes.' '.$other_attributes : $button_css_attributes;
734 734
 	}
735 735
 
736 736
 
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 	 * @return string
740 740
 	 */
741 741
 	public function button_css_attributes() {
742
-		if ( empty( $this->_button_css_attributes )) {
742
+		if (empty($this->_button_css_attributes)) {
743 743
 			$this->set_button_css_attributes();
744 744
 		}
745 745
 		return $this->_button_css_attributes;
@@ -759,27 +759,27 @@  discard block
 block discarded – undo
759 759
 	 * @param array $req_data
760 760
 	 * @return mixed whatever the raw value of this form section is in the request data
761 761
 	 */
762
-	public function find_form_data_for_this_section( $req_data ){
762
+	public function find_form_data_for_this_section($req_data) {
763 763
 		// break up the html name by "[]"
764
-		if ( strpos( $this->html_name(), '[' ) !== FALSE ) {
765
-			$before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') );
764
+		if (strpos($this->html_name(), '[') !== FALSE) {
765
+			$before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '['));
766 766
 		} else {
767 767
 			$before_any_brackets = $this->html_name();
768 768
 		}
769 769
 		// grab all of the segments
770
-		preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches);
771
-		if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){
772
-			$name_parts = $matches[ 1 ];
770
+		preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches);
771
+		if (isset($matches[1]) && is_array($matches[1])) {
772
+			$name_parts = $matches[1];
773 773
 			array_unshift($name_parts, $before_any_brackets);
774
-		}else{
775
-			$name_parts = array( $before_any_brackets );
774
+		} else {
775
+			$name_parts = array($before_any_brackets);
776 776
 		}
777 777
 		// now get the value for the input
778 778
 		$value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data);
779
-		if( $value === NULL ){
779
+		if ($value === NULL) {
780 780
 			//check if this thing's name is at the TOP level of the request data
781
-			if( isset( $req_data[ $this->name() ] ) ){
782
-				$value = $req_data[ $this->name() ];
781
+			if (isset($req_data[$this->name()])) {
782
+				$value = $req_data[$this->name()];
783 783
 			}
784 784
 		}
785 785
 		return $value;
@@ -793,15 +793,15 @@  discard block
 block discarded – undo
793 793
 	 * @param array $req_data
794 794
 	 * @return array | NULL
795 795
 	 */
796
-	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){
797
-		$first_part_to_consider = array_shift( $html_name_parts );
798
-		if( isset( $req_data[ $first_part_to_consider ] ) ){
799
-			if( empty($html_name_parts ) ){
800
-				return $req_data[ $first_part_to_consider ];
801
-			}else{
802
-				return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[ $first_part_to_consider ] );
796
+	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) {
797
+		$first_part_to_consider = array_shift($html_name_parts);
798
+		if (isset($req_data[$first_part_to_consider])) {
799
+			if (empty($html_name_parts)) {
800
+				return $req_data[$first_part_to_consider];
801
+			} else {
802
+				return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[$first_part_to_consider]);
803 803
 			}
804
-		}else{
804
+		} else {
805 805
 			return NULL;
806 806
 		}
807 807
 	}
@@ -813,14 +813,14 @@  discard block
 block discarded – undo
813 813
 	 * @param array $req_data like $_POST
814 814
 	 * @return boolean
815 815
 	 */
816
-	public function form_data_present_in($req_data = NULL){
817
-		if( $req_data === NULL ){
816
+	public function form_data_present_in($req_data = NULL) {
817
+		if ($req_data === NULL) {
818 818
 			$req_data = $_POST;
819 819
 		}
820
-		$checked_value = $this->find_form_data_for_this_section( $req_data );
821
-		if( $checked_value !== null ){
820
+		$checked_value = $this->find_form_data_for_this_section($req_data);
821
+		if ($checked_value !== null) {
822 822
 			return TRUE;
823
-		}else{
823
+		} else {
824 824
 			return FALSE;
825 825
 		}
826 826
 	}
Please login to merge, or discard this patch.
form_sections/payment_methods/EE_Billing_Attendee_Info_Form.form.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 /**
@@ -14,31 +14,31 @@  discard block
 block discarded – undo
14 14
  * @author				Mike Nelson
15 15
  *
16 16
  */
17
-class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form{
17
+class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form {
18 18
 
19 19
 	/**
20 20
 	 *
21 21
 	 * @param EE_Payment_Method $payment_method
22 22
 	 * @param array $options_array @see EE_Form_Section_Proper::__construct()
23 23
 	 */
24
-	public function __construct( EE_Payment_Method $payment_method, $options_array= array()){
24
+	public function __construct(EE_Payment_Method $payment_method, $options_array = array()) {
25 25
 		$options_array['subsections'] = array_merge(
26 26
 			array(
27
-				'first_name' 	=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __( 'First Name', 'event_espresso' ) ) ),
28
-				'last_name'		=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __( 'Last Name', 'event_espresso' ) ) ),
29
-				'email'				=> new EE_Email_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __( 'Email', 'event_espresso' ) ) ),
30
-				'address'			=> new EE_Text_Input( array( 'html_label_text'=>  __( 'Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address' )),
31
-				'address2'		=> new EE_Text_Input( array( 'html_label_text'=> __( 'Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2' )),
32
-				'city'					=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __( 'City', 'event_espresso' ) ) ),
33
-				'state' 				=> apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __( 'State', 'event_espresso' ) ) ) ),
34
-				'country' 			=> apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __( 'Country', 'event_espresso' ) ) ) ),
35
-				'zip'					=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __( 'Zip', 'event_espresso' ) ) ),
36
-				'phone'			=> new EE_Text_Input( array( 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __( 'Phone', 'event_espresso' ) )),
27
+				'first_name' 	=> new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __('First Name', 'event_espresso'))),
28
+				'last_name'		=> new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __('Last Name', 'event_espresso'))),
29
+				'email'				=> new EE_Email_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso'))),
30
+				'address'			=> new EE_Text_Input(array('html_label_text'=>  __('Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address')),
31
+				'address2'		=> new EE_Text_Input(array('html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2')),
32
+				'city'					=> new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso'))),
33
+				'state' 				=> apply_filters('FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __('State', 'event_espresso')))),
34
+				'country' 			=> apply_filters('FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __('Country', 'event_espresso')))),
35
+				'zip'					=> new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso'))),
36
+				'phone'			=> new EE_Text_Input(array('html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso'))),
37 37
 			),
38
-			isset( $options_array['subsections'] ) ? $options_array['subsections'] : array()
38
+			isset($options_array['subsections']) ? $options_array['subsections'] : array()
39 39
 		);
40 40
 
41
-		parent::__construct( $payment_method, $options_array );
41
+		parent::__construct($payment_method, $options_array);
42 42
 
43 43
 	}
44 44
 
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 	 * Sets the defaults for the billing form according to the attendee's details
47 47
 	 * @param EE_Attendee $attendee
48 48
 	 */
49
-	public function populate_from_attendee( $attendee ){
49
+	public function populate_from_attendee($attendee) {
50 50
 		$attendee = EEM_Attendee::instance()->ensure_is_obj($attendee);
51 51
 		/** @var $attendee EE_Attendee */
52 52
 		$this->populate_defaults( 
53
-				apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee',
53
+				apply_filters('FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee',
54 54
 					array(
55 55
 						'first_name'=>$attendee->fname(),
56 56
 						'last_name'=>$attendee->lname(),
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 						'zip'=>$attendee->zip(),
64 64
 						'phone'=>$attendee->phone(),
65 65
 					),
66
-					$attendee )
66
+					$attendee)
67 67
 				
68 68
 				);
69 69
 	}
@@ -76,48 +76,48 @@  discard block
 block discarded – undo
76 76
 	 * @param \EE_Attendee $attendee - the attendee object to copy details to
77 77
 	 * @return \EE_Attendee
78 78
 	 */
79
-	public function copy_billing_form_data_to_attendee( EE_Attendee $attendee ){
79
+	public function copy_billing_form_data_to_attendee(EE_Attendee $attendee) {
80 80
 		// grab billing form data
81 81
 		$data = $this->valid_data();
82 82
 		// copy first_name
83
-		if ( ! empty( $data['first_name'] )) {
84
-			$attendee->set_fname( $data['first_name'] );
83
+		if ( ! empty($data['first_name'])) {
84
+			$attendee->set_fname($data['first_name']);
85 85
 		}
86 86
 		// copy last_name
87
-		if ( ! empty( $data['last_name'] )) {
88
-			$attendee->set_lname( $data['last_name'] );
87
+		if ( ! empty($data['last_name'])) {
88
+			$attendee->set_lname($data['last_name']);
89 89
 		}
90 90
 		// copy email
91
-		if ( ! empty( $data['email'] )) {
92
-			$attendee->set_email( $data['email'] );
91
+		if ( ! empty($data['email'])) {
92
+			$attendee->set_email($data['email']);
93 93
 		}
94 94
 		// copy address
95
-		if ( ! empty( $data['address'] )) {
96
-			$attendee->set_address( $data['address'] );
95
+		if ( ! empty($data['address'])) {
96
+			$attendee->set_address($data['address']);
97 97
 		}
98 98
 		// copy address2
99
-		if ( ! empty( $data['address2'] )) {
100
-			$attendee->set_address2( $data['address2'] );
99
+		if ( ! empty($data['address2'])) {
100
+			$attendee->set_address2($data['address2']);
101 101
 		}
102 102
 		// copy city
103
-		if ( ! empty( $data['city'] )) {
104
-			$attendee->set_city( $data['city'] );
103
+		if ( ! empty($data['city'])) {
104
+			$attendee->set_city($data['city']);
105 105
 		}
106 106
 		// copy state
107
-		if ( ! empty( $data['state'] )) {
108
-			$attendee->set_state( $data['state'] );
107
+		if ( ! empty($data['state'])) {
108
+			$attendee->set_state($data['state']);
109 109
 		}
110 110
 		// copy country
111
-		if ( ! empty( $data['country'] )) {
112
-			$attendee->set_country( $data['country'] );
111
+		if ( ! empty($data['country'])) {
112
+			$attendee->set_country($data['country']);
113 113
 		}
114 114
 		// copy zip
115
-		if ( ! empty( $data['zip'] )) {
116
-			$attendee->set_zip( $data['zip'] );
115
+		if ( ! empty($data['zip'])) {
116
+			$attendee->set_zip($data['zip']);
117 117
 		}
118 118
 		// copy phone
119
-		if ( ! empty( $data['phone'] )) {
120
-			$attendee->set_phone( $data['phone'] );
119
+		if ( ! empty($data['phone'])) {
120
+			$attendee->set_phone($data['phone']);
121 121
 		}
122 122
 		return $attendee;
123 123
 	}
@@ -128,20 +128,20 @@  discard block
 block discarded – undo
128 128
 	 * uses info from the billing form to create a new attendee
129 129
 	 * @return \EE_Attendee
130 130
 	 */
131
-	public function create_attendee_from_billing_form_data(){
131
+	public function create_attendee_from_billing_form_data() {
132 132
 		// grab billing form data
133 133
 		$data = $this->valid_data();
134
-		return EE_Attendee::new_instance( array(
135
-			'ATT_fname' 		=> ! empty( $data['first_name'] ) ? $data['first_name'] : '',
136
-			'ATT_lname' 		=> ! empty( $data['last_name'] ) ? $data['last_name'] : '',
137
-			'ATT_email' 		=> ! empty( $data['email'] ) ? $data['email'] : '',
138
-			'ATT_address' 		=> ! empty( $data['address'] ) ? $data['address'] : '',
139
-			'ATT_address2' 	=> ! empty( $data['address2'] ) ? $data['address2'] : '',
140
-			'ATT_city' 			=> ! empty( $data['city'] ) ? $data['city'] : '',
141
-			'STA_ID' 				=> ! empty( $data['state'] ) ? $data['state'] : '',
142
-			'CNT_ISO' 			=> ! empty( $data['country'] ) ? $data['country'] : '',
143
-			'ATT_zip' 				=> ! empty( $data['zip'] ) ? $data['zip'] : '',
144
-			'ATT_phone' 		=> ! empty( $data['phone'] ) ? $data['phone'] : '',
134
+		return EE_Attendee::new_instance(array(
135
+			'ATT_fname' 		=> ! empty($data['first_name']) ? $data['first_name'] : '',
136
+			'ATT_lname' 		=> ! empty($data['last_name']) ? $data['last_name'] : '',
137
+			'ATT_email' 		=> ! empty($data['email']) ? $data['email'] : '',
138
+			'ATT_address' 		=> ! empty($data['address']) ? $data['address'] : '',
139
+			'ATT_address2' 	=> ! empty($data['address2']) ? $data['address2'] : '',
140
+			'ATT_city' 			=> ! empty($data['city']) ? $data['city'] : '',
141
+			'STA_ID' 				=> ! empty($data['state']) ? $data['state'] : '',
142
+			'CNT_ISO' 			=> ! empty($data['country']) ? $data['country'] : '',
143
+			'ATT_zip' 				=> ! empty($data['zip']) ? $data['zip'] : '',
144
+			'ATT_phone' 		=> ! empty($data['phone']) ? $data['phone'] : '',
145 145
 		));
146 146
 	}
147 147
 }
Please login to merge, or discard this patch.
core/libraries/messages/defaults/default/email_main_wrapper.template.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@
 block discarded – undo
7 7
 	<!-- Facebook sharing information tags -->
8 8
 	<meta property="og:title" content="<?php echo $subject; ?>" />
9 9
 	<title><?php echo $subject; ?></title>
10
-	<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_head', $message_type, $subject, $from, $main_body ); ?>
10
+	<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_head', $message_type, $subject, $from, $main_body); ?>
11 11
 </head>
12
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_header', $message_type, $subject, $from, $main_body ); ?>
12
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_header', $message_type, $subject, $from, $main_body); ?>
13 13
 <body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
14
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_before_main_body', $message_type, $subject, $from, $main_body ); ?>
14
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_before_main_body', $message_type, $subject, $from, $main_body); ?>
15 15
 <?php echo $main_body; ?>
16
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_after_main_body', $message_type, $subject, $from, $main_body ); ?>
16
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_after_main_body', $message_type, $subject, $from, $main_body); ?>
17 17
 </body>
18
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_footer', $message_type, $subject, $from, $main_body ); ?>
18
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_footer', $message_type, $subject, $from, $main_body); ?>
19 19
 </html>
20 20
\ No newline at end of file
Please login to merge, or discard this patch.