Completed
Branch BUG-8936-recaptcha-fail (74c1f8)
by
unknown
43:02 queued 30:40
created
core/helpers/EEH_Form_Fields.helper.php 4 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 
394 394
 	/**
395 395
 	 * generate_question_groups_html
396
- 	 *
396
+	 *
397 397
 	 * @param string $question_groups
398 398
 	 * @return string HTML
399 399
 	 */
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 
538 538
 	/**
539 539
 	 * generate_form_input
540
- 	 *
540
+	 *
541 541
 	 * @param EE_Question_Form_Input $QFI
542 542
 	 * @return string HTML
543 543
 	 */
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 
613 613
 	/**
614 614
 	 * generates HTML for a form text input
615
- 	 *
615
+	 *
616 616
 	 * @param string $question 	label content
617 617
 	 * @param string $answer 		form input value attribute
618 618
 	 * @param string $name 			form input name attribute
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 
658 658
 	/**
659 659
 	 * generates HTML for a form textarea
660
- 	 *
660
+	 *
661 661
 	 * @param string $question 		label content
662 662
 	 * @param string $answer 		form input value attribute
663 663
 	 * @param string $name 			form input name attribute
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 
709 709
 	/**
710 710
 	 * generates HTML for a form select input
711
- 	 *
711
+	 *
712 712
 	 * @param string $question 		label content
713 713
 	 * @param string $answer 		form input value attribute
714 714
 	 * @param array $options			array of answer options where array key = option value and array value = option display text
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 
886 886
 	/**
887 887
 	 * generates HTML for form checkbox inputs
888
- 	 *
888
+	 *
889 889
 	 * @param string $question 		label content
890 890
 	 * @param string $answer 		form input value attribute
891 891
 	 * @param array $options 			array of options where array key = option value and array value = option display text
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 
967 967
 	/**
968 968
 	 * generates HTML for a form datepicker input
969
- 	 *
969
+	 *
970 970
 	 * @param string $question 	label content
971 971
 	 * @param string $answer 		form input value attribute
972 972
 	 * @param string $name 			form input name attribute
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.
Spacing   +378 added lines, -378 removed lines patch added patch discarded remove patch
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 	 * 	@return string
70 70
 	 * 	@todo: at some point we can break this down into other static methods to abstract it a bit better.
71 71
 	 */
