Completed
Branch BETA-4.9-message-activity (c2a8e0)
by
unknown
18:28 queued 10s
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.
modules/messages/EED_Messages.module.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 	 *
542 542
 	 * @param string  $payment_status The payment status being matched.
543 543
 	 *
544
-	 * @return string|bool The payment message type slug matching the status or false if no match.
544
+	 * @return string|false The payment message type slug matching the status or false if no match.
545 545
 	 */
546 546
 	protected static function _get_payment_message_type( $payment_status ) {
547 547
 		EE_Registry::instance()->load_helper( 'MSG_Template' );
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 	 * @since 4.9.0
872 872
 	 * @param $message_ids
873 873
 	 *
874
-	 * @return bool | EE_Messages_Queue  false if no messages sent.
874
+	 * @return EE_Messages_Queue | EE_Messages_Queue  false if no messages sent.
875 875
 	 */
876 876
 	public static function send_now( $message_ids ) {
877 877
 		self::_load_controller();
Please login to merge, or discard this patch.
Spacing   +177 added lines, -177 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @return EED_Module
70 70
 	 */
71 71
 	public static function instance() {
72
-		return parent::get_instance( __CLASS__ );
72
+		return parent::get_instance(__CLASS__);
73 73
 	}
74 74
 
75 75
 
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public static function set_hooks() {
86 86
 		//actions
87
-		add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 );
88
-		add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 2 );
87
+		add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2);
88
+		add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 2);
89 89
 		//filters
90
-		add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
91
-		add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
90
+		add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
91
+		add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
92 92
 		//register routes
93 93
 		self::_register_routes();
94 94
 	}
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public static function set_hooks_admin() {
103 103
 		//actions
104
-		add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 );
105
-		add_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array( 'EED_Messages', 'payment_reminder' ), 10 );
106
-		add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 3 );
107
-		add_action( 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations', array( 'EED_Messages', 'send_newsletter_message' ), 10, 2 );
108
-		add_action( 'AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array( 'EED_Messages', 'cancelled_registration' ), 10 );
109
-		add_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', array( 'EED_Messages', 'process_admin_payment' ), 10, 1 );
104
+		add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2);
105
+		add_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array('EED_Messages', 'payment_reminder'), 10);
106
+		add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 3);
107
+		add_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations', array('EED_Messages', 'send_newsletter_message'), 10, 2);
108
+		add_action('AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array('EED_Messages', 'cancelled_registration'), 10);
109
+		add_action('AHEE__EE_Admin_Page___process_admin_payment_notification', array('EED_Messages', 'process_admin_payment'), 10, 1);
110 110
 		//filters
111
-		add_filter( 'FHEE__EE_Admin_Page___process_resend_registration__success', array( 'EED_Messages', 'process_resend' ), 10, 2 );
112
-		add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
113
-		add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
111
+		add_filter('FHEE__EE_Admin_Page___process_resend_registration__success', array('EED_Messages', 'process_resend'), 10, 2);
112
+		add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
113
+		add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
114 114
 	}
115 115
 
116 116
 
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 	 * @return void
125 125
 	 */
126 126
 	protected static function _register_routes() {
127
-		EE_Config::register_route( 'msg_url_trigger', 'Messages', 'run' );
128
-		EE_Config::register_route( 'msg_cron_trigger', 'Messages', 'run_cron' );
129
-		EE_Config::register_route( 'msg_browser_trigger', 'Messages', 'browser_trigger' );
130
-		EE_Config::register_route( 'msg_browser_error_trigger', 'Messages', 'browser_error_trigger' );
131
-		do_action( 'AHEE__EED_Messages___register_routes' );
127
+		EE_Config::register_route('msg_url_trigger', 'Messages', 'run');
128
+		EE_Config::register_route('msg_cron_trigger', 'Messages', 'run_cron');
129
+		EE_Config::register_route('msg_browser_trigger', 'Messages', 'browser_trigger');
130
+		EE_Config::register_route('msg_browser_error_trigger', 'Messages', 'browser_error_trigger');
131
+		do_action('AHEE__EED_Messages___register_routes');
132 132
 	}
133 133
 
134 134
 
@@ -139,18 +139,18 @@  discard block
 block discarded – undo
139 139
 	 * @since 4.9.0
140 140
 	 * @param WP $WP
141 141
 	 */
