Completed
Branch FET-3467-waitlists (24004d)
by
unknown
86:26 queued 75:18
created
form_sections/strategies/display/EE_Display_Strategy_Base.strategy.php 1 patch
Indentation   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if (! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -16,229 +16,229 @@  discard block
 block discarded – undo
16 16
 {
17 17
 
18 18
 
19
-    /**
20
-     * @var string $_tag
21
-     */
22
-    protected $_tag = '';
19
+	/**
20
+	 * @var string $_tag
21
+	 */
22
+	protected $_tag = '';
23 23
 
24 24
 
25 25
 
26 26
 
27 27
 
28
-    /**
29
-     * returns HTML and javascript related to the displaying of this input
30
-     *
31
-     * @return string
32
-     */
33
-    abstract public function display();
28
+	/**
29
+	 * returns HTML and javascript related to the displaying of this input
30
+	 *
31
+	 * @return string
32
+	 */
33
+	abstract public function display();
34 34
 
35 35
 
36 36
 
37
-    /**
38
-     * _remove_chars - takes an incoming string, and removes the string $chars from the end of it, but only if $chars
39
-     * is already there
40
-     *
41
-     * @param string $string - the string being processed
42
-     * @param string $chars  - exact string of characters to remove
43
-     * @return string
44
-     */
45
-    protected function _remove_chars($string = '', $chars = '-')
46
-    {
47
-        $char_length = strlen($chars) * -1;
48
-        // if last three characters of string is  " - ", then remove it
49
-        return substr($string, $char_length) === $chars ? substr($string, 0, $char_length) : $string;
50
-    }
37
+	/**
38
+	 * _remove_chars - takes an incoming string, and removes the string $chars from the end of it, but only if $chars
39
+	 * is already there
40
+	 *
41
+	 * @param string $string - the string being processed
42
+	 * @param string $chars  - exact string of characters to remove
43
+	 * @return string
44
+	 */
45
+	protected function _remove_chars($string = '', $chars = '-')
46
+	{
47
+		$char_length = strlen($chars) * -1;
48
+		// if last three characters of string is  " - ", then remove it
49
+		return substr($string, $char_length) === $chars ? substr($string, 0, $char_length) : $string;
50
+	}
51 51
 
52 52
 
53 53
 
54
-    /**
55
-     * _append_chars - takes an incoming string, and adds the string $chars to the end of it, but only if $chars is not
56
-     * already there
57
-     *
58
-     * @param string $string - the string being processed
59
-     * @param string $chars  - exact string of characters to be added to end of string
60
-     * @return string
61
-     */
62
-    protected function _append_chars($string = '', $chars = '-')
63
-    {
64
-        return $this->_remove_chars($string, $chars) . $chars;
65
-    }
54
+	/**
55
+	 * _append_chars - takes an incoming string, and adds the string $chars to the end of it, but only if $chars is not
56
+	 * already there
57
+	 *
58
+	 * @param string $string - the string being processed
59
+	 * @param string $chars  - exact string of characters to be added to end of string
60
+	 * @return string
61
+	 */
62
+	protected function _append_chars($string = '', $chars = '-')
63
+	{
64
+		return $this->_remove_chars($string, $chars) . $chars;
65
+	}
66 66
 
67 67
 
68
-
69
-    /**
70
-     * Gets the HTML IDs of all the inputs
71
-     *
72
-     * @param bool $add_pound_sign
73
-     * @return array
74
-     */
75
-    public function get_html_input_ids($add_pound_sign = false)
76
-    {
77
-        return array($this->get_input()->html_id($add_pound_sign));
78
-    }
79
-
80
-
81
-
82
-    /**
83
-     * Adds js variables for localization to the $other_js_data. These should be put
84
-     * in each form's "other_data" javascript object.
85
-     *
86
-     * @param array $other_js_data
87
-     * @return array
88
-     */
89
-    public function get_other_js_data($other_js_data = array())
90
-    {
91
-        return $other_js_data;
92
-    }
93
-
94
-
95
-
96
-    /**
97
-     * Opportunity for this display strategy to call wp_enqueue_script and wp_enqueue_style.
98
-     * This should be called during wp_enqueue_scripts
99
-     */
100
-    public function enqueue_js()
101
-    {
102
-    }
103
-
104
-
105
-
106
-    /**
107
-     * returns string like: '<tag'
108
-     *
109
-     * @param string $tag
110
-     * @return string
111
-     */
112
-    protected function _opening_tag($tag)
113
-    {
114
-        $this->_tag = $tag;
115
-        return "<{$this->_tag}";
116
-    }
117
-
118
-
119
-
120
-    /**
121
-     * returns string like: '</tag>
122
-     *
123
-     * @return string
124
-     */
125
-    protected function _closing_tag()
126
-    {
127
-        return "</{$this->_tag}>";
128
-    }
129
-
130
-
131
-
132
-    /**
133
-     * returns string like: '/>'
134
-     *
135
-     * @return string
136
-     */
137
-    protected function _close_tag()
138
-    {
139
-        return '/>';
140
-    }
141
-
142
-
143
-
144
-    /**
145
-     * returns an array of standard HTML attributes that get added to nearly all inputs,
146
-     * where string keys represent named attributes like id, class, etc
147
-     * and numeric keys represent single attributes like 'required'.
148
-     * Note: this does not include "value" because many inputs (like dropdowns, textareas, and checkboxes) don't use
149
-     * it.
150
-     *
151
-     * @return array
152
-     */
153
-    protected function _standard_attributes_array()
154
-    {
155
-        return array(
156
-            'name'  => $this->_input->html_name(),
157
-            'id'    => $this->_input->html_id(),
158
-            'class' => $this->_input->html_class(true),
159
-            0       => array('required', $this->_input->required()),
160
-            1       => $this->_input->other_html_attributes(),
161
-            'style' => $this->_input->html_style(),
162
-        );
163
-    }
164
-
165
-
166
-
167
-    /**
168
-     * sets the attributes using the incoming array
169
-     * and returns a string of all attributes rendered as valid HTML
170
-     *
171
-     * @param array $attributes
172
-     * @return string
173
-     */
174
-    protected function _attributes_string($attributes = array())
175
-    {
176
-        $attributes = apply_filters(
177
-            'FHEE__EE_Display_Strategy_Base__attributes_string__attributes',
178
-            $attributes,
179
-            $this,
180
-            $this->_input
181
-        );
182
-        $attributes_string = '';
183
-        foreach ($attributes as $attribute => $value) {
184
-            if (is_numeric($attribute)) {
185
-                $add = true;
186
-                if (is_array($value)) {
187
-                    $attribute = isset($value[0]) ? $value[0] : '';
188
-                    $add = isset($value[1]) ? $value[1] : false;
189
-                } else {
190
-                    $attribute = $value;
191
-                }
192
-                $attributes_string .= $this->_single_attribute($attribute, $add);
193
-            } else {
194
-                $attributes_string .= $this->_attribute($attribute, $value);
195
-            }
196
-        }
197
-        return $attributes_string;
198
-    }
199
-
200
-
201
-
202
-    /**
203
-     * returns string like: ' attribute="value"'
204
-     * returns an empty string if $value is null
205
-     *
206
-     * @param string $attribute
207
-     * @param string $value
208
-     * @return string
209
-     */
210
-    protected function _attribute($attribute, $value = '')
211
-    {
212
-        return $value !== null ? " {$attribute}=\"{$value}\"" : '';
213
-    }
214
-
215
-
216
-
217
-    /**
218
-     * returns string like: ' data-attribute="value"'
219
-     * returns an empty string if $value is null
220
-     *
221
-     * @param string $attribute
222
-     * @param string $value
223
-     * @return string
224
-     */
225
-    protected function _data_attribute($attribute, $value = '')
226
-    {
227
-        return $value !== null ? " data-{$attribute}=\"{$value}\"" : '';
228
-    }
229
-
230
-
231
-
232
-    /**
233
-     * returns string like: ' attribute' if $add is true
234
-     *
235
-     * @param string  $attribute
236
-     * @param boolean $add
237
-     * @return string
238
-     */
239
-    protected function _single_attribute($attribute, $add = true)
240
-    {
241
-        return $add ? " {$attribute}" : '';
242
-    }
68
+
69
+	/**
70
+	 * Gets the HTML IDs of all the inputs
71
+	 *
72
+	 * @param bool $add_pound_sign
73
+	 * @return array
74
+	 */
75
+	public function get_html_input_ids($add_pound_sign = false)
76
+	{
77
+		return array($this->get_input()->html_id($add_pound_sign));
78
+	}
79
+
80
+
81
+
82
+	/**
83
+	 * Adds js variables for localization to the $other_js_data. These should be put
84
+	 * in each form's "other_data" javascript object.
85
+	 *
86
+	 * @param array $other_js_data
87
+	 * @return array
88
+	 */
89
+	public function get_other_js_data($other_js_data = array())
90
+	{
91
+		return $other_js_data;
92
+	}
93
+
94
+
95
+
96
+	/**
97
+	 * Opportunity for this display strategy to call wp_enqueue_script and wp_enqueue_style.
98
+	 * This should be called during wp_enqueue_scripts
99
+	 */
100
+	public function enqueue_js()
101
+	{
102
+	}
103
+
104
+
105
+
106
+	/**
107
+	 * returns string like: '<tag'
108
+	 *
109
+	 * @param string $tag
110
+	 * @return string
111
+	 */
112
+	protected function _opening_tag($tag)
113
+	{
114
+		$this->_tag = $tag;
115
+		return "<{$this->_tag}";
116
+	}
117
+
118
+
119
+
120
+	/**
121
+	 * returns string like: '</tag>
122
+	 *
123
+	 * @return string
124
+	 */
125
+	protected function _closing_tag()
126
+	{
127
+		return "</{$this->_tag}>";
128
+	}
129
+
130
+
131
+
132
+	/**
133
+	 * returns string like: '/>'
134
+	 *
135
+	 * @return string
136
+	 */
137
+	protected function _close_tag()
138
+	{
139
+		return '/>';
140
+	}
141
+
142
+
143
+
144
+	/**
145
+	 * returns an array of standard HTML attributes that get added to nearly all inputs,
146
+	 * where string keys represent named attributes like id, class, etc
147
+	 * and numeric keys represent single attributes like 'required'.
148
+	 * Note: this does not include "value" because many inputs (like dropdowns, textareas, and checkboxes) don't use
149
+	 * it.
150
+	 *
151
+	 * @return array
152
+	 */
153
+	protected function _standard_attributes_array()
154
+	{
155
+		return array(
156
+			'name'  => $this->_input->html_name(),
157
+			'id'    => $this->_input->html_id(),
158
+			'class' => $this->_input->html_class(true),
159
+			0       => array('required', $this->_input->required()),
160
+			1       => $this->_input->other_html_attributes(),
161
+			'style' => $this->_input->html_style(),
162
+		);
163
+	}
164
+
165
+
166
+
167
+	/**
168
+	 * sets the attributes using the incoming array
169
+	 * and returns a string of all attributes rendered as valid HTML
170
+	 *
171
+	 * @param array $attributes
172
+	 * @return string
173
+	 */
174
+	protected function _attributes_string($attributes = array())
175
+	{
176
+		$attributes = apply_filters(
177
+			'FHEE__EE_Display_Strategy_Base__attributes_string__attributes',
178
+			$attributes,
179
+			$this,
180
+			$this->_input
181
+		);
182
+		$attributes_string = '';
183
+		foreach ($attributes as $attribute => $value) {
184
+			if (is_numeric($attribute)) {
185
+				$add = true;
186
+				if (is_array($value)) {
187
+					$attribute = isset($value[0]) ? $value[0] : '';
188
+					$add = isset($value[1]) ? $value[1] : false;
189
+				} else {
190
+					$attribute = $value;
191
+				}
192
+				$attributes_string .= $this->_single_attribute($attribute, $add);
193
+			} else {
194
+				$attributes_string .= $this->_attribute($attribute, $value);
195
+			}
196
+		}
197
+		return $attributes_string;
198
+	}
199
+
200
+
201
+
202
+	/**
203
+	 * returns string like: ' attribute="value"'
204
+	 * returns an empty string if $value is null
205
+	 *
206
+	 * @param string $attribute
207
+	 * @param string $value
208
+	 * @return string
209
+	 */
210
+	protected function _attribute($attribute, $value = '')
211
+	{
212
+		return $value !== null ? " {$attribute}=\"{$value}\"" : '';
213
+	}
214
+
215
+
216
+
217
+	/**
218
+	 * returns string like: ' data-attribute="value"'
219
+	 * returns an empty string if $value is null
220
+	 *
221
+	 * @param string $attribute
222
+	 * @param string $value
223
+	 * @return string
224
+	 */
225
+	protected function _data_attribute($attribute, $value = '')
226
+	{
227
+		return $value !== null ? " data-{$attribute}=\"{$value}\"" : '';
228
+	}
229
+
230
+
231
+
232
+	/**
233
+	 * returns string like: ' attribute' if $add is true
234
+	 *
235
+	 * @param string  $attribute
236
+	 * @param boolean $add
237
+	 * @return string
238
+	 */
239
+	protected function _single_attribute($attribute, $add = true)
240
+	{
241
+		return $add ? " {$attribute}" : '';
242
+	}
243 243
 
244 244
 }
245 245
\ No newline at end of file
Please login to merge, or discard this patch.
form_sections/strategies/display/EE_Number_Input_Display_Strategy.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -14,56 +14,56 @@
 block discarded – undo
14 14
 class EE_Number_Input_Display_Strategy extends EE_Display_Strategy_Base
15 15
 {
16 16
 
17
-    /**
18
-     * minimum value for number field
19
-     *
20
-     * @var int|null $min
21
-     */
22
-    protected $min;
17
+	/**
18
+	 * minimum value for number field
19
+	 *
20
+	 * @var int|null $min
21
+	 */
22
+	protected $min;
23 23
 
24
-    /**
25
-     * maximum value for number field
26
-     *
27
-     * @var int|null $max
28
-     */
29
-    protected $max;
24
+	/**
25
+	 * maximum value for number field
26
+	 *
27
+	 * @var int|null $max
28
+	 */
29
+	protected $max;
30 30
 
31 31
 
32 32
 
33
-    /**
34
-     * EE_Number_Input_Display_Strategy constructor.
35
-     *
36
-     * @param int $min
37
-     * @param int $max
38
-     */
39
-    public function __construct($min = null, $max = null)
40
-    {
41
-        $this->min = $min;
42
-        $this->max = $max;
43
-    }
33
+	/**
34
+	 * EE_Number_Input_Display_Strategy constructor.
35
+	 *
36
+	 * @param int $min
37
+	 * @param int $max
38
+	 */
39
+	public function __construct($min = null, $max = null)
40
+	{
41
+		$this->min = $min;
42
+		$this->max = $max;
43
+	}
44 44
 
45 45
 
46 46
 
47
-    /**
48
-     * @return string of html to display the field
49
-     */
50
-    public function display()
51
-    {
52
-        $input = $this->_opening_tag('input');
53
-        $input .= $this->_attributes_string(
54
-            array_merge(
55
-                $this->_standard_attributes_array(),
56
-                array(
57
-                    'type' => 'number',
58
-                    'min'  => $this->min,
59
-                    'max'  => $this->max,
60
-                    'value' => $this->_input->raw_value_in_form()
61
-                )
62
-            )
63
-        );
64
-        $input .= $this->_close_tag();
65
-        return $input;
66
-    }
47
+	/**
48
+	 * @return string of html to display the field
49
+	 */
50
+	public function display()
51
+	{
52
+		$input = $this->_opening_tag('input');
53
+		$input .= $this->_attributes_string(
54
+			array_merge(
55
+				$this->_standard_attributes_array(),
56
+				array(
57
+					'type' => 'number',
58
+					'min'  => $this->min,
59
+					'max'  => $this->max,
60
+					'value' => $this->_input->raw_value_in_form()
61
+				)
62
+			)
63
+		);
64
+		$input .= $this->_close_tag();
65
+		return $input;
66
+	}
67 67
 
68 68
 }
69 69
 // End of file EE_Number_Input_Display_Strategy.php
Please login to merge, or discard this patch.
form_sections/strategies/normalization/EE_Int_Normalization.strategy.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 
18 18
     /**
19 19
      * @param string $value_to_normalize
20
-     * @return int|mixed|string
20
+     * @return null|integer
21 21
      * @throws \EE_Validation_Error
22 22
      */
23 23
     public function normalize($value_to_normalize)
Please login to merge, or discard this patch.
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if (! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -15,89 +15,89 @@  discard block
 block discarded – undo
15 15
 class EE_Int_Normalization extends EE_Normalization_Strategy_Base
16 16
 {
17 17
 
18
-    /*
18
+	/*
19 19
      * regex pattern that matches for the following:
20 20
      *      * optional negative sign
21 21
      *      * one or more digits
22 22
      */
23
-    const REGEX = '/^(-?)(\d+)(?:\.0+)?$/';
23
+	const REGEX = '/^(-?)(\d+)(?:\.0+)?$/';
24 24
 
25 25
 
26
-    /**
27
-     * @param string $value_to_normalize
28
-     * @return int|mixed|string
29
-     * @throws \EE_Validation_Error
30
-     */
31
-    public function normalize($value_to_normalize)
32
-    {
33
-        if ($value_to_normalize === null) {
34
-            return null;
35
-        }
36
-        if (is_int($value_to_normalize) || is_float($value_to_normalize)) {
37
-            return (int)$value_to_normalize;
38
-        }
39
-        if (! is_string($value_to_normalize)) {
40
-            throw new EE_Validation_Error(
41
-                sprintf(
42
-                    __('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'),
43
-                    print_r($value_to_normalize, true),
44
-                    gettype($value_to_normalize)
45
-                )
46
-            );
47
-        }
48
-        $value_to_normalize = filter_var(
49
-            $value_to_normalize,
50
-            FILTER_SANITIZE_NUMBER_FLOAT,
51
-            FILTER_FLAG_ALLOW_FRACTION
52
-        );
53
-        if ($value_to_normalize === '') {
54
-            return null;
55
-        }
56
-        $matches = array();
57
-        if (preg_match(EE_Int_Normalization::REGEX, $value_to_normalize, $matches)) {
58
-            if (count($matches) === 3) {
59
-                // if first match is the negative sign,
60
-                // then the number needs to be multiplied by -1 to remain negative
61
-                return $matches[1] === '-'
62
-                    ? (int)$matches[2] * -1
63
-                    : (int)$matches[2];
64
-            }
65
-        }
66
-        //find if this input has a int validation strategy
67
-        //in which case, use its message
68
-        $validation_error_message = null;
69
-        foreach ($this->_input->get_validation_strategies() as $validation_strategy) {
70
-            if ($validation_strategy instanceof EE_Int_Validation_Strategy) {
71
-                $validation_error_message = $validation_strategy->get_validation_error_message();
72
-            }
73
-        }
74
-        //this really shouldn't ever happen because fields with a int normalization strategy
75
-        //should also have a int validation strategy, but in case it doesn't use the default
76
-        if (! $validation_error_message) {
77
-            $default_validation_strategy = new EE_Int_Validation_Strategy();
78
-            $validation_error_message = $default_validation_strategy->get_validation_error_message();
79
-        }
80
-        throw new EE_Validation_Error($validation_error_message, 'numeric_only');
81
-    }
26
+	/**
27
+	 * @param string $value_to_normalize
28
+	 * @return int|mixed|string
29
+	 * @throws \EE_Validation_Error
30
+	 */
31
+	public function normalize($value_to_normalize)
32
+	{
33
+		if ($value_to_normalize === null) {
34
+			return null;
35
+		}
36
+		if (is_int($value_to_normalize) || is_float($value_to_normalize)) {
37
+			return (int)$value_to_normalize;
38
+		}
39
+		if (! is_string($value_to_normalize)) {
40
+			throw new EE_Validation_Error(
41
+				sprintf(
42
+					__('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'),
43
+					print_r($value_to_normalize, true),
44
+					gettype($value_to_normalize)
45
+				)
46
+			);
47
+		}
48
+		$value_to_normalize = filter_var(
49
+			$value_to_normalize,
50
+			FILTER_SANITIZE_NUMBER_FLOAT,
51
+			FILTER_FLAG_ALLOW_FRACTION
52
+		);
53
+		if ($value_to_normalize === '') {
54
+			return null;
55
+		}
56
+		$matches = array();
57
+		if (preg_match(EE_Int_Normalization::REGEX, $value_to_normalize, $matches)) {
58
+			if (count($matches) === 3) {
59
+				// if first match is the negative sign,
60
+				// then the number needs to be multiplied by -1 to remain negative
61
+				return $matches[1] === '-'
62
+					? (int)$matches[2] * -1
63
+					: (int)$matches[2];
64
+			}
65
+		}
66
+		//find if this input has a int validation strategy
67
+		//in which case, use its message
68
+		$validation_error_message = null;
69
+		foreach ($this->_input->get_validation_strategies() as $validation_strategy) {
70
+			if ($validation_strategy instanceof EE_Int_Validation_Strategy) {
71
+				$validation_error_message = $validation_strategy->get_validation_error_message();
72
+			}
73
+		}
74
+		//this really shouldn't ever happen because fields with a int normalization strategy
75
+		//should also have a int validation strategy, but in case it doesn't use the default
76
+		if (! $validation_error_message) {
77
+			$default_validation_strategy = new EE_Int_Validation_Strategy();
78
+			$validation_error_message = $default_validation_strategy->get_validation_error_message();
79
+		}
80
+		throw new EE_Validation_Error($validation_error_message, 'numeric_only');
81
+	}
82 82
 
83 83
 
84 84
 
85
-    /**
86
-     * Converts the int into a string for use in teh html form
87
-     *
88
-     * @param int $normalized_value
89
-     * @return string
90
-     */
91
-    public function unnormalize($normalized_value)
92
-    {
93
-        if ($normalized_value === null || $normalized_value === '') {
94
-            return '';
95
-        }
96
-        if (empty($normalized_value)) {
97
-            return '0';
98
-        }
99
-        return "$normalized_value";
100
-    }
85
+	/**
86
+	 * Converts the int into a string for use in teh html form
87
+	 *
88
+	 * @param int $normalized_value
89
+	 * @return string
90
+	 */
91
+	public function unnormalize($normalized_value)
92
+	{
93
+		if ($normalized_value === null || $normalized_value === '') {
94
+			return '';
95
+		}
96
+		if (empty($normalized_value)) {
97
+			return '0';
98
+		}
99
+		return "$normalized_value";
100
+	}
101 101
 }
102 102
 
103 103
 // End of file EE_Int_Normalization.strategy.php
104 104
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (! defined('EVENT_ESPRESSO_VERSION')) {
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2 2
     exit('No direct script access allowed');
3 3
 }
4 4
 
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
             return null;
35 35
         }
36 36
         if (is_int($value_to_normalize) || is_float($value_to_normalize)) {
37
-            return (int)$value_to_normalize;
37
+            return (int) $value_to_normalize;
38 38
         }
39
-        if (! is_string($value_to_normalize)) {
39
+        if ( ! is_string($value_to_normalize)) {
40 40
             throw new EE_Validation_Error(
41 41
                 sprintf(
42 42
                     __('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'),
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
                 // if first match is the negative sign,
60 60
                 // then the number needs to be multiplied by -1 to remain negative
61 61
                 return $matches[1] === '-'
62
-                    ? (int)$matches[2] * -1
63
-                    : (int)$matches[2];
62
+                    ? (int) $matches[2] * -1
63
+                    : (int) $matches[2];
64 64
             }
65 65
         }
66 66
         //find if this input has a int validation strategy
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         }
74 74
         //this really shouldn't ever happen because fields with a int normalization strategy
75 75
         //should also have a int validation strategy, but in case it doesn't use the default
76
-        if (! $validation_error_message) {
76
+        if ( ! $validation_error_message) {
77 77
             $default_validation_strategy = new EE_Int_Validation_Strategy();
78 78
             $validation_error_message = $default_validation_strategy->get_validation_error_message();
79 79
         }
Please login to merge, or discard this patch.
form_sections/strategies/validation/EE_Int_Validation_Strategy.strategy.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,14 +33,14 @@
 block discarded – undo
33 33
 	 * @return array
34 34
 	 */
35 35
 	function get_jquery_validation_rule_array(){
36
-        return array(
37
-            'number'=>true,
38
-            'step' => 1,
39
-            'messages' => array(
40
-                'number' => $this->get_validation_error_message(),
41
-                'step' => $this->get_validation_error_message()
42
-            )
43
-        );
36
+		return array(
37
+			'number'=>true,
38
+			'step' => 1,
39
+			'messages' => array(
40
+				'number' => $this->get_validation_error_message(),
41
+				'step' => $this->get_validation_error_message()
42
+			)
43
+		);
44 44
 	}
45 45
 }
46 46
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,16 +6,16 @@  discard block
 block discarded – undo
6 6
  * @subpackage	Expression package is undefined on line 19, column 19 in Templates/Scripting/PHPClass.php.
7 7
  * @author				Mike Nelson
8 8
  */
9
-class EE_Int_Validation_Strategy extends EE_Validation_Strategy_Base{
9
+class EE_Int_Validation_Strategy extends EE_Validation_Strategy_Base {
10 10
 
11 11
 	/**
12 12
 	 * @param null $validation_error_message
13 13
 	 */
14
-	public function __construct( $validation_error_message = NULL ) {
15
-		if( ! $validation_error_message ){
14
+	public function __construct($validation_error_message = NULL) {
15
+		if ( ! $validation_error_message) {
16 16
 			$validation_error_message = __("Only digits are allowed.", "event_espresso");
17 17
 		}
18
-		parent::__construct( $validation_error_message );
18
+		parent::__construct($validation_error_message);
19 19
 	}
20 20
 
21 21
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	/**
33 33
 	 * @return array
34 34
 	 */
35
-	function get_jquery_validation_rule_array(){
35
+	function get_jquery_validation_rule_array() {
36 36
         return array(
37 37
             'number'=>true,
38 38
             'step' => 1,
Please login to merge, or discard this patch.
core/helpers/EEH_Money.helper.php 2 patches
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -8,62 +8,62 @@  discard block
 block discarded – undo
8 8
  */
9 9
 if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
10 10
  /**
11
- *
12
- * Money helper class.
13
- * This class has helper methods that help with money related conversions and calculations.
14
- *
15
- * @since %VER%
16
- *
17
- * @package		Event Espresso
18
- * @subpackage	helpers
19
- * @author		Darren Ethier
20
- *
21
- * ------------------------------------------------------------------------
22
- */
11
+  *
12
+  * Money helper class.
13
+  * This class has helper methods that help with money related conversions and calculations.
14
+  *
15
+  * @since %VER%
16
+  *
17
+  * @package		Event Espresso
18
+  * @subpackage	helpers
19
+  * @author		Darren Ethier
20
+  *
21
+  * ------------------------------------------------------------------------
22
+  */
23 23
 class EEH_Money extends EEH_Base  {
24 24
 
25 25
 
26
-    /**
27
-     * This removes all localized money formatting from the incoming value
28
-     *
29
-     * @param int|float|string $money_value
30
-     * @param string           $CNT_ISO
31
-     * @return float
32
-     * @throws EE_Error
33
-     */
26
+	/**
27
+	 * This removes all localized money formatting from the incoming value
28
+	 *
29
+	 * @param int|float|string $money_value
30
+	 * @param string           $CNT_ISO
31
+	 * @return float
32
+	 * @throws EE_Error
33
+	 */
34 34
 	public static function strip_localized_money_formatting($money_value, $CNT_ISO = '') {
35
-        $currency_config = EEH_Money::get_currency_config($CNT_ISO);
36
-        $money_value = str_replace(
37
-		    array(
38
-                $currency_config->thsnds,
39
-                $currency_config->dec_mrk,
40
-            ),
41
-            array(
42
-                '', // remove thousands separator
43
-                '.', // convert decimal mark to what PHP expects
44
-            ),
45
-            $money_value
46
-        );
47
-        $money_value = filter_var(
48
-            $money_value,
49
-            FILTER_SANITIZE_NUMBER_FLOAT,
50
-            FILTER_FLAG_ALLOW_FRACTION
51
-        );
52
-        return $money_value;
53
-    }
54
-
55
-
56
-
57
-    /**
58
-     * This converts an incoming localized money value into a standard float item (to three decimal places)
59
-     *
60
-     * @param int|string $money_value
61
-     * @return float
62
-     * @throws EE_Error
63
-     */
35
+		$currency_config = EEH_Money::get_currency_config($CNT_ISO);
36
+		$money_value = str_replace(
37
+			array(
38
+				$currency_config->thsnds,
39
+				$currency_config->dec_mrk,
40
+			),
41
+			array(
42
+				'', // remove thousands separator
43
+				'.', // convert decimal mark to what PHP expects
44
+			),
45
+			$money_value
46
+		);
47
+		$money_value = filter_var(
48
+			$money_value,
49
+			FILTER_SANITIZE_NUMBER_FLOAT,
50
+			FILTER_FLAG_ALLOW_FRACTION
51
+		);
52
+		return $money_value;
53
+	}
54
+
55
+
56
+
57
+	/**
58
+	 * This converts an incoming localized money value into a standard float item (to three decimal places)
59
+	 *
60
+	 * @param int|string $money_value
61
+	 * @return float
62
+	 * @throws EE_Error
63
+	 */
64 64
 	public static function convert_to_float_from_localized_money($money_value ) {
65 65
 		//float it! and round to three decimal places
66
-        return round ( (float) EEH_Money::strip_localized_money_formatting($money_value), 3 );
66
+		return round ( (float) EEH_Money::strip_localized_money_formatting($money_value), 3 );
67 67
 	}
68 68
 
69 69
 
@@ -151,19 +151,19 @@  discard block
 block discarded – undo
151 151
 
152 152
 
153 153
 
154
-    /**
155
-     * This returns a localized format string suitable for jQplot.
156
-     *
157
-     * @param string $CNT_ISO  If this is provided, then will attempt to get the currency settings for the country.
158
-     *                         Otherwise will use currency settings for current active country on site.
159
-     * @return string
160
-     * @throws EE_Error
161
-     */
154
+	/**
155
+	 * This returns a localized format string suitable for jQplot.
156
+	 *
157
+	 * @param string $CNT_ISO  If this is provided, then will attempt to get the currency settings for the country.
158
+	 *                         Otherwise will use currency settings for current active country on site.
159
+	 * @return string
160
+	 * @throws EE_Error
161
+	 */
162 162
 	public static function get_format_for_jqplot( $CNT_ISO = '') {
163 163
 		//default format
164 164
 		$format = 'f';
165 165
 		$currency_config = $currency_config = EEH_Money::get_currency_config($CNT_ISO);
166
-        //first get the decimal place and number of places
166
+		//first get the decimal place and number of places
167 167
 		$format = "%'." . $currency_config->dec_plc . $format;
168 168
 		//currency symbol on right side.
169 169
 		$format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign;
@@ -172,16 +172,16 @@  discard block
 block discarded – undo
172 172
 
173 173
 
174 174
 
175
-    /**
176
-     * This returns a localized format string suitable for usage with the Google Charts API format param.
177
-     *
178
-     * @param string $CNT_ISO  If this is provided, then will attempt to get the currency settings for the country.
179
-     *                         Otherwise will use currency settings for current active country on site.
180
-     *                         Note: GoogleCharts uses ICU pattern set
181
-     *                         (@see http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details)
182
-     * @return string
183
-     * @throws EE_Error
184
-     */
175
+	/**
176
+	 * This returns a localized format string suitable for usage with the Google Charts API format param.
177
+	 *
178
+	 * @param string $CNT_ISO  If this is provided, then will attempt to get the currency settings for the country.
179
+	 *                         Otherwise will use currency settings for current active country on site.
180
+	 *                         Note: GoogleCharts uses ICU pattern set
181
+	 *                         (@see http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details)
182
+	 * @return string
183
+	 * @throws EE_Error
184
+	 */
185 185
 	public static function get_format_for_google_charts( $CNT_ISO = '' ) {
186 186
 		$currency_config = EEH_Money::get_currency_config($CNT_ISO);
187 187
 		$decimal_places_placeholder = str_pad( '', $currency_config->dec_plc, '0' );
@@ -208,24 +208,24 @@  discard block
 block discarded – undo
208 208
 
209 209
 
210 210
 
211
-    /**
212
-     * @param string $CNT_ISO
213
-     * @return EE_Currency_Config|null
214
-     * @throws EE_Error
215
-     */
216
-    public static function get_currency_config($CNT_ISO = '')
217
-    {
218
-        //if CNT_ISO passed lets try to get currency settings for it.
219
-        $currency_config = $CNT_ISO !== ''
220
-            ? new EE_Currency_Config($CNT_ISO)
221
-            : null;
222
-        //default currency settings for site if not set
223
-        if (! $currency_config instanceof EE_Currency_Config) {
224
-            $currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
225
-                ? EE_Registry::instance()->CFG->currency
226
-                : new EE_Currency_Config();
227
-        }
228
-        return $currency_config;
229
-    }
211
+	/**
212
+	 * @param string $CNT_ISO
213
+	 * @return EE_Currency_Config|null
214
+	 * @throws EE_Error
215
+	 */
216
+	public static function get_currency_config($CNT_ISO = '')
217
+	{
218
+		//if CNT_ISO passed lets try to get currency settings for it.
219
+		$currency_config = $CNT_ISO !== ''
220
+			? new EE_Currency_Config($CNT_ISO)
221
+			: null;
222
+		//default currency settings for site if not set
223
+		if (! $currency_config instanceof EE_Currency_Config) {
224
+			$currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
225
+				? EE_Registry::instance()->CFG->currency
226
+				: new EE_Currency_Config();
227
+		}
228
+		return $currency_config;
229
+	}
230 230
 
231 231
 } //end class EEH_Money
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  *
21 21
  * ------------------------------------------------------------------------
22 22
  */
23
-class EEH_Money extends EEH_Base  {
23
+class EEH_Money extends EEH_Base {
24 24
 
25 25
 
26 26
     /**
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
      * @return float
62 62
      * @throws EE_Error
63 63
      */
64
-	public static function convert_to_float_from_localized_money($money_value ) {
64
+	public static function convert_to_float_from_localized_money($money_value) {
65 65
 		//float it! and round to three decimal places
66
-        return round ( (float) EEH_Money::strip_localized_money_formatting($money_value), 3 );
66
+        return round((float) EEH_Money::strip_localized_money_formatting($money_value), 3);
67 67
 	}
68 68
 
69 69
 
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
 	 * @throws EE_Error
83 83
 	 */
84 84
 
85
-	public static function compare_floats( $float1, $float2, $operator='=' ) {
85
+	public static function compare_floats($float1, $float2, $operator = '=') {
86 86
 		// Check numbers to 5 digits of precision
87 87
 		$epsilon = 0.00001;
88 88
 
89
-		$float1 = (float)$float1;
90
-		$float2 = (float)$float2;
89
+		$float1 = (float) $float1;
90
+		$float2 = (float) $float2;
91 91
 
92 92
 		switch ($operator) {
93 93
 			// equal
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 				}
144 144
 				break;
145 145
 			default:
146
-				throw new EE_Error(__( "Unknown operator '" . $operator . "' in EEH_Money::compare_floats()", 'event_espresso' ) );
146
+				throw new EE_Error(__("Unknown operator '".$operator."' in EEH_Money::compare_floats()", 'event_espresso'));
147 147
 		}
148 148
 
149 149
 		return false;
@@ -159,14 +159,14 @@  discard block
 block discarded – undo
159 159
      * @return string
160 160
      * @throws EE_Error
161 161
      */
162
-	public static function get_format_for_jqplot( $CNT_ISO = '') {
162
+	public static function get_format_for_jqplot($CNT_ISO = '') {
163 163
 		//default format
164 164
 		$format = 'f';
165 165
 		$currency_config = $currency_config = EEH_Money::get_currency_config($CNT_ISO);
166 166
         //first get the decimal place and number of places
167
-		$format = "%'." . $currency_config->dec_plc . $format;
167
+		$format = "%'.".$currency_config->dec_plc.$format;
168 168
 		//currency symbol on right side.
169
-		$format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign;
169
+		$format = $currency_config->sign_b4 ? $currency_config->sign.$format : $format.$currency_config->sign;
170 170
 		return $format;
171 171
 	}
172 172
 
@@ -182,20 +182,20 @@  discard block
 block discarded – undo
182 182
      * @return string
183 183
      * @throws EE_Error
184 184
      */
185
-	public static function get_format_for_google_charts( $CNT_ISO = '' ) {
185
+	public static function get_format_for_google_charts($CNT_ISO = '') {
186 186
 		$currency_config = EEH_Money::get_currency_config($CNT_ISO);
187
-		$decimal_places_placeholder = str_pad( '', $currency_config->dec_plc, '0' );
187
+		$decimal_places_placeholder = str_pad('', $currency_config->dec_plc, '0');
188 188
 		//first get the decimal place and number of places
189
-		$format = '#,##0.' . $decimal_places_placeholder;
189
+		$format = '#,##0.'.$decimal_places_placeholder;
190 190
 
191 191
 		//currency symbol on right side.
192
-		$format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign;
192
+		$format = $currency_config->sign_b4 ? $currency_config->sign.$format : $format.$currency_config->sign;
193 193
 		$formatterObject = array(
194 194
 			'decimalSymbol' => $currency_config->dec_mrk,
195 195
 			'groupingSymbol' => $currency_config->thsnds,
196 196
 			'fractionDigits' => $currency_config->dec_plc,
197 197
 		);
198
-		if ( $currency_config->sign_b4 ) {
198
+		if ($currency_config->sign_b4) {
199 199
 			$formatterObject['prefix'] = $currency_config->sign;
200 200
 		} else {
201 201
 			$formatterObject['suffix'] = $currency_config->sign;
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
             ? new EE_Currency_Config($CNT_ISO)
221 221
             : null;
222 222
         //default currency settings for site if not set
223
-        if (! $currency_config instanceof EE_Currency_Config) {
223
+        if ( ! $currency_config instanceof EE_Currency_Config) {
224 224
             $currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
225 225
                 ? EE_Registry::instance()->CFG->currency
226 226
                 : new EE_Currency_Config();
Please login to merge, or discard this patch.
form_sections/strategies/normalization/EE_Float_Normalization.strategy.php 2 patches
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if (! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -15,85 +15,85 @@  discard block
 block discarded – undo
15 15
 class EE_Float_Normalization extends EE_Normalization_Strategy_Base
16 16
 {
17 17
 
18
-    /*
18
+	/*
19 19
      * regex pattern that matches for the following:
20 20
      *      * optional negative sign
21 21
      *      * one or more digits or decimals
22 22
      */
23
-    const REGEX = '/^(-?)([\d.]+)$/';
23
+	const REGEX = '/^(-?)([\d.]+)$/';
24 24
 
25 25
 
26
-    /**
27
-     * @param string $value_to_normalize
28
-     * @return float
29
-     * @throws \EE_Validation_Error
30
-     */
31
-    public function normalize($value_to_normalize)
32
-    {
33
-        if ($value_to_normalize === null) {
34
-            return null;
35
-        }
36
-        if (is_float($value_to_normalize) || is_int($value_to_normalize)) {
37
-            return (float)$value_to_normalize;
38
-        }
39
-        if (! is_string($value_to_normalize)) {
40
-            throw new EE_Validation_Error(
41
-                sprintf(
42
-                    __('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'),
43
-                    print_r($value_to_normalize, true),
44
-                    gettype($value_to_normalize)
45
-                )
46
-            );
47
-        }
48
-        $normalized_value = filter_var(
49
-            $value_to_normalize,
50
-            FILTER_SANITIZE_NUMBER_FLOAT,
51
-            FILTER_FLAG_ALLOW_FRACTION
52
-        );
53
-        if($normalized_value === ''){
54
-            return null;
55
-        }
56
-        if (preg_match(EE_Float_Normalization::REGEX, $normalized_value, $matches)) {
57
-            if (count($matches) === 3) {
58
-                // if first match is the negative sign,
59
-                // then the number needs to be multiplied by -1 to remain negative
60
-                return $matches[1] === '-'
61
-                    ? (float)$matches[2] * -1
62
-                    : (float)$matches[2];
63
-            }
64
-        }
65
-        //find if this input has a float validation strategy
66
-        //in which case, use its message
67
-        $validation_error_message = null;
68
-        foreach ($this->_input->get_validation_strategies() as $validation_strategy) {
69
-            if ($validation_strategy instanceof EE_Float_Validation_Strategy) {
70
-                $validation_error_message = $validation_strategy->get_validation_error_message();
71
-            }
72
-        }
73
-        //this really shouldn't ever happen because fields with a float normalization strategy
74
-        //should also have a float validation strategy, but in case it doesn't use the default
75
-        if (! $validation_error_message) {
76
-            $default_validation_strategy = new EE_Float_Validation_Strategy();
77
-            $validation_error_message = $default_validation_strategy->get_validation_error_message();
78
-        }
79
-        throw new EE_Validation_Error($validation_error_message, 'float_only');
80
-    }
26
+	/**
27
+	 * @param string $value_to_normalize
28
+	 * @return float
29
+	 * @throws \EE_Validation_Error
30
+	 */
31
+	public function normalize($value_to_normalize)
32
+	{
33
+		if ($value_to_normalize === null) {
34
+			return null;
35
+		}
36
+		if (is_float($value_to_normalize) || is_int($value_to_normalize)) {
37
+			return (float)$value_to_normalize;
38
+		}
39
+		if (! is_string($value_to_normalize)) {
40
+			throw new EE_Validation_Error(
41
+				sprintf(
42
+					__('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'),
43
+					print_r($value_to_normalize, true),
44
+					gettype($value_to_normalize)
45
+				)
46
+			);
47
+		}
48
+		$normalized_value = filter_var(
49
+			$value_to_normalize,
50
+			FILTER_SANITIZE_NUMBER_FLOAT,
51
+			FILTER_FLAG_ALLOW_FRACTION
52
+		);
53
+		if($normalized_value === ''){
54
+			return null;
55
+		}
56
+		if (preg_match(EE_Float_Normalization::REGEX, $normalized_value, $matches)) {
57
+			if (count($matches) === 3) {
58
+				// if first match is the negative sign,
59
+				// then the number needs to be multiplied by -1 to remain negative
60
+				return $matches[1] === '-'
61
+					? (float)$matches[2] * -1
62
+					: (float)$matches[2];
63
+			}
64
+		}
65
+		//find if this input has a float validation strategy
66
+		//in which case, use its message
67
+		$validation_error_message = null;
68
+		foreach ($this->_input->get_validation_strategies() as $validation_strategy) {
69
+			if ($validation_strategy instanceof EE_Float_Validation_Strategy) {
70
+				$validation_error_message = $validation_strategy->get_validation_error_message();
71
+			}
72
+		}
73
+		//this really shouldn't ever happen because fields with a float normalization strategy
74
+		//should also have a float validation strategy, but in case it doesn't use the default
75
+		if (! $validation_error_message) {
76
+			$default_validation_strategy = new EE_Float_Validation_Strategy();
77
+			$validation_error_message = $default_validation_strategy->get_validation_error_message();
78
+		}
79
+		throw new EE_Validation_Error($validation_error_message, 'float_only');
80
+	}
81 81
 
82 82
 
83 83
 
84
-    /**
85
-     * Converts a float into a string
86
-     *
87
-     * @param float $normalized_value
88
-     * @return string
89
-     */
90
-    public function unnormalize($normalized_value)
91
-    {
92
-        if (empty($normalized_value)) {
93
-            return '0.00';
94
-        }
95
-        return "{$normalized_value}";
96
-    }
84
+	/**
85
+	 * Converts a float into a string
86
+	 *
87
+	 * @param float $normalized_value
88
+	 * @return string
89
+	 */
90
+	public function unnormalize($normalized_value)
91
+	{
92
+		if (empty($normalized_value)) {
93
+			return '0.00';
94
+		}
95
+		return "{$normalized_value}";
96
+	}
97 97
 }
98 98
 
99 99
 // End of file EE_Float_Normalization.strategy.php
100 100
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (! defined('EVENT_ESPRESSO_VERSION')) {
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2 2
     exit('No direct script access allowed');
3 3
 }
4 4
 
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
             return null;
35 35
         }
36 36
         if (is_float($value_to_normalize) || is_int($value_to_normalize)) {
37
-            return (float)$value_to_normalize;
37
+            return (float) $value_to_normalize;
38 38
         }
39
-        if (! is_string($value_to_normalize)) {
39
+        if ( ! is_string($value_to_normalize)) {
40 40
             throw new EE_Validation_Error(
41 41
                 sprintf(
42 42
                     __('The value "%s" must be a string submitted for normalization, it was %s', 'event_espresso'),
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             FILTER_SANITIZE_NUMBER_FLOAT,
51 51
             FILTER_FLAG_ALLOW_FRACTION
52 52
         );
53
-        if($normalized_value === ''){
53
+        if ($normalized_value === '') {
54 54
             return null;
55 55
         }
56 56
         if (preg_match(EE_Float_Normalization::REGEX, $normalized_value, $matches)) {
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
                 // if first match is the negative sign,
59 59
                 // then the number needs to be multiplied by -1 to remain negative
60 60
                 return $matches[1] === '-'
61
-                    ? (float)$matches[2] * -1
62
-                    : (float)$matches[2];
61
+                    ? (float) $matches[2] * -1
62
+                    : (float) $matches[2];
63 63
             }
64 64
         }
65 65
         //find if this input has a float validation strategy
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         }
73 73
         //this really shouldn't ever happen because fields with a float normalization strategy
74 74
         //should also have a float validation strategy, but in case it doesn't use the default
75
-        if (! $validation_error_message) {
75
+        if ( ! $validation_error_message) {
76 76
             $default_validation_strategy = new EE_Float_Validation_Strategy();
77 77
             $validation_error_message = $default_validation_strategy->get_validation_error_message();
78 78
         }
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('ABSPATH')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -40,243 +40,243 @@  discard block
 block discarded – undo
40 40
  * @since            4.0
41 41
  */
42 42
 if (function_exists('espresso_version')) {
43
-    /**
44
-     *    espresso_duplicate_plugin_error
45
-     *    displays if more than one version of EE is activated at the same time
46
-     */
47
-    function espresso_duplicate_plugin_error()
48
-    {
49
-        ?>
43
+	/**
44
+	 *    espresso_duplicate_plugin_error
45
+	 *    displays if more than one version of EE is activated at the same time
46
+	 */
47
+	function espresso_duplicate_plugin_error()
48
+	{
49
+		?>
50 50
         <div class="error">
51 51
             <p>
52 52
                 <?php echo esc_html__(
53
-                        'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
-                        'event_espresso'
55
-                ); ?>
53
+						'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
+						'event_espresso'
55
+				); ?>
56 56
             </p>
57 57
         </div>
58 58
         <?php
59
-        espresso_deactivate_plugin(plugin_basename(__FILE__));
60
-    }
59
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
60
+	}
61 61
 
62
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
62
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
63 63
 } else {
64
-    define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
65
-    if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
-        /**
67
-         * espresso_minimum_php_version_error
68
-         *
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
64
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
65
+	if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
+		/**
67
+		 * espresso_minimum_php_version_error
68
+		 *
69
+		 * @return void
70
+		 */
71
+		function espresso_minimum_php_version_error()
72
+		{
73
+			?>
74 74
             <div class="error">
75 75
                 <p>
76 76
                     <?php
77
-                    printf(
78
-                            esc_html__(
79
-                                    'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
-                                    'event_espresso'
81
-                            ),
82
-                            EE_MIN_PHP_VER_REQUIRED,
83
-                            PHP_VERSION,
84
-                            '<br/>',
85
-                            '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
-                    );
87
-                    ?>
77
+					printf(
78
+							esc_html__(
79
+									'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
+									'event_espresso'
81
+							),
82
+							EE_MIN_PHP_VER_REQUIRED,
83
+							PHP_VERSION,
84
+							'<br/>',
85
+							'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
+					);
87
+					?>
88 88
                 </p>
89 89
             </div>
90 90
             <?php
91
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
92
-        }
91
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
92
+		}
93 93
 
94
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
-    } else {
96
-        /**
97
-         * espresso_version
98
-         * Returns the plugin version
99
-         *
100
-         * @return string
101
-         */
102
-        function espresso_version()
103
-        {
104
-            return apply_filters('FHEE__espresso__espresso_version', '4.9.38.rc.029');
105
-        }
94
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
+	} else {
96
+		/**
97
+		 * espresso_version
98
+		 * Returns the plugin version
99
+		 *
100
+		 * @return string
101
+		 */
102
+		function espresso_version()
103
+		{
104
+			return apply_filters('FHEE__espresso__espresso_version', '4.9.38.rc.029');
105
+		}
106 106
 
107
-        // define versions
108
-        define('EVENT_ESPRESSO_VERSION', espresso_version());
109
-        define('EE_MIN_WP_VER_REQUIRED', '4.1');
110
-        define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
111
-        define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
112
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
113
-        //used to be DIRECTORY_SEPARATOR, but that caused issues on windows
114
-        if ( ! defined('DS')) {
115
-            define('DS', '/');
116
-        }
117
-        if ( ! defined('PS')) {
118
-            define('PS', PATH_SEPARATOR);
119
-        }
120
-        if ( ! defined('SP')) {
121
-            define('SP', ' ');
122
-        }
123
-        if ( ! defined('EENL')) {
124
-            define('EENL', "\n");
125
-        }
126
-        define('EE_SUPPORT_EMAIL', '[email protected]');
127
-        // define the plugin directory and URL
128
-        define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
129
-        define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
130
-        define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
131
-        // main root folder paths
132
-        define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS);
133
-        define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS);
134
-        define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS);
135
-        define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS);
136
-        define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS);
137
-        define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS);
138
-        define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS);
139
-        define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS);
140
-        // core system paths
141
-        define('EE_ADMIN', EE_CORE . 'admin' . DS);
142
-        define('EE_CPTS', EE_CORE . 'CPTs' . DS);
143
-        define('EE_CLASSES', EE_CORE . 'db_classes' . DS);
144
-        define('EE_INTERFACES', EE_CORE . 'interfaces' . DS);
145
-        define('EE_BUSINESS', EE_CORE . 'business' . DS);
146
-        define('EE_MODELS', EE_CORE . 'db_models' . DS);
147
-        define('EE_HELPERS', EE_CORE . 'helpers' . DS);
148
-        define('EE_LIBRARIES', EE_CORE . 'libraries' . DS);
149
-        define('EE_TEMPLATES', EE_CORE . 'templates' . DS);
150
-        define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS);
151
-        define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS);
152
-        define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS);
153
-        // gateways
154
-        define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS);
155
-        define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS);
156
-        // asset URL paths
157
-        define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS);
158
-        define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS);
159
-        define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS);
160
-        define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS);
161
-        define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/');
162
-        define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/');
163
-        // define upload paths
164
-        $uploads = wp_upload_dir();
165
-        // define the uploads directory and URL
166
-        define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS);
167
-        define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS);
168
-        // define the templates directory and URL
169
-        define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS);
170
-        define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS);
171
-        // define the gateway directory and URL
172
-        define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS);
173
-        define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS);
174
-        // languages folder/path
175
-        define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS);
176
-        define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS);
177
-        //check for dompdf fonts in uploads
178
-        if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) {
179
-            define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS);
180
-        }
181
-        //ajax constants
182
-        define(
183
-                'EE_FRONT_AJAX',
184
-                isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false
185
-        );
186
-        define(
187
-                'EE_ADMIN_AJAX',
188
-                isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false
189
-        );
190
-        //just a handy constant occasionally needed for finding values representing infinity in the DB
191
-        //you're better to use this than its straight value (currently -1) in case you ever
192
-        //want to change its default value! or find when -1 means infinity
193
-        define('EE_INF_IN_DB', -1);
194
-        define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX);
195
-        define('EE_DEBUG', false);
196
-        // for older WP versions
197
-        if ( ! defined('MONTH_IN_SECONDS')) {
198
-            define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
199
-        }
200
-        /**
201
-         *    espresso_plugin_activation
202
-         *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
203
-         */
204
-        function espresso_plugin_activation()
205
-        {
206
-            update_option('ee_espresso_activation', true);
207
-        }
107
+		// define versions
108
+		define('EVENT_ESPRESSO_VERSION', espresso_version());
109
+		define('EE_MIN_WP_VER_REQUIRED', '4.1');
110
+		define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
111
+		define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
112
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
113
+		//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
114
+		if ( ! defined('DS')) {
115
+			define('DS', '/');
116
+		}
117
+		if ( ! defined('PS')) {
118
+			define('PS', PATH_SEPARATOR);
119
+		}
120
+		if ( ! defined('SP')) {
121
+			define('SP', ' ');
122
+		}
123
+		if ( ! defined('EENL')) {
124
+			define('EENL', "\n");
125
+		}
126
+		define('EE_SUPPORT_EMAIL', '[email protected]');
127
+		// define the plugin directory and URL
128
+		define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
129
+		define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
130
+		define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
131
+		// main root folder paths
132
+		define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS);
133
+		define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS);
134
+		define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS);
135
+		define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS);
136
+		define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS);
137
+		define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS);
138
+		define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS);
139
+		define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS);
140
+		// core system paths
141
+		define('EE_ADMIN', EE_CORE . 'admin' . DS);
142
+		define('EE_CPTS', EE_CORE . 'CPTs' . DS);
143
+		define('EE_CLASSES', EE_CORE . 'db_classes' . DS);
144
+		define('EE_INTERFACES', EE_CORE . 'interfaces' . DS);
145
+		define('EE_BUSINESS', EE_CORE . 'business' . DS);
146
+		define('EE_MODELS', EE_CORE . 'db_models' . DS);
147
+		define('EE_HELPERS', EE_CORE . 'helpers' . DS);
148
+		define('EE_LIBRARIES', EE_CORE . 'libraries' . DS);
149
+		define('EE_TEMPLATES', EE_CORE . 'templates' . DS);
150
+		define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS);
151
+		define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS);
152
+		define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS);
153
+		// gateways
154
+		define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS);
155
+		define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS);
156
+		// asset URL paths
157
+		define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS);
158
+		define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS);
159
+		define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS);
160
+		define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS);
161
+		define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/');
162
+		define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/');
163
+		// define upload paths
164
+		$uploads = wp_upload_dir();
165
+		// define the uploads directory and URL
166
+		define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS);
167
+		define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS);
168
+		// define the templates directory and URL
169
+		define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS);
170
+		define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS);
171
+		// define the gateway directory and URL
172
+		define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS);
173
+		define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS);
174
+		// languages folder/path
175
+		define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS);
176
+		define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS);
177
+		//check for dompdf fonts in uploads
178
+		if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) {
179
+			define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS);
180
+		}
181
+		//ajax constants
182
+		define(
183
+				'EE_FRONT_AJAX',
184
+				isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false
185
+		);
186
+		define(
187
+				'EE_ADMIN_AJAX',
188
+				isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false
189
+		);
190
+		//just a handy constant occasionally needed for finding values representing infinity in the DB
191
+		//you're better to use this than its straight value (currently -1) in case you ever
192
+		//want to change its default value! or find when -1 means infinity
193
+		define('EE_INF_IN_DB', -1);
194
+		define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX);
195
+		define('EE_DEBUG', false);
196
+		// for older WP versions
197
+		if ( ! defined('MONTH_IN_SECONDS')) {
198
+			define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
199
+		}
200
+		/**
201
+		 *    espresso_plugin_activation
202
+		 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
203
+		 */
204
+		function espresso_plugin_activation()
205
+		{
206
+			update_option('ee_espresso_activation', true);
207
+		}
208 208
 
