Completed
Branch FET-9593-collection-loader-man... (8bd595)
by
unknown
328:26 queued 314:10
created
core/libraries/line_item_filters/EE_Line_Item_Filter_Base.class.php 1 patch
Spacing   +3 added lines, -3 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 EE_Line_Item_Filter_Base
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * @param \EEI_Line_Item $line_item
25 25
 	 * @return \EEI_Line_Item
26 26
 	 */
27
-	public function process( EEI_Line_Item $line_item ) {
27
+	public function process(EEI_Line_Item $line_item) {
28 28
 		return $line_item;
29 29
 	}
30 30
 
Please login to merge, or discard this patch.
core/libraries/messages/EE_Messages_Generator.lib.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -464,8 +464,8 @@  discard block
 block discarded – undo
464 464
 		//if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because that means this
465 465
 		//context is turned off) EXCEPT if we're previewing
466 466
 		if ( empty( $templates['to'][ $context ] )
467
-		     && ! $this->_generation_queue->get_queue()->is_preview()
468
-		     && ! $this->_current_messenger->allow_empty_to_field() ) {
467
+			 && ! $this->_generation_queue->get_queue()->is_preview()
468
+			 && ! $this->_current_messenger->allow_empty_to_field() ) {
469 469
 			//we silently exit here and do NOT record a fail because the message is "turned off" by having no "to" field.
470 470
 			return false;
471 471
 		}
@@ -583,9 +583,9 @@  discard block
 block discarded – undo
583 583
 		 * Check if there is any generation data, but only if this is not for a preview.
584 584
 		 */
585 585
 		if ( ! $this->_generation_queue->get_queue()->get_generation_data()
586
-		     && (
587
-			     ! $this->_generation_queue->get_queue()->is_preview()
588
-			     && $this->_generation_queue->get_queue()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' )
586
+			 && (
587
+				 ! $this->_generation_queue->get_queue()->is_preview()
588
+				 && $this->_generation_queue->get_queue()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' )
589 589
 		) {
590 590
 			$this->_error_msg[] = __( 'There is no generation data for this message. Unable to generate.' );
591 591
 		}
Please login to merge, or discard this patch.
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); }
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 
3 3
 /**
4 4
  * This class is used for generating EE_Message objects with given info.
@@ -116,17 +116,17 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @return EE_Messages_Queue  The new queue for holding generated EE_Message objects.
118 118
 	 */
119
-	public function generate( $save = true ) {
119
+	public function generate($save = true) {
120 120
 		//iterate through the messages in the queue, generate, and add to new queue.
121 121
 		$this->_generation_queue->get_queue()->rewind();
122
-		while ( $this->_generation_queue->get_queue()->valid() ) {
122
+		while ($this->_generation_queue->get_queue()->valid()) {
123 123
 			//reset "current" properties
124 124
 			$this->_reset_current_properties();
125 125
 
126 126
 			/** @type EE_Message $msg */
127 127
 			$msg = $this->_generation_queue->get_queue()->current();
128 128
 
129
-			if ( $this->_verify() ) {
129
+			if ($this->_verify()) {
130 130
 				//let's get generating!
131 131
 				$this->_generate();
132 132
 			}
@@ -138,26 +138,26 @@  discard block
 block discarded – undo
138 138
 			$this->_generation_queue->get_queue()->next();
139 139
 			$next_msg = $this->_generation_queue->get_queue()->current();
140 140
 			//restore pointer to current item
141
-			$this->_generation_queue->get_queue()->set_current( $msg );
141
+			$this->_generation_queue->get_queue()->set_current($msg);
142 142
 
143 143
 			//if there are error messages then let's set the status and the error message.
144
-			if ( $this->_error_msg ) {
144
+			if ($this->_error_msg) {
145 145
 				//if the status is already debug only, then let's leave it at that.
146
-				if ( $msg->STS_ID() !== EEM_Message::status_debug_only ) {
147
-					$msg->set_STS_ID( EEM_Message::status_failed );
146
+				if ($msg->STS_ID() !== EEM_Message::status_debug_only) {
147
+					$msg->set_STS_ID(EEM_Message::status_failed);
148 148
 				}
149 149
 				$msg->set_error_message(
150
-					__( 'Message failed to generate for the following reasons: ' )
150
+					__('Message failed to generate for the following reasons: ')
151 151
 					. "\n"
152
-					. implode( "\n", $this->_error_msg )
152
+					. implode("\n", $this->_error_msg)
153 153
 				);
154
-				$msg->set_modified( time() );
154
+				$msg->set_modified(time());
155 155
 			} else {
156 156
 				//remove from db
157 157
 				$this->_generation_queue->get_queue()->delete();
158 158
 			}
159 159
 			//next item
160
-			$this->_generation_queue->get_queue()->set_current( $next_msg );
160
+			$this->_generation_queue->get_queue()->set_current($next_msg);
161 161
 		}
162 162
 
163 163
 		//generation queue is ALWAYS saved to record any errors in the generation process.
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		 * so a EE_Extra_Meta entry could be created and attached to the EE_Message.  In those cases the save flag is
171 171
 		 * irrelevant.
172 172
 		 */
173
-		if ( $save ) {
173
+		if ($save) {
174 174
 			$this->_ready_queue->save();
175 175
 		}
176 176
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	protected function _reset_current_properties() {
189 189
 		$this->_verified = false;
190 190
 		//make sure any _data value in the current message type is reset
191
-		if ( $this->_current_message_type instanceof EE_message_type ) {
191
+		if ($this->_current_message_type instanceof EE_message_type) {
192 192
 			$this->_current_message_type->reset_data();
193 193
 		}
194 194
 		$this->_current_messenger = $this->_current_message_type = $this->_current_data_handler = null;
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	protected function _generate() {
209 209
 		//double check verification has run and that everything is ready to work with (saves us having to validate everything again).
210
-		if ( ! $this->_verified ) {
210
+		if ( ! $this->_verified) {
211 211
 			return false; //get out because we don't have a valid setup to work with.
212 212
 		}
213 213
 
@@ -217,34 +217,34 @@  discard block
 block discarded – undo
217 217
 				$this->_current_data_handler,
218 218
 				$this->_generation_queue->get_queue()->current()->context()
219 219
 			);
220
-		} catch ( EE_Error $e ) {
220
+		} catch (EE_Error $e) {
221 221
 			$this->_error_msg[] = $e->getMessage();
222 222
 			return false;
223 223
 		}
224 224
 
225 225
 
226 226
 		//if no addressees then get out because there is nothing to generation (possible bad data).
227
-		if ( ! $this->_valid_addressees( $addressees ) ) {
228
-			$this->_generation_queue->get_queue()->current()->set_STS_ID( EEM_Message::status_debug_only );
229
-			$this->_error_msg[] = __( 'This is not a critical error but an informational notice. Unable to generate messages EE_Messages_Addressee objects.  There were no attendees prepared by the data handler.
230
-			  Sometimes this is because messages only get generated for certain registration statuses. For example, the ticket notice message type only goes to approved registrations.', 'event_espresso' );
227
+		if ( ! $this->_valid_addressees($addressees)) {
228
+			$this->_generation_queue->get_queue()->current()->set_STS_ID(EEM_Message::status_debug_only);
229
+			$this->_error_msg[] = __('This is not a critical error but an informational notice. Unable to generate messages EE_Messages_Addressee objects.  There were no attendees prepared by the data handler.
230
+			  Sometimes this is because messages only get generated for certain registration statuses. For example, the ticket notice message type only goes to approved registrations.', 'event_espresso');
231 231
 			return false;
232 232
 		}
233 233
 
234 234
 		$message_template_group = $this->_get_message_template_group();
235 235
 
236 236
 		//in the unlikely event there is no EE_Message_Template_Group available, get out!
237
-		if ( ! $message_template_group instanceof EE_Message_Template_Group ) {
238
-			$this->_error_msg[] = __( 'Unable to get the Message Templates for the Message being generated.  No message template group accessible.', 'event_espresso' );
237
+		if ( ! $message_template_group instanceof EE_Message_Template_Group) {
238
+			$this->_error_msg[] = __('Unable to get the Message Templates for the Message being generated.  No message template group accessible.', 'event_espresso');
239 239
 			return false;
240 240
 		}
241 241
 
242 242
 		//get formatted templates for using to parse and setup EE_Message objects.
243
-		$templates = $this->_get_templates( $message_template_group );
243
+		$templates = $this->_get_templates($message_template_group);
244 244
 
245 245
 
246 246
 		//setup new EE_Message objects (and add to _ready_queue)
247
-		return $this->_assemble_messages( $addressees, $templates, $message_template_group );
247
+		return $this->_assemble_messages($addressees, $templates, $message_template_group);
248 248
 	}
249 249
 
250 250
 
@@ -262,17 +262,17 @@  discard block
 block discarded – undo
262 262
 		//so let's use that.
263 263
 		$GRP_ID = $this->_generation_queue->get_queue()->current()->GRP_ID();
264 264
 
265
-		if ( $GRP_ID ) {
265
+		if ($GRP_ID) {
266 266
 			//attempt to retrieve from repo first
267
-			$GRP = $this->_template_collection->get_by_ID( $GRP_ID );
268
-			if ( $GRP instanceof EE_Message_Template_Group ) {
269
-				return $GRP;  //got it!
267
+			$GRP = $this->_template_collection->get_by_ID($GRP_ID);
268
+			if ($GRP instanceof EE_Message_Template_Group) {
269
+				return $GRP; //got it!
270 270
 			}
271 271
 
272 272
 			//nope don't have it yet.  Get from DB then add to repo
273
-			$GRP = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
274
-			if ( $GRP instanceof EE_Message_Template_Group ) {
275
-				$this->_template_collection->add( $GRP );
273
+			$GRP = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
274
+			if ($GRP instanceof EE_Message_Template_Group) {
275
+				$this->_template_collection->add($GRP);
276 276
 			}
277 277
 			return $GRP;
278 278
 		}
@@ -291,41 +291,41 @@  discard block
 block discarded – undo
291 291
 		//in vanilla EE we're assuming there's only one event.
292 292
 		//However, if there are multiple events then we'll just use the default templates instead of different
293 293
 		// templates per event (which could create problems).
294
-		if ( count( $this->_current_data_handler->events ) === 1 ) {
295
-			foreach ( $this->_current_data_handler->events as $event ) {
294
+		if (count($this->_current_data_handler->events) === 1) {
295
+			foreach ($this->_current_data_handler->events as $event) {
296 296
 				$EVT_ID = $event['ID'];
297 297
 			}
298 298
 		}
299 299
 
300 300
 		//before going any further, let's see if its in the queue
301
-		$GRP = $this->_template_collection->get_by_key( $this->_template_collection->get_key( $this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID ) );
301
+		$GRP = $this->_template_collection->get_by_key($this->_template_collection->get_key($this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID));
302 302
 
303
-		if ( $GRP instanceof EE_Message_Template_Group ) {
303
+		if ($GRP instanceof EE_Message_Template_Group) {
304 304
 			return $GRP;
305 305
 		}
306 306
 
307 307
 		//nope still no GRP?
308 308
 		//first we get the global template in case it has an override set.
309
-		$global_template_qa = array_merge( array( 'MTP_is_global' => true ), $template_qa );
310
-		$global_GRP = EEM_Message_Template_Group::instance()->get_one( array( $global_template_qa ) );
309
+		$global_template_qa = array_merge(array('MTP_is_global' => true), $template_qa);
310
+		$global_GRP = EEM_Message_Template_Group::instance()->get_one(array($global_template_qa));
311 311
 
312 312
 		//if this is an override, then we just return it.
313
-		if ( $global_GRP instanceof EE_Message_Template_Group && $global_GRP->get( 'MTP_is_override' ) ) {
314
-			$this->_template_collection->add( $global_GRP, $EVT_ID );
313
+		if ($global_GRP instanceof EE_Message_Template_Group && $global_GRP->get('MTP_is_override')) {
314
+			$this->_template_collection->add($global_GRP, $EVT_ID);
315 315
 			return $global_GRP;
316 316
 		}
317 317
 
318 318
 		//STILL here? Okay that means we want to see if there is event specific group and if there is we return it,
319 319
 		//otherwise we return the global group we retrieved.
320
-		if ( $EVT_ID ) {
320
+		if ($EVT_ID) {
321 321
 			$template_qa['Event.EVT_ID'] = $EVT_ID;
322 322
 		}
323 323
 
324
-		$GRP = EEM_Message_Template_Group::instance()->get_one( array( $template_qa ) );
324
+		$GRP = EEM_Message_Template_Group::instance()->get_one(array($template_qa));
325 325
 		$GRP = $GRP instanceof EE_Message_Template_Group ? $GRP : $global_GRP;
326 326
 
327
-		if ( $GRP instanceof EE_Message_Template_Group ) {
328
-			$this->_template_collection->add( $GRP, $EVT_ID );
327
+		if ($GRP instanceof EE_Message_Template_Group) {
328
+			$this->_template_collection->add($GRP, $EVT_ID);
329 329
 			return $GRP;
330 330
 		}
331 331
 
@@ -349,15 +349,15 @@  discard block
 block discarded – undo
349 349
 	 *                      )
350 350
 	 *                  )
351 351
 	 */
352
-	protected function _get_templates( EE_Message_Template_Group $message_template_group ) {
352
+	protected function _get_templates(EE_Message_Template_Group $message_template_group) {
353 353
 		$templates = array();
354 354
 		$context_templates = $message_template_group->context_templates();
355
-		foreach ( $context_templates as $context => $template_fields ) {
356
-			foreach ( $template_fields as $template_field => $template_obj ) {
357
-				if ( ! $template_obj instanceof EE_Message_Template ) {
355
+		foreach ($context_templates as $context => $template_fields) {
356
+			foreach ($template_fields as $template_field => $template_obj) {
357
+				if ( ! $template_obj instanceof EE_Message_Template) {
358 358
 					continue;
359 359
 				}
360
-				$templates[ $template_field ][ $context ] = $template_obj->get( 'MTP_content' );
360
+				$templates[$template_field][$context] = $template_obj->get('MTP_content');
361 361
 			}
362 362
 		}
363 363
 		return $templates;
@@ -379,20 +379,20 @@  discard block
 block discarded – undo
379 379
 	 *                get added to the queue with EEM_Message::status_idle, unsuccessfully generated messages will get added
380 380
 	 *                to the queue as EEM_Message::status_failed.  Very rarely should "false" be returned from this method.
381 381
 	 */
382
-	protected function _assemble_messages( $addressees, $templates, EE_Message_Template_Group $message_template_group ) {
382
+	protected function _assemble_messages($addressees, $templates, EE_Message_Template_Group $message_template_group) {
383 383
 
384 384
 		//if templates are empty then get out because we can't generate anything.
385
-		if ( ! $templates ) {
385
+		if ( ! $templates) {
386 386
 			return false;
387 387
 		}
388 388
 
389 389
 		//We use this as the counter for generated messages because don't forget we may be executing this inside of a
390 390
 		//generation_queue.  So _ready_queue may have generated EE_Message objects already.
391 391
 		$generated_count = 0;
392
-		foreach ( $addressees as $context => $recipients ) {
393
-			foreach ( $recipients as $recipient ) {
394
-				$message = $this->_setup_message_object( $context, $recipient, $templates, $message_template_group );
395
-				if ( $message instanceof EE_Message ) {
392
+		foreach ($addressees as $context => $recipients) {
393
+			foreach ($recipients as $recipient) {
394
+				$message = $this->_setup_message_object($context, $recipient, $templates, $message_template_group);
395
+				if ($message instanceof EE_Message) {
396 396
 					$this->_ready_queue->add(
397 397
 						$message,
398 398
 						array(),
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 	) {
428 428
 		//stuff we already know
429 429
 		$transaction_id = $recipient->txn instanceof EE_Transaction ? $recipient->txn->ID() : 0;
430
-		$transaction_id = empty( $transaction_id ) && $this->_current_data_handler->txn instanceof EE_Transaction
430
+		$transaction_id = empty($transaction_id) && $this->_current_data_handler->txn instanceof EE_Transaction
431 431
 			? $this->_current_data_handler->txn->ID()
432 432
 			: $transaction_id;
433 433
 		$message_fields = array(
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 
441 441
 		//recipient id and type should be on the EE_Messages_Addressee object but if this is empty, let's try to grab the
442 442
 		//info from the att_obj found in the EE_Messages_Addressee object.
443
-		if ( empty( $recipient->recipient_id ) || empty( $recipient->recipient_type ) ) {
443
+		if (empty($recipient->recipient_id) || empty($recipient->recipient_type)) {
444 444
 			$message_fields['MSG_recipient_ID'] = $recipient->att_obj instanceof EE_Attendee
445 445
 				? $recipient->att_obj->ID()
446 446
 				: 0;
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 			$message_fields['MSG_recipient_ID'] = $recipient->recipient_id;
450 450
 			$message_fields['MSG_recipient_type'] = $recipient->recipient_type;
451 451
 		}
452
-		$message = EE_Message_Factory::create( $message_fields );
452
+		$message = EE_Message_Factory::create($message_fields);
453 453
 
454 454
 		//grab valid shortcodes for shortcode parser
455 455
 		$mt_shortcodes = $this->_current_message_type->get_valid_shortcodes();
@@ -457,43 +457,43 @@  discard block
 block discarded – undo
457 457
 
458 458
 		//if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because that means this
459 459
 		//context is turned off) EXCEPT if we're previewing
460
-		if ( empty( $templates['to'][ $context ] )
460
+		if (empty($templates['to'][$context])
461 461
 		     && ! $this->_generation_queue->get_queue()->is_preview()
462
-		     && ! $this->_current_messenger->allow_empty_to_field() ) {
462
+		     && ! $this->_current_messenger->allow_empty_to_field()) {
463 463
 			//we silently exit here and do NOT record a fail because the message is "turned off" by having no "to" field.
464 464
 			return false;
465 465
 		}
466 466
 		$error_msg = array();
467
-		foreach ( $templates as $field => $field_context ) {
467
+		foreach ($templates as $field => $field_context) {
468 468
 			$error_msg = array();
469 469
 			//let's setup the valid shortcodes for the incoming context.
470
-			$valid_shortcodes = $mt_shortcodes[ $context ];
470
+			$valid_shortcodes = $mt_shortcodes[$context];
471 471
 			//merge in valid shortcodes for the field.
472
-			$shortcodes = isset($m_shortcodes[ $field ]) ? $m_shortcodes[ $field ] : $valid_shortcodes;
473
-			if ( isset( $templates[ $field ][ $context ] ) ) {
472
+			$shortcodes = isset($m_shortcodes[$field]) ? $m_shortcodes[$field] : $valid_shortcodes;
473
+			if (isset($templates[$field][$context])) {
474 474
 				//prefix field.
475
-				$column_name = 'MSG_' . $field;
475
+				$column_name = 'MSG_'.$field;
476 476
 				try {
477 477
 					$content = $this->_shortcode_parser->parse_message_template(
478
-						$templates[ $field ][ $context ],
478
+						$templates[$field][$context],
479 479
 						$recipient,
480 480
 						$shortcodes,
481 481
 						$this->_current_message_type,
482 482
 						$this->_current_messenger,
483 483
 						$message );
484
-					$message->set_field_or_extra_meta( $column_name, $content );
485
-				} catch ( EE_Error $e ) {
486
-					$error_msg[] = sprintf( __( 'There was a problem generating the content for the field %s: %s', 'event_espresso' ), $field, $e->getMessage() );
487
-					$message->set_STS_ID( EEM_Message::status_failed );
484
+					$message->set_field_or_extra_meta($column_name, $content);
485
+				} catch (EE_Error $e) {
486
+					$error_msg[] = sprintf(__('There was a problem generating the content for the field %s: %s', 'event_espresso'), $field, $e->getMessage());
487
+					$message->set_STS_ID(EEM_Message::status_failed);
488 488
 				}
489 489
 			}
490 490
 		}
491 491
 
492
-		if ( $message->STS_ID() === EEM_Message::status_failed ) {
493
-			$error_msg = __( 'There were problems generating this message:', 'event_espresso' ) . "\n" . implode( "\n", $error_msg );
494
-			$message->set_error_message( $error_msg );
492
+		if ($message->STS_ID() === EEM_Message::status_failed) {
493
+			$error_msg = __('There were problems generating this message:', 'event_espresso')."\n".implode("\n", $error_msg);
494
+			$message->set_error_message($error_msg);
495 495
 		} else {
496
-			$message->set_STS_ID( EEM_Message::status_idle );
496
+			$message->set_STS_ID(EEM_Message::status_idle);
497 497
 		}
498 498
 		return $message;
499 499
 	}
@@ -527,14 +527,14 @@  discard block
 block discarded – undo
527 527
 	 * @param array $addressees  Keys correspond to contexts for the message type and values are EE_Messages_Addressee[]
528 528
 	 * @return bool
529 529
 	 */
530
-	protected function _valid_addressees( $addressees ) {
531
-		if ( ! $addressees || ! is_array( $addressees ) ) {
530
+	protected function _valid_addressees($addressees) {
531
+		if ( ! $addressees || ! is_array($addressees)) {
532 532
 			return false;
533 533
 		}
534 534
 
535
-		foreach( $addressees as $addressee_array ) {
536
-			foreach ( $addressee_array as $addressee ) {
537
-				if ( ! $addressee instanceof EE_Messages_Addressee ) {
535
+		foreach ($addressees as $addressee_array) {
536
+			foreach ($addressee_array as $addressee) {
537
+				if ( ! $addressee instanceof EE_Messages_Addressee) {
538 538
 					return false;
539 539
 				}
540 540
 			}
@@ -555,19 +555,19 @@  discard block
 block discarded – undo
555 555
 	protected function _validate_messenger_and_message_type() {
556 556
 
557 557
 		//first are there any existing error messages?  If so then return.
558
-		if ( $this->_error_msg ) {
558
+		if ($this->_error_msg) {
559 559
 			return false;
560 560
 		}
561 561
 		/** @type EE_Message $message */
562 562
 		$message = $this->_generation_queue->get_queue()->current();
563 563
 		try {
564
-			$this->_current_messenger = $message->valid_messenger( true ) ? $message->messenger_object() : null;
565
-		} catch ( Exception $e ) {
564
+			$this->_current_messenger = $message->valid_messenger(true) ? $message->messenger_object() : null;
565
+		} catch (Exception $e) {
566 566
 			$this->_error_msg[] = $e->getMessage();
567 567
 		}
568 568
 		try {
569
-			$this->_current_message_type = $message->valid_message_type( true ) ? $message->message_type_object() : null;
570
-		} catch ( Exception $e ) {
569
+			$this->_current_message_type = $message->valid_message_type(true) ? $message->message_type_object() : null;
570
+		} catch (Exception $e) {
571 571
 			$this->_error_msg[] = $e->getMessage();
572 572
 		}
573 573
 
@@ -579,10 +579,10 @@  discard block
 block discarded – undo
579 579
 			     ! $this->_generation_queue->get_queue()->is_preview()
580 580
 			     && $this->_generation_queue->get_queue()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' )
581 581
 		) {
582
-			$this->_error_msg[] = __( 'There is no generation data for this message. Unable to generate.' );
582
+			$this->_error_msg[] = __('There is no generation data for this message. Unable to generate.');
583 583
 		}
584 584
 
585
-		return empty( $this->_error_msg );
585
+		return empty($this->_error_msg);
586 586
 	}
587 587
 
588 588
 
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 
600 600
 		//First, are there any existing error messages?  If so, return because if there were errors elsewhere this can't
601 601
 		//be used anyways.
602
-		if ( $this->_error_msg ) {
602
+		if ($this->_error_msg) {
603 603
 			return false;
604 604
 		}
605 605
 
@@ -608,29 +608,29 @@  discard block
 block discarded – undo
608 608
 		/** @type EE_Messages_incoming_data $data_handler_class_name - well not really... just the class name actually */
609 609
 		$data_handler_class_name = $this->_generation_queue->get_queue()->get_data_handler()
610 610
 			? $this->_generation_queue->get_queue()->get_data_handler()
611
-			: 'EE_Messages_' .  $this->_current_message_type->get_data_handler( $generation_data ) . '_incoming_data';
611
+			: 'EE_Messages_'.$this->_current_message_type->get_data_handler($generation_data).'_incoming_data';
612 612
 
613 613
 		//If this EE_Message is for a preview, then let's switch out to the preview data handler.
614
-		if ( $this->_generation_queue->get_queue()->is_preview() ) {
615
-			$data_handler_class_name  = 'EE_Messages_Preview_incoming_data';
614
+		if ($this->_generation_queue->get_queue()->is_preview()) {
615
+			$data_handler_class_name = 'EE_Messages_Preview_incoming_data';
616 616
 		}
617 617
 
618 618
 		//First get the class name for the data handler (and also verifies it exists.
619
-		if ( ! class_exists( $data_handler_class_name ) ) {
619
+		if ( ! class_exists($data_handler_class_name)) {
620 620
 			$this->_error_msg[] = sprintf(
621
-				__( 'The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes.  Looking for %s.', 'event_espresso' ),
621
+				__('The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes.  Looking for %s.', 'event_espresso'),
622 622
 				$data_handler_class_name
623 623
 			);
624 624
 			return false;
625 625
 		}
626 626
 
627 627
 		//convert generation_data for data_handler_instantiation.
628
-		$generation_data = $data_handler_class_name::convert_data_from_persistent_storage( $generation_data );
628
+		$generation_data = $data_handler_class_name::convert_data_from_persistent_storage($generation_data);
629 629
 
630 630
 		//note, this may set error messages as well.
631
-		$this->_set_data_handler( $generation_data, $data_handler_class_name );
631
+		$this->_set_data_handler($generation_data, $data_handler_class_name);
632 632
 
633
-		return empty( $this->_error_msg );
633
+		return empty($this->_error_msg);
634 634
 	}
635 635
 
636 636
 
@@ -647,16 +647,16 @@  discard block
 block discarded – undo
647 647
 	 *
648 648
 	 * @return void.
649 649
 	 */
650
-	protected function _set_data_handler( $generating_data, $data_handler_class_name ) {
650
+	protected function _set_data_handler($generating_data, $data_handler_class_name) {
651 651
 		//valid classname for the data handler.  Now let's setup the key for the data handler repository to see if there
652 652
 		//is already a ready data handler in the repository.
653
-		$this->_current_data_handler = $this->_data_handler_collection->get_by_key( $this->_data_handler_collection->get_key( $data_handler_class_name, $generating_data ) );
654
-		if ( ! $this->_current_data_handler instanceof EE_messages_incoming_data ) {
653
+		$this->_current_data_handler = $this->_data_handler_collection->get_by_key($this->_data_handler_collection->get_key($data_handler_class_name, $generating_data));
654
+		if ( ! $this->_current_data_handler instanceof EE_messages_incoming_data) {
655 655
 			//no saved data_handler in the repo so let's set one up and add it to the repo.
656 656
 			try {
657
-				$this->_current_data_handler = new $data_handler_class_name( $generating_data );
658
-				$this->_data_handler_collection->add( $this->_current_data_handler, $generating_data );
659
-			} catch( EE_Error $e ) {
657
+				$this->_current_data_handler = new $data_handler_class_name($generating_data);
658
+				$this->_data_handler_collection->add($this->_current_data_handler, $generating_data);
659
+			} catch (EE_Error $e) {
660 660
 				$this->_error_msg[] = $e->get_error();
661 661
 			}
662 662
 		}
@@ -676,13 +676,13 @@  discard block
 block discarded – undo
676 676
 	 * @param bool                   $preview Indicate whether this is being used for a preview or not.
677 677
 	 * @return mixed Prepped data for persisting to the queue.  false is returned if unable to prep data.
678 678
 	 */
679
-	protected function _prepare_data_for_queue( EE_Message_To_Generate $message_to_generate, $preview ) {
679
+	protected function _prepare_data_for_queue(EE_Message_To_Generate $message_to_generate, $preview) {
680 680
 		/** @type EE_Messages_incoming_data $data_handler - well not really... just the class name actually */
681
-		$data_handler = $message_to_generate->get_data_handler_class_name( $preview );
682
-		if ( ! $message_to_generate->valid() ) {
681
+		$data_handler = $message_to_generate->get_data_handler_class_name($preview);
682
+		if ( ! $message_to_generate->valid()) {
683 683
 			return false; //unable to get the data because the info in the EE_Message_To_Generate class is invalid.
684 684
 		}
685
-		return $data_handler::convert_data_for_persistent_storage( $message_to_generate->data() );
685
+		return $data_handler::convert_data_for_persistent_storage($message_to_generate->data());
686 686
 	}
687 687
 
688 688
 
@@ -695,26 +695,26 @@  discard block
 block discarded – undo
695 695
 	 * @param EE_Message_To_Generate $message_to_generate
696 696
 	 * @param bool                   $test_send Whether this is just a test send or not.  Typically used for previews.
697 697
 	 */
698
-	public function create_and_add_message_to_queue( EE_Message_To_Generate $message_to_generate, $test_send = false ) {
698
+	public function create_and_add_message_to_queue(EE_Message_To_Generate $message_to_generate, $test_send = false) {
699 699
 		//prep data
700
-		$data = $this->_prepare_data_for_queue( $message_to_generate, $message_to_generate->preview() );
700
+		$data = $this->_prepare_data_for_queue($message_to_generate, $message_to_generate->preview());
701 701
 
702 702
 		$message = $message_to_generate->get_EE_Message();
703 703
 
704 704
 		//is there a GRP_ID in the request?
705
-		if ( $GRP_ID = EE_Registry::instance()->REQ->get( 'GRP_ID' ) ) {
706
-			$message->set_GRP_ID( $GRP_ID );
705
+		if ($GRP_ID = EE_Registry::instance()->REQ->get('GRP_ID')) {
706
+			$message->set_GRP_ID($GRP_ID);
707 707
 		}
708 708
 
709
-		if ( $data === false ) {
710
-			$message->set_STS_ID( EEM_Message::status_failed );
711
-			$message->set_error_message( __( 'Unable to prepare data for persistence to the database.', 'event_espresso' ) );
709
+		if ($data === false) {
710
+			$message->set_STS_ID(EEM_Message::status_failed);
711
+			$message->set_error_message(__('Unable to prepare data for persistence to the database.', 'event_espresso'));
712 712
 		} else {
713 713
 			//make sure that the data handler is cached on the message as well
714 714
 			$data['data_handler_class_name'] = $message_to_generate->get_data_handler_class_name();
715 715
 		}
716 716
 
717
-		$this->_generation_queue->add( $message, $data, $message_to_generate->preview(), $test_send );
717
+		$this->_generation_queue->add($message, $data, $message_to_generate->preview(), $test_send);
718 718
 	}
719 719
 
720 720
 
Please login to merge, or discard this patch.
core/libraries/messages/EE_messenger.lib.php 3 patches
Braces   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -717,8 +718,9 @@  discard block
 block discarded – undo
717 718
 		$wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, $type );
718 719
 
719 720
 		//check file exists and is readable
720
-		if ( !is_readable( $wrapper_template ) )
721
-			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 ) );
721
+		if ( !is_readable( $wrapper_template ) ) {
722
+					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 ) );
723
+		}
722 724
 
723 725
 		//require template helper
724 726
 		EE_Registry::instance()->load_helper( 'Template' );
@@ -788,20 +790,24 @@  discard block
 block discarded – undo
788 790
 	 */
789 791
 	public function get_field_label( $field ) {
790 792
 		//first let's see if the field requests is in the top level array.
791
-		if ( isset( $this->_template_fields[$field] ) && !empty( $this->_template_fields[$field]['label'] ) )
792
-			return $this->_template[$field]['label'];
793
+		if ( isset( $this->_template_fields[$field] ) && !empty( $this->_template_fields[$field]['label'] ) ) {
794
+					return $this->_template[$field]['label'];
795
+		}
793 796
 
794 797
 		//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.
795
-		if ( isset( $this->_template_fields['extra'] ) && !empty( $this->_template_fields['extra'][$field] ) && !empty( $this->_template_fields['extra'][$field]['main']['label'] )  )
796
-			return $this->_template_fields['extra'][$field]['main']['label'];
798
+		if ( isset( $this->_template_fields['extra'] ) && !empty( $this->_template_fields['extra'][$field] ) && !empty( $this->_template_fields['extra'][$field]['main']['label'] )  ) {
799
+					return $this->_template_fields['extra'][$field]['main']['label'];
800
+		}
797 801
 
798 802
 		//now it's possible this field may just be existing in any of the extra array items.
799 803
 		if ( !empty( $this->_template_fields['extra'] ) && is_array( $this->_template_fields['extra'] ) ) {
800 804
 			foreach ( $this->_template_fields['extra'] as $main_field => $subfields ) {
801
-				if ( !is_array( $subfields ) )
802
-					continue;
803
-				if ( isset( $subfields[$field] ) && !empty( $subfields[$field]['label'] ) )
804
-					return $subfields[$field]['label'];
805
+				if ( !is_array( $subfields ) ) {
806
+									continue;
807
+				}
808
+				if ( isset( $subfields[$field] ) && !empty( $subfields[$field]['label'] ) ) {
809
+									return $subfields[$field]['label'];
810
+				}
805 811
 			}
806 812
 		}
807 813
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 	/**
504 504
 	 * @param $message_types
505 505
 	 * @param array $extra
506
-	 * @return mixed|string
506
+	 * @return string
507 507
 	 */
508 508
 	protected function _get_admin_content_events_edit( $message_types, $extra ) {
509 509
 		//defaults
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 	 * All this does is set the existing test settings (in the db) for the messenger
772 772
 	 *
773 773
 	 * @access public
774
-	 * @param $settings
774
+	 * @param string $settings
775 775
 	 * @return bool success/fail
776 776
 	 */
777 777
 	public function set_existing_test_settings( $settings ) {
Please login to merge, or discard this 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.
modules/bot_trap/EED_Bot_Trap.module.php 2 patches
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.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @return EED_Bot_Trap
19 19
 	 */
20 20
 	public static function instance() {
21
-		return parent::get_instance( __CLASS__ );
21
+		return parent::get_instance(__CLASS__);
22 22
 	}
23 23
 
24 24
 
@@ -31,22 +31,22 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public static function set_hooks() {
33 33
 		if (
34
-			apply_filters( 'FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true ) &&
34
+			apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) &&
35 35
 			EE_Registry::instance()->CFG->registration->use_bot_trap
36 36
 		) {
37
-			define( 'EE_BOT_TRAP_BASE_URL', plugin_dir_url( __FILE__ ) . DS );
37
+			define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__).DS);
38 38
 			add_action(
39 39
 				'AHEE__ticket_selector_chart__template__after_ticket_selector',
40
-				array( 'EED_Bot_Trap', 'generate_bot_trap' ),
40
+				array('EED_Bot_Trap', 'generate_bot_trap'),
41 41
 				10, 2
42 42
 			);
43 43
 			add_action(
44 44
 				'EED_Ticket_Selector__process_ticket_selections__before',
45
-				array( 'EED_Bot_Trap', 'process_bot_trap' ),
45
+				array('EED_Bot_Trap', 'process_bot_trap'),
46 46
 				1, 2
47 47
 			);
48 48
 			// redirect bots to bogus success page
49
-			EE_Config::register_route( 'ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success' );
49
+			EE_Config::register_route('ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success');
50 50
 		}
51 51
 	}
52 52
 
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 	public static function set_hooks_admin() {
62 62
 		add_action(
63 63
 			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
64
-			array( 'EED_Bot_Trap', 'bot_trap_settings_form' ),
64
+			array('EED_Bot_Trap', 'bot_trap_settings_form'),
65 65
 			10
66 66
 		);
67 67
 		add_filter(
68 68
 			'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',
69
-			array( 'EED_Bot_Trap', 'update_bot_trap_settings_form' ),
69
+			array('EED_Bot_Trap', 'update_bot_trap_settings_form'),
70 70
 			10, 1
71 71
 		);
72 72
 	}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @param    WP $WP
81 81
 	 * @return    void
82 82
 	 */
83
-	public function run( $WP ) {}
83
+	public function run($WP) {}
84 84
 
85 85
 
86 86
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 	 * @return    void
92 92
 	 */
93 93
 	public static function generate_bot_trap() {
94
-		$do_not_enter = __( 'please do not enter anything in this input', 'event_espresso' );
94
+		$do_not_enter = __('please do not enter anything in this input', 'event_espresso');
95 95
 		$html = '<div id="tkt-slctr-request-processor-dv" style="float:left; margin-left:-999em;">';
96
-		$html .= '<label for="tkt-slctr-request-processor-email">' . $do_not_enter  . '</label>';
96
+		$html .= '<label for="tkt-slctr-request-processor-email">'.$do_not_enter.'</label>';
97 97
 		$html .= '<input type="email" name="tkt-slctr-request-processor-email" value=""/>';
98 98
 		$html .= '<input type="hidden" name="tkt-slctr-request-processor-token" value="';
99
-		if ( EE_Registry::instance()->CFG->registration->use_encryption ) {
100
-			EE_Registry::instance()->load_core( 'EE_Encryption' );
101
-			$html .= EE_Encryption::instance()->encrypt( time() );
99
+		if (EE_Registry::instance()->CFG->registration->use_encryption) {
100
+			EE_Registry::instance()->load_core('EE_Encryption');
101
+			$html .= EE_Encryption::instance()->encrypt(time());
102 102
 		} else {
103 103
 			$html .= time();
104 104
 		}
@@ -117,35 +117,35 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public static function process_bot_trap() {
119 119
 		// what's your email address Mr. Bot ?
120
-		$empty_trap = isset( $_REQUEST[ 'tkt-slctr-request-processor-email' ] ) && $_REQUEST[ 'tkt-slctr-request-processor-email' ] == '' ? true : false;
120
+		$empty_trap = isset($_REQUEST['tkt-slctr-request-processor-email']) && $_REQUEST['tkt-slctr-request-processor-email'] == '' ? true : false;
121 121
 		// get encrypted timestamp for when the form was originally displayed
122
-		$bot_trap_timestamp = isset( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) ? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) : '';
122
+		$bot_trap_timestamp = isset($_REQUEST['tkt-slctr-request-processor-token']) ? sanitize_text_field($_REQUEST['tkt-slctr-request-processor-token']) : '';
123 123
 		// decrypt and convert to absolute  integer
124
-		if ( EE_Registry::instance()->CFG->registration->use_encryption ) {
125
-			EE_Registry::instance()->load_core( 'EE_Encryption' );
126
-			$bot_trap_timestamp = absint( EE_Encryption::instance()->decrypt( $bot_trap_timestamp ) );
124
+		if (EE_Registry::instance()->CFG->registration->use_encryption) {
125
+			EE_Registry::instance()->load_core('EE_Encryption');
126
+			$bot_trap_timestamp = absint(EE_Encryption::instance()->decrypt($bot_trap_timestamp));
127 127
 		} else {
128
-			$bot_trap_timestamp = absint( $bot_trap_timestamp );
128
+			$bot_trap_timestamp = absint($bot_trap_timestamp);
129 129
 		}
130 130
 		// ticket form submitted too impossibly fast ( after now ) or more than an hour later ???
131
-		$suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < ( time() - HOUR_IN_SECONDS ) ? true : false;
131
+		$suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < (time() - HOUR_IN_SECONDS) ? true : false;
132 132
 		// are we human ?
133
-		if ( $empty_trap && ! $suspicious_timing ) {
133
+		if ($empty_trap && ! $suspicious_timing) {
134 134
 			return;
135 135
 		}
136 136
 		// UH OH...
137 137
 		$redirect_url = add_query_arg(
138
-			array( 'ee' => 'ticket_selection_received' ),
138
+			array('ee' => 'ticket_selection_received'),
139 139
 			EE_Registry::instance()->CFG->core->reg_page_url()
140 140
 		);
141
-		if ( $suspicious_timing ) {
141
+		if ($suspicious_timing) {
142 142
 			$redirect_url = add_query_arg(
143
-				array( 'ee-notice' => urlencode( __( 'We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso' ) ) ),
143
+				array('ee-notice' => urlencode(__('We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso'))),
144 144
 				$redirect_url
145 145
 			);
146 146
 		}
147 147
 		wp_safe_redirect(
148
-			apply_filters( 'FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url )
148
+			apply_filters('FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url)
149 149
 		);
150 150
 		exit();
151 151
 	}
@@ -160,10 +160,10 @@  discard block
 block discarded – undo
160 160
 	 * @return    void
161 161
 	 */
162 162
 	public static function display_bot_trap_success() {
163
-		add_filter( 'FHEE__EED_Single_Page_Checkout__run', '__return_false' );
164
-		$bot_notice = __( 'Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso' );
165
-		$bot_notice = isset( $_REQUEST[ 'ee-notice' ] ) && $_REQUEST[ 'ee-notice' ] !== '' ? sanitize_text_field( stripslashes( $_REQUEST[ 'ee-notice' ] ) ) : $bot_notice;
166
-		EE_Registry::instance()->REQ->add_output( EEH_HTML::div( $bot_notice, '', 'ee-attention' ) );
163
+		add_filter('FHEE__EED_Single_Page_Checkout__run', '__return_false');
164
+		$bot_notice = __('Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso');
165
+		$bot_notice = isset($_REQUEST['ee-notice']) && $_REQUEST['ee-notice'] !== '' ? sanitize_text_field(stripslashes($_REQUEST['ee-notice'])) : $bot_notice;
166
+		EE_Registry::instance()->REQ->add_output(EEH_HTML::div($bot_notice, '', 'ee-attention'));
167 167
 	}
168 168
 
169 169
 
@@ -197,20 +197,20 @@  discard block
 block discarded – undo
197 197
 				'html_id'         			=> 'bot_trap_settings',
198 198
 				'layout_strategy' 	=> new EE_Admin_Two_Column_Layout(),
199 199
 				'subsections'     		=> array(
200
-					'bot_trap_hdr' 		=> new EE_Form_Section_HTML( EEH_HTML::h2( __( 'Bot Trap Settings', 'event_espresso' ) ) ),
200
+					'bot_trap_hdr' 		=> new EE_Form_Section_HTML(EEH_HTML::h2(__('Bot Trap Settings', 'event_espresso'))),
201 201
 					'use_bot_trap' 		=> new EE_Yes_No_Input(
202 202
 						array(
203
-							'html_label_text' 	=> __( 'Enable Bot Trap', 'event_espresso' ),
204
-							'html_help_text' 		=>  __( 'The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso' ),
205
-							'default'        			=> isset( EE_Registry::instance()->CFG->registration->use_bot_trap ) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true,
203
+							'html_label_text' 	=> __('Enable Bot Trap', 'event_espresso'),
204
+							'html_help_text' 		=>  __('The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso'),
205
+							'default'        			=> isset(EE_Registry::instance()->CFG->registration->use_bot_trap) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true,
206 206
 							'required'        		=> false
207 207
 						)
208 208
 					),
209 209
 					'use_encryption' 		=> new EE_Yes_No_Input(
210 210
 						array(
211
-							'html_label_text' 	=> __( 'Encrypt Bot Trap Data', 'event_espresso' ),
212
-							'html_help_text' 		=>  __( 'One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso' ),
213
-							'default'        			=> isset( EE_Registry::instance()->CFG->registration->use_encryption ) ? EE_Registry::instance()->CFG->registration->use_encryption : true,
211
+							'html_label_text' 	=> __('Encrypt Bot Trap Data', 'event_espresso'),
212
+							'html_help_text' 		=>  __('One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso'),
213
+							'default'        			=> isset(EE_Registry::instance()->CFG->registration->use_encryption) ? EE_Registry::instance()->CFG->registration->use_encryption : true,
214 214
 							'required'        		=> false
215 215
 						)
216 216
 					),
@@ -228,30 +228,30 @@  discard block
 block discarded – undo
228 228
 	 * @param \EE_Registration_Config $EE_Registration_Config
229 229
 	 * @return \EE_Registration_Config
230 230
 	 */
231
-	public static function update_bot_trap_settings_form( EE_Registration_Config $EE_Registration_Config ) {
231
+	public static function update_bot_trap_settings_form(EE_Registration_Config $EE_Registration_Config) {
232 232
 		try {
233 233
 			$bot_trap_settings_form = EED_Bot_Trap::_bot_trap_settings_form();
234 234
 			// if not displaying a form, then check for form submission
235
-			if ( $bot_trap_settings_form->was_submitted() ) {
235
+			if ($bot_trap_settings_form->was_submitted()) {
236 236
 				// capture form data
237 237
 				$bot_trap_settings_form->receive_form_submission();
238 238
 				// validate form data
239
-				if ( $bot_trap_settings_form->is_valid() ) {
239
+				if ($bot_trap_settings_form->is_valid()) {
240 240
 					// grab validated data from form
241 241
 					$valid_data = $bot_trap_settings_form->valid_data();
242
-					if ( isset( $valid_data[ 'use_bot_trap' ], $valid_data[ 'use_encryption' ] ) ) {
243
-						$EE_Registration_Config->use_bot_trap = $valid_data[ 'use_bot_trap' ];
244
-						$EE_Registration_Config->use_encryption = $valid_data[ 'use_encryption' ];
242
+					if (isset($valid_data['use_bot_trap'], $valid_data['use_encryption'])) {
243
+						$EE_Registration_Config->use_bot_trap = $valid_data['use_bot_trap'];
244
+						$EE_Registration_Config->use_encryption = $valid_data['use_encryption'];
245 245
 					} else {
246
-						EE_Error::add_error( __( 'Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
246
+						EE_Error::add_error(__('Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
247 247
 					}
248 248
 				} else {
249
-					if ( $bot_trap_settings_form->submission_error_message() != '' ) {
250
-						EE_Error::add_error( $bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
249
+					if ($bot_trap_settings_form->submission_error_message() != '') {
250
+						EE_Error::add_error($bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
251 251
 					}
252 252
 				}
253 253
 			}
254
-		} catch ( EE_Error $e ) {
254
+		} catch (EE_Error $e) {
255 255
 			$e->get_error();
256 256
 		}
257 257
 		return $EE_Registration_Config;
Please login to merge, or discard this patch.
modules/messages/EED_Messages.module.php 4 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -912,11 +912,11 @@
 block discarded – undo
912 912
 				sprintf(
913 913
 					_n(
914 914
 						'%d message successfully queued for resending.',
915
-				        '%d messages successfully queued for resending.',
916
-				        $queue_count,
917
-				        'event_espresso'
918
-				    ),
919
-				    $queue_count
915
+						'%d messages successfully queued for resending.',
916
+						$queue_count,
917
+						'event_espresso'
918
+					),
919
+					$queue_count
920 920
 				)
921 921
 			);
922 922
 		} else {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
  * @subpackage plugin api, messages
6 6
  * @since           4.5.0
7 7
  */
8
-if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10
+}
9 11
 
10 12
 /**
11 13
  * Use this to register or deregister a new message template pack variation for the EE messages system.
Please login to merge, or discard this patch.
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   +178 added lines, -178 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,33 +235,33 @@  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
-		$transient_key = EE_Registry::instance()->REQ->get( 'key' );
243
-		header( 'HTTP/1.1 200 OK' );
241
+		$cron_type = EE_Registry::instance()->REQ->get('type');
242
+		$transient_key = EE_Registry::instance()->REQ->get('key');
243
+		header('HTTP/1.1 200 OK');
244 244
 
245 245
 		//now let's verify transient, if not valid exit immediately
246
-		if ( ! get_transient( $transient_key ) ) {
246
+		if ( ! get_transient($transient_key)) {
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 Request (Transient does not exist)', 'event_espresso' ) );
250
+			trigger_error(esc_attr__('Invalid Request (Transient does not exist)', 'event_espresso'));
251 251
 		}
252 252
 
253 253
 		//if made it here, lets' delete the transient to keep the db clean
254
-		delete_transient( $transient_key );
254
+		delete_transient($transient_key);
255 255
 
256
-		$method = 'batch_' . $cron_type . '_from_queue';
257
-		if ( method_exists( self::$_MSG_PROCESSOR, $method ) ) {
256
+		$method = 'batch_'.$cron_type.'_from_queue';
257
+		if (method_exists(self::$_MSG_PROCESSOR, $method)) {
258 258
 			self::$_MSG_PROCESSOR->$method();
259 259
 		} else {
260 260
 			//no matching task
261 261
 			/**
262 262
 			 * trigger error so this gets in the error logs.  This is important because it happens on a non user request.
263 263
 			 */
264
-			trigger_error( esc_attr( sprintf( __( 'There is no task corresponding to this route %s', 'event_espresso' ), $cron_type ) ) );
264
+			trigger_error(esc_attr(sprintf(__('There is no task corresponding to this route %s', 'event_espresso'), $cron_type)));
265 265
 		}
266 266
 		exit();
267 267
 	}
@@ -279,9 +279,9 @@  discard block
 block discarded – undo
279 279
 	 *
280 280
 	 * @return EE_Messages_Template_Pack
281 281
 	 */
282
-	public static function get_template_pack( $template_pack_name ) {
283
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
284
-		return EEH_MSG_Template::get_template_pack( $template_pack_name );
282
+	public static function get_template_pack($template_pack_name) {
283
+		EE_Registry::instance()->load_helper('MSG_Template');
284
+		return EEH_MSG_Template::get_template_pack($template_pack_name);
285 285
 	}
286 286
 
287 287
 
@@ -295,14 +295,14 @@  discard block
 block discarded – undo
295 295
 	 * @return EE_Messages_Template_Pack[]
296 296
 	 */
297 297
 	public static function get_template_packs() {
298
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
298
+		EE_Registry::instance()->load_helper('MSG_Template');
299 299
 
300 300
 		//for backward compat, let's make sure this returns in the same format as originally.
301 301
 		$template_pack_collection = EEH_MSG_Template::get_template_pack_collection();
302 302
 		$template_pack_collection->rewind();
303 303
 		$template_packs = array();
304
-		while ( $template_pack_collection->valid() ) {
305
-			$template_packs[ $template_pack_collection->current()->dbref ] = $template_pack_collection->current();
304
+		while ($template_pack_collection->valid()) {
305
+			$template_packs[$template_pack_collection->current()->dbref] = $template_pack_collection->current();
306 306
 			$template_pack_collection->next();
307 307
 		}
308 308
 		return $template_packs;
@@ -318,14 +318,14 @@  discard block
 block discarded – undo
318 318
 	 * @return void
319 319
 	 */
320 320
 	public static function set_autoloaders() {
321
-		if ( empty( self::$_MSG_PATHS ) ) {
321
+		if (empty(self::$_MSG_PATHS)) {
322 322
 			self::_set_messages_paths();
323
-			foreach ( self::$_MSG_PATHS as $path ) {
324
-				EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $path );
323
+			foreach (self::$_MSG_PATHS as $path) {
324
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($path);
325 325
 			}
326 326
 			// add aliases
327
-			EEH_Autoloader::add_alias( 'EE_messages', 'EE_messages' );
328
-			EEH_Autoloader::add_alias( 'EE_messenger', 'EE_messenger' );
327
+			EEH_Autoloader::add_alias('EE_messages', 'EE_messages');
328
+			EEH_Autoloader::add_alias('EE_messenger', 'EE_messenger');
329 329
 		}
330 330
 	}
331 331
 
@@ -353,10 +353,10 @@  discard block
 block discarded – undo
353 353
 			'shortcodes',
354 354
 			);
355 355
 		$paths = array();
356
-		foreach ( $dir_ref as $index => $dir ) {
357
-			$paths[ $index ] = EE_LIBRARIES . $dir;
356
+		foreach ($dir_ref as $index => $dir) {
357
+			$paths[$index] = EE_LIBRARIES.$dir;
358 358
 		}
359
-		self::$_MSG_PATHS = apply_filters( 'FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths );
359
+		self::$_MSG_PATHS = apply_filters('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths);
360 360
 	}
361 361
 
362 362
 
@@ -367,12 +367,12 @@  discard block
 block discarded – undo
367 367
 	 * @return void
368 368
 	 */
369 369
 	protected static function _load_controller() {
370
-		if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor ) {
371
-			EE_Registry::instance()->load_core( 'Request_Handler' );
370
+		if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor) {
371
+			EE_Registry::instance()->load_core('Request_Handler');
372 372
 			self::set_autoloaders();
373
-			self::$_EEMSG = EE_Registry::instance()->load_lib( 'messages' );
374
-			self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib( 'Messages_Processor' );
375
-			self::$_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
373
+			self::$_EEMSG = EE_Registry::instance()->load_lib('messages');
374
+			self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib('Messages_Processor');
375
+			self::$_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
376 376
 		}
377 377
 	}
378 378
 
@@ -381,10 +381,10 @@  discard block
 block discarded – undo
381 381
 	/**
382 382
 	 * @param EE_Transaction $transaction
383 383
 	 */
384
-	public static function payment_reminder( EE_Transaction $transaction ) {
384
+	public static function payment_reminder(EE_Transaction $transaction) {
385 385
 		self::_load_controller();
386
-		$data = array( $transaction, null );
387
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'payment_reminder', $data );
386
+		$data = array($transaction, null);
387
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('payment_reminder', $data);
388 388
 	}
389 389
 
390 390
 
@@ -395,14 +395,14 @@  discard block
 block discarded – undo
395 395
 	 * @param  EE_Payment object
396 396
 	 * @return void
397 397
 	 */
398
-	public static function payment( EE_Transaction $transaction, EE_Payment $payment ) {
398
+	public static function payment(EE_Transaction $transaction, EE_Payment $payment) {
399 399
 		self::_load_controller();
400
-		$data = array( $transaction, $payment );
401
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
402
-		$message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() );
400
+		$data = array($transaction, $payment);
401
+		EE_Registry::instance()->load_helper('MSG_Template');
402
+		$message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID());
403 403
 		//if payment amount is less than 0 then switch to payment_refund message type.
404 404
 		$message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type;
405
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data );
405
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data);
406 406
 	}
407 407
 
408 408
 
@@ -410,10 +410,10 @@  discard block
 block discarded – undo
410 410
 	/**
411 411
 	 * @param EE_Transaction $transaction
412 412
 	 */
413
-	public static function cancelled_registration( EE_Transaction $transaction ) {
413
+	public static function cancelled_registration(EE_Transaction $transaction) {
414 414
 		self::_load_controller();
415
-		$data = array( $transaction, null );
416
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'cancelled_registration', $data );
415
+		$data = array($transaction, null);
416
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('cancelled_registration', $data);
417 417
 	}
418 418
 
419 419
 
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
 	 * @param array $extra_details
427 427
 	 * @return void
428 428
 	 */
429
-	public static function maybe_registration( EE_Registration $registration, $extra_details = array() ) {
429
+	public static function maybe_registration(EE_Registration $registration, $extra_details = array()) {
430 430
 
431
-		if ( ! self::_verify_registration_notification_send( $registration, $extra_details ) ) {
431
+		if ( ! self::_verify_registration_notification_send($registration, $extra_details)) {
432 432
 			//no messages please
433 433
 			return;
434 434
 		}
@@ -443,22 +443,22 @@  discard block
 block discarded – undo
443 443
 		$mtgs = array();
444 444
 
445 445
 		//loop through registrations and trigger messages once per status.
446
-		foreach ( $all_registrations as $reg ) {
446
+		foreach ($all_registrations as $reg) {
447 447
 
448 448
 			//already triggered?
449
-			if ( in_array( $reg->status_ID(), $statuses_sent ) ) {
449
+			if (in_array($reg->status_ID(), $statuses_sent)) {
450 450
 				continue;
451 451
 			}
452 452
 
453
-			$message_type = EEH_MSG_Template::convert_reg_status_to_message_type( $reg->status_ID() );
454
-			$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( $message_type, array( $registration->transaction(), null, $reg->status_ID() ) );
453
+			$message_type = EEH_MSG_Template::convert_reg_status_to_message_type($reg->status_ID());
454
+			$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers($message_type, array($registration->transaction(), null, $reg->status_ID()));
455 455
 			$statuses_sent[] = $reg->status_ID();
456 456
 		}
457 457
 
458
-		$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( 'registration_summary', array( $registration->transaction(), null ) );
458
+		$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers('registration_summary', array($registration->transaction(), null));
459 459
 
460 460
 		//batch queue and initiate request
461
-		self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $mtgs );
461
+		self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($mtgs);
462 462
 		self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority();
463 463
 	}
464 464
 
@@ -473,39 +473,39 @@  discard block
 block discarded – undo
473 473
 	 *
474 474
 	 * @return bool          true = send away, false = nope halt the presses.
475 475
 	 */
476
-	protected static function _verify_registration_notification_send( EE_Registration $registration, $extra_details = array() ) {
476
+	protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array()) {
477 477
 		 //self::log(
478 478
 		 //	__CLASS__, __FUNCTION__, __LINE__,
479 479
 		 //	$registration->transaction(),
480 480
 		 //	array( '$extra_details' => $extra_details )
481 481
 		 //);
482 482
 		// currently only using this to send messages for the primary registrant
483
-		if ( ! $registration->is_primary_registrant() ) {
483
+		if ( ! $registration->is_primary_registrant()) {
484 484
 			return false;
485 485
 		}
486 486
 		// first we check if we're in admin and not doing front ajax
487
-		if ( is_admin() && ! EE_FRONT_AJAX ) {
487
+		if (is_admin() && ! EE_FRONT_AJAX) {
488 488
 			//make sure appropriate admin params are set for sending messages
489
-			if ( empty( $_REQUEST['txn_reg_status_change']['send_notifications'] ) || ! absint( $_REQUEST['txn_reg_status_change']['send_notifications'] ) ) {
489
+			if (empty($_REQUEST['txn_reg_status_change']['send_notifications']) || ! absint($_REQUEST['txn_reg_status_change']['send_notifications'])) {
490 490
 				//no messages sent please.
491 491
 				return false;
492 492
 			}
493 493
 		} else {
494 494
 			// frontend request (either regular or via AJAX)
495 495
 			// TXN is NOT finalized ?
496
-			if ( ! isset( $extra_details['finalized'] ) || $extra_details['finalized'] === false ) {
496
+			if ( ! isset($extra_details['finalized']) || $extra_details['finalized'] === false) {
497 497
 				return false;
498 498
 			}
499 499
 			// return visit but nothing changed ???
500 500
 			if (
501
-				isset( $extra_details['revisit'], $extra_details['status_updates'] ) &&
501
+				isset($extra_details['revisit'], $extra_details['status_updates']) &&
502 502
 				$extra_details['revisit'] && ! $extra_details['status_updates']
503 503
 			) {
504 504
 				return false;
505 505
 			}
506 506
 			// NOT sending messages && reg status is something other than "Not-Approved"
507 507
 			if (
508
-				! apply_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', false ) &&
508
+				! apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) &&
509 509
 				$registration->status_ID() !== EEM_Registration::status_id_not_approved
510 510
 			) {
511 511
 				return false;
@@ -527,10 +527,10 @@  discard block
 block discarded – undo
527 527
 	 *
528 528
 	 * @return array
529 529
 	 */
530
-	protected static function _get_reg_status_array( $reg_status = '' ) {
531
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
532
-		return EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status )
533
-			? EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status )
530
+	protected static function _get_reg_status_array($reg_status = '') {
531
+		EE_Registry::instance()->load_helper('MSG_Template');
532
+		return EEH_MSG_Template::convert_reg_status_to_message_type($reg_status)
533
+			? EEH_MSG_Template::convert_reg_status_to_message_type($reg_status)
534 534
 			: EEH_MSG_Template::reg_status_to_message_type_array();
535 535
 	}
536 536
 
@@ -546,10 +546,10 @@  discard block
 block discarded – undo
546 546
 	 *
547 547
 	 * @return string|bool The payment message type slug matching the status or false if no match.
548 548
 	 */
549
-	protected static function _get_payment_message_type( $payment_status ) {
550
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
551
-		return EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status )
552
-			? EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status )
549
+	protected static function _get_payment_message_type($payment_status) {
550
+		EE_Registry::instance()->load_helper('MSG_Template');
551
+		return EEH_MSG_Template::convert_payment_status_to_message_type($payment_status)
552
+			? EEH_MSG_Template::convert_payment_status_to_message_type($payment_status)
553 553
 			: false;
554 554
 	}
555 555
 
@@ -563,33 +563,33 @@  discard block
 block discarded – undo
563 563
 	 * @param array $req_data This is the $_POST & $_GET data sent from EE_Admin Pages
564 564
 	 * @return bool          success/fail
565 565
 	 */
566
-	public static function process_resend( $req_data ) {
566
+	public static function process_resend($req_data) {
567 567
 		self::_load_controller();
568 568
 
569 569
 		//if $msgID in this request then skip to the new resend_message
570
-		if ( EE_Registry::instance()->REQ->get( 'MSG_ID' ) ) {
570
+		if (EE_Registry::instance()->REQ->get('MSG_ID')) {
571 571
 			return self::resend_message();
572 572
 		}
573 573
 
574 574
 		//make sure any incoming request data is set on the REQ so that it gets picked up later.
575 575
 		$req_data = (array) $req_data;
576
-		foreach( $req_data as $request_key => $request_value ) {
577
-			EE_Registry::instance()->REQ->set( $request_key, $request_value );
576
+		foreach ($req_data as $request_key => $request_value) {
577
+			EE_Registry::instance()->REQ->set($request_key, $request_value);
578 578
 		}
579 579
 
580
-		if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request() ) {
580
+		if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request()) {
581 581
 			return false;
582 582
 		}
583 583
 
584 584
 		try {
585
-			self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $messages_to_send );
585
+			self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($messages_to_send);
586 586
 			self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority();
587
-		} catch( EE_Error $e ) {
588
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
587
+		} catch (EE_Error $e) {
588
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
589 589
 			return false;
590 590
 		}
591 591
 		EE_Error::add_success(
592
-			__( 'Messages have been successfully queued for generation and sending.', 'event_espresso' )
592
+			__('Messages have been successfully queued for generation and sending.', 'event_espresso')
593 593
 		);
594 594
 		return true; //everything got queued.
595 595
 	}
@@ -602,17 +602,17 @@  discard block
 block discarded – undo
602 602
 	public static function resend_message() {
603 603
 		self::_load_controller();
604 604
 
605
-		$msgID = EE_Registry::instance()->REQ->get( 'MSG_ID' );
606
-		if ( ! $msgID ) {
607
-			EE_Error::add_error( __( 'Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
605
+		$msgID = EE_Registry::instance()->REQ->get('MSG_ID');
606
+		if ( ! $msgID) {
607
+			EE_Error::add_error(__('Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
608 608
 			return false;
609 609
 		}
610 610
 
611
-		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( (array) $msgID );
611
+		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send((array) $msgID);
612 612
 
613 613
 		//setup success message.
614
-		$count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend );
615
-		EE_Error::add_success( sprintf(
614
+		$count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend);
615
+		EE_Error::add_success(sprintf(
616 616
 			_n(
617 617
 				'There was %d message queued for resending.',
618 618
 				'There were %d messages queued for resending.',
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 				'event_espresso'
621 621
 			),
622 622
 			$count_ready_for_resend
623
-		) );
623
+		));
624 624
 		return true;
625 625
 	}
626 626
 
@@ -633,13 +633,13 @@  discard block
 block discarded – undo
633 633
 	 * @param  EE_Payment $payment EE_payment object
634 634
 	 * @return bool              success/fail
635 635
 	 */
636
-	public static function process_admin_payment( EE_Payment $payment ) {
637
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
636
+	public static function process_admin_payment(EE_Payment $payment) {
637
+		EE_Registry::instance()->load_helper('MSG_Template');
638 638
 		//we need to get the transaction object
639 639
 		$transaction = $payment->transaction();
640
-		if ( $transaction instanceof EE_Transaction ) {
641
-			$data = array( $transaction, $payment );
642
-			$message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() );
640
+		if ($transaction instanceof EE_Transaction) {
641
+			$data = array($transaction, $payment);
642
+			$message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID());
643 643
 
644 644
 			//if payment amount is less than 0 then switch to payment_refund message type.
645 645
 			$message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type;
@@ -649,17 +649,17 @@  discard block
 block discarded – undo
649 649
 
650 650
 			self::_load_controller();
651 651
 
652
-			self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data );
652
+			self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data);
653 653
 
654 654
 			//get count of queued for generation
655
-			$count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_incomplete );
655
+			$count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete);
656 656
 
657
-			if ( $count_to_generate > 0 ) {
658
-				add_filter( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true' );
657
+			if ($count_to_generate > 0) {
658
+				add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true');
659 659
 				return true;
660 660
 			} else {
661
-				$count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::instance()->stati_indicating_failed_sending() );
662
-				EE_Error::add_error( sprintf(
661
+				$count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::instance()->stati_indicating_failed_sending());
662
+				EE_Error::add_error(sprintf(
663 663
 					_n(
664 664
 						'The payment notification generation failed.',
665 665
 						'%d payment notifications failed being sent.',
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 						'event_espresso'
668 668
 					),
669 669
 					$count_failed
670
-				), __FILE__, __FUNCTION__, __LINE__ );
670
+				), __FILE__, __FUNCTION__, __LINE__);
671 671
 				return false;
672 672
 			}
673 673
 		} else {
@@ -690,11 +690,11 @@  discard block
 block discarded – undo
690 690
 	 * @param  int      	      $grp_id     a specific message template group id.
691 691
 	 * @return void
692 692
 	 */
693
-	public static function send_newsletter_message( $registrations, $grp_id ) {
693
+	public static function send_newsletter_message($registrations, $grp_id) {
694 694
 		//make sure mtp is id and set it in the EE_Request Handler later messages setup.
695
-		EE_Registry::instance()->REQ->set( 'GRP_ID', (int) $grp_id );
695
+		EE_Registry::instance()->REQ->set('GRP_ID', (int) $grp_id);
696 696
 		self::_load_controller();
697
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'newsletter', $registrations );
697
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('newsletter', $registrations);
698 698
 	}
699 699
 
700 700
 
@@ -709,9 +709,9 @@  discard block
 block discarded – undo
709 709
 	 * @param string 	$message_type
710 710
 	 * @return 	string
711 711
 	 */
712
-	public static function registration_message_trigger_url( $registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice' ) {
712
+	public static function registration_message_trigger_url($registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice') {
713 713
 		// whitelist $messenger
714
-		switch ( $messenger ) {
714
+		switch ($messenger) {
715 715
 			case 'pdf' :
716 716
 				$sending_messenger = 'pdf';
717 717
 				$generating_messenger = 'html';
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 				break;
724 724
 		}
725 725
 		// whitelist $message_type
726
-		switch ( $message_type ) {
726
+		switch ($message_type) {
727 727
 			case 'receipt' :
728 728
 				$message_type = 'receipt';
729 729
 				break;
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
 				break;
734 734
 		}
735 735
 		// verify that both the messenger AND the message type are active
736
-		if ( EEH_MSG_Template::is_messenger_active( $sending_messenger ) && EEH_MSG_Template::is_mt_active( $message_type ) ) {
736
+		if (EEH_MSG_Template::is_messenger_active($sending_messenger) && EEH_MSG_Template::is_mt_active($message_type)) {
737 737
 			//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?)
738 738
 			$template_query_params = array(
739 739
 				'MTP_is_active' => true,
@@ -742,16 +742,16 @@  discard block
 block discarded – undo
742 742
 				'Event.EVT_ID' => $registration->event_ID()
743 743
 			);
744 744
 			//get the message template group.
745
-			$msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) );
745
+			$msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params));
746 746
 			//if we don't have an EE_Message_Template_Group then return
747
-			if ( ! $msg_template_group instanceof EE_Message_Template_Group ) {
747
+			if ( ! $msg_template_group instanceof EE_Message_Template_Group) {
748 748
 				// remove EVT_ID from query params so that global templates get picked up
749
-				unset( $template_query_params['Event.EVT_ID'] );
749
+				unset($template_query_params['Event.EVT_ID']);
750 750
 				//get global template as the fallback
751
-				$msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) );
751
+				$msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params));
752 752
 			}
753 753
 			//if we don't have an EE_Message_Template_Group then return
754
-			if ( ! $msg_template_group instanceof EE_Message_Template_Group ) {
754
+			if ( ! $msg_template_group instanceof EE_Message_Template_Group) {
755 755
 				return '';
756 756
 			}
757 757
 			// generate the URL
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 	 * @param bool 	  $send true we will do a test send using the messenger delivery, false we just do a regular preview
781 781
 	 * @return string          The body of the message.
782 782
 	 */
783
-	public static function preview_message( $type, $context, $messenger, $send = false ) {
783
+	public static function preview_message($type, $context, $messenger, $send = false) {
784 784
 		self::_load_controller();
785 785
 		$mtg = new EE_Message_To_Generate(
786 786
 			$messenger,
@@ -789,8 +789,8 @@  discard block
 block discarded – undo
789 789
 			$context,
790 790
 			true
791 791
 		);
792
-		$generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview( $mtg );
793
-		if ( $generated_preview_queue instanceof EE_Messages_Queue ) {
792
+		$generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview($mtg);
793
+		if ($generated_preview_queue instanceof EE_Messages_Queue) {
794 794
 			return $generated_preview_queue->get_queue()->current()->content();
795 795
 		} else {
796 796
 			return $generated_preview_queue;
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
 	 *
818 818
 	 * @return bool          success or fail.
819 819
 	 */
820
-	public static function send_message_with_messenger_only( $messenger, $message_type, EE_Messages_Queue $queue, $custom_subject = '' ) {
820
+	public static function send_message_with_messenger_only($messenger, $message_type, EE_Messages_Queue $queue, $custom_subject = '') {
821 821
 		self::_load_controller();
822 822
 		/** @type EE_Message_To_Generate_From_Queue $message_to_generate */
823 823
 		$message_to_generate = EE_Registry::instance()->load_lib(
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 				$custom_subject,
830 830
 			)
831 831
 		);
832
-		return self::$_MSG_PROCESSOR->queue_for_sending( $message_to_generate );
832
+		return self::$_MSG_PROCESSOR->queue_for_sending($message_to_generate);
833 833
 	}
834 834
 
835 835
 
@@ -842,22 +842,22 @@  discard block
 block discarded – undo
842 842
 	 * @param array     $message_ids An array of message ids
843 843
 	 * @return bool | EE_Messages_Queue     false if nothing was generated, EE_Messages_Queue containing generated messages.
844 844
 	 */
845
-	public static function generate_now( $message_ids ) {
845
+	public static function generate_now($message_ids) {
846 846
 		self::_load_controller();
847 847
 		$messages = EEM_Message::instance()->get_all(
848 848
 			array(
849 849
 				0 => array(
850
-					'MSG_ID' => array( 'IN', $message_ids ),
850
+					'MSG_ID' => array('IN', $message_ids),
851 851
 					'STS_ID' => EEM_Message::status_incomplete,
852 852
 				)
853 853
 			)
854 854
 		);
855 855
 
856
-		$generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue( $messages );
856
+		$generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue($messages);
857 857
 
858
-		if ( ! $generated_queue instanceof EE_Messages_Queue ) {
858
+		if ( ! $generated_queue instanceof EE_Messages_Queue) {
859 859
 			EE_Error::add_error(
860
-				__( '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' ),
860
+				__('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'),
861 861
 				__FILE__, __FUNCTION__, __LINE__
862 862
 			);
863 863
 		}
@@ -876,28 +876,28 @@  discard block
 block discarded – undo
876 876
 	 *
877 877
 	 * @return bool | EE_Messages_Queue  false if no messages sent.
878 878
 	 */
879
-	public static function send_now( $message_ids ) {
879
+	public static function send_now($message_ids) {
880 880
 		self::_load_controller();
881 881
 		$messages = EEM_Message::instance()->get_all(
882 882
 			array(
883 883
 				0 => array(
884
-					'MSG_ID' => array( 'IN', $message_ids ),
885
-					'STS_ID' => array( 'IN', array( EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry ) )
884
+					'MSG_ID' => array('IN', $message_ids),
885
+					'STS_ID' => array('IN', array(EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry))
886 886
 				)
887 887
 			)
888 888
 		);
889 889
 
890
-		$sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue( $messages );
890
+		$sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue($messages);
891 891
 
892
-		if ( ! $sent_queue instanceof EE_Messages_Queue ) {
892
+		if ( ! $sent_queue instanceof EE_Messages_Queue) {
893 893
 			EE_Error::add_error(
894
-				__( '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' ),
894
+				__('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'),
895 895
 				__FILE__, __FUNCTION__, __LINE__
896 896
 			);
897 897
 		} else {
898 898
 			//can count how many sent by using the messages in the queue
899
-			$sent_count = $sent_queue->count_STS_in_queue( EEM_Message::instance()->stati_indicating_sent() );
900
-			if ( $sent_count > 0 ) {
899
+			$sent_count = $sent_queue->count_STS_in_queue(EEM_Message::instance()->stati_indicating_sent());
900
+			if ($sent_count > 0) {
901 901
 				EE_Error::add_success(
902 902
 					sprintf(
903 903
 						_n(
@@ -912,8 +912,8 @@  discard block
 block discarded – undo
912 912
 			} else {
913 913
 				EE_Error::overwrite_errors();
914 914
 				EE_Error::add_error(
915
-					__( '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.
916
-					If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso' ),
915
+					__('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.
916
+					If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso'),
917 917
 					__FILE__, __FUNCTION__, __LINE__
918 918
 				);
919 919
 			}
@@ -934,13 +934,13 @@  discard block
 block discarded – undo
934 934
 	 *
935 935
 	 * @return bool  true means messages were successfully queued for resending, false means none were queued for resending.
936 936
 	 */
937
-	public static function queue_for_resending( $message_ids ) {
937
+	public static function queue_for_resending($message_ids) {
938 938
 		self::_load_controller();
939
-		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( $message_ids );
939
+		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send($message_ids);
940 940
 
941 941
 		//get queue and count
942
-		$queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend );
943
-		if ( $queue_count > 0 ) {
942
+		$queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend);
943
+		if ($queue_count > 0) {
944 944
 			EE_Error::add_success(
945 945
 				sprintf(
946 946
 					_n(
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 			);
955 955
 		} else {
956 956
 			EE_Error::add_error(
957
-				__( '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' ),
957
+				__('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'),
958 958
 				__FILE__, __FUNCTION__, __LINE__
959 959
 			);
960 960
 		}
@@ -976,16 +976,16 @@  discard block
 block discarded – undo
976 976
 	 * @param array $info
977 977
 	 * @param bool $display_request
978 978
 	 */
979
-	protected static function log( $class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false ) {
980
-		if ( WP_DEBUG && false ) {
981
-			if ( $transaction instanceof EE_Transaction ) {
979
+	protected static function log($class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false) {
980
+		if (WP_DEBUG && false) {
981
+			if ($transaction instanceof EE_Transaction) {
982 982
 				// don't serialize objects
983
-				$info = EEH_Debug_Tools::strip_objects( $info );
983
+				$info = EEH_Debug_Tools::strip_objects($info);
984 984
 				$info['TXN_status'] = $transaction->status_ID();
985 985
 				$info['TXN_reg_steps'] = $transaction->reg_steps();
986
-				if ( $transaction->ID() ) {
987
-					$index = 'EE_Transaction: ' . $transaction->ID();
988
-					EEH_Debug_Tools::log( $class, $func, $line, $info, $display_request, $index );
986
+				if ($transaction->ID()) {
987
+					$index = 'EE_Transaction: '.$transaction->ID();
988
+					EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index);
989 989
 				}
990 990
 			}
991 991
 		}
Please login to merge, or discard this patch.
reg_steps/payment_options/payment_options_main.template.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,37 +1,37 @@
 block discarded – undo
1 1
 
2 2
 	<h4 id="reg-page-totals-hdr" class="">
3
-		<span class="drk-grey-text"><?php _e('Registrations:', 'event_espresso'); ?></span> <?php echo $reg_count;?>
3
+		<span class="drk-grey-text"><?php _e('Registrations:', 'event_espresso'); ?></span> <?php echo $reg_count; ?>
4 4
 	</h4>
5 5
 
6 6
 	<div class="spco-payment-info-dv">
7 7
 		<table id="spco-payment-info-table">
8 8
 			<thead>
9 9
 				<tr>
10
-					<th scope="col" width=""><?php _e('Name and Description', 'event_espresso');?></th>
11
-					<th scope="col" width="15%" class="jst-cntr"><?php _e('Price', 'event_espresso');?></th>
12
-					<th scope="col" width="5%" class="jst-cntr"><?php _e( 'Qty', 'event_espresso' ); ?></th>
13
-					<th scope="col" width="15%" class="jst-cntr"><?php _e('Total', 'event_espresso');?></th>
14
-					<?php	do_action( 'AHEE__registration_page_payment_options__payment_info_table_thead_row_end' ); ?>
10
+					<th scope="col" width=""><?php _e('Name and Description', 'event_espresso'); ?></th>
11
+					<th scope="col" width="15%" class="jst-cntr"><?php _e('Price', 'event_espresso'); ?></th>
12
+					<th scope="col" width="5%" class="jst-cntr"><?php _e('Qty', 'event_espresso'); ?></th>
13
+					<th scope="col" width="15%" class="jst-cntr"><?php _e('Total', 'event_espresso'); ?></th>
14
+					<?php	do_action('AHEE__registration_page_payment_options__payment_info_table_thead_row_end'); ?>
15 15
 				</tr>
16 16
 			</thead>
17 17
 			<tbody>
18
-			<?php echo $transaction_details;?>
19
-			<?php	do_action( 'AHEE__registration_page_payment_options__payment_info_table_tbody_end' ); ?>
18
+			<?php echo $transaction_details; ?>
19
+			<?php	do_action('AHEE__registration_page_payment_options__payment_info_table_tbody_end'); ?>
20 20
 			</tbody>
21 21
 		</table>
22 22
 	</div>
23 23
 	<div class="clear-float"> </div>
24 24
 
25
-	<?php  echo $before_payment_options;  ?>
25
+	<?php  echo $before_payment_options; ?>
26 26
 
27 27
 	<div id="methods-of-payment">
28 28
 		<?php echo $payment_options; ?>
29
-		<a id="reg-page-select-other-method-of-payment-lnk" class="hidden smaller-text right" rel=""><?php echo apply_filters( 'FHEE__registration_page_payment_options__select_other_method_of_payment_lnk', __( 'select a different method of payment:', 'event_espresso' )); ?></a>
29
+		<a id="reg-page-select-other-method-of-payment-lnk" class="hidden smaller-text right" rel=""><?php echo apply_filters('FHEE__registration_page_payment_options__select_other_method_of_payment_lnk', __('select a different method of payment:', 'event_espresso')); ?></a>
30 30
 	</div>
31 31
 	<!-- end #methods-of-payment -->
32 32
 
33
-	<?php  echo $after_payment_options;  ?>
33
+	<?php  echo $after_payment_options; ?>
34 34
 
35
-	<?php  echo $default_hidden_inputs;  ?>
36
-	<?php  echo $extra_hidden_inputs;  ?>
35
+	<?php  echo $default_hidden_inputs; ?>
36
+	<?php  echo $extra_hidden_inputs; ?>
37 37
 
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_venues-details.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,43 +1,43 @@
 block discarded – undo
1 1
 <?php //echo '<h1>' . __FILE__ . '</h1>'; ?>
2 2
 <?php global $post; ?>
3 3
 <div class="venue-content">
4
-<?php if ( apply_filters( 'FHEE__content_espresso_venues_details_template__display_entry_meta', TRUE )): ?>
4
+<?php if (apply_filters('FHEE__content_espresso_venues_details_template__display_entry_meta', TRUE)): ?>
5 5
 	<div class="entry-meta">
6
-		<span class="tags-links"><?php espresso_venue_categories( $post->ID, TRUE, TRUE ); ?></span>
6
+		<span class="tags-links"><?php espresso_venue_categories($post->ID, TRUE, TRUE); ?></span>
7 7
 		<?php
8
-			if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) :
8
+			if ( ! post_password_required() && (comments_open() || get_comments_number())) :
9 9
 		?>
10
-		<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'event_espresso' ), __( '1 Comment', 'event_espresso' ), __( '% Comments', 'event_espresso' ) ); ?></span>
10
+		<span class="comments-link"><?php comments_popup_link(__('Leave a comment', 'event_espresso'), __('1 Comment', 'event_espresso'), __('% Comments', 'event_espresso')); ?></span>
11 11
 		<?php
12 12
 			endif;
13 13
 
14
-			edit_post_link( __( 'Edit', 'event_espresso' ), '<span class="edit-link">', '</span>' );
14
+			edit_post_link(__('Edit', 'event_espresso'), '<span class="edit-link">', '</span>');
15 15
 		?>
16 16
 	</div>
17 17
 <?php  endif; ?>
18 18
 	
19 19
 	<h3 class="event-venues-h3 ee-event-h3">
20
-		<?php _e( 'Details', 'event_espresso' ); ?>
20
+		<?php _e('Details', 'event_espresso'); ?>
21 21
 	</h3>
22 22
 
23
-	<?php if ( $venue_phone = espresso_venue_phone( $post->ID, FALSE )) : ?>
23
+	<?php if ($venue_phone = espresso_venue_phone($post->ID, FALSE)) : ?>
24 24
 	<p>
25
-		<span class="small-text"><strong><?php _e( 'Venue Phone:', 'event_espresso' ); ?> </strong></span><?php echo $venue_phone; ?>
25
+		<span class="small-text"><strong><?php _e('Venue Phone:', 'event_espresso'); ?> </strong></span><?php echo $venue_phone; ?>
26 26
 	</p>
27 27
 	<?php endif; ?>
28
-	<?php if ( $venue_website = espresso_venue_website( $post->ID, FALSE )) : ?>
28
+	<?php if ($venue_website = espresso_venue_website($post->ID, FALSE)) : ?>
29 29
 	<p>
30
-		<span class="small-text"><strong><?php _e( 'Venue Website:', 'event_espresso' ); ?> </strong></span><?php echo $venue_website; ?>
30
+		<span class="small-text"><strong><?php _e('Venue Website:', 'event_espresso'); ?> </strong></span><?php echo $venue_website; ?>
31 31
 	</p>
32 32
 	<?php endif; ?>
33 33
 	<?php 
34
-	do_action( 'AHEE__content_espresso_venues_details_template__before_the_content', $post ); 
35
-	if ( is_archive() && has_excerpt( $post->ID )) {
34
+	do_action('AHEE__content_espresso_venues_details_template__before_the_content', $post); 
35
+	if (is_archive() && has_excerpt($post->ID)) {
36 36
 		the_excerpt();
37 37
 	} else {
38 38
 		the_content();
39 39
 	}
40
-	do_action( 'AHEE__content_espresso_venues_details_template__after_the_content', $post ); 
40
+	do_action('AHEE__content_espresso_venues_details_template__after_the_content', $post); 
41 41
 	?>
42 42
 </div>
43 43
 <!-- .venue-content -->
Please login to merge, or discard this patch.
core/db_models/EEM_Post_Meta.model.php 2 patches
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.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,20 +31,20 @@  discard block
 block discarded – undo
31 31
  *
32 32
  * ------------------------------------------------------------------------
33 33
  */
34
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
34
+require_once (EE_MODELS.'EEM_Base.model.php');
35 35
 
36 36
 class EEM_Post_Meta extends EEM_Base {
37 37
 
38 38
   	// private instance of the EE_Post_Meta object
39 39
 	protected static $_instance = NULL;
40 40
 
41
-	protected function __construct( $timezone = NULL ) {
42
-		$this->singular_item = __('Post Meta','event_espresso');
43
-		$this->plural_item = __('Post Metas','event_espresso');
41
+	protected function __construct($timezone = NULL) {
42
+		$this->singular_item = __('Post Meta', 'event_espresso');
43
+		$this->plural_item = __('Post Metas', 'event_espresso');
44 44
 		$this->_tables = array(
45 45
 			'Post_Meta'=> new EE_Primary_Table('postmeta', 'meta_id')
46 46
 		);
47
-		$models_this_can_attach_to = array_keys( EE_Registry::instance()->cpt_models() );
47
+		$models_this_can_attach_to = array_keys(EE_Registry::instance()->cpt_models());
48 48
 		$this->_fields = array(
49 49
 			'Post_Meta'=>array(
50 50
 				'meta_id'=>new EE_Primary_Key_Int_Field('meta_id', __("Meta ID", "event_espresso")),
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
 				'meta_value'=>new EE_Maybe_Serialized_Text_Field('meta_value', __("Meta Value", "event_espresso"), true)
54 54
 			));
55 55
 		$this->_model_relations = array();
56
-		foreach($models_this_can_attach_to as $model){
56
+		foreach ($models_this_can_attach_to as $model) {
57 57
 			$this->_model_relations[$model] = new EE_Belongs_To_Relation();
58 58
 		}
59
-		foreach( $this->cap_contexts_to_cap_action_map() as $cap_context => $action ) {
60
-			$this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( 'meta_key', 'meta_value' );
59
+		foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) {
60
+			$this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta('meta_key', 'meta_value');
61 61
 		}
62
-		parent::__construct( $timezone );
62
+		parent::__construct($timezone);
63 63
 	}
64 64
 
65 65
 
Please login to merge, or discard this patch.
admin_pages/venues/Venues_Admin_Page.core.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -944,7 +944,7 @@
 block discarded – undo
944 944
 	 * @access  private
945 945
 	 * @param  int $VNU_ID
946 946
 	 * @param  string $venue_status
947
-	 * @return void
947
+	 * @return boolean
948 948
 	 */
949 949
 	private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) {
950 950
 		// grab venue id
Please login to merge, or discard this patch.
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -893,8 +894,9 @@  discard block
 block discarded – undo
893 894
 		}
894 895
 		$action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
895 896
 
896
-		if ( $redirect_after )
897
-			$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
897
+		if ( $redirect_after ) {
898
+					$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
899
+		}
898 900
 
899 901
 	}
900 902
 
@@ -1013,8 +1015,9 @@  discard block
 block discarded – undo
1013 1015
 			$msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso');
1014 1016
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1015 1017
 		}
1016
-		if ( $redirect_after )
1017
-			$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1018
+		if ( $redirect_after ) {
1019
+					$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1020
+		}
1018 1021
 	}
1019 1022
 
1020 1023
 
@@ -1185,8 +1188,10 @@  discard block
 block discarded – undo
1185 1188
 	 * @return void
1186 1189
 	 */
1187 1190
 	private function _set_category_object() {
1188
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
1189
-			return; //already have the category object so get out.
1191
+		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) {
1192
+					return;
1193
+		}
1194
+		//already have the category object so get out.
1190 1195
 
1191 1196
 		//set default category object
1192 1197
 		$this->_set_empty_category_object();
Please login to merge, or discard this patch.
Spacing   +238 added lines, -238 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
 /**
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 
63 63
 
64 64
 	protected function _init_page_props() {
65
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
65
+		require_once(EE_MODELS.'EEM_Venue.model.php');
66 66
 		$this->page_slug = EE_VENUES_PG_SLUG;
67 67
 		$this->_admin_base_url = EE_VENUES_ADMIN_URL;
68
-		$this->_admin_base_path = EE_ADMIN_PAGES . 'venues';
68
+		$this->_admin_base_path = EE_ADMIN_PAGES.'venues';
69 69
 		$this->page_label = __('Event Venues', 'event_espresso');
70 70
 		$this->_cpt_model_names = array(
71 71
 			'create_new' => 'EEM_Venue',
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 				'edit' => __('Update Venue', 'event_espresso'),
109 109
 				'add_category' => __('Save New Category', 'event_espresso'),
110 110
 				'edit_category' => __('Update Category', 'event_espresso'),
111
-				'google_map_settings' => __( 'Update Settings', 'event_espresso' )
111
+				'google_map_settings' => __('Update Settings', 'event_espresso')
112 112
 				)
113 113
 		);
114 114
 	}
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 		//load field generator helper
124 124
 
125 125
 		//is there a vnu_id in the request?
126
-		$vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0;
127
-		$vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id;
126
+		$vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0;
127
+		$vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id;
128 128
 
129 129
 		$this->_page_routes = array(
130 130
 			'default' => array(
@@ -142,27 +142,27 @@  discard block
 block discarded – undo
142 142
 				),
143 143
 			'trash_venue' => array(
144 144
 				'func' => '_trash_or_restore_venue',
145
-				'args' => array( 'venue_status' => 'trash' ),
145
+				'args' => array('venue_status' => 'trash'),
146 146
 				'noheader' => TRUE,
147 147
 				'capability' => 'ee_delete_venue',
148 148
 				'obj_id' => $vnu_id
149 149
 				),
150 150
 			'trash_venues' => array(
151 151
 				'func' => '_trash_or_restore_venues',
152
-				'args' => array( 'venue_status' => 'trash' ),
152
+				'args' => array('venue_status' => 'trash'),
153 153
 				'noheader' => TRUE,
154 154
 				'capability' => 'ee_delete_venues'
155 155
 				),
156 156
 			'restore_venue' => array(
157 157
 				'func' => '_trash_or_restore_venue',
158
-				'args' => array( 'venue_status' => 'draft' ),
158
+				'args' => array('venue_status' => 'draft'),
159 159
 				'noheader' => TRUE,
160 160
 				'capability' => 'ee_delete_venue',
161 161
 				'obj_id' => $vnu_id
162 162
 				),
163 163
 			'restore_venues' => array(
164 164
 				'func' => '_trash_or_restore_venues',
165
-				'args' => array( 'venue_status' => 'draft' ),
165
+				'args' => array('venue_status' => 'draft'),
166 166
 				'noheader' => TRUE,
167 167
 				'capability' => 'ee_delete_venues'
168 168
 				),
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 						'filename' => 'venues_overview_views_bulk_actions_search'
265 265
 					)
266 266
 				),
267
-				'help_tour' => array( 'Venues_Overview_Help_Tour' ),
267
+				'help_tour' => array('Venues_Overview_Help_Tour'),
268 268
 				'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'),
269 269
 				'require_nonce' => FALSE
270 270
 			),
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 						'filename' => 'venues_editor_other'
301 301
 					)
302 302
 				),
303
-				'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ),
303
+				'help_tour' => array('Venues_Add_Venue_Help_Tour'),
304 304
 				'metaboxes' => array('_venue_editor_metaboxes'),
305 305
 				'require_nonce' => FALSE
306 306
 				),
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 					'label' => __('Edit Venue', 'event_espresso'),
310 310
 					'order' => 5,
311 311
 					'persistent' => FALSE,
312
-					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url )  : $this->_admin_base_url
312
+					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url
313 313
 				),
314 314
 				'help_tabs' => array(
315 315
 					'venues_editor_help_tab' => array(
@@ -346,14 +346,14 @@  discard block
 block discarded – undo
346 346
 					'label' => __('Google Maps'),
347 347
 					'order' => 40
348 348
 				),
349
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
349
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
350 350
 				'help_tabs' => array(
351 351
 					'general_settings_google_maps_help_tab' => array(
352 352
 						'title' => __('Google Maps', 'event_espresso'),
353 353
 						'filename' => 'general_settings_google_maps'
354 354
 					)
355 355
 				),
356
-				'help_tour' => array( 'Google_Maps_Help_Tour' ),
356
+				'help_tour' => array('Google_Maps_Help_Tour'),
357 357
 				'require_nonce' => FALSE
358 358
 			),
359 359
 			//venue category stuff
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 						'filename' => 'venues_add_category'
370 370
 					)
371 371
 				),
372
-				'help_tour' => array( 'Venues_Add_Category_Help_Tour' ),
372
+				'help_tour' => array('Venues_Add_Category_Help_Tour'),
373 373
 				'require_nonce' => FALSE
374 374
 				),
375 375
 			'edit_category' => array(
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 					'label' => __('Edit Category', 'event_espresso'),
378 378
 					'order' => 15,
379 379
 					'persistent' => FALSE,
380
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
380
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
381 381
 					),
382 382
 				'metaboxes' => array('_publish_post_box'),
383 383
 				'help_tabs' => array(
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 						'filename' => 'venues_categories_other'
414 414
 					)
415 415
 				),
416
-				'help_tour' => array( 'Venues_Categories_Help_Tour' ),
416
+				'help_tour' => array('Venues_Categories_Help_Tour'),
417 417
 				'metaboxes' => $this->_default_espresso_metaboxes,
418 418
 				'require_nonce' => FALSE
419 419
 				)
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 
471 471
 
472 472
 	public function load_scripts_styles() {
473
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
473
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
474 474
 		wp_enqueue_style('ee-cat-admin');
475 475
 	}
476 476
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	public function load_scripts_styles_edit() {
494 494
 		//styles
495 495
 		wp_enqueue_style('espresso-ui-theme');
496
-		wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION );
496
+		wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION);
497 497
 		wp_enqueue_style('espresso_venues');
498 498
 	}
499 499
 
@@ -512,13 +512,13 @@  discard block
 block discarded – undo
512 512
 				)
513 513
 		);
514 514
 
515
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) {
515
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) {
516 516
 			$this->_views['all']['bulk_action'] = array(
517 517
 				'trash_venues' => __('Move to Trash', 'event_espresso')
518 518
 			);
519 519
 			$this->_views['trash'] = array(
520 520
 				'slug' => 'trash',
521
-				'label' => __( 'Trash', 'event_espresso' ),
521
+				'label' => __('Trash', 'event_espresso'),
522 522
 				'count' => 0,
523 523
 				'bulk_action' => array(
524 524
 					'restore_venues' => __('Restore from Trash', 'event_espresso'),
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
 
552 552
 
553 553
 	protected function _overview_list_table() {
554
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
555
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button' );
554
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
555
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button');
556 556
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
557 557
 		$this->_search_btn_label = __('Venues', 'event_espresso');
558 558
 		$this->display_admin_list_table_page_with_sidebar();
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
 			'vnu_url' => $this->_cpt_model_obj->venue_url(),
567 567
 			'vnu_phone' => $this->_cpt_model_obj->phone()
568 568
 			);
569
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php';
570
-		EEH_Template::display_template( $template, $extra_rows );
569
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php';
570
+		EEH_Template::display_template($template, $extra_rows);
571 571
 	}
572 572
 
573 573
 
@@ -582,115 +582,115 @@  discard block
 block discarded – undo
582 582
 		$default_map_settings = new stdClass();
583 583
 		$default_map_settings->use_google_maps = TRUE;
584 584
 		// for event details pages (reg page)
585
-		$default_map_settings->event_details_map_width = 585; 			// ee_map_width_single
586
-		$default_map_settings->event_details_map_height = 362; 			// ee_map_height_single
587
-		$default_map_settings->event_details_map_zoom = 14; 			// ee_map_zoom_single
588
-		$default_map_settings->event_details_display_nav = TRUE; 			// ee_map_nav_display_single
589
-		$default_map_settings->event_details_nav_size = FALSE; 			// ee_map_nav_size_single
590
-		$default_map_settings->event_details_control_type = 'default'; 		// ee_map_type_control_single
591
-		$default_map_settings->event_details_map_align = 'center'; 			// ee_map_align_single
585
+		$default_map_settings->event_details_map_width = 585; // ee_map_width_single
586
+		$default_map_settings->event_details_map_height = 362; // ee_map_height_single
587
+		$default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single
588
+		$default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single
589
+		$default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single
590
+		$default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single
591
+		$default_map_settings->event_details_map_align = 'center'; // ee_map_align_single
592 592
 		// for event list pages
593
-		$default_map_settings->event_list_map_width = 300; 			// ee_map_width
594
-		$default_map_settings->event_list_map_height = 185; 		// ee_map_height
595
-		$default_map_settings->event_list_map_zoom = 12; 			// ee_map_zoom
596
-		$default_map_settings->event_list_display_nav = FALSE; 		// ee_map_nav_display
597
-		$default_map_settings->event_list_nav_size = TRUE; 			// ee_map_nav_size
598
-		$default_map_settings->event_list_control_type = 'dropdown'; 		// ee_map_type_control
599
-		$default_map_settings->event_list_map_align = 'center'; 			// ee_map_align
593
+		$default_map_settings->event_list_map_width = 300; // ee_map_width
594
+		$default_map_settings->event_list_map_height = 185; // ee_map_height
595
+		$default_map_settings->event_list_map_zoom = 12; // ee_map_zoom
596
+		$default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display
597
+		$default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size
598
+		$default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control
599
+		$default_map_settings->event_list_map_align = 'center'; // ee_map_align
600 600
 
601 601
 		$this->_template_args['map_settings'] =
602
-			isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings )
603
-				? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings )
602
+			isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings)
603
+				? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings)
604 604
 				: $default_map_settings;
605 605
 
606
-		$this->_set_add_edit_form_tags( 'update_google_map_settings' );
607
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
608
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', $this->_template_args, TRUE );
606
+		$this->_set_add_edit_form_tags('update_google_map_settings');
607
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
608
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_VENUES_TEMPLATE_PATH.'google_map.template.php', $this->_template_args, TRUE);
609 609
 		$this->display_admin_page_with_sidebar();
610 610
 	}
611 611
 
612 612
 	protected function _update_google_map_settings() {
613 613
 
614 614
 		EE_Registry::instance()->CFG->map_settings->use_google_maps =
615
-			isset( $this->_req_data['use_google_maps'] )
616
-				? absint( $this->_req_data['use_google_maps'] )
615
+			isset($this->_req_data['use_google_maps'])
616
+				? absint($this->_req_data['use_google_maps'])
617 617
 				: EE_Registry::instance()->CFG->map_settings->use_google_maps;
618 618
 
619 619
 		EE_Registry::instance()->CFG->map_settings->event_details_map_width =
620
-			isset( $this->_req_data['event_details_map_width'] )
621
-				? absint( $this->_req_data['event_details_map_width'] )
620
+			isset($this->_req_data['event_details_map_width'])
621
+				? absint($this->_req_data['event_details_map_width'])
622 622
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_width;
623 623
 
624 624
 		EE_Registry::instance()->CFG->map_settings->event_details_map_height =
625
-			isset( $this->_req_data['event_details_map_height'] )
626
-				? absint( $this->_req_data['event_details_map_height'] )
625
+			isset($this->_req_data['event_details_map_height'])
626
+				? absint($this->_req_data['event_details_map_height'])
627 627
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_height;
628 628
 
629 629
 		EE_Registry::instance()->CFG->map_settings->event_details_map_zoom =
630
-			isset( $this->_req_data['event_details_map_zoom'] )
631
-				? absint( $this->_req_data['event_details_map_zoom'] )
630
+			isset($this->_req_data['event_details_map_zoom'])
631
+				? absint($this->_req_data['event_details_map_zoom'])
632 632
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_zoom;
633 633
 
634 634
 		EE_Registry::instance()->CFG->map_settings->event_details_display_nav =
635
-			isset( $this->_req_data['event_details_display_nav'] )
636
-				? absint( $this->_req_data['event_details_display_nav'] )
635
+			isset($this->_req_data['event_details_display_nav'])
636
+				? absint($this->_req_data['event_details_display_nav'])
637 637
 				: EE_Registry::instance()->CFG->map_settings->event_details_display_nav;
638 638
 
639 639
 		EE_Registry::instance()->CFG->map_settings->event_details_nav_size =
640
-			isset( $this->_req_data['event_details_nav_size'] )
641
-				? absint( $this->_req_data['event_details_nav_size'] )
640
+			isset($this->_req_data['event_details_nav_size'])
641
+				? absint($this->_req_data['event_details_nav_size'])
642 642
 				: EE_Registry::instance()->CFG->map_settings->event_details_nav_size;
643 643
 
644 644
 		EE_Registry::instance()->CFG->map_settings->event_details_control_type =
645
-			isset( $this->_req_data['event_details_control_type'] )
646
-				? sanitize_text_field( $this->_req_data['event_details_control_type'] )
645
+			isset($this->_req_data['event_details_control_type'])
646
+				? sanitize_text_field($this->_req_data['event_details_control_type'])
647 647
 				: EE_Registry::instance()->CFG->map_settings->event_details_control_type;
648 648
 
649 649
 		EE_Registry::instance()->CFG->map_settings->event_details_map_align =
650
-			isset( $this->_req_data['event_details_map_align'] )
651
-				? sanitize_text_field( $this->_req_data['event_details_map_align'] )
650
+			isset($this->_req_data['event_details_map_align'])
651
+				? sanitize_text_field($this->_req_data['event_details_map_align'])
652 652
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_align;
653 653
 
654 654
 		EE_Registry::instance()->CFG->map_settings->event_list_map_width =
655
-			isset( $this->_req_data['event_list_map_width'] )
656
-				? absint( $this->_req_data['event_list_map_width'] )
655
+			isset($this->_req_data['event_list_map_width'])
656
+				? absint($this->_req_data['event_list_map_width'])
657 657
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_width;
658 658
 
659 659
 		EE_Registry::instance()->CFG->map_settings->event_list_map_height =
660
-			isset( $this->_req_data['event_list_map_height'] )
661
-				? absint( $this->_req_data['event_list_map_height'] )
660
+			isset($this->_req_data['event_list_map_height'])
661
+				? absint($this->_req_data['event_list_map_height'])
662 662
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_height;
663 663
 
664 664
 		EE_Registry::instance()->CFG->map_settings->event_list_map_zoom =
665
-			isset( $this->_req_data['event_list_map_zoom'] )
666
-				? absint( $this->_req_data['event_list_map_zoom'] )
665
+			isset($this->_req_data['event_list_map_zoom'])
666
+				? absint($this->_req_data['event_list_map_zoom'])
667 667
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_zoom;
668 668
 
669 669
 		EE_Registry::instance()->CFG->map_settings->event_list_display_nav =
670
-			isset( $this->_req_data['event_list_display_nav'] )
671
-				? absint( $this->_req_data['event_list_display_nav'] )
670
+			isset($this->_req_data['event_list_display_nav'])
671
+				? absint($this->_req_data['event_list_display_nav'])
672 672
 				: EE_Registry::instance()->CFG->map_settings->event_list_display_nav;
673 673
 
674 674
 		EE_Registry::instance()->CFG->map_settings->event_list_nav_size =
675
-			isset( $this->_req_data['event_list_nav_size'] )
676
-				? absint( $this->_req_data['event_list_nav_size'] )
675
+			isset($this->_req_data['event_list_nav_size'])
676
+				? absint($this->_req_data['event_list_nav_size'])
677 677
 				: EE_Registry::instance()->CFG->map_settings->event_list_nav_size;
678 678
 
679 679
 		EE_Registry::instance()->CFG->map_settings->event_list_control_type =
680
-			isset( $this->_req_data['event_list_control_type'] )
681
-				? sanitize_text_field( $this->_req_data['event_list_control_type'] )
680
+			isset($this->_req_data['event_list_control_type'])
681
+				? sanitize_text_field($this->_req_data['event_list_control_type'])
682 682
 				: EE_Registry::instance()->CFG->map_settings->event_list_control_type;
683 683
 
684 684
 		EE_Registry::instance()->CFG->map_settings->event_list_map_align =
685
-			isset( $this->_req_data['event_list_map_align'] )
686
-				? sanitize_text_field( $this->_req_data['event_list_map_align'] )
685
+			isset($this->_req_data['event_list_map_align'])
686
+				? sanitize_text_field($this->_req_data['event_list_map_align'])
687 687
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_align;
688 688
 
689
-		EE_Registry::instance()->CFG->map_settings = apply_filters( 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings );
689
+		EE_Registry::instance()->CFG->map_settings = apply_filters('FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings);
690 690
 
691 691
 		$what = 'Google Map Settings';
692
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__ );
693
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) );
692
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__);
693
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings'));
694 694
 
695 695
 	}
696 696
 
@@ -699,9 +699,9 @@  discard block
 block discarded – undo
699 699
 	protected function _venue_editor_metaboxes() {
700 700
 		$this->verify_cpt_object();
701 701
 
702
-		add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' );
703
-		add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' );
704
-		add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' );
702
+		add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default');
703
+		add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default');
704
+		add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default');
705 705
 
706 706
 	}
707 707
 
@@ -709,23 +709,23 @@  discard block
 block discarded – undo
709 709
 
710 710
 	public function venue_gmap_metabox() {
711 711
 		$template_args = array(
712
-			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap() ),
712
+			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap()),
713 713
 			'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(),
714 714
 			);
715
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php';
716
-		EEH_Template::display_template( $template, $template_args );
715
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php';
716
+		EEH_Template::display_template($template, $template_args);
717 717
 	}
718 718
 
719 719
 
720 720
 
721 721
 	public function venue_address_metabox() {
722 722
 
723
-		$template_args['_venue'] =$this->_cpt_model_obj;
723
+		$template_args['_venue'] = $this->_cpt_model_obj;
724 724
 
725 725
 		$template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input(
726 726
 			$QFI = new EE_Question_Form_Input(
727
-				EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )),
728
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->state_ID() )),
727
+				EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')),
728
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())),
729 729
 				array(
730 730
 					'input_name' =>  'sta_id',
731 731
 					'input_id' => 'sta_id',
@@ -737,8 +737,8 @@  discard block
 block discarded – undo
737 737
 		);
738 738
 		$template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input(
739 739
 			$QFI = new EE_Question_Form_Input(
740
-				EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )),
741
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->country_ID() )),
740
+				EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')),
741
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())),
742 742
 				array(
743 743
 					'input_name' =>  'cnt_iso',
744 744
 					'input_id' => 'cnt_iso',
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
 			)
750 750
 		);
751 751
 
752
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php';
753
-		EEH_Template::display_template( $template, $template_args );
752
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php';
753
+		EEH_Template::display_template($template, $template_args);
754 754
 	}
755 755
 
756 756
 
@@ -762,8 +762,8 @@  discard block
 block discarded – undo
762 762
 		$template_args = array(
763 763
 			'_venue' => $this->_cpt_model_obj
764 764
 			);
765
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php';
766
-		EEH_Template::display_template( $template, $template_args );
765
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php';
766
+		EEH_Template::display_template($template, $template_args);
767 767
 	}
768 768
 
769 769
 
@@ -786,52 +786,52 @@  discard block
 block discarded – undo
786 786
 	 * @param  object $post    Post object (with "blessed" WP properties)
787 787
 	 * @return void
788 788
 	 */
789
-	protected function _insert_update_cpt_item( $post_id, $post ) {
789
+	protected function _insert_update_cpt_item($post_id, $post) {
790 790
 
791
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_venues' ) {
792
-			return;// get out we're not processing the saving of venues.
791
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') {
792
+			return; // get out we're not processing the saving of venues.
793 793
 		}
794 794
 
795
-		$wheres = array( $this->_venue_model->primary_key_name() => $post_id );
795
+		$wheres = array($this->_venue_model->primary_key_name() => $post_id);
796 796
 
797 797
 		$venue_values = array(
798
-			'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL,
799
-			'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL,
800
-			'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL,
801
-			'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL,
802
-			'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL,
803
-			'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL,
804
-			'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL,
805
-			'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : EE_INF,
806
-			'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL,
807
-			'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL,
808
-			'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL,
809
-			'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE,
810
-			'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL
798
+			'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL,
799
+			'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL,
800
+			'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL,
801
+			'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL,
802
+			'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL,
803
+			'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL,
804
+			'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL,
805
+			'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : EE_INF,
806
+			'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL,
807
+			'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL,
808
+			'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL,
809
+			'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE,
810
+			'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL
811 811
 			);
812 812
 
813 813
 		//update venue
814
-		$success = $this->_venue_model->update( $venue_values, array( $wheres ) );
814
+		$success = $this->_venue_model->update($venue_values, array($wheres));
815 815
 
816 816
 		//get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
817
-		$get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status  );
818
-		$venue = $this->_venue_model->get_one( array( $get_one_where ) );
817
+		$get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status);
818
+		$venue = $this->_venue_model->get_one(array($get_one_where));
819 819
 
820 820
 		//notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use.  So this is just here for addons to more easily hook into venue saves.
821
-		$venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() );
821
+		$venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array());
822 822
 
823 823
 		$att_success = TRUE;
824 824
 
825
-		foreach ( $venue_update_callbacks as $v_callback ) {
826
-			$_succ = call_user_func_array( $v_callback, array( $venue,  $this->_req_data ) );
827
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
825
+		foreach ($venue_update_callbacks as $v_callback) {
826
+			$_succ = call_user_func_array($v_callback, array($venue, $this->_req_data));
827
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
828 828
 		}
829 829
 
830 830
 		//any errors?
831
-		if ( $success && !$att_success ) {
832
-			EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
833
-		} else if ( $success === FALSE ) {
834
-			EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
831
+		if ($success && ! $att_success) {
832
+			EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
833
+		} else if ($success === FALSE) {
834
+			EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
835 835
 		}
836 836
 	}
837 837
 
@@ -839,9 +839,9 @@  discard block
 block discarded – undo
839 839
 
840 840
 
841 841
 
842
-	public function trash_cpt_item( $post_id ) {
842
+	public function trash_cpt_item($post_id) {
843 843
 		$this->_req_data['VNU_ID'] = $post_id;
844
-		$this->_trash_or_restore_venue( 'trash', FALSE );
844
+		$this->_trash_or_restore_venue('trash', FALSE);
845 845
 	}
846 846
 
847 847
 
@@ -849,18 +849,18 @@  discard block
 block discarded – undo
849 849
 
850 850
 
851 851
 
852
-	public function restore_cpt_item( $post_id ) {
852
+	public function restore_cpt_item($post_id) {
853 853
 		$this->_req_data['VNU_ID'] = $post_id;
854
-		$this->_trash_or_restore_venue( 'draft', FALSE );
854
+		$this->_trash_or_restore_venue('draft', FALSE);
855 855
 	}
856 856
 
857 857
 
858 858
 
859 859
 
860 860
 
861
-	public function delete_cpt_item( $post_id ) {
861
+	public function delete_cpt_item($post_id) {
862 862
 		$this->_req_data['VNU_ID'] = $post_id;
863
-		$this->_delete_venue( FALSE );
863
+		$this->_delete_venue(FALSE);
864 864
 	}
865 865
 
866 866
 
@@ -875,15 +875,15 @@  discard block
 block discarded – undo
875 875
 
876 876
 
877 877
 
878
-	protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) {
879
-		$VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE;
878
+	protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) {
879
+		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE;
880 880
 
881 881
 		//loop thru venues
882
-		if ( $VNU_ID ) {
882
+		if ($VNU_ID) {
883 883
 			//clean status
884
-			$venue_status = sanitize_key( $venue_status );
884
+			$venue_status = sanitize_key($venue_status);
885 885
 			// grab status
886
-			if (!empty($venue_status)) {
886
+			if ( ! empty($venue_status)) {
887 887
 				$success = $this->_change_venue_status($VNU_ID, $venue_status);
888 888
 			} else {
889 889
 				$success = FALSE;
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 		}
898 898
 		$action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
899 899
 
900
-		if ( $redirect_after )
900
+		if ($redirect_after)
901 901
 			$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
902 902
 
903 903
 	}
@@ -906,11 +906,11 @@  discard block
 block discarded – undo
906 906
 
907 907
 
908 908
 
909
-	protected function _trash_or_restore_venues( $venue_status = 'trash' ) {
909
+	protected function _trash_or_restore_venues($venue_status = 'trash') {
910 910
 		// clean status
911 911
 		$venue_status = sanitize_key($venue_status);
912 912
 		// grab status
913
-		if (!empty($venue_status)) {
913
+		if ( ! empty($venue_status)) {
914 914
 			$success = TRUE;
915 915
 			//determine the event id and set to array.
916 916
 			$VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array();
@@ -950,20 +950,20 @@  discard block
 block discarded – undo
950 950
 	 * @param  string $venue_status
951 951
 	 * @return void
952 952
 	 */
953
-	private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) {
953
+	private function _change_venue_status($VNU_ID = 0, $venue_status = '') {
954 954
 		// grab venue id
955
-		if (! $VNU_ID) {
955
+		if ( ! $VNU_ID) {
956 956
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
957 957
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
958 958
 			return FALSE;
959 959
 		}
960 960
 
961
-		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
961
+		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
962 962
 
963 963
 		// clean status
964 964
 		$venue_status = sanitize_key($venue_status);
965 965
 		// grab status
966
-		if ( ! $venue_status ) {
966
+		if ( ! $venue_status) {
967 967
 			$msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso');
968 968
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
969 969
 			return FALSE;
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 				$hook = FALSE;
985 985
 		}
986 986
 		//use class to change status
987
-		$this->_cpt_model_obj->set_status( $venue_status );
987
+		$this->_cpt_model_obj->set_status($venue_status);
988 988
 		$success = $this->_cpt_model_obj->save();
989 989
 
990 990
 		if ($success === FALSE) {
@@ -1003,21 +1003,21 @@  discard block
 block discarded – undo
1003 1003
 	 * @param  bool $redirect_after
1004 1004
 	 * @return void
1005 1005
 	 */
1006
-	protected function _delete_venue( $redirect_after = true ) {
1006
+	protected function _delete_venue($redirect_after = true) {
1007 1007
 		//determine the venue id and set to array.
1008 1008
 		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL;
1009
-		$VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID;
1009
+		$VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID;
1010 1010
 
1011 1011
 
1012 1012
 		// loop thru venues
1013 1013
 		if ($VNU_ID) {
1014
-			$success = $this->_delete_or_trash_venue( $VNU_ID );
1014
+			$success = $this->_delete_or_trash_venue($VNU_ID);
1015 1015
 		} else {
1016 1016
 			$success = FALSE;
1017 1017
 			$msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso');
1018 1018
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1019 1019
 		}
1020
-		if ( $redirect_after )
1020
+		if ($redirect_after)
1021 1021
 			$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1022 1022
 	}
1023 1023
 
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
 	//todo: put in parent
1050 1050
 	private function _delete_or_trash_venue($VNU_ID = FALSE) {
1051 1051
 		// grab event id
1052
-		if (!$VNU_ID = absint($VNU_ID)) {
1052
+		if ( ! $VNU_ID = absint($VNU_ID)) {
1053 1053
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
1054 1054
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1055 1055
 			return FALSE;
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1070 1070
 			return FALSE;
1071 1071
 		}
1072
-		do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' );
1072
+		do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted');
1073 1073
 		return TRUE;
1074 1074
 	}
1075 1075
 
@@ -1080,11 +1080,11 @@  discard block
 block discarded – undo
1080 1080
 	/* QUERIES */
1081 1081
 
1082 1082
 
1083
-	public function get_venues( $per_page = 10, $count = FALSE ) {
1083
+	public function get_venues($per_page = 10, $count = FALSE) {
1084 1084
 
1085
-		$_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : '';
1085
+		$_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1086 1086
 
1087
-		switch ( $_orderby ) {
1087
+		switch ($_orderby) {
1088 1088
 			case 'id':
1089 1089
 				$orderby = 'VNU_ID';
1090 1090
 				break;
@@ -1102,43 +1102,43 @@  discard block
 block discarded – undo
1102 1102
 		}
1103 1103
 
1104 1104
 
1105
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
1105
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
1106 1106
 
1107
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1108
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
1109
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1107
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1108
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
1109
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1110 1110
 
1111 1111
 
1112
-		$offset = ($current_page-1)*$per_page;
1112
+		$offset = ($current_page - 1) * $per_page;
1113 1113
 		$limit = array($offset, $per_page);
1114 1114
 
1115
-		$category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1115
+		$category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1116 1116
 		$where = array();
1117 1117
 
1118 1118
 		//only set initial status if it is in the incoming request.  Otherwise the "all" view display's all statuses.
1119
-		if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) {
1119
+		if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') {
1120 1120
 			$where['status'] = $this->_req_data['status'];
1121 1121
 		}
1122 1122
 
1123
-		if ( isset( $this->_req_data['venue_status'] ) ) {
1123
+		if (isset($this->_req_data['venue_status'])) {
1124 1124
 			$where['status'] = $this->_req_data['venue_status'];
1125 1125
 		}
1126 1126
 
1127 1127
 
1128
-		if ( $category ) {
1128
+		if ($category) {
1129 1129
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories';
1130 1130
 			$where['Term_Taxonomy.term_id'] = $category;
1131 1131
 		}
1132 1132
 
1133 1133
 
1134
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) {
1135
-			$where['VNU_wp_user'] =  get_current_user_id();
1134
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) {
1135
+			$where['VNU_wp_user'] = get_current_user_id();
1136 1136
 		} else {
1137
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) {
1137
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) {
1138 1138
 					$where['OR'] = array(
1139
-						'status*restrict_private' => array( '!=', 'private' ),
1139
+						'status*restrict_private' => array('!=', 'private'),
1140 1140
 						'AND'                     => array(
1141
-							'status*inclusive' => array( '=', 'private' ),
1141
+							'status*inclusive' => array('=', 'private'),
1142 1142
 							'VNU_wp_user'      => get_current_user_id()
1143 1143
 						)
1144 1144
 					);
@@ -1148,30 +1148,30 @@  discard block
 block discarded – undo
1148 1148
 
1149 1149
 
1150 1150
 
1151
-		if ( isset( $this->_req_data['s'] ) ) {
1152
-			$sstr = '%' . $this->_req_data['s'] . '%';
1151
+		if (isset($this->_req_data['s'])) {
1152
+			$sstr = '%'.$this->_req_data['s'].'%';
1153 1153
 			$where['OR'] = array(
1154
-				'VNU_name' => array('LIKE',$sstr ),
1155
-				'VNU_desc' => array('LIKE',$sstr ),
1156
-				'VNU_short_desc' => array( 'LIKE',$sstr ),
1157
-				'VNU_address' => array( 'LIKE', $sstr ),
1158
-				'VNU_address2' => array( 'LIKE', $sstr ),
1159
-				'VNU_city' => array( 'LIKE', $sstr ),
1160
-				'VNU_zip' => array( 'LIKE', $sstr ),
1161
-				'VNU_phone' => array( 'LIKE', $sstr ),
1162
-				'VNU_url' => array( 'LIKE', $sstr ),
1163
-				'VNU_virtual_phone' => array( 'LIKE', $sstr ),
1164
-				'VNU_virtual_url' => array( 'LIKE', $sstr ),
1165
-				'VNU_google_map_link' => array( 'LIKE', $sstr ),
1166
-				'Event.EVT_name' => array('LIKE', $sstr ),
1167
-				'Event.EVT_desc' => array('LIKE', $sstr ),
1168
-				'Event.EVT_phone' => array('LIKE', $sstr ),
1169
-				'Event.EVT_external_URL' => array('LIKE', $sstr ),
1154
+				'VNU_name' => array('LIKE', $sstr),
1155
+				'VNU_desc' => array('LIKE', $sstr),
1156
+				'VNU_short_desc' => array('LIKE', $sstr),
1157
+				'VNU_address' => array('LIKE', $sstr),
1158
+				'VNU_address2' => array('LIKE', $sstr),
1159
+				'VNU_city' => array('LIKE', $sstr),
1160
+				'VNU_zip' => array('LIKE', $sstr),
1161
+				'VNU_phone' => array('LIKE', $sstr),
1162
+				'VNU_url' => array('LIKE', $sstr),
1163
+				'VNU_virtual_phone' => array('LIKE', $sstr),
1164
+				'VNU_virtual_url' => array('LIKE', $sstr),
1165
+				'VNU_google_map_link' => array('LIKE', $sstr),
1166
+				'Event.EVT_name' => array('LIKE', $sstr),
1167
+				'Event.EVT_desc' => array('LIKE', $sstr),
1168
+				'Event.EVT_phone' => array('LIKE', $sstr),
1169
+				'Event.EVT_external_URL' => array('LIKE', $sstr),
1170 1170
 				);
1171 1171
 		}
1172 1172
 
1173 1173
 
1174
-		$venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) );
1174
+		$venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort));
1175 1175
 
1176 1176
 		return $venues;
1177 1177
 
@@ -1189,22 +1189,22 @@  discard block
 block discarded – undo
1189 1189
 	 * @return void
1190 1190
 	 */
1191 1191
 	private function _set_category_object() {
1192
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
1192
+		if (isset($this->_category->id) && ! empty($this->_category->id))
1193 1193
 			return; //already have the category object so get out.
1194 1194
 
1195 1195
 		//set default category object
1196 1196
 		$this->_set_empty_category_object();
1197 1197
 
1198 1198
 		//only set if we've got an id
1199
-		if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) {
1199
+		if ( ! isset($this->_req_data['VEN_CAT_ID'])) {
1200 1200
 			return;
1201 1201
 		}
1202 1202
 
1203 1203
 		$category_id = absint($this->_req_data['VEN_CAT_ID']);
1204
-		$term = get_term( $category_id, 'espresso_venue_categories' );
1204
+		$term = get_term($category_id, 'espresso_venue_categories');
1205 1205
 
1206 1206
 
1207
-		if ( !empty( $term ) ) {
1207
+		if ( ! empty($term)) {
1208 1208
 			$this->_category->category_name = $term->name;
1209 1209
 			$this->_category->category_identifier = $term->slug;
1210 1210
 			$this->_category->category_desc = $term->description;
@@ -1218,14 +1218,14 @@  discard block
 block discarded – undo
1218 1218
 
1219 1219
 	private function _set_empty_category_object() {
1220 1220
 		$this->_category = new stdClass();
1221
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
1221
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
1222 1222
 		$this->_category->id = $this->_category->parent = 0;
1223 1223
 	}
1224 1224
 
1225 1225
 
1226 1226
 
1227 1227
 	protected function _category_list_table() {
1228
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1228
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1229 1229
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
1230 1230
 		$this->_search_btn_label = __('Venue Categories', 'event_espresso');
1231 1231
 		$this->display_admin_list_table_page_with_sidebar();
@@ -1241,13 +1241,13 @@  discard block
 block discarded – undo
1241 1241
 		$this->_set_add_edit_form_tags($route);
1242 1242
 
1243 1243
 		$this->_set_category_object();
1244
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
1244
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
1245 1245
 
1246 1246
 		$delete_action = 'delete_category';
1247 1247
 
1248
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url );
1248
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
1249 1249
 
1250
-		$this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect );
1250
+		$this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect);
1251 1251
 
1252 1252
 		//take care of contents
1253 1253
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -1261,25 +1261,25 @@  discard block
 block discarded – undo
1261 1261
 			'type' => 'wp_editor',
1262 1262
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
1263 1263
 			'class' => 'my_editor_custom',
1264
-			'wpeditor_args' => array( 'media_buttons' => FALSE )
1264
+			'wpeditor_args' => array('media_buttons' => FALSE)
1265 1265
 		);
1266
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
1266
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
1267 1267
 
1268
-		$all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
1268
+		$all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
1269 1269
 
1270 1270
 		//setup category select for term parents.
1271 1271
 		$category_select_values[] = array(
1272 1272
 			'text' => __('No Parent', 'event_espresso'),
1273 1273
 			'id' => 0
1274 1274
 			);
1275
-		foreach ( $all_terms as $term ) {
1275
+		foreach ($all_terms as $term) {
1276 1276
 			$category_select_values[] = array(
1277 1277
 				'text' => $term->name,
1278 1278
 				'id' => $term->term_id
1279 1279
 				);
1280 1280
 		}
1281 1281
 
1282
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
1282
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
1283 1283
 		$template_args = array(
1284 1284
 			'category' => $this->_category,
1285 1285
 			'category_select' => $category_select,
@@ -1288,15 +1288,15 @@  discard block
 block discarded – undo
1288 1288
 			'disable' => '',
1289 1289
 			'disabled_message' =>FALSE
1290 1290
 			);
1291
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
1292
-		return EEH_Template::display_template($template, $template_args, TRUE );
1291
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
1292
+		return EEH_Template::display_template($template, $template_args, TRUE);
1293 1293
 	}
1294 1294
 
1295 1295
 
1296 1296
 	protected function _delete_categories() {
1297
-		$cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1297
+		$cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1298 1298
 
1299
-		foreach ( $cat_ids as $cat_id ) {
1299
+		foreach ($cat_ids as $cat_id) {
1300 1300
 			$this->_delete_category($cat_id);
1301 1301
 		}
1302 1302
 
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
 		$query_args = array(
1305 1305
 			'action' => 'category_list'
1306 1306
 			);
1307
-		$this->_redirect_after_action(0,'','',$query_args);
1307
+		$this->_redirect_after_action(0, '', '', $query_args);
1308 1308
 
1309 1309
 	}
1310 1310
 
@@ -1313,58 +1313,58 @@  discard block
 block discarded – undo
1313 1313
 
1314 1314
 
1315 1315
 	protected function _delete_category($cat_id) {
1316
-		$cat_id = absint( $cat_id );
1317
-		wp_delete_term( $cat_id, 'espresso_venue_categories' );
1316
+		$cat_id = absint($cat_id);
1317
+		wp_delete_term($cat_id, 'espresso_venue_categories');
1318 1318
 	}
1319 1319
 
1320 1320
 
1321 1321
 
1322 1322
 	protected function _insert_or_update_category($new_category) {
1323 1323
 
1324
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
1324
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
1325 1325
 		$success = 0; //we already have a success message so lets not send another.
1326
-		if ( $cat_id ) {
1326
+		if ($cat_id) {
1327 1327
 			$query_args = array(
1328 1328
 				'action'     => 'edit_category',
1329 1329
 				'VEN_CAT_ID' => $cat_id
1330 1330
 			);
1331 1331
 		} else {
1332
-			$query_args = array( 'action' => 'add_category' );
1332
+			$query_args = array('action' => 'add_category');
1333 1333
 		}
1334
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
1334
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
1335 1335
 
1336 1336
 	}
1337 1337
 
1338 1338
 
1339 1339
 
1340
-	private function _insert_category( $update = FALSE ) {
1340
+	private function _insert_category($update = FALSE) {
1341 1341
 		$cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : '';
1342
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
1343
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
1344
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
1342
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
1343
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
1344
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
1345 1345
 
1346
-		if ( empty( $category_name ) ) {
1347
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
1348
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1346
+		if (empty($category_name)) {
1347
+			$msg = __('You must add a name for the category.', 'event_espresso');
1348
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1349 1349
 			return false;
1350 1350
 		}
1351 1351
 
1352 1352
 
1353
-		$term_args=array(
1353
+		$term_args = array(
1354 1354
 			'name'=>$category_name,
1355 1355
 			'description'=>$category_desc,
1356 1356
 			'parent'=>$category_parent
1357 1357
 		);
1358 1358
 
1359
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args );
1359
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args);
1360 1360
 
1361
-		if ( !is_array( $insert_ids ) ) {
1362
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
1363
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1361
+		if ( ! is_array($insert_ids)) {
1362
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
1363
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1364 1364
 		} else {
1365 1365
 			$cat_id = $insert_ids['term_id'];
1366
-			$msg = sprintf ( __('The category %s was successfuly created', 'event_espresso'), $category_name );
1367
-			EE_Error::add_success( $msg );
1366
+			$msg = sprintf(__('The category %s was successfuly created', 'event_espresso'), $category_name);
1367
+			EE_Error::add_success($msg);
1368 1368
 		}
1369 1369
 
1370 1370
 		return $cat_id;
@@ -1384,11 +1384,11 @@  discard block
 block discarded – undo
1384 1384
 			'category_ids' => $this->_req_data['VEN_CAT_ID']
1385 1385
 			);
1386 1386
 
1387
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
1387
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
1388 1388
 
1389
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) {
1390
-			require_once( EE_CLASSES . 'EE_Export.class.php');
1391
-			$EE_Export = EE_Export::instance( $this->_req_data );
1389
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
1390
+			require_once(EE_CLASSES.'EE_Export.class.php');
1391
+			$EE_Export = EE_Export::instance($this->_req_data);
1392 1392
 			$EE_Export->export();
1393 1393
 		}
1394 1394
 
@@ -1400,7 +1400,7 @@  discard block
 block discarded – undo
1400 1400
 
1401 1401
 	protected function _import_categories() {
1402 1402
 
1403
-		require_once(EE_CLASSES . 'EE_Import.class.php');
1403
+		require_once(EE_CLASSES.'EE_Import.class.php');
1404 1404
 		EE_Import::instance()->import();
1405 1405
 
1406 1406
 	}
@@ -1408,29 +1408,29 @@  discard block
 block discarded – undo
1408 1408
 
1409 1409
 
1410 1410
 
1411
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
1411
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
1412 1412
 
1413 1413
 		//testing term stuff
1414
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
1415
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
1416
-		$limit = ($current_page-1)*$per_page;
1417
-		$where = array( 'taxonomy' => 'espresso_venue_categories' );
1418
-		if ( isset( $this->_req_data['s'] ) ) {
1419
-			$sstr = '%' . $this->_req_data['s'] . '%';
1414
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
1415
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
1416
+		$limit = ($current_page - 1) * $per_page;
1417
+		$where = array('taxonomy' => 'espresso_venue_categories');
1418
+		if (isset($this->_req_data['s'])) {
1419
+			$sstr = '%'.$this->_req_data['s'].'%';
1420 1420
 			$where['OR'] = array(
1421
-				'Term.name' => array( 'LIKE', $sstr),
1422
-				'description' => array( 'LIKE', $sstr )
1421
+				'Term.name' => array('LIKE', $sstr),
1422
+				'description' => array('LIKE', $sstr)
1423 1423
 				);
1424 1424
 		}
1425 1425
 
1426 1426
 		$query_params = array(
1427 1427
 			$where,
1428
-			'order_by' => array( $orderby => $order ),
1429
-			'limit' => $limit . ',' . $per_page,
1428
+			'order_by' => array($orderby => $order),
1429
+			'limit' => $limit.','.$per_page,
1430 1430
 			'force_join' => array('Term')
1431 1431
 			);
1432 1432
 
1433
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
1433
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
1434 1434
 
1435 1435
 		return $categories;
1436 1436
 	}
Please login to merge, or discard this patch.