142
-	public function browser_trigger( $WP ) {
142
+	public function browser_trigger($WP) {
143 143
 		//ensure controller is loaded
144 144
 		self::_load_controller();
145
-		$token = EE_Registry::instance()->REQ->get( 'token' );
145
+		$token = EE_Registry::instance()->REQ->get('token');
146 146
 		try {
147
-			$mtg = new EE_Message_Generated_From_Token( $token, 'html', self::$_message_resource_manager );
148
-			self::$_MSG_PROCESSOR->generate_and_send_now( $mtg );
149
-		} catch( EE_Error $e ) {
150
-			$error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' );
147
+			$mtg = new EE_Message_Generated_From_Token($token, 'html', self::$_message_resource_manager);
148
+			self::$_MSG_PROCESSOR->generate_and_send_now($mtg);
149
+		} catch (EE_Error $e) {
150
+			$error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso');
151 151
 			// add specific message for developers if WP_DEBUG in on
152
-			$error_msg .= '||' . $e->getMessage();
153
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
152
+			$error_msg .= '||'.$e->getMessage();
153
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
154 154
 		}
155 155
 	}
156 156
 
@@ -166,20 +166,20 @@  discard block
 block discarded – undo
166 166
 	 * @since 4.9.0
167 167
 	 * @param $WP
168 168
 	 */
169
-	public function browser_error_trigger( $WP ) {
170
-		$token = EE_Registry::instance()->REQ->get( 'token' );
171
-		if ( $token ) {
172
-			$message = EEM_Message::instance()->get_one_by_token( $token );
173
-			if ( $message instanceof EE_Message ) {
174
-				header( 'HTTP/1.1 200 OK' );
175
-				$error_msg = nl2br( $message->error_message() );
169
+	public function browser_error_trigger($WP) {
170
+		$token = EE_Registry::instance()->REQ->get('token');
171
+		if ($token) {
172
+			$message = EEM_Message::instance()->get_one_by_token($token);
173
+			if ($message instanceof EE_Message) {
174
+				header('HTTP/1.1 200 OK');
175
+				$error_msg = nl2br($message->error_message());
176 176
 				?>
177 177
 				<!DOCTYPE html>
178 178
 				<html>
179 179
 					<head></head>
180 180
 					<body>
181
-						<?php echo empty( $error_msg )
182
-						? esc_html__( 'Unfortunately, we were unable to capture the error message for this message.', 'event_espresso' )
181
+						<?php echo empty($error_msg)
182
+						? esc_html__('Unfortunately, we were unable to capture the error message for this message.', 'event_espresso')
183 183
 						: wp_kses(
184 184
 							$error_msg,
185 185
 							array(
@@ -214,19 +214,19 @@  discard block
 block discarded – undo
214 214
 	 * @throws EE_Error
215 215
 	 * @return    void
216 216
 	 */
217
-	public function run( $WP ) {
217
+	public function run($WP) {
218 218
 		//ensure controller is loaded
219 219
 		self::_load_controller();
220 220
 		// attempt to process message
221 221
 		try {
222 222
 			/** @type EE_Message_To_Generate_From_Request $message_to_generate */
223
-			$message_to_generate = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' );
224
-			self::$_MSG_PROCESSOR->generate_and_send_now( $message_to_generate );
225
-		} catch ( EE_Error $e ) {
226
-			$error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' );
223
+			$message_to_generate = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request');
224
+			self::$_MSG_PROCESSOR->generate_and_send_now($message_to_generate);
225
+		} catch (EE_Error $e) {
226
+			$error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso');
227 227
 			// add specific message for developers if WP_DEBUG in on
228
-			$error_msg .= '||' . $e->getMessage();
229
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
228
+			$error_msg .= '||'.$e->getMessage();
229
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
230 230
 		}
231 231
 	}
232 232
 
@@ -235,30 +235,30 @@  discard block
 block discarded – undo
235 235
 	 * This is triggered by the 'msg_cron_trigger' route.
236 236
 	 * @param WP $WP
237 237
 	 */
238
-	public function run_cron( $WP ) {
238
+	public function run_cron($WP) {
239 239
 		self::_load_controller();
240 240
 		//get required vars
241
-		$cron_type = EE_Registry::instance()->REQ->get( 'type' );
242
-		$nonce = EE_Registry::instance()->REQ->get( '_nonce' );
243
-		header( 'HTTP/1.1 200 OK' );
241
+		$cron_type = EE_Registry::instance()->REQ->get('type');
242
+		$nonce = EE_Registry::instance()->REQ->get('_nonce');
243
+		header('HTTP/1.1 200 OK');
244 244
 
245 245
 		//now let's verify nonce, if not valid exit immediately
246
-		if ( ! wp_verify_nonce( $nonce, 'EE_Messages_Scheduler_' . $cron_type ) ) {
246
+		if ( ! wp_verify_nonce($nonce, 'EE_Messages_Scheduler_'.$cron_type)) {
247 247
 			/**
248 248
 			 * trigger error so this gets in the error logs.  This is important because it happens on a non-user request.
249 249
 			 */
250
-			trigger_error( esc_attr__( 'Invalid Nonce', 'event_espresso' ) );
250
+			trigger_error(esc_attr__('Invalid Nonce', 'event_espresso'));
251 251
 		}
252 252
 
253
-		$method = 'batch_' . $cron_type . '_from_queue';
254
-		if ( method_exists( self::$_MSG_PROCESSOR, $method ) ) {
253
+		$method = 'batch_'.$cron_type.'_from_queue';
254
+		if (method_exists(self::$_MSG_PROCESSOR, $method)) {
255 255
 			self::$_MSG_PROCESSOR->$method();
256 256
 		} else {
257 257
 			//no matching task
258 258
 			/**
259 259
 			 * trigger error so this gets in the error logs.  This is important because it happens on a non user request.
260 260
 			 */
261
-			trigger_error( esc_attr( sprintf( __( 'There is no task corresponding to this route %s', 'event_espresso' ), $cron_type ) ) );
261
+			trigger_error(esc_attr(sprintf(__('There is no task corresponding to this route %s', 'event_espresso'), $cron_type)));
262 262
 		}
263 263
 		exit();
264 264
 	}
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 	 *
277 277
 	 * @return EE_Messages_Template_Pack
278 278
 	 */
279
-	public static function get_template_pack( $template_pack_name ) {
280
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
281
-		return EEH_MSG_Template::get_template_pack( $template_pack_name );
279
+	public static function get_template_pack($template_pack_name) {
280
+		EE_Registry::instance()->load_helper('MSG_Template');
281
+		return EEH_MSG_Template::get_template_pack($template_pack_name);
282 282
 	}
283 283
 
284 284
 
@@ -292,14 +292,14 @@  discard block
 block discarded – undo
292 292
 	 * @return EE_Messages_Template_Pack[]
293 293
 	 */
294 294
 	public static function get_template_packs() {
295
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
295
+		EE_Registry::instance()->load_helper('MSG_Template');
296 296
 
297 297
 		//for backward compat, let's make sure this returns in the same format as originally.
298 298
 		$template_pack_collection = EEH_MSG_Template::get_template_pack_collection();
299 299
 		$template_pack_collection->rewind();
300 300
 		$template_packs = array();
301
-		while ( $template_pack_collection->valid() ) {
302
-			$template_packs[ $template_pack_collection->current()->dbref ] = $template_pack_collection->current();
301
+		while ($template_pack_collection->valid()) {
302
+			$template_packs[$template_pack_collection->current()->dbref] = $template_pack_collection->current();
303 303
 			$template_pack_collection->next();
304 304
 		}
305 305
 		return $template_packs;
@@ -315,14 +315,14 @@  discard block
 block discarded – undo
315 315
 	 * @return void
316 316
 	 */
317 317
 	public static function set_autoloaders() {
318
-		if ( empty( self::$_MSG_PATHS ) ) {
318
+		if (empty(self::$_MSG_PATHS)) {
319 319
 			self::_set_messages_paths();
320
-			foreach ( self::$_MSG_PATHS as $path ) {
321
-				EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $path );
320
+			foreach (self::$_MSG_PATHS as $path) {
321
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($path);
322 322
 			}
323 323
 			// add aliases
324
-			EEH_Autoloader::add_alias( 'EE_messages', 'EE_messages' );
325
-			EEH_Autoloader::add_alias( 'EE_messenger', 'EE_messenger' );
324
+			EEH_Autoloader::add_alias('EE_messages', 'EE_messages');
325
+			EEH_Autoloader::add_alias('EE_messenger', 'EE_messenger');
326 326
 		}
327 327
 	}
328 328
 
@@ -350,10 +350,10 @@  discard block
 block discarded – undo
350 350
 			'shortcodes',
351 351
 			);
352 352
 		$paths = array();
353
-		foreach ( $dir_ref as $index => $dir ) {
354
-			$paths[ $index ] = EE_LIBRARIES . $dir;
353
+		foreach ($dir_ref as $index => $dir) {
354
+			$paths[$index] = EE_LIBRARIES.$dir;
355 355
 		}
356
-		self::$_MSG_PATHS = apply_filters( 'FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths );
356
+		self::$_MSG_PATHS = apply_filters('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths);
357 357
 	}
358 358
 
359 359
 
@@ -364,12 +364,12 @@  discard block
 block discarded – undo
364 364
 	 * @return void
365 365
 	 */
366 366
 	protected static function _load_controller() {
367
-		if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor ) {
368
-			EE_Registry::instance()->load_core( 'Request_Handler' );
367
+		if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor) {
368
+			EE_Registry::instance()->load_core('Request_Handler');
369 369
 			self::set_autoloaders();
370
-			self::$_EEMSG = EE_Registry::instance()->load_lib( 'messages' );
371
-			self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib( 'Messages_Processor' );
372
-			self::$_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
370
+			self::$_EEMSG = EE_Registry::instance()->load_lib('messages');
371
+			self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib('Messages_Processor');
372
+			self::$_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
373 373
 		}
374 374
 	}
375 375
 
@@ -378,10 +378,10 @@  discard block
 block discarded – undo
378 378
 	/**
379 379
 	 * @param EE_Transaction $transaction
380 380
 	 */
381
-	public static function payment_reminder( EE_Transaction $transaction ) {
381
+	public static function payment_reminder(EE_Transaction $transaction) {
382 382
 		self::_load_controller();
383
-		$data = array( $transaction, null );
384
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'payment_reminder', $data );
383
+		$data = array($transaction, null);
384
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('payment_reminder', $data);
385 385
 	}
386 386
 
387 387
 
@@ -392,14 +392,14 @@  discard block
 block discarded – undo
392 392
 	 * @param  EE_Payment object
393 393
 	 * @return void
394 394
 	 */
395
-	public static function payment( EE_Transaction $transaction, EE_Payment $payment ) {
395
+	public static function payment(EE_Transaction $transaction, EE_Payment $payment) {
396 396
 		self::_load_controller();
397
-		$data = array( $transaction, $payment );
398
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
399
-		$message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() );
397
+		$data = array($transaction, $payment);
398
+		EE_Registry::instance()->load_helper('MSG_Template');
399
+		$message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID());
400 400
 		//if payment amount is less than 0 then switch to payment_refund message type.
401 401
 		$message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type;
402
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data );
402
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data);
403 403
 	}
404 404
 
405 405
 
@@ -407,10 +407,10 @@  discard block
 block discarded – undo
407 407
 	/**
408 408
 	 * @param EE_Transaction $transaction
409 409
 	 */
410
-	public static function cancelled_registration( EE_Transaction $transaction ) {
410
+	public static function cancelled_registration(EE_Transaction $transaction) {
411 411
 		self::_load_controller();
412
-		$data = array( $transaction, null );
413
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'cancelled_registration', $data );
412
+		$data = array($transaction, null);
413
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('cancelled_registration', $data);
414 414
 	}
415 415
 
416 416
 
@@ -423,9 +423,9 @@  discard block
 block discarded – undo
423 423
 	 * @param array $extra_details
424 424
 	 * @return void
425 425
 	 */
426
-	public static function maybe_registration( EE_Registration $registration, $extra_details = array() ) {
426
+	public static function maybe_registration(EE_Registration $registration, $extra_details = array()) {
427 427
 
428
-		if ( ! self::_verify_registration_notification_send( $registration, $extra_details ) ) {
428
+		if ( ! self::_verify_registration_notification_send($registration, $extra_details)) {
429 429
 			//no messages please
430 430
 			return;
431 431
 		}
@@ -440,22 +440,22 @@  discard block
 block discarded – undo
440 440
 		$mtgs = array();
441 441
 
442 442
 		//loop through registrations and trigger messages once per status.
443
-		foreach ( $all_registrations as $reg ) {
443
+		foreach ($all_registrations as $reg) {
444 444
 
445 445
 			//already triggered?
446
-			if ( in_array( $reg->status_ID(), $statuses_sent ) ) {
446
+			if (in_array($reg->status_ID(), $statuses_sent)) {
447 447
 				continue;
448 448
 			}
449 449
 
450
-			$message_type = EEH_MSG_Template::convert_reg_status_to_message_type( $reg->status_ID() );
451
-			$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( $message_type, array( $registration->transaction(), null, $reg->status_ID() ) );
450
+			$message_type = EEH_MSG_Template::convert_reg_status_to_message_type($reg->status_ID());
451
+			$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers($message_type, array($registration->transaction(), null, $reg->status_ID()));
452 452
 			$statuses_sent[] = $reg->status_ID();
453 453
 		}
454 454
 
455
-		$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( 'registration_summary', array( $registration->transaction(), null ) );
455
+		$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers('registration_summary', array($registration->transaction(), null));
456 456
 
457 457
 		//batch queue and initiate request
458
-		self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $mtgs );
458
+		self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($mtgs);
459 459
 		self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority();
460 460
 	}
461 461
 
@@ -470,39 +470,39 @@  discard block
 block discarded – undo
470 470
 	 *
471 471
 	 * @return bool          true = send away, false = nope halt the presses.
472 472
 	 */
473
-	protected static function _verify_registration_notification_send( EE_Registration $registration, $extra_details = array() ) {
473
+	protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array()) {
474 474
 		 //self::log(
475 475
 		 //	__CLASS__, __FUNCTION__, __LINE__,
476 476
 		 //	$registration->transaction(),
477 477
 		 //	array( '$extra_details' => $extra_details )
478 478
 		 //);
479 479
 		// currently only using this to send messages for the primary registrant
480
-		if ( ! $registration->is_primary_registrant() ) {
480
+		if ( ! $registration->is_primary_registrant()) {
481 481
 			return false;
482 482
 		}
483 483
 		// first we check if we're in admin and not doing front ajax
484
-		if ( is_admin() && ! EE_FRONT_AJAX ) {
484
+		if (is_admin() && ! EE_FRONT_AJAX) {
485 485
 			//make sure appropriate admin params are set for sending messages
486
-			if ( empty( $_REQUEST['txn_reg_status_change']['send_notifications'] ) || ! absint( $_REQUEST['txn_reg_status_change']['send_notifications'] ) ) {
486
+			if (empty($_REQUEST['txn_reg_status_change']['send_notifications']) || ! absint($_REQUEST['txn_reg_status_change']['send_notifications'])) {
487 487
 				//no messages sent please.
488 488
 				return false;
489 489
 			}
490 490
 		} else {
491 491
 			// frontend request (either regular or via AJAX)
492 492
 			// TXN is NOT finalized ?
493
-			if ( ! isset( $extra_details['finalized'] ) || $extra_details['finalized'] === false ) {
493
+			if ( ! isset($extra_details['finalized']) || $extra_details['finalized'] === false) {
494 494
 				return false;
495 495
 			}
496 496
 			// return visit but nothing changed ???
497 497
 			if (
498
-				isset( $extra_details['revisit'], $extra_details['status_updates'] ) &&
498
+				isset($extra_details['revisit'], $extra_details['status_updates']) &&
499 499
 				$extra_details['revisit'] && ! $extra_details['status_updates']
500 500
 			) {
501 501
 				return false;
502 502
 			}
503 503
 			// NOT sending messages && reg status is something other than "Not-Approved"
504 504
 			if (
505
-				! apply_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', false ) &&
505
+				! apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) &&
506 506
 				$registration->status_ID() !== EEM_Registration::status_id_not_approved
507 507
 			) {
508 508
 				return false;
@@ -524,10 +524,10 @@  discard block
 block discarded – undo
524 524
 	 *
525 525
 	 * @return array
526 526
 	 */
527
-	protected static function _get_reg_status_array( $reg_status = '' ) {
528
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
529
-		return EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status )
530
-			? EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status )
527
+	protected static function _get_reg_status_array($reg_status = '') {
528
+		EE_Registry::instance()->load_helper('MSG_Template');
529
+		return EEH_MSG_Template::convert_reg_status_to_message_type($reg_status)
530
+			? EEH_MSG_Template::convert_reg_status_to_message_type($reg_status)
531 531
 			: EEH_MSG_Template::reg_status_to_message_type_array();
532 532
 	}
533 533
 
@@ -543,10 +543,10 @@  discard block
 block discarded – undo
543 543
 	 *
544 544
 	 * @return string|bool The payment message type slug matching the status or false if no match.
545 545
 	 */
546
-	protected static function _get_payment_message_type( $payment_status ) {
547
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
548
-		return EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status )
549
-			? EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status )
546
+	protected static function _get_payment_message_type($payment_status) {
547
+		EE_Registry::instance()->load_helper('MSG_Template');
548
+		return EEH_MSG_Template::convert_payment_status_to_message_type($payment_status)
549
+			? EEH_MSG_Template::convert_payment_status_to_message_type($payment_status)
550 550
 			: false;
551 551
 	}
552 552
 
@@ -560,33 +560,33 @@  discard block
 block discarded – undo
560 560
 	 * @param array $req_data This is the $_POST & $_GET data sent from EE_Admin Pages
561 561
 	 * @return bool          success/fail
562 562
 	 */
563
-	public static function process_resend( $req_data ) {
563
+	public static function process_resend($req_data) {
564 564
 		self::_load_controller();
565 565
 
566 566
 		//if $msgID in this request then skip to the new resend_message
567
-		if ( EE_Registry::instance()->REQ->get( 'MSG_ID' ) ) {
567
+		if (EE_Registry::instance()->REQ->get('MSG_ID')) {
568 568
 			return self::resend_message();
569 569
 		}
570 570
 
571 571
 		//make sure any incoming request data is set on the REQ so that it gets picked up later.
572 572
 		$req_data = (array) $req_data;
573
-		foreach( $req_data as $request_key => $request_value ) {
574
-			EE_Registry::instance()->REQ->set( $request_key, $request_value );
573
+		foreach ($req_data as $request_key => $request_value) {
574
+			EE_Registry::instance()->REQ->set($request_key, $request_value);
575 575
 		}
576 576
 
577
-		if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request() ) {
577
+		if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request()) {
578 578
 			return false;
579 579
 		}
580 580
 
581 581
 		try {
582
-			self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $messages_to_send );
582
+			self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($messages_to_send);
583 583
 			self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority();
584
-		} catch( EE_Error $e ) {
585
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
584
+		} catch (EE_Error $e) {
585
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
586 586
 			return false;
587 587
 		}
588 588
 		EE_Error::add_success(
589
-			__( 'Messages have been successfully queued for generation and sending.', 'event_espresso' )
589
+			__('Messages have been successfully queued for generation and sending.', 'event_espresso')
590 590
 		);
591 591
 		return true; //everything got queued.
592 592
 	}
@@ -599,17 +599,17 @@  discard block
 block discarded – undo
599 599
 	public static function resend_message() {
600 600
 		self::_load_controller();
601 601
 
602
-		$msgID = EE_Registry::instance()->REQ->get( 'MSG_ID' );
603
-		if ( ! $msgID ) {
604
-			EE_Error::add_error( __( 'Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
602
+		$msgID = EE_Registry::instance()->REQ->get('MSG_ID');
603
+		if ( ! $msgID) {
604
+			EE_Error::add_error(__('Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
605 605
 			return false;
606 606
 		}
607 607
 
608
-		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( (array) $msgID );
608
+		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send((array) $msgID);
609 609
 
610 610
 		//setup success message.
611
-		$count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend );
612
-		EE_Error::add_success( sprintf(
611
+		$count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend);
612
+		EE_Error::add_success(sprintf(
613 613
 			_n(
614 614
 				'There was %d message queued for resending.',
615 615
 				'There were %d messages queued for resending.',
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 				'event_espresso'
618 618
 			),
619 619
 			$count_ready_for_resend
620
-		) );
620
+		));
621 621
 		return true;
622 622
 	}
623 623
 
@@ -630,13 +630,13 @@  discard block
 block discarded – undo
630 630
 	 * @param  EE_Payment $payment EE_payment object
631 631
 	 * @return bool              success/fail
632 632
 	 */
633
-	public static function process_admin_payment( EE_Payment $payment ) {
634
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
633
+	public static function process_admin_payment(EE_Payment $payment) {
634
+		EE_Registry::instance()->load_helper('MSG_Template');
635 635
 		//we need to get the transaction object
636 636
 		$transaction = $payment->transaction();
637
-		if ( $transaction instanceof EE_Transaction ) {
638
-			$data = array( $transaction, $payment );
639
-			$message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() );
637
+		if ($transaction instanceof EE_Transaction) {
638
+			$data = array($transaction, $payment);
639
+			$message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID());
640 640
 
641 641
 			//if payment amount is less than 0 then switch to payment_refund message type.
642 642
 			$message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type;
@@ -646,17 +646,17 @@  discard block
 block discarded – undo
646 646
 
647 647
 			self::_load_controller();
648 648
 
649
-			self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data );
649
+			self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data);
650 650
 
651 651
 			//get count of queued for generation
652
-			$count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_incomplete );
652
+			$count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete);
653 653
 
654
-			if ( $count_to_generate > 0 ) {
655
-				add_filter( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true' );
654
+			if ($count_to_generate > 0) {
655
+				add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true');
656 656
 				return true;
657 657
 			} else {
658
-				$count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::instance()->stati_indicating_failed_sending() );
659
-				EE_Error::add_error( sprintf(
658
+				$count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::instance()->stati_indicating_failed_sending());
659
+				EE_Error::add_error(sprintf(
660 660
 					_n(
661 661
 						'The payment notification generation failed.',
662 662
 						'%d payment notifications failed being sent.',
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 						'event_espresso'
665 665
 					),
666 666
 					$count_failed
667
-				), __FILE__, __FUNCTION__, __LINE__ );
667
+				), __FILE__, __FUNCTION__, __LINE__);
668 668
 				return false;
669 669
 			}
670 670
 		} else {
@@ -687,11 +687,11 @@  discard block
 block discarded – undo
687 687
 	 * @param  int      	      $grp_id     a specific message template group id.
688 688
 	 * @return void
689 689
 	 */
690
-	public static function send_newsletter_message( $registrations, $grp_id ) {
690
+	public static function send_newsletter_message($registrations, $grp_id) {
691 691
 		//make sure mtp is id and set it in the EE_Request Handler later messages setup.
692
-		EE_Registry::instance()->REQ->set( 'GRP_ID', (int) $grp_id );
692
+		EE_Registry::instance()->REQ->set('GRP_ID', (int) $grp_id);
693 693
 		self::_load_controller();
694
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'newsletter', $registrations );
694
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('newsletter', $registrations);
695 695
 	}
696 696
 
697 697
 
@@ -706,9 +706,9 @@  discard block
 block discarded – undo
706 706
 	 * @param string 	$message_type
707 707
 	 * @return 	string
708 708
 	 */
709
-	public static function registration_message_trigger_url( $registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice' ) {
709
+	public static function registration_message_trigger_url($registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice') {
710 710
 		// whitelist $messenger
711
-		switch ( $messenger ) {
711
+		switch ($messenger) {
712 712
 			case 'pdf' :
713 713
 				$sending_messenger = 'pdf';
714 714
 				$generating_messenger = 'html';
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
 				break;
721 721
 		}
722 722
 		// whitelist $message_type
723
-		switch ( $message_type ) {
723
+		switch ($message_type) {
724 724
 			case 'receipt' :
725 725
 				$message_type = 'receipt';
726 726
 				break;
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 				break;
731 731
 		}
732 732
 		// verify that both the messenger AND the message type are active
733
-		if ( EEH_MSG_Template::is_messenger_active( $sending_messenger ) && EEH_MSG_Template::is_mt_active( $message_type ) ) {
733
+		if (EEH_MSG_Template::is_messenger_active($sending_messenger) && EEH_MSG_Template::is_mt_active($message_type)) {
734 734
 			//need to get the correct message template group for this (i.e. is there a custom invoice for the event this registration is registered for?)
735 735
 			$template_query_params = array(
736 736
 				'MTP_is_active' => true,
@@ -739,16 +739,16 @@  discard block
 block discarded – undo
739 739
 				'Event.EVT_ID' => $registration->event_ID()
740 740
 			);
741 741
 			//get the message template group.
742
-			$msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) );
742
+			$msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params));
743 743
 			//if we don't have an EE_Message_Template_Group then return
744
-			if ( ! $msg_template_group instanceof EE_Message_Template_Group ) {
744
+			if ( ! $msg_template_group instanceof EE_Message_Template_Group) {
745 745
 				// remove EVT_ID from query params so that global templates get picked up
746
-				unset( $template_query_params['Event.EVT_ID'] );
746
+				unset($template_query_params['Event.EVT_ID']);
747 747
 				//get global template as the fallback
748
-				$msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) );
748
+				$msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params));
749 749
 			}
750 750
 			//if we don't have an EE_Message_Template_Group then return
751
-			if ( ! $msg_template_group instanceof EE_Message_Template_Group ) {
751
+			if ( ! $msg_template_group instanceof EE_Message_Template_Group) {
752 752
 				return '';
753 753
 			}
754 754
 			// generate the URL
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 	 * @param bool 	  $send true we will do a test send using the messenger delivery, false we just do a regular preview
778 778
 	 * @return string          The body of the message.
779 779
 	 */
780
-	public static function preview_message( $type, $context, $messenger, $send = false ) {
780
+	public static function preview_message($type, $context, $messenger, $send = false) {
781 781
 		self::_load_controller();
782 782
 		$mtg = new EE_Message_To_Generate(
783 783
 			$messenger,
@@ -786,8 +786,8 @@  discard block
 block discarded – undo
786 786
 			$context,
787 787
 			true
788 788
 		);
789
-		$generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview( $mtg );
790
-		if ( $generated_preview_queue instanceof EE_Messages_Queue ) {
789
+		$generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview($mtg);
790
+		if ($generated_preview_queue instanceof EE_Messages_Queue) {
791 791
 			return $generated_preview_queue->get_queue()->current()->content();
792 792
 		} else {
793 793
 			return $generated_preview_queue;
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 	 *
815 815
 	 * @return bool          success or fail.
816 816
 	 */
817
-	public static function send_message_with_messenger_only( $messenger, $message_type, EE_Messages_Queue $queue, $custom_subject = '' ) {
817
+	public static function send_message_with_messenger_only($messenger, $message_type, EE_Messages_Queue $queue, $custom_subject = '') {
818 818
 		self::_load_controller();
819 819
 		/** @type EE_Message_To_Generate_From_Queue $message_to_generate */
820 820
 		$message_to_generate = EE_Registry::instance()->load_lib(
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 				$custom_subject,
827 827
 			)
828 828
 		);
829
-		return self::$_MSG_PROCESSOR->queue_for_sending( $message_to_generate );
829
+		return self::$_MSG_PROCESSOR->queue_for_sending($message_to_generate);
830 830
 	}
831 831
 
832 832
 
@@ -839,22 +839,22 @@  discard block
 block discarded – undo
839 839
 	 * @param array     $message_ids An array of message ids
840 840
 	 * @return bool | EE_Messages_Queue     false if nothing was generated, EE_Messages_Queue containing generated messages.
841 841
 	 */
842
-	public static function generate_now( $message_ids ) {
842
+	public static function generate_now($message_ids) {
843 843
 		self::_load_controller();
844 844
 		$messages = EEM_Message::instance()->get_all(
845 845
 			array(
846 846
 				0 => array(
847
-					'MSG_ID' => array( 'IN', $message_ids ),
847
+					'MSG_ID' => array('IN', $message_ids),
848 848
 					'STS_ID' => EEM_Message::status_incomplete,
849 849
 				)
850 850
 			)
851 851
 		);
852 852
 
853
-		$generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue( $messages );
853
+		$generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue($messages);
854 854
 
855
-		if ( ! $generated_queue instanceof EE_Messages_Queue ) {
855
+		if ( ! $generated_queue instanceof EE_Messages_Queue) {
856 856
 			EE_Error::add_error(
857
-				__( 'The messages were not generated.  This is usually because there is already a batch being generated on a separate request.  You can wait a minute or two and try again.', 'event_espresso' ),
857
+				__('The messages were not generated.  This is usually because there is already a batch being generated on a separate request.  You can wait a minute or two and try again.', 'event_espresso'),
858 858
 				__FILE__, __FUNCTION__, __LINE__
859 859
 			);
860 860
 		}
@@ -873,28 +873,28 @@  discard block
 block discarded – undo
873 873
 	 *
874 874
 	 * @return bool | EE_Messages_Queue  false if no messages sent.
875 875
 	 */
876
-	public static function send_now( $message_ids ) {
876
+	public static function send_now($message_ids) {
877 877
 		self::_load_controller();
878 878
 		$messages = EEM_Message::instance()->get_all(
879 879
 			array(
880 880
 				0 => array(
881
-					'MSG_ID' => array( 'IN', $message_ids ),
882
-					'STS_ID' => array( 'IN', array( EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry ) )
881
+					'MSG_ID' => array('IN', $message_ids),
882
+					'STS_ID' => array('IN', array(EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry))
883 883
 				)
884 884
 			)
885 885
 		);
886 886
 
887
-		$sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue( $messages );
887
+		$sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue($messages);
888 888
 
889
-		if ( ! $sent_queue instanceof EE_Messages_Queue ) {
889
+		if ( ! $sent_queue instanceof EE_Messages_Queue) {
890 890
 			EE_Error::add_error(
891
-				__( 'The messages were not sent.  This is usually because there is already a batch being sent on a separate request.  You can wait a minute or two and try again.', 'event_espresso' ),
891
+				__('The messages were not sent.  This is usually because there is already a batch being sent on a separate request.  You can wait a minute or two and try again.', 'event_espresso'),
892 892
 				__FILE__, __FUNCTION__, __LINE__
893 893
 			);
894 894
 		} else {
895 895
 			//can count how many sent by using the messages in the queue
896
-			$sent_count = $sent_queue->count_STS_in_queue( EEM_Message::instance()->stati_indicating_sent() );
897
-			if ( $sent_count > 0 ) {
896
+			$sent_count = $sent_queue->count_STS_in_queue(EEM_Message::instance()->stati_indicating_sent());
897
+			if ($sent_count > 0) {
898 898
 				EE_Error::add_success(
899 899
 					sprintf(
900 900
 						_n(
@@ -909,8 +909,8 @@  discard block
 block discarded – undo
909 909
 			} else {
910 910
 				EE_Error::overwrite_errors();
911 911
 				EE_Error::add_error(
912
-					__( 'No message was sent because of problems with sending. Either all the messages you selected were not a sendable message, they were ALREADY sent on a different scheduled task, or there was an error.
913
-					If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso' ),
912
+					__('No message was sent because of problems with sending. Either all the messages you selected were not a sendable message, they were ALREADY sent on a different scheduled task, or there was an error.
913
+					If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso'),
914 914
 					__FILE__, __FUNCTION__, __LINE__
915 915
 				);
916 916
 			}
@@ -931,13 +931,13 @@  discard block
 block discarded – undo
931 931
 	 *
932 932
 	 * @return bool  true means messages were successfully queued for resending, false means none were queued for resending.
933 933
 	 */
934
-	public static function queue_for_resending( $message_ids ) {
934
+	public static function queue_for_resending($message_ids) {
935 935
 		self::_load_controller();
936
-		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( $message_ids );
936
+		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send($message_ids);
937 937
 
938 938
 		//get queue and count
939
-		$queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend );
940
-		if ( $queue_count > 0 ) {
939
+		$queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend);
940
+		if ($queue_count > 0) {
941 941
 			EE_Error::add_success(
942 942
 				sprintf(
943 943
 					_n(
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 			);
952 952
 		} else {
953 953
 			EE_Error::add_error(
954
-				__( 'No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso' ),
954
+				__('No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso'),
955 955
 				__FILE__, __FUNCTION__, __LINE__
956 956
 			);
957 957
 		}
@@ -973,16 +973,16 @@  discard block
 block discarded – undo
973 973
 	 * @param array $info
974 974
 	 * @param bool $display_request
975 975
 	 */
976
-	protected static function log( $class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false ) {
977
-		if ( WP_DEBUG && false ) {
978
-			if ( $transaction instanceof EE_Transaction ) {
976
+	protected static function log($class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false) {
977
+		if (WP_DEBUG && false) {
978
+			if ($transaction instanceof EE_Transaction) {
979 979
 				// don't serialize objects
980
-				$info = EEH_Debug_Tools::strip_objects( $info );
980
+				$info = EEH_Debug_Tools::strip_objects($info);
981 981
 				$info['TXN_status'] = $transaction->status_ID();
982 982
 				$info['TXN_reg_steps'] = $transaction->reg_steps();
983
-				if ( $transaction->ID() ) {
984
-					$index = 'EE_Transaction: ' . $transaction->ID();
985
-					EEH_Debug_Tools::log( $class, $func, $line, $info, $display_request, $index );
983
+				if ($transaction->ID()) {
984
+					$index = 'EE_Transaction: '.$transaction->ID();
985
+					EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index);
986 986
 				}
987 987
 			}
988 988
 		}
Please login to merge, or discard this patch.
admin/extend/messages/Custom_Messages_Template_List_Table.class.php 1 patch
Spacing   +59 added lines, -59 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
 /**
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 class Custom_Messages_Template_List_Table extends EE_Admin_List_Table {
31 31
 
32 32
 
33
-	public function __construct( $admin_page ) {
33
+	public function __construct($admin_page) {
34 34
 		//Set parent defaults
35 35
 		parent::__construct($admin_page);
36 36
 	}
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
 	protected function _setup_data() {
52
-		$this->_data = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, FALSE, FALSE, FALSE );
53
-		$this->_all_data_count = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, TRUE, TRUE, FALSE );
52
+		$this->_data = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, FALSE, FALSE, FALSE);
53
+		$this->_all_data_count = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, TRUE, TRUE, FALSE);
54 54
 	}
55 55
 
56 56
 
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 
60 60
 	protected function _set_properties() {
61 61
 		$this->_wp_list_args = array(
62
-			'singular' => __('Message Template Group', 'event_espresso' ),
63
-			'plural' => __('Message Template', 'event_espresso' ),
62
+			'singular' => __('Message Template Group', 'event_espresso'),
63
+			'plural' => __('Message Template', 'event_espresso'),
64 64
 			'ajax' => TRUE, //for now,
65 65
 			'screen' => $this->get_admin_page()->get_current_screen()->id
66 66
 			);
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
 			'cb' => '<input type="checkbox" />',
70 70
 			'name' => __('Template Name', 'event_espresso'),
71 71
 			'message_type' => __('Message Type', 'event_espresso'),
72
-			'messenger' => __( 'Messenger', 'event_espresso'),
73
-			'description' => __( 'Description', 'event_espresso' ),
74
-			'events' => __( 'Events', 'event_espresso'), //count of events using this template.
72
+			'messenger' => __('Messenger', 'event_espresso'),
73
+			'description' => __('Description', 'event_espresso'),
74
+			'events' => __('Events', 'event_espresso'), //count of events using this template.
75 75
 			'actions' => ''
76 76
 			//'messages_sent' => __( 'Total Sent', 'event_espresso' ) //todo this will come later when we've got message tracking in place.
77 77
 			);
78 78
 
79 79
 		$this->_sortable_columns = array(
80
-			'messenger' => array( 'MTP_messenger' => TRUE ),
80
+			'messenger' => array('MTP_messenger' => TRUE),
81 81
 			//'message_type' => array( 'MTP_message_type' => FALSE )
82 82
 			);
83 83
 
@@ -96,16 +96,16 @@  discard block
 block discarded – undo
96 96
 	 *
97 97
 	 * @return string
98 98
 	 */
99
-	public function single_row( $item ) {
99
+	public function single_row($item) {
100 100
 		$message_type = $item->message_type_obj();
101 101
 		$messenger = $item->messenger_obj();
102 102
 
103
-		if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger ) {
103
+		if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) {
104 104
 			echo '';
105 105
 			return;
106 106
 		}
107 107
 
108
-		parent::single_row( $item );
108
+		parent::single_row($item);
109 109
 	}
110 110
 
111 111
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		$mt_values = $this->get_admin_page()->get_message_types_for_list_table();
122 122
 		//setup messengers for selects
123 123
 		$m_values[0]['id'] = 'all';
124
-		$m_values[0]['text'] = __('All Messengers', 'event_espresso' );
124
+		$m_values[0]['text'] = __('All Messengers', 'event_espresso');
125 125
 
126 126
 		$msgr_default[0] = array(
127 127
 			'id' => 'none_selected',
@@ -133,28 +133,28 @@  discard block
 block discarded – undo
133 133
 			'text' => __('Show All', 'event_espresso')
134 134
 			);
135 135
 
136
-		$msgr_filters = !empty($m_values) ? array_merge( $msgr_default, $m_values ) : array();
137
-		$mt_filters = !empty($mt_values) ? array_merge( $mt_default, $mt_values ) : array();
136
+		$msgr_filters = ! empty($m_values) ? array_merge($msgr_default, $m_values) : array();
137
+		$mt_filters = ! empty($mt_values) ? array_merge($mt_default, $mt_values) : array();
138 138
 
139
-		if ( empty( $m_values ) )
139
+		if (empty($m_values))
140 140
 			$msgr_filters[0] = array(
141 141
 				'id' => 'no_messenger_options',
142 142
 				'text' => __('No Messengers active', 'event_espresso')
143 143
 				);
144 144
 
145
-		if ( empty($mt_values) )
145
+		if (empty($mt_values))
146 146
 			$mt_filters[0] = array(
147 147
 				'id' => 'no_message_type_options',
148 148
 				'text' => __('No Message Types active', 'event_espresso')
149 149
 				);
150 150
 
151
-		if ( count( $m_values ) >= 1  && !empty( $m_values ) ) {
152
-			unset( $msgr_filters[0] );
153
-			$msgr_filters = array_values( $msgr_filters ); //reindex keys
151
+		if (count($m_values) >= 1 && ! empty($m_values)) {
152
+			unset($msgr_filters[0]);
153
+			$msgr_filters = array_values($msgr_filters); //reindex keys
154 154
 		}
155 155
 
156
-		$filters[] = EEH_Form_Fields::select_input('ee_messenger_filter_by', $msgr_filters, isset($this->_req_data['ee_messenger_filter_by']) ? sanitize_key( $this->_req_data['ee_messenger_filter_by']) : '' );
157
-		$filters[] = EEH_Form_Fields::select_input('ee_message_type_filter_by', $mt_filters, isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_key( $this->_req_data['ee_message_type_filter_by']) : '');
156
+		$filters[] = EEH_Form_Fields::select_input('ee_messenger_filter_by', $msgr_filters, isset($this->_req_data['ee_messenger_filter_by']) ? sanitize_key($this->_req_data['ee_messenger_filter_by']) : '');
157
+		$filters[] = EEH_Form_Fields::select_input('ee_message_type_filter_by', $mt_filters, isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_key($this->_req_data['ee_message_type_filter_by']) : '');
158 158
 		return $filters;
159 159
 	}
160 160
 
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 	 * we're just removing the search box for message templates, not needed.
163 163
 	 * @return string (empty);
164 164
 	 */
165
-	function search_box( $text, $input_id ) {
165
+	function search_box($text, $input_id) {
166 166
 		return '';
167 167
 	}
168 168
 
169 169
 
170 170
 	protected function _add_view_counts() {
171
-		foreach ( $this->_views as $view => $args )  {
172
-			$this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates( $this->_per_page, $view, TRUE, TRUE, FALSE );
171
+		foreach ($this->_views as $view => $args) {
172
+			$this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates($this->_per_page, $view, TRUE, TRUE, FALSE);
173 173
 		}
174 174
 	}
175 175
 
@@ -183,16 +183,16 @@  discard block
 block discarded – undo
183 183
 	 * @return string
184 184
 	 */
185 185
 	public function no_items() {
186
-		if ( $this->_view !== 'trashed' )
187
-			printf( __('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>' );
186
+		if ($this->_view !== 'trashed')
187
+			printf(__('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>');
188 188
 		else
189 189
 			parent::no_items();
190 190
 	}
191 191
 
192 192
 
193 193
 
194
-	public function column_cb( $item ) {
195
-		return sprintf( '<input type="checkbox" name="checkbox[%s] value="1" />', $item->GRP_ID() );
194
+	public function column_cb($item) {
195
+		return sprintf('<input type="checkbox" name="checkbox[%s] value="1" />', $item->GRP_ID());
196 196
 	}
197 197
 
198 198
 
@@ -200,29 +200,29 @@  discard block
 block discarded – undo
200 200
 
201 201
 
202 202
 
203
-	function column_name( $item ) {
204
-		return '<p>' . $item->name() . '</p>';
203
+	function column_name($item) {
204
+		return '<p>'.$item->name().'</p>';
205 205
 	}
206 206
 
207 207
 
208 208
 
209 209
 
210
-	function column_description( $item ) {
211
-		return '<p>' . $item->description() . '</p>';
210
+	function column_description($item) {
211
+		return '<p>'.$item->description().'</p>';
212 212
 	}
213 213
 
214 214
 
215 215
 
216
-	function column_actions( $item ) {
217
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messages_add_new_message_template' ) ) {
216
+	function column_actions($item) {
217
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messages_add_new_message_template')) {
218 218
 			$create_args = array(
219 219
 				'GRP_ID' => $item->ID(),
220 220
 				'messenger' => $item->messenger(),
221 221
 				'message_type' => $item->message_type(),
222 222
 				'action' => 'add_new_message_template'
223 223
 				);
224
-			$create_link = EE_Admin_Page::add_query_args_and_nonce( $create_args, EE_MSG_ADMIN_URL );
225
-			return sprintf( '<p><a href="%s" class="button button-small">%s</a></p>', $create_link, __('Create Custom', 'event_espresso') );
224
+			$create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL);
225
+			return sprintf('<p><a href="%s" class="button button-small">%s</a></p>', $create_link, __('Create Custom', 'event_espresso'));
226 226
 		}
227 227
 		return '';
228 228
 	}
@@ -239,27 +239,27 @@  discard block
 block discarded – undo
239 239
 		$actions = array();
240 240
 
241 241
 		// edit link but only if item isn't trashed.
242
-		if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ) {
243
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_message_template', 'id'=>$item->GRP_ID() ), EE_MSG_ADMIN_URL );
244
-			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>';
242
+		if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID())) {
243
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID()), EE_MSG_ADMIN_URL);
244
+			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>';
245 245
 		}
246 246
 
247
-		$name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() )? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template', 'event_espresso' ) . '">' . ucwords( $item->messenger_obj()->label['singular'] ) . '</a>' : ucwords( $item->messenger_obj()->label['singular'] );
248
-		$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
247
+		$name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template', 'event_espresso').'">'.ucwords($item->messenger_obj()->label['singular']).'</a>' : ucwords($item->messenger_obj()->label['singular']);
248
+		$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL);
249 249
 		// restore link
250
-		$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
250
+		$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL);
251 251
 		// delete price link
252
-		$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
252
+		$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL);
253 253
 
254
-		if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_trash_message_template', $item->ID() ) ) {
255
-			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Move Template Group to Trash', 'event_espresso' ) . '">' . __( 'Move to Trash', 'event_espresso' ) . '</a>';
254
+		if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_trash_message_template', $item->ID())) {
255
+			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Move Template Group to Trash', 'event_espresso').'">'.__('Move to Trash', 'event_espresso').'</a>';
256 256
 		} else {
257
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_restore_message_template', $item->ID() ) ) {
258
-				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Message Template', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>';
257
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_restore_message_template', $item->ID())) {
258
+				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Message Template', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
259 259
 			}
260 260
 
261
-			if ( $this->_view == 'trashed' && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_delete_message_template', $item->ID() ) ) {
262
-				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Template Group Permanently', 'event_espresso' ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>';
261
+			if ($this->_view == 'trashed' && EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_delete_message_template', $item->ID())) {
262
+				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Template Group Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>';
263 263
 			}
264 264
 		}
265 265
 
@@ -268,15 +268,15 @@  discard block
 block discarded – undo
268 268
 		$c_configs = $item->contexts_config();
269 269
 		$ctxt = array();
270 270
 		$context_templates = $item->context_templates();
271
-		foreach ( $context_templates as $context => $template_fields ) {
272
-			$mtp_to = !empty( $context_templates[$context]['to'] ) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL;
273
-			$inactive = empty( $mtp_to ) && !empty( $context_templates[$context]['to'] ) ? ' class="mtp-inactive"' : '';
271
+		foreach ($context_templates as $context => $template_fields) {
272
+			$mtp_to = ! empty($context_templates[$context]['to']) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL;
273
+			$inactive = empty($mtp_to) && ! empty($context_templates[$context]['to']) ? ' class="mtp-inactive"' : '';
274 274
 			$context_title = ucwords($c_configs[$context]['label']);
275
-			$edit_link = EE_Admin_Page::add_query_args_and_nonce( array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL );
276
-			$ctxt[] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a' . $inactive . ' href="'. $edit_link . '" title="' . esc_attr__('Edit Context', 'event_espresso') . '">' . $context_title . '</a>' : $context_title;
275
+			$edit_link = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL);
276
+			$ctxt[] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a'.$inactive.' href="'.$edit_link.'" title="'.esc_attr__('Edit Context', 'event_espresso').'">'.$context_title.'</a>' : $context_title;
277 277
 		}
278 278
 
279
-		$ctx_content = !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? sprintf( __('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural']) ) . implode(' | ', $ctxt) : '';
279
+		$ctx_content = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? sprintf(__('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural'])).implode(' | ', $ctxt) : '';
280 280
 
281 281
 
282 282
 		//Return the name contents
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 										/* $1%s */ $name_link,
285 285
 										/* $2%s */ $item->GRP_ID(),
286 286
 										/* %4$s */ $ctx_content,
287
-										/* $3%s */ $this->row_actions( $actions )
287
+										/* $3%s */ $this->row_actions($actions)
288 288
 		);
289 289
 	}
290 290
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	 * @return string       message_type name
306 306
 	 */
307 307
 	function column_message_type($item) {
308
-		return ucwords($item->message_type_obj()->label['singular'] );
308
+		return ucwords($item->message_type_obj()->label['singular']);
309 309
 	}
310 310
 
311 311
 
Please login to merge, or discard this patch.
admin/extend/messages/espresso_events_Messages_Hooks_Extend.class.php 1 patch
Spacing   +41 added lines, -41 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
 /**
@@ -22,21 +22,21 @@  discard block
 block discarded – undo
22 22
 	 *
23 23
 	 * @param \EE_Admin_Page $admin_page
24 24
 	 */
25
-	public function __construct( EE_Admin_Page $admin_page ) {
25
+	public function __construct(EE_Admin_Page $admin_page) {
26 26
 		/**
27 27
 		 * Add cap restriction ... metaboxes should not show if user does not have the ability to edit_custom_messages
28 28
 		 */
29 29
 		if (
30
-			! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'messages_events_editor_metabox' )
30
+			! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'messages_events_editor_metabox')
31 31
 		) {
32 32
 			return;
33 33
 		}
34 34
 		add_filter(
35 35
 			'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks',
36
-			array( $this, 'caf_updates' ),
36
+			array($this, 'caf_updates'),
37 37
 			10
38 38
 		);
39
-		parent::__construct( $admin_page );
39
+		parent::__construct($admin_page);
40 40
 	}
41 41
 
42 42
 
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	protected function _extend_properties() {
51 51
 
52
-		define( 'EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/' );
52
+		define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/');
53 53
 		$this->_ajax_func = array(
54 54
 			'ee_msgs_create_new_custom' => 'create_new_custom'
55 55
 			);
56 56
 		$this->_metaboxes = array(
57 57
 			0 => array(
58
-				'page_route' => array('edit','create_new'),
58
+				'page_route' => array('edit', 'create_new'),
59 59
 				'func' => 'messages_metabox',
60 60
 				'label' => __('Notifications', 'event_espresso'),
61 61
 				'priority' => 'high'
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 		$this->_scripts_styles = array(
67 67
 			'registers' => array(
68 68
 				'events_msg_admin' => array(
69
-					'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js',
69
+					'url' => EE_MSGS_EXTEND_ASSETS_URL.'events_messages_admin.js',
70 70
 					'depends' => array('ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array')
71 71
 				),
72 72
 				'events_msg_admin_css' => array(
73
-					'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css',
73
+					'url' => EE_MSGS_EXTEND_ASSETS_URL.'ee_msg_events_admin.css',
74 74
 					'type' => 'css'
75 75
 				)
76 76
 			),
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	}
83 83
 
84 84
 
85
-	public function caf_updates( $update_callbacks ) {
86
-		$update_callbacks[] = array( $this, 'attach_evt_message_templates' );
85
+	public function caf_updates($update_callbacks) {
86
+		$update_callbacks[] = array($this, 'attach_evt_message_templates');
87 87
 		return $update_callbacks;
88 88
 	}
89 89
 
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 	 * @param  array    $data   The request data from the form
98 98
 	 * @return bool     		success or fail
99 99
 	 */
100
-	public function attach_evt_message_templates( $event, $data ) {
100
+	public function attach_evt_message_templates($event, $data) {
101 101
 		//first we remove all existing relations on the Event for message types.
102 102
 		$event->_remove_relations('Message_Template_Group');
103 103
 		//now let's just loop through the selected templates and add relations!
104
-		if ( isset( $data[ 'event_message_templates_relation' ] ) ) {
105
-			foreach ( $data[ 'event_message_templates_relation' ] as $grp_ID ) {
106
-				$event->_add_relation_to( $grp_ID, 'Message_Template_Group' );
104
+		if (isset($data['event_message_templates_relation'])) {
105
+			foreach ($data['event_message_templates_relation'] as $grp_ID) {
106
+				$event->_add_relation_to($grp_ID, 'Message_Template_Group');
107 107
 			}
108 108
 		}
109 109
 		//now save
@@ -118,25 +118,25 @@  discard block
 block discarded – undo
118 118
 	 * @return string
119 119
 	 * @throws \EE_Error
120 120
 	 */
121
-	public function messages_metabox( $event, $callback_args ) {
121
+	public function messages_metabox($event, $callback_args) {
122 122
 		//let's get the active messengers (b/c messenger objects have the active message templates)
123 123
 		//convert 'evt_id' to 'EVT_ID'
124
-		$this->_req_data['EVT_ID'] = isset( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : NULL;
125
-		$this->_req_data['EVT_ID'] = isset( $this->_req_data['post'] ) && empty( $this->_req_data['EVT_ID'] )
124
+		$this->_req_data['EVT_ID'] = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;
125
+		$this->_req_data['EVT_ID'] = isset($this->_req_data['post']) && empty($this->_req_data['EVT_ID'])
126 126
 			? $this->_req_data['post']
127 127
 			: $this->_req_data['EVT_ID'];
128 128
 
129
-		$this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID'] ) && isset($this->_req_data['evt_id'] )
129
+		$this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID']) && isset($this->_req_data['evt_id'])
130 130
 			? $this->_req_data['evt_id']
131 131
 			: $this->_req_data['EVT_ID'];
132 132
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
133
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
133
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
134 134
 		$active_messengers = $message_resource_manager->active_messengers();
135 135
 		$tabs = array();
136 136
 
137 137
 		//empty messengers?
138 138
 		//Note message types will always have at least one available because every messenger has a default message type associated with it (payment) if no other message types are selected.
139
-		if ( empty( $active_messengers ) ) {
139
+		if (empty($active_messengers)) {
140 140
 			$msg_activate_url = EE_Admin_Page::add_query_args_and_nonce(
141 141
 				array('action' => 'settings'),
142 142
 				EE_MSG_ADMIN_URL
@@ -145,11 +145,11 @@  discard block
 block discarded – undo
145 145
 				__('There are no active messengers. So no notifications will go out for %1$sany%2$s events.  You will want to %3$sActivate a Messenger%4$s.', 'event_espresso'),
146 146
 				'<strong>',
147 147
 				'</strong>',
148
-				'<a href="' . $msg_activate_url . '">',
148
+				'<a href="'.$msg_activate_url.'">',
149 149
 				'</a>'
150 150
 			);
151
-			$error_content = '<div class="error"><p>' . $error_msg . '</p></div>';
152
-			$internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>';
151
+			$error_content = '<div class="error"><p>'.$error_msg.'</p></div>';
152
+			$internal_content = '<div id="messages-error"><p>'.$error_msg.'</p></div>';
153 153
 
154 154
 			echo $error_content;
155 155
 			echo $internal_content;
@@ -158,20 +158,20 @@  discard block
 block discarded – undo
158 158
 
159 159
 		$event_id = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;
160 160
 		//get content for active messengers
161
-		foreach ( $active_messengers as $name => $messenger ) {
161
+		foreach ($active_messengers as $name => $messenger) {
162 162
 			//first check if there are any active message types for this messenger.
163
-			$active_mts = $message_resource_manager->get_active_message_types_for_messenger( $name );
164
-			if ( empty( $active_mts ) ) {
163
+			$active_mts = $message_resource_manager->get_active_message_types_for_messenger($name);
164
+			if (empty($active_mts)) {
165 165
 				continue;
166 166
 			}
167 167
 
168 168
 			$tab_content = $messenger->get_messenger_admin_page_content(
169 169
 				'events',
170 170
 				'edit',
171
-				array( 'event' => $event_id )
171
+				array('event' => $event_id)
172 172
 			);
173 173
 
174
-			if ( ! empty( $tab_content ) ) {
174
+			if ( ! empty($tab_content)) {
175 175
 				$tabs[$name] = $tab_content;
176 176
 			}
177 177
 		}
@@ -179,23 +179,23 @@  discard block
 block discarded – undo
179 179
 
180 180
 		//we want this to be tabbed content so let's use the EEH_Tabbed_Content::display helper.
181 181
 		$tabbed_content = EEH_Tabbed_Content::display($tabs);
182
-		if ( $tabbed_content instanceof WP_Error ) {
182
+		if ($tabbed_content instanceof WP_Error) {
183 183
 			$tabbed_content = $tabbed_content->get_error_message();
184 184
 		}
185 185
 
186 186
 		$notices = '
187 187
 	<div id="espresso-ajax-loading" class="ajax-loader-grey">
188
-		<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso') . '</span>
188
+		<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso').'</span>
189 189
 	</div>
190 190
 	<div class="ee-notices"></div>';
191 191
 
192
-		if ( defined('DOING_AJAX' ) ) {
192
+		if (defined('DOING_AJAX')) {
193 193
 			return $tabbed_content;
194 194
 		}
195 195
 
196
-		do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content' );
197
-		echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>';
198
-		do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content' );
196
+		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content');
197
+		echo $notices.'<div class="messages-tabs-content">'.$tabbed_content.'</div>';
198
+		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content');
199 199
 
200 200
 	}
201 201
 
@@ -210,15 +210,15 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	public function create_new_custom() {
212 212
 
213
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'create_new_custom_ajax' ) ) {
214
-			wp_die( __('You don\'t have privileges to do this action', 'event_espresso' ) );
213
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) {
214
+			wp_die(__('You don\'t have privileges to do this action', 'event_espresso'));
215 215
 		}
216 216
 
217 217
 		//let's clean up the _POST global a bit for downstream usage of name and description.
218
-		$_POST['templateName'] = !empty( $this->_req_data['custom_template_args']['MTP_name'] )
218
+		$_POST['templateName'] = ! empty($this->_req_data['custom_template_args']['MTP_name'])
219 219
 			? $this->_req_data['custom_template_args']['MTP_name']
220 220
 			: '';
221
-		$_POST['templateDescription'] = !empty( $this->_req_data['custom_template_args']['MTP_description'] )
221
+		$_POST['templateDescription'] = ! empty($this->_req_data['custom_template_args']['MTP_description'])
222 222
 			? $this->_req_data['custom_template_args']['MTP_description']
223 223
 			: '';
224 224
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		$this->_set_page_object();
228 228
 
229 229
 		// is this a template switch if so EE_Admin_Page child needs this object
230
-		$this->_page_object->set_hook_object( $this );
230
+		$this->_page_object->set_hook_object($this);
231 231
 
232 232
 		$this->_page_object->add_message_template(
233 233
 			$this->_req_data['messageType'],
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 */
252 252
 	public function edit_admin_footer() {
253 253
 		EEH_Template::display_template(
254
-			EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php'
254
+			EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/create_custom_template_form.template.php'
255 255
 		);
256 256
 	}
257 257
 
Please login to merge, or discard this patch.
caffeinated/admin/extend/events/Extend_Events_Admin_Page.core.php 1 patch
Spacing   +216 added lines, -216 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
 /**
@@ -30,25 +30,25 @@  discard block
 block discarded – undo
30 30
 class Extend_Events_Admin_Page extends Events_Admin_Page {
31 31
 
32 32
 
33
-	public function __construct( $routing = TRUE ) {
34
-		parent::__construct( $routing );
35
-		define( 'EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/');
36
-		define( 'EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/');
37
-		define( 'EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/');
33
+	public function __construct($routing = TRUE) {
34
+		parent::__construct($routing);
35
+		define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'events/templates/');
36
+		define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'events/assets/');
37
+		define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'events/assets/');
38 38
 	}
39 39
 
40 40
 
41 41
 	protected function _extend_page_config() {
42 42
 
43
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events';
43
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'events';
44 44
 		$default_espresso_boxes = $this->_default_espresso_metaboxes;
45 45
 
46 46
 		//is there a evt_id in the request?
47
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0;
48
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
47
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0;
48
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
49 49
 
50 50
 		//tkt_id?
51
-		$tkt_id = !empty( $this->_req_data['TKT_ID'] ) && ! is_array( $this->_req_data['TKT_ID'] ) ? $this->_req_data['TKT_ID'] : 0;
51
+		$tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) ? $this->_req_data['TKT_ID'] : 0;
52 52
 
53 53
 		$new_page_routes = array(
54 54
 			'duplicate_event' => array(
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
 				'capability' => 'ee_delete_default_ticket',
67 67
 				'obj_id' => $tkt_id,
68 68
 				'noheader' => TRUE,
69
-				'args' => array( 'trash' => TRUE )
69
+				'args' => array('trash' => TRUE)
70 70
 				),
71 71
 			'trash_tickets' => array(
72 72
 				'func' => '_trash_or_restore_ticket',
73 73
 				'capability' => 'ee_delete_default_tickets',
74 74
 				'noheader' => TRUE,
75
-				'args' => array( 'trash' => TRUE )
75
+				'args' => array('trash' => TRUE)
76 76
 				),
77 77
 			'restore_ticket' => array(
78 78
 				'func' => '_trash_or_restore_ticket',
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 				)
133 133
 			);
134 134
 
135
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
135
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
136 136
 
137 137
 
138 138
 		//partial route/config override
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 		$this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table';
145 145
 
146 146
 		//add tickets tab but only if there are more than one default ticket!
147
-		$tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array( array('TKT_is_default' => 1 ) ), 'TKT_ID', TRUE );
148
-		if ( $tkt_count > 1 ) {
147
+		$tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE);
148
+		if ($tkt_count > 1) {
149 149
 			$new_page_config = array(
150 150
 				'ticket_list_table' => array(
151 151
 					'nav' => array(
@@ -164,14 +164,14 @@  discard block
 block discarded – undo
164 164
 				'label' => __('Templates'),
165 165
 				'order' => 30
166 166
 			),
167
-			'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
167
+			'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
168 168
 			'help_tabs' => array(
169 169
 				'general_settings_templates_help_tab' => array(
170 170
 					'title' => __('Templates', 'event_espresso'),
171 171
 					'filename' => 'general_settings_templates'
172 172
 				)
173 173
 			),
174
-			'help_tour' => array( 'Templates_Help_Tour' ),
174
+			'help_tour' => array('Templates_Help_Tour'),
175 175
 			'require_nonce' => FALSE
176 176
 		);
177 177
 
@@ -190,26 +190,26 @@  discard block
 block discarded – undo
190 190
 //				'metaboxes' => $default_espresso_boxes,
191 191
 //				'require_nonce' => FALSE
192 192
 //		);
193
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
193
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
194 194
 
195 195
 		//add filters and actions
196 196
 		//modifying _views
197
-		add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array( $this, 'add_additional_datetime_button' ), 10, 2 );
198
-		add_filter('FHEE_event_datetime_metabox_clone_button_template', array( $this, 'add_datetime_clone_button' ), 10, 2 );
199
-		add_filter('FHEE_event_datetime_metabox_timezones_template', array( $this, 'datetime_timezones_template'), 10, 2 );
197
+		add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array($this, 'add_additional_datetime_button'), 10, 2);
198
+		add_filter('FHEE_event_datetime_metabox_clone_button_template', array($this, 'add_datetime_clone_button'), 10, 2);
199
+		add_filter('FHEE_event_datetime_metabox_timezones_template', array($this, 'datetime_timezones_template'), 10, 2);
200 200
 
201 201
 
202 202
 		//filters for event list table
203
-		add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array( $this, 'list_table_filters'), 10, 2);
204
-		add_filter('FHEE__Events_Admin_List_Table__column_actions__action_links', array( $this, 'extra_list_table_actions'), 10, 2 );
203
+		add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array($this, 'list_table_filters'), 10, 2);
204
+		add_filter('FHEE__Events_Admin_List_Table__column_actions__action_links', array($this, 'extra_list_table_actions'), 10, 2);
205 205
 
206 206
 		//legend item
207
-		add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array( $this, 'additional_legend_items') );
207
+		add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array($this, 'additional_legend_items'));
208 208
 
209
-		add_action('admin_init', array( $this, 'admin_init') );
209
+		add_action('admin_init', array($this, 'admin_init'));
210 210
 
211 211
 		//heartbeat stuff
212
-		add_filter( 'heartbeat_received', array( $this, 'heartbeat_response' ), 10, 2 );
212
+		add_filter('heartbeat_received', array($this, 'heartbeat_response'), 10, 2);
213 213
 
214 214
 	}
215 215
 
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
 		EE_Registry::$i18n_js_strings = array_merge(
223 223
 			EE_Registry::$i18n_js_strings,
224 224
 			array(
225
-				'image_confirm'          => __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' ),
226
-				'event_starts_on'        => __( 'Event Starts on', 'event_espresso' ),
227
-				'event_ends_on'          => __( 'Event Ends on', 'event_espresso' ),
228
-				'event_datetime_actions' => __( 'Actions', 'event_espresso' ),
229
-				'event_clone_dt_msg'     => __( 'Clone this Event Date and Time', 'event_espresso' ),
230
-				'remove_event_dt_msg'    => __( 'Remove this Event Time', 'event_espresso' )
225
+				'image_confirm'          => __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso'),
226
+				'event_starts_on'        => __('Event Starts on', 'event_espresso'),
227
+				'event_ends_on'          => __('Event Ends on', 'event_espresso'),
228
+				'event_datetime_actions' => __('Actions', 'event_espresso'),
229
+				'event_clone_dt_msg'     => __('Clone this Event Date and Time', 'event_espresso'),
230
+				'remove_event_dt_msg'    => __('Remove this Event Time', 'event_espresso')
231 231
 			)
232 232
 		);
233 233
 	}
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @return array  possibly appended response.
244 244
 	 */
245
-	public function heartbeat_response( $response, $data ) {
245
+	public function heartbeat_response($response, $data) {
246 246
 		/**
247 247
 		 * check whether count of tickets is approaching the potential
248 248
 		 * limits for the server.
249 249
 		 */
250
-		if ( ! empty( $data['input_count'] ) ) {
250
+		if ( ! empty($data['input_count'])) {
251 251
 			$response['max_input_vars_check'] = EE_Registry::instance()->CFG->environment->max_input_vars_limit_check($data['input_count']);
252 252
 		}
253 253
 
@@ -262,13 +262,13 @@  discard block
 block discarded – undo
262 262
 
263 263
 
264 264
 
265
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
266
-		$return = parent::extra_permalink_field_buttons( $return, $id, $new_title, $new_slug );
265
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
266
+		$return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug);
267 267
 		//make sure this is only when editing
268
-		if ( !empty( $id ) ) {
269
-			$href = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url );
268
+		if ( ! empty($id)) {
269
+			$href = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url);
270 270
 			$title = esc_attr__('Duplicate Event', 'event_espresso');
271
-			$return .= '<a href="' . $href . '" title="' . $title . '" id="ee-duplicate-event-button" class="button button-small"  value="duplicate_event">' . $title  . '</button>';
271
+			$return .= '<a href="'.$href.'" title="'.$title.'" id="ee-duplicate-event-button" class="button button-small"  value="duplicate_event">'.$title.'</button>';
272 272
 		}
273 273
 		return $return;
274 274
 	}
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 				'label' => __('Trash', 'event_espresso'),
292 292
 				'count' => 0,
293 293
 				'bulk_action' => array(
294
-					'restore_tickets' => __('Restore from Trash' , 'event_espresso'),
294
+					'restore_tickets' => __('Restore from Trash', 'event_espresso'),
295 295
 					'delete_tickets' => __('Delete Permanently', 'event_espresso')
296 296
 					)
297 297
 				)
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
 
303 303
 	public function load_scripts_styles_edit() {
304
-		wp_register_script( 'ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js', array( 'ee_admin_js', 'heartbeat' ), EVENT_ESPRESSO_VERSION, TRUE );
304
+		wp_register_script('ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL.'event-editor-heartbeat.js', array('ee_admin_js', 'heartbeat'), EVENT_ESPRESSO_VERSION, TRUE);
305 305
 
306 306
 		/**
307 307
 		 * load accounting js.
@@ -320,20 +320,20 @@  discard block
 block discarded – undo
320 320
 
321 321
 
322 322
 
323
-	public function add_additional_datetime_button( $template, $template_args ) {
324
-		return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php', $template_args, TRUE);
323
+	public function add_additional_datetime_button($template, $template_args) {
324
+		return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_add_additional_time.template.php', $template_args, TRUE);
325 325
 	}
326 326
 
327 327
 
328 328
 
329
-	public function add_datetime_clone_button( $template, $template_args ) {
330
-		return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php', $template_args, TRUE );
329
+	public function add_datetime_clone_button($template, $template_args) {
330
+		return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_metabox_clone_button.template.php', $template_args, TRUE);
331 331
 	}
332 332
 
333 333
 
334 334
 
335
-	public function datetime_timezones_template( $template, $template_args ) {
336
-		return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php', $template_args, TRUE );
335
+	public function datetime_timezones_template($template, $template_args) {
336
+		return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_timezones.template.php', $template_args, TRUE);
337 337
 	}
338 338
 
339 339
 
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
 	protected function _set_list_table_views_default() {
343 343
 		parent::_set_list_table_views_default();
344 344
 		$export_label = __('Export Events', 'event_espresso');
345
-		if ( EE_Registry::instance()->CAP->current_user_can( 'export', 'espresso_events_export' ) ) {
345
+		if (EE_Registry::instance()->CAP->current_user_can('export', 'espresso_events_export')) {
346 346
 //			$this->_views['all']['bulk_action']['export_events'] = $export_label;
347 347
 //			$this->_views['draft']['bulk_action']['export_events'] = $export_label;
348 348
 
349
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
349
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
350 350
 //				$this->_views['trash']['bulk_action']['export_events'] = $export_label;
351 351
 			}
352 352
 		}
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 			)
373 373
 		);
374 374
 
375
-		$this->_views = array_merge( $this->_views, $new_views);
375
+		$this->_views = array_merge($this->_views, $new_views);
376 376
 	}
377 377
 
378 378
 
@@ -386,17 +386,17 @@  discard block
 block discarded – undo
386 386
 
387 387
 
388 388
 
389
-	public function extra_list_table_actions( $actionlinks, $event ) {
390
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports', $event->ID() ) ) {
389
+	public function extra_list_table_actions($actionlinks, $event) {
390
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports', $event->ID())) {
391 391
 			$reports_query_args = array(
392 392
 					'action' => 'reports',
393 393
 					'EVT_ID' => $event->ID()
394 394
 				);
395
-			$reports_link = EE_Admin_Page::add_query_args_and_nonce( $reports_query_args, REG_ADMIN_URL );
396
-			$actionlinks[] = '<a href="' . $reports_link . '" title="' .  esc_attr__('View Report', 'event_espresso') . '"><div class="dashicons dashicons-chart-bar"></div></a>' . "\n\t";
395
+			$reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL);
396
+			$actionlinks[] = '<a href="'.$reports_link.'" title="'.esc_attr__('View Report', 'event_espresso').'"><div class="dashicons dashicons-chart-bar"></div></a>'."\n\t";
397 397
 		}
398
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_messages', 'view_filtered_messages' ) ) {
399
-			EE_Registry::instance()->load_helper( 'MSG_Template' );
398
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_messages', 'view_filtered_messages')) {
399
+			EE_Registry::instance()->load_helper('MSG_Template');
400 400
 			$actionlinks[] = EEH_MSG_Template::get_message_action_link(
401 401
 				'see_notifications_for',
402 402
 				null,
@@ -411,15 +411,15 @@  discard block
 block discarded – undo
411 411
 
412 412
 
413 413
 	public function additional_legend_items($items) {
414
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports' ) ) {
414
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports')) {
415 415
 			$items['reports'] = array(
416 416
 					'class' => 'dashicons dashicons-chart-bar',
417 417
 					'desc' => __('Event Reports', 'event_espresso')
418 418
 				);
419 419
 		}
420
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_messages', 'view_filtered_messages' ) ) {
421
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
422
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
420
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_messages', 'view_filtered_messages')) {
421
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
422
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
423 423
 				$items['view_related_messages'] = array(
424 424
 					'class' => $related_for_icon['css_class'],
425 425
 					'desc' => $related_for_icon['label'],
@@ -444,17 +444,17 @@  discard block
 block discarded – undo
444 444
 	 */
445 445
 	protected function _duplicate_event() {
446 446
 		//first make sure the ID for the event is in the request.  If it isnt' then we need to bail and redirect back to overview list table (cause how did we get here?)
447
-		if ( !isset( $this->_req_data['EVT_ID'] ) ) {
448
-			EE_Error::add_error( __('In order to duplicate an event an Event ID is required.  None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
449
-			$this->_redirect_after_action( FALSE, '', '', array(), TRUE );
447
+		if ( ! isset($this->_req_data['EVT_ID'])) {
448
+			EE_Error::add_error(__('In order to duplicate an event an Event ID is required.  None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
449
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
450 450
 			return;
451 451
 		}
452 452
 
453 453
 		//k we've got EVT_ID so let's use that to get the event we'll duplicate
454
-		$orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] );
454
+		$orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']);
455 455
 
456
-		if ( ! $orig_event instanceof EE_Event )
457
-			throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID'] ) );
456
+		if ( ! $orig_event instanceof EE_Event)
457
+			throw new EE_Error(sprintf(__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID']));
458 458
 
459 459
 		//k now let's clone the $orig_event before getting relations
460 460
 		$new_event = clone $orig_event;
@@ -467,43 +467,43 @@  discard block
 block discarded – undo
467 467
 
468 468
 
469 469
 		//reset the ID and modify other details to make it clear this is a dupe
470
-		$new_event->set( 'EVT_ID', 0 );
471
-		$new_name = $new_event->name() . ' ' . __('**DUPLICATE**', 'event_espresso');
472
-		$new_event->set( 'EVT_name',  $new_name );
473
-		$new_event->set( 'EVT_slug',  wp_unique_post_slug( sanitize_title( $orig_event->name() ), 0, 'publish', 'espresso_events', 0 ) );
474
-		$new_event->set( 'status', 'draft' );
470
+		$new_event->set('EVT_ID', 0);
471
+		$new_name = $new_event->name().' '.__('**DUPLICATE**', 'event_espresso');
472
+		$new_event->set('EVT_name', $new_name);
473
+		$new_event->set('EVT_slug', wp_unique_post_slug(sanitize_title($orig_event->name()), 0, 'publish', 'espresso_events', 0));
474
+		$new_event->set('status', 'draft');
475 475
 
476 476
 		//duplicate discussion settings
477
-		$new_event->set( 'comment_status', $orig_event->get('comment_status') );
478
-		$new_event->set( 'ping_status', $orig_event->get( 'ping_status' ) );
477
+		$new_event->set('comment_status', $orig_event->get('comment_status'));
478
+		$new_event->set('ping_status', $orig_event->get('ping_status'));
479 479
 
480 480
 		//save the new event
481 481
 		$new_event->save();
482 482
 
483 483
 		//venues
484
-		foreach( $orig_ven as $ven ) {
485
-			$new_event->_add_relation_to( $ven, 'Venue' );
484
+		foreach ($orig_ven as $ven) {
485
+			$new_event->_add_relation_to($ven, 'Venue');
486 486
 		}
487 487
 		$new_event->save();
488 488
 
489 489
 
490 490
 		//now we need to get the question group relations and handle that
491 491
 		//first primary question groups
492
-		$orig_primary_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 1 ) ) );
493
-		if ( !empty( $orig_primary_qgs ) ) {
494
-			foreach ( $orig_primary_qgs as $id => $obj ) {
495
-				if ( $obj instanceof EE_Question_Group ) {
496
-					$new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 1 ) );
492
+		$orig_primary_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 1)));
493
+		if ( ! empty($orig_primary_qgs)) {
494
+			foreach ($orig_primary_qgs as $id => $obj) {
495
+				if ($obj instanceof EE_Question_Group) {
496
+					$new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 1));
497 497
 				}
498 498
 			}
499 499
 		}
500 500
 
501 501
 		//next additional attendee question groups
502
-		$orig_additional_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 0 ) ) );
503
-		if ( !empty( $orig_additional_qgs ) ) {
504
-			foreach ( $orig_additional_qgs as $id => $obj ) {
505
-				if ( $obj instanceof EE_Question_Group ) {
506
-					$new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 0 ) );
502
+		$orig_additional_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0)));
503
+		if ( ! empty($orig_additional_qgs)) {
504
+			foreach ($orig_additional_qgs as $id => $obj) {
505
+				if ($obj instanceof EE_Question_Group) {
506
+					$new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 0));
507 507
 				}
508 508
 			}
509 509
 		}
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 
515 515
 		//k now that we have the new event saved we can loop through the datetimes and start adding relations.
516 516
 		$cloned_tickets = array();
517
-		foreach ( $orig_datetimes as $orig_dtt ) {
517
+		foreach ($orig_datetimes as $orig_dtt) {
518 518
 			$new_dtt = clone $orig_dtt;
519 519
 			$orig_tkts = $orig_dtt->tickets();
520 520
 
@@ -522,22 +522,22 @@  discard block
 block discarded – undo
522 522
 			$new_dtt->set('DTT_ID', 0);
523 523
 			$new_dtt->set('DTT_sold', 0);
524 524
 			$new_dtt->save();
525
-			$new_event->_add_relation_to( $new_dtt, 'Datetime');
525
+			$new_event->_add_relation_to($new_dtt, 'Datetime');
526 526
 			$new_event->save();
527 527
 
528 528
 			//now let's get the ticket relations setup.
529
-			foreach ( (array) $orig_tkts as $orig_tkt ) {
529
+			foreach ((array) $orig_tkts as $orig_tkt) {
530 530
 				//it's possible a datetime will have no tickets so let's verify we HAVE a ticket first.
531
-				if ( ! $orig_tkt instanceof EE_Ticket )
531
+				if ( ! $orig_tkt instanceof EE_Ticket)
532 532
 					continue;
533 533
 
534 534
 				//is this ticket archived?  If it is then let's skip
535
-				if ( $orig_tkt->get( 'TKT_deleted' ) ) {
535
+				if ($orig_tkt->get('TKT_deleted')) {
536 536
 					continue;
537 537
 				}
538 538
 
539 539
 				//does this original ticket already exist in the clone_tickets cache?  If so we'll just use the new ticket from it.
540
-				if ( isset( $cloned_tickets[$orig_tkt->ID()] ) ) {
540
+				if (isset($cloned_tickets[$orig_tkt->ID()])) {
541 541
 					$new_tkt = $cloned_tickets[$orig_tkt->ID()];
542 542
 				} else {
543 543
 					$new_tkt = clone $orig_tkt;
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 					$new_tkt->save(); //make sure new ticket has ID.
550 550
 
551 551
 					//price relations on new ticket need to be setup.
552
-					foreach ( $orig_prices as $orig_price ) {
552
+					foreach ($orig_prices as $orig_price) {
553 553
 						$new_price = clone $orig_price;
554 554
 						$new_price->set('PRC_ID', 0);
555 555
 						$new_price->save();
@@ -566,39 +566,39 @@  discard block
 block discarded – undo
566 566
 		}
567 567
 
568 568
 		//clone taxonomy information
569
-		$taxonomies_to_clone_with = apply_filters( 'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array( 'espresso_event_categories', 'espresso_event_type', 'post_tag' ) );
569
+		$taxonomies_to_clone_with = apply_filters('FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array('espresso_event_categories', 'espresso_event_type', 'post_tag'));
570 570
 
571 571
 		//get terms for original event (notice)
572
-		$orig_terms = wp_get_object_terms( $orig_event->ID(), $taxonomies_to_clone_with );
572
+		$orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with);
573 573
 
574 574
 		//loop through terms and add them to new event.
575
-		foreach ( $orig_terms as $term ) {
576
-			wp_set_object_terms( $new_event->ID(), $term->term_id, $term->taxonomy, true );
575
+		foreach ($orig_terms as $term) {
576
+			wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true);
577 577
 		}
578 578
 
579 579
 
580
-		do_action( 'AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event );
580
+		do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event);
581 581
 
582 582
 		//now let's redirect to the edit page for this duplicated event if we have a new event id.
583
-		if ( $new_event->ID() ) {
583
+		if ($new_event->ID()) {
584 584
 			$redirect_args = array(
585 585
 				'post' => $new_event->ID(),
586 586
 				'action' => 'edit'
587 587
 			);
588
-			EE_Error::add_success( __('Event successfully duplicated.  Please review the details below and make any necessary edits', 'event_espresso') );
588
+			EE_Error::add_success(__('Event successfully duplicated.  Please review the details below and make any necessary edits', 'event_espresso'));
589 589
 		} else {
590 590
 			$redirect_args = array(
591 591
 				'action' => 'default'
592 592
 				);
593
-			EE_Error::add_error( __('Not able to duplicate event.  Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
593
+			EE_Error::add_error(__('Not able to duplicate event.  Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
594 594
 		}
595 595
 
596
-		$this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE );
596
+		$this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE);
597 597
 	}
598 598
 
599 599
 
600 600
 
601
-	protected function _import_page(){
601
+	protected function _import_page() {
602 602
 
603 603
 		$title = __('Import', 'event_espresso');
604 604
 		$intro = __('If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ', 'event_espresso');
@@ -606,8 +606,8 @@  discard block
 block discarded – undo
606 606
 		$action = 'import_events';
607 607
 		$type = 'csv';
608 608
 		$this->_template_args['form'] = EE_Import::instance()->upload_form($title, $intro, $form_url, $action, $type);
609
-		$this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'),$this->_admin_base_url);
610
-		$content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php',$this->_template_args,true);
609
+		$this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'), $this->_admin_base_url);
610
+		$content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'import_page.template.php', $this->_template_args, true);
611 611
 
612 612
 
613 613
 		$this->_template_args['admin_page_content'] = $content;
@@ -620,9 +620,9 @@  discard block
 block discarded – undo
620 620
 	 * @return string html
621 621
 	 */
622 622
 	protected function _import_events() {
623
-		require_once(EE_CLASSES . 'EE_Import.class.php');
623
+		require_once(EE_CLASSES.'EE_Import.class.php');
624 624
 		$success = EE_Import::instance()->import();
625
-		$this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'),true);
625
+		$this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'), true);
626 626
 
627 627
 	}
628 628
 
@@ -636,23 +636,23 @@  discard block
 block discarded – undo
636 636
 	 * @return file
637 637
 	 */
638 638
 	protected function _events_export() {
639
-		if(isset($this->_req_data['EVT_ID'])){
639
+		if (isset($this->_req_data['EVT_ID'])) {
640 640
 			$event_ids = $this->_req_data['EVT_ID'];
641
-		}elseif(isset($this->_req_data['EVT_IDs'])){
641
+		}elseif (isset($this->_req_data['EVT_IDs'])) {
642 642
 			$event_ids = $this->_req_data['EVT_IDs'];
643
-		}else{
643
+		} else {
644 644
 			$event_ids = NULL;
645 645
 		}
646 646
 		//todo: I don't like doing this but it'll do until we modify EE_Export Class.
647 647
 		$new_request_args = array(
648 648
 			'export' => 'report',
649 649
 			'action' => 'all_event_data',
650
-			'EVT_ID' => $event_ids ,
650
+			'EVT_ID' => $event_ids,
651 651
 		);
652 652
 		$this->_req_data = array_merge($this->_req_data, $new_request_args);
653 653
 
654
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
655
-			require_once(EE_CLASSES . 'EE_Export.class.php');
654
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
655
+			require_once(EE_CLASSES.'EE_Export.class.php');
656 656
 			$EE_Export = EE_Export::instance($this->_req_data);
657 657
 			$EE_Export->export();
658 658
 		}
@@ -674,11 +674,11 @@  discard block
 block discarded – undo
674 674
 			'category_ids' => $this->_req_data['EVT_CAT_ID']
675 675
 			);
676 676
 
677
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
677
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
678 678
 
679
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) {
680
-			require_once( EE_CLASSES . 'EE_Export.class.php');
681
-			$EE_Export = EE_Export::instance( $this->_req_data );
679
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
680
+			require_once(EE_CLASSES.'EE_Export.class.php');
681
+			$EE_Export = EE_Export::instance($this->_req_data);
682 682
 			$EE_Export->export();
683 683
 		}
684 684
 
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 	/**
690 690
 	 * Creates a sample CSV file for importing
691 691
 	 */
692
-	protected function _sample_export_file(){
692
+	protected function _sample_export_file() {
693 693
 //		require_once(EE_CLASSES . 'EE_Export.class.php');
694 694
 		EE_Export::instance()->export_sample();
695 695
 	}
@@ -706,10 +706,10 @@  discard block
 block discarded – undo
706 706
 		 * Note leaving this filter in for backward compatibility this was moved in 4.6.x
707 707
 		 * from General_Settings_Admin_Page to here.
708 708
 		 */
709
-		$this->_template_args = apply_filters( 'FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args );
710
-		$this->_set_add_edit_form_tags( 'update_template_settings' );
711
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
712
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php', $this->_template_args, TRUE );
709
+		$this->_template_args = apply_filters('FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args);
710
+		$this->_set_add_edit_form_tags('update_template_settings');
711
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
712
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'template_settings.template.php', $this->_template_args, TRUE);
713 713
 		$this->display_admin_page_with_sidebar();
714 714
 	}
715 715
 
@@ -721,24 +721,24 @@  discard block
 block discarded – undo
721 721
 		 * Note leaving this filter in for backward compatibility this was moved in 4.6.x
722 722
 		 * from General_Settings_Admin_Page to here.
723 723
 		 */
724
-		EE_Registry::instance()->CFG->template_settings = apply_filters( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data );
724
+		EE_Registry::instance()->CFG->template_settings = apply_filters('FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data);
725 725
 
726 726
 
727 727
 		//update custom post type slugs and detect if we need to flush rewrite rules
728 728
 		$old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug;
729
-		EE_Registry::instance()->CFG->core->event_cpt_slug = empty( $this->_req_data['event_cpt_slug'] ) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes( $this->_req_data['event_cpt_slug'] );
729
+		EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug']) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes($this->_req_data['event_cpt_slug']);
730 730
 
731 731
 
732 732
 		$what = 'Template Settings';
733
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__ );
733
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__);
734 734
 
735 735
 
736
-		if ( EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug ) {
737
-			update_option( 'ee_flush_rewrite_rules', true );
736
+		if (EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug) {
737
+			update_option('ee_flush_rewrite_rules', true);
738 738
 		}
739 739
 
740 740
 
741
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'template_settings' ) );
741
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'template_settings'));
742 742
 
743 743
 	}
744 744
 
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 
757 757
 		$this->verify_cpt_object();
758 758
 
759
-		add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array( $this, 'registration_options_meta_box' ), $this->page_slug, 'side', 'core');
759
+		add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array($this, 'registration_options_meta_box'), $this->page_slug, 'side', 'core');
760 760
 		//add_meta_box('espresso_event_types', __('Event Type', 'event_espresso'), array( $this, 'event_type_meta_box' ), $this->page_slug, 'side', 'default' ); //add this back in when the feature is ready.
761 761
 
762 762
 		//todo feature in progress
@@ -780,16 +780,16 @@  discard block
 block discarded – undo
780 780
 			array('id' => true, 'text' => __('Yes', 'event_espresso')),
781 781
 			array('id' => false, 'text' => __('No', 'event_espresso'))
782 782
 		);
783
-		$default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete ), TRUE);
783
+		$default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete), TRUE);
784 784
 		$template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(FALSE);
785 785
 		$template_args['_event'] = $this->_cpt_model_obj;
786 786
 		$template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit();
787 787
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
788 788
 		$template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description());
789 789
 		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false);
790
-		$template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status() );
791
-		$template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values );
792
-		$templatepath = EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php';
790
+		$template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
791
+		$template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values);
792
+		$templatepath = EVENTS_CAF_TEMPLATE_PATH.'event_registration_options.template.php';
793 793
 		EEH_Template::display_template($templatepath, $template_args);
794 794
 	}
795 795
 
@@ -802,9 +802,9 @@  discard block
 block discarded – undo
802 802
 	 * @param  array  $box  metabox args
803 803
 	 * @return string       metabox contents
804 804
 	 */
805
-	public function event_type_meta_box( $post, $box ) {
806
-		$template_args['radio_list'] = $this->wp_terms_radio($post->ID, array( 'taxonomy' => 'espresso_event_type' ) );
807
-		$template = EVENTS_CAF_TEMPLATE_PATH . 'event_type_metabox_contents.template.php';
805
+	public function event_type_meta_box($post, $box) {
806
+		$template_args['radio_list'] = $this->wp_terms_radio($post->ID, array('taxonomy' => 'espresso_event_type'));
807
+		$template = EVENTS_CAF_TEMPLATE_PATH.'event_type_metabox_contents.template.php';
808 808
 		EEH_Template::display_template($template, $template_args);
809 809
 	}
810 810
 
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 
815 815
 
816 816
 
817
-	public function wp_terms_radio( $post_id = 0, $args = array() ) {
817
+	public function wp_terms_radio($post_id = 0, $args = array()) {
818 818
 		$defaults = array(
819 819
 			'descendants_and_self' => 0,
820 820
 			'selected_cats' => false,
@@ -823,11 +823,11 @@  discard block
 block discarded – undo
823 823
 			'taxonomy' => 'category',
824 824
 			'checked_ontop' => true
825 825
 		);
826
-		$args = apply_filters( 'wp_terms_checklist_args', $args, $post_id );
826
+		$args = apply_filters('wp_terms_checklist_args', $args, $post_id);
827 827
 
828
-		extract( wp_parse_args($args, $defaults), EXTR_SKIP );
828
+		extract(wp_parse_args($args, $defaults), EXTR_SKIP);
829 829
 
830
-		if ( empty($walker) || !is_a($walker, 'Walker') )
830
+		if (empty($walker) || ! is_a($walker, 'Walker'))
831 831
 			$walker = new Walker_Radio_Checklist;
832 832
 
833 833
 		$descendants_and_self = (int) $descendants_and_self;
@@ -835,37 +835,37 @@  discard block
 block discarded – undo
835 835
 		$args = array('taxonomy' => $taxonomy);
836 836
 
837 837
 		$tax = get_taxonomy($taxonomy);
838
-		$args['disabled'] = !current_user_can($tax->cap->assign_terms);
838
+		$args['disabled'] = ! current_user_can($tax->cap->assign_terms);
839 839
 
840
-		if ( is_array( $selected_cats ) )
840
+		if (is_array($selected_cats))
841 841
 			$args['selected_cats'] = $selected_cats;
842
-		elseif ( $post_id )
842
+		elseif ($post_id)
843 843
 			$args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids')));
844 844
 		else
845 845
 			$args['selected_cats'] = array();
846 846
 
847
-		if ( is_array( $popular_cats ) )
847
+		if (is_array($popular_cats))
848 848
 			$args['popular_cats'] = $popular_cats;
849 849
 		else
850
-			$args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
850
+			$args['popular_cats'] = get_terms($taxonomy, array('fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false));
851 851
 
852
-		if ( $descendants_and_self ) {
853
-			$categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) );
854
-			$self = get_term( $descendants_and_self, $taxonomy );
855
-			array_unshift( $categories, $self );
852
+		if ($descendants_and_self) {
853
+			$categories = (array) get_terms($taxonomy, array('child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0));
854
+			$self = get_term($descendants_and_self, $taxonomy);
855
+			array_unshift($categories, $self);
856 856
 		} else {
857 857
 			$categories = (array) get_terms($taxonomy, array('get' => 'all'));
858 858
 		}
859 859
 
860
-		if ( $checked_ontop ) {
860
+		if ($checked_ontop) {
861 861
 			// Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
862 862
 			$checked_categories = array();
863
-			$keys = array_keys( $categories );
863
+			$keys = array_keys($categories);
864 864
 
865
-			foreach( $keys as $k ) {
866
-				if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) {
865
+			foreach ($keys as $k) {
866
+				if (in_array($categories[$k]->term_id, $args['selected_cats'])) {
867 867
 					$checked_categories[] = $categories[$k];
868
-					unset( $categories[$k] );
868
+					unset($categories[$k]);
869 869
 				}
870 870
 			}
871 871
 
@@ -890,18 +890,18 @@  discard block
 block discarded – undo
890 890
 	 * @param  array  $list_table_obj the list table object
891 891
 	 * @return array                  new filters
892 892
 	 */
893
-	public function list_table_filters( $oldfilters, $list_table_obj ) {
893
+	public function list_table_filters($oldfilters, $list_table_obj) {
894 894
 		$filters = array();
895 895
 
896 896
 		//first month/year filters
897 897
 		$filters[] = $this->espresso_event_months_dropdown();
898 898
 
899 899
 
900
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
900
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
901 901
 
902 902
 		//active status dropdown
903
-		if ( $status !== 'draft' )
904
-			$filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' );
903
+		if ($status !== 'draft')
904
+			$filter[] = $this->active_status_dropdown(isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : '');
905 905
 
906 906
 		//category filter
907 907
 		$filters[] = $this->category_dropdown();
@@ -923,17 +923,17 @@  discard block
 block discarded – undo
923 923
 	 */
924 924
 	public function espresso_event_months_dropdown() {
925 925
 		//what we need to do is get all PRIMARY datetimes for all events to filter on. Note we need to include any other filters that are set!
926
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
926
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
927 927
 
928 928
 		//categories?
929
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
929
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
930 930
 
931 931
 		//active status?
932
-		$active_status = isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : NULL;
932
+		$active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : NULL;
933 933
 
934 934
 		$cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
935 935
 
936
-		return EEH_Form_Fields::generate_event_months_dropdown( $cur_date, $status, $category, $active_status );
936
+		return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status);
937 937
 	}
938 938
 
939 939
 
@@ -944,12 +944,12 @@  discard block
 block discarded – undo
944 944
 	 * @param  string $current_value whatever the ucrrent active status is
945 945
 	 * @return string                html dropdown.
946 946
 	 */
947
-	public function  active_status_dropdown( $current_value = '' ) {
947
+	public function  active_status_dropdown($current_value = '') {
948 948
 		$select_name = 'active_status';
949
-		$values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso') );
949
+		$values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso'));
950 950
 		$id = 'id="espresso-active-status-dropdown-filter"';
951 951
 		$class = 'wide';
952
-		echo EEH_Form_Fields::select_input( $select_name, $values, $current_value, $id, $class );
952
+		echo EEH_Form_Fields::select_input($select_name, $values, $current_value, $id, $class);
953 953
 	}
954 954
 
955 955
 
@@ -961,9 +961,9 @@  discard block
 block discarded – undo
961 961
 	 * @return string html
962 962
 	 */
963 963
 	public function category_dropdown() {
964
-		$cur_cat = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1;
964
+		$cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
965 965
 
966
-		return EEH_Form_Fields::generate_event_category_dropdown( $cur_cat );
966
+		return EEH_Form_Fields::generate_event_category_dropdown($cur_cat);
967 967
 	}
968 968
 
969 969
 
@@ -975,14 +975,14 @@  discard block
 block discarded – undo
975 975
 	 * @return int
976 976
 	 */
977 977
 	public function total_events_today() {
978
-		$start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 00:00:00', 'Y-m-d H:i:s', 'UTC' );
979
-		$end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' );
978
+		$start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 00:00:00', 'Y-m-d H:i:s', 'UTC');
979
+		$end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 23:59:59', 'Y-m-d H:i:s', 'UTC');
980 980
 
981 981
 		$where = array(
982
-			'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) )
982
+			'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end))
983 983
 			);
984 984
 
985
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
985
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
986 986
 		return $count;
987 987
 	}
988 988
 
@@ -997,14 +997,14 @@  discard block
 block discarded – undo
997 997
 		$this_year_r = date('Y');
998 998
 		$this_month_r = date('m');
999 999
 		$days_this_month = date('t');
1000
-		$start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-01 00:00:00', 'Y-m-d H:i:s', 'UTC' );
1001
-		$end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' );
1000
+		$start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-01 00:00:00', 'Y-m-d H:i:s', 'UTC');
1001
+		$end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' 23:59:59', 'Y-m-d H:i:s', 'UTC');
1002 1002
 
1003 1003
 		$where = array(
1004
-			'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) )
1004
+			'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end))
1005 1005
 			);
1006 1006
 
1007
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
1007
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
1008 1008
 		return $count;
1009 1009
 	}
1010 1010
 
@@ -1021,53 +1021,53 @@  discard block
 block discarded – undo
1021 1021
 
1022 1022
 
1023 1023
 
1024
-	public function get_default_tickets( $per_page = 10, $count = FALSE, $trashed = FALSE ) {
1024
+	public function get_default_tickets($per_page = 10, $count = FALSE, $trashed = FALSE) {
1025 1025
 
1026
-		$orderby= empty( $this->_req_data['orderby'] ) ? 'TKT_name' : $this->_req_data['orderby'];
1027
-		$order = empty( $this->_req_data['order'] ) ? 'ASC' : $this->_req_data['order'];
1026
+		$orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby'];
1027
+		$order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order'];
1028 1028
 
1029
-		switch ( $orderby ) {
1029
+		switch ($orderby) {
1030 1030
 			case 'TKT_name' :
1031
-				$orderby = array( 'TKT_name' => $order );
1031
+				$orderby = array('TKT_name' => $order);
1032 1032
 				break;
1033 1033
 
1034 1034
 			case 'TKT_price' :
1035
-				$orderby = array( 'TKT_price' => $order );
1035
+				$orderby = array('TKT_price' => $order);
1036 1036
 				break;
1037 1037
 
1038 1038
 			case 'TKT_uses' :
1039
-				$orderby = array( 'TKT_uses' => $order );
1039
+				$orderby = array('TKT_uses' => $order);
1040 1040
 				break;
1041 1041
 
1042 1042
 			case 'TKT_min' :
1043
-				$orderby = array( 'TKT_min' => $order );
1043
+				$orderby = array('TKT_min' => $order);
1044 1044
 				break;
1045 1045
 
1046 1046
 			case 'TKT_max' :
1047
-				$orderby = array( 'TKT_max' => $order );
1047
+				$orderby = array('TKT_max' => $order);
1048 1048
 				break;
1049 1049
 
1050 1050
 			case 'TKT_qty' :
1051
-				$orderby = array( 'TKT_qty' => $order );
1051
+				$orderby = array('TKT_qty' => $order);
1052 1052
 				break;
1053 1053
 		}
1054 1054
 
1055
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1056
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1055
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1056
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1057 1057
 
1058 1058
 		$_where = array(
1059 1059
 			'TKT_is_default' => 1,
1060 1060
 			'TKT_deleted' => $trashed
1061 1061
 			);
1062 1062
 
1063
-		$offset = ($current_page-1)*$per_page;
1064
-		$limit = array( $offset, $per_page );
1063
+		$offset = ($current_page - 1) * $per_page;
1064
+		$limit = array($offset, $per_page);
1065 1065
 
1066
-		if ( isset( $this->_req_data['s'] ) ) {
1067
-			$sstr = '%' . $this->_req_data['s'] . '%';
1066
+		if (isset($this->_req_data['s'])) {
1067
+			$sstr = '%'.$this->_req_data['s'].'%';
1068 1068
 			$_where['OR'] = array(
1069
-				'TKT_name' => array('LIKE',$sstr ),
1070
-				'TKT_description' => array('LIKE',$sstr )
1069
+				'TKT_name' => array('LIKE', $sstr),
1070
+				'TKT_description' => array('LIKE', $sstr)
1071 1071
 				);
1072 1072
 		}
1073 1073
 
@@ -1078,9 +1078,9 @@  discard block
 block discarded – undo
1078 1078
 			'group_by'=>'TKT_ID'
1079 1079
 			);
1080 1080
 
1081
-		if($count){
1081
+		if ($count) {
1082 1082
 			return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where));
1083
-		}else{
1083
+		} else {
1084 1084
 			return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params);
1085 1085
 		}
1086 1086
 
@@ -1090,35 +1090,35 @@  discard block
 block discarded – undo
1090 1090
 
1091 1091
 
1092 1092
 
1093
-	protected function _trash_or_restore_ticket(  $trash = FALSE ) {
1093
+	protected function _trash_or_restore_ticket($trash = FALSE) {
1094 1094
 		$success = 1;
1095 1095
 
1096 1096
 		$TKT = EEM_Ticket::instance();
1097 1097
 
1098 1098
 		//checkboxes?
1099
-		if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
1099
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1100 1100
 			//if array has more than one element then success message should be plural
1101
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1101
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1102 1102
 
1103 1103
 			//cycle thru the boxes
1104
-			while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
1105
-				if ( $trash ) {
1106
-					if ( ! $TKT->delete_by_ID( $TKT_ID ) )
1104
+			while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
1105
+				if ($trash) {
1106
+					if ( ! $TKT->delete_by_ID($TKT_ID))
1107 1107
 						$success = 0;
1108 1108
 				} else {
1109
-					if ( ! $TKT->restore_by_ID( $TKT_ID ) )
1109
+					if ( ! $TKT->restore_by_ID($TKT_ID))
1110 1110
 						$success = 0;
1111 1111
 				}
1112 1112
 			}
1113 1113
 		} else {
1114 1114
 			//grab single id and trash
1115
-			$TKT_ID = absint( $this->_req_data['TKT_ID'] );
1115
+			$TKT_ID = absint($this->_req_data['TKT_ID']);
1116 1116
 
1117
-			if ( $trash ) {
1118
-				if ( ! $TKT->delete_by_ID( $TKT_ID ) )
1117
+			if ($trash) {
1118
+				if ( ! $TKT->delete_by_ID($TKT_ID))
1119 1119
 					$success = 0;
1120 1120
 			} else {
1121
-				if ( ! $TKT->restore_by_ID( $TKT_ID ) )
1121
+				if ( ! $TKT->restore_by_ID($TKT_ID))
1122 1122
 					$success = 0;
1123 1123
 			}
1124 1124
 		}
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
 			'action' => 'ticket_list_table',
1129 1129
 			'status' => $trash ? '' : 'trashed'
1130 1130
 			);
1131
-		$this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args );
1131
+		$this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args);
1132 1132
 	}
1133 1133
 
1134 1134
 
@@ -1141,21 +1141,21 @@  discard block
 block discarded – undo
1141 1141
 		$TKT = EEM_Ticket::instance();
1142 1142
 
1143 1143
 		//checkboxes?
1144
-		if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
1144
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1145 1145
 			//if array has more than one element then success message should be plural
1146
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1146
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1147 1147
 
1148 1148
 			//cycle thru the boxes
1149
-			while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
1149
+			while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
1150 1150
 				//delete
1151
-				if ( ! $this->_delete_the_ticket( $TKT_ID ) ) {
1151
+				if ( ! $this->_delete_the_ticket($TKT_ID)) {
1152 1152
 					$success = 0;
1153 1153
 				}
1154 1154
 			}
1155 1155
 		} else {
1156 1156
 			//grab single id and trash
1157
-			$TKT_ID = absint( $this->_req_data['TKT_ID'] );
1158
-			if ( ! $this->_delete_the_ticket( $TKT_ID ) ) {
1157
+			$TKT_ID = absint($this->_req_data['TKT_ID']);
1158
+			if ( ! $this->_delete_the_ticket($TKT_ID)) {
1159 1159
 					$success = 0;
1160 1160
 				}
1161 1161
 		}
@@ -1167,16 +1167,16 @@  discard block
 block discarded – undo
1167 1167
 			);
1168 1168
 
1169 1169
 		//failsafe.  If the default ticket count === 1 then we need to redirect to event overview.
1170
-		if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) )
1170
+		if (EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE))
1171 1171
 			$query_args = array();
1172
-		$this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args );
1172
+		$this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args);
1173 1173
 	}
1174 1174
 
1175 1175
 
1176 1176
 
1177 1177
 
1178
-	protected function _delete_the_ticket( $TKT_ID ) {
1179
-		$tkt = EEM_Ticket::instance()->get_one_by_ID( $TKT_ID );
1178
+	protected function _delete_the_ticket($TKT_ID) {
1179
+		$tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID);
1180 1180
 		$tkt->_remove_relations('Datetime');
1181 1181
 		//delete all related prices first
1182 1182
 		$tkt->delete_related_permanently('Price');
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php 1 patch
Spacing   +381 added lines, -381 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
 /**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		$this->_name = 'pricing';
55 55
 
56 56
 		//capability check
57
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) {
57
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) {
58 58
 			return;
59 59
 		}
60 60
 
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 		//if we were going to add our own metaboxes we'd use the below.
63 63
 		$this->_metaboxes = array(
64 64
 			0 => array(
65
-				'page_route' => array('edit','create_new'),
65
+				'page_route' => array('edit', 'create_new'),
66 66
 				'func' => 'pricing_metabox',
67 67
 				'label' => __('Event Tickets & Datetimes', 'event_espresso'),
68 68
 				'priority' => 'high',
69 69
 				'context' => 'normal'
70 70
 				),
71 71
 
72
-			);/**/
72
+			); /**/
73 73
 
74 74
 		$this->_remove_metaboxes = array(
75 75
 			0 => array(
@@ -88,24 +88,24 @@  discard block
 block discarded – undo
88 88
 		 *
89 89
 		 * @var array  Expected an array returned with 'date' and 'time' keys.
90 90
 		 */
91
-		$this->_date_format_strings = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
91
+		$this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
92 92
 				'date' => 'Y-m-d',
93 93
 				'time' => 'h:i a'
94 94
 			));
95 95
 
96 96
 		//validate
97
-		$this->_date_format_strings['date'] = isset( $this->_date_format_strings['date'] ) ? $this->_date_format_strings['date'] : null;
98
-		$this->_date_format_strings['time'] = isset( $this->_date_format_strings['time'] ) ? $this->_date_format_strings['time'] : null;
97
+		$this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null;
98
+		$this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null;
99 99
 
100 100
 		//validate format strings
101
-		$format_validation = EEH_DTT_Helper::validate_format_string( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
102
-		if ( is_array( $format_validation ) ) {
103
-			$msg = '<p>' . sprintf( __( 'The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso' ), $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ) . '</p><ul>';
104
-			foreach ( $format_validation as $error ) {
105
-				$msg .= '<li>' . $error . '</li>';
101
+		$format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
102
+		if (is_array($format_validation)) {
103
+			$msg = '<p>'.sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso'), $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']).'</p><ul>';
104
+			foreach ($format_validation as $error) {
105
+				$msg .= '<li>'.$error.'</li>';
106 106
 			}
107
-			$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
108
-			EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
107
+			$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
108
+			EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
109 109
 			$this->_date_format_strings = array(
110 110
 				'date' => 'Y-m-d',
111 111
 				'time' => 'h:i a'
@@ -116,60 +116,60 @@  discard block
 block discarded – undo
116 116
 		$this->_scripts_styles = array(
117 117
 			'registers' => array(
118 118
 				'ee-tickets-datetimes-css' => array(
119
-					'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css',
119
+					'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css',
120 120
 					'type' => 'css'
121 121
 					),
122 122
 				'ee-dtt-ticket-metabox' => array(
123
-					'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js',
123
+					'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js',
124 124
 					'depends' => array('ee-datepicker', 'ee-dialog', 'underscore')
125 125
 					)
126 126
 				),
127 127
 			'deregisters' => array(
128
-				'event-editor-css' => array('type' => 'css' ),
128
+				'event-editor-css' => array('type' => 'css'),
129 129
 				'event-datetime-metabox' => array('type' => 'js')
130 130
 				),
131 131
 			'enqueues' => array(
132
-				'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ),
133
-				'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' )
132
+				'ee-tickets-datetimes-css' => array('edit', 'create_new'),
133
+				'ee-dtt-ticket-metabox' => array('edit', 'create_new')
134 134
 				),
135 135
 			'localize' => array(
136 136
 				'ee-dtt-ticket-metabox' => array(
137 137
 					'DTT_TRASH_BLOCK' => array(
138 138
 						'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'),
139 139
 						'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'),
140
-						'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>',
140
+						'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>',
141 141
 						'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
142 142
 						'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket.  Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
143
-						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>'
143
+						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>'
144 144
 						),
145 145
 					'DTT_ERROR_MSG' => array(
146 146
 						'no_ticket_name' => __('General Admission', 'event_espresso'),
147
-						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>'
147
+						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>'
148 148
 						),
149 149
 					'DTT_OVERSELL_WARNING' => array(
150 150
 						'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', 'event_espresso'),
151 151
 						'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', 'event_espresso')
152 152
 						),
153
-					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats( $this->_date_format_strings['date'], $this->_date_format_strings['time'] ),
154
-					'DTT_START_OF_WEEK' => array( 'dayValue' => (int) get_option( 'start_of_week' ) )
153
+					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']),
154
+					'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week'))
155 155
 					)
156 156
 				)
157 157
 			);
158 158
 
159 159
 
160
-		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 );
161
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
160
+		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10);
161
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
162 162
 	}
163 163
 
164 164
 
165 165
 
166
-	public function caf_updates( $update_callbacks ) {
167
-		foreach ( $update_callbacks as $key => $callback ) {
168
-			if ( $callback[1] == '_default_tickets_update' )
169
-				unset( $update_callbacks[$key] );
166
+	public function caf_updates($update_callbacks) {
167
+		foreach ($update_callbacks as $key => $callback) {
168
+			if ($callback[1] == '_default_tickets_update')
169
+				unset($update_callbacks[$key]);
170 170
 		}
171 171
 
172
-		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
172
+		$update_callbacks[] = array($this, 'dtt_and_tickets_caf_update');
173 173
 		return $update_callbacks;
174 174
 	}
175 175
 
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 	 * @param  array    $data   The request data from the form
183 183
 	 * @return bool             success or fail
184 184
 	 */
185
-	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
185
+	public function dtt_and_tickets_caf_update($evtobj, $data) {
186 186
 		//first we need to start with datetimes cause they are the "root" items attached to events.
187
-		$saved_dtts = $this->_update_dtts( $evtobj, $data );
187
+		$saved_dtts = $this->_update_dtts($evtobj, $data);
188 188
 		//next tackle the tickets (and prices?)
189
-		$this->_update_tkts( $evtobj, $saved_dtts, $data );
189
+		$this->_update_tkts($evtobj, $saved_dtts, $data);
190 190
 	}
191 191
 
192 192
 
@@ -197,41 +197,41 @@  discard block
 block discarded – undo
197 197
 	 * @param  array    	$data    the request data from the form
198 198
 	 * @return EE_Datetime[]
199 199
 	 */
200
-	protected function _update_dtts( $evt_obj, $data ) {
201
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
200
+	protected function _update_dtts($evt_obj, $data) {
201
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
202 202
 		$saved_dtt_ids = array();
203 203
 		$saved_dtt_objs = array();
204 204
 
205
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
205
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
206 206
 			//trim all values to ensure any excess whitespace is removed.
207 207
 			$dtt = array_map(
208
-				function( $datetime_data ) {
209
-					return is_array( $datetime_data ) ? $datetime_data : trim( $datetime_data );
208
+				function($datetime_data) {
209
+					return is_array($datetime_data) ? $datetime_data : trim($datetime_data);
210 210
 				},
211 211
 				$dtt
212 212
 			);
213
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
213
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
214 214
 			$datetime_values = array(
215
-				'DTT_ID' 			=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
216
-				'DTT_name' 			=> ! empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '',
217
-				'DTT_description' 	=> ! empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '',
215
+				'DTT_ID' 			=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
216
+				'DTT_name' 			=> ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '',
217
+				'DTT_description' 	=> ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '',
218 218
 				'DTT_EVT_start' 	=> $dtt['DTT_EVT_start'],
219 219
 				'DTT_EVT_end' 		=> $dtt['DTT_EVT_end'],
220
-				'DTT_reg_limit' 	=> empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt[ 'DTT_reg_limit' ],
221
-				'DTT_order' 		=> ! isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'],
220
+				'DTT_reg_limit' 	=> empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
221
+				'DTT_order' 		=> ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'],
222 222
 			);
223 223
 
224 224
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
225 225
 
226
-			if ( !empty( $dtt['DTT_ID'] ) ) {
227
-				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] );
226
+			if ( ! empty($dtt['DTT_ID'])) {
227
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']);
228 228
 
229 229
 				//set date and time format according to what is set in this class.
230
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
231
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
230
+				$DTM->set_date_format($this->_date_format_strings['date']);
231
+				$DTM->set_time_format($this->_date_format_strings['time']);
232 232
 
233
-				foreach ( $datetime_values as $field => $value ) {
234
-					$DTM->set( $field, $value );
233
+				foreach ($datetime_values as $field => $value) {
234
+					$DTM->set($field, $value);
235 235
 				}
236 236
 
237 237
 				// make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.
@@ -239,24 +239,24 @@  discard block
 block discarded – undo
239 239
 				$saved_dtt_ids[$DTM->ID()] = $DTM->ID();
240 240
 
241 241
 			} else {
242
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE );
242
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE);
243 243
 
244 244
 				//reset date and times to match the format
245
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
246
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
247
-				foreach( $datetime_values as $field => $value ) {
248
-					$DTM->set( $field, $value );
245
+				$DTM->set_date_format($this->_date_format_strings['date']);
246
+				$DTM->set_time_format($this->_date_format_strings['time']);
247
+				foreach ($datetime_values as $field => $value) {
248
+					$DTM->set($field, $value);
249 249
 				}
250 250
 			}
251 251
 
252 252
 
253 253
 			$DTM->save();
254
-			$DTM = $evt_obj->_add_relation_to( $DTM, 'Datetime' );
254
+			$DTM = $evt_obj->_add_relation_to($DTM, 'Datetime');
255 255
 			$evt_obj->save();
256 256
 
257 257
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
258
-			if( $DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end') ) {
259
-				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start') );
258
+			if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) {
259
+				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start'));
260 260
 				$DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days');
261 261
 				$DTM->save();
262 262
 			}
@@ -271,25 +271,25 @@  discard block
 block discarded – undo
271 271
 		}
272 272
 
273 273
 		//now we need to REMOVE any dtts that got deleted.  Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point.
274
-		$old_datetimes = explode(',', $data['datetime_IDs'] );
274
+		$old_datetimes = explode(',', $data['datetime_IDs']);
275 275
 		$old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes;
276 276
 
277
-		if ( is_array( $old_datetimes ) ) {
278
-			$dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids );
279
-			foreach ( $dtts_to_delete as $id ) {
280
-				$id = absint( $id );
281
-				if ( empty( $id ) )
277
+		if (is_array($old_datetimes)) {
278
+			$dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids);
279
+			foreach ($dtts_to_delete as $id) {
280
+				$id = absint($id);
281
+				if (empty($id))
282 282
 					continue;
283 283
 
284 284
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
285 285
 
286 286
 				//remove tkt relationships.
287 287
 				$related_tickets = $dtt_to_remove->get_many_related('Ticket');
288
-				foreach ( $related_tickets as $tkt ) {
288
+				foreach ($related_tickets as $tkt) {
289 289
 					$dtt_to_remove->_remove_relation_to($tkt, 'Ticket');
290 290
 				}
291 291
 
292
-				$evt_obj->_remove_relation_to( $id, 'Datetime' );
292
+				$evt_obj->_remove_relation_to($id, 'Datetime');
293 293
 				$dtt_to_remove->refresh_cache_of_related_objects();
294 294
 
295 295
 			}
@@ -310,85 +310,85 @@  discard block
 block discarded – undo
310 310
 	 * @param  array            $data       incoming request data
311 311
 	 * @return EE_Ticket[]
312 312
 	 */
313
-	protected function _update_tkts( $evtobj, $saved_dtts, $data ) {
313
+	protected function _update_tkts($evtobj, $saved_dtts, $data) {
314 314
 
315 315
 		$new_tkt = null;
316 316
 		$new_default = null;
317 317
 		//stripslashes because WP filtered the $_POST ($data) array to add slashes
318 318
 		$data = stripslashes_deep($data);
319
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
319
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
320 320
 		$saved_tickets = $dtts_on_existing = array();
321
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
321
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
322 322
 
323 323
 		//load money helper
324 324
 
325
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
325
+		foreach ($data['edit_tickets'] as $row => $tkt) {
326 326
 
327 327
 			$update_prices = $create_new_TKT = FALSE;
328 328
 
329 329
 			//figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session.
330 330
 
331
-			$starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]);
332
-			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] );
331
+			$starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]);
332
+			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]);
333 333
 			$dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows);
334 334
 			$dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows);
335 335
 
336 336
 			// trim inputs to ensure any excess whitespace is removed.
337 337
 			$tkt = array_map(
338
-				function( $ticket_data ) {
339
-					return is_array( $ticket_data ) ? $ticket_data : trim( $ticket_data );
338
+				function($ticket_data) {
339
+					return is_array($ticket_data) ? $ticket_data : trim($ticket_data);
340 340
 				},
341 341
 				$tkt
342 342
 			);
343 343
 
344 344
 			//note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models.
345 345
 			//note incoming ['TKT_price'] value is already in standard notation (via js).
346
-			$ticket_price = isset( $tkt['TKT_price'] ) ?  round ( (float) $tkt['TKT_price'], 3 ) : 0;
346
+			$ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0;
347 347
 
348 348
 			//note incoming base price needs converted from localized value.
349
-			$base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0;
349
+			$base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0;
350 350
 			//if ticket price == 0 and $base_price != 0 then ticket price == base_price
351 351
 			$ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price;
352
-			$base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0;
352
+			$base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0;
353 353
 
354 354
 			$price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array();
355 355
 
356 356
 			$now = null;
357
-			if ( empty( $tkt['TKT_start_date'] ) ) {
357
+			if (empty($tkt['TKT_start_date'])) {
358 358
 				//lets' use now in the set timezone.
359
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
360
-				$tkt['TKT_start_date'] = $now->format( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
359
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
360
+				$tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
361 361
 			}
362 362
 
363
-			if ( empty( $tkt['TKT_end_date'] ) ) {
363
+			if (empty($tkt['TKT_end_date'])) {
364 364
 				/**
365 365
 				 * set the TKT_end_date to the first datetime attached to the ticket.
366 366
 				 */
367
-				$first_dtt = $saved_dtts[reset( $tkt_dtt_rows )];
368
-				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time( $this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time'] );
367
+				$first_dtt = $saved_dtts[reset($tkt_dtt_rows)];
368
+				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']);
369 369
 			}
370 370
 
371 371
 			$TKT_values = array(
372
-				'TKT_ID' 			=> ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
373
-				'TTM_ID' 			=> ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
374
-				'TKT_name' 			=> ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
375
-				'TKT_description' 	=> ! empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
372
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
373
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
374
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
375
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
376 376
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
377 377
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
378
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt[ 'TKT_qty' ],
379
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt['TKT_uses'],
380
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
381
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
378
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
379
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
380
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
381
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
382 382
 				'TKT_row' 			=> $row,
383
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0,
384
-				'TKT_taxable' 		=> ! empty( $tkt['TKT_taxable'] ) ? 1 : 0,
385
-				'TKT_required' 		=> ! empty( $tkt['TKT_required'] ) ? 1 : 0,
383
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0,
384
+				'TKT_taxable' 		=> ! empty($tkt['TKT_taxable']) ? 1 : 0,
385
+				'TKT_required' 		=> ! empty($tkt['TKT_required']) ? 1 : 0,
386 386
 				'TKT_price' 		=> $ticket_price
387 387
 			);
388 388
 
389 389
 
390 390
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
391
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
391
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
392 392
 				$TKT_values['TKT_ID'] = 0;
393 393
 				$TKT_values['TKT_is_default'] = 0;
394 394
 				$update_prices = TRUE;
@@ -400,21 +400,21 @@  discard block
 block discarded – undo
400 400
 			// but DID have it's items modified.
401 401
 			// keep in mind that if the TKT has been sold (and we have changed pricing information),
402 402
 			// then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
403
-			if ( absint( $TKT_values['TKT_ID'] ) ) {
404
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] );
405
-				if ( $TKT instanceof EE_Ticket ) {
403
+			if (absint($TKT_values['TKT_ID'])) {
404
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']);
405
+				if ($TKT instanceof EE_Ticket) {
406 406
 
407
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
407
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
408 408
 					// are there any registrations using this ticket ?
409 409
 					$tickets_sold = $TKT->count_related(
410 410
 						'Registration',
411
-						array( array(
412
-								'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) )
413
-						) )
411
+						array(array(
412
+								'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))
413
+						))
414 414
 					);
415 415
 					//set ticket formats
416
-					$TKT->set_date_format( $this->_date_format_strings['date'] );
417
-					$TKT->set_time_format( $this->_date_format_strings['time'] );
416
+					$TKT->set_date_format($this->_date_format_strings['date']);
417
+					$TKT->set_time_format($this->_date_format_strings['time']);
418 418
 
419 419
 					// let's just check the total price for the existing ticket
420 420
 					// and determine if it matches the new total price.
@@ -424,17 +424,17 @@  discard block
 block discarded – undo
424 424
 							? TRUE : FALSE;
425 425
 
426 426
 					//set new values
427
-					foreach ( $TKT_values as $field => $value ) {
428
-						if ( $field === 'TKT_qty' ) {
429
-							$TKT->set_qty( $value );
427
+					foreach ($TKT_values as $field => $value) {
428
+						if ($field === 'TKT_qty') {
429
+							$TKT->set_qty($value);
430 430
 						} else {
431
-							$TKT->set( $field, $value );
431
+							$TKT->set($field, $value);
432 432
 						}
433 433
 					}
434 434
 
435 435
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
436
-					if ( $create_new_TKT ) {
437
-						$new_tkt = $this->_duplicate_ticket( $TKT, $price_rows, $ticket_price, $base_price, $base_price_id );
436
+					if ($create_new_TKT) {
437
+						$new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price, $base_price_id);
438 438
 					}
439 439
 				}
440 440
 
@@ -443,12 +443,12 @@  discard block
 block discarded – undo
443 443
 				$TKT = EE_Ticket::new_instance(
444 444
 					$TKT_values,
445 445
 					$timezone,
446
-					array( $this->_date_format_strings[ 'date' ], $this->_date_format_strings[ 'time' ]  )
446
+					array($this->_date_format_strings['date'], $this->_date_format_strings['time'])
447 447
 				);
448
-				if ( $TKT instanceof EE_Ticket ) {
448
+				if ($TKT instanceof EE_Ticket) {
449 449
 					// make sure ticket has an ID of setting relations won't work
450 450
 					$TKT->save();
451
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
451
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
452 452
 					$update_prices = TRUE;
453 453
 				}
454 454
 			}
@@ -456,37 +456,37 @@  discard block
 block discarded – undo
456 456
 			//$TKT->save();
457 457
 
458 458
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
459
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
460
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
459
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
460
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
461 461
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
462 462
 			}
463 463
 
464 464
 			//let's make sure the base price is handled
465
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT;
465
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT;
466 466
 
467 467
 			//add/update price_modifiers
468
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT;
468
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT;
469 469
 
470 470
 			//need to make sue that the TKT_price is accurate after saving the prices.
471 471
 			$TKT->ensure_TKT_Price_correct();
472 472
 
473 473
 			//handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave.
474
-			if ( ! defined('DOING_AUTOSAVE' ) ) {
475
-				if ( !empty($tkt['TKT_is_default_selector'] ) ) {
474
+			if ( ! defined('DOING_AUTOSAVE')) {
475
+				if ( ! empty($tkt['TKT_is_default_selector'])) {
476 476
 					$update_prices = TRUE;
477 477
 					$new_default = clone $TKT;
478
-					$new_default->set( 'TKT_ID', 0 );
479
-					$new_default->set( 'TKT_is_default', 1 );
480
-					$new_default->set( 'TKT_row', 1 );
481
-					$new_default->set( 'TKT_price', $ticket_price );
478
+					$new_default->set('TKT_ID', 0);
479
+					$new_default->set('TKT_is_default', 1);
480
+					$new_default->set('TKT_row', 1);
481
+					$new_default->set('TKT_price', $ticket_price);
482 482
 					//remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object)
483 483
 					$new_default->_remove_relations('Datetime');
484 484
 					//todo we need to add the current attached prices as new prices to the new default ticket.
485
-					$new_default = $this->_add_prices_to_ticket( $price_rows, $new_default, $update_prices );
485
+					$new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices);
486 486
 					//don't forget the base price!
487
-					$new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id );
487
+					$new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id);
488 488
 					$new_default->save();
489
-					do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data );
489
+					do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data);
490 490
 				}
491 491
 			}
492 492
 
@@ -497,19 +497,19 @@  discard block
 block discarded – undo
497 497
 			//let's assign any tickets that have been setup to the saved_tickets tracker
498 498
 			//save existing TKT
499 499
 			$TKT->save();
500
-			if ( $create_new_TKT && $new_tkt instanceof EE_Ticket ) {
500
+			if ($create_new_TKT && $new_tkt instanceof EE_Ticket) {
501 501
 				//save new TKT
502 502
 				$new_tkt->save();
503 503
 				//add new ticket to array
504
-				$saved_tickets[ $new_tkt->ID() ] = $new_tkt;
504
+				$saved_tickets[$new_tkt->ID()] = $new_tkt;
505 505
 
506
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data );
506
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data);
507 507
 
508 508
 			} else {
509 509
 				//add tkt to saved tkts
510
-				$saved_tickets[ $TKT->ID() ] = $TKT;
510
+				$saved_tickets[$TKT->ID()] = $TKT;
511 511
 
512
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data );
512
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data);
513 513
 			}
514 514
 
515 515
 		}
@@ -519,22 +519,22 @@  discard block
 block discarded – undo
519 519
 		// (i.e. autosaves are happening and then in between autosaves the user trashes a ticket).
520 520
 		// Or a draft event was saved and in the process of editing a ticket is trashed.
521 521
 		// No sense in keeping all the related data in the db!
522
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
523
-		$tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) );
522
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
523
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
524 524
 
525
-		foreach ( $tickets_removed as $id ) {
526
-			$id = absint( $id );
525
+		foreach ($tickets_removed as $id) {
526
+			$id = absint($id);
527 527
 
528 528
 			//get the ticket for this id
529 529
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
530 530
 
531 531
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
532
-			if ( $tkt_to_remove->get('TKT_is_default') )
532
+			if ($tkt_to_remove->get('TKT_is_default'))
533 533
 				continue;
534 534
 
535 535
 			// if this tkt has any registrations attached so then we just ARCHIVE
536 536
 			// because we don't actually permanently delete these tickets.
537
-			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
537
+			if ($tkt_to_remove->count_related('Registration') > 0) {
538 538
 				$tkt_to_remove->delete();
539 539
 				continue;
540 540
 			}
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 			// (remember this process can ONLY kick off if there are NO tkts_sold)
544 544
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
545 545
 
546
-			foreach( $dtts as $dtt ) {
546
+			foreach ($dtts as $dtt) {
547 547
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
548 548
 			}
549 549
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 			// tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
552 552
 			$tkt_to_remove->delete_related_permanently('Price');
553 553
 
554
-			do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove );
554
+			do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove);
555 555
 
556 556
 			// finally let's delete this ticket
557 557
 			// (which should not be blocked at this point b/c we've removed all our relationships)
@@ -583,39 +583,39 @@  discard block
 block discarded – undo
583 583
 		// and removing the ticket from datetimes it got removed from.
584 584
 
585 585
 		// first let's add datetimes
586
-		if ( ! empty( $added_datetimes ) && is_array( $added_datetimes ) ) {
587
-			foreach ( $added_datetimes as $row_id ) {
586
+		if ( ! empty($added_datetimes) && is_array($added_datetimes)) {
587
+			foreach ($added_datetimes as $row_id) {
588 588
 				$row_id = (int) $row_id;
589
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
590
-					$ticket->_add_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
589
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
590
+					$ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime');
591 591
 					// Is this an existing ticket (has an ID) and does it have any sold?
592 592
 					// If so, then we need to add that to the DTT sold because this DTT is getting added.
593
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
594
-						$saved_datetimes[ $row_id ]->increase_sold( $ticket->sold() );
595
-						$saved_datetimes[ $row_id ]->save();
593
+					if ($ticket->ID() && $ticket->sold() > 0) {
594
+						$saved_datetimes[$row_id]->increase_sold($ticket->sold());
595
+						$saved_datetimes[$row_id]->save();
596 596
 					}
597 597
 				}
598 598
 			}
599 599
 		}
600 600
 		// then remove datetimes
601
-		if ( ! empty( $removed_datetimes ) && is_array( $removed_datetimes ) ) {
602
-			foreach ( $removed_datetimes as $row_id ) {
603
-				$row_id = (int)$row_id;
601
+		if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) {
602
+			foreach ($removed_datetimes as $row_id) {
603
+				$row_id = (int) $row_id;
604 604
 				// its entirely possible that a datetime got deleted (instead of just removed from relationship.
605 605
 				// So make sure we skip over this if the dtt isn't in the $saved_datetimes array)
606
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
607
-					$ticket->_remove_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
606
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
607
+					$ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime');
608 608
 					// Is this an existing ticket (has an ID) and does it have any sold?
609 609
 					// If so, then we need to remove it's sold from the DTT_sold.
610
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
611
-						$saved_datetimes[ $row_id ]->decrease_sold( $ticket->sold() );
612
-						$saved_datetimes[ $row_id ]->save();
610
+					if ($ticket->ID() && $ticket->sold() > 0) {
611
+						$saved_datetimes[$row_id]->decrease_sold($ticket->sold());
612
+						$saved_datetimes[$row_id]->save();
613 613
 					}
614 614
 				}
615 615
 			}
616 616
 		}
617 617
 		// cap ticket qty by datetime reg limits
618
-		$ticket->set_qty( min( $ticket->qty(), $ticket->qty( 'reg_limit' ) ) );
618
+		$ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit')));
619 619
 		return $ticket;
620 620
 	}
621 621
 
@@ -636,39 +636,39 @@  discard block
 block discarded – undo
636 636
 		EE_Ticket $ticket,
637 637
 		$price_rows = array(),
638 638
 		$ticket_price = 0,
639
-		$base_price = 0 ,
639
+		$base_price = 0,
640 640
 		$base_price_id = 0
641 641
 	) {
642 642
 
643 643
 		// create new ticket that's a copy of the existing
644 644
 		// except a new id of course (and not archived)
645 645
 		// AND has the new TKT_price associated with it.
646
-		$new_ticket = clone( $ticket );
647
-		$new_ticket->set( 'TKT_ID', 0 );
648
-		$new_ticket->set( 'TKT_deleted', 0 );
649
-		$new_ticket->set( 'TKT_price', $ticket_price );
650
-		$new_ticket->set( 'TKT_sold', 0 );
646
+		$new_ticket = clone($ticket);
647
+		$new_ticket->set('TKT_ID', 0);
648
+		$new_ticket->set('TKT_deleted', 0);
649
+		$new_ticket->set('TKT_price', $ticket_price);
650
+		$new_ticket->set('TKT_sold', 0);
651 651
 		// let's get a new ID for this ticket
652 652
 		$new_ticket->save();
653 653
 		// we also need to make sure this new ticket gets the same datetime attachments as the archived ticket
654
-		$datetimes_on_existing = $ticket->get_many_related( 'Datetime' );
654
+		$datetimes_on_existing = $ticket->get_many_related('Datetime');
655 655
 		$new_ticket = $this->_update_ticket_datetimes(
656 656
 			$new_ticket,
657 657
 			$datetimes_on_existing,
658
-			array_keys( $datetimes_on_existing )
658
+			array_keys($datetimes_on_existing)
659 659
 		);
660 660
 
661 661
 		// $ticket will get archived later b/c we are NOT adding it to the saved_tickets array.
662 662
 		// if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining
663 663
 		// available.
664
-		if ( $ticket->sold() > 0 ) {
664
+		if ($ticket->sold() > 0) {
665 665
 			$new_qty = $ticket->qty() - $ticket->sold();
666
-			$new_ticket->set_qty( $new_qty );
666
+			$new_ticket->set_qty($new_qty);
667 667
 		}
668 668
 		//now we update the prices just for this ticket
669
-		$new_ticket = $this->_add_prices_to_ticket( $price_rows, $new_ticket, true );
669
+		$new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true);
670 670
 		//and we update the base price
671
-		$new_ticket = $this->_add_prices_to_ticket( array(), $new_ticket, true, $base_price, $base_price_id );
671
+		$new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id);
672 672
 		return $new_ticket;
673 673
 	}
674 674
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
689 689
 	 * @return EE_Ticket
690 690
 	 */
691
-	protected function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
691
+	protected function  _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) {
692 692
 
693 693
 		//let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session.
694 694
 		$current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers();
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 		$updated_prices = array();
697 697
 
698 698
 		// if $base_price ! FALSE then updating a base price.
699
-		if ( $base_price !== FALSE ) {
699
+		if ($base_price !== FALSE) {
700 700
 			$prices[1] = array(
701 701
 				'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id,
702 702
 				'PRT_ID' => 1,
@@ -707,47 +707,47 @@  discard block
 block discarded – undo
707 707
 		}
708 708
 
709 709
 		//possibly need to save tkt
710
-		if ( ! $ticket->ID() )
710
+		if ( ! $ticket->ID())
711 711
 			$ticket->save();
712 712
 
713
-		foreach ( $prices as $row => $prc ) {
714
-			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
715
-			if ( empty($prt_id) )
713
+		foreach ($prices as $row => $prc) {
714
+			$prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL;
715
+			if (empty($prt_id))
716 716
 				continue; //prices MUST have a price type id.
717 717
 			$PRC_values = array(
718
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
718
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
719 719
 				'PRT_ID' => $prt_id,
720
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
721
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
722
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
720
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
721
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
722
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
723 723
 				'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor
724 724
 				'PRC_order' => $row
725 725
 				);
726
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
726
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
727 727
 				$PRC_values['PRC_ID'] = 0;
728
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
728
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
729 729
 			} else {
730
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
730
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
731 731
 				//update this price with new values
732
-				foreach ( $PRC_values as $field => $newprc ) {
733
-					$PRC->set( $field, $newprc );
732
+				foreach ($PRC_values as $field => $newprc) {
733
+					$PRC->set($field, $newprc);
734 734
 				}
735 735
 			}
736 736
 			$PRC->save();
737 737
 			$prcid = $PRC->ID();
738 738
 			$updated_prices[$prcid] = $PRC;
739
-			$ticket->_add_relation_to( $PRC, 'Price' );
739
+			$ticket->_add_relation_to($PRC, 'Price');
740 740
 		}
741 741
 
742 742
 		//now let's remove any prices that got removed from the ticket
743
-		if ( !empty ( $current_prices_on_ticket ) ) {
743
+		if ( ! empty ($current_prices_on_ticket)) {
744 744
 			$current = array_keys($current_prices_on_ticket);
745 745
 			$updated = array_keys($updated_prices);
746 746
 			$prices_to_remove = array_diff($current, $updated);
747
-			if ( !empty( $prices_to_remove ) ) {
748
-				foreach ( $prices_to_remove as $prc_id ) {
747
+			if ( ! empty($prices_to_remove)) {
748
+				foreach ($prices_to_remove as $prc_id) {
749 749
 					$p = $current_prices_on_ticket[$prc_id];
750
-					$ticket->_remove_relation_to( $p, 'Price' );
750
+					$ticket->_remove_relation_to($p, 'Price');
751 751
 
752 752
 					//delete permanently the price
753 753
 					$p->delete_permanently();
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 
761 761
 
762 762
 
763
-	public function autosave_handling( $event_admin_obj ) {
763
+	public function autosave_handling($event_admin_obj) {
764 764
 		return $event_admin_obj; //doing nothing for the moment.
765 765
 		//todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method)
766 766
 
@@ -794,12 +794,12 @@  discard block
 block discarded – undo
794 794
 
795 795
 		//default main template args
796 796
 		$main_template_args = array(
797
-			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
797
+			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
798 798
 			'existing_datetime_ids' => '',
799 799
 			'total_dtt_rows' => 1,
800
-			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
800
+			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
801 801
 			'datetime_rows' => '',
802
-			'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
802
+			'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
803 803
 			'ticket_rows' => '',
804 804
 			'existing_ticket_ids' => '',
805 805
 			'total_ticket_rows' => 1,
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 
810 810
 		$timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL;
811 811
 
812
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
812
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
813 813
 
814 814
 		/**
815 815
 		 * 1. Start with retrieving Datetimes
@@ -817,8 +817,8 @@  discard block
 block discarded – undo
817 817
 		 * 3. For each ticket get related prices
818 818
 		 */
819 819
 
820
-		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) );
821
-		$times = $DTM->get_all_event_dates( $evtID );
820
+		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone));
821
+		$times = $DTM->get_all_event_dates($evtID);
822 822
 
823 823
 
824 824
 
@@ -826,31 +826,31 @@  discard block
 block discarded – undo
826 826
 
827 827
 		/** @see https://events.codebasehq.com/projects/event-espresso/tickets/9486 for why we are counting $dttrow and then setting that on the Datetime object */
828 828
 		$dttrow = 1;
829
-		foreach ( $times as $time ) {
829
+		foreach ($times as $time) {
830 830
 			$dttid = $time->get('DTT_ID');
831
-			$time->set( 'DTT_order', $dttrow );
831
+			$time->set('DTT_order', $dttrow);
832 832
 			$existing_datetime_ids[] = $dttid;
833 833
 
834 834
 			//tickets attached
835
-			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC' ) ) ) : array();
835
+			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC'))) : array();
836 836
 
837 837
 			//if there are no related tickets this is likely a new event OR autodraft
838 838
 			// event so we need to generate the default tickets because dtts
839 839
 			// ALWAYS have at least one related ticket!!.  EXCEPT, we dont' do this if there is already more than one
840 840
 			// datetime on the event.
841
-			if ( empty ( $related_tickets ) && count( $times ) < 2 ) {
841
+			if (empty ($related_tickets) && count($times) < 2) {
842 842
 				$related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
843 843
 
844 844
 				//this should be ordered by TKT_ID, so let's grab the first default ticket (which will be the main default) and ensure it has any default prices added to it (but do NOT save).
845 845
 				$default_prices = EEM_Price::instance()->get_all_default_prices();
846 846
 
847
-				$main_default_ticket = reset( $related_tickets );
848
-				if ( $main_default_ticket instanceof EE_Ticket ) {
849
-					foreach ( $default_prices as $default_price ) {
850
-						if ( $default_price->is_base_price() ) {
847
+				$main_default_ticket = reset($related_tickets);
848
+				if ($main_default_ticket instanceof EE_Ticket) {
849
+					foreach ($default_prices as $default_price) {
850
+						if ($default_price->is_base_price()) {
851 851
 							continue;
852 852
 						}
853
-						$main_default_ticket->cache( 'Price', $default_price );
853
+						$main_default_ticket->cache('Price', $default_price);
854 854
 					}
855 855
 				}
856 856
 			}
@@ -859,11 +859,11 @@  discard block
 block discarded – undo
859 859
 			//we can't actually setup rows in this loop yet cause we don't know all the unique tickets for this event yet (tickets are linked through all datetimes). So we're going to temporarily cache some of that information.
860 860
 
861 861
 			//loop through and setup the ticket rows and make sure the order is set.
862
-			foreach ( $related_tickets as $ticket ) {
862
+			foreach ($related_tickets as $ticket) {
863 863
 				$tktid = $ticket->get('TKT_ID');
864 864
 				$tktrow = $ticket->get('TKT_row');
865 865
 				//we only want unique tickets in our final display!!
866
-				if ( !in_array( $tktid, $existing_ticket_ids ) ) {
866
+				if ( ! in_array($tktid, $existing_ticket_ids)) {
867 867
 					$existing_ticket_ids[] = $tktid;
868 868
 					$all_tickets[] = $ticket;
869 869
 				}
@@ -872,57 +872,57 @@  discard block
 block discarded – undo
872 872
 				$datetime_tickets[$dttid][] = $tktrow;
873 873
 
874 874
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
875
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
875
+				if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid]))
876 876
 					$ticket_datetimes[$tktid][] = $dttrow;
877 877
 			}
878 878
 			$dttrow++;
879 879
 		}
880 880
 
881
-		$main_template_args['total_ticket_rows'] = count( $existing_ticket_ids );
882
-		$main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids );
883
-		$main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids );
881
+		$main_template_args['total_ticket_rows'] = count($existing_ticket_ids);
882
+		$main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
883
+		$main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
884 884
 
885 885
 		//sort $all_tickets by order
886
-		usort( $all_tickets, function( $a, $b ) {
886
+		usort($all_tickets, function($a, $b) {
887 887
 			$a_order = (int) $a->get('TKT_order');
888 888
 			$b_order = (int) $b->get('TKT_order');
889
-			if ( $a_order == $b_order ) {
889
+			if ($a_order == $b_order) {
890 890
 				return 0;
891 891
 			}
892
-			return ( $a_order < $b_order ) ? -1 : 1;
892
+			return ($a_order < $b_order) ? -1 : 1;
893 893
 		});
894 894
 
895 895
 		//k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again.
896 896
 		$dttrow = 1;
897
-		foreach ( $times as $time ) {
898
-			$main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times );
897
+		foreach ($times as $time) {
898
+			$main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times);
899 899
 			$dttrow++;
900 900
 		}
901 901
 
902 902
 		//then loop through all tickets for the ticket rows.
903 903
 		$tktrow = 1;
904
-		foreach ( $all_tickets as $ticket ) {
905
-			$main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets );
904
+		foreach ($all_tickets as $ticket) {
905
+			$main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets);
906 906
 			$tktrow++;
907 907
 		}
908 908
 
909 909
 		$main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets);
910
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php';
911
-		EEH_Template::display_template( $template, $main_template_args );
910
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php';
911
+		EEH_Template::display_template($template, $main_template_args);
912 912
 		return;
913 913
 	}
914 914
 
915 915
 
916 916
 
917
-	protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
917
+	protected function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) {
918 918
 
919 919
 		$dtt_display_template_args = array(
920
-			'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ),
921
-			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ),
920
+			'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts),
921
+			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default),
922 922
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow
923 923
 			);
924
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php';
925
-		return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE);
924
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php';
925
+		return EEH_Template::display_template($template, $dtt_display_template_args, TRUE);
926 926
 	}
927 927
 
928 928
 
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 	 *
941 941
 	 * @return string Generated edit row.
942 942
 	 */
943
-	protected function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) {
943
+	protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) {
944 944
 
945 945
 		// if the incomign $dtt object is NOT an instance of EE_Datetime then force default to true.
946 946
 		$default = ! $dtt instanceof EE_Datetime ? true : false;
@@ -948,30 +948,30 @@  discard block
 block discarded – undo
948 948
 		$template_args = array(
949 949
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
950 950
 			'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
951
-			'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
951
+			'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
952 952
 			'DTT_ID' => $default ? '' : $dtt->ID(),
953 953
 			'DTT_name' => $default ? '' : $dtt->name(),
954 954
 			'DTT_description' => $default ? '' : $dtt->description(),
955
-			'DTT_EVT_start' => $default ? '' : $dtt->start_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
956
-			'DTT_EVT_end' => $default ? '' : $dtt->end_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
957
-			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'),
955
+			'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
956
+			'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
957
+			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'),
958 958
 			'DTT_order' => $default ? 'DTTNUM' : $dttrow,
959 959
 			'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'),
960
-			'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
961
-			'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0  ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
960
+			'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
961
+			'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
962 962
 			);
963 963
 
964
-		$template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
964
+		$template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
965 965
 
966 966
 		//allow filtering of template args at this point.
967
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event );
967
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event);
968 968
 
969
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php';
970
-		return EEH_Template::display_template( $template, $template_args, TRUE );
969
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php';
970
+		return EEH_Template::display_template($template, $template_args, TRUE);
971 971
 	}
972 972
 
973 973
 
974
-	protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
974
+	protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) {
975 975
 
976 976
 		$template_args = array(
977 977
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
@@ -979,47 +979,47 @@  discard block
 block discarded – undo
979 979
 			'DTT_description' => $default ? '' : $dtt->description(),
980 980
 			'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '',
981 981
 			'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '',
982
-			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
982
+			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
983 983
 			'DTT_ID' => $default ? '' : $dtt->ID()
984 984
 			);
985 985
 
986 986
 		//need to setup the list items (but only if this isnt' a default skeleton setup)
987
-		if ( !$default ) {
987
+		if ( ! $default) {
988 988
 			$tktrow = 1;
989
-			foreach ( $all_tickets as $ticket ) {
990
-				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default );
989
+			foreach ($all_tickets as $ticket) {
990
+				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default);
991 991
 				$tktrow++;
992 992
 			}
993 993
 		}
994 994
 
995 995
 		//filter template args at this point
996
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event );
996
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event);
997 997
 
998
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php';
999
-		return EEH_Template::display_template( $template, $template_args, TRUE );
998
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php';
999
+		return EEH_Template::display_template($template, $template_args, TRUE);
1000 1000
 	}
1001 1001
 
1002 1002
 
1003 1003
 
1004
-	protected function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) {
1005
-		$tktid = !empty( $ticket ) ? $ticket->ID() : 0;
1006
-		$dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array();
1004
+	protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) {
1005
+		$tktid = ! empty($ticket) ? $ticket->ID() : 0;
1006
+		$dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array();
1007 1007
 
1008
-		$displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0;
1008
+		$displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0;
1009 1009
 		$template_args = array(
1010 1010
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
1011
-			'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow,
1011
+			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1012 1012
 			'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '',
1013 1013
 			'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '',
1014
-			'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'),
1015
-			'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
1014
+			'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'),
1015
+			'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
1016 1016
 			);
1017 1017
 
1018 1018
 		//filter template args
1019
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event );
1019
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event);
1020 1020
 
1021
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php';
1022
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1021
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php';
1022
+		return EEH_Template::display_template($template, $template_args, TRUE);
1023 1023
 	}
1024 1024
 
1025 1025
 
@@ -1041,37 +1041,37 @@  discard block
 block discarded – undo
1041 1041
 	 *
1042 1042
 	 * @return [type] [description]
1043 1043
 	 */
1044
-	protected function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) {
1044
+	protected function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) {
1045 1045
 
1046 1046
 		//if $ticket is not an instance of EE_Ticket then force default to true.
1047
-		$default =  ! $ticket instanceof EE_Ticket ? true : false;
1047
+		$default = ! $ticket instanceof EE_Ticket ? true : false;
1048 1048
 
1049
-		$prices = ! empty( $ticket ) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array();
1049
+		$prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array();
1050 1050
 
1051 1051
 		//if there is only one price (which would be the base price) or NO prices and this ticket is a default ticket, let's just make sure there are no cached default prices on
1052 1052
 		//the object.  This is done by not including any query_params.
1053
-		if ( $ticket instanceof EE_Ticket && $ticket->is_default() && ( count( $prices ) === 1  || empty( $prices ) ) ) {
1054
-			$prices = $ticket->get_many_related( 'Price' );
1053
+		if ($ticket instanceof EE_Ticket && $ticket->is_default() && (count($prices) === 1 || empty($prices))) {
1054
+			$prices = $ticket->get_many_related('Price');
1055 1055
 		}
1056 1056
 
1057 1057
 		// check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket).  This will future proof in case there is ever any behaviour change between what the primary_key defaults to.
1058
-		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE;
1058
+		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE;
1059 1059
 
1060
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1060
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1061 1061
 
1062 1062
 		$ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal();
1063
-		$base_price = $default ? NULL :  $ticket->base_price();
1063
+		$base_price = $default ? NULL : $ticket->base_price();
1064 1064
 		$count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE);
1065 1065
 
1066 1066
 		//breaking out complicated condition for ticket_status
1067
-		if ( $default ) {
1068
-			$ticket_status_class = ' tkt-status-' . EE_Ticket::onsale;
1067
+		if ($default) {
1068
+			$ticket_status_class = ' tkt-status-'.EE_Ticket::onsale;
1069 1069
 		} else {
1070
-			$ticket_status_class =  $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status();
1070
+			$ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status();
1071 1071
 		}
1072 1072
 
1073 1073
 		//breaking out complicated condition for TKT_taxable
1074
-		if ( $default ) {
1074
+		if ($default) {
1075 1075
 			$TKT_taxable = '';
1076 1076
 		} else {
1077 1077
 			$TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : '';
@@ -1086,19 +1086,19 @@  discard block
 block discarded – undo
1086 1086
 			'edit_tkt_expanded' => '',
1087 1087
 			'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets',
1088 1088
 			'TKT_name' => $default ? '' : $ticket->get('TKT_name'),
1089
-			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
1090
-			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']  ),
1091
-			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
1089
+			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1090
+			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1091
+			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
1092 1092
 			'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE),
1093 1093
 			'TKT_price_code' => EE_Registry::instance()->CFG->currency->code,
1094 1094
 			'TKT_price_amount' => $default ? 0 : $ticket_subtotal,
1095
-			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'),
1096
-			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'),
1097
-			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'),
1098
-			'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ),
1099
-			'TKT_max' => $default ? '' :  $ticket->get_pretty('TKT_max','input'),
1095
+			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'),
1096
+			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'),
1097
+			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'),
1098
+			'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')),
1099
+			'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'),
1100 1100
 			'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'),
1101
-			'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ),
1101
+			'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))),
1102 1102
 			'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'),
1103 1103
 			'TKT_description' => $default ? '' : $ticket->get('TKT_description'),
1104 1104
 			'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'),
@@ -1107,99 +1107,99 @@  discard block
 block discarded – undo
1107 1107
 			'ticket_price_rows' => '',
1108 1108
 			'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'),
1109 1109
 			'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(),
1110
-			'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"',
1111
-			'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '',
1110
+			'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"',
1111
+			'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '',
1112 1112
 			'total_price_rows' => count($prices) > 1 ? count($prices) : 1,
1113 1113
 			'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '',
1114 1114
 			'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts),
1115 1115
 			'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts),
1116
-			'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ),
1116
+			'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)),
1117 1117
 			'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'),
1118 1118
 			'TKT_taxable' => $TKT_taxable,
1119 1119
 			'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
1120 1120
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1121
-			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ),
1121
+			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE),
1122 1122
 			'TKT_subtotal_amount' => $ticket_subtotal,
1123
-			'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ),
1124
-			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE: FALSE,
1123
+			'tax_rows' => $this->_get_tax_rows($tktrow, $ticket),
1124
+			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE : FALSE,
1125 1125
 			'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
1126 1126
 			'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
1127 1127
 			'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
1128 1128
 			);
1129 1129
 
1130
-		$template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1130
+		$template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1131 1131
 
1132 1132
 		//handle rows that should NOT be empty
1133
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1133
+		if (empty($template_args['TKT_start_date'])) {
1134 1134
 			//if empty then the start date will be now.
1135
-			$template_args['TKT_start_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , current_time('timestamp'));
1136
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1135
+			$template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], current_time('timestamp'));
1136
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1137 1137
 		}
1138 1138
 
1139
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1139
+		if (empty($template_args['TKT_end_date'])) {
1140 1140
 
1141 1141
 			//get the earliest datetime (if present);
1142
-			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1142
+			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1143 1143
 
1144
-			if ( !empty( $earliest_dtt ) ) {
1145
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
1144
+			if ( ! empty($earliest_dtt)) {
1145
+				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
1146 1146
 			} else {
1147 1147
 				//default so let's just use what's been set for the default date-time which is 30 days from now.
1148
-				$template_args['TKT_end_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") )  );
1148
+				$template_args['TKT_end_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], mktime(24, 0, 0, date("m"), date("d") + 29, date("Y")));
1149 1149
 			}
1150
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1150
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1151 1151
 		}
1152 1152
 
1153 1153
 		//generate ticket_datetime items
1154
-		if ( ! $default ) {
1154
+		if ( ! $default) {
1155 1155
 			$dttrow = 1;
1156
-			foreach ( $all_dtts as $dtt ) {
1157
-				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default );
1156
+			foreach ($all_dtts as $dtt) {
1157
+				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default);
1158 1158
 				$dttrow++;
1159 1159
 			}
1160 1160
 		}
1161 1161
 
1162 1162
 		$prcrow = 1;
1163
-		foreach ( $prices as $price ) {
1164
-			if ( $price->is_base_price() ) {
1163
+		foreach ($prices as $price) {
1164
+			if ($price->is_base_price()) {
1165 1165
 				$prcrow++;
1166 1166
 				continue;
1167 1167
 			}
1168
-			$show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1  ? FALSE : TRUE;
1169
-			$show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE;
1170
-			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create );
1168
+			$show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE;
1169
+			$show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE;
1170
+			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create);
1171 1171
 			$prcrow++;
1172 1172
 		}
1173 1173
 
1174 1174
 		//filter $template_args
1175
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event );
1175
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event);
1176 1176
 
1177
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php';
1178
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1177
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php';
1178
+		return EEH_Template::display_template($template, $template_args, TRUE);
1179 1179
 	}
1180 1180
 
1181 1181
 
1182 1182
 
1183 1183
 
1184 1184
 
1185
-	protected function _get_tax_rows( $tktrow, $ticket ) {
1185
+	protected function _get_tax_rows($tktrow, $ticket) {
1186 1186
 		$tax_rows = '';
1187
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
1187
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php';
1188 1188
 		$template_args = array();
1189
-		$taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1190
-		foreach ( $taxes as $tax ) {
1191
-			$tax_added = $this->_get_tax_added( $tax, $ticket );
1189
+		$taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1190
+		foreach ($taxes as $tax) {
1191
+			$tax_added = $this->_get_tax_added($tax, $ticket);
1192 1192
 			$template_args = array(
1193
-				'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1193
+				'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1194 1194
 				'tax_id' => $tax->ID(),
1195 1195
 				'tkt_row' => $tktrow,
1196 1196
 				'tax_label' => $tax->get('PRC_name'),
1197 1197
 				'tax_added' => $tax_added,
1198
-				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ),
1198
+				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE),
1199 1199
 				'tax_amount' => $tax->get('PRC_amount')
1200 1200
 				);
1201
-			$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event  );
1202
-			$tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE );
1201
+			$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event);
1202
+			$tax_rows .= EEH_Template::display_template($template, $template_args, TRUE);
1203 1203
 		}
1204 1204
 
1205 1205
 
@@ -1207,81 +1207,81 @@  discard block
 block discarded – undo
1207 1207
 	}
1208 1208
 
1209 1209
 
1210
-	protected function _get_tax_added( EE_Price $tax, $ticket ) {
1211
-		$subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal();
1210
+	protected function _get_tax_added(EE_Price $tax, $ticket) {
1211
+		$subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal();
1212 1212
 		return $subtotal * $tax->get('PRC_amount') / 100;
1213 1213
 	}
1214 1214
 
1215 1215
 
1216 1216
 
1217 1217
 
1218
-	protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
1219
-		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1218
+	protected function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) {
1219
+		$send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1220 1220
 		$template_args = array(
1221 1221
 			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1222 1222
 			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1223 1223
 			'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices',
1224
-			'price_type_selector' => $default && empty( $price ) ? $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ) : $this->_get_price_type_selector( $tktrow, $prcrow, $price, $default, $send_disabled ),
1224
+			'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled),
1225 1225
 			'PRC_ID' => $default && empty($price) ? 0 : $price->ID(),
1226 1226
 			'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'),
1227 1227
 			'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'),
1228 1228
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1229 1229
 			'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"',
1230
-			'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1231
-			'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1232
-			'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ),
1233
-			'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1234
-			'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ),
1230
+			'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1231
+			'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1232
+			'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''),
1233
+			'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1234
+			'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'),
1235 1235
 			'show_trash_icon' => $show_trash ? '' : ' style="display:none;"',
1236 1236
 			'show_create_button' => $show_create ? '' : ' style="display:none;"',
1237
-			'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'),
1238
-			'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1237
+			'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'),
1238
+			'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1239 1239
 			);
1240 1240
 
1241
-	$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event );
1241
+	$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event);
1242 1242
 
1243
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php';
1244
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1243
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php';
1244
+		return EEH_Template::display_template($template, $template_args, TRUE);
1245 1245
 	}
1246 1246
 
1247 1247
 
1248
-	protected function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1249
-		if ( $price->is_base_price() ) {
1250
-			return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default );
1248
+	protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1249
+		if ($price->is_base_price()) {
1250
+			return $this->_get_base_price_template($tktrow, $prcrow, $price, $default);
1251 1251
 		} else {
1252
-			return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled );
1252
+			return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled);
1253 1253
 		}
1254 1254
 
1255 1255
 	}
1256 1256
 
1257 1257
 
1258
-	protected function _get_base_price_template( $tktrow, $prcrow, $price, $default ) {
1258
+	protected function _get_base_price_template($tktrow, $prcrow, $price, $default) {
1259 1259
 		$template_args = array(
1260 1260
 				'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1261
-				'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1262
-				'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'),
1261
+				'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1262
+				'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'),
1263 1263
 				'PRT_name' => __('Price', 'event_espresso'),
1264 1264
 				'price_selected_operator' => '+',
1265 1265
 				'price_selected_is_percent' => 0
1266 1266
 			);
1267
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php';
1267
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php';
1268 1268
 
1269
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event );
1269
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event);
1270 1270
 
1271
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1271
+		return EEH_Template::display_template($template, $template_args, TRUE);
1272 1272
 	}
