Completed
Branch BUG-10375-migrations-not-repor... (1e9646)
by
unknown
62:53 queued 49:42
created
modules/ticket_sales_monitor/EED_Ticket_Sales_Monitor.module.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 * @access    protected
239 239
 	 * @param    \EE_Ticket $ticket
240 240
 	 * @param int           $quantity
241
-	 * @return bool
241
+	 * @return integer
242 242
 	 * @throws \EE_Error
243 243
 	 */
244 244
 	protected function _reserve_ticket( EE_Ticket $ticket, $quantity = 1 ) {
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 * @access protected
258 258
 	 * @param  EE_Ticket $ticket
259 259
 	 * @param  int       $quantity
260
-	 * @return bool
260
+	 * @return integer
261 261
 	 * @throws \EE_Error
262 262
 	 */
263 263
 	protected function _release_reserved_ticket( EE_Ticket $ticket, $quantity = 1 ) {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 *
281 281
 	 * @access 	protected
282 282
 	 * @param 	\EE_Ticket   $ticket
283
-	 * @return 	bool
283
+	 * @return 	boolean|null
284 284
 	 * @throws \EE_Error
285 285
 	 */
286 286
 	protected function _ticket_sold_out( EE_Ticket $ticket ) {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @access    protected
301 301
 	 * @param    \EE_Ticket $ticket
302
-	 * @return bool
302
+	 * @return boolean|null
303 303
 	 */
304 304
 	protected function _ticket_quantity_decremented( EE_Ticket $ticket ) {
305 305
 		if ( self::debug ) {
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -399,13 +399,13 @@  discard block
 block discarded – undo
399 399
 		if ( self::debug ) {
400 400
 			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
401 401
 		}
402
-        $refresh_msg = '';
403
-        $none_added_msg = '';
402
+		$refresh_msg = '';
403
+		$none_added_msg = '';
404 404
 		if (defined('DOING_AJAX') && DOING_AJAX) {
405
-            $refresh_msg = __('Please refresh the page to view updated ticket quantities.',
406
-                'event_espresso');
407
-            $none_added_msg = __('No tickets were added for the event.', 'event_espresso');
408
-        }
405
+			$refresh_msg = __('Please refresh the page to view updated ticket quantities.',
406
+				'event_espresso');
407
+			$none_added_msg = __('No tickets were added for the event.', 'event_espresso');
408
+		}
409 409
 		if ( ! empty( $this->sold_out_tickets ) ) {
410 410
 			EE_Error::add_attention(
411 411
 				sprintf(
@@ -415,16 +415,16 @@  discard block
 block discarded – undo
415 415
 					),
416 416
 					'<br />',
417 417
 					implode( '<br />', $this->sold_out_tickets ),
418
-                    $none_added_msg,
419
-                    $refresh_msg
418
+					$none_added_msg,
419
+					$refresh_msg
420 420
 				)
421 421
 			);
422 422
 			// alter code flow in the Ticket Selector for better UX
423 423
 			add_filter( 'FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', '__return_true' );
424 424
 			add_filter( 'FHEE__EED_Ticket_Selector__process_ticket_selections__success', '__return_false' );
425 425
 			$this->sold_out_tickets = array();
426
-            // and reset the cart
427
-            EED_Ticket_Sales_Monitor::session_cart_reset(EE_Registry::instance()->SSN);
426
+			// and reset the cart
427
+			EED_Ticket_Sales_Monitor::session_cart_reset(EE_Registry::instance()->SSN);
428 428
 		}
429 429
 		if ( ! empty( $this->decremented_tickets ) ) {
430 430
 			EE_Error::add_attention(
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
 					),
436 436
 					'<br />',
437 437
 					implode( '<br />', $this->decremented_tickets ),
438
-                    $none_added_msg,
439
-                    $refresh_msg
438
+					$none_added_msg,
439
+					$refresh_msg
440 440
 				)
441 441
 			);
442 442
 			$this->decremented_tickets = array();
@@ -607,11 +607,11 @@  discard block
 block discarded – undo
607 607
 				}
608 608
 			}
609 609
 		}
610
-        if (self::debug) {
611
-            echo "<br /><br /> RESET COMPLETED ";
612
-        }
610
+		if (self::debug) {
611
+			echo "<br /><br /> RESET COMPLETED ";
612
+		}
613 613
 
614
-    }
614
+	}
615 615
 
616 616
 
617 617
 
