Completed
Branch models-cleanup/model-relations (db5ca7)
by
unknown
13:03 queued 08:35
created
strategies/display/EE_Submit_Input_Display_Strategy.strategy.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -12,29 +12,29 @@
 block discarded – undo
12 12
 class EE_Submit_Input_Display_Strategy extends EE_Display_Strategy_Base
13 13
 {
14 14
 
15
-    /**
16
-     * @return string of html to display the input
17
-     */
18
-    public function display()
19
-    {
20
-        $default_value = $this->_input->get_default();
21
-        if ($this->_input->get_normalization_strategy() instanceof EE_Normalization_Strategy_Base) {
22
-            $default_value = $this->_input->get_normalization_strategy()->unnormalize($default_value);
23
-        }
24
-        $html = $this->_opening_tag('input');
25
-        $html .= $this->_attributes_string(
26
-            array_merge(
27
-                $this->_standard_attributes_array(),
28
-                array(
29
-                    'type'  => 'submit',
30
-                    'value' => $default_value,
31
-                    // overwrite the standard id with the backwards compatible one
32
-                    'id' => $this->_input->html_id() . '-submit',
33
-                    'class' => $this->_input->html_class() . ' ' . $this->_input->button_css_attributes()
34
-                )
35
-            )
36
-        );
37
-        $html .= $this->_close_tag();
38
-        return $html;
39
-    }
15
+	/**
16
+	 * @return string of html to display the input
17
+	 */
18
+	public function display()
19
+	{
20
+		$default_value = $this->_input->get_default();
21
+		if ($this->_input->get_normalization_strategy() instanceof EE_Normalization_Strategy_Base) {
22
+			$default_value = $this->_input->get_normalization_strategy()->unnormalize($default_value);
23
+		}
24
+		$html = $this->_opening_tag('input');
25
+		$html .= $this->_attributes_string(
26
+			array_merge(
27
+				$this->_standard_attributes_array(),
28
+				array(
29
+					'type'  => 'submit',
30
+					'value' => $default_value,
31
+					// overwrite the standard id with the backwards compatible one
32
+					'id' => $this->_input->html_id() . '-submit',
33
+					'class' => $this->_input->html_class() . ' ' . $this->_input->button_css_attributes()
34
+				)
35
+			)
36
+		);
37
+		$html .= $this->_close_tag();
38
+		return $html;
39
+	}
40 40
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@
 block discarded – undo
29 29
                     'type'  => 'submit',
30 30
                     'value' => $default_value,
31 31
                     // overwrite the standard id with the backwards compatible one
32
-                    'id' => $this->_input->html_id() . '-submit',
33
-                    'class' => $this->_input->html_class() . ' ' . $this->_input->button_css_attributes()
32
+                    'id' => $this->_input->html_id().'-submit',
33
+                    'class' => $this->_input->html_class().' '.$this->_input->button_css_attributes()
34 34
                 )
35 35
             )
36 36
         );
Please login to merge, or discard this patch.
form_sections/strategies/display/EE_Number_Input_Display_Strategy.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -11,109 +11,109 @@
 block discarded – undo
11 11
 class EE_Number_Input_Display_Strategy extends EE_Display_Strategy_Base