1273 1273
 
1274 1274
 
1275 1275
 
1276
-	protected function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1277
-		$select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]';
1278
-		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) );
1279
-		$price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php';
1280
-		$all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array();
1281
-		$selected_price_type_id = $default && empty( $price ) ? 0 : $price->type();
1276
+	protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1277
+		$select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]';
1278
+		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3'))));
1279
+		$price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php';
1280
+		$all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array();
1281
+		$selected_price_type_id = $default && empty($price) ? 0 : $price->type();
1282 1282
 		$price_option_spans = '';
1283 1283
 		//setup pricetypes for selector
1284
-		foreach ( $price_types as $price_type ) {
1284
+		foreach ($price_types as $price_type) {
1285 1285
 			$all_price_types[] = array(
1286 1286
 				'id' => $price_type->ID(),
1287 1287
 				'text' => $price_type->get('PRT_name'),
@@ -1293,50 +1293,50 @@  discard block
 block discarded – undo
1293 1293
 				'PRT_operator' => $price_type->is_discount() ? '-' : '+',
1294 1294
 				'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0
1295 1295
 				);
1296
-			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE );
1296
+			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE);
1297 1297
 		}
1298 1298
 
1299
-		$select_params = $disabled ? 'style="width:auto;" disabled'  : 'style="width:auto;"';
1299
+		$select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"';
1300 1300
 		$main_name = $select_name;
