Completed
Branch BUG-9715-shortcode-resources (0cf20f)
by
unknown
695:33 queued 678:11
created
core/EE_Request_Handler.core.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 	 *    remove param
352 352
 	 *
353 353
 	 * @access    public
354
-	 * @param $key
354
+	 * @param string $key
355 355
 	 * @return    void
356 356
 	 */
357 357
 	public function un_set( $key ) {
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	 *    add_output
392 392
 	 *
393 393
 	 * @access    public
394
-	 * @param $string
394
+	 * @param string $string
395 395
 	 * @return    void
396 396
 	 */
397 397
 	public function add_output( $string ) {
@@ -456,14 +456,14 @@  discard block
 block discarded – undo
456 456
 
457 457
 
458 458
 	/**
459
-	 * @return bool
459
+	 * @return boolean|null
460 460
 	 */
461 461
 	public function __clone() {}
462 462
 
463 463
 
464 464
 
465 465
 	/**
466
-	 * @return bool
466
+	 * @return boolean|null
467 467
 	 */
468 468
 	public function __wakeup() {}
469 469
 
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
2 2
 /**
3 3
  * class EE_Request_Handler
4 4
  *
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 	 * @param  EE_Request $request
51 51
 	 * @return \EE_Request_Handler
52 52
 	 */
53
-	public function __construct( EE_Request $request ) {
53
+	public function __construct(EE_Request $request) {
54 54
 		// grab request vars
55 55
 		$this->_params = $request->params();
56 56
 		// AJAX ???
57
-		$this->ajax = defined( 'DOING_AJAX' ) && DOING_AJAX ? true : false;
58
-		$this->front_ajax = defined( 'EE_FRONT_AJAX' ) && EE_FRONT_AJAX ? true : false;
59
-		do_action( 'AHEE__EE_Request_Handler__construct__complete' );
57
+		$this->ajax = defined('DOING_AJAX') && DOING_AJAX ? true : false;
58
+		$this->front_ajax = defined('EE_FRONT_AJAX') && EE_FRONT_AJAX ? true : false;
59
+		do_action('AHEE__EE_Request_Handler__construct__complete');
60 60
 	}
61 61
 
62 62
 
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
 	 * @param WP $wp
69 69
 	 * @return void
70 70
 	 */
71
-	public function parse_request( $wp = null ) {
71
+	public function parse_request($wp = null) {
72 72
 		//if somebody forgot to provide us with WP, that's ok because its global
73
-		if ( ! $wp instanceof WP ) {
73
+		if ( ! $wp instanceof WP) {
74 74
 			global $wp;
75 75
 		}
76
-		$this->set_request_vars( $wp );
76
+		$this->set_request_vars($wp);
77 77
 	}
78 78
 
79 79
 
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
 	 * @param WP $wp
86 86
 	 * @return void
87 87
 	 */
88
-	public function set_request_vars( $wp = null ) {
89
-		if ( ! is_admin() ) {
88
+	public function set_request_vars($wp = null) {
89
+		if ( ! is_admin()) {
90 90
 			// set request post_id
91
-			$this->set( 'post_id', $this->get_post_id_from_request( $wp ));
91
+			$this->set('post_id', $this->get_post_id_from_request($wp));
92 92
 			// set request post name
93
-			$this->set( 'post_name', $this->get_post_name_from_request( $wp ));
93
+			$this->set('post_name', $this->get_post_name_from_request($wp));
94 94
 			// set request post_type
95
-			$this->set( 'post_type', $this->get_post_type_from_request( $wp ));
95
+			$this->set('post_type', $this->get_post_type_from_request($wp));
96 96
 			// true or false ? is this page being used by EE ?
97 97
 			$this->set_espresso_page();
98 98
 		}
@@ -107,19 +107,19 @@  discard block
 block discarded – undo
107 107
 	 * @param WP $wp
108 108
 	 * @return int
109 109
 	 */
110
-	public function get_post_id_from_request( $wp = null ) {
111
-		if ( ! $wp instanceof WP ){
110
+	public function get_post_id_from_request($wp = null) {
111
+		if ( ! $wp instanceof WP) {
112 112
 			global $wp;
113 113
 		}
114 114
 		$post_id = null;
115
-		if ( isset( $wp->query_vars['p'] )) {
115
+		if (isset($wp->query_vars['p'])) {
116 116
 			$post_id = $wp->query_vars['p'];
117 117
 		}
118
-		if ( ! $post_id && isset( $wp->query_vars['page_id'] )) {
118
+		if ( ! $post_id && isset($wp->query_vars['page_id'])) {
119 119
 			$post_id = $wp->query_vars['page_id'];
120 120
 		}
121
-		if ( ! $post_id && isset( $wp->request ) && is_numeric( basename( $wp->request ))) {
122
-			$post_id = basename( $wp->request );
121
+		if ( ! $post_id && isset($wp->request) && is_numeric(basename($wp->request))) {
122
+			$post_id = basename($wp->request);
123 123
 		}
124 124
 		return $post_id;
125 125
 	}
@@ -133,35 +133,35 @@  discard block
 block discarded – undo
133 133
 	 * @param WP $wp
134 134
 	 * @return string
135 135
 	 */
136
-	public function get_post_name_from_request( $wp = null ) {
137
-		if ( ! $wp instanceof WP ){
136
+	public function get_post_name_from_request($wp = null) {
137
+		if ( ! $wp instanceof WP) {
138 138
 			global $wp;
139 139
 		}
140 140
 		$post_name = null;
141
-		if ( isset( $wp->query_vars['name'] ) && ! empty( $wp->query_vars['name'] )) {
141
+		if (isset($wp->query_vars['name']) && ! empty($wp->query_vars['name'])) {
142 142
 			$post_name = $wp->query_vars['name'];
143 143
 		}
144
-		if ( ! $post_name && isset( $wp->query_vars['pagename'] ) && ! empty( $wp->query_vars['pagename'] )) {
144
+		if ( ! $post_name && isset($wp->query_vars['pagename']) && ! empty($wp->query_vars['pagename'])) {
145 145
 			$post_name = $wp->query_vars['pagename'];
146 146
 		}
147
-		if ( ! $post_name && isset( $wp->request ) && ! empty( $wp->request )) {
148
-			$possible_post_name = basename( $wp->request );
149
-			if ( ! is_numeric( $possible_post_name )) {
147
+		if ( ! $post_name && isset($wp->request) && ! empty($wp->request)) {
148
+			$possible_post_name = basename($wp->request);
149
+			if ( ! is_numeric($possible_post_name)) {
150 150
 				/** @type WPDB $wpdb */
151 151
 				global $wpdb;
152 152
 				$SQL = "SELECT ID from $wpdb->posts WHERE post_status='publish' AND post_name=%s";
153
-				$possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $possible_post_name ));
154
-				if ( $possible_post_name ) {
153
+				$possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $possible_post_name));
154
+				if ($possible_post_name) {
155 155
 					$post_name = $possible_post_name;
156 156
 				}
157 157
 			}
158 158
 		}
159
-		if ( ! $post_name && $this->get( 'post_id' )) {
159
+		if ( ! $post_name && $this->get('post_id')) {
160 160
 			/** @type WPDB $wpdb */
161 161
 			global $wpdb;
162 162
 			$SQL = "SELECT post_name from $wpdb->posts WHERE post_status='publish' AND ID=%d";
163
-			$possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $this->get( 'post_id' )));
164
-			if( $possible_post_name ) {
163
+			$possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $this->get('post_id')));
164
+			if ($possible_post_name) {
165 165
 				$post_name = $possible_post_name;
166 166
 			}
167 167
 		}
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 	 * @param WP $wp
178 178
 	 * @return mixed
179 179
 	 */
180
-	public function get_post_type_from_request( $wp = null ) {
181
-		if ( ! $wp instanceof WP ){
180
+	public function get_post_type_from_request($wp = null) {
181
+		if ( ! $wp instanceof WP) {
182 182
 			global $wp;
183 183
 		}
184
-		return isset( $wp->query_vars['post_type'] ) ? $wp->query_vars['post_type'] : null;
184
+		return isset($wp->query_vars['post_type']) ? $wp->query_vars['post_type'] : null;
185 185
 	}
186 186
 
187 187
 
@@ -191,18 +191,18 @@  discard block
 block discarded – undo
191 191
 	 * @param  WP $wp
192 192
 	 * @return bool|string|void
193 193
 	 */
194
-	public function get_current_page_permalink( $wp = null ) {
195
-		$post_id = $this->get_post_id_from_request( $wp );
196
-		if ( $post_id ) {
197
-			$current_page_permalink = get_permalink( $post_id );
194
+	public function get_current_page_permalink($wp = null) {
195
+		$post_id = $this->get_post_id_from_request($wp);
196
+		if ($post_id) {
197
+			$current_page_permalink = get_permalink($post_id);
198 198
 		} else {
199
-			if ( ! $wp instanceof WP ) {
199
+			if ( ! $wp instanceof WP) {
200 200
 				global $wp;
201 201
 			}
202
-			if ( $wp->request ) {
203
-				$current_page_permalink = site_url( $wp->request );
202
+			if ($wp->request) {
203
+				$current_page_permalink = site_url($wp->request);
204 204
 			} else {
205
-				$current_page_permalink = esc_url( site_url( $_SERVER[ 'REQUEST_URI' ] ) );
205
+				$current_page_permalink = esc_url(site_url($_SERVER['REQUEST_URI']));
206 206
 			}
207 207
 		}
208 208
 		return $current_page_permalink;
@@ -219,41 +219,41 @@  discard block
 block discarded – undo
219 219
 	public function test_for_espresso_page() {
220 220
 		global $wp;
221 221
 		/** @type EE_CPT_Strategy $EE_CPT_Strategy */
222
-		$EE_CPT_Strategy = EE_Registry::instance()->load_core( 'CPT_Strategy' );
222
+		$EE_CPT_Strategy = EE_Registry::instance()->load_core('CPT_Strategy');
223 223
 		$espresso_CPT_taxonomies = $EE_CPT_Strategy->get_CPT_taxonomies();
224
-		if ( is_array( $espresso_CPT_taxonomies ) ) {
225
-			foreach ( $espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details ) {
226
-				if ( isset( $wp->query_vars, $wp->query_vars[ $espresso_CPT_taxonomy ] ) ) {
224
+		if (is_array($espresso_CPT_taxonomies)) {
225
+			foreach ($espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details) {
226
+				if (isset($wp->query_vars, $wp->query_vars[$espresso_CPT_taxonomy])) {
227 227
 					return true;
228 228
 				}
229 229
 			}
230 230
 		}
231 231
 		// load espresso CPT endpoints
232 232
 		$espresso_CPT_endpoints = $EE_CPT_Strategy->get_CPT_endpoints();
233
-		$post_type_CPT_endpoints = array_flip( $espresso_CPT_endpoints );
234
-		$post_types = (array)$this->get( 'post_type' );
235
-		foreach ( $post_types as $post_type ) {
233
+		$post_type_CPT_endpoints = array_flip($espresso_CPT_endpoints);
234
+		$post_types = (array) $this->get('post_type');
235
+		foreach ($post_types as $post_type) {
236 236
 			// was a post name passed ?
237
-			if ( isset( $post_type_CPT_endpoints[ $post_type ] ) ) {
237
+			if (isset($post_type_CPT_endpoints[$post_type])) {
238 238
 				// kk we know this is an espresso page, but is it a specific post ?
239
-				if ( ! $this->get( 'post_name' ) ) {
239
+				if ( ! $this->get('post_name')) {
240 240
 					// there's no specific post name set, so maybe it's one of our endpoints like www.domain.com/events
241
-					$post_name = isset( $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] ) ? $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] : null;
241
+					$post_name = isset($post_type_CPT_endpoints[$this->get('post_type')]) ? $post_type_CPT_endpoints[$this->get('post_type')] : null;
242 242
 					// if the post type matches on of our then set the endpoint
243
-					if ( $post_name ) {
244
-						$this->set( 'post_name', $post_name );
243
+					if ($post_name) {
244
+						$this->set('post_name', $post_name);
245 245
 					}
246 246
 				}
247 247
 				return true;
248 248
 			}
249 249
 		}
250
-		if ( $this->get( 'post_name' )) {
250
+		if ($this->get('post_name')) {
251 251
 			// load all pages using espresso shortcodes
252
-			$post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
252
+			$post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
253 253
 			// make sure core pages are included
254
-			$espresso_pages = array_merge( $espresso_CPT_endpoints, $post_shortcodes );
254
+			$espresso_pages = array_merge($espresso_CPT_endpoints, $post_shortcodes);
255 255
 			// was a post name passed ?
256
-			if (  isset( $espresso_pages[ $this->get( 'post_name' ) ] )) {
256
+			if (isset($espresso_pages[$this->get('post_name')])) {
257 257
 				 return true;
258 258
 			}
259 259
 		}
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 * @param null|bool $value
270 270
 	 * @return    mixed
271 271
 	 */
272
-	public function set_espresso_page( $value = null ) {
272
+	public function set_espresso_page($value = null) {
273 273
 		$value = $value ? $value : $this->test_for_espresso_page();
274 274
 		$this->_params['is_espresso_page'] = $value;
275 275
 	}
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	 *  @return 	mixed
284 284
 	 */
285 285
 	public function is_espresso_page() {
286
-		return isset( $this->_params['is_espresso_page'] ) ? $this->_params['is_espresso_page'] : false;
286
+		return isset($this->_params['is_espresso_page']) ? $this->_params['is_espresso_page'] : false;
287 287
 	}
288 288
 
289 289
 
@@ -307,14 +307,14 @@  discard block
 block discarded – undo
307 307
 	 * @param bool $override_ee
308 308
 	 * @return    void
309 309
 	 */
310
-	public function set( $key, $value, $override_ee = false ) {
310
+	public function set($key, $value, $override_ee = false) {
311 311
 		// don't allow "ee" to be overwritten unless explicitly instructed to do so
312 312
 		if (
313 313
 			$key !== 'ee' ||
314
-			( $key === 'ee' && empty( $this->_params['ee'] ))
315
-			|| ( $key === 'ee' && ! empty( $this->_params['ee'] ) && $override_ee )
314
+			($key === 'ee' && empty($this->_params['ee']))
315
+			|| ($key === 'ee' && ! empty($this->_params['ee']) && $override_ee)
316 316
 		) {
317
-			$this->_params[ $key ] = $value;
317
+			$this->_params[$key] = $value;
318 318
 		}
319 319
 	}
320 320
 
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 	 * @param null $default
329 329
 	 * @return    mixed
330 330
 	 */
331
-	public function get( $key, $default = null ) {
332
-		return isset( $this->_params[ $key ] ) ? $this->_params[ $key ] : $default;
331
+	public function get($key, $default = null) {
332
+		return isset($this->_params[$key]) ? $this->_params[$key] : $default;
333 333
 	}
334 334
 
335 335
 
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 	 * @param $key
342 342
 	 * @return    boolean
343 343
 	 */
344
-	public function is_set( $key ) {
345
-		return isset( $this->_params[ $key ] ) ? true : false;
344
+	public function is_set($key) {
345
+		return isset($this->_params[$key]) ? true : false;
346 346
 	}
347 347
 
348 348
 
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 	 * @param $key
355 355
 	 * @return    void
356 356
 	 */
357
-	public function un_set( $key ) {
358
-		unset( $this->_params[ $key ] );
357
+	public function un_set($key) {
358
+		unset($this->_params[$key]);
359 359
 	}
360 360
 
361 361
 
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
 	 * @param $value
369 369
 	 * @return    void
370 370
 	 */
371
-	public function set_notice( $key, $value ) {
372
-		$this->_notice[ $key ] = $value;
371
+	public function set_notice($key, $value) {
372
+		$this->_notice[$key] = $value;
373 373
 	}
374 374
 
375 375
 
@@ -381,8 +381,8 @@  discard block
 block discarded – undo
381 381
 	 * @param $key
382 382
 	 * @return    mixed
383 383
 	 */
384
-	public function get_notice( $key ) {
385
-		return isset( $this->_notice[ $key ] ) ? $this->_notice[ $key ] : null;
384
+	public function get_notice($key) {
385
+		return isset($this->_notice[$key]) ? $this->_notice[$key] : null;
386 386
 	}
387 387
 
388 388
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 	 * @param $string
395 395
 	 * @return    void
396 396
 	 */
397
-	public function add_output( $string ) {
397
+	public function add_output($string) {
398 398
 		$this->_output .= $string;
399 399
 	}
400 400
 
@@ -416,8 +416,8 @@  discard block
 block discarded – undo
416 416
 	 * @param $item
417 417
 	 * @param $key
418 418
 	 */
419
-	public function sanitize_text_field_for_array_walk( &$item, &$key ) {
420
-		$item = strpos( $item, 'email' ) !== false ? sanitize_email( $item ) : sanitize_text_field( $item );
419
+	public function sanitize_text_field_for_array_walk(&$item, &$key) {
420
+		$item = strpos($item, 'email') !== false ? sanitize_email($item) : sanitize_text_field($item);
421 421
 	}
422 422
 
423 423
 
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 	 * @param $b
428 428
 	 * @return bool
429 429
 	 */
430
-	public function __set($a,$b) { return false; }
430
+	public function __set($a, $b) { return false; }
431 431
 
432 432
 
433 433
 
Please login to merge, or discard this patch.
shortcodes/espresso_thank_you/EES_Espresso_Thank_You.shortcode.php 1 patch
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @return    void
92 92
 	 */
93 93
 	public static function set_hooks() {
94
-		add_action( 'wp_loaded', array( 'EES_Espresso_Thank_You', 'set_definitions' ), 2 );
94
+		add_action('wp_loaded', array('EES_Espresso_Thank_You', 'set_definitions'), 2);
95 95
 	}
96 96
 
97 97
 
@@ -104,22 +104,22 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public static function set_hooks_admin() {
106 106
 		// AJAX for IPN monitoring
107
-		add_filter( 'heartbeat_received', array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ), 10, 3 );
107
+		add_filter('heartbeat_received', array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'), 10, 3);
108 108
 		add_filter(
109 109
 			'heartbeat_nopriv_received',
110
-			array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ),
110
+			array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'),
111 111
 			10,
112 112
 			3
113 113
 		);
114 114
 		add_action(
115 115
 			'wp_ajax_espresso_resend_reg_confirmation_email',
116
-			array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ),
116
+			array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'),
117 117
 			10,
118 118
 			2
119 119
 		);
120 120
 		add_action(
121 121
 			'wp_ajax_nopriv_espresso_resend_reg_confirmation_email',
122
-			array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ),
122
+			array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'),
123 123
 			10,
124 124
 			2
125 125
 		);
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 	 * @return    void
135 135
 	 */
136 136
 	public static function set_definitions() {
137
-		define( 'THANK_YOU_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
138
-		define( 'THANK_YOU_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ ) ) . 'templates' . DS );
137
+		define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
138
+		define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
139 139
 	}
140 140
 
141 141
 
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
 	 * @return    EE_Transaction
148 148
 	 */
149 149
 	public function get_txn() {
150
-		if ( $this->_current_txn instanceof EE_Transaction ) {
150
+		if ($this->_current_txn instanceof EE_Transaction) {
151 151
 			return $this->_current_txn;
152 152
 		}
153
-		$TXN_model = EE_Registry::instance()->load_model( 'Transaction' );
154
-		if ( ! $TXN_model instanceof EEM_Transaction ) {
153
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
154
+		if ( ! $TXN_model instanceof EEM_Transaction) {
155 155
 			EE_Error::add_error(
156
-				__( 'The transaction model could not be established.', 'event_espresso' ),
156
+				__('The transaction model could not be established.', 'event_espresso'),
157 157
 				__FILE__,
158 158
 				__FUNCTION__,
159 159
 				__LINE__
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
 			return null;
162 162
 		}
163 163
 		//get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request
164
-		$this->_current_txn = $TXN_model->get_transaction_from_reg_url_link( $this->_reg_url_link );
164
+		$this->_current_txn = $TXN_model->get_transaction_from_reg_url_link($this->_reg_url_link);
165 165
 		// verify TXN
166
-		if ( WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction ) {
166
+		if (WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction) {
167 167
 			EE_Error::add_error(
168 168
 				__(
169 169
 					'No transaction information could be retrieved or the transaction data is not of the correct type.',
@@ -187,16 +187,16 @@  discard block
 block discarded – undo
187 187
 	 * @param int $since
188 188
 	 * @return    mixed array of EE_Payment || FALSE
189 189
 	 */
190
-	public function get_txn_payments( $since = 0 ) {
191
-		if ( ! $this->get_txn() ) {
190
+	public function get_txn_payments($since = 0) {
191
+		if ( ! $this->get_txn()) {
192 192
 			return false;
193 193
 		}
194
-		$args = array( 'order_by' => array( 'PAY_timestamp' => 'ASC' ) );
195
-		if ( $since > 0 ) {
196
-			$args[0] = array( 'PAY_timestamp' => array( '>', $since ) );
194
+		$args = array('order_by' => array('PAY_timestamp' => 'ASC'));
195
+		if ($since > 0) {
196
+			$args[0] = array('PAY_timestamp' => array('>', $since));
197 197
 		}
198 198
 		// get array of payments with most recent first
199
-		return $this->_current_txn->payments( $args );
199
+		return $this->_current_txn->payments($args);
200 200
 	}
201 201
 
202 202
 
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
 	 * @return    void
209 209
 	 */
210 210
 	private function _get_reg_url_link() {
211
-		if ( ! empty( $this->_reg_url_link ) ) {
211
+		if ( ! empty($this->_reg_url_link)) {
212 212
 			return;
213 213
 		}
214 214
 		// only do thank you page stuff if we have a REG_url_link in the url
215
-		if ( WP_DEBUG && ! EE_Registry::instance()->REQ->is_set( 'e_reg_url_link' ) ) {
215
+		if (WP_DEBUG && ! EE_Registry::instance()->REQ->is_set('e_reg_url_link')) {
216 216
 			EE_Error::add_error(
217 217
 				__(
218 218
 					'No transaction information could be retrieved because the registration URL link is missing or invalid.',
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 			return;
226 226
 		}
227 227
 		// check for reg_url_link
228
-		$this->_reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link' );
228
+		$this->_reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link');
229 229
 	}
230 230
 
231 231
 
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 	 * @param    string $reg_url_link
238 238
 	 * @return    string
239 239
 	 */
240
-	public function set_reg_url_link( $reg_url_link = null ) {
241
-		$this->_reg_url_link = ! empty( $reg_url_link ) ? $reg_url_link : $this->_reg_url_link;
240
+	public function set_reg_url_link($reg_url_link = null) {
241
+		$this->_reg_url_link = ! empty($reg_url_link) ? $reg_url_link : $this->_reg_url_link;
242 242
 	}
243 243
 
244 244
 
@@ -251,28 +251,28 @@  discard block
 block discarded – undo
251 251
 	 * @param    WP $WP
252 252
 	 * @return    void
253 253
 	 */
254
-	public function run( WP $WP ) {
254
+	public function run(WP $WP) {
255 255
 		// remove site_url() from thank you page URL
256
-		$thank_you_page_URL = substr( EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen( home_url() ) );
256
+		$thank_you_page_URL = substr(EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen(home_url()));
257 257
 		// remove other non-essential details from URL
258
-		$thank_you_page_URL = trim( parse_url( $thank_you_page_URL, PHP_URL_PATH ), '/' );
258
+		$thank_you_page_URL = trim(parse_url($thank_you_page_URL, PHP_URL_PATH), '/');
259 259
 		// ensure this shortcode doesn't trigger on anything BUT the thank you page
260
-		if ( isset( $WP->request ) && trim( $WP->request, '/' ) !== $thank_you_page_URL ) {
260
+		if (isset($WP->request) && trim($WP->request, '/') !== $thank_you_page_URL) {
261 261
 			return;
262 262
 		} else if (
263
-			isset( $WP->query_vars['page_id'] )
264
-			&& (int)$WP->query_vars['page_id'] !== (int)EE_Registry::instance()->CFG->core->thank_you_page_id
263
+			isset($WP->query_vars['page_id'])
264
+			&& (int) $WP->query_vars['page_id'] !== (int) EE_Registry::instance()->CFG->core->thank_you_page_id
265 265
 		) {
266 266
 			return;
267 267
 		}
268 268
 		$this->_get_reg_url_link();
269 269
 		// resend_reg_confirmation_email ?
270
-		if ( EE_Registry::instance()->REQ->is_set( 'resend' ) ) {
270
+		if (EE_Registry::instance()->REQ->is_set('resend')) {
271 271
 			EES_Espresso_Thank_You::resend_reg_confirmation_email();
272 272
 		}
273 273
 		// load assets
274
-		add_action( 'wp_enqueue_scripts', array( $this, 'load_js' ), 10 );
275
-		EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
274
+		add_action('wp_enqueue_scripts', array($this, 'load_js'), 10);
275
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
276 276
 		$this->_translate_strings();
277 277
 	}
278 278
 
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 	public function load_js() {
327 327
 		wp_register_script(
328 328
 			'thank_you_page',
329
-			THANK_YOU_ASSETS_URL . 'thank_you_page.js',
330
-			array( 'espresso_core', 'heartbeat' ),
329
+			THANK_YOU_ASSETS_URL.'thank_you_page.js',
330
+			array('espresso_core', 'heartbeat'),
331 331
 			EVENT_ESPRESSO_VERSION,
332 332
 			true
333 333
 		);
334
-		wp_enqueue_script( 'thank_you_page' );
334
+		wp_enqueue_script('thank_you_page');
335 335
 	}
336 336
 
337 337
 
@@ -345,9 +345,9 @@  discard block
 block discarded – undo
345 345
 	 */
346 346
 	public function init() {
347 347
 		$this->_get_reg_url_link();
348
-		if ( ! $this->get_txn() ) {
348
+		if ( ! $this->get_txn()) {
349 349
 			echo EEH_HTML::div(
350
-				EEH_HTML::h4( __( 'We\'re sorry...', 'event_espresso' ), '', '' ) .
350
+				EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '').
351 351
 				sprintf(
352 352
 					__(
353 353
 						'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s',
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
 			return null;
362 362
 		}
363 363
 		// if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete"
364
-		if ( $this->_current_txn->status_ID() === EEM_Transaction::failed_status_code ) {
365
-			$this->_current_txn->set_status( EEM_Transaction::incomplete_status_code );
364
+		if ($this->_current_txn->status_ID() === EEM_Transaction::failed_status_code) {
365
+			$this->_current_txn->set_status(EEM_Transaction::incomplete_status_code);
366 366
 			$this->_current_txn->save();
367 367
 		}
368 368
 		$this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration
@@ -375,15 +375,15 @@  discard block
 block discarded – undo
375 375
 		);
376 376
 		$this->_show_try_pay_again_link = $show_try_pay_again_link_default;
377 377
 		// txn status ?
378
-		if ( $this->_current_txn->is_completed() ) {
378
+		if ($this->_current_txn->is_completed()) {
379 379
 			$this->_show_try_pay_again_link = $show_try_pay_again_link_default;
380 380
 		} else if (
381 381
 			$this->_current_txn->is_incomplete()
382
-			&& ( $this->_primary_registrant->is_approved()
383
-			|| $this->_primary_registrant->is_pending_payment() )
382
+			&& ($this->_primary_registrant->is_approved()
383
+			|| $this->_primary_registrant->is_pending_payment())
384 384
 		) {
385 385
 			$this->_show_try_pay_again_link = true;
386
-		} else if ( $this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment() ) {
386
+		} else if ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) {
387 387
 			// its pending
388 388
 			$this->_show_try_pay_again_link = isset(
389 389
 				EE_Registry::instance()->CFG->registration->show_pending_payment_options
@@ -409,21 +409,21 @@  discard block
 block discarded – undo
409 409
 		}
410 410
 		// link to SPCO
411 411
 		$revisit_spco_url = add_query_arg(
412
-			array( 'ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link ),
412
+			array('ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link),
413 413
 			EE_Registry::instance()->CFG->core->reg_page_url()
414 414
 		);
415 415
 		// link to SPCO payment_options
416 416
 		$this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration
417 417
 			? $this->_primary_registrant->payment_overview_url()
418 418
 			: add_query_arg(
419
-				array( 'step' => 'payment_options' ),
419
+				array('step' => 'payment_options'),
420 420
 				$revisit_spco_url
421 421
 			);
422 422
 		// link to SPCO attendee_information
423 423
 		$this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration
424 424
 			? $this->_primary_registrant->edit_attendee_information_url()
425 425
 			: false;
426
-		do_action( 'AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn );
426
+		do_action('AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn);
427 427
 		// set no cache headers and constants
428 428
 		EE_System::do_not_cache();
429 429
 	}
@@ -438,15 +438,15 @@  discard block
 block discarded – undo
438 438
 	 * @return    string
439 439
 	 * @throws \EE_Error
440 440
 	 */
441
-	public function process_shortcode( $attributes = array() ) {
441
+	public function process_shortcode($attributes = array()) {
442 442
 		$this->init();
443
-		if ( ! $this->_current_txn instanceof EE_Transaction ) {
443
+		if ( ! $this->_current_txn instanceof EE_Transaction) {
444 444
 			return EE_Error::get_notices();
445 445
 		}
446 446
 		//EEH_Debug_Tools::log( __CLASS__, __FUNCTION__, __LINE__, array( $this->_current_txn ), true, 	'EE_Transaction: ' . $this->_current_txn->ID() );
447 447
 		// link to receipt
448
-		$template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url( 'html' );
449
-		if ( ! empty( $template_args['TXN_receipt_url'] ) ) {
448
+		$template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html');
449
+		if ( ! empty($template_args['TXN_receipt_url'])) {
450 450
 			$template_args['order_conf_desc'] = __(
451 451
 				'%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.',
452 452
 				'event_espresso'
@@ -458,13 +458,13 @@  discard block
 block discarded – undo
458 458
 			);
459 459
 		}
460 460
 		$template_args['transaction'] = $this->_current_txn;
461
-		$template_args['revisit'] = EE_Registry::instance()->REQ->get( 'revisit', false );
462
-		add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_registration_details' ) );
463
-		if ( $this->_is_primary && ! $this->_current_txn->is_free() ) {
464
-			add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_ajax_content' ) );
461
+		$template_args['revisit'] = EE_Registry::instance()->REQ->get('revisit', false);
462
+		add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details'));
463
+		if ($this->_is_primary && ! $this->_current_txn->is_free()) {
464
+			add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content'));
465 465
 		}
466 466
 		return EEH_Template::locate_template(
467
-			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php',
467
+			THANK_YOU_TEMPLATES_PATH.'thank-you-page-overview.template.php',
468 468
 			$template_args,
469 469
 			true,
470 470
 			true
@@ -485,15 +485,15 @@  discard block
 block discarded – undo
485 485
 	 * @return    array
486 486
 	 * @throws \EE_Error
487 487
 	 */
488
-	public static function thank_you_page_IPN_monitor( $response = array(), $data = array() ) {
488
+	public static function thank_you_page_IPN_monitor($response = array(), $data = array()) {
489 489
 		// does this heartbeat contain our data ?
490
-		if ( ! isset( $data['espresso_thank_you_page'] ) ) {
490
+		if ( ! isset($data['espresso_thank_you_page'])) {
491 491
 			return $response;
492 492
 		}
493 493
 		// check for reg_url_link in the incoming heartbeat data
494
-		if ( ! isset( $data['espresso_thank_you_page']['e_reg_url_link'] ) ) {
494
+		if ( ! isset($data['espresso_thank_you_page']['e_reg_url_link'])) {
495 495
 			$response['espresso_thank_you_page'] = array(
496
-			'errors' => ! empty( $notices['errors'] )
496
+			'errors' => ! empty($notices['errors'])
497 497
 				? $notices['errors']
498 498
 				: __(
499 499
 					'No transaction information could be retrieved because the registration URL link is missing or invalid.',
@@ -508,15 +508,15 @@  discard block
 block discarded – undo
508 508
 		EES_Espresso_Thank_You::set_definitions();
509 509
 		/** @var $espresso_thank_you_page EES_Espresso_Thank_You */
510 510
 		$espresso_thank_you_page = EES_Espresso_Thank_You::instance();
511
-		$espresso_thank_you_page->set_reg_url_link( $data['espresso_thank_you_page']['e_reg_url_link'] );
511
+		$espresso_thank_you_page->set_reg_url_link($data['espresso_thank_you_page']['e_reg_url_link']);
512 512
 		$espresso_thank_you_page->init();
513 513
 		//get TXN
514 514
 		$TXN = $espresso_thank_you_page->get_txn();
515 515
 		// no TXN? then get out
516
-		if ( ! $TXN instanceof EE_Transaction ) {
516
+		if ( ! $TXN instanceof EE_Transaction) {
517 517
 			$notices = EE_Error::get_notices();
518 518
 			$response['espresso_thank_you_page'] = array(
519
-			'errors' => ! empty( $notices['errors'] )
519
+			'errors' => ! empty($notices['errors'])
520 520
 				? $notices['errors']
521 521
 				: sprintf(
522 522
 					__(
@@ -529,13 +529,13 @@  discard block
 block discarded – undo
529 529
 			return $response;
530 530
 		}
531 531
 		// grab transient of TXN's status
532
-		$txn_status = isset( $data['espresso_thank_you_page']['txn_status'] )
532
+		$txn_status = isset($data['espresso_thank_you_page']['txn_status'])
533 533
 			? $data['espresso_thank_you_page']['txn_status']
534 534
 			: null;
535 535
 		// has the TXN status changed since we last checked (or empty because this is the first time running through this code)?
536
-		if ( $txn_status !== $TXN->status_ID() ) {
536
+		if ($txn_status !== $TXN->status_ID()) {
537 537
 			// switch between two possible basic outcomes
538
-			switch ( $TXN->status_ID() ) {
538
+			switch ($TXN->status_ID()) {
539 539
 				// TXN has been updated in some way
540 540
 				case EEM_Transaction::overpaid_status_code:
541 541
 				case EEM_Transaction::complete_status_code:
@@ -550,25 +550,25 @@  discard block
 block discarded – undo
550 550
 				case EEM_Transaction::failed_status_code:
551 551
 				default:
552 552
 					// keep on waiting...
553
-					return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] );
553
+					return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']);
554 554
 			}
555 555
 			// or is the TXN still failed (never been updated) ???
556
-		} else if ( $TXN->failed() ) {
556
+		} else if ($TXN->failed()) {
557 557
 			// keep on waiting...
558
-			return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] );
558
+			return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']);
559 559
 		}
560 560
 		// TXN is happening so let's get the payments now
561 561
 		// if we've already gotten payments then the heartbeat data will contain the timestamp of the last time we checked
562
-		$since = isset( $data['espresso_thank_you_page']['get_payments_since'] )
562
+		$since = isset($data['espresso_thank_you_page']['get_payments_since'])
563 563
 			? $data['espresso_thank_you_page']['get_payments_since']
564 564
 			: 0;
565 565
 		// then check for payments
566
-		$payments = $espresso_thank_you_page->get_txn_payments( $since );
566
+		$payments = $espresso_thank_you_page->get_txn_payments($since);
567 567
 		// has a payment been processed ?
568
-		if ( ! empty( $payments ) || $espresso_thank_you_page->_is_offline_payment_method ) {
569
-			if ( $since ) {
568
+		if ( ! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) {
569
+			if ($since) {
570 570
 				$response['espresso_thank_you_page'] = array(
571
-					'new_payments'        => $espresso_thank_you_page->get_new_payments( $payments ),
571
+					'new_payments'        => $espresso_thank_you_page->get_new_payments($payments),
572 572
 					'transaction_details' => $espresso_thank_you_page->get_transaction_details(),
573 573
 					'txn_status'          => $TXN->status_ID()
574 574
 				);
@@ -594,9 +594,9 @@  discard block
 block discarded – undo
594 594
 	 * @param    array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data
595 595
 	 * @return    array
596 596
 	 */
597
-	private function _update_server_wait_time( $thank_you_page_data = array() ) {
597
+	private function _update_server_wait_time($thank_you_page_data = array()) {
598 598
 		$response['espresso_thank_you_page'] = array(
599
-			'still_waiting' => isset( $thank_you_page_data['initial_access'] )
599
+			'still_waiting' => isset($thank_you_page_data['initial_access'])
600 600
 				? time() - $thank_you_page_data['initial_access']
601 601
 				: 0,
602 602
 			'txn_status'    => $this->_current_txn->status_ID()
@@ -621,17 +621,17 @@  discard block
 block discarded – undo
621 621
 		$template_args['is_primary'] = $this->_is_primary;
622 622
 		$template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url;
623 623
 		$template_args['resend_reg_confirmation_url'] = add_query_arg(
624
-			array( 'token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true' ),
624
+			array('token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true'),
625 625
 			EE_Registry::instance()->CFG->core->thank_you_page_url()
626 626
 		);
627 627
 		// verify template arguments
628
-		EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' );
628
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
629 629
 		EEH_Template_Validator::verify_isnt_null(
630 630
 			$template_args['SPCO_attendee_information_url'],
631 631
 			'$SPCO_attendee_information_url'
632 632
 		);
633 633
 		echo EEH_Template::locate_template(
634
-			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php',
634
+			THANK_YOU_TEMPLATES_PATH.'thank-you-page-registration-details.template.php',
635 635
 			$template_args,
636 636
 			true,
637 637
 			true
@@ -644,16 +644,16 @@  discard block
 block discarded – undo
644 644
 	 *    resend_reg_confirmation_email
645 645
 	 */
646 646
 	public static function resend_reg_confirmation_email() {
647
-		EE_Registry::instance()->load_core( 'Request_Handler' );
648
-		$reg_url_link = EE_Registry::instance()->REQ->get( 'token' );
647
+		EE_Registry::instance()->load_core('Request_Handler');
648
+		$reg_url_link = EE_Registry::instance()->REQ->get('token');
649 649
 		// was a REG_ID passed ?
650
-		if ( $reg_url_link ) {
651
-			$registration = EE_Registry::instance()->load_model( 'Registration' )->get_one(
652
-				array( array( 'REG_url_link' => $reg_url_link ) )
650
+		if ($reg_url_link) {
651
+			$registration = EE_Registry::instance()->load_model('Registration')->get_one(
652
+				array(array('REG_url_link' => $reg_url_link))
653 653
 			);
654
-			if ( $registration instanceof EE_Registration ) {
654
+			if ($registration instanceof EE_Registration) {
655 655
 				// resend email
656
-				EED_Messages::process_resend( array( '_REG_ID' => $registration->ID() ) );
656
+				EED_Messages::process_resend(array('_REG_ID' => $registration->ID()));
657 657
 			} else {
658 658
 				EE_Error::add_error(
659 659
 					__(
@@ -677,16 +677,16 @@  discard block
 block discarded – undo
677 677
 			);
678 678
 		}
679 679
 		// request sent via AJAX ?
680
-		if ( EE_FRONT_AJAX ) {
681
-			echo json_encode( EE_Error::get_notices( false ) );
680
+		if (EE_FRONT_AJAX) {
681
+			echo json_encode(EE_Error::get_notices(false));
682 682
 			die();
683 683
 			// or was JS disabled ?
684 684
 		} else {
685 685
 			// save errors so that they get picked up on the next request
686
-			EE_Error::get_notices( true, true );
686
+			EE_Error::get_notices(true, true);
687 687
 			wp_safe_redirect(
688 688
 				add_query_arg(
689
-					array( 'e_reg_url_link' => $reg_url_link ),
689
+					array('e_reg_url_link' => $reg_url_link),
690 690
 					EE_Registry::instance()->CFG->core->thank_you_page_url()
691 691
 				)
692 692
 			);
@@ -702,26 +702,26 @@  discard block
 block discarded – undo
702 702
 	 * @return    void
703 703
 	 */
704 704
 	public function get_ajax_content() {
705
-		if ( ! $this->get_txn() ) {
705
+		if ( ! $this->get_txn()) {
706 706
 			return;
707 707
 		}
708 708
 		// first determine which event(s) require pre-approval or not
709 709
 		$events = array();
710 710
 		$events_requiring_pre_approval = array();
711
-		foreach ( $this->_current_txn->registrations() as $registration ) {
712
-			if ( $registration instanceof EE_Registration ) {
711
+		foreach ($this->_current_txn->registrations() as $registration) {
712
+			if ($registration instanceof EE_Registration) {
713 713
 				$event = $registration->event();
714
-				if ( $event instanceof EE_Event ) {
715
-					if ( $registration->is_not_approved() && $registration->event() instanceof EE_Event ) {
716
-						$events_requiring_pre_approval[ $event->ID() ] = $event;
714
+				if ($event instanceof EE_Event) {
715
+					if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) {
716
+						$events_requiring_pre_approval[$event->ID()] = $event;
717 717
 					} else {
718
-						$events[ $event->ID() ] = $event;
718
+						$events[$event->ID()] = $event;
719 719
 					}
720 720
 				}
721 721
 			}
722 722
 		}
723
-		$this->display_details_for_events_requiring_pre_approval( $events_requiring_pre_approval );
724
-		$this->display_details_for_events( $events );
723
+		$this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval);
724
+		$this->display_details_for_events($events);
725 725
 	}
726 726
 
727 727
 
@@ -733,8 +733,8 @@  discard block
 block discarded – undo
733 733
 	 * @param EE_Event[] $events
734 734
 	 * @return string
735 735
 	 */
736
-	public function display_details_for_events( $events = array() ) {
737
-		if ( ! empty( $events ) ) {
736
+	public function display_details_for_events($events = array()) {
737
+		if ( ! empty($events)) {
738 738
 			?>
739 739
 			<div id="espresso-thank-you-page-ajax-content-dv">
740 740
 				<div id="espresso-thank-you-page-ajax-transaction-dv"></div>
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
 							'event_espresso'
747 747
 							); ?></span>
748 748
 					</div>
749
-					<?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed ) : ?>
749
+					<?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?>
750 750
 						<p id="ee-ajax-loading-pg" class="highlight-bg small-text clear">
751 751
 							<?php echo apply_filters(
752 752
 								'EES_Espresso_Thank_You__get_ajax_content__waiting_for_IPN_msg',
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 							); ?>
758 758
 							<br/>
759 759
 							<span class="jst-rght ee-block small-text lt-grey-text">
760
-								<?php _e( 'current wait time ', 'event_espresso' ); ?>
760
+								<?php _e('current wait time ', 'event_espresso'); ?>
761 761
 							<span id="espresso-thank-you-page-ajax-time-dv">00:00:00</span></span>
762 762
 						</p>
763 763
 					<?php endif; ?>
@@ -777,11 +777,11 @@  discard block
 block discarded – undo
777 777
 	 * @param EE_Event[] $events
778 778
 	 * @return string
779 779
 	 */
780
-	public function display_details_for_events_requiring_pre_approval( $events = array() ) {
781
-		if ( ! empty( $events ) ) {
780
+	public function display_details_for_events_requiring_pre_approval($events = array()) {
781
+		if ( ! empty($events)) {
782 782
 			?>
783 783
 			<div id="espresso-thank-you-page-not-approved-message-dv">
784
-				<h4 class="orange-text"><?php _e( 'Important Notice:', 'event_espresso' ); ?></h4>
784
+				<h4 class="orange-text"><?php _e('Important Notice:', 'event_espresso'); ?></h4>
785 785
 				<p id="events-requiring-pre-approval-pg" class="small-text">
786 786
 					<?php echo apply_filters(
787 787
 						'AHEE__EES_Espresso_Thank_You__get_ajax_content__not_approved_message',
@@ -792,8 +792,8 @@  discard block
 block discarded – undo
792 792
 					); ?>
793 793
 				</p>
794 794
 				<ul class="events-requiring-pre-approval-ul">
795
-					<?php foreach ( $events as $event ) {
796
-						if ( $event instanceof EE_Event ) {
795
+					<?php foreach ($events as $event) {
796
+						if ($event instanceof EE_Event) {
797 797
 							echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>',
798 798
 								$event->name(),
799 799
 								'</li>';
@@ -820,12 +820,12 @@  discard block
 block discarded – undo
820 820
 		$template_args = array();
821 821
 		$template_args['transaction'] = $this->_current_txn;
822 822
 		$template_args['reg_url_link'] = $this->_reg_url_link;
823
-		$template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name( true );
823
+		$template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(true);
824 824
 		// link to SPCO payment_options
825 825
 		$template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link;
826 826
 		$template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url;
827 827
 		// verify template arguments
828
-		EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' );
828
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
829 829
 		EEH_Template_Validator::verify_isnt_null(
830 830
 			$template_args['show_try_pay_again_link'],
831 831
 			'$show_try_pay_again_link'
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 			'$SPCO_payment_options_url'
836 836
 		);
837 837
 		return EEH_Template::locate_template(
838
-			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php',
838
+			THANK_YOU_TEMPLATES_PATH.'thank-you-page-transaction-details.template.php',
839 839
 			$template_args,
840 840
 			true,
841 841
 			true
@@ -852,9 +852,9 @@  discard block
 block discarded – undo
852 852
 	 * @return    string
853 853
 	 * @throws \EE_Error
854 854
 	 */
855
-	public function get_payment_row_html( $payment = null ) {
855
+	public function get_payment_row_html($payment = null) {
856 856
 		$html = '';
857
-		if ( $payment instanceof EE_Payment ) {
857
+		if ($payment instanceof EE_Payment) {
858 858
 			if (
859 859
 				$payment->payment_method() instanceof EE_Payment_Method
860 860
 				&& $payment->status() === EEM_Payment::status_id_failed
@@ -863,31 +863,31 @@  discard block
 block discarded – undo
863 863
 				// considering the registrant has made it to the Thank You page,
864 864
 				// any failed payments may actually be pending and the IPN is just slow
865 865
 				// so let's
866
-				$payment->set_status( EEM_Payment::status_id_pending );
866
+				$payment->set_status(EEM_Payment::status_id_pending);
867 867
 			}
868 868
 			$payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined
869
-				? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>'
869
+				? '<br /><span class="small-text">'.$payment->gateway_response().'</span>'
870 870
 				: '';
871 871
 			$html .= '
872 872
 				<tr>
873 873
 					<td>
874
-						' . $payment->timestamp() . '
874
+						' . $payment->timestamp().'
875 875
 					</td>
876 876
 					<td>
877 877
 						' . (
878 878
 								$payment->payment_method() instanceof EE_Payment_Method
879 879
 									? $payment->payment_method()->name()
880
-									: __( 'Unknown', 'event_espresso' )
881
-							) . '
880
+									: __('Unknown', 'event_espresso')
881
+							).'
882 882
 					</td>
883 883
 					<td class="jst-rght">
884
-						' . EEH_Template::format_currency( $payment->amount() ) . '
884
+						' . EEH_Template::format_currency($payment->amount()).'
885 885
 					</td>
886 886
 					<td class="jst-rght" style="line-height:1;">
887
-						' . $payment->pretty_status( true ) . $payment_declined_msg . '
887
+						' . $payment->pretty_status(true).$payment_declined_msg.'
888 888
 					</td>
889 889
 				</tr>';
890
-			do_action( 'AHEE__thank_you_page_payment_details_template__after_each_payment', $payment );
890
+			do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment);
891 891
 		}
892 892
 		return $html;
893 893
 	}
@@ -902,14 +902,14 @@  discard block
 block discarded – undo
902 902
 	 * @return    string
903 903
 	 * @throws \EE_Error
904 904
 	 */
905
-	public function get_payment_details( $payments = array() ) {
905
+	public function get_payment_details($payments = array()) {
906 906
 		//prepare variables for displaying
907 907
 		$template_args = array();
908 908
 		$template_args['transaction'] = $this->_current_txn;
909 909
 		$template_args['reg_url_link'] = $this->_reg_url_link;
910 910
 		$template_args['payments'] = array();
911
-		foreach ( $payments as $payment ) {
912
-			$template_args['payments'][] = $this->get_payment_row_html( $payment );
911
+		foreach ($payments as $payment) {
912
+			$template_args['payments'][] = $this->get_payment_row_html($payment);
913 913
 		}
914 914
 		//create a hacky payment object, but dont save it
915 915
 		$payment = EE_Payment::new_instance(
@@ -922,8 +922,8 @@  discard block
 block discarded – undo
922 922
 			)
923 923
 		);
924 924
 		$payment_method = $this->_current_txn->payment_method();
925
-		if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base ) {
926
-			$template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content( $payment );
925
+		if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) {
926
+			$template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment);
927 927
 		} else {
928 928
 			$template_args['gateway_content'] = '';
929 929
 		}
@@ -931,19 +931,19 @@  discard block
 block discarded – undo
931 931
 		$template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link;
932 932
 		$template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url;
933 933
 		// verify template arguments
934
-		EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' );
935
-		EEH_Template_Validator::verify_isnt_null( $template_args['payments'], '$payments' );
934
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
935
+		EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments');
936 936
 		EEH_Template_Validator::verify_isnt_null(
937 937
 			$template_args['show_try_pay_again_link'],
938 938
 			'$show_try_pay_again_link'
939 939
 		);
940
-		EEH_Template_Validator::verify_isnt_null( $template_args['gateway_content'], '$gateway_content' );
940
+		EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content');
941 941
 		EEH_Template_Validator::verify_isnt_null(
942 942
 			$template_args['SPCO_payment_options_url'],
943 943
 			'$SPCO_payment_options_url'
944 944
 		);
945 945
 		return EEH_Template::locate_template(
946
-			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php',
946
+			THANK_YOU_TEMPLATES_PATH.'thank-you-page-payment-details.template.php',
947 947
 			$template_args,
948 948
 			true,
949 949
 			true
@@ -960,11 +960,11 @@  discard block
 block discarded – undo
960 960
 	 * @return    string
961 961
 	 * @throws \EE_Error
962 962
 	 */
963
-	public function get_new_payments( $payments = array() ) {
963
+	public function get_new_payments($payments = array()) {
964 964
 		$payments_html = '';
965 965
 		//prepare variables for displaying
966
-		foreach ( $payments as $payment ) {
967
-			$payments_html .= $this->get_payment_row_html( $payment );
966
+		foreach ($payments as $payment) {
967
+			$payments_html .= $this->get_payment_row_html($payment);
968 968
 		}
969 969
 		return $payments_html;
970 970
 	}
Please login to merge, or discard this patch.
core/libraries/payment_methods/EE_Payment_Method_Manager.lib.php 2 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 				$validation_error_message = $default_validation_strategy->get_validation_error_message();
43 43
 			}
44 44
 			throw new EE_Validation_Error( $validation_error_message, 'float_only' );
45
-		}else{
45
+		} else{
46 46
 			return floatval($normalized_value);
47 47
 		}
48 48
 	}
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	public function unnormalize($normalized_value) {
56 56
 		if( empty( $normalized_value ) ){
57 57
 			return '0.00';
58
-		}else{
58
+		} else{
59 59
 			return "$normalized_value";
60 60
 		}
61 61
 	}
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
2 2
 /**
3 3
  *
4 4
  * Class EE_Payment_Method_Manager
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public static function instance() {
37 37
 		// check if class object is instantiated, and instantiated properly
38
-		if ( ! self::$_instance instanceof EE_Payment_Method_Manager ) {
38
+		if ( ! self::$_instance instanceof EE_Payment_Method_Manager) {
39 39
 			self::$_instance = new self();
40 40
 		}
41 41
 		EE_Registry::instance()->load_lib('PMT_Base');
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * Resets the instance and returns a new one
47 47
 	 * @return EE_Payment_Method_Manager
48 48
 	 */
49
-	public static function reset(){
49
+	public static function reset() {
50 50
 		self::$_instance = NULL;
51 51
 		return self::instance();
52 52
 	}
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	 * or just re-use the PMTs we found last time we checked during this request (if
58 58
 	 * we have not yet checked during this request, then we need to check anyways)
59 59
 	 */
60
-	public function maybe_register_payment_methods( $force_recheck = FALSE ){
61
-		if( ! $this->_payment_method_types || $force_recheck ){
60
+	public function maybe_register_payment_methods($force_recheck = FALSE) {
61
+		if ( ! $this->_payment_method_types || $force_recheck) {
62 62
 			$this->_register_payment_methods();
63 63
 			//if in admin lets ensure caps are set.
64
-			if ( is_admin() ) {
65
-				add_filter( 'FHEE__EE_Capabilities__init_caps_map__caps', array( $this, 'add_payment_method_caps' ) );
64
+			if (is_admin()) {
65
+				add_filter('FHEE__EE_Capabilities__init_caps_map__caps', array($this, 'add_payment_method_caps'));
66 66
 				EE_Registry::instance()->CAP->init_caps();
67 67
 			}
68 68
 		}
@@ -75,19 +75,19 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	protected function _register_payment_methods() {
77 77
 		// grab list of installed modules
78
-		$pm_to_register = glob( EE_PAYMENT_METHODS . '*', GLOB_ONLYDIR );
78
+		$pm_to_register = glob(EE_PAYMENT_METHODS.'*', GLOB_ONLYDIR);
79 79
 		// filter list of modules to register
80
-		$pm_to_register = apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register );
80
+		$pm_to_register = apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register);
81 81
 
82 82
 		// loop through folders
83
-		foreach ( $pm_to_register as $pm_path ) {
84
-				$this->register_payment_method( $pm_path );
83
+		foreach ($pm_to_register as $pm_path) {
84
+				$this->register_payment_method($pm_path);
85 85
 		}
86
-		do_action( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods' );
86
+		do_action('FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods');
87 87
 		// filter list of installed modules
88 88
 		//keep them organized alphabetically by the payment method type's name
89
-		ksort( $this->_payment_method_types );
90
-		return apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types );
89
+		ksort($this->_payment_method_types);
90
+		return apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types);
91 91
 	}
92 92
 
93 93
 
@@ -99,35 +99,35 @@  discard block
 block discarded – undo
99 99
 	 * @param string $payment_method_path - full path up to and including payment method folder
100 100
 	 * @return boolean
101 101
 	 */
102
-	public function register_payment_method( $payment_method_path = '' ) {
103
-		do_action( 'AHEE__EE_Payment_Method_Manager__register_payment_method__begin',$payment_method_path );
102
+	public function register_payment_method($payment_method_path = '') {
103
+		do_action('AHEE__EE_Payment_Method_Manager__register_payment_method__begin', $payment_method_path);
104 104
 		$module_ext = '.pm.php';
105 105
 		// make all separators match
106
-		$payment_method_path = rtrim( str_replace( '/\\', DS, $payment_method_path ), DS );
106
+		$payment_method_path = rtrim(str_replace('/\\', DS, $payment_method_path), DS);
107 107
 		// grab and sanitize module name
108
-		$module_dir = basename( $payment_method_path );
108
+		$module_dir = basename($payment_method_path);
109 109
 		// create classname from module directory name
110
-		$module = str_replace( ' ', '_', str_replace( '_', ' ', $module_dir ));
110
+		$module = str_replace(' ', '_', str_replace('_', ' ', $module_dir));
111 111
 		// add class prefix
112
-		$module_class = 'EE_PMT_' . $module;
112
+		$module_class = 'EE_PMT_'.$module;
113 113
 		// does the module exist ?
114
-		if ( ! is_readable( $payment_method_path . DS . $module_class . $module_ext )) {
115
-			$msg = sprintf( __( 'The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module );
116
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
114
+		if ( ! is_readable($payment_method_path.DS.$module_class.$module_ext)) {
115
+			$msg = sprintf(__('The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso'), $module);
116
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
117 117
 			return FALSE;
118 118
 		}
119
-		if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->start_timer(); }
119
+		if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->start_timer(); }
120 120
 		// load the module class file
121
-		require_once( $payment_method_path . DS . $module_class . $module_ext );
122
-		if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); }
121
+		require_once($payment_method_path.DS.$module_class.$module_ext);
122
+		if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); }
123 123
 		// verify that class exists
124
-		if ( ! class_exists( $module_class )) {
125
-			$msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class );
126
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
124
+		if ( ! class_exists($module_class)) {
125
+			$msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
126
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
127 127
 			return FALSE;
128 128
 		}
129 129
 		// add to array of registered modules
130
-		$this->_payment_method_types[ $module ] = $payment_method_path . DS . $module_class . $module_ext;
130
+		$this->_payment_method_types[$module] = $payment_method_path.DS.$module_class.$module_ext;
131 131
 		return TRUE;
132 132
 	}
133 133
 	/**
@@ -136,18 +136,18 @@  discard block
 block discarded – undo
136 136
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
137 137
 	 * @return boolean
138 138
 	 */
139
-	public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE){
139
+	public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE) {
140 140
 		if (
141 141
 			$force_recheck
142
-			|| ! is_array( $this->_payment_method_types )
143
-			|| ! isset( $this->_payment_method_types[$payment_method_name] )
142
+			|| ! is_array($this->_payment_method_types)
143
+			|| ! isset($this->_payment_method_types[$payment_method_name])
144 144
 		) {
145 145
 			$this->maybe_register_payment_methods($force_recheck);
146 146
 		}
147
-		if(isset($this->_payment_method_types[$payment_method_name])){
147
+		if (isset($this->_payment_method_types[$payment_method_name])) {
148 148
 			require_once($this->_payment_method_types[$payment_method_name]);
149 149
 			return true;
150
-		}else{
150
+		} else {
151 151
 			return false;
152 152
 		}
153 153
 	}
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
159 159
 	 * @return array
160 160
 	 */
161
-	public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE ){
161
+	public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE) {
162 162
 		$this->maybe_register_payment_methods($force_recheck);
163
-		if($with_prefixes){
163
+		if ($with_prefixes) {
164 164
 			$classnames = array_keys($this->_payment_method_types);
165 165
 			$payment_methods = array();
166
-			foreach($classnames as $classname){
166
+			foreach ($classnames as $classname) {
167 167
 				$payment_methods[] = $this->payment_method_class_from_type($classname);
168 168
 			}
169 169
 			return $payment_methods;
170
-		}else{
170
+		} else {
171 171
 			return array_keys($this->_payment_method_types);
172 172
 		}
173 173
 	}
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
178 178
 	 * @return EE_PMT_Base[]
179 179
 	 */
180
-	public function payment_method_types( $force_recheck = FALSE ){
180
+	public function payment_method_types($force_recheck = FALSE) {
181 181
 		$this->maybe_register_payment_methods($force_recheck);
182 182
 		$pmt_objs = array();
183
-		foreach($this->payment_method_type_names(true) as $classname){
183
+		foreach ($this->payment_method_type_names(true) as $classname) {
184 184
 			$pmt_objs[] = new $classname;
185 185
 		}
186 186
 		return $pmt_objs;
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 	 * @param string $classname
193 193
 	 * @return string
194 194
 	 */
195
-	public function payment_method_type_sans_class_prefix($classname){
196
-		return str_replace( "EE_PMT_", "", $classname );
195
+	public function payment_method_type_sans_class_prefix($classname) {
196
+		return str_replace("EE_PMT_", "", $classname);
197 197
 	}
198 198
 
199 199
 	/**
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * @param string $type
202 202
 	 * @return string
203 203
 	 */
204
-	public function payment_method_class_from_type($type){
204
+	public function payment_method_class_from_type($type) {
205 205
 		$this->maybe_register_payment_methods();
206 206
 		return "EE_PMT_".$type;
207 207
 	}
@@ -215,39 +215,39 @@  discard block
 block discarded – undo
215 215
 	 * @return \EE_Payment_Method
216 216
 	 * @throws \EE_Error
217 217
 	 */
218
-	public function activate_a_payment_method_of_type( $payment_method_type ){
218
+	public function activate_a_payment_method_of_type($payment_method_type) {
219 219
 		$payment_method = EEM_Payment_Method::instance()->get_one_of_type($payment_method_type);
220
-		if( ! $payment_method instanceof EE_Payment_Method ){
220
+		if ( ! $payment_method instanceof EE_Payment_Method) {
221 221
 			$pm_type_class = $this->payment_method_class_from_type($payment_method_type);
222
-			if(class_exists($pm_type_class)){
222
+			if (class_exists($pm_type_class)) {
223 223
 				/** @var $pm_type_obj EE_PMT_Base */
224 224
 				$pm_type_obj = new $pm_type_class;
225 225
 				$payment_method = EEM_Payment_Method::instance()->get_one_by_slug($pm_type_obj->system_name());
226
-				if( ! $payment_method){
227
-					$payment_method = $this->create_payment_method_of_type( $pm_type_obj );
226
+				if ( ! $payment_method) {
227
+					$payment_method = $this->create_payment_method_of_type($pm_type_obj);
228 228
 				}
229
-				$payment_method->set_type( $payment_method_type );
230
-				$this->initialize_payment_method( $payment_method );
229
+				$payment_method->set_type($payment_method_type);
230
+				$this->initialize_payment_method($payment_method);
231 231
 			} else {
232 232
 				throw new EE_Error(
233 233
 					sprintf(
234
-						__( 'There is no payment method of type %1$s, so it could not be activated', 'event_espresso'),
234
+						__('There is no payment method of type %1$s, so it could not be activated', 'event_espresso'),
235 235
 						$pm_type_class )
236 236
 				);
237 237
 			}
238 238
 		}
239 239
 		$payment_method->set_active();
240 240
 		$payment_method->save();
241
-		$this->set_usable_currencies_on_payment_method( $payment_method );
242
-		if( $payment_method->type() === 'Invoice' ){
241
+		$this->set_usable_currencies_on_payment_method($payment_method);
242
+		if ($payment_method->type() === 'Invoice') {
243 243
 			/** @type EE_Message_Resource_Manager $message_resource_manager */
244
-			$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
245
-			$message_resource_manager->ensure_message_type_is_active( 'invoice', 'html' );
246
-			$message_resource_manager->ensure_messenger_is_active( 'pdf' );
244
+			$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
245
+			$message_resource_manager->ensure_message_type_is_active('invoice', 'html');
246
+			$message_resource_manager->ensure_messenger_is_active('pdf');
247 247
 			EE_Error::add_attention(
248 248
 				sprintf(
249
-					__( 'Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso' ),
250
-					'<a href="' . admin_url( 'admin.php?page=espresso_messages') . '">',
249
+					__('Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso'),
250
+					'<a href="'.admin_url('admin.php?page=espresso_messages').'">',
251 251
 					'</a>'
252 252
 				)
253 253
 			);
@@ -265,17 +265,17 @@  discard block
 block discarded – undo
265 265
 	 * @return EE_Payment_Method
266 266
 	 * @throws \EE_Error
267 267
 	 */
268
-	public function create_payment_method_of_type( $pm_type_obj ) {
268
+	public function create_payment_method_of_type($pm_type_obj) {
269 269
 		global $current_user;
270 270
 		$payment_method = EE_Payment_Method::new_instance(
271 271
 			array(
272 272
 				'PMD_type' 		 => $pm_type_obj->system_name(),
273 273
 				'PMD_name' 		 => $pm_type_obj->pretty_name(),
274 274
 				'PMD_admin_name' => $pm_type_obj->pretty_name(),
275
-				'PMD_slug' 		 => $pm_type_obj->system_name(),//automatically converted to slug
275
+				'PMD_slug' 		 => $pm_type_obj->system_name(), //automatically converted to slug
276 276
 				'PMD_wp_user' 	 => $current_user->ID,
277 277
 				'PMD_order' 	 => EEM_Payment_Method::instance()->count(
278
-					array( array( 'PMD_type' => array( '!=', 'Admin_Only' )))
278
+					array(array('PMD_type' => array('!=', 'Admin_Only')))
279 279
 				) * 10,
280 280
 			)
281 281
 		);
@@ -291,21 +291,21 @@  discard block
 block discarded – undo
291 291
 	 * @return EE_Payment_Method
292 292
 	 * @throws \EE_Error
293 293
 	 */
294
-	public function initialize_payment_method( $payment_method ) {
294
+	public function initialize_payment_method($payment_method) {
295 295
 		$pm_type_obj = $payment_method->type_obj();
296
-		$payment_method->set_description( $pm_type_obj->default_description() );
297
-		if( ! $payment_method->button_url() ){
298
-			$payment_method->set_button_url( $pm_type_obj->default_button_url() );
296
+		$payment_method->set_description($pm_type_obj->default_description());
297
+		if ( ! $payment_method->button_url()) {
298
+			$payment_method->set_button_url($pm_type_obj->default_button_url());
299 299
 		}
300 300
 		//now add setup its default extra meta properties
301 301
 		$extra_metas = $pm_type_obj->settings_form()->extra_meta_inputs();
302
-		if ( ! empty( $extra_metas ) ) {
302
+		if ( ! empty($extra_metas)) {
303 303
 			//verify the payment method has an ID before adding extra meta
304
-			if ( ! $payment_method->ID() ) {
304
+			if ( ! $payment_method->ID()) {
305 305
 				$payment_method->save();
306 306
 			}
307
-			foreach ( $extra_metas as $meta_name => $input ) {
308
-				$payment_method->update_extra_meta( $meta_name, $input->raw_value() );
307
+			foreach ($extra_metas as $meta_name => $input) {
308
+				$payment_method->update_extra_meta($meta_name, $input->raw_value());
309 309
 			}
310 310
 		}
311 311
 		return $payment_method;
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 	 * @return EE_Payment_Method
321 321
 	 * @throws \EE_Error
322 322
 	 */
323
-	public function set_usable_currencies_on_payment_method( $payment_method ) {
324
-		foreach($payment_method->get_all_usable_currencies() as $currency_obj){
323
+	public function set_usable_currencies_on_payment_method($payment_method) {
324
+		foreach ($payment_method->get_all_usable_currencies() as $currency_obj) {
325 325
 			$payment_method->_add_relation_to($currency_obj, 'Currency');
326 326
 		}
327 327
 		return $payment_method;
@@ -339,19 +339,19 @@  discard block
 block discarded – undo
339 339
 	 *
340 340
 	 * @return int count of rows updated.
341 341
 	 */
342
-	public function deactivate_payment_method( $payment_method_slug ) {
342
+	public function deactivate_payment_method($payment_method_slug) {
343 343
 		EE_Log::instance()->log(
344 344
 				__FILE__,
345 345
 				__FUNCTION__,
346 346
 				sprintf(
347
-					__( 'Payment method with slug %1$s is being deactivated by site admin', 'event_espresso' ),
347
+					__('Payment method with slug %1$s is being deactivated by site admin', 'event_espresso'),
348 348
 					$payment_method_slug
349 349
 				),
350 350
 				'payment_method_change'
351 351
 			);
352 352
 		$count_updated = EEM_Payment_Method::instance()->update(
353
-			array( 'PMD_scope' => array() ),
354
-			array( array( 'PMD_slug' => $payment_method_slug ) )
353
+			array('PMD_scope' => array()),
354
+			array(array('PMD_slug' => $payment_method_slug))
355 355
 		);
356 356
 		return $count_updated;
357 357
 	}
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 * @param array $caps capabilities being filtered
366 366
 	 * @return array
367 367
 	 */
368
-	public function add_payment_method_caps( $caps ) {
368
+	public function add_payment_method_caps($caps) {
369 369
 		/* add dynamic caps from payment methods
370 370
 		 * at the time of writing, october 20 2014, these are the caps added:
371 371
 		 * ee_payment_method_admin_only
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 		 * their related capability automatically added too, so long as they are
381 381
 		 * registered properly using EE_Register_Payment_Method::register()
382 382
 		 */
383
-		foreach( $this->payment_method_types() as $payment_method_type_obj ){
383
+		foreach ($this->payment_method_types() as $payment_method_type_obj) {
384 384
 			$caps['administrator'][] = $payment_method_type_obj->cap_name();
385 385
 		}
386 386
 		return $caps;
Please login to merge, or discard this patch.
core/db_classes/EE_Payment_Method.class.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
2
-do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
2
+do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3 3
 /**
4 4
  * Event Espresso
5 5
  *
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * ------------------------------------------------------------------------
25 25
  */
26
-class EE_Payment_Method extends EE_Base_Class{
26
+class EE_Payment_Method extends EE_Base_Class {
27 27
 
28 28
 	/**
29 29
 	 * Payment Method type object, which has all the info about this type of payment method,
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	 * @return EE_Payment_Method
40 40
 	 * @throws \EE_Error
41 41
 	 */
42
-	public static function new_instance( $props_n_values = array()) {
43
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
44
-		return $has_object ? $has_object : new self( $props_n_values, FALSE );
42
+	public static function new_instance($props_n_values = array()) {
43
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
44
+		return $has_object ? $has_object : new self($props_n_values, FALSE);
45 45
 	}
46 46
 
47 47
 
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	 * @return EE_Payment_Method
52 52
 	 * @throws \EE_Error
53 53
 	 */
54
-	public static function new_instance_from_db ( $props_n_values = array()) {
55
-		return new self( $props_n_values, TRUE );
54
+	public static function new_instance_from_db($props_n_values = array()) {
55
+		return new self($props_n_values, TRUE);
56 56
 	}
57 57
 
58 58
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 * @return boolean
82 82
 	 */
83 83
 	public function active() {
84
-		return array_intersect(array_keys(EEM_Payment_Method::instance()->scopes()),$this->scope());
84
+		return array_intersect(array_keys(EEM_Payment_Method::instance()->scopes()), $this->scope());
85 85
 	}
86 86
 
87 87
 
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
 	 *
93 93
 	 * @throws \EE_Error
94 94
 	 */
95
-	public function set_active(){
95
+	public function set_active() {
96 96
 		$default_scopes = array(EEM_Payment_Method::scope_cart);
97
-		if($this->type_obj() &&
98
-			$this->type_obj()->payment_occurs() === EE_PMT_Base::offline){
97
+		if ($this->type_obj() &&
98
+			$this->type_obj()->payment_occurs() === EE_PMT_Base::offline) {
99 99
 			$default_scopes[] = EEM_Payment_Method::scope_admin;
100 100
 		}
101 101
 		$this->set_scope($default_scopes);
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	/**
107 107
 	 * Makes this payment method apply to NO scopes at all. DOES NOT SAVE it.
108 108
 	 */
109
-	public function deactivate(){
109
+	public function deactivate() {
110 110
 		$this->set_scope(array());
111 111
 	}
112 112
 
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 	 * @param mixed $field_value
298 298
 	 * @param boolean $use_default
299 299
 	 */
300
-	public function set( $field_name, $field_value, $use_default = FALSE ){
301
-		if( $field_name === 'PMD_type' ){
300
+	public function set($field_name, $field_value, $use_default = FALSE) {
301
+		if ($field_name === 'PMD_type') {
302 302
 			//the type has probably changed, so forget about its old type object
303 303
 			$this->_type_obj = NULL;
304 304
 		}
@@ -372,26 +372,26 @@  discard block
 block discarded – undo
372 372
 	 * @return EE_PMT_Base
373 373
 	 * @throws EE_Error
374 374
 	 */
375
-	public function type_obj(){
376
-		if( ! $this->_type_obj ) {
377
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
378
-			if ( EE_Payment_Method_Manager::instance()->payment_method_type_exists( $this->type() )) {
379
-				$class_name = EE_Payment_Method_Manager::instance()->payment_method_class_from_type( $this->type() );
380
-				if ( ! class_exists( $class_name )) {
375
+	public function type_obj() {
376
+		if ( ! $this->_type_obj) {
377
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
378
+			if (EE_Payment_Method_Manager::instance()->payment_method_type_exists($this->type())) {
379
+				$class_name = EE_Payment_Method_Manager::instance()->payment_method_class_from_type($this->type());
380
+				if ( ! class_exists($class_name)) {
381 381
 					throw new EE_Error(
382 382
 						sprintf(
383
-							__( 'An attempt to use the "%1$s" payment method failed, so it was deactivated.%2$sWas the "%1$s" Plugin recently deactivated? It can be reactivated on the %3$sPlugins Admin Page%4$s', 'event_espresso' ),
383
+							__('An attempt to use the "%1$s" payment method failed, so it was deactivated.%2$sWas the "%1$s" Plugin recently deactivated? It can be reactivated on the %3$sPlugins Admin Page%4$s', 'event_espresso'),
384 384
 							$class_name,
385 385
 							'<br />',
386
-							'<a href="' . admin_url('plugins.php') . '">',
386
+							'<a href="'.admin_url('plugins.php').'">',
387 387
 							'</a>'
388 388
 						)
389 389
 					);
390 390
 				}
391
-				$r = new ReflectionClass( $class_name );
392
-					$this->_type_obj = $r->newInstanceArgs( array( $this ));
391
+				$r = new ReflectionClass($class_name);
392
+					$this->_type_obj = $r->newInstanceArgs(array($this));
393 393
 			} else {
394
-				throw new EE_Error( sprintf( __( 'A payment method of type "%1$s" does not exist. Only ones existing are: %2$s', 'event_espresso' ), $this->type(), implode(',', EE_Payment_Method_Manager::instance()->payment_method_type_names() ) ) );
394
+				throw new EE_Error(sprintf(__('A payment method of type "%1$s" does not exist. Only ones existing are: %2$s', 'event_espresso'), $this->type(), implode(',', EE_Payment_Method_Manager::instance()->payment_method_type_names())));
395 395
 			}
396 396
 		}
397 397
 		return $this->_type_obj;
@@ -404,18 +404,18 @@  discard block
 block discarded – undo
404 404
 	 * and the extra meta. Mostly used for passing off ot gateways.	 *
405 405
 	 * @return array
406 406
 	 */
407
-	public function settings_array(){
407
+	public function settings_array() {
408 408
 		$fields = $this->model_field_array();
409 409
 		$extra_meta = $this->all_extra_meta_array();
410 410
 		//remove the model's prefix from the fields
411 411
 		$combined_settings_array = array();
412
-		foreach($fields as $key => $value){
413
-			if(strpos($key, 'PMD_')===0){
412
+		foreach ($fields as $key => $value) {
413
+			if (strpos($key, 'PMD_') === 0) {
414 414
 				$key_sans_model_prefix = str_replace('PMD_', '', $key);
415 415
 				$combined_settings_array [$key_sans_model_prefix] = $value;
416 416
 			}
417 417
 		}
418
-		$combined_settings_array = array_merge( $extra_meta,$combined_settings_array );
418
+		$combined_settings_array = array_merge($extra_meta, $combined_settings_array);
419 419
 		return $combined_settings_array;
420 420
 	}
421 421
 
@@ -429,12 +429,12 @@  discard block
 block discarded – undo
429 429
 	 * @return string of HTML for displaying the button
430 430
 	 * @throws \EE_Error
431 431
 	 */
432
-	public function button_html( $url = '', $css_class = '' ){
432
+	public function button_html($url = '', $css_class = '') {
433 433
 		$payment_occurs = $this->type_obj()->payment_occurs();
434 434
 		return '
435
-		 <div id="' . $this->slug() . '-payment-option-dv" class="'. $payment_occurs .'-payment-gateway reg-page-payment-option-dv' . $css_class . '">
436
-			<a id="payment-gateway-button-' . $this->slug() . '" class="reg-page-payment-option-lnk" rel="' . $this->slug() . '" href="' . $url . '" >
437
-				<img src="' . $this->button_url() . '" alt="' . sprintf( esc_attr__( 'Pay using %s', 'event_espresso' ), $this->get_pretty('PMD_name','form_input') ) . '" />
435
+		 <div id="' . $this->slug().'-payment-option-dv" class="'.$payment_occurs.'-payment-gateway reg-page-payment-option-dv'.$css_class.'">
436
+			<a id="payment-gateway-button-' . $this->slug().'" class="reg-page-payment-option-lnk" rel="'.$this->slug().'" href="'.$url.'" >
437
+				<img src="' . $this->button_url().'" alt="'.sprintf(esc_attr__('Pay using %s', 'event_espresso'), $this->get_pretty('PMD_name', 'form_input')).'" />
438 438
 			</a>
439 439
 		</div>
440 440
 ';
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 	 * @return EE_Currency[]
450 450
 	 * @throws \EE_Error
451 451
 	 */
452
-	public function get_all_usable_currencies(){
452
+	public function get_all_usable_currencies() {
453 453
 		return EEM_Currency::instance()->get_all_currencies_usable_by($this->type_obj());
454 454
 	}
455 455
 
@@ -462,9 +462,9 @@  discard block
 block discarded – undo
462 462
 	 * @return boolean
463 463
 	 * @throws \EE_Error
464 464
 	 */
465
-	public function usable_for_currency( $currency_code ) {
466
-		foreach( $this->get_all_usable_currencies() as $currency_obj ) {
467
-			if( $currency_obj->ID() === $currency_code ){
465
+	public function usable_for_currency($currency_code) {
466
+		foreach ($this->get_all_usable_currencies() as $currency_obj) {
467
+			if ($currency_obj->ID() === $currency_code) {
468 468
 				return TRUE;
469 469
 			}
470 470
 		}
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 	 * @return bool
480 480
 	 * @throws \EE_Error
481 481
 	 */
482
-	public function is_on_site(){
482
+	public function is_on_site() {
483 483
 		return $this->type_obj()->payment_occurs() === EE_PMT_Base::onsite;
484 484
 	}
485 485
 
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 	 * @return bool
492 492
 	 * @throws \EE_Error
493 493
 	 */
494
-	public function is_off_site(){
494
+	public function is_off_site() {
495 495
 		return $this->type_obj()->payment_occurs() === EE_PMT_Base::offsite;
496 496
 	}
497 497
 
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 	 * @return bool
504 504
 	 * @throws \EE_Error
505 505
 	 */
506
-	public function is_off_line(){
506
+	public function is_off_line() {
507 507
 		return $this->type_obj()->payment_occurs() === EE_PMT_Base::offline;
508 508
 	}
509 509
 
@@ -513,10 +513,10 @@  discard block
 block discarded – undo
513 513
 	 * to load the required classes, and don't need them at the time of unserialization
514 514
 	 * @return array
515 515
 	 */
516
-	public function __sleep(){
517
-		$properties =  get_object_vars( $this );
518
-		unset( $properties[ '_type_obj' ] );
519
-		return array_keys( $properties );
516
+	public function __sleep() {
517
+		$properties = get_object_vars($this);
518
+		unset($properties['_type_obj']);
519
+		return array_keys($properties);
520 520
 	}
521 521
 
522 522
 
@@ -528,17 +528,17 @@  discard block
 block discarded – undo
528 528
 	 * @return int @see EE_Base_Class::save()
529 529
 	 * @throws \EE_Error
530 530
 	 */
531
-	public function save( $set_cols_n_values = array() ) {
532
-		$results =  parent::save( $set_cols_n_values );
533
-		if( $this->get_original( 'PMD_scope' ) !== $this->get( 'PMD_scope' ) ) {
531
+	public function save($set_cols_n_values = array()) {
532
+		$results = parent::save($set_cols_n_values);
533
+		if ($this->get_original('PMD_scope') !== $this->get('PMD_scope')) {
534 534
 			EE_Log::instance()->log(
535 535
 				__FILE__,
536 536
 				__FUNCTION__,
537 537
 				sprintf(
538
-					__( 'Set new scope on payment method %1$s to %2$s from %3$s on URL %4$s', 'event_espresso' ),
538
+					__('Set new scope on payment method %1$s to %2$s from %3$s on URL %4$s', 'event_espresso'),
539 539
 					$this->name(),
540
-					serialize( $this->get_original(  'PMD_scope' ) ),
541
-					serialize( $this->get( 'PMD_scope' ) ),
540
+					serialize($this->get_original('PMD_scope')),
541
+					serialize($this->get('PMD_scope')),
542 542
 					EE_Registry::instance()->REQ->get_current_page_permalink()
543 543
 				),
544 544
 				'payment_method_change'
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Select_Input.input.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php  if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); }
1
+<?php  if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3 3
  * Class EE_Select_Input
4 4
  *
@@ -10,22 +10,22 @@  discard block
 block discarded – undo
10 10
  * @since 				4.6
11 11
  *
12 12
  */
13
-class EE_Select_Input extends EE_Form_Input_With_Options_Base{
13
+class EE_Select_Input extends EE_Form_Input_With_Options_Base {
14 14
 
15 15
 	/**
16 16
 	 * @param array $answer_options
17 17
 	 * @param array $input_settings
18 18
 	 */
19
-	public function __construct( $answer_options, $input_settings = array() ) {
20
-		$this->_set_display_strategy( new EE_Select_Display_Strategy( $answer_options ) );
19
+	public function __construct($answer_options, $input_settings = array()) {
20
+		$this->_set_display_strategy(new EE_Select_Display_Strategy($answer_options));
21 21
 		$this->_add_validation_strategy(
22 22
 			new EE_Enum_Validation_Strategy(
23
-				isset( $input_settings['validation_error_message'] )
23
+				isset($input_settings['validation_error_message'])
24 24
 					? $input_settings['validation_error_message']
25 25
 					: null
26 26
 			)
27 27
 		);
28
-		parent::__construct( $answer_options, $input_settings );
28
+		parent::__construct($answer_options, $input_settings);
29 29
 	}
30 30
 
31 31
 }
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
validation/EE_Conditionally_Required_Validation_Strategy.strategy.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 		//so in case teh IPN is arriving later, let's try to process an IPN!
91 91
 		if($_SERVER['REQUEST_METHOD'] == 'POST'){
92 92
 			return $this->handle_ipn($_POST, $transaction );
93
-		}else{
93
+		} else{
94 94
 			return parent::finalize_payment_for( $transaction );
95 95
 		}
96 96
 	}
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @since 				4.6
9 9
  *
10 10
  */
11
-class EE_Conditionally_Required_Validation_Strategy extends EE_Validation_Strategy_Base{
11
+class EE_Conditionally_Required_Validation_Strategy extends EE_Validation_Strategy_Base {
12 12
 
13 13
 	/**
14 14
 	 * Array describing conditions necessary to make the input required.
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
 	 * @param string $validation_error_message
25 25
 	 * @param array $requirement_conditions
26 26
 	 */
27
-	public function __construct( $validation_error_message = null, $requirement_conditions = array() ) {
28
-		if( ! $validation_error_message ){
27
+	public function __construct($validation_error_message = null, $requirement_conditions = array()) {
28
+		if ( ! $validation_error_message) {
29 29
 			$validation_error_message = __("This field is required.", "event_espresso");
30 30
 		}
31
-		$this->set_requirement_conditions( $requirement_conditions );
32
-		parent::__construct( $validation_error_message );
31
+		$this->set_requirement_conditions($requirement_conditions);
32
+		parent::__construct($validation_error_message);
33 33
 	}
34 34
 
35 35
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @throws \EE_Validation_Error
45 45
 	 */
46 46
 	public function validate($normalized_value) {
47
-		if(
47
+		if (
48 48
 			(
49 49
 				$normalized_value === ''
50 50
 				|| $normalized_value === null
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 			)
53 53
 			&& $this->_input_is_required_server_side()
54 54
 		) {
55
-			throw new EE_Validation_Error( $this->get_validation_error_message(), 'required');
56
-		}else{
55
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'required');
56
+		} else {
57 57
 			return true;
58 58
 		}
59 59
 	}
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @return array
65 65
 	 * @throws \EE_Error
66 66
 	 */
67
-	public function get_jquery_validation_rule_array(){
67
+	public function get_jquery_validation_rule_array() {
68 68
 		return array(
69 69
 			'required'=> $this->_get_jquery_requirement_value(),
70 70
 			'messages' => array(
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 *
83 83
 	 * @param array $requirement_conditions
84 84
 	 */
85
-	public function set_requirement_conditions( $requirement_conditions ) {
85
+	public function set_requirement_conditions($requirement_conditions) {
86 86
 		$this->requirement_conditions = (array) $requirement_conditions;
87 87
 	}
88 88
 
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 	protected function _get_jquery_requirement_value() {
109 109
 		$requirement_value = '';
110 110
 		$conditions = $this->get_requirement_conditions();
111
-		if( ! is_array( $conditions ) ){
111
+		if ( ! is_array($conditions)) {
112 112
 			EE_Error::throw_exception_if_debugging(
113 113
 				sprintf(
114
-					__( 'Input requirement conditions must be an array. You provided %1$s', 'event_espresso' ),
114
+					__('Input requirement conditions must be an array. You provided %1$s', 'event_espresso'),
115 115
 					$this->_input->name()
116 116
 				),
117 117
 				__FILE__,
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 			);
121 121
 			return true;
122 122
 		}
123
-		if( count( $conditions ) > 1 ) {
123
+		if (count($conditions) > 1) {
124 124
 			EE_Error::throw_exception_if_debugging(
125 125
 				sprintf(
126
-					__( 'Required Validation Strategy does not yet support multiple conditions. You should add it! The related input is %1$s', 'event_espresso' ),
126
+					__('Required Validation Strategy does not yet support multiple conditions. You should add it! The related input is %1$s', 'event_espresso'),
127 127
 					$this->_input->name()
128 128
 				),
129 129
 				__FILE__,
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 				__LINE__
132 132
 			);
133 133
 		}
134
-		foreach( $conditions as $input_path => $op_and_value ) {
135
-			$input = $this->_input->find_section_from_path( $input_path );
136
-			if( ! $input instanceof EE_Form_Input_Base ) {
134
+		foreach ($conditions as $input_path => $op_and_value) {
135
+			$input = $this->_input->find_section_from_path($input_path);
136
+			if ( ! $input instanceof EE_Form_Input_Base) {
137 137
 				EE_Error::throw_exception_if_debugging(
138 138
 					sprintf(
139
-						__( 'Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'),
139
+						__('Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'),
140 140
 						$this->_input->name(),
141 141
 						$input_path
142 142
 					),
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
 				);
147 147
 				return false;
148 148
 			}
149
-			list( $op, $value ) = $this->_validate_op_and_value( $op_and_value );
149
+			list($op, $value) = $this->_validate_op_and_value($op_and_value);
150 150
 			//ok now the jquery dependency expression depends on the input's display strategy.
151
-			if( ! $input->get_display_strategy() instanceof EE_Select_Display_Strategy ) {
151
+			if ( ! $input->get_display_strategy() instanceof EE_Select_Display_Strategy) {
152 152
 				EE_Error::throw_exception_if_debugging(
153 153
 					sprintf(
154
-						__( 'Required Validation Strategy can only depend on another input which uses the EE_Select_Display_Strategy, but you specified a field "%1$s" that uses display strategy "%2$s". If you need others, please add support for it! The related input is %3$s', 'event_espresso' ),
154
+						__('Required Validation Strategy can only depend on another input which uses the EE_Select_Display_Strategy, but you specified a field "%1$s" that uses display strategy "%2$s". If you need others, please add support for it! The related input is %3$s', 'event_espresso'),
155 155
 						$input->name(),
156
-						get_class( $input->get_display_strategy() ),
156
+						get_class($input->get_display_strategy()),
157 157
 						$this->_input->name()
158 158
 					),
159 159
 					__FILE__,
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 					__LINE__
162 162
 				);
163 163
 			}
164
-			$requirement_value = $input->html_id( true ) . ' option[value="' . $value . '"]:selected';
164
+			$requirement_value = $input->html_id(true).' option[value="'.$value.'"]:selected';
165 165
 		}
166 166
 		return $requirement_value;
167 167
 	}
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
 	protected function _input_is_required_server_side() {
180 180
 		$meets_all_requirements = true;
181 181
 		$conditions = $this->get_requirement_conditions();
182
-		foreach( $conditions as $input_path => $op_and_value ) {
183
-			$input = $this->_input->find_section_from_path( $input_path );
184
-			if( ! $input instanceof EE_Form_Input_Base ) {
182
+		foreach ($conditions as $input_path => $op_and_value) {
183
+			$input = $this->_input->find_section_from_path($input_path);
184
+			if ( ! $input instanceof EE_Form_Input_Base) {
185 185
 				EE_Error::throw_exception_if_debugging(
186 186
 					sprintf(
187
-						__( 'Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'),
187
+						__('Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'),
188 188
 						$this->_input->name(),
189 189
 						$input_path
190 190
 					),
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
 				);
195 195
 				return false;
196 196
 			}
197
-			list( $op, $value ) = $this->_validate_op_and_value( $op_and_value );
198
-			switch( $op ) {
197
+			list($op, $value) = $this->_validate_op_and_value($op_and_value);
198
+			switch ($op) {
199 199
 				case '=':
200 200
 				default:
201 201
 					$meets_all_requirements = $input->normalized_value() === $value;
202 202
 			}
203
-			if( ! $meets_all_requirements ) {
203
+			if ( ! $meets_all_requirements) {
204 204
 				break;
205 205
 			}
206 206
 		}
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 	 * @return array
218 218
 	 * @throws \EE_Error
219 219
 	 */
220
-	protected function _validate_op_and_value( $op_and_value ) {
221
-		if( ! isset( $op_and_value[ 0 ], $op_and_value[ 1 ] ) ) {
220
+	protected function _validate_op_and_value($op_and_value) {
221
+		if ( ! isset($op_and_value[0], $op_and_value[1])) {
222 222
 				EE_Error::throw_exception_if_debugging(
223 223
 					sprintf(
224
-						__( 'Required Validation Strategy conditions array\'s value must be an array with two elements: an operator, and a value. It didn\'t. The related input is %1$s', 'event_espresso' ),
224
+						__('Required Validation Strategy conditions array\'s value must be an array with two elements: an operator, and a value. It didn\'t. The related input is %1$s', 'event_espresso'),
225 225
 						$this->_input->name()
226 226
 					),
227 227
 					__FILE__,
@@ -229,12 +229,12 @@  discard block
 block discarded – undo
229 229
 					__LINE__
230 230
 				);
231 231
 			}
232
-			$operator = $op_and_value[ 0 ];
233
-			$value = (string) $op_and_value[ 1 ];
234
-			if( $operator !== '=' ) {
232
+			$operator = $op_and_value[0];
233
+			$value = (string) $op_and_value[1];
234
+			if ($operator !== '=') {
235 235
 				EE_Error::throw_exception_if_debugging(
236 236
 					sprintf(
237
-						__( 'Required Validation Strategy conditions can currently only use the equals operator. If you need others, please add support for it! The related input is %1$s', 'event_espresso' ),
237
+						__('Required Validation Strategy conditions can currently only use the equals operator. If you need others, please add support for it! The related input is %1$s', 'event_espresso'),
238 238
 						$this->_input->name()
239 239
 					),
240 240
 					__FILE__,
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 					__LINE__
243 243
 				);
244 244
 			}
245
-			return array( $operator, $value );
245
+			return array($operator, $value);
246 246
 
247 247
 	}
248 248
 }
Please login to merge, or discard this patch.
strategies/validation/EE_Validation_Strategy_Base.strategy.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	/**
23 23
 	 * @param null $validation_error_message
24 24
 	 */
25
-	public function __construct( $validation_error_message = null ) {
25
+	public function __construct($validation_error_message = null) {
26 26
 		$this->_validation_error_message = $validation_error_message === null
27
-			? __( 'Input invalid', 'event_espresso' )
27
+			? __('Input invalid', 'event_espresso')
28 28
 			: $validation_error_message;
29 29
 		parent::__construct();
30 30
 	}
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 *                                this validation strategy is the 'required' validation strategy,
42 42
 	 *                                most should be OK with a null, empty string, etc)
43 43
 	 */
44
-	public function validate( $normalized_value ) {
44
+	public function validate($normalized_value) {
45 45
 		//by default, the validation strategy does no validation. this should be implemented
46 46
 	}
47 47
 
Please login to merge, or discard this patch.
core/libraries/form_sections/base/EE_Form_Section_Base.form.php 2 patches
Spacing   +51 added lines, -51 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
 /**
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
 	 *	@type $name string the name for this form section, if you want to explicitly define it
80 80
 	 * }
81 81
 	 */
82
-	public function __construct( $options_array = array() ) {
82
+	public function __construct($options_array = array()) {
83 83
 		// used by display strategies
84 84
 		EE_Registry::instance()->load_helper('HTML');
85 85
 		// assign incoming values to properties
86
-		foreach( $options_array as $key => $value ) {
87
-			$key = '_' . $key;
88
-			if ( property_exists( $this, $key ) && empty( $this->{$key} )) {
86
+		foreach ($options_array as $key => $value) {
87
+			$key = '_'.$key;
88
+			if (property_exists($this, $key) && empty($this->{$key} )) {
89 89
 				$this->{$key} = $value;
90 90
 			}
91 91
 		}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * @param $name
99 99
 	 * @throws \EE_Error
100 100
 	 */
101
-	protected function _construct_finalize( $parent_form_section, $name ){
101
+	protected function _construct_finalize($parent_form_section, $name) {
102 102
 		$this->_construction_finalized = TRUE;
103 103
 		$this->_parent_section = $parent_form_section;
104 104
 		$this->_name = $name;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	/**
120 120
 	 * @param string $action
121 121
 	 */
122
-	public function set_action( $action ) {
122
+	public function set_action($action) {
123 123
 		$this->_action = $action;
124 124
 	}
125 125
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 * @return string
130 130
 	 */
131 131
 	public function method() {
132
-		return ! empty( $this->_method ) ? $this->_method : 'POST';
132
+		return ! empty($this->_method) ? $this->_method : 'POST';
133 133
 	}
134 134
 
135 135
 
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 	/**
138 138
 	 * @param string $method
139 139
 	 */
140
-	public function set_method( $method ) {
141
-		switch ( $method ) {
140
+	public function set_method($method) {
141
+		switch ($method) {
142 142
 			case 'get' :
143 143
 			case 'GET' :
144 144
 				$this->_method = 'GET';
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @throws \EE_Error
159 159
 	 */
160
-	protected function _set_default_html_id_if_empty(){
161
-		if( ! $this->_html_id ){
162
-			if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper ){
163
-				$this->_html_id = $this->_parent_section->html_id() . '-' . $this->_prep_name_for_html_id( $this->name() );
164
-			}else{
165
-				$this->_html_id = $this->_prep_name_for_html_id( $this->name() );
160
+	protected function _set_default_html_id_if_empty() {
161
+		if ( ! $this->_html_id) {
162
+			if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) {
163
+				$this->_html_id = $this->_parent_section->html_id().'-'.$this->_prep_name_for_html_id($this->name());
164
+			} else {
165
+				$this->_html_id = $this->_prep_name_for_html_id($this->name());
166 166
 			}
167 167
 		}
168 168
 	}
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 	 * @param $name
175 175
 	 * @return string
176 176
 	 */
177
-	private function _prep_name_for_html_id( $name ) {
178
-		return sanitize_key( str_replace( array( '&nbsp;', ' ', '_' ), '-', $name ));
177
+	private function _prep_name_for_html_id($name) {
178
+		return sanitize_key(str_replace(array('&nbsp;', ' ', '_'), '-', $name));
179 179
 	}
180 180
 
181 181
 
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 	 * @param bool $add_pound_sign
193 193
 	 * @return string
194 194
 	 */
195
-	public function html_id( $add_pound_sign = FALSE ){
196
-		return $add_pound_sign ? '#' . $this->_html_id : $this->_html_id;
195
+	public function html_id($add_pound_sign = FALSE) {
196
+		return $add_pound_sign ? '#'.$this->_html_id : $this->_html_id;
197 197
 	}
198 198
 
199 199
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	/**
202 202
 	 * @return string
203 203
 	 */
204
-	public function html_class(){
204
+	public function html_class() {
205 205
 		return $this->_html_class;
206 206
 	}
207 207
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	/**
211 211
 	 * @return string
212 212
 	 */
213
-	public function html_style(){
213
+	public function html_style() {
214 214
 		return $this->_html_style;
215 215
 	}
216 216
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	/**
220 220
 	 * @param mixed $html_class
221 221
 	 */
222
-	public function set_html_class( $html_class ) {
222
+	public function set_html_class($html_class) {
223 223
 		$this->_html_class = $html_class;
224 224
 	}
225 225
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	/**
229 229
 	 * @param mixed $html_id
230 230
 	 */
231
-	public function set_html_id( $html_id ) {
231
+	public function set_html_id($html_id) {
232 232
 		$this->_html_id = $html_id;
233 233
 	}
234 234
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	/**
238 238
 	 * @param mixed $html_style
239 239
 	 */
240
-	public function set_html_style( $html_style ) {
240
+	public function set_html_style($html_style) {
241 241
 		$this->_html_style = $html_style;
242 242
 	}
243 243
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	/**
247 247
 	 * @param string $other_html_attributes
248 248
 	 */
249
-	public function set_other_html_attributes( $other_html_attributes ) {
249
+	public function set_other_html_attributes($other_html_attributes) {
250 250
 		$this->_other_html_attributes = $other_html_attributes;
251 251
 	}
252 252
 
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
 	 * @throws EE_Error
267 267
 	 * @return string
268 268
 	 */
269
-	public function name(){
270
-		if( ! $this->_construction_finalized ){
271
-			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) ) );
269
+	public function name() {
270
+		if ( ! $this->_construction_finalized) {
271
+			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)));
272 272
 		}
273 273
 		return $this->_name;
274 274
 	}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 * Gets the parent section
280 280
 	 * @return EE_Form_Section_Proper
281 281
 	 */
282
-	public function parent_section(){
282
+	public function parent_section() {
283 283
 		return $this->_parent_section;
284 284
 	}
285 285
 
@@ -292,18 +292,18 @@  discard block
 block discarded – undo
292 292
 	 * @param string $other_attributes anything else added to the form open tag, MUST BE VALID HTML
293 293
 	 * @return string
294 294
 	 */
295
-	public function form_open( $action = '', $method = '', $other_attributes = '' ) {
296
-		if ( ! empty( $action )) {
297
-			$this->set_action( $action );
295
+	public function form_open($action = '', $method = '', $other_attributes = '') {
296
+		if ( ! empty($action)) {
297
+			$this->set_action($action);
298 298
 		}
299
-		if ( ! empty( $method )) {
300
-			$this->set_method( $method );
299
+		if ( ! empty($method)) {
300
+			$this->set_method($method);
301 301
 		}
302
-		$html = EEH_HTML::nl( 1, 'form' ) . '<form';
303
-		$html .= $this->html_id() !== '' ? ' id="' . $this->html_id() . '"' : '';
304
-		$html .= ' action="' . $this->action() . '"';
305
-		$html .= ' method="' . $this->method() . '"';
306
-		$html .= $other_attributes . '>';
302
+		$html = EEH_HTML::nl(1, 'form').'<form';
303
+		$html .= $this->html_id() !== '' ? ' id="'.$this->html_id().'"' : '';
304
+		$html .= ' action="'.$this->action().'"';
305
+		$html .= ' method="'.$this->method().'"';
306
+		$html .= $other_attributes.'>';
307 307
 		return $html;
308 308
 	}
309 309
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	 * @return string
315 315
 	 */
316 316
 	public function form_close() {
317
-		return EEH_HTML::nl( -1, 'form' ) . '</form>' . EEH_HTML::nl() . '<!-- end of ee-' . $this->html_id() . '-form -->' . EEH_HTML::nl();
317
+		return EEH_HTML::nl( -1, 'form' ).'</form>'.EEH_HTML::nl().'<!-- end of ee-'.$this->html_id().'-form -->'.EEH_HTML::nl();
318 318
 	}
319 319
 
320 320
 	/**
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	 * @param array $form_other_js_data
330 330
 	 * @return array
331 331
 	 */
332
-	public function get_other_js_data( $form_other_js_data = array() ) {
332
+	public function get_other_js_data($form_other_js_data = array()) {
333 333
 		return $form_other_js_data;
334 334
 	}
335 335
 
@@ -347,20 +347,20 @@  discard block
 block discarded – undo
347 347
 	 * @param string|false $form_section_path we accept false also because substr( '../', '../' ) = false
348 348
 	 * @return EE_Form_Section_Base
349 349
 	 */
350
-	public function find_section_from_path( $form_section_path ) {		
351
-		if( strpos( $form_section_path, '/' ) === 0 ) {
352
-			$form_section_path = substr( $form_section_path, strlen( '/' ) );
350
+	public function find_section_from_path($form_section_path) {		
351
+		if (strpos($form_section_path, '/') === 0) {
352
+			$form_section_path = substr($form_section_path, strlen('/'));
353 353
 		}
354
-		if( empty( $form_section_path ) ) {
354
+		if (empty($form_section_path)) {
355 355
 			return $this;
356 356
 		}
357
-		if( strpos( $form_section_path, '../' ) === 0 ) {
357
+		if (strpos($form_section_path, '../') === 0) {
358 358
 			$parent = $this->parent_section();
359 359
 			
360
-			$form_section_path = substr( $form_section_path, strlen( '../' ) );
361
-			if( $parent instanceof EE_Form_Section_Base ) {
362
-				return $parent->find_section_from_path( $form_section_path );
363
-			} elseif( empty( $form_section_path ) ) {
360
+			$form_section_path = substr($form_section_path, strlen('../'));
361
+			if ($parent instanceof EE_Form_Section_Base) {
362
+				return $parent->find_section_from_path($form_section_path);
363
+			} elseif (empty($form_section_path)) {
364 364
 				return $this;
365 365
 			}
366 366
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 		if( $normalized_value ){
34 34
 			if (filter_var($normalized_value, FILTER_VALIDATE_URL) === false){
35 35
 				throw new EE_Validation_Error( $this->get_validation_error_message(), 'invalid_url');
36
-			}else{
36
+			} else{
37 37
 				EE_Registry::instance()->load_helper('URL');
38 38
 				if( ! EEH_URL::remote_file_exists(
39 39
 						$normalized_value,
Please login to merge, or discard this patch.
strategies/validation/EE_Simple_HTML_Validation_Strategy.strategy.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@  discard block
 block discarded – undo
10 10
  * @since 				4.6
11 11
  *
12 12
  */
13
-class EE_Simple_HTML_Validation_Strategy extends EE_Validation_Strategy_Base{
13
+class EE_Simple_HTML_Validation_Strategy extends EE_Validation_Strategy_Base {
14 14
 
15 15
 	/**
16 16
 	 * @param null $validation_error_message
17 17
 	 */
18
-	public function __construct( $validation_error_message = NULL ) {
19
-		if( ! $validation_error_message ){
18
+	public function __construct($validation_error_message = NULL) {
19
+		if ( ! $validation_error_message) {
20 20
 			$allowedtags = $this->_get_allowed_tags();
21
-			$validation_error_message = sprintf( __( "Only simple HTML tags are allowed. Eg, %s", "event_espresso" ), implode( ",", array_keys( $allowedtags ) ) );
21
+			$validation_error_message = sprintf(__("Only simple HTML tags are allowed. Eg, %s", "event_espresso"), implode(",", array_keys($allowedtags)));
22 22
 		}
23
-		parent::__construct( $validation_error_message );
23
+		parent::__construct($validation_error_message);
24 24
 	}
25 25
 
26 26
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function get_list_of_allowed_tags() {
45 45
 		$allowed_tags = $this->_get_allowed_tags();
46
-		ksort( $allowed_tags );
47
-		return implode( ', ', array_keys( $allowed_tags ) );
46
+		ksort($allowed_tags);
47
+		return implode(', ', array_keys($allowed_tags));
48 48
 	}
49 49
 
50 50
 
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function validate($normalized_value) {
57 57
 		$allowedtags = $this->_get_allowed_tags();
58
-		parent::validate( $normalized_value );
59
-		$normalized_value_sans_tags =  wp_kses( "$normalized_value",$allowedtags );
60
-		if ( strlen( $normalized_value ) > strlen( $normalized_value_sans_tags ) ) {
61
-			throw new EE_Validation_Error( $this->get_validation_error_message(), 'complex_html_tags' );
58
+		parent::validate($normalized_value);
59
+		$normalized_value_sans_tags = wp_kses("$normalized_value", $allowedtags);
60
+		if (strlen($normalized_value) > strlen($normalized_value_sans_tags)) {
61
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'complex_html_tags');
62 62
 		}
63 63
 	}
64 64
 }
65 65
\ No newline at end of file
Please login to merge, or discard this patch.