Completed
Branch BUG-9647-cpt-queries (308763)
by
unknown
761:16 queued 742:07
created
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_Multi_Model_Input.input.php 2 patches
Spacing   +16 added lines, -16 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
-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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Select_Multiple_Input.input.php 1 patch
Spacing   +5 added lines, -5 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_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
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_State_Select_Input.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,19 +6,19 @@  discard block
 block discarded – undo
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
 block discarded – undo
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 {
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Submit_Input.input.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,15 +8,15 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Yes_No_Input.input.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,14 +6,14 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
libraries/form_sections/strategies/EE_Form_Input_Strategy_Base.strategy.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@  discard block
 block discarded – undo
3 3
  * base class for all strategies which operate on form inputs. Generally, they
4 4
  * all need to know about the form input they are operating on.
5 5
  */
6
-abstract class EE_Form_Input_Strategy_Base{
6
+abstract class EE_Form_Input_Strategy_Base {
7 7
 	/**
8 8
 	 * Form Input to display
9 9
 	 * @var EE_Form_Input_Base
10 10
 	 */
11 11
 	protected $_input;
12 12
 	
13
-	function __construct(){
13
+	function __construct() {
14 14
 		
15 15
 	}
16 16
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * The form input on which this strategy is to perform
19 19
 	 * @param EE_Form_Input_Base $form_input
20 20
 	 */
21
-	function _construct_finalize(EE_Form_Input_Base $form_input){
21
+	function _construct_finalize(EE_Form_Input_Base $form_input) {
22 22
 		$this->_input = $form_input;
23 23
 	}
24 24
 }
25 25
\ No newline at end of file
Please login to merge, or discard this patch.
form_sections/strategies/display/EE_Checkbox_Display_Strategy.strategy.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,51 +11,51 @@
 block discarded – undo
11 11
  * @since 				$VID:$
12 12
  *
13 13
  */
14
-class EE_Checkbox_Display_Strategy extends EE_Display_Strategy_Base{
14
+class EE_Checkbox_Display_Strategy extends EE_Display_Strategy_Base {
15 15
 
16 16
 	/**
17 17
 	 *
18 18
 	 * @throws EE_Error
19 19
 	 * @return string of html to display the field
20 20
 	 */
21
-	function display(){
22
-		if( ! $this->_input instanceof EE_Form_Input_With_Options_Base ){
21
+	function display() {
22
+		if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base) {
23 23
 			throw new EE_Error(sprintf(__("Cannot use Checkbox Display Strategy with an input that doesn't have options", "event_espresso")));
24 24
 		}
25 25
 		//d( $this->_input );
26
-		$multi = count( $this->_input->options() ) > 1 ? TRUE : FALSE;
26
+		$multi = count($this->_input->options()) > 1 ? TRUE : FALSE;
27 27
 		$this->_input->set_label_sizes();
28 28
 		$label_size_class = $this->_input->get_label_size_class();
29 29
 		$html = '';
30
-		if ( ! is_array( $this->_input->raw_value() ) && $this->_input->raw_value() !== NULL ) {
30
+		if ( ! is_array($this->_input->raw_value()) && $this->_input->raw_value() !== NULL) {
31 31
 			EE_Error::doing_it_wrong(
32 32
 				'EE_Checkbox_Display_Strategy::display()',
33 33
 				sprintf(
34
-					__( 'Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"', 'event_espresso'),
34
+					__('Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"', 'event_espresso'),
35 35
 					$this->_input->html_id(),
36
-					var_export( $this->_input->raw_value(), true),
37
-					$this->_input->html_name() . '[]'
36
+					var_export($this->_input->raw_value(), true),
37
+					$this->_input->html_name().'[]'
38 38
 				),
39 39
 				'4.6.21'
40 40
 			);
41 41
 		}
42
-		$input_raw_value = (array)$this->_input->raw_value();
43
-		foreach( $this->_input->options() as $value => $display_text ){
44
-			$option_value_as_string = $this->_input->get_normalization_strategy()->unnormalize_one( $value );
45
-			$html_id = $multi ? $this->_input->html_id() . '-' . sanitize_key( $option_value_as_string ) : $this->_input->html_id();
46
-			$html .= EEH_HTML::nl( 0, 'checkbox' );
47
-			$html .= '<label for="' . $html_id . '" id="' . $html_id . '-lbl" class="ee-checkbox-label-after' . $label_size_class . '">';
48
-			$html .= EEH_HTML::nl( 1, 'checkbox' );
42
+		$input_raw_value = (array) $this->_input->raw_value();
43
+		foreach ($this->_input->options() as $value => $display_text) {
44
+			$option_value_as_string = $this->_input->get_normalization_strategy()->unnormalize_one($value);
45
+			$html_id = $multi ? $this->_input->html_id().'-'.sanitize_key($option_value_as_string) : $this->_input->html_id();
46
+			$html .= EEH_HTML::nl(0, 'checkbox');
47
+			$html .= '<label for="'.$html_id.'" id="'.$html_id.'-lbl" class="ee-checkbox-label-after'.$label_size_class.'">';
48
+			$html .= EEH_HTML::nl(1, 'checkbox');
49 49
 			$html .= '<input type="checkbox"';
50
-			$html .= ' name="' . $this->_input->html_name() . '[]"';
51
-			$html .= ' id="' . $html_id . '"';
52
-			$html .= ' class="' . $this->_input->html_class() . '"';
53
-			$html .= ' style="' . $this->_input->html_style() . '"';
54
-			$html .= ' value="' . esc_attr( $value ) . '"';
55
-			$html .= ! empty( $input_raw_value ) && in_array( $value, $input_raw_value ) ? ' checked="checked"' : '';
50
+			$html .= ' name="'.$this->_input->html_name().'[]"';
51
+			$html .= ' id="'.$html_id.'"';
52
+			$html .= ' class="'.$this->_input->html_class().'"';
53
+			$html .= ' style="'.$this->_input->html_style().'"';
54
+			$html .= ' value="'.esc_attr($value).'"';
55
+			$html .= ! empty($input_raw_value) && in_array($value, $input_raw_value) ? ' checked="checked"' : '';
56 56
 			$html .= '>&nbsp;';
57 57
 			$html .= $display_text;
58
-			$html .= EEH_HTML::nl( -1, 'checkbox' ) . '</label>';
58
+			$html .= EEH_HTML::nl( -1, 'checkbox' ).'</label>';
59 59
 		}
60 60
 		return $html;
61 61
 	}
Please login to merge, or discard this patch.
form_sections/strategies/display/EE_Display_Strategy_Base.strategy.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @since               	4.6
9 9
  *
10 10
  */
11
-abstract class EE_Display_Strategy_Base extends EE_Form_Input_Strategy_Base{
11
+abstract class EE_Display_Strategy_Base extends EE_Form_Input_Strategy_Base {
12 12
 	/**
13 13
 	 * returns HTML and javascript related to the displaying of this input
14 14
 	 * @return string
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 * @param string $chars - exact string of characters to remove
25 25
 	 * @return string
26 26
 	 */
27
-	protected function _remove_chars( $string = '', $chars = '-' ) {
28
-		$char_length = strlen( $chars ) * -1;
27
+	protected function _remove_chars($string = '', $chars = '-') {
28
+		$char_length = strlen($chars) * -1;
29 29
 		// if last three characters of string is  " - ", then remove it
30
-		return substr( $string, $char_length ) == $chars ? substr( $string, 0, $char_length ) : $string;
30
+		return substr($string, $char_length) == $chars ? substr($string, 0, $char_length) : $string;
31 31
 	}
32 32
 
33 33
 
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 	 * @param string $chars - exact string of characters to be added to end of string
40 40
 	 * @return string
41 41
 	 */
42
-	protected function _append_chars( $string = '', $chars = '-' ) {
43
-		return  $this->_remove_chars( $string, $chars ) . $chars;
42
+	protected function _append_chars($string = '', $chars = '-') {
43
+		return  $this->_remove_chars($string, $chars).$chars;
44 44
 	}
45 45
 
46 46
 
Please login to merge, or discard this patch.