1301
-		$select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name;
1301
+		$select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name;
1302 1302
 
1303 1303
 		$template_args = array(
1304 1304
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1305
-			'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1306
-			'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ),
1305
+			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1306
+			'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'),
1307 1307
 			'main_name' => $main_name,
1308 1308
 			'selected_price_type_id' => $selected_price_type_id,
1309 1309
 			'price_option_spans' => $price_option_spans,
1310
-			'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ),
1311
-			'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ),
1310
+			'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'),
1311
+			'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0),
1312 1312
 			'disabled' => $disabled
1313 1313
 			);
1314 1314
 
1315
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event );
1315
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event);
1316 1316
 
1317
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php';
1317
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php';
1318 1318
 
1319
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1319
+		return EEH_Template::display_template($template, $template_args, TRUE);
1320 1320
 	}
1321 1321
 
1322 1322
 
1323 1323
 
1324
-	protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1325
-		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1326
-		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
1327
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1324
+	protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) {
1325
+		$dttid = ! empty($dtt) ? $dtt->ID() : 0;
1326
+		$displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0;
1327
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1328 1328
 		$template_args = array(
1329
-			'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow,
1329
+			'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow,
1330 1330
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1331
-			'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '',
1332
-			'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '',
1333
-			'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ),
1331
+			'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '',
1332
+			'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '',
1333
+			'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE),
1334 1334
 			'tkt_status_class' => '',
1335 1335
 			);
1336 1336
 
1337
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event );
1338
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1339
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1337
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event);
1338
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1339
+		return EEH_Template::display_template($template, $template_args, TRUE);
1340 1340
 	}