209
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
210
-        /**
211
-         *    espresso_load_error_handling
212
-         *    this function loads EE's class for handling exceptions and errors
213
-         */
214
-        function espresso_load_error_handling()
215
-        {
216
-            // load debugging tools
217
-            if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
218
-                require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php');
219
-                EEH_Debug_Tools::instance();
220
-            }
221
-            // load error handling
222
-            if (is_readable(EE_CORE . 'EE_Error.core.php')) {
223
-                require_once(EE_CORE . 'EE_Error.core.php');
224
-            } else {
225
-                wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
226
-            }
227
-        }
209
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
210
+		/**
211
+		 *    espresso_load_error_handling
212
+		 *    this function loads EE's class for handling exceptions and errors
213
+		 */
214
+		function espresso_load_error_handling()
215
+		{
216
+			// load debugging tools
217
+			if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
218
+				require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php');
219
+				EEH_Debug_Tools::instance();
220
+			}
221
+			// load error handling
222
+			if (is_readable(EE_CORE . 'EE_Error.core.php')) {
223
+				require_once(EE_CORE . 'EE_Error.core.php');
224
+			} else {
225
+				wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
226
+			}
227
+		}
228 228
 
229
-        /**
230
-         *    espresso_load_required
231
-         *    given a class name and path, this function will load that file or throw an exception
232
-         *
233
-         * @param    string $classname
234
-         * @param    string $full_path_to_file
235
-         * @throws    EE_Error
236
-         */
237
-        function espresso_load_required($classname, $full_path_to_file)
238
-        {
239
-            static $error_handling_loaded = false;
240
-            if ( ! $error_handling_loaded) {
241
-                espresso_load_error_handling();
242
-                $error_handling_loaded = true;
243
-            }
244
-            if (is_readable($full_path_to_file)) {
245
-                require_once($full_path_to_file);
246
-            } else {
247
-                throw new EE_Error (
248
-                        sprintf(
249
-                                esc_html__(
250
-                                        'The %s class file could not be located or is not readable due to file permissions.',
251
-                                        'event_espresso'
252
-                                ),
253
-                                $classname
254
-                        )
255
-                );
256
-            }
257
-        }
229
+		/**
230
+		 *    espresso_load_required
231
+		 *    given a class name and path, this function will load that file or throw an exception
232
+		 *
233
+		 * @param    string $classname
234
+		 * @param    string $full_path_to_file
235
+		 * @throws    EE_Error
236
+		 */
237
+		function espresso_load_required($classname, $full_path_to_file)
238
+		{
239
+			static $error_handling_loaded = false;
240
+			if ( ! $error_handling_loaded) {
241
+				espresso_load_error_handling();
242
+				$error_handling_loaded = true;
243
+			}
244
+			if (is_readable($full_path_to_file)) {
245
+				require_once($full_path_to_file);
246
+			} else {
247
+				throw new EE_Error (
248
+						sprintf(
249
+								esc_html__(
250
+										'The %s class file could not be located or is not readable due to file permissions.',
251
+										'event_espresso'
252
+								),
253
+								$classname
254
+						)
255
+				);
256
+			}
257
+		}
258 258
 
