Completed
Branch FET-9099-unit-test-factories (8a4437)
by
unknown
75:17 queued 63:34
created
core/libraries/batch/Helpers/JobParameters.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
 	 * @param array $request_data
97 97
 	 * @param array $extra_data
98 98
 	 */
99
-	function __construct( $job_id, $classname, $request_data, $extra_data = array() ) {
100
-		$this->set_job_id( $job_id );
101
-		$this->set_classname( $classname );
102
-		$this->set_request_data( $request_data );
103
-		$this->set_extra_data( $extra_data );
104
-		$this->set_status( JobParameters::status_continue );
99
+	function __construct($job_id, $classname, $request_data, $extra_data = array()) {
100
+		$this->set_job_id($job_id);
101
+		$this->set_classname($classname);
102
+		$this->set_request_data($request_data);
103
+		$this->set_extra_data($extra_data);
104
+		$this->set_status(JobParameters::status_continue);
105 105
 	}
106 106
 
107 107
 
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 	 * @param boolean $first
127 127
 	 * @return boolean success
128 128
 	 */
129
-	function save( $first = false ) {
130
-		$object_vars = wp_json_encode( get_object_vars( $this ) );
131
-		if( $first ) {
132
-			return add_option( $this->option_name(), $object_vars, null, 'no' );
133
-		} else{
134
-			return update_option( $this->option_name(), $object_vars );
129
+	function save($first = false) {
130
+		$object_vars = wp_json_encode(get_object_vars($this));
131
+		if ($first) {
132
+			return add_option($this->option_name(), $object_vars, null, 'no');
133
+		} else {
134
+			return update_option($this->option_name(), $object_vars);
135 135
 		}
136 136
 	}
137 137
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @return boolean
144 144
 	 */
145 145
 	function delete() {
146
-		return delete_option( $this->option_name() );
146
+		return delete_option($this->option_name());
147 147
 	}
148 148
 
149 149
 
@@ -154,26 +154,26 @@  discard block
 block discarded – undo
154 154
 	 * @return JobParameters
155 155
 	 * @throws BatchRequestException
156 156
 	 */
157
-	static function load( $job_id ) {
158
-		$job_parameter_vars = json_decode( get_option( JobParameters::wp_option_prefix . $job_id ), true );
159
-		if(
160
-			! is_array( $job_parameter_vars ) ||
161
-			! isset( $job_parameter_vars[ '_classname' ] ) ||
162
-			! isset( $job_parameter_vars[ '_request_data' ] )
157
+	static function load($job_id) {
158
+		$job_parameter_vars = json_decode(get_option(JobParameters::wp_option_prefix.$job_id), true);
159
+		if (
160
+			! is_array($job_parameter_vars) ||
161
+			! isset($job_parameter_vars['_classname']) ||
162
+			! isset($job_parameter_vars['_request_data'])
163 163
 		) {
164 164
 			throw new BatchRequestException(
165 165
 				sprintf(
166 166
 					__('Could not retrieve job %1$s from the Wordpress options table, and so the job could not continue. The wordpress option was %2$s', 'event_espresso'),
167 167
 					$job_id,
168
-					get_option( JobParameters::wp_option_prefix . $job_id )
168
+					get_option(JobParameters::wp_option_prefix.$job_id)
169 169
 				)
170 170
 			);
171 171
 		}
172 172
 		$job_parameters = new JobParameters(
173 173
 				$job_id,
174
-				$job_parameter_vars[ '_classname' ],
175
-				$job_parameter_vars[ '_request_data'] );
176
-		foreach( $job_parameter_vars as $key => $value ) {
174
+				$job_parameter_vars['_classname'],
175
+				$job_parameter_vars['_request_data'] );
176
+		foreach ($job_parameter_vars as $key => $value) {
177 177
 			$job_parameters->{$key} = $value;
178 178
 		}
179 179
 		return $job_parameters;
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
 	 * @param string|array $default
218 218
 	 * @return string|array
219 219
 	 */
220
-	function request_datum( $key, $default = '' ) {
221
-		if( isset( $this->_request_data[ $key ] ) ) {
222
-			return $this->_request_data[ $key ];
220
+	function request_datum($key, $default = '') {
221
+		if (isset($this->_request_data[$key])) {
222
+			return $this->_request_data[$key];
223 223
 		} else {
224 224
 			return $default;
225 225
 		}
@@ -233,9 +233,9 @@  discard block
 block discarded – undo
233 233
 	 * @param string|array $default
234 234
 	 * @return string|array
235 235
 	 */
236
-	function extra_datum( $key, $default = '' ) {
237
-		if( isset( $this->_extra_data[ $key ] ) ) {
238
-			return $this->_extra_data[ $key ];
236
+	function extra_datum($key, $default = '') {
237
+		if (isset($this->_extra_data[$key])) {
238
+			return $this->_extra_data[$key];
239 239
 		} else {
240 240
 			return $default;
241 241
 		}
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 	 * @param string $key
249 249
 	 * @param string|int|array|null $value almost any extra data you want to store
250 250
 	 */
251
-	function add_extra_data( $key, $value ) {
252
-		$this->_extra_data[ $key ] = $value;
251
+	function add_extra_data($key, $value) {
252
+		$this->_extra_data[$key] = $value;
253 253
 	}
254 254
 
255 255
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 * Sets the job size. You decide what units to use
279 279
 	 * @param int $size
280 280
 	 */
281
-	function set_job_size( $size ) {
281
+	function set_job_size($size) {
282 282
 		$this->_job_size = $size;
283 283
 	}
284 284
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @param int $newly_processed
300 300
 	 * @return int updated units processed
301 301
 	 */
302
-	function mark_processed( $newly_processed ) {
302
+	function mark_processed($newly_processed) {
303 303
 		$this->_units_processed += $newly_processed;
304 304
 		return $this->_units_processed;
305 305
 	}
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 * Sets the total count of units processed. You might prefer to use mark_processed
311 311
 	 * @param int $total_units_processed
312 312
 	 */
313
-	function set_units_processed( $total_units_processed ) {
313
+	function set_units_processed($total_units_processed) {
314 314
 		$this->_units_processed = $total_units_processed;
315 315
 	}
316 316
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 * Sets the job's ID
321 321
 	 * @param string $job_id
322 322
 	 */
323
-	function set_job_id( $job_id ) {
323
+	function set_job_id($job_id) {
324 324
 		$this->_job_id = $job_id;
325 325
 	}
326 326
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 * sets the classname
331 331
 	 * @param string $classname
332 332
 	 */
333
-	function set_classname( $classname ) {
333
+	function set_classname($classname) {
334 334
 		$this->_classname = $classname;
335 335
 	}
336 336
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	 * Sets the request data
341 341
 	 * @param array $request_data
342 342
 	 */
343
-	function set_request_data( $request_data ) {
343
+	function set_request_data($request_data) {
344 344
 		$this->_request_data = $request_data;
345 345
 	}
346 346
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	 * Sets the array of extra data we want to store on this request
351 351
 	 * @param array $extra_data
352 352
 	 */
353
-	function set_extra_data( $extra_data ) {
353
+	function set_extra_data($extra_data) {
354 354
 		$this->_extra_data = $extra_data;
355 355
 	}
356 356
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 	 * @return string
362 362
 	 */
363 363
 	function option_name() {
364
-		return JobParameters::wp_option_prefix . $this->job_id();
364
+		return JobParameters::wp_option_prefix.$this->job_id();
365 365
 	}
366 366
 
367 367
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	 *
381 381
 	 * @param string $status on eof JobParameters::valid_stati()
382 382
 	 */
383
-	public function set_status( $status ) {
383
+	public function set_status($status) {
384 384
 		$this->_status = $status;
385 385
 	}
386 386
 
Please login to merge, or discard this patch.
core/libraries/form_sections/base/EE_Form_Section_Base.form.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
 	 *	@type $name string the name for this form section, if you want to explicitly define it
96 96
 	 * }
97 97
 	 */
98
-	function __construct( $options_array = array() ) {
98
+	function __construct($options_array = array()) {
99 99
 		// used by display strategies
100 100
 		EE_Registry::instance()->load_helper('HTML');
101 101
 		// assign incoming values to properties
102
-		foreach( $options_array as $key => $value ) {
103
-			$key = '_' . $key;
104
-			if ( property_exists( $this, $key ) && empty( $this->{$key} )) {
102
+		foreach ($options_array as $key => $value) {
103
+			$key = '_'.$key;
104
+			if (property_exists($this, $key) && empty($this->{$key} )) {
105 105
 				$this->{$key} = $value;
106 106
 			}
107 107
 		}
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @param $parent_form_section
114 114
 	 * @param $name
115 115
 	 */
116
-	protected function _construct_finalize( $parent_form_section, $name ){
116
+	protected function _construct_finalize($parent_form_section, $name) {
117 117
 		$this->_construction_finalized = TRUE;
118 118
 		$this->_parent_section = $parent_form_section;
119 119
 		$this->_name = $name;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	/**
135 135
 	 * @param string $action
136 136
 	 */
137
-	public function set_action( $action ) {
137
+	public function set_action($action) {
138 138
 		$this->_action = $action;
139 139
 	}
140 140
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @return string
145 145
 	 */
146 146
 	public function method() {
147
-		return ! empty( $this->_method ) ? $this->_method : 'POST';
147
+		return ! empty($this->_method) ? $this->_method : 'POST';
148 148
 	}
149 149
 
150 150
 
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	/**
153 153
 	 * @param string $method
154 154
 	 */
155
-	public function set_method( $method ) {
156
-		switch ( $method ) {
155
+	public function set_method($method) {
156
+		switch ($method) {
157 157
 			case 'get' :
158 158
 			case 'GET' :
159 159
 				$this->_method = 'GET';
@@ -171,12 +171,12 @@  discard block
 block discarded – undo
171 171
 	 * Calculation involves using the name and the parent's html id
172 172
 	 * return void
173 173
 	 */
174
-	protected function _set_default_html_id_if_empty(){
175
-		if( ! $this->_html_id ){
176
-			if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper ){
177
-				$this->_html_id = $this->_parent_section->html_id() . '-' . $this->_prep_name_for_html_id( $this->name() );
178
-			}else{
179
-				$this->_html_id = $this->_prep_name_for_html_id( $this->name() );
174
+	protected function _set_default_html_id_if_empty() {
175
+		if ( ! $this->_html_id) {
176
+			if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) {
177
+				$this->_html_id = $this->_parent_section->html_id().'-'.$this->_prep_name_for_html_id($this->name());
178
+			} else {
179
+				$this->_html_id = $this->_prep_name_for_html_id($this->name());
180 180
 			}
181 181
 		}
182 182
 	}
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
 	 * @param $name
189 189
 	 * @return string
190 190
 	 */
191
-	private function _prep_name_for_html_id( $name ) {
192
-		return sanitize_key( str_replace( array( '&nbsp;', ' ', '_' ), '-', $name ));
191
+	private function _prep_name_for_html_id($name) {
192
+		return sanitize_key(str_replace(array('&nbsp;', ' ', '_'), '-', $name));
193 193
 	}
194 194
 
195 195
 
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 	 * @param bool $add_pound_sign
207 207
 	 * @return string
208 208
 	 */
209
-	public function html_id( $add_pound_sign = FALSE ){
210
-		return $add_pound_sign ? '#' . $this->_html_id : $this->_html_id;
209
+	public function html_id($add_pound_sign = FALSE) {
210
+		return $add_pound_sign ? '#'.$this->_html_id : $this->_html_id;
211 211
 	}
212 212
 
213 213
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	/**
216 216
 	 * @return string
217 217
 	 */
218
-	public function html_class(){
218
+	public function html_class() {
219 219
 		return $this->_html_class;
220 220
 	}
221 221
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	/**
225 225
 	 * @return string
226 226
 	 */
227
-	public function html_style(){
227
+	public function html_style() {
228 228
 		return $this->_html_style;
229 229
 	}
230 230
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	/**
234 234
 	 * @param mixed $html_class
235 235
 	 */
236
-	public function set_html_class( $html_class ) {
236
+	public function set_html_class($html_class) {
237 237
 		$this->_html_class = $html_class;
238 238
 	}
239 239
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	/**
243 243
 	 * @param mixed $html_id
244 244
 	 */
245
-	public function set_html_id( $html_id ) {
245
+	public function set_html_id($html_id) {
246 246
 		$this->_html_id = $html_id;
247 247
 	}
248 248
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	/**
252 252
 	 * @param mixed $html_style
253 253
 	 */
254
-	public function set_html_style( $html_style ) {
254
+	public function set_html_style($html_style) {
255 255
 		$this->_html_style = $html_style;
256 256
 	}
257 257
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	/**
261 261
 	 * @param string $other_html_attributes
262 262
 	 */
263
-	public function set_other_html_attributes( $other_html_attributes ) {
263
+	public function set_other_html_attributes($other_html_attributes) {
264 264
 		$this->_other_html_attributes = $other_html_attributes;
265 265
 	}
266 266
 
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 	 * @throws EE_Error
281 281
 	 * @return string
282 282
 	 */
283
-	function name(){
284
-		if( ! $this->_construction_finalized ){
285
-			throw new EE_Error(sprintf( __( 'You cannot use the form section\s name until _construct_finalize has been called on it (when we set the name). It was called on a form section of type \'s\'', 'event_espresso' ), get_class($this) ) );
283
+	function name() {
284
+		if ( ! $this->_construction_finalized) {
285
+			throw new EE_Error(sprintf(__('You cannot use the form section\s name until _construct_finalize has been called on it (when we set the name). It was called on a form section of type \'s\'', 'event_espresso'), get_class($this)));
286 286
 		}
287 287
 		return $this->_name;
288 288
 	}
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 	 * Gets the parent section
294 294
 	 * @return EE_Form_Section_Proper
295 295
 	 */
296
-	function parent_section(){
296
+	function parent_section() {
297 297
 		return $this->_parent_section;
298 298
 	}
299 299
 
@@ -306,18 +306,18 @@  discard block
 block discarded – undo
306 306
 	 * @param string $other_attributes anything else added to the form open tag, MUST BE VALID HTML
307 307
 	 * @return string
308 308
 	 */
309
-	public function form_open( $action = '', $method = '', $other_attributes = '' ) {
310
-		if ( ! empty( $action )) {
311
-			$this->set_action( $action );
309
+	public function form_open($action = '', $method = '', $other_attributes = '') {
310
+		if ( ! empty($action)) {
311
+			$this->set_action($action);
312 312
 		}
313
-		if ( ! empty( $method )) {
314
-			$this->set_method( $method );
313
+		if ( ! empty($method)) {
314
+			$this->set_method($method);
315 315
 		}
316
-		$html = EEH_HTML::nl( 1, 'form' ) . '<form';
317
-		$html .= $this->html_id() !== '' ? ' id="' . $this->html_id() . '"' : '';
318
-		$html .= ' action="' . $this->action() . '"';
319
-		$html .= ' method="' . $this->method() . '"';
320
-		$html .= $other_attributes . '>';
316
+		$html = EEH_HTML::nl(1, 'form').'<form';
317
+		$html .= $this->html_id() !== '' ? ' id="'.$this->html_id().'"' : '';
318
+		$html .= ' action="'.$this->action().'"';
319
+		$html .= ' method="'.$this->method().'"';
320
+		$html .= $other_attributes.'>';
321 321
 		return $html;
322 322
 	}
323 323
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	 * @return string
329 329
 	 */
330 330
 	public function form_close() {
331
-		return EEH_HTML::nl( -1, 'form' ) . '</form>' . EEH_HTML::nl() . '<!-- end of ee-' . $this->html_id() . '-form -->' . EEH_HTML::nl();
331
+		return EEH_HTML::nl( -1, 'form' ).'</form>'.EEH_HTML::nl().'<!-- end of ee-'.$this->html_id().'-form -->'.EEH_HTML::nl();
332 332
 	}
333 333
 
334 334
 
Please login to merge, or discard this patch.
core/libraries/form_sections/base/EE_Form_Section_Proper.form.php 1 patch
Spacing   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * before the hook wp_enqueue_scripts is called (so that the form section can enqueue its needed scripts).
8 8
  * However, you may output the form (usually by calling get_html_and_js) anywhere you like.
9 9
  */
10
-class EE_Form_Section_Proper extends EE_Form_Section_Validatable{
10
+class EE_Form_Section_Proper extends EE_Form_Section_Validatable {
11 11
 
12 12
 	/**
13 13
 	 * Subsections
@@ -68,38 +68,38 @@  discard block
 block discarded – undo
68 68
 	 * } @see EE_Form_Section_Validatable::__construct()
69 69
 	 *
70 70
 	 */
71
-	public function __construct( $options_array = array() ){
71
+	public function __construct($options_array = array()) {
72 72
 		EE_Registry::instance()->load_helper('Formatter');
73
-		$options_array = apply_filters( 'FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this );
73
+		$options_array = apply_filters('FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this);
74 74
 		//call parent first, as it may be setting the name
75 75
 		parent::__construct($options_array);
76 76
 		//if they've included subsections in the constructor, add them now
77
-		if( isset( $options_array['include'] )){
77
+		if (isset($options_array['include'])) {
78 78
 			//we are going to make sure we ONLY have those subsections to include
79 79
 			//AND we are going to make sure they're in that specified order
80 80
 			$reordered_subsections = array();
81
-			foreach($options_array['include'] as $input_name){
82
-				if(isset($this->_subsections[$input_name])){
81
+			foreach ($options_array['include'] as $input_name) {
82
+				if (isset($this->_subsections[$input_name])) {
83 83
 					$reordered_subsections[$input_name] = $this->_subsections[$input_name];
84 84
 				}
85 85
 			}
86 86
 			$this->_subsections = $reordered_subsections;
87 87
 		}
88
-		if(isset($options_array['exclude'])){
88
+		if (isset($options_array['exclude'])) {
89 89
 			$exclude = $options_array['exclude'];
90 90
 			$this->_subsections = array_diff_key($this->_subsections, array_flip($exclude));
91 91
 		}
92
-		if(isset($options_array['layout_strategy'])){
92
+		if (isset($options_array['layout_strategy'])) {
93 93
 			$this->_layout_strategy = $options_array['layout_strategy'];
94 94
 		}
95
-		if( ! $this->_layout_strategy){
95
+		if ( ! $this->_layout_strategy) {
96 96
 			$this->_layout_strategy = new EE_Two_Column_Layout();
97 97
 		}
98 98
 		$this->_layout_strategy->_construct_finalize($this);
99 99
 
100
-		add_action( 'wp_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
101
-		add_action( 'admin_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
102
-		add_action( 'wp_footer', array( $this, 'ensure_scripts_localized' ), 1 );
100
+		add_action('wp_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
101
+		add_action('admin_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
102
+		add_action('wp_footer', array($this, 'ensure_scripts_localized'), 1);
103 103
 	}
104 104
 
105 105
 
@@ -111,25 +111,25 @@  discard block
 block discarded – undo
111 111
 	 * @param string                 $name
112 112
 	 * @throws \EE_Error
113 113
 	 */
114
-	public function _construct_finalize( $parent_form_section, $name ) {
114
+	public function _construct_finalize($parent_form_section, $name) {
115 115
 		parent::_construct_finalize($parent_form_section, $name);
116 116
 		$this->_set_default_name_if_empty();
117 117
 		$this->_set_default_html_id_if_empty();
118
-		foreach( $this->_subsections as $subsection_name => $subsection ){
119
-			if ( $subsection instanceof EE_Form_Section_Base ) {
120
-				$subsection->_construct_finalize( $this, $subsection_name );
118
+		foreach ($this->_subsections as $subsection_name => $subsection) {
119
+			if ($subsection instanceof EE_Form_Section_Base) {
120
+				$subsection->_construct_finalize($this, $subsection_name);
121 121
 			} else {
122 122
 				throw new EE_Error(
123 123
 					sprintf(
124
-						__( 'Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso' ),
124
+						__('Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso'),
125 125
 						$subsection_name,
126 126
 						get_class($this),
127
-						$subsection ? get_class($subsection) : __( 'NULL', 'event_espresso' )
127
+						$subsection ? get_class($subsection) : __('NULL', 'event_espresso')
128 128
 					)
129 129
 				);
130 130
 			}
131 131
 		}
132
-		do_action( 'AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name );
132
+		do_action('AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name);
133 133
 	}
134 134
 
135 135
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * Gets the layout strategy for this form section
139 139
 	 * @return EE_Form_Section_Layout_Base
140 140
 	 */
141
-	public function get_layout_strategy(){
141
+	public function get_layout_strategy() {
142 142
 		return $this->_layout_strategy;
143 143
 	}
144 144
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 * @param EE_Form_Input_Base $input
151 151
 	 * @return string
152 152
 	 */
153
-	public function get_html_for_input($input){
153
+	public function get_html_for_input($input) {
154 154
 		return $this->_layout_strategy->layout_input($input);
155 155
 	}
156 156
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @param null $form_data
164 164
 	 * @return boolean
165 165
 	 */
166
-	public function was_submitted($form_data = NULL){
166
+	public function was_submitted($form_data = NULL) {
167 167
 		return $this->form_data_present_in($form_data);
168 168
 	}
169 169
 
@@ -184,16 +184,16 @@  discard block
 block discarded – undo
184 184
 	 * to skip this step.
185 185
 	 * @return void
186 186
 	 */
187
-	public function receive_form_submission($req_data = NULL, $validate = TRUE){
188
-		$req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate );
189
-		if( $req_data === NULL){
187
+	public function receive_form_submission($req_data = NULL, $validate = TRUE) {
188
+		$req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate);
189
+		if ($req_data === NULL) {
190 190
 			$req_data = $_REQUEST;
191 191
 		}
192 192
 		$this->_normalize($req_data);
193
-		if( $validate ){
193
+		if ($validate) {
194 194
 			$this->_validate();
195 195
 		}
196
-		do_action( 'AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate );
196
+		do_action('AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate);
197 197
 	}
198 198
 
199 199
 
@@ -206,12 +206,12 @@  discard block
 block discarded – undo
206 206
 	 * the value being an array formatted in teh same way
207 207
 	 * @param array $default_data
208 208
 	 */
209
-	public function populate_defaults($default_data){
210
-		foreach($this->subsections() as $subsection_name => $subsection){
211
-			if(isset($default_data[$subsection_name])){
212
-				if($subsection instanceof EE_Form_Input_Base){
209
+	public function populate_defaults($default_data) {
210
+		foreach ($this->subsections() as $subsection_name => $subsection) {
211
+			if (isset($default_data[$subsection_name])) {
212
+				if ($subsection instanceof EE_Form_Input_Base) {
213 213
 					$subsection->set_default($default_data[$subsection_name]);
214
-				}elseif($subsection instanceof EE_Form_Section_Proper){
214
+				}elseif ($subsection instanceof EE_Form_Section_Proper) {
215 215
 					$subsection->populate_defaults($default_data[$subsection_name]);
216 216
 				}
217 217
 			}
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
 	 * (realizing that the subsections' html names might not be set yet, etc.)
230 230
 	 * @return EE_Form_Section_Base
231 231
 	 */
232
-	public function get_subsection($name, $require_construction_to_be_finalized = TRUE ){
233
-		if( $require_construction_to_be_finalized ){
232
+	public function get_subsection($name, $require_construction_to_be_finalized = TRUE) {
233
+		if ($require_construction_to_be_finalized) {
234 234
 			$this->ensure_construct_finalized_called();
235 235
 		}
236 236
 		return isset($this->_subsections[$name]) ? $this->_subsections[$name] : NULL;
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 	 * Gets all the validatable subsections of this form section
243 243
 	 * @return EE_Form_Section_Validatable[]
244 244
 	 */
245
-	public function get_validatable_subsections(){
245
+	public function get_validatable_subsections() {
246 246
 		$validatable_subsections = array();
247
-		foreach($this->subsections() as $name=>$obj){
248
-			if($obj instanceof EE_Form_Section_Validatable){
247
+		foreach ($this->subsections() as $name=>$obj) {
248
+			if ($obj instanceof EE_Form_Section_Validatable) {
249 249
 				$validatable_subsections[$name] = $obj;
250 250
 			}
251 251
 		}
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 	 * @return EE_Form_Input_Base
266 266
 	 * @throws EE_Error
267 267
 	 */
268
-	public function get_input($name, $require_construction_to_be_finalized = TRUE ){
268
+	public function get_input($name, $require_construction_to_be_finalized = TRUE) {
269 269
 		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
270
-		if( ! $subsection instanceof EE_Form_Input_Base){
271
-			throw new EE_Error(sprintf(__("Subsection '%s' is not an instanceof EE_Form_Input_Base on form '%s'. It is a '%s'", 'event_espresso'),$name, get_class($this),$subsection ? get_class($subsection) : __("NULL", 'event_espresso')));
270
+		if ( ! $subsection instanceof EE_Form_Input_Base) {
271
+			throw new EE_Error(sprintf(__("Subsection '%s' is not an instanceof EE_Form_Input_Base on form '%s'. It is a '%s'", 'event_espresso'), $name, get_class($this), $subsection ? get_class($subsection) : __("NULL", 'event_espresso')));
272 272
 		}
273 273
 		return $subsection;
274 274
 	}
@@ -286,10 +286,10 @@  discard block
 block discarded – undo
286 286
 	 * @return EE_Form_Section_Proper
287 287
 	 * @throws EE_Error
288 288
 	 */
289
-	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE ){
290
-		$subsection = $this->get_subsection( $name, $require_construction_to_be_finalized );
291
-		if( ! $subsection instanceof EE_Form_Section_Proper){
292
-			throw new EE_Error(sprintf(__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'),$name, get_class($this)));
289
+	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE) {
290
+		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
291
+		if ( ! $subsection instanceof EE_Form_Section_Proper) {
292
+			throw new EE_Error(sprintf(__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'), $name, get_class($this)));
293 293
 		}
294 294
 		return $subsection;
295 295
 	}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	 * @param string $name
303 303
 	 * @return mixed depending on the input's type and its normalization strategy
304 304
 	 */
305
-	public function get_input_value($name){
305
+	public function get_input_value($name) {
306 306
 		$input = $this->get_input($name);
307 307
 		return $input->normalized_value();
308 308
 	}
@@ -315,16 +315,16 @@  discard block
 block discarded – undo
315 315
 	 * @return boolean
316 316
 	 */
317 317
 	public function is_valid() {
318
-		if( ! $this->has_received_submission()){
318
+		if ( ! $this->has_received_submission()) {
319 319
 			throw new EE_Error(sprintf(__("You cannot check if a form is valid before receiving the form submission using receive_form_submission", "event_espresso")));
320 320
 		}
321
-		if( ! parent::is_valid()){
321
+		if ( ! parent::is_valid()) {
322 322
 			return false;
323 323
 		}
324 324
 		//ok so no errors general to this entire form section. so let's check the subsections
325
-		foreach( $this->get_validatable_subsections() as $subsection ){
326
-			if( ! $subsection->is_valid() || $subsection->get_validation_error_string() != '' ){
327
-				$this->set_submission_error_message( $subsection->get_validation_error_string() );
325
+		foreach ($this->get_validatable_subsections() as $subsection) {
326
+			if ( ! $subsection->is_valid() || $subsection->get_validation_error_string() != '') {
327
+				$this->set_submission_error_message($subsection->get_validation_error_string());
328 328
 				return false;
329 329
 			}
330 330
 		}
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 	 * gets teh default name of this form section if none is specified
338 338
 	 * @return string
339 339
 	 */
340
-	protected function _set_default_name_if_empty(){
341
-		if( ! $this->_name ){
340
+	protected function _set_default_name_if_empty() {
341
+		if ( ! $this->_name) {
342 342
 			$classname = get_class($this);
343 343
 			$default_name = str_replace("EE_", "", $classname);
344
-			$this->_name =  $default_name;
344
+			$this->_name = $default_name;
345 345
 		}
346 346
 	}
347 347
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	 * Also returns the HTML for the form, except for the form opening and closing tags
353 353
 	 * (as the form section doesn't know where you necessarily want to send the information to), and except for a submit button.
354 354
 	 */
355
-	public function get_html_and_js(){
355
+	public function get_html_and_js() {
356 356
 		$this->enqueue_js();
357 357
 		return $this->get_html();
358 358
 	}
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	 * returns HTML for displaying this form section. recursively calls display_section() on all subsections
364 364
 	 * @return string
365 365
 	 */
366
-	public function get_html(){
366
+	public function get_html() {
367 367
 		$this->ensure_construct_finalized_called();
368 368
 		return $this->_layout_strategy->layout_form();
369 369
 	}
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	 * enqueues JS for the form
375 375
 	 * @return string
376 376
 	 */
377
-	public function enqueue_js(){
377
+	public function enqueue_js() {
378 378
 		$this->_enqueue_and_localize_form_js();
379 379
 	}
380 380
 
@@ -390,11 +390,11 @@  discard block
 block discarded – undo
390 390
 	 * @param boolean $init_form_validation_automatically whether or not we want the form validation to be triggered automatically or not
391 391
 	 * @return void
392 392
 	 */
393
-	public static function wp_enqueue_scripts( $init_form_validation_automatically = false ){
394
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
395
-		wp_register_script( 'ee_form_section_validation', EE_GLOBAL_ASSETS_URL . 'scripts' . DS . 'form_section_validation.js', array( 'jquery-validate', 'jquery-ui-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE );
393
+	public static function wp_enqueue_scripts($init_form_validation_automatically = false) {
394
+		add_filter('FHEE_load_jquery_validate', '__return_true');
395
+		wp_register_script('ee_form_section_validation', EE_GLOBAL_ASSETS_URL.'scripts'.DS.'form_section_validation.js', array('jquery-validate', 'jquery-ui-datepicker'), EVENT_ESPRESSO_VERSION, TRUE);
396 396
 		
397
-		wp_localize_script( 'ee_form_section_validation', 'ee_form_section_validation_init', array( 'init' => $init_form_validation_automatically ) );
397
+		wp_localize_script('ee_form_section_validation', 'ee_form_section_validation_init', array('init' => $init_form_validation_automatically));
398 398
 	}
399 399
 
400 400
 
@@ -404,14 +404,14 @@  discard block
 block discarded – undo
404 404
 	 * This needs to be called AFTER we've called $this->_enqueue_jquery_validate_script,
405 405
 	 * but before the wordpress hook wp_loaded
406 406
 	 */
407
-	public function _enqueue_and_localize_form_js(){
407
+	public function _enqueue_and_localize_form_js() {
408 408
 		$this->ensure_construct_finalized_called();
409 409
 		//actually, we don't want to localize just yet. There may be other forms on the page.
410 410
 		//so we need to add our form section data to a static variable accessible by all form sections
411 411
 		//and localize it just before the footer
412 412
 		$this->localize_validation_rules();
413
-		add_action( 'wp_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ), 2 );
414
-		add_action( 'admin_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ) );
413
+		add_action('wp_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'), 2);
414
+		add_action('admin_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'));
415 415
 	}
416 416
 
417 417
 
@@ -421,11 +421,11 @@  discard block
 block discarded – undo
421 421
 	 * @param bool $return_for_subsection
422 422
 	 * @return void
423 423
 	 */
424
-	public function localize_validation_rules( $return_for_subsection = FALSE ){
424
+	public function localize_validation_rules($return_for_subsection = FALSE) {
425 425
 		// we only want to localize vars ONCE for the entire form, so if the form section doesn't have a parent, then it must be the top dog
426
-		if ( ! $this->parent_section() || $return_for_subsection ) {
427
-			EE_Form_Section_Proper::$_js_localization['form_data'][ $this->html_id() ] = array(
428
-				'form_section_id'=> $this->html_id( TRUE ),
426
+		if ( ! $this->parent_section() || $return_for_subsection) {
427
+			EE_Form_Section_Proper::$_js_localization['form_data'][$this->html_id()] = array(
428
+				'form_section_id'=> $this->html_id(TRUE),
429 429
 				'validation_rules'=> $this->get_jquery_validation_rules(),
430 430
 				'errors'=> $this->subsection_validation_errors_by_html_name()
431 431
 			);
@@ -440,12 +440,12 @@  discard block
 block discarded – undo
440 440
 	 * Keys are their form names, and values are the inputs themselves
441 441
 	 * @return EE_Form_Input_Base
442 442
 	 */
443
-	public function inputs_in_subsections(){
443
+	public function inputs_in_subsections() {
444 444
 		$inputs = array();
445
-		foreach($this->subsections() as $subsection){
446
-			if( $subsection instanceof EE_Form_Input_Base ){
447
-				$inputs[ $subsection->html_name() ] = $subsection;
448
-			}elseif($subsection instanceof EE_Form_Section_Proper ){
445
+		foreach ($this->subsections() as $subsection) {
446
+			if ($subsection instanceof EE_Form_Input_Base) {
447
+				$inputs[$subsection->html_name()] = $subsection;
448
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
449 449
 				$inputs += $subsection->inputs_in_subsections();
450 450
 			}
451 451
 		}
@@ -458,12 +458,12 @@  discard block
 block discarded – undo
458 458
 	 * and values are a string of all their validation errors
459 459
 	 * @return string[]
460 460
 	 */
461
-	public function subsection_validation_errors_by_html_name(){
461
+	public function subsection_validation_errors_by_html_name() {
462 462
 		$inputs = $this->inputs();
463 463
 		$errors = array();
464
-		foreach( $inputs as $form_input ){
465
-			if ( $form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors() ){
466
-				$errors[ $form_input->html_name() ] = $form_input->get_validation_error_string();
464
+		foreach ($inputs as $form_input) {
465
+			if ($form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors()) {
466
+				$errors[$form_input->html_name()] = $form_input->get_validation_error_string();
467 467
 			}
468 468
 		}
469 469
 		return $errors;
@@ -475,12 +475,12 @@  discard block
 block discarded – undo
475 475
 	 * passes all the form data required by the JS to the JS, and enqueues the few required JS files.
476 476
 	 * Should be setup by each form during the _enqueues_and_localize_form_js
477 477
 	 */
478
-	public static function localize_script_for_all_forms(){
478
+	public static function localize_script_for_all_forms() {
479 479
 		//allow inputs and stuff to hook in their JS and stuff here
480 480
 		do_action('AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin');
481 481
 		EE_Form_Section_Proper::$_js_localization['localized_error_messages'] = EE_Form_Section_Proper::_get_localized_error_messages();
482
-		wp_enqueue_script( 'ee_form_section_validation' );
483
-		wp_localize_script( 'ee_form_section_validation', 'ee_form_section_vars', EE_Form_Section_Proper::$_js_localization );
482
+		wp_enqueue_script('ee_form_section_validation');
483
+		wp_localize_script('ee_form_section_validation', 'ee_form_section_vars', EE_Form_Section_Proper::$_js_localization);
484 484
 	}
485 485
 
486 486
 
@@ -488,8 +488,8 @@  discard block
 block discarded – undo
488 488
 	/**
489 489
 	 * ensure_scripts_localized
490 490
 	 */
491
-	public function ensure_scripts_localized(){
492
-		if ( ! EE_Form_Section_Proper::$_scripts_localized ) {
491
+	public function ensure_scripts_localized() {
492
+		if ( ! EE_Form_Section_Proper::$_scripts_localized) {
493 493
 			$this->_enqueue_and_localize_form_js();
494 494
 		}
495 495
 	}
@@ -501,10 +501,10 @@  discard block
 block discarded – undo
501 501
 	 * is that the key here should be the same as the custom validation rule put in the JS file
502 502
 	 * @return array keys are custom validation rules, and values are internationalized strings
503 503
 	 */
504
-	private static function _get_localized_error_messages(){
504
+	private static function _get_localized_error_messages() {
505 505
 		return array(
506 506
 			'validUrl'=>  __("This is not a valid absolute URL. Eg, http://domain.com/monkey.jpg", "event_espresso"),
507
-			'regex' => __( 'Please check your input', 'event_espresso' ),
507
+			'regex' => __('Please check your input', 'event_espresso'),
508 508
 		);
509 509
 	}
510 510
 
@@ -532,10 +532,10 @@  discard block
 block discarded – undo
532 532
 	 * Gets the JS to put inside the jquery validation rules for subsection of this form section. See parent function for more...
533 533
 	 * @return array
534 534
 	 */
535
-	function get_jquery_validation_rules(){
535
+	function get_jquery_validation_rules() {
536 536
 		$jquery_validation_rules = array();
537
-		foreach($this->get_validatable_subsections() as $subsection){
538
-			$jquery_validation_rules = array_merge( $jquery_validation_rules,  $subsection->get_jquery_validation_rules() );
537
+		foreach ($this->get_validatable_subsections() as $subsection) {
538
+			$jquery_validation_rules = array_merge($jquery_validation_rules, $subsection->get_jquery_validation_rules());
539 539
 		}
540 540
 		return $jquery_validation_rules;
541 541
 	}
@@ -550,11 +550,11 @@  discard block
 block discarded – undo
550 550
 	protected function _normalize($req_data) {
551 551
 		$this->_received_submission = TRUE;
552 552
 		$this->_validation_errors = array();
553
-		foreach($this->get_validatable_subsections() as $subsection){
554
-			try{
553
+		foreach ($this->get_validatable_subsections() as $subsection) {
554
+			try {
555 555
 				$subsection->_normalize($req_data);
556
-			}catch( EE_Validation_Error $e ){
557
-				$subsection->add_validation_error( $e );
556
+			} catch (EE_Validation_Error $e) {
557
+				$subsection->add_validation_error($e);
558 558
 			}
559 559
 		}
560 560
 	}
@@ -568,9 +568,9 @@  discard block
 block discarded – undo
568 568
 	 * calling parent::_validate() first.
569 569
 	 */
570 570
 	protected function _validate() {
571
-		foreach($this->get_validatable_subsections() as $subsection_name => $subsection){
572
-			if(method_exists($this,'_validate_'.$subsection_name)){
573
-				call_user_func_array(array($this,'_validate_'.$subsection_name), array($subsection));
571
+		foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) {
572
+			if (method_exists($this, '_validate_'.$subsection_name)) {
573
+				call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection));
574 574
 			}
575 575
 			$subsection->_validate();
576 576
 		}
@@ -582,13 +582,13 @@  discard block
 block discarded – undo
582 582
 	 * Gets all the validated inputs for the form section
583 583
 	 * @return array
584 584
 	 */
585
-	public function valid_data(){
585
+	public function valid_data() {
586 586
 		$inputs = array();
587
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
588
-			if ( $subsection instanceof EE_Form_Section_Proper ) {
589
-				$inputs[ $subsection_name ] = $subsection->valid_data();
590
-			} else if ( $subsection instanceof EE_Form_Input_Base ){
591
-				$inputs[ $subsection_name ] = $subsection->normalized_value();
587
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
588
+			if ($subsection instanceof EE_Form_Section_Proper) {
589
+				$inputs[$subsection_name] = $subsection->valid_data();
590
+			} else if ($subsection instanceof EE_Form_Input_Base) {
591
+				$inputs[$subsection_name] = $subsection->normalized_value();
592 592
 			}
593 593
 		}
594 594
 		return $inputs;
@@ -600,11 +600,11 @@  discard block
 block discarded – undo
600 600
 	 * Gets all the inputs on this form section
601 601
 	 * @return EE_Form_Input_Base[]
602 602
 	 */
603
-	public function inputs(){
603
+	public function inputs() {
604 604
 		$inputs = array();
605
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
606
-			if ( $subsection instanceof EE_Form_Input_Base ){
607
-				$inputs[ $subsection_name ] = $subsection;
605
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
606
+			if ($subsection instanceof EE_Form_Input_Base) {
607
+				$inputs[$subsection_name] = $subsection;
608 608
 			}
609 609
 		}
610 610
 		return $inputs;
@@ -616,10 +616,10 @@  discard block
 block discarded – undo
616 616
 	 * Gets all the subsections which are a proper form
617 617
 	 * @return EE_Form_Section_Proper[]
618 618
 	 */
619
-	public function subforms(){
619
+	public function subforms() {
620 620
 		$form_sections = array();
621
-		foreach($this->subsections() as $name=>$obj){
622
-			if($obj instanceof EE_Form_Section_Proper){
621
+		foreach ($this->subsections() as $name=>$obj) {
622
+			if ($obj instanceof EE_Form_Section_Proper) {
623 623
 				$form_sections[$name] = $obj;
624 624
 			}
625 625
 		}
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 	 * if you only want form inputs or proper form sections.
635 635
 	 * @return EE_Form_Section_Proper[]
636 636
 	 */
637
-	public function subsections(){
637
+	public function subsections() {
638 638
 		$this->ensure_construct_finalized_called();
639 639
 		return $this->_subsections;
640 640
 	}
@@ -652,8 +652,8 @@  discard block
 block discarded – undo
652 652
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
653 653
 	 * input's normalized value, or an array like the top-level array
654 654
 	 */
655
-	public function input_values( $include_subform_inputs = false, $flatten = false ){
656
-		return $this->_input_values( false, $include_subform_inputs, $flatten );
655
+	public function input_values($include_subform_inputs = false, $flatten = false) {
656
+		return $this->_input_values(false, $include_subform_inputs, $flatten);
657 657
 	}
658 658
 
659 659
 	/**
@@ -669,8 +669,8 @@  discard block
 block discarded – undo
669 669
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
670 670
 	 * input's normalized value, or an array like the top-level array
671 671
 	 */
672
-	public function input_pretty_values(  $include_subform_inputs = false, $flatten = false ){
673
-		return $this->_input_values( true, $include_subform_inputs, $flatten );
672
+	public function input_pretty_values($include_subform_inputs = false, $flatten = false) {
673
+		return $this->_input_values(true, $include_subform_inputs, $flatten);
674 674
 	}
675 675
 
676 676
 	/**
@@ -683,17 +683,17 @@  discard block
 block discarded – undo
683 683
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
684 684
 	 * input's normalized value, or an array like the top-level array
685 685
 	 */
686
-	public function _input_values( $pretty = false, $include_subform_inputs = false, $flatten = false ) {
686
+	public function _input_values($pretty = false, $include_subform_inputs = false, $flatten = false) {
687 687
 		$input_values = array();
688
-		foreach( $this->subsections() as $subsection_name => $subsection ) {
689
-			if( $subsection instanceof EE_Form_Input_Base ) {
690
-				$input_values[ $subsection_name ] = $pretty ? $subsection->pretty_value() : $subsection->normalized_value();
691
-			} else if( $subsection instanceof EE_Form_Section_Proper && $include_subform_inputs ) {
692
-				$subform_input_values = $subsection->_input_values( $pretty, $include_subform_inputs, $flatten );
693
-				if( $flatten ) {
694
-					$input_values = array_merge( $input_values, $subform_input_values );
688
+		foreach ($this->subsections() as $subsection_name => $subsection) {
689
+			if ($subsection instanceof EE_Form_Input_Base) {
690
+				$input_values[$subsection_name] = $pretty ? $subsection->pretty_value() : $subsection->normalized_value();
691
+			} else if ($subsection instanceof EE_Form_Section_Proper && $include_subform_inputs) {
692
+				$subform_input_values = $subsection->_input_values($pretty, $include_subform_inputs, $flatten);
693
+				if ($flatten) {
694
+					$input_values = array_merge($input_values, $subform_input_values);
695 695
 				} else {
696
-					$input_values[ $subsection_name ] = $subform_input_values;
696
+					$input_values[$subsection_name] = $subform_input_values;
697 697
 				}
698 698
 			}
699 699
 		}
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 	 * (ie, had receive_form_submission called on it yet)
708 708
 	 * @return boolean
709 709
 	 */
710
-	public function has_received_submission(){
710
+	public function has_received_submission() {
711 711
 		$this->ensure_construct_finalized_called();
712 712
 		return $this->_received_submission;
713 713
 	}
@@ -720,8 +720,8 @@  discard block
 block discarded – undo
720 720
 	 * @param array $inputs_to_exclude values are the input names
721 721
 	 * @return void
722 722
 	 */
723
-	public function exclude($inputs_to_exclude = array()){
724
-		foreach($inputs_to_exclude as $input_to_exclude_name){
723
+	public function exclude($inputs_to_exclude = array()) {
724
+		foreach ($inputs_to_exclude as $input_to_exclude_name) {
725 725
 			unset($this->_subsections[$input_to_exclude_name]);
726 726
 		}
727 727
 	}
@@ -731,8 +731,8 @@  discard block
 block discarded – undo
731 731
 	/**
732 732
 	 * @param array $inputs_to_hide
733 733
 	 */
734
-	public function hide($inputs_to_hide= array()){
735
-		foreach($inputs_to_hide as $input_to_hide){
734
+	public function hide($inputs_to_hide = array()) {
735
+		foreach ($inputs_to_hide as $input_to_hide) {
736 736
 			$input = $this->get_input($input_to_hide);
737 737
 
738 738
 			$input->set_display_strategy(new EE_Hidden_Display_Strategy());
@@ -757,13 +757,13 @@  discard block
 block discarded – undo
757 757
 	 * 																								or if $subsection_name_to_target is null, before or after entire subsections array
758 758
 	 * @return void
759 759
 	 */
760
-	public function add_subsections( $new_subsections, $subsection_name_to_target = NULL, $add_before = true ){
761
-		foreach($new_subsections as $subsection_name => $subsection){
762
-			if( ! $subsection instanceof EE_Form_Section_Base){
760
+	public function add_subsections($new_subsections, $subsection_name_to_target = NULL, $add_before = true) {
761
+		foreach ($new_subsections as $subsection_name => $subsection) {
762
+			if ( ! $subsection instanceof EE_Form_Section_Base) {
763 763
 				EE_Error::add_error(
764 764
 					sprintf(
765 765
 						__("Trying to add a %s as a subsection (it was named '%s') to the form section '%s'. It was removed.", "event_espresso"),
766
-						get_class( $subsection ),
766
+						get_class($subsection),
767 767
 						$subsection_name,
768 768
 						$this->name()
769 769
 					)
@@ -772,8 +772,8 @@  discard block
 block discarded – undo
772 772
 			}
773 773
 		}
774 774
 
775
-		EE_Registry::instance()->load_helper( 'Array' );
776
-		$this->_subsections = EEH_Array::insert_into_array( $this->_subsections, $new_subsections, $subsection_name_to_target, $add_before );
775
+		EE_Registry::instance()->load_helper('Array');
776
+		$this->_subsections = EEH_Array::insert_into_array($this->_subsections, $new_subsections, $subsection_name_to_target, $add_before);
777 777
 
778 778
 		/*$subsections_before = array();
779 779
 		if( $subsection_name_to_target ){
@@ -804,8 +804,8 @@  discard block
 block discarded – undo
804 804
 				$this->_subsections = $new_subsections;
805 805
 			}
806 806
 		}*/
807
-		if( $this->_construction_finalized ){
808
-			foreach($this->_subsections as $name => $subsection){
807
+		if ($this->_construction_finalized) {
808
+			foreach ($this->_subsections as $name => $subsection) {
809 809
 				$subsection->_construct_finalize($this, $name);
810 810
 			}
811 811
 		}
@@ -816,8 +816,8 @@  discard block
 block discarded – undo
816 816
 	/**
817 817
 	 * Just gets all validatable subsections to clean their sensitive data
818 818
 	 */
819
-	public function clean_sensitive_data(){
820
-		foreach($this->get_validatable_subsections() as $subsection){
819
+	public function clean_sensitive_data() {
820
+		foreach ($this->get_validatable_subsections() as $subsection) {
821 821
 			$subsection->clean_sensitive_data();
822 822
 		}
823 823
 	}
@@ -827,8 +827,8 @@  discard block
 block discarded – undo
827 827
 	/**
828 828
 	 * @param string $form_submission_error_message
829 829
 	 */
830
-	public function set_submission_error_message( $form_submission_error_message = '' ) {
831
-		$this->_form_submission_error_message .= ! empty( $form_submission_error_message ) ? $form_submission_error_message : __( 'Form submission failed due to errors', 'event_espresso' );
830
+	public function set_submission_error_message($form_submission_error_message = '') {
831
+		$this->_form_submission_error_message .= ! empty($form_submission_error_message) ? $form_submission_error_message : __('Form submission failed due to errors', 'event_espresso');
832 832
 	}
833 833
 
834 834
 
@@ -845,8 +845,8 @@  discard block
 block discarded – undo
845 845
 	/**
846 846
 	 * @param string $form_submission_success_message
847 847
 	 */
848
-	public function set_submission_success_message( $form_submission_success_message ) {
849
-		$this->_form_submission_success_message .= ! empty( $form_submission_success_message ) ? $form_submission_success_message : __( 'Form submitted successfully', 'event_espresso' );
848
+	public function set_submission_success_message($form_submission_success_message) {
849
+		$this->_form_submission_success_message .= ! empty($form_submission_success_message) ? $form_submission_success_message : __('Form submitted successfully', 'event_espresso');
850 850
 	}
851 851
 
852 852
 
@@ -868,10 +868,10 @@  discard block
 block discarded – undo
868 868
 	 * EE_Form_Input_Base::_set_default_html_name_if_empty
869 869
 	 * @return string
870 870
 	 */
871
-	public function html_name_prefix(){
872
-		if( $this->parent_section() instanceof EE_Form_Section_Proper ){
873
-			return $this->parent_section()->html_name_prefix() . '[' . $this->name() . ']';
874
-		}else{
871
+	public function html_name_prefix() {
872
+		if ($this->parent_section() instanceof EE_Form_Section_Proper) {
873
+			return $this->parent_section()->html_name_prefix().'['.$this->name().']';
874
+		} else {
875 875
 			return $this->name();
876 876
 		}
877 877
 	}
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 	 * was set, which is probably nothing, or the classname)
883 883
 	 * @return string
884 884
 	 */
885
-	public function name(){
885
+	public function name() {
886 886
 		$this->ensure_construct_finalized_called();
887 887
 		return parent::name();
888 888
 	}
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 	 *
892 892
 	 * @return EE_Form_Section_Proper
893 893
 	 */
894
-	public function parent_section(){
894
+	public function parent_section() {
895 895
 		$this->ensure_construct_finalized_called();
896 896
 		return parent::parent_section();
897 897
 	}
@@ -900,9 +900,9 @@  discard block
 block discarded – undo
900 900
 	 * make sure construction finalized was called, otherwise children might not be ready
901 901
 	 * @return void
902 902
 	 */
903
-	public function ensure_construct_finalized_called(){
904
-		if( ! $this->_construction_finalized ){
905
-			$this->_construct_finalize($this->_parent_section, $this->_name );
903
+	public function ensure_construct_finalized_called() {
904
+		if ( ! $this->_construction_finalized) {
905
+			$this->_construct_finalize($this->_parent_section, $this->_name);
906 906
 		}
907 907
 	}
908 908
 
@@ -914,17 +914,17 @@  discard block
 block discarded – undo
914 914
 	 * @param array $req_data
915 915
 	 * @return boolean
916 916
 	 */
917
-	public function form_data_present_in( $req_data = NULL ) {
918
-		if( $req_data === NULL){
917
+	public function form_data_present_in($req_data = NULL) {
918
+		if ($req_data === NULL) {
919 919
 			$req_data = $_POST;
920 920
 		}
921
-		foreach( $this->subsections() as $subsection ) {
922
-			if($subsection instanceof EE_Form_Input_Base ) {
923
-				if( $subsection->form_data_present_in( $req_data ) ) {
921
+		foreach ($this->subsections() as $subsection) {
922
+			if ($subsection instanceof EE_Form_Input_Base) {
923
+				if ($subsection->form_data_present_in($req_data)) {
924 924
 					return TRUE;
925 925
 				}
926
-			}elseif( $subsection instanceof EE_Form_Section_Proper ) {
927
-				if( $subsection->form_data_present_in( $req_data ) ) {
926
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
927
+				if ($subsection->form_data_present_in($req_data)) {
928 928
 					return TRUE;
929 929
 				}
930 930
 			}
@@ -941,14 +941,14 @@  discard block
 block discarded – undo
941 941
 	 */
942 942
 	public function get_validation_errors_accumulated() {
943 943
 		$validation_errors = $this->get_validation_errors();
944
-		foreach($this->get_validatable_subsections() as $subsection ) {
945
-			if( $subsection instanceof EE_Form_Section_Proper ) {
944
+		foreach ($this->get_validatable_subsections() as $subsection) {
945
+			if ($subsection instanceof EE_Form_Section_Proper) {
946 946
 				$validation_errors_on_this_subsection = $subsection->get_validation_errors_accumulated();
947 947
 			} else {
948
-				$validation_errors_on_this_subsection =  $subsection->get_validation_errors();
948
+				$validation_errors_on_this_subsection = $subsection->get_validation_errors();
949 949
 			}
950
-			if( $validation_errors_on_this_subsection ){
951
-				$validation_errors = array_merge( $validation_errors, $validation_errors_on_this_subsection );
950
+			if ($validation_errors_on_this_subsection) {
951
+				$validation_errors = array_merge($validation_errors, $validation_errors_on_this_subsection);
952 952
 			}
953 953
 		}
954 954
 		return $validation_errors;
Please login to merge, or discard this patch.
core/libraries/messages/EE_messenger.lib.php 2 patches
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	 * @return void
290 290
 	 */
291 291
 	public function enqueue_scripts_styles() {
292
-		do_action( 'AHEE__EE_messenger__enqueue_scripts_styles');
292
+		do_action('AHEE__EE_messenger__enqueue_scripts_styles');
293 293
 	}
294 294
 
295 295
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 
326 326
 		$this->_supports_labels->template_variation_description = __('These are different styles to choose from for the selected template structure.  Usually these affect things like font style, color, borders etc.  In some cases the styles will also make minor layout changes.');
327 327
 
328
-		$this->_supports_labels = apply_filters( 'FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this );
328
+		$this->_supports_labels = apply_filters('FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this);
329 329
 	}
330 330
 
331 331
 
@@ -340,10 +340,10 @@  discard block
 block discarded – undo
340 340
 	 * @return stdClass
341 341
 	 */
342 342
 	public function get_supports_labels() {
343
-		if ( empty( $this->_supports_labels->template_pack ) || empty( $this->_supports_labels->template_variation) ) {
343
+		if (empty($this->_supports_labels->template_pack) || empty($this->_supports_labels->template_variation)) {
344 344
 			$this->_set_supports_labels_defaults();
345 345
 		}
346
-		return apply_filters( 'FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this );
346
+		return apply_filters('FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this);
347 347
 	}
348 348
 
349 349
 
@@ -363,10 +363,10 @@  discard block
 block discarded – undo
363 363
 	 *
364 364
 	 * @return string                    path or url for the requested variation.
365 365
 	 */
366
-	public function get_variation( EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE ) {
366
+	public function get_variation(EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE) {
367 367
 		$this->_tmp_pack = $pack;
368
-		$variation_path = apply_filters( 'EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters );
369
-		$variation_path = empty( $variation_path ) ? $this->_tmp_pack->get_variation( $this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters ) : $variation_path;
368
+		$variation_path = apply_filters('EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters);
369
+		$variation_path = empty($variation_path) ? $this->_tmp_pack->get_variation($this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters) : $variation_path;
370 370
 		return $variation_path;
371 371
 
372 372
 	}
@@ -384,13 +384,13 @@  discard block
 block discarded – undo
384 384
 	 * @return array
385 385
 	 */
386 386
 	public function get_default_message_types() {
387
-		$class = get_class( $this );
387
+		$class = get_class($this);
388 388
 
389 389
 		//messenger specific filter
390
-		$default_types = apply_filters( 'FHEE__' . $class . '__get_default_message_types__default_types', $this->_default_message_types, $this );
390
+		$default_types = apply_filters('FHEE__'.$class.'__get_default_message_types__default_types', $this->_default_message_types, $this);
391 391
 
392 392
 		//all messengers filter
393
-		$default_types = apply_filters( 'FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this );
393
+		$default_types = apply_filters('FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this);
394 394
 		return $default_types;
395 395
 	}
396 396
 
@@ -405,14 +405,14 @@  discard block
 block discarded – undo
405 405
 	 * @return array
406 406
 	 */
407 407
 	public function get_valid_message_types() {
408
-		$class = get_class( $this );
408
+		$class = get_class($this);
409 409
 
410 410
 		//messenger specific filter
411 411
 		//messenger specific filter
412
-		$valid_types = apply_filters( 'FHEE__' . $class . '__get_valid_message_types__valid_types', $this->_valid_message_types, $this );
412
+		$valid_types = apply_filters('FHEE__'.$class.'__get_valid_message_types__valid_types', $this->_valid_message_types, $this);
413 413
 
414 414
 		//all messengers filter
415
-		$valid_types = apply_filters( 'FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this );
415
+		$valid_types = apply_filters('FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this);
416 416
 		return $valid_types;
417 417
 	}
418 418
 
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	 * @access public
427 427
 	 * @param array $new_config Whatever is put in here will reset the _validator_config property
428 428
 	 */
429
-	public function set_validator_config( $new_config ) {
429
+	public function set_validator_config($new_config) {
430 430
 		$this->_validator_config = $new_config;
431 431
 	}
432 432
 
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
 	public function get_validator_config() {
443 443
 		$class = get_class($this);
444 444
 
445
-		$config = apply_filters( 'FHEE__' . $class . '__get_validator_config', $this->_validator_config, $this );
446
-		$config = apply_filters( 'FHEE__EE_messenger__get_validator_config', $config, $this );
445
+		$config = apply_filters('FHEE__'.$class.'__get_validator_config', $this->_validator_config, $this);
446
+		$config = apply_filters('FHEE__EE_messenger__get_validator_config', $config, $this);
447 447
 		return $config;
448 448
 	}
449 449
 
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
 	 * @access public
461 461
 	 * @return string content for page
462 462
 	 */
463
-	public function get_messenger_admin_page_content( $page, $action = null, $extra = array(), $message_types = array() ) {
464
-		return $this->_get_admin_page_content( $page, $action, $extra, $message_types );
463
+	public function get_messenger_admin_page_content($page, $action = null, $extra = array(), $message_types = array()) {
464
+		return $this->_get_admin_page_content($page, $action, $extra, $message_types);
465 465
 	}
466 466
 
467 467
 
@@ -470,76 +470,76 @@  discard block
 block discarded – undo
470 470
 
471 471
 
472 472
 
473
-	protected function _get_admin_content_events_edit( $message_types, $extra ) {
473
+	protected function _get_admin_content_events_edit($message_types, $extra) {
474 474
 		//defaults
475 475
 		$template_args = array();
476 476
 		$custom_templates = array();
477 477
 		$selector_rows = '';
478 478
 
479 479
 		//we don't need message types here so we're just going to ignore. we do, however, expect the event id here. The event id is needed to provide a link to setup a custom template for this event.
480
-		$event_id = isset( $extra['event'] ) ? $extra['event'] : NULL;
480
+		$event_id = isset($extra['event']) ? $extra['event'] : NULL;
481 481
 
482
-		$template_wrapper_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_wrapper.template.php';
483
-		$template_row_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_row.template.php';
482
+		$template_wrapper_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_wrapper.template.php';
483
+		$template_row_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_row.template.php';
484 484
 
485 485
 		//array of template objects for global and custom (non-trashed) (but remember just for this messenger!)
486
-		$global_templates = EEM_Message_Template_Group::instance()->get_all( array( array('MTP_messenger' => $this->name, 'MTP_is_global' => TRUE, 'MTP_is_active' => TRUE ) ) );
487
-		$templates_for_event = EEM_Message_Template_Group::instance()->get_all_custom_templates_by_event( $event_id, array( 'MTP_messenger' => $this->name, 'MTP_is_active' => TRUE ) );
488
-		$templates_for_event = !empty( $templates_for_event ) ? $templates_for_event : array();
486
+		$global_templates = EEM_Message_Template_Group::instance()->get_all(array(array('MTP_messenger' => $this->name, 'MTP_is_global' => TRUE, 'MTP_is_active' => TRUE)));
487
+		$templates_for_event = EEM_Message_Template_Group::instance()->get_all_custom_templates_by_event($event_id, array('MTP_messenger' => $this->name, 'MTP_is_active' => TRUE));
488
+		$templates_for_event = ! empty($templates_for_event) ? $templates_for_event : array();
489 489
 
490 490
 		//so we need to setup the rows for the selectors and we use the global mtpgs (cause those will the active message template groups)
491
-		foreach ( $global_templates as $mtpgID => $mtpg ) {
491
+		foreach ($global_templates as $mtpgID => $mtpg) {
492 492
 			//verify this message type is supposed to show on this page
493 493
 			$mtp_obj = $mtpg->message_type_obj();
494
-			if ( ! $mtp_obj instanceof EE_message_type ) {
494
+			if ( ! $mtp_obj instanceof EE_message_type) {
495 495
 				continue;
496 496
 			}
497 497
 			$mtp_obj->admin_registered_pages = (array) $mtp_obj->admin_registered_pages;
498
-			if ( ! in_array( 'events_edit', $mtp_obj->admin_registered_pages ) )
498
+			if ( ! in_array('events_edit', $mtp_obj->admin_registered_pages))
499 499
 				continue;
500 500
 			$stargs = array();
501 501
 			$default_value = '';
502 502
 			$select_values = array();
503 503
 			$select_values[$mtpgID] = __('Global', 'event_espresso');
504
-			$default_value = array_key_exists( $mtpgID, $templates_for_event ) && ! $mtpg->get('MTP_is_override' ) ? $mtpgID : NULL;
504
+			$default_value = array_key_exists($mtpgID, $templates_for_event) && ! $mtpg->get('MTP_is_override') ? $mtpgID : NULL;
505 505
 
506 506
 			//if the override has been set for the global template, then that means even if there are custom templates already created we ignore them because of the set override.
507 507
 
508
-			if ( ! $mtpg->get('MTP_is_override' ) ) {
508
+			if ( ! $mtpg->get('MTP_is_override')) {
509 509
 				//any custom templates for this message type?
510
-				$custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt( $this->name, $mtpg->message_type() );
510
+				$custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt($this->name, $mtpg->message_type());
511 511
 
512
-				foreach( $custom_templates as $cmtpgID => $cmtpg ) {
512
+				foreach ($custom_templates as $cmtpgID => $cmtpg) {
513 513
 					$select_values[$cmtpgID] = $cmtpg->name();
514
-					$default_value = array_key_exists( $cmtpgID, $templates_for_event ) ? $cmtpgID : $default_value;
514
+					$default_value = array_key_exists($cmtpgID, $templates_for_event) ? $cmtpgID : $default_value;
515 515
 				}
516 516
 			}
517 517
 
518 518
 			//if there is no $default_value then we set it as the global
519
-			$default_value = empty( $default_value ) ? $mtpgID : $default_value;
519
+			$default_value = empty($default_value) ? $mtpgID : $default_value;
520 520
 
521
-			$edit_url = EEH_URL::add_query_args_and_nonce( array('page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value), admin_url('admin.php') );
522
-			$create_url = EEH_URL::add_query_args_and_nonce( array('page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value ), admin_url( 'admin.php' ) );
521
+			$edit_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value), admin_url('admin.php'));
522
+			$create_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value), admin_url('admin.php'));
523 523
 
524
-			$st_args['mt_name'] = ucwords( $mtp_obj->label['singular'] );
524
+			$st_args['mt_name'] = ucwords($mtp_obj->label['singular']);
525 525
 			$st_args['mt_slug'] = $mtpg->message_type();
526 526
 			$st_args['messenger_slug'] = $this->name;
527
-			$st_args['selector'] = EEH_Form_Fields::select_input( 'event_message_templates_relation[' . $mtpgID . ']', $select_values, $default_value, 'data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '"', 'message-template-selector' );
527
+			$st_args['selector'] = EEH_Form_Fields::select_input('event_message_templates_relation['.$mtpgID.']', $select_values, $default_value, 'data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'"', 'message-template-selector');
528 528
 
529 529
 			//note that  message template group that has override_all_custom set will remove the ability to set a custom message template based off of the global (and that also in turn overrides any other custom templates).
530
-			$st_args['create_button'] =  $mtpg->get('MTP_is_override') ? '' : '<a data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $create_url . '" class="button button-small create-mtpg-button">' . __('Create New Custom', 'event_espresso') . '</a>';
531
-			$st_args['create_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messsages_add_new_message_template' ) ? $st_args['create_button'] : '';
532
-			$st_args['edit_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID ) ?  '<a data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $edit_url . '" class="button button-small edit-mtpg-button">' . __('Edit', 'event_espresso') . '</a>' : '';
533
-			$selector_rows .= EEH_Template::display_template( $template_row_path, $st_args, TRUE );
530
+			$st_args['create_button'] = $mtpg->get('MTP_is_override') ? '' : '<a data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$create_url.'" class="button button-small create-mtpg-button">'.__('Create New Custom', 'event_espresso').'</a>';
531
+			$st_args['create_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messsages_add_new_message_template') ? $st_args['create_button'] : '';
532
+			$st_args['edit_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID) ? '<a data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$edit_url.'" class="button button-small edit-mtpg-button">'.__('Edit', 'event_espresso').'</a>' : '';
533
+			$selector_rows .= EEH_Template::display_template($template_row_path, $st_args, TRUE);
534 534
 		}
535 535
 
536 536
 		//if no selectors present then get out.
537
-		if ( empty( $selector_rows ) ) {
537
+		if (empty($selector_rows)) {
538 538
 			return '';
539 539
 		}
540 540
 
541 541
 		$template_args['selector_rows'] = $selector_rows;
542
-		return EEH_Template::display_template( $template_wrapper_path, $template_args, TRUE );
542
+		return EEH_Template::display_template($template_wrapper_path, $template_args, TRUE);
543 543
 	}
544 544
 
545 545
 
@@ -554,8 +554,8 @@  discard block
 block discarded – undo
554 554
 	 * @return array $this->_template_fields
555 555
 	 */
556 556
 	public function get_template_fields() {
557
-		$template_fields = apply_filters( 'FHEE__' . get_class($this) . '__get_template_fields', $this->_template_fields, $this );
558
-		$template_fields = apply_filters( 'FHEE__EE_messenger__get_template_fields', $template_fields, $this );
557
+		$template_fields = apply_filters('FHEE__'.get_class($this).'__get_template_fields', $this->_template_fields, $this);
558
+		$template_fields = apply_filters('FHEE__EE_messenger__get_template_fields', $template_fields, $this);
559 559
 		return $template_fields;
560 560
 	}
561 561
 
@@ -568,9 +568,9 @@  discard block
 block discarded – undo
568 568
 	 * The following method doesn't NEED to be used by child classes but might be modified by the specific messenger
569 569
 	 */
570 570
 	protected function _set_template_value($item, $value) {
571
-		if ( array_key_exists($item, $this->_template_fields) ) {
572
-			$prop = '_' . $item;
573
-			$this->{$prop}= $value;
571
+		if (array_key_exists($item, $this->_template_fields)) {
572
+			$prop = '_'.$item;
573
+			$this->{$prop} = $value;
574 574
 		}
575 575
 	}
576 576
 
@@ -580,8 +580,8 @@  discard block
 block discarded – undo
580 580
 	 * @param EE_message_type $message_type The message type object used in combination with this messenger to generate the provided message.
581 581
 	 * @return bool | WP_Error
582 582
 	 */
583
-	public function send_message( $message, EE_message_type $message_type ) {
584
-		$this->_validate_and_setup( $message );
583
+	public function send_message($message, EE_message_type $message_type) {
584
+		$this->_validate_and_setup($message);
585 585
 		$this->_incoming_message_type = $message_type;
586 586
 		return $this->_send_message();
587 587
 	}
@@ -595,28 +595,28 @@  discard block
 block discarded – undo
595 595
 	 * @param  bool   $send    true we will actually use the _send method (for test sends). FALSE we just return preview
596 596
 	 * @return string          return the message html content
597 597
 	 */
598
-	public function get_preview( $message, EE_message_type $message_type, $send = FALSE ) {
599
-		$this->_validate_and_setup( $message );
598
+	public function get_preview($message, EE_message_type $message_type, $send = FALSE) {
599
+		$this->_validate_and_setup($message);
600 600
 
601 601
 		$this->_incoming_message_type = $message_type;
602 602
 
603
-		if ( $send ) {
603
+		if ($send) {
604 604
 			//are we overriding any existing template fields?
605 605
 			$settings = $this->get_existing_test_settings();
606
-			if ( !empty( $settings ) ) {
607
-				foreach( $settings as $field => $value ) {
608
-					$this->_set_template_value( $field, $value );
606
+			if ( ! empty($settings)) {
607
+				foreach ($settings as $field => $value) {
608
+					$this->_set_template_value($field, $value);
609 609
 				}
610 610
 			}
611 611
 		}
612 612
 
613 613
 		//enqueue preview js so that any links/buttons on the page are disabled.
614
-		if ( ! $send ) {
614
+		if ( ! $send) {
615 615
 			// the below may seem like duplication.  However, typically if a messenger enqueues scripts/styles,
616 616
 			// it deregisters all existing wp scripts and styles first.  So the second hook ensures our previewer still gets setup.
617
-			add_action( 'admin_enqueue_scripts', array( $this, 'add_preview_script' ), 10 );
618
-			add_action( 'wp_enqueue_scripts', array( $this, 'add_preview_script' ), 10 );
619
-			add_action( 'AHEE__EE_messenger__enqueue_scripts_styles', array( $this, 'add_preview_script' ), 10 );
617
+			add_action('admin_enqueue_scripts', array($this, 'add_preview_script'), 10);
618
+			add_action('wp_enqueue_scripts', array($this, 'add_preview_script'), 10);
619
+			add_action('AHEE__EE_messenger__enqueue_scripts_styles', array($this, 'add_preview_script'), 10);
620 620
 		}
621 621
 
622 622
 		return $send ? $this->_send_message() : $this->_preview();
@@ -634,10 +634,10 @@  discard block
 block discarded – undo
634 634
 	 */
635 635
 	public function add_preview_script() {
636 636
 		//error message
637
-		EE_Registry::$i18n_js_strings[ 'links_disabled' ] = __( 'All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup.  To test generated links, you must trigger an actual message notification.', 'event_espresso' );
638
-		wp_register_script( 'ee-messages-preview-js', EE_LIBRARIES_URL . 'messages/messenger/assets/js/ee-messages-preview.js', array( 'jquery' ), EVENT_ESPRESSO_VERSION, true );
639
-		wp_localize_script( 'ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings );
640
-		wp_enqueue_script( 'ee-messages-preview-js' );
637
+		EE_Registry::$i18n_js_strings['links_disabled'] = __('All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup.  To test generated links, you must trigger an actual message notification.', 'event_espresso');
638
+		wp_register_script('ee-messages-preview-js', EE_LIBRARIES_URL.'messages/messenger/assets/js/ee-messages-preview.js', array('jquery'), EVENT_ESPRESSO_VERSION, true);
639
+		wp_localize_script('ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings);
640
+		wp_enqueue_script('ee-messages-preview-js');
641 641
 	}
642 642
 
643 643
 
@@ -647,23 +647,23 @@  discard block
 block discarded – undo
647 647
 	 * @param  object $message message object
648 648
 	 * @throws \EE_Error
649 649
 	 */
650
-	protected function _validate_and_setup( $message ) {
651
-		if ( !is_object( $message ) )
652
-			throw new EE_Error( __('Incoming "$message" must be an object', 'event_espresso' ) );
650
+	protected function _validate_and_setup($message) {
651
+		if ( ! is_object($message))
652
+			throw new EE_Error(__('Incoming "$message" must be an object', 'event_espresso'));
653 653
 
654 654
 		//verify we have the required template pack value on the $message object.
655
-		if ( empty( $message->template_pack ) || ! $message->template_pack instanceof EE_Messages_Template_Pack ) {
656
-			throw new EE_Error( __('Incoming $message object must have a EE_Messages_Template_Pack object assigned to the template_pack property', 'event_espresso' ) );
655
+		if (empty($message->template_pack) || ! $message->template_pack instanceof EE_Messages_Template_Pack) {
656
+			throw new EE_Error(__('Incoming $message object must have a EE_Messages_Template_Pack object assigned to the template_pack property', 'event_espresso'));
657 657
 		}
658 658
 
659 659
 		$this->_tmp_pack = $message->template_pack;
660 660
 
661
-		$this->_variation = !empty ( $message->variation ) ? $message->variation : 'default';
661
+		$this->_variation = ! empty ($message->variation) ? $message->variation : 'default';
662 662
 
663 663
 		$template_fields = $this->get_template_fields();
664 664
 
665
-		foreach ( $template_fields as $template => $value ) {
666
-			if ( $template !== 'extra' )
665
+		foreach ($template_fields as $template => $value) {
666
+			if ($template !== 'extra')
667 667
 				$this->_set_template_value($template, $message->{$template});
668 668
 		}
669 669
 	}
@@ -678,21 +678,21 @@  discard block
 block discarded – undo
678 678
 	 * @return string
679 679
 	 * @throws \EE_Error
680 680
 	 */
681
-	protected function _get_main_template( $preview = FALSE ) {
681
+	protected function _get_main_template($preview = FALSE) {
682 682
 		$type = $preview ? 'preview' : 'main';
683 683
 
684
-		$wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, $type );
684
+		$wrapper_template = $this->_tmp_pack->get_wrapper($this->name, $type);
685 685
 
686 686
 		//check file exists and is readable
687
-		if ( !is_readable( $wrapper_template ) )
688
-			throw new EE_Error( sprintf( __('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso' ), ucwords($this->label['singular']) , $wrapper_template ) );
687
+		if ( ! is_readable($wrapper_template))
688
+			throw new EE_Error(sprintf(__('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso'), ucwords($this->label['singular']), $wrapper_template));
689 689
 
690 690
 		//add message type to template args
691 691
 		$this->_template_args['message_type'] = $this->_incoming_message_type;
692 692
 
693 693
 		//require template helper
694
-		EE_Registry::instance()->load_helper( 'Template' );
695
-		return EEH_Template::display_template( $wrapper_template, $this->_template_args, TRUE );
694
+		EE_Registry::instance()->load_helper('Template');
695
+		return EEH_Template::display_template($wrapper_template, $this->_template_args, TRUE);
696 696
 	}
697 697
 
698 698
 
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 	 */
729 729
 	public function get_existing_test_settings() {
730 730
 		$settings = EEH_MSG_Template::get_active_messengers_in_db();
731
-		return isset( $settings[$this->name]['test_settings'] ) ? $settings[$this->name]['test_settings'] : array();
731
+		return isset($settings[$this->name]['test_settings']) ? $settings[$this->name]['test_settings'] : array();
732 732
 	}
733 733
 
734 734
 
@@ -739,10 +739,10 @@  discard block
 block discarded – undo
739 739
 	 * @access public
740 740
 	 * @return bool 	success/fail
741 741
 	 */
742
-	public function set_existing_test_settings( $settings ) {
742
+	public function set_existing_test_settings($settings) {
743 743
 		$existing = EEH_MSG_Template::get_active_messengers_in_db();
744 744
 		$existing[$this->name]['test_settings'] = $settings;
745
-		return EEH_MSG_Template::update_active_messengers_in_db( $existing );
745
+		return EEH_MSG_Template::update_active_messengers_in_db($existing);
746 746
 	}
747 747
 
748 748
 
@@ -755,21 +755,21 @@  discard block
 block discarded – undo
755 755
 	 * @param string $field The field to retrieve the label for
756 756
 	 * @return string        	  The label
757 757
 	 */
758
-	public function get_field_label( $field ) {
758
+	public function get_field_label($field) {
759 759
 		//first let's see if the field requests is in the top level array.
760
-		if ( isset( $this->_template_fields[$field] ) && !empty( $this->_template_fields[$field]['label'] ) )
760
+		if (isset($this->_template_fields[$field]) && ! empty($this->_template_fields[$field]['label']))
761 761
 			return $this->_template[$field]['label'];
762 762
 
763 763
 		//nope so let's look in the extra array to see if it's there HOWEVER if the field exists as a top level index in the extra array then we know the label is in the 'main' index.
764
-		if ( isset( $this->_template_fields['extra'] ) && !empty( $this->_template_fields['extra'][$field] ) && !empty( $this->_template_fields['extra'][$field]['main']['label'] )  )
764
+		if (isset($this->_template_fields['extra']) && ! empty($this->_template_fields['extra'][$field]) && ! empty($this->_template_fields['extra'][$field]['main']['label']))
765 765
 			return $this->_template_fields['extra'][$field]['main']['label'];
766 766
 
767 767
 		//now it's possible this field may just be existing in any of the extra array items.
768
-		if ( !empty( $this->_template_fields['extra'] ) && is_array( $this->_template_fields['extra'] ) ) {
769
-			foreach ( $this->_template_fields['extra'] as $main_field => $subfields ) {
770
-				if ( !is_array( $subfields ) )
768
+		if ( ! empty($this->_template_fields['extra']) && is_array($this->_template_fields['extra'])) {
769
+			foreach ($this->_template_fields['extra'] as $main_field => $subfields) {
770
+				if ( ! is_array($subfields))
771 771
 					continue;
772
-				if ( isset( $subfields[$field] ) && !empty( $subfields[$field]['label'] ) )
772
+				if (isset($subfields[$field]) && ! empty($subfields[$field]['label']))
773 773
 					return $subfields[$field]['label'];
774 774
 			}
775 775
 		}
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
 	 *
791 791
 	 * @return void
792 792
 	 */
793
-	public function do_secondary_messenger_hooks( $sending_messenger_name ) {
793
+	public function do_secondary_messenger_hooks($sending_messenger_name) {
794 794
 		return;
795 795
 	}
796 796
 
Please login to merge, or discard this patch.
Braces   +26 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -495,8 +496,9 @@  discard block
 block discarded – undo
495 496
 				continue;
496 497
 			}
497 498
 			$mtp_obj->admin_registered_pages = (array) $mtp_obj->admin_registered_pages;
498
-			if ( ! in_array( 'events_edit', $mtp_obj->admin_registered_pages ) )
499
-				continue;
499
+			if ( ! in_array( 'events_edit', $mtp_obj->admin_registered_pages ) ) {
500
+							continue;
501
+			}
500 502
 			$stargs = array();
501 503
 			$default_value = '';
502 504
 			$select_values = array();
@@ -648,8 +650,9 @@  discard block
 block discarded – undo
648 650
 	 * @throws \EE_Error
649 651
 	 */
650 652
 	protected function _validate_and_setup( $message ) {
651
-		if ( !is_object( $message ) )
652
-			throw new EE_Error( __('Incoming "$message" must be an object', 'event_espresso' ) );
653
+		if ( !is_object( $message ) ) {
654
+					throw new EE_Error( __('Incoming "$message" must be an object', 'event_espresso' ) );
655
+		}
653 656
 
654 657
 		//verify we have the required template pack value on the $message object.
655 658
 		if ( empty( $message->template_pack ) || ! $message->template_pack instanceof EE_Messages_Template_Pack ) {
@@ -663,8 +666,9 @@  discard block
 block discarded – undo
663 666
 		$template_fields = $this->get_template_fields();
664 667
 
665 668
 		foreach ( $template_fields as $template => $value ) {
666
-			if ( $template !== 'extra' )
667
-				$this->_set_template_value($template, $message->{$template});
669
+			if ( $template !== 'extra' ) {
670
+							$this->_set_template_value($template, $message->{$template});
671
+			}
668 672
 		}
669 673
 	}
670 674
 
@@ -684,8 +688,9 @@  discard block
 block discarded – undo
684 688
 		$wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, $type );
685 689
 
686 690
 		//check file exists and is readable
687
-		if ( !is_readable( $wrapper_template ) )
688
-			throw new EE_Error( sprintf( __('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso' ), ucwords($this->label['singular']) , $wrapper_template ) );
691
+		if ( !is_readable( $wrapper_template ) ) {
692
+					throw new EE_Error( sprintf( __('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso' ), ucwords($this->label['singular']) , $wrapper_template ) );
693
+		}
689 694
 
690 695
 		//add message type to template args
691 696
 		$this->_template_args['message_type'] = $this->_incoming_message_type;
@@ -757,20 +762,24 @@  discard block
 block discarded – undo
757 762
 	 */
758 763
 	public function get_field_label( $field ) {
759 764
 		//first let's see if the field requests is in the top level array.
760
-		if ( isset( $this->_template_fields[$field] ) && !empty( $this->_template_fields[$field]['label'] ) )
761
-			return $this->_template[$field]['label'];
765
+		if ( isset( $this->_template_fields[$field] ) && !empty( $this->_template_fields[$field]['label'] ) ) {
766
+					return $this->_template[$field]['label'];
767
+		}
762 768
 
763 769
 		//nope so let's look in the extra array to see if it's there HOWEVER if the field exists as a top level index in the extra array then we know the label is in the 'main' index.
764
-		if ( isset( $this->_template_fields['extra'] ) && !empty( $this->_template_fields['extra'][$field] ) && !empty( $this->_template_fields['extra'][$field]['main']['label'] )  )
765
-			return $this->_template_fields['extra'][$field]['main']['label'];
770
+		if ( isset( $this->_template_fields['extra'] ) && !empty( $this->_template_fields['extra'][$field] ) && !empty( $this->_template_fields['extra'][$field]['main']['label'] )  ) {
771
+					return $this->_template_fields['extra'][$field]['main']['label'];
772
+		}
766 773
 
767 774
 		//now it's possible this field may just be existing in any of the extra array items.
768 775
 		if ( !empty( $this->_template_fields['extra'] ) && is_array( $this->_template_fields['extra'] ) ) {
769 776
 			foreach ( $this->_template_fields['extra'] as $main_field => $subfields ) {
770
-				if ( !is_array( $subfields ) )
771
-					continue;
772
-				if ( isset( $subfields[$field] ) && !empty( $subfields[$field]['label'] ) )
773
-					return $subfields[$field]['label'];
777
+				if ( !is_array( $subfields ) ) {
778
+									continue;
779
+				}
780
+				if ( isset( $subfields[$field] ) && !empty( $subfields[$field]['label'] ) ) {
781
+									return $subfields[$field]['label'];
782
+				}
774 783
 			}
775 784
 		}
776 785
 
Please login to merge, or discard this patch.
core/libraries/messages/data_class/EE_Messages_Addressee.class.php 2 patches
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
4 4
 	exit('NO direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * Event Espresso
@@ -166,8 +167,9 @@  discard block
 block discarded – undo
166 167
 	protected function _set_properties() {
167 168
 
168 169
 		foreach ( $this->_data as $prop => $value ) {
169
-			if( EEH_Class_Tools::has_property( $this, $prop ) )
170
-				$this->{$prop} = $value;
170
+			if( EEH_Class_Tools::has_property( $this, $prop ) ) {
171
+							$this->{$prop} = $value;
172
+			}
171 173
 		}
172 174
 
173 175
 		//if user_id present we'll use this to set the fname and lname and admin_email.
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	/**
35 35
 	 * Identifier properties for the recipient
36 36
 	 */
37
-	public $user_id;  //if available we'll use this to set the fname and lname (admin)
37
+	public $user_id; //if available we'll use this to set the fname and lname (admin)
38 38
 	public $fname; //this will always be the admin fname (set later via incoming user_id)
39 39
 	public $lname; //this will always be the admin lname (set later via incoming user_id)
40 40
 	public $primary_registration_id;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @param array $addressee_data We're expecting an incoming array of data that will be used to fill the properties for the object.
150 150
 	 * @return void
151 151
 	 */
152
-	public function __construct( $addressee_data ) {
152
+	public function __construct($addressee_data) {
153 153
 		$this->_data = $addressee_data;
154 154
 		$this->_set_properties();
155 155
 	}
@@ -165,15 +165,15 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	protected function _set_properties() {
167 167
 
168
-		foreach ( $this->_data as $prop => $value ) {
169
-			if( EEH_Class_Tools::has_property( $this, $prop ) )
168
+		foreach ($this->_data as $prop => $value) {
169
+			if (EEH_Class_Tools::has_property($this, $prop))
170 170
 				$this->{$prop} = $value;
171 171
 		}
172 172
 
173 173
 		//if user_id present we'll use this to set the fname and lname and admin_email.
174
-		if ( !empty( $this->user_id ) ) {
174
+		if ( ! empty($this->user_id)) {
175 175
 			$this->user_id = (int) $this->user_id;
176
-			$user = get_userdata( $this->user_id );
176
+			$user = get_userdata($this->user_id);
177 177
 			$this->fname = $user->user_firstname;
178 178
 			$this->lname = $user->user_lastname;
179 179
 			$this->admin_email = $user->user_email;
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Addon.lib.php 1 patch
Spacing   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -66,23 +66,23 @@  discard block
 block discarded – undo
66 66
 	 * @param string $min_core_version
67 67
 	 * @return string always like '4.3.0.rc.000'
68 68
 	 */
69
-	protected static function _effective_version( $min_core_version ) {
69
+	protected static function _effective_version($min_core_version) {
70 70
 		// versions: 4 . 3 . 1 . p . 123
71 71
 		// offsets:    0 . 1 . 2 . 3 . 4
72
-		$version_parts = explode( '.', $min_core_version );
72
+		$version_parts = explode('.', $min_core_version);
73 73
 		//check they specified the micro version (after 2nd period)
74
-		if( ! isset( $version_parts[ 2 ] ) ) {
75
-			$version_parts[ 2] = '0';
74
+		if ( ! isset($version_parts[2])) {
75
+			$version_parts[2] = '0';
76 76
 		}
77 77
 		//if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible
78 78
 		//soon we can assume that's 'rc', but this current version is 'alpha'
79
-		if( ! isset( $version_parts[ 3 ] ) ) {
80
-			$version_parts[ 3 ] = 'dev';
79
+		if ( ! isset($version_parts[3])) {
80
+			$version_parts[3] = 'dev';
81 81
 		}
82
-		if( ! isset( $version_parts[ 4 ] ) ) {
83
-			$version_parts[ 4 ] = '000';
82
+		if ( ! isset($version_parts[4])) {
83
+			$version_parts[4] = '000';
84 84
 		}
85
-		return implode( '.', $version_parts );
85
+		return implode('.', $version_parts);
86 86
 
87 87
 	}
88 88
 
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 	 * @param string $actual_core_version the actual core version, optional
93 93
 	 * @return boolean
94 94
 	 */
95
-	public static  function _meets_min_core_version_requirement( $min_core_version, $actual_core_version = EVENT_ESPRESSO_VERSION ) {
96
-		return version_compare( self::_effective_version( $actual_core_version ), self::_effective_version( $min_core_version ), '>=' );
95
+	public static  function _meets_min_core_version_requirement($min_core_version, $actual_core_version = EVENT_ESPRESSO_VERSION) {
96
+		return version_compare(self::_effective_version($actual_core_version), self::_effective_version($min_core_version), '>=');
97 97
 	}
98 98
 
99 99
 
@@ -155,235 +155,235 @@  discard block
 block discarded – undo
155 155
 	 * @throws EE_Error
156 156
 	 * @return void
157 157
 	 */
158
-	public static function register( $addon_name = '', $setup_args = array()  ) {
158
+	public static function register($addon_name = '', $setup_args = array()) {
159 159
 		// required fields MUST be present, so let's make sure they are.
160
-		if ( empty( $addon_name ) || ! is_array( $setup_args )) {
161
-			throw new EE_Error( __( 'In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.', 'event_espresso' ));
160
+		if (empty($addon_name) || ! is_array($setup_args)) {
161
+			throw new EE_Error(__('In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.', 'event_espresso'));
162 162
 		}
163
-		if ( ! isset($setup_args[ 'main_file_path' ]) || empty( $setup_args[ 'main_file_path' ] ) ){
164
-			throw new EE_Error( sprintf( __( 'When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s', 'event_espresso' ), implode(",", array_keys( $setup_args ) ) ) );
163
+		if ( ! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
164
+			throw new EE_Error(sprintf(__('When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s', 'event_espresso'), implode(",", array_keys($setup_args))));
165 165
 		}
166 166
 		// check that addon has not already been registered with that name
167
-		if ( isset( self::$_settings[ $addon_name ] ) && ! did_action( 'activate_plugin' ) ) {
168
-			throw new EE_Error( sprintf( __( 'An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.', 'event_espresso' ), $addon_name ));
167
+		if (isset(self::$_settings[$addon_name]) && ! did_action('activate_plugin')) {
168
+			throw new EE_Error(sprintf(__('An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.', 'event_espresso'), $addon_name));
169 169
 		}
170 170
 
171 171
 
172 172
 		// no class name for addon?
173
-		if ( empty( $setup_args['class_name'] )) {
173
+		if (empty($setup_args['class_name'])) {
174 174
 			// generate one by first separating name with spaces
175
-			$class_name = str_replace( array( '-', '_' ), ' ', trim( $addon_name ));
175
+			$class_name = str_replace(array('-', '_'), ' ', trim($addon_name));
176 176
 			//capitalize, then replace spaces with underscores
177
-			$class_name = str_replace( ' ', '_', ucwords( $class_name ));
177
+			$class_name = str_replace(' ', '_', ucwords($class_name));
178 178
 		} else {
179 179
 			$class_name = $setup_args['class_name'];
180 180
 		}
181
-		$class_name = strpos( $class_name, 'EE_' ) === 0 ? $class_name : 'EE_' . $class_name;
181
+		$class_name = strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_'.$class_name;
182 182
 		//setup $_settings array from incoming values.
183 183
 		$addon_settings = array(
184 184
 			// generated from the addon name, changes something like "calendar" to "EE_Calendar"
185 185
 			'class_name' 						=> $class_name,
186 186
 			// the addon slug for use in URLs, etc
187
-			'plugin_slug' 						=> isset( $setup_args['plugin_slug'] ) ? (string)$setup_args['plugin_slug'] : '',
187
+			'plugin_slug' 						=> isset($setup_args['plugin_slug']) ? (string) $setup_args['plugin_slug'] : '',
188 188
 			// page slug to be used when generating the "Settings" link on the WP plugin page
189
-			'plugin_action_slug' 			=> isset( $setup_args[ 'plugin_action_slug' ] ) ? (string)$setup_args[ 'plugin_action_slug' ] : '',
189
+			'plugin_action_slug' 			=> isset($setup_args['plugin_action_slug']) ? (string) $setup_args['plugin_action_slug'] : '',
190 190
 			// the "software" version for the addon
191
-			'version' 								=> isset( $setup_args['version'] ) ? (string)$setup_args['version'] : '',
191
+			'version' 								=> isset($setup_args['version']) ? (string) $setup_args['version'] : '',
192 192
 			// the minimum version of EE Core that the addon will work with
193
-			'min_core_version' 			=> isset( $setup_args['min_core_version'] ) ? (string)$setup_args['min_core_version'] : '',
193
+			'min_core_version' 			=> isset($setup_args['min_core_version']) ? (string) $setup_args['min_core_version'] : '',
194 194
 			// full server path to main file (file loaded directly by WP)
195
-			'main_file_path' 					=> isset( $setup_args['main_file_path'] ) ? (string)$setup_args['main_file_path'] : '',
195
+			'main_file_path' 					=> isset($setup_args['main_file_path']) ? (string) $setup_args['main_file_path'] : '',
196 196
 			// path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages
197
-			'admin_path' 						=> isset( $setup_args['admin_path'] ) ? (string)$setup_args['admin_path'] : '',
197
+			'admin_path' 						=> isset($setup_args['admin_path']) ? (string) $setup_args['admin_path'] : '',
198 198
 			// a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page
199
-			'admin_callback' 				=> isset( $setup_args['admin_callback'] ) ? (string)$setup_args['admin_callback'] : '',
199
+			'admin_callback' 				=> isset($setup_args['admin_callback']) ? (string) $setup_args['admin_callback'] : '',
200 200
 			// the section name for this addon's configuration settings section (defaults to "addons")
201
-			'config_section' 					=> isset( $setup_args['config_section'] ) ? (string)$setup_args['config_section'] : 'addons',
201
+			'config_section' 					=> isset($setup_args['config_section']) ? (string) $setup_args['config_section'] : 'addons',
202 202
 			// the class name for this addon's configuration settings object
203
-			'config_class' 						=> isset( $setup_args['config_class'] ) ? (string)$setup_args['config_class'] : '',
203
+			'config_class' 						=> isset($setup_args['config_class']) ? (string) $setup_args['config_class'] : '',
204 204
 			//the name given to the config for this addons' configuration settings object (optional)
205
-			'config_name' 					=> isset( $setup_args['config_name'] ) ? (string) $setup_args['config_name']: '',
205
+			'config_name' 					=> isset($setup_args['config_name']) ? (string) $setup_args['config_name'] : '',
206 206
 			// an array of "class names" => "full server paths" for any classes that might be invoked by the addon
207
-			'autoloader_paths' 			=> isset( $setup_args['autoloader_paths'] ) ? (array)$setup_args['autoloader_paths'] : array(),
207
+			'autoloader_paths' 			=> isset($setup_args['autoloader_paths']) ? (array) $setup_args['autoloader_paths'] : array(),
208 208
 			// an array of  "full server paths" for any folders containing classes that might be invoked by the addon
209
-			'autoloader_folders' 			=> isset( $setup_args['autoloader_folders'] ) ? (array)$setup_args['autoloader_folders'] : array(),
209
+			'autoloader_folders' 			=> isset($setup_args['autoloader_folders']) ? (array) $setup_args['autoloader_folders'] : array(),
210 210
 			// array of full server paths to any EE_DMS data migration scripts used by the addon
211
-			'dms_paths' 						=> isset( $setup_args['dms_paths'] ) ? (array)$setup_args['dms_paths'] : array(),
211
+			'dms_paths' 						=> isset($setup_args['dms_paths']) ? (array) $setup_args['dms_paths'] : array(),
212 212
 			// array of full server paths to any EED_Modules used by the addon
213
-			'module_paths' 					=> isset( $setup_args['module_paths'] ) ? (array)$setup_args['module_paths'] : array(),
213
+			'module_paths' 					=> isset($setup_args['module_paths']) ? (array) $setup_args['module_paths'] : array(),
214 214
 			// array of full server paths to any EES_Shortcodes used by the addon
215
-			'shortcode_paths'			 	=> isset( $setup_args['shortcode_paths'] ) ? (array)$setup_args['shortcode_paths'] : array(),
215
+			'shortcode_paths'			 	=> isset($setup_args['shortcode_paths']) ? (array) $setup_args['shortcode_paths'] : array(),
216 216
 			// array of full server paths to any WP_Widgets used by the addon
217
-			'widget_paths' 					=> isset( $setup_args['widget_paths'] ) ? (array)$setup_args['widget_paths'] : array(),
217
+			'widget_paths' 					=> isset($setup_args['widget_paths']) ? (array) $setup_args['widget_paths'] : array(),
218 218
 			// array of PUE options used by the addon
219
-			'pue_options' 						=> isset( $setup_args['pue_options'] ) ? (array)$setup_args['pue_options'] : array(),
220
-			'message_types' 				=> isset( $setup_args['message_types'] ) ? (array) $setup_args['message_types'] : array(),
221
-			'capabilities' 						=> isset( $setup_args['capabilities'] ) ? (array) $setup_args['capabilities'] : array(),
222
-			'capability_maps' 				=> isset( $setup_args['capability_maps'] ) ? (array) $setup_args['capability_maps'] : array(),
223
-			'model_paths' 					=> isset( $setup_args['model_paths'] ) ? (array) $setup_args['model_paths'] : array(),
224
-			'class_paths' 						=> isset( $setup_args['class_paths'] ) ? (array) $setup_args['class_paths'] : array(),
225
-			'model_extension_paths' 	=> isset( $setup_args['model_extension_paths'] ) ? (array) $setup_args['model_extension_paths'] : array(),
226
-			'class_extension_paths' 		=> isset( $setup_args['class_extension_paths'] ) ? (array) $setup_args['class_extension_paths'] : array(),
227
-			'custom_post_types' 			=> isset( $setup_args['custom_post_types'] ) ? (array) $setup_args['custom_post_types'] : array(),
228
-			'custom_taxonomies' 		=> isset( $setup_args['custom_taxonomies'] ) ? (array) $setup_args['custom_taxonomies'] : array(),
229
-			'payment_method_paths'	=> isset( $setup_args[ 'payment_method_paths' ] ) ? (array) $setup_args[ 'payment_method_paths' ] : array(),
230
-			'default_terms' 					=> isset( $setup_args['default_terms'] ) ? (array) $setup_args['default_terms'] : array(),
219
+			'pue_options' 						=> isset($setup_args['pue_options']) ? (array) $setup_args['pue_options'] : array(),
220
+			'message_types' 				=> isset($setup_args['message_types']) ? (array) $setup_args['message_types'] : array(),
221
+			'capabilities' 						=> isset($setup_args['capabilities']) ? (array) $setup_args['capabilities'] : array(),
222
+			'capability_maps' 				=> isset($setup_args['capability_maps']) ? (array) $setup_args['capability_maps'] : array(),
223
+			'model_paths' 					=> isset($setup_args['model_paths']) ? (array) $setup_args['model_paths'] : array(),
224
+			'class_paths' 						=> isset($setup_args['class_paths']) ? (array) $setup_args['class_paths'] : array(),
225
+			'model_extension_paths' 	=> isset($setup_args['model_extension_paths']) ? (array) $setup_args['model_extension_paths'] : array(),
226
+			'class_extension_paths' 		=> isset($setup_args['class_extension_paths']) ? (array) $setup_args['class_extension_paths'] : array(),
227
+			'custom_post_types' 			=> isset($setup_args['custom_post_types']) ? (array) $setup_args['custom_post_types'] : array(),
228
+			'custom_taxonomies' 		=> isset($setup_args['custom_taxonomies']) ? (array) $setup_args['custom_taxonomies'] : array(),
229
+			'payment_method_paths'	=> isset($setup_args['payment_method_paths']) ? (array) $setup_args['payment_method_paths'] : array(),
230
+			'default_terms' 					=> isset($setup_args['default_terms']) ? (array) $setup_args['default_terms'] : array(),
231 231
 			// if not empty, inserts a new table row after this plugin's row on the WP Plugins page that can be used for adding upgrading/marketing info
232
-			'plugins_page_row' 			=> isset( $setup_args['plugins_page_row'] ) ? $setup_args['plugins_page_row'] : '',
232
+			'plugins_page_row' 			=> isset($setup_args['plugins_page_row']) ? $setup_args['plugins_page_row'] : '',
233 233
 		);
234 234
 
235 235
 		// if plugin_action_slug is NOT set, but an admin page path IS set, then let's just use the plugin_slug since that will be used for linking to the admin page
236
-		$addon_settings[ 'plugin_action_slug' ] = empty( $addon_settings[ 'plugin_action_slug' ] ) && ! empty( $addon_settings[ 'admin_path' ] ) ? $addon_settings[ 'plugin_slug' ] : $addon_settings[ 'plugin_action_slug' ];
236
+		$addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug']) && ! empty($addon_settings['admin_path']) ? $addon_settings['plugin_slug'] : $addon_settings['plugin_action_slug'];
237 237
 		// full server path to main file (file loaded directly by WP)
238
-		$addon_settings['plugin_basename'] = plugin_basename( $addon_settings[ 'main_file_path' ] );
238
+		$addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']);
239 239
 
240 240
 		//check whether this addon version is compatible with EE core
241
-		if ( isset( EE_Register_Addon::$_incompatible_addons[ $addon_name ] ) &&
242
-				! self::_meets_min_core_version_requirement( EE_Register_Addon::$_incompatible_addons[ $addon_name ], $addon_settings[ 'version' ] ) ) {
241
+		if (isset(EE_Register_Addon::$_incompatible_addons[$addon_name]) &&
242
+				! self::_meets_min_core_version_requirement(EE_Register_Addon::$_incompatible_addons[$addon_name], $addon_settings['version'])) {
243 243
 			$incompatibility_message = sprintf(
244
-				__( 'The Event Espresso "%1$s" addon was deactivated because it is incompatible with this version of core.%2$s Only version %3$s or higher of "%1$s" can run with this version of core. This can happen when attempting to run beta versions or release candidates with older versions of core, or running old versions of addons with a newer version of core.%2$sPlease upgrade Event Espresso Core and the "%1$s" addon, then re-attempt activating it.', 'event_espresso' ),
244
+				__('The Event Espresso "%1$s" addon was deactivated because it is incompatible with this version of core.%2$s Only version %3$s or higher of "%1$s" can run with this version of core. This can happen when attempting to run beta versions or release candidates with older versions of core, or running old versions of addons with a newer version of core.%2$sPlease upgrade Event Espresso Core and the "%1$s" addon, then re-attempt activating it.', 'event_espresso'),
245 245
 				$addon_name,
246 246
 				'<br />',
247
-				EE_Register_Addon::$_incompatible_addons[ $addon_name ]
247
+				EE_Register_Addon::$_incompatible_addons[$addon_name]
248 248
 			);
249
-		} else if ( ! self::_meets_min_core_version_requirement( $setup_args[ 'min_core_version' ], espresso_version() ) ) {
249
+		} else if ( ! self::_meets_min_core_version_requirement($setup_args['min_core_version'], espresso_version())) {
250 250
 			$incompatibility_message = sprintf(
251
-				__( 'The Event Espresso "%1$s" addon could not be activated because it requires Event Espresso Core version "%2$s" or higher in order to run.%4$sYour version of Event Espresso Core is currently at "%3$s". Please upgrade Event Espresso Core first and then re-attempt activating "%1$s".', 'event_espresso' ),
251
+				__('The Event Espresso "%1$s" addon could not be activated because it requires Event Espresso Core version "%2$s" or higher in order to run.%4$sYour version of Event Espresso Core is currently at "%3$s". Please upgrade Event Espresso Core first and then re-attempt activating "%1$s".', 'event_espresso'),
252 252
 				$addon_name,
253
-				self::_effective_version( $setup_args[ 'min_core_version' ] ),
254
-				self::_effective_version( espresso_version() ),
253
+				self::_effective_version($setup_args['min_core_version']),
254
+				self::_effective_version(espresso_version()),
255 255
 				'<br />'
256 256
 			);
257 257
 		} else {
258 258
 			$incompatibility_message = '';
259 259
 		}
260
-		if ( ! empty( $incompatibility_message ) ) {
260
+		if ( ! empty($incompatibility_message)) {
261 261
 			//remove 'activate' from the REQUEST so WP doesn't erroneously tell the user the
262 262
 			//plugin activated fine when it didn't
263
-			if( isset( $_GET[ 'activate' ]) ) {
264
-				unset( $_GET[ 'activate' ] );
263
+			if (isset($_GET['activate'])) {
264
+				unset($_GET['activate']);
265 265
 			}
266
-			if( isset( $_REQUEST[ 'activate' ] ) ){
267
-				unset( $_REQUEST[ 'activate' ] );
266
+			if (isset($_REQUEST['activate'])) {
267
+				unset($_REQUEST['activate']);
268 268
 			}
269 269
 			//and show an error message indicating the plugin didn't activate properly
270
-			EE_Error::add_error( $incompatibility_message, __FILE__, __FUNCTION__, __LINE__ );
271
-			if ( current_user_can( 'activate_plugins' )) {
272
-				require_once( ABSPATH.'wp-admin/includes/plugin.php' );
273
-				deactivate_plugins( plugin_basename( $addon_settings[ 'main_file_path' ] ), TRUE );
270
+			EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__);
271
+			if (current_user_can('activate_plugins')) {
272
+				require_once(ABSPATH.'wp-admin/includes/plugin.php');
273
+				deactivate_plugins(plugin_basename($addon_settings['main_file_path']), TRUE);
274 274
 			}
275 275
 			return;
276 276
 		}
277 277
 		//this is an activation request
278
-		if( did_action( 'activate_plugin' ) ){
278
+		if (did_action('activate_plugin')) {
279 279
 			//to find if THIS is the addon that was activated,
280 280
 			//just check if we have already registered it or not
281 281
 			//(as the newly-activated addon wasn't around the first time addons were registered)
282
-			if( ! isset( self::$_settings[ $addon_name ] ) ){
283
-				self::$_settings[ $addon_name ] = $addon_settings;
282
+			if ( ! isset(self::$_settings[$addon_name])) {
283
+				self::$_settings[$addon_name] = $addon_settings;
284 284
 				$addon = self::_load_and_init_addon_class($addon_name);
285 285
 				$addon->set_activation_indicator_option();
286 286
 				//dont bother setting up the rest of the addon.
287 287
 				//we know it was just activated and the request will end soon
288 288
 			}
289 289
 			return;
290
-		}else{
290
+		} else {
291 291
 			// make sure this was called in the right place!
292
-			if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System___detect_if_activation_or_upgrade__begin' )) {
292
+			if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin')) {
293 293
 				EE_Error::doing_it_wrong(
294 294
 					__METHOD__,
295 295
 					sprintf(
296
-						__( 'An attempt to register an EE_Addon named "%s" has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register addons.','event_espresso'),
296
+						__('An attempt to register an EE_Addon named "%s" has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register addons.', 'event_espresso'),
297 297
 						$addon_name
298 298
 					),
299 299
 					'4.3.0'
300 300
 				);
301 301
 			}
302
-			self::$_settings[ $addon_name ] = $addon_settings;
302
+			self::$_settings[$addon_name] = $addon_settings;
303 303
 		}
304 304
 		// we need cars
305
-		if ( ! empty( self::$_settings[ $addon_name ]['autoloader_paths'] )) {
305
+		if ( ! empty(self::$_settings[$addon_name]['autoloader_paths'])) {
306 306
 			// setup autoloader for single file
307
-			EEH_Autoloader::instance()->register_autoloader( self::$_settings[ $addon_name ]['autoloader_paths'] );
307
+			EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']);
308 308
 		}
309 309
 		// setup autoloaders for folders
310
-		if ( ! empty( self::$_settings[ $addon_name ]['autoloader_folders'] )) {
311
-			foreach ( self::$_settings[ $addon_name ]['autoloader_folders'] as $autoloader_folder ) {
312
-				EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $autoloader_folder );
310
+		if ( ! empty(self::$_settings[$addon_name]['autoloader_folders'])) {
311
+			foreach (self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) {
312
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder);
313 313
 			}
314 314
 		}
315 315
 		// register new models
316
-		if ( ! empty( self::$_settings[ $addon_name ]['model_paths'] ) || ! empty( self::$_settings[ $addon_name ]['class_paths'] )) {
317
-			EE_Register_Model::register( $addon_name, array( 'model_paths' => self::$_settings[ $addon_name ]['model_paths'] , 'class_paths' => self::$_settings[ $addon_name ]['class_paths']));
316
+		if ( ! empty(self::$_settings[$addon_name]['model_paths']) || ! empty(self::$_settings[$addon_name]['class_paths'])) {
317
+			EE_Register_Model::register($addon_name, array('model_paths' => self::$_settings[$addon_name]['model_paths'], 'class_paths' => self::$_settings[$addon_name]['class_paths']));
318 318
 		}
319 319
 		// register model extensions
320
-		if ( ! empty( self::$_settings[ $addon_name ]['model_extension_paths'] ) || ! empty( self::$_settings[ $addon_name ]['class_extension_paths'] )) {
321
-			EE_Register_Model_Extensions::register( $addon_name, array( 'model_extension_paths' => self::$_settings[ $addon_name ]['model_extension_paths'] , 'class_extension_paths' => self::$_settings[ $addon_name ]['class_extension_paths']));
320
+		if ( ! empty(self::$_settings[$addon_name]['model_extension_paths']) || ! empty(self::$_settings[$addon_name]['class_extension_paths'])) {
321
+			EE_Register_Model_Extensions::register($addon_name, array('model_extension_paths' => self::$_settings[$addon_name]['model_extension_paths'], 'class_extension_paths' => self::$_settings[$addon_name]['class_extension_paths']));
322 322
 		}
323 323
 		// setup DMS
324
-		if ( ! empty( self::$_settings[ $addon_name ]['dms_paths'] )) {
325
-			EE_Register_Data_Migration_Scripts::register( $addon_name, array( 'dms_paths' => self::$_settings[ $addon_name ]['dms_paths'] ));
324
+		if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) {
325
+			EE_Register_Data_Migration_Scripts::register($addon_name, array('dms_paths' => self::$_settings[$addon_name]['dms_paths']));
326 326
 		}
327 327
 		// if config_class is present let's register config.
328
-		if ( ! empty( self::$_settings[ $addon_name ]['config_class'] )) {
328
+		if ( ! empty(self::$_settings[$addon_name]['config_class'])) {
329 329
 			EE_Register_Config::register(
330
-				self::$_settings[ $addon_name ]['config_class'],
330
+				self::$_settings[$addon_name]['config_class'],
331 331
 				array(
332
-					'config_section' => self::$_settings[ $addon_name ]['config_section'],
333
-					'config_name' => self::$_settings[ $addon_name ]['config_name']
332
+					'config_section' => self::$_settings[$addon_name]['config_section'],
333
+					'config_name' => self::$_settings[$addon_name]['config_name']
334 334
 				)
335 335
 			);
336 336
 		}
337 337
 		// register admin page
338
-		if ( ! empty( self::$_settings[ $addon_name ]['admin_path'] )) {
339
-			EE_Register_Admin_Page::register( $addon_name, array( 'page_path' => self::$_settings[ $addon_name ]['admin_path'] ));
338
+		if ( ! empty(self::$_settings[$addon_name]['admin_path'])) {
339
+			EE_Register_Admin_Page::register($addon_name, array('page_path' => self::$_settings[$addon_name]['admin_path']));
340 340
 
341 341
 		}
342 342
 		// add to list of modules to be registered
343
-		if ( ! empty( self::$_settings[ $addon_name ]['module_paths'] )) {
344
-			EE_Register_Module::register( $addon_name, array( 'module_paths' => self::$_settings[ $addon_name ]['module_paths'] ));
343
+		if ( ! empty(self::$_settings[$addon_name]['module_paths'])) {
344
+			EE_Register_Module::register($addon_name, array('module_paths' => self::$_settings[$addon_name]['module_paths']));
345 345
 		}
346 346
 		// add to list of shortcodes to be registered
347
-		if ( ! empty( self::$_settings[ $addon_name ]['shortcode_paths'] )) {
348
-			EE_Register_Shortcode::register( $addon_name, array( 'shortcode_paths' => self::$_settings[ $addon_name ]['shortcode_paths'] ));
347
+		if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
348
+			EE_Register_Shortcode::register($addon_name, array('shortcode_paths' => self::$_settings[$addon_name]['shortcode_paths']));
349 349
 		}
350 350
 		// add to list of widgets to be registered
351
-		if ( ! empty( self::$_settings[ $addon_name ]['widget_paths'] )) {
352
-			EE_Register_Widget::register( $addon_name, array( 'widget_paths' => self::$_settings[ $addon_name ]['widget_paths'] ));
351
+		if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) {
352
+			EE_Register_Widget::register($addon_name, array('widget_paths' => self::$_settings[$addon_name]['widget_paths']));
353 353
 		}
354 354
 
355 355
 		//register capability related stuff.
356
-		if ( ! empty( self::$_settings[ $addon_name ]['capabilities'] ) ) {
357
-			EE_Register_Capabilities::register( $addon_name , array( 'capabilities' => self::$_settings[$addon_name]['capabilities'], 'capability_maps' => self::$_settings[$addon_name]['capability_maps'] ) );
356
+		if ( ! empty(self::$_settings[$addon_name]['capabilities'])) {
357
+			EE_Register_Capabilities::register($addon_name, array('capabilities' => self::$_settings[$addon_name]['capabilities'], 'capability_maps' => self::$_settings[$addon_name]['capability_maps']));
358 358
 		}
359 359
 		//any message type to register?
360
-		if (  !empty( self::$_settings[$addon_name]['message_types'] ) ) {
361
-				add_action( 'EE_Brewing_Regular___messages_caf', array( 'EE_Register_Addon', 'register_message_types' ) );
360
+		if ( ! empty(self::$_settings[$addon_name]['message_types'])) {
361
+				add_action('EE_Brewing_Regular___messages_caf', array('EE_Register_Addon', 'register_message_types'));
362 362
 		}
363 363
 
364 364
 		// if plugin update engine is being used for auto-updates (not needed if PUE is not being used)
365
-		if ( ! empty( $setup_args['pue_options'] )) {
366
-			self::$_settings[ $addon_name ]['pue_options'] = array(
367
-				'pue_plugin_slug' 	=> isset( $setup_args['pue_options']['pue_plugin_slug'] ) ? (string)$setup_args['pue_options']['pue_plugin_slug'] : 'espresso_' . strtolower( $class_name ),
368
-				'plugin_basename' => isset( $setup_args['pue_options']['plugin_basename'] ) ? (string)$setup_args['pue_options']['plugin_basename'] : plugin_basename( self::$_settings[ $addon_name ]['main_file_path'] ),
369
-				'checkPeriod' 			=> isset( $setup_args['pue_options']['checkPeriod'] ) ? (string)$setup_args['pue_options']['checkPeriod'] : '24',
370
-				'use_wp_update'		=> isset( $setup_args['pue_options']['use_wp_update'] ) ? (string)$setup_args['pue_options']['use_wp_update'] : FALSE
365
+		if ( ! empty($setup_args['pue_options'])) {
366
+			self::$_settings[$addon_name]['pue_options'] = array(
367
+				'pue_plugin_slug' 	=> isset($setup_args['pue_options']['pue_plugin_slug']) ? (string) $setup_args['pue_options']['pue_plugin_slug'] : 'espresso_'.strtolower($class_name),
368
+				'plugin_basename' => isset($setup_args['pue_options']['plugin_basename']) ? (string) $setup_args['pue_options']['plugin_basename'] : plugin_basename(self::$_settings[$addon_name]['main_file_path']),
369
+				'checkPeriod' 			=> isset($setup_args['pue_options']['checkPeriod']) ? (string) $setup_args['pue_options']['checkPeriod'] : '24',
370
+				'use_wp_update'		=> isset($setup_args['pue_options']['use_wp_update']) ? (string) $setup_args['pue_options']['use_wp_update'] : FALSE
371 371
 			);
372
-			add_action( 'AHEE__EE_System__brew_espresso__after_pue_init', array( 'EE_Register_Addon', 'load_pue_update' ));
372
+			add_action('AHEE__EE_System__brew_espresso__after_pue_init', array('EE_Register_Addon', 'load_pue_update'));
373 373
 		}
374 374
 
375 375
 		//any custom post type/ custom capabilities or default terms to register
376
-		if ( !empty( self::$_settings[$addon_name]['custom_post_types'] ) || !empty( self::$_settings[$addon_name]['custom_taxonomies'] ) ) {
377
-			EE_Register_CPT::register( $addon_name, array( 'cpts' => self::$_settings[$addon_name]['custom_post_types'] , 'cts' => self::$_settings[$addon_name]['custom_taxonomies'], 'default_terms' => self::$_settings[$addon_name]['default_terms'] ) );
376
+		if ( ! empty(self::$_settings[$addon_name]['custom_post_types']) || ! empty(self::$_settings[$addon_name]['custom_taxonomies'])) {
377
+			EE_Register_CPT::register($addon_name, array('cpts' => self::$_settings[$addon_name]['custom_post_types'], 'cts' => self::$_settings[$addon_name]['custom_taxonomies'], 'default_terms' => self::$_settings[$addon_name]['default_terms']));
378 378
 		}
379
-		if( ! empty( self::$_settings[ $addon_name ][ 'payment_method_paths' ] ) ){
380
-			EE_Register_Payment_Method::register($addon_name, array( 'payment_method_paths' => self::$_settings[ $addon_name ][ 'payment_method_paths' ] ) );
379
+		if ( ! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
380
+			EE_Register_Payment_Method::register($addon_name, array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths']));
381 381
 		}
382 382
 		// load and instantiate main addon class
383 383
 		$addon = self::_load_and_init_addon_class($addon_name);
384 384
 		// call any additional admin_callback functions during load_admin_controller hook
385
-		if ( ! empty( self::$_settings[ $addon_name ]['admin_callback'] )) {
386
-			add_action( 'AHEE__EE_System__load_controllers__load_admin_controllers', array( $addon, self::$_settings[ $addon_name ]['admin_callback'] ));
385
+		if ( ! empty(self::$_settings[$addon_name]['admin_callback'])) {
386
+			add_action('AHEE__EE_System__load_controllers__load_admin_controllers', array($addon, self::$_settings[$addon_name]['admin_callback']));
387 387
 		}
388 388
 	}
389 389
 
@@ -394,22 +394,22 @@  discard block
 block discarded – undo
394 394
 	 * @param string $addon_name
395 395
 	 * @return EE_Addon
396 396
 	 */
397
-	private static function _load_and_init_addon_class($addon_name){
398
-		$addon = EE_Registry::instance()->load_addon( dirname( self::$_settings[ $addon_name ]['main_file_path'] ), self::$_settings[ $addon_name ]['class_name'] );
399
-		$addon->set_name( $addon_name );
400
-		$addon->set_plugin_slug( self::$_settings[ $addon_name ][ 'plugin_slug' ] );
401
-		$addon->set_plugin_basename( self::$_settings[ $addon_name ][ 'plugin_basename' ] );
402
-		$addon->set_main_plugin_file( self::$_settings[ $addon_name ]['main_file_path'] );
403
-		$addon->set_plugin_action_slug( self::$_settings[ $addon_name ][ 'plugin_action_slug' ] );
404
-		$addon->set_plugins_page_row( self::$_settings[ $addon_name ][ 'plugins_page_row' ] );
405
-		$addon->set_version( self::$_settings[ $addon_name ]['version'] );
406
-		$addon->set_min_core_version( self::_effective_version( self::$_settings[ $addon_name ]['min_core_version'] ) );
407
-		$addon->set_config_section( self::$_settings[ $addon_name ]['config_section'] );
408
-		$addon->set_config_class( self::$_settings[ $addon_name ]['config_class'] );
409
-		$addon->set_config_name( self::$_settings[ $addon_name ]['config_name'] );
397
+	private static function _load_and_init_addon_class($addon_name) {
398
+		$addon = EE_Registry::instance()->load_addon(dirname(self::$_settings[$addon_name]['main_file_path']), self::$_settings[$addon_name]['class_name']);
399
+		$addon->set_name($addon_name);
400
+		$addon->set_plugin_slug(self::$_settings[$addon_name]['plugin_slug']);
401
+		$addon->set_plugin_basename(self::$_settings[$addon_name]['plugin_basename']);
402
+		$addon->set_main_plugin_file(self::$_settings[$addon_name]['main_file_path']);
403
+		$addon->set_plugin_action_slug(self::$_settings[$addon_name]['plugin_action_slug']);
404
+		$addon->set_plugins_page_row(self::$_settings[$addon_name]['plugins_page_row']);
405
+		$addon->set_version(self::$_settings[$addon_name]['version']);
406
+		$addon->set_min_core_version(self::_effective_version(self::$_settings[$addon_name]['min_core_version']));
407
+		$addon->set_config_section(self::$_settings[$addon_name]['config_section']);
408
+		$addon->set_config_class(self::$_settings[$addon_name]['config_class']);
409
+		$addon->set_config_name(self::$_settings[$addon_name]['config_name']);
410 410
 		//unfortunately this can't be hooked in upon construction, because we don't have
411 411
 		//the plugin mainfile's path upon construction.
412
-		register_deactivation_hook($addon->get_main_plugin_file(), array($addon,'deactivation'));
412
+		register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation'));
413 413
 		return $addon;
414 414
 	}
415 415
 
@@ -422,18 +422,18 @@  discard block
 block discarded – undo
422 422
 	 */
423 423
 	public static function load_pue_update() {
424 424
 		// load PUE client
425
-		require_once  EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php';
425
+		require_once  EE_THIRD_PARTY.'pue'.DS.'pue-client.php';
426 426
 		// cycle thru settings
427
-		foreach ( self::$_settings as $settings ) {
428
-			if ( ! empty( $settings['pue_options'] )) {
427
+		foreach (self::$_settings as $settings) {
428
+			if ( ! empty($settings['pue_options'])) {
429 429
 				// initiate the class and start the plugin update engine!
430 430
 				new PluginUpdateEngineChecker(
431 431
 				// host file URL
432 432
 					'https://eventespresso.com',
433 433
 					// plugin slug(s)
434 434
 					array(
435
-						'premium' => array( 'p' => $settings['pue_options']['pue_plugin_slug'] ),
436
-						'prerelease' => array( 'beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr' )
435
+						'premium' => array('p' => $settings['pue_options']['pue_plugin_slug']),
436
+						'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'].'-pr')
437 437
 					),
438 438
 					// options
439 439
 					array(
@@ -461,9 +461,9 @@  discard block
 block discarded – undo
461 461
 	 * @return void
462 462
 	 */
463 463
 	public static function register_message_types() {
464
-		foreach ( self::$_settings as $settings ) {
465
-			foreach( $settings['message_types'] as $message_type => $message_type_settings ) {
466
-				EE_Register_Message_Type::register( $message_type, $message_type_settings );
464
+		foreach (self::$_settings as $settings) {
465
+			foreach ($settings['message_types'] as $message_type => $message_type_settings) {
466
+				EE_Register_Message_Type::register($message_type, $message_type_settings);
467 467
 			}
468 468
 		}
469 469
 	}
@@ -479,60 +479,60 @@  discard block
 block discarded – undo
479 479
 	 * @throws EE_Error
480 480
 	 * @return void
481 481
 	 */
482
-	public static function deregister( $addon_name = NULL ) {
483
-		if ( isset( self::$_settings[ $addon_name ] )) {
484
-			$class_name = self::$_settings[ $addon_name ]['class_name'];
485
-			if ( ! empty( self::$_settings[ $addon_name ]['dms_paths'] )) {
482
+	public static function deregister($addon_name = NULL) {
483
+		if (isset(self::$_settings[$addon_name])) {
484
+			$class_name = self::$_settings[$addon_name]['class_name'];
485
+			if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) {
486 486
 				// setup DMS
487
-				EE_Register_Data_Migration_Scripts::deregister( $addon_name );
487
+				EE_Register_Data_Migration_Scripts::deregister($addon_name);
488 488
 			}
489
-			if ( ! empty( self::$_settings[ $addon_name ]['admin_path'] )) {
489
+			if ( ! empty(self::$_settings[$addon_name]['admin_path'])) {
490 490
 				// register admin page
491
-				EE_Register_Admin_Page::deregister( $addon_name );
491
+				EE_Register_Admin_Page::deregister($addon_name);
492 492
 			}
493
-			if ( ! empty( self::$_settings[ $addon_name ]['module_paths'] )) {
493
+			if ( ! empty(self::$_settings[$addon_name]['module_paths'])) {
494 494
 				// add to list of modules to be registered
495
-				EE_Register_Module::deregister( $addon_name );
495
+				EE_Register_Module::deregister($addon_name);
496 496
 			}
497
-			if ( ! empty( self::$_settings[ $addon_name ]['shortcode_paths'] )) {
497
+			if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
498 498
 				// add to list of shortcodes to be registered
499
-				EE_Register_Shortcode::deregister( $addon_name );
499
+				EE_Register_Shortcode::deregister($addon_name);
500 500
 			}
501
-			if ( ! empty( self::$_settings[ $addon_name ]['config_class'] )) {
501
+			if ( ! empty(self::$_settings[$addon_name]['config_class'])) {
502 502
 				// if config_class present let's register config.
503
-				EE_Register_Config::deregister( self::$_settings[ $addon_name ]['config_class']);
503
+				EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']);
504 504
 			}
505
-			if ( ! empty( self::$_settings[ $addon_name ]['widget_paths'] )) {
505
+			if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) {
506 506
 				// add to list of widgets to be registered
507
-				EE_Register_Widget::deregister( $addon_name );
507
+				EE_Register_Widget::deregister($addon_name);
508 508
 			}
509
-			if ( ! empty( self::$_settings[ $addon_name ]['model_paths'] ) ||
510
-					! empty( self::$_settings[ $addon_name ]['class_paths'] )) {
509
+			if ( ! empty(self::$_settings[$addon_name]['model_paths']) ||
510
+					! empty(self::$_settings[$addon_name]['class_paths'])) {
511 511
 				// add to list of shortcodes to be registered
512
-				EE_Register_Model::deregister( $addon_name );
512
+				EE_Register_Model::deregister($addon_name);
513 513
 			}
514
-			if ( ! empty( self::$_settings[ $addon_name ]['model_extension_paths'] ) ||
515
-					! empty( self::$_settings[ $addon_name ]['class_extension_paths'] )) {
514
+			if ( ! empty(self::$_settings[$addon_name]['model_extension_paths']) ||
515
+					! empty(self::$_settings[$addon_name]['class_extension_paths'])) {
516 516
 				// add to list of shortcodes to be registered
517
-				EE_Register_Model_Extensions::deregister( $addon_name );
517
+				EE_Register_Model_Extensions::deregister($addon_name);
518 518
 				}
519
-			if (  !empty( self::$_settings[$addon_name]['message_types'] ) ) {
520
-				foreach( self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings ) {
521
-					EE_Register_Message_Type::deregister( $message_type );
519
+			if ( ! empty(self::$_settings[$addon_name]['message_types'])) {
520
+				foreach (self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) {
521
+					EE_Register_Message_Type::deregister($message_type);
522 522
 				}
523 523
 			}
524 524
 			//deregister capabilities for addon
525
-			if ( ! empty( self::$_settings[$addon_name]['capabilities'] ) || ! empty( self::$_settings[$addon_name]['capability_maps']) ) {
526
-				EE_Register_Capabilities::deregister( $addon_name );
525
+			if ( ! empty(self::$_settings[$addon_name]['capabilities']) || ! empty(self::$_settings[$addon_name]['capability_maps'])) {
526
+				EE_Register_Capabilities::deregister($addon_name);
527 527
 			}
528 528
 			//deregister custom_post_types for addon
529
-			if ( ! empty( self::$_settings[$addon_name]['custom_post_types'] ) ) {
530
-				EE_Register_CPT::deregister( $addon_name );
529
+			if ( ! empty(self::$_settings[$addon_name]['custom_post_types'])) {
530
+				EE_Register_CPT::deregister($addon_name);
531 531
 			}
532
-			remove_action('deactivate_'.EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(),  array( EE_Registry::instance()->addons->{$class_name}, 'deactivation' ) );
533
-			remove_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( EE_Registry::instance()->addons->{$class_name}, 'initialize_db_if_no_migrations_required' ) );
532
+			remove_action('deactivate_'.EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(), array(EE_Registry::instance()->addons->{$class_name}, 'deactivation'));
533
+			remove_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array(EE_Registry::instance()->addons->{$class_name}, 'initialize_db_if_no_migrations_required'));
534 534
 			unset(EE_Registry::instance()->addons->{$class_name});
535
-			unset( self::$_settings[ $addon_name ] );
535
+			unset(self::$_settings[$addon_name]);
536 536
 		}
537 537
 	}
538 538
 
Please login to merge, or discard this patch.
core/libraries/qtips/EE_Qtip_Config.lib.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -177,8 +177,9 @@  discard block
 block discarded – undo
177 177
 	protected function _construct_tips() {
178 178
 		foreach ( $this->_qtipsa as $qt ) {
179 179
 			//make sure we have what we need.
180
-			if ( !isset( $qt['content_id'] ) || !isset( $qt['target'] ) || !isset( $qt['content'] ) )
181
-				throw new EE_Error( sprintf( __('There is something wrong with the _qtipsa property setup for the %s qtip config class.  The dump of the current array index is: %s.<br /><br />Please check that it is setup correctly.', 'event_espresso'), get_class($this), var_export($qt, true) ) );
180
+			if ( !isset( $qt['content_id'] ) || !isset( $qt['target'] ) || !isset( $qt['content'] ) ) {
181
+							throw new EE_Error( sprintf( __('There is something wrong with the _qtipsa property setup for the %s qtip config class.  The dump of the current array index is: %s.<br /><br />Please check that it is setup correctly.', 'event_espresso'), get_class($this), var_export($qt, true) ) );
182
+			}
182 183
 
183 184
 			//make sure the options include defaults and just override via set config.
184 185
 			$options_override = isset( $qt['options'] ) ? (array) $qt['options'] : array();
@@ -266,8 +267,9 @@  discard block
 block discarded – undo
266 267
 
267 268
 	public function __construct( $setup_array ) {
268 269
 		foreach ( $setup_array as $prop => $value ) {
269
-			if ( EEH_Class_Tools::has_property( $this, $prop ) )
270
-				$this->{$prop} = $value;
270
+			if ( EEH_Class_Tools::has_property( $this, $prop ) ) {
271
+							$this->{$prop} = $value;
272
+			}
271 273
 		}
272 274
 	}
273 275
 }
274 276
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 				'event' => 'mouseleave', //similar as what you do for show.event.
143 143
 				'target' => false, //Options jQuery::#selector. which html element will trigger hide event. When false, the element the .qtip() method was called upon is used.
144 144
 				'delay' => 0, //set time in milliseconds for delaying the hide of the tooltip
145
-				'inactive' => false,  //if integer, time in millisecons in which the tooltip should be hidden if remains inactive (not interacted with)
145
+				'inactive' => false, //if integer, time in millisecons in which the tooltip should be hidden if remains inactive (not interacted with)
146 146
 				'fixed' => false, //when set to true, the tooltip will not hide if moused over.
147 147
 				'leave' => 'window', //specify whether the tooltip will hide when leaving the window it's conained within.
148 148
 				'distance' => false, //if integer, distance in pixels that the tooltip hides when the mouse is moved from the point it triggered the tooltip.
@@ -175,21 +175,21 @@  discard block
 block discarded – undo
175 175
 	 * @return void
176 176
 	 */
177 177
 	protected function _construct_tips() {
178
-		foreach ( $this->_qtipsa as $qt ) {
178
+		foreach ($this->_qtipsa as $qt) {
179 179
 			//make sure we have what we need.
180
-			if ( !isset( $qt['content_id'] ) || !isset( $qt['target'] ) || !isset( $qt['content'] ) )
181
-				throw new EE_Error( sprintf( __('There is something wrong with the _qtipsa property setup for the %s qtip config class.  The dump of the current array index is: %s.<br /><br />Please check that it is setup correctly.', 'event_espresso'), get_class($this), var_export($qt, true) ) );
180
+			if ( ! isset($qt['content_id']) || ! isset($qt['target']) || ! isset($qt['content']))
181
+				throw new EE_Error(sprintf(__('There is something wrong with the _qtipsa property setup for the %s qtip config class.  The dump of the current array index is: %s.<br /><br />Please check that it is setup correctly.', 'event_espresso'), get_class($this), var_export($qt, true)));
182 182
 
183 183
 			//make sure the options include defaults and just override via set config.
184
-			$options_override = isset( $qt['options'] ) ? (array) $qt['options'] : array();
185
-			$options = array_merge( $this->_default_options, $options_override );
184
+			$options_override = isset($qt['options']) ? (array) $qt['options'] : array();
185
+			$options = array_merge($this->_default_options, $options_override);
186 186
 			$setup = array(
187 187
 				'content_id' => $qt['content_id'],
188 188
 				'options' => $options,
189 189
 				'target' => $qt['target'],
190 190
 				'content' => $qt['content']
191 191
 				);
192
-			$this->_qtips[] = new EE_Qtip( $setup );
192
+			$this->_qtips[] = new EE_Qtip($setup);
193 193
 		}
194 194
 	}
195 195
 
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
 	public $target;
265 265
 	public $content;
266 266
 
267
-	public function __construct( $setup_array ) {
268
-		foreach ( $setup_array as $prop => $value ) {
269
-			if ( EEH_Class_Tools::has_property( $this, $prop ) )
267
+	public function __construct($setup_array) {
268
+		foreach ($setup_array as $prop => $value) {
269
+			if (EEH_Class_Tools::has_property($this, $prop))
270 270
 				$this->{$prop} = $value;
271 271
 		}
272 272
 	}
Please login to merge, or discard this patch.
core/libraries/rest_api/changes/Changes_In_4_8_33.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
 		//is for lower than 4.8.33
14 14
 		add_filter( 
15 15
 			'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes',
16
-			array( $this, 'remove_checkin_routes_earlier_than_4_8_33' ),
16
+			array($this, 'remove_checkin_routes_earlier_than_4_8_33'),
17 17
 			10,
18 18
 			2
19 19
 		);
20 20
 		add_filter( 
21 21
 			'FHEE__EventEspresso\core\libraries\rest_api\controllers\Base___get_headers_from_ee_notices__return',
22
-			array( $this, 'dont_add_headers_from_ee_notices' ),
22
+			array($this, 'dont_add_headers_from_ee_notices'),
23 23
 			10,
24 24
 			2
25 25
 		);
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 * @param string $version
33 33
 	 * @return array like $routes_on_this_version
34 34
 	 */
35
-	public function remove_checkin_routes_earlier_than_4_8_33( $routes_on_this_version, $version ) {
36
-		if( $this->applies_to_version(  $version ) ) {
37
-			unset( $routes_on_this_version[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] );
35
+	public function remove_checkin_routes_earlier_than_4_8_33($routes_on_this_version, $version) {
36
+		if ($this->applies_to_version($version)) {
37
+			unset($routes_on_this_version['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)']);
38 38
 		}
39 39
 		return $routes_on_this_version;
40 40
 	}
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	 * @param string $requested_version
46 46
 	 * @return array
47 47
 	 */
48
-	public function dont_add_headers_from_ee_notices( $headers_from_ee_notices, $requested_version ) {
49
-		if( $this->applies_to_version(  $requested_version ) ) {
48
+	public function dont_add_headers_from_ee_notices($headers_from_ee_notices, $requested_version) {
49
+		if ($this->applies_to_version($requested_version)) {
50 50
 			return array();
51 51
 		}
52 52
 		return $headers_from_ee_notices;
Please login to merge, or discard this patch.
core/libraries/rest_api/changes/Changes_In_Base.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 * @return boolean true: this class' name indicates its filters and actions
57 57
 	 * should take effect. False: this class' name indicates it shouldn't do anything
58 58
 	 */
59
-	public function applies_to_version( $requested_version ) {
60
-		if( $this->version() > $requested_version ) {
59
+	public function applies_to_version($requested_version) {
60
+		if ($this->version() > $requested_version) {
61 61
 			return true;
62 62
 		}
63 63
 		return false;
@@ -71,24 +71,24 @@  discard block
 block discarded – undo
71 71
 	 * @throws \EE_Error
72 72
 	 */
73 73
 	public function version() {
74
-		if( $this->_version === null ) {
74
+		if ($this->_version === null) {
75 75
 			$matches = array();
76 76
 			$regex = '~Changes_In_(.*)_(.*)_(.*)$~';
77 77
 			$success = preg_match(
78 78
 				$regex,
79
-				get_class( $this ),
79
+				get_class($this),
80 80
 				$matches
81 81
 			);
82
-			if( ! $success ) {
82
+			if ( ! $success) {
83 83
 				throw new \EE_Error(
84 84
 					sprintf(
85
-						__( 'The class %1$s was misnamed. It name should match the regex "%2$s"', 'event_espresso' ),
86
-						get_class( $this ),
85
+						__('The class %1$s was misnamed. It name should match the regex "%2$s"', 'event_espresso'),
86
+						get_class($this),
87 87
 						$regex
88 88
 					)
89 89
 				);
90 90
 			}
91
-			$this->_version = $matches[1] . '.' . $matches[2] . '.' . $matches[3];
91
+			$this->_version = $matches[1].'.'.$matches[2].'.'.$matches[3];
92 92
 		}
93 93
 		return $this->_version;
94 94
 	}
Please login to merge, or discard this patch.