1341 1341
 
1342 1342
 
@@ -1344,53 +1344,53 @@  discard block
 block discarded – undo
1344 1344
 	protected function _get_ticket_js_structure($all_dtts, $all_tickets) {
1345 1345
 		$template_args = array(
1346 1346
 			'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts),
1347
-			'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE),
1348
-			'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ),
1347
+			'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE),
1348
+			'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL),
1349 1349
 			'default_price_rows' => '',
1350 1350
 			'default_base_price_amount' => 0,
1351 1351
 			'default_base_price_name' => '',
1352 1352
 			'default_base_price_description' => '',
1353
-			'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ),
1354
-			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ),
1353
+			'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE),
1354
+			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE),
1355 1355
 			'existing_available_datetime_tickets_list' => '',
1356 1356
 			'existing_available_ticket_datetimes_list' => '',
1357
-			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ),
1358
-			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE )
1357
+			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE),
1358
+			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE)
1359 1359
 			);
1360 1360
 
1361 1361
 		$tktrow = 1;
1362
-		foreach ( $all_tickets as $ticket ) {
1363
-			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE );
1362
+		foreach ($all_tickets as $ticket) {
1363
+			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE);
1364 1364
 			$tktrow++;
1365 1365
 		}
1366 1366
 
1367 1367
 
1368 1368
 		$dttrow = 1;
