Completed
Branch BUG-7527-answer-question-group (0815fc)
by
unknown
25:10 queued 12:57
created
core/libraries/form_sections/inputs/EE_Float_Input.input.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@
 block discarded – undo
6 6
  * @subpackage
7 7
  * @author				Mike Nelson
8 8
  */
9
-class EE_Float_Input extends EE_Form_Input_Base{
9
+class EE_Float_Input extends EE_Form_Input_Base {
10 10
 
11 11
 	/**
12 12
 	 * @param array $input_settings
13 13
 	 */
14
-	function __construct($input_settings = array()){
14
+	function __construct($input_settings = array()) {
15 15
 		$this->_set_display_strategy(new EE_Text_Input_Display_Strategy());
16
-		$this->_set_normalization_strategy(new EE_Float_Normalization( isset( $input_settings[ 'validation_error_message' ] ) ? $input_settings[ 'validation_error_message' ] : NULL ) );
17
-		$this->_add_validation_strategy( new EE_Float_Validation_Strategy( isset( $input_settings[ 'validation_error_message' ] ) ? $input_settings[ 'validation_error_message' ] : NULL ) );
16
+		$this->_set_normalization_strategy(new EE_Float_Normalization(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : NULL));
17
+		$this->_add_validation_strategy(new EE_Float_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : NULL));
18 18
 		parent::__construct($input_settings);
19 19
 	}
20 20
 }
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Form_Input_Base.input.php 2 patches
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 		if( ! $this->_html_name){
201 201
 			if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){
202 202
 				$this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]";
203
-			}else{
203
+			} else{
204 204
 				$this->_html_name = $this->name();
205 205
 			}
206 206
 		}
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	protected function _get_display_strategy(){
231 231
 		if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){
232 232
 			throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"),$this->html_name(),$this->html_id()));
233
-		}else{
233
+		} else{
234 234
 			return $this->_display_strategy;
235 235
 		}
236 236
 	}
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	public function get_validation_strategies(){
307 307
 		if(is_array($this->_validation_strategies)){
308 308
 			return $this->_validation_strategies;
309
-		}else{
309
+		} else{
310 310
 			return array();
311 311
 		}
312 312
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 				if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
414 414
 					try{
415 415
 						$validation_strategy->validate($this->normalized_value());
416
-					}catch(EE_Validation_Error $e){
416
+					} catch(EE_Validation_Error $e){
417 417
 						$this->add_validation_error($e);
418 418
 					}
419 419
 				}
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 		}
422 422
 		if( $this->get_validation_errors()){
423 423
 			return false;
424
-		}else{
424
+		} else{
425 425
 			return true;
426 426
 		}
427 427
 	}
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 
603 603
 		if(! empty($jquery_validation_rules)){
604 604
 			$jquery_validation_js[ $this->html_id( TRUE ) ] = $jquery_validation_rules;
605
-		}else{
605
+		} else{
606 606
 			return array();
607 607
 		}
608 608
 		return $jquery_validation_js;
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
 		if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){
770 770
 			$name_parts = $matches[ 1 ];
771 771
 			array_unshift($name_parts, $before_any_brackets);
772
-		}else{
772
+		} else{
773 773
 			$name_parts = array( $before_any_brackets );
774 774
 		}
775 775
 		// now get the value for the input
@@ -796,10 +796,10 @@  discard block
 block discarded – undo
796 796
 		if( isset( $req_data[ $first_part_to_consider ] ) ){
797 797
 			if( empty($html_name_parts ) ){
798 798
 				return $req_data[ $first_part_to_consider ];
799
-			}else{
799
+			} else{
800 800
 				return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[ $first_part_to_consider ] );
801 801
 			}
802
-		}else{
802
+		} else{
803 803
 			return NULL;
804 804
 		}
805 805
 	}
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 		$checked_value = $this->find_form_data_for_this_section( $req_data );
819 819
 		if( $checked_value !== null ){
820 820
 			return TRUE;
821
-		}else{
821
+		} else{
822 822
 			return FALSE;
823 823
 		}
824 824
 	}
Please login to merge, or discard this patch.
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @subpackage
9 9
  * @author				Mike Nelson
10 10
  */
