@@ -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 | } |
@@ -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 { |
@@ -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 |
@@ -6,14 +6,14 @@ |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_Yes_No_Input extends EE_Select_Input{ |
|
9 | +class EE_Yes_No_Input extends EE_Select_Input { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @param array $options |
13 | 13 | */ |
14 | - function __construct( $options = array()){ |
|
15 | - $select_options = array(true=> __("Yes", "event_espresso"),false=> __("No", "event_espresso")); |
|
14 | + function __construct($options = array()) { |
|
15 | + $select_options = array(true=> __("Yes", "event_espresso"), false=> __("No", "event_espresso")); |
|
16 | 16 | |
17 | - parent::__construct($select_options,$options); |
|
17 | + parent::__construct($select_options, $options); |
|
18 | 18 | } |
19 | 19 | } |
@@ -1,6 +1,6 @@ discard block |
||
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 | /** |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_Hidden_Display_Strategy extends EE_Display_Strategy_Base{ |
|
28 | +class EE_Hidden_Display_Strategy extends EE_Display_Strategy_Base { |
|
29 | 29 | /** |
30 | 30 | * |
31 | 31 | * @return string of html to display the HIDDEN field |
32 | 32 | */ |
33 | - function display(){ |
|
33 | + function display() { |
|
34 | 34 | $input = $this->_input; |
35 | 35 | return "<input type='hidden' id='{$input->html_id()}' name='{$input->html_name()}' class='{$input->html_class()}' style='{$input->html_style()}' value='{$input->raw_value_in_form()}'/>"; |
36 | 36 | } |
@@ -1,7 +1,8 @@ |
||
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 | * Event Espresso |
7 | 8 | * |
@@ -1,7 +1,8 @@ discard block |
||
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 |
@@ -53,7 +54,7 @@ discard block |
||
53 | 54 | EEH_HTML::indent( 1, 'select' ); |
54 | 55 | if( EEH_Array::is_multi_dimensional_array( $this->_input->options() )){ |
55 | 56 | throw new EE_Error(sprintf(__("Select multiple display strategy does not allow for nested arrays of options.", "event_espresso"))); |
56 | - }else{ |
|
57 | + } else{ |
|
57 | 58 | $html.=$this->_display_options( $this->_input->options() ); |
58 | 59 | } |
59 | 60 |
@@ -1,6 +1,6 @@ discard block |
||
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 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_Select_Multiple_Display_Strategy extends EE_Select_Display_Strategy{ |
|
28 | +class EE_Select_Multiple_Display_Strategy extends EE_Select_Display_Strategy { |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * |
@@ -34,31 +34,31 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function display() { |
36 | 36 | |
37 | - if( ! $this->_input instanceof EE_Form_Input_With_Options_Base){ |
|
37 | + if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base) { |
|
38 | 38 | throw new EE_Error(sprintf(__('Cannot use Select Multiple Display Strategy with an input that doesn\'t have options', "event_espresso"))); |
39 | 39 | } |
40 | 40 | |
41 | - $html = EEH_HTML::nl( 0, 'select' ); |
|
41 | + $html = EEH_HTML::nl(0, 'select'); |
|
42 | 42 | $html .= '<select multiple'; |
43 | - $html .= ' id="' . $this->_input->html_id() . '"'; |
|
44 | - $html .= ' name="' . $this->_input->html_name() . '[]"'; |
|
45 | - $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class(); |
|
46 | - $html .= ' class="' . $class . '"'; |
|
43 | + $html .= ' id="'.$this->_input->html_id().'"'; |
|
44 | + $html .= ' name="'.$this->_input->html_name().'[]"'; |
|
45 | + $class = $this->_input->required() ? $this->_input->required_css_class().' '.$this->_input->html_class() : $this->_input->html_class(); |
|
46 | + $html .= ' class="'.$class.'"'; |
|
47 | 47 | // add html5 required |
48 | 48 | $html .= $this->_input->required() ? ' required' : ''; |
49 | - $html .= ' style="' . $this->_input->html_style() . '"'; |
|
50 | - $html .= ' ' . $this->_input->other_html_attributes(); |
|
49 | + $html .= ' style="'.$this->_input->html_style().'"'; |
|
50 | + $html .= ' '.$this->_input->other_html_attributes(); |
|
51 | 51 | $html .= '>'; |
52 | 52 | |
53 | 53 | EE_Registry::instance()->load_helper('Array'); |
54 | - EEH_HTML::indent( 1, 'select' ); |
|
55 | - if( EEH_Array::is_multi_dimensional_array( $this->_input->options() )){ |
|
54 | + EEH_HTML::indent(1, 'select'); |
|
55 | + if (EEH_Array::is_multi_dimensional_array($this->_input->options())) { |
|
56 | 56 | throw new EE_Error(sprintf(__("Select multiple display strategy does not allow for nested arrays of options.", "event_espresso"))); |
57 | - }else{ |
|
58 | - $html.=$this->_display_options( $this->_input->options() ); |
|
57 | + } else { |
|
58 | + $html .= $this->_display_options($this->_input->options()); |
|
59 | 59 | } |
60 | 60 | |
61 | - $html.= EEH_HTML::nl( -1, 'select' ) . "</select>"; |
|
61 | + $html .= EEH_HTML::nl( -1, 'select' )."</select>"; |
|
62 | 62 | return $html; |
63 | 63 | } |
64 | 64 | |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | * @param string|int $value unnormalized value option (string) |
70 | 70 | * @return boolean |
71 | 71 | */ |
72 | - protected function _check_if_option_selected( $value ){ |
|
72 | + protected function _check_if_option_selected($value) { |
|
73 | 73 | $selected_options = $this->_input->raw_value(); |
74 | - if ( empty( $selected_options )){ |
|
74 | + if (empty($selected_options)) { |
|
75 | 75 | return FALSE; |
76 | 76 | } |
77 | - return in_array( $value, $selected_options ) ? TRUE : FALSE; |
|
77 | + return in_array($value, $selected_options) ? TRUE : FALSE; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 |
@@ -1,15 +1,15 @@ |
||
1 | 1 | <?php |
2 | -class EE_Submit_Input_Display_Strategy extends EE_Display_Strategy_Base{ |
|
2 | +class EE_Submit_Input_Display_Strategy extends EE_Display_Strategy_Base { |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * @return string of html to display the input |
6 | 6 | */ |
7 | - function display(){ |
|
7 | + function display() { |
|
8 | 8 | $html = '<input type="submit" '; |
9 | - $html .= 'value="' . $this->_input->raw_value_in_form() . '" '; |
|
10 | - $html .= 'id="' . $this->_input->html_id() . '-submit" '; |
|
11 | - $html .= 'class="' . $this->_input->html_class() . ' ' . $this->_input->button_css_attributes() . '" '; |
|
12 | - $html .= 'style="' . $this->_input->html_style() . '" '; |
|
9 | + $html .= 'value="'.$this->_input->raw_value_in_form().'" '; |
|
10 | + $html .= 'id="'.$this->_input->html_id().'-submit" '; |
|
11 | + $html .= 'class="'.$this->_input->html_class().' '.$this->_input->button_css_attributes().'" '; |
|
12 | + $html .= 'style="'.$this->_input->html_style().'" '; |
|
13 | 13 | $html .= $this->_input->other_html_attributes(); |
14 | 14 | $html .= '/>'; |
15 | 15 | return $html; |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_Fieldset_Section_Layout |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since $VID:$ |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_Fieldset_Section_Layout |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since $VID:$ |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_Fieldset_Section_Layout extends EE_Div_Per_Section_Layout{ |
15 | 15 | |
16 | 16 | /** |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @since $VID:$ |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Fieldset_Section_Layout extends EE_Div_Per_Section_Layout{ |
|
14 | +class EE_Fieldset_Section_Layout extends EE_Div_Per_Section_Layout { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * legend_class |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @param array $options |
34 | 34 | */ |
35 | - function __construct( $options = array() ){ |
|
36 | - foreach( $options as $key => $value ) { |
|
37 | - $key = '_' . $key; |
|
38 | - if ( property_exists( $this, $key )) { |
|
35 | + function __construct($options = array()) { |
|
36 | + foreach ($options as $key => $value) { |
|
37 | + $key = '_'.$key; |
|
38 | + if (property_exists($this, $key)) { |
|
39 | 39 | $this->$key = $value; |
40 | 40 | } |
41 | 41 | } |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @return string |
48 | 48 | */ |
49 | 49 | public function layout_form_begin() { |
50 | - $html = EEH_HTML::nl(1) . '<fieldset id="' . $this->_form_section->html_id() . '" class="' . $this->_form_section->html_class() . '" style="' . $this->_form_section->html_style() . '">'; |
|
51 | - $html .= '<legend class="' . $this->legend_class() . '">' . $this->legend_text() . '</legend>'; |
|
50 | + $html = EEH_HTML::nl(1).'<fieldset id="'.$this->_form_section->html_id().'" class="'.$this->_form_section->html_class().'" style="'.$this->_form_section->html_style().'">'; |
|
51 | + $html .= '<legend class="'.$this->legend_class().'">'.$this->legend_text().'</legend>'; |
|
52 | 52 | return $html; |
53 | 53 | } |
54 | 54 | |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | * closing div tag for a form |
59 | 59 | * @return string |
60 | 60 | */ |
61 | - public function layout_form_end(){ |
|
62 | - return EEH_HTML::nl(-1) . '</fieldset>'; |
|
61 | + public function layout_form_end() { |
|
62 | + return EEH_HTML::nl(-1).'</fieldset>'; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /** |
68 | 68 | * @param string $legend_class |
69 | 69 | */ |
70 | - public function set_legend_class( $legend_class ) { |
|
70 | + public function set_legend_class($legend_class) { |
|
71 | 71 | $this->_legend_class = $legend_class; |
72 | 72 | } |
73 | 73 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | /** |
86 | 86 | * @param string $legend_text |
87 | 87 | */ |
88 | - public function set_legend_text( $legend_text ) { |
|
88 | + public function set_legend_text($legend_text) { |
|
89 | 89 | $this->_legend_text = $legend_text; |
90 | 90 | } |
91 | 91 |