259
-        espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php');
260
-        espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php');
261
-        espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php');
262
-        new EE_Bootstrap();
263
-    }
259
+		espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php');
260
+		espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php');
261
+		espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php');
262
+		new EE_Bootstrap();
263
+	}
264 264
 }
265 265
 if ( ! function_exists('espresso_deactivate_plugin')) {
266
-    /**
267
-     *    deactivate_plugin
268
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
269
-     *
270
-     * @access public
271
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
272
-     * @return    void
273
-     */
274
-    function espresso_deactivate_plugin($plugin_basename = '')
275
-    {
276
-        if ( ! function_exists('deactivate_plugins')) {
277
-            require_once(ABSPATH . 'wp-admin/includes/plugin.php');
278
-        }
279
-        unset($_GET['activate'], $_REQUEST['activate']);
280
-        deactivate_plugins($plugin_basename);
281
-    }
266
+	/**
267
+	 *    deactivate_plugin
268
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
269
+	 *
270
+	 * @access public
271
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
272
+	 * @return    void
273
+	 */
274
+	function espresso_deactivate_plugin($plugin_basename = '')
275
+	{
276
+		if ( ! function_exists('deactivate_plugins')) {
277
+			require_once(ABSPATH . 'wp-admin/includes/plugin.php');
278
+		}
279
+		unset($_GET['activate'], $_REQUEST['activate']);
280
+		deactivate_plugins($plugin_basename);
281
+	}
282 282
 }