72
-	static public function get_form_fields( $input_vars = array(), $id = FALSE ) {
72
+	static public function get_form_fields($input_vars = array(), $id = FALSE) {
73 73
 		
74
-		if ( empty($input_vars) ) {
75
-			EE_Error::add_error( __('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
74
+		if (empty($input_vars)) {
75
+			EE_Error::add_error(__('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
76 76
 			return FALSE;
77 77
 		}
78 78
 
@@ -98,25 +98,25 @@  discard block
 block discarded – undo
98 98
 				'append_content' => ''
99 99
 				);
100 100
 
101
-			$input_value = wp_parse_args( $input_value, $defaults );
101
+			$input_value = wp_parse_args($input_value, $defaults);
102 102
 
103 103
 			// required fields get a *
104 104
 			$required = isset($input_value['required']) && $input_value['required'] ? ' <span>*</span>: ' : ': ';
105 105
 			// and the css class "required"
106
-			$css_class = isset( $input_value['css_class'] ) ? $input_value['css_class'] : '';
107
-			$styles = $input_value['required'] ? 'required ' . $css_class : $css_class;
106
+			$css_class = isset($input_value['css_class']) ? $input_value['css_class'] : '';
107
+			$styles = $input_value['required'] ? 'required '.$css_class : $css_class;
108 108
 
109
-			$field_id = ($id) ? $id . '-' . $input_key : $input_key;
110
-			$tabindex = !empty($input_value['tabindex']) ? ' tabindex="' . $input_value['tabindex'] . '"' : '';
109
+			$field_id = ($id) ? $id.'-'.$input_key : $input_key;
110
+			$tabindex = ! empty($input_value['tabindex']) ? ' tabindex="'.$input_value['tabindex'].'"' : '';
111 111
 
112 112
 			//rows or cols?
113
-			$rows = isset($input_value['rows'] ) ? $input_value['rows'] : '10';
114
-			$cols = isset($input_value['cols'] ) ? $input_value['cols'] : '80';
113
+			$rows = isset($input_value['rows']) ? $input_value['rows'] : '10';
114
+			$cols = isset($input_value['cols']) ? $input_value['cols'] : '80';
115 115
 
116 116
 			//any content?
117 117
 			$append_content = $input_value['append_content'];
118 118
 
119
-			$output .= (!$close) ? '<ul>' : '';
119
+			$output .= ( ! $close) ? '<ul>' : '';
120 120
 			$output .= '<li>';
121 121
 
122 122
 			// what type of input are we dealing with ?
@@ -124,15 +124,15 @@  discard block
 block discarded – undo
124 124
 
125 125
 				// text inputs
126 126
 				case 'text' :
127
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
128
-					$output .= "\n\t\t\t" . '<input id="' . $field_id . '" class="' . $styles . '" type="text" value="' . $input_value['value'] . '" name="' . $input_value['name'] . '"' . $tabindex . '>';
127
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
128
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" class="'.$styles.'" type="text" value="'.$input_value['value'].'" name="'.$input_value['name'].'"'.$tabindex.'>';
129 129
 					break;
130 130
 
131 131
 				// dropdowns
132 132
 				case 'select' :
133 133
 
134
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
135
-					$output .= "\n\t\t\t" . '<select id="' . $field_id . '" class="' . $styles . '" name="' . $input_value['name'] . '"' . $tabindex . '>';
134
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
135
+					$output .= "\n\t\t\t".'<select id="'.$field_id.'" class="'.$styles.'" name="'.$input_value['name'].'"'.$tabindex.'>';
136 136
 
137 137
 					if (is_array($input_value['options'])) {
138 138
 						$options = $input_value['options'];
@@ -141,30 +141,30 @@  discard block
 block discarded – undo
141 141
 					}
142 142
 
143 143
 					foreach ($options as $key => $value) {
144
-						$selected = isset( $input_value['value'] ) && $input_value['value'] == $key ? 'selected=selected' : '';
144
+						$selected = isset($input_value['value']) && $input_value['value'] == $key ? 'selected=selected' : '';
145 145
 						//$key = str_replace( ' ', '_', sanitize_key( $value ));
146
-						$output .= "\n\t\t\t\t" . '<option '. $selected . ' value="' . $key . '">' . $value . '</option>';
146
+						$output .= "\n\t\t\t\t".'<option '.$selected.' value="'.$key.'">'.$value.'</option>';
147 147
 					}
148
-					$output .= "\n\t\t\t" . '</select>';
148
+					$output .= "\n\t\t\t".'</select>';
149 149
 
150 150
 					break;
151 151
 
152 152
 				case 'textarea' :
153 153
 
154
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
155
-					$output .= "\n\t\t\t" . '<textarea id="' . $field_id . '" class="' . $styles . '" rows="'.$rows.'" cols="'.$cols.'" name="' . $input_value['name'] . '"' . $tabindex . '>' . $input_value['value'] . '</textarea>';
154
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
155
+					$output .= "\n\t\t\t".'<textarea id="'.$field_id.'" class="'.$styles.'" rows="'.$rows.'" cols="'.$cols.'" name="'.$input_value['name'].'"'.$tabindex.'>'.$input_value['value'].'</textarea>';
156 156
 					break;
157 157
 
158 158
 				case 'hidden' :
159 159
 					$close = false;
160 160
 					$output .= "</li></ul>";
161
-					$output .= "\n\t\t\t" . '<input id="' . $field_id . '" type="hidden" name="' . $input_value['name'] . '" value="' . $input_value['value'] . '">';
161
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" type="hidden" name="'.$input_value['name'].'" value="'.$input_value['value'].'">';
162 162
 					break;
163 163
 
164 164
 				case 'checkbox' :
165
-					$checked = ( $input_value['value'] == 1 ) ? 'checked="checked"' : '';
166
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
167
-					$output .= "\n\t\t\t" . '<input id="' . $field_id. '" type="checkbox" name="' . $input_value['name'] . '" value="1"' . $checked . $tabindex . ' />';
165
+					$checked = ($input_value['value'] == 1) ? 'checked="checked"' : '';
166
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
167
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" type="checkbox" name="'.$input_value['name'].'" value="1"'.$checked.$tabindex.' />';
168 168
 					break;
169 169
 
170 170
 				case 'wp_editor' :
@@ -177,19 +177,19 @@  discard block
 block discarded – undo
177 177
 					);
178 178
 					$output .= '</li>';
179 179
 					$output .= '</ul>';
180
-					$output .= '<h4>' . $input_value['label'] . '</h4>';
181
-					if ( $append_content ) {
180
+					$output .= '<h4>'.$input_value['label'].'</h4>';
181
+					if ($append_content) {
182 182
 						$output .= $append_content;
183 183
 					}
184 184
 					ob_start();
185
-					wp_editor( $input_value['value'], $field_id, $editor_settings);
185
+					wp_editor($input_value['value'], $field_id, $editor_settings);
186 186
 					$editor = ob_get_contents();
187 187
 					ob_end_clean();
188 188
 					$output .= $editor;
189 189
 					break;
190 190
 
191 191
 				}
192
-				if ( $append_content && $input_value['input'] !== 'wp_editor' ) {
192
+				if ($append_content && $input_value['input'] !== 'wp_editor') {
193 193
 					$output .= $append_content;
194 194
 				}
195 195
 				$output .= ($close) ? '</li>' : '';
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		$form_fields = array();
231 231
 		$fields = (array) $fields;
232 232
 
233
-		foreach ( $fields as $field_name => $field_atts ) {
233
+		foreach ($fields as $field_name => $field_atts) {
234 234
 			//defaults:
235 235
 			$defaults = array(
236 236
 				'label' => '',
@@ -248,67 +248,67 @@  discard block
 block discarded – undo
248 248
 				'wpeditor_args' => array()
249 249
 				);
250 250
 			// merge defaults with passed arguments
251
-			$_fields = wp_parse_args( $field_atts, $defaults);
252
-			extract( $_fields );
251
+			$_fields = wp_parse_args($field_atts, $defaults);
252
+			extract($_fields);
253 253
 			// generate label
254
-			$label = empty($label) ? '' : '<label for="' . $id . '">' . $label . '</label>';
254
+			$label = empty($label) ? '' : '<label for="'.$id.'">'.$label.'</label>';
255 255
 			// generate field name
256
-			$f_name = !empty($unique_id) ? $field_name . '[' . $unique_id . ']' : $field_name;
256
+			$f_name = ! empty($unique_id) ? $field_name.'['.$unique_id.']' : $field_name;
257 257
 
258 258
 			//tabindex
259
-			$tabindex_str = !empty( $tabindex ) ? ' tabindex="' . $tabindex . '"' : '';
259
+			$tabindex_str = ! empty($tabindex) ? ' tabindex="'.$tabindex.'"' : '';
260 260
 
261 261
 			//we determine what we're building based on the type
262
-			switch ( $type ) {
262
+			switch ($type) {
263 263
 
264 264
 				case 'textarea' :
265
-						$fld = '<textarea id="' . $id . '" class="' . $class . '" rows="' . $dimensions[1] . '" cols="' . $dimensions[0] . '" name="' . $f_name . '"' . $tabindex_str . '>' . $value . '</textarea>';
265
+						$fld = '<textarea id="'.$id.'" class="'.$class.'" rows="'.$dimensions[1].'" cols="'.$dimensions[0].'" name="'.$f_name.'"'.$tabindex_str.'>'.$value.'</textarea>';
266 266
 						$fld .= $extra_desc;
267 267
 					break;
268 268
 
269 269
 				case 'checkbox' :
270 270
 						$c_input = '';
271
-						if ( is_array($value) ) {
272
-							foreach ( $value as $key => $val ) {
273
-								$c_id = $field_name . '_' . $value;
274
-								$c_class = isset($classes[$key]) ? ' class="' . $classes[$key] . '" ' : '';
275
-								$c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : '';
276
-								$checked = !empty($default) && $default == $val ? ' checked="checked" ' : '';
277
-								$c_input .= '<input name="' . $f_name . '[]" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label;
271
+						if (is_array($value)) {
272
+							foreach ($value as $key => $val) {
273
+								$c_id = $field_name.'_'.$value;
274
+								$c_class = isset($classes[$key]) ? ' class="'.$classes[$key].'" ' : '';
275
+								$c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : '';
276
+								$checked = ! empty($default) && $default == $val ? ' checked="checked" ' : '';
277
+								$c_input .= '<input name="'.$f_name.'[]" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label;
278 278
 							}
279 279
 							$fld = $c_input;
280 280
 						} else {
281
-							$checked = !empty($default) && $default == $val ? 'checked="checked" ' : '';
282
-							$fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n";
281
+							$checked = ! empty($default) && $default == $val ? 'checked="checked" ' : '';
282
+							$fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n";
283 283
 						}
284 284
 					break;
285 285
 
286 286
 				case 'radio' :
287 287
 						$c_input = '';
288
-						if ( is_array($value) ) {
289
-							foreach ( $value as $key => $val ) {
290
-								$c_id = $field_name . '_' . $value;
291
-								$c_class = isset($classes[$key]) ? 'class="' . $classes[$key] . '" ' : '';
292
-								$c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : '';
293
-								$checked = !empty($default) && $default == $val ? ' checked="checked" ' : '';
294
-								$c_input .= '<input name="' . $f_name . '" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label;
288
+						if (is_array($value)) {
289
+							foreach ($value as $key => $val) {
290
+								$c_id = $field_name.'_'.$value;
291
+								$c_class = isset($classes[$key]) ? 'class="'.$classes[$key].'" ' : '';
292
+								$c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : '';
293
+								$checked = ! empty($default) && $default == $val ? ' checked="checked" ' : '';
294
+								$c_input .= '<input name="'.$f_name.'" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label;
295 295
 							}
296 296
 							$fld = $c_input;
297 297
 						} else {
298
-							$checked = !empty($default) && $default == $val ? 'checked="checked" ' : '';
299
-							$fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n";
298
+							$checked = ! empty($default) && $default == $val ? 'checked="checked" ' : '';
299
+							$fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n";
300 300
 						}
301 301
 					break;
302 302
 
303 303
 				case 'hidden' :
304
-						$fld = '<input name="' . $f_name . '" type="hidden" id="' . $id . '" class="' . $class . '" value="' . $value . '" />' . "\n";
304
+						$fld = '<input name="'.$f_name.'" type="hidden" id="'.$id.'" class="'.$class.'" value="'.$value.'" />'."\n";
305 305
 					break;
306 306
 
307 307
 				case 'select' :
308
-						$fld = '<select name="' . $f_name . '" class="' . $class . '" id="' . $id . '"' . $tabindex_str . '>' . "\n";
309
-						foreach ( $value as $key => $val ) {
310
-							$checked = !empty($default) && $default == $val ? ' selected="selected"' : '';
311
-							$fld .= "\t" . '<option value="' . $val . '"' . $checked . '>' . $labels[$key] . '</option>' . "\n";
308
+						$fld = '<select name="'.$f_name.'" class="'.$class.'" id="'.$id.'"'.$tabindex_str.'>'."\n";
309
+						foreach ($value as $key => $val) {
310
+							$checked = ! empty($default) && $default == $val ? ' selected="selected"' : '';
311
+							$fld .= "\t".'<option value="'.$val.'"'.$checked.'>'.$labels[$key].'</option>'."\n";
312 312
 						}
313 313
 						$fld .= '</select>';
314 314
 					break;
@@ -320,21 +320,21 @@  discard block
 block discarded – undo
320 320
 							'editor_class' => $class,
321 321
 							'tabindex' => $tabindex
322 322
 							);
323
-						$editor_settings = array_merge( $wpeditor_args, $editor_settings );
323
+						$editor_settings = array_merge($wpeditor_args, $editor_settings);
324 324
 						ob_start();
325
-						wp_editor( $value, $id, $editor_settings );
325
+						wp_editor($value, $id, $editor_settings);
326 326
 						$editor = ob_get_contents();
327 327
 						ob_end_clean();
328 328
 						$fld = $editor;
329 329
 					break;
330 330
 
331 331
 				default : //'text fields'
332
-						$fld = '<input name="' . $f_name . '" type="text" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $tabindex_str . ' />' . "\n";
332
+						$fld = '<input name="'.$f_name.'" type="text" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$tabindex_str.' />'."\n";
333 333
 						$fld .= $extra_desc;
334 334
 
335 335
 			}
336 336
 
337
-			$form_fields[ $field_name ] = array( 'label' => $label, 'field' => $fld );
337
+			$form_fields[$field_name] = array('label' => $label, 'field' => $fld);
338 338
 		}
339 339
 
340 340
 		return $form_fields;
@@ -363,22 +363,22 @@  discard block
 block discarded – undo
363 363
 	 */
364 364
 	static public function select_input($name, $values, $default = '', $parameters = '', $class = '', $autosize = true) {
365 365
 		//if $values was submitted in the wrong format, convert it over
366
-		if(!empty($values) && (!array_key_exists(0,$values) || !is_array($values[0]))){
367
-			$converted_values=array();
368
-			foreach($values as $id=>$text){
369
-				$converted_values[]=array('id'=>$id,'text'=>$text);
366
+		if ( ! empty($values) && ( ! array_key_exists(0, $values) || ! is_array($values[0]))) {
367
+			$converted_values = array();
368
+			foreach ($values as $id=>$text) {
369
+				$converted_values[] = array('id'=>$id, 'text'=>$text);
370 370
 			}
371
-			$values=$converted_values;
371
+			$values = $converted_values;
372 372
 		}
373 373
 		//load formatter helper
374
-		EE_Registry::instance()->load_helper( 'Formatter' );
374
+		EE_Registry::instance()->load_helper('Formatter');
375 375
 		//EE_Registry::instance()->load_helper( 'Formatter' );
376 376
 
377
-		$field = '<select id="' . EEH_Formatter::ee_tep_output_string($name) . '" name="' . EEH_Formatter::ee_tep_output_string($name) . '"';
377
+		$field = '<select id="'.EEH_Formatter::ee_tep_output_string($name).'" name="'.EEH_Formatter::ee_tep_output_string($name).'"';
378 378
 		//Debug
379 379
 		//EEH_Debug_Tools::printr( $values, '$values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
380
-		if ( EEH_Formatter::ee_tep_not_null($parameters))
381
-			$field .= ' ' . $parameters;
380
+		if (EEH_Formatter::ee_tep_not_null($parameters))
381
+			$field .= ' '.$parameters;
382 382
 		if ($autosize) {
383 383
 			$size = 'med';
384 384
 			for ($ii = 0, $ni = sizeof($values); $ii < $ni; $ii++) {
@@ -391,21 +391,21 @@  discard block
 block discarded – undo
391 391
 			$size = '';
392 392
 		}
393 393
 
394
-		$field .= ' class="' . $class . ' ' . $size . '">';
394
+		$field .= ' class="'.$class.' '.$size.'">';
395 395
 
396 396
 		if (empty($default) && isset($GLOBALS[$name]))
397 397
 			$default = stripslashes($GLOBALS[$name]);
398 398
 
399 399
 
400 400
 		for ($i = 0, $n = sizeof($values); $i < $n; $i++) {
401
-			$field .= '<option value="' . $values[$i]['id'] . '"';
401
+			$field .= '<option value="'.$values[$i]['id'].'"';
402 402
 			if ($default == $values[$i]['id']) {
403 403
 				$field .= ' selected = "selected"';
404 404
 			}
405
-			if ( isset( $values[$i]['class'] ) ) {
406
-				$field .= ' class="' . $values[$i]['class'] . '"';
405
+			if (isset($values[$i]['class'])) {
406
+				$field .= ' class="'.$values[$i]['class'].'"';
407 407
 			}
408
-			$field .= '>' . $values[$i]['text'] . '</option>';
408
+			$field .= '>'.$values[$i]['text'].'</option>';
409 409
 		}
410 410
 		$field .= '</select>';
411 411
 
@@ -423,38 +423,38 @@  discard block
 block discarded – undo
423 423
 	 * @param string $question_groups
424 424
 	 * @return string HTML
425 425
 	 */
426
-	static function generate_question_groups_html( $question_groups = array(), $group_wrapper = 'fieldset' ) {
426
+	static function generate_question_groups_html($question_groups = array(), $group_wrapper = 'fieldset') {
427 427
 
428 428
 		$html = '';
429
-		$before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' );
430
-		$after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' );
429
+		$before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
430
+		$after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
431 431
 
432
-		if ( ! empty( $question_groups )) {
432
+		if ( ! empty($question_groups)) {
433 433
 			//EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
434 434
 			// loop thru question groups
435
-			foreach ( $question_groups as $QSG ) {
435
+			foreach ($question_groups as $QSG) {
436 436
 				// check that questions exist
437
-				if ( ! empty( $QSG['QSG_questions'] )) {
437
+				if ( ! empty($QSG['QSG_questions'])) {
438 438
 					// use fieldsets
439
-					$html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG['QSG_identifier'] . '">';
439
+					$html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG['QSG_identifier'].'">';
440 440
 					// group_name
441
-					$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>' : '';
441
+					$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>' : '';
442 442
 					// group_desc
443
-					$html .= $QSG['QSG_show_group_desc'] && ! empty( $QSG['QSG_desc'] ) ? '<div class="espresso-question-group-desc-pg">' . self::prep_answer( $QSG['QSG_desc'] ) . '</div>' : '';
443
+					$html .= $QSG['QSG_show_group_desc'] && ! empty($QSG['QSG_desc']) ? '<div class="espresso-question-group-desc-pg">'.self::prep_answer($QSG['QSG_desc']).'</div>' : '';
444 444
 
445 445
 					$html .= $before_question_group_questions;
446 446
 					// loop thru questions
447
-					foreach ( $QSG['QSG_questions'] as $question ) {
447
+					foreach ($QSG['QSG_questions'] as $question) {
448 448
 //						EEH_Debug_Tools::printr( $question, '$question  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
449 449
 						$QFI = new EE_Question_Form_Input(
450 450
 							$question['qst_obj'],
451 451
 							$question['ans_obj'],
452 452
 							$question
453 453
 						);
454
-						$html .= self::generate_form_input( $QFI );
454
+						$html .= self::generate_form_input($QFI);
455 455
 					}
456 456
 					$html .= $after_question_group_questions;
457
-					$html .= "\n\t" . '</' . $group_wrapper . '>';
457
+					$html .= "\n\t".'</'.$group_wrapper.'>';
458 458
 				}
459 459
 			}
460 460
 		}
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
 	 * @param string       $group_wrapper
475 475
 	 * @return string HTML
476 476
 	 */
477
-	static function generate_question_groups_html2( $question_groups = array(), $q_meta = array(), 	$from_admin = FALSE, $group_wrapper = 'fieldset' ) {
477
+	static function generate_question_groups_html2($question_groups = array(), $q_meta = array(), $from_admin = FALSE, $group_wrapper = 'fieldset') {
478 478
 
479 479
 		$html = '';
480
-		$before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' );
481
-		$after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' );
480
+		$before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
481
+		$after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
482 482
 
483 483
 		$default_q_meta = array(
484 484
 				'att_nmbr' => 1,
@@ -487,55 +487,55 @@  discard block
 block discarded – undo
487 487
 				'input_id' => '',
488 488
 				'input_class' => ''
489 489
 		);
490
-		$q_meta = array_merge( $default_q_meta, $q_meta );
490
+		$q_meta = array_merge($default_q_meta, $q_meta);
491 491
 		//EEH_Debug_Tools::printr( $q_meta, '$q_meta  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
492 492
 
493
-		if ( ! empty( $question_groups )) {
493
+		if ( ! empty($question_groups)) {
494 494
 //			EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
495 495
 			// loop thru question groups
496
-			foreach ( $question_groups as $QSG ) {
497
-				if ( $QSG instanceof EE_Question_Group ) {
496
+			foreach ($question_groups as $QSG) {
497
+				if ($QSG instanceof EE_Question_Group) {
498 498
 					// check that questions exist
499 499
 
500
-					$where = array( 'QST_deleted' => 0 );
501
-					if ( ! $from_admin ) {
500
+					$where = array('QST_deleted' => 0);
501
+					if ( ! $from_admin) {
502 502
 						$where['QST_admin_only'] = 0;
503 503
 					}
504
-					$questions = $QSG->questions( array( $where, 'order_by' => array( 'Question_Group_Question.QGQ_order' => 'ASC' )));
505
-					if ( ! empty( $questions )) {
504
+					$questions = $QSG->questions(array($where, 'order_by' => array('Question_Group_Question.QGQ_order' => 'ASC')));
505
+					if ( ! empty($questions)) {
506 506
 						// use fieldsets
507
-						$html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG->get( 'QSG_identifier' ) . '">';
507
+						$html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG->get('QSG_identifier').'">';
508 508
 						// group_name
509
-						if ( $QSG->show_group_name() ) {
510
-							$html .=  "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . $QSG->get_pretty( 'QSG_name' ) . '</h5>';
509
+						if ($QSG->show_group_name()) {
510
+							$html .= "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.$QSG->get_pretty('QSG_name').'</h5>';
511 511
 						}
512 512
 						// group_desc
513
-						if ( $QSG->show_group_desc() ) {
514
-							$html .=  '<div class="espresso-question-group-desc-pg">' . $QSG->get_pretty( 'QSG_desc'  ) . '</div>';
513
+						if ($QSG->show_group_desc()) {
514
+							$html .= '<div class="espresso-question-group-desc-pg">'.$QSG->get_pretty('QSG_desc').'</div>';
515 515
 						}
516 516
 
517 517
 						$html .= $before_question_group_questions;
518 518
 						// loop thru questions
519
-						foreach ( $questions as $QST ) {
519
+						foreach ($questions as $QST) {
520 520
 							$qstn_id = $QST->is_system_question() ? $QST->system_ID() : $QST->ID();
521 521
 
522 522
 							$answer = NULL;
523 523
 
524
-							if (  isset( $_GET['qstn'] ) && isset( $q_meta['input_id'] ) && isset( $q_meta['att_nmbr'] )) {
524
+							if (isset($_GET['qstn']) && isset($q_meta['input_id']) && isset($q_meta['att_nmbr'])) {
525 525
 								// check for answer in $_GET in case we are reprocessing a form after an error
526
-								if ( isset( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] )) {
527
-									$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 ] );
526
+								if (isset($_GET['qstn'][$q_meta['input_id']][$qstn_id])) {
527
+									$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]);
528 528
 								}
529
-							} else if ( isset( $q_meta['attendee'] ) && $q_meta['attendee'] ) {
529
+							} else if (isset($q_meta['attendee']) && $q_meta['attendee']) {
530 530
 								//attendee data from the session
531
-								$answer = isset( $q_meta['attendee'][ $qstn_id ] ) ? $q_meta['attendee'][ $qstn_id ] : NULL;
531
+								$answer = isset($q_meta['attendee'][$qstn_id]) ? $q_meta['attendee'][$qstn_id] : NULL;
532 532
 							}
533 533
 
534 534
 
535 535
 
536 536
 							$QFI = new EE_Question_Form_Input(
537 537
 									$QST,
538
-									EE_Answer::new_instance ( array(
538
+									EE_Answer::new_instance(array(
539 539
 											'ANS_ID'=> 0,
540 540
 											'QST_ID'=> 0,
541 541
 											'REG_ID'=> 0,
@@ -544,10 +544,10 @@  discard block
 block discarded – undo
544 544
 									$q_meta
545 545
 							);
546 546
 							//EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
547
-							$html .= self::generate_form_input( $QFI );
547
+							$html .= self::generate_form_input($QFI);
548 548
 						}
549 549
 						$html .= $after_question_group_questions;
550
-						$html .= "\n\t" . '</' . $group_wrapper . '>';
550
+						$html .= "\n\t".'</'.$group_wrapper.'>';
551 551
 					}
552 552
 				}
553 553
 			}
@@ -567,63 +567,63 @@  discard block
 block discarded – undo
567 567
 	 * @param EE_Question_Form_Input $QFI
568 568
 	 * @return string HTML
569 569
 	 */
570
-	static function generate_form_input( EE_Question_Form_Input $QFI ) {
571
-		if ( isset( $QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin() ) {
570
+	static function generate_form_input(EE_Question_Form_Input $QFI) {
571
+		if (isset($QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin()) {
572 572
 			return '';
573 573
 		}
574 574
 
575
-		$QFI = self::_load_system_dropdowns( $QFI );
576
-		$QFI = self::_load_specialized_dropdowns( $QFI );
575
+		$QFI = self::_load_system_dropdowns($QFI);
576
+		$QFI = self::_load_specialized_dropdowns($QFI);
577 577
 
578 578
 		//we also need to verify
579 579
 
580 580
 		$display_text = $QFI->get('QST_display_text');
581 581
 		$input_name = $QFI->get('QST_input_name');
582
-		$answer = EE_Registry::instance()->REQ->is_set( $input_name ) ? EE_Registry::instance()->REQ->get( $input_name ) : $QFI->get('ANS_value');
582
+		$answer = EE_Registry::instance()->REQ->is_set($input_name) ? EE_Registry::instance()->REQ->get($input_name) : $QFI->get('ANS_value');
583 583
 		$input_id = $QFI->get('QST_input_id');
584 584
 		$input_class = $QFI->get('QST_input_class');
585 585
 //		$disabled = $QFI->get('QST_disabled') ? ' disabled="disabled"' : '';
586 586
 		$disabled = $QFI->get('QST_disabled') ? TRUE : FALSE;
587
-		$required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>' );
587
+		$required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>');
588 588
 		$QST_required = $QFI->get('QST_required');
589
-		$required = $QST_required ? array( 'label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required ) : array();
590
-		$use_html_entities = $QFI->get_meta( 'htmlentities' );
591
-		$required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __( 'This field is required', 'event_espresso' );
592
-		$required_text = $QST_required ? "\n\t\t\t" . '<div class="required-text hidden">' . self::prep_answer( $required_text, $use_html_entities ) . '</div>' : '';
589
+		$required = $QST_required ? array('label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required) : array();
590
+		$use_html_entities = $QFI->get_meta('htmlentities');
591
+		$required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __('This field is required', 'event_espresso');
592
+		$required_text = $QST_required ? "\n\t\t\t".'<div class="required-text hidden">'.self::prep_answer($required_text, $use_html_entities).'</div>' : '';
593 593
 		$label_class = 'espresso-form-input-lbl';
594
-		$QST_options = $QFI->options(true,$answer);
595
-		$options = is_array( $QST_options ) ? self::prep_answer_options( $QST_options ) : array();
594
+		$QST_options = $QFI->options(true, $answer);
595
+		$options = is_array($QST_options) ? self::prep_answer_options($QST_options) : array();
596 596
 		$system_ID = $QFI->get('QST_system');
597
-		$label_b4 = $QFI->get_meta( 'label_b4' );
598
-		$use_desc_4_label = $QFI->get_meta( 'use_desc_4_label' );
597
+		$label_b4 = $QFI->get_meta('label_b4');
598
+		$use_desc_4_label = $QFI->get_meta('use_desc_4_label');
599 599
 
600 600
 
601
-		switch ( $QFI->get('QST_type') ){
601
+		switch ($QFI->get('QST_type')) {
602 602
 
603 603
 			case 'TEXTAREA' :
604
-					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 );
604
+					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);
605 605
 				break;
606 606
 
607 607
 			case 'DROPDOWN' :
608
-					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 );
608
+					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);
609 609
 				break;
610 610
 
611 611
 
612 612
 			case 'RADIO_BTN' :
613
-					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 );
613
+					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);
614 614
 				break;
615 615
 
616 616
 			case 'CHECKBOX' :
617
-					return EEH_Form_Fields::checkbox( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $label_b4, $system_ID, $use_html_entities );
617
+					return EEH_Form_Fields::checkbox($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $label_b4, $system_ID, $use_html_entities);
618 618
 				break;
619 619
 
620 620
 			case 'DATE' :
621
-					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 );
621
+					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);
622 622
 				break;
623 623
 
624 624
 			case 'TEXT' :
625 625
 			default:
626
-					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 );
626
+					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);
627 627
 				break;
628 628
 
629 629
 		}
@@ -649,31 +649,31 @@  discard block
 block discarded – undo
649 649
 	 * @param string $disabled 		disabled="disabled" or null
650 650
 	 * @return string HTML
651 651
 	 */
652
-	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 ) {
652
+	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) {
653 653
 		// need these
654
-		if ( ! $question || ! $name ) {
654
+		if ( ! $question || ! $name) {
655 655
 			return NULL;
656 656
 		}
657 657
 		// prep the answer
658
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
658
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
659 659
 		// prep the required array
660
-		$required = self::prep_required( $required );
660
+		$required = self::prep_required($required);
661 661
 		// set disabled tag
662
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
662
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
663 663
 		// ya gots ta have style man!!!
664 664
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-text-inp';
665
-		$class = empty( $class ) ? $txt_class : $class;
666
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
667
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
665
+		$class = empty($class) ? $txt_class : $class;
666
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
667
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
668 668
 
669
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
669
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
670 670
 		// filter label but ensure required text comes before it
671
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
671
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
672 672
 
673
-		$input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" value="' . esc_attr( $answer ) . '"  title="' . esc_attr( $required['msg'] ) . '" ' . $disabled .' ' . $extra . '/>';
673
+		$input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" value="'.esc_attr($answer).'"  title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>';
674 674
 
675
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
676
-		return  $label_html . $input_html;
675
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
676
+		return  $label_html.$input_html;
677 677
 
678 678
 	}
679 679
 
@@ -695,35 +695,35 @@  discard block
 block discarded – undo
695 695
 	 * @param string $disabled 		disabled="disabled" or null
696 696
 	 * @return string HTML
697 697
 	 */
698
-	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 ) {
698
+	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) {
699 699
 		// need these
700
-		if ( ! $question || ! $name ) {
700
+		if ( ! $question || ! $name) {
701 701
 			return NULL;
702 702
 		}
703 703
 		// prep the answer
704
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
704
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
705 705
 		// prep the required array
706
-		$required = self::prep_required( $required );
706
+		$required = self::prep_required($required);
707 707
 		// make sure $dimensions is an array
708
-		$dimensions = is_array( $dimensions ) ? $dimensions : array();
708
+		$dimensions = is_array($dimensions) ? $dimensions : array();
709 709
 		// and set some defaults
710
-		$dimensions = array_merge( array( 'rows' => 3, 'cols' => 40 ), $dimensions );
710
+		$dimensions = array_merge(array('rows' => 3, 'cols' => 40), $dimensions);
711 711
 		// set disabled tag
712
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
712
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
713 713
 		// ya gots ta have style man!!!
714 714
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-textarea-inp';
715
-		$class = empty( $class ) ? $txt_class : $class;
716
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
717
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
715
+		$class = empty($class) ? $txt_class : $class;
716
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
717
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
718 718
 
719
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
719
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
720 720
 		// filter label but ensure required text comes before it
721
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
721
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
722 722
 
723
-		$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>';
723
+		$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>';
724 724
 
725
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
726
-		return  $label_html . $input_html;
725
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
726
+		return  $label_html.$input_html;
727 727
 
728 728
 	}
729 729
 
@@ -746,47 +746,47 @@  discard block
 block discarded – undo
746 746
 	 * @param string $disabled 		disabled="disabled" or null
747 747
 	 * @return string HTML
748 748
 	 */
749
-	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 ) {
749
+	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) {
750 750
 
751 751
 		// need these
752
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
752
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
753 753
 			return NULL;
754 754
 		}
755 755
 		// prep the answer
756
-		$answer = is_array( $answer ) ? self::prep_answer( array_shift( $answer ), $use_html_entities) : self::prep_answer( $answer, $use_html_entities );
756
+		$answer = is_array($answer) ? self::prep_answer(array_shift($answer), $use_html_entities) : self::prep_answer($answer, $use_html_entities);
757 757
 		// prep the required array
758
-		$required = self::prep_required( $required );
758
+		$required = self::prep_required($required);
759 759
 		// set disabled tag
760
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
760
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
761 761
 		// ya gots ta have style man!!!
762 762
 		$txt_class = is_admin() ? 'wide' : 'espresso-select-inp';
763
-		$class = empty( $class ) ? $txt_class : $class;
764
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
765
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
763
+		$class = empty($class) ? $txt_class : $class;
764
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
765
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
766 766
 
767
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
767
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
768 768
 		// filter label but ensure required text comes before it
769
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
769
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
770 770
 
771
-		$input_html = "\n\t\t\t" . '<select name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" title="' . esc_attr( $required['msg'] ) . '"' . $disabled . ' ' . $extra . '>';
771
+		$input_html = "\n\t\t\t".'<select name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" title="'.esc_attr($required['msg']).'"'.$disabled.' '.$extra.'>';
772 772
 		// recursively count array elements, to determine total number of options
773
-		$only_option = count( $options, 1 ) == 1 ? TRUE : FALSE;
774
-		if ( ! $only_option ) {
773
+		$only_option = count($options, 1) == 1 ? TRUE : FALSE;
774
+		if ( ! $only_option) {
775 775
 			// if there is NO answer set and there are multiple options to choose from, then set the "please select" message as selected
776 776
 			$selected = $answer === NULL ? ' selected="selected"' : '';
777
-			$input_html .= $add_please_select_option ? "\n\t\t\t\t" . '<option value=""' . $selected . '>' . __(' - please select - ', 'event_espresso') . '</option>' : '';
777
+			$input_html .= $add_please_select_option ? "\n\t\t\t\t".'<option value=""'.$selected.'>'.__(' - please select - ', 'event_espresso').'</option>' : '';
778 778
 		}
779
-		foreach ( $options as $key => $value ) {
779
+		foreach ($options as $key => $value) {
780 780
 			// if value is an array, then create option groups, else create regular ol' options
781
-			$input_html .= is_array( $value ) ? self::_generate_select_option_group( $key, $value, $answer, $use_html_entities ) : self::_generate_select_option( $value->value(), $value->desc(), $answer, $only_option, $use_html_entities );
781
+			$input_html .= is_array($value) ? self::_generate_select_option_group($key, $value, $answer, $use_html_entities) : self::_generate_select_option($value->value(), $value->desc(), $answer, $only_option, $use_html_entities);
782 782
 		}
783 783
 
784
-		$input_html .= "\n\t\t\t" . '</select>';
784
+		$input_html .= "\n\t\t\t".'</select>';
785 785
 
786
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID );
786
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID);
787 787
 
788
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
789
-		return  $label_html . $input_html;
788
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
789
+		return  $label_html.$input_html;
790 790
 
791 791
 	}
792 792
 
@@ -804,12 +804,12 @@  discard block
 block discarded – undo
804 804
 	 * @param boolean $use_html_entities
805 805
 	 * @return string
806 806
 	 */
807
-	private static function _generate_select_option_group( $opt_group, $QSOs, $answer, $use_html_entities = true ){
808
-		$html = "\n\t\t\t\t" . '<optgroup label="' . self::prep_option_value( $opt_group ) . '">';
809
-		foreach ( $QSOs as $QSO ) {
810
-			$html .= self::_generate_select_option( $QSO->value(), $QSO->desc(), $answer, false, $use_html_entities );
807
+	private static function _generate_select_option_group($opt_group, $QSOs, $answer, $use_html_entities = true) {
808
+		$html = "\n\t\t\t\t".'<optgroup label="'.self::prep_option_value($opt_group).'">';
809
+		foreach ($QSOs as $QSO) {
810
+			$html .= self::_generate_select_option($QSO->value(), $QSO->desc(), $answer, false, $use_html_entities);
811 811
 		}
812
-		$html .= "\n\t\t\t\t" . '</optgroup>';
812
+		$html .= "\n\t\t\t\t".'</optgroup>';
813 813
 		return $html;
814 814
 	}
815 815
 
@@ -824,12 +824,12 @@  discard block
 block discarded – undo
824 824
 	 * @param boolean $use_html_entities
825 825
 	 * @return string
826 826
 	 */
827
-	private static function _generate_select_option( $key, $value, $answer, $only_option = FALSE, $use_html_entities = true ){
828
-		$key = self::prep_answer( $key, $use_html_entities );
829
-		$value = self::prep_answer( $value, $use_html_entities );
830
-		$value = ! empty( $value ) ? $value : $key;
831
-		$selected = ( $answer == $key || $only_option ) ? ' selected="selected"' : '';
832
-		return "\n\t\t\t\t" . '<option value="' . self::prep_option_value( $key ) . '"' . $selected . '> ' . $value . '&nbsp;&nbsp;&nbsp;</option>';
827
+	private static function _generate_select_option($key, $value, $answer, $only_option = FALSE, $use_html_entities = true) {
828
+		$key = self::prep_answer($key, $use_html_entities);
829
+		$value = self::prep_answer($value, $use_html_entities);
830
+		$value = ! empty($value) ? $value : $key;
831
+		$selected = ($answer == $key || $only_option) ? ' selected="selected"' : '';
832
+		return "\n\t\t\t\t".'<option value="'.self::prep_option_value($key).'"'.$selected.'> '.$value.'&nbsp;&nbsp;&nbsp;</option>';
833 833
 	}
834 834
 
835 835
 
@@ -853,56 +853,56 @@  discard block
 block discarded – undo
853 853
 	 * @param bool        $use_desc_4_label
854 854
 	 * @return string HTML
855 855
 	 */
856
-	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 ) {
856
+	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) {
857 857
 		// need these
858
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
858
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
859 859
 			return NULL;
860 860
 		}
861 861
 		// prep the answer
862
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
862
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
863 863
 		// prep the required array
864
-		$required = self::prep_required( $required );
864
+		$required = self::prep_required($required);
865 865
 		// set disabled tag
866
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
866
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
867 867
 		// ya gots ta have style man!!!
868 868
 		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
869
-		$class = ! empty( $class ) ? $class : 'espresso-radio-btn-inp';
870
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
869
+		$class = ! empty($class) ? $class : 'espresso-radio-btn-inp';
870
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
871 871
 
872
-		$label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> ';
872
+		$label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> ';
873 873
 		// filter label but ensure required text comes before it
874
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
874
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
875 875
 
876
-		$input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-radio-btn-options-ul ' . $label_class . ' ' . $class . '-ul">';
876
+		$input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-radio-btn-options-ul '.$label_class.' '.$class.'-ul">';
877 877
 
878
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
879
-		$class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : '';
878
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
879
+		$class .= ! empty($required['class']) ? ' '.$required['class'] : '';
880 880
 
881
-		foreach ( $options as $OPT ) {
882
-			if ( $OPT instanceof EE_Question_Option ) {
883
-				$value = self::prep_option_value( $OPT->value() );
881
+		foreach ($options as $OPT) {
882
+			if ($OPT instanceof EE_Question_Option) {
883
+				$value = self::prep_option_value($OPT->value());
884 884
 				$label = $use_desc_4_label ? $OPT->desc() : $OPT->value();
885
-				$size = $use_desc_4_label ? self::get_label_size_class( $OPT->value() . ' ' . $OPT->desc() ) : self::get_label_size_class( $OPT->value() );
886
-				$desc = $OPT->desc();//no self::prep_answer
887
-				$answer = is_numeric( $value ) && empty( $answer ) ? 0 : $answer;
888
-				$checked = (string)$value == (string)$answer ? ' checked="checked"' : '';
889
-				$opt = '-' . sanitize_key( $value );
890
-
891
-				$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
892
-				$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-radio-btn-lbl">';
893
-				$input_html .= $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $label . '</span>' : '';
894
-				$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 . '/>';
895
-				$input_html .= ! $label_b4  ? "\n\t\t\t\t\t\t" . '<span class="espresso-radio-btn-desc">' . $label . '</span>' : '';
896
-				$input_html .= "\n\t\t\t\t\t" . '</label>';
897
-				$input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">' . $desc . '</span>';
898
-				$input_html .= "\n\t\t\t\t" . '</li>';
885
+				$size = $use_desc_4_label ? self::get_label_size_class($OPT->value().' '.$OPT->desc()) : self::get_label_size_class($OPT->value());
886
+				$desc = $OPT->desc(); //no self::prep_answer
887
+				$answer = is_numeric($value) && empty($answer) ? 0 : $answer;
888
+				$checked = (string) $value == (string) $answer ? ' checked="checked"' : '';
889
+				$opt = '-'.sanitize_key($value);
890
+
891
+				$input_html .= "\n\t\t\t\t".'<li'.$size.'>';
892
+				$input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-radio-btn-lbl">';
893
+				$input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$label.'</span>' : '';
894
+				$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.'/>';
895
+				$input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span class="espresso-radio-btn-desc">'.$label.'</span>' : '';
896
+				$input_html .= "\n\t\t\t\t\t".'</label>';
897
+				$input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">'.$desc.'</span>';
898
+				$input_html .= "\n\t\t\t\t".'</li>';
899 899
 			}
900 900
 		}
901 901
 
902
-		$input_html .= "\n\t\t\t" . '</ul>';
902
+		$input_html .= "\n\t\t\t".'</ul>';
903 903
 
904
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
905
-		return  $label_html . $input_html;
904
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
905
+		return  $label_html.$input_html;
906 906
 
907 907
 	}
908 908
 
@@ -925,65 +925,65 @@  discard block
 block discarded – undo
925 925
 	 * @param string $disabled 		disabled="disabled" or null
926 926
 	 * @return string HTML
927 927
 	 */
928
-	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 ) {
928
+	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) {
929 929
 		// need these
930
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
930
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
931 931
 			return NULL;
932 932
 		}
933
-		$answer = maybe_unserialize( $answer );
933
+		$answer = maybe_unserialize($answer);
934 934
 
935 935
 		// prep the answer(s)
936
-		$answer = is_array( $answer ) ? $answer : array( sanitize_key( $answer ) => $answer );
936
+		$answer = is_array($answer) ? $answer : array(sanitize_key($answer) => $answer);
937 937
 
938
-		foreach ( $answer as $key => $value ) {
939
-			$key = self::prep_option_value( $key );
940
-			$answer[$key] = self::prep_answer( $value, $use_html_entities );
938
+		foreach ($answer as $key => $value) {
939
+			$key = self::prep_option_value($key);
940
+			$answer[$key] = self::prep_answer($value, $use_html_entities);
941 941
 		}
942 942
 
943 943
 		// prep the required array
944
-		$required = self::prep_required( $required );
944
+		$required = self::prep_required($required);
945 945
 		// set disabled tag
946
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
946
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
947 947
 		// ya gots ta have style man!!!
948 948
 		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
949
-		$class = empty( $class ) ? 'espresso-radio-btn-inp' : $class;
950
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
949
+		$class = empty($class) ? 'espresso-radio-btn-inp' : $class;
950
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
951 951
 
952
-		$label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> ';
952
+		$label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> ';
953 953
 		// filter label but ensure required text comes before it
954
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
955
-
956
-		$input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-checkbox-options-ul ' . $label_class . ' ' . $class . '-ul">';
957
-
958
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
959
-		$class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : '';
960
-
961
-		foreach ( $options as $OPT ) {
962
-			$value = $OPT->value();//self::prep_option_value( $OPT->value() );
963
-			$size = self::get_label_size_class(  $OPT->value() . ' ' . $OPT->desc() );
964
-			$text = self::prep_answer( $OPT->value() );
965
-			$desc = $OPT->desc() ;
966
-			$opt = '-' . sanitize_key( $value );
967
-
968
-			$checked = is_array( $answer ) && in_array( $text, $answer ) ? ' checked="checked"' : '';
969
-
970
-			$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
971
-			$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-checkbox-lbl">';
972
-			$input_html .= $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : '';
973
-			$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 . '/>';
974
-			$input_html .= ! $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : '';
975
- 			$input_html .= "\n\t\t\t\t\t" . '</label>';
976
-			if ( ! empty( $desc ) && $desc != $text ) {
977
-	 			$input_html .= "\n\t\t\t\t\t" . ' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">' . $desc . '</div>';
954
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
955
+
956
+		$input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-checkbox-options-ul '.$label_class.' '.$class.'-ul">';
957
+
958
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
959
+		$class .= ! empty($required['class']) ? ' '.$required['class'] : '';
960
+
961
+		foreach ($options as $OPT) {
962
+			$value = $OPT->value(); //self::prep_option_value( $OPT->value() );
963
+			$size = self::get_label_size_class($OPT->value().' '.$OPT->desc());
964
+			$text = self::prep_answer($OPT->value());
965
+			$desc = $OPT->desc();
966
+			$opt = '-'.sanitize_key($value);
967
+
968
+			$checked = is_array($answer) && in_array($text, $answer) ? ' checked="checked"' : '';
969
+
970
+			$input_html .= "\n\t\t\t\t".'<li'.$size.'>';
971
+			$input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-checkbox-lbl">';
972
+			$input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : '';
973
+			$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.'/>';
974
+			$input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : '';
975
+ 			$input_html .= "\n\t\t\t\t\t".'</label>';
976
+			if ( ! empty($desc) && $desc != $text) {
977
+	 			$input_html .= "\n\t\t\t\t\t".' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">'.$desc.'</div>';
978 978
 			}
979
-			$input_html .= "\n\t\t\t\t" . '</li>';
979
+			$input_html .= "\n\t\t\t\t".'</li>';
980 980
 
981 981
 		}
982 982
 
983
-		$input_html .= "\n\t\t\t" . '</ul>';
983
+		$input_html .= "\n\t\t\t".'</ul>';
984 984
 
985
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
986
-		return  $label_html . $input_html;
985
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
986
+		return  $label_html.$input_html;
987 987
 
988 988
 	}
989 989
 
@@ -1005,36 +1005,36 @@  discard block
 block discarded – undo
1005 1005
 	 * @param string $disabled 		disabled="disabled" or null
1006 1006
 	 * @return string HTML
1007 1007
 	 */
1008
-	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 ) {
1008
+	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) {
1009 1009
 		// need these
1010
-		if ( ! $question || ! $name ) {
1010
+		if ( ! $question || ! $name) {
1011 1011
 			return NULL;
1012 1012
 		}
1013 1013
 		// prep the answer
1014
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
1014
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
1015 1015
 		// prep the required array
1016
-		$required = self::prep_required( $required );
1016
+		$required = self::prep_required($required);
1017 1017
 		// set disabled tag
1018
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
1018
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
1019 1019
 		// ya gots ta have style man!!!
1020 1020
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-datepicker-inp';
1021
-		$class = empty( $class ) ? $txt_class : $class;
1022
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
1023
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
1021
+		$class = empty($class) ? $txt_class : $class;
1022
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
1023
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1024 1024
 
1025
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
1025
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
1026 1026
 		// filter label but ensure required text comes before it
1027
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
1027
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
1028 1028
 
1029
-		$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 . '/>';
1029
+		$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.'/>';
1030 1030
 
1031 1031
 		// enqueue scripts
1032
-		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 );
1033
-		wp_enqueue_style( 'espresso-ui-theme');
1034
-		wp_enqueue_script( 'jquery-ui-datepicker' );
1032
+		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);
1033
+		wp_enqueue_style('espresso-ui-theme');
1034
+		wp_enqueue_script('jquery-ui-datepicker');
1035 1035
 
1036
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
1037
-		return  $label_html . $input_html;
1036
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1037
+		return  $label_html.$input_html;
1038 1038
 
1039 1039
 	}
1040 1040
 
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 	 * 	@access public
1047 1047
 	 * 	@return 	string
1048 1048
 	 */
1049
-	public static function remove_label_keep_required_msg( $label_html, $required_text ) {
1049
+	public static function remove_label_keep_required_msg($label_html, $required_text) {
1050 1050
 		return $required_text;
1051 1051
 	}
1052 1052
 
@@ -1060,9 +1060,9 @@  discard block
 block discarded – undo
1060 1060
 	 * @param string $value
1061 1061
 	 * @return string HTML
1062 1062
 	 */
1063
-	static function hidden_input( $name, $value, $id = '' ){
1064
-		$id = ! empty( $id ) ? $id : $name;
1065
-		return '<input id="' . $id . '" type="hidden" name="'.$name.'" value="' .  $value . '"/>';
1063
+	static function hidden_input($name, $value, $id = '') {
1064
+		$id = ! empty($id) ? $id : $name;
1065
+		return '<input id="'.$id.'" type="hidden" name="'.$name.'" value="'.$value.'"/>';
1066 1066
 	}
1067 1067
 
1068 1068
 
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 	 * @param string $question
1075 1075
 	 * @return string
1076 1076
 	 */
1077
-	static function prep_question( $question ){
1077
+	static function prep_question($question) {
1078 1078
 		return $question;
1079 1079
 //		$link = '';
1080 1080
 //		// does this label have a help link attached ?
@@ -1097,13 +1097,13 @@  discard block
 block discarded – undo
1097 1097
 	 * @param mixed $answer
1098 1098
 	 * @return string
1099 1099
 	 */
1100
-	static function prep_answer( $answer, $use_html_entities = TRUE ){
1100
+	static function prep_answer($answer, $use_html_entities = TRUE) {
1101 1101
 		//make sure we convert bools first.  Otherwise (bool) false becomes an empty string which is NOT desired, we want "0".
1102
-		if ( is_bool( $answer ) ) {
1102
+		if (is_bool($answer)) {
1103 1103
 			$answer = $answer ? 1 : 0;
1104 1104
 		}
1105
-		$answer = trim( stripslashes( str_replace( '&#039;', "'", $answer )));
1106
-		return $use_html_entities ? htmlentities( $answer, ENT_QUOTES, 'UTF-8' ) : $answer;
1105
+		$answer = trim(stripslashes(str_replace('&#039;', "'", $answer)));
1106
+		return $use_html_entities ? htmlentities($answer, ENT_QUOTES, 'UTF-8') : $answer;
1107 1107
 	}
1108 1108
 
1109 1109
 
@@ -1113,18 +1113,18 @@  discard block
 block discarded – undo
1113 1113
 	 * 	@param array $QSOs  array of EE_Question_Option objects
1114 1114
 	 * 	@return array
1115 1115
 	 */
1116
-	public static function prep_answer_options( $QSOs = array() ){
1116
+	public static function prep_answer_options($QSOs = array()) {
1117 1117
 		$prepped_answer_options = array();
1118
-		if ( is_array( $QSOs ) && ! empty( $QSOs )) {
1119
-			foreach( $QSOs as $key => $QSO ) {
1120
-				if ( ! $QSO instanceof EE_Question_Option ) {
1121
-					$QSO = EE_Question_Option::new_instance( array(
1122
-						'QSO_value' => is_array( $QSO ) && isset( $QSO['id'] ) ? (string)$QSO['id'] : (string)$key,
1123
-						'QSO_desc' => is_array( $QSO ) && isset( $QSO['text'] ) ? (string)$QSO['text'] : (string)$QSO
1118
+		if (is_array($QSOs) && ! empty($QSOs)) {
1119
+			foreach ($QSOs as $key => $QSO) {
1120
+				if ( ! $QSO instanceof EE_Question_Option) {
1121
+					$QSO = EE_Question_Option::new_instance(array(
1122
+						'QSO_value' => is_array($QSO) && isset($QSO['id']) ? (string) $QSO['id'] : (string) $key,
1123
+						'QSO_desc' => is_array($QSO) && isset($QSO['text']) ? (string) $QSO['text'] : (string) $QSO
1124 1124
 					));
1125 1125
 				}
1126
-				if ( $QSO->opt_group() ) {
1127
-					$prepped_answer_options[ $QSO->opt_group() ][] = $QSO;
1126
+				if ($QSO->opt_group()) {
1127
+					$prepped_answer_options[$QSO->opt_group()][] = $QSO;
1128 1128
 				} else {
1129 1129
 					$prepped_answer_options[] = $QSO;
1130 1130
 				}
@@ -1140,8 +1140,8 @@  discard block
 block discarded – undo
1140 1140
 	 * @param string $option_value
1141 1141
 	 * @return string
1142 1142
 	 */
1143
-	static function prep_option_value( $option_value ){
1144
-		return esc_attr( trim( stripslashes( $option_value ) ) );
1143
+	static function prep_option_value($option_value) {
1144
+		return esc_attr(trim(stripslashes($option_value)));
1145 1145
 	}
1146 1146
 
1147 1147
 
@@ -1152,11 +1152,11 @@  discard block
 block discarded – undo
1152 1152
 	 * @param string|array 	$required
1153 1153
 	 * @return array
1154 1154
 	 */
1155
-	static function prep_required( $required = array() ){
1155
+	static function prep_required($required = array()) {
1156 1156
 		// make sure required is an array
1157
-		$required = is_array( $required ) ? $required : array();
1157
+		$required = is_array($required) ? $required : array();
1158 1158
 		// and set some defaults
1159
-		$required = array_merge( array( 'label' => '', 'class' => '', 'msg' => '' ), $required );
1159
+		$required = array_merge(array('label' => '', 'class' => '', 'msg' => ''), $required);
1160 1160
 		return $required;
1161 1161
 	}
1162 1162
 
@@ -1167,30 +1167,30 @@  discard block
 block discarded – undo
1167 1167
 	 * @param string 	$value
1168 1168
 	 * @return string
1169 1169
 	 */
1170
-	static function get_label_size_class( $value = FALSE ){
1171
-			if ( $value === FALSE || $value == '' ) {
1170
+	static function get_label_size_class($value = FALSE) {
1171
+			if ($value === FALSE || $value == '') {
1172 1172
 				return ' class="medium-lbl"';
1173 1173
 			}
1174 1174
 			// determine length of option value
1175
-			$val_size = strlen( $value );
1176
-			switch( $val_size ){
1175
+			$val_size = strlen($value);
1176
+			switch ($val_size) {
1177 1177
 				case $val_size < 3 :
1178
-					$size =  ' class="nano-lbl"';
1178
+					$size = ' class="nano-lbl"';
1179 1179
 					break;
1180 1180
 				case $val_size < 6 :
1181
-					$size =  ' class="micro-lbl"';
1181
+					$size = ' class="micro-lbl"';
1182 1182
 					break;
1183 1183
 				case $val_size < 12 :
1184
-					$size =  ' class="tiny-lbl"';
1184
+					$size = ' class="tiny-lbl"';
1185 1185
 					break;
1186 1186
 				case $val_size < 25 :
1187
-					$size =  ' class="small-lbl"';
1187
+					$size = ' class="small-lbl"';
1188 1188
 					break;
1189 1189
 				case $val_size > 100 :
1190
-					$size =  ' class="big-lbl"';
1190
+					$size = ' class="big-lbl"';
1191 1191
 					break;
1192 1192
 				default:
1193
-					$size =  ' class="medium-lbl"';
1193
+					$size = ' class="medium-lbl"';
1194 1194
 					break;
1195 1195
 			}
1196 1196
 		return $size;
@@ -1204,20 +1204,20 @@  discard block
 block discarded – undo
1204 1204
 	 * @param array 	$QFI
1205 1205
 	 * @return array
1206 1206
 	 */
1207
-	private static function _load_system_dropdowns( $QFI ){
1207
+	private static function _load_system_dropdowns($QFI) {
1208 1208
 		$QST_system = $QFI->get('QST_system');
1209
-		switch ( $QST_system ) {
1209
+		switch ($QST_system) {
1210 1210
 			case 'state' :
1211
-				$QFI = self::generate_state_dropdown( $QFI );
1211
+				$QFI = self::generate_state_dropdown($QFI);
1212 1212
 				break;
1213 1213
 			case 'country' :
1214
-				$QFI = self::generate_country_dropdown( $QFI );
1214
+				$QFI = self::generate_country_dropdown($QFI);
1215 1215
 				break;
1216 1216
 			case 'admin-state' :
1217
-				$QFI = self::generate_state_dropdown( $QFI, TRUE );
1217
+				$QFI = self::generate_state_dropdown($QFI, TRUE);
1218 1218
 				break;
1219 1219
 			case 'admin-country' :
1220
-				$QFI = self::generate_country_dropdown( $QFI, TRUE );
1220
+				$QFI = self::generate_country_dropdown($QFI, TRUE);
1221 1221
 				break;
1222 1222
 		}
1223 1223
 		return $QFI;
@@ -1234,13 +1234,13 @@  discard block
 block discarded – undo
1234 1234
 	 *
1235 1235
 	 * @return EE_Question_Form_Input
1236 1236
 	 */
1237
-	protected static function _load_specialized_dropdowns( $QFI ) {
1238
-		switch( $QFI->get( 'QST_type' ) ) {
1237
+	protected static function _load_specialized_dropdowns($QFI) {
1238
+		switch ($QFI->get('QST_type')) {
1239 1239
 			case 'STATE' :
1240
-				$QFI = self::generate_state_dropdown( $QFI );
1240
+				$QFI = self::generate_state_dropdown($QFI);
1241 1241
 				break;
1242 1242
 			case 'COUNTRY' :
1243
-				$QFI = self::generate_country_dropdown( $QFI );
1243
+				$QFI = self::generate_country_dropdown($QFI);
1244 1244
 				break;
1245 1245
 		}
1246 1246
 		return $QFI;
@@ -1254,23 +1254,23 @@  discard block
 block discarded – undo
1254 1254
 	 * @param bool  $get_all
1255 1255
 	 * @return array
1256 1256
 	 */
1257
-	public static function generate_state_dropdown( $QST, $get_all = FALSE ){
1257
+	public static function generate_state_dropdown($QST, $get_all = FALSE) {
1258 1258
 		$states = $get_all ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_states_of_active_countries();
1259
-		if ( $states && count( $states ) != count( $QST->options() )) {
1260
-			$QST->set( 'QST_type', 'DROPDOWN' );
1259
+		if ($states && count($states) != count($QST->options())) {
1260
+			$QST->set('QST_type', 'DROPDOWN');
1261 1261
 			// if multiple countries, we'll create option groups within the dropdown
1262
-			foreach ( $states as $state ) {
1263
-				if ( $state instanceof EE_State ) {
1264
-					$QSO = EE_Question_Option::new_instance ( array (
1262
+			foreach ($states as $state) {
1263
+				if ($state instanceof EE_State) {
1264
+					$QSO = EE_Question_Option::new_instance(array(
1265 1265
 						'QSO_value' => $state->ID(),
1266 1266
 						'QSO_desc' => $state->name(),
1267
-						'QST_ID' => $QST->get( 'QST_ID' ),
1267
+						'QST_ID' => $QST->get('QST_ID'),
1268 1268
 						'QSO_deleted' => FALSE
1269 1269
 					));
1270 1270
 					// set option group
1271
-					$QSO->set_opt_group( $state->country()->name() );
1271
+					$QSO->set_opt_group($state->country()->name());
1272 1272
 					// add option to question
1273
-					$QST->add_temp_option( $QSO );
1273
+					$QST->add_temp_option($QSO);
1274 1274
 				}
1275 1275
 			}
1276 1276
 		}
@@ -1286,20 +1286,20 @@  discard block
 block discarded – undo
1286 1286
 	 * @internal param array $question
1287 1287
 	 * @return array
1288 1288
 	 */
1289
-	public static function generate_country_dropdown( $QST, $get_all = FALSE ){
1289
+	public static function generate_country_dropdown($QST, $get_all = FALSE) {
1290 1290
 		$countries = $get_all ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries();
1291
-		if ( $countries && count( $countries ) != count( $QST->options() ) ) {
1292
-			$QST->set( 'QST_type', 'DROPDOWN' );
1291
+		if ($countries && count($countries) != count($QST->options())) {
1292
+			$QST->set('QST_type', 'DROPDOWN');
1293 1293
 			// now add countries
1294
-			foreach ( $countries as $country ) {
1295
-				if ( $country instanceof EE_Country ) {
1296
-					$QSO = EE_Question_Option::new_instance ( array (
1294
+			foreach ($countries as $country) {
1295
+				if ($country instanceof EE_Country) {
1296
+					$QSO = EE_Question_Option::new_instance(array(
1297 1297
 						'QSO_value' => $country->ID(),
1298 1298
 						'QSO_desc' => $country->name(),
1299
-						'QST_ID' => $QST->get( 'QST_ID' ),
1299
+						'QST_ID' => $QST->get('QST_ID'),
1300 1300
 						'QSO_deleted' => FALSE
1301 1301
 					));
1302
-					$QST->add_temp_option( $QSO );
1302
+					$QST->add_temp_option($QSO);
1303 1303
 				}
1304 1304
 			}
1305 1305
 		}
@@ -1316,11 +1316,11 @@  discard block
 block discarded – undo
1316 1316
 	 */
1317 1317
 	public static function two_digit_months_dropdown_options() {
1318 1318
 		$options = array();
1319
-		for ( $x = 1; $x <= 12; $x++ ) {
1320
-			$mm = str_pad( $x, 2, '0', STR_PAD_LEFT );
1321
-			$options[ (string)$mm ] = (string)$mm;
1319
+		for ($x = 1; $x <= 12; $x++) {
1320
+			$mm = str_pad($x, 2, '0', STR_PAD_LEFT);
1321
+			$options[(string) $mm] = (string) $mm;
1322 1322
 		}
1323
-		return EEH_Form_Fields::prep_answer_options( $options );
1323
+		return EEH_Form_Fields::prep_answer_options($options);
1324 1324
 	}
1325 1325
 
1326 1326
 
@@ -1335,11 +1335,11 @@  discard block
 block discarded – undo
1335 1335
 		$options = array();
1336 1336
 		$current_year = date('y');
1337 1337
 		$next_decade = $current_year + 10;
1338
-		for ( $x = $current_year; $x <= $next_decade; $x++ ) {
1339
-			$yy = str_pad( $x, 2, '0', STR_PAD_LEFT );
1340
-			$options[ (string)$yy ] = (string)$yy;
1338
+		for ($x = $current_year; $x <= $next_decade; $x++) {
1339
+			$yy = str_pad($x, 2, '0', STR_PAD_LEFT);
1340
+			$options[(string) $yy] = (string) $yy;
1341 1341
 		}
1342
-		return EEH_Form_Fields::prep_answer_options( $options );
1342
+		return EEH_Form_Fields::prep_answer_options($options);
1343 1343
 	}
1344 1344
 
1345 1345
 
@@ -1353,17 +1353,17 @@  discard block
 block discarded – undo
1353 1353
 	 * @param  integer $evt_category Event Category ID if the Event Category filter is selected
1354 1354
 	 * @return string                html
1355 1355
 	 */
1356
-	public static function generate_registration_months_dropdown( $cur_date = '', $status = '', $evt_category = 0 ) {
1356
+	public static function generate_registration_months_dropdown($cur_date = '', $status = '', $evt_category = 0) {
1357 1357
 		$_where = array();
1358
-		if ( !empty( $status ) ) {
1358
+		if ( ! empty($status)) {
1359 1359
 			$_where['STS_ID'] = $status;
1360 1360
 		}
1361 1361
 
1362
-		if ( $evt_category > 0 ) {
1362
+		if ($evt_category > 0) {
1363 1363
 			$_where['Event.Term_Taxonomy.term_id'] = $evt_category;
1364 1364
 		}
1365 1365
 
1366
-		$regdtts = EEM_Registration::instance()->get_reg_months_and_years( $_where );
1366
+		$regdtts = EEM_Registration::instance()->get_reg_months_and_years($_where);
1367 1367
 
1368 1368
 		//setup vals for select input helper
1369 1369
 		$options = array(
@@ -1373,15 +1373,15 @@  discard block
 block discarded – undo
1373 1373
 				)
1374 1374
 			);
1375 1375
 
1376
-		foreach ( $regdtts as $regdtt ) {
1377
-			$date = $regdtt->reg_month. ' ' . $regdtt->reg_year;
1376
+		foreach ($regdtts as $regdtt) {
1377
+			$date = $regdtt->reg_month.' '.$regdtt->reg_year;
1378 1378
 			$options[] = array(
1379 1379
 				'text' => $date,
1380 1380
 				'id' => $date
1381 1381
 				);
1382 1382
 		}
1383 1383
 
1384
-		return self::select_input('month_range', $options, $cur_date, '', 'wide' );
1384
+		return self::select_input('month_range', $options, $cur_date, '', 'wide');
1385 1385
 	}
1386 1386
 
1387 1387
 
@@ -1395,18 +1395,18 @@  discard block
 block discarded – undo
1395 1395
 	 * @param  string $evt_active_status "upcoming", "expired", "active", or "inactive"
1396 1396
 	 * @return string                    html
1397 1397
 	 */
1398
-	public static function generate_event_months_dropdown( $cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL ) {
1398
+	public static function generate_event_months_dropdown($cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL) {
1399 1399
 		//determine what post_status our condition will have for the query.
1400
-		switch ( $status ) {
1400
+		switch ($status) {
1401 1401
 			case 'month' :
1402 1402
 			case 'today' :
1403 1403
 			case NULL :
1404 1404
 			case 'all' :
1405
-				$where['Event.status'] = array( 'NOT IN', array('trash') );
1405
+				$where['Event.status'] = array('NOT IN', array('trash'));
1406 1406
 				break;
1407 1407
 
1408 1408
 			case 'draft' :
1409
-				$where['Event.status'] = array( 'IN', array('draft', 'auto-draft') );
1409
+				$where['Event.status'] = array('IN', array('draft', 'auto-draft'));
1410 1410
 
1411 1411
 			default :
1412 1412
 				$where['Event.status'] = $status;
@@ -1415,7 +1415,7 @@  discard block
 block discarded – undo
1415 1415
 		//categories?
1416 1416
 
1417 1417
 
1418
-		if ( !empty ( $evt_category ) ) {
1418
+		if ( ! empty ($evt_category)) {
1419 1419
 			$where['Event.Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1420 1420
 			$where['Event.Term_Taxonomy.term_id'] = $evt_category;
1421 1421
 		}
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
 
1424 1424
 //		$where['DTT_is_primary'] = 1;
1425 1425
 
1426
-		$DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status );
1426
+		$DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status);
1427 1427
 
1428 1428
 		//let's setup vals for select input helper
1429 1429
 		$options = array(
@@ -1438,9 +1438,9 @@  discard block
 block discarded – undo
1438 1438
 		//translate month and date
1439 1439
 		global $wp_locale;
1440 1440
 
1441
-		foreach ( $DTTS as $DTT ) {
1442
-			$localized_date = $wp_locale->get_month( $DTT->dtt_month_num ) . ' ' . $DTT->dtt_year;
1443
-			$id = $DTT->dtt_month . ' ' . $DTT->dtt_year;
1441
+		foreach ($DTTS as $DTT) {
1442
+			$localized_date = $wp_locale->get_month($DTT->dtt_month_num).' '.$DTT->dtt_year;
1443
+			$id = $DTT->dtt_month.' '.$DTT->dtt_year;
1444 1444
 			$options[] = array(
1445 1445
 				'text' => $localized_date,
1446 1446
 				'id' => $id
@@ -1448,7 +1448,7 @@  discard block
 block discarded – undo
1448 1448
 		}
1449 1449
 
1450 1450
 
1451
-		return self::select_input( 'month_range', $options, $cur_date, '', 'wide' );
1451
+		return self::select_input('month_range', $options, $cur_date, '', 'wide');
1452 1452
 	}
1453 1453
 
1454 1454
 
@@ -1459,7 +1459,7 @@  discard block
 block discarded – undo
1459 1459
 	 * @param  integer $current_cat currently selected category
1460 1460
 	 * @return string               html for dropdown
1461 1461
 	 */
1462
-	public static function generate_event_category_dropdown( $current_cat = -1 ) {
1462
+	public static function generate_event_category_dropdown($current_cat = -1) {
1463 1463
 		$categories = EEM_Term::instance()->get_all_ee_categories(TRUE);
1464 1464
 		$options = array(
1465 1465
 			'0' => array(
@@ -1469,14 +1469,14 @@  discard block
 block discarded – undo
1469 1469
 			);
1470 1470
 
1471 1471
 		//setup categories for dropdown
1472
-		foreach ( $categories as $category ) {
1472
+		foreach ($categories as $category) {
1473 1473
 			$options[] = array(
1474 1474
 				'text' => $category->get('name'),
1475 1475
 				'id' => $category->ID()
1476 1476
 				);
1477 1477
 		}
1478 1478
 
1479
-		return self::select_input( 'EVT_CAT', $options, $current_cat );
1479
+		return self::select_input('EVT_CAT', $options, $current_cat);
1480 1480
 	}
1481 1481
 
1482 1482
 
@@ -1495,20 +1495,20 @@  discard block
 block discarded – undo
1495 1495
 	 * @param    string   $extra_attributes - any extra attributes that need to be attached to the form input
1496 1496
 	 * @return    void
1497 1497
 	 */
1498
-	public static function submit_button( $url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '' ) {
1498
+	public static function submit_button($url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '') {
1499 1499
 		$btn = '';
1500
-		if ( empty( $url ) || empty( $ID )) {
1500
+		if (empty($url) || empty($ID)) {
1501 1501
 			return $btn;
1502 1502
 		}
1503
-		$text = ! empty( $text ) ? $text : __('Submit', 'event_espresso' );
1504
-		$btn .= '<input id="' . $ID . '-btn" class="' . $class . '" type="submit" value="' . $text . '" ' . $extra_attributes . '/>';
1505
-		if ( ! $input_only ) {
1506
-			$btn_frm = '<form id="' . $ID . '-frm" method="POST" action="' . $url . '">';
1507
-			$btn_frm .= ! empty( $nonce_action ) ? wp_nonce_field( $nonce_action, $nonce_action . '_nonce', TRUE, FALSE ) : '';
1503
+		$text = ! empty($text) ? $text : __('Submit', 'event_espresso');
1504
+		$btn .= '<input id="'.$ID.'-btn" class="'.$class.'" type="submit" value="'.$text.'" '.$extra_attributes.'/>';
1505
+		if ( ! $input_only) {
1506
+			$btn_frm = '<form id="'.$ID.'-frm" method="POST" action="'.$url.'">';
1507
+			$btn_frm .= ! empty($nonce_action) ? wp_nonce_field($nonce_action, $nonce_action.'_nonce', TRUE, FALSE) : '';
1508 1508
 			$btn_frm .= $btn;
1509 1509
 			$btn_frm .= '</form>';
1510 1510
 			$btn = $btn_frm;
1511
-			unset ( $btn_frm );
1511
+			unset ($btn_frm);
1512 1512
 		}
1513 1513
 		return $btn;
1514 1514
 	}
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 	 *
798 798
 	 * @param mixed $opt_group
799 799
 	 * @param mixed $QSOs
800
-	 * @param mixed $answer
800
+	 * @param string $answer
801 801
 	 * @param boolean $use_html_entities
802 802
 	 * @return string
803 803
 	 */
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
 	/**
1148 1148
 	 * 	prep_required
1149 1149
 	 * @param string|array 	$required
1150
-	 * @return array
1150
+	 * @return string
1151 1151
 	 */
1152 1152
 	static function prep_required( $required = array() ){
1153 1153
 		// make sure required is an array
@@ -1198,8 +1198,8 @@  discard block
 block discarded – undo
1198 1198
 
1199 1199
 	/**
1200 1200
 	 * 	_load_system_dropdowns
1201
-	 * @param array 	$QFI
1202
-	 * @return array
1201
+	 * @param EE_Question_Form_Input 	$QFI
1202
+	 * @return EE_Question_Form_Input
1203 1203
 	 */
1204 1204
 	private static function _load_system_dropdowns( $QFI ){
1205 1205
 		$QST_system = $QFI->get('QST_system');
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
 	 * @param    string   $nonce_action     - if using nonces
1491 1491
 	 * @param    bool|string $input_only       - whether to print form header and footer. TRUE returns the input without the form
1492 1492
 	 * @param    string   $extra_attributes - any extra attributes that need to be attached to the form input
1493
-	 * @return    void
1493
+	 * @return    string
1494 1494
 	 */
1495 1495
 	public static function submit_button( $url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '' ) {
1496 1496
 		$btn = '';
Please login to merge, or discard this patch.
core/helpers/EEH_HTML.helper.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EEH_HTML
5
- *
3
+  *
4
+  * Class EEH_HTML
5
+  *
6 6
   * Sometimes when writing PHP you need to generate some standard HTML,
7 7
   * but either not enough to warrant creating a template file,
8 8
   * or the amount of PHP conditionals and/or loops peppered throughout the HTML
9 9
   * just make it really ugly and difficult to read.
10 10
   * This class simply adds a bunch of methods for generating basic HTML tags.
11 11
   * Most of the methods have the same name as the HTML tag they generate, and most have the same set of parameters.
12
- *
13
- * @package         Event Espresso
14
- * @subpackage    core
15
- * @author				Brent Christensen
16
- * @since		 	   $VID:$
17
- *
18
- */
12
+  *
13
+  * @package         Event Espresso
14
+  * @subpackage    core
15
+  * @author				Brent Christensen
16
+  * @since		 	   $VID:$
17
+  *
18
+  */
19 19
 
20 20
 class EEH_HTML {
21 21
 
Please login to merge, or discard this patch.
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public static function instance() {
43 43
 		// check if class object is instantiated, and instantiated properly
44
-		if ( ! self::$_instance instanceof EEH_HTML ) {
44
+		if ( ! self::$_instance instanceof EEH_HTML) {
45 45
 			self::$_instance = new EEH_HTML();
46 46
 		}
47 47
 		return self::$_instance;
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
 	 * @param bool   $force_close
94 94
 	 * @return string
95 95
 	 */
96
-	protected static function _open_tag( $tag = 'div', $content = '', $id = '', $class = '', $style = '', $other_attributes = '', $force_close = FALSE ) {
97
-		$attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : '';
98
-		$attributes .= ! empty( $class ) ? ' class="' . $class . '"' : '';
99
-		$attributes .= ! empty( $style ) ? ' style="' . $style . '"' : '';
100
-		$attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : '';
101
-		$html = EEH_HTML::nl( 0, $tag ) . '<' . $tag . $attributes . '>';
102
-		$html .= ! empty( $content ) ? EEH_HTML::nl( 1, $tag  ) . $content : '';
103
-		$indent = ! empty( $content ) || $force_close ? TRUE : FALSE;
104
-		$html .= ! empty( $content ) || $force_close ? EEH_HTML::_close_tag( $tag, $id, $class, $indent ) : '';
96
+	protected static function _open_tag($tag = 'div', $content = '', $id = '', $class = '', $style = '', $other_attributes = '', $force_close = FALSE) {
97
+		$attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : '';
98
+		$attributes .= ! empty($class) ? ' class="'.$class.'"' : '';
99
+		$attributes .= ! empty($style) ? ' style="'.$style.'"' : '';
100
+		$attributes .= ! empty($other_attributes) ? ' '.$other_attributes : '';
101
+		$html = EEH_HTML::nl(0, $tag).'<'.$tag.$attributes.'>';
102
+		$html .= ! empty($content) ? EEH_HTML::nl(1, $tag).$content : '';
103
+		$indent = ! empty($content) || $force_close ? TRUE : FALSE;
104
+		$html .= ! empty($content) || $force_close ? EEH_HTML::_close_tag($tag, $id, $class, $indent) : '';
105 105
 		return $html;
106 106
 	}
107 107
 
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 	 * @param bool   $indent
118 118
 	 * @return string
119 119
 	 */
120
-	protected static function _close_tag( $tag = 'div', $id = '', $class = '', $indent = TRUE ) {
121
-		if ( $id ) {
122
-			$comment = EEH_HTML::comment( 'close ' . $id ) . EEH_HTML::nl( 0, $tag );
123
-		} else if ( $class ) {
124
-			$comment = EEH_HTML::comment( 'close ' . $class ) . EEH_HTML::nl( 0, $tag );
120
+	protected static function _close_tag($tag = 'div', $id = '', $class = '', $indent = TRUE) {
121
+		if ($id) {
122
+			$comment = EEH_HTML::comment('close '.$id).EEH_HTML::nl(0, $tag);
123
+		} else if ($class) {
124
+			$comment = EEH_HTML::comment('close '.$class).EEH_HTML::nl(0, $tag);
125 125
 		} else {
126 126
 			$comment = '';
127 127
 		}
128 128
 		$html = $indent ? EEH_HTML::nl( -1, $tag ) : '';
129
-		$html .= '</' . $tag . '>' . $comment;
129
+		$html .= '</'.$tag.'>'.$comment;
130 130
 		return $html;
131 131
 	}
132 132
 
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
146 146
 	 * @return string
147 147
 	 */
148
-	public static function div( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
149
-		return EEH_HTML::_open_tag( 'div', $content, $id, $class, $style, $other_attributes );
148
+	public static function div($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
149
+		return EEH_HTML::_open_tag('div', $content, $id, $class, $style, $other_attributes);
150 150
 	}
151 151
 
152 152
 
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 	 * @param string $class - html class attribute
160 160
 	 * @return string
161 161
 	 */
162
-	public static function divx( $id = '', $class = '' ) {
163
-		return EEH_HTML::_close_tag( 'div', $id, $class );
162
+	public static function divx($id = '', $class = '') {
163
+		return EEH_HTML::_close_tag('div', $id, $class);
164 164
 	}
165 165
 
166 166
 
@@ -176,23 +176,23 @@  discard block
 block discarded – undo
176 176
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
177 177
 	 * @return string
178 178
 	 */
179
-	public static function h1( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
180
-		return EEH_HTML::_open_tag( 'h1', $content, $id, $class, $style, $other_attributes, TRUE );
179
+	public static function h1($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
180
+		return EEH_HTML::_open_tag('h1', $content, $id, $class, $style, $other_attributes, TRUE);
181 181
 	}
182
-	public static function h2( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
183
-		return EEH_HTML::_open_tag( 'h2', $content, $id, $class, $style, $other_attributes, TRUE );
182
+	public static function h2($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
183
+		return EEH_HTML::_open_tag('h2', $content, $id, $class, $style, $other_attributes, TRUE);
184 184
 	}
185
-	public static function h3( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
186
-		return EEH_HTML::_open_tag( 'h3', $content, $id, $class, $style, $other_attributes, TRUE );
185
+	public static function h3($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
186
+		return EEH_HTML::_open_tag('h3', $content, $id, $class, $style, $other_attributes, TRUE);
187 187
 	}
188
-	public static function h4( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
189
-		return EEH_HTML::_open_tag( 'h4', $content, $id, $class, $style, $other_attributes, TRUE );
188
+	public static function h4($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
189
+		return EEH_HTML::_open_tag('h4', $content, $id, $class, $style, $other_attributes, TRUE);
190 190
 	}
191
-	public static function h5( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
192
-		return EEH_HTML::_open_tag( 'h5', $content, $id, $class, $style, $other_attributes, TRUE );
191
+	public static function h5($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
192
+		return EEH_HTML::_open_tag('h5', $content, $id, $class, $style, $other_attributes, TRUE);
193 193
 	}
194
-	public static function h6( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
195
-		return EEH_HTML::_open_tag( 'h6', $content, $id, $class, $style, $other_attributes, TRUE );
194
+	public static function h6($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
195
+		return EEH_HTML::_open_tag('h6', $content, $id, $class, $style, $other_attributes, TRUE);
196 196
 	}
197 197
 
198 198
 
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
209 209
 	 * @return string
210 210
 	 */
211
-	public static function p( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
212
-		return EEH_HTML::_open_tag( 'p', $content, $id, $class, $style, $other_attributes, TRUE );
211
+	public static function p($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
212
+		return EEH_HTML::_open_tag('p', $content, $id, $class, $style, $other_attributes, TRUE);
213 213
 	}
214 214
 
215 215
 
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
225 225
 	 * @return string
226 226
 	 */
227
-	public static function ul( $id = '', $class = '', $style = '', $other_attributes = '' ) {
228
-		return EEH_HTML::_open_tag( 'ul', '', $id, $class, $style, $other_attributes );
227
+	public static function ul($id = '', $class = '', $style = '', $other_attributes = '') {
228
+		return EEH_HTML::_open_tag('ul', '', $id, $class, $style, $other_attributes);
229 229
 	}
230 230
 
231 231
 
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
 	 * @param string $class - html class attribute
239 239
 	 * @return string
240 240
 	 */
241
-	public static function ulx( $id = '', $class = '' ) {
242
-		return EEH_HTML::_close_tag( 'ul', $id, $class );
241
+	public static function ulx($id = '', $class = '') {
242
+		return EEH_HTML::_close_tag('ul', $id, $class);
243 243
 	}
244 244
 
245 245
 
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
257 257
 	 * @return string
258 258
 	 */
259
-	public static function li( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
260
-		return EEH_HTML::_open_tag( 'li', $content, $id, $class, $style, $other_attributes );
259
+	public static function li($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
260
+		return EEH_HTML::_open_tag('li', $content, $id, $class, $style, $other_attributes);
261 261
 	}
262 262
 
263 263
 
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	 * @param string $class - html class attribute
271 271
 	 * @return string
272 272
 	 */
273
-	public static function lix( $id = '', $class = '' ) {
274
-		return EEH_HTML::_close_tag( 'li', $id, $class );
273
+	public static function lix($id = '', $class = '') {
274
+		return EEH_HTML::_close_tag('li', $id, $class);
275 275
 	}
276 276
 
277 277
 
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
288 288
 	 * @return string
289 289
 	 */
290
-	public static function table( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
291
-		return EEH_HTML::_open_tag( 'table', $content, $id, $class, $style, $other_attributes );
290
+	public static function table($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
291
+		return EEH_HTML::_open_tag('table', $content, $id, $class, $style, $other_attributes);
292 292
 	}
293 293
 
294 294
 
@@ -300,8 +300,8 @@  discard block
 block discarded – undo
300 300
 	 * @param string $class - html class attribute
301 301
 	 * @return string
302 302
 	 */
303
-	public static function tablex( $id = '', $class = '' ) {
304
-		return EEH_HTML::_close_tag( 'table', $id, $class );
303
+	public static function tablex($id = '', $class = '') {
304
+		return EEH_HTML::_close_tag('table', $id, $class);
305 305
 	}
306 306
 
307 307
 
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
318 318
 	 * @return string
319 319
 	 */
320
-	public static function thead( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
321
-		return EEH_HTML::_open_tag( 'thead', $content, $id, $class, $style, $other_attributes );
320
+	public static function thead($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
321
+		return EEH_HTML::_open_tag('thead', $content, $id, $class, $style, $other_attributes);
322 322
 	}
323 323
 
324 324
 
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
 	 * @param string $class - html class attribute
331 331
 	 * @return string
332 332
 	 */
333
-	public static function theadx( $id = '', $class = '' ) {
334
-		return EEH_HTML::_close_tag( 'thead', $id, $class );
333
+	public static function theadx($id = '', $class = '') {
334
+		return EEH_HTML::_close_tag('thead', $id, $class);
335 335
 	}
336 336
 
337 337
 
@@ -347,8 +347,8 @@  discard block
 block discarded – undo
347 347
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
348 348
 	 * @return string
349 349
 	 */
350
-	public static function tbody( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
351
-		return EEH_HTML::_open_tag( 'tbody', $content, $id, $class, $style, $other_attributes );
350
+	public static function tbody($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
351
+		return EEH_HTML::_open_tag('tbody', $content, $id, $class, $style, $other_attributes);
352 352
 	}
353 353
 
354 354
 
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 	 * @param string $class - html class attribute
361 361
 	 * @return string
362 362
 	 */
363
-	public static function tbodyx( $id = '', $class = '' ) {
364
-		return EEH_HTML::_close_tag( 'tbody', $id, $class );
363
+	public static function tbodyx($id = '', $class = '') {
364
+		return EEH_HTML::_close_tag('tbody', $id, $class);
365 365
 	}
366 366
 
367 367
 
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
378 378
 	 * @return string
379 379
 	 */
380
-	public static function tr( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
381
-		return EEH_HTML::_open_tag( 'tr', $content, $id, $class, $style, $other_attributes );
380
+	public static function tr($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
381
+		return EEH_HTML::_open_tag('tr', $content, $id, $class, $style, $other_attributes);
382 382
 	}
383 383
 
384 384
 
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
 	 * @param string $class - html class attribute
391 391
 	 * @return string
392 392
 	 */
393
-	public static function trx( $id = '', $class = '' ) {
394
-		return EEH_HTML::_close_tag( 'tr', $id, $class );
393
+	public static function trx($id = '', $class = '') {
394
+		return EEH_HTML::_close_tag('tr', $id, $class);
395 395
 	}
396 396
 
397 397
 
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
408 408
 	 * @return string
409 409
 	 */
410
-	public static function th( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
411
-		return EEH_HTML::_open_tag( 'th', $content, $id, $class, $style, $other_attributes );
410
+	public static function th($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
411
+		return EEH_HTML::_open_tag('th', $content, $id, $class, $style, $other_attributes);
412 412
 	}
413 413
 
414 414
 
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
 	 * @param string $class - html class attribute
421 421
 	 * @return string
422 422
 	 */
423
-	public static function thx( $id = '', $class = '' ) {
424
-		return EEH_HTML::_close_tag( 'th', $id, $class );
423
+	public static function thx($id = '', $class = '') {
424
+		return EEH_HTML::_close_tag('th', $id, $class);
425 425
 	}
426 426
 
427 427
 
@@ -437,8 +437,8 @@  discard block
 block discarded – undo
437 437
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
438 438
 	 * @return string
439 439
 	 */
440
-	public static function td( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
441
-		return EEH_HTML::_open_tag( 'td', $content, $id, $class, $style, $other_attributes );
440
+	public static function td($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
441
+		return EEH_HTML::_open_tag('td', $content, $id, $class, $style, $other_attributes);
442 442
 	}
443 443
 
444 444
 
@@ -450,8 +450,8 @@  discard block
 block discarded – undo
450 450
 	 * @param string $class - html class attribute
451 451
 	 * @return string
452 452
 	 */
453
-	public static function tdx( $id = '', $class = '' ) {
454
-		return EEH_HTML::_close_tag( 'td', $id, $class );
453
+	public static function tdx($id = '', $class = '') {
454
+		return EEH_HTML::_close_tag('td', $id, $class);
455 455
 	}
456 456
 
457 457
 
@@ -465,10 +465,10 @@  discard block
 block discarded – undo
465 465
 	 * @param int    $colspan
466 466
 	 * @return string
467 467
 	 */
468
-	public static function no_row( $content = '', $colspan = 2 ) {
468
+	public static function no_row($content = '', $colspan = 2) {
469 469
 		return EEH_HTML::tr(
470
-			EEH_HTML::td( $content, '', '',  'padding:0; border:none;', 'colspan="' . $colspan . '"' ),
471
-			'', '',  'padding:0; border:none;'
470
+			EEH_HTML::td($content, '', '', 'padding:0; border:none;', 'colspan="'.$colspan.'"'),
471
+			'', '', 'padding:0; border:none;'
472 472
 		);
473 473
 	}
474 474
 
@@ -488,14 +488,14 @@  discard block
 block discarded – undo
488 488
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
489 489
 	 * @return string
490 490
 	 */
491
-	public static function link( $href = '', $link_text = '', $title = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
492
-		$link_text = ! empty( $link_text ) ? $link_text : $href;
493
-		$attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : '';
494
-		$attributes .= ! empty( $class ) ? ' class="' . $class . '"' : '';
495
-		$attributes .= ! empty( $style ) ? ' style="' . $style . '"' : '';
496
-		$attributes .= ! empty( $title ) ? ' title="' . esc_attr( $title ) . '"' : '';
497
-		$attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : '';
498
-		return '<a href="' . $href . '" ' . $attributes . '>'  . $link_text  . '</a>';
491
+	public static function link($href = '', $link_text = '', $title = '', $id = '', $class = '', $style = '', $other_attributes = '') {
492
+		$link_text = ! empty($link_text) ? $link_text : $href;
493
+		$attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : '';
494
+		$attributes .= ! empty($class) ? ' class="'.$class.'"' : '';
495
+		$attributes .= ! empty($style) ? ' style="'.$style.'"' : '';
496
+		$attributes .= ! empty($title) ? ' title="'.esc_attr($title).'"' : '';
497
+		$attributes .= ! empty($other_attributes) ? ' '.$other_attributes : '';
498
+		return '<a href="'.$href.'" '.$attributes.'>'.$link_text.'</a>';
499 499
 	}
500 500
 
501 501
 
@@ -512,14 +512,14 @@  discard block
 block discarded – undo
512 512
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
513 513
 	 * @return string
514 514
 	 */
515
-	public static function img( $src = '', $alt = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
516
-		$attributes = ! empty( $src ) ? ' src="' . esc_url_raw( $src ) . '"' : '';
517
-		$attributes .= ! empty( $alt ) ? ' alt="' . esc_attr( $alt ) . '"' : '';
518
-		$attributes .= ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : '';
519
-		$attributes .= ! empty( $class ) ? ' class="' . $class . '"' : '';
520
-		$attributes .= ! empty( $style ) ? ' style="' . $style . '"' : '';
521
-		$attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : '';
522
-		return '<img' . $attributes  . '/>';
515
+	public static function img($src = '', $alt = '', $id = '', $class = '', $style = '', $other_attributes = '') {
516
+		$attributes = ! empty($src) ? ' src="'.esc_url_raw($src).'"' : '';
517
+		$attributes .= ! empty($alt) ? ' alt="'.esc_attr($alt).'"' : '';
518
+		$attributes .= ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : '';
519
+		$attributes .= ! empty($class) ? ' class="'.$class.'"' : '';
520
+		$attributes .= ! empty($style) ? ' style="'.$style.'"' : '';
521
+		$attributes .= ! empty($other_attributes) ? ' '.$other_attributes : '';
522
+		return '<img'.$attributes.'/>';
523 523
 	}
524 524
 
525 525
 
@@ -537,12 +537,12 @@  discard block
 block discarded – undo
537 537
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
538 538
 	 * @return string
539 539
 	 */
540
-	protected static function _inline_tag( $tag = 'span', $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
541
-		$attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : '';
542
-		$attributes .= ! empty( $class ) ? ' class="' . $class . '"' : '';
543
-		$attributes .= ! empty( $style ) ? ' style="' . $style . '"' : '';
544
-		$attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : '';
545
-		return '<' . $tag . ' ' . $attributes . '>'  . $content  . '</' . $tag . '>';
540
+	protected static function _inline_tag($tag = 'span', $content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
541
+		$attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : '';
542
+		$attributes .= ! empty($class) ? ' class="'.$class.'"' : '';
543
+		$attributes .= ! empty($style) ? ' style="'.$style.'"' : '';
544
+		$attributes .= ! empty($other_attributes) ? ' '.$other_attributes : '';
545
+		return '<'.$tag.' '.$attributes.'>'.$content.'</'.$tag.'>';
546 546
 	}
547 547
 
548 548
 
@@ -558,8 +558,8 @@  discard block
 block discarded – undo
558 558
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
559 559
 	 * @return string
560 560
 	 */
561
-	public static function label( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
562
-		return EEH_HTML::_inline_tag( 'label', $content, $id, $class, $style, $other_attributes );
561
+	public static function label($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
562
+		return EEH_HTML::_inline_tag('label', $content, $id, $class, $style, $other_attributes);
563 563
 	}
564 564
 
565 565
 
@@ -575,8 +575,8 @@  discard block
 block discarded – undo
575 575
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
576 576
 	 * @return string
577 577
 	 */
578
-	public static function span( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
579
-		return EEH_HTML::_inline_tag( 'span', $content, $id, $class, $style, $other_attributes );
578
+	public static function span($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
579
+		return EEH_HTML::_inline_tag('span', $content, $id, $class, $style, $other_attributes);
580 580
 	}
581 581
 
582 582
 
@@ -592,8 +592,8 @@  discard block
 block discarded – undo
592 592
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
593 593
 	 * @return string
594 594
 	 */
595
-	public static function strong( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
596
-		return EEH_HTML::_inline_tag( 'strong', $content, $id, $class, $style, $other_attributes );
595
+	public static function strong($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
596
+		return EEH_HTML::_inline_tag('strong', $content, $id, $class, $style, $other_attributes);
597 597
 	}
598 598
 
599 599
 
@@ -605,8 +605,8 @@  discard block
 block discarded – undo
605 605
 	 * @param string $comment
606 606
 	 * @return string
607 607
 	 */
608
-	public static function comment( $comment = '' ) {
609
-		return ! empty( $comment ) ? EEH_HTML::nl() . '<!-- ' . $comment . ' -->' : '';
608
+	public static function comment($comment = '') {
609
+		return ! empty($comment) ? EEH_HTML::nl().'<!-- '.$comment.' -->' : '';
610 610
 	}
611 611
 
612 612
 
@@ -617,8 +617,8 @@  discard block
 block discarded – undo
617 617
 	 * @param int $nmbr - the number of line breaks to return
618 618
 	 * @return string
619 619
 	 */
620
-	public static function br( $nmbr = 1 ) {
621
-		return str_repeat( '<br />', $nmbr );
620
+	public static function br($nmbr = 1) {
621
+		return str_repeat('<br />', $nmbr);
622 622
 	}
623 623
 
624 624
 
@@ -629,8 +629,8 @@  discard block
 block discarded – undo
629 629
 	 * @param int $nmbr - the number of non-breaking spaces to return
630 630
 	 * @return string
631 631
 	 */
632
-	public static function nbsp( $nmbr = 1 ) {
633
-		return str_repeat( '&nbsp;', $nmbr );
632
+	public static function nbsp($nmbr = 1) {
633
+		return str_repeat('&nbsp;', $nmbr);
634 634
 	}
635 635
 
636 636
 
@@ -644,9 +644,9 @@  discard block
 block discarded – undo
644 644
 	 * @param string $id
645 645
 	 * @return string
646 646
 	 */
647
-	public static function sanitize_id( $id = '' ) {
648
-		$key = str_replace( ' ', '-', trim( $id ) );
649
-		return preg_replace( '/[^a-zA-Z0-9_\-]/', '', $key );
647
+	public static function sanitize_id($id = '') {
648
+		$key = str_replace(' ', '-', trim($id));
649
+		return preg_replace('/[^a-zA-Z0-9_\-]/', '', $key);
650 650
 	}
651 651
 
652 652
 
@@ -658,10 +658,10 @@  discard block
 block discarded – undo
658 658
 	 * @param string $tag
659 659
 	 * @return string - newline character plus # of indents passed (can be + or -)
660 660
 	 */
661
-	public static function nl( $indent = 0, $tag = 'none' ) {
661
+	public static function nl($indent = 0, $tag = 'none') {
662 662
 		$html = "\n";
663
-		EEH_HTML::indent( $indent, $tag );
664
-		for ( $x = 0; $x < EEH_HTML::$_indent[ $tag ]; $x++ ) {
663
+		EEH_HTML::indent($indent, $tag);
664
+		for ($x = 0; $x < EEH_HTML::$_indent[$tag]; $x++) {
665 665
 			$html .= "\t";
666 666
 		}
667 667
 		return $html;
@@ -676,17 +676,17 @@  discard block
 block discarded – undo
676 676
 	 * @param int    $indent can be negative to decrease the indentation level
677 677
 	 * @param string $tag
678 678
 	 */
679
-	public static function indent( $indent, $tag = 'none' ){
679
+	public static function indent($indent, $tag = 'none') {
680 680
 		static $default_indentation = FALSE;
681
-		if ( ! $default_indentation ) {
681
+		if ( ! $default_indentation) {
682 682
 			EEH_HTML::_set_default_indentation();
683 683
 			$default_indentation = TRUE;
684 684
 		}
685
-		if ( ! isset( EEH_HTML::$_indent[ $tag ] )) {
686
-			EEH_HTML::$_indent[ $tag ] = 0;
685
+		if ( ! isset(EEH_HTML::$_indent[$tag])) {
686
+			EEH_HTML::$_indent[$tag] = 0;
687 687
 		}
688
-		EEH_HTML::$_indent[ $tag ] += intval( $indent );
689
-		EEH_HTML::$_indent[ $tag ] = EEH_HTML::$_indent[ $tag ] >= 0 ? EEH_HTML::$_indent[ $tag ] : 0;
688
+		EEH_HTML::$_indent[$tag] += intval($indent);
689
+		EEH_HTML::$_indent[$tag] = EEH_HTML::$_indent[$tag] >= 0 ? EEH_HTML::$_indent[$tag] : 0;
690 690
 	}
691 691
 
692 692
 
Please login to merge, or discard this patch.
core/helpers/EEH_Inflector.helper.php 3 patches
Indentation   +315 added lines, -315 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
  * @version $Revision 0.1 $
36 36
  */
37 37
 class EEH_Inflector{
38
-    // ------ CLASS METHODS ------ //
39
-    // ---- Public methods ---- //
40
-    // {{{ pluralize()
38
+	// ------ CLASS METHODS ------ //
39
+	// ---- Public methods ---- //
40
+	// {{{ pluralize()
41 41
 
42 42
 	/**
43 43
 	 * Just calls self::pluralize and strtolower on $word and returns it
@@ -51,319 +51,319 @@  discard block
 block discarded – undo
51 51
 	static function singularize_and_upper( $word ) {
52 52
 		return str_replace( ' ', '_', self::humanize( self::singularize( $word ), 'all' ) );
53 53
 	}
54
-    /**
55
-     * Pluralizes English nouns.
56
-     *
57
-     * @access public
58
-     * @static
59
-     * @param    string    $word    English noun to pluralize
60
-     * @return string Plural noun
61
-     */
62
-    static function pluralize($word){
63
-        $plural = array(
64
-            '/(quiz)$/i'               => '\1zes',
65
-            '/^(ox)$/i'                => '\1en',
66
-            '/([m|l])ouse$/i'          => '\1ice',
67
-            '/(matr|vert|ind)ix|ex$/i' => '\1ices',
68
-            '/(x|ch|ss|sh)$/i'         => '\1es',
69
-            '/([^aeiouy]|qu)ies$/i'    => '\1y',
70
-            '/([^aeiouy]|qu)y$/i'      => '\1ies',
71
-            '/(hive)$/i'               => '\1s',
72
-            '/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
73
-            '/sis$/i'                  => 'ses',
74
-            '/([ti])um$/i'             => '\1a',
75
-            '/(buffal|tomat)o$/i'      => '\1oes',
76
-            '/(bu)s$/i'                => '\1ses',
77
-            '/(alias|status)/i'        => '\1es',
78
-            '/(octop|vir)us$/i'        => '\1i',
79
-            '/(ax|test)is$/i'          => '\1es',
80
-            '/s$/i'                    => 's',
81
-            '/$/'                      => 's');
82
-
83
-        $uncountable = array('equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep');
84
-
85
-        $irregular = array(
86
-            'person' => 'people',
87
-            'man'    => 'men',
88
-            'child'  => 'children',
89
-            'sex'    => 'sexes',
90
-            'move'   => 'moves');
91
-
92
-        $lowercased_word = strtolower($word);
93
-
94
-        foreach($uncountable as $_uncountable){
95
-            if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable && //even though the word "price" ends in "rice", it can be pluralized, so check the previous character isnt a letter
54
+	/**
55
+	 * Pluralizes English nouns.
56
+	 *
57
+	 * @access public
58
+	 * @static
59
+	 * @param    string    $word    English noun to pluralize
60
+	 * @return string Plural noun
61
+	 */
62
+	static function pluralize($word){
63
+		$plural = array(
64
+			'/(quiz)$/i'               => '\1zes',
65
+			'/^(ox)$/i'                => '\1en',
66
+			'/([m|l])ouse$/i'          => '\1ice',
67
+			'/(matr|vert|ind)ix|ex$/i' => '\1ices',
68
+			'/(x|ch|ss|sh)$/i'         => '\1es',
69
+			'/([^aeiouy]|qu)ies$/i'    => '\1y',
70
+			'/([^aeiouy]|qu)y$/i'      => '\1ies',
71
+			'/(hive)$/i'               => '\1s',
72
+			'/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
73
+			'/sis$/i'                  => 'ses',
74
+			'/([ti])um$/i'             => '\1a',
75
+			'/(buffal|tomat)o$/i'      => '\1oes',
76
+			'/(bu)s$/i'                => '\1ses',
77
+			'/(alias|status)/i'        => '\1es',
78
+			'/(octop|vir)us$/i'        => '\1i',
79
+			'/(ax|test)is$/i'          => '\1es',
80
+			'/s$/i'                    => 's',
81
+			'/$/'                      => 's');
82
+
83
+		$uncountable = array('equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep');
84
+
85
+		$irregular = array(
86
+			'person' => 'people',
87
+			'man'    => 'men',
88
+			'child'  => 'children',
89
+			'sex'    => 'sexes',
90
+			'move'   => 'moves');
91
+
92
+		$lowercased_word = strtolower($word);
93
+
94
+		foreach($uncountable as $_uncountable){
95
+			if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable && //even though the word "price" ends in "rice", it can be pluralized, so check the previous character isnt a letter
96 96
 					! ctype_alpha( $lowercased_word[ strlen( $lowercased_word ) - strlen($_uncountable) ] ) ){
97
-                return $word;
98
-            }
99
-        }
100
-
101
-        foreach($irregular as $_plural => $_singular){
102
-            if(preg_match('/(' . $_plural . ')$/i', $word, $arr)){
103
-                return preg_replace('/(' . $_plural . ')$/i', substr($arr[0], 0, 1) . substr($_singular, 1), $word);
104
-            }
105
-        }
106
-
107
-        foreach($plural as $rule => $replacement){
108
-            if(preg_match($rule, $word)){
109
-                return preg_replace($rule, $replacement, $word);
110
-            }
111
-        }
112
-        return false;
113
-    }
114
-
115
-    // }}}
116
-    // {{{ singularize()
117
-
118
-    /**
119
-     * Singularizes English nouns.
120
-     *
121
-     * @access public
122
-     * @static
123
-     * @param    string    $word    English noun to singularize
124
-     * @return string Singular noun.
125
-     */
126
-    static function singularize($word){
127
-        $singular = array(
128
-            '/(quiz)zes$/i'                                                    => '\1',
129
-            '/(matr)ices$/i'                                                   => '\1ix',
130
-            '/(vert|ind)ices$/i'                                               => '\1ex',
131
-            '/^(ox)en/i'                                                       => '\1',
132
-            '/(alias|status)es$/i'                                             => '\1',
133
-            '/([octop|vir])i$/i'                                               => '\1us',
134
-            '/(cris|ax|test)es$/i'                                             => '\1is',
135
-            '/(shoe)s$/i'                                                      => '\1',
136
-            '/(o)es$/i'                                                        => '\1',
137
-            '/(bus)es$/i'                                                      => '\1',
138
-            '/([m|l])ice$/i'                                                   => '\1ouse',
139
-            '/(x|ch|ss|sh)es$/i'                                               => '\1',
140
-            '/(m)ovies$/i'                                                     => '\1ovie',
141
-            '/(s)eries$/i'                                                     => '\1eries',
142
-            '/([^aeiouy]|qu)ies$/i'                                            => '\1y',
143
-            '/([lr])ves$/i'                                                    => '\1f',
144
-            '/(tive)s$/i'                                                      => '\1',
145
-            '/(hive)s$/i'                                                      => '\1',
146
-            '/([^f])ves$/i'                                                    => '\1fe',
147
-            '/(^analy)ses$/i'                                                  => '\1sis',
148
-            '/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
149
-            '/([ti])a$/i'                                                      => '\1um',
150
-            '/(n)ews$/i'                                                       => '\1ews',
151
-            '/s$/i'                                                            => '',
152
-        );
153
-
154
-        $uncountable = array('equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep');
155
-
156
-        $irregular = array(
157
-            'person' => 'people',
158
-            'man'    => 'men',
159
-            'child'  => 'children',
160
-            'sex'    => 'sexes',
161
-            'move'   => 'moves');
162
-
163
-        $lowercased_word = strtolower($word);
164
-        foreach($uncountable as $_uncountable){
165
-            if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable){
166
-                return $word;
167
-            }
168
-        }
169
-
170
-        foreach($irregular as $_plural => $_singular){
171
-            if(preg_match('/(' . $_singular . ')$/i', $word, $arr)){
172
-                return preg_replace('/(' . $_singular . ')$/i', substr($arr[0], 0, 1) . substr($_plural, 1), $word);
173
-            }
174
-        }
175
-
176
-        foreach($singular as $rule => $replacement){
177
-            if(preg_match($rule, $word)){
178
-                return preg_replace($rule, $replacement, $word);
179
-            }
180
-        }
181
-
182
-        return $word;
183
-    }
184
-
185
-    // }}}
186
-    // {{{ titleize()
187
-
188
-    /**
189
-     * Converts an underscored or CamelCase word into a English
190
-     * sentence.
191
-     *
192
-     * The titleize static function converts text like "WelcomePage",
193
-     * "welcome_page" or  "welcome page" to this "Welcome
194
-     * Page".
195
-     * If second parameter is set to 'first' it will only
196
-     * capitalize the first character of the title.
197
-     *
198
-     * @access public
199
-     * @static
200
-     * @param    string    $word    Word to format as tile
201
-     * @param    string    $uppercase    If set to 'first' it will only uppercase the
202
-     * first character. Otherwise it will uppercase all
203
-     * the words in the title.
204
-     * @return string Text formatted as title
205
-     */
206
-    static function titleize($word, $uppercase = ''){
207
-        $uppercase = $uppercase == 'first' ? 'ucfirst' : 'ucwords';
208
-        return $uppercase(EEH_Inflector::humanize(EEH_Inflector::underscore($word)));
209
-    }
210
-
211
-    // }}}
212
-    // {{{ camelize()
213
-
214
-    /**
215
-     * Returns given word as CamelCased
216
-     *
217
-     * Converts a word like "send_email" to "SendEmail". It
218
-     * will remove non alphanumeric character from the word, so
219
-     * "who's online" will be converted to "WhoSOnline"
220
-     *
221
-     * @access public
222
-     * @static
223
-     * @see variablize
224
-     * @param    string    $word    Word to convert to camel case
225
-     * @return string UpperCamelCasedWord
226
-     */
227
-    static function camelize($word){
228
-        return str_replace(' ', '', ucwords(preg_replace('/[^A-Z^a-z^0-9]+/', ' ', $word)));
229
-    }
230
-
231
-    // }}}
232
-    // {{{ underscore()
233
-
234
-    /**
235
-     * Converts a word "into_it_s_underscored_version"
236
-     *
237
-     * Convert any "CamelCased" or "ordinary Word" into an
238
-     * "underscored_word".
239
-     *
240
-     * This can be really useful for creating friendly URLs.
241
-     *
242
-     * @access public
243
-     * @static
244
-     * @param    string    $word    Word to underscore
245
-     * @return string Underscored word
246
-     */
247
-    static function underscore($word){
248
-        return strtolower(preg_replace('/[^A-Z^a-z^0-9]+/', '_', preg_replace('/([a-zd])([A-Z])/', '1_2', preg_replace('/([A-Z]+)([A-Z][a-z])/', '1_2', $word))));
249
-    }
250
-
251
-    // }}}
252
-    // {{{ humanize()
253
-
254
-    /**
255
-     * Returns a human-readable string from $word
256
-     *
257
-     * Returns a human-readable string from $word, by replacing
258
-     * underscores with a space, and by upper-casing the initial
259
-     * character by default.
260
-     *
261
-     * If you need to uppercase all the words you just have to
262
-     * pass 'all' as a second parameter.
263
-     *
264
-     * @access public
265
-     * @static
266
-     * @param    string    $word    String to "humanize"
267
-     * @param    string    $uppercase    If set to 'all' it will uppercase all the words
268
-     * instead of just the first one.
269
-     * @return string Human-readable word
270
-     */
271
-    static function humanize($word, $uppercase = ''){
97
+				return $word;
98
+			}
99
+		}
100
+
101
+		foreach($irregular as $_plural => $_singular){
102
+			if(preg_match('/(' . $_plural . ')$/i', $word, $arr)){
103
+				return preg_replace('/(' . $_plural . ')$/i', substr($arr[0], 0, 1) . substr($_singular, 1), $word);
104
+			}
105
+		}
106
+
107
+		foreach($plural as $rule => $replacement){
108
+			if(preg_match($rule, $word)){
109
+				return preg_replace($rule, $replacement, $word);
110
+			}
111
+		}
112
+		return false;
113
+	}
114
+
115
+	// }}}
116
+	// {{{ singularize()
117
+
118
+	/**
119
+	 * Singularizes English nouns.
120
+	 *
121
+	 * @access public
122
+	 * @static
123
+	 * @param    string    $word    English noun to singularize
124
+	 * @return string Singular noun.
125
+	 */
126
+	static function singularize($word){
127
+		$singular = array(
128
+			'/(quiz)zes$/i'                                                    => '\1',
129
+			'/(matr)ices$/i'                                                   => '\1ix',
130
+			'/(vert|ind)ices$/i'                                               => '\1ex',
131
+			'/^(ox)en/i'                                                       => '\1',
132
+			'/(alias|status)es$/i'                                             => '\1',
133
+			'/([octop|vir])i$/i'                                               => '\1us',
134
+			'/(cris|ax|test)es$/i'                                             => '\1is',
135
+			'/(shoe)s$/i'                                                      => '\1',
136
+			'/(o)es$/i'                                                        => '\1',
137
+			'/(bus)es$/i'                                                      => '\1',
138
+			'/([m|l])ice$/i'                                                   => '\1ouse',
139
+			'/(x|ch|ss|sh)es$/i'                                               => '\1',
140
+			'/(m)ovies$/i'                                                     => '\1ovie',
141
+			'/(s)eries$/i'                                                     => '\1eries',
142
+			'/([^aeiouy]|qu)ies$/i'                                            => '\1y',
143
+			'/([lr])ves$/i'                                                    => '\1f',
144
+			'/(tive)s$/i'                                                      => '\1',
145
+			'/(hive)s$/i'                                                      => '\1',
146
+			'/([^f])ves$/i'                                                    => '\1fe',
147
+			'/(^analy)ses$/i'                                                  => '\1sis',
148
+			'/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
149
+			'/([ti])a$/i'                                                      => '\1um',
150
+			'/(n)ews$/i'                                                       => '\1ews',
151
+			'/s$/i'                                                            => '',
152
+		);
153
+
154
+		$uncountable = array('equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep');
155
+
156
+		$irregular = array(
157
+			'person' => 'people',
158
+			'man'    => 'men',
159
+			'child'  => 'children',
160
+			'sex'    => 'sexes',
161
+			'move'   => 'moves');
162
+
163
+		$lowercased_word = strtolower($word);
164
+		foreach($uncountable as $_uncountable){
165
+			if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable){
166
+				return $word;
167
+			}
168
+		}
169
+
170
+		foreach($irregular as $_plural => $_singular){
171
+			if(preg_match('/(' . $_singular . ')$/i', $word, $arr)){
172
+				return preg_replace('/(' . $_singular . ')$/i', substr($arr[0], 0, 1) . substr($_plural, 1), $word);
173
+			}
174
+		}
175
+
176
+		foreach($singular as $rule => $replacement){
177
+			if(preg_match($rule, $word)){
178
+				return preg_replace($rule, $replacement, $word);
179
+			}
180
+		}
181
+
182
+		return $word;
183
+	}
184
+
185
+	// }}}
186
+	// {{{ titleize()
187
+
188
+	/**
189
+	 * Converts an underscored or CamelCase word into a English
190
+	 * sentence.
191
+	 *
192
+	 * The titleize static function converts text like "WelcomePage",
193
+	 * "welcome_page" or  "welcome page" to this "Welcome
194
+	 * Page".
195
+	 * If second parameter is set to 'first' it will only
196
+	 * capitalize the first character of the title.
197
+	 *
198
+	 * @access public
199
+	 * @static
200
+	 * @param    string    $word    Word to format as tile
201
+	 * @param    string    $uppercase    If set to 'first' it will only uppercase the
202
+	 * first character. Otherwise it will uppercase all
203
+	 * the words in the title.
204
+	 * @return string Text formatted as title
205
+	 */
206
+	static function titleize($word, $uppercase = ''){
207
+		$uppercase = $uppercase == 'first' ? 'ucfirst' : 'ucwords';
208
+		return $uppercase(EEH_Inflector::humanize(EEH_Inflector::underscore($word)));
209
+	}
210
+
211
+	// }}}
212
+	// {{{ camelize()
213
+
214
+	/**
215
+	 * Returns given word as CamelCased
216
+	 *
217
+	 * Converts a word like "send_email" to "SendEmail". It
218
+	 * will remove non alphanumeric character from the word, so
219
+	 * "who's online" will be converted to "WhoSOnline"
220
+	 *
221
+	 * @access public
222
+	 * @static
223
+	 * @see variablize
224
+	 * @param    string    $word    Word to convert to camel case
225
+	 * @return string UpperCamelCasedWord
226
+	 */
227
+	static function camelize($word){
228
+		return str_replace(' ', '', ucwords(preg_replace('/[^A-Z^a-z^0-9]+/', ' ', $word)));
229
+	}
230
+
231
+	// }}}
232
+	// {{{ underscore()
233
+
234
+	/**
235
+	 * Converts a word "into_it_s_underscored_version"
236
+	 *
237
+	 * Convert any "CamelCased" or "ordinary Word" into an
238
+	 * "underscored_word".
239
+	 *
240
+	 * This can be really useful for creating friendly URLs.
241
+	 *
242
+	 * @access public
243
+	 * @static
244
+	 * @param    string    $word    Word to underscore
245
+	 * @return string Underscored word
246
+	 */
247
+	static function underscore($word){
248
+		return strtolower(preg_replace('/[^A-Z^a-z^0-9]+/', '_', preg_replace('/([a-zd])([A-Z])/', '1_2', preg_replace('/([A-Z]+)([A-Z][a-z])/', '1_2', $word))));
249
+	}
250
+
251
+	// }}}
252
+	// {{{ humanize()
253
+
254
+	/**
255
+	 * Returns a human-readable string from $word
256
+	 *
257
+	 * Returns a human-readable string from $word, by replacing
258
+	 * underscores with a space, and by upper-casing the initial
259
+	 * character by default.
260
+	 *
261
+	 * If you need to uppercase all the words you just have to
262
+	 * pass 'all' as a second parameter.
263
+	 *
264
+	 * @access public
265
+	 * @static
266
+	 * @param    string    $word    String to "humanize"
267
+	 * @param    string    $uppercase    If set to 'all' it will uppercase all the words
268
+	 * instead of just the first one.
269
+	 * @return string Human-readable word
270
+	 */
271
+	static function humanize($word, $uppercase = ''){
272 272
 		//make special exceptions for acronyms
273 273
 		$word = str_replace('wp_', 'WP_', $word );
274
-        $uppercase = $uppercase == 'all' ? 'ucwords' : 'ucfirst';
275
-        return $uppercase(str_replace('_', ' ', preg_replace('/_id$/', '', $word)));
276
-    }
277
-
278
-    // }}}
279
-    // {{{ variablize()
280
-
281
-    /**
282
-     * Same as camelize but first char is underscored
283
-     *
284
-     * Converts a word like "send_email" to "sendEmail". It
285
-     * will remove non alphanumeric character from the word, so
286
-     * "who's online" will be converted to "whoSOnline"
287
-     *
288
-     * @access public
289
-     * @static
290
-     * @see camelize
291
-     * @param    string    $word    Word to lowerCamelCase
292
-     * @return string Returns a lowerCamelCasedWord
293
-     */
294
-    static function variablize($word){
295
-        $word = EEH_Inflector::camelize($word);
296
-        return strtolower($word[0]) . substr($word, 1);
297
-    }
298
-
299
-    // }}}
300
-    // {{{ tableize()
301
-
302
-    /**
303
-     * Converts a class name to its table name according to rails
304
-     * naming conventions.
305
-     *
306
-     * Converts "Person" to "people"
307
-     *
308
-     * @access public
309
-     * @static
310
-     * @see classify
311
-     * @param    string    $class_name    Class name for getting related table_name.
312
-     * @return string plural_table_name
313
-     */
314
-    static function tableize($class_name){
315
-        return EEH_Inflector::pluralize(EEH_Inflector::underscore($class_name));
316
-    }
317
-
318
-    // }}}
319
-    // {{{ classify()
320
-
321
-    /**
322
-     * Converts a table name to its class name according to rails
323
-     * naming conventions.
324
-     *
325
-     * Converts "people" to "Person"
326
-     *
327
-     * @access public
328
-     * @static
329
-     * @see tableize
330
-     * @param    string    $table_name    Table name for getting related ClassName.
331
-     * @return string SingularClassName
332
-     */
333
-    static function classify($table_name){
334
-        return EEH_Inflector::camelize(EEH_Inflector::singularize($table_name));
335
-    }
336
-
337
-    // }}}
338
-    // {{{ ordinalize()
339
-
340
-    /**
341
-     * Converts number to its ordinal English form.
342
-     *
343
-     * This method converts 13 to 13th, 2 to 2nd ...
344
-     *
345
-     * @access public
346
-     * @static
347
-     * @param    integer    $number    Number to get its ordinal value
348
-     * @return string Ordinal representation of given string.
349
-     */
350
-    static function ordinalize($number){
351
-        if(in_array(($number % 100), range(11, 13))){
352
-            return $number . 'th';
353
-        }else{
354
-            switch(($number % 10)){
355
-                case 1:
356
-                    return $number . 'st';
357
-                    break;
358
-                case 2:
359
-                    return $number . 'nd';
360
-                    break;
361
-                case 3:
362
-                    return $number . 'rd';
363
-                default:
364
-                    return $number . 'th';
365
-                    break;
366
-            }
367
-        }
368
-    }
274
+		$uppercase = $uppercase == 'all' ? 'ucwords' : 'ucfirst';
275
+		return $uppercase(str_replace('_', ' ', preg_replace('/_id$/', '', $word)));
276
+	}
277
+
278
+	// }}}
279
+	// {{{ variablize()
280
+
281
+	/**
282
+	 * Same as camelize but first char is underscored
283
+	 *
284
+	 * Converts a word like "send_email" to "sendEmail". It
285
+	 * will remove non alphanumeric character from the word, so
286
+	 * "who's online" will be converted to "whoSOnline"
287
+	 *
288
+	 * @access public
289
+	 * @static
290
+	 * @see camelize
291
+	 * @param    string    $word    Word to lowerCamelCase
292
+	 * @return string Returns a lowerCamelCasedWord
293
+	 */
294
+	static function variablize($word){
295
+		$word = EEH_Inflector::camelize($word);
296
+		return strtolower($word[0]) . substr($word, 1);
297
+	}
298
+
299
+	// }}}
300
+	// {{{ tableize()
301
+
302
+	/**
303
+	 * Converts a class name to its table name according to rails
304
+	 * naming conventions.
305
+	 *
306
+	 * Converts "Person" to "people"
307
+	 *
308
+	 * @access public
309
+	 * @static
310
+	 * @see classify
311
+	 * @param    string    $class_name    Class name for getting related table_name.
312
+	 * @return string plural_table_name
313
+	 */
314
+	static function tableize($class_name){
315
+		return EEH_Inflector::pluralize(EEH_Inflector::underscore($class_name));
316
+	}
317
+
318
+	// }}}
319
+	// {{{ classify()
320
+
321
+	/**
322
+	 * Converts a table name to its class name according to rails
323
+	 * naming conventions.
324
+	 *
325
+	 * Converts "people" to "Person"
326
+	 *
327
+	 * @access public
328
+	 * @static
329
+	 * @see tableize
330
+	 * @param    string    $table_name    Table name for getting related ClassName.
331
+	 * @return string SingularClassName
332
+	 */
333
+	static function classify($table_name){
334
+		return EEH_Inflector::camelize(EEH_Inflector::singularize($table_name));
335
+	}
336
+
337
+	// }}}
338
+	// {{{ ordinalize()
339
+
340
+	/**
341
+	 * Converts number to its ordinal English form.
342
+	 *
343
+	 * This method converts 13 to 13th, 2 to 2nd ...
344
+	 *
345
+	 * @access public
346
+	 * @static
347
+	 * @param    integer    $number    Number to get its ordinal value
348
+	 * @return string Ordinal representation of given string.
349
+	 */
350
+	static function ordinalize($number){
351
+		if(in_array(($number % 100), range(11, 13))){
352
+			return $number . 'th';
353
+		}else{
354
+			switch(($number % 10)){
355
+				case 1:
356
+					return $number . 'st';
357
+					break;
358
+				case 2:
359
+					return $number . 'nd';
360
+					break;
361
+				case 3:
362
+					return $number . 'rd';
363
+				default:
364
+					return $number . 'th';
365
+					break;
366
+			}
367
+		}
368
+	}
369 369
 }
370 370
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 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
 // +----------------------------------------------------------------------+
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * @since 0.1
35 35
  * @version $Revision 0.1 $
36 36
  */
37
-class EEH_Inflector{
37
+class EEH_Inflector {
38 38
     // ------ CLASS METHODS ------ //
39 39
     // ---- Public methods ---- //
40 40
     // {{{ pluralize()
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 	 * @param string $word
45 45
 	 * @return string
46 46
 	 */
47
-	static function pluralize_and_lower( $word ){
48
-		return strtolower( self::pluralize( $word ) );
47
+	static function pluralize_and_lower($word) {
48
+		return strtolower(self::pluralize($word));
49 49
 	}
50 50
 
51
-	static function singularize_and_upper( $word ) {
52
-		return str_replace( ' ', '_', self::humanize( self::singularize( $word ), 'all' ) );
51
+	static function singularize_and_upper($word) {
52
+		return str_replace(' ', '_', self::humanize(self::singularize($word), 'all'));
53 53
 	}
54 54
     /**
55 55
      * Pluralizes English nouns.
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * @param    string    $word    English noun to pluralize
60 60
      * @return string Plural noun
61 61
      */
62
-    static function pluralize($word){
62
+    static function pluralize($word) {
63 63
         $plural = array(
64 64
             '/(quiz)$/i'               => '\1zes',
65 65
             '/^(ox)$/i'                => '\1en',
@@ -91,21 +91,21 @@  discard block
 block discarded – undo
91 91
 
92 92
         $lowercased_word = strtolower($word);
93 93
 
94
-        foreach($uncountable as $_uncountable){
95
-            if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable && //even though the word "price" ends in "rice", it can be pluralized, so check the previous character isnt a letter
96
-					! ctype_alpha( $lowercased_word[ strlen( $lowercased_word ) - strlen($_uncountable) ] ) ){
94
+        foreach ($uncountable as $_uncountable) {
95
+            if (substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable && //even though the word "price" ends in "rice", it can be pluralized, so check the previous character isnt a letter
96
+					! ctype_alpha($lowercased_word[strlen($lowercased_word) - strlen($_uncountable)])) {
97 97
                 return $word;
98 98
             }
99 99
         }
100 100
 
101
-        foreach($irregular as $_plural => $_singular){
102
-            if(preg_match('/(' . $_plural . ')$/i', $word, $arr)){
103
-                return preg_replace('/(' . $_plural . ')$/i', substr($arr[0], 0, 1) . substr($_singular, 1), $word);
101
+        foreach ($irregular as $_plural => $_singular) {
102
+            if (preg_match('/('.$_plural.')$/i', $word, $arr)) {
103
+                return preg_replace('/('.$_plural.')$/i', substr($arr[0], 0, 1).substr($_singular, 1), $word);
104 104
             }
105 105
         }
106 106
 
107
-        foreach($plural as $rule => $replacement){
108
-            if(preg_match($rule, $word)){
107
+        foreach ($plural as $rule => $replacement) {
108
+            if (preg_match($rule, $word)) {
109 109
                 return preg_replace($rule, $replacement, $word);
110 110
             }
111 111
         }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      * @param    string    $word    English noun to singularize
124 124
      * @return string Singular noun.
125 125
      */
126
-    static function singularize($word){
126
+    static function singularize($word) {
127 127
         $singular = array(
128 128
             '/(quiz)zes$/i'                                                    => '\1',
129 129
             '/(matr)ices$/i'                                                   => '\1ix',
@@ -161,20 +161,20 @@  discard block
 block discarded – undo
161 161
             'move'   => 'moves');
162 162
 
163 163
         $lowercased_word = strtolower($word);
164
-        foreach($uncountable as $_uncountable){
165
-            if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable){
164
+        foreach ($uncountable as $_uncountable) {
165
+            if (substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable) {
166 166
                 return $word;
167 167
             }
168 168
         }
169 169
 
170
-        foreach($irregular as $_plural => $_singular){
171
-            if(preg_match('/(' . $_singular . ')$/i', $word, $arr)){
172
-                return preg_replace('/(' . $_singular . ')$/i', substr($arr[0], 0, 1) . substr($_plural, 1), $word);
170
+        foreach ($irregular as $_plural => $_singular) {
171
+            if (preg_match('/('.$_singular.')$/i', $word, $arr)) {
172
+                return preg_replace('/('.$_singular.')$/i', substr($arr[0], 0, 1).substr($_plural, 1), $word);
173 173
             }
174 174
         }
175 175
 
176
-        foreach($singular as $rule => $replacement){
177
-            if(preg_match($rule, $word)){
176
+        foreach ($singular as $rule => $replacement) {
177
+            if (preg_match($rule, $word)) {
178 178
                 return preg_replace($rule, $replacement, $word);
179 179
             }
180 180
         }
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      * the words in the title.
204 204
      * @return string Text formatted as title
205 205
      */
206
-    static function titleize($word, $uppercase = ''){
206
+    static function titleize($word, $uppercase = '') {
207 207
         $uppercase = $uppercase == 'first' ? 'ucfirst' : 'ucwords';
208 208
         return $uppercase(EEH_Inflector::humanize(EEH_Inflector::underscore($word)));
209 209
     }
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      * @param    string    $word    Word to convert to camel case
225 225
      * @return string UpperCamelCasedWord
226 226
      */
227
-    static function camelize($word){
227
+    static function camelize($word) {
228 228
         return str_replace(' ', '', ucwords(preg_replace('/[^A-Z^a-z^0-9]+/', ' ', $word)));
229 229
     }
230 230
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
      * @param    string    $word    Word to underscore
245 245
      * @return string Underscored word
246 246
      */
247
-    static function underscore($word){
247
+    static function underscore($word) {
248 248
         return strtolower(preg_replace('/[^A-Z^a-z^0-9]+/', '_', preg_replace('/([a-zd])([A-Z])/', '1_2', preg_replace('/([A-Z]+)([A-Z][a-z])/', '1_2', $word))));
249 249
     }
250 250
 
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
      * instead of just the first one.
269 269
      * @return string Human-readable word
270 270
      */
271
-    static function humanize($word, $uppercase = ''){
271
+    static function humanize($word, $uppercase = '') {
272 272
 		//make special exceptions for acronyms
273
-		$word = str_replace('wp_', 'WP_', $word );
273
+		$word = str_replace('wp_', 'WP_', $word);
274 274
         $uppercase = $uppercase == 'all' ? 'ucwords' : 'ucfirst';
275 275
         return $uppercase(str_replace('_', ' ', preg_replace('/_id$/', '', $word)));
276 276
     }
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
      * @param    string    $word    Word to lowerCamelCase
292 292
      * @return string Returns a lowerCamelCasedWord
293 293
      */
294
-    static function variablize($word){
294
+    static function variablize($word) {
295 295
         $word = EEH_Inflector::camelize($word);
296
-        return strtolower($word[0]) . substr($word, 1);
296
+        return strtolower($word[0]).substr($word, 1);
297 297
     }
298 298
 
299 299
     // }}}
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      * @param    string    $class_name    Class name for getting related table_name.
312 312
      * @return string plural_table_name
313 313
      */
314
-    static function tableize($class_name){
314
+    static function tableize($class_name) {
315 315
         return EEH_Inflector::pluralize(EEH_Inflector::underscore($class_name));
316 316
     }
317 317
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
      * @param    string    $table_name    Table name for getting related ClassName.
331 331
      * @return string SingularClassName
332 332
      */
333
-    static function classify($table_name){
333
+    static function classify($table_name) {
334 334
         return EEH_Inflector::camelize(EEH_Inflector::singularize($table_name));
335 335
     }
336 336
 
@@ -347,21 +347,21 @@  discard block
 block discarded – undo
347 347
      * @param    integer    $number    Number to get its ordinal value
348 348
      * @return string Ordinal representation of given string.
349 349
      */
350
-    static function ordinalize($number){
351
-        if(in_array(($number % 100), range(11, 13))){
352
-            return $number . 'th';
353
-        }else{
354
-            switch(($number % 10)){
350
+    static function ordinalize($number) {
351
+        if (in_array(($number % 100), range(11, 13))) {
352
+            return $number.'th';
353
+        } else {
354
+            switch (($number % 10)) {
355 355
                 case 1:
356
-                    return $number . 'st';
356
+                    return $number.'st';
357 357
                     break;
358 358
                 case 2:
359
-                    return $number . 'nd';
359
+                    return $number.'nd';
360 360
                     break;
361 361
                 case 3:
362
-                    return $number . 'rd';
362
+                    return $number.'rd';
363 363
                 default:
364
-                    return $number . 'th';
364
+                    return $number.'th';
365 365
                     break;
366 366
             }
367 367
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -350,7 +350,7 @@
 block discarded – undo
350 350
     static function ordinalize($number){
351 351
         if(in_array(($number % 100), range(11, 13))){
352 352
             return $number . 'th';
353
-        }else{
353
+        } else{
354 354
             switch(($number % 10)){
355 355
                 case 1:
356 356
                     return $number . 'st';
Please login to merge, or discard this patch.
core/helpers/EEH_MSG_Template.helper.php 2 patches
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
4 4
 	exit('NO direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * Event Espresso
@@ -85,7 +86,9 @@  discard block
 block discarded – undo
85 86
 				$success = FALSE;
86 87
 				continue;
87 88
 			}
88
-			if ( $templates === TRUE ) $templates = array();
89
+			if ( $templates === TRUE ) {
90
+				$templates = array();
91
+			}
89 92
 			$templates[] = $new_message_template_group;
90 93
 		}
91 94
 
@@ -142,8 +145,9 @@  discard block
 block discarded – undo
142 145
 	 */
143 146
 	public static function update_to_inactive( $messenger = '', $message_type = '' ) {
144 147
 		$query_args = array();
145
-		if ( empty( $messenger ) && empty( $message_type ) )
146
-			return 0;
148
+		if ( empty( $messenger ) && empty( $message_type ) ) {
149
+					return 0;
150
+		}
147 151
 		if ( ! empty( $messenger ) ) {
148 152
 			$query_args[0]['MTP_messenger'] = $messenger;
149 153
 		}
@@ -221,8 +225,9 @@  discard block
 block discarded – undo
221 225
 		if ( ! empty( $fields ) ) {
222 226
 			$specified_shortcodes = array();
223 227
 			foreach ( $fields as $field ) {
224
-				if ( isset( $valid_shortcodes[$field] ) )
225
-					$specified_shortcodes[$field] = $valid_shortcodes[$field];
228
+				if ( isset( $valid_shortcodes[$field] ) ) {
229
+									$specified_shortcodes[$field] = $valid_shortcodes[$field];
230
+				}
226 231
 			}
227 232
 			$valid_shortcodes = $specified_shortcodes;
228 233
 		}
@@ -249,10 +254,11 @@  discard block
 block discarded – undo
249 254
 				} else if ( isset( $field_settings['extra'] ) ) {
250 255
 					//loop through extra "main fields" and see if any of their children have our field
251 256
 					foreach ( $field_settings['extra'] as $main_field => $fields ) {
252
-						if ( isset( $fields[$field] ) )
253
-							$_field = $fields[$field]['label'];
254
-						else
255
-							$_field = $field;
257
+						if ( isset( $fields[$field] ) ) {
258
+													$_field = $fields[$field]['label'];
259
+						} else {
260
+													$_field = $field;
261
+						}
256 262
 					}
257 263
 				} else {
258 264
 					$_field = $field;
@@ -270,10 +276,11 @@  discard block
 block discarded – undo
270 276
 			$merged_codes = array();
271 277
 			foreach ( $valid_shortcodes as $field => $shortcode ) {
272 278
 				foreach ( $shortcode as $code => $label ) {
273
-					if ( isset( $merged_codes[$code] ) )
274
-						continue;
275
-					else
276
-						$merged_codes[$code] = $label;
279
+					if ( isset( $merged_codes[$code] ) ) {
280
+											continue;
281
+					} else {
282
+											$merged_codes[$code] = $label;
283
+					}
277 284
 				}
278 285
 			}
279 286
 			$valid_shortcodes = $merged_codes;
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -46,20 +46,20 @@  discard block
 block discarded – undo
46 46
 	 * @throws \EE_Error
47 47
 	 * @return array|bool array of data required for the redirect to the correct edit page or FALSE if encountering problems.
48 48
 	 */
49
-	public static function generate_new_templates($messenger, $message_types, $GRP_ID = 0,  $global = FALSE) {
49
+	public static function generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = FALSE) {
50 50
 
51 51
 		//make sure message_type is an array.
52 52
 		$message_types = (array) $message_types;
53 53
 		$templates = array();
54 54
 		$success = TRUE;
55 55
 
56
-		if ( empty($messenger) ) {
57
-			throw new EE_Error( __('We need a messenger to generate templates!', 'event_espresso') );
56
+		if (empty($messenger)) {
57
+			throw new EE_Error(__('We need a messenger to generate templates!', 'event_espresso'));
58 58
 		}
59 59
 
60 60
 		//if we STILL have empty $message_types then we need to generate an error message b/c we NEED message types to do the template files.
61
-		if ( empty($message_types) ) {
62
-			throw new EE_Error( __('We need at least one message type to generate templates!', 'event_espresso') );
61
+		if (empty($message_types)) {
62
+			throw new EE_Error(__('We need at least one message type to generate templates!', 'event_espresso'));
63 63
 		}
64 64
 
65 65
 		self::_set_autoloader();
@@ -67,25 +67,25 @@  discard block
 block discarded – undo
67 67
 
68 68
 		$MSG = new EE_messages();
69 69
 
70
-		foreach ( $message_types as $message_type ) {
70
+		foreach ($message_types as $message_type) {
71 71
 			//if global then let's attempt to get the GRP_ID for this combo IF GRP_ID is empty.
72
-			if ( $global && empty( $GRP_ID ) ) {
73
-				$GRP_ID = EEM_Message_Template_Group::instance()->get_one( array( array( 'MTP_messenger' => $messenger, 'MTP_message_type' => $message_type, 'MTP_is_global' => TRUE ) ) );
72
+			if ($global && empty($GRP_ID)) {
73
+				$GRP_ID = EEM_Message_Template_Group::instance()->get_one(array(array('MTP_messenger' => $messenger, 'MTP_message_type' => $message_type, 'MTP_is_global' => TRUE)));
74 74
 				$GRP_ID = $GRP_ID instanceof EE_Message_Template_Group ? $GRP_ID->ID() : 0;
75 75
 			}
76 76
 			//if this is global template generation. First let's determine if we already HAVE global templates for this messenger and message_type combination.  If we do then NO generation!!
77
-			if ( $global && self::already_generated($messenger, $message_type, $GRP_ID  ) ) {
77
+			if ($global && self::already_generated($messenger, $message_type, $GRP_ID)) {
78 78
 				$templates = TRUE;
79 79
 				continue; //get out we've already got generated templates for this.
80 80
 			}
81 81
 
82 82
 			$new_message_template_group = $MSG->create_new_templates($messenger, $message_type, $GRP_ID, $global);
83 83
 
84
-			if ( !$new_message_template_group ) {
84
+			if ( ! $new_message_template_group) {
85 85
 				$success = FALSE;
86 86
 				continue;
87 87
 			}
88
-			if ( $templates === TRUE ) $templates = array();
88
+			if ($templates === TRUE) $templates = array();
89 89
 			$templates[] = $new_message_template_group;
90 90
 		}
91 91
 
@@ -101,18 +101,18 @@  discard block
 block discarded – undo
101 101
 	 * @param  bool  $update_to_active if true then we also toggle the template to active.
102 102
 	 * @return bool                true = generated, false = hasn't been generated.
103 103
 	 */
104
-	public static function already_generated( $messenger, $message_type, $GRP_ID = 0, $update_to_active = TRUE ) {
104
+	public static function already_generated($messenger, $message_type, $GRP_ID = 0, $update_to_active = TRUE) {
105 105
 		self::_set_autoloader();
106 106
 		$MTP = EEM_Message_Template::instance();
107 107
 
108 108
 		//what method we use depends on whether we have an GRP_ID or not
109
-		$count = empty( $GRP_ID ) ? EEM_Message_Template::instance()->count( array( array( 'Message_Template_Group.MTP_messenger' => $messenger, 'Message_Template_Group.MTP_message_type' => $message_type, 'Message_Template_Group.MTP_is_global' => TRUE ) ) ) :  $MTP->count( array( array( 'GRP_ID' => $GRP_ID ) ) );
109
+		$count = empty($GRP_ID) ? EEM_Message_Template::instance()->count(array(array('Message_Template_Group.MTP_messenger' => $messenger, 'Message_Template_Group.MTP_message_type' => $message_type, 'Message_Template_Group.MTP_is_global' => TRUE))) : $MTP->count(array(array('GRP_ID' => $GRP_ID)));
110 110
 
111
-		if ( $update_to_active ) {
112
-			self::update_to_active( $messenger, $message_type );
111
+		if ($update_to_active) {
112
+			self::update_to_active($messenger, $message_type);
113 113
 		}
114 114
 
115
-		return ( $count > 0 ) ? TRUE : FALSE;
115
+		return ($count > 0) ? TRUE : FALSE;
116 116
 	}
117 117
 
118 118
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 * @static
127 127
 	 * @return  int 						count of updated records.
128 128
 	 */
129
-	public static function update_to_active( $messenger, $message_type ) {
130
-		return EEM_Message_Template_Group::instance()->update( array('MTP_is_active' => 1), array(array('MTP_messenger' => $messenger, 'MTP_message_type' => $message_type )) );
129
+	public static function update_to_active($messenger, $message_type) {
130
+		return EEM_Message_Template_Group::instance()->update(array('MTP_is_active' => 1), array(array('MTP_messenger' => $messenger, 'MTP_message_type' => $message_type)));
131 131
 	}
132 132
 
133 133
 
@@ -140,18 +140,18 @@  discard block
 block discarded – undo
140 140
 	 *
141 141
 	 * @return int  count of updated records.
142 142
 	 */
143
-	public static function update_to_inactive( $messenger = '', $message_type = '' ) {
143
+	public static function update_to_inactive($messenger = '', $message_type = '') {
144 144
 		$query_args = array();
145
-		if ( empty( $messenger ) && empty( $message_type ) )
145
+		if (empty($messenger) && empty($message_type))
146 146
 			return 0;
147
-		if ( ! empty( $messenger ) ) {
147
+		if ( ! empty($messenger)) {
148 148
 			$query_args[0]['MTP_messenger'] = $messenger;
149 149
 		}
150 150
 
151
-		if ( ! empty( $message_type ) ) {
151
+		if ( ! empty($message_type)) {
152 152
 			$query_args[0]['MTP_message_type'] = $message_type;
153 153
 		}
154
-		return EEM_Message_Template_Group::instance()->update( array( 'MTP_is_active' => FALSE ), $query_args );
154
+		return EEM_Message_Template_Group::instance()->update(array('MTP_is_active' => FALSE), $query_args);
155 155
 	}
156 156
 
157 157
 
@@ -189,38 +189,38 @@  discard block
 block discarded – undo
189 189
 	 *												OR
190 190
 	 * 												FALSE if no shortcodes found.
191 191
 	 */
192
-	public static function get_shortcodes( $message_type, $messenger, $fields = array(), $context = 'admin', $merged = FALSE ) {
192
+	public static function get_shortcodes($message_type, $messenger, $fields = array(), $context = 'admin', $merged = FALSE) {
193 193
 
194
-		$messenger_name = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $messenger ) ) );
195
-		$mt_name = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $message_type ) ) );
194
+		$messenger_name = str_replace(' ', '_', ucwords(str_replace('_', ' ', $messenger)));
195
+		$mt_name = str_replace(' ', '_', ucwords(str_replace('_', ' ', $message_type)));
196 196
 
197 197
 		//convert slug to object
198
-		$messenger = self::messenger_obj( $messenger );
198
+		$messenger = self::messenger_obj($messenger);
199 199
 
200 200
 		//validate class for getting our list of shortcodes
201
-		$classname = 'EE_Messages_' . $messenger_name . '_' . $mt_name . '_Validator';
202
-		if ( !class_exists( $classname ) ) {
203
-			$msg[] = __( 'The Validator class was unable to load', 'event_espresso');
204
-			$msg[] = sprintf( __('The class name compiled was %s. Please check and make sure the spelling and case is correct for the class name and that there is an autoloader in place for this class', 'event_espresso'), $classname );
205
-			throw new EE_Error( implode( '||', $msg ) );
201
+		$classname = 'EE_Messages_'.$messenger_name.'_'.$mt_name.'_Validator';
202
+		if ( ! class_exists($classname)) {
203
+			$msg[] = __('The Validator class was unable to load', 'event_espresso');
204
+			$msg[] = sprintf(__('The class name compiled was %s. Please check and make sure the spelling and case is correct for the class name and that there is an autoloader in place for this class', 'event_espresso'), $classname);
205
+			throw new EE_Error(implode('||', $msg));
206 206
 		}
207 207
 
208
-		$a = new ReflectionClass( $classname );
209
-		$_VLD = $a->newInstance( array(), $context );
208
+		$a = new ReflectionClass($classname);
209
+		$_VLD = $a->newInstance(array(), $context);
210 210
 		$valid_shortcodes = $_VLD->get_validators();
211 211
 
212 212
 		//let's make sure we're only getting the shortcode part of the validators
213 213
 		$shortcodes = array();
214
-		foreach( $valid_shortcodes as $field => $validators ) {
214
+		foreach ($valid_shortcodes as $field => $validators) {
215 215
 			$shortcodes[$field] = $validators['shortcodes'];
216 216
 		}
217 217
 		$valid_shortcodes = $shortcodes;
218 218
 
219 219
 		//if not all fields let's make sure we ONLY include the shortcodes for the specified fields.
220
-		if ( ! empty( $fields ) ) {
220
+		if ( ! empty($fields)) {
221 221
 			$specified_shortcodes = array();
222
-			foreach ( $fields as $field ) {
223
-				if ( isset( $valid_shortcodes[$field] ) )
222
+			foreach ($fields as $field) {
223
+				if (isset($valid_shortcodes[$field]))
224 224
 					$specified_shortcodes[$field] = $valid_shortcodes[$field];
225 225
 			}
226 226
 			$valid_shortcodes = $specified_shortcodes;
@@ -228,16 +228,16 @@  discard block
 block discarded – undo
228 228
 
229 229
 
230 230
 		//if not merged then let's replace the fields with the localized fields
231
-		if ( ! $merged ) {
231
+		if ( ! $merged) {
232 232
 			//let's get all the fields for the set messenger so that we can get the localized label and use that in the returned array.
233 233
 			$field_settings = $messenger->get_template_fields();
234 234
 			$localized = array();
235
-			foreach ( $valid_shortcodes as $field => $shortcodes ) {
235
+			foreach ($valid_shortcodes as $field => $shortcodes) {
236 236
 				//get localized field label
237
-				if ( isset( $field_settings[$field] ) ) {
237
+				if (isset($field_settings[$field])) {
238 238
 					//possible that this is used as a main field.
239
-					if ( empty( $field_settings[$field] ) ) {
240
-						if ( isset( $field_settings['extra'][$field] ) ) {
239
+					if (empty($field_settings[$field])) {
240
+						if (isset($field_settings['extra'][$field])) {
241 241
 							$_field = $field_settings['extra'][$field]['main']['label'];
242 242
 						} else {
243 243
 							$_field = $field;
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
 					} else {
246 246
 						$_field = $field_settings[$field]['label'];
247 247
 					}
248
-				} else if ( isset( $field_settings['extra'] ) ) {
248
+				} else if (isset($field_settings['extra'])) {
249 249
 					//loop through extra "main fields" and see if any of their children have our field
250
-					foreach ( $field_settings['extra'] as $main_field => $fields ) {
251
-						if ( isset( $fields[$field] ) )
250
+					foreach ($field_settings['extra'] as $main_field => $fields) {
251
+						if (isset($fields[$field]))
252 252
 							$_field = $fields[$field]['label'];
253 253
 						else
254 254
 							$_field = $field;
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 				} else {
257 257
 					$_field = $field;
258 258
 				}
259
-				if ( isset( $_field )) {
260
-					$localized[ $_field ] = $shortcodes;
259
+				if (isset($_field)) {
260
+					$localized[$_field] = $shortcodes;
261 261
 				}
262 262
 			}
263 263
 			$valid_shortcodes = $localized;
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
 
266 266
 
267 267
 		//if $merged then let's merge all the shortcodes into one list NOT indexed by field.
268
-		if ( $merged ) {
268
+		if ($merged) {
269 269
 			$merged_codes = array();
270
-			foreach ( $valid_shortcodes as $field => $shortcode ) {
271
-				foreach ( $shortcode as $code => $label ) {
272
-					if ( isset( $merged_codes[$code] ) )
270
+			foreach ($valid_shortcodes as $field => $shortcode) {
271
+				foreach ($shortcode as $code => $label) {
272
+					if (isset($merged_codes[$code]))
273 273
 						continue;
274 274
 					else
275 275
 						$merged_codes[$code] = $label;
@@ -291,15 +291,15 @@  discard block
 block discarded – undo
291 291
 	 * @throws \EE_Error
292 292
 	 * @return EE_messenger
293 293
 	 */
294
-	public static function messenger_obj( $messenger ) {
295
-		$ref = ucwords( str_replace( '_', ' ', $messenger ) );
296
-		$ref = str_replace( ' ', '_', $ref );
297
-		$classname = 'EE_' . $ref . '_messenger';
294
+	public static function messenger_obj($messenger) {
295
+		$ref = ucwords(str_replace('_', ' ', $messenger));
296
+		$ref = str_replace(' ', '_', $ref);
297
+		$classname = 'EE_'.$ref.'_messenger';
298 298
 
299
-		if ( !class_exists($classname) ) {
299
+		if ( ! class_exists($classname)) {
300 300
 			$msg[] = __('Messenger class loading fail.', 'event_espresso');
301
-			$msg[] = sprintf( __('The class name checked was "%s". Please check the spelling and case of this reference and make sure it matches the appropriate messenger file name (minus the extension) in the "/core/messages/messenger/" directory', 'event_espresso'), $classname );
302
-			throw new EE_Error( implode( '||', $msg ) );
301
+			$msg[] = sprintf(__('The class name checked was "%s". Please check the spelling and case of this reference and make sure it matches the appropriate messenger file name (minus the extension) in the "/core/messages/messenger/" directory', 'event_espresso'), $classname);
302
+			throw new EE_Error(implode('||', $msg));
303 303
 		}
304 304
 
305 305
 		//made it here so let's instantiate the object and return it.
@@ -317,15 +317,15 @@  discard block
 block discarded – undo
317 317
 	 * @throws \EE_Error
318 318
 	 * @return EE_message_type
319 319
 	 */
320
-	public static function message_type_obj( $message_type ) {
321
-		$ref = ucwords( str_replace( '_', ' ', $message_type ) );
322
-		$ref = str_replace( ' ', '_', $ref );
323
-		$classname = 'EE_' . $ref . '_message_type';
320
+	public static function message_type_obj($message_type) {
321
+		$ref = ucwords(str_replace('_', ' ', $message_type));
322
+		$ref = str_replace(' ', '_', $ref);
323
+		$classname = 'EE_'.$ref.'_message_type';
324 324
 
325
-		if ( !class_exists($classname) ) {
325
+		if ( ! class_exists($classname)) {
326 326
 			$msg[] = __('Message Type class loading fail.', 'event_espresso');
327
-			$msg[] = sprintf( __('The class name checked was "%s". Please check the spelling and case of this reference and make sure it matches the appropriate message type file name (minus the extension) in the "/core/messages/message_type/" directory', 'event_espresso'), $classname );
328
-			throw new EE_Error( implode( '||', $msg ) );
327
+			$msg[] = sprintf(__('The class name checked was "%s". Please check the spelling and case of this reference and make sure it matches the appropriate message type file name (minus the extension) in the "/core/messages/message_type/" directory', 'event_espresso'), $classname);
328
+			throw new EE_Error(implode('||', $msg));
329 329
 		}
330 330
 
331 331
 		//made it here so let's instantiate the object and return it.
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
 	 * @param  string   $message_type message type to check for.
345 345
 	 * @return boolean
346 346
 	 */
347
-	public static function is_mt_active( $message_type ) {
347
+	public static function is_mt_active($message_type) {
348 348
 		self::_set_autoloader();
349
-		$active_mts = EE_Registry::instance()->load_lib( 'messages' )->get_active_message_types();
350
-		return in_array( $message_type, $active_mts );
349
+		$active_mts = EE_Registry::instance()->load_lib('messages')->get_active_message_types();
350
+		return in_array($message_type, $active_mts);
351 351
 	}
352 352
 
353 353
 
@@ -360,10 +360,10 @@  discard block
 block discarded – undo
360 360
 	 * @param  string  $messenger slug for messenger to check.
361 361
 	 * @return boolean
362 362
 	 */
363
-	public static function is_messenger_active( $messenger ) {
363
+	public static function is_messenger_active($messenger) {
364 364
 		self::_set_autoloader();
365 365
 		$active_messengers = EE_Registry::instance()->load_lib('messages')->get_active_messengers();
366
-		return isset( $active_messengers[ $messenger ] );
366
+		return isset($active_messengers[$messenger]);
367 367
 	}
368 368
 
369 369
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 	 * @return array
378 378
 	 */
379 379
 	public static function get_active_messengers_in_db() {
380
-		return apply_filters( 'FHEE__EEH_MSG_Template__get_active_messengers_in_db', get_option( 'ee_active_messengers', array() ) );
380
+		return apply_filters('FHEE__EEH_MSG_Template__get_active_messengers_in_db', get_option('ee_active_messengers', array()));
381 381
 	}
382 382
 
383 383
 
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
 	 *
393 393
 	 * @return bool FALSE if not updated, TRUE if updated.
394 394
 	 */
395
-	public static function update_active_messengers_in_db( $data_to_save ) {
396
-		return update_option( 'ee_active_messengers', $data_to_save );
395
+	public static function update_active_messengers_in_db($data_to_save) {
396
+		return update_option('ee_active_messengers', $data_to_save);
397 397
 	}
398 398
 
399 399
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 *
413 413
 	 * @return string          The generated url.
414 414
 	 */
415
-	public static function generate_url_trigger( $sending_messenger, $generating_messenger, $context, $message_type, EE_Registration $registration, $message_template_group, $data_id ) {
415
+	public static function generate_url_trigger($sending_messenger, $generating_messenger, $context, $message_type, EE_Registration $registration, $message_template_group, $data_id) {
416 416
 		$query_args = array(
417 417
 			'ee' => 'msg_url_trigger',
418 418
 			'snd_msgr' => $sending_messenger,
@@ -423,10 +423,10 @@  discard block
 block discarded – undo
423 423
 			'GRP_ID' => $message_template_group,
424 424
 			'id' => $data_id
425 425
 			);
426
-		$url = add_query_arg( $query_args, get_site_url() );
426
+		$url = add_query_arg($query_args, get_site_url());
427 427
 
428 428
 		//made it here so now we can just get the url and filter it.  Filtered globally and by message type.
429
-		$url = apply_filters( 'FHEE__EEH_MSG_Template__generate_url_trigger', $url, $sending_messenger, $generating_messenger, $context, $message_type, $registration, $message_template_group, $data_id );
429
+		$url = apply_filters('FHEE__EEH_MSG_Template__generate_url_trigger', $url, $sending_messenger, $generating_messenger, $context, $message_type, $registration, $message_template_group, $data_id);
430 430
 
431 431
 		return $url;
432 432
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Money.helper.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@
 block discarded – undo
8 8
  */
9 9
 if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
10 10
  /**
11
- *
12
- * Money helper class.
13
- * This class has helper methods that help with money related conversions and calculations.
14
- *
15
- * @since %VER%
16
- *
17
- * @package		Event Espresso
18
- * @subpackage	helpers
19
- * @author		Darren Ethier
20
- *
21
- * ------------------------------------------------------------------------
22
- */
11
+  *
12
+  * Money helper class.
13
+  * This class has helper methods that help with money related conversions and calculations.
14
+  *
15
+  * @since %VER%
16
+  *
17
+  * @package		Event Espresso
18
+  * @subpackage	helpers
19
+  * @author		Darren Ethier
20
+  *
21
+  * ------------------------------------------------------------------------
22
+  */
23 23
 class EEH_Money extends EEH_Base  {
24 24
 
25 25
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@
 block discarded – undo
6 6
  * @package  Event Espresso
7 7
  * @subpackage helper
8 8
  */
9
-if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
9
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
10
+	exit('No direct script access allowed');
11
+}
10 12
  /**
11 13
  *
12 14
  * Money helper class.
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 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
 
@@ -160,27 +160,27 @@  discard block
 block discarded – undo
160 160
 	 *
161 161
 	 * @return string
162 162
 	 */
163
-	public static function get_format_for_google_charts( $CNT_ISO = '' ) {
163
+	public static function get_format_for_google_charts($CNT_ISO = '') {
164 164
 		//if CNT_ISO passed lets try to get currency settings for it.
165
-		$currency_config = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : null;
165
+		$currency_config = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null;
166 166
 		//default currency settings for site if not set
167
-		if ( ! $currency_config instanceof EE_Currency_Config ) {
167
+		if ( ! $currency_config instanceof EE_Currency_Config) {
168 168
 			$currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config();
169 169
 		}
170 170
 
171
-		$decimal_places_placeholder = str_pad( '', $currency_config->dec_plc, '0' );
171
+		$decimal_places_placeholder = str_pad('', $currency_config->dec_plc, '0');
172 172
 
173 173
 		//first get the decimal place and number of places
174
-		$format = '#,##0.' . $decimal_places_placeholder;
174
+		$format = '#,##0.'.$decimal_places_placeholder;
175 175
 
176 176
 		//currency symbol on right side.
177
-		$format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign;
177
+		$format = $currency_config->sign_b4 ? $currency_config->sign.$format : $format.$currency_config->sign;
178 178
 		$formatterObject = array(
179 179
 			'decimalSymbol' => $currency_config->dec_mrk,
180 180
 			'groupingSymbol' => $currency_config->thsnds,
181 181
 			'fractionDigits' => $currency_config->dec_plc,
182 182
 		);
183
-		if ( $currency_config->sign_b4 ) {
183
+		if ($currency_config->sign_b4) {
184 184
 			$formatterObject['prefix'] = $currency_config->sign;
185 185
 		} else {
186 186
 			$formatterObject['suffix'] = $currency_config->sign;
Please login to merge, or discard this patch.
core/helpers/EEH_Parse_Shortcodes.helper.php 2 patches
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @param INT 					 $GRP_ID 	       The message template grp_id for the specific template being parsed.
84 84
 	 * @return string                   The parsed template string
85 85
 	 */
86
-	public function parse_message_template( $template, EE_Messages_Addressee $data, $valid_shortcodes, EE_message_type $message_type, EE_messenger $messenger, $context, $GRP_ID ) {
86
+	public function parse_message_template($template, EE_Messages_Addressee $data, $valid_shortcodes, EE_message_type $message_type, EE_messenger $messenger, $context, $GRP_ID) {
87 87
 		$extra_data = array(
88 88
 			'messenger' => $messenger,
89 89
 			'message_type' => $message_type,
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 			'GRP_ID' => $GRP_ID
92 92
 			);
93 93
 
94
-		$this->_init_data( $template, $data, $valid_shortcodes, $extra_data );
94
+		$this->_init_data($template, $data, $valid_shortcodes, $extra_data);
95 95
 
96 96
 
97 97
 		$this->_template = is_array($template) ? $template['main'] : $template;
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 	}
103 103
 
104 104
 
105
-	public function parse_attendee_list_template( $template, EE_Registration $registration, $valid_shortcodes, $extra_data = array() ) {
105
+	public function parse_attendee_list_template($template, EE_Registration $registration, $valid_shortcodes, $extra_data = array()) {
106 106
 
107
-		$this->_init_data( $template, $registration, $valid_shortcodes, $extra_data );
107
+		$this->_init_data($template, $registration, $valid_shortcodes, $extra_data);
108 108
 
109 109
 		$this->_template = is_array($template) ? $template['attendee_list'] : $template;
110 110
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 		return $parsed;
113 113
 	}
114 114
 
115
-	public function parse_event_list_template( $template, EE_Event $event, $valid_shortcodes, $extra_data = array() ) {
116
-		$this->_init_data( $template, $event, $valid_shortcodes, $extra_data );
115
+	public function parse_event_list_template($template, EE_Event $event, $valid_shortcodes, $extra_data = array()) {
116
+		$this->_init_data($template, $event, $valid_shortcodes, $extra_data);
117 117
 
118 118
 		$this->_template = is_array($template) ? $template['event_list'] : $template;
119 119
 
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	}
123 123
 
124 124
 
125
-	public function parse_ticket_list_template( $template, EE_Ticket $ticket, $valid_shortcodes, $extra_data = array() ) {
126
-		$this->_init_data( $template, $ticket, $valid_shortcodes, $extra_data );
125
+	public function parse_ticket_list_template($template, EE_Ticket $ticket, $valid_shortcodes, $extra_data = array()) {
126
+		$this->_init_data($template, $ticket, $valid_shortcodes, $extra_data);
127 127
 
128 128
 		$this->_template = is_array($template) ? $template['ticket_list'] : $template;
129 129
 
@@ -133,26 +133,26 @@  discard block
 block discarded – undo
133 133
 
134 134
 
135 135
 
136
-	public function parse_line_item_list_template( $template, EE_Line_Item $line_item, $valid_shortcodes, $extra_data = array() ) {
137
-		$this->_init_data( $template, $line_item, $valid_shortcodes, $extra_data );
138
-		$this->_template = is_array( $template ) ? $template['ticket_line_item_no_pms'] : $template;
136
+	public function parse_line_item_list_template($template, EE_Line_Item $line_item, $valid_shortcodes, $extra_data = array()) {
137
+		$this->_init_data($template, $line_item, $valid_shortcodes, $extra_data);
138
+		$this->_template = is_array($template) ? $template['ticket_line_item_no_pms'] : $template;
139 139
 
140 140
 		$parsed = $this->_parse_message_template();
141 141
 		return $parsed;
142 142
 	}
143 143
 
144 144
 
145
-	public function parse_payment_list_template( $template, EE_Payment $payment_item, $valid_shortcodes, $extra_data = array() ) {
146
-		$this->_init_data( $template, $payment_item, $valid_shortcodes, $extra_data );
147
-		$this->_template = is_array( $template ) ? $template['payment_list'] : $template;
145
+	public function parse_payment_list_template($template, EE_Payment $payment_item, $valid_shortcodes, $extra_data = array()) {
146
+		$this->_init_data($template, $payment_item, $valid_shortcodes, $extra_data);
147
+		$this->_template = is_array($template) ? $template['payment_list'] : $template;
148 148
 
149 149
 		$parsed = $this->_parse_message_template();
150 150
 		return $parsed;
151 151
 	}
152 152
 
153 153
 
154
-	public function parse_datetime_list_template( $template, EE_Datetime $datetime, $valid_shortcodes, $extra_data = array() ) {
155
-		$this->_init_data( $template, $datetime, $valid_shortcodes, $extra_data );
154
+	public function parse_datetime_list_template($template, EE_Datetime $datetime, $valid_shortcodes, $extra_data = array()) {
155
+		$this->_init_data($template, $datetime, $valid_shortcodes, $extra_data);
156 156
 
157 157
 		$this->_template = is_array($template) ? $template['datetime_list'] : $template;
158 158
 
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 	}
162 162
 
163 163
 
164
-	public function parse_question_list_template( $template, EE_Answer $answer, $valid_shortcodes, $extra_data = array() ) {
165
-		$this->_init_data( $template, $answer, $valid_shortcodes, $extra_data );
164
+	public function parse_question_list_template($template, EE_Answer $answer, $valid_shortcodes, $extra_data = array()) {
165
+		$this->_init_data($template, $answer, $valid_shortcodes, $extra_data);
166 166
 
167 167
 		$this->_template = is_array($template) ? $template['question_list'] : $template;
168 168
 
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
 	}
172 172
 
173 173
 
174
-	private function _init_data( $template, $data, $valid_shortcodes, $extra_data = array() ) {
174
+	private function _init_data($template, $data, $valid_shortcodes, $extra_data = array()) {
175 175
 		$this->_reset_props();
176 176
 		$this->_data['template'] = $template;
177 177
 		$this->_data['data'] = $data;
178 178
 		$this->_data['extra_data'] = $extra_data;
179 179
 
180
-		$this->_set_shortcodes( $valid_shortcodes );
180
+		$this->_set_shortcodes($valid_shortcodes);
181 181
 	}
182 182
 
183 183
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
 
198 198
 		//now let's get a list of shortcodes that are found in the given template
199
-		$possible_shortcodes = preg_match_all( '/(\[.+?\])/', $this->_template, $matches );
199
+		$possible_shortcodes = preg_match_all('/(\[.+?\])/', $this->_template, $matches);
200 200
 		$shortcodes = (array) $matches[0]; //this should be an array of shortcodes in the template string.
201 201
 
202 202
 		$matched_code = array();
@@ -221,31 +221,31 @@  discard block
 block discarded – undo
221 221
 			'[PAYMENT_LIST_*]'
222 222
 			);
223 223
 
224
-		$list_type_shortcodes = apply_filters( 'FHEE__EEH_Parse_Shortcodes___parse_message_template__list_type_shortcodes', $list_type_shortcodes );
224
+		$list_type_shortcodes = apply_filters('FHEE__EEH_Parse_Shortcodes___parse_message_template__list_type_shortcodes', $list_type_shortcodes);
225 225
 
226 226
 		//now lets go ahead and loop through our parsers for each shortcode and setup the values
227
-		foreach ( $shortcodes as $shortcode ) {
227
+		foreach ($shortcodes as $shortcode) {
228 228
 
229
-			foreach ( $this->_shortcode_objs as $sc_obj ) {
229
+			foreach ($this->_shortcode_objs as $sc_obj) {
230 230
 				$data_send = '';
231 231
 
232 232
 				//we need to setup any dynamic shortcodes so that they work with the array_key_exists
233
-				$sc = preg_match_all( '/(\[[A-Za-z0-9\_]+_\*)/', $shortcode, $matches );
234
-				$sc_to_verify = !empty($matches[0] ) ? $matches[0][0] . ']' : $shortcode;
233
+				$sc = preg_match_all('/(\[[A-Za-z0-9\_]+_\*)/', $shortcode, $matches);
234
+				$sc_to_verify = ! empty($matches[0]) ? $matches[0][0].']' : $shortcode;
235 235
 
236
-				if ( !array_key_exists( $sc_to_verify, $sc_obj->get_shortcodes() ) ) {
236
+				if ( ! array_key_exists($sc_to_verify, $sc_obj->get_shortcodes())) {
237 237
 					continue; //the given shortcode isn't in this object
238 238
 				}
239 239
 
240 240
 				//if this isn't  a "list" type shortcode then we'll send along the data vanilla instead of in an array.
241
-				if ( ! in_array( $sc_to_verify, $list_type_shortcodes ) ) {
242
-					$data_send = !is_object($this->_data) && isset($this->_data['data']) ? $this->_data['data'] : $this->_data;
241
+				if ( ! in_array($sc_to_verify, $list_type_shortcodes)) {
242
+					$data_send = ! is_object($this->_data) && isset($this->_data['data']) ? $this->_data['data'] : $this->_data;
243 243
 				} else {
244 244
 					$data_send = $this->_data;
245 245
 				}
246 246
 
247 247
 
248
-				$parsed = $sc_obj->parser( $shortcode, $data_send, $this->_data['extra_data'] );
248
+				$parsed = $sc_obj->parser($shortcode, $data_send, $this->_data['extra_data']);
249 249
 
250 250
 				$matched_code[] = $shortcode;
251 251
 				$sc_values[] = $parsed;
@@ -267,13 +267,13 @@  discard block
 block discarded – undo
267 267
 	 * @param array $valid_shortcodes an array of strings corresponding to EE_Shortcode Library objects
268 268
 	 * @return void
269 269
 	 */
270
-	private function _set_shortcodes( $valid_shortcodes ) {
271
-		foreach ( $valid_shortcodes as $shortcode_ref ) {
272
-			$ref = ucwords( str_replace('_', ' ', $shortcode_ref ) );
273
-			$ref = str_replace( ' ', '_', $ref );
274
-			$classname = 'EE_' . $ref . '_Shortcodes';
275
-			if ( class_exists( $classname ) ) {
276
-				$a = new ReflectionClass( $classname );
270
+	private function _set_shortcodes($valid_shortcodes) {
271
+		foreach ($valid_shortcodes as $shortcode_ref) {
272
+			$ref = ucwords(str_replace('_', ' ', $shortcode_ref));
273
+			$ref = str_replace(' ', '_', $ref);
274
+			$classname = 'EE_'.$ref.'_Shortcodes';
275
+			if (class_exists($classname)) {
276
+				$a = new ReflectionClass($classname);
277 277
 				$this->_shortcode_objs[] = $a->newInstance();
278 278
 			}
279 279
 		}
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
Please login to merge, or discard this patch.
core/helpers/EEH_Template.helper.php 4 patches
Braces   +19 added lines, -16 removed lines patch added patch discarded remove patch
@@ -160,8 +160,9 @@  discard block
 block discarded – undo
160 160
 		// first use WP locate_template to check for template in the current theme folder
161 161
 		$template_path = locate_template( $templates );
162 162
 
163
-		if ( $check_if_custom && !empty( $template_path ) )
164
-			return TRUE;
163
+		if ( $check_if_custom && !empty( $template_path ) ) {
164
+					return TRUE;
165
+		}
165 166
 
166 167
 		// not in the theme
167 168
 		if ( empty( $template_path )) {
@@ -364,11 +365,11 @@  discard block
 block discarded – undo
364 365
 				if( $mny->sign_b4 ){
365 366
 					if( $amount >= 0 ){
366 367
 						$amount_formatted = $mny->sign . $amount_formatted;
367
-					}else{
368
+					} else{
368 369
 						$amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted );
369 370
 					}
370 371
 
371
-				}else{
372
+				} else{
372 373
 					$amount_formatted =  $amount_formatted . $mny->sign;
373 374
 				}
374 375
 
@@ -432,11 +433,13 @@  discard block
 block discarded – undo
432 433
 	 */
433 434
 	public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) {
434 435
 
435
-		if ( ! $page )
436
-			$page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page;
436
+		if ( ! $page ) {
437
+					$page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page;
438
+		}
437 439
 
438
-		if ( ! $action )
439
-			$action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action;
440
+		if ( ! $action ) {
441
+					$action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action;
442
+		}
440 443
 
441 444
 		$action = empty($action) ? 'default' : $action;
442 445
 
@@ -510,8 +513,9 @@  discard block
 block discarded – undo
510 513
 	 * @return string               html structure for status.
511 514
 	 */
512 515
 	public static function status_legend( $status_array, $active_status = '' ) {
513
-		if ( !is_array( $status_array ) )
514
-			throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') );
516
+		if ( !is_array( $status_array ) ) {
517
+					throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') );
518
+		}
515 519
 
516 520
 		$setup_array = array();
517 521
 		foreach ( $status_array as $item => $status ) {
@@ -572,8 +576,7 @@  discard block
 block discarded – undo
572 576
 				</tbody>
573 577
 			</table>
574 578
 			<?php
575
-		}
576
-		else {
579
+		} else {
577 580
 			?>
578 581
 			<ul>
579 582
 				<?php
@@ -583,8 +586,7 @@  discard block
 block discarded – undo
583 586
 			</ul>
584 587
 			<?php
585 588
 		}
586
-	}
587
-	else {
589
+	} else {
588 590
 		//simple value
589 591
 		echo $data;
590 592
 	}
@@ -664,8 +666,9 @@  discard block
 block discarded – undo
664 666
 
665 667
 		$total_pages = ceil( $total_items / $per_page );
666 668
 
667
-		if ( $total_pages <= 1 )
668
-			return '';
669
+		if ( $total_pages <= 1 ) {
670
+					return '';
671
+		}
669 672
 
670 673
 		$item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single'];
671 674
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 *
283 283
 	 * given two paths, this determines if there is a common base path between the two
284 284
 	 *
285
-	 * @param array $paths
285
+	 * @param string[] $paths
286 286
 	 * @return string
287 287
 	 */
288 288
 	protected static function _find_common_base_path( $paths ) {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @param bool|string $template_path server path to the file to be loaded, including file name and extension
310 310
 	 * @param  array      $template_args an array of arguments to be extracted for use in the template
311 311
 	 * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
312
-	 * @return mixed string
312
+	 * @return string string
313 313
 	 */
314 314
 	public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) {
315 315
 		//require the template validator for verifying variables are set according to how the template requires
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 				return array();
100 100
 			}
101 101
 			if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) {
102
-			    unset( $espresso_themes[ $key ] );
102
+				unset( $espresso_themes[ $key ] );
103 103
 			}
104 104
 			EEH_Template::$_espresso_themes = array();
105 105
 			foreach ( $espresso_themes as $espresso_theme ) {
@@ -709,9 +709,9 @@  discard block
 block discarded – undo
709 709
 		);
710 710
 
711 711
 		if ( empty( $items_label )
712
-		     || ! is_array( $items_label )
713
-		     || ! isset( $items_label['single'] )
714
-		     || ! isset( $items_label['plural'] ) ) {
712
+			 || ! is_array( $items_label )
713
+			 || ! isset( $items_label['single'] )
714
+			 || ! isset( $items_label['plural'] ) ) {
715 715
 			$items_label = array(
716 716
 				'single' => __( '1 item', 'event_espresso' ),
717 717
 				'plural' => __( '%s items', 'event_espresso' )
Please login to merge, or discard this patch.
Spacing   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 
17 17
 
18
-if ( ! function_exists( 'espresso_get_template_part' )) {
18
+if ( ! function_exists('espresso_get_template_part')) {
19 19
 	/**
20 20
 	 * espresso_get_template_part
21 21
 	 * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 	 * @param string $name The name of the specialised template.
26 26
 	 * @return string        the html output for the formatted money value
27 27
 	 */
28
-	function espresso_get_template_part( $slug = NULL, $name = NULL ) {
29
-		EEH_Template::get_template_part( $slug, $name );
28
+	function espresso_get_template_part($slug = NULL, $name = NULL) {
29
+		EEH_Template::get_template_part($slug, $name);
30 30
 	}
31 31
 }
32 32
 
33 33
 
34 34
 
35
-if ( ! function_exists( 'espresso_get_object_css_class' )) {
35
+if ( ! function_exists('espresso_get_object_css_class')) {
36 36
 	/**
37 37
 	 * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
38 38
 	 *
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @param  string $suffix added to the end of the generated class
43 43
 	 * @return string
44 44
 	 */
45
-	function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) {
46
-		return EEH_Template::get_object_css_class( $object, $prefix, $suffix );
45
+	function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') {
46
+		return EEH_Template::get_object_css_class($object, $prefix, $suffix);
47 47
 	}
48 48
 }
49 49
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * 	@return boolean
71 71
 	 */
72 72
 	public static function is_espresso_theme() {
73
-		return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE;
73
+		return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE;
74 74
 	}
75 75
 
76 76
 	/**
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	 * 	@return void
80 80
 	 */
81 81
 	public static function load_espresso_theme_functions() {
82
-		if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) {
83
-			if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) {
84
-				require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' );
82
+		if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) {
83
+			if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) {
84
+				require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php');
85 85
 			}
86 86
 		}
87 87
 	}
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
 	 * 	@return array
94 94
 	 */
95 95
 	public static function get_espresso_themes() {
96
-		if ( empty( EEH_Template::$_espresso_themes )) {
97
-			$espresso_themes =  glob( EE_PUBLIC . '*', GLOB_ONLYDIR );
98
-			if ( empty( $espresso_themes ) ) {
96
+		if (empty(EEH_Template::$_espresso_themes)) {
97
+			$espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR);
98
+			if (empty($espresso_themes)) {
99 99
 				return array();
100 100
 			}
101
-			if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) {
102
-			    unset( $espresso_themes[ $key ] );
101
+			if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) {
102
+			    unset($espresso_themes[$key]);
103 103
 			}
104 104
 			EEH_Template::$_espresso_themes = array();
105
-			foreach ( $espresso_themes as $espresso_theme ) {
106
-				EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme;
105
+			foreach ($espresso_themes as $espresso_theme) {
106
+				EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme;
107 107
 			}
108 108
 		}
109 109
 		return EEH_Template::$_espresso_themes;
@@ -122,16 +122,16 @@  discard block
 block discarded – undo
122 122
 	 * @param bool   $return_string
123 123
 	 * @return string        the html output for the formatted money value
124 124
 	 */
125
-	public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE  ) {
126
-		do_action( "get_template_part_{$slug}-{$name}", $slug, $name );
125
+	public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) {
126
+		do_action("get_template_part_{$slug}-{$name}", $slug, $name);
127 127
 		$templates = array();
128 128
 		$name = (string) $name;
129
-		if ( $name != '' ) {
129
+		if ($name != '') {
130 130
 			$templates[] = "{$slug}-{$name}.php";
131 131
 		}
132 132
 		// allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' );
133
-		if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) {
134
-			EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string );
133
+		if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) {
134
+			EEH_Template::locate_template($templates, $template_args, TRUE, $return_string);
135 135
 		}
136 136
 	}
137 137
 
@@ -182,26 +182,26 @@  discard block
 block discarded – undo
182 182
 	 * 				Used in places where you don't actually load the template, you just want to know if there's a custom version of it.
183 183
 	 * @return mixed
184 184
 	 */
185
-	public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) {
185
+	public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) {
186 186
 		// first use WP locate_template to check for template in the current theme folder
187
-		$template_path = locate_template( $templates );
187
+		$template_path = locate_template($templates);
188 188
 
189
-		if ( $check_if_custom && !empty( $template_path ) )
189
+		if ($check_if_custom && ! empty($template_path))
190 190
 			return TRUE;
191 191
 
192 192
 		// not in the theme
193
-		if ( empty( $template_path )) {
193
+		if (empty($template_path)) {
194 194
 			// not even a template to look for ?
195
-			if ( empty( $templates )) {
195
+			if (empty($templates)) {
196 196
 				// get post_type
197
-				$post_type = EE_Registry::instance()->REQ->get( 'post_type' );
197
+				$post_type = EE_Registry::instance()->REQ->get('post_type');
198 198
 				// get array of EE Custom Post Types
199 199
 				$EE_CPTs = EE_Register_CPTs::get_CPTs();
200 200
 				// build template name based on request
201
-				if ( isset( $EE_CPTs[ $post_type ] )) {
202
-					$archive_or_single =  is_archive() ? 'archive' : '';
203
-					$archive_or_single =  is_single() ? 'single' : $archive_or_single;
204
-					$templates = $archive_or_single . '-' . $post_type . '.php';
201
+				if (isset($EE_CPTs[$post_type])) {
202
+					$archive_or_single = is_archive() ? 'archive' : '';
203
+					$archive_or_single = is_single() ? 'single' : $archive_or_single;
204
+					$templates = $archive_or_single.'-'.$post_type.'.php';
205 205
 				}
206 206
 			}
207 207
 			// currently active EE template theme
@@ -210,80 +210,80 @@  discard block
 block discarded – undo
210 210
 			// array of paths to folders that may contain templates
211 211
 			$template_folder_paths = array(
212 212
 				// first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
213
-				EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
213
+				EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme,
214 214
 				// then in the root of the /wp-content/uploads/espresso/templates/ folder
215 215
 				EVENT_ESPRESSO_TEMPLATE_DIR
216 216
 			);
217 217
 
218 218
 			//add core plugin folders for checking only if we're not $check_if_custom
219
-			if ( ! $check_if_custom ) {
219
+			if ( ! $check_if_custom) {
220 220
 				$core_paths = array(
221 221
 					// in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
222
-					EE_PUBLIC . $current_theme,
222
+					EE_PUBLIC.$current_theme,
223 223
 					// in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
224
-					EE_TEMPLATES . $current_theme,
224
+					EE_TEMPLATES.$current_theme,
225 225
 					// or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
226 226
 					EE_PLUGIN_DIR_PATH
227 227
 					);
228
-				$template_folder_paths = array_merge( $template_folder_paths, $core_paths );
228
+				$template_folder_paths = array_merge($template_folder_paths, $core_paths);
229 229
 			}
230 230
 
231 231
 			// now filter that array
232
-			$template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths );
233
-			$templates = is_array( $templates ) ? $templates : array( $templates );
234
-			$template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths );
232
+			$template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths);
233
+			$templates = is_array($templates) ? $templates : array($templates);
234
+			$template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths);
235 235
 			// array to hold all possible template paths
236 236
 			$full_template_paths = array();
237 237
 
238 238
 			EE_Registry::instance()->load_helper('File');
239 239
 			// loop through $templates
240
-			foreach ( $templates as $template ) {
240
+			foreach ($templates as $template) {
241 241
 				// normalize directory separators
242
-				$template = EEH_File::standardise_directory_separators( $template );
243
-				$file_name = basename( $template );
244
-				$template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) );
242
+				$template = EEH_File::standardise_directory_separators($template);
243
+				$file_name = basename($template);
244
+				$template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
245 245
 				// while looping through all template folder paths
246
-				foreach ( $template_folder_paths as $template_folder_path ) {
246
+				foreach ($template_folder_paths as $template_folder_path) {
247 247
 					// normalize directory separators
248
-					$template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path );
248
+					$template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
249 249
 					// determine if any common base path exists between the two paths
250 250
 					$common_base_path = EEH_Template::_find_common_base_path(
251
-						array( $template_folder_path, $template_path_minus_file_name )
251
+						array($template_folder_path, $template_path_minus_file_name)
252 252
 					);
253
-					if ( $common_base_path !== '' ) {
253
+					if ($common_base_path !== '') {
254 254
 						// both paths have a common base, so just tack the filename onto our search path
255
-						$resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name;
255
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name;
256 256
 					} else {
257 257
 						// no common base path, so let's just concatenate
258
-						$resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template;
258
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template;
259 259
 					}
260 260
 					// build up our template locations array by adding our resolved paths
261 261
 					$full_template_paths[] = $resolved_path;
262 262
 				}
263 263
 				// if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
264
-				array_unshift( $full_template_paths, $template );
264
+				array_unshift($full_template_paths, $template);
265 265
 				// path to the directory of the current theme: /wp-content/themes/(current WP theme)/
266
-				array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name );
266
+				array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name);
267 267
 			}
268 268
 			// filter final array of full template paths
269
-			$full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name );
269
+			$full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name);
270 270
 			// now loop through our final array of template location paths and check each location
271
-			foreach ( (array)$full_template_paths as $full_template_path ) {
272
-				if ( is_readable( $full_template_path )) {
273
-					$template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path );
271
+			foreach ((array) $full_template_paths as $full_template_path) {
272
+				if (is_readable($full_template_path)) {
273
+					$template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path);
274 274
 					break;
275 275
 				}
276 276
 			}
277 277
 		}
278 278
 		// if we got it and you want to see it...
279
-		if ( $template_path && $load && ! $check_if_custom  ) {
280
-			if ( $return_string ) {
281
-				return EEH_Template::display_template( $template_path, $template_args, TRUE );
279
+		if ($template_path && $load && ! $check_if_custom) {
280
+			if ($return_string) {
281
+				return EEH_Template::display_template($template_path, $template_args, TRUE);
282 282
 			} else {
283
-				EEH_Template::display_template( $template_path, $template_args, FALSE );
283
+				EEH_Template::display_template($template_path, $template_args, FALSE);
284 284
 			}
285 285
 		}
286
-		return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path;
286
+		return $check_if_custom && ! empty($template_path) ? TRUE : $template_path;
287 287
 	}
288 288
 
289 289
 
@@ -296,21 +296,21 @@  discard block
 block discarded – undo
296 296
 	 * @param array $paths
297 297
 	 * @return string
298 298
 	 */
299
-	protected static function _find_common_base_path( $paths ) {
299
+	protected static function _find_common_base_path($paths) {
300 300
 		$last_offset = 0;
301 301
 		$common_base_path = '';
302
-		while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) {
302
+		while (($index = strpos($paths[0], DS, $last_offset)) !== false) {
303 303
 			$dir_length = $index - $last_offset + 1;
304
-			$directory = substr( $paths[ 0 ], $last_offset, $dir_length );
305
-			foreach ( $paths as $path ) {
306
-				if ( substr( $path, $last_offset, $dir_length ) != $directory ) {
304
+			$directory = substr($paths[0], $last_offset, $dir_length);
305
+			foreach ($paths as $path) {
306
+				if (substr($path, $last_offset, $dir_length) != $directory) {
307 307
 					return $common_base_path;
308 308
 				}
309 309
 			}
310 310
 			$common_base_path .= $directory;
311 311
 			$last_offset = $index + 1;
312 312
 		}
313
-		return substr( $common_base_path, 0, -1 );
313
+		return substr($common_base_path, 0, -1);
314 314
 	}
315 315
 
316 316
 
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
 	 * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
323 323
 	 * @return mixed string
324 324
 	 */
325
-	public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) {
325
+	public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) {
326 326
 		//require the template validator for verifying variables are set according to how the template requires
327
-		EE_Registry::instance()->load_helper( 'Template_Validator' );
327
+		EE_Registry::instance()->load_helper('Template_Validator');
328 328
 
329 329
 		/**
330 330
 		 * These two filters are intended for last minute changes to templates being loaded and/or template arg
@@ -335,26 +335,26 @@  discard block
 block discarded – undo
335 335
 		 *
336 336
 		 * @since 4.6.0
337 337
 		 */
338
-		$template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path );
339
-		$template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args );
338
+		$template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
339
+		$template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
340 340
 
341 341
 		// you gimme nuttin - YOU GET NUTTIN !!
342
-		if ( ! $template_path || ! is_readable( $template_path )) {
342
+		if ( ! $template_path || ! is_readable($template_path)) {
343 343
 			return '';
344 344
 		}
345 345
 		// if $template_args are not in an array, then make it so
346
-		if ( ! is_array( $template_args ) && ! is_object( $template_args )) {
347
-			$template_args = array( $template_args );
346
+		if ( ! is_array($template_args) && ! is_object($template_args)) {
347
+			$template_args = array($template_args);
348 348
 		}
349
-		extract( (array) $template_args);
349
+		extract((array) $template_args);
350 350
 
351
-		if ( $return_string ) {
351
+		if ($return_string) {
352 352
 			// because we want to return a string, we are going to capture the output
353 353
 			ob_start();
354
-			include( $template_path );
354
+			include($template_path);
355 355
 			return ob_get_clean();
356 356
 		} else {
357
-			include( $template_path );
357
+			include($template_path);
358 358
 		}
359 359
 		return '';
360 360
 	}
@@ -372,27 +372,27 @@  discard block
 block discarded – undo
372 372
 	 * @param  string $suffix added to the end of the generated class
373 373
 	 * @return string
374 374
 	 */
375
-	public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) {
375
+	public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') {
376 376
 		// in the beginning...
377
-		$prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : '';
377
+		$prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : '';
378 378
 		// da muddle
379 379
 		$class = '';
380 380
 		// the end
381
-		$suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : '';
381
+		$suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : '';
382 382
 		// is the passed object an EE object ?
383
-		if ( $object instanceof EE_Base_Class ) {
383
+		if ($object instanceof EE_Base_Class) {
384 384
 			// grab the exact type of object
385
-			$obj_class = get_class( $object );
385
+			$obj_class = get_class($object);
386 386
 			// depending on the type of object...
387
-			switch ( $obj_class ) {
387
+			switch ($obj_class) {
388 388
 				// no specifics just yet...
389 389
 				default :
390
-					$class = strtolower( str_replace( '_', '-', $obj_class ));
391
-					$class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : '';
390
+					$class = strtolower(str_replace('_', '-', $obj_class));
391
+					$class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : '';
392 392
 
393 393
 			}
394 394
 		}
395
-		return $prefix . $class . $suffix;
395
+		return $prefix.$class.$suffix;
396 396
 	}
397 397
 
398 398
 
@@ -408,50 +408,50 @@  discard block
 block discarded – undo
408 408
 	 * @param string      $cur_code_span_class
409 409
 	 * @return string        the html output for the formatted money value
410 410
 	 */
411
-	public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) {
411
+	public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') {
412 412
 		// ensure amount was received
413
-		if ( is_null( $amount ) ) {
414
-			$msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' );
415
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
413
+		if (is_null($amount)) {
414
+			$msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso');
415
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
416 416
 			return '';
417 417
 		}
418 418
 		//ensure amount is float
419 419
 		$amount = (float) $amount;
420 420
 		// filter raw amount (allows 0.00 to be changed to "free" for example)
421
-		$amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw );
421
+		$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
422 422
 		// still a number or was amount converted to a string like "free" ?
423
-		if ( is_float( $amount_formatted )) {
423
+		if (is_float($amount_formatted)) {
424 424
 			// was a country ISO code passed ? if so generate currency config object for that country
425
-			$mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL;
425
+			$mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL;
426 426
 			// verify results
427
-			if ( ! $mny instanceof EE_Currency_Config ) {
427
+			if ( ! $mny instanceof EE_Currency_Config) {
428 428
 				// set default config country currency settings
429 429
 				$mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config();
430 430
 			}
431 431
 			// format float
432
-			$amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds );
432
+			$amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
433 433
 			// add formatting ?
434
-			if ( ! $return_raw ) {
434
+			if ( ! $return_raw) {
435 435
 				// add currency sign
436
-				if( $mny->sign_b4 ){
437
-					if( $amount >= 0 ){
438
-						$amount_formatted = $mny->sign . $amount_formatted;
439
-					}else{
440
-						$amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted );
436
+				if ($mny->sign_b4) {
437
+					if ($amount >= 0) {
438
+						$amount_formatted = $mny->sign.$amount_formatted;
439
+					} else {
440
+						$amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted);
441 441
 					}
442 442
 
443
-				}else{
444
-					$amount_formatted =  $amount_formatted . $mny->sign;
443
+				} else {
444
+					$amount_formatted = $amount_formatted.$mny->sign;
445 445
 				}
446 446
 
447 447
 				// add currency code ?
448
-				$amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted;
448
+				$amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted;
449 449
 			}
450 450
 			// filter results
451
-			$amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw );
451
+			$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw);
452 452
 		}
453 453
 		// clean up vars
454
-		unset( $mny );
454
+		unset($mny);
455 455
 		// return formatted currency amount
456 456
 		return $amount_formatted;
457 457
 	}
@@ -466,11 +466,11 @@  discard block
 block discarded – undo
466 466
 	 * @param  string  $schema    'UPPER', 'lower', or 'Sentence'
467 467
 	 * @return string             The localized label for the status id.
468 468
 	 */
469
-	public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) {
469
+	public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') {
470 470
 		/** @type EEM_Status $EEM_Status */
471
-		$EEM_Status = EE_Registry::instance()->load_model( 'Status' );
472
-		$status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema );
473
-		return $status[ $status_id ];
471
+		$EEM_Status = EE_Registry::instance()->load_model('Status');
472
+		$status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema);
473
+		return $status[$status_id];
474 474
 	}
475 475
 
476 476
 
@@ -483,9 +483,9 @@  discard block
 block discarded – undo
483 483
 	 * @param string  $icon
484 484
 	 * @return string 	the html output for the button
485 485
 	 */
486
-	public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) {
487
-		$label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label;
488
-		$button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>';
486
+	public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') {
487
+		$label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label;
488
+		$button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>';
489 489
 		return $button;
490 490
 	}
491 491
 
@@ -502,21 +502,21 @@  discard block
 block discarded – undo
502 502
 	 * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
503 503
 	 * @return string              generated link
504 504
 	 */
505
-	public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) {
505
+	public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) {
506 506
 
507
-		if ( ! $page )
508
-			$page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page;
507
+		if ( ! $page)
508
+			$page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page;
509 509
 
510
-		if ( ! $action )
511
-			$action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action;
510
+		if ( ! $action)
511
+			$action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action;
512 512
 
513 513
 		$action = empty($action) ? 'default' : $action;
514 514
 
515 515
 
516
-		$help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
517
-		$icon = !$icon_style ? ' dashicons-editor-help' : $icon_style;
518
-		$help_text = !$help_text ? '' : $help_text;
519
-		return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>';
516
+		$help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id;
517
+		$icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
518
+		$help_text = ! $help_text ? '' : $help_text;
519
+		return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>';
520 520
 	}
521 521
 
522 522
 
@@ -528,31 +528,31 @@  discard block
 block discarded – undo
528 528
 	 * @param EE_Help_Tour
529 529
 	 * @return string         html
530 530
 	 */
531
-	public static function help_tour_stops_generator( EE_Help_Tour $tour ) {
531
+	public static function help_tour_stops_generator(EE_Help_Tour $tour) {
532 532
 		$id = $tour->get_slug();
533 533
 		$stops = $tour->get_stops();
534 534
 
535
-		$content = '<ol style="display:none" id="' . $id . '">';
535
+		$content = '<ol style="display:none" id="'.$id.'">';
536 536
 
537
-		foreach ( $stops as $stop ) {
538
-			$data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : '';
539
-			$data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : '';
537
+		foreach ($stops as $stop) {
538
+			$data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : '';
539
+			$data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : '';
540 540
 
541 541
 			//if container is set to modal then let's make sure we set the options accordingly
542
-			if ( empty( $data_id ) && empty( $data_class ) ) {
542
+			if (empty($data_id) && empty($data_class)) {
543 543
 				$stop['options']['modal'] = true;
544 544
 				$stop['options']['expose'] = true;
545 545
 			}
546 546
 
547
-			$custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : '';
548
-			$button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : '';
547
+			$custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : '';
548
+			$button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : '';
549 549
 			$inner_content = isset($stop['content']) ? $stop['content'] : '';
550 550
 
551 551
 			//options
552
-			if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) {
552
+			if (isset($stop['options']) && is_array($stop['options'])) {
553 553
 				$options = ' data-options="';
554
-				foreach ( $stop['options'] as $option => $value ) {
555
-					$options .= $option . ':' . $value . ';';
554
+				foreach ($stop['options'] as $option => $value) {
555
+					$options .= $option.':'.$value.';';
556 556
 				}
557 557
 				$options .= '"';
558 558
 			} else {
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 			}
561 561
 
562 562
 			//let's put all together
563
-			$content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>';
563
+			$content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>';
564 564
 		}
565 565
 
566 566
 		$content .= '</ol>';
@@ -581,31 +581,31 @@  discard block
 block discarded – undo
581 581
 	 * @throws EE_Error
582 582
 	 * @return string               html structure for status.
583 583
 	 */
584
-	public static function status_legend( $status_array, $active_status = '' ) {
585
-		if ( !is_array( $status_array ) )
586
-			throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') );
584
+	public static function status_legend($status_array, $active_status = '') {
585
+		if ( ! is_array($status_array))
586
+			throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso'));
587 587
 
588 588
 		$setup_array = array();
589
-		foreach ( $status_array as $item => $status ) {
589
+		foreach ($status_array as $item => $status) {
590 590
 			$setup_array[$item] = array(
591
-					'class' => 'ee-status-legend ee-status-legend-' . $status,
592
-					'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ),
591
+					'class' => 'ee-status-legend ee-status-legend-'.$status,
592
+					'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'),
593 593
 					'status' => $status
594 594
 				);
595 595
 		}
596 596
 
597
-		$content = '<div class="ee-list-table-legend-container">' . "\n";
598
-		$content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n";
599
-		$content .= '<dl class="ee-list-table-legend">' . "\n\t";
600
-		foreach ( $setup_array as $item => $details ) {
597
+		$content = '<div class="ee-list-table-legend-container">'."\n";
598
+		$content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n";
599
+		$content .= '<dl class="ee-list-table-legend">'."\n\t";
600
+		foreach ($setup_array as $item => $details) {
601 601
 			$active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : '';
602
-			$content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t";
603
-			$content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t";
604
-			$content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t";
605
-			$content .= '</dt>' . "\n";
602
+			$content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t";
603
+			$content .= '<span class="'.$details['class'].'"></span>'."\n\t\t";
604
+			$content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t";
605
+			$content .= '</dt>'."\n";
606 606
 		}
607
-		$content .= '</dl>' . "\n";
608
-		$content .= '</div>' . "\n";
607
+		$content .= '</dl>'."\n";
608
+		$content .= '</div>'."\n";
609 609
 		return $content;
610 610
 	}
611 611
 
@@ -618,8 +618,8 @@  discard block
 block discarded – undo
618 618
 	 * @return string
619 619
 	 */
620 620
 	public static function layout_array_as_table($data) {
621
-	if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) {
622
-		$data = (array)$data;
621
+	if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
622
+		$data = (array) $data;
623 623
 	}
624 624
 	EE_Registry::instance()->load_helper('Array');
625 625
 	ob_start();
@@ -633,10 +633,10 @@  discard block
 block discarded – undo
633 633
 						?>
634 634
 						<tr>
635 635
 							<td>
636
-								<?php echo $data_key;?>
636
+								<?php echo $data_key; ?>
637 637
 							</td>
638 638
 							<td>
639
-								<?php echo self::layout_array_as_table($data_values);?>
639
+								<?php echo self::layout_array_as_table($data_values); ?>
640 640
 							</td>
641 641
 						</tr>
642 642
 						<?php
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 			<ul>
651 651
 				<?php
652 652
 				foreach ($data as $datum) {
653
-					echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>";
653
+					echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>";
654 654
 				}?>
655 655
 			</ul>
656 656
 			<?php
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
 	 *
681 681
 	 * @return string
682 682
 	 */
683
-	public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) {
684
-		echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label );
683
+	public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) {
684
+		echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label);
685 685
 	}
686 686
 
687 687
 
@@ -705,13 +705,13 @@  discard block
 block discarded – undo
705 705
 	 *                                 )
706 706
 	 * @return  string
707 707
 	 */
708
-	public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) {
708
+	public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) {
709 709
 		$page_links = array();
710 710
 		$disable_first = $disable_last = '';
711 711
 		$total_items = (int) $total_items;
712 712
 		$per_page = (int) $per_page;
713 713
 		$current = (int) $current;
714
-		$paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name );
714
+		$paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
715 715
 
716 716
 		//filter items_label
717 717
 		$items_label = apply_filters(
@@ -719,68 +719,68 @@  discard block
 block discarded – undo
719 719
 			$items_label
720 720
 		);
721 721
 
722
-		if ( empty( $items_label )
723
-		     || ! is_array( $items_label )
724
-		     || ! isset( $items_label['single'] )
725
-		     || ! isset( $items_label['plural'] ) ) {
722
+		if (empty($items_label)
723
+		     || ! is_array($items_label)
724
+		     || ! isset($items_label['single'])
725
+		     || ! isset($items_label['plural'])) {
726 726
 			$items_label = array(
727
-				'single' => __( '1 item', 'event_espresso' ),
728
-				'plural' => __( '%s items', 'event_espresso' )
727
+				'single' => __('1 item', 'event_espresso'),
728
+				'plural' => __('%s items', 'event_espresso')
729 729
 			);
730 730
 		} else {
731 731
 			$items_label = array(
732
-				'single' => '1 ' . esc_html( $items_label['single'] ),
733
-				'plural' => '%s ' . esc_html( $items_label['plural'] )
732
+				'single' => '1 '.esc_html($items_label['single']),
733
+				'plural' => '%s '.esc_html($items_label['plural'])
734 734
 			);
735 735
 		}
736 736
 
737
-		$total_pages = ceil( $total_items / $per_page );
737
+		$total_pages = ceil($total_items / $per_page);
738 738
 
739
-		if ( $total_pages <= 1 )
739
+		if ($total_pages <= 1)
740 740
 			return '';
741 741
 
742
-		$item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single'];
742
+		$item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
743 743
 
744
-		$output = '<span class="displaying-num">' . $item_label . '</span>';
744
+		$output = '<span class="displaying-num">'.$item_label.'</span>';
745 745
 
746
-		if ( $current === 1 ) {
746
+		if ($current === 1) {
747 747
 			$disable_first = ' disabled';
748 748
 		}
749
-		if ( $current == $total_pages ) {
749
+		if ($current == $total_pages) {
750 750
 			$disable_last = ' disabled';
751 751
 		}
752 752
 
753
-		$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
754
-			'first-page' . $disable_first,
755
-			esc_attr__( 'Go to the first page' ),
756
-			esc_url( remove_query_arg( $paged_arg_name, $url ) ),
753
+		$page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>",
754
+			'first-page'.$disable_first,
755
+			esc_attr__('Go to the first page'),
756
+			esc_url(remove_query_arg($paged_arg_name, $url)),
757 757
 			'&laquo;'
758 758
 		);
759 759
 
760 760
 		$page_links[] = sprintf(
761 761
 			'<a class="%s" title="%s" href="%s">%s</a>',
762
-			'prev-page' . $disable_first,
763
-			esc_attr__( 'Go to the previous page' ),
764
-			esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ),
762
+			'prev-page'.$disable_first,
763
+			esc_attr__('Go to the previous page'),
764
+			esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
765 765
 			'&lsaquo;'
766 766
 		);
767 767
 
768
-		if ( ! $show_num_field ) {
768
+		if ( ! $show_num_field) {
769 769
 			$html_current_page = $current;
770 770
 		} else {
771
-			$html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
772
-				esc_attr__( 'Current page' ),
771
+			$html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
772
+				esc_attr__('Current page'),
773 773
 				$current,
774
-				strlen( $total_pages )
774
+				strlen($total_pages)
775 775
 			);
776 776
 		}
777 777
 
778 778
 		$html_total_pages = sprintf(
779 779
 			'<span class="total-pages">%s</span>',
780
-			number_format_i18n( $total_pages )
780
+			number_format_i18n($total_pages)
781 781
 		);
782 782
 		$page_links[] = sprintf(
783
-			_x( '%3$s%1$s of %2$s%4$s', 'paging' ),
783
+			_x('%3$s%1$s of %2$s%4$s', 'paging'),
784 784
 			$html_current_page,
785 785
 			$html_total_pages,
786 786
 			'<span class="paging-input">',
@@ -789,29 +789,29 @@  discard block
 block discarded – undo
789 789
 
790 790
 		$page_links[] = sprintf(
791 791
 			'<a class="%s" title="%s" href="%s">%s</a>',
792
-			'next-page' . $disable_last,
793
-			esc_attr__( 'Go to the next page' ),
794
-			esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ),
792
+			'next-page'.$disable_last,
793
+			esc_attr__('Go to the next page'),
794
+			esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
795 795
 			'&rsaquo;'
796 796
 		);
797 797
 
798 798
 		$page_links[] = sprintf(
799 799
 			'<a class="%s" title="%s" href="%s">%s</a>',
800
-			'last-page' . $disable_last,
801
-			esc_attr__( 'Go to the last page' ),
802
-			esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ),
800
+			'last-page'.$disable_last,
801
+			esc_attr__('Go to the last page'),
802
+			esc_url(add_query_arg($paged_arg_name, $total_pages, $url)),
803 803
 			'&raquo;'
804 804
 		);
805 805
 
806
-		$output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>';
806
+		$output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>';
807 807
 		// set page class
808
-		if ( $total_pages ) {
808
+		if ($total_pages) {
809 809
 			$page_class = $total_pages < 2 ? ' one-page' : '';
810 810
 		} else {
811 811
 			$page_class = ' no-pages';
812 812
 		}
813 813
 
814
-		return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
814
+		return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>';
815 815
 	}
816 816
 
817 817
 
Please login to merge, or discard this patch.
core/helpers/EEH_Venue_View.helper.php 2 patches
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -44,16 +44,16 @@  discard block
 block discarded – undo
44 44
 	 *                             		     regardless of access.
45 45
 	 * @return EE_Venue | null
46 46
 	 */
47
-	public static function get_venue( $VNU_ID = 0, $look_in_event = TRUE, $privacy_check = true ) {
48
-		$VNU_ID = absint( $VNU_ID );
47
+	public static function get_venue($VNU_ID = 0, $look_in_event = TRUE, $privacy_check = true) {
48
+		$VNU_ID = absint($VNU_ID);
49 49
 		// do we already have the Venue you are looking for?
50
-		if ( EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->ID() == $VNU_ID ) {
51
-			return EEH_Venue_View::_get_venue( $privacy_check );
50
+		if (EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->ID() == $VNU_ID) {
51
+			return EEH_Venue_View::_get_venue($privacy_check);
52 52
 		}
53 53
 		// international newspaper?
54 54
 		global $post;
55
-		if ( $post instanceof WP_Post ) {
56
-			switch ( $post->post_type ) {
55
+		if ($post instanceof WP_Post) {
56
+			switch ($post->post_type) {
57 57
 				// if this is being called from an EE_Venue post,
58 58
 				// and the EE_Venue post corresponds to the EE_Venue that is being asked for,
59 59
 				// then we can try to just grab the attached EE_Venue object
@@ -61,31 +61,31 @@  discard block
 block discarded – undo
61 61
 					// the post already contains the related EE_Venue object AND one of the following is TRUE:
62 62
 					// the requested Venue ID matches the post ID OR...
63 63
 					// there was no specific Venue ID requested
64
-					if ( isset( $post->EE_Venue ) && ( $VNU_ID == $post->ID || ! $VNU_ID )) {
64
+					if (isset($post->EE_Venue) && ($VNU_ID == $post->ID || ! $VNU_ID)) {
65 65
 						// use existing related EE_Venue object
66
-						EEH_Venue_View::$_venue =  $post->EE_Venue;
67
-					} else if ( $VNU_ID ) {
66
+						EEH_Venue_View::$_venue = $post->EE_Venue;
67
+					} else if ($VNU_ID) {
68 68
 						// there WAS a specific Venue ID requested, but it's NOT the current post object
69
-						EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
69
+						EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
70 70
 					} else {
71 71
 						// no specific Venue ID requested, so use post ID to generate EE_Venue object
72
-						EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $post->ID );
72
+						EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($post->ID);
73 73
 					}
74 74
 				break;
75 75
 
76 76
 				case 'espresso_events':
77
-					if ( $look_in_event ) {
77
+					if ($look_in_event) {
78 78
 						// grab the events related venues
79 79
 						$venues = EEH_Venue_View::get_event_venues();
80 80
 						// make sure the result is an array
81
-						$venues = is_array( $venues ) ? $venues : array();
81
+						$venues = is_array($venues) ? $venues : array();
82 82
 						// do we have an ID for a specific venue?
83
-						if ( $VNU_ID ) {
83
+						if ($VNU_ID) {
84 84
 							// loop thru the related venues
85
-							foreach( $venues as $venue ) {
86
-								if ( $venue instanceof EE_Venue ) {
85
+							foreach ($venues as $venue) {
86
+								if ($venue instanceof EE_Venue) {
87 87
 									// until we find the venue we're looking for
88
-									if ( $venue->ID() == $VNU_ID ) {
88
+									if ($venue->ID() == $VNU_ID) {
89 89
 										EEH_Venue_View::$_venue = $venue;
90 90
 										break;
91 91
 									}
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 							// then the global post is an events post and this function was called with no argument
98 98
 						} else {
99 99
 							// just grab the first related event venue
100
-							EEH_Venue_View::$_venue = reset( $venues );
100
+							EEH_Venue_View::$_venue = reset($venues);
101 101
 						}
102 102
 					}
103 103
 				break;
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 			}
106 106
 		}
107 107
 		// now if we STILL do NOT have an EE_Venue model object, BUT we have a Venue ID...
108
-		if ( ! EEH_Venue_View::$_venue instanceof EE_Venue && $VNU_ID ) {
108
+		if ( ! EEH_Venue_View::$_venue instanceof EE_Venue && $VNU_ID) {
109 109
 			// sigh... pull it from the db
110
-			EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
110
+			EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
111 111
 		}
112
-		return EEH_Venue_View::_get_venue( $privacy_check );
112
+		return EEH_Venue_View::_get_venue($privacy_check);
113 113
 	}
114 114
 
115 115
 
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 	 *                             		     regardless of access.
122 122
 	 *  @return 	EE_Venue
123 123
 	 */
124
-	protected static function _get_venue( $privacy_check = true ) {
124
+	protected static function _get_venue($privacy_check = true) {
125 125
 		// check for private venues.
126
-		if ( EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->status() == 'private' && $privacy_check && ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) {
126
+		if (EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->status() == 'private' && $privacy_check && ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) {
127 127
 			return null;
128 128
 		}
129 129
 		return EEH_Venue_View::$_venue instanceof EE_Venue ? EEH_Venue_View::$_venue : null;
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	public static function get_event_venues() {
141 141
 		global $post;
142
-		if ( $post->post_type == 'espresso_events' ) {
143
-			if ( isset( $post->EE_Event ) && $post->EE_Event instanceof EE_Event ) {
142
+		if ($post->post_type == 'espresso_events') {
143
+			if (isset($post->EE_Event) && $post->EE_Event instanceof EE_Event) {
144 144
 				return $post->EE_Event->venues();
145 145
 			}
146 146
 		}
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
 	 *
161 161
 	 * @return bool|null
162 162
 	 */
163
-	public static function is_venue_private( $VNU_ID = false ) {
164
-		$venue = EEH_Venue_View::get_venue( $VNU_ID, true, true );
165
-		if ( ! $venue instanceof EE_Venue ) {
163
+	public static function is_venue_private($VNU_ID = false) {
164
+		$venue = EEH_Venue_View::get_venue($VNU_ID, true, true);
165
+		if ( ! $venue instanceof EE_Venue) {
166 166
 			return null;
167 167
 		}
168 168
 
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 	 * @param int $VNU_ID
179 179
 	 * @return string
180 180
 	 */
181
-	public static function venue_description( $VNU_ID = 0 ) {
182
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
183
-		if ( $venue instanceof EE_Venue ) {
181
+	public static function venue_description($VNU_ID = 0) {
182
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
183
+		if ($venue instanceof EE_Venue) {
184 184
 			return$venue->description();
185 185
 		}
186 186
 		return '';
@@ -195,12 +195,12 @@  discard block
 block discarded – undo
195 195
 	 * @param int $VNU_ID
196 196
 	 * @return string
197 197
 	 */
198
-	public static function venue_excerpt( $VNU_ID = 0 ) {
199
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
200
-		if ( $venue instanceof EE_Venue ) {
198
+	public static function venue_excerpt($VNU_ID = 0) {
199
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
200
+		if ($venue instanceof EE_Venue) {
201 201
 			$excerpt = $venue->excerpt() != NULL && $venue->excerpt() ? $venue->excerpt() : $venue->description();
202
-			$venue_link = ' ' . EEH_Venue_View::venue_details_link( $venue->ID(), __( 'more', 'event_espresso' ) . '&hellip;' );
203
-			return ! empty( $excerpt ) ? wp_trim_words( $excerpt, 25, '' ) . $venue_link : '';
202
+			$venue_link = ' '.EEH_Venue_View::venue_details_link($venue->ID(), __('more', 'event_espresso').'&hellip;');
203
+			return ! empty($excerpt) ? wp_trim_words($excerpt, 25, '').$venue_link : '';
204 204
 		}
205 205
 		return '';
206 206
 	}
@@ -215,22 +215,22 @@  discard block
 block discarded – undo
215 215
 	 * @param bool $hide_uncategorized
216 216
 	 * @return string
217 217
 	 */
218
-	public static function venue_categories( $VNU_ID = 0, $hide_uncategorized = TRUE ) {
218
+	public static function venue_categories($VNU_ID = 0, $hide_uncategorized = TRUE) {
219 219
 		$category_links = array();
220
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
221
-		if ( $venue instanceof EE_Venue ) {
220
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
221
+		if ($venue instanceof EE_Venue) {
222 222
 			// get category terms
223
-			if ( $venue_categories = get_the_terms( $venue->ID(), 'espresso_venue_categories' )) {
223
+			if ($venue_categories = get_the_terms($venue->ID(), 'espresso_venue_categories')) {
224 224
 				// loop thru terms and create links
225
-				foreach ( $venue_categories as $term ) {
226
-					$url = get_term_link( $term, 'espresso_venue_categories' );
227
-					if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) {
228
-						$category_links[] = '<a href="' . esc_url( $url ) . '" rel="tag">' . $term->name . '</a> ';
225
+				foreach ($venue_categories as $term) {
226
+					$url = get_term_link($term, 'espresso_venue_categories');
227
+					if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) {
228
+						$category_links[] = '<a href="'.esc_url($url).'" rel="tag">'.$term->name.'</a> ';
229 229
 					}
230 230
 				}
231 231
 			}
232 232
 		}
233
-		return implode( ', ', $category_links );
233
+		return implode(', ', $category_links);
234 234
 	}
235 235
 
236 236
 
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
 	 * @param bool $add_wrapper
246 246
 	 * @return string
247 247
 	 */
248
-	public static function venue_address( $type = 'multiline', $VNU_ID = 0, $use_schema = true, $add_wrapper = true ) {
249
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
250
-		if ( $venue instanceof EE_Venue ) {
251
-			EE_Registry::instance()->load_helper( 'Formatter' );
252
-			return EEH_Address::format( $venue, $type, $use_schema, $add_wrapper );
248
+	public static function venue_address($type = 'multiline', $VNU_ID = 0, $use_schema = true, $add_wrapper = true) {
249
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
250
+		if ($venue instanceof EE_Venue) {
251
+			EE_Registry::instance()->load_helper('Formatter');
252
+			return EEH_Address::format($venue, $type, $use_schema, $add_wrapper);
253 253
 		}
254 254
 		return '';
255 255
 	}
@@ -263,11 +263,11 @@  discard block
 block discarded – undo
263 263
 	 * @param int $VNU_ID
264 264
 	 * @return bool|string
265 265
 	 */
266
-	public static function venue_has_address( $VNU_ID = 0 ) {
267
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
268
-		if ( $venue instanceof EE_Venue ) {
269
-			EE_Registry::instance()->load_helper( 'Formatter' );
270
-			return EEH_Address::format( $venue, 'inline', FALSE, FALSE );
266
+	public static function venue_has_address($VNU_ID = 0) {
267
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
268
+		if ($venue instanceof EE_Venue) {
269
+			EE_Registry::instance()->load_helper('Formatter');
270
+			return EEH_Address::format($venue, 'inline', FALSE, FALSE);
271 271
 		}
272 272
 		return false;
273 273
 	}
@@ -282,31 +282,31 @@  discard block
 block discarded – undo
282 282
 	 * @param int $VNU_ID
283 283
 	 * @return string
284 284
 	 */
285
-	public static function venue_name( $link_to = 'details', $VNU_ID = 0 ) {
286
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
287
-		if ( $venue instanceof EE_Venue ) {
288
-			EE_Registry::instance()->load_helper( 'Formatter' );
285
+	public static function venue_name($link_to = 'details', $VNU_ID = 0) {
286
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
287
+		if ($venue instanceof EE_Venue) {
288
+			EE_Registry::instance()->load_helper('Formatter');
289 289
 			$venue_name = apply_filters(
290 290
 				'FHEE__EEH_Venue__venue_name__append_private_venue_name',
291 291
 				EEH_Venue_View::is_venue_private()
292
-					? EEH_Venue_View::$_venue->name() . "&nbsp;" . __( '(Private)', 'event_espresso' )
292
+					? EEH_Venue_View::$_venue->name()."&nbsp;".__('(Private)', 'event_espresso')
293 293
 					: EEH_Venue_View::$_venue->name(),
294 294
 				EEH_Venue_View::$_venue
295 295
 			);
296
-			$venue_name = EEH_Schema::name( $venue_name );
296
+			$venue_name = EEH_Schema::name($venue_name);
297 297
 
298 298
 			//if venue is trashed then ignore the "link to" setting because the venue is trashed.
299
-			if ( $venue->get('status') == 'trash' ) {
299
+			if ($venue->get('status') == 'trash') {
300 300
 				$link_to = '';
301 301
 			}
302
-			switch( $link_to ) {
302
+			switch ($link_to) {
303 303
 
304 304
 				case 'details' :
305
-					return EEH_Venue_View::venue_details_link( $venue->ID(), $venue_name );
305
+					return EEH_Venue_View::venue_details_link($venue->ID(), $venue_name);
306 306
 				break;
307 307
 
308 308
 				case 'website' :
309
-					return EEH_Venue_View::venue_website_link( $venue->ID(), $venue_name );
309
+					return EEH_Venue_View::venue_website_link($venue->ID(), $venue_name);
310 310
 				break;
311 311
 
312 312
 				default :
@@ -326,10 +326,10 @@  discard block
 block discarded – undo
326 326
 	 * @param    string $text
327 327
 	 * @return string
328 328
 	 */
329
-	public static function venue_details_link( $VNU_ID = 0, $text = '' ) {
330
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
331
-		if ( $venue instanceof EE_Venue ) {
332
-			return EEH_Schema::url( get_permalink( $venue->ID() ), $text );
329
+	public static function venue_details_link($VNU_ID = 0, $text = '') {
330
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
331
+		if ($venue instanceof EE_Venue) {
332
+			return EEH_Schema::url(get_permalink($venue->ID()), $text);
333 333
 		}
334 334
 		return '';
335 335
 	}
@@ -344,13 +344,13 @@  discard block
 block discarded – undo
344 344
 	 * @param    string $text
345 345
 	 * @return string
346 346
 	 */
347
-	public static function venue_website_link( $VNU_ID = 0, $text = '' ) {
348
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
349
-		if ( $venue instanceof EE_Venue ) {
350
-			EE_Registry::instance()->load_helper( 'Formatter' );
347
+	public static function venue_website_link($VNU_ID = 0, $text = '') {
348
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
349
+		if ($venue instanceof EE_Venue) {
350
+			EE_Registry::instance()->load_helper('Formatter');
351 351
 			$url = $venue->venue_url();
352
-			$text = ! empty( $text ) ? $text : $url;
353
-			return ! empty( $url ) ? EEH_Schema::url( $url, $text ) : '';
352
+			$text = ! empty($text) ? $text : $url;
353
+			return ! empty($url) ? EEH_Schema::url($url, $text) : '';
354 354
 		}
355 355
 		return '';
356 356
 	}
@@ -364,11 +364,11 @@  discard block
 block discarded – undo
364 364
 	 * @param int $VNU_ID
365 365
 	 * @return string
366 366
 	 */
367
-	public static function venue_phone( $VNU_ID = 0) {
368
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
369
-		if ( $venue instanceof EE_Venue ) {
370
-			EE_Registry::instance()->load_helper( 'Formatter' );
371
-			return EEH_Schema::telephone( $venue->phone() );
367
+	public static function venue_phone($VNU_ID = 0) {
368
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
369
+		if ($venue instanceof EE_Venue) {
370
+			EE_Registry::instance()->load_helper('Formatter');
371
+			return EEH_Schema::telephone($venue->phone());
372 372
 		}
373 373
 		return '';
374 374
 	}
@@ -384,51 +384,51 @@  discard block
 block discarded – undo
384 384
 	 * @param    array $gmap map options
385 385
 	 * @return string
386 386
 	 */
387
-	public static function venue_gmap( $VNU_ID = 0, $map_ID = FALSE, $gmap = array() ) {
387
+	public static function venue_gmap($VNU_ID = 0, $map_ID = FALSE, $gmap = array()) {
388 388
 
389
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
390
-		if ( $venue instanceof EE_Venue ) {
389
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
390
+		if ($venue instanceof EE_Venue) {
391 391
 			// check for global espresso_events post and use it's ID if no map_ID is set
392 392
 			global $post;
393
-			$map_ID = empty( $map_ID ) && $post->post_type == 'espresso_events' ? $post->ID : $map_ID;
393
+			$map_ID = empty($map_ID) && $post->post_type == 'espresso_events' ? $post->ID : $map_ID;
394 394
 			// grab map settings
395 395
 			$map_cfg = EE_Registry::instance()->CFG->map_settings;
396 396
 			// are maps enabled ?
397
-			if ( $map_cfg->use_google_maps && $venue->enable_for_gmap() ) {
397
+			if ($map_cfg->use_google_maps && $venue->enable_for_gmap()) {
398 398
 
399
-				EE_Registry::instance()->load_helper( 'Maps' );
400
-				EE_Registry::instance()->load_helper( 'Formatter' );
399
+				EE_Registry::instance()->load_helper('Maps');
400
+				EE_Registry::instance()->load_helper('Formatter');
401 401
 
402 402
 				$details_page = is_single();
403 403
 				$options = array();
404
-				$options['map_ID'] = $map_ID && $map_ID != $venue->ID() ? $map_ID . '-' . $venue->ID()/* . '-' . $static_map_id*/ : $venue->ID()/* . '-' . $static_map_id*/;
404
+				$options['map_ID'] = $map_ID && $map_ID != $venue->ID() ? $map_ID.'-'.$venue->ID()/* . '-' . $static_map_id*/ : $venue->ID()/* . '-' . $static_map_id*/;
405 405
 
406
-				$options['location'] = EEH_Address::format( $venue, 'inline', FALSE, FALSE );
406
+				$options['location'] = EEH_Address::format($venue, 'inline', FALSE, FALSE);
407 407
 
408 408
 				$options['ee_map_width'] = $details_page ? $map_cfg->event_details_map_width : $map_cfg->event_list_map_width;
409
-				$options['ee_map_width'] = isset( $gmap['ee_map_width'] ) && ! empty( $gmap['ee_map_width'] ) ? $gmap['ee_map_width'] : $options['ee_map_width'];
409
+				$options['ee_map_width'] = isset($gmap['ee_map_width']) && ! empty($gmap['ee_map_width']) ? $gmap['ee_map_width'] : $options['ee_map_width'];
410 410
 
411 411
 				$options['ee_map_height'] = $details_page ? $map_cfg->event_details_map_height : $map_cfg->event_list_map_height;
412
-				$options['ee_map_height'] = isset( $gmap['ee_map_height'] ) && ! empty( $gmap['ee_map_height'] ) ? $gmap['ee_map_height'] : $options['ee_map_height'];
412
+				$options['ee_map_height'] = isset($gmap['ee_map_height']) && ! empty($gmap['ee_map_height']) ? $gmap['ee_map_height'] : $options['ee_map_height'];
413 413
 
414 414
 				$options['ee_map_zoom'] = $details_page ? $map_cfg->event_details_map_zoom : $map_cfg->event_list_map_zoom;
415
-				$options['ee_map_zoom'] = isset( $gmap['ee_map_zoom'] ) && ! empty( $gmap['ee_map_zoom'] ) ? $gmap['ee_map_zoom'] : $options['ee_map_zoom'];
415
+				$options['ee_map_zoom'] = isset($gmap['ee_map_zoom']) && ! empty($gmap['ee_map_zoom']) ? $gmap['ee_map_zoom'] : $options['ee_map_zoom'];
416 416
 
417 417
 				$options['ee_map_nav_display'] = $details_page ? $map_cfg->event_details_display_nav : $map_cfg->event_list_display_nav;
418
-				$options['ee_map_nav_display'] = isset( $gmap['ee_map_nav_display'] ) && ! empty( $gmap['ee_map_nav_display'] ) ? 'true' : $options['ee_map_nav_display'];;
418
+				$options['ee_map_nav_display'] = isset($gmap['ee_map_nav_display']) && ! empty($gmap['ee_map_nav_display']) ? 'true' : $options['ee_map_nav_display']; ;
419 419
 
420 420
 				$options['ee_map_nav_size'] = $details_page ? $map_cfg->event_details_nav_size : $map_cfg->event_list_nav_size;
421
-				$options['ee_map_nav_size'] =  isset( $gmap['ee_map_nav_size'] ) && ! empty( $gmap['ee_map_nav_size'] )? $gmap['ee_map_nav_size'] : $options['ee_map_nav_size'];
421
+				$options['ee_map_nav_size'] = isset($gmap['ee_map_nav_size']) && ! empty($gmap['ee_map_nav_size']) ? $gmap['ee_map_nav_size'] : $options['ee_map_nav_size'];
422 422
 
423 423
 				$options['ee_map_type_control'] = $details_page ? $map_cfg->event_details_control_type : $map_cfg->event_list_control_type;
424
-				$options['ee_map_type_control'] =  isset( $gmap['ee_map_type_control'] ) && ! empty( $gmap['ee_map_type_control'] )? $gmap['ee_map_type_control'] : $options['ee_map_type_control'];
424
+				$options['ee_map_type_control'] = isset($gmap['ee_map_type_control']) && ! empty($gmap['ee_map_type_control']) ? $gmap['ee_map_type_control'] : $options['ee_map_type_control'];
425 425
 
426 426
 				$options['ee_map_align'] = $details_page ? $map_cfg->event_details_map_align : $map_cfg->event_list_map_align;
427
-				$options['ee_map_align'] =  isset( $gmap['ee_map_align'] ) && ! empty( $gmap['ee_map_align'] )? $gmap['ee_map_align'] : $options['ee_map_align'];
427
+				$options['ee_map_align'] = isset($gmap['ee_map_align']) && ! empty($gmap['ee_map_align']) ? $gmap['ee_map_align'] : $options['ee_map_align'];
428 428
 
429
-				$options['ee_static_url'] =  isset( $gmap['ee_static_url'] ) && ! empty( $gmap['ee_static_url'] ) ? (bool)absint( $gmap['ee_static_url'] ) : $venue->google_map_link();
429
+				$options['ee_static_url'] = isset($gmap['ee_static_url']) && ! empty($gmap['ee_static_url']) ? (bool) absint($gmap['ee_static_url']) : $venue->google_map_link();
430 430
 
431
-				return EEH_Maps::google_map( $options );
431
+				return EEH_Maps::google_map($options);
432 432
 
433 433
 			}
434 434
 		}
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 	 * @param array $atts like EEH_Maps::google_map_link
444 444
 	 * @return string
445 445
 	 */
446
-	public static function espresso_google_static_map( EE_Venue $venue, $atts = array() ){
446
+	public static function espresso_google_static_map(EE_Venue $venue, $atts = array()) {
447 447
 		EE_Registry::instance()->load_helper('Maps');
448 448
 		$state = $venue->state_obj();
449 449
 		$country = $venue->country_obj();
@@ -475,23 +475,23 @@  discard block
 block discarded – undo
475 475
 	 * @param string $after
476 476
 	 * @return string
477 477
 	 */
478
-	public static function edit_venue_link( $VNU_ID = 0, $link = '', $before = '<p class="edit-venue-lnk small-txt">', $after = '</p>' ) {
479
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
480
-		if ( $venue instanceof EE_Venue ) {
478
+	public static function edit_venue_link($VNU_ID = 0, $link = '', $before = '<p class="edit-venue-lnk small-txt">', $after = '</p>') {
479
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
480
+		if ($venue instanceof EE_Venue) {
481 481
 			// can the user edit this post ?
482
-			if ( current_user_can( 'edit_post', $venue->ID() )) {
482
+			if (current_user_can('edit_post', $venue->ID())) {
483 483
 				// set link text
484
-				$link = ! empty( $link ) ? $link : __('edit this venue');
484
+				$link = ! empty($link) ? $link : __('edit this venue');
485 485
 				// generate nonce
486
-				$nonce = wp_create_nonce( 'edit_nonce' );
486
+				$nonce = wp_create_nonce('edit_nonce');
487 487
 				// generate url to venue editor for this venue
488
-				$url = add_query_arg( array( 'page' => 'espresso_venues', 'action' => 'edit', 'post' => $venue->ID(), 'edit_nonce' => $nonce ), admin_url( 'admin.php' ) );
488
+				$url = add_query_arg(array('page' => 'espresso_venues', 'action' => 'edit', 'post' => $venue->ID(), 'edit_nonce' => $nonce), admin_url('admin.php'));
489 489
 				// get edit CPT text
490
-				$post_type_obj = get_post_type_object( 'espresso_venues' );
490
+				$post_type_obj = get_post_type_object('espresso_venues');
491 491
 				// build final link html
492
-				$link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( $post_type_obj->labels->edit_item ) . '">' . $link . '</a>';
492
+				$link = '<a class="post-edit-link" href="'.$url.'" title="'.esc_attr($post_type_obj->labels->edit_item).'">'.$link.'</a>';
493 493
 				// put it all together
494
-				return $before . apply_filters( 'edit_post_link', $link, $venue->ID() ) . $after;
494
+				return $before.apply_filters('edit_post_link', $link, $venue->ID()).$after;
495 495
 			}
496 496
 		}
497 497
 		return '';
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/interfaces/EEI_Collection.interface.php 1 patch
Spacing   +7 added lines, -7 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
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @param mixed  $info
26 26
 	 * @return bool
27 27
 	 */
28
-	public function add( $object, $info = null );
28
+	public function add($object, $info = null);
29 29
 
30 30
 
31 31
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param mixed  $info
40 40
 	 * @return bool
41 41
 	 */
42
-	public function set_info( $object, $info = null );
42
+	public function set_info($object, $info = null);
43 43
 
44 44
 
45 45
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 * @param mixed
53 53
 	 * @return null | object
54 54
 	 */
55
-	public function get_by_info( $info );
55
+	public function get_by_info($info);
56 56
 
57 57
 
58 58
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @param object $object
66 66
 	 * @return bool
67 67
 	 */
68
-	public function has( $object );
68
+	public function has($object);
69 69
 
70 70
 
71 71
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @param $object
79 79
 	 * @return void
80 80
 	 */
81
-	public function remove( $object );
81
+	public function remove($object);
82 82
 
83 83
 
84 84
 
Please login to merge, or discard this patch.