11
-abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{
11
+abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable {
12 12
 
13 13
 	/**
14 14
 	 * the input's name attribute
@@ -141,67 +141,67 @@  discard block
 block discarded – undo
141 141
 	 *		@type EE_Validation_Strategy_Base[] $validation_strategies
142 142
 	 * }
143 143
 	 */
144
-	public function __construct( $input_args = array() ){
145
-		$input_args = apply_filters( 'FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this );
144
+	public function __construct($input_args = array()) {
145
+		$input_args = apply_filters('FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this);
146 146
 		// the following properties must be cast as arrays
147 147
 		$set_as_array = array(
148 148
 			'validation_strategies'
149 149
 		);
150 150
 		// loop thru incoming options
151
-		foreach( $input_args as $key => $value ) {
151
+		foreach ($input_args as $key => $value) {
152 152
 			// add underscore to $key to match property names
153
-			$_key = '_' . $key;
154
-			if ( property_exists( $this, $_key )) {
153
+			$_key = '_'.$key;
154
+			if (property_exists($this, $_key)) {
155 155
 				// first check if this property needs to be set as an array
156
-				if ( isset( $set_as_array[ $key ] )) {
156
+				if (isset($set_as_array[$key])) {
157 157
 					// ensure value is an array
158
-					$value = is_array( $value ) ? $value : array( $value );
158
+					$value = is_array($value) ? $value : array($value);
159 159
 					// and merge with existing values
160
-					$this->{$_key} = array_merge( $this->{$_key}, $value );
160
+					$this->{$_key} = array_merge($this->{$_key}, $value);
161 161
 				} else {
162 162
 					$this->{$_key} = $value;
163 163
 				}
164 164
 			}
165 165
 		}
166 166
 		// ensure that "required" is set correctly
167
-		$this->set_required( $this->_required, isset( $input_args[ 'required_validation_error_message' ] ) ? $input_args[ 'required_validation_error_message' ] : NULL );
167
+		$this->set_required($this->_required, isset($input_args['required_validation_error_message']) ? $input_args['required_validation_error_message'] : NULL);
168 168
 
169
-		$this->_html_name_specified = isset( $input_args['html_name'] ) ? TRUE : FALSE;
169
+		$this->_html_name_specified = isset($input_args['html_name']) ? TRUE : FALSE;
170 170
 
171 171
 		$this->_display_strategy->_construct_finalize($this);
172 172
 
173
-		if ( $this->_validation_strategies ){
174
-			foreach( $this->_validation_strategies as $validation_strategy ){
173
+		if ($this->_validation_strategies) {
174
+			foreach ($this->_validation_strategies as $validation_strategy) {
175 175
 				$validation_strategy->_construct_finalize($this);
176 176
 			}
177 177
 		}
178 178
 
179
-		if( ! $this->_normalization_strategy){
179
+		if ( ! $this->_normalization_strategy) {
180 180
 			$this->_normalization_strategy = new EE_Text_Normalization();
181 181
 		}
182 182
 		$this->_normalization_strategy->_construct_finalize($this);
183 183
 
184 184
 		//at least we can use the normalization strategy to populate the default
185
-		if( isset( $input_args[ 'default' ] ) ) {
186
-			$this->set_default( $input_args[ 'default' ] );
185
+		if (isset($input_args['default'])) {
186
+			$this->set_default($input_args['default']);
187 187
 		}
188 188
 
189
-		if( ! $this->_sensitive_data_removal_strategy){
189
+		if ( ! $this->_sensitive_data_removal_strategy) {
190 190
 			$this->_sensitive_data_removal_strategy = new EE_No_Sensitive_Data_Removal();
191 191
 		}
192 192
 		$this->_sensitive_data_removal_strategy->_construct_finalize($this);
193
-		parent::__construct( $input_args );
193
+		parent::__construct($input_args);
194 194
 	}
195 195
 
196 196
 	/**
197 197
 	 * Sets the html_name to its default value, if none was specified in teh constructor.
198 198
 	 * Calculation involves using the name and the parent's html_name
199 199
 	 */
200
-	protected function _set_default_html_name_if_empty(){
201
-		if( ! $this->_html_name){
202
-			if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){
203
-				$this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]";
204
-			}else{
200
+	protected function _set_default_html_name_if_empty() {
201
+		if ( ! $this->_html_name) {
202
+			if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) {
203
+				$this->_html_name = $this->_parent_section->html_name_prefix()."[{$this->name()}]";
204
+			} else {
205 205
 				$this->_html_name = $this->name();
206 206
 			}
207 207
 		}
@@ -216,12 +216,12 @@  discard block
 block discarded – undo
216 216
 	function _construct_finalize($parent_form_section, $name) {
217 217
 		parent::_construct_finalize($parent_form_section, $name);
218 218
 		$this->_set_default_html_name_if_empty();
219
-		if( ! $this->_html_label ){
220
-			if( ! $this->_html_label_text){
221
-				$this->_html_label_text = ucwords( str_replace("_"," ",$name));
219
+		if ( ! $this->_html_label) {
220
+			if ( ! $this->_html_label_text) {
221
+				$this->_html_label_text = ucwords(str_replace("_", " ", $name));
222 222
 			}
223 223
 		}
224
-		do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name );
224
+		do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name);
225 225
 	}
226 226
 
227 227
 	 /**
@@ -229,10 +229,10 @@  discard block
 block discarded – undo
229 229
 	  * @return EE_Display_Strategy_Base
230 230
 	  * @throws EE_Error
231 231
 	  */
232
-	protected function _get_display_strategy(){
233
-		if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){
234
-			throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"),$this->html_name(),$this->html_id()));
235
-		}else{
232
+	protected function _get_display_strategy() {
233
+		if ( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base) {
234
+			throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"), $this->html_name(), $this->html_id()));
235
+		} else {
236 236
 			return $this->_display_strategy;
237 237
 		}
238 238
 	}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 * Sets the display strategy.
241 241
 	 * @param EE_Display_Strategy_Base $strategy
242 242
 	 */
243
-	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy){
243
+	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy) {
244 244
 		$this->_display_strategy = $strategy;
245 245
 	}
246 246
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 * Sets the sanitization strategy
249 249
 	 * @param EE_Normalization_Strategy_Base $strategy
250 250
 	 */
251
-	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy){
251
+	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy) {
252 252
 		$this->_normalization_strategy = $strategy;
253 253
 	}
254 254
 
@@ -274,14 +274,14 @@  discard block
 block discarded – undo
274 274
 	 * Gets the display strategy for this input
275 275
 	 * @return EE_Display_Strategy_Base
276 276
 	 */
277
-	public function get_display_strategy(){
277
+	public function get_display_strategy() {
278 278
 		return $this->_display_strategy;
279 279
 	}
280 280
 	/**
281 281
 	 * Overwrites the display strategy
282 282
 	 * @param EE_Display_Strategy_Base $display_strategy
283 283
 	 */
284
-	public function set_display_strategy($display_strategy){
284
+	public function set_display_strategy($display_strategy) {
285 285
 		$this->_display_strategy = $display_strategy;
286 286
 		$this->_display_strategy->_construct_finalize($this);
287 287
 	}
@@ -289,14 +289,14 @@  discard block
 block discarded – undo
289 289
 	 * Gets the normalization strategy set on this input
290 290
 	 * @return EE_Normalization_Strategy_Base
291 291
 	 */
292
-	public function get_normalization_strategy(){
292
+	public function get_normalization_strategy() {
293 293
 		return $this->_normalization_strategy;
294 294
 	}
295 295
 	/**
296 296
 	 * Overwrites the normalization strategy
297 297
 	 * @param EE_Normalization_Strategy_Base $normalization_strategy
298 298
 	 */
299
-	public function set_normalization_strategy($normalization_strategy){
299
+	public function set_normalization_strategy($normalization_strategy) {
300 300
 		$this->_normalization_strategy = $normalization_strategy;
301 301
 		$this->_normalization_strategy->_construct_finalize($this);
302 302
 	}
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
 	 * Returns all teh validation strategies which apply to this field, numerically indexed
306 306
 	 * @return EE_Validation_Strategy_Base[]
307 307
 	 */
308
-	public function get_validation_strategies(){
309
-		if(is_array($this->_validation_strategies)){
308
+	public function get_validation_strategies() {
309
+		if (is_array($this->_validation_strategies)) {
310 310
 			return $this->_validation_strategies;
311
-		}else{
311
+		} else {
312 312
 			return array();
313 313
 		}
314 314
 
@@ -318,9 +318,9 @@  discard block
 block discarded – undo
318 318
 	 * @param EE_Validation_Strategy_Base $validation_strategy
319 319
 	 * @return void
320 320
 	 */
321
-	protected function _add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ){
322
-		$validation_strategy->_construct_finalize( $this );
323
-		$this->_validation_strategies[ get_class($validation_strategy) ] = $validation_strategy;
321
+	protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
322
+		$validation_strategy->_construct_finalize($this);
323
+		$this->_validation_strategies[get_class($validation_strategy)] = $validation_strategy;
324 324
 
325 325
 	}
326 326
 
@@ -329,18 +329,18 @@  discard block
 block discarded – undo
329 329
 	 * @param EE_Validation_Strategy_Base $validation_strategy
330 330
 	 * @return void
331 331
 	 */
332
-	public function add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ) {
333
-		$this->_add_validation_strategy( $validation_strategy );
332
+	public function add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
333
+		$this->_add_validation_strategy($validation_strategy);
334 334
 	}
335 335
 
336 336
 	/**
337 337
 	 * The classname of the validation strategy to remove
338 338
 	 * @param string $validation_strategy_classname
339 339
 	 */
340
-	public function remove_validation_strategy( $validation_strategy_classname ) {
341
-		foreach( $this->_validation_strategies as $key => $validation_strategy ){
342
-			if( is_subclass_of( $validation_strategy, $validation_strategy_classname ) ){
343
-				unset( $this->_validation_strategies[ $key ] );
340
+	public function remove_validation_strategy($validation_strategy_classname) {
341
+		foreach ($this->_validation_strategies as $key => $validation_strategy) {
342
+			if (is_subclass_of($validation_strategy, $validation_strategy_classname)) {
343
+				unset($this->_validation_strategies[$key]);
344 344
 			}
345 345
 		}
346 346
 	}
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 	 * to the parent form's layout strategy
350 350
 	 * @return string
351 351
 	 */
352
-	public function get_html_and_js(){
352
+	public function get_html_and_js() {
353 353
 		return $this->_parent_section->get_html_for_input($this);
354 354
 	}
355 355
 	/**
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 	 * Makes sure the JS and CSS are enqueued for it
359 359
 	 * @return string
360 360
 	 */
361
-	public function get_html_for_input(){
361
+	public function get_html_for_input() {
362 362
 		return  $this->_get_display_strategy()->display();
363 363
 	}
364 364
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	 * @return string
369 369
 	 */
370 370
 	public function html_other_attributes() {
371
-		return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : '';
371
+		return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : '';
372 372
 	}
373 373
 
374 374
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	/**
377 377
 	 * @param string $html_other_attributes
378 378
 	 */
379
-	public function set_html_other_attributes( $html_other_attributes ) {
379
+	public function set_html_other_attributes($html_other_attributes) {
380 380
 		$this->_html_other_attributes = $html_other_attributes;
381 381
 	}
382 382
 
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 	 * according to the form section's layout strategy
386 386
 	 * @return string
387 387
 	 */
388
-	public function get_html_for_label(){
388
+	public function get_html_for_label() {
389 389
 		return $this->_parent_section->get_layout_strategy()->display_label($this);
390 390
 	}
391 391
 	/**
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 	 * according to the form section's layout strategy
394 394
 	 * @return string
395 395
 	 */
396
-	public function get_html_for_errors(){
396
+	public function get_html_for_errors() {
397 397
 		return $this->_parent_section->get_layout_strategy()->display_errors($this);
398 398
 	}
399 399
 	/**
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 	 * according to the form section's layout strategy
402 402
 	 * @return string
403 403
 	 */
404
-	public function get_html_for_help(){
404
+	public function get_html_for_help() {
405 405
 		return $this->_parent_section->get_layout_strategy()->display_help_text($this);
406 406
 	}
407 407
 	/**
@@ -410,20 +410,20 @@  discard block
 block discarded – undo
410 410
 	 * @return boolean
411 411
 	 */
412 412
 	protected function _validate() {
413
-		if(is_array($this->_validation_strategies)){
414
-			foreach($this->_validation_strategies as $validation_strategy){
415
-				if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
416
-					try{
413
+		if (is_array($this->_validation_strategies)) {
414
+			foreach ($this->_validation_strategies as $validation_strategy) {
415
+				if ($validation_strategy instanceof EE_Validation_Strategy_Base) {
416
+					try {
417 417
 						$validation_strategy->validate($this->normalized_value());
418
-					}catch(EE_Validation_Error $e){
418
+					} catch (EE_Validation_Error $e) {
419 419
 						$this->add_validation_error($e);
420 420
 					}
421 421
 				}
422 422
 			}
423 423
 		}
424
-		if( $this->get_validation_errors()){
424
+		if ($this->get_validation_errors()) {
425 425
 			return false;
426
-		}else{
426
+		} else {
427 427
 			return true;
428 428
 		}
429 429
 	}
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
 	 * @param string $value
437 437
 	 * @return null|string
438 438
 	 */
439
-	private function _sanitize($value){
440
-		return $value !== NULL ?stripslashes(html_entity_decode($value)) : NULL;//don't sanitize_text_field
439
+	private function _sanitize($value) {
440
+		return $value !== NULL ?stripslashes(html_entity_decode($value)) : NULL; //don't sanitize_text_field
441 441
 	}
442 442
 
443 443
 
@@ -449,24 +449,24 @@  discard block
 block discarded – undo
449 449
 	 * @param array $req_data like $_POST
450 450
 	 * @return boolean whether or not there was an error
451 451
 	 */
452
-	protected function _normalize( $req_data ) {
452
+	protected function _normalize($req_data) {
453 453
 		//any existing validation errors don't apply so clear them
454 454
 		$this->_validation_errors = array();
455 455
 		try {
456
-			$raw_input = $this->find_form_data_for_this_section( $req_data );
456
+			$raw_input = $this->find_form_data_for_this_section($req_data);
457 457
 			//super simple sanitization for now
458
-			if ( is_array( $raw_input )) {
458
+			if (is_array($raw_input)) {
459 459
 				$this->_raw_value = array();
460
-				foreach( $raw_input as $key => $value ) {
461
-					$this->_raw_value[ $key ] = $this->_sanitize( $value );
460
+				foreach ($raw_input as $key => $value) {
461
+					$this->_raw_value[$key] = $this->_sanitize($value);
462 462
 				}
463 463
 			} else {
464
-				$this->_raw_value = $this->_sanitize( $raw_input );
464
+				$this->_raw_value = $this->_sanitize($raw_input);
465 465
 			}
466 466
 			//we want ot mostly leave the input alone in case we need to re-display it to the user
467
-			$this->_normalized_value = $this->_normalization_strategy->normalize( $this->raw_value() );
468
-		} catch ( EE_Validation_Error $e ) {
469
-			$this->add_validation_error( $e );
467
+			$this->_normalized_value = $this->_normalization_strategy->normalize($this->raw_value());
468
+		} catch (EE_Validation_Error $e) {
469
+			$this->add_validation_error($e);
470 470
 		}
471 471
 	}
472 472
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 	/**
476 476
 	 * @return string
477 477
 	 */
478
-	public function html_name(){
478
+	public function html_name() {
479 479
 		return $this->_html_name;
480 480
 	}
481 481
 
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 	/**
485 485
 	 * @return string
486 486
 	 */
487
-	function html_label_id(){
488
-		return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl';
487
+	function html_label_id() {
488
+		return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl';
489 489
 	}
490 490
 
491 491
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	/**
494 494
 	 * @return string
495 495
 	 */
496
-	function html_label_class(){
496
+	function html_label_class() {
497 497
 		return $this->_html_label_class;
498 498
 	}
499 499
 
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	/**
503 503
 	 * @return string
504 504
 	 */
505
-	function html_label_style(){
505
+	function html_label_style() {
506 506
 		return $this->_html_label_style;
507 507
 	}
508 508
 
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	/**
512 512
 	 * @return string
513 513
 	 */
514
-	function html_label_text(){
514
+	function html_label_text() {
515 515
 		return $this->_html_label_text;
516 516
 	}
517 517
 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	/**
521 521
 	 * @return string
522 522
 	 */
523
-	function html_help_text(){
523
+	function html_help_text() {
524 524
 		return $this->_html_help_text;
525 525
 	}
526 526
 
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 	/**
530 530
 	 * @return string
531 531
 	 */
532
-	function html_help_class(){
532
+	function html_help_class() {
533 533
 		return $this->_html_help_class;
534 534
 	}
535 535
 
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 	/**
539 539
 	 * @return string
540 540
 	 */
541
-	function html_help_style(){
541
+	function html_help_style() {
542 542
 		return $this->_html_style;
543 543
 	}
544 544
 	/**
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 	 * in which case, we would have stored the malicious content to our database.
552 552
 	 * @return string
553 553
 	 */
554
-	function raw_value(){
554
+	function raw_value() {
555 555
 		return $this->_raw_value;
556 556
 	}
557 557
 	/**
@@ -559,15 +559,15 @@  discard block
 block discarded – undo
559 559
 	 * it escapes all html entities
560 560
 	 * @return string
561 561
 	 */
562
-	function raw_value_in_form(){
563
-		return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8');
562
+	function raw_value_in_form() {
563
+		return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8');
564 564
 	}
565 565
 	/**
566 566
 	 * returns the value after it's been sanitized, and then converted into it's proper type
567 567
 	 * in PHP. Eg, a string, an int, an array,
568 568
 	 * @return mixed
569 569
 	 */
570
-	function normalized_value(){
570
+	function normalized_value() {
571 571
 		return $this->_normalized_value;
572 572
 	}
573 573
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	 * the best thing to display
578 578
 	 * @return string
579 579
 	 */
580
-	function pretty_value(){
580
+	function pretty_value() {
581 581
 		return $this->_normalized_value;
582 582
 	}
583 583
 	/**
@@ -596,15 +596,15 @@  discard block
 block discarded – undo
596 596
 		  }</code>
597 597
 	 * @return array
598 598
 	 */
599
-	function get_jquery_validation_rules(){
599
+	function get_jquery_validation_rules() {
600 600
 		$jquery_validation_rules = array();
601
-		foreach($this->get_validation_strategies() as $validation_strategy){
602
-			$jquery_validation_rules = array_replace_recursive( $jquery_validation_rules, $validation_strategy->get_jquery_validation_rule_array());
601
+		foreach ($this->get_validation_strategies() as $validation_strategy) {
602
+			$jquery_validation_rules = array_replace_recursive($jquery_validation_rules, $validation_strategy->get_jquery_validation_rule_array());
603 603
 		}
604 604
 
605
-		if(! empty($jquery_validation_rules)){
606
-			$jquery_validation_js[ $this->html_id( TRUE ) ] = $jquery_validation_rules;
607
-		}else{
605
+		if ( ! empty($jquery_validation_rules)) {
606
+			$jquery_validation_js[$this->html_id(TRUE)] = $jquery_validation_rules;
607
+		} else {
608 608
 			return array();
609 609
 		}
610 610
 		return $jquery_validation_js;
@@ -616,9 +616,9 @@  discard block
 block discarded – undo
616 616
 	 * @param mixed $value
617 617
 	 * @return void
618 618
 	 */
619
-	function set_default($value){
619
+	function set_default($value) {
620 620
 		$this->_normalized_value = $value;
621
-		$this->_raw_value = $this->_normalization_strategy->unnormalize( $value );
621
+		$this->_raw_value = $this->_normalization_strategy->unnormalize($value);
622 622
 	}
623 623
 
624 624
 	/**
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 	 * @param string $label
627 627
 	 * @return void
628 628
 	 */
629
-	function set_html_label_text($label){
629
+	function set_html_label_text($label) {
630 630
 		$this->_html_label_text = $label;
631 631
 	}
632 632
 
@@ -638,12 +638,12 @@  discard block
 block discarded – undo
638 638
 	 * @param boolean $required
639 639
 	 * @param null    $required_text
640 640
 	 */
641
-	function set_required($required = true, $required_text = NULL ){
642
-		$required = filter_var( $required, FILTER_VALIDATE_BOOLEAN );
643
-		if ( $required ) {
644
-			$this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) );
641
+	function set_required($required = true, $required_text = NULL) {
642
+		$required = filter_var($required, FILTER_VALIDATE_BOOLEAN);
643
+		if ($required) {
644
+			$this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text));
645 645
 		} else {
646
-			unset( $this->_validation_strategies[ get_class( new EE_Required_Validation_Strategy() ) ] );
646
+			unset($this->_validation_strategies[get_class(new EE_Required_Validation_Strategy())]);
647 647
 		}
648 648
 		$this->_required = $required;
649 649
 	}
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 	 * Returns whether or not this field is required
652 652
 	 * @return boolean
653 653
 	 */
654
-	public function required(){
654
+	public function required() {
655 655
 		return $this->_required;
656 656
 	}
657 657
 
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 	/**
661 661
 	 * @param string $required_css_class
662 662
 	 */
663
-	public function set_required_css_class( $required_css_class ) {
663
+	public function set_required_css_class($required_css_class) {
664 664
 		$this->_required_css_class = $required_css_class;
665 665
 	}
666 666
 
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 	 * Sets the help text, in case
680 680
 	 * @param string $text
681 681
 	 */
682
-	public function set_html_help_text($text){
682
+	public function set_html_help_text($text) {
683 683
 		$this->_html_help_text = $text;
684 684
 	}
685 685
 	/**
@@ -691,8 +691,8 @@  discard block
 block discarded – undo
691 691
 	public function clean_sensitive_data() {
692 692
 		//if we do ANY kind of sensitive data removal on this, then just clear out the raw value
693 693
 		//if we need more logic than this we'll make a strategy for it
694
-		if( $this->_sensitive_data_removal_strategy &&
695
-				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){
694
+		if ($this->_sensitive_data_removal_strategy &&
695
+				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) {
696 696
 			$this->_raw_value = NULL;
697 697
 		}
698 698
 		//and clean the normalized value according to the appropriate strategy
@@ -706,10 +706,10 @@  discard block
 block discarded – undo
706 706
 	 * @param string $button_size
707 707
 	 * @param string $other_attributes
708 708
 	 */
709
-	public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) {
709
+	public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') {
710 710
 		$button_css_attributes = 'button';
711 711
 		$button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary';
712
-		switch ( $button_size ) {
712
+		switch ($button_size) {
713 713
 			case 'xs' :
714 714
 			case 'extra-small' :
715 715
 				$button_css_attributes .= ' button-xs';
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 			default :
731 731
 				$button_css_attributes .= '';
732 732
 		}
733
-		$this->_button_css_attributes .= ! empty( $other_attributes ) ? $button_css_attributes . ' ' . $other_attributes : $button_css_attributes;
733
+		$this->_button_css_attributes .= ! empty($other_attributes) ? $button_css_attributes.' '.$other_attributes : $button_css_attributes;
734 734
 	}
735 735
 
736 736
 
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 	 * @return string
740 740
 	 */
741 741
 	public function button_css_attributes() {
742
-		if ( empty( $this->_button_css_attributes )) {
742
+		if (empty($this->_button_css_attributes)) {
743 743
 			$this->set_button_css_attributes();
744 744
 		}
745 745
 		return $this->_button_css_attributes;
@@ -759,27 +759,27 @@  discard block
 block discarded – undo
759 759
 	 * @param array $req_data
760 760
 	 * @return mixed whatever the raw value of this form section is in the request data
761 761
 	 */
762
-	public function find_form_data_for_this_section( $req_data ){
762
+	public function find_form_data_for_this_section($req_data) {
763 763
 		// break up the html name by "[]"
764
-		if ( strpos( $this->html_name(), '[' ) !== FALSE ) {
765
-			$before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') );
764
+		if (strpos($this->html_name(), '[') !== FALSE) {
765
+			$before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '['));
766 766
 		} else {
767 767
 			$before_any_brackets = $this->html_name();
768 768
 		}
769 769
 		// grab all of the segments
770
-		preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches);
771
-		if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){
772
-			$name_parts = $matches[ 1 ];
770
+		preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches);
771
+		if (isset($matches[1]) && is_array($matches[1])) {
772
+			$name_parts = $matches[1];
773 773
 			array_unshift($name_parts, $before_any_brackets);
774
-		}else{
775
-			$name_parts = array( $before_any_brackets );
774
+		} else {
775
+			$name_parts = array($before_any_brackets);
776 776
 		}
777 777
 		// now get the value for the input
778 778
 		$value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data);
779
-		if( $value === NULL ){
779
+		if ($value === NULL) {
780 780
 			//check if this thing's name is at the TOP level of the request data
781
-			if( isset( $req_data[ $this->name() ] ) ){
782
-				$value = $req_data[ $this->name() ];
781
+			if (isset($req_data[$this->name()])) {
782
+				$value = $req_data[$this->name()];
783 783
 			}
784 784
 		}
785 785
 		return $value;
@@ -793,15 +793,15 @@  discard block
 block discarded – undo
793 793
 	 * @param array $req_data
794 794
 	 * @return array | NULL
795 795
 	 */
796
-	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){
797
-		$first_part_to_consider = array_shift( $html_name_parts );
798
-		if( isset( $req_data[ $first_part_to_consider ] ) ){
799
-			if( empty($html_name_parts ) ){
800
-				return $req_data[ $first_part_to_consider ];
801
-			}else{
802
-				return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[ $first_part_to_consider ] );
796
+	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) {
797
+		$first_part_to_consider = array_shift($html_name_parts);
798
+		if (isset($req_data[$first_part_to_consider])) {
799
+			if (empty($html_name_parts)) {
800
+				return $req_data[$first_part_to_consider];
801
+			} else {
802
+				return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[$first_part_to_consider]);
803 803
 			}
804
-		}else{
804
+		} else {
805 805
 			return NULL;
806 806
 		}
807 807
 	}
@@ -813,14 +813,14 @@  discard block
 block discarded – undo
813 813
 	 * @param array $req_data like $_POST
814 814
 	 * @return boolean
815 815
 	 */
816
-	public function form_data_present_in($req_data = NULL){
817
-		if( $req_data === NULL ){
816
+	public function form_data_present_in($req_data = NULL) {
817
+		if ($req_data === NULL) {
818 818
 			$req_data = $_POST;
819 819
 		}
820
-		$checked_value = $this->find_form_data_for_this_section( $req_data );
821
-		if( $checked_value !== null ){
820
+		$checked_value = $this->find_form_data_for_this_section($req_data);
821
+		if ($checked_value !== null) {
822 822
 			return TRUE;
823
-		}else{
823
+		} else {
824 824
 			return FALSE;
825 825
 		}
826 826
 	}
Please login to merge, or discard this patch.
libraries/form_sections/inputs/EE_Form_Input_With_Options_Base.input.php 2 patches
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @subpackage
8 8
  * @author				Mike Nelson
9 9
  */
10
-class EE_Form_Input_With_Options_Base extends EE_Form_Input_Base{
10
+class EE_Form_Input_With_Options_Base extends EE_Form_Input_Base {
11 11
 
12 12
 	/**
13 13
 	 * array of available options to choose as an answer
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
 	 * @param array $answer_options
54 54
 	 * @param array $input_settings
55 55
 	 */
56
-	public function __construct( $answer_options = array(), $input_settings = array() ) {
57
-		if ( isset( $input_settings['label_size'] )) {
58
-			$this->_set_label_size( $input_settings['label_size'] );
59
-			if ( isset( $input_settings['enforce_label_size'] ) && $input_settings['enforce_label_size'] ) {
56
+	public function __construct($answer_options = array(), $input_settings = array()) {
57
+		if (isset($input_settings['label_size'])) {
58
+			$this->_set_label_size($input_settings['label_size']);
59
+			if (isset($input_settings['enforce_label_size']) && $input_settings['enforce_label_size']) {
60 60
 				$this->_enforce_label_size = TRUE;
61 61
 			}
62 62
 		}
63
-		if ( isset( $input_settings['display_html_label_text'] )) {
64
-			$this->set_display_html_label_text( $input_settings['display_html_label_text'] );
63
+		if (isset($input_settings['display_html_label_text'])) {
64
+			$this->set_display_html_label_text($input_settings['display_html_label_text']);
65 65
 		}
66
-		$this->set_select_options( $answer_options );
67
-		parent::__construct( $input_settings );
66
+		$this->set_select_options($answer_options);
67
+		parent::__construct($input_settings);
68 68
 	}
69 69
 
70 70
 
@@ -75,47 +75,47 @@  discard block
 block discarded – undo
75 75
 	 * @param array $answer_options
76 76
 	 * @return void  just has the side-effect of setting the options for this input
77 77
 	 */
78
-	public function set_select_options( $answer_options = array() ){
79
-		$answer_options = is_array( $answer_options ) ? $answer_options : array( $answer_options );
78
+	public function set_select_options($answer_options = array()) {
79
+		$answer_options = is_array($answer_options) ? $answer_options : array($answer_options);
80 80
 		//get the first item in the select options and check it's type
81
-		if ( reset( $answer_options ) instanceof EE_Question_Option ) {
82
-			$this->_options = $this->_process_question_options( $answer_options );
81
+		if (reset($answer_options) instanceof EE_Question_Option) {
82
+			$this->_options = $this->_process_question_options($answer_options);
83 83
 		} else {
84 84
 			$this->_options = $answer_options;
85 85
 		}
86 86
 		//d( $this->_options );
87
-		$select_option_keys = array_keys( $this->_options );
87
+		$select_option_keys = array_keys($this->_options);
88 88
 		// attempt to determine data type for values in order to set normalization type
89 89
 		if (
90
-			count( $this->_options ) == 2
90
+			count($this->_options) == 2
91 91
 			&&
92 92
 			(
93
-				( in_array( TRUE, $select_option_keys, true ) && in_array( FALSE, $select_option_keys, true ))
94
-				|| ( in_array( 1, $select_option_keys, true ) && in_array( 0, $select_option_keys, true ))
93
+				(in_array(TRUE, $select_option_keys, true) && in_array(FALSE, $select_option_keys, true))
94
+				|| (in_array(1, $select_option_keys, true) && in_array(0, $select_option_keys, true))
95 95
 			)
96
-		){
96
+		) {
97 97
 			// values appear to be boolean, like TRUE, FALSE, 1, 0
98 98
 			$normalization = new EE_Boolean_Normalization();
99
-		} else{
99
+		} else {
100 100
 			//are ALL the options ints? If so use int validation
101 101
 			$all_ints = true;
102
-			foreach($select_option_keys as $value ){
103
-				if( ! is_int( $value ) ){
102
+			foreach ($select_option_keys as $value) {
103
+				if ( ! is_int($value)) {
104 104
 					$all_ints = false;
105 105
 					break;
106 106
 				}
107 107
 			}
108
-			if( $all_ints ){
108
+			if ($all_ints) {
109 109
 				$normalization = new EE_Int_Normalization();
110
-			}else{
110
+			} else {
111 111
 				$normalization = new EE_Text_Normalization();
112 112
 			}
113 113
 		}
114 114
 		// does input type have multiple options ?
115
-		if ( $this->_multiple_selections ) {
116
-			$this->_set_normalization_strategy( new EE_Many_Valued_Normalization( $normalization ));
115
+		if ($this->_multiple_selections) {
116
+			$this->_set_normalization_strategy(new EE_Many_Valued_Normalization($normalization));
117 117
 		} else {
118
-			$this->_set_normalization_strategy( $normalization );
118
+			$this->_set_normalization_strategy($normalization);
119 119
 		}
120 120
 	}
121 121
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	/**
125 125
 	 * @return array
126 126
 	 */
127
-	public function options(){
127
+	public function options() {
128 128
 		return $this->_options;
129 129
 	}
130 130
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * Returns an array which is guaranteed to not be multidimensional
135 135
 	 * @return array
136 136
 	 */
137
-	public function flat_options(){
137
+	public function flat_options() {
138 138
 		return $this->_flatten_select_options($this->options());
139 139
 	}
140 140
 
@@ -145,20 +145,20 @@  discard block
 block discarded – undo
145 145
 	 * @param array $arr
146 146
 	 * @return array
147 147
 	 */
148
-	protected function _flatten_select_options( $arr ){
148
+	protected function _flatten_select_options($arr) {
149 149
 		$flat_array = array();
150 150
 		EE_Registry::instance()->load_helper('Array');
151
-		if ( EEH_Array::is_multi_dimensional_array( $arr )) {
152
-			foreach( $arr as $sub_array ){
153
-				foreach( $sub_array as $key => $value ) {
154
-					$flat_array[ $key ] = $value;
155
-					$this->_set_label_size( $value );
151
+		if (EEH_Array::is_multi_dimensional_array($arr)) {
152
+			foreach ($arr as $sub_array) {
153
+				foreach ($sub_array as $key => $value) {
154
+					$flat_array[$key] = $value;
155
+					$this->_set_label_size($value);
156 156
 				}
157 157
 			}
158 158
 		} else {
159
-			foreach( $arr as $key => $value ) {
160
-				$flat_array[ $key ] = $value;
161
-				$this->_set_label_size( $value );
159
+			foreach ($arr as $key => $value) {
160
+				$flat_array[$key] = $value;
161
+				$this->_set_label_size($value);
162 162
 			}
163 163
 		}
164 164
 		return $flat_array;
@@ -170,18 +170,18 @@  discard block
 block discarded – undo
170 170
 	 * @param EE_Question_Option[] $question_options_array
171 171
 	 * @return array
172 172
 	 */
173
-	protected function _process_question_options( $question_options_array = array() ) {
173
+	protected function _process_question_options($question_options_array = array()) {
174 174
 		$flat_array = array();
175
-		foreach( $question_options_array as $question_option ) {
176
-			if ( $question_option instanceof EE_Question_Option ) {
175
+		foreach ($question_options_array as $question_option) {
176
+			if ($question_option instanceof EE_Question_Option) {
177 177
 				$desc = '';
178
-				if ( $this->_use_desc_in_label ) {
178
+				if ($this->_use_desc_in_label) {
179 179
 					$desc = $question_option->desc();
180
-					$desc = ! empty( $desc ) ? '<span class="ee-question-option-desc"> - ' . $desc . '</span>' : '';
180
+					$desc = ! empty($desc) ? '<span class="ee-question-option-desc"> - '.$desc.'</span>' : '';
181 181
 				}
182
-				$flat_array[ $question_option->value() ] = $question_option->value() . $desc;
183
-			} elseif ( is_array( $question_option )) {
184
-				$non_question_option = $this->_flatten_select_options( $question_option );
182
+				$flat_array[$question_option->value()] = $question_option->value().$desc;
183
+			} elseif (is_array($question_option)) {
184
+				$non_question_option = $this->_flatten_select_options($question_option);
185 185
 				$flat_array = $flat_array + $non_question_option;
186 186
 			}
187 187
 		}
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
 	 *    set_label_sizes
195 195
 	 * @return void
196 196
 	 */
197
-	public function set_label_sizes(){
197
+	public function set_label_sizes() {
198 198
 		// did the input settings specifically say to NOT set the label size dynamically ?
199
-		if ( ! $this->_enforce_label_size ) {
200
-			foreach( $this->_options as $option ) {
199
+		if ( ! $this->_enforce_label_size) {
200
+			foreach ($this->_options as $option) {
201 201
 				// calculate the strlen of the label
202
-				$this->_set_label_size( $option );
202
+				$this->_set_label_size($option);
203 203
 			}
204 204
 		}
205 205
 	}
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 	 * @param int|string $value
212 212
 	 * @return void
213 213
 	 */
214
-	private function _set_label_size( $value = '' ){
214
+	private function _set_label_size($value = '') {
215 215
 		// determine length of option value
216
-		$val_size = is_int( $value ) ? $value : strlen( $value );
216
+		$val_size = is_int($value) ? $value : strlen($value);
217 217
 		// use new value if bigger than existing
218 218
 		$this->_label_size = $val_size > $this->_label_size ? $val_size : $this->_label_size;
219 219
 	}
@@ -224,22 +224,22 @@  discard block
 block discarded – undo
224 224
 	 * 	get_label_size_class
225 225
 	 * @return string
226 226
 	 */
227
-	function get_label_size_class(){
227
+	function get_label_size_class() {
228 228
 		// use maximum option value length to determine label size
229
-		if( $this->_label_size < 3 ) {
229
+		if ($this->_label_size < 3) {
230 230
 			$size = ' nano-lbl';
231
-		} else if ( $this->_label_size < 6 ) {
232
-			$size =  ' micro-lbl';
233
-		} else if ( $this->_label_size < 12 ) {
234
-			$size =  ' tiny-lbl';
235
-		} else if ( $this->_label_size < 25 ) {
236
-			$size =  ' small-lbl';
237
-		} else if ( $this->_label_size < 50 ) {
238
-			$size =  ' medium-lbl';
239
-		} else if ( $this->_label_size >= 100 ) {
240
-			$size =  ' big-lbl';
231
+		} else if ($this->_label_size < 6) {
232
+			$size = ' micro-lbl';
233
+		} else if ($this->_label_size < 12) {
234
+			$size = ' tiny-lbl';
235
+		} else if ($this->_label_size < 25) {
236
+			$size = ' small-lbl';
237
+		} else if ($this->_label_size < 50) {
238
+			$size = ' medium-lbl';
239
+		} else if ($this->_label_size >= 100) {
240
+			$size = ' big-lbl';
241 241
 		} else {
242
-			$size =  ' medium-lbl';
242
+			$size = ' medium-lbl';
243 243
 		}
244 244
 		return $size;
245 245
 	}
@@ -248,21 +248,21 @@  discard block
 block discarded – undo
248 248
 	 * Returns the pretty value for the normalized value
249 249
 	 * @return string
250 250
 	 */
251
-	function pretty_value(){
251
+	function pretty_value() {
252 252
 		$options = $this->flat_options();
253
-		$unnormalized_value_choices = $this->get_normalization_strategy()->unnormalize( $this->_normalized_value );
254
-		if( ! $this->_multiple_selections ){
255
-			$unnormalized_value_choices = array( $unnormalized_value_choices );
253
+		$unnormalized_value_choices = $this->get_normalization_strategy()->unnormalize($this->_normalized_value);
254
+		if ( ! $this->_multiple_selections) {
255
+			$unnormalized_value_choices = array($unnormalized_value_choices);
256 256
 		}
257 257
 		$pretty_strings = array();
258
-		foreach( $unnormalized_value_choices as $unnormalized_value_choice ){
259
-			if( isset( $options[ $unnormalized_value_choice ] ) ){
260
-				$pretty_strings[] =  $options[ $unnormalized_value_choice ];
261
-			}else{
258
+		foreach ($unnormalized_value_choices as $unnormalized_value_choice) {
259
+			if (isset($options[$unnormalized_value_choice])) {
260
+				$pretty_strings[] = $options[$unnormalized_value_choice];
261
+			} else {
262 262
 				$pretty_strings[] = $this->normalized_value();
263 263
 			}
264 264
 		}
265
-		return implode(", ", $pretty_strings );
265
+		return implode(", ", $pretty_strings);
266 266
 	}
267 267
 
268 268
 
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
 	/**
280 280
 	 * @param boolean $display_html_label_text
281 281
 	 */
282
-	public function set_display_html_label_text( $display_html_label_text ) {
283
-		$this->_display_html_label_text = filter_var( $display_html_label_text, FILTER_VALIDATE_BOOLEAN );
282
+	public function set_display_html_label_text($display_html_label_text) {
283
+		$this->_display_html_label_text = filter_var($display_html_label_text, FILTER_VALIDATE_BOOLEAN);
284 284
 	}
285 285
 
286 286
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 			}
108 108
 			if( $all_ints ){
109 109
 				$normalization = new EE_Int_Normalization();
110
-			}else{
110
+			} else{
111 111
 				$normalization = new EE_Text_Normalization();
112 112
 			}
113 113
 		}
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 		foreach( $unnormalized_value_choices as $unnormalized_value_choice ){
259 259
 			if( isset( $options[ $unnormalized_value_choice ] ) ){
260 260
 				$pretty_strings[] =  $options[ $unnormalized_value_choice ];
261
-			}else{
261
+			} else{
262 262
 				$pretty_strings[] = $this->normalized_value();
263 263
 			}
264 264
 		}
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Hidden_Input.input.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,20 +6,20 @@
 block discarded – undo
6 6
  * @subpackage
7 7
  * @author				Mike Nelson
8 8
  */
9
-class EE_Hidden_Input extends EE_Form_Input_Base{
9
+class EE_Hidden_Input extends EE_Form_Input_Base {
10 10
 
11 11
 	/**
12 12
 	 * @param array $input_settings
13 13
 	 */
14
-	function __construct($input_settings = array()){
14
+	function __construct($input_settings = array()) {
15 15
 		//require_once('strategies/display_strategies/EE_Text_Input_Display_Strategy.strategy.php');
16 16
 		$this->_set_display_strategy(new EE_Hidden_Display_Strategy());
17
-		if ( isset( $input_settings['normalization_strategy'] ) && $input_settings['normalization_strategy'] instanceof EE_Normalization_Strategy_Base ) {
18
-			$this->_set_normalization_strategy( $input_settings['normalization_strategy'] );
17
+		if (isset($input_settings['normalization_strategy']) && $input_settings['normalization_strategy'] instanceof EE_Normalization_Strategy_Base) {
18
+			$this->_set_normalization_strategy($input_settings['normalization_strategy']);
19 19
 		} else {
20
-			$this->_set_normalization_strategy( new EE_Text_Normalization() );
20
+			$this->_set_normalization_strategy(new EE_Text_Normalization());
21 21
 		}
22
-		parent::__construct( $input_settings );
22
+		parent::__construct($input_settings);
23 23
 	}
24 24
 
25 25
 
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Month_Input.input.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,14 +6,14 @@  discard block
 block discarded – undo
6 6
  * @subpackage
7 7
  * @author				Mike Nelson
8 8
  */
9
-class EE_Month_Input extends EE_Select_Input{
9
+class EE_Month_Input extends EE_Select_Input {
10 10
 
11 11
 	/**
12 12
 	 * @param bool  $leading_zero
13 13
 	 * @param array $input_settings
14 14
 	 */
15
-	function __construct( $leading_zero = false, $input_settings = array()){
16
-		if($leading_zero){
15
+	function __construct($leading_zero = false, $input_settings = array()) {
16
+		if ($leading_zero) {
17 17
 			$select_options = array(
18 18
 			'01'=>'01',
19 19
 			'02'=>'02',
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 			'11'=>'11',
29 29
 			'12'=>'12'
30 30
 			);
31
-		}else{
31
+		} else {
32 32
 			$select_options = array(
33 33
 				1=>'01',
34 34
 				2=>'02',
@@ -44,6 +44,6 @@  discard block
 block discarded – undo
44 44
 				12=>'12'
45 45
 			);
46 46
 		}
47
-		parent::__construct($select_options,$input_settings);
47
+		parent::__construct($select_options, $input_settings);
48 48
 	}
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 			'11'=>'11',
29 29
 			'12'=>'12'
30 30
 			);
31
-		}else{
31
+		} else{
32 32
 			$select_options = array(
33 33
 				1=>'01',
34 34
 				2=>'02',
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Password_Input.input.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,17 +6,17 @@
 block discarded – undo
6 6
  * @subpackage
7 7
  * @author				Mike Nelson
8 8
  */
9
-class EE_Password_Input extends EE_Form_Input_Base{
9
+class EE_Password_Input extends EE_Form_Input_Base {
10 10
 
11 11
 
12 12
 	/**
13 13
 	 * @param array $input_settings
14 14
 	 */
15
-	function __construct($input_settings = array()){
15
+	function __construct($input_settings = array()) {
16 16
 		$this->_set_display_strategy(new EE_Text_Input_Display_Strategy('password'));
17 17
 		$this->_set_normalization_strategy(new EE_Text_Normalization());
18 18
 		parent::__construct($input_settings);
19
-		$this->set_html_class( $this->html_class() . 'password' );
19
+		$this->set_html_class($this->html_class().'password');
20 20
 	}
21 21
 
22 22
 
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Phone_Input.input.php 1 patch
Spacing   +6 added lines, -6 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
 /**
@@ -15,13 +15,13 @@  discard block
 block discarded – undo
15 15
  * @author				Mike Nelson
16 16
  *
17 17
  */
18
-class EE_Phone_Input extends EE_Text_Input{
18
+class EE_Phone_Input extends EE_Text_Input {
19 19
 	/**
20 20
 	 * @param array $options
21 21
 	 */
22
-	function __construct($options = array()){
23
-		$this->_add_validation_strategy( new EE_Text_Validation_Strategy( __( 'Please enter a valid phone number. Eg 123-456-7890 or 1234567890', 'event_espresso' ), '~^([\d]{10})|([\d]{3}-[\d]{3}-[\d]{4})$~'));
24
-		parent::__construct( $options );
22
+	function __construct($options = array()) {
23
+		$this->_add_validation_strategy(new EE_Text_Validation_Strategy(__('Please enter a valid phone number. Eg 123-456-7890 or 1234567890', 'event_espresso'), '~^([\d]{10})|([\d]{3}-[\d]{3}-[\d]{4})$~'));
24
+		parent::__construct($options);
25 25
 	}
26 26
 }
27 27
 
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Radio_Button_Input.input.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3 3
  *
4 4
  * Class EE_Radio_Button_Input
@@ -11,17 +11,17 @@  discard block
 block discarded – undo
11 11
  * @since 				$VID:$
12 12
  *
13 13
  */
14
-class EE_Radio_Button_Input extends EE_Form_Input_With_Options_Base{
14
+class EE_Radio_Button_Input extends EE_Form_Input_With_Options_Base {
15 15
 
16 16
 	/**
17 17
 	 * @param array $answer_options
18 18
 	 * @param array $input_settings
19 19
 	 */
20
-	function __construct( $answer_options, $input_settings = array() ){
21
-		$this->_set_display_strategy( new EE_Radio_Button_Display_Strategy() );
22
-		$this->_add_validation_strategy( new EE_Enum_Validation_Strategy( isset( $input_settings[ 'validation_error_message' ] ) ? $input_settings[ 'validation_error_message' ] : NULL ) );
20
+	function __construct($answer_options, $input_settings = array()) {
21
+		$this->_set_display_strategy(new EE_Radio_Button_Display_Strategy());
22
+		$this->_add_validation_strategy(new EE_Enum_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : NULL));
23 23
 		$this->_multiple_selections = FALSE;
24
-		parent::__construct( $answer_options, $input_settings );
24
+		parent::__construct($answer_options, $input_settings);
25 25
 	}
26 26
 
27 27
 }
28 28
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Select_Input.input.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php  if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); }
1
+<?php  if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3 3
  * Class EE_Select_Input
4 4
  *
@@ -10,16 +10,16 @@  discard block
 block discarded – undo
10 10
  * @since 				4.6
11 11
  *
12 12
  */
13
-class EE_Select_Input extends EE_Form_Input_With_Options_Base{
13
+class EE_Select_Input extends EE_Form_Input_With_Options_Base {
14 14
 
15 15
 	/**
16 16
 	 * @param array $answer_options
17 17
 	 * @param array $input_settings
18 18
 	 */
19
-	function __construct( $answer_options, $input_settings = array() ){
20
-		$this->_set_display_strategy( new EE_Select_Display_Strategy( $answer_options ));
21
-		$this->_add_validation_strategy( new EE_Enum_Validation_Strategy( isset( $input_settings[ 'validation_error_message' ] ) ? $input_settings[ 'validation_error_message' ] : NULL ) );
22
-		parent::__construct( $answer_options, $input_settings );
19
+	function __construct($answer_options, $input_settings = array()) {
20
+		$this->_set_display_strategy(new EE_Select_Display_Strategy($answer_options));
21
+		$this->_add_validation_strategy(new EE_Enum_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : NULL));
22
+		parent::__construct($answer_options, $input_settings);
23 23
 	}
24 24
 
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.