12 12
 {
13 13
 
14
-    /**
15
-     * minimum value for number field
16
-     *
17
-     * @var int|null $min
18
-     */
19
-    protected $min;
14
+	/**
15
+	 * minimum value for number field
16
+	 *
17
+	 * @var int|null $min
18
+	 */
19
+	protected $min;
20 20
 
21
-    /**
22
-     * maximum value for number field
23
-     *
24
-     * @var int|null $max
25
-     */
26
-    protected $max;
21
+	/**
22
+	 * maximum value for number field
23
+	 *
24
+	 * @var int|null $max
25
+	 */
26
+	protected $max;
27 27
 
28 28
 
29
-    /**
30
-     * This is used to set the "step" attribute for the html5 number input.
31
-     * Controls the increments on the input when incrementing or decrementing the value.
32
-     * Note:  Although the step attribute allows for the string "any" to be used, Firefox and Chrome will interpret that
33
-     * to increment by 1.  So although "any" is accepted as a value, it is converted to 1.
34
-     * @var float
35
-     */
36
-    protected $step;
29
+	/**
30
+	 * This is used to set the "step" attribute for the html5 number input.
31
+	 * Controls the increments on the input when incrementing or decrementing the value.
32
+	 * Note:  Although the step attribute allows for the string "any" to be used, Firefox and Chrome will interpret that
33
+	 * to increment by 1.  So although "any" is accepted as a value, it is converted to 1.
34
+	 * @var float
35
+	 */
36
+	protected $step;
37 37
 
38 38
 
39
-    /**
40
-     * EE_Number_Input_Display_Strategy constructor.
41
-     * Null is the default value for the incoming arguments because 0 is a valid value.  So we use null
42
-     * to indicate NOT setting this attribute.
43
-     *
44
-     * @param int|null $min
45
-     * @param int|null $max
46
-     * @param int|null $step
47
-     * @throws InvalidArgumentException
48
-     */
49
-    public function __construct($min = null, $max = null, $step = null)
50
-    {
51
-        $this->min = is_numeric($min) || $min === null
52
-            ? $min
53
-            : $this->throwValidationException('min', $min);
54
-        $this->max = is_numeric($max) || $max === null
55
-            ? $max
56
-            : $this->throwValidationException('max', $max);
57
-        $step = $step === 'any' ? 1 : $step;
58
-        $this->step = is_numeric($step) || $step === null
59
-            ? $step
60
-            : $this->throwValidationException('step', $step);
61
-    }
39
+	/**
40
+	 * EE_Number_Input_Display_Strategy constructor.
41
+	 * Null is the default value for the incoming arguments because 0 is a valid value.  So we use null
42
+	 * to indicate NOT setting this attribute.
43
+	 *
44
+	 * @param int|null $min
45
+	 * @param int|null $max
46
+	 * @param int|null $step
47
+	 * @throws InvalidArgumentException
48
+	 */
49
+	public function __construct($min = null, $max = null, $step = null)
50
+	{
51
+		$this->min = is_numeric($min) || $min === null
52
+			? $min
53
+			: $this->throwValidationException('min', $min);
54
+		$this->max = is_numeric($max) || $max === null
55
+			? $max
56
+			: $this->throwValidationException('max', $max);
57
+		$step = $step === 'any' ? 1 : $step;
58
+		$this->step = is_numeric($step) || $step === null
59
+			? $step
60
+			: $this->throwValidationException('step', $step);
61
+	}
62 62
 
63 63
 
64
-    private function throwValidationException($argument_label, $argument_value)
65
-    {
66
-        throw new InvalidArgumentException(
67
-            sprintf(
68
-                esc_html__(
69
-                    'The %1$s parameter value for %2$s must be numeric or null, %3$s was passed into the constructor.',
70
-                    'event_espresso'
71
-                ),
72
-                $argument_label,
73
-                __CLASS__,
74
-                $argument_value
75
-            )
76
-        );
77
-    }
64
+	private function throwValidationException($argument_label, $argument_value)
65
+	{
66
+		throw new InvalidArgumentException(
67
+			sprintf(
68
+				esc_html__(
69
+					'The %1$s parameter value for %2$s must be numeric or null, %3$s was passed into the constructor.',
70
+					'event_espresso'
71
+				),
72
+				$argument_label,
73
+				__CLASS__,
74
+				$argument_value
75
+			)
76
+		);
77
+	}
78 78
 
79 79
 
80 80
 
81
-    /**
82
-     * @return string of html to display the field
83
-     */
84
-    public function display()
85
-    {
86
-        $input = $this->_opening_tag('input');
87
-        $input .= $this->_attributes_string(
88
-            array_merge(
89
-                $this->_standard_attributes_array(),
90
-                $this->getNumberInputAttributes()
91
-            )
92
-        );
93
-        $input .= $this->_close_tag();
94
-        return $input;
95
-    }
81
+	/**
82
+	 * @return string of html to display the field
83
+	 */
84
+	public function display()
85
+	{
86
+		$input = $this->_opening_tag('input');
87
+		$input .= $this->_attributes_string(
88
+			array_merge(
89
+				$this->_standard_attributes_array(),
90
+				$this->getNumberInputAttributes()
91
+			)
92
+		);
93
+		$input .= $this->_close_tag();
94
+		return $input;
95
+	}
96 96
 
97 97
 
98
-    /**
99
-     * Return the attributes specific to this display strategy
100
-     * @return array
101
-     */
102
-    private function getNumberInputAttributes()
103
-    {
104
-        $attributes = array(
105
-            'type' => 'number',
106
-            'value' => $this->_input->raw_value_in_form()
107
-        );
108
-        if ($this->min !== null) {
109
-            $attributes['min'] = $this->min;
110
-        }
111
-        if ($this->max !== null) {
112
-            $attributes['max'] = $this->max;
113
-        }
114
-        if ($this->step !== null) {
115
-            $attributes['step'] = $this->step;
116
-        }
117
-        return $attributes;
118
-    }
98
+	/**
99
+	 * Return the attributes specific to this display strategy
100
+	 * @return array
101
+	 */
102
+	private function getNumberInputAttributes()
103
+	{
104
+		$attributes = array(
105
+			'type' => 'number',
106
+			'value' => $this->_input->raw_value_in_form()
107
+		);
108
+		if ($this->min !== null) {
109
+			$attributes['min'] = $this->min;
110
+		}
111
+		if ($this->max !== null) {
112
+			$attributes['max'] = $this->max;
113
+		}
114
+		if ($this->step !== null) {
115
+			$attributes['step'] = $this->step;
116
+		}
117
+		return $attributes;
118
+	}
119 119
 }
Please login to merge, or discard this patch.
form_sections/strategies/display/EE_Hidden_Display_Strategy.strategy.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
  */
12 12
 class EE_Hidden_Display_Strategy extends EE_Display_Strategy_Base
13 13
 {
14
-    /**
15
-     *
16
-     * @return string of html to display the HIDDEN field
17
-     */
18
-    public function display()
19
-    {
20
-        $input = $this->_input;
21
-        return "<input type='hidden' id='{$input->html_id()}' name='{$input->html_name()}' class='{$input->html_class()}' style='{$input->html_style()}' value='{$input->raw_value_in_form()}' {$input->other_html_attributes()}/>";
22
-    }
14
+	/**
15
+	 *
16
+	 * @return string of html to display the HIDDEN field
17
+	 */
18
+	public function display()
19
+	{
20
+		$input = $this->_input;
21
+		return "<input type='hidden' id='{$input->html_id()}' name='{$input->html_name()}' class='{$input->html_class()}' style='{$input->html_style()}' value='{$input->raw_value_in_form()}' {$input->other_html_attributes()}/>";
22
+	}
23 23
 }
Please login to merge, or discard this patch.
form_sections/strategies/display/EE_Display_Strategy_Base.strategy.php 2 patches
Indentation   +226 added lines, -226 removed lines patch added patch discarded remove patch
@@ -11,236 +11,236 @@
 block discarded – undo
