Completed
Branch dependabot/npm_and_yarn/wordpr... (0475b3)
by
unknown
14:52 queued 12:42
created
libraries/shortcodes/EE_Primary_Registration_Details_Shortcodes.lib.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
         $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee
100 100
             ? $this->_extra_data['data'] : $primary_registration;
101 101
 
102
-        if (! $primary_registration instanceof EE_Messages_Addressee) {
102
+        if ( ! $primary_registration instanceof EE_Messages_Addressee) {
103 103
             return '';
104 104
         }
105 105
 
106 106
         $attendee = $primary_registration->primary_att_obj;
107 107
         $primary_reg = $primary_registration->primary_reg_obj;
108 108
 
109
-        if (! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration) {
109
+        if ( ! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration) {
110 110
             return '';
111 111
         }
112 112
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                 break;
163 163
 
164 164
             case '[PRIMARY_REGISTRANT_REGISTRATION_DATE]':
165
-                if (! $primary_registration->primary_reg_obj instanceof EE_Registration) {
165
+                if ( ! $primary_registration->primary_reg_obj instanceof EE_Registration) {
166 166
                     return '';
167 167
                 }
168 168
                 return $primary_registration->primary_reg_obj->get_i18n_datetime('REG_date', get_option('date_format'));
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
                 if (
188 188
                     $question instanceof EE_Question
189 189
                     && trim($question->get('QST_display_text')) === trim($shortcode)
190
-                    && isset($primary_registration->registrations[ $primary_reg->ID() ]['ans_objs'][ $ansid ])
190
+                    && isset($primary_registration->registrations[$primary_reg->ID()]['ans_objs'][$ansid])
191 191
                 ) {
192
-                    $primary_reg_ansid = $primary_registration->registrations[ $primary_reg->ID() ]['ans_objs'][ $ansid ];
192
+                    $primary_reg_ansid = $primary_registration->registrations[$primary_reg->ID()]['ans_objs'][$ansid];
193 193
 
194 194
                     // what we show for the answer depends on the question type!
195 195
                     switch ($question->get('QST_type')) {
Please login to merge, or discard this patch.
Indentation   +197 added lines, -197 removed lines patch added patch discarded remove patch
@@ -19,201 +19,201 @@
 block discarded – undo
19 19
 {
20 20
 
21 21
 
22
-    protected function _init_props()
23
-    {
24
-        $this->label = esc_html__('Primary_Registration Details Shortcodes', 'event_espresso');
25
-        $this->description = esc_html__('All shortcodes specific primary registrant data', 'event_espresso');
26
-        $this->_shortcodes = array(
27
-            '[PRIMARY_REGISTRANT_FNAME]'                  => esc_html__(
28
-                'Parses to the first name of the primary registration for the transaction.',
29
-                'event_espresso'
30
-            ),
31
-            '[PRIMARY_REGISTRANT_LNAME]'                  => esc_html__(
32
-                'Parses to the last name of the primary registration for the transaction.',
33
-                'event_espresso'
34
-            ),
35
-            '[PRIMARY_REGISTRANT_EMAIL]'                  => esc_html__(
36
-                'Parses to the email address of the primary registration for the transaction.',
37
-                'event_espresso'
38
-            ),
39
-            '[PRIMARY_REGISTRANT_REGISTRATION_ID]'        => esc_html__(
40
-                'Parses to the registration ID of the primary registrant for the transaction.',
41
-                'event_espresso'
42
-            ),
43
-            '[PRIMARY_REGISTRANT_REGISTRATION_CODE]'      => esc_html__(
44
-                'Parses to the registration code of the primary registrant for the transaction.',
45
-                'event_espresso'
46
-            ),
47
-            '[PRIMARY_REGISTRANT_PHONE_NUMBER]'           => esc_html__(
48
-                'The Phone Number for the primary registrant for the transaction.',
49
-                'event_espresso'
50
-            ),
51
-            '[PRIMARY_REGISTRANT_ADDRESS]'                => esc_html__(
52
-                'The Address for the primary registrant for the transaction.',
53
-                'event_espresso'
54
-            ),
55
-            '[PRIMARY_REGISTRANT_ADDRESS2]'               => esc_html__(
56
-                'Whatever was in the address 2 field for the primary registrant for the transaction.',
57
-                'event_espresso'
58
-            ),
59
-            '[PRIMARY_REGISTRANT_CITY]'                   => esc_html__(
60
-                'The city for the primary registrant for the transaction.',
61
-                'event_espresso'
62
-            ),
63
-            '[PRIMARY_REGISTRANT_ZIP_PC]'                 => esc_html__(
64
-                'The ZIP (or Postal) Code for the primary registrant for the transaction.',
65
-                'event_espresso'
66
-            ),
67
-            '[PRIMARY_REGISTRANT_ADDRESS_STATE]'          => esc_html__(
68
-                'The state/province for the primary registrant for the transaction.',
69
-                'event_espresso'
70
-            ),
71
-            '[PRIMARY_REGISTRANT_COUNTRY]'                => esc_html__(
72
-                'The country for the primary registrant for the transaction.',
73
-                'event_espresso'
74
-            ),
75
-            '[PRIMARY_REGISTRANT_REGISTRATION_DATE]'      => esc_html__(
76
-                'The date the registration occured for the primary registration.',
77
-                'event_espresso'
78
-            ),
79
-            '[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]' => esc_html__(
80
-                'Generates a link for the given registration to edit this registration details on the frontend.',
81
-                'event_espresso'
82
-            ),
83
-            '[PRIMARY_REGISTRANT_ANSWER_*]'               => esc_html__(
84
-                'This is a special dynamic shortcode.  After the "*", add the exact text of an existing question, and if there is an answer for that question for this primary registrant, then it will be output in place of this shortcode.',
85
-                'event_espresso'
86
-            ),
87
-        );
88
-    }
89
-
90
-
91
-    protected function _parser($shortcode)
92
-    {
93
-        // make sure we end up with a copy of the EE_Messages_Addressee object
94
-        $primary_registration = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
95
-        $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && is_array(
96
-            $this->_data
97
-        ) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data']
98
-            : $primary_registration;
99
-        $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee
100
-            ? $this->_extra_data['data'] : $primary_registration;
101
-
102
-        if (! $primary_registration instanceof EE_Messages_Addressee) {
103
-            return '';
104
-        }
105
-
106
-        $attendee = $primary_registration->primary_att_obj;
107
-        $primary_reg = $primary_registration->primary_reg_obj;
108
-
109
-        if (! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration) {
110
-            return '';
111
-        }
112
-
113
-        switch ($shortcode) {
114
-            case '[PRIMARY_REGISTRANT_FNAME]':
115
-                return $attendee->fname();
116
-                break;
117
-
118
-            case '[PRIMARY_REGISTRANT_LNAME]':
119
-                return $attendee->lname();
120
-                break;
121
-
122
-            case '[PRIMARY_REGISTRANT_EMAIL]':
123
-                return $attendee->email();
124
-                break;
125
-
126
-            case '[PRIMARY_REGISTRANT_REGISTRATION_ID]':
127
-                return $primary_reg->ID();
128
-                break;
129
-
130
-            case '[PRIMARY_REGISTRANT_REGISTRATION_CODE]':
131
-                return $primary_reg->reg_code();
132
-                break;
133
-
134
-            case '[PRIMARY_REGISTRANT_PHONE_NUMBER]':
135
-                return $attendee->phone();
136
-                break;
137
-
138
-            case '[PRIMARY_REGISTRANT_ADDRESS]':
139
-                return $attendee->address();
140
-                break;
141
-
142
-            case '[PRIMARY_REGISTRANT_ADDRESS2]':
143
-                return $attendee->address2();
144
-                break;
145
-
146
-            case '[PRIMARY_REGISTRANT_CITY]':
147
-                return $attendee->city();
148
-                break;
149
-
150
-            case '[PRIMARY_REGISTRANT_ZIP_PC]':
151
-                return $attendee->zip();
152
-                break;
153
-
154
-            case '[PRIMARY_REGISTRANT_ADDRESS_STATE]':
155
-                $state_obj = $attendee->state_obj();
156
-                return $state_obj instanceof EE_State ? $state_obj->name() : '';
157
-                break;
158
-
159
-            case '[PRIMARY_REGISTRANT_COUNTRY]':
160
-                $country_obj = $attendee->country_obj();
161
-                return $country_obj instanceof EE_Country ? $country_obj->name() : '';
162
-                break;
163
-
164
-            case '[PRIMARY_REGISTRANT_REGISTRATION_DATE]':
165
-                if (! $primary_registration->primary_reg_obj instanceof EE_Registration) {
166
-                    return '';
167
-                }
168
-                return $primary_registration->primary_reg_obj->get_i18n_datetime('REG_date', get_option('date_format'));
169
-                break;
170
-
171
-            case '[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]':
172
-                return $primary_reg->edit_attendee_information_url();
173
-                break;
174
-        }
175
-
176
-        if (strpos($shortcode, '[PRIMARY_REGISTRANT_ANSWER_*') !== false) {
177
-            $shortcode = str_replace('[PRIMARY_REGISTRANT_ANSWER_*', '', $shortcode);
178
-            $shortcode = trim(str_replace(']', '', $shortcode));
179
-
180
-
181
-            // now let's figure out what question has this text
182
-            if (empty($primary_registration->questions)) {
183
-                return '';
184
-            }
185
-
186
-            foreach ($primary_registration->questions as $ansid => $question) {
187
-                if (
188
-                    $question instanceof EE_Question
189
-                    && trim($question->get('QST_display_text')) === trim($shortcode)
190
-                    && isset($primary_registration->registrations[ $primary_reg->ID() ]['ans_objs'][ $ansid ])
191
-                ) {
192
-                    $primary_reg_ansid = $primary_registration->registrations[ $primary_reg->ID() ]['ans_objs'][ $ansid ];
193
-
194
-                    // what we show for the answer depends on the question type!
195
-                    switch ($question->get('QST_type')) {
196
-                        case EEM_Question::QST_type_state:
197
-                            $state = EEM_State::instance()->get_one_by_ID($primary_reg_ansid->get('ANS_value'));
198
-                            $answer = $state instanceof EE_State ? $state->name() : '';
199
-                            break;
200
-
201
-                        case EEM_Question::QST_type_country:
202
-                            $country = EEM_Country::instance()->get_one_by_ID($primary_reg_ansid->get('ANS_value'));
203
-                            $answer = $country instanceof EE_Country ? $country->name() : '';
204
-                            break;
205
-
206
-                        default:
207
-                            $answer = $primary_reg_ansid->get_pretty('ANS_value', 'no_wpautop');
208
-                            break;
209
-                    }
210
-
211
-                    return $answer;
212
-                    break;
213
-                }
214
-            }
215
-        }
216
-
217
-        return '';
218
-    }
22
+	protected function _init_props()
23
+	{
24
+		$this->label = esc_html__('Primary_Registration Details Shortcodes', 'event_espresso');
25
+		$this->description = esc_html__('All shortcodes specific primary registrant data', 'event_espresso');
26
+		$this->_shortcodes = array(
27
+			'[PRIMARY_REGISTRANT_FNAME]'                  => esc_html__(
28
+				'Parses to the first name of the primary registration for the transaction.',
29
+				'event_espresso'
30
+			),
31
+			'[PRIMARY_REGISTRANT_LNAME]'                  => esc_html__(
32
+				'Parses to the last name of the primary registration for the transaction.',
33
+				'event_espresso'
34
+			),
35
+			'[PRIMARY_REGISTRANT_EMAIL]'                  => esc_html__(
36
+				'Parses to the email address of the primary registration for the transaction.',
37
+				'event_espresso'
38
+			),
39
+			'[PRIMARY_REGISTRANT_REGISTRATION_ID]'        => esc_html__(
40
+				'Parses to the registration ID of the primary registrant for the transaction.',
41
+				'event_espresso'
42
+			),
43
+			'[PRIMARY_REGISTRANT_REGISTRATION_CODE]'      => esc_html__(
44
+				'Parses to the registration code of the primary registrant for the transaction.',
45
+				'event_espresso'
46
+			),
47
+			'[PRIMARY_REGISTRANT_PHONE_NUMBER]'           => esc_html__(
48
+				'The Phone Number for the primary registrant for the transaction.',
49
+				'event_espresso'
50
+			),
51
+			'[PRIMARY_REGISTRANT_ADDRESS]'                => esc_html__(
52
+				'The Address for the primary registrant for the transaction.',
53
+				'event_espresso'
54
+			),
55
+			'[PRIMARY_REGISTRANT_ADDRESS2]'               => esc_html__(
56
+				'Whatever was in the address 2 field for the primary registrant for the transaction.',
57
+				'event_espresso'
58
+			),
59
+			'[PRIMARY_REGISTRANT_CITY]'                   => esc_html__(
60
+				'The city for the primary registrant for the transaction.',
61
+				'event_espresso'
62
+			),
63
+			'[PRIMARY_REGISTRANT_ZIP_PC]'                 => esc_html__(
64
+				'The ZIP (or Postal) Code for the primary registrant for the transaction.',
65
+				'event_espresso'
66
+			),
67
+			'[PRIMARY_REGISTRANT_ADDRESS_STATE]'          => esc_html__(
68
+				'The state/province for the primary registrant for the transaction.',
69
+				'event_espresso'
70
+			),
71
+			'[PRIMARY_REGISTRANT_COUNTRY]'                => esc_html__(
72
+				'The country for the primary registrant for the transaction.',
73
+				'event_espresso'
74
+			),
75
+			'[PRIMARY_REGISTRANT_REGISTRATION_DATE]'      => esc_html__(
76
+				'The date the registration occured for the primary registration.',
77
+				'event_espresso'
78
+			),
79
+			'[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]' => esc_html__(
80
+				'Generates a link for the given registration to edit this registration details on the frontend.',
81
+				'event_espresso'
82
+			),
83
+			'[PRIMARY_REGISTRANT_ANSWER_*]'               => esc_html__(
84
+				'This is a special dynamic shortcode.  After the "*", add the exact text of an existing question, and if there is an answer for that question for this primary registrant, then it will be output in place of this shortcode.',
85
+				'event_espresso'
86
+			),
87
+		);
88
+	}
89
+
90
+
91
+	protected function _parser($shortcode)
92
+	{
93
+		// make sure we end up with a copy of the EE_Messages_Addressee object
94
+		$primary_registration = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
95
+		$primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && is_array(
96
+			$this->_data
97
+		) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data']
98
+			: $primary_registration;
99
+		$primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee
100
+			? $this->_extra_data['data'] : $primary_registration;
101
+
102
+		if (! $primary_registration instanceof EE_Messages_Addressee) {
103
+			return '';
104
+		}
105
+
106
+		$attendee = $primary_registration->primary_att_obj;
107
+		$primary_reg = $primary_registration->primary_reg_obj;
108
+
109
+		if (! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration) {
110
+			return '';
111
+		}
112
+
113
+		switch ($shortcode) {
114
+			case '[PRIMARY_REGISTRANT_FNAME]':
115
+				return $attendee->fname();
116
+				break;
117
+
118
+			case '[PRIMARY_REGISTRANT_LNAME]':
119
+				return $attendee->lname();
120
+				break;
121
+
122
+			case '[PRIMARY_REGISTRANT_EMAIL]':
123
+				return $attendee->email();
124
+				break;
125
+
126
+			case '[PRIMARY_REGISTRANT_REGISTRATION_ID]':
127
+				return $primary_reg->ID();
128
+				break;
129
+
130
+			case '[PRIMARY_REGISTRANT_REGISTRATION_CODE]':
131
+				return $primary_reg->reg_code();
132
+				break;
133
+
134
+			case '[PRIMARY_REGISTRANT_PHONE_NUMBER]':
135
+				return $attendee->phone();
136
+				break;
137
+
138
+			case '[PRIMARY_REGISTRANT_ADDRESS]':
139
+				return $attendee->address();
140
+				break;
141
+
142
+			case '[PRIMARY_REGISTRANT_ADDRESS2]':
143
+				return $attendee->address2();
144
+				break;
145
+
146
+			case '[PRIMARY_REGISTRANT_CITY]':
147
+				return $attendee->city();
148
+				break;
149
+
150
+			case '[PRIMARY_REGISTRANT_ZIP_PC]':
151
+				return $attendee->zip();
152
+				break;
153
+
154
+			case '[PRIMARY_REGISTRANT_ADDRESS_STATE]':
155
+				$state_obj = $attendee->state_obj();
156
+				return $state_obj instanceof EE_State ? $state_obj->name() : '';
157
+				break;
158
+
159
+			case '[PRIMARY_REGISTRANT_COUNTRY]':
160
+				$country_obj = $attendee->country_obj();
161
+				return $country_obj instanceof EE_Country ? $country_obj->name() : '';
162
+				break;
163
+
164
+			case '[PRIMARY_REGISTRANT_REGISTRATION_DATE]':
165
+				if (! $primary_registration->primary_reg_obj instanceof EE_Registration) {
166
+					return '';
167
+				}
168
+				return $primary_registration->primary_reg_obj->get_i18n_datetime('REG_date', get_option('date_format'));
169
+				break;
170
+
171
+			case '[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]':
172
+				return $primary_reg->edit_attendee_information_url();
173
+				break;
174
+		}
175
+
176
+		if (strpos($shortcode, '[PRIMARY_REGISTRANT_ANSWER_*') !== false) {
177
+			$shortcode = str_replace('[PRIMARY_REGISTRANT_ANSWER_*', '', $shortcode);
178
+			$shortcode = trim(str_replace(']', '', $shortcode));
179
+
180
+
181
+			// now let's figure out what question has this text
182
+			if (empty($primary_registration->questions)) {
183
+				return '';
184
+			}
185
+
186
+			foreach ($primary_registration->questions as $ansid => $question) {
187
+				if (
188
+					$question instanceof EE_Question
189
+					&& trim($question->get('QST_display_text')) === trim($shortcode)
190
+					&& isset($primary_registration->registrations[ $primary_reg->ID() ]['ans_objs'][ $ansid ])
191
+				) {
192
+					$primary_reg_ansid = $primary_registration->registrations[ $primary_reg->ID() ]['ans_objs'][ $ansid ];
193
+
194
+					// what we show for the answer depends on the question type!
195
+					switch ($question->get('QST_type')) {
196
+						case EEM_Question::QST_type_state:
197
+							$state = EEM_State::instance()->get_one_by_ID($primary_reg_ansid->get('ANS_value'));
198
+							$answer = $state instanceof EE_State ? $state->name() : '';
199
+							break;
200
+
201
+						case EEM_Question::QST_type_country:
202
+							$country = EEM_Country::instance()->get_one_by_ID($primary_reg_ansid->get('ANS_value'));
203
+							$answer = $country instanceof EE_Country ? $country->name() : '';
204
+							break;
205
+
206
+						default:
207
+							$answer = $primary_reg_ansid->get_pretty('ANS_value', 'no_wpautop');
208
+							break;
209
+					}
210
+
211
+					return $answer;
212
+					break;
213
+				}
214
+			}
215
+		}
216
+
217
+		return '';
218
+	}
219 219
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Currency_Input.input.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -12,23 +12,23 @@
 block discarded – undo
12 12
 class EE_Currency_Input extends EE_Select_Input
13 13
 {
14 14
 
15
-    /**
16
-     *
17
-     * @param array $only_specific_currency_codes numerically-indexed array of allowed currency codes. By default, all are allowed
18
-     * @param array $input_settings
19
-     */
20
-    public function __construct($only_specific_currency_codes = array(), $input_settings = array())
21
-    {
22
-        $query_params = array('order_by' => array('CNT_name' => 'asc'));
23
-        if ($only_specific_currency_codes) {
24
-            $query_params[0]['CNT_cur_code'] = array('IN',$only_specific_currency_codes);
25
-        }
26
-        $all_countries = EEM_Country::instance()->get_all($query_params);
27
-        $country_options = array();
28
-        foreach ($all_countries as $country) {
29
-            /* @var $country EE_Country */
30
-            $country_options[ $country->currency_code() ] = $country->name() . ": " . $country->currency_name_single() . " (" . $country->currency_sign() . ")";
31
-        }
32
-        parent::__construct($country_options, 'int', $input_settings);
33
-    }
15
+	/**
16
+	 *
17
+	 * @param array $only_specific_currency_codes numerically-indexed array of allowed currency codes. By default, all are allowed
18
+	 * @param array $input_settings
19
+	 */
20
+	public function __construct($only_specific_currency_codes = array(), $input_settings = array())
21
+	{
22
+		$query_params = array('order_by' => array('CNT_name' => 'asc'));
23
+		if ($only_specific_currency_codes) {
24
+			$query_params[0]['CNT_cur_code'] = array('IN',$only_specific_currency_codes);
25
+		}
26
+		$all_countries = EEM_Country::instance()->get_all($query_params);
27
+		$country_options = array();
28
+		foreach ($all_countries as $country) {
29
+			/* @var $country EE_Country */
30
+			$country_options[ $country->currency_code() ] = $country->name() . ": " . $country->currency_name_single() . " (" . $country->currency_sign() . ")";
31
+		}
32
+		parent::__construct($country_options, 'int', $input_settings);
33
+	}
34 34
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@
 block discarded – undo
21 21
     {
22 22
         $query_params = array('order_by' => array('CNT_name' => 'asc'));
23 23
         if ($only_specific_currency_codes) {
24
-            $query_params[0]['CNT_cur_code'] = array('IN',$only_specific_currency_codes);
24
+            $query_params[0]['CNT_cur_code'] = array('IN', $only_specific_currency_codes);
25 25
         }
26 26
         $all_countries = EEM_Country::instance()->get_all($query_params);
27 27
         $country_options = array();
28 28
         foreach ($all_countries as $country) {
29 29
             /* @var $country EE_Country */
30
-            $country_options[ $country->currency_code() ] = $country->name() . ": " . $country->currency_name_single() . " (" . $country->currency_sign() . ")";
30
+            $country_options[$country->currency_code()] = $country->name().": ".$country->currency_name_single()." (".$country->currency_sign().")";
31 31
         }
32 32
         parent::__construct($country_options, 'int', $input_settings);
33 33
     }
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Select_Reveal_Input.input.php 2 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -15,65 +15,65 @@
 block discarded – undo
15 15
 class EE_Select_Reveal_Input extends EE_Select_Input
16 16
 {
17 17
 
18
-    /**
19
-     * @param array $answer_options Array keys which match a sibling section's name
20
-     *              will show/unhide that sibling subsection. Otherwise, siblings whose names
21
-     *              match array keys of $answer_options are hidden.
22
-     *              Note: internally each array key is considered a relative form input path
23
-     *              (see EE_Form_Section_Base::find_section_from_path) but relative
24
-     *              to THIS INPUT's PARENT section, not this input itself. ie,
25
-     *              a '../' is automatically added onto each each array key, to produce
26
-     *              the relative form input path.
27
-     *              Note however: array keys which are an EMPTY STRING are left as-is
28
-     *
29
-     * @param array $input_settings
30
-     */
31
-    public function __construct($answer_options, $input_settings = array())
32
-    {
33
-        parent::__construct($answer_options, $input_settings);
34
-    }
18
+	/**
19
+	 * @param array $answer_options Array keys which match a sibling section's name
20
+	 *              will show/unhide that sibling subsection. Otherwise, siblings whose names
21
+	 *              match array keys of $answer_options are hidden.
22
+	 *              Note: internally each array key is considered a relative form input path
23
+	 *              (see EE_Form_Section_Base::find_section_from_path) but relative
24
+	 *              to THIS INPUT's PARENT section, not this input itself. ie,
25
+	 *              a '../' is automatically added onto each each array key, to produce
26
+	 *              the relative form input path.
27
+	 *              Note however: array keys which are an EMPTY STRING are left as-is
28
+	 *
29
+	 * @param array $input_settings
30
+	 */
31
+	public function __construct($answer_options, $input_settings = array())
32
+	{
33
+		parent::__construct($answer_options, $input_settings);
34
+	}
35 35
 
36
-    /**
37
-     * Gets all the sibling sections controlled by this reveal select input
38
-     * @return \EE_Form_Section_Base[] keys are their form section paths
39
-     */
40
-    public function sibling_sections_controlled()
41
-    {
42
-        $sibling_sections = array();
43
-        foreach ($this->options() as $sibling_section_name => $sibling_section) {
44
-            // if it's an empty string just leave it alone
45
-            if (empty($sibling_section_name)) {
46
-                continue;
47
-            }
48
-            $sibling_section = $this->find_section_from_path('../' . $sibling_section_name);
49
-            if (
50
-                $sibling_section instanceof EE_Form_Section_Base
51
-                && ! empty($sibling_section_name)
52
-            ) {
53
-                $sibling_sections[ $sibling_section_name ] = $sibling_section;
54
-            }
55
-        }
56
-        return $sibling_sections;
57
-    }
36
+	/**
37
+	 * Gets all the sibling sections controlled by this reveal select input
38
+	 * @return \EE_Form_Section_Base[] keys are their form section paths
39
+	 */
40
+	public function sibling_sections_controlled()
41
+	{
42
+		$sibling_sections = array();
43
+		foreach ($this->options() as $sibling_section_name => $sibling_section) {
44
+			// if it's an empty string just leave it alone
45
+			if (empty($sibling_section_name)) {
46
+				continue;
47
+			}
48
+			$sibling_section = $this->find_section_from_path('../' . $sibling_section_name);
49
+			if (
50
+				$sibling_section instanceof EE_Form_Section_Base
51
+				&& ! empty($sibling_section_name)
52
+			) {
53
+				$sibling_sections[ $sibling_section_name ] = $sibling_section;
54
+			}
55
+		}
56
+		return $sibling_sections;
57
+	}
58 58
 
59
-    /**
60
-     * Adds an entry of 'select_reveal_inputs' to the js data, which is an array
61
-     * whose top-level keys are select reveal input html ids; values are arrays
62
-     * whose keys are select option values and values are the sections they reveal
63
-     * @param array $form_other_js_data
64
-     * @return array
65
-     */
66
-    public function get_other_js_data($form_other_js_data = array())
67
-    {
68
-        $form_other_js_data = parent::get_other_js_data($form_other_js_data);
69
-        if (! isset($form_other_js_data['select_reveal_inputs'])) {
70
-            $form_other_js_data['select_reveal_inputs'] = array();
71
-        }
72
-        $sibling_input_to_html_id_map = array();
73
-        foreach ($this->sibling_sections_controlled() as $sibling_section_path => $sibling_section) {
74
-            $sibling_input_to_html_id_map[ $sibling_section_path ] = $sibling_section->html_id();
75
-        }
76
-        $form_other_js_data['select_reveal_inputs'][ $this->html_id() ] = $sibling_input_to_html_id_map;
77
-        return $form_other_js_data;
78
-    }
59
+	/**
60
+	 * Adds an entry of 'select_reveal_inputs' to the js data, which is an array
61
+	 * whose top-level keys are select reveal input html ids; values are arrays
62
+	 * whose keys are select option values and values are the sections they reveal
63
+	 * @param array $form_other_js_data
64
+	 * @return array
65
+	 */
66
+	public function get_other_js_data($form_other_js_data = array())
67
+	{
68
+		$form_other_js_data = parent::get_other_js_data($form_other_js_data);
69
+		if (! isset($form_other_js_data['select_reveal_inputs'])) {
70
+			$form_other_js_data['select_reveal_inputs'] = array();
71
+		}
72
+		$sibling_input_to_html_id_map = array();
73
+		foreach ($this->sibling_sections_controlled() as $sibling_section_path => $sibling_section) {
74
+			$sibling_input_to_html_id_map[ $sibling_section_path ] = $sibling_section->html_id();
75
+		}
76
+		$form_other_js_data['select_reveal_inputs'][ $this->html_id() ] = $sibling_input_to_html_id_map;
77
+		return $form_other_js_data;
78
+	}
79 79
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
             if (empty($sibling_section_name)) {
46 46
                 continue;
47 47
             }
48
-            $sibling_section = $this->find_section_from_path('../' . $sibling_section_name);
48
+            $sibling_section = $this->find_section_from_path('../'.$sibling_section_name);
49 49
             if (
50 50
                 $sibling_section instanceof EE_Form_Section_Base
51 51
                 && ! empty($sibling_section_name)
52 52
             ) {
53
-                $sibling_sections[ $sibling_section_name ] = $sibling_section;
53
+                $sibling_sections[$sibling_section_name] = $sibling_section;
54 54
             }
55 55
         }
56 56
         return $sibling_sections;
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
     public function get_other_js_data($form_other_js_data = array())
67 67
     {
68 68
         $form_other_js_data = parent::get_other_js_data($form_other_js_data);
69
-        if (! isset($form_other_js_data['select_reveal_inputs'])) {
69
+        if ( ! isset($form_other_js_data['select_reveal_inputs'])) {
70 70
             $form_other_js_data['select_reveal_inputs'] = array();
71 71
         }
72 72
         $sibling_input_to_html_id_map = array();
73 73
         foreach ($this->sibling_sections_controlled() as $sibling_section_path => $sibling_section) {
74
-            $sibling_input_to_html_id_map[ $sibling_section_path ] = $sibling_section->html_id();
74
+            $sibling_input_to_html_id_map[$sibling_section_path] = $sibling_section->html_id();
75 75
         }
76
-        $form_other_js_data['select_reveal_inputs'][ $this->html_id() ] = $sibling_input_to_html_id_map;
76
+        $form_other_js_data['select_reveal_inputs'][$this->html_id()] = $sibling_input_to_html_id_map;
77 77
         return $form_other_js_data;
78 78
     }
79 79
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Text_Area_Input.input.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -13,68 +13,68 @@
 block discarded – undo
13 13
 {
14 14
 
15 15
 
16
-    protected $_rows = 2;
17
-    protected $_cols = 20;
16
+	protected $_rows = 2;
17
+	protected $_cols = 20;
18 18
 
19
-    /**
20
-     * sets the rows property on this input
21
-     * @param int $rows
22
-     */
23
-    public function set_rows($rows)
24
-    {
25
-        $this->_rows = $rows;
26
-    }
27
-    /**
28
-     * sets the cols html property on this input
29
-     * @param int $cols
30
-     */
31
-    public function set_cols($cols)
32
-    {
33
-        $this->_cols = $cols;
34
-    }
35
-    /**
36
-     *
37
-     * @return int
38
-     */
39
-    public function get_rows()
40
-    {
41
-        return $this->_rows;
42
-    }
43
-    /**
44
-     *
45
-     * @return int
46
-     */
47
-    public function get_cols()
48
-    {
49
-        return $this->_cols;
50
-    }
19
+	/**
20
+	 * sets the rows property on this input
21
+	 * @param int $rows
22
+	 */
23
+	public function set_rows($rows)
24
+	{
25
+		$this->_rows = $rows;
26
+	}
27
+	/**
28
+	 * sets the cols html property on this input
29
+	 * @param int $cols
30
+	 */
31
+	public function set_cols($cols)
32
+	{
33
+		$this->_cols = $cols;
34
+	}
35
+	/**
36
+	 *
37
+	 * @return int
38
+	 */
39
+	public function get_rows()
40
+	{
41
+		return $this->_rows;
42
+	}
43
+	/**
44
+	 *
45
+	 * @return int
46
+	 */
47
+	public function get_cols()
48
+	{
49
+		return $this->_cols;
50
+	}
51 51
 
52 52
 
53 53
 
54
-    /**
55
-     * @param array $options_array
56
-     */
57
-    public function __construct($options_array = array())
58
-    {
59
-        $this->_set_display_strategy(new EE_Text_Area_Display_Strategy());
60
-        $this->_set_normalization_strategy(new EE_Text_Normalization());
54
+	/**
55
+	 * @param array $options_array
56
+	 */
57
+	public function __construct($options_array = array())
58
+	{
59
+		$this->_set_display_strategy(new EE_Text_Area_Display_Strategy());
60
+		$this->_set_normalization_strategy(new EE_Text_Normalization());
61 61
 
62 62
 
63
-        parent::__construct($options_array);
63
+		parent::__construct($options_array);
64 64
 
65
-        // if the input hasn't specifically mentioned a more lenient validation strategy,
66
-        // apply plaintext validation strategy
67
-        if (
68
-            ! $this->has_validation_strategy(
69
-                array(
70
-                    'EE_Full_HTML_Validation_Strategy',
71
-                    'EE_Simple_HTML_Validation_Strategy'
72
-                )
73
-            )
74
-        ) {
75
-            // by default we use the plaintext validation. If you want something else,
76
-            // just remove it after the input is constructed :P using EE_Form_Input_Base::remove_validation_strategy()
77
-            $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy());
78
-        }
79
-    }
65
+		// if the input hasn't specifically mentioned a more lenient validation strategy,
66
+		// apply plaintext validation strategy
67
+		if (
68
+			! $this->has_validation_strategy(
69
+				array(
70
+					'EE_Full_HTML_Validation_Strategy',
71
+					'EE_Simple_HTML_Validation_Strategy'
72
+				)
73
+			)
74
+		) {
75
+			// by default we use the plaintext validation. If you want something else,
76
+			// just remove it after the input is constructed :P using EE_Form_Input_Base::remove_validation_strategy()
77
+			$this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy());
78
+		}
79
+	}
80 80
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_CVV_Input.input.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -12,43 +12,43 @@
 block discarded – undo
12 12
 class EE_CVV_Input extends EE_Text_Input
13 13
 {
14 14
 
15
-    /**
16
-     * @param array $input_settings {
17
-     *  @type boolean $include_whats_this_link defaults to true
18
-     * }
19
-     */
20
-    public function __construct($input_settings = array())
21
-    {
22
-        $this->set_sensitive_data_removal_strategy(new EE_CCV_Sensitive_Data_Removal());
23
-        $this->_add_validation_strategy(
24
-            new EE_Text_Validation_Strategy(
25
-                isset($input_settings['validation_error_message'])
26
-                    ?  $input_settings['validation_error_message']
27
-                    : esc_html__(
28
-                        'The CVV is either a 3 digit number on the back of your card, or 4 digit number on the front',
29
-                        'event_espresso'
30
-                    ),
31
-                '~^\d{3,4}$~'
32
-            )
33
-        );
34
-        parent::__construct($input_settings);
35
-        if (
36
-            ! isset($input_settings['include_whats_this_link'])
37
-            || (
38
-                isset($input_settings['include_whats_this_link'])
39
-                 && $input_settings['include_whats_this_link'] === true
40
-            )
41
-        ) {
42
-            $this->_html_label_text = sprintf(
43
-                esc_html_x(
44
-                    '%1$s %2$s(What\'s this?)%3$s',
45
-                    'CVV (What\'s this?)',
46
-                    'event_espresso'
47
-                ),
48
-                $this->_html_label_text,
49
-                '<a href="https://www.cvvnumber.com/" target="_blank" rel="noopener noreferrer">',
50
-                '</a>'
51
-            );
52
-        }
53
-    }
15
+	/**
16
+	 * @param array $input_settings {
17
+	 *  @type boolean $include_whats_this_link defaults to true
18
+	 * }
19
+	 */
20
+	public function __construct($input_settings = array())
21
+	{
22
+		$this->set_sensitive_data_removal_strategy(new EE_CCV_Sensitive_Data_Removal());
23
+		$this->_add_validation_strategy(
24
+			new EE_Text_Validation_Strategy(
25
+				isset($input_settings['validation_error_message'])
26
+					?  $input_settings['validation_error_message']
27
+					: esc_html__(
28
+						'The CVV is either a 3 digit number on the back of your card, or 4 digit number on the front',
29
+						'event_espresso'
30
+					),
31
+				'~^\d{3,4}$~'
32
+			)
33
+		);
34
+		parent::__construct($input_settings);
35
+		if (
36
+			! isset($input_settings['include_whats_this_link'])
37
+			|| (
38
+				isset($input_settings['include_whats_this_link'])
39
+				 && $input_settings['include_whats_this_link'] === true
40
+			)
41
+		) {
42
+			$this->_html_label_text = sprintf(
43
+				esc_html_x(
44
+					'%1$s %2$s(What\'s this?)%3$s',
45
+					'CVV (What\'s this?)',
46
+					'event_espresso'
47
+				),
48
+				$this->_html_label_text,
49
+				'<a href="https://www.cvvnumber.com/" target="_blank" rel="noopener noreferrer">',
50
+				'</a>'
51
+			);
52
+		}
53
+	}
54 54
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
         $this->_add_validation_strategy(
24 24
             new EE_Text_Validation_Strategy(
25 25
                 isset($input_settings['validation_error_message'])
26
-                    ?  $input_settings['validation_error_message']
26
+                    ? $input_settings['validation_error_message']
27 27
                     : esc_html__(
28 28
                         'The CVV is either a 3 digit number on the back of your card, or 4 digit number on the front',
29 29
                         'event_espresso'
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Text_Input.input.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -13,27 +13,27 @@
 block discarded – undo
13 13
 {
14 14
 
15 15
 
16
-    /**
17
-     * @param array $options
18
-     */
19
-    public function __construct($options = array())
20
-    {
21
-        $this->_set_display_strategy(new EE_Text_Input_Display_Strategy());
22
-        $this->_set_normalization_strategy(new EE_Text_Normalization());
23
-        parent::__construct($options);
24
-        // if the input hasn't specifically mentioned a more lenient validation strategy,
25
-        // apply plaintext validation strategy
26
-        if (
27
-            ! $this->has_validation_strategy(
28
-                array(
29
-                    'EE_Full_HTML_Validation_Strategy',
30
-                    'EE_Simple_HTML_Validation_Strategy'
31
-                )
32
-            )
33
-        ) {
34
-            // by default we use the plaintext validation. If you want something else,
35
-            // just remove it after the input is constructed :P using EE_Form_Input_Base::remove_validation_strategy()
36
-            $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy());
37
-        }
38
-    }
16
+	/**
17
+	 * @param array $options
18
+	 */
19
+	public function __construct($options = array())
20
+	{
21
+		$this->_set_display_strategy(new EE_Text_Input_Display_Strategy());
22
+		$this->_set_normalization_strategy(new EE_Text_Normalization());
23
+		parent::__construct($options);
24
+		// if the input hasn't specifically mentioned a more lenient validation strategy,
25
+		// apply plaintext validation strategy
26
+		if (
27
+			! $this->has_validation_strategy(
28
+				array(
29
+					'EE_Full_HTML_Validation_Strategy',
30
+					'EE_Simple_HTML_Validation_Strategy'
31
+				)
32
+			)
33
+		) {
34
+			// by default we use the plaintext validation. If you want something else,
35
+			// just remove it after the input is constructed :P using EE_Form_Input_Base::remove_validation_strategy()
36
+			$this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy());
37
+		}
38
+	}
39 39
 }
Please login to merge, or discard this patch.
libraries/form_sections/inputs/EE_Form_Input_With_Options_Base.input.php 2 patches
Indentation   +320 added lines, -320 removed lines patch added patch discarded remove patch
@@ -12,324 +12,324 @@
 block discarded – undo
12 12
 class EE_Form_Input_With_Options_Base extends EE_Form_Input_Base
13 13
 {
14 14
 
15
-    /**
16
-     * array of available options to choose as an answer
17
-     *
18
-     * @var array
19
-     */
20
-    protected $_options = array();
21
-
22
-    /**
23
-     * whether to display the html_label_text above the checkbox/radio button options
24
-     *
25
-     * @var boolean
26
-     */
27
-    protected $_display_html_label_text = true;
28
-
29
-    /**
30
-     * whether to display an question option description as part of the input label
31
-     *
32
-     * @var boolean
33
-     */
34
-    protected $_use_desc_in_label = true;
35
-
36
-    /**
37
-     * strlen() result for the longest input value (what gets displayed in the label)
38
-     * this is used to apply a css class to the input label
39
-     *
40
-     * @var int
41
-     */
42
-    protected $_label_size = 0;
43
-
44
-    /**
45
-     * whether to enforce the label size value passed in the constructor
46
-     *
47
-     * @var boolean
48
-     */
49
-    protected $_enforce_label_size = false;
50
-
51
-    /**
52
-     * whether to allow multiple selections (ie, the value of this input should be an array)
53
-     * or not (ie, the value should be a simple int, string, etc)
54
-     *
55
-     * @var boolean
56
-     */
57
-    protected $_multiple_selections = false;
58
-
59
-
60
-
61
-    /**
62
-     * @param array     $answer_options
63
-     * @param array     $input_settings {
64
-     * @type int|string $label_size
65
-     * @type boolean    $display_html_label_text
66
-     *                                  }
67
-     *                                  And all the options accepted by EE_Form_Input_Base
68
-     */
69
-    public function __construct($answer_options = array(), $input_settings = array())
70
-    {
71
-        if (isset($input_settings['label_size'])) {
72
-            $this->_set_label_size($input_settings['label_size']);
73
-            if (isset($input_settings['enforce_label_size']) && $input_settings['enforce_label_size']) {
74
-                $this->_enforce_label_size = true;
75
-            }
76
-        }
77
-        if (isset($input_settings['display_html_label_text'])) {
78
-            $this->set_display_html_label_text($input_settings['display_html_label_text']);
79
-        }
80
-        $this->set_select_options($answer_options);
81
-        parent::__construct($input_settings);
82
-    }
83
-
84
-
85
-
86
-    /**
87
-     * Sets the allowed options for this input. Also has the side-effect of
88
-     * updating the normalization strategy to match the keys provided in the array
89
-     *
90
-     * @param array $answer_options
91
-     * @return void  just has the side-effect of setting the options for this input
92
-     */
93
-    public function set_select_options($answer_options = array())
94
-    {
95
-        $answer_options = is_array($answer_options) ? $answer_options : array($answer_options);
96
-        // get the first item in the select options and check it's type
97
-        $this->_options = reset($answer_options) instanceof EE_Question_Option
98
-            ? $this->_process_question_options($answer_options)
99
-            : $answer_options;
100
-        // d( $this->_options );
101
-        $select_option_keys = array_keys($this->_options);
102
-        // attempt to determine data type for values in order to set normalization type
103
-        // purposefully only
104
-        if (
105
-            count($this->_options) === 2
106
-            && (
107
-                (in_array(true, $select_option_keys, true) && in_array(false, $select_option_keys, true))
108
-                || (in_array(1, $select_option_keys, true) && in_array(0, $select_option_keys, true))
109
-            )
110
-        ) {
111
-            // values appear to be boolean, like TRUE, FALSE, 1, 0
112
-            $normalization = new EE_Boolean_Normalization();
113
-        } else {
114
-            // are ALL the options ints (even if we're using a multi-dimensional array)? If so use int validation
115
-            $all_ints = true;
116
-            array_walk_recursive(
117
-                $this->_options,
118
-                function ($value, $key) use (&$all_ints) {
119
-                    // is this a top-level key? ignore it
120
-                    if (
121
-                        ! is_array($value)
122
-                        && ! is_int($key)
123
-                        && $key !== ''
124
-                        && $key !== null
125
-                    ) {
126
-                        $all_ints = false;
127
-                    }
128
-                }
129
-            );
130
-            if ($all_ints) {
131
-                $normalization = new EE_Int_Normalization();
132
-            } else {
133
-                $normalization = new EE_Text_Normalization();
134
-            }
135
-        }
136
-        // does input type have multiple options ?
137
-        if ($this->_multiple_selections) {
138
-            $this->_set_normalization_strategy(new EE_Many_Valued_Normalization($normalization));
139
-        } else {
140
-            $this->_set_normalization_strategy($normalization);
141
-        }
142
-    }
143
-
144
-
145
-
146
-    /**
147
-     * @return array
148
-     */
149
-    public function options()
150
-    {
151
-        return $this->_options;
152
-    }
153
-
154
-
155
-
156
-    /**
157
-     * Returns an array which is guaranteed to not be multidimensional
158
-     *
159
-     * @return array
160
-     */
161
-    public function flat_options()
162
-    {
163
-        return $this->_flatten_select_options($this->options());
164
-    }
165
-
166
-
167
-
168
-    /**
169
-     * Makes sure $arr is a flat array, not a multidimensional one
170
-     *
171
-     * @param array $arr
172
-     * @return array
173
-     */
174
-    protected function _flatten_select_options($arr)
175
-    {
176
-        $flat_array = array();
177
-        if (EEH_Array::is_multi_dimensional_array($arr)) {
178
-            foreach ($arr as $sub_array) {
179
-                foreach ((array) $sub_array as $key => $value) {
180
-                    $flat_array[ $key ] = $value;
181
-                    $this->_set_label_size($value);
182
-                }
183
-            }
184
-        } else {
185
-            foreach ($arr as $key => $value) {
186
-                $flat_array[ $key ] = $value;
187
-                $this->_set_label_size($value);
188
-            }
189
-        }
190
-        return $flat_array;
191
-    }
192
-
193
-
194
-
195
-    /**
196
-     * @param EE_Question_Option[] $question_options_array
197
-     * @return array
198
-     */
199
-    protected function _process_question_options($question_options_array = array())
200
-    {
201
-        $flat_array = array();
202
-        foreach ($question_options_array as $question_option) {
203
-            if ($question_option instanceof EE_Question_Option) {
204
-                $desc = '';
205
-                if ($this->_use_desc_in_label) {
206
-                    $desc = $question_option->desc();
207
-                    $desc = ! empty($desc) ? '<span class="ee-question-option-desc">' . $desc . '</span>' : '';
208
-                }
209
-                $value = $question_option->value();
210
-                // add value even if it's empty
211
-                $flat_array[ $value ] = $value;
212
-                // if both value and desc are not empty, then separate with a dash
213
-                if (! empty($value) && ! empty($desc)) {
214
-                    $flat_array[ $value ] .= ' - ' . $desc;
215
-                } else {
216
-                    // otherwise, just add desc, since either or both of the vars is empty, and no dash is necessary
217
-                    $flat_array[ $value ] .= $desc;
218
-                }
219
-            } elseif (is_array($question_option)) {
220
-                $flat_array += $this->_flatten_select_options($question_option);
221
-            }
222
-        }
223
-        return $flat_array;
224
-    }
225
-
226
-
227
-
228
-    /**
229
-     *    set_label_sizes
230
-     *
231
-     * @return void
232
-     */
233
-    public function set_label_sizes()
234
-    {
235
-        // did the input settings specifically say to NOT set the label size dynamically ?
236
-        if (! $this->_enforce_label_size) {
237
-            foreach ($this->_options as $option) {
238
-                // calculate the strlen of the label
239
-                $this->_set_label_size($option);
240
-            }
241
-        }
242
-    }
243
-
244
-
245
-
246
-    /**
247
-     *    _set_label_size_class
248
-     *
249
-     * @param int|string $value
250
-     * @return void
251
-     */
252
-    private function _set_label_size($value = '')
253
-    {
254
-        // don't change label size if it has already been set and is being enforced
255
-        if ($this->_enforce_label_size && $this->_label_size >  0) {
256
-            return;
257
-        }
258
-        // determine length of option value
259
-        $val_size = is_int($value) ? $value : strlen($value);
260
-        // use new value if bigger than existing
261
-        $this->_label_size = $val_size > $this->_label_size ? $val_size : $this->_label_size;
262
-    }
263
-
264
-
265
-
266
-    /**
267
-     *    get_label_size_class
268
-     *
269
-     * @return string
270
-     */
271
-    public function get_label_size_class()
272
-    {
273
-        $size = ' medium-lbl';
274
-        // use maximum option value length to determine label size
275
-        if ($this->_label_size < 3) {
276
-            $size = ' nano-lbl';
277
-        } elseif ($this->_label_size < 6) {
278
-            $size = ' micro-lbl';
279
-        } elseif ($this->_label_size < 12) {
280
-            $size = ' tiny-lbl';
281
-        } elseif ($this->_label_size < 25) {
282
-            $size = ' small-lbl';
283
-        } elseif ($this->_label_size < 50) {
284
-            $size = ' medium-lbl';
285
-        } elseif ($this->_label_size >= 100) {
286
-            $size = ' big-lbl';
287
-        }
288
-        return $size;
289
-    }
290
-
291
-
292
-
293
-    /**
294
-     * Returns the pretty value for the normalized value
295
-     *
296
-     * @return string
297
-     */
298
-    public function pretty_value()
299
-    {
300
-        $options = $this->flat_options();
301
-        $unnormalized_value_choices = $this->get_normalization_strategy()->unnormalize($this->_normalized_value);
302
-        if (! $this->_multiple_selections) {
303
-            $unnormalized_value_choices = array($unnormalized_value_choices);
304
-        }
305
-        $pretty_strings = array();
306
-        foreach ((array) $unnormalized_value_choices as $unnormalized_value_choice) {
307
-            if (isset($options[ $unnormalized_value_choice ])) {
308
-                $pretty_strings[] = $options[ $unnormalized_value_choice ];
309
-            } else {
310
-                $pretty_strings[] = $this->normalized_value();
311
-            }
312
-        }
313
-        return implode(', ', $pretty_strings);
314
-    }
315
-
316
-
317
-
318
-    /**
319
-     * @return boolean
320
-     */
321
-    public function display_html_label_text()
322
-    {
323
-        return $this->_display_html_label_text;
324
-    }
325
-
326
-
327
-
328
-    /**
329
-     * @param boolean $display_html_label_text
330
-     */
331
-    public function set_display_html_label_text($display_html_label_text)
332
-    {
333
-        $this->_display_html_label_text = filter_var($display_html_label_text, FILTER_VALIDATE_BOOLEAN);
334
-    }
15
+	/**
16
+	 * array of available options to choose as an answer
17
+	 *
18
+	 * @var array
19
+	 */
20
+	protected $_options = array();
21
+
22
+	/**
23
+	 * whether to display the html_label_text above the checkbox/radio button options
24
+	 *
25
+	 * @var boolean
26
+	 */
27
+	protected $_display_html_label_text = true;
28
+
29
+	/**
30
+	 * whether to display an question option description as part of the input label
31
+	 *
32
+	 * @var boolean
33
+	 */
34
+	protected $_use_desc_in_label = true;
35
+
36
+	/**
37
+	 * strlen() result for the longest input value (what gets displayed in the label)
38
+	 * this is used to apply a css class to the input label
39
+	 *
40
+	 * @var int
41
+	 */
42
+	protected $_label_size = 0;
43
+
44
+	/**
45
+	 * whether to enforce the label size value passed in the constructor
46
+	 *
47
+	 * @var boolean
48
+	 */
49
+	protected $_enforce_label_size = false;
50
+
51
+	/**
52
+	 * whether to allow multiple selections (ie, the value of this input should be an array)
53
+	 * or not (ie, the value should be a simple int, string, etc)
54
+	 *
55
+	 * @var boolean
56
+	 */
57
+	protected $_multiple_selections = false;
58
+
59
+
60
+
61
+	/**
62
+	 * @param array     $answer_options
63
+	 * @param array     $input_settings {
64
+	 * @type int|string $label_size
65
+	 * @type boolean    $display_html_label_text
66
+	 *                                  }
67
+	 *                                  And all the options accepted by EE_Form_Input_Base
68
+	 */
69
+	public function __construct($answer_options = array(), $input_settings = array())
70
+	{
71
+		if (isset($input_settings['label_size'])) {
72
+			$this->_set_label_size($input_settings['label_size']);
73
+			if (isset($input_settings['enforce_label_size']) && $input_settings['enforce_label_size']) {
74
+				$this->_enforce_label_size = true;
75
+			}
76
+		}
77
+		if (isset($input_settings['display_html_label_text'])) {
78
+			$this->set_display_html_label_text($input_settings['display_html_label_text']);
79
+		}
80
+		$this->set_select_options($answer_options);
81
+		parent::__construct($input_settings);
82
+	}
83
+
84
+
85
+
86
+	/**
87
+	 * Sets the allowed options for this input. Also has the side-effect of
88
+	 * updating the normalization strategy to match the keys provided in the array
89
+	 *
90
+	 * @param array $answer_options
91
+	 * @return void  just has the side-effect of setting the options for this input
92
+	 */
93
+	public function set_select_options($answer_options = array())
94
+	{
95
+		$answer_options = is_array($answer_options) ? $answer_options : array($answer_options);
96
+		// get the first item in the select options and check it's type
97
+		$this->_options = reset($answer_options) instanceof EE_Question_Option
98
+			? $this->_process_question_options($answer_options)
99
+			: $answer_options;
100
+		// d( $this->_options );
101
+		$select_option_keys = array_keys($this->_options);
102
+		// attempt to determine data type for values in order to set normalization type
103
+		// purposefully only
104
+		if (
105
+			count($this->_options) === 2
106
+			&& (
107
+				(in_array(true, $select_option_keys, true) && in_array(false, $select_option_keys, true))
108
+				|| (in_array(1, $select_option_keys, true) && in_array(0, $select_option_keys, true))
109
+			)
110
+		) {
111
+			// values appear to be boolean, like TRUE, FALSE, 1, 0
112
+			$normalization = new EE_Boolean_Normalization();
113
+		} else {
114
+			// are ALL the options ints (even if we're using a multi-dimensional array)? If so use int validation
115
+			$all_ints = true;
116
+			array_walk_recursive(
117
+				$this->_options,
118
+				function ($value, $key) use (&$all_ints) {
119
+					// is this a top-level key? ignore it
120
+					if (
121
+						! is_array($value)
122
+						&& ! is_int($key)
123
+						&& $key !== ''
124
+						&& $key !== null
125
+					) {
126
+						$all_ints = false;
127
+					}
128
+				}
129
+			);
130
+			if ($all_ints) {
131
+				$normalization = new EE_Int_Normalization();
132
+			} else {
133
+				$normalization = new EE_Text_Normalization();
134
+			}
135
+		}
136
+		// does input type have multiple options ?
137
+		if ($this->_multiple_selections) {
138
+			$this->_set_normalization_strategy(new EE_Many_Valued_Normalization($normalization));
139
+		} else {
140
+			$this->_set_normalization_strategy($normalization);
141
+		}
142
+	}
143
+
144
+
145
+
146
+	/**
147
+	 * @return array
148
+	 */
149
+	public function options()
150
+	{
151
+		return $this->_options;
152
+	}
153
+
154
+
155
+
156
+	/**
157
+	 * Returns an array which is guaranteed to not be multidimensional
158
+	 *
159
+	 * @return array
160
+	 */
161
+	public function flat_options()
162
+	{
163
+		return $this->_flatten_select_options($this->options());
164
+	}
165
+
166
+
167
+
168
+	/**
169
+	 * Makes sure $arr is a flat array, not a multidimensional one
170
+	 *
171
+	 * @param array $arr
172
+	 * @return array
173
+	 */
174
+	protected function _flatten_select_options($arr)
175
+	{
176
+		$flat_array = array();
177
+		if (EEH_Array::is_multi_dimensional_array($arr)) {
178
+			foreach ($arr as $sub_array) {
179
+				foreach ((array) $sub_array as $key => $value) {
180
+					$flat_array[ $key ] = $value;
181
+					$this->_set_label_size($value);
182
+				}
183
+			}
184
+		} else {
185
+			foreach ($arr as $key => $value) {
186
+				$flat_array[ $key ] = $value;
187
+				$this->_set_label_size($value);
188
+			}
189
+		}
190
+		return $flat_array;
191
+	}
192
+
193
+
194
+
195
+	/**
196
+	 * @param EE_Question_Option[] $question_options_array
197
+	 * @return array
198
+	 */
199
+	protected function _process_question_options($question_options_array = array())
200
+	{
201
+		$flat_array = array();
202
+		foreach ($question_options_array as $question_option) {
203
+			if ($question_option instanceof EE_Question_Option) {
204
+				$desc = '';
205
+				if ($this->_use_desc_in_label) {
206
+					$desc = $question_option->desc();
207
+					$desc = ! empty($desc) ? '<span class="ee-question-option-desc">' . $desc . '</span>' : '';
208
+				}
209
+				$value = $question_option->value();
210
+				// add value even if it's empty
211
+				$flat_array[ $value ] = $value;
212
+				// if both value and desc are not empty, then separate with a dash
213
+				if (! empty($value) && ! empty($desc)) {
214
+					$flat_array[ $value ] .= ' - ' . $desc;
215
+				} else {
216
+					// otherwise, just add desc, since either or both of the vars is empty, and no dash is necessary
217
+					$flat_array[ $value ] .= $desc;
218
+				}
219
+			} elseif (is_array($question_option)) {
220
+				$flat_array += $this->_flatten_select_options($question_option);
221
+			}
222
+		}
223
+		return $flat_array;
224
+	}
225
+
226
+
227
+
228
+	/**
229
+	 *    set_label_sizes
230
+	 *
231
+	 * @return void
232
+	 */
233
+	public function set_label_sizes()
234
+	{
235
+		// did the input settings specifically say to NOT set the label size dynamically ?
236
+		if (! $this->_enforce_label_size) {
237
+			foreach ($this->_options as $option) {
238
+				// calculate the strlen of the label
239
+				$this->_set_label_size($option);
240
+			}
241
+		}
242
+	}
243
+
244
+
245
+
246
+	/**
247
+	 *    _set_label_size_class
248
+	 *
249
+	 * @param int|string $value
250
+	 * @return void
251
+	 */
252
+	private function _set_label_size($value = '')
253
+	{
254
+		// don't change label size if it has already been set and is being enforced
255
+		if ($this->_enforce_label_size && $this->_label_size >  0) {
256
+			return;
257
+		}
258
+		// determine length of option value
259
+		$val_size = is_int($value) ? $value : strlen($value);
260
+		// use new value if bigger than existing
261
+		$this->_label_size = $val_size > $this->_label_size ? $val_size : $this->_label_size;
262
+	}
263
+
264
+
265
+
266
+	/**
267
+	 *    get_label_size_class
268
+	 *
269
+	 * @return string
270
+	 */
271
+	public function get_label_size_class()
272
+	{
273
+		$size = ' medium-lbl';
274
+		// use maximum option value length to determine label size
275
+		if ($this->_label_size < 3) {
276
+			$size = ' nano-lbl';
277
+		} elseif ($this->_label_size < 6) {
278
+			$size = ' micro-lbl';
279
+		} elseif ($this->_label_size < 12) {
280
+			$size = ' tiny-lbl';
281
+		} elseif ($this->_label_size < 25) {
282
+			$size = ' small-lbl';
283
+		} elseif ($this->_label_size < 50) {
284
+			$size = ' medium-lbl';
285
+		} elseif ($this->_label_size >= 100) {
286
+			$size = ' big-lbl';
287
+		}
288
+		return $size;
289
+	}
290
+
291
+
292
+
293
+	/**
294
+	 * Returns the pretty value for the normalized value
295
+	 *
296
+	 * @return string
297
+	 */
298
+	public function pretty_value()
299
+	{
300
+		$options = $this->flat_options();
301
+		$unnormalized_value_choices = $this->get_normalization_strategy()->unnormalize($this->_normalized_value);
302
+		if (! $this->_multiple_selections) {
303
+			$unnormalized_value_choices = array($unnormalized_value_choices);
304
+		}
305
+		$pretty_strings = array();
306
+		foreach ((array) $unnormalized_value_choices as $unnormalized_value_choice) {
307
+			if (isset($options[ $unnormalized_value_choice ])) {
308
+				$pretty_strings[] = $options[ $unnormalized_value_choice ];
309
+			} else {
310
+				$pretty_strings[] = $this->normalized_value();
311
+			}
312
+		}
313
+		return implode(', ', $pretty_strings);
314
+	}
315
+
316
+
317
+
318
+	/**
319
+	 * @return boolean
320
+	 */
321
+	public function display_html_label_text()
322
+	{
323
+		return $this->_display_html_label_text;
324
+	}
325
+
326
+
327
+
328
+	/**
329
+	 * @param boolean $display_html_label_text
330
+	 */
331
+	public function set_display_html_label_text($display_html_label_text)
332
+	{
333
+		$this->_display_html_label_text = filter_var($display_html_label_text, FILTER_VALIDATE_BOOLEAN);
334
+	}
335 335
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             $all_ints = true;
116 116
             array_walk_recursive(
117 117
                 $this->_options,
118
-                function ($value, $key) use (&$all_ints) {
118
+                function($value, $key) use (&$all_ints) {
119 119
                     // is this a top-level key? ignore it
120 120
                     if (
121 121
                         ! is_array($value)
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
         if (EEH_Array::is_multi_dimensional_array($arr)) {
178 178
             foreach ($arr as $sub_array) {
179 179
                 foreach ((array) $sub_array as $key => $value) {
180
-                    $flat_array[ $key ] = $value;
180
+                    $flat_array[$key] = $value;
181 181
                     $this->_set_label_size($value);
182 182
                 }
183 183
             }
184 184
         } else {
185 185
             foreach ($arr as $key => $value) {
186
-                $flat_array[ $key ] = $value;
186
+                $flat_array[$key] = $value;
187 187
                 $this->_set_label_size($value);
188 188
             }
189 189
         }
@@ -204,17 +204,17 @@  discard block
 block discarded – undo
204 204
                 $desc = '';
205 205
                 if ($this->_use_desc_in_label) {
206 206
                     $desc = $question_option->desc();
207
-                    $desc = ! empty($desc) ? '<span class="ee-question-option-desc">' . $desc . '</span>' : '';
207
+                    $desc = ! empty($desc) ? '<span class="ee-question-option-desc">'.$desc.'</span>' : '';
208 208
                 }
209 209
                 $value = $question_option->value();
210 210
                 // add value even if it's empty
211
-                $flat_array[ $value ] = $value;
211
+                $flat_array[$value] = $value;
212 212
                 // if both value and desc are not empty, then separate with a dash
213
-                if (! empty($value) && ! empty($desc)) {
214
-                    $flat_array[ $value ] .= ' - ' . $desc;
213
+                if ( ! empty($value) && ! empty($desc)) {
214
+                    $flat_array[$value] .= ' - '.$desc;
215 215
                 } else {
216 216
                     // otherwise, just add desc, since either or both of the vars is empty, and no dash is necessary
217
-                    $flat_array[ $value ] .= $desc;
217
+                    $flat_array[$value] .= $desc;
218 218
                 }
219 219
             } elseif (is_array($question_option)) {
220 220
                 $flat_array += $this->_flatten_select_options($question_option);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     public function set_label_sizes()
234 234
     {
235 235
         // did the input settings specifically say to NOT set the label size dynamically ?
236
-        if (! $this->_enforce_label_size) {
236
+        if ( ! $this->_enforce_label_size) {
237 237
             foreach ($this->_options as $option) {
238 238
                 // calculate the strlen of the label
239 239
                 $this->_set_label_size($option);
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
     private function _set_label_size($value = '')
253 253
     {
254 254
         // don't change label size if it has already been set and is being enforced
255
-        if ($this->_enforce_label_size && $this->_label_size >  0) {
255
+        if ($this->_enforce_label_size && $this->_label_size > 0) {
256 256
             return;
257 257
         }
258 258
         // determine length of option value
@@ -299,13 +299,13 @@  discard block
 block discarded – undo
299 299
     {
300 300
         $options = $this->flat_options();
301 301
         $unnormalized_value_choices = $this->get_normalization_strategy()->unnormalize($this->_normalized_value);
302
-        if (! $this->_multiple_selections) {
302
+        if ( ! $this->_multiple_selections) {
303 303
             $unnormalized_value_choices = array($unnormalized_value_choices);
304 304
         }
305 305
         $pretty_strings = array();
306 306
         foreach ((array) $unnormalized_value_choices as $unnormalized_value_choice) {
307
-            if (isset($options[ $unnormalized_value_choice ])) {
308
-                $pretty_strings[] = $options[ $unnormalized_value_choice ];
307
+            if (isset($options[$unnormalized_value_choice])) {
308
+                $pretty_strings[] = $options[$unnormalized_value_choice];
309 309
             } else {
310 310
                 $pretty_strings[] = $this->normalized_value();
311 311
             }
Please login to merge, or discard this patch.
strategies/display/EE_Text_Input_Display_Strategy.strategy.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -14,59 +14,59 @@
 block discarded – undo
14 14
  */
15 15
 class EE_Text_Input_Display_Strategy extends EE_Display_Strategy_Base
16 16
 {
17
-    /**
18
-     * The html "type" attribute value. default is "text"
19
-     * @var string
20
-     */
21
-    protected $_type;
17
+	/**
18
+	 * The html "type" attribute value. default is "text"
19
+	 * @var string
20
+	 */
21
+	protected $_type;
22 22
 
23 23
 
24 24
 
25
-    /**
26
-     * @param string $type
27
-     */
28
-    public function __construct($type = 'text')
29
-    {
30
-        $this->_type = $type;
31
-        parent::__construct();
32
-    }
25
+	/**
26
+	 * @param string $type
27
+	 */
28
+	public function __construct($type = 'text')
29
+	{
30
+		$this->_type = $type;
31
+		parent::__construct();
32
+	}
33 33
 
34 34
 
35 35
 
36
-    /**
37
-     * Gets the html "type" attribute's value
38
-     * @return string
39
-     */
40
-    public function get_type()
41
-    {
42
-        if (
43
-            $this->_type === 'email'
44
-            && ! apply_filters('FHEE__EE_Text_Input_Display_Strategy__use_html5_email', false)
45
-        ) {
46
-            return 'text';
47
-        }
48
-        return $this->_type;
49
-    }
36
+	/**
37
+	 * Gets the html "type" attribute's value
38
+	 * @return string
39
+	 */
40
+	public function get_type()
41
+	{
42
+		if (
43
+			$this->_type === 'email'
44
+			&& ! apply_filters('FHEE__EE_Text_Input_Display_Strategy__use_html5_email', false)
45
+		) {
46
+			return 'text';
47
+		}
48
+		return $this->_type;
49
+	}
50 50
 
51 51
 
52 52
 
53
-    /**
54
-     *
55
-     * @return string of html to display the field
56
-     */
57
-    public function display()
58
-    {
59
-        $input = '<input type="' . $this->get_type() . '"';
60
-        $input .= ' name="' . $this->_input->html_name() . '"';
61
-        $input .= ' id="' . $this->_input->html_id() . '"';
62
-        $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class();
63
-        $input .= ' class="' . $class . '"';
64
-        // add html5 required
65
-        $input .= $this->_input->required() ? ' required' : '';
66
-        $input .= ' value="' . $this->_input->raw_value_in_form() . '"';
67
-        $input .= ' style="' . $this->_input->html_style() . '"';
68
-        $input .= $this->_input->other_html_attributes();
69
-        $input .= '/>';
70
-        return $input;
71
-    }
53
+	/**
54
+	 *
55
+	 * @return string of html to display the field
56
+	 */
57
+	public function display()
58
+	{
59
+		$input = '<input type="' . $this->get_type() . '"';
60
+		$input .= ' name="' . $this->_input->html_name() . '"';
61
+		$input .= ' id="' . $this->_input->html_id() . '"';
62
+		$class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class();
63
+		$input .= ' class="' . $class . '"';
64
+		// add html5 required
65
+		$input .= $this->_input->required() ? ' required' : '';
66
+		$input .= ' value="' . $this->_input->raw_value_in_form() . '"';
67
+		$input .= ' style="' . $this->_input->html_style() . '"';
68
+		$input .= $this->_input->other_html_attributes();
69
+		$input .= '/>';
70
+		return $input;
71
+	}
72 72
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -56,15 +56,15 @@
 block discarded – undo
56 56
      */
57 57
     public function display()
58 58
     {
59
-        $input = '<input type="' . $this->get_type() . '"';
60
-        $input .= ' name="' . $this->_input->html_name() . '"';
61
-        $input .= ' id="' . $this->_input->html_id() . '"';
62
-        $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class();
63
-        $input .= ' class="' . $class . '"';
59
+        $input = '<input type="'.$this->get_type().'"';
60
+        $input .= ' name="'.$this->_input->html_name().'"';
61
+        $input .= ' id="'.$this->_input->html_id().'"';
62
+        $class = $this->_input->required() ? $this->_input->required_css_class().' '.$this->_input->html_class() : $this->_input->html_class();
63
+        $input .= ' class="'.$class.'"';
64 64
         // add html5 required
65 65
         $input .= $this->_input->required() ? ' required' : '';
66
-        $input .= ' value="' . $this->_input->raw_value_in_form() . '"';
67
-        $input .= ' style="' . $this->_input->html_style() . '"';
66
+        $input .= ' value="'.$this->_input->raw_value_in_form().'"';
67
+        $input .= ' style="'.$this->_input->html_style().'"';
68 68
         $input .= $this->_input->other_html_attributes();
69 69
         $input .= '/>';
70 70
         return $input;
Please login to merge, or discard this patch.
sensitive_data_removal/EE_CCV_Sensitive_Data_Removal.strategy.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,18 +11,18 @@
 block discarded – undo
11 11
  */
12 12
 class EE_CCV_Sensitive_Data_Removal extends EE_Sensitive_Data_Removal_Base
13 13
 {
14
-    public function remove_sensitive_data($normalized_value)
15
-    {
16
-        // Get the ccv Length
17
-        $ccv_lenght = strlen($normalized_value);
18
-        // Replace all characters of credit card except the last four and dashes
19
-        for ($i = 0; $i < $ccv_lenght; $i++) {
20
-            if ($normalized_value[ $i ] == '-') {
21
-                continue;
22
-            }
23
-            $normalized_value[ $i ] = 'X';
24
-        }
25
-        // Return the masked Credit Card #
26
-        return $normalized_value;
27
-    }
14
+	public function remove_sensitive_data($normalized_value)
15
+	{
16
+		// Get the ccv Length
17
+		$ccv_lenght = strlen($normalized_value);
18
+		// Replace all characters of credit card except the last four and dashes
19
+		for ($i = 0; $i < $ccv_lenght; $i++) {
20
+			if ($normalized_value[ $i ] == '-') {
21
+				continue;
22
+			}
23
+			$normalized_value[ $i ] = 'X';
24
+		}
25
+		// Return the masked Credit Card #
26
+		return $normalized_value;
27
+	}
28 28
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@
 block discarded – undo
17 17
         $ccv_lenght = strlen($normalized_value);
18 18
         // Replace all characters of credit card except the last four and dashes
19 19
         for ($i = 0; $i < $ccv_lenght; $i++) {
20
-            if ($normalized_value[ $i ] == '-') {
20
+            if ($normalized_value[$i] == '-') {
21 21
                 continue;
22 22
             }
23
-            $normalized_value[ $i ] = 'X';
23
+            $normalized_value[$i] = 'X';
24 24
         }
25 25
         // Return the masked Credit Card #
26 26
         return $normalized_value;
Please login to merge, or discard this patch.