283 283
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/rest_api/controllers/config/Read.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\libraries\rest_api\controllers\config;
3 3
 
4 4
 if (! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -18,74 +18,74 @@  discard block
 block discarded – undo
18 18
 class Read
19 19
 {
20 20
 
21
-    /**
22
-     * @param \WP_REST_Request $request
23
-     * @return \EE_Config|\WP_Error
24
-     */
25
-    public static function handle_request(\WP_REST_Request $request)
26
-    {
27
-        $cap = \EE_Restriction_Generator_Base::get_default_restrictions_cap();
28
-        if (\EE_Capabilities::instance()->current_user_can($cap, 'read_over_api')) {
29
-            return \EE_Config::instance();
30
-        } else {
31
-            return new \WP_Error(
32
-                'cannot_read_config',
33
-                sprintf(
34
-                    __(
35
-                        'You do not have the necessary capabilities (%s) to read Event Espresso Configuration data',
36
-                        'event_espresso'
37
-                    ),
38
-                    $cap
39
-                ),
40
-                array('status' => 403)
41
-            );
42
-        }
43
-    }
21
+	/**
22
+	 * @param \WP_REST_Request $request
23
+	 * @return \EE_Config|\WP_Error
24
+	 */
25
+	public static function handle_request(\WP_REST_Request $request)
26
+	{
27
+		$cap = \EE_Restriction_Generator_Base::get_default_restrictions_cap();
28
+		if (\EE_Capabilities::instance()->current_user_can($cap, 'read_over_api')) {
29
+			return \EE_Config::instance();
30
+		} else {
31
+			return new \WP_Error(
32
+				'cannot_read_config',
33
+				sprintf(
34
+					__(
35
+						'You do not have the necessary capabilities (%s) to read Event Espresso Configuration data',
36
+						'event_espresso'
37
+					),
38
+					$cap
39
+				),
40
+				array('status' => 403)
41
+			);
42
+		}
43
+	}
44 44
 
45 45
 
46 46
 
47
-    /**
48
-     * Handles the request for public site info
49
-     *
50
-     * @global                 $wp_json_basic_auth_success       boolean set by the basic auth plugin, indicates if the
51
-     *                         current user could be authenticated using basic auth data
52
-     * @global                 $wp_json_basic_auth_received_data boolean set by the basic auth plugin, indicates if
53
-     *                         basic auth data was somehow received
54
-     * @param \WP_REST_Request $request
55
-     * @return \EE_Config|\WP_Error
56
-     */
57
-    public static function handle_request_site_info(\WP_REST_Request $request)
58
-    {
59
-        global $wp_json_basic_auth_success, $wp_json_basic_auth_received_data;
60
-        $insecure_usage_of_basic_auth = apply_filters(
61
-            'EventEspresso__core__libraries__rest_api__controllers__config__handle_request_site_info__insecure_usage_of_basic_auth',
62
-            $wp_json_basic_auth_success && ! is_ssl(),
63
-            $request
64
-        );
65
-        if ($insecure_usage_of_basic_auth) {
66
-            $warning = sprintf(
67
-                esc_html__('Notice: We strongly recommend installing an SSL Certificate on your website to keep your data secure. %1$sPlease see our recommendations.%2$s',
68
-                    'event_espresso'),
69
-                '<a href="https://eventespresso.com/wiki/rest-api-security-recommendations/">',
70
-                '</a>'
71
-            );
72
-        } else {
73
-            $warning = '';
74
-        }
75
-        return array(
76
-            'default_timezone' => array(
77
-                'pretty' => \EEH_DTT_Helper::get_timezone_string_for_display(),
78
-                'string' => get_option('timezone_string'),
79
-                'offset' => \EEH_DTT_Helper::get_site_timezone_gmt_offset(),
80
-            ),
81
-            'default_currency' => \EE_Config::instance()->currency,
82
-            'authentication'   => array(
83
-                'received_basic_auth_data'     => (bool)$wp_json_basic_auth_received_data,
84
-                'insecure_usage_of_basic_auth' => (bool)$insecure_usage_of_basic_auth,
85
-                'warning'                      => $warning
86
-            )
87
-        );
88
-    }
47
+	/**
48
+	 * Handles the request for public site info
49
+	 *
50
+	 * @global                 $wp_json_basic_auth_success       boolean set by the basic auth plugin, indicates if the
51
+	 *                         current user could be authenticated using basic auth data
52
+	 * @global                 $wp_json_basic_auth_received_data boolean set by the basic auth plugin, indicates if
53
+	 *                         basic auth data was somehow received
54
+	 * @param \WP_REST_Request $request
55
+	 * @return \EE_Config|\WP_Error
56
+	 */
57
+	public static function handle_request_site_info(\WP_REST_Request $request)
58
+	{
59
+		global $wp_json_basic_auth_success, $wp_json_basic_auth_received_data;
60
+		$insecure_usage_of_basic_auth = apply_filters(
61
+			'EventEspresso__core__libraries__rest_api__controllers__config__handle_request_site_info__insecure_usage_of_basic_auth',
62
+			$wp_json_basic_auth_success && ! is_ssl(),
63
+			$request
64
+		);
65
+		if ($insecure_usage_of_basic_auth) {
66
+			$warning = sprintf(
67
+				esc_html__('Notice: We strongly recommend installing an SSL Certificate on your website to keep your data secure. %1$sPlease see our recommendations.%2$s',
68
+					'event_espresso'),
69
+				'<a href="https://eventespresso.com/wiki/rest-api-security-recommendations/">',
70
+				'</a>'
71
+			);
72
+		} else {
73
+			$warning = '';
74
+		}
75
+		return array(
76
+			'default_timezone' => array(
77
+				'pretty' => \EEH_DTT_Helper::get_timezone_string_for_display(),
78
+				'string' => get_option('timezone_string'),
79
+				'offset' => \EEH_DTT_Helper::get_site_timezone_gmt_offset(),
80
+			),
81
+			'default_currency' => \EE_Config::instance()->currency,
82
+			'authentication'   => array(
83
+				'received_basic_auth_data'     => (bool)$wp_json_basic_auth_received_data,
84
+				'insecure_usage_of_basic_auth' => (bool)$insecure_usage_of_basic_auth,
85
+				'warning'                      => $warning
86
+			)
87
+		);
88
+	}
89 89
 }
90 90
 
91 91
 // End of file Read.php
92 92
\ No newline at end of file
Please login to merge, or discard this patch.
core/EE_Dependency_Map.core.php 2 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 	public static function register_class_loader( $class_name, $loader = 'load_core' ) {
143 143
 		// check that loader method starts with "load_" and exists in EE_Registry
144 144
 		if (
145
-		    ! is_callable($loader)
146
-            && (strpos( $loader, 'load_' ) !== 0 || ! method_exists( 'EE_Registry', $loader ))
147
-        ) {
145
+			! is_callable($loader)
146
+			&& (strpos( $loader, 'load_' ) !== 0 || ! method_exists( 'EE_Registry', $loader ))
147
+		) {
148 148
 			throw new EE_Error(
149 149
 				sprintf(
150 150
 					__( '"%1$s" is not a valid loader method on EE_Registry.', 'event_espresso' ),
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	public function has_dependency_for_class( $class_name = '', $dependency = '' ) {
194 194
 		$dependency = $this->get_alias( $dependency );
195
-        return isset( $this->_dependency_map[ $class_name ], $this->_dependency_map[ $class_name ][ $dependency ] )
195
+		return isset( $this->_dependency_map[ $class_name ], $this->_dependency_map[ $class_name ][ $dependency ] )
196 196
 			? true
197 197
 			: false;
198 198
 	}
@@ -235,65 +235,65 @@  discard block
 block discarded – undo
235 235
 
236 236
 
237 237
 
238
-    /**
239
-     * adds an alias for a classname
240
-     *
241
-     * @param string $class_name    the class name that should be used (concrete class to replace interface)
242
-     * @param string $alias         the class name that would be type hinted for (abstract parent or interface)
243
-     * @param string $for_class     the class that has the dependency (is type hinting for the interface)
244
-     */
238
+	/**
239
+	 * adds an alias for a classname
240
+	 *
241
+	 * @param string $class_name    the class name that should be used (concrete class to replace interface)
242
+	 * @param string $alias         the class name that would be type hinted for (abstract parent or interface)
243
+	 * @param string $for_class     the class that has the dependency (is type hinting for the interface)
244
+	 */
245 245
 	public function add_alias( $class_name, $alias, $for_class = '' ) {
246
-	    if ($for_class !== '') {
247
-            if ( ! isset($this->_aliases[$for_class])) {
248
-                $this->_aliases[$for_class] = array();
249
-            }
250
-            $this->_aliases[$for_class][$class_name] = $alias;
251
-        }
246
+		if ($for_class !== '') {
247
+			if ( ! isset($this->_aliases[$for_class])) {
248
+				$this->_aliases[$for_class] = array();
249
+			}
250
+			$this->_aliases[$for_class][$class_name] = $alias;
251
+		}
252 252
 		$this->_aliases[ $class_name ] = $alias;
253 253
 	}
254 254
 
255 255
 
256 256
 
257
-    /**
258
-     * returns TRUE if the provided class name has an alias
259
-     *
260
-     * @param string $class_name
261
-     * @param string $for_class
262
-     * @return bool
263
-     */
257
+	/**
258
+	 * returns TRUE if the provided class name has an alias
259
+	 *
260
+	 * @param string $class_name
261
+	 * @param string $for_class
262
+	 * @return bool
263
+	 */
264 264
 	public function has_alias( $class_name = '', $for_class = '' ) {
265
-	    if (isset($this->_aliases[$for_class], $this->_aliases[$for_class][$class_name])) {
266
-	        return true;
267
-        }
265
+		if (isset($this->_aliases[$for_class], $this->_aliases[$for_class][$class_name])) {
266
+			return true;
267
+		}
268 268
 		return isset( $this->_aliases[ $class_name ] ) && ! is_array( $this->_aliases[ $class_name ] ) ? true : false;
269 269
 	}
270 270
 
271 271
 
272 272
 
273
-    /**
274
-     * returns alias for class name if one exists, otherwise returns the original classname
275
-     * functions recursively, so that multiple aliases can be used to drill down to a classname
276
-     *  for example:
277
-     *      if the following two entries were added to the _aliases array:
278
-     *          array(
279
-     *              'interface_alias'           => 'some\namespace\interface'
280
-     *              'some\namespace\interface'  => 'some\namespace\classname'
281
-     *          )
282
-     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
283
-     *      to load an instance of 'some\namespace\classname'
284
-     *
285
-     * @param string $class_name
286
-     * @param string $for_class
287
-     * @return string
288
-     */
273
+	/**
274
+	 * returns alias for class name if one exists, otherwise returns the original classname
275
+	 * functions recursively, so that multiple aliases can be used to drill down to a classname
276
+	 *  for example:
277
+	 *      if the following two entries were added to the _aliases array:
278
+	 *          array(
279
+	 *              'interface_alias'           => 'some\namespace\interface'
280
+	 *              'some\namespace\interface'  => 'some\namespace\classname'
281
+	 *          )
282
+	 *      then one could use EE_Registry::instance()->create( 'interface_alias' )
283
+	 *      to load an instance of 'some\namespace\classname'
284
+	 *
285
+	 * @param string $class_name
286
+	 * @param string $for_class
287
+	 * @return string
288
+	 */
289 289
 	public function get_alias( $class_name = '', $for_class = '' ) {
290
-	    if(! $this->has_alias($class_name, $for_class)) {
291
-	        return $class_name;
292
-        }
293
-        if ($for_class !== '') {
294
-            return $this->get_alias($this->_aliases[$for_class][$class_name], $for_class);
295
-        }
296
-        return $this->get_alias( $this->_aliases[ $class_name ] );
290
+		if(! $this->has_alias($class_name, $for_class)) {
291
+			return $class_name;
292
+		}
293
+		if ($for_class !== '') {
294
+			return $this->get_alias($this->_aliases[$for_class][$class_name], $for_class);
295
+		}
296
+		return $this->get_alias( $this->_aliases[ $class_name ] );
297 297
 	}
298 298
 
299 299
 
@@ -412,43 +412,43 @@  discard block
 block discarded – undo
412 412
 			),
413 413
 			'EE_Data_Migration_Class_Base' => array(
414 414
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
415
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
415
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
416 416
 			),
417 417
 			'EE_DMS_Core_4_1_0' => array(
418 418
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
419
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
419
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
420 420
 			),
421 421
 			'EE_DMS_Core_4_2_0' => array(
422 422
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
423
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
423
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
424 424
 			),
425 425
 			'EE_DMS_Core_4_3_0' => array(
426 426
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
427
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
427
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
428 428
 			),
429 429
 			'EE_DMS_Core_4_4_0' => array(
430 430
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
431
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
431
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
432 432
 			),
433 433
 			'EE_DMS_Core_4_5_0' => array(
434 434
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
435
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
435
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
436 436
 			),
437 437
 			'EE_DMS_Core_4_6_0' => array(
438 438
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
439
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
439
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
440 440
 			),
441 441
 			'EE_DMS_Core_4_7_0' => array(
442 442
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
443
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
443
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
444 444
 			),
445 445
 			'EE_DMS_Core_4_8_0' => array(
446 446
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
447
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
447
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
448 448
 			),
449 449
 			'EE_DMS_Core_4_9_0' => array(
450 450
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
451
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
451
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
452 452
 			),
453 453
 		);
454 454
 	}
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 	 * @param  \EE_Request  $request
76 76
 	 * @param  \EE_Response $response
77 77
 	 */
78
-	protected function __construct( EE_Request $request, EE_Response $response ) {
78
+	protected function __construct(EE_Request $request, EE_Response $response) {
79 79
 		$this->_request = $request;
80 80
 		$this->_response = $response;
81
-		add_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', array( $this, 'initialize' ) );
82
-		do_action( 'EE_Dependency_Map____construct' );
81
+		add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize'));
82
+		do_action('EE_Dependency_Map____construct');
83 83
 	}
84 84
 
85 85
 
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 	 * @param  \EE_Response $response
102 102
 	 * @return \EE_Dependency_Map instance
103 103
 	 */
104
-	public static function instance( EE_Request $request = null, EE_Response $response = null ) {
104
+	public static function instance(EE_Request $request = null, EE_Response $response = null) {
105 105
 		// check if class object is instantiated, and instantiated properly
106
-		if ( ! self::$_instance instanceof EE_Dependency_Map ) {
107
-			self::$_instance = new EE_Dependency_Map( $request, $response );
106
+		if ( ! self::$_instance instanceof EE_Dependency_Map) {
107
+			self::$_instance = new EE_Dependency_Map($request, $response);
108 108
 		}
109 109
 		return self::$_instance;
110 110
 	}
@@ -116,16 +116,16 @@  discard block
 block discarded – undo
116 116
 	 * @param array  $dependencies
117 117
 	 * @return boolean
118 118
 	 */
119
-	public static function register_dependencies( $class, $dependencies ) {
120
-		if ( ! isset( self::$_instance->_dependency_map[ $class ] ) ) {
119
+	public static function register_dependencies($class, $dependencies) {
120
+		if ( ! isset(self::$_instance->_dependency_map[$class])) {
121 121
 			// we need to make sure that any aliases used when registering a dependency
122 122
 			// get resolved to the correct class name
123
-			foreach ( (array) $dependencies as $dependency => $load_source ) {
124
-				$alias = self::$_instance->get_alias( $dependency );
125
-				unset( $dependencies[ $dependency ] );
126
-				$dependencies[ $alias ] = $load_source;
123
+			foreach ((array) $dependencies as $dependency => $load_source) {
124
+				$alias = self::$_instance->get_alias($dependency);
125
+				unset($dependencies[$dependency]);
126
+				$dependencies[$alias] = $load_source;
127 127
 			}
128
-			self::$_instance->_dependency_map[ $class ] = (array) $dependencies;
128
+			self::$_instance->_dependency_map[$class] = (array) $dependencies;
129 129
 			return true;
130 130
 		}
131 131
 		return false;
@@ -139,22 +139,22 @@  discard block
 block discarded – undo
139 139
 	 * @return bool
140 140
 	 * @throws \EE_Error
141 141
 	 */
142
-	public static function register_class_loader( $class_name, $loader = 'load_core' ) {
142
+	public static function register_class_loader($class_name, $loader = 'load_core') {
143 143
 		// check that loader method starts with "load_" and exists in EE_Registry
144 144
 		if (
145 145
 		    ! is_callable($loader)
146
-            && (strpos( $loader, 'load_' ) !== 0 || ! method_exists( 'EE_Registry', $loader ))
146
+            && (strpos($loader, 'load_') !== 0 || ! method_exists('EE_Registry', $loader))
147 147
         ) {
148 148
 			throw new EE_Error(
149 149
 				sprintf(
150
-					__( '"%1$s" is not a valid loader method on EE_Registry.', 'event_espresso' ),
150
+					__('"%1$s" is not a valid loader method on EE_Registry.', 'event_espresso'),
151 151
 					$loader
152 152
 				)
153 153
 			);
154 154
 		}
155
-		$class_name = self::$_instance->get_alias( $class_name );
156
-		if ( ! isset( self::$_instance->_class_loaders[ $class_name ] ) ) {
157
-			self::$_instance->_class_loaders[ $class_name ] = $loader;
155
+		$class_name = self::$_instance->get_alias($class_name);
156
+		if ( ! isset(self::$_instance->_class_loaders[$class_name])) {
157
+			self::$_instance->_class_loaders[$class_name] = $loader;
158 158
 			return true;
159 159
 		}
160 160
 		return false;
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
 	 * @param string $class_name
178 178
 	 * @return boolean
179 179
 	 */
180
-	public function has( $class_name = '' ) {
181
-		return isset( $this->_dependency_map[ $class_name ] ) ? true : false;
180
+	public function has($class_name = '') {
181
+		return isset($this->_dependency_map[$class_name]) ? true : false;
182 182
 	}
183 183
 
184 184
 
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 	 * @param string $dependency
191 191
 	 * @return bool
192 192
 	 */
193
-	public function has_dependency_for_class( $class_name = '', $dependency = '' ) {
194
-		$dependency = $this->get_alias( $dependency );
195
-        return isset( $this->_dependency_map[ $class_name ], $this->_dependency_map[ $class_name ][ $dependency ] )
193
+	public function has_dependency_for_class($class_name = '', $dependency = '') {
194
+		$dependency = $this->get_alias($dependency);
195
+        return isset($this->_dependency_map[$class_name], $this->_dependency_map[$class_name][$dependency])
196 196
 			? true
197 197
 			: false;
198 198
 	}
@@ -206,10 +206,10 @@  discard block
 block discarded – undo
206 206
 	 * @param string $dependency
207 207
 	 * @return int
208 208
 	 */
209
-	public function loading_strategy_for_class_dependency( $class_name = '', $dependency = '' ) {
210
-		$dependency = $this->get_alias( $dependency );
211
-		return $this->has_dependency_for_class( $class_name, $dependency )
212
-			? $this->_dependency_map[ $class_name ][ $dependency ]
209
+	public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') {
210
+		$dependency = $this->get_alias($dependency);
211
+		return $this->has_dependency_for_class($class_name, $dependency)
212
+			? $this->_dependency_map[$class_name][$dependency]
213 213
 			: EE_Dependency_Map::not_registered;
214 214
 	}
215 215
 
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
 	 * @param string $class_name
220 220
 	 * @return string | Closure
221 221
 	 */
222
-	public function class_loader( $class_name ) {
223
-		$class_name = $this->get_alias( $class_name );
224
-		return isset( $this->_class_loaders[ $class_name ] ) ? $this->_class_loaders[ $class_name ] : '';
222
+	public function class_loader($class_name) {
223
+		$class_name = $this->get_alias($class_name);
224
+		return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : '';
225 225
 	}
226 226
 
227 227
 
@@ -242,14 +242,14 @@  discard block
 block discarded – undo
242 242
      * @param string $alias         the class name that would be type hinted for (abstract parent or interface)
243 243
      * @param string $for_class     the class that has the dependency (is type hinting for the interface)
244 244
      */
245
-	public function add_alias( $class_name, $alias, $for_class = '' ) {
245
+	public function add_alias($class_name, $alias, $for_class = '') {
246 246
 	    if ($for_class !== '') {
247 247
             if ( ! isset($this->_aliases[$for_class])) {
248 248
                 $this->_aliases[$for_class] = array();
249 249
             }
250 250
             $this->_aliases[$for_class][$class_name] = $alias;
251 251
         }
252
-		$this->_aliases[ $class_name ] = $alias;
252
+		$this->_aliases[$class_name] = $alias;
253 253
 	}
254 254
 
255 255
 
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
      * @param string $for_class
262 262
      * @return bool
263 263
      */
264
-	public function has_alias( $class_name = '', $for_class = '' ) {
264
+	public function has_alias($class_name = '', $for_class = '') {
265 265
 	    if (isset($this->_aliases[$for_class], $this->_aliases[$for_class][$class_name])) {
266 266
 	        return true;
267 267
         }
268
-		return isset( $this->_aliases[ $class_name ] ) && ! is_array( $this->_aliases[ $class_name ] ) ? true : false;
268
+		return isset($this->_aliases[$class_name]) && ! is_array($this->_aliases[$class_name]) ? true : false;
269 269
 	}
270 270
 
271 271
 
@@ -286,14 +286,14 @@  discard block
 block discarded – undo
286 286
      * @param string $for_class
287 287
      * @return string
288 288
      */
289
-	public function get_alias( $class_name = '', $for_class = '' ) {
290
-	    if(! $this->has_alias($class_name, $for_class)) {
289
+	public function get_alias($class_name = '', $for_class = '') {
290
+	    if ( ! $this->has_alias($class_name, $for_class)) {
291 291
 	        return $class_name;
292 292
         }
293 293
         if ($for_class !== '') {
294 294
             return $this->get_alias($this->_aliases[$for_class][$class_name], $for_class);
295 295
         }
296
-        return $this->get_alias( $this->_aliases[ $class_name ] );
296
+        return $this->get_alias($this->_aliases[$class_name]);
297 297
 	}
298 298
 
299 299
 
@@ -511,10 +511,10 @@  discard block
 block discarded – undo
511 511
 			'EE_Messages_Data_Handler_Collection'  => 'load_lib',
512 512
 			'EE_Message_Template_Group_Collection' => 'load_lib',
513 513
 			'EE_Messages_Generator' => function() {
514
-				return EE_Registry::instance()->load_lib( 'Messages_Generator', array(), false, false );
514
+				return EE_Registry::instance()->load_lib('Messages_Generator', array(), false, false);
515 515
 			},
516
-			'EE_Messages_Template_Defaults' => function( $arguments = array() ) {
517
-				return EE_Registry::instance()->load_lib( 'Messages_Template_Defaults', $arguments, false, false );
516
+			'EE_Messages_Template_Defaults' => function($arguments = array()) {
517
+				return EE_Registry::instance()->load_lib('Messages_Template_Defaults', $arguments, false, false);
518 518
 			},
519 519
 			//load_model
520 520
 			'EEM_Attendee'                         => 'load_model',
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 			'EEM_Message_Template'                 => 'load_model',
523 523
 			//load_helper
524 524
 			'EEH_Parse_Shortcodes'                 => function() {
525
-				if ( EE_Registry::instance()->load_helper( 'Parse_Shortcodes' ) ) {
525
+				if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
526 526
 					return new EEH_Parse_Shortcodes();
527 527
 				}
528 528
 				return null;
Please login to merge, or discard this patch.