1369
-		foreach ( $all_dtts as $dtt ) {
1370
-			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE );
1369
+		foreach ($all_dtts as $dtt) {
1370
+			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE);
1371 1371
 			$dttrow++;
1372 1372
 		}
1373 1373
 
1374 1374
 		$default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices();
1375 1375
 		$prcrow = 1;
1376
-		foreach ( $default_prices as $price ) {
1377
-			if ( $price->is_base_price() ) {
1376
+		foreach ($default_prices as $price) {
1377
+			if ($price->is_base_price()) {
1378 1378
 				$template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float');
1379 1379
 				$template_args['default_base_price_name'] = $price->get('PRC_name');
1380 1380
 				$template_args['default_base_price_description'] = $price->get('PRC_desc');
1381 1381
 				$prcrow++;
1382 1382
 				continue;
1383 1383
 			}
1384
-			$show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1  ? FALSE : TRUE;
1385
-			$show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE;
1386
-			$template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create );
1384
+			$show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE;
1385
+			$show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE;
1386
+			$template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create);
1387 1387
 			$prcrow++;
1388 1388
 		}
1389 1389
 
1390
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event );
1390
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event);
1391 1391
 
1392
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php';
1393
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1392
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php';
1393
+		return EEH_Template::display_template($template, $template_args, TRUE);
1394 1394
 	}
1395 1395
 
1396 1396
 
Please login to merge, or discard this patch.
caffeinated/modules/recaptcha/EED_Recaptcha.module.php 1 patch
Spacing   +130 added lines, -131 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @return EED_Recaptcha
44 44
 	 */
45 45
 	public static function instance() {
46
-		return parent::get_instance( __CLASS__ );
46
+		return parent::get_instance(__CLASS__);
47 47
 	}
48 48
 
49 49
 
@@ -59,32 +59,32 @@  discard block
 block discarded – undo
59 59
 		if (
60 60
 			EE_Registry::instance()->CFG->registration->use_captcha
61 61
 			&& ! (
62
-				EE_Registry::instance()->REQ->get( 'step', '' ) === 'payment_options'
63
-				&& (boolean) EE_Registry::instance()->REQ->get( 'revisit', false ) === true
62
+				EE_Registry::instance()->REQ->get('step', '') === 'payment_options'
63
+				&& (boolean) EE_Registry::instance()->REQ->get('revisit', false) === true
64 64
 			)
65 65
 		) {
66 66
 			EED_Recaptcha::set_definitions();
67 67
 			EED_Recaptcha::enqueue_styles_and_scripts();
68
-			add_action( 'wp', array( 'EED_Recaptcha', 'set_late_hooks' ), 1, 0 );
68
+			add_action('wp', array('EED_Recaptcha', 'set_late_hooks'), 1, 0);
69 69
 			add_action(
70 70
 				'AHEE__before_spco_whats_next_buttons',
71
-				array( 'EED_Recaptcha', 'display_recaptcha' ), 10, 0
71
+				array('EED_Recaptcha', 'display_recaptcha'), 10, 0
72 72
 			);
73 73
 			add_filter(
74 74
 				'FHEE__EED_Single_Page_Checkout__init___continue_reg',
75
-				array( 'EED_Recaptcha', 'not_a_robot' ), 10
75
+				array('EED_Recaptcha', 'not_a_robot'), 10
76 76
 			);
77 77
 			add_filter(
78 78
 				'FHEE__EE_SPCO_Reg_Step__set_completed___completed',
79
-				array( 'EED_Recaptcha', 'not_a_robot' ), 10
79
+				array('EED_Recaptcha', 'not_a_robot'), 10
80 80
 			);
81 81
 			add_filter(
82 82
 				'FHEE__EE_SPCO_JSON_Response___toString__JSON_response',
83
-				array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1
83
+				array('EED_Recaptcha', 'recaptcha_response'), 10, 1
84 84
 			);
85 85
 			add_filter(
86 86
 				'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array',
87
-				array( 'EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method' ), 10, 1
87
+				array('EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method'), 10, 1
88 88
 			);
89 89
 		}
90 90
 	}
@@ -103,18 +103,18 @@  discard block
 block discarded – undo
103 103
 		if (
104 104
 			EE_Registry::instance()->CFG->registration->use_captcha
105 105
 			&& ! (
106
-				EE_Registry::instance()->REQ->get( 'step', '' ) === 'payment_options'
107
-				&& (boolean) EE_Registry::instance()->REQ->get( 'revisit', false ) === true
106
+				EE_Registry::instance()->REQ->get('step', '') === 'payment_options'
107
+				&& (boolean) EE_Registry::instance()->REQ->get('revisit', false) === true
108 108
 			)
109 109
 		) {
110 110
 			EED_Recaptcha::enqueue_styles_and_scripts();
111
-			add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
112
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
113
-			add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 );
111
+			add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10);
112
+			add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10);
113
+			add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1);
114 114
 		}
115 115
 		// admin settings