Please login to merge, or discard this patch.
Spacing   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  * Class EED_Ticket_Sales_Monitor
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class EED_Ticket_Sales_Monitor extends EED_Module {
19 19
 
20
-	const debug = false; 	//	true false
20
+	const debug = false; //	true false
21 21
 
22 22
 	/**
23 23
 	 * an array of raw ticket data from EED_Ticket_Selector
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public static function set_hooks() {
61 61
 		// check ticket reserves AFTER MER does it's check (hence priority 20)
62
-		add_filter( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty',
63
-			array( 'EED_Ticket_Sales_Monitor', 'validate_ticket_sale' ),
62
+		add_filter('FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty',
63
+			array('EED_Ticket_Sales_Monitor', 'validate_ticket_sale'),
64 64
 			20, 3
65 65
 		);
66 66
 		// add notices for sold out tickets
67
-		add_action( 'AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart',
68
-			array( 'EED_Ticket_Sales_Monitor', 'post_notices' ),
67
+		add_action('AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart',
68
+			array('EED_Ticket_Sales_Monitor', 'post_notices'),
69 69
 			10
70 70
 		);
71 71
 		// handle ticket quantities adjusted in cart
@@ -77,40 +77,40 @@  discard block
 block discarded – undo
77 77
 		// handle tickets deleted from cart
78 78
 		add_action(
79 79
 			'FHEE__EED_Multi_Event_Registration__delete_ticket__ticket_removed_from_cart',
80
-			array( 'EED_Ticket_Sales_Monitor', 'ticket_removed_from_cart' ),
80
+			array('EED_Ticket_Sales_Monitor', 'ticket_removed_from_cart'),
81 81
 			10, 2
82 82
 		);
83 83
 		// handle emptied carts
84 84
 		add_action(
85 85
 			'AHEE__EE_Session__reset_cart__before_reset',
86
-			array( 'EED_Ticket_Sales_Monitor', 'session_cart_reset' ),
86
+			array('EED_Ticket_Sales_Monitor', 'session_cart_reset'),
87 87
 			10, 1
88 88
 		);
89 89
 		add_action(
90 90
 			'AHEE__EED_Multi_Event_Registration__empty_event_cart__before_delete_cart',
91
-			array( 'EED_Ticket_Sales_Monitor', 'session_cart_reset' ),
91
+			array('EED_Ticket_Sales_Monitor', 'session_cart_reset'),
92 92
 			10, 1
93 93
 		);
94 94
 		// handle cancelled registrations
95 95
 		add_action(
96 96
 			'AHEE__EE_Session__reset_checkout__before_reset',
97
-			array( 'EED_Ticket_Sales_Monitor', 'session_checkout_reset' ),
97
+			array('EED_Ticket_Sales_Monitor', 'session_checkout_reset'),
98 98
 			10, 1
99 99
 		);
100 100
 		// cron tasks
101 101
 		add_action(
102 102
 			'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions__abandoned_transaction',
103
-			array( 'EED_Ticket_Sales_Monitor', 'process_abandoned_transactions' ),
103
+			array('EED_Ticket_Sales_Monitor', 'process_abandoned_transactions'),
104 104
 			10, 1
105 105
 		);
106 106
 		add_action(
107 107
 			'AHEE__EE_Cron_Tasks__process_expired_transactions__incomplete_transaction',
108
-			array( 'EED_Ticket_Sales_Monitor', 'process_abandoned_transactions' ),
108
+			array('EED_Ticket_Sales_Monitor', 'process_abandoned_transactions'),
109 109
 			10, 1
110 110
 		);
111 111
 		add_action(
112 112
 			'AHEE__EE_Cron_Tasks__process_expired_transactions__failed_transaction',
113
-			array( 'EED_Ticket_Sales_Monitor', 'process_failed_transactions' ),
113
+			array('EED_Ticket_Sales_Monitor', 'process_failed_transactions'),
114 114
 			10, 1
115 115
 		);
116 116
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * @return EED_Ticket_Sales_Monitor
135 135
 	 */
136 136
 	public static function instance() {
137
-		return parent::get_instance( __CLASS__ );
137
+		return parent::get_instance(__CLASS__);
138 138
 	}
139 139
 
140 140
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @param WP_Query $WP_Query
147 147
 	 * @return    void
148 148
 	 */
149
-	public function run( $WP_Query ) {
149
+	public function run($WP_Query) {
150 150
 	}
151 151
 
152 152
 
@@ -164,14 +164,14 @@  discard block
 block discarded – undo
164 164
 	 * @param \EE_Ticket $ticket
165 165
 	 * @return bool
166 166
 	 */
167
-	public static function validate_ticket_sale( $qty = 1, EE_Ticket $ticket  ) {
168
-		$qty = absint( $qty );
169
-		if ( $qty > 0 ) {
170
-			$qty = EED_Ticket_Sales_Monitor::instance()->_validate_ticket_sale( $ticket, $qty );
167
+	public static function validate_ticket_sale($qty = 1, EE_Ticket $ticket) {
168
+		$qty = absint($qty);
169
+		if ($qty > 0) {
170
+			$qty = EED_Ticket_Sales_Monitor::instance()->_validate_ticket_sale($ticket, $qty);
171 171
 		}
172
-		if ( self::debug ) {
173
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "()";
174
-			echo "<br /><br /><b> RETURNED QTY: " . $qty . '</b>';
172
+		if (self::debug) {
173
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."()";
174
+			echo "<br /><br /><b> RETURNED QTY: ".$qty.'</b>';
175 175
 		}
176 176
 		return $qty;
177 177
 	}
@@ -187,42 +187,42 @@  discard block
 block discarded – undo
187 187
 	 * @param int          $qty
188 188
 	 * @return int
189 189
 	 */
190
-	protected function _validate_ticket_sale( EE_Ticket $ticket, $qty = 1 ) {
191
-		if ( self::debug ) {
192
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
190
+	protected function _validate_ticket_sale(EE_Ticket $ticket, $qty = 1) {
191
+		if (self::debug) {
192
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
193 193
 		}
194
-		if ( ! $ticket instanceof EE_Ticket ) {
194
+		if ( ! $ticket instanceof EE_Ticket) {
195 195
 			return 0;
196 196
 		}
197
-		if ( self::debug ) {
198
-			echo "<br /><b> . ticket->ID: " . $ticket->ID() . '</b>';
199
-			echo "<br /> . original ticket->reserved: " . $ticket->reserved();
197
+		if (self::debug) {
198
+			echo "<br /><b> . ticket->ID: ".$ticket->ID().'</b>';
199
+			echo "<br /> . original ticket->reserved: ".$ticket->reserved();
200 200
 		}
201 201
 		$ticket->refresh_from_db();
202 202
 		// first let's determine the ticket availability based on sales
203
-		$available = $ticket->qty( 'saleable' );
204
-		if ( self::debug ) {
205
-			echo "<br /> . . . ticket->qty: " . $ticket->qty();
206
-			echo "<br /> . . . ticket->sold: " . $ticket->sold();
207
-			echo "<br /> . . . ticket->reserved: " . $ticket->reserved();
208
-			echo "<br /> . . . ticket->qty(saleable): " . $ticket->qty( 'saleable' );
209
-			echo "<br /> . . . available: " . $available;
210
-		}
211
-		if ( $available < 1 ) {
212
-			$this->_ticket_sold_out( $ticket );
203
+		$available = $ticket->qty('saleable');
204
+		if (self::debug) {
205
+			echo "<br /> . . . ticket->qty: ".$ticket->qty();
206
+			echo "<br /> . . . ticket->sold: ".$ticket->sold();
207
+			echo "<br /> . . . ticket->reserved: ".$ticket->reserved();
208
+			echo "<br /> . . . ticket->qty(saleable): ".$ticket->qty('saleable');
209
+			echo "<br /> . . . available: ".$available;
210
+		}
211
+		if ($available < 1) {
212
+			$this->_ticket_sold_out($ticket);
213 213
 			return 0;
214 214
 		}
215
-		if ( self::debug ) {
216
-			echo "<br /> . . . qty: " . $qty;
215
+		if (self::debug) {
216
+			echo "<br /> . . . qty: ".$qty;
217 217
 		}
218
-		if ( $available < $qty ) {
218
+		if ($available < $qty) {
219 219
 			$qty = $available;
220
-			if ( self::debug ) {
221
-				echo "<br /> . . . QTY ADJUSTED: " . $qty;
220
+			if (self::debug) {
221
+				echo "<br /> . . . QTY ADJUSTED: ".$qty;
222 222
 			}
223
-			$this->_ticket_quantity_decremented( $ticket );
223
+			$this->_ticket_quantity_decremented($ticket);
224 224
 		}
225
-		$this->_reserve_ticket( $ticket, $qty );
225
+		$this->_reserve_ticket($ticket, $qty);
226 226
 		return $qty;
227 227
 	}
228 228
 
@@ -238,11 +238,11 @@  discard block
 block discarded – undo
238 238
 	 * @return bool
239 239
 	 * @throws \EE_Error
240 240
 	 */
241
-	protected function _reserve_ticket( EE_Ticket $ticket, $quantity = 1 ) {
242
-		if ( self::debug ) {
243
-			echo "<br /><br /> . . . INCREASE RESERVED: " . $quantity;
241
+	protected function _reserve_ticket(EE_Ticket $ticket, $quantity = 1) {
242
+		if (self::debug) {
243
+			echo "<br /><br /> . . . INCREASE RESERVED: ".$quantity;
244 244
 		}
245
-		$ticket->increase_reserved( $quantity );
245
+		$ticket->increase_reserved($quantity);
246 246
 		return $ticket->save();
247 247
 	}
248 248
 
@@ -257,14 +257,14 @@  discard block
 block discarded – undo
257 257
 	 * @return bool
258 258
 	 * @throws \EE_Error
259 259
 	 */
260
-	protected function _release_reserved_ticket( EE_Ticket $ticket, $quantity = 1 ) {
261
-		if ( self::debug ) {
262
-			echo "<br /> . . . ticket->ID: " . $ticket->ID();
263
-			echo "<br /> . . . ticket->reserved: " . $ticket->reserved();
260
+	protected function _release_reserved_ticket(EE_Ticket $ticket, $quantity = 1) {
261
+		if (self::debug) {
262
+			echo "<br /> . . . ticket->ID: ".$ticket->ID();
263
+			echo "<br /> . . . ticket->reserved: ".$ticket->reserved();
264 264
 		}
265
-		$ticket->decrease_reserved( $quantity );
266
-		if ( self::debug ) {
267
-			echo "<br /> . . . ticket->reserved: " . $ticket->reserved();
265
+		$ticket->decrease_reserved($quantity);
266
+		if (self::debug) {
267
+			echo "<br /> . . . ticket->reserved: ".$ticket->reserved();
268 268
 		}
269 269
 		return $ticket->save() ? 1 : 0;
270 270
 	}
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
 	 * @return 	bool
281 281
 	 * @throws \EE_Error
282 282
 	 */
283
-	protected function _ticket_sold_out( EE_Ticket $ticket ) {
284
-		if ( self::debug ) {
285
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
286
-			echo "<br /> . . ticket->name: " . $this->_get_ticket_and_event_name( $ticket );
283
+	protected function _ticket_sold_out(EE_Ticket $ticket) {
284
+		if (self::debug) {
285
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
286
+			echo "<br /> . . ticket->name: ".$this->_get_ticket_and_event_name($ticket);
287 287
 		}
288
-		$this->sold_out_tickets[] = $this->_get_ticket_and_event_name( $ticket );
288
+		$this->sold_out_tickets[] = $this->_get_ticket_and_event_name($ticket);
289 289
 	}
290 290
 
291 291
 
@@ -298,12 +298,12 @@  discard block
 block discarded – undo
298 298
 	 * @param    \EE_Ticket $ticket
299 299
 	 * @return bool
300 300
 	 */
301
-	protected function _ticket_quantity_decremented( EE_Ticket $ticket ) {
302
-		if ( self::debug ) {
303
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
304
-			echo "<br /> . . ticket->name: " . $this->_get_ticket_and_event_name( $ticket );
301
+	protected function _ticket_quantity_decremented(EE_Ticket $ticket) {
302
+		if (self::debug) {
303
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
304
+			echo "<br /> . . ticket->name: ".$this->_get_ticket_and_event_name($ticket);
305 305
 		}
306
-		$this->decremented_tickets[] = $this->_get_ticket_and_event_name( $ticket );
306
+		$this->decremented_tickets[] = $this->_get_ticket_and_event_name($ticket);
307 307
 	}
308 308
 
309 309
 
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
 	 * @param    \EE_Ticket $ticket
317 317
 	 * @return string
318 318
 	 */
319
-	protected function _get_ticket_and_event_name( EE_Ticket $ticket ) {
319
+	protected function _get_ticket_and_event_name(EE_Ticket $ticket) {
320 320
 		$event = $ticket->get_related_event();
321
-		if ( $event instanceof EE_Event ) {
321
+		if ($event instanceof EE_Event) {
322 322
 			$ticket_name = sprintf(
323
-				_x( '%1$s for %2$s', 'ticket name for event name', 'event_espresso' ),
323
+				_x('%1$s for %2$s', 'ticket name for event name', 'event_espresso'),
324 324
 				$ticket->name(),
325 325
 				$event->name()
326 326
 			);
@@ -345,13 +345,13 @@  discard block
 block discarded – undo
345 345
 	 * @param  int          $quantity
346 346
 	 * @return void
347 347
 	 */
348
-	public static function ticket_quantity_updated( EE_Line_Item $line_item, $quantity = 1 ) {
349
-		$ticket = EEM_Ticket::instance()->get_one_by_ID( absint( $line_item->OBJ_ID() ) );
350
-		if ( $ticket instanceof EE_Ticket ) {
351
-			if ( $quantity > 0 ) {
352
-				EED_Ticket_Sales_Monitor::instance()->_reserve_ticket( $ticket, $quantity );
348
+	public static function ticket_quantity_updated(EE_Line_Item $line_item, $quantity = 1) {
349
+		$ticket = EEM_Ticket::instance()->get_one_by_ID(absint($line_item->OBJ_ID()));
350
+		if ($ticket instanceof EE_Ticket) {
351
+			if ($quantity > 0) {
352
+				EED_Ticket_Sales_Monitor::instance()->_reserve_ticket($ticket, $quantity);
353 353
 			} else {
354
-				EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket( $ticket, $quantity );
354
+				EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket($ticket, $quantity);
355 355
 			}
356 356
 		}
357 357
 	}
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
 	 * @param  int       $quantity
368 368
 	 * @return void
369 369
 	 */
370
-	public static function ticket_removed_from_cart( EE_Ticket $ticket, $quantity = 1 ) {
371
-		EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket( $ticket, $quantity );
370
+	public static function ticket_removed_from_cart(EE_Ticket $ticket, $quantity = 1) {
371
+		EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket($ticket, $quantity);
372 372
 	}
373 373
 
374 374
 
@@ -396,8 +396,8 @@  discard block
 block discarded – undo
396 396
 	 * @return    void
397 397
 	 */
398 398
 	protected function _post_notices() {
399
-		if ( self::debug ) {
400
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
399
+		if (self::debug) {
400
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
401 401
 		}
402 402
         $refresh_msg = '';
403 403
         $none_added_msg = '';
@@ -406,35 +406,35 @@  discard block
 block discarded – undo
406 406
                 'event_espresso');
407 407
             $none_added_msg = __('No tickets were added for the event.', 'event_espresso');
408 408
         }
409
-		if ( ! empty( $this->sold_out_tickets ) ) {
409
+		if ( ! empty($this->sold_out_tickets)) {
410 410
 			EE_Error::add_attention(
411 411
 				sprintf(
412 412
 					apply_filters(
413 413
 						'FHEE__EED_Ticket_Sales_Monitor___post_notices__sold_out_tickets_notice',
414
-						__( 'We\'re sorry...%1$sThe following items have sold out since you first viewed this page, and can no longer be registered for:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%1$s%1$s%3$s%1$s%4$s%1$s', 'event_espresso' )
414
+						__('We\'re sorry...%1$sThe following items have sold out since you first viewed this page, and can no longer be registered for:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%1$s%1$s%3$s%1$s%4$s%1$s', 'event_espresso')
415 415
 					),
416 416
 					'<br />',
417
-					implode( '<br />', $this->sold_out_tickets ),
417
+					implode('<br />', $this->sold_out_tickets),
418 418
                     $none_added_msg,
419 419
                     $refresh_msg
420 420
 				)
421 421
 			);
422 422
 			// alter code flow in the Ticket Selector for better UX
423
-			add_filter( 'FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', '__return_true' );
424
-			add_filter( 'FHEE__EED_Ticket_Selector__process_ticket_selections__success', '__return_false' );
423
+			add_filter('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', '__return_true');
424
+			add_filter('FHEE__EED_Ticket_Selector__process_ticket_selections__success', '__return_false');
425 425
 			$this->sold_out_tickets = array();
426 426
             // and reset the cart
427 427
             EED_Ticket_Sales_Monitor::session_cart_reset(EE_Registry::instance()->SSN);
428 428
 		}
429
-		if ( ! empty( $this->decremented_tickets ) ) {
429
+		if ( ! empty($this->decremented_tickets)) {
430 430
 			EE_Error::add_attention(
431 431
 				sprintf(
432 432
 					apply_filters(
433 433
 						'FHEE__EED_Ticket_Sales_Monitor___ticket_quantity_decremented__notice',
434
-						__( 'We\'re sorry...%1$sDue to sales that have occurred since you first viewed the last page, the following items have had their quantities adjusted to match the current available amount:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%1$s%1$s%3$s%1$s%4$s%1$s', 'event_espresso' )
434
+						__('We\'re sorry...%1$sDue to sales that have occurred since you first viewed the last page, the following items have had their quantities adjusted to match the current available amount:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%1$s%1$s%3$s%1$s%4$s%1$s', 'event_espresso')
435 435
 					),
436 436
 					'<br />',
437
-					implode( '<br />', $this->decremented_tickets ),
437
+					implode('<br />', $this->decremented_tickets),
438 438
                     $none_added_msg,
439 439
                     $refresh_msg
440 440
 				)
@@ -458,27 +458,27 @@  discard block
 block discarded – undo
458 458
 	 * @param 	EE_Transaction 	$transaction
459 459
 	 * @return int
460 460
 	 */
461
-	protected function _release_all_reserved_tickets_for_transaction( EE_Transaction $transaction ) {
462
-		if ( self::debug ) {
463
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
464
-			echo "<br /> . transaction->ID: " . $transaction->ID();
461
+	protected function _release_all_reserved_tickets_for_transaction(EE_Transaction $transaction) {
462
+		if (self::debug) {
463
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
464
+			echo "<br /> . transaction->ID: ".$transaction->ID();
465 465
 		}
466 466
 		/** @type EE_Transaction_Processor $transaction_processor */
467
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
467
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
468 468
 		// check if 'finalize_registration' step has been completed...
469
-		$finalized = $transaction_processor->reg_step_completed( $transaction, 'finalize_registration' );
470
-		if ( self::debug ) {
469
+		$finalized = $transaction_processor->reg_step_completed($transaction, 'finalize_registration');
470
+		if (self::debug) {
471 471
 			// DEBUG LOG
472 472
 			EEH_Debug_Tools::log(
473 473
 				__CLASS__, __FUNCTION__, __LINE__,
474
-				array( 'finalized' => $finalized ),
475
-				false, 'EE_Transaction: ' . $transaction->ID()
474
+				array('finalized' => $finalized),
475
+				false, 'EE_Transaction: '.$transaction->ID()
476 476
 			);
477 477
 		}
478 478
 		// how many tickets were released
479 479
 		$count = 0;
480
-		if ( self::debug ) {
481
-			echo "<br /> . . . finalized: " . $finalized;
480
+		if (self::debug) {
481
+			echo "<br /> . . . finalized: ".$finalized;
482 482
 		}
483 483
 		$release_tickets_with_TXN_status = array(
484 484
 			EEM_Transaction::failed_status_code,
@@ -486,13 +486,13 @@  discard block
 block discarded – undo
486 486
 			EEM_Transaction::incomplete_status_code,
487 487
 		);
488 488
 		// if the session is getting cleared BEFORE the TXN has been finalized
489
-		if ( ! $finalized || in_array( $transaction->status_ID(), $release_tickets_with_TXN_status ) ) {
489
+		if ( ! $finalized || in_array($transaction->status_ID(), $release_tickets_with_TXN_status)) {
490 490
 			// let's cancel any reserved tickets
491 491
 			$registrations = $transaction->registrations();
492
-			if ( ! empty( $registrations ) ) {
493
-				foreach ( $registrations as $registration ) {
494
-					if ( $registration instanceof EE_Registration ) {
495
-						$count += $this->_release_reserved_ticket_for_registration( $registration, $transaction );
492
+			if ( ! empty($registrations)) {
493
+				foreach ($registrations as $registration) {
494
+					if ($registration instanceof EE_Registration) {
495
+						$count += $this->_release_reserved_ticket_for_registration($registration, $transaction);
496 496
 					}
497 497
 				}
498 498
 			}
@@ -513,12 +513,12 @@  discard block
 block discarded – undo
513 513
 	 * @return 	int
514 514
 	 * @throws 	\EE_Error
515 515
 	 */
516
-	protected function _release_reserved_ticket_for_registration( EE_Registration $registration, EE_Transaction $transaction ) {
517
-		if ( self::debug ) {
518
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
519
-			echo "<br /> . . registration->ID: " . $registration->ID();
520
-			echo "<br /> . . registration->status_ID: " . $registration->status_ID();
521
-			echo "<br /> . . transaction->status_ID(): " . $transaction->status_ID();
516
+	protected function _release_reserved_ticket_for_registration(EE_Registration $registration, EE_Transaction $transaction) {
517
+		if (self::debug) {
518
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
519
+			echo "<br /> . . registration->ID: ".$registration->ID();
520
+			echo "<br /> . . registration->status_ID: ".$registration->status_ID();
521
+			echo "<br /> . . transaction->status_ID(): ".$transaction->status_ID();
522 522
 		}
523 523
 		if (
524 524
 			// release Tickets for Failed Transactions and Abandoned Transactions
@@ -531,8 +531,8 @@  discard block
 block discarded – undo
531 531
 			)
532 532
 		) {
533 533
 			$ticket = $registration->ticket();
534
-			if ( $ticket instanceof EE_Ticket ) {
535
-				return $this->_release_reserved_ticket( $ticket );
534
+			if ($ticket instanceof EE_Ticket) {
535
+				return $this->_release_reserved_ticket($ticket);
536 536
 			}
537 537
 		}
538 538
 		return 0;
@@ -552,20 +552,20 @@  discard block
 block discarded – undo
552 552
 	 * @param    EE_Session $session
553 553
 	 * @return    void
554 554
 	 */
555
-	public static function session_cart_reset( EE_Session $session ) {
556
-		if ( self::debug ) {
557
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
555
+	public static function session_cart_reset(EE_Session $session) {
556
+		if (self::debug) {
557
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
558 558
 		}
559 559
 		$cart = $session->cart();
560
-		if ( $cart instanceof EE_Cart ) {
561
-			if ( self::debug ) {
560
+		if ($cart instanceof EE_Cart) {
561
+			if (self::debug) {
562 562
 				echo "<br /><br /> cart instanceof EE_Cart: ";
563 563
 			}
564
-			EED_Ticket_Sales_Monitor::instance()->_session_cart_reset( $cart );
564
+			EED_Ticket_Sales_Monitor::instance()->_session_cart_reset($cart);
565 565
 		} else {
566
-			if ( self::debug ) {
566
+			if (self::debug) {
567 567
 				echo "<br /><br /> invalid EE_Cart: ";
568
-				var_dump( $cart );
568
+				var_dump($cart);
569 569
 			}
570 570
 		}
571 571
 	}
@@ -580,30 +580,30 @@  discard block
 block discarded – undo
580 580
 	 * @param    EE_Cart $cart
581 581
 	 * @return    void
582 582
 	 */
583
-	protected function _session_cart_reset( EE_Cart $cart ) {
584
-		if ( self::debug ) {
585
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
583
+	protected function _session_cart_reset(EE_Cart $cart) {
584
+		if (self::debug) {
585
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
586 586
 		}
587
-		EE_Registry::instance()->load_helper( 'Line_Item' );
587
+		EE_Registry::instance()->load_helper('Line_Item');
588 588
 		$ticket_line_items = $cart->get_tickets();
589
-		if ( empty( $ticket_line_items ) ) {
589
+		if (empty($ticket_line_items)) {
590 590
 			return;
591 591
 		}
592
-		foreach ( $ticket_line_items as $ticket_line_item ) {
593
-			if ( self::debug ) {
594
-				echo "<br /> . ticket_line_item->ID(): " . $ticket_line_item->ID();
592
+		foreach ($ticket_line_items as $ticket_line_item) {
593
+			if (self::debug) {
594
+				echo "<br /> . ticket_line_item->ID(): ".$ticket_line_item->ID();
595 595
 			}
596
-			if ( $ticket_line_item instanceof EE_Line_Item && $ticket_line_item->OBJ_type() == 'Ticket' ) {
597
-				if ( self::debug ) {
598
-					echo "<br /> . . ticket_line_item->OBJ_ID(): " . $ticket_line_item->OBJ_ID();
596
+			if ($ticket_line_item instanceof EE_Line_Item && $ticket_line_item->OBJ_type() == 'Ticket') {
597
+				if (self::debug) {
598
+					echo "<br /> . . ticket_line_item->OBJ_ID(): ".$ticket_line_item->OBJ_ID();
599 599
 				}
600
-				$ticket = EEM_Ticket::instance()->get_one_by_ID( $ticket_line_item->OBJ_ID() );
601
-				if ( $ticket instanceof EE_Ticket ) {
602
-					if ( self::debug ) {
603
-						echo "<br /> . . ticket->ID(): " . $ticket->ID();
604
-						echo "<br /> . . ticket_line_item->quantity(): " . $ticket_line_item->quantity();
600
+				$ticket = EEM_Ticket::instance()->get_one_by_ID($ticket_line_item->OBJ_ID());
601
+				if ($ticket instanceof EE_Ticket) {
602
+					if (self::debug) {
603
+						echo "<br /> . . ticket->ID(): ".$ticket->ID();
604
+						echo "<br /> . . ticket_line_item->quantity(): ".$ticket_line_item->quantity();
605 605
 					}
606
-					$this->_release_reserved_ticket( $ticket, $ticket_line_item->quantity() );
606
+					$this->_release_reserved_ticket($ticket, $ticket_line_item->quantity());
607 607
 				}
608 608
 			}
609 609
 		}
@@ -627,10 +627,10 @@  discard block
 block discarded – undo
627 627
 	 * @param    EE_Session $session
628 628
 	 * @return    void
629 629
 	 */
630
-	public static function session_checkout_reset( EE_Session $session ) {
630
+	public static function session_checkout_reset(EE_Session $session) {
631 631
 		$checkout = $session->checkout();
632
-		if ( $checkout instanceof EE_Checkout ) {
633
-			EED_Ticket_Sales_Monitor::instance()->_session_checkout_reset( $checkout );
632
+		if ($checkout instanceof EE_Checkout) {
633
+			EED_Ticket_Sales_Monitor::instance()->_session_checkout_reset($checkout);
634 634
 		}
635 635
 	}
636 636
 
@@ -644,15 +644,15 @@  discard block
 block discarded – undo
644 644
 	 * @param    EE_Checkout $checkout
645 645
 	 * @return    void
646 646
 	 */
647
-	protected function _session_checkout_reset( EE_Checkout $checkout ) {
648
-		if ( self::debug ) {
649
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
647
+	protected function _session_checkout_reset(EE_Checkout $checkout) {
648
+		if (self::debug) {
649
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
650 650
 		}
651 651
 		// we want to release the each registration's reserved tickets if the session was cleared, but not if this is a revisit
652
-		if ( $checkout->revisit || ! $checkout->transaction instanceof EE_Transaction ) {
652
+		if ($checkout->revisit || ! $checkout->transaction instanceof EE_Transaction) {
653 653
 			return;
654 654
 		}
655
-		$this->_release_all_reserved_tickets_for_transaction( $checkout->transaction );
655
+		$this->_release_all_reserved_tickets_for_transaction($checkout->transaction);
656 656
 	}
657 657
 
658 658
 
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 	 * @param    EE_Session $session
669 669
 	 * @return    void
670 670
 	 */
671
-	public static function session_expired_reset( EE_Session $session ) {
671
+	public static function session_expired_reset(EE_Session $session) {
672 672
 
673 673
 	}
674 674
 
@@ -687,30 +687,30 @@  discard block
 block discarded – undo
687 687
 	 * @param    EE_Transaction $transaction
688 688
 	 * @return    void
689 689
 	 */
690
-	public static function process_abandoned_transactions( EE_Transaction $transaction ) {
690
+	public static function process_abandoned_transactions(EE_Transaction $transaction) {
691 691
 		// is this TXN free or has any money been paid towards this TXN? If so, then leave it alone
692
-		if ( $transaction->is_free() || $transaction->paid() > 0 ) {
693
-			if ( self::debug ) {
692
+		if ($transaction->is_free() || $transaction->paid() > 0) {
693
+			if (self::debug) {
694 694
 				// DEBUG LOG
695 695
 				EEH_Debug_Tools::log(
696 696
 					__CLASS__, __FUNCTION__, __LINE__,
697
-					array( $transaction ),
698
-					false, 'EE_Transaction: ' . $transaction->ID()
697
+					array($transaction),
698
+					false, 'EE_Transaction: '.$transaction->ID()
699 699
 				);
700 700
 			}
701 701
 			return;
702 702
 		}
703 703
 		// have their been any successful payments made ?
704 704
 		$payments = $transaction->payments();
705
-		foreach ( $payments as $payment ) {
706
-			if ( $payment instanceof EE_Payment ) {
707
-				if ( $payment->status() === EEM_Payment::status_id_approved ) {
708
-					if ( self::debug ) {
705
+		foreach ($payments as $payment) {
706
+			if ($payment instanceof EE_Payment) {
707
+				if ($payment->status() === EEM_Payment::status_id_approved) {
708
+					if (self::debug) {
709 709
 						// DEBUG LOG
710 710
 						EEH_Debug_Tools::log(
711 711
 							__CLASS__, __FUNCTION__, __LINE__,
712
-							array( $payment ),
713
-							false, 'EE_Transaction: ' . $transaction->ID()
712
+							array($payment),
713
+							false, 'EE_Transaction: '.$transaction->ID()
714 714
 						);
715 715
 					}
716 716
 					return;
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 			}
719 719
 		}
720 720
 		// since you haven't even attempted to pay for your ticket...
721
-		EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction( $transaction );
721
+		EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction($transaction);
722 722
 	}
723 723
 
724 724
 
@@ -735,9 +735,9 @@  discard block
 block discarded – undo
735 735
 	 * @param    EE_Transaction $transaction
736 736
 	 * @return    void
737 737
 	 */
738
-	public static function process_failed_transactions( EE_Transaction $transaction ) {
738
+	public static function process_failed_transactions(EE_Transaction $transaction) {
739 739
 		// since you haven't even attempted to pay for your ticket...
740
-		EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction( $transaction );
740
+		EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction($transaction);
741 741
 	}
742 742
 
743 743
 
Please login to merge, or discard this patch.
caffeinated/modules/recaptcha/ReCaptcha/RequestMethod.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@
 block discarded – undo
32 32
 interface RequestMethod
33 33
 {
34 34
 
35
-    /**
36
-     * Submit the request with the specified parameters.
37
-     *
38
-     * @param RequestParameters $params Request parameters
39
-     * @return string Body of the reCAPTCHA response
40
-     */
41
-    public function submit(RequestParameters $params);
35
+	/**
36
+	 * Submit the request with the specified parameters.
37
+	 *
38
+	 * @param RequestParameters $params Request parameters
39
+	 * @return string Body of the reCAPTCHA response
40
+	 */
41
+	public function submit(RequestParameters $params);
42 42
 }
Please login to merge, or discard this patch.
admin/extend/messages/espresso_events_Messages_Hooks_Extend.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
 	 *
96 96
 	 * @param  EE_Event $event 	EE event object
97 97
 	 * @param  array    $data   The request data from the form
98
-	 * @return bool     		success or fail
98
+	 * @return integer     		success or fail
99 99
 	 */
100 100
 	public function attach_evt_message_templates( $event, $data ) {
101 101
 		//first we remove all existing relations on the Event for message types.
Please login to merge, or discard this 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.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * espresso_events_Messages_Hooks_Extend
Please login to merge, or discard this patch.
core/db_models/EEM_Message_Template_Group.model.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @param        $messenger
85 85
 	 * @param string $orderby
86 86
 	 * @param string $order
87
-	 * @return array all (including trashed or inactive) message template group objects for the given messenger
87
+	 * @return EE_Base_Class[] all (including trashed or inactive) message template group objects for the given messenger
88 88
 	 */
89 89
 	public function get_all_message_templates_by_messenger($messenger, $orderby = 'GRP_ID', $order = 'ASC' ) {
90 90
 		return $this->get_all_deleted_and_undeleted(
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 	/**
344 344
 	 * This sends things to the validator for the given messenger and message type.
345 345
 	 *
346
-	 * @param  array $fields the incoming fields to check.
346
+	 * @param  string $fields the incoming fields to check.
347 347
 	 *                       Note this array is in the formatted fields from the form fields setup.
348 348
 	 *                       So we need to reformat this into an array of expected field refs by the validator.
349 349
 	 *                       Note also that this is not only the fields for the Message Template Group
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <?php if (!defined('EVENT_ESPRESSO_VERSION') )
2 2
 	exit('NO direct script access allowed');
3 3
 /**
4
- * EEM_Message_Template_Group
5
- *
6
- * @package		Event Espresso
7
- * @subpackage	includes/models/EEM_Message_Template_Group.model.php
8
- * @author		Darren Ethier
9
- *
10
- *
11
- */
4
+	 * EEM_Message_Template_Group
5
+	 *
6
+	 * @package		Event Espresso
7
+	 * @subpackage	includes/models/EEM_Message_Template_Group.model.php
8
+	 * @author		Darren Ethier
9
+	 *
10
+	 *
11
+	 */
12 12
 require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
13 13
 class EEM_Message_Template_Group extends EEM_Soft_Delete_Base {
14 14
 
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION'))
2 2
 	exit('NO direct script access allowed');
3 3
 /**
4 4
  * EEM_Message_Template_Group
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  *
10 10
  *
11 11
  */
12
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
12
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
13 13
 class EEM_Message_Template_Group extends EEM_Soft_Delete_Base {
14 14
 
15 15
 	// private instance of the EEM_Message_Template_Group object
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 
19 19
 
20
-	protected function __construct( $timezone = NULL ) {
20
+	protected function __construct($timezone = NULL) {
21 21
 		$this->singular_item = __('Message Template Group', 'event_espresso');
22 22
 		$this->plural_item = __('Message Template Groups', 'event_espresso');
23 23
 		$this->_tables = array(
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 		$this->_fields = array(
27 27
 			'Message_Template_Group' => array(
28 28
 				'GRP_ID' => new EE_Primary_Key_Int_Field('GRP_ID', __('Message Template Group ID', 'event_espresso')),
29
-				'MTP_name' => new EE_Plain_Text_Field( 'MTP_name', __('The name of the template group', 'event_espresso'), FALSE, '' ),
30
-				'MTP_description' => new EE_Simple_HTML_Field( 'MTP_description', __('A brief description about this template.', 'event_espresso' ), FALSE, '' ),
31
-				'MTP_user_id'=> new EE_WP_User_Field('MTP_user_id', __('Template Creator ID', 'event_espresso'), FALSE, get_current_user_id() ),
32
-				'MTP_messenger'=>new EE_Plain_Text_Field('MTP_messenger', __('Messenger Used for Template', 'event_espresso'), FALSE, 'email' ),
33
-				'MTP_message_type'=>new EE_Plain_Text_Field('MTP_message_type', __('Message Type', 'event_espresso'),false,'registration'),
29
+				'MTP_name' => new EE_Plain_Text_Field('MTP_name', __('The name of the template group', 'event_espresso'), FALSE, ''),
30
+				'MTP_description' => new EE_Simple_HTML_Field('MTP_description', __('A brief description about this template.', 'event_espresso'), FALSE, ''),
31
+				'MTP_user_id'=> new EE_WP_User_Field('MTP_user_id', __('Template Creator ID', 'event_espresso'), FALSE, get_current_user_id()),
32
+				'MTP_messenger'=>new EE_Plain_Text_Field('MTP_messenger', __('Messenger Used for Template', 'event_espresso'), FALSE, 'email'),
33
+				'MTP_message_type'=>new EE_Plain_Text_Field('MTP_message_type', __('Message Type', 'event_espresso'), false, 'registration'),
34 34
 				'MTP_is_global'=>new EE_Boolean_Field('MTP_is_global', __('Flag indicating if Template Group is Global', 'event_espresso'), false, true),
35 35
 				'MTP_is_override'=>new EE_Boolean_Field('MTP_is_override', __('Flag indicating if Template Group overrides any other Templates for the messenger/messagetype combination', 'event_espresso'), false, false),
36 36
 				'MTP_deleted'=>new EE_Trashed_Flag_Field('MTP_deleted', __('Flag indicating whether this has been trashed', 'event_espresso'), false, false),
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 			'Event' => new EE_HABTM_Relation('Event_Message_Template'),
44 44
 			'WP_User' => new EE_Belongs_To_Relation()
45 45
 		);
46
-		foreach( $this->_cap_contexts_to_cap_action_map as $context => $action ){
47
-			$this->_cap_restriction_generators[ $context ] = new EE_Restriction_Generator_Global( 'MTP_is_global');
46
+		foreach ($this->_cap_contexts_to_cap_action_map as $context => $action) {
47
+			$this->_cap_restriction_generators[$context] = new EE_Restriction_Generator_Global('MTP_is_global');
48 48
 		}
49 49
 		$this->_caps_slug = 'messages';
50 50
 
51
-		parent::__construct( $timezone );
51
+		parent::__construct($timezone);
52 52
 	}
53 53
 
54 54
 
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 		$limit = null,
72 72
 		$count = false
73 73
 	) {
74
-		$query_params = array( array('Event.EVT_ID' => $EVT_ID), 'order_by' => array($orderby => $order), 'limit' => $limit );
75
-		return $count ? $this->count_deleted( $query_params, 'GRP_ID', TRUE ) : $this->get_all_deleted( $query_params );
74
+		$query_params = array(array('Event.EVT_ID' => $EVT_ID), 'order_by' => array($orderby => $order), 'limit' => $limit);
75
+		return $count ? $this->count_deleted($query_params, 'GRP_ID', TRUE) : $this->get_all_deleted($query_params);
76 76
 	}
77 77
 
78 78
 
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 	 * @param string $order
87 87
 	 * @return array all (including trashed or inactive) message template group objects for the given messenger
88 88
 	 */
89
-	public function get_all_message_templates_by_messenger($messenger, $orderby = 'GRP_ID', $order = 'ASC' ) {
89
+	public function get_all_message_templates_by_messenger($messenger, $orderby = 'GRP_ID', $order = 'ASC') {
90 90
 		return $this->get_all_deleted_and_undeleted(
91
-			array( array( 'MTP_messenger' => $messenger ), 'order_by' => array( $orderby => $order ) )
91
+			array(array('MTP_messenger' => $messenger), 'order_by' => array($orderby => $order))
92 92
 		);
93 93
 	}
94 94
 
@@ -99,18 +99,18 @@  discard block
 block discarded – undo
99 99
 	 * @param  array  $_where any existing where conditions to append these to.
100 100
 	 * @return array          original where conditions or original with additional filters.
101 101
 	 */
102
-	protected function _maybe_mtp_filters( $_where = array() ) {
102
+	protected function _maybe_mtp_filters($_where = array()) {
103 103
 		//account for messenger or message type filters
104 104
 		if (
105
-			isset( $_REQUEST[ 'ee_messenger_filter_by' ] )
106
-			&& $_REQUEST[ 'ee_messenger_filter_by' ] != 'none_selected'
107
-			&& $_REQUEST[ 'ee_messenger_filter_by' ] != 'all'
105
+			isset($_REQUEST['ee_messenger_filter_by'])
106
+			&& $_REQUEST['ee_messenger_filter_by'] != 'none_selected'
107
+			&& $_REQUEST['ee_messenger_filter_by'] != 'all'
108 108
 		) {
109
-			$_where['MTP_messenger'] =  $_REQUEST['ee_messenger_filter_by'] ;
109
+			$_where['MTP_messenger'] = $_REQUEST['ee_messenger_filter_by'];
110 110
 		}
111 111
 
112 112
 		if (
113
-			isset( $_REQUEST['ee_message_type_filter_by'])
113
+			isset($_REQUEST['ee_message_type_filter_by'])
114 114
 			&& $_REQUEST['ee_message_type_filter_by'] != 'none_selected'
115 115
 		) {
116 116
 			$_where['MTP_message_type'] = $_REQUEST['ee_message_type_filter_by'];
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 		$global = true,
142 142
 		$user_check = false
143 143
 	) {
144
-		$_where = $global ? array('MTP_is_global' => TRUE ) : array('MTP_is_global' => FALSE );
144
+		$_where = $global ? array('MTP_is_global' => TRUE) : array('MTP_is_global' => FALSE);
145 145
 		$_where['MTP_is_active'] = TRUE;
146 146
 		$_where = $this->_maybe_mtp_filters($_where);
147 147
 
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 			$_where['MTP_user_id'] = get_current_user_id();
157 157
 		}
158 158
 
159
-		$query_params = array( $_where, 'order_by' => array($orderby => $order), 'limit' => $limit );
159
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
160 160
 
161
-		return $count ? $this->count($query_params, 'GRP_ID', TRUE ) : $this->get_all($query_params);
161
+		return $count ? $this->count($query_params, 'GRP_ID', TRUE) : $this->get_all($query_params);
162 162
 	}
163 163
 
164 164
 
@@ -173,14 +173,14 @@  discard block
 block discarded – undo
173 173
 	 * @param bool   $count
174 174
 	 * @return mixed array on success, FALSE on fail
175 175
 	 */
176
-	public function get_all_message_templates( $orderby = 'GRP_ID', $order = 'ASC', $limit = null, $count = false ) {
176
+	public function get_all_message_templates($orderby = 'GRP_ID', $order = 'ASC', $limit = null, $count = false) {
177 177
 		$_where = $this->_maybe_mtp_filters();
178 178
 
179
-		$query_params = array( $_where, 'order_by' => array($orderby => $order), 'limit' => $limit );
179
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
180 180
 
181 181
 		$r_templates = $count
182
-			? $this->count_deleted_and_undeleted($query_params, 'GRP_ID', TRUE )
183
-			: $this->get_all_deleted_and_undeleted( $query_params );
182
+			? $this->count_deleted_and_undeleted($query_params, 'GRP_ID', TRUE)
183
+			: $this->get_all_deleted_and_undeleted($query_params);
184 184
 
185 185
 		return $r_templates;
186 186
 	}
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
 	 * @param  array  $query_params same as EEM_Base::get_all()
195 195
 	 * @return  EE_Message_Template_Group[]
196 196
 	 */
197
-	public function get_all_custom_templates_by_event( $EVT_ID, $query_params = array() ) {
198
-		$where = array_merge( $query_params, array( 'Event.EVT_ID' => $EVT_ID ) );
197
+	public function get_all_custom_templates_by_event($EVT_ID, $query_params = array()) {
198
+		$where = array_merge($query_params, array('Event.EVT_ID' => $EVT_ID));
199 199
 		return $this->get_all(
200
-			array( $where )
200
+			array($where)
201 201
 		);
202 202
 	}
203 203
 
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
 		$count = false,
223 223
 		$global = true
224 224
 	) {
225
-		$_where = $global ? array('MTP_is_global' => TRUE ) : array('MTP_is_global' => FALSE );
225
+		$_where = $global ? array('MTP_is_global' => TRUE) : array('MTP_is_global' => FALSE);
226 226
 		$_where['MTP_is_active'] = TRUE;
227 227
 		$_where = $this->_maybe_mtp_filters($_where);
228 228
 
229
-		$query_params = array( $_where, 'order_by' => array($orderby => $order), 'limit' => $limit );
229
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
230 230
 
231
-		return $count ? $this->count_deleted($query_params, 'GRP_ID', TRUE ) : $this->get_all_deleted( $query_params );
231
+		return $count ? $this->count_deleted($query_params, 'GRP_ID', TRUE) : $this->get_all_deleted($query_params);
232 232
 	}
233 233
 
234 234
 
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
 			'MTP_is_active' => $active
265 265
 		);
266 266
 
267
-		$query_params = array( $_where, 'order_by' => array($orderby=>$order), 'limit' => $limit );
267
+		$query_params = array($_where, 'order_by' => array($orderby=>$order), 'limit' => $limit);
268 268
 
269
-		return $count ? $this->count($query_params, 'GRP_ID', TRUE ) : $this->get_all( $query_params );
269
+		return $count ? $this->count($query_params, 'GRP_ID', TRUE) : $this->get_all($query_params);
270 270
 	}
271 271
 
272 272
 
@@ -300,13 +300,13 @@  discard block
 block discarded – undo
300 300
 			'MTP_is_global' => TRUE,
301 301
 		);
302 302
 
303
-		if ( $active != 'all' ) {
303
+		if ($active != 'all') {
304 304
 			$_where['MTP_is_active'] = $active;
305 305
 		}
306 306
 
307
-		$query_params = array( $_where, 'order_by' => array( $orderby => $order ), 'limit' => $limit );
307
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
308 308
 
309
-		return $count ? $this->count( $query_params, 'GRP_ID', TRUE ) : $this->get_all( $query_params );
309
+		return $count ? $this->count($query_params, 'GRP_ID', TRUE) : $this->get_all($query_params);
310 310
 	}
311 311
 
312 312
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	 * @param  array  $query_params same as EEM_Base->get_all()
320 320
 	 * @return EE_Message_Template_Group[]
321 321
 	 */
322
-	public function get_custom_message_template_by_m_and_mt( $messenger, $message_type, $query_params = array() ) {
322
+	public function get_custom_message_template_by_m_and_mt($messenger, $message_type, $query_params = array()) {
323 323
 		return $this->get_all(
324 324
 			array_merge(
325 325
 				$query_params,
@@ -356,14 +356,14 @@  discard block
 block discarded – undo
356 356
 		$assembled_fields = array();
357 357
 
358 358
 		//let's loop through all the fields and set them up in the right format
359
-		foreach ( $fields as $index => $value ) {
359
+		foreach ($fields as $index => $value) {
360 360
 			// first let's figure out if the value['content'] in the current index is an array.
361 361
 			//  If it is then this is special fields that are used in parsing special shortcodes (i.e. 'attendee_list').
362
-			if ( is_array($value['content']) ) {
362
+			if (is_array($value['content'])) {
363 363
 				$assembled_fields[$value['name']] = $value['content']['main'];
364 364
 				//loop through the content and get the other fields.
365
-				foreach ( $value['content'] as $name => $val ) {
366
-					if ( $name == 'main' ) continue;
365
+				foreach ($value['content'] as $name => $val) {
366
+					if ($name == 'main') continue;
367 367
 					$assembled_fields[$name] = $val;
368 368
 				}
369 369
 				continue;
@@ -375,15 +375,15 @@  discard block
 block discarded – undo
375 375
 
376 376
 		// now we've got the assembled_fields.
377 377
 		// We need to setup the string for the appropriate validator class and call that.
378
-		$m_ref = ucwords( str_replace('_',' ', $messenger ) );
379
-		$m_ref = str_replace( ' ', '_', $m_ref );
380
-		$mt_ref = ucwords( str_replace('_', ' ', $message_type ) );
381
-		$mt_ref = str_replace( ' ', '_', $mt_ref );
378
+		$m_ref = ucwords(str_replace('_', ' ', $messenger));
379
+		$m_ref = str_replace(' ', '_', $m_ref);
380
+		$mt_ref = ucwords(str_replace('_', ' ', $message_type));
381
+		$mt_ref = str_replace(' ', '_', $mt_ref);
382 382
 
383
-		$classname = 'EE_Messages_' . $m_ref . '_' . $mt_ref . '_Validator';
383
+		$classname = 'EE_Messages_'.$m_ref.'_'.$mt_ref.'_Validator';
384 384
 
385
-		if ( !class_exists( $classname ) ) {
386
-			$msg[] = __( 'The Validator class was unable to load', 'event_espresso');
385
+		if ( ! class_exists($classname)) {
386
+			$msg[] = __('The Validator class was unable to load', 'event_espresso');
387 387
 			$msg[] = sprintf(
388 388
 				__(
389 389
 					'The class name compiled was %s. Please check and make sure the spelling and case is correct for the class name and that there is an autoloader in place for this class',
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
 				),
392 392
 				$classname
393 393
 			);
394
-			throw new EE_Error( implode( '||', $msg ) );
394
+			throw new EE_Error(implode('||', $msg));
395 395
 		}
396 396
 
397
-		$a = new ReflectionClass( $classname );
398
-		$_VLD = $a->newInstance( $assembled_fields, $context );
397
+		$a = new ReflectionClass($classname);
398
+		$_VLD = $a->newInstance($assembled_fields, $context);
399 399
 		$result = $_VLD->validate();
400 400
 		return $result;
401 401
 	}
@@ -414,18 +414,18 @@  discard block
 block discarded – undo
414 414
 	 *
415 415
 	 * @return int  count of updated records.
416 416
 	 */
417
-	public function deactivate_message_template_groups_for( $messenger_names = array(), $message_type_names = array() ) {
417
+	public function deactivate_message_template_groups_for($messenger_names = array(), $message_type_names = array()) {
418 418
 		$query_args = array();
419
-		if ( empty( $messenger_names ) && empty( $message_type_names ) ) {
419
+		if (empty($messenger_names) && empty($message_type_names)) {
420 420
 			return 0;
421 421
 		}
422
-		if ( ! empty( $messenger_names ) ) {
423
-			$query_args[ 0 ][ 'MTP_messenger' ] = array( 'IN', (array) $messenger_names );
422
+		if ( ! empty($messenger_names)) {
423
+			$query_args[0]['MTP_messenger'] = array('IN', (array) $messenger_names);
424 424
 		}
425
-		if ( ! empty( $message_type_names ) ) {
426
-			$query_args[ 0 ][ 'MTP_message_type' ] = array( 'IN', (array) $message_type_names );
425
+		if ( ! empty($message_type_names)) {
426
+			$query_args[0]['MTP_message_type'] = array('IN', (array) $message_type_names);
427 427
 		}
428
-		return $this->update( array( 'MTP_is_active' => false ), $query_args );
428
+		return $this->update(array('MTP_is_active' => false), $query_args);
429 429
 	}
430 430
 
431 431
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,6 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if (!defined('EVENT_ESPRESSO_VERSION') ) {
2 2
 	exit('NO direct script access allowed');
3
+}
3 4
 /**
4 5
  * EEM_Message_Template_Group
5 6
  *
@@ -363,7 +364,9 @@  discard block
 block discarded – undo
363 364
 				$assembled_fields[$value['name']] = $value['content']['main'];
364 365
 				//loop through the content and get the other fields.
365 366
 				foreach ( $value['content'] as $name => $val ) {
366
-					if ( $name == 'main' ) continue;
367
+					if ( $name == 'main' ) {
368
+						continue;
369
+					}
367 370
 					$assembled_fields[$name] = $val;
368 371
 				}
369 372
 				continue;
Please login to merge, or discard this patch.
shortcodes/espresso_checkout/EES_Espresso_Checkout.shortcode.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
 	 * @param WP $WP
52 52
 	 * @return    void
53 53
 	 */
54
-	public function run( WP $WP ) {
55
-		if ( did_action( 'pre_get_posts' ) && did_action( 'send_headers' ) ) {
54
+	public function run(WP $WP) {
55
+		if (did_action('pre_get_posts') && did_action('send_headers')) {
56 56
 			global $wp_query;
57 57
 			EED_Single_Page_Checkout::load_reg_steps();
58
-			EED_Single_Page_Checkout::init( $wp_query );
58
+			EED_Single_Page_Checkout::init($wp_query);
59 59
 		} else {
60 60
 			// hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called
61
-			add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 );
61
+			add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1);
62 62
 			// this will trigger the EED_Single_Page_Checkout module's run() method during the pre_get_posts hook point,
63 63
 			// this allows us to initialize things, enqueue assets, etc,
64
-			add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'init' ), 10, 1 );
64
+			add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'init'), 10, 1);
65 65
 		}
66 66
 	}
67 67
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 *  @param		array 	$attributes
75 75
 	 *  @return 	string
76 76
 	 */
77
-	public function process_shortcode( $attributes = array() ) {
77
+	public function process_shortcode($attributes = array()) {
78 78
 		return EE_Registry::instance()->REQ->get_output();
79 79
 	}
80 80
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/db_classes/EE_Soft_Delete_Base_Class.class.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -43,23 +43,23 @@  discard block
 block discarded – undo
43 43
 	 * @param bool $delete true=>delete, false=>restore
44 44
 	 * @return bool|int
45 45
 	 */
46
-	public function delete_or_restore( $delete = true ) {
46
+	public function delete_or_restore($delete = true) {
47 47
 		/**
48 48
 		 * Called just before trashing (soft delete) or restoring a trashed item.
49 49
 		 *
50 50
 		 * @param EE_Base_Class $model_object about to be trashed or restored
51 51
 		 * @param bool          $delete       true the item is being trashed, false the item is being restored.
52 52
 		 */
53
-		do_action( 'AHEE__EE_Soft_Delete_Base_Class__delete_or_restore__before', $this, $delete );
53
+		do_action('AHEE__EE_Soft_Delete_Base_Class__delete_or_restore__before', $this, $delete);
54 54
 		$model = $this->get_model();
55
-		$result = $model->delete_or_restore_by_ID( $delete, $this->ID() );
55
+		$result = $model->delete_or_restore_by_ID($delete, $this->ID());
56 56
 		/**
57 57
 		 * Called just after trashing (soft delete) or restoring a trashed item.
58 58
 		 * @param EE_Base_Class $model_object that was just trashed or restored.
59 59
 		 * @param bool          $delete       true the item is being trashed, false the item is being restored.
60 60
 		 * @param bool|int $result
61 61
 		 */
62
-		do_action( 'AHEE__EE_Soft_Delete_Base_Class__delete_or_restore__after', $this, $delete, $result );
62
+		do_action('AHEE__EE_Soft_Delete_Base_Class__delete_or_restore__after', $this, $delete, $result);
63 63
 		return $result;
64 64
 	}
65 65
 
@@ -70,6 +70,6 @@  discard block
 block discarded – undo
70 70
 	 * @return bool|int
71 71
 	 */
72 72
 	public function restore() {
73
-		return $this->delete_or_restore( false );
73
+		return $this->delete_or_restore(false);
74 74
 	}
75 75
 }
76 76
\ No newline at end of file
Please login to merge, or discard this patch.
registrations/form_sections/EE_Registration_Custom_Questions_Form.form.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@
 block discarded – undo
128 128
 			if( $subsection->form_data_present_in( $req_data ) ) {
129 129
 				try{
130 130
 					$subsection->_normalize($req_data);
131
-				}catch( EE_Validation_Error $e ){
131
+				} catch( EE_Validation_Error $e ){
132 132
 					$subsection->add_validation_error( $e );
133 133
 				}
134 134
 			}
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  * @since		 	   4.8.30.rc.009
14 14
  *
15 15
  */
16
-if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
17
-	exit( 'No direct script access allowed' );
16
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
17
+	exit('No direct script access allowed');
18 18
 }
19 19
 
20
-class EE_Registration_Custom_Questions_Form extends EE_Form_Section_Proper{
20
+class EE_Registration_Custom_Questions_Form extends EE_Form_Section_Proper {
21 21
 	/**
22 22
 	 *
23 23
 	 * @var EE_Registration
@@ -29,16 +29,16 @@  discard block
 block discarded – undo
29 29
 	 * @param EE_Registration $reg
30 30
 	 * @param array $options
31 31
 	 */
32
-	public function __construct( EE_Registration $reg, $options = array() ) {
32
+	public function __construct(EE_Registration $reg, $options = array()) {
33 33
 		$this->_registration = $reg;
34
-		if( ! isset( $options[ 'layout_strategy' ] ) ) {
35
-			$options[ 'layout_strategy' ] = new EE_Admin_Two_Column_Layout();
34
+		if ( ! isset($options['layout_strategy'])) {
35
+			$options['layout_strategy'] = new EE_Admin_Two_Column_Layout();
36 36
 		}
37
-		if( ! isset( $options[ 'html_id' ] ) ) {
38
-			$options[ 'html_id' ] = 'reg-admin-attendee-questions-frm';
37
+		if ( ! isset($options['html_id'])) {
38
+			$options['html_id'] = 'reg-admin-attendee-questions-frm';
39 39
 		}
40 40
 		$this->build_form_from_registration();
41
-		parent::__construct( $options );
41
+		parent::__construct($options);
42 42
 	}
43 43
 
44 44
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 
53 53
 	public function build_form_from_registration() {
54 54
 		$reg = $this->get_registration();
55
-		if( ! $reg instanceof EE_Registration ) {
56
-			throw new EE_Error( __( 'We cannot build the registration custom questions form because there is no registration set on it yet', 'event_espresso') );
55
+		if ( ! $reg instanceof EE_Registration) {
56
+			throw new EE_Error(__('We cannot build the registration custom questions form because there is no registration set on it yet', 'event_espresso'));
57 57
 		}
58 58
 		//we want to get all their question groups
59 59
 		$question_groups = EEM_Question_Group::instance()->get_all(
@@ -63,16 +63,16 @@  discard block
 block discarded – undo
63 63
 					'Event_Question_Group.EQG_primary' => $reg->count() == 1 ? TRUE : FALSE,
64 64
 					'OR' => array(
65 65
 						'Question.QST_system*blank' =>  '',
66
-						'Question.QST_system*null' => array( 'IS_NULL' ) 
66
+						'Question.QST_system*null' => array('IS_NULL') 
67 67
 					)
68 68
 				),
69
-				'order_by' => array( 'QSG_order' => 'ASC' )
69
+				'order_by' => array('QSG_order' => 'ASC')
70 70
 			)
71 71
 		);
72 72
 		//get each question groups questions
73
-		foreach( $question_groups as $question_group ) {
74
-			if ( $question_group instanceof EE_Question_Group ) {
75
-				$this->_subsections[ $question_group->ID() ] = $this->build_subform_from_question_group(
73
+		foreach ($question_groups as $question_group) {
74
+			if ($question_group instanceof EE_Question_Group) {
75
+				$this->_subsections[$question_group->ID()] = $this->build_subform_from_question_group(
76 76
 					$question_group,
77 77
 					$reg
78 78
 				);
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
 	 * @return \EE_Form_Section_Proper
90 90
 	 * @throws \EE_Error
91 91
 	 */
92
-	public function build_subform_from_question_group( $question_group, $registration ) {
93
-		if( ! $question_group instanceof EE_Question_Group ||
92
+	public function build_subform_from_question_group($question_group, $registration) {
93
+		if ( ! $question_group instanceof EE_Question_Group ||
94 94
 			! $registration instanceof EE_Registration) {
95
-			throw new EE_Error( __( 'A valid question group and registration must be passed to EE_Registration_Custom_Question_Form', 'event_espresso' ) );
95
+			throw new EE_Error(__('A valid question group and registration must be passed to EE_Registration_Custom_Question_Form', 'event_espresso'));
96 96
 		}
97 97
 		$parts_of_subsection = array(
98 98
 			'title' => new EE_Form_Section_HTML(
99
-					EEH_HTML::h5( $question_group->name(),
99
+					EEH_HTML::h5($question_group->name(),
100 100
 					$question_group->identifier(),
101
-					'espresso-question-group-title-h5 section-title' )
101
+					'espresso-question-group-title-h5 section-title')
102 102
 				)
103 103
 		);
104 104
 		$questions = $question_group->questions( 
@@ -106,17 +106,17 @@  discard block
 block discarded – undo
106 106
 				array( 
107 107
 					'OR' => array(
108 108
 						'QST_system*blank' => '',
109
-						'QST_system*null' => array( 'IS_NULL' )
109
+						'QST_system*null' => array('IS_NULL')
110 110
 					)
111 111
 				)
112 112
 			)
113 113
 		);
114
-		foreach( $questions as $question ) {
115
-			$parts_of_subsection[ $question->ID() ] = $question->generate_form_input( $registration );
114
+		foreach ($questions as $question) {
115
+			$parts_of_subsection[$question->ID()] = $question->generate_form_input($registration);
116 116
 		}
117
-		$parts_of_subsection[ 'edit_link' ] = new EE_Form_Section_HTML(
118
-				'<tr><th/><td class="reg-admin-edit-attendee-question-td"><a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
119
-					<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
117
+		$parts_of_subsection['edit_link'] = new EE_Form_Section_HTML(
118
+				'<tr><th/><td class="reg-admin-edit-attendee-question-td"><a class="reg-admin-edit-attendee-question-lnk" href="#" title="'.esc_attr__('click to edit question', 'event_espresso').'">
119
+					<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
120 120
 					<div class="dashicons dashicons-edit"></div>
121 121
 				</a></td></tr>'
122 122
 			);
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
 	protected function _normalize($req_data) {
137 137
 		$this->_received_submission = TRUE;
138 138
 		$this->_validation_errors = array();
139
-		foreach($this->get_validatable_subsections() as $subsection){
140
-			if( $subsection->form_data_present_in( $req_data ) ) {
141
-				try{
139
+		foreach ($this->get_validatable_subsections() as $subsection) {
140
+			if ($subsection->form_data_present_in($req_data)) {
141
+				try {
142 142
 					$subsection->_normalize($req_data);
143
-				}catch( EE_Validation_Error $e ){
144
-					$subsection->add_validation_error( $e );
143
+				} catch (EE_Validation_Error $e) {
144
+					$subsection->add_validation_error($e);
145 145
 				}
146 146
 			}
147 147
 		}
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
 	 * calling parent::_validate() first.
157 157
 	 */
158 158
 	protected function _validate() {
159
-		foreach($this->get_validatable_subsections() as $subsection_name => $subsection){
160
-			if( $subsection->form_data_present_in( array_merge( $_GET, $_POST ) ) ) {
161
-				if(method_exists($this,'_validate_'.$subsection_name)){
162
-					call_user_func_array(array($this,'_validate_'.$subsection_name), array($subsection));
159
+		foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) {
160
+			if ($subsection->form_data_present_in(array_merge($_GET, $_POST))) {
161
+				if (method_exists($this, '_validate_'.$subsection_name)) {
162
+					call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection));
163 163
 				}
164 164
 				$subsection->_validate();
165
-			} elseif( $subsection instanceof EE_Form_Section_Proper ) {
165
+			} elseif ($subsection instanceof EE_Form_Section_Proper) {
166 166
 				$subsection->_received_submission = true;
167 167
 			}
168 168
 		}
Please login to merge, or discard this patch.
core/admin/templates/admin_wrapper.template.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <div class="wrap espresso-admin">
2 2
 
3
-	<h1><?php esc_attr_e( 'Event Espresso', 'event_espresso' ); ?>&nbsp;-&nbsp;<?php echo $admin_page_title; ?></h1>
3
+	<h1><?php esc_attr_e('Event Espresso', 'event_espresso'); ?>&nbsp;-&nbsp;<?php echo $admin_page_title; ?></h1>
4 4
 
5 5
 	<div id="ajax-notices-container"></div>
6 6
 
7 7
 	<?php echo $nav_tabs; ?>
8 8
 
9 9
 	<?php
10
-	do_action( 'AHEE__admin_wrapper__template__before_admin_page_content' );
10
+	do_action('AHEE__admin_wrapper__template__before_admin_page_content');
11 11
 	echo $before_admin_page_content;
12 12
 	echo $admin_page_content;
13 13
 	echo $after_admin_page_content;
14
-	do_action( 'AHEE__admin_wrapper__template__after_admin_page_content' );
14
+	do_action('AHEE__admin_wrapper__template__after_admin_page_content');
15 15
 	?>
16 16
 
17 17
 </div>
Please login to merge, or discard this patch.
core/admin/templates/admin_wrapper_ajax.template.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <div class="wrap espresso-admin">
2
-	<h1><?php esc_attr_e( 'Event Espresso', 'event_espresso' ); ?>&nbsp;-&nbsp;<?php echo $admin_page_title; ?></h1>
2
+	<h1><?php esc_attr_e('Event Espresso', 'event_espresso'); ?>&nbsp;-&nbsp;<?php echo $admin_page_title; ?></h1>
3 3
 
4
-	<div class="ee-notices"><?php echo isset( $ajax_notices ) ? $ajax_notices : ''; ?></div>
4
+	<div class="ee-notices"><?php echo isset($ajax_notices) ? $ajax_notices : ''; ?></div>
5 5
 	<?php
6
-	do_action( 'AHEE__admin_wrapper__template__before_admin_page_content' );
6
+	do_action('AHEE__admin_wrapper__template__before_admin_page_content');
7 7
 	echo $before_admin_page_content;
8 8
 	echo $admin_page_content;
9 9
 	echo $after_admin_page_content;
10
-	do_action( 'AHEE__admin_wrapper__template__after_admin_page_content' );
10
+	do_action('AHEE__admin_wrapper__template__after_admin_page_content');
11 11
 	?>
12 12
 </div>
13 13
 <!-- espresso-admin -->
14 14
\ No newline at end of file
Please login to merge, or discard this patch.