@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -15,13 +15,13 @@ discard block |
||
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 |
@@ -1,4 +1,4 @@ discard block |
||
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 |
||
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 |
@@ -1,4 +1,4 @@ discard block |
||
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 |
||
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 |
@@ -1,15 +1,15 @@ |
||
1 | 1 | <?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); } |
2 | 2 | /** |
3 | - * Class EE_Select_Input |
|
4 | - * |
|
5 | - * Generates an HTML <select> form input |
|
6 | - * |
|
7 | - * @package Event Espresso |
|
8 | - * @subpackage core |
|
9 | - * @author Mike Nelson |
|
10 | - * @since 4.6 |
|
11 | - * |
|
12 | - */ |
|
3 | + * Class EE_Select_Input |
|
4 | + * |
|
5 | + * Generates an HTML <select> form input |
|
6 | + * |
|
7 | + * @package Event Espresso |
|
8 | + * @subpackage core |
|
9 | + * @author Mike Nelson |
|
10 | + * @since 4.6 |
|
11 | + * |
|
12 | + */ |
|
13 | 13 | class EE_Select_Input extends EE_Form_Input_With_Options_Base{ |
14 | 14 | |
15 | 15 | /** |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage |
9 | 9 | * @author Mike Nelson |
10 | 10 | */ |
11 | -class EE_Select_Multi_Model_Input extends EE_Select_Multiple_Input{ |
|
11 | +class EE_Select_Multi_Model_Input extends EE_Select_Multiple_Input { |
|
12 | 12 | |
13 | 13 | |
14 | 14 | protected $_naming_method; |
@@ -24,18 +24,18 @@ discard block |
||
24 | 24 | * example: if the class were an EE_Event, this could be slug(), description(), name() (default) |
25 | 25 | * } |
26 | 26 | */ |
27 | - public function __construct( $answer_options = array(), $input_settings = array() ) { |
|
28 | - if( isset( $input_settings['naming_method'] )){ |
|
29 | - $this->set_option_naming_method( $input_settings['naming_method'] ); |
|
27 | + public function __construct($answer_options = array(), $input_settings = array()) { |
|
28 | + if (isset($input_settings['naming_method'])) { |
|
29 | + $this->set_option_naming_method($input_settings['naming_method']); |
|
30 | 30 | } |
31 | - parent::__construct( $answer_options, $input_settings ); |
|
31 | + parent::__construct($answer_options, $input_settings); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Sets the method name which will be called when outputting the options list |
36 | 36 | * @param string $method |
37 | 37 | */ |
38 | - public function set_option_naming_method($method){ |
|
38 | + public function set_option_naming_method($method) { |
|
39 | 39 | $this->_naming_method = $method; |
40 | 40 | } |
41 | 41 | |
@@ -46,16 +46,16 @@ discard block |
||
46 | 46 | * @param EE_Base_Class[] $answer_options |
47 | 47 | * @return null|void |
48 | 48 | */ |
49 | - public function set_select_options( $answer_options = array() ) { |
|
49 | + public function set_select_options($answer_options = array()) { |
|
50 | 50 | //convert the model objects to select from into normal select options |
51 | 51 | $select_options = array(); |
52 | - foreach( $answer_options as $model_obj ){ |
|
53 | - if( $this->_naming_method ){ |
|
54 | - $display_value = call_user_func( array( $model_obj, $this->_naming_method )); |
|
55 | - }else{ |
|
52 | + foreach ($answer_options as $model_obj) { |
|
53 | + if ($this->_naming_method) { |
|
54 | + $display_value = call_user_func(array($model_obj, $this->_naming_method)); |
|
55 | + } else { |
|
56 | 56 | $display_value = $model_obj->name(); |
57 | 57 | } |
58 | - $select_options[ $model_obj->ID() ] = $display_value; |
|
58 | + $select_options[$model_obj->ID()] = $display_value; |
|
59 | 59 | } |
60 | 60 | parent::set_select_options($select_options); |
61 | 61 | } |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | * into the format EE_Select_Multiple expects |
68 | 68 | * @param EE_Base_Class[]|array $values |
69 | 69 | */ |
70 | - public function set_default($values){ |
|
70 | + public function set_default($values) { |
|
71 | 71 | $defaults_as_simple_ids = array(); |
72 | - foreach($values as $key => $value){ |
|
73 | - if($value instanceof EE_Base_Class){ |
|
72 | + foreach ($values as $key => $value) { |
|
73 | + if ($value instanceof EE_Base_Class) { |
|
74 | 74 | $defaults_as_simple_ids[] = $value->ID(); |
75 | - }else{ |
|
75 | + } else { |
|
76 | 76 | $defaults_as_simple_ids[] = $value; |
77 | 77 | } |
78 | 78 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | foreach( $answer_options as $model_obj ){ |
53 | 53 | if( $this->_naming_method ){ |
54 | 54 | $display_value = call_user_func( array( $model_obj, $this->_naming_method )); |
55 | - }else{ |
|
55 | + } else{ |
|
56 | 56 | $display_value = $model_obj->name(); |
57 | 57 | } |
58 | 58 | $select_options[ $model_obj->ID() ] = $display_value; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | foreach($values as $key => $value){ |
73 | 73 | if($value instanceof EE_Base_Class){ |
74 | 74 | $defaults_as_simple_ids[] = $value->ID(); |
75 | - }else{ |
|
75 | + } else{ |
|
76 | 76 | $defaults_as_simple_ids[] = $value; |
77 | 77 | } |
78 | 78 | } |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * EE_Select_Multi_Model_Input |
|
4 | - * Just like EE_Select_Multiple_Input, except the array of options is an array of |
|
5 | - * model objects, and the optional 'default' param CAN be an array of model objects too |
|
6 | - * |
|
7 | - * @package Event Espresso |
|
8 | - * @subpackage |
|
9 | - * @author Mike Nelson |
|
10 | - */ |
|
3 | + * EE_Select_Multi_Model_Input |
|
4 | + * Just like EE_Select_Multiple_Input, except the array of options is an array of |
|
5 | + * model objects, and the optional 'default' param CAN be an array of model objects too |
|
6 | + * |
|
7 | + * @package Event Espresso |
|
8 | + * @subpackage |
|
9 | + * @author Mike Nelson |
|
10 | + */ |
|
11 | 11 | class EE_Select_Multi_Model_Input extends EE_Select_Multiple_Input{ |
12 | 12 | |
13 | 13 |
@@ -6,17 +6,17 @@ |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_Select_Multiple_Input extends EE_Form_Input_With_Options_Base{ |
|
9 | +class EE_Select_Multiple_Input extends EE_Form_Input_With_Options_Base { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @param array | EE_Question_Option[] $answer_options |
13 | 13 | * @param array $input_settings |
14 | 14 | */ |
15 | - public function __construct( $answer_options, $input_settings = array() ) { |
|
16 | - $this->_set_display_strategy( new EE_Select_Multiple_Display_Strategy() ); |
|
17 | - $this->_add_validation_strategy( new EE_Many_Valued_Validation_Strategy( array( new EE_Enum_Validation_Strategy( isset( $input_settings[ 'validation_error_message' ] ) ? $input_settings[ 'validation_error_message' ] : NULL ) ))); |
|
15 | + public function __construct($answer_options, $input_settings = array()) { |
|
16 | + $this->_set_display_strategy(new EE_Select_Multiple_Display_Strategy()); |
|
17 | + $this->_add_validation_strategy(new EE_Many_Valued_Validation_Strategy(array(new EE_Enum_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : NULL)))); |
|
18 | 18 | $this->_multiple_selections = TRUE; |
19 | - parent::__construct( $answer_options, $input_settings ); |
|
19 | + parent::__construct($answer_options, $input_settings); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | } |
@@ -6,19 +6,19 @@ discard block |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_State_Select_Input extends EE_Select_Input{ |
|
9 | +class EE_State_Select_Input extends EE_Select_Input { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @param array $state_options |
13 | 13 | * @param array $input_settings |
14 | 14 | */ |
15 | - function __construct( $state_options, $input_settings = array() ){ |
|
15 | + function __construct($state_options, $input_settings = array()) { |
|
16 | 16 | $state_options = apply_filters( |
17 | 17 | 'FHEE__EE_State_Select_Input____construct__state_options', |
18 | - $this->get_state_answer_options( $state_options ), |
|
18 | + $this->get_state_answer_options($state_options), |
|
19 | 19 | $this |
20 | 20 | ); |
21 | - parent::__construct( $state_options, $input_settings ); |
|
21 | + parent::__construct($state_options, $input_settings); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
@@ -29,17 +29,17 @@ discard block |
||
29 | 29 | * @param array $state_options |
30 | 30 | * @return array |
31 | 31 | */ |
32 | - public function get_state_answer_options( $state_options = NULL ){ |
|
32 | + public function get_state_answer_options($state_options = NULL) { |
|
33 | 33 | // if passed something that is NOT an array |
34 | - if ( ! is_array( $state_options )) { |
|
34 | + if ( ! is_array($state_options)) { |
|
35 | 35 | // get possibly cached list of states |
36 | 36 | $states = EEM_State::instance()->get_all_active_states(); |
37 | - if ( ! empty( $states )) { |
|
37 | + if ( ! empty($states)) { |
|
38 | 38 | //set the default |
39 | 39 | $state_options[''][''] = ''; |
40 | - foreach( $states as $state ){ |
|
41 | - if ( $state instanceof EE_State ) { |
|
42 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
40 | + foreach ($states as $state) { |
|
41 | + if ($state instanceof EE_State) { |
|
42 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } else { |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * EE_State_Select_Input |
|
4 | - * |
|
5 | - * @package Event Espresso |
|
6 | - * @subpackage |
|
7 | - * @author Mike Nelson |
|
8 | - */ |
|
3 | + * EE_State_Select_Input |
|
4 | + * |
|
5 | + * @package Event Espresso |
|
6 | + * @subpackage |
|
7 | + * @author Mike Nelson |
|
8 | + */ |
|
9 | 9 | class EE_State_Select_Input extends EE_Select_Input{ |
10 | 10 | |
11 | 11 | /** |
@@ -8,15 +8,15 @@ |
||
8 | 8 | * |
9 | 9 | * This input has a default validation strategy of plaintext (which can be removed after construction) |
10 | 10 | */ |
11 | -class EE_Submit_Input extends EE_Form_Input_Base{ |
|
11 | +class EE_Submit_Input extends EE_Form_Input_Base { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param array $options |
15 | 15 | */ |
16 | - function __construct($options = array()){ |
|
16 | + function __construct($options = array()) { |
|
17 | 17 | $this->_set_display_strategy(new EE_Submit_Input_Display_Strategy()); |
18 | 18 | $this->_set_normalization_strategy(new EE_Text_Normalization()); |
19 | - $this->_add_validation_strategy( new EE_Plaintext_Validation_Strategy() ); |
|
19 | + $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
20 | 20 | parent::__construct($options); |
21 | 21 | } |
22 | 22 | } |
23 | 23 | \ No newline at end of file |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * |
9 | 9 | * This input has a default validation strategy of plaintext (which can be removed after construction) |
10 | 10 | */ |
11 | -class EE_Text_Area_Input extends EE_Form_Input_Base{ |
|
11 | +class EE_Text_Area_Input extends EE_Form_Input_Base { |
|
12 | 12 | |
13 | 13 | |
14 | 14 | protected $_rows = 2; |
@@ -18,28 +18,28 @@ discard block |
||
18 | 18 | * sets the rows property on this input |
19 | 19 | * @param int $rows |
20 | 20 | */ |
21 | - public function set_rows( $rows ) { |
|
21 | + public function set_rows($rows) { |
|
22 | 22 | $this->_rows = $rows; |
23 | 23 | } |
24 | 24 | /** |
25 | 25 | * sets the cols html property on this input |
26 | 26 | * @param int $cols |
27 | 27 | */ |
28 | - public function set_cols( $cols ) { |
|
28 | + public function set_cols($cols) { |
|
29 | 29 | $this->_cols = $cols; |
30 | 30 | } |
31 | 31 | /** |
32 | 32 | * |
33 | 33 | * @return int |
34 | 34 | */ |
35 | - public function get_rows(){ |
|
35 | + public function get_rows() { |
|
36 | 36 | return $this->_rows; |
37 | 37 | } |
38 | 38 | /** |
39 | 39 | * |
40 | 40 | * @return int |
41 | 41 | */ |
42 | - public function get_cols(){ |
|
42 | + public function get_cols() { |
|
43 | 43 | return $this->_cols; |
44 | 44 | } |
45 | 45 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $this->_set_normalization_strategy(new EE_Text_Normalization()); |
54 | 54 | //by default we use the plaintext validation. If you want something else, |
55 | 55 | //just remove it after the input is constructed :P using EE_Form_Input_Base::remove_validation_strategy() |
56 | - $this->_add_validation_strategy( new EE_Plaintext_Validation_Strategy() ); |
|
56 | + $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
57 | 57 | parent::__construct($options_array); |
58 | 58 | } |
59 | 59 | } |
@@ -8,18 +8,18 @@ |
||
8 | 8 | * |
9 | 9 | * This input has a default validation strategy of plaintext (which can be removed after construction) |
10 | 10 | */ |
11 | -class EE_Text_Input extends EE_Form_Input_Base{ |
|
11 | +class EE_Text_Input extends EE_Form_Input_Base { |
|
12 | 12 | |
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @param array $options |
16 | 16 | */ |
17 | - function __construct($options = array()){ |
|
17 | + function __construct($options = array()) { |
|
18 | 18 | $this->_set_display_strategy(new EE_Text_Input_Display_Strategy()); |
19 | 19 | $this->_set_normalization_strategy(new EE_Text_Normalization()); |
20 | 20 | //by default we use the plaintext validation. If you want something else, |
21 | 21 | //just remove it after the input is constructed :P using EE_Form_Input_Base::remove_validation_strategy() |
22 | - $this->_add_validation_strategy( new EE_Plaintext_Validation_Strategy() ); |
|
22 | + $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
23 | 23 | parent::__construct($options); |
24 | 24 | } |
25 | 25 |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * EE_Year_Input |
|
4 | - * |
|
5 | - * @package Event Espresso |
|
6 | - * @subpackage |
|
7 | - * @author Mike Nelson |
|
8 | - * |
|
9 | - * This input has a default validation strategy of plaintext (which can be removed after construction) |
|
10 | - */ |
|
3 | + * EE_Year_Input |
|
4 | + * |
|
5 | + * @package Event Espresso |
|
6 | + * @subpackage |
|
7 | + * @author Mike Nelson |
|
8 | + * |
|
9 | + * This input has a default validation strategy of plaintext (which can be removed after construction) |
|
10 | + */ |
|
11 | 11 | class EE_Text_Input extends EE_Form_Input_Base{ |
12 | 12 | |
13 | 13 |