116
-		add_action( 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array( 'EED_Recaptcha', 'admin_settings' ), 10, 1 );
117
-		add_filter( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array( 'EED_Recaptcha', 'update_admin_settings' ), 10, 1 );
116
+		add_action('AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array('EED_Recaptcha', 'admin_settings'), 10, 1);
117
+		add_filter('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array('EED_Recaptcha', 'update_admin_settings'), 10, 1);
118 118
 	}
119 119
 
120 120
 
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 	 *  @return 	void
127 127
 	 */
128 128
 	public static function set_definitions() {
129
-		if ( is_user_logged_in() ) {
129
+		if (is_user_logged_in()) {
130 130
 			EED_Recaptcha::$_not_a_robot = true;
131 131
 		}
132
-		define( 'RECAPTCHA_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
133
-		define( 'RECAPTCHA_BASE_URL', plugin_dir_url( __FILE__ ));
132
+		define('RECAPTCHA_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
133
+		define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__));
134 134
 	}
135 135
 
136 136
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	public static function set_late_hooks() {
145 145
 		add_filter(
146 146
 			'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit',
147
-			array( 'EED_Recaptcha', 'not_a_robot' )
147
+			array('EED_Recaptcha', 'not_a_robot')
148 148
 		);
149 149
 	}
150 150
 
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
 	 *  @return 	void
158 158
 	 */
159 159
 	public static function enqueue_styles_and_scripts() {
160
-		wp_register_script( 'espresso_recaptcha', RECAPTCHA_BASE_URL . 'scripts' . DS . 'espresso_recaptcha.js', array( 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, TRUE );
161
-		wp_register_script( 'google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . EE_Registry::instance()->CFG->registration->recaptcha_language, array( 'espresso_recaptcha' ), EVENT_ESPRESSO_VERSION, TRUE );
162
-		EE_Registry::$i18n_js_strings['no_SPCO_error'] = __( 'It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso' );
163
-		EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __( 'There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso' );
164
-		EE_Registry::$i18n_js_strings['recaptcha_fail'] = __( 'Please complete the anti-spam test before proceeding.', 'event_espresso' );
160
+		wp_register_script('espresso_recaptcha', RECAPTCHA_BASE_URL.'scripts'.DS.'espresso_recaptcha.js', array('single_page_checkout'), EVENT_ESPRESSO_VERSION, TRUE);
161
+		wp_register_script('google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl='.EE_Registry::instance()->CFG->registration->recaptcha_language, array('espresso_recaptcha'), EVENT_ESPRESSO_VERSION, TRUE);
162
+		EE_Registry::$i18n_js_strings['no_SPCO_error'] = __('It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso');
163
+		EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __('There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso');
164
+		EE_Registry::$i18n_js_strings['recaptcha_fail'] = __('Please complete the anti-spam test before proceeding.', 'event_espresso');
165 165
 	}
166 166
 
167 167
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 * @access    public
173 173
 	 * @param \WP $WP
174 174
 	 */
175
-	public function run( $WP ) {
175
+	public function run($WP) {
176 176
 	}
177 177
 
178 178
 
@@ -182,8 +182,7 @@  discard block
 block discarded – undo
182 182
 	 *  @return boolean
183 183
 	 */
184 184
 	public static function not_a_robot() {
185
-		$not_a_robot = is_bool( EED_Recaptcha::$_not_a_robot ) ? EED_Recaptcha::$_not_a_robot :
186
-			EED_Recaptcha::recaptcha_passed();
185
+		$not_a_robot = is_bool(EED_Recaptcha::$_not_a_robot) ? EED_Recaptcha::$_not_a_robot : EED_Recaptcha::recaptcha_passed();
187 186
 		return $not_a_robot;
188 187
 	}
189 188
 
@@ -199,22 +198,22 @@  discard block
 block discarded – undo
199 198
 	 */
200 199
 	public static function display_recaptcha() {
201 200
 		// logged in means you have already passed a turing test of sorts
202
-		if ( is_user_logged_in() ) {
201
+		if (is_user_logged_in()) {
203 202
 			return;
204 203
 		}
205 204
 		// don't display if not using recaptcha or user is logged in
206
-		if ( EE_Registry::instance()->CFG->registration->use_captcha ) {
205
+		if (EE_Registry::instance()->CFG->registration->use_captcha) {
207 206
 			// only display if they have NOT passed the test yet
208
-			if ( ! EED_Recaptcha::$_not_a_robot ) {
207
+			if ( ! EED_Recaptcha::$_not_a_robot) {
209 208
 				EEH_Template::display_template(
210
-					RECAPTCHA_BASE_PATH . DS . 'templates' . DS . 'recaptcha.template.php',
209
+					RECAPTCHA_BASE_PATH.DS.'templates'.DS.'recaptcha.template.php',
211 210
 					array(
212 211
 						'recaptcha_publickey' 	=> EE_Registry::instance()->CFG->registration->recaptcha_publickey,
213 212
 						'recaptcha_theme' 		=> EE_Registry::instance()->CFG->registration->recaptcha_theme,
214 213
 						'recaptcha_type' 			=> EE_Registry::instance()->CFG->registration->recaptcha_type
215 214
 					)
216 215
 				);
217
-				wp_enqueue_script( 'google_recaptcha' );
216
+				wp_enqueue_script('google_recaptcha');
218 217
 			}
219 218
 		}
220 219
 	}
@@ -245,17 +244,17 @@  discard block
 block discarded – undo
245 244
 	 */
246 245
 	public static function recaptcha_passed() {
247 246
 		// logged in means you have already passed a turing test of sorts
248
-		if ( is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha() ) {
247
+		if (is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha()) {
249 248
 			return TRUE;
250 249
 		}
251 250
 		// was test already passed?
252
-		$recaptcha_passed = EE_Registry::instance()->SSN->get_session_data( 'recaptcha_passed' );
253
-		$recaptcha_passed = filter_var( $recaptcha_passed, FILTER_VALIDATE_BOOLEAN );
251
+		$recaptcha_passed = EE_Registry::instance()->SSN->get_session_data('recaptcha_passed');
252
+		$recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN);
254 253
 		// verify recaptcha
255 254
 		EED_Recaptcha::_get_recaptcha_response();
256
-		if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response ) {
255
+		if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) {
257 256
 			$recaptcha_passed = EED_Recaptcha::_process_recaptcha_response();
258
-			EE_Registry::instance()->SSN->set_session_data( array( 'recaptcha_passed' => $recaptcha_passed ));
257
+			EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed));
259 258
 			EE_Registry::instance()->SSN->update();
260 259
 		}
261 260
 		EED_Recaptcha::$_not_a_robot = $recaptcha_passed;
@@ -271,8 +270,8 @@  discard block
 block discarded – undo
271 270
 	 * @param array $recaptcha_response
272 271
 	 * @return boolean
273 272
 	 */
274
-	public static function recaptcha_response( $recaptcha_response = array() ) {
275
-		if ( EED_Recaptcha::_bypass_recaptcha() ) {
273
+	public static function recaptcha_response($recaptcha_response = array()) {
274
+		if (EED_Recaptcha::_bypass_recaptcha()) {
276 275
 			$recaptcha_response['bypass_recaptcha'] = TRUE;
277 276
 			$recaptcha_response['recaptcha_passed'] = TRUE;
278 277
 		} else {
@@ -292,16 +291,16 @@  discard block
 block discarded – undo
292 291
 	 */
293 292
 	private static function _bypass_recaptcha() {
294 293
 		// an array of key value pairs that must match exactly with the incoming request, in order to bypass recaptcha for the current request ONLY
295
-		$bypass_request_params_array = apply_filters( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array() );
294
+		$bypass_request_params_array = apply_filters('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array());
296 295
 		// does $bypass_request_params_array have any values ?
297
-		if ( empty( $bypass_request_params_array )) {
296
+		if (empty($bypass_request_params_array)) {
298 297
 			return FALSE;
299 298
 		}
300 299
 		// initially set bypass to TRUE
301 300
 		$bypass_recaptcha = TRUE;
302
-		foreach ( $bypass_request_params_array as $key => $value ) {
301
+		foreach ($bypass_request_params_array as $key => $value) {
303 302
 			// if $key is not found or value doesn't match exactly, then toggle bypass to FALSE, otherwise carry over it's value. This way, one missed setting results in no bypass
304
-			$bypass_recaptcha = isset( $_REQUEST[ $key ] ) && $_REQUEST[ $key ] === $value ? $bypass_recaptcha : FALSE;
303
+			$bypass_recaptcha = isset($_REQUEST[$key]) && $_REQUEST[$key] === $value ? $bypass_recaptcha : FALSE;
305 304
 		}
306 305
 		return $bypass_recaptcha;
307 306
 	}
@@ -316,7 +315,7 @@  discard block
 block discarded – undo
316 315
 	 * 	@return 	boolean
317 316
 	 */
318 317
 	private static function _get_recaptcha_response() {
319
-		EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false );
318
+		EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get('g-recaptcha-response', false);
320 319
 	}
321 320
 
322 321
 
@@ -330,26 +329,26 @@  discard block
 block discarded – undo
330 329
 	 */
331 330
 	private static function _process_recaptcha_response() {
332 331
 		// verify library is loaded
333
-		if ( ! class_exists( '\\ReCaptcha\\ReCaptcha' )) {
334
-			require_once( RECAPTCHA_BASE_PATH . DS . 'autoload.php' );
332
+		if ( ! class_exists('\\ReCaptcha\\ReCaptcha')) {
333
+			require_once(RECAPTCHA_BASE_PATH.DS.'autoload.php');
335 334
 		}
336 335
 		// The response from reCAPTCHA
337 336
 		EED_Recaptcha::_get_recaptcha_response();
338 337
 		$recaptcha_response = EED_Recaptcha::$_recaptcha_response;
339 338
 		// Was there a reCAPTCHA response?
340
-		if ( $recaptcha_response ) {
339
+		if ($recaptcha_response) {
341 340
 			// if allow_url_fopen is Off, then set a different request method
342
-			$request_method = ! ini_get( 'allow_url_fopen' ) ? new \ReCaptcha\RequestMethod\SocketPost() : null;
341
+			$request_method = ! ini_get('allow_url_fopen') ? new \ReCaptcha\RequestMethod\SocketPost() : null;
343 342
 			$recaptcha = new \ReCaptcha\ReCaptcha(
344 343
 				EE_Registry::instance()->CFG->registration->recaptcha_privatekey,
345 344
 				$request_method
346 345
 			);
347 346
 			$recaptcha_response = $recaptcha->verify(
348 347
 				EED_Recaptcha::$_recaptcha_response,
349
-				$_SERVER[ 'REMOTE_ADDR' ]
348
+				$_SERVER['REMOTE_ADDR']
350 349
 			);
351 350
 		}
352
-		if ( $recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess() ) {
351
+		if ($recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess()) {
353 352
 			return TRUE;
354 353
 		}
355 354
 		// sorry... it appears you can't don't know what soup or hamburgers are !!!
@@ -393,12 +392,12 @@  discard block
 block discarded – undo
393 392
 				'subsections' 			=> apply_filters(
394 393
 					'FHEE__EED_Recaptcha___recaptcha_settings_form__form_subsections',
395 394
 					array(
396
-						'main_settings_hdr' 				=> new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Anti-spam Settings', 'event_espresso' ) . EEH_Template::get_help_tab_link( 'recaptcha_info' ))),
395
+						'main_settings_hdr' 				=> new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Anti-spam Settings', 'event_espresso').EEH_Template::get_help_tab_link('recaptcha_info'))),
397 396
 						'main_settings' 						=> EED_Recaptcha::_recaptcha_main_settings(),
398
-						'appearance_settings_hdr' 	=> new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Appearance', 'event_espresso' ) )),
397
+						'appearance_settings_hdr' 	=> new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Appearance', 'event_espresso'))),
399 398
 						'appearance_settings' 			=> EED_Recaptcha::_recaptcha_appearance_settings(),
400 399
 						// 'recaptcha_example' 				=> new EE_Form_Section_HTML( EED_Recaptcha::display_recaptcha() ),
401
-						'required_fields_note' 			=> new EE_Form_Section_HTML( EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' ))
400
+						'required_fields_note' 			=> new EE_Form_Section_HTML(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text'))
402 401
 					)
403 402
 				)
404 403
 			)
@@ -425,28 +424,28 @@  discard block
 block discarded – undo
425 424
 					array(
426 425
 						'use_captcha' 				=> new EE_Yes_No_Input(
427 426
 							array(
428
-								'html_label_text'	 	=> __( 'Use reCAPTCHA', 'event_espresso' ),
427
+								'html_label_text'	 	=> __('Use reCAPTCHA', 'event_espresso'),
429 428
 								'html_help_text' 		=> sprintf(
430
-									__( 'reCAPTCHA is a free service that  protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso' ),
429
+									__('reCAPTCHA is a free service that  protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso'),
431 430
 									'<a href="https://www.google.com/recaptcha/intro/index.html">',
432 431
 									'</a>'
433 432
 								),
434
-								'default' 								=> isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE,
433
+								'default' 								=> isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE,
435 434
 								'display_html_label_text' 	=> FALSE
436 435
 							)
437 436
 						),
438 437
 						'recaptcha_publickey' 		=> new EE_Text_Input(
439 438
 							array(
440
-								'html_label_text'	 	=> __( 'Site Key', 'event_espresso' ),
441
-								'html_help_text' 		=> __( 'The site key is used to display the widget on your site.', 'event_espresso' ),
442
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : ''
439
+								'html_label_text'	 	=> __('Site Key', 'event_espresso'),
440
+								'html_help_text' 		=> __('The site key is used to display the widget on your site.', 'event_espresso'),
441
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : ''
443 442
 							)
444 443
 						),
445 444
 						'recaptcha_privatekey' 		=> new EE_Text_Input(
446 445
 							array(
447
-								'html_label_text'	 	=> __( 'Secret Key', 'event_espresso' ),
448
-								'html_help_text' 		=> __( 'The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso' ),
449
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : ''
446
+								'html_label_text'	 	=> __('Secret Key', 'event_espresso'),
447
+								'html_help_text' 		=> __('The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso'),
448
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : ''
450 449
 							)
451 450
 						)
452 451
 					)
@@ -478,81 +477,81 @@  discard block
 block discarded – undo
478 477
 					array(
479 478
 						'recaptcha_theme' 		=> new EE_Radio_Button_Input(
480 479
 							array(
481
-								'light' => __( 'Light', 'event_espresso' ),
482
-								'dark' => __( 'Dark', 'event_espresso' )
480
+								'light' => __('Light', 'event_espresso'),
481
+								'dark' => __('Dark', 'event_espresso')
483 482
 							),
484 483
 							array(
485
-								'html_label_text'	 	=> __( 'Theme', 'event_espresso' ),
486
-								'html_help_text' 		=> __( 'The color theme of the widget.', 'event_espresso' ),
487
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light',
484
+								'html_label_text'	 	=> __('Theme', 'event_espresso'),
485
+								'html_help_text' 		=> __('The color theme of the widget.', 'event_espresso'),
486
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light',
488 487
 								'display_html_label_text' => FALSE
489 488
 							)
490 489
 						),
491 490
 						'recaptcha_type' 		=> new EE_Radio_Button_Input(
492 491
 							array(
493
-								'image' => __( 'Image', 'event_espresso' ),
494
-								'audio' => __( 'Audio', 'event_espresso' )
492
+								'image' => __('Image', 'event_espresso'),
493
+								'audio' => __('Audio', 'event_espresso')
495 494
 							),
496 495
 							array(
497
-								'html_label_text'	 	=> __( 'Type', 'event_espresso' ),
498
-								'html_help_text' 		=> __( 'The type of CAPTCHA to serve.', 'event_espresso' ),
499
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_type ) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image',
496
+								'html_label_text'	 	=> __('Type', 'event_espresso'),
497
+								'html_help_text' 		=> __('The type of CAPTCHA to serve.', 'event_espresso'),
498
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_type) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image',
500 499
 								'display_html_label_text' =>FALSE
501 500
 							)
502 501
 						),
503 502
 						'recaptcha_language' 		=> new EE_Select_Input(
504 503
 							array(
505
-								 'ar' 			=> __( 'Arabic', 'event_espresso' ),
506
-								 'bg' 		=> __( 'Bulgarian', 'event_espresso' ),
507
-								 'ca' 			=> __( 'Catalan', 'event_espresso' ),
508
-								 'zh-CN' 	=>  __( 'Chinese (Simplified)', 'event_espresso' ),
509
-								 'zh-TW' 	=>  __( 'Chinese (Traditional)	', 'event_espresso' ),
510
-								 'hr' 			=> __( 'Croatian', 'event_espresso' ),
511
-								 'cs' 			=> __( 'Czech', 'event_espresso' ),
512
-								 'da' 			=> __( 'Danish', 'event_espresso' ),
513
-								 'nl' 			=> __( 'Dutch', 'event_espresso' ),
514
-								 'en-GB' 	=>  __( 'English (UK)', 'event_espresso' ),
515
-								 'en' 			=> __( 'English (US)', 'event_espresso' ),
516
-								 'fil' 			=> __( 'Filipino', 'event_espresso' ),
517
-								 'fi' 			=> __( 'Finnish', 'event_espresso' ),
518
-								 'fr' 			=> __( 'French', 'event_espresso' ),
519
-								 'fr-CA' 	=>  __( 'French (Canadian)', 'event_espresso' ),
520
-								 'de' 			=> __( 'German', 'event_espresso' ),
521
-								 'de-AT' 	=>  __( 'German (Austria)', 'event_espresso' ),
522
-								 'de-CH' 	=>  __( 'German (Switzerland)', 'event_espresso' ),
523
-								 'el' 			=> __( 'Greek', 'event_espresso' ),
524
-								 'iw' 			=> __( 'Hebrew', 'event_espresso' ),
525
-								 'hi' 			=> __( 'Hindi', 'event_espresso' ),
526
-								 'hu' 		=> __( 'Hungarian', 'event_espresso' ),
527
-								 'id' 			=> __( 'Indonesian', 'event_espresso' ),
528
-								 'it' 			=> __( 'Italian', 'event_espresso' ),
529
-								 'ja' 			=> __( 'Japanese', 'event_espresso' ),
530
-								 'ko' 			=> __( 'Korean', 'event_espresso' ),
531
-								 'lv' 			=> __( 'Latvian', 'event_espresso' ),
532
-								 'lt' 			=> __( 'Lithuanian', 'event_espresso' ),
533
-								 'no' 		=> __( 'Norwegian', 'event_espresso' ),
534
-								 'fa' 			=> __( 'Persian', 'event_espresso' ),
535
-								 'pl' 			=> __( 'Polish', 'event_espresso' ),
536
-								 'pt' 			=> __( 'Portuguese', 'event_espresso' ),
537
-								 'pt-BR' 	=>  __( 'Portuguese (Brazil)', 'event_espresso' ),
538
-								 'pt-PT' 	=>  __( 'Portuguese (Portugal)', 'event_espresso' ),
539
-								 'ro' 			=> __( 'Romanian', 'event_espresso' ),
540
-								 'ru' 			=> __( 'Russian', 'event_espresso' ),
541
-								 'sr' 			=> __( 'Serbian', 'event_espresso' ),
542
-								 'sk' 			=> __( 'Slovak', 'event_espresso' ),
543
-								 'sl' 			=> __( 'Slovenian', 'event_espresso' ),
544
-								 'es' 			=> __( 'Spanish', 'event_espresso' ),
545
-								 'es-419' 	=>  __( 'Spanish (Latin America)', 'event_espresso' ),
546
-								 'sv' 			=> __( 'Swedish', 'event_espresso' ),
547
-								 'th' 			=> __( 'Thai', 'event_espresso' ),
548
-								 'tr' 			=> __( 'Turkish', 'event_espresso' ),
549
-								 'uk' 			=> __( 'Ukrainian', 'event_espresso' ),
550
-								 'vi' 			=> __( 'Vietnamese', 'event_espresso')
504
+								 'ar' 			=> __('Arabic', 'event_espresso'),
505
+								 'bg' 		=> __('Bulgarian', 'event_espresso'),
506
+								 'ca' 			=> __('Catalan', 'event_espresso'),
507
+								 'zh-CN' 	=>  __('Chinese (Simplified)', 'event_espresso'),
508
+								 'zh-TW' 	=>  __('Chinese (Traditional)	', 'event_espresso'),
509
+								 'hr' 			=> __('Croatian', 'event_espresso'),
510
+								 'cs' 			=> __('Czech', 'event_espresso'),
511
+								 'da' 			=> __('Danish', 'event_espresso'),
512
+								 'nl' 			=> __('Dutch', 'event_espresso'),
513
+								 'en-GB' 	=>  __('English (UK)', 'event_espresso'),
514
+								 'en' 			=> __('English (US)', 'event_espresso'),
515
+								 'fil' 			=> __('Filipino', 'event_espresso'),
516
+								 'fi' 			=> __('Finnish', 'event_espresso'),
517
+								 'fr' 			=> __('French', 'event_espresso'),
518
+								 'fr-CA' 	=>  __('French (Canadian)', 'event_espresso'),
519
+								 'de' 			=> __('German', 'event_espresso'),
520
+								 'de-AT' 	=>  __('German (Austria)', 'event_espresso'),
521
+								 'de-CH' 	=>  __('German (Switzerland)', 'event_espresso'),
522
+								 'el' 			=> __('Greek', 'event_espresso'),
523
+								 'iw' 			=> __('Hebrew', 'event_espresso'),
524
+								 'hi' 			=> __('Hindi', 'event_espresso'),
525
+								 'hu' 		=> __('Hungarian', 'event_espresso'),
526
+								 'id' 			=> __('Indonesian', 'event_espresso'),
527
+								 'it' 			=> __('Italian', 'event_espresso'),
528
+								 'ja' 			=> __('Japanese', 'event_espresso'),
529
+								 'ko' 			=> __('Korean', 'event_espresso'),
530
+								 'lv' 			=> __('Latvian', 'event_espresso'),
531
+								 'lt' 			=> __('Lithuanian', 'event_espresso'),
532
+								 'no' 		=> __('Norwegian', 'event_espresso'),
533
+								 'fa' 			=> __('Persian', 'event_espresso'),
534
+								 'pl' 			=> __('Polish', 'event_espresso'),
535
+								 'pt' 			=> __('Portuguese', 'event_espresso'),
536
+								 'pt-BR' 	=>  __('Portuguese (Brazil)', 'event_espresso'),
537
+								 'pt-PT' 	=>  __('Portuguese (Portugal)', 'event_espresso'),
538
+								 'ro' 			=> __('Romanian', 'event_espresso'),
539
+								 'ru' 			=> __('Russian', 'event_espresso'),
540
+								 'sr' 			=> __('Serbian', 'event_espresso'),
541
+								 'sk' 			=> __('Slovak', 'event_espresso'),
542
+								 'sl' 			=> __('Slovenian', 'event_espresso'),
543
+								 'es' 			=> __('Spanish', 'event_espresso'),
544
+								 'es-419' 	=>  __('Spanish (Latin America)', 'event_espresso'),
545
+								 'sv' 			=> __('Swedish', 'event_espresso'),
546
+								 'th' 			=> __('Thai', 'event_espresso'),
547
+								 'tr' 			=> __('Turkish', 'event_espresso'),
548
+								 'uk' 			=> __('Ukrainian', 'event_espresso'),
549
+								 'vi' 			=> __('Vietnamese', 'event_espresso')
551 550
 							),
552 551
 							array(
553
-								'html_label_text'	 	=> __( 'Language', 'event_espresso' ),
554
-								'html_help_text' 		=> __( 'Forces the widget to render in a specific language.', 'event_espresso' ),
555
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'
552
+								'html_label_text'	 	=> __('Language', 'event_espresso'),
553
+								'html_help_text' 		=> __('Forces the widget to render in a specific language.', 'event_espresso'),
554
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'
556 555
 							)
557 556
 						)
558 557
 					)
@@ -600,25 +599,25 @@  discard block
 block discarded – undo
600 599
 	 * @param EE_Registration_Config $EE_Registration_Config
601 600
 	 * @return array
602 601
 	 */
603
-	public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) {
602
+	public static function update_admin_settings(EE_Registration_Config $EE_Registration_Config) {
604 603
 		try {
605 604
 			$recaptcha_settings_form = EED_Recaptcha::_recaptcha_settings_form();
606 605
 			// if not displaying a form, then check for form submission
607
-			if ( $recaptcha_settings_form->was_submitted() ) {
606
+			if ($recaptcha_settings_form->was_submitted()) {
608 607
 				// capture form data
609 608
 				$recaptcha_settings_form->receive_form_submission();
610 609
 				// validate form data
611
-				if ( $recaptcha_settings_form->is_valid() ) {
610
+				if ($recaptcha_settings_form->is_valid()) {
612 611
 					// grab validated data from form
613 612
 					$valid_data = $recaptcha_settings_form->valid_data();
614 613
 					// user proofing recaptcha:  If Use reCAPTCHA is set to yes but we dont' have site or secret keys then set Use reCAPTCHA to FALSE and give error message.
615 614
 					if (
616
-						apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config )
615
+						apply_filters('FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config)
617 616
 						&& $valid_data['main_settings']['use_captcha']
618
-						&& ( ! $EE_Registration_Config->use_captcha && ( empty( $valid_data['main_settings']['recaptcha_publickey'] ) || empty( $valid_data['main_settings']['recaptcha_privatekey'] )))
617
+						&& ( ! $EE_Registration_Config->use_captcha && (empty($valid_data['main_settings']['recaptcha_publickey']) || empty($valid_data['main_settings']['recaptcha_privatekey'])))
619 618
 					) {
620 619
 						$valid_data['main_settings']['use_captcha'] = FALSE;
621
-						EE_Error::add_error( __('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
620
+						EE_Error::add_error(__('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
622 621
 					}
623 622
 					$EE_Registration_Config->use_captcha = $valid_data['main_settings']['use_captcha'];
624 623
 					$EE_Registration_Config->recaptcha_publickey = $valid_data['main_settings']['recaptcha_publickey'];
@@ -627,12 +626,12 @@  discard block
 block discarded – undo
627 626
 					$EE_Registration_Config->recaptcha_theme = $valid_data['appearance_settings']['recaptcha_theme'];
628 627
 					$EE_Registration_Config->recaptcha_language = $valid_data['appearance_settings']['recaptcha_language'];
629 628
 				} else {
630
-					if ( $recaptcha_settings_form->submission_error_message() != '' ) {
631
-						EE_Error::add_error( $recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
629
+					if ($recaptcha_settings_form->submission_error_message() != '') {
630
+						EE_Error::add_error($recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
632 631
 					}
633 632
 				}
634 633
 			}
635
-		} catch( EE_Error $e ) {
634
+		} catch (EE_Error $e) {
636 635
 			$e->get_error();
637 636
 		}
638 637
 
Please login to merge, or discard this patch.
core/libraries/messages/EE_Messages_Scheduler.lib.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -23,18 +23,18 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct() {
25 25
 		//register tasks (and make sure only registered once).
26
-		if ( ! has_action( 'FHEE__EEH_Activation__get_cron_tasks', array( $this, 'register_scheduled_tasks' ) ) ) {
27
-			add_action( 'FHEE__EEH_Activation__get_cron_tasks', array( $this, 'register_scheduled_tasks' ), 10 );
26
+		if ( ! has_action('FHEE__EEH_Activation__get_cron_tasks', array($this, 'register_scheduled_tasks'))) {
27
+			add_action('FHEE__EEH_Activation__get_cron_tasks', array($this, 'register_scheduled_tasks'), 10);
28 28
 		}
29 29
 
30 30
 		//register callbacks for scheduled events (but make sure they are set only once).
31
-		if ( ! has_action( 'AHEE__EE_Messages_Scheduler__generation', array( 'EE_Messages_Scheduler', 'batch_generation' ) ) ) {
32
-			add_action( 'AHEE__EE_Messages_Scheduler__generation', array( 'EE_Messages_Scheduler', 'batch_generation') );
33
-			add_action( 'AHEE__EE_Messages_Scheduler__sending', array( 'EE_Messages_Scheduler', 'batch_sending' ) );
31
+		if ( ! has_action('AHEE__EE_Messages_Scheduler__generation', array('EE_Messages_Scheduler', 'batch_generation'))) {
32
+			add_action('AHEE__EE_Messages_Scheduler__generation', array('EE_Messages_Scheduler', 'batch_generation'));
33
+			add_action('AHEE__EE_Messages_Scheduler__sending', array('EE_Messages_Scheduler', 'batch_sending'));
34 34
 		}
35 35
 
36 36
 		//add custom schedules
37
-		add_filter( 'cron_schedules', array( $this, 'custom_schedules' ) );
37
+		add_filter('cron_schedules', array($this, 'custom_schedules'));
38 38
 	}
39 39
 
40 40
 
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
 	 * Add custom schedules for wp_cron
45 45
 	 * @param $schedules
46 46
 	 */
47
-	public function custom_schedules( $schedules ) {
47
+	public function custom_schedules($schedules) {
48 48
 		$schedules['ee_message_cron'] = array(
49 49
 			'interval' => self::message_cron_schedule,
50
-			'display' => __( 'This is the cron time interval for EE Message schedules (defaults to once every 5 minutes)', 'event_espresso' )
50
+			'display' => __('This is the cron time interval for EE Message schedules (defaults to once every 5 minutes)', 'event_espresso')
51 51
 		);
52 52
 		return $schedules;
53 53
 	}
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 * @param array $tasks  already existing scheduled tasks
59 59
 	 * @return array
60 60
 	 */
61
-	public function register_scheduled_tasks( $tasks ) {
61
+	public function register_scheduled_tasks($tasks) {
62 62
 		$tasks['AHEE__EE_Messages_Scheduler__generation'] = 'ee_message_cron';
63 63
 		$tasks['AHEE__EE_Messages_Scheduler__sending'] = 'ee_message_cron';
64 64
 		return $tasks;
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 	 * Note: The EED_Messages module has the handlers for these requests.
71 71
 	 * @param string $task  The task the request is being generated for.
72 72
 	 */
73
-	public static function initiate_scheduled_non_blocking_request( $task ) {
73
+	public static function initiate_scheduled_non_blocking_request($task) {
74 74
 		//create nonce (this ensures that only valid requests are accepted)
75
-		$nonce = wp_create_nonce( 'EE_Messages_Scheduler_' . $task );
75
+		$nonce = wp_create_nonce('EE_Messages_Scheduler_'.$task);
76 76
 		$request_url = add_query_arg(
77 77
 			array(
78 78
 				'ee' => 'msg_cron_trigger',
@@ -83,13 +83,13 @@  discard block
 block discarded – undo
83 83
 		);
84 84
 		$request_args = array(
85 85
 			'timeout' => 300,
86
-			'blocking' => ( defined( 'DOING_CRON' ) && DOING_CRON ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ? true : false,
86
+			'blocking' => (defined('DOING_CRON') && DOING_CRON) || (defined('DOING_AJAX') && DOING_AJAX) ? true : false,
87 87
 			'sslverify' => false,
88 88
 			'redirection' => 10,
89 89
 		);
90
-		$response = wp_remote_get( $request_url, $request_args );
91
-		if ( is_wp_error( $response ) ) {
92
-			trigger_error( $response->get_error_message() );
90
+		$response = wp_remote_get($request_url, $request_args);
91
+		if (is_wp_error($response)) {
92
+			trigger_error($response->get_error_message());
93 93
 		}
94 94
 	}
95 95
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * Callback for scheduled AHEE__EE_Messages_Scheduler__generation wp cron event
102 102
 	 */
103 103
 	public static function batch_generation() {
104
-		EE_Messages_Scheduler::initiate_scheduled_non_blocking_request( 'generate' );
104
+		EE_Messages_Scheduler::initiate_scheduled_non_blocking_request('generate');
105 105
 	}
106 106
 
107 107
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * Callback for scheduled AHEE__EE_Messages_Scheduler__sending
112 112
 	 */
113 113
 	public static function batch_sending() {
114
-		EE_Messages_Scheduler::initiate_scheduled_non_blocking_request( 'send' );
114
+		EE_Messages_Scheduler::initiate_scheduled_non_blocking_request('send');
115 115
 	}
116 116
 
117 117
 } //end EE_Messages_Scheduler
118 118
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/messages/EE_messenger.lib.php 1 patch
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	 * @return void
290 290
 	 */
291 291
 	public function enqueue_scripts_styles() {
292
-		do_action( 'AHEE__EE_messenger__enqueue_scripts_styles');
292
+		do_action('AHEE__EE_messenger__enqueue_scripts_styles');
293 293
 	}
294 294
 
295 295
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
 		$this->_supports_labels->template_variation_description = __('These are different styles to choose from for the selected template structure.  Usually these affect things like font style, color, borders etc.  In some cases the styles will also make minor layout changes.');
361 361
 
362
-		$this->_supports_labels = apply_filters( 'FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this );
362
+		$this->_supports_labels = apply_filters('FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this);
363 363
 	}
364 364
 
365 365
 
@@ -374,10 +374,10 @@  discard block
 block discarded – undo
374 374
 	 * @return stdClass
375 375
 	 */
376 376
 	public function get_supports_labels() {
377
-		if ( empty( $this->_supports_labels->template_pack ) || empty( $this->_supports_labels->template_variation) ) {
377
+		if (empty($this->_supports_labels->template_pack) || empty($this->_supports_labels->template_variation)) {
378 378
 			$this->_set_supports_labels_defaults();
379 379
 		}
380
-		return apply_filters( 'FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this );
380
+		return apply_filters('FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this);
381 381
 	}
382 382
 
383 383
 
@@ -397,10 +397,10 @@  discard block
 block discarded – undo
397 397
 	 *
398 398
 	 * @return string                    path or url for the requested variation.
399 399
 	 */
400
-	public function get_variation( EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE ) {
400
+	public function get_variation(EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE) {
401 401
 		$this->_tmp_pack = $pack;
402
-		$variation_path = apply_filters( 'EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters );
403
-		$variation_path = empty( $variation_path ) ? $this->_tmp_pack->get_variation( $this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters ) : $variation_path;
402
+		$variation_path = apply_filters('EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters);
403
+		$variation_path = empty($variation_path) ? $this->_tmp_pack->get_variation($this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters) : $variation_path;
404 404
 		return $variation_path;
405 405
 
406 406
 	}
@@ -418,13 +418,13 @@  discard block
 block discarded – undo
418 418
 	 * @return array
419 419
 	 */
420 420
 	public function get_default_message_types() {
421
-		$class = get_class( $this );
421
+		$class = get_class($this);
422 422
 
423 423
 		//messenger specific filter
424
-		$default_types = apply_filters( 'FHEE__' . $class . '__get_default_message_types__default_types', $this->_default_message_types, $this );
424
+		$default_types = apply_filters('FHEE__'.$class.'__get_default_message_types__default_types', $this->_default_message_types, $this);
425 425
 
426 426
 		//all messengers filter
427
-		$default_types = apply_filters( 'FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this );
427
+		$default_types = apply_filters('FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this);
428 428
 		return $default_types;
429 429
 	}
430 430
 
@@ -439,14 +439,14 @@  discard block
 block discarded – undo
439 439
 	 * @return array
440 440
 	 */
441 441
 	public function get_valid_message_types() {
442
-		$class = get_class( $this );
442
+		$class = get_class($this);
443 443
 
444 444
 		//messenger specific filter
445 445
 		//messenger specific filter
446
-		$valid_types = apply_filters( 'FHEE__' . $class . '__get_valid_message_types__valid_types', $this->_valid_message_types, $this );
446
+		$valid_types = apply_filters('FHEE__'.$class.'__get_valid_message_types__valid_types', $this->_valid_message_types, $this);
447 447
 
448 448
 		//all messengers filter
449
-		$valid_types = apply_filters( 'FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this );
449
+		$valid_types = apply_filters('FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this);
450 450
 		return $valid_types;
451 451
 	}
452 452
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 	 * @access public
461 461
 	 * @param array $new_config Whatever is put in here will reset the _validator_config property
462 462
 	 */
463
-	public function set_validator_config( $new_config ) {
463
+	public function set_validator_config($new_config) {
464 464
 		$this->_validator_config = $new_config;
465 465
 	}
466 466
 
@@ -476,8 +476,8 @@  discard block
 block discarded – undo
476 476
 	public function get_validator_config() {
477 477
 		$class = get_class($this);
478 478
 
479
-		$config = apply_filters( 'FHEE__' . $class . '__get_validator_config', $this->_validator_config, $this );
480
-		$config = apply_filters( 'FHEE__EE_messenger__get_validator_config', $config, $this );
479
+		$config = apply_filters('FHEE__'.$class.'__get_validator_config', $this->_validator_config, $this);
480
+		$config = apply_filters('FHEE__EE_messenger__get_validator_config', $config, $this);
481 481
 		return $config;
482 482
 	}
483 483
 
@@ -494,8 +494,8 @@  discard block
 block discarded – undo
494 494
 	 * @access public
495 495
 	 * @return string content for page
496 496
 	 */
497
-	public function get_messenger_admin_page_content( $page, $action = null, $extra = array(), $message_types = array() ) {
498
-		return $this->_get_admin_page_content( $page, $action, $extra, $message_types );
497
+	public function get_messenger_admin_page_content($page, $action = null, $extra = array(), $message_types = array()) {
498
+		return $this->_get_admin_page_content($page, $action, $extra, $message_types);
499 499
 	}
500 500
 
501 501
 
@@ -505,20 +505,20 @@  discard block
 block discarded – undo
505 505
 	 * @param array $extra
506 506
 	 * @return mixed|string
507 507
 	 */
508
-	protected function _get_admin_content_events_edit( $message_types, $extra ) {
508
+	protected function _get_admin_content_events_edit($message_types, $extra) {
509 509
 		//defaults
510 510
 		$template_args = array();
511 511
 		$selector_rows = '';
512 512
 
513 513
 		//we don't need message types here so we're just going to ignore. we do, however, expect the event id here. The event id is needed to provide a link to setup a custom template for this event.
514
-		$event_id = isset( $extra['event'] ) ? $extra['event'] : NULL;
514
+		$event_id = isset($extra['event']) ? $extra['event'] : NULL;
515 515
 
516
-		$template_wrapper_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_wrapper.template.php';
517
-		$template_row_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_row.template.php';
516
+		$template_wrapper_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_wrapper.template.php';
517
+		$template_row_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_row.template.php';
518 518
 
519 519
 		//array of template objects for global and custom (non-trashed) (but remember just for this messenger!)
520 520
 		$global_templates = EEM_Message_Template_Group::instance()->get_all(
521
-			array( array( 'MTP_messenger' => $this->name, 'MTP_is_global' => true, 'MTP_is_active' => true ) )
521
+			array(array('MTP_messenger' => $this->name, 'MTP_is_global' => true, 'MTP_is_active' => true))
522 522
 		);
523 523
 		$templates_for_event = EEM_Message_Template_Group::instance()->get_all_custom_templates_by_event(
524 524
 			$event_id,
@@ -527,55 +527,55 @@  discard block
 block discarded – undo
527 527
 				'MTP_is_active' => true
528 528
 			)
529 529
 		);
530
-		$templates_for_event = !empty( $templates_for_event ) ? $templates_for_event : array();
530
+		$templates_for_event = ! empty($templates_for_event) ? $templates_for_event : array();
531 531
 
532 532
 		//so we need to setup the rows for the selectors and we use the global mtpgs (cause those will the active message template groups)
533
-		foreach ( $global_templates as $mtpgID => $mtpg ) {
534
-			if ( $mtpg instanceof EE_Message_Template_Group ) {
533
+		foreach ($global_templates as $mtpgID => $mtpg) {
534
+			if ($mtpg instanceof EE_Message_Template_Group) {
535 535
 				//verify this message type is supposed to show on this page
536 536
 				$mtp_obj = $mtpg->message_type_obj();
537
-				if ( ! $mtp_obj instanceof EE_message_type ) {
537
+				if ( ! $mtp_obj instanceof EE_message_type) {
538 538
 					continue;
539 539
 				}
540
-				$mtp_obj->admin_registered_pages = (array)$mtp_obj->admin_registered_pages;
541
-				if ( ! in_array( 'events_edit', $mtp_obj->admin_registered_pages ) ) {
540
+				$mtp_obj->admin_registered_pages = (array) $mtp_obj->admin_registered_pages;
541
+				if ( ! in_array('events_edit', $mtp_obj->admin_registered_pages)) {
542 542
 					continue;
543 543
 				}
544 544
 				$select_values = array();
545
-				$select_values[ $mtpgID ] = __( 'Global', 'event_espresso' );
546
-				$default_value = array_key_exists( $mtpgID, $templates_for_event ) && ! $mtpg->get( 'MTP_is_override' ) ? $mtpgID : null;
545
+				$select_values[$mtpgID] = __('Global', 'event_espresso');
546
+				$default_value = array_key_exists($mtpgID, $templates_for_event) && ! $mtpg->get('MTP_is_override') ? $mtpgID : null;
547 547
 				//if the override has been set for the global template, then that means even if there are custom templates already created we ignore them because of the set override.
548
-				if ( ! $mtpg->get( 'MTP_is_override' ) ) {
548
+				if ( ! $mtpg->get('MTP_is_override')) {
549 549
 					//any custom templates for this message type?
550
-					$custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt( $this->name, $mtpg->message_type() );
551
-					foreach ( $custom_templates as $cmtpgID => $cmtpg ) {
552
-						$select_values[ $cmtpgID ] = $cmtpg->name();
553
-						$default_value = array_key_exists( $cmtpgID, $templates_for_event ) ? $cmtpgID : $default_value;
550
+					$custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt($this->name, $mtpg->message_type());
551
+					foreach ($custom_templates as $cmtpgID => $cmtpg) {
552
+						$select_values[$cmtpgID] = $cmtpg->name();
553
+						$default_value = array_key_exists($cmtpgID, $templates_for_event) ? $cmtpgID : $default_value;
554 554
 					}
555 555
 				}
556 556
 				//if there is no $default_value then we set it as the global
557
-				$default_value = empty( $default_value ) ? $mtpgID : $default_value;
558
-				$edit_url = EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value ), admin_url( 'admin.php' ) );
559
-				$create_url = EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value ), admin_url( 'admin.php' ) );
560
-				$st_args[ 'mt_name' ] = ucwords( $mtp_obj->label[ 'singular' ] );
561
-				$st_args[ 'mt_slug' ] = $mtpg->message_type();
562
-				$st_args[ 'messenger_slug' ] = $this->name;
563
-				$st_args[ 'selector' ] = EEH_Form_Fields::select_input( 'event_message_templates_relation[' . $mtpgID . ']', $select_values, $default_value, 'data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '"', 'message-template-selector' );
557
+				$default_value = empty($default_value) ? $mtpgID : $default_value;
558
+				$edit_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value), admin_url('admin.php'));
559
+				$create_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value), admin_url('admin.php'));
560
+				$st_args['mt_name'] = ucwords($mtp_obj->label['singular']);
561
+				$st_args['mt_slug'] = $mtpg->message_type();
562
+				$st_args['messenger_slug'] = $this->name;
563
+				$st_args['selector'] = EEH_Form_Fields::select_input('event_message_templates_relation['.$mtpgID.']', $select_values, $default_value, 'data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'"', 'message-template-selector');
564 564
 				//note that  message template group that has override_all_custom set will remove the ability to set a custom message template based off of the global (and that also in turn overrides any other custom templates).
565
-				$st_args[ 'create_button' ] = $mtpg->get( 'MTP_is_override' ) ? '' : '<a data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $create_url . '" class="button button-small create-mtpg-button">' . __( 'Create New Custom', 'event_espresso' ) . '</a>';
566
-				$st_args[ 'create_button' ] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messages_add_new_message_template' ) ? $st_args[ 'create_button' ] : '';
567
-				$st_args[ 'edit_button' ] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID ) ? '<a data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $edit_url . '" class="button button-small edit-mtpg-button">' . __( 'Edit', 'event_espresso' ) . '</a>' : '';
568
-				$selector_rows .= EEH_Template::display_template( $template_row_path, $st_args, true );
565
+				$st_args['create_button'] = $mtpg->get('MTP_is_override') ? '' : '<a data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$create_url.'" class="button button-small create-mtpg-button">'.__('Create New Custom', 'event_espresso').'</a>';
566
+				$st_args['create_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messages_add_new_message_template') ? $st_args['create_button'] : '';
567
+				$st_args['edit_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID) ? '<a data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$edit_url.'" class="button button-small edit-mtpg-button">'.__('Edit', 'event_espresso').'</a>' : '';
568
+				$selector_rows .= EEH_Template::display_template($template_row_path, $st_args, true);
569 569
 			}
570 570
 		}
571 571
 
572 572
 		//if no selectors present then get out.
573
-		if ( empty( $selector_rows ) ) {
573
+		if (empty($selector_rows)) {
574 574
 			return '';
575 575
 		}
576 576
 
577 577
 		$template_args['selector_rows'] = $selector_rows;
578
-		return EEH_Template::display_template( $template_wrapper_path, $template_args, TRUE );
578
+		return EEH_Template::display_template($template_wrapper_path, $template_args, TRUE);
579 579
 	}
580 580
 
581 581
 
@@ -590,8 +590,8 @@  discard block
 block discarded – undo
590 590
 	 * @return array $this->_template_fields
591 591
 	 */
592 592
 	public function get_template_fields() {
593
-		$template_fields = apply_filters( 'FHEE__' . get_class($this) . '__get_template_fields', $this->_template_fields, $this );
594
-		$template_fields = apply_filters( 'FHEE__EE_messenger__get_template_fields', $template_fields, $this );
593
+		$template_fields = apply_filters('FHEE__'.get_class($this).'__get_template_fields', $this->_template_fields, $this);
594
+		$template_fields = apply_filters('FHEE__EE_messenger__get_template_fields', $template_fields, $this);
595 595
 		return $template_fields;
596 596
 	}
597 597
 
@@ -605,9 +605,9 @@  discard block
 block discarded – undo
605 605
 	 * @param mixed $value
606 606
 	 */
607 607
 	protected function _set_template_value($item, $value) {
608
-		if ( array_key_exists($item, $this->_template_fields) ) {
609
-			$prop = '_' . $item;
610
-			$this->{$prop}= $value;
608
+		if (array_key_exists($item, $this->_template_fields)) {
609
+			$prop = '_'.$item;
610
+			$this->{$prop} = $value;
611 611
 		}
612 612
 	}
613 613
 
@@ -618,8 +618,8 @@  discard block
 block discarded – undo
618 618
 	 * @return bool Very important that all messengers return bool for successful send or not.  Error messages can be
619 619
 	 *              added to EE_Error.
620 620
 	 */
621
-	public function send_message( $message, EE_message_type $message_type ) {
622
-		$this->_validate_and_setup( $message );
621
+	public function send_message($message, EE_message_type $message_type) {
622
+		$this->_validate_and_setup($message);
623 623
 		$this->_incoming_message_type = $message_type;
624 624
 		return $this->_send_message();
625 625
 	}
@@ -633,28 +633,28 @@  discard block
 block discarded – undo
633 633
 	 * @param  bool   $send    true we will actually use the _send method (for test sends). FALSE we just return preview
634 634
 	 * @return string          return the message html content
635 635
 	 */
636
-	public function get_preview( EE_Message $message, EE_message_type $message_type, $send = false ) {
637
-		$this->_validate_and_setup( $message );
636
+	public function get_preview(EE_Message $message, EE_message_type $message_type, $send = false) {
637
+		$this->_validate_and_setup($message);
638 638
 
639 639
 		$this->_incoming_message_type = $message_type;
640 640
 
641
-		if ( $send ) {
641
+		if ($send) {
642 642
 			//are we overriding any existing template fields?
643 643
 			$settings = $this->get_existing_test_settings();
644
-			if ( !empty( $settings ) ) {
645
-				foreach( $settings as $field => $value ) {
646
-					$this->_set_template_value( $field, $value );
644
+			if ( ! empty($settings)) {
645
+				foreach ($settings as $field => $value) {
646
+					$this->_set_template_value($field, $value);
647 647
 				}
648 648
 			}
649 649
 		}
650 650
 
651 651
 		//enqueue preview js so that any links/buttons on the page are disabled.
652
-		if ( ! $send ) {
652
+		if ( ! $send) {
653 653
 			// the below may seem like duplication.  However, typically if a messenger enqueues scripts/styles,
654 654
 			// it deregisters all existing wp scripts and styles first.  So the second hook ensures our previewer still gets setup.
655
-			add_action( 'admin_enqueue_scripts', array( $this, 'add_preview_script' ), 10 );
656
-			add_action( 'wp_enqueue_scripts', array( $this, 'add_preview_script' ), 10 );
657
-			add_action( 'AHEE__EE_messenger__enqueue_scripts_styles', array( $this, 'add_preview_script' ), 10 );
655
+			add_action('admin_enqueue_scripts', array($this, 'add_preview_script'), 10);
656
+			add_action('wp_enqueue_scripts', array($this, 'add_preview_script'), 10);
657
+			add_action('AHEE__EE_messenger__enqueue_scripts_styles', array($this, 'add_preview_script'), 10);
658 658
 		}
659 659
 
660 660
 		return $send ? $this->_send_message() : $this->_preview();
@@ -672,10 +672,10 @@  discard block
 block discarded – undo
672 672
 	 */
673 673
 	public function add_preview_script() {
674 674
 		//error message
675
-		EE_Registry::$i18n_js_strings[ 'links_disabled' ] = __( 'All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup.  To test generated links, you must trigger an actual message notification.', 'event_espresso' );
676
-		wp_register_script( 'ee-messages-preview-js', EE_LIBRARIES_URL . 'messages/messenger/assets/js/ee-messages-preview.js', array( 'jquery' ), EVENT_ESPRESSO_VERSION, true );
677
-		wp_localize_script( 'ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings );
678
-		wp_enqueue_script( 'ee-messages-preview-js' );
675
+		EE_Registry::$i18n_js_strings['links_disabled'] = __('All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup.  To test generated links, you must trigger an actual message notification.', 'event_espresso');
676
+		wp_register_script('ee-messages-preview-js', EE_LIBRARIES_URL.'messages/messenger/assets/js/ee-messages-preview.js', array('jquery'), EVENT_ESPRESSO_VERSION, true);
677
+		wp_localize_script('ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings);
678
+		wp_enqueue_script('ee-messages-preview-js');
679 679
 	}
680 680
 
681 681
 
@@ -686,13 +686,13 @@  discard block
 block discarded – undo
686 686
 	 * @param  EE_Message $message
687 687
 	 * @throws EE_Error
688 688
 	 */
689
-	protected function _validate_and_setup( EE_Message $message ) {
689
+	protected function _validate_and_setup(EE_Message $message) {
690 690
 		$template_pack = $message->get_template_pack();
691 691
 		$variation = $message->get_template_pack_variation();
692 692
 
693 693
 		//verify we have the required template pack value on the $message object.
694
-		if ( ! $template_pack instanceof EE_Messages_Template_Pack ) {
695
-			throw new EE_Error( __('Incoming $message object must have an EE_Messages_Template_Pack object available.', 'event_espresso' ) );
694
+		if ( ! $template_pack instanceof EE_Messages_Template_Pack) {
695
+			throw new EE_Error(__('Incoming $message object must have an EE_Messages_Template_Pack object available.', 'event_espresso'));
696 696
 		}
697 697
 
698 698
 		$this->_tmp_pack = $template_pack;
@@ -701,11 +701,11 @@  discard block
 block discarded – undo
701 701
 
702 702
 		$template_fields = $this->get_template_fields();
703 703
 
704
-		foreach ( $template_fields as $template => $value ) {
705
-			if ( $template !== 'extra' ) {
706
-				$column_value = $message->get_field_or_extra_meta( 'MSG_' . $template );
704
+		foreach ($template_fields as $template => $value) {
705
+			if ($template !== 'extra') {
706
+				$column_value = $message->get_field_or_extra_meta('MSG_'.$template);
707 707
 				$message_template_value = $column_value ? $column_value : null;
708
-				$this->_set_template_value( $template, $message_template_value );
708
+				$this->_set_template_value($template, $message_template_value);
709 709
 			}
710 710
 		}
711 711
 	}
@@ -720,19 +720,19 @@  discard block
 block discarded – undo
720 720
 	 * @return string
721 721
 	 * @throws \EE_Error
722 722
 	 */
723
-	protected function _get_main_template( $preview = FALSE ) {
723
+	protected function _get_main_template($preview = FALSE) {
724 724
 		$type = $preview ? 'preview' : 'main';
725 725
 
726
-		$wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, $type );
726
+		$wrapper_template = $this->_tmp_pack->get_wrapper($this->name, $type);
727 727
 
728 728
 		//check file exists and is readable
729
-		if ( !is_readable( $wrapper_template ) )
730
-			throw new EE_Error( sprintf( __('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso' ), ucwords($this->label['singular']) , $wrapper_template ) );
729
+		if ( ! is_readable($wrapper_template))
730
+			throw new EE_Error(sprintf(__('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso'), ucwords($this->label['singular']), $wrapper_template));
731 731
 
732 732
 		//add message type to template args
733 733
 		$this->_template_args['message_type'] = $this->_incoming_message_type;
734 734
 
735
-		return EEH_Template::display_template( $wrapper_template, $this->_template_args, TRUE );
735
+		return EEH_Template::display_template($wrapper_template, $this->_template_args, TRUE);
736 736
 	}
737 737
 
738 738
 
@@ -768,9 +768,9 @@  discard block
 block discarded – undo
768 768
 	 */
769 769
 	public function get_existing_test_settings() {
770 770
 		/** @var EE_Message_Resource_Manager $Message_Resource_Manager */
771
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
771
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
772 772
 		$settings = $Message_Resource_Manager->get_active_messengers_option();
773
-		return isset( $settings[ $this->name ]['test_settings'] ) ? $settings[ $this->name ]['test_settings'] : array();
773
+		return isset($settings[$this->name]['test_settings']) ? $settings[$this->name]['test_settings'] : array();
774 774
 	}
775 775
 
776 776
 
@@ -782,12 +782,12 @@  discard block
 block discarded – undo
782 782
 	 * @param $settings
783 783
 	 * @return bool success/fail
784 784
 	 */
785
-	public function set_existing_test_settings( $settings ) {
785
+	public function set_existing_test_settings($settings) {
786 786
 		/** @var EE_Message_Resource_Manager $Message_Resource_Manager */
787
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
787
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
788 788
 		$existing = $Message_Resource_Manager->get_active_messengers_option();
789
-		$existing[ $this->name ]['test_settings'] = $settings;
790
-		return $Message_Resource_Manager->update_active_messengers_option( $existing );
789
+		$existing[$this->name]['test_settings'] = $settings;
790
+		return $Message_Resource_Manager->update_active_messengers_option($existing);
791 791
 	}
792 792
 
793 793
 
@@ -800,21 +800,21 @@  discard block
 block discarded – undo
800 800
 	 * @param string $field The field to retrieve the label for
801 801
 	 * @return string        	  The label
802 802
 	 */
803
-	public function get_field_label( $field ) {
803
+	public function get_field_label($field) {
804 804
 		//first let's see if the field requests is in the top level array.
805
-		if ( isset( $this->_template_fields[$field] ) && !empty( $this->_template_fields[$field]['label'] ) )
805
+		if (isset($this->_template_fields[$field]) && ! empty($this->_template_fields[$field]['label']))
806 806
 			return $this->_template[$field]['label'];
807 807
 
808 808
 		//nope so let's look in the extra array to see if it's there HOWEVER if the field exists as a top level index in the extra array then we know the label is in the 'main' index.
809
-		if ( isset( $this->_template_fields['extra'] ) && !empty( $this->_template_fields['extra'][$field] ) && !empty( $this->_template_fields['extra'][$field]['main']['label'] )  )
809
+		if (isset($this->_template_fields['extra']) && ! empty($this->_template_fields['extra'][$field]) && ! empty($this->_template_fields['extra'][$field]['main']['label']))
810 810
 			return $this->_template_fields['extra'][$field]['main']['label'];
811 811
 
812 812
 		//now it's possible this field may just be existing in any of the extra array items.
813
-		if ( !empty( $this->_template_fields['extra'] ) && is_array( $this->_template_fields['extra'] ) ) {
814
-			foreach ( $this->_template_fields['extra'] as $main_field => $subfields ) {
815
-				if ( !is_array( $subfields ) )
813
+		if ( ! empty($this->_template_fields['extra']) && is_array($this->_template_fields['extra'])) {
814
+			foreach ($this->_template_fields['extra'] as $main_field => $subfields) {
815
+				if ( ! is_array($subfields))
816 816
 					continue;
817
-				if ( isset( $subfields[$field] ) && !empty( $subfields[$field]['label'] ) )
817
+				if (isset($subfields[$field]) && ! empty($subfields[$field]['label']))
818 818
 					return $subfields[$field]['label'];
819 819
 			}
820 820
 		}
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 	 *
836 836
 	 * @return void
837 837
 	 */
838
-	public function do_secondary_messenger_hooks( $sending_messenger_name ) {
838
+	public function do_secondary_messenger_hooks($sending_messenger_name) {
839 839
 		return;
840 840
 	}
841 841
 
Please login to merge, or discard this patch.