11 11
 {
12 12
 
13 13
 
14
-    /**
15
-     * @var string $_tag
16
-     */
17
-    protected $_tag = '';
14
+	/**
15
+	 * @var string $_tag
16
+	 */
17
+	protected $_tag = '';
18 18
 
19 19
 
20 20
 
21
-
22
-
23
-    /**
24
-     * returns HTML and javascript related to the displaying of this input
25
-     *
26
-     * @return string
27
-     */
28
-    abstract public function display();
21
+
22
+
23
+	/**
24
+	 * returns HTML and javascript related to the displaying of this input
25
+	 *
26
+	 * @return string
27
+	 */
28
+	abstract public function display();
29 29
 
30 30
 
31 31
 
32
-    /**
33
-     * _remove_chars - takes an incoming string, and removes the string $chars from the end of it, but only if $chars
34
-     * is already there
35
-     *
36
-     * @param string $string - the string being processed
37
-     * @param string $chars  - exact string of characters to remove
38
-     * @return string
39
-     */
40
-    protected function _remove_chars($string = '', $chars = '-')
41
-    {
42
-        $char_length = strlen($chars) * -1;
43
-        // if last three characters of string is  " - ", then remove it
44
-        return substr($string, $char_length) === $chars ? substr($string, 0, $char_length) : $string;
45
-    }
46
-
47
-
48
-
49
-    /**
50
-     * _append_chars - takes an incoming string, and adds the string $chars to the end of it, but only if $chars is not
51
-     * already there
52
-     *
53
-     * @param string $string - the string being processed
54
-     * @param string $chars  - exact string of characters to be added to end of string
55
-     * @return string
56
-     */
57
-    protected function _append_chars($string = '', $chars = '-')
58
-    {
59
-        return $this->_remove_chars($string, $chars) . $chars;
60
-    }
61
-
62
-
63
-
64
-    /**
65
-     * Gets the HTML IDs of all the inputs
66
-     *
67
-     * @param bool $add_pound_sign
68
-     * @return array
69
-     */
70
-    public function get_html_input_ids($add_pound_sign = false)
71
-    {
72
-        return array($this->get_input()->html_id($add_pound_sign));
73
-    }
74
-
75
-
76
-
77
-    /**
78
-     * Adds js variables for localization to the $other_js_data. These should be put
79
-     * in each form's "other_data" javascript object.
80
-     *
81
-     * @param array $other_js_data
82
-     * @return array
83
-     */
84
-    public function get_other_js_data($other_js_data = array())
85
-    {
86
-        return $other_js_data;
87
-    }
88
-
89
-
90
-
91
-    /**
92
-     * Opportunity for this display strategy to call wp_enqueue_script and wp_enqueue_style.
93
-     * This should be called during wp_enqueue_scripts
94
-     */
95
-    public function enqueue_js()
96
-    {
97
-    }
98
-
99
-
100
-
101
-    /**
102
-     * returns string like: '<tag'
103
-     *
104
-     * @param string $tag
105
-     * @return string
106
-     */
107
-    protected function _opening_tag($tag)
108
-    {
109
-        $this->_tag = $tag;
110
-        return "<{$this->_tag}";
111
-    }
112
-
113
-
114
-
115
-    /**
116
-     * returns string like: '</tag>
117
-     *
118
-     * @return string
119
-     */
120
-    protected function _closing_tag()
121
-    {
122
-        return "</{$this->_tag}>";
123
-    }
124
-
125
-
126
-
127
-    /**
128
-     * returns string like: '/>'
129
-     *
130
-     * @return string
131
-     */
132
-    protected function _close_tag()
133
-    {
134
-        return '/>';
135
-    }
136
-
137
-
138
-
139
-    /**
140
-     * returns an array of standard HTML attributes that get added to nearly all inputs,
141
-     * where string keys represent named attributes like id, class, etc
142
-     * and numeric keys represent single attributes like 'required'.
143
-     * Note: this does not include "value" because many inputs (like dropdowns, textareas, and checkboxes) don't use
144
-     * it.
145
-     *
146
-     * @return array
147
-     */
148
-    protected function _standard_attributes_array()
149
-    {
150
-        return array(
151
-            'name'  => $this->_input->html_name(),
152
-            'id'    => $this->_input->html_id(),
153
-            'class' => $this->_input->html_class(true),
154
-            0       => array('required', $this->_input->required()),
155
-            1       => $this->_input->other_html_attributes(),
156
-            'style' => $this->_input->html_style(),
157
-        );
158
-    }
159
-
160
-
161
-
162
-    /**
163
-     * sets the attributes using the incoming array
164
-     * and returns a string of all attributes rendered as valid HTML
165
-     *
166
-     * @param array $attributes
167
-     * @return string
168
-     */
169
-    protected function _attributes_string($attributes = array())
170
-    {
171
-        $attributes = apply_filters(
172
-            'FHEE__EE_Display_Strategy_Base__attributes_string__attributes',
173
-            $attributes,
174
-            $this,
175
-            $this->_input
176
-        );
177
-        $attributes_string = '';
178
-        foreach ($attributes as $attribute => $value) {
179
-            if (is_numeric($attribute)) {
180
-                $add = true;
181
-                if (is_array($value)) {
182
-                    $attribute = isset($value[0]) ? $value[0] : '';
183
-                    $add = isset($value[1]) ? $value[1] : false;
184
-                } else {
185
-                    $attribute = $value;
186
-                }
187
-                $attributes_string .= $this->_single_attribute($attribute, $add);
188
-            } else {
189
-                $attributes_string .= $this->_attribute($attribute, $value);
190
-            }
191
-        }
192
-        return $attributes_string;
193
-    }
194
-
195
-
196
-
197
-    /**
198
-     * returns string like: ' attribute="value"'
199
-     * returns an empty string if $value is null
200
-     *
201
-     * @param string $attribute
202
-     * @param string $value
203
-     * @return string
204
-     */
205
-    protected function _attribute($attribute, $value = '')
206
-    {
207
-        if ($value === null) {
208
-            return '';
209
-        }
210
-        $value = esc_attr($value);
211
-        return " {$attribute}=\"{$value}\"";
212
-    }
213
-
214
-
215
-
216
-    /**
217
-     * returns string like: ' data-attribute="value"'
218
-     * returns an empty string if $value is null
219
-     *
220
-     * @param string $attribute
221
-     * @param string $value
222
-     * @return string
223
-     */
224
-    protected function _data_attribute($attribute, $value = '')
225
-    {
226
-        if ($value === null) {
227
-            return '';
228
-        }
229
-        $value = esc_attr($value);
230
-        return " data-{$attribute}=\"{$value}\"";
231
-    }
232
-
233
-
234
-
235
-    /**
236
-     * returns string like: ' attribute' if $add is true
237
-     *
238
-     * @param string  $attribute
239
-     * @param boolean $add
240
-     * @return string
241
-     */
242
-    protected function _single_attribute($attribute, $add = true)
243
-    {
244
-        return $add ? " {$attribute}" : '';
245
-    }
32
+	/**
33
+	 * _remove_chars - takes an incoming string, and removes the string $chars from the end of it, but only if $chars
34
+	 * is already there
35
+	 *
36
+	 * @param string $string - the string being processed
37
+	 * @param string $chars  - exact string of characters to remove
38
+	 * @return string
39
+	 */
40
+	protected function _remove_chars($string = '', $chars = '-')
41
+	{
42
+		$char_length = strlen($chars) * -1;
43
+		// if last three characters of string is  " - ", then remove it
44
+		return substr($string, $char_length) === $chars ? substr($string, 0, $char_length) : $string;
45
+	}
46
+
47
+
48
+
49
+	/**
50
+	 * _append_chars - takes an incoming string, and adds the string $chars to the end of it, but only if $chars is not
51
+	 * already there
52
+	 *
53
+	 * @param string $string - the string being processed
54
+	 * @param string $chars  - exact string of characters to be added to end of string
55
+	 * @return string
56
+	 */
57
+	protected function _append_chars($string = '', $chars = '-')
58
+	{
59
+		return $this->_remove_chars($string, $chars) . $chars;
60
+	}
61
+
62
+
63
+
64
+	/**
65
+	 * Gets the HTML IDs of all the inputs
66
+	 *
67
+	 * @param bool $add_pound_sign
68
+	 * @return array
69
+	 */
70
+	public function get_html_input_ids($add_pound_sign = false)
71
+	{
72
+		return array($this->get_input()->html_id($add_pound_sign));
73
+	}
74
+
75
+
76
+
77
+	/**
78
+	 * Adds js variables for localization to the $other_js_data. These should be put
79
+	 * in each form's "other_data" javascript object.
80
+	 *
81
+	 * @param array $other_js_data
82
+	 * @return array
83
+	 */
84
+	public function get_other_js_data($other_js_data = array())
85
+	{
86
+		return $other_js_data;
87
+	}
88
+
89
+
90
+
91
+	/**
92
+	 * Opportunity for this display strategy to call wp_enqueue_script and wp_enqueue_style.
93
+	 * This should be called during wp_enqueue_scripts
94
+	 */
95
+	public function enqueue_js()
96
+	{
97
+	}
98
+
99
+
100
+
101
+	/**
102
+	 * returns string like: '<tag'
103
+	 *
104
+	 * @param string $tag
105
+	 * @return string
106
+	 */
107
+	protected function _opening_tag($tag)
108
+	{
109
+		$this->_tag = $tag;
110
+		return "<{$this->_tag}";
111
+	}
112
+
113
+
114
+
115
+	/**
116
+	 * returns string like: '</tag>
117
+	 *
118
+	 * @return string
119
+	 */
120
+	protected function _closing_tag()
121
+	{
122
+		return "</{$this->_tag}>";
123
+	}
124
+
125
+
126
+
127
+	/**
128
+	 * returns string like: '/>'
129
+	 *
130
+	 * @return string
131
+	 */
132
+	protected function _close_tag()
133
+	{
134
+		return '/>';
135
+	}
136
+
137
+
138
+
139
+	/**
140
+	 * returns an array of standard HTML attributes that get added to nearly all inputs,
141
+	 * where string keys represent named attributes like id, class, etc
142
+	 * and numeric keys represent single attributes like 'required'.
143
+	 * Note: this does not include "value" because many inputs (like dropdowns, textareas, and checkboxes) don't use
144
+	 * it.
145
+	 *
146
+	 * @return array
147
+	 */
148
+	protected function _standard_attributes_array()
149
+	{
150
+		return array(
151
+			'name'  => $this->_input->html_name(),
152
+			'id'    => $this->_input->html_id(),
153
+			'class' => $this->_input->html_class(true),
154
+			0       => array('required', $this->_input->required()),
155
+			1       => $this->_input->other_html_attributes(),
156
+			'style' => $this->_input->html_style(),
157
+		);
158
+	}
159
+
160
+
161
+
162
+	/**
163
+	 * sets the attributes using the incoming array
164
+	 * and returns a string of all attributes rendered as valid HTML
165
+	 *
166
+	 * @param array $attributes
167
+	 * @return string
168
+	 */
169
+	protected function _attributes_string($attributes = array())
170
+	{
171
+		$attributes = apply_filters(
172
+			'FHEE__EE_Display_Strategy_Base__attributes_string__attributes',
173
+			$attributes,
174
+			$this,
175
+			$this->_input
176
+		);
177
+		$attributes_string = '';
178
+		foreach ($attributes as $attribute => $value) {
179
+			if (is_numeric($attribute)) {
180
+				$add = true;
181
+				if (is_array($value)) {
182
+					$attribute = isset($value[0]) ? $value[0] : '';
183
+					$add = isset($value[1]) ? $value[1] : false;
184
+				} else {
185
+					$attribute = $value;
186
+				}
187
+				$attributes_string .= $this->_single_attribute($attribute, $add);
188
+			} else {
189
+				$attributes_string .= $this->_attribute($attribute, $value);
190
+			}
191
+		}
192
+		return $attributes_string;
193
+	}
194
+
195
+
196
+
197
+	/**
198
+	 * returns string like: ' attribute="value"'
199
+	 * returns an empty string if $value is null
200
+	 *
201
+	 * @param string $attribute
202
+	 * @param string $value
203
+	 * @return string
204
+	 */
205
+	protected function _attribute($attribute, $value = '')
206
+	{
207
+		if ($value === null) {
208
+			return '';
209
+		}
210
+		$value = esc_attr($value);
211
+		return " {$attribute}=\"{$value}\"";
212
+	}
213
+
214
+
215
+
216
+	/**
217
+	 * returns string like: ' data-attribute="value"'
218
+	 * returns an empty string if $value is null
219
+	 *
220
+	 * @param string $attribute
221
+	 * @param string $value
222
+	 * @return string
223
+	 */
224
+	protected function _data_attribute($attribute, $value = '')
225
+	{
226
+		if ($value === null) {
227
+			return '';
228
+		}
229
+		$value = esc_attr($value);
230
+		return " data-{$attribute}=\"{$value}\"";
231
+	}
232
+
233
+
234
+
235
+	/**
236
+	 * returns string like: ' attribute' if $add is true
237
+	 *
238
+	 * @param string  $attribute
239
+	 * @param boolean $add
240
+	 * @return string
241
+	 */
242
+	protected function _single_attribute($attribute, $add = true)
243
+	{
244
+		return $add ? " {$attribute}" : '';
245
+	}
246 246
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
      */
57 57
     protected function _append_chars($string = '', $chars = '-')
58 58
     {
59
-        return $this->_remove_chars($string, $chars) . $chars;
59
+        return $this->_remove_chars($string, $chars).$chars;
60 60
     }
61 61
 
62 62
 
Please login to merge, or discard this patch.
form_sections/strategies/display/EE_Text_Area_Display_Strategy.strategy.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@
 block discarded – undo
20 20
             $cols = 20;
21 21
         }
22 22
         $html = '<textarea';
23
-        $html .= ' id="' . $input->html_id() . '"';
24
-        $html .= ' name="' . $input->html_name() . '"';
25
-        $html .= ' class="' . $input->html_class() . '"' ;
26
-        $html .= ' style="' . $input->html_style() . '"';
23
+        $html .= ' id="'.$input->html_id().'"';
24
+        $html .= ' name="'.$input->html_name().'"';
25
+        $html .= ' class="'.$input->html_class().'"';
26
+        $html .= ' style="'.$input->html_style().'"';
27 27
         $html .= $input->other_html_attributes();
28
-        $html .= ' rows= "' . $rows . '" cols="' . $cols . '">';
28
+        $html .= ' rows= "'.$rows.'" cols="'.$cols.'">';
29 29
         $html .= esc_textarea($raw_value);
30 30
         $html .= '</textarea>';
31 31
         foreach ($this->_input->get_validation_strategies() as $validation_strategy) {
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -5,43 +5,43 @@
 block discarded – undo
5 5
 
6 6
 
7 7
 
8
-    /**
9
-    *
10
-    * @return string of html to display the field
11
-    */
12
-    public function display()
13
-    {
14
-        $input = $this->_input;
15
-        $raw_value = maybe_serialize($input->raw_value());
16
-        if ($input instanceof EE_Text_Area_Input) {
17
-            $rows = $input->get_rows();
18
-            $cols = $input->get_cols();
19
-        } else {
20
-            $rows = 4;
21
-            $cols = 20;
22
-        }
23
-        $html = '<textarea';
24
-        $html .= ' id="' . $input->html_id() . '"';
25
-        $html .= ' name="' . $input->html_name() . '"';
26
-        $html .= ' class="' . $input->html_class() . '"' ;
27
-        $html .= ' style="' . $input->html_style() . '"';
28
-        $html .= $input->other_html_attributes();
29
-        $html .= ' rows= "' . $rows . '" cols="' . $cols . '">';
30
-        $html .= esc_textarea($raw_value);
31
-        $html .= '</textarea>';
32
-        foreach ($this->_input->get_validation_strategies() as $validation_strategy) {
33
-            if (
34
-                $validation_strategy instanceof EE_Simple_HTML_Validation_Strategy
35
-                || $validation_strategy instanceof EE_Full_HTML_Validation_Strategy
36
-            ) {
37
-                $html .= sprintf(
38
-                    __('%1$s(allowed tags: %2$s)%3$s', 'event_espresso'),
39
-                    '<p class="ee-question-desc">',
40
-                    $validation_strategy->get_list_of_allowed_tags(),
41
-                    '</p>'
42
-                );
43
-            }
44
-        }
45
-        return $html;
46
-    }
8
+	/**
9
+	 *
10
+	 * @return string of html to display the field
11
+	 */
12
+	public function display()
13
+	{
14
+		$input = $this->_input;
15
+		$raw_value = maybe_serialize($input->raw_value());
16
+		if ($input instanceof EE_Text_Area_Input) {
17
+			$rows = $input->get_rows();
18
+			$cols = $input->get_cols();
19
+		} else {
20
+			$rows = 4;
21
+			$cols = 20;
22
+		}
23
+		$html = '<textarea';
24
+		$html .= ' id="' . $input->html_id() . '"';
25
+		$html .= ' name="' . $input->html_name() . '"';
26
+		$html .= ' class="' . $input->html_class() . '"' ;
27
+		$html .= ' style="' . $input->html_style() . '"';
28
+		$html .= $input->other_html_attributes();
29
+		$html .= ' rows= "' . $rows . '" cols="' . $cols . '">';
30
+		$html .= esc_textarea($raw_value);
31
+		$html .= '</textarea>';
32
+		foreach ($this->_input->get_validation_strategies() as $validation_strategy) {
33
+			if (
34
+				$validation_strategy instanceof EE_Simple_HTML_Validation_Strategy
35
+				|| $validation_strategy instanceof EE_Full_HTML_Validation_Strategy
36
+			) {
37
+				$html .= sprintf(
38
+					__('%1$s(allowed tags: %2$s)%3$s', 'event_espresso'),
39
+					'<p class="ee-question-desc">',
40
+					$validation_strategy->get_list_of_allowed_tags(),
41
+					'</p>'
42
+				);
43
+			}
44
+		}
45
+		return $html;
46
+	}
47 47
 }
Please login to merge, or discard this patch.
strategies/display/EE_Invisible_Recaptcha_Display_Strategy.strategy.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -14,27 +14,27 @@  discard block
 block discarded – undo
14 14
 class EE_Invisible_Recaptcha_Display_Strategy extends EE_Display_Strategy_Base
15 15
 {
16 16
 
17
-    /**
18
-     * @return EE_Form_Input_Base|EE_Invisible_Recaptcha_Input
19
-     */
20
-    public function input()
21
-    {
22
-        return $this->_input;
23
-    }
17
+	/**
18
+	 * @return EE_Form_Input_Base|EE_Invisible_Recaptcha_Input
19
+	 */
20
+	public function input()
21
+	{
22
+		return $this->_input;
23
+	}
24 24
 
25 25
 
26
-    /**
27
-     * returns HTML and javascript related to the displaying of this input
28
-     *
29
-     * @return string
30
-     * @throws InvalidInterfaceException
31
-     * @throws InvalidDataTypeException
32
-     * @throws InvalidArgumentException
33
-     */
34
-    public function display()
35
-    {
36
-        wp_enqueue_script(EE_Invisible_Recaptcha_Input::SCRIPT_HANDLE_GOOGLE_INVISIBLE_RECAPTCHA);
37
-        return <<<EOD
26
+	/**
27
+	 * returns HTML and javascript related to the displaying of this input
28
+	 *
29
+	 * @return string
30
+	 * @throws InvalidInterfaceException
31
+	 * @throws InvalidDataTypeException
32
+	 * @throws InvalidArgumentException
33
+	 */
34
+	public function display()
35
+	{
36
+		wp_enqueue_script(EE_Invisible_Recaptcha_Input::SCRIPT_HANDLE_GOOGLE_INVISIBLE_RECAPTCHA);
37
+		return <<<EOD
38 38
     <div id="g-recaptcha-{$this->input()->recaptchaId()}"
39 39
         class="g-recaptcha"
40 40
         data-sitekey="{$this->input()->siteKey()}"
@@ -45,5 +45,5 @@  discard block
 block discarded – undo
45 45
         >
46 46
     </div>
47 47
 EOD;
48
-    }
48
+	}
49 49
 }
Please login to merge, or discard this patch.
strategies/display/EE_Compound_Input_Display_Strategy.strategy.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -16,57 +16,57 @@
 block discarded – undo
16 16
 abstract class EE_Compound_Input_Display_Strategy extends EE_Display_Strategy_Base
17 17
 {
18 18
 
19
-    /**
20
-     * Gets the html ID for the sub-input for the specified option html value (not display text)
21
-     *
22
-     * @param string $option_value
23
-     * @param bool   $add_pound_sign
24
-     * @return string
25
-     */
26
-    public function get_sub_input_id($option_value, $add_pound_sign = false)
27
-    {
28
-        return $this->_append_chars($this->_input->html_id($add_pound_sign), '-') . sanitize_key($option_value);
29
-    }
19
+	/**
20
+	 * Gets the html ID for the sub-input for the specified option html value (not display text)
21
+	 *
22
+	 * @param string $option_value
23
+	 * @param bool   $add_pound_sign
24
+	 * @return string
25
+	 */
26
+	public function get_sub_input_id($option_value, $add_pound_sign = false)
27
+	{
28
+		return $this->_append_chars($this->_input->html_id($add_pound_sign), '-') . sanitize_key($option_value);
29
+	}
30 30
 
31 31
 
32 32
 
33
-    /**
34
-     * Gets the HTML IDs of all the inputs
35
-     *
36
-     * @param boolean $add_pound_sign
37
-     * @return array
38
-     * @throws \EE_Error
39
-     */
40
-    public function get_html_input_ids($add_pound_sign = false)
41
-    {
42
-        $html_input_ids = array();
43
-        foreach ($this->get_input()->options() as $value => $display) {
44
-            $html_input_ids[] = $this->get_sub_input_id($value, $add_pound_sign);
45
-        }
46
-        return $html_input_ids;
47
-    }
33
+	/**
34
+	 * Gets the HTML IDs of all the inputs
35
+	 *
36
+	 * @param boolean $add_pound_sign
37
+	 * @return array
38
+	 * @throws \EE_Error
39
+	 */
40
+	public function get_html_input_ids($add_pound_sign = false)
41
+	{
42
+		$html_input_ids = array();
43
+		foreach ($this->get_input()->options() as $value => $display) {
44
+			$html_input_ids[] = $this->get_sub_input_id($value, $add_pound_sign);
45
+		}
46
+		return $html_input_ids;
47
+	}
48 48
 
49 49
 
50 50
 
51
-    /**
52
-     * Overrides parent to make sure this display strategy is only used with the
53
-     * appropriate input type
54
-     *
55
-     * @return \EE_Form_Input_With_Options_Base
56
-     * @throws \EE_Error
57
-     */
58
-    public function get_input()
59
-    {
60
-        if (! $this->_input instanceof EE_Form_Input_With_Options_Base) {
61
-            throw new EE_Error(
62
-                sprintf(
63
-                    __(
64
-                        'Can not use a Compound Input Display Strategy (eg checkbox or radio) with an input that doesn\'t have options',
65
-                        'event_espresso'
66
-                    )
67
-                )
68
-            );
69
-        }
70
-        return parent::get_input();
71
-    }
51
+	/**
52
+	 * Overrides parent to make sure this display strategy is only used with the
53
+	 * appropriate input type
54
+	 *
55
+	 * @return \EE_Form_Input_With_Options_Base
56
+	 * @throws \EE_Error
57
+	 */
58
+	public function get_input()
59
+	{
60
+		if (! $this->_input instanceof EE_Form_Input_With_Options_Base) {
61
+			throw new EE_Error(
62
+				sprintf(
63
+					__(
64
+						'Can not use a Compound Input Display Strategy (eg checkbox or radio) with an input that doesn\'t have options',
65
+						'event_espresso'
66
+					)
67
+				)
68
+			);
69
+		}
70
+		return parent::get_input();
71
+	}
72 72
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function get_sub_input_id($option_value, $add_pound_sign = false)
27 27
     {
28
-        return $this->_append_chars($this->_input->html_id($add_pound_sign), '-') . sanitize_key($option_value);
28
+        return $this->_append_chars($this->_input->html_id($add_pound_sign), '-').sanitize_key($option_value);
29 29
     }
30 30
 
31 31
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function get_input()
59 59
     {
60
-        if (! $this->_input instanceof EE_Form_Input_With_Options_Base) {
60
+        if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base) {
61 61
             throw new EE_Error(
62 62
                 sprintf(
63 63
                     __(
Please login to merge, or discard this patch.
form_sections/strategies/normalization/EE_Float_Normalization.strategy.php 2 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -10,84 +10,84 @@
 block discarded – undo
10 10
 class EE_Float_Normalization extends EE_Normalization_Strategy_Base
11 11
 {
12 12
 
13
-    /*
13
+	/*
14 14
      * regex pattern that matches for the following:
15 15
      *      * optional negative sign
16 16
      *      * one or more digits or decimals
17 17
      */
18
-    const REGEX = '/^(-?)([\d.]+)$/';
18
+	const REGEX = '/^(-?)([\d.]+)$/';
19 19
 
20 20
 
21 21
 
22
-    /**
23
-     * @param string $value_to_normalize
24
-     * @return float
25
-     * @throws \EE_Validation_Error
26
-     */
27
-    public function normalize($value_to_normalize)
28
-    {
29
-        if ($value_to_normalize === null) {
30
-            return null;
31
-        }
32
-        if (is_float($value_to_normalize) || is_int($value_to_normalize)) {
33
-            return (float) $value_to_normalize;
34
-        }
35
-        if (! is_string($value_to_normalize)) {
36
-            throw new EE_Validation_Error(
37
-                sprintf(
38
-                    __('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'),
39
-                    print_r($value_to_normalize, true),
40
-                    gettype($value_to_normalize)
41
-                )
42
-            );
43
-        }
44
-        $normalized_value = filter_var(
45
-            $value_to_normalize,
46
-            FILTER_SANITIZE_NUMBER_FLOAT,
47
-            FILTER_FLAG_ALLOW_FRACTION
48
-        );
49
-        if ($normalized_value === '') {
50
-            return null;
51
-        }
52
-        if (preg_match(EE_Float_Normalization::REGEX, $normalized_value, $matches)) {
53
-            if (count($matches) === 3) {
54
-                // if first match is the negative sign,
55
-                // then the number needs to be multiplied by -1 to remain negative
56
-                return $matches[1] === '-'
57
-                    ? (float) $matches[2] * -1
58
-                    : (float) $matches[2];
59
-            }
60
-        }
61
-        // find if this input has a float validation strategy
62
-        // in which case, use its message
63
-        $validation_error_message = null;
64
-        foreach ($this->_input->get_validation_strategies() as $validation_strategy) {
65
-            if ($validation_strategy instanceof EE_Float_Validation_Strategy) {
66
-                $validation_error_message = $validation_strategy->get_validation_error_message();
67
-            }
68
-        }
69
-        // this really shouldn't ever happen because fields with a float normalization strategy
70
-        // should also have a float validation strategy, but in case it doesn't use the default
71
-        if (! $validation_error_message) {
72
-            $default_validation_strategy = new EE_Float_Validation_Strategy();
73
-            $validation_error_message = $default_validation_strategy->get_validation_error_message();
74
-        }
75
-        throw new EE_Validation_Error($validation_error_message, 'float_only');
76
-    }
22
+	/**
23
+	 * @param string $value_to_normalize
24
+	 * @return float
25
+	 * @throws \EE_Validation_Error
26
+	 */
27
+	public function normalize($value_to_normalize)
28
+	{
29
+		if ($value_to_normalize === null) {
30
+			return null;
31
+		}
32
+		if (is_float($value_to_normalize) || is_int($value_to_normalize)) {
33
+			return (float) $value_to_normalize;
34
+		}
35
+		if (! is_string($value_to_normalize)) {
36
+			throw new EE_Validation_Error(
37
+				sprintf(
38
+					__('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'),
39
+					print_r($value_to_normalize, true),
40
+					gettype($value_to_normalize)
41
+				)
42
+			);
43
+		}
44
+		$normalized_value = filter_var(
45
+			$value_to_normalize,
46
+			FILTER_SANITIZE_NUMBER_FLOAT,
47
+			FILTER_FLAG_ALLOW_FRACTION
48
+		);
49
+		if ($normalized_value === '') {
50
+			return null;
51
+		}
52
+		if (preg_match(EE_Float_Normalization::REGEX, $normalized_value, $matches)) {
53
+			if (count($matches) === 3) {
54
+				// if first match is the negative sign,
55
+				// then the number needs to be multiplied by -1 to remain negative
56
+				return $matches[1] === '-'
57
+					? (float) $matches[2] * -1
58
+					: (float) $matches[2];
59
+			}
60
+		}
61
+		// find if this input has a float validation strategy
62
+		// in which case, use its message
63
+		$validation_error_message = null;
64
+		foreach ($this->_input->get_validation_strategies() as $validation_strategy) {
65
+			if ($validation_strategy instanceof EE_Float_Validation_Strategy) {
66
+				$validation_error_message = $validation_strategy->get_validation_error_message();
67
+			}
68
+		}
69
+		// this really shouldn't ever happen because fields with a float normalization strategy
70
+		// should also have a float validation strategy, but in case it doesn't use the default
71
+		if (! $validation_error_message) {
72
+			$default_validation_strategy = new EE_Float_Validation_Strategy();
73
+			$validation_error_message = $default_validation_strategy->get_validation_error_message();
74
+		}
75
+		throw new EE_Validation_Error($validation_error_message, 'float_only');
76
+	}
77 77
 
78 78
 
79 79
 
80
-    /**
81
-     * Converts a float into a string
82
-     *
83
-     * @param float $normalized_value
84
-     * @return string
85
-     */
86
-    public function unnormalize($normalized_value)
87
-    {
88
-        if (empty($normalized_value)) {
89
-            return '0.00';
90
-        }
91
-        return "{$normalized_value}";
92
-    }
80
+	/**
81
+	 * Converts a float into a string
82
+	 *
83
+	 * @param float $normalized_value
84
+	 * @return string
85
+	 */
86
+	public function unnormalize($normalized_value)
87
+	{
88
+		if (empty($normalized_value)) {
89
+			return '0.00';
90
+		}
91
+		return "{$normalized_value}";
92
+	}
93 93
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         if (is_float($value_to_normalize) || is_int($value_to_normalize)) {
33 33
             return (float) $value_to_normalize;
34 34
         }
35
-        if (! is_string($value_to_normalize)) {
35
+        if ( ! is_string($value_to_normalize)) {
36 36
             throw new EE_Validation_Error(
37 37
                 sprintf(
38 38
                     __('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'),
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         }
69 69
         // this really shouldn't ever happen because fields with a float normalization strategy
70 70
         // should also have a float validation strategy, but in case it doesn't use the default
71
-        if (! $validation_error_message) {
71
+        if ( ! $validation_error_message) {
72 72
             $default_validation_strategy = new EE_Float_Validation_Strategy();
73 73
             $validation_error_message = $default_validation_strategy->get_validation_error_message();
74 74
         }
Please login to merge, or discard this patch.
form_sections/strategies/normalization/EE_Int_Normalization.strategy.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -10,88 +10,88 @@
 block discarded – undo
10 10
 class EE_Int_Normalization extends EE_Normalization_Strategy_Base
11 11
 {
12 12
 
13
-    /*
13
+	/*
14 14
      * regex pattern that matches for the following:
15 15
      *      * optional negative sign
16 16
      *      * one or more digits
17 17
      */
18
-    const REGEX = '/^(-?)(\d+)(?:\.0+)?$/';
18
+	const REGEX = '/^(-?)(\d+)(?:\.0+)?$/';
19 19
 
20 20
 
21 21
 
22
-    /**
23
-     * @param string $value_to_normalize
24
-     * @return int|mixed|string
25
-     * @throws \EE_Validation_Error
26
-     */
27
-    public function normalize($value_to_normalize)
28
-    {
29
-        if ($value_to_normalize === null) {
30
-            return null;
31
-        }
32
-        if (is_int($value_to_normalize) || is_float($value_to_normalize)) {
33
-            return (int) $value_to_normalize;
34
-        }
35
-        if (! is_string($value_to_normalize)) {
36
-            throw new EE_Validation_Error(
37
-                sprintf(
38
-                    __('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'),
39
-                    print_r($value_to_normalize, true),
40
-                    gettype($value_to_normalize)
41
-                )
42
-            );
43
-        }
44
-        $value_to_normalize = filter_var(
45
-            $value_to_normalize,
46
-            FILTER_SANITIZE_NUMBER_FLOAT,
47
-            FILTER_FLAG_ALLOW_FRACTION
48
-        );
49
-        if ($value_to_normalize === '') {
50
-            return null;
51
-        }
52
-        $matches = array();
53
-        if (preg_match(EE_Int_Normalization::REGEX, $value_to_normalize, $matches)) {
54
-            if (count($matches) === 3) {
55
-                // if first match is the negative sign,
56
-                // then the number needs to be multiplied by -1 to remain negative
57
-                return $matches[1] === '-'
58
-                    ? (int) $matches[2] * -1
59
-                    : (int) $matches[2];
60
-            }
61
-        }
62
-        // find if this input has a int validation strategy
63
-        // in which case, use its message
64
-        $validation_error_message = null;
65
-        foreach ($this->_input->get_validation_strategies() as $validation_strategy) {
66
-            if ($validation_strategy instanceof EE_Int_Validation_Strategy) {
67
-                $validation_error_message = $validation_strategy->get_validation_error_message();
68
-            }
69
-        }
70
-        // this really shouldn't ever happen because fields with a int normalization strategy
71
-        // should also have a int validation strategy, but in case it doesn't use the default
72
-        if (! $validation_error_message) {
73
-            $default_validation_strategy = new EE_Int_Validation_Strategy();
74
-            $validation_error_message = $default_validation_strategy->get_validation_error_message();
75
-        }
76
-        throw new EE_Validation_Error($validation_error_message, 'numeric_only');
77
-    }
22
+	/**
23
+	 * @param string $value_to_normalize
24
+	 * @return int|mixed|string
25
+	 * @throws \EE_Validation_Error
26
+	 */
27
+	public function normalize($value_to_normalize)
28
+	{
29
+		if ($value_to_normalize === null) {
30
+			return null;
31
+		}
32
+		if (is_int($value_to_normalize) || is_float($value_to_normalize)) {
33
+			return (int) $value_to_normalize;
34
+		}
35
+		if (! is_string($value_to_normalize)) {
36
+			throw new EE_Validation_Error(
37
+				sprintf(
38
+					__('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'),
39
+					print_r($value_to_normalize, true),
40
+					gettype($value_to_normalize)
41
+				)
42
+			);
43
+		}
44
+		$value_to_normalize = filter_var(
45
+			$value_to_normalize,
46
+			FILTER_SANITIZE_NUMBER_FLOAT,
47
+			FILTER_FLAG_ALLOW_FRACTION
48
+		);
49
+		if ($value_to_normalize === '') {
50
+			return null;
51
+		}
52
+		$matches = array();
53
+		if (preg_match(EE_Int_Normalization::REGEX, $value_to_normalize, $matches)) {
54
+			if (count($matches) === 3) {
55
+				// if first match is the negative sign,
56
+				// then the number needs to be multiplied by -1 to remain negative
57
+				return $matches[1] === '-'
58
+					? (int) $matches[2] * -1
59
+					: (int) $matches[2];
60
+			}
61
+		}
62
+		// find if this input has a int validation strategy
63
+		// in which case, use its message
64
+		$validation_error_message = null;
65
+		foreach ($this->_input->get_validation_strategies() as $validation_strategy) {
66
+			if ($validation_strategy instanceof EE_Int_Validation_Strategy) {
67
+				$validation_error_message = $validation_strategy->get_validation_error_message();
68
+			}
69
+		}
70
+		// this really shouldn't ever happen because fields with a int normalization strategy
71
+		// should also have a int validation strategy, but in case it doesn't use the default
72
+		if (! $validation_error_message) {
73
+			$default_validation_strategy = new EE_Int_Validation_Strategy();
74
+			$validation_error_message = $default_validation_strategy->get_validation_error_message();
75
+		}
76
+		throw new EE_Validation_Error($validation_error_message, 'numeric_only');
77
+	}
78 78
 
79 79
 
80 80
 
81
-    /**
82
-     * Converts the int into a string for use in teh html form
83
-     *
84
-     * @param int $normalized_value
85
-     * @return string
86
-     */
87
-    public function unnormalize($normalized_value)
88
-    {
89
-        if ($normalized_value === null || $normalized_value === '') {
90
-            return '';
91
-        }
92
-        if (empty($normalized_value)) {
93
-            return '0';
94
-        }
95
-        return "$normalized_value";
96
-    }
81
+	/**
82
+	 * Converts the int into a string for use in teh html form
83
+	 *
84
+	 * @param int $normalized_value
85
+	 * @return string
86
+	 */
87
+	public function unnormalize($normalized_value)
88
+	{
89
+		if ($normalized_value === null || $normalized_value === '') {
90
+			return '';
91
+		}
92
+		if (empty($normalized_value)) {
93
+			return '0';
94
+		}
95
+		return "$normalized_value";
96
+	}
97 97
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         if (is_int($value_to_normalize) || is_float($value_to_normalize)) {
33 33
             return (int) $value_to_normalize;
34 34
         }
35
-        if (! is_string($value_to_normalize)) {
35
+        if ( ! is_string($value_to_normalize)) {
36 36
             throw new EE_Validation_Error(
37 37
                 sprintf(
38 38
                     __('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'),
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         }
70 70
         // this really shouldn't ever happen because fields with a int normalization strategy
71 71
         // should also have a int validation strategy, but in case it doesn't use the default
72
-        if (! $validation_error_message) {
72
+        if ( ! $validation_error_message) {
73 73
             $default_validation_strategy = new EE_Int_Validation_Strategy();
74 74
             $validation_error_message = $default_validation_strategy->get_validation_error_message();
75 75
         }
Please login to merge, or discard this patch.