Completed
Branch FET-9576-iframes (7043fb)
by
unknown
486:30 queued 469:44
created
libraries/form_sections/strategies/EE_Form_Input_Strategy_Base.strategy.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@  discard block
 block discarded – undo
3 3
  * base class for all strategies which operate on form inputs. Generally, they
4 4
  * all need to know about the form input they are operating on.
5 5
  */
6
-abstract class EE_Form_Input_Strategy_Base{
6
+abstract class EE_Form_Input_Strategy_Base {
7 7
 	/**
8 8
 	 * Form Input to display
9 9
 	 * @var EE_Form_Input_Base
10 10
 	 */
11 11
 	protected $_input;
12 12
 	
13
-	function __construct(){
13
+	function __construct() {
14 14
 		
15 15
 	}
16 16
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * The form input on which this strategy is to perform
19 19
 	 * @param EE_Form_Input_Base $form_input
20 20
 	 */
21
-	function _construct_finalize(EE_Form_Input_Base $form_input){
21
+	function _construct_finalize(EE_Form_Input_Base $form_input) {
22 22
 		$this->_input = $form_input;
23 23
 	}
24 24
 	
Please login to merge, or discard this patch.
strategies/display/EE_Compound_Input_Display_Strategy.strategy.php 1 patch
Spacing   +8 added lines, -8 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
 
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 	 * @param bool   $add_pound_sign
28 28
 	 * @return string
29 29
 	 */
30
-	public function get_sub_input_id( $option_value, $add_pound_sign = false ) {
31
-		return $this->_append_chars( $this->_input->html_id( $add_pound_sign ), '-' ) . sanitize_key( $option_value );
30
+	public function get_sub_input_id($option_value, $add_pound_sign = false) {
31
+		return $this->_append_chars($this->_input->html_id($add_pound_sign), '-').sanitize_key($option_value);
32 32
 	}
33 33
 
34 34
 
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 	 * @return array
41 41
 	 * @throws \EE_Error
42 42
 	 */
43
-	public function get_html_input_ids( $add_pound_sign = false ) {
43
+	public function get_html_input_ids($add_pound_sign = false) {
44 44
 		$html_input_ids = array();
45
-		foreach( $this->get_input()->options() as $value => $display ) {
46
-			$html_input_ids[] = $this->get_sub_input_id( $value, $add_pound_sign );
45
+		foreach ($this->get_input()->options() as $value => $display) {
46
+			$html_input_ids[] = $this->get_sub_input_id($value, $add_pound_sign);
47 47
 		}
48 48
 		return $html_input_ids;
49 49
 	}
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 * @throws \EE_Error
59 59
 	 */
60 60
 	public function get_input() {
61
-		if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base ){
61
+		if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base) {
62 62
 			throw new EE_Error(
63 63
 				sprintf(
64 64
 					__(
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_To_Generate_From_Queue.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 	 * @param EE_Messages_Queue $queue
26 26
 	 * @param string            $custom_subject  Used if a custom subject is desired for the generated aggregate EE_Message object
27 27
 	 */
28
-	public function __construct( $messenger_name, $message_type_name, EE_Messages_Queue $queue, $custom_subject = '' ) {
28
+	public function __construct($messenger_name, $message_type_name, EE_Messages_Queue $queue, $custom_subject = '') {
29 29
 		$this->queue = $queue;
30
-		parent::__construct( $messenger_name, $message_type_name, array(), '', false, EEM_Message::status_idle );
31
-		if ( $this->valid() ) {
32
-			$this->_message->set_content( $this->_get_content() );
33
-			$this->_message->set_subject( $this->_get_subject( $custom_subject ) );
30
+		parent::__construct($messenger_name, $message_type_name, array(), '', false, EEM_Message::status_idle);
31
+		if ($this->valid()) {
32
+			$this->_message->set_content($this->_get_content());
33
+			$this->_message->set_subject($this->_get_subject($custom_subject));
34 34
 		}
35 35
 	}
36 36
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	protected function _get_content() {
45 45
 		$content = '';
46 46
 		$this->queue->get_message_repository()->rewind();
47
-		while ( $this->queue->get_message_repository()->valid() ) {
47
+		while ($this->queue->get_message_repository()->valid()) {
48 48
 			$content .= $this->queue->get_message_repository()->current()->content();
49 49
 			$this->queue->get_message_repository()->next();
50 50
 		}
@@ -58,15 +58,15 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @return string
60 60
 	 */
61
-	protected function _get_subject( $custom_subject = '' ) {
62
-		if ( ! empty( $custom_subject ) ) {
61
+	protected function _get_subject($custom_subject = '') {
62
+		if ( ! empty($custom_subject)) {
63 63
 			return $custom_subject;
64 64
 		}
65 65
 		$this->queue->get_message_repository()->rewind();
66 66
 		$count_of_items = $this->queue->get_message_repository()->count();
67 67
 
68 68
 		//if $count of items in queue == 1, then let's just return the subject for that item.
69
-		if ( $count_of_items === 1 ) {
69
+		if ($count_of_items === 1) {
70 70
 			return $this->queue->get_message_repository()->current()->subject();
71 71
 		}
72 72
 
Please login to merge, or discard this patch.
core/libraries/messages/EE_messenger.lib.php 1 patch
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	 * @return void
290 290
 	 */
291 291
 	public function enqueue_scripts_styles() {
292
-		do_action( 'AHEE__EE_messenger__enqueue_scripts_styles');
292
+		do_action('AHEE__EE_messenger__enqueue_scripts_styles');
293 293
 	}
294 294
 
295 295
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
 		$this->_supports_labels->template_variation_description = __('These are different styles to choose from for the selected template structure.  Usually these affect things like font style, color, borders etc.  In some cases the styles will also make minor layout changes.');
361 361
 
362
-		$this->_supports_labels = apply_filters( 'FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this );
362
+		$this->_supports_labels = apply_filters('FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this);
363 363
 	}
364 364
 
365 365
 
@@ -374,10 +374,10 @@  discard block
 block discarded – undo
374 374
 	 * @return stdClass
375 375
 	 */
376 376
 	public function get_supports_labels() {
377
-		if ( empty( $this->_supports_labels->template_pack ) || empty( $this->_supports_labels->template_variation) ) {
377
+		if (empty($this->_supports_labels->template_pack) || empty($this->_supports_labels->template_variation)) {
378 378
 			$this->_set_supports_labels_defaults();
379 379
 		}
380
-		return apply_filters( 'FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this );
380
+		return apply_filters('FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this);
381 381
 	}
382 382
 
383 383
 
@@ -397,10 +397,10 @@  discard block
 block discarded – undo
397 397
 	 *
398 398
 	 * @return string                    path or url for the requested variation.
399 399
 	 */
400
-	public function get_variation( EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE ) {
400
+	public function get_variation(EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE) {
401 401
 		$this->_tmp_pack = $pack;
402
-		$variation_path = apply_filters( 'EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters );
403
-		$variation_path = empty( $variation_path ) ? $this->_tmp_pack->get_variation( $this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters ) : $variation_path;
402
+		$variation_path = apply_filters('EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters);
403
+		$variation_path = empty($variation_path) ? $this->_tmp_pack->get_variation($this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters) : $variation_path;
404 404
 		return $variation_path;
405 405
 
406 406
 	}
@@ -418,13 +418,13 @@  discard block
 block discarded – undo
418 418
 	 * @return array
419 419
 	 */
420 420
 	public function get_default_message_types() {
421
-		$class = get_class( $this );
421
+		$class = get_class($this);
422 422
 
423 423
 		//messenger specific filter
424
-		$default_types = apply_filters( 'FHEE__' . $class . '__get_default_message_types__default_types', $this->_default_message_types, $this );
424
+		$default_types = apply_filters('FHEE__'.$class.'__get_default_message_types__default_types', $this->_default_message_types, $this);
425 425
 
426 426
 		//all messengers filter
427
-		$default_types = apply_filters( 'FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this );
427
+		$default_types = apply_filters('FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this);
428 428
 		return $default_types;
429 429
 	}
430 430
 
@@ -439,14 +439,14 @@  discard block
 block discarded – undo
439 439
 	 * @return array
440 440
 	 */
441 441
 	public function get_valid_message_types() {
442
-		$class = get_class( $this );
442
+		$class = get_class($this);
443 443
 
444 444
 		//messenger specific filter
445 445
 		//messenger specific filter
446
-		$valid_types = apply_filters( 'FHEE__' . $class . '__get_valid_message_types__valid_types', $this->_valid_message_types, $this );
446
+		$valid_types = apply_filters('FHEE__'.$class.'__get_valid_message_types__valid_types', $this->_valid_message_types, $this);
447 447
 
448 448
 		//all messengers filter
449
-		$valid_types = apply_filters( 'FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this );
449
+		$valid_types = apply_filters('FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this);
450 450
 		return $valid_types;
451 451
 	}
452 452
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 	 * @access public
461 461
 	 * @param array $new_config Whatever is put in here will reset the _validator_config property
462 462
 	 */
463
-	public function set_validator_config( $new_config ) {
463
+	public function set_validator_config($new_config) {
464 464
 		$this->_validator_config = $new_config;
465 465
 	}
466 466
 
@@ -476,8 +476,8 @@  discard block
 block discarded – undo
476 476
 	public function get_validator_config() {
477 477
 		$class = get_class($this);
478 478
 
479
-		$config = apply_filters( 'FHEE__' . $class . '__get_validator_config', $this->_validator_config, $this );
480
-		$config = apply_filters( 'FHEE__EE_messenger__get_validator_config', $config, $this );
479
+		$config = apply_filters('FHEE__'.$class.'__get_validator_config', $this->_validator_config, $this);
480
+		$config = apply_filters('FHEE__EE_messenger__get_validator_config', $config, $this);
481 481
 		return $config;
482 482
 	}
483 483
 
@@ -494,8 +494,8 @@  discard block
 block discarded – undo
494 494
 	 * @access public
495 495
 	 * @return string content for page
496 496
 	 */
497
-	public function get_messenger_admin_page_content( $page, $action = null, $extra = array(), $message_types = array() ) {
498
-		return $this->_get_admin_page_content( $page, $action, $extra, $message_types );
497
+	public function get_messenger_admin_page_content($page, $action = null, $extra = array(), $message_types = array()) {
498
+		return $this->_get_admin_page_content($page, $action, $extra, $message_types);
499 499
 	}
500 500
 
501 501
 
@@ -505,20 +505,20 @@  discard block
 block discarded – undo
505 505
 	 * @param array $extra
506 506
 	 * @return mixed|string
507 507
 	 */
508
-	protected function _get_admin_content_events_edit( $message_types, $extra ) {
508
+	protected function _get_admin_content_events_edit($message_types, $extra) {
509 509
 		//defaults
510 510
 		$template_args = array();
511 511
 		$selector_rows = '';
512 512
 
513 513
 		//we don't need message types here so we're just going to ignore. we do, however, expect the event id here. The event id is needed to provide a link to setup a custom template for this event.
514
-		$event_id = isset( $extra['event'] ) ? $extra['event'] : NULL;
514
+		$event_id = isset($extra['event']) ? $extra['event'] : NULL;
515 515
 
516
-		$template_wrapper_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_wrapper.template.php';
517
-		$template_row_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_row.template.php';
516
+		$template_wrapper_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_wrapper.template.php';
517
+		$template_row_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_row.template.php';
518 518
 
519 519
 		//array of template objects for global and custom (non-trashed) (but remember just for this messenger!)
520 520
 		$global_templates = EEM_Message_Template_Group::instance()->get_all(
521
-			array( array( 'MTP_messenger' => $this->name, 'MTP_is_global' => true, 'MTP_is_active' => true ) )
521
+			array(array('MTP_messenger' => $this->name, 'MTP_is_global' => true, 'MTP_is_active' => true))
522 522
 		);
523 523
 		$templates_for_event = EEM_Message_Template_Group::instance()->get_all_custom_templates_by_event(
524 524
 			$event_id,
@@ -527,55 +527,55 @@  discard block
 block discarded – undo
527 527
 				'MTP_is_active' => true
528 528
 			)
529 529
 		);
530
-		$templates_for_event = !empty( $templates_for_event ) ? $templates_for_event : array();
530
+		$templates_for_event = ! empty($templates_for_event) ? $templates_for_event : array();
531 531
 
532 532
 		//so we need to setup the rows for the selectors and we use the global mtpgs (cause those will the active message template groups)
533
-		foreach ( $global_templates as $mtpgID => $mtpg ) {
534
-			if ( $mtpg instanceof EE_Message_Template_Group ) {
533
+		foreach ($global_templates as $mtpgID => $mtpg) {
534
+			if ($mtpg instanceof EE_Message_Template_Group) {
535 535
 				//verify this message type is supposed to show on this page
536 536
 				$mtp_obj = $mtpg->message_type_obj();
537
-				if ( ! $mtp_obj instanceof EE_message_type ) {
537
+				if ( ! $mtp_obj instanceof EE_message_type) {
538 538
 					continue;
539 539
 				}
540
-				$mtp_obj->admin_registered_pages = (array)$mtp_obj->admin_registered_pages;
541
-				if ( ! in_array( 'events_edit', $mtp_obj->admin_registered_pages ) ) {
540
+				$mtp_obj->admin_registered_pages = (array) $mtp_obj->admin_registered_pages;
541
+				if ( ! in_array('events_edit', $mtp_obj->admin_registered_pages)) {
542 542
 					continue;
543 543
 				}
544 544
 				$select_values = array();
545
-				$select_values[ $mtpgID ] = __( 'Global', 'event_espresso' );
546
-				$default_value = array_key_exists( $mtpgID, $templates_for_event ) && ! $mtpg->get( 'MTP_is_override' ) ? $mtpgID : null;
545
+				$select_values[$mtpgID] = __('Global', 'event_espresso');
546
+				$default_value = array_key_exists($mtpgID, $templates_for_event) && ! $mtpg->get('MTP_is_override') ? $mtpgID : null;
547 547
 				//if the override has been set for the global template, then that means even if there are custom templates already created we ignore them because of the set override.
548
-				if ( ! $mtpg->get( 'MTP_is_override' ) ) {
548
+				if ( ! $mtpg->get('MTP_is_override')) {
549 549
 					//any custom templates for this message type?
550
-					$custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt( $this->name, $mtpg->message_type() );
551
-					foreach ( $custom_templates as $cmtpgID => $cmtpg ) {
552
-						$select_values[ $cmtpgID ] = $cmtpg->name();
553
-						$default_value = array_key_exists( $cmtpgID, $templates_for_event ) ? $cmtpgID : $default_value;
550
+					$custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt($this->name, $mtpg->message_type());
551
+					foreach ($custom_templates as $cmtpgID => $cmtpg) {
552
+						$select_values[$cmtpgID] = $cmtpg->name();
553
+						$default_value = array_key_exists($cmtpgID, $templates_for_event) ? $cmtpgID : $default_value;
554 554
 					}
555 555
 				}
556 556
 				//if there is no $default_value then we set it as the global
557
-				$default_value = empty( $default_value ) ? $mtpgID : $default_value;
558
-				$edit_url = EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value ), admin_url( 'admin.php' ) );
559
-				$create_url = EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value ), admin_url( 'admin.php' ) );
560
-				$st_args[ 'mt_name' ] = ucwords( $mtp_obj->label[ 'singular' ] );
561
-				$st_args[ 'mt_slug' ] = $mtpg->message_type();
562
-				$st_args[ 'messenger_slug' ] = $this->name;
563
-				$st_args[ 'selector' ] = EEH_Form_Fields::select_input( 'event_message_templates_relation[' . $mtpgID . ']', $select_values, $default_value, 'data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '"', 'message-template-selector' );
557
+				$default_value = empty($default_value) ? $mtpgID : $default_value;
558
+				$edit_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value), admin_url('admin.php'));
559
+				$create_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value), admin_url('admin.php'));
560
+				$st_args['mt_name'] = ucwords($mtp_obj->label['singular']);
561
+				$st_args['mt_slug'] = $mtpg->message_type();
562
+				$st_args['messenger_slug'] = $this->name;
563
+				$st_args['selector'] = EEH_Form_Fields::select_input('event_message_templates_relation['.$mtpgID.']', $select_values, $default_value, 'data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'"', 'message-template-selector');
564 564
 				//note that  message template group that has override_all_custom set will remove the ability to set a custom message template based off of the global (and that also in turn overrides any other custom templates).
565
-				$st_args[ 'create_button' ] = $mtpg->get( 'MTP_is_override' ) ? '' : '<a data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $create_url . '" class="button button-small create-mtpg-button">' . __( 'Create New Custom', 'event_espresso' ) . '</a>';
566
-				$st_args[ 'create_button' ] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messages_add_new_message_template' ) ? $st_args[ 'create_button' ] : '';
567
-				$st_args[ 'edit_button' ] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID ) ? '<a data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $edit_url . '" class="button button-small edit-mtpg-button">' . __( 'Edit', 'event_espresso' ) . '</a>' : '';
568
-				$selector_rows .= EEH_Template::display_template( $template_row_path, $st_args, true );
565
+				$st_args['create_button'] = $mtpg->get('MTP_is_override') ? '' : '<a data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$create_url.'" class="button button-small create-mtpg-button">'.__('Create New Custom', 'event_espresso').'</a>';
566
+				$st_args['create_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messages_add_new_message_template') ? $st_args['create_button'] : '';
567
+				$st_args['edit_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID) ? '<a data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$edit_url.'" class="button button-small edit-mtpg-button">'.__('Edit', 'event_espresso').'</a>' : '';
568
+				$selector_rows .= EEH_Template::display_template($template_row_path, $st_args, true);
569 569
 			}
570 570
 		}
571 571
 
572 572
 		//if no selectors present then get out.
573
-		if ( empty( $selector_rows ) ) {
573
+		if (empty($selector_rows)) {
574 574
 			return '';
575 575
 		}
576 576
 
577 577
 		$template_args['selector_rows'] = $selector_rows;
578
-		return EEH_Template::display_template( $template_wrapper_path, $template_args, TRUE );
578
+		return EEH_Template::display_template($template_wrapper_path, $template_args, TRUE);
579 579
 	}
580 580
 
581 581
 
@@ -590,8 +590,8 @@  discard block
 block discarded – undo
590 590
 	 * @return array $this->_template_fields
591 591
 	 */
592 592
 	public function get_template_fields() {
593
-		$template_fields = apply_filters( 'FHEE__' . get_class($this) . '__get_template_fields', $this->_template_fields, $this );
594
-		$template_fields = apply_filters( 'FHEE__EE_messenger__get_template_fields', $template_fields, $this );
593
+		$template_fields = apply_filters('FHEE__'.get_class($this).'__get_template_fields', $this->_template_fields, $this);
594
+		$template_fields = apply_filters('FHEE__EE_messenger__get_template_fields', $template_fields, $this);
595 595
 		return $template_fields;
596 596
 	}
597 597
 
@@ -605,9 +605,9 @@  discard block
 block discarded – undo
605 605
 	 * @param mixed $value
606 606
 	 */
607 607
 	protected function _set_template_value($item, $value) {
608
-		if ( array_key_exists($item, $this->_template_fields) ) {
609
-			$prop = '_' . $item;
610
-			$this->{$prop}= $value;
608
+		if (array_key_exists($item, $this->_template_fields)) {
609
+			$prop = '_'.$item;
610
+			$this->{$prop} = $value;
611 611
 		}
612 612
 	}
613 613
 
@@ -618,8 +618,8 @@  discard block
 block discarded – undo
618 618
 	 * @return bool Very important that all messengers return bool for successful send or not.  Error messages can be
619 619
 	 *              added to EE_Error.
620 620
 	 */
621
-	public function send_message( $message, EE_message_type $message_type ) {
622
-		$this->_validate_and_setup( $message );
621
+	public function send_message($message, EE_message_type $message_type) {
622
+		$this->_validate_and_setup($message);
623 623
 		$this->_incoming_message_type = $message_type;
624 624
 		return $this->_send_message();
625 625
 	}
@@ -633,28 +633,28 @@  discard block
 block discarded – undo
633 633
 	 * @param  bool   $send    true we will actually use the _send method (for test sends). FALSE we just return preview
634 634
 	 * @return string          return the message html content
635 635
 	 */
636
-	public function get_preview( EE_Message $message, EE_message_type $message_type, $send = false ) {
637
-		$this->_validate_and_setup( $message );
636
+	public function get_preview(EE_Message $message, EE_message_type $message_type, $send = false) {
637
+		$this->_validate_and_setup($message);
638 638
 
639 639
 		$this->_incoming_message_type = $message_type;
640 640
 
641
-		if ( $send ) {
641
+		if ($send) {
642 642
 			//are we overriding any existing template fields?
643 643
 			$settings = $this->get_existing_test_settings();
644
-			if ( ! empty( $settings ) ) {
645
-				foreach ( $settings as $field => $value ) {
646
-					$this->_set_template_value( $field, $value );
644
+			if ( ! empty($settings)) {
645
+				foreach ($settings as $field => $value) {
646
+					$this->_set_template_value($field, $value);
647 647
 				}
648 648
 			}
649 649
 		}
650 650
 
651 651
 		//enqueue preview js so that any links/buttons on the page are disabled.
652
-		if ( ! $send ) {
652
+		if ( ! $send) {
653 653
 			// the below may seem like duplication.  However, typically if a messenger enqueues scripts/styles,
654 654
 			// it deregisters all existing wp scripts and styles first.  So the second hook ensures our previewer still gets setup.
655
-			add_action( 'admin_enqueue_scripts', array( $this, 'add_preview_script' ), 10 );
656
-			add_action( 'wp_enqueue_scripts', array( $this, 'add_preview_script' ), 10 );
657
-			add_action( 'AHEE__EE_messenger__enqueue_scripts_styles', array( $this, 'add_preview_script' ), 10 );
655
+			add_action('admin_enqueue_scripts', array($this, 'add_preview_script'), 10);
656
+			add_action('wp_enqueue_scripts', array($this, 'add_preview_script'), 10);
657
+			add_action('AHEE__EE_messenger__enqueue_scripts_styles', array($this, 'add_preview_script'), 10);
658 658
 		}
659 659
 
660 660
 		return $send ? $this->_send_message() : $this->_preview();
@@ -672,10 +672,10 @@  discard block
 block discarded – undo
672 672
 	 */
673 673
 	public function add_preview_script() {
674 674
 		//error message
675
-		EE_Registry::$i18n_js_strings[ 'links_disabled' ] = __( 'All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup.  To test generated links, you must trigger an actual message notification.', 'event_espresso' );
676
-		wp_register_script( 'ee-messages-preview-js', EE_LIBRARIES_URL . 'messages/messenger/assets/js/ee-messages-preview.js', array( 'jquery' ), EVENT_ESPRESSO_VERSION, true );
677
-		wp_localize_script( 'ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings );
678
-		wp_enqueue_script( 'ee-messages-preview-js' );
675
+		EE_Registry::$i18n_js_strings['links_disabled'] = __('All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup.  To test generated links, you must trigger an actual message notification.', 'event_espresso');
676
+		wp_register_script('ee-messages-preview-js', EE_LIBRARIES_URL.'messages/messenger/assets/js/ee-messages-preview.js', array('jquery'), EVENT_ESPRESSO_VERSION, true);
677
+		wp_localize_script('ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings);
678
+		wp_enqueue_script('ee-messages-preview-js');
679 679
 	}
680 680
 
681 681
 
@@ -686,13 +686,13 @@  discard block
 block discarded – undo
686 686
 	 * @param  EE_Message $message
687 687
 	 * @throws EE_Error
688 688
 	 */
689
-	protected function _validate_and_setup( EE_Message $message ) {
689
+	protected function _validate_and_setup(EE_Message $message) {
690 690
 		$template_pack = $message->get_template_pack();
691 691
 		$variation = $message->get_template_pack_variation();
692 692
 
693 693
 		//verify we have the required template pack value on the $message object.
694
-		if ( ! $template_pack instanceof EE_Messages_Template_Pack ) {
695
-			throw new EE_Error( __('Incoming $message object must have an EE_Messages_Template_Pack object available.', 'event_espresso' ) );
694
+		if ( ! $template_pack instanceof EE_Messages_Template_Pack) {
695
+			throw new EE_Error(__('Incoming $message object must have an EE_Messages_Template_Pack object available.', 'event_espresso'));
696 696
 		}
697 697
 
698 698
 		$this->_tmp_pack = $template_pack;
@@ -701,11 +701,11 @@  discard block
 block discarded – undo
701 701
 
702 702
 		$template_fields = $this->get_template_fields();
703 703
 
704
-		foreach ( $template_fields as $template => $value ) {
705
-			if ( $template !== 'extra' ) {
706
-				$column_value = $message->get_field_or_extra_meta( 'MSG_' . $template );
704
+		foreach ($template_fields as $template => $value) {
705
+			if ($template !== 'extra') {
706
+				$column_value = $message->get_field_or_extra_meta('MSG_'.$template);
707 707
 				$message_template_value = $column_value ? $column_value : null;
708
-				$this->_set_template_value( $template, $message_template_value );
708
+				$this->_set_template_value($template, $message_template_value);
709 709
 			}
710 710
 		}
711 711
 	}
@@ -720,19 +720,19 @@  discard block
 block discarded – undo
720 720
 	 * @return string
721 721
 	 * @throws \EE_Error
722 722
 	 */
723
-	protected function _get_main_template( $preview = FALSE ) {
723
+	protected function _get_main_template($preview = FALSE) {
724 724
 		$type = $preview ? 'preview' : 'main';
725 725
 
726
-		$wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, $type );
726
+		$wrapper_template = $this->_tmp_pack->get_wrapper($this->name, $type);
727 727
 
728 728
 		//check file exists and is readable
729
-		if ( !is_readable( $wrapper_template ) )
730
-			throw new EE_Error( sprintf( __('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso' ), ucwords($this->label['singular']) , $wrapper_template ) );
729
+		if ( ! is_readable($wrapper_template))
730
+			throw new EE_Error(sprintf(__('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso'), ucwords($this->label['singular']), $wrapper_template));
731 731
 
732 732
 		//add message type to template args
733 733
 		$this->_template_args['message_type'] = $this->_incoming_message_type;
734 734
 
735
-		return EEH_Template::display_template( $wrapper_template, $this->_template_args, TRUE );
735
+		return EEH_Template::display_template($wrapper_template, $this->_template_args, TRUE);
736 736
 	}
737 737
 
738 738
 
@@ -768,9 +768,9 @@  discard block
 block discarded – undo
768 768
 	 */
769 769
 	public function get_existing_test_settings() {
770 770
 		/** @var EE_Message_Resource_Manager $Message_Resource_Manager */
771
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
771
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
772 772
 		$settings = $Message_Resource_Manager->get_active_messengers_option();
773
-		return isset( $settings[ $this->name ]['test_settings'] ) ? $settings[ $this->name ]['test_settings'] : array();
773
+		return isset($settings[$this->name]['test_settings']) ? $settings[$this->name]['test_settings'] : array();
774 774
 	}
775 775
 
776 776
 
@@ -782,12 +782,12 @@  discard block
 block discarded – undo
782 782
 	 * @param $settings
783 783
 	 * @return bool success/fail
784 784
 	 */
785
-	public function set_existing_test_settings( $settings ) {
785
+	public function set_existing_test_settings($settings) {
786 786
 		/** @var EE_Message_Resource_Manager $Message_Resource_Manager */
787
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
787
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
788 788
 		$existing = $Message_Resource_Manager->get_active_messengers_option();
789
-		$existing[ $this->name ]['test_settings'] = $settings;
790
-		return $Message_Resource_Manager->update_active_messengers_option( $existing );
789
+		$existing[$this->name]['test_settings'] = $settings;
790
+		return $Message_Resource_Manager->update_active_messengers_option($existing);
791 791
 	}
792 792
 
793 793
 
@@ -800,21 +800,21 @@  discard block
 block discarded – undo
800 800
 	 * @param string $field The field to retrieve the label for
801 801
 	 * @return string        	  The label
802 802
 	 */
803
-	public function get_field_label( $field ) {
803
+	public function get_field_label($field) {
804 804
 		//first let's see if the field requests is in the top level array.
805
-		if ( isset( $this->_template_fields[$field] ) && !empty( $this->_template_fields[$field]['label'] ) )
805
+		if (isset($this->_template_fields[$field]) && ! empty($this->_template_fields[$field]['label']))
806 806
 			return $this->_template[$field]['label'];
807 807
 
808 808
 		//nope so let's look in the extra array to see if it's there HOWEVER if the field exists as a top level index in the extra array then we know the label is in the 'main' index.
809
-		if ( isset( $this->_template_fields['extra'] ) && !empty( $this->_template_fields['extra'][$field] ) && !empty( $this->_template_fields['extra'][$field]['main']['label'] )  )
809
+		if (isset($this->_template_fields['extra']) && ! empty($this->_template_fields['extra'][$field]) && ! empty($this->_template_fields['extra'][$field]['main']['label']))
810 810
 			return $this->_template_fields['extra'][$field]['main']['label'];
811 811
 
812 812
 		//now it's possible this field may just be existing in any of the extra array items.
813
-		if ( !empty( $this->_template_fields['extra'] ) && is_array( $this->_template_fields['extra'] ) ) {
814
-			foreach ( $this->_template_fields['extra'] as $main_field => $subfields ) {
815
-				if ( !is_array( $subfields ) )
813
+		if ( ! empty($this->_template_fields['extra']) && is_array($this->_template_fields['extra'])) {
814
+			foreach ($this->_template_fields['extra'] as $main_field => $subfields) {
815
+				if ( ! is_array($subfields))
816 816
 					continue;
817
-				if ( isset( $subfields[$field] ) && !empty( $subfields[$field]['label'] ) )
817
+				if (isset($subfields[$field]) && ! empty($subfields[$field]['label']))
818 818
 					return $subfields[$field]['label'];
819 819
 			}
820 820
 		}
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 	 *
836 836
 	 * @return void
837 837
 	 */
838
-	public function do_secondary_messenger_hooks( $sending_messenger_name ) {
838
+	public function do_secondary_messenger_hooks($sending_messenger_name) {
839 839
 		return;
840 840
 	}
841 841
 
Please login to merge, or discard this patch.
core/libraries/messages/validators/EE_Messages_Validator.core.php 1 patch
Spacing   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 	 * @param       $context
120 120
 	 * @throws \EE_Error
121 121
 	 */
122
-	public function __construct( $fields, $context ) {
122
+	public function __construct($fields, $context) {
123 123
 		//check that _m_name and _mt_name have been set by child class otherwise we get out.
124
-		if ( empty($this->_m_name ) || empty( $this->_mt_name) )
124
+		if (empty($this->_m_name) || empty($this->_mt_name))
125 125
 			throw new EE_Error(
126 126
 				__(
127 127
 					'EE_Messages_Validator child classes MUST set the $_m_name and $_mt_name property.  Check that the child class is doing this',
@@ -167,14 +167,14 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	private function _load_objects() {
169 169
 		//load messenger
170
-		$messenger = ucwords( str_replace( '_', ' ', $this->_m_name ) );
171
-		$messenger = str_replace( ' ', '_', $messenger );
172
-		$messenger = 'EE_' . $messenger . '_messenger';
170
+		$messenger = ucwords(str_replace('_', ' ', $this->_m_name));
171
+		$messenger = str_replace(' ', '_', $messenger);
172
+		$messenger = 'EE_'.$messenger.'_messenger';
173 173
 
174
-		if ( ! class_exists( $messenger ) ) {
174
+		if ( ! class_exists($messenger)) {
175 175
 			throw new EE_Error(
176 176
 				sprintf(
177
-					__( 'There is no messenger class for the given string (%s)', 'event_espresso' ),
177
+					__('There is no messenger class for the given string (%s)', 'event_espresso'),
178 178
 					$this->_m_name
179 179
 				)
180 180
 			);
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
 		$this->_messenger = new $messenger();
184 184
 
185 185
 		//load message type
186
-		$message_type = ucwords( str_replace( '_', ' ', $this->_mt_name ) );
187
-		$message_type = str_replace( ' ', '_', $message_type );
188
-		$message_type = 'EE_' . $message_type . '_message_type';
186
+		$message_type = ucwords(str_replace('_', ' ', $this->_mt_name));
187
+		$message_type = str_replace(' ', '_', $message_type);
188
+		$message_type = 'EE_'.$message_type.'_message_type';
189 189
 
190
-		if ( !class_exists( $message_type ) ) {
190
+		if ( ! class_exists($message_type)) {
191 191
 			throw new EE_Error(
192 192
 				sprintf(
193
-					__( 'There is no message type class for the given string (%s)', 'event_espresso' ),
193
+					__('There is no message type class for the given string (%s)', 'event_espresso'),
194 194
 					$this->_mt_name
195 195
 				)
196 196
 			);
@@ -227,25 +227,25 @@  discard block
 block discarded – undo
227 227
 		$shortcode_groups = $mt_codes;
228 228
 		$groups_per_field = array();
229 229
 
230
-		foreach ( $msgr_validator as $field => $config ) {
231
-			if ( empty($config) || !isset($config['shortcodes']) )
232
-				continue;  //Nothing to see here.
233
-			$groups_per_field[$field] = array_intersect( $config['shortcodes'], $mt_codes );
234
-			$shortcode_groups = array_merge( $config[ 'shortcodes'], $shortcode_groups );
230
+		foreach ($msgr_validator as $field => $config) {
231
+			if (empty($config) || ! isset($config['shortcodes']))
232
+				continue; //Nothing to see here.
233
+			$groups_per_field[$field] = array_intersect($config['shortcodes'], $mt_codes);
234
+			$shortcode_groups = array_merge($config['shortcodes'], $shortcode_groups);
235 235
 		}
236 236
 
237
-		$shortcode_groups = array_unique( $shortcode_groups);
237
+		$shortcode_groups = array_unique($shortcode_groups);
238 238
 
239 239
 		// okay now we've got our groups.
240 240
 		// Let's get the codes from the objects into an array indexed by group for easy retrieval later.
241 241
 		$codes_from_objs = array();
242 242
 
243
-		foreach ( $shortcode_groups as $group ) {
244
-			$ref = ucwords( str_replace('_', ' ', $group ) );
245
-			$ref = str_replace( ' ', '_', $ref );
246
-			$classname = 'EE_' . $ref . '_Shortcodes';
247
-			if ( class_exists( $classname ) ) {
248
-				$a = new ReflectionClass( $classname );
243
+		foreach ($shortcode_groups as $group) {
244
+			$ref = ucwords(str_replace('_', ' ', $group));
245
+			$ref = str_replace(' ', '_', $ref);
246
+			$classname = 'EE_'.$ref.'_Shortcodes';
247
+			if (class_exists($classname)) {
248
+				$a = new ReflectionClass($classname);
249 249
 				$obj = $a->newInstance();
250 250
 				$codes_from_objs[$group] = $obj->get_shortcodes();
251 251
 			}
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
 
255 255
 		//let's just replace the $mt shortcode group indexes with the actual shortcodes (unique)
256 256
 		$final_mt_codes = array();
257
-		foreach ( $mt_codes as $group ) {
258
-			$final_mt_codes = array_merge( $final_mt_codes, $codes_from_objs[$group] );
257
+		foreach ($mt_codes as $group) {
258
+			$final_mt_codes = array_merge($final_mt_codes, $codes_from_objs[$group]);
259 259
 		}
260 260
 
261 261
 		$mt_codes = $final_mt_codes;
@@ -263,60 +263,60 @@  discard block
 block discarded – undo
263 263
 
264 264
 		// k now in this next loop we're going to loop through $msgr_validator again
265 265
 		// and setup the _validators property from the data we've setup so far.
266
-		foreach ( $msgr_validator as $field => $config ) {
266
+		foreach ($msgr_validator as $field => $config) {
267 267
 			//if required shortcode is not in our list of codes for the given field, then we skip this field.
268 268
 			$required = isset($config['required'])
269 269
 				? array_intersect($config['required'], array_keys($mt_codes))
270 270
 				: true;
271
-			if ( empty($required) )
271
+			if (empty($required))
272 272
 				continue;
273 273
 
274 274
 			//If we have an override then we use it to indicate the codes we want.
275
-			if ( isset( $this->_valid_shortcodes_modifier[$context][$field] ) ) {
276
-				$this->_validators[ $field ][ 'shortcodes' ] = $this->_reassemble_valid_shortcodes_from_group(
277
-					$this->_valid_shortcodes_modifier[ $context ][ $field ],
275
+			if (isset($this->_valid_shortcodes_modifier[$context][$field])) {
276
+				$this->_validators[$field]['shortcodes'] = $this->_reassemble_valid_shortcodes_from_group(
277
+					$this->_valid_shortcodes_modifier[$context][$field],
278 278
 					$codes_from_objs
279 279
 				);
280 280
 			}
281 281
 
282 282
 			//if we have specific shortcodes for a field then we need to use them
283
-			else if ( isset( $groups_per_field[$field] ) ) {
284
-				$this->_validators[ $field ][ 'shortcodes' ] = $this->_reassemble_valid_shortcodes_from_group(
285
-					$groups_per_field[ $field ],
283
+			else if (isset($groups_per_field[$field])) {
284
+				$this->_validators[$field]['shortcodes'] = $this->_reassemble_valid_shortcodes_from_group(
285
+					$groups_per_field[$field],
286 286
 					$codes_from_objs
287 287
 				);
288 288
 			}
289 289
 
290 290
 			//if empty config then we're assuming we're just going to use the shortcodes from the message type context
291
-			else if ( empty( $config ) ) {
291
+			else if (empty($config)) {
292 292
 				$this->_validators[$field]['shortcodes'] = $mt_codes;
293 293
 			}
294 294
 
295 295
 			//if we have specific shortcodes then we need to use them
296
-			else if ( isset($config['specific_shortcodes'] ) ) {
296
+			else if (isset($config['specific_shortcodes'])) {
297 297
 				$this->_validators[$field]['shortcodes'] = $config['specific_shortcodes'];
298 298
 			}
299 299
 
300 300
 			//otherwise the shortcodes are what is set by the messenger for that field
301 301
 			else {
302
-				foreach ( $config['shortcodes'] as $group ) {
302
+				foreach ($config['shortcodes'] as $group) {
303 303
 					$this->_validators[$field]['shortcodes'] = isset($this->_validators[$field]['shortcodes'])
304
-						? array_merge( $this->_validators[$field]['shortcodes'], $codes_from_objs[$group] )
304
+						? array_merge($this->_validators[$field]['shortcodes'], $codes_from_objs[$group])
305 305
 						: $codes_from_objs[$group];
306 306
 				}
307 307
 			}
308 308
 
309 309
 			//now let's just make sure that any excluded specific shortcodes are removed.
310 310
 			$specific_excludes = $this->get_specific_shortcode_excludes();
311
-			if ( isset( $specific_excludes[$field] ) ) {
312
-				foreach( $specific_excludes[$field] as $sex ) {
313
-					if ( isset( $this->_validators[$field]['shortcodes'][$sex] ) )
314
-						unset( $this->_validators[$field]['shortcodes'][$sex] );
311
+			if (isset($specific_excludes[$field])) {
312
+				foreach ($specific_excludes[$field] as $sex) {
313
+					if (isset($this->_validators[$field]['shortcodes'][$sex]))
314
+						unset($this->_validators[$field]['shortcodes'][$sex]);
315 315
 				}
316 316
 			}
317 317
 
318 318
 			//hey! don't forget to include the type if present!
319
-			$this->_validators[$field]['type'] = isset( $config['type'] ) ? $config['type'] : NULL;
319
+			$this->_validators[$field]['type'] = isset($config['type']) ? $config['type'] : NULL;
320 320
 		}
321 321
 	}
322 322
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	public function get_specific_shortcode_excludes() {
345 345
 		//specific validator filter
346 346
 		$shortcode_excludes = apply_filters(
347
-			'FHEE__' . get_class( $this ) . '__get_specific_shortcode_excludes;',
347
+			'FHEE__'.get_class($this).'__get_specific_shortcode_excludes;',
348 348
 			$this->_specific_shortcode_excludes,
349 349
 			$this->_context
350 350
 		);
@@ -372,20 +372,20 @@  discard block
 block discarded – undo
372 372
 		//some defaults
373 373
 		$template_fields = $this->_messenger->get_template_fields();
374 374
 		//loop through the fields and check!
375
-		foreach ( $this->_fields as $field => $value ) {
375
+		foreach ($this->_fields as $field => $value) {
376 376
 			$this->_errors[$field] = array();
377 377
 			$err_msg = '';
378 378
 			$field_label = '';
379 379
 			//if field is not present in the _validators array then we continue
380
-			if ( !isset( $this->_validators[$field] ) ) {
381
-				unset( $this->_errors[$field] );
380
+			if ( ! isset($this->_validators[$field])) {
381
+				unset($this->_errors[$field]);
382 382
 				continue;
383 383
 			}
384 384
 
385 385
 			//get the translated field label!
386 386
 			//first check if it's in the main fields list
387
-			if ( isset( $template_fields[$field] ) ) {
388
-				if ( empty( $template_fields[$field] ) )
387
+			if (isset($template_fields[$field])) {
388
+				if (empty($template_fields[$field]))
389 389
 					$field_label = $field; //most likely the field is found in the 'extra' array.
390 390
 				else
391 391
 					$field_label = $template_fields[$field]['label'];
@@ -393,16 +393,16 @@  discard block
 block discarded – undo
393 393
 
394 394
 			// if field label is empty OR is equal to the current field
395 395
 			// then we need to loop through the 'extra' fields in the template_fields config (if present)
396
-			if ( isset( $template_fields['extra'] ) && ( empty($field_label) ) || $field_label == $field ) {
397
-				foreach( $template_fields['extra'] as $main_field => $secondary_field ) {
398
-					foreach ( $secondary_field as $name => $values ) {
399
-						if ( $name == $field ) {
396
+			if (isset($template_fields['extra']) && (empty($field_label)) || $field_label == $field) {
397
+				foreach ($template_fields['extra'] as $main_field => $secondary_field) {
398
+					foreach ($secondary_field as $name => $values) {
399
+						if ($name == $field) {
400 400
 							$field_label = $values['label'];
401 401
 						}
402 402
 
403 403
 						// if we've got a 'main' secondary field, let's see if that matches what field we're on
404 404
 						// which means it contains the label for this field.
405
-						if ( $name == 'main' && $main_field == $field_label )
405
+						if ($name == 'main' && $main_field == $field_label)
406 406
 							$field_label = $values['label'];
407 407
 					}
408 408
 				}
@@ -410,27 +410,27 @@  discard block
 block discarded – undo
410 410
 
411 411
 			//field is present. Let's validate shortcodes first (but only if shortcodes present).
412 412
 			if (
413
-				isset( $this->_validators[ $field ][ 'shortcodes' ] )
414
-				&& ! empty( $this->_validators[ $field ][ 'shortcodes' ] )
413
+				isset($this->_validators[$field]['shortcodes'])
414
+				&& ! empty($this->_validators[$field]['shortcodes'])
415 415
 			) {
416
-				$invalid_shortcodes = $this->_invalid_shortcodes( $value, $this->_validators[$field]['shortcodes'] );
416
+				$invalid_shortcodes = $this->_invalid_shortcodes($value, $this->_validators[$field]['shortcodes']);
417 417
 				// if true then that means there is a returned error message
418 418
 				// that we'll need to add to the _errors array for this field.
419
-				if ( $invalid_shortcodes ) {
419
+				if ($invalid_shortcodes) {
420 420
 					$v_s = array_keys($this->_validators[$field]['shortcodes']);
421 421
 					$err_msg = sprintf(
422 422
 						__(
423 423
 							'%3$sThe following shortcodes were found in the "%1$s" field that ARE not valid: %2$s%4$s',
424 424
 							'event_espresso'
425 425
 						),
426
-						'<strong>' . $field_label . '</strong>',
426
+						'<strong>'.$field_label.'</strong>',
427 427
 						$invalid_shortcodes,
428 428
 						'<p>',
429 429
 						'</p >'
430 430
 					);
431 431
 					$err_msg .= sprintf(
432
-						__( '%2$sValid shortcodes for this field are: %1$s%3$s', 'event_espresso' ),
433
-						implode( ', ', $v_s ),
432
+						__('%2$sValid shortcodes for this field are: %1$s%3$s', 'event_espresso'),
433
+						implode(', ', $v_s),
434 434
 						'<strong>',
435 435
 						'</strong>'
436 436
 					);
@@ -438,10 +438,10 @@  discard block
 block discarded – undo
438 438
 			}
439 439
 
440 440
 			//if there's a "type" to be validated then let's do that too.
441
-			if ( isset( $this->_validators[$field]['type'] ) && !empty( $this->_validators[$field]['type'] ) ) {
442
-				switch ( $this->_validators[$field]['type'] ) {
441
+			if (isset($this->_validators[$field]['type']) && ! empty($this->_validators[$field]['type'])) {
442
+				switch ($this->_validators[$field]['type']) {
443 443
 					case 'number' :
444
-						if ( !is_numeric($value) )
444
+						if ( ! is_numeric($value))
445 445
 							$err_msg .= sprintf(
446 446
 								__(
447 447
 									'%3$sThe %1$s field is supposed to be a number. The value given (%2$s)  is not.  Please double-check and make sure the field contains a number%4$s',
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 						break;
456 456
 					case 'email' :
457 457
 						$valid_email = $this->_validate_email($value);
458
-						if ( !$valid_email )
458
+						if ( ! $valid_email)
459 459
 							$err_msg .= htmlentities(
460 460
 								sprintf(
461 461
 									__(
@@ -472,23 +472,23 @@  discard block
 block discarded – undo
472 472
 			}
473 473
 
474 474
 			//if $err_msg isn't empty let's setup the _errors array for this field.
475
-			if ( !empty($err_msg ) ) {
475
+			if ( ! empty($err_msg)) {
476 476
 				$this->_errors[$field]['msg'] = $err_msg;
477 477
 			} else {
478
-				unset( $this->_errors[$field] );
478
+				unset($this->_errors[$field]);
479 479
 			}
480 480
 		}
481 481
 
482 482
 		// if we have ANY errors, then we want to make sure we return the values
483 483
 		// for ALL the fields so the user doesn't have to retype them all.
484
-		if ( !empty( $this->_errors ) ) {
485
-			foreach ( $this->_fields as $field => $value ) {
484
+		if ( ! empty($this->_errors)) {
485
+			foreach ($this->_fields as $field => $value) {
486 486
 				$this->_errors[$field]['value'] = stripslashes($value);
487 487
 			}
488 488
 		}
489 489
 
490 490
 		//return any errors or just TRUE if everything validates
491
-		return empty( $this->_errors ) ? TRUE : $this->_errors;
491
+		return empty($this->_errors) ? TRUE : $this->_errors;
492 492
 	}
493 493
 
494 494
 
@@ -501,10 +501,10 @@  discard block
 block discarded – undo
501 501
 	 * @param  array $codes_from_objs All the codes available.
502 502
 	 * @return array                   an array of actual shortcodes (that will be used for validation).
503 503
 	 */
504
-	private function _reassemble_valid_shortcodes_from_group( $groups, $codes_from_objs ) {
504
+	private function _reassemble_valid_shortcodes_from_group($groups, $codes_from_objs) {
505 505
 		$shortcodes = array();
506
-		foreach ( $groups as $group ) {
507
-			$shortcodes = array_merge( $shortcodes, $codes_from_objs[$group] );
506
+		foreach ($groups as $group) {
507
+			$shortcodes = array_merge($shortcodes, $codes_from_objs[$group]);
508 508
 		}
509 509
 		return $shortcodes;
510 510
 	}
@@ -523,29 +523,29 @@  discard block
 block discarded – undo
523 523
 	 */
524 524
 	protected function _invalid_shortcodes($value, $valid_shortcodes) {
525 525
 		//first we need to go through the string and get the shortcodes in the string
526
-		preg_match_all( '/(\[.+?\])/', $value, $matches );
526
+		preg_match_all('/(\[.+?\])/', $value, $matches);
527 527
 		$incoming_shortcodes = (array) $matches[0];
528 528
 
529 529
 		//get a diff of the shortcodes in the string vs the valid shortcodes
530
-		$diff = array_diff( $incoming_shortcodes, array_keys($valid_shortcodes) );
530
+		$diff = array_diff($incoming_shortcodes, array_keys($valid_shortcodes));
531 531
 
532 532
 		//we need to account for custom codes so let's loop through the diff and remove any of those type of codes
533
-		foreach ( $diff as $ind => $code ) {
534
-			if ( preg_match('/(\[[A-Za-z0-9\_]+_\*)/', $code ) ) {
533
+		foreach ($diff as $ind => $code) {
534
+			if (preg_match('/(\[[A-Za-z0-9\_]+_\*)/', $code)) {
535 535
 				//strip the shortcode so we just have the BASE string (i.e. [ANSWER_*] )
536 536
 				$dynamic_sc = preg_replace('/(_\*+.+)/', '_*]', $code);
537 537
 				//does this exist in the $valid_shortcodes?  If so then unset.
538
-				if ( isset( $valid_shortcodes[$dynamic_sc] ) ) {
539
-					unset( $diff[$ind] );
538
+				if (isset($valid_shortcodes[$dynamic_sc])) {
539
+					unset($diff[$ind]);
540 540
 				}
541 541
 			}
542 542
 		}
543 543
 
544
-		if ( empty( $diff ) ) return FALSE; //there is no diff, we have no invalid shortcodes, so return
544
+		if (empty($diff)) return FALSE; //there is no diff, we have no invalid shortcodes, so return
545 545
 
546 546
 		//made it here? then let's assemble the error message
547
-		$invalid_shortcodes = implode( '</strong>,<strong>', $diff );
548
-		$invalid_shortcodes = '<strong>' . $invalid_shortcodes . '</strong>';
547
+		$invalid_shortcodes = implode('</strong>,<strong>', $diff);
548
+		$invalid_shortcodes = '<strong>'.$invalid_shortcodes.'</strong>';
549 549
 		return $invalid_shortcodes;
550 550
 	}
551 551
 
@@ -557,13 +557,13 @@  discard block
 block discarded – undo
557 557
 	 * @param  string $value incoming value to validate
558 558
 	 * @return bool        true if the string validates, false if it doesn't
559 559
 	 */
560
-	protected function _validate_email( $value ) {
560
+	protected function _validate_email($value) {
561 561
 		$validate = TRUE;
562 562
 		$or_val = $value;
563 563
 
564 564
 		// empty strings will validate because this is how a message template
565 565
 		// for a particular context can be "turned off" (if there is no email then no message)
566
-		if ( empty( $value ) )
566
+		if (empty($value))
567 567
 			return $validate;
568 568
 
569 569
 		// first determine if there ARE any shortcodes.
@@ -581,19 +581,19 @@  discard block
 block discarded – undo
581 581
 		// its possible that this message is being "turned off" for a particular context
582 582
 
583 583
 
584
-		if ( !empty($or_val) && empty($value) )
584
+		if ( ! empty($or_val) && empty($value))
585 585
 			return $validate;
586 586
 
587 587
 		//trim any commas from beginning and end of string ( after whitespace trimmed );
588
-		$value = trim( trim($value), ',' );
588
+		$value = trim(trim($value), ',');
589 589
 
590 590
 
591 591
 		//next we need to split up the string if its comma delimited.
592 592
 		$emails = explode(',', $value);
593 593
 		$empty = FALSE; //used to indicate that there is an empty comma.
594 594
 		//now let's loop through the emails and do our checks
595
-		foreach ( $emails as $email ) {
596
-			if ( empty($email) ) {
595
+		foreach ($emails as $email) {
596
+			if (empty($email)) {
597 597
 				$empty = TRUE;
598 598
 				continue;
599 599
 			}
@@ -601,20 +601,20 @@  discard block
 block discarded – undo
601 601
 			//trim whitespace
602 602
 			$email = trim($email);
603 603
 			//either its of type "[email protected]", or its of type "fname lname <[email protected]>"
604
-			if(is_email($email)){
604
+			if (is_email($email)) {
605 605
 				continue;
606
-			}else{
606
+			} else {
607 607
 				$matches = array();
608
-				$validate = preg_match( '/(.*)<(.+)>/', $email, $matches ) ? TRUE : FALSE;
609
-				if( $validate && is_email($matches[2])){
608
+				$validate = preg_match('/(.*)<(.+)>/', $email, $matches) ? TRUE : FALSE;
609
+				if ($validate && is_email($matches[2])) {
610 610
 					continue;
611
-				}else{
611
+				} else {
612 612
 					return false;
613 613
 				}
614 614
 			}
615 615
 		}
616 616
 
617
-		$validate = $empty && !$has_shortcodes ? FALSE : $validate;
617
+		$validate = $empty && ! $has_shortcodes ? FALSE : $validate;
618 618
 
619 619
 		return $validate;
620 620
 
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 	 * @throws Exception
631 631
 	 * @return mixed
632 632
 	 */
633
-	public function __get( $property ) {
633
+	public function __get($property) {
634 634
 		$expected_properties_map = array(
635 635
 			/**
636 636
 			 * @deprecated 4.9.0
@@ -642,15 +642,15 @@  discard block
 block discarded – undo
642 642
 			'_MSGTYP' => '_message_type'
643 643
 		);
644 644
 
645
-		if ( isset( $expected_properties_map[ $property ] ) ) {
646
-			return $this->{$expected_properties_map[ $property ]};
645
+		if (isset($expected_properties_map[$property])) {
646
+			return $this->{$expected_properties_map[$property]};
647 647
 		}
648 648
 
649 649
 		throw new Exception(
650 650
 			sprintf(
651
-				__( 'The property %1$s being requested on %2$s does not exist', 'event_espresso' ),
651
+				__('The property %1$s being requested on %2$s does not exist', 'event_espresso'),
652 652
 				$property,
653
-				get_class( $this )
653
+				get_class($this)
654 654
 			)
655 655
 		);
656 656
 	}
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
@@ -458,8 +458,8 @@  discard block
 block discarded – undo
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 460
 		if ( empty( $templates['to'][ $context ] )
461
-		     && ! $this->_generation_queue->get_message_repository()->is_preview()
462
-		     && ! $this->_current_messenger->allow_empty_to_field() ) {
461
+			 && ! $this->_generation_queue->get_message_repository()->is_preview()
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
 		}
@@ -575,9 +575,9 @@  discard block
 block discarded – undo
575 575
 		 * Check if there is any generation data, but only if this is not for a preview.
576 576
 		 */
577 577
 		if ( ! $this->_generation_queue->get_message_repository()->get_generation_data()
578
-		     && (
579
-			     ! $this->_generation_queue->get_message_repository()->is_preview()
580
-			     && $this->_generation_queue->get_message_repository()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' )
578
+			 && (
579
+				 ! $this->_generation_queue->get_message_repository()->is_preview()
580
+				 && $this->_generation_queue->get_message_repository()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' )
581 581
 		) {
582 582
 			$this->_error_msg[] = __( 'There is no generation data for this message. Unable to generate.' );
583 583
 		}
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 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,10 +116,10 @@  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_message_repository()->rewind();
122
-		while ( $this->_generation_queue->get_message_repository()->valid() ) {
122
+		while ($this->_generation_queue->get_message_repository()->valid()) {
123 123
 			//reset "current" properties
124 124
 			$this->_reset_current_properties();
125 125
 
@@ -133,18 +133,18 @@  discard block
 block discarded – undo
133 133
 			$this->_generation_queue->get_message_repository()->next();
134 134
 			$next_msg = $this->_generation_queue->get_message_repository()->current();
135 135
 			//restore pointer to current item
136
-			$this->_generation_queue->get_message_repository()->set_current( $msg );
136
+			$this->_generation_queue->get_message_repository()->set_current($msg);
137 137
 
138 138
 			//skip and delete if the current $msg is NOT incomplete (queued for generation)
139
-			if ( $msg->STS_ID() !== EEM_Message::status_incomplete ) {
139
+			if ($msg->STS_ID() !== EEM_Message::status_incomplete) {
140 140
 				//we keep this item in the db just remove from the repo.
141
-				$this->_generation_queue->get_message_repository()->remove( $msg );
141
+				$this->_generation_queue->get_message_repository()->remove($msg);
142 142
 				//next item
143
-				$this->_generation_queue->get_message_repository()->set_current( $next_msg );
143
+				$this->_generation_queue->get_message_repository()->set_current($next_msg);
144 144
 				continue;
145 145
 			}
146 146
 
147
-			if ( $this->_verify() ) {
147
+			if ($this->_verify()) {
148 148
 				//let's get generating!
149 149
 				$this->_generate();
150 150
 			}
@@ -155,28 +155,28 @@  discard block
 block discarded – undo
155 155
 				&& ! EEM_Message::debug()
156 156
 			) {
157 157
 				$this->_generation_queue->get_message_repository()->delete();
158
-				$this->_generation_queue->get_message_repository()->set_current( $next_msg );
158
+				$this->_generation_queue->get_message_repository()->set_current($next_msg);
159 159
 				continue;
160 160
 			}
161 161
 
162 162
 			//if there are error messages then let's set the status and the error message.
163
-			if ( $this->_error_msg ) {
163
+			if ($this->_error_msg) {
164 164
 				//if the status is already debug only, then let's leave it at that.
165
-				if ( $msg->STS_ID() !== EEM_Message::status_debug_only ) {
166
-					$msg->set_STS_ID( EEM_Message::status_failed );
165
+				if ($msg->STS_ID() !== EEM_Message::status_debug_only) {
166
+					$msg->set_STS_ID(EEM_Message::status_failed);
167 167
 				}
168 168
 				$msg->set_error_message(
169
-					__( 'Message failed to generate for the following reasons: ' )
169
+					__('Message failed to generate for the following reasons: ')
170 170
 					. "\n"
171
-					. implode( "\n", $this->_error_msg )
171
+					. implode("\n", $this->_error_msg)
172 172
 				);
173
-				$msg->set_modified( time() );
173
+				$msg->set_modified(time());
174 174
 			} else {
175 175
 				//remove from db
176 176
 				$this->_generation_queue->get_message_repository()->delete();
177 177
 			}
178 178
 			//next item
179
-			$this->_generation_queue->get_message_repository()->set_current( $next_msg );
179
+			$this->_generation_queue->get_message_repository()->set_current($next_msg);
180 180
 		}
181 181
 
182 182
 		//generation queue is ALWAYS saved to record any errors in the generation process.
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		 * so a EE_Extra_Meta entry could be created and attached to the EE_Message.  In those cases the save flag is
190 190
 		 * irrelevant.
191 191
 		 */
192
-		if ( $save ) {
192
+		if ($save) {
193 193
 			$this->_ready_queue->save();
194 194
 		}
195 195
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	protected function _reset_current_properties() {
208 208
 		$this->_verified = false;
209 209
 		//make sure any _data value in the current message type is reset
210
-		if ( $this->_current_message_type instanceof EE_message_type ) {
210
+		if ($this->_current_message_type instanceof EE_message_type) {
211 211
 			$this->_current_message_type->reset_data();
212 212
 		}
213 213
 		$this->_current_messenger = $this->_current_message_type = $this->_current_data_handler = null;
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	protected function _generate() {
228 228
 		//double check verification has run and that everything is ready to work with (saves us having to validate everything again).
229
-		if ( ! $this->_verified ) {
229
+		if ( ! $this->_verified) {
230 230
 			return false; //get out because we don't have a valid setup to work with.
231 231
 		}
232 232
 
@@ -236,34 +236,34 @@  discard block
 block discarded – undo
236 236
 				$this->_current_data_handler,
237 237
 				$this->_generation_queue->get_message_repository()->current()->context()
238 238
 			);
239
-		} catch ( EE_Error $e ) {
239
+		} catch (EE_Error $e) {
240 240
 			$this->_error_msg[] = $e->getMessage();
241 241
 			return false;
242 242
 		}
243 243
 
244 244
 
245 245
 		//if no addressees then get out because there is nothing to generation (possible bad data).
246
-		if ( ! $this->_valid_addressees( $addressees ) ) {
247
-			$this->_generation_queue->get_message_repository()->current()->set_STS_ID( EEM_Message::status_debug_only );
248
-			$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.
249
-			  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' );
246
+		if ( ! $this->_valid_addressees($addressees)) {
247
+			$this->_generation_queue->get_message_repository()->current()->set_STS_ID(EEM_Message::status_debug_only);
248
+			$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.
249
+			  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');
250 250
 			return false;
251 251
 		}
252 252
 
253 253
 		$message_template_group = $this->_get_message_template_group();
254 254
 
255 255
 		//in the unlikely event there is no EE_Message_Template_Group available, get out!
256
-		if ( ! $message_template_group instanceof EE_Message_Template_Group ) {
257
-			$this->_error_msg[] = __( 'Unable to get the Message Templates for the Message being generated.  No message template group accessible.', 'event_espresso' );
256
+		if ( ! $message_template_group instanceof EE_Message_Template_Group) {
257
+			$this->_error_msg[] = __('Unable to get the Message Templates for the Message being generated.  No message template group accessible.', 'event_espresso');
258 258
 			return false;
259 259
 		}
260 260
 
261 261
 		//get formatted templates for using to parse and setup EE_Message objects.
262
-		$templates = $this->_get_templates( $message_template_group );
262
+		$templates = $this->_get_templates($message_template_group);
263 263
 
264 264
 
265 265
 		//setup new EE_Message objects (and add to _ready_queue)
266
-		return $this->_assemble_messages( $addressees, $templates, $message_template_group );
266
+		return $this->_assemble_messages($addressees, $templates, $message_template_group);
267 267
 	}
268 268
 
269 269
 
@@ -281,17 +281,17 @@  discard block
 block discarded – undo
281 281
 		//so let's use that.
282 282
 		$GRP_ID = $this->_generation_queue->get_message_repository()->current()->GRP_ID();
283 283
 
284
-		if ( $GRP_ID ) {
284
+		if ($GRP_ID) {
285 285
 			//attempt to retrieve from repo first
286
-			$GRP = $this->_template_collection->get_by_ID( $GRP_ID );
287
-			if ( $GRP instanceof EE_Message_Template_Group ) {
288
-				return $GRP;  //got it!
286
+			$GRP = $this->_template_collection->get_by_ID($GRP_ID);
287
+			if ($GRP instanceof EE_Message_Template_Group) {
288
+				return $GRP; //got it!
289 289
 			}
290 290
 
291 291
 			//nope don't have it yet.  Get from DB then add to repo
292
-			$GRP = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
293
-			if ( $GRP instanceof EE_Message_Template_Group ) {
294
-				$this->_template_collection->add( $GRP );
292
+			$GRP = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
293
+			if ($GRP instanceof EE_Message_Template_Group) {
294
+				$this->_template_collection->add($GRP);
295 295
 			}
296 296
 			return $GRP;
297 297
 		}
@@ -310,41 +310,41 @@  discard block
 block discarded – undo
310 310
 		//in vanilla EE we're assuming there's only one event.
311 311
 		//However, if there are multiple events then we'll just use the default templates instead of different
312 312
 		// templates per event (which could create problems).
313
-		if ( count( $this->_current_data_handler->events ) === 1 ) {
314
-			foreach ( $this->_current_data_handler->events as $event ) {
313
+		if (count($this->_current_data_handler->events) === 1) {
314
+			foreach ($this->_current_data_handler->events as $event) {
315 315
 				$EVT_ID = $event['ID'];
316 316
 			}
317 317
 		}
318 318
 
319 319
 		//before going any further, let's see if its in the queue
320
-		$GRP = $this->_template_collection->get_by_key( $this->_template_collection->get_key( $this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID ) );
320
+		$GRP = $this->_template_collection->get_by_key($this->_template_collection->get_key($this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID));
321 321
 
322
-		if ( $GRP instanceof EE_Message_Template_Group ) {
322
+		if ($GRP instanceof EE_Message_Template_Group) {
323 323
 			return $GRP;
324 324
 		}
325 325
 
326 326
 		//nope still no GRP?
327 327
 		//first we get the global template in case it has an override set.
328
-		$global_template_qa = array_merge( array( 'MTP_is_global' => true ), $template_qa );
329
-		$global_GRP = EEM_Message_Template_Group::instance()->get_one( array( $global_template_qa ) );
328
+		$global_template_qa = array_merge(array('MTP_is_global' => true), $template_qa);
329
+		$global_GRP = EEM_Message_Template_Group::instance()->get_one(array($global_template_qa));
330 330
 
331 331
 		//if this is an override, then we just return it.
332
-		if ( $global_GRP instanceof EE_Message_Template_Group && $global_GRP->get( 'MTP_is_override' ) ) {
333
-			$this->_template_collection->add( $global_GRP, $EVT_ID );
332
+		if ($global_GRP instanceof EE_Message_Template_Group && $global_GRP->get('MTP_is_override')) {
333
+			$this->_template_collection->add($global_GRP, $EVT_ID);
334 334
 			return $global_GRP;
335 335
 		}
336 336
 
337 337
 		//STILL here? Okay that means we want to see if there is event specific group and if there is we return it,
338 338
 		//otherwise we return the global group we retrieved.
339
-		if ( $EVT_ID ) {
339
+		if ($EVT_ID) {
340 340
 			$template_qa['Event.EVT_ID'] = $EVT_ID;
341 341
 		}
342 342
 
343
-		$GRP = EEM_Message_Template_Group::instance()->get_one( array( $template_qa ) );
343
+		$GRP = EEM_Message_Template_Group::instance()->get_one(array($template_qa));
344 344
 		$GRP = $GRP instanceof EE_Message_Template_Group ? $GRP : $global_GRP;
345 345
 
346
-		if ( $GRP instanceof EE_Message_Template_Group ) {
347
-			$this->_template_collection->add( $GRP, $EVT_ID );
346
+		if ($GRP instanceof EE_Message_Template_Group) {
347
+			$this->_template_collection->add($GRP, $EVT_ID);
348 348
 			return $GRP;
349 349
 		}
350 350
 
@@ -368,15 +368,15 @@  discard block
 block discarded – undo
368 368
 	 *                      )
369 369
 	 *                  )
370 370
 	 */
371
-	protected function _get_templates( EE_Message_Template_Group $message_template_group ) {
371
+	protected function _get_templates(EE_Message_Template_Group $message_template_group) {
372 372
 		$templates = array();
373 373
 		$context_templates = $message_template_group->context_templates();
374
-		foreach ( $context_templates as $context => $template_fields ) {
375
-			foreach ( $template_fields as $template_field => $template_obj ) {
376
-				if ( ! $template_obj instanceof EE_Message_Template ) {
374
+		foreach ($context_templates as $context => $template_fields) {
375
+			foreach ($template_fields as $template_field => $template_obj) {
376
+				if ( ! $template_obj instanceof EE_Message_Template) {
377 377
 					continue;
378 378
 				}
379
-				$templates[ $template_field ][ $context ] = $template_obj->get( 'MTP_content' );
379
+				$templates[$template_field][$context] = $template_obj->get('MTP_content');
380 380
 			}
381 381
 		}
382 382
 		return $templates;
@@ -398,20 +398,20 @@  discard block
 block discarded – undo
398 398
 	 *                get added to the queue with EEM_Message::status_idle, unsuccessfully generated messages will get added
399 399
 	 *                to the queue as EEM_Message::status_failed.  Very rarely should "false" be returned from this method.
400 400
 	 */
401
-	protected function _assemble_messages( $addressees, $templates, EE_Message_Template_Group $message_template_group ) {
401
+	protected function _assemble_messages($addressees, $templates, EE_Message_Template_Group $message_template_group) {
402 402
 
403 403
 		//if templates are empty then get out because we can't generate anything.
404
-		if ( ! $templates ) {
404
+		if ( ! $templates) {
405 405
 			return false;
406 406
 		}
407 407
 
408 408
 		//We use this as the counter for generated messages because don't forget we may be executing this inside of a
409 409
 		//generation_queue.  So _ready_queue may have generated EE_Message objects already.
410 410
 		$generated_count = 0;
411
-		foreach ( $addressees as $context => $recipients ) {
412
-			foreach ( $recipients as $recipient ) {
413
-				$message = $this->_setup_message_object( $context, $recipient, $templates, $message_template_group );
414
-				if ( $message instanceof EE_Message ) {
411
+		foreach ($addressees as $context => $recipients) {
412
+			foreach ($recipients as $recipient) {
413
+				$message = $this->_setup_message_object($context, $recipient, $templates, $message_template_group);
414
+				if ($message instanceof EE_Message) {
415 415
 					$this->_ready_queue->add(
416 416
 						$message,
417 417
 						array(),
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 				}
423 423
 
424 424
 				//if the current MSG being generated is for a test send then we'll only use ONE message in the generation.
425
-				if ( $this->_generation_queue->get_message_repository()->is_test_send() ) {
425
+				if ($this->_generation_queue->get_message_repository()->is_test_send()) {
426 426
 					break 2;
427 427
 				}
428 428
 			}
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	) {
452 452
 		//stuff we already know
453 453
 		$transaction_id = $recipient->txn instanceof EE_Transaction ? $recipient->txn->ID() : 0;
454
-		$transaction_id = empty( $transaction_id ) && $this->_current_data_handler->txn instanceof EE_Transaction
454
+		$transaction_id = empty($transaction_id) && $this->_current_data_handler->txn instanceof EE_Transaction
455 455
 			? $this->_current_data_handler->txn->ID()
456 456
 			: $transaction_id;
457 457
 		$message_fields = array(
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 
465 465
 		//recipient id and type should be on the EE_Messages_Addressee object but if this is empty, let's try to grab the
466 466
 		//info from the att_obj found in the EE_Messages_Addressee object.
467
-		if ( empty( $recipient->recipient_id ) || empty( $recipient->recipient_type ) ) {
467
+		if (empty($recipient->recipient_id) || empty($recipient->recipient_type)) {
468 468
 			$message_fields['MSG_recipient_ID'] = $recipient->att_obj instanceof EE_Attendee
469 469
 				? $recipient->att_obj->ID()
470 470
 				: 0;
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 			$message_fields['MSG_recipient_ID'] = $recipient->recipient_id;
474 474
 			$message_fields['MSG_recipient_type'] = $recipient->recipient_type;
475 475
 		}
476
-		$message = EE_Message_Factory::create( $message_fields );
476
+		$message = EE_Message_Factory::create($message_fields);
477 477
 
478 478
 		//grab valid shortcodes for shortcode parser
479 479
 		$mt_shortcodes = $this->_current_message_type->get_valid_shortcodes();
@@ -481,43 +481,43 @@  discard block
 block discarded – undo
481 481
 
482 482
 		//if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because that means this
483 483
 		//context is turned off) EXCEPT if we're previewing
484
-		if ( empty( $templates['to'][ $context ] )
484
+		if (empty($templates['to'][$context])
485 485
 		     && ! $this->_generation_queue->get_message_repository()->is_preview()
486
-		     && ! $this->_current_messenger->allow_empty_to_field() ) {
486
+		     && ! $this->_current_messenger->allow_empty_to_field()) {
487 487
 			//we silently exit here and do NOT record a fail because the message is "turned off" by having no "to" field.
488 488
 			return false;
489 489
 		}
490 490
 		$error_msg = array();
491
-		foreach ( $templates as $field => $field_context ) {
491
+		foreach ($templates as $field => $field_context) {
492 492
 			$error_msg = array();
493 493
 			//let's setup the valid shortcodes for the incoming context.
494
-			$valid_shortcodes = $mt_shortcodes[ $context ];
494
+			$valid_shortcodes = $mt_shortcodes[$context];
495 495
 			//merge in valid shortcodes for the field.
496
-			$shortcodes = isset($m_shortcodes[ $field ]) ? $m_shortcodes[ $field ] : $valid_shortcodes;
497
-			if ( isset( $templates[ $field ][ $context ] ) ) {
496
+			$shortcodes = isset($m_shortcodes[$field]) ? $m_shortcodes[$field] : $valid_shortcodes;
497
+			if (isset($templates[$field][$context])) {
498 498
 				//prefix field.
499
-				$column_name = 'MSG_' . $field;
499
+				$column_name = 'MSG_'.$field;
500 500
 				try {
501 501
 					$content = $this->_shortcode_parser->parse_message_template(
502
-						$templates[ $field ][ $context ],
502
+						$templates[$field][$context],
503 503
 						$recipient,
504 504
 						$shortcodes,
505 505
 						$this->_current_message_type,
506 506
 						$this->_current_messenger,
507 507
 						$message );
508
-					$message->set_field_or_extra_meta( $column_name, $content );
509
-				} catch ( EE_Error $e ) {
510
-					$error_msg[] = sprintf( __( 'There was a problem generating the content for the field %s: %s', 'event_espresso' ), $field, $e->getMessage() );
511
-					$message->set_STS_ID( EEM_Message::status_failed );
508
+					$message->set_field_or_extra_meta($column_name, $content);
509
+				} catch (EE_Error $e) {
510
+					$error_msg[] = sprintf(__('There was a problem generating the content for the field %s: %s', 'event_espresso'), $field, $e->getMessage());
511
+					$message->set_STS_ID(EEM_Message::status_failed);
512 512
 				}
513 513
 			}
514 514
 		}
515 515
 
516
-		if ( $message->STS_ID() === EEM_Message::status_failed ) {
517
-			$error_msg = __( 'There were problems generating this message:', 'event_espresso' ) . "\n" . implode( "\n", $error_msg );
518
-			$message->set_error_message( $error_msg );
516
+		if ($message->STS_ID() === EEM_Message::status_failed) {
517
+			$error_msg = __('There were problems generating this message:', 'event_espresso')."\n".implode("\n", $error_msg);
518
+			$message->set_error_message($error_msg);
519 519
 		} else {
520
-			$message->set_STS_ID( EEM_Message::status_idle );
520
+			$message->set_STS_ID(EEM_Message::status_idle);
521 521
 		}
522 522
 		return $message;
523 523
 	}
@@ -551,14 +551,14 @@  discard block
 block discarded – undo
551 551
 	 * @param array $addressees  Keys correspond to contexts for the message type and values are EE_Messages_Addressee[]
552 552
 	 * @return bool
553 553
 	 */
554
-	protected function _valid_addressees( $addressees ) {
555
-		if ( ! $addressees || ! is_array( $addressees ) ) {
554
+	protected function _valid_addressees($addressees) {
555
+		if ( ! $addressees || ! is_array($addressees)) {
556 556
 			return false;
557 557
 		}
558 558
 
559
-		foreach( $addressees as $addressee_array ) {
560
-			foreach ( $addressee_array as $addressee ) {
561
-				if ( ! $addressee instanceof EE_Messages_Addressee ) {
559
+		foreach ($addressees as $addressee_array) {
560
+			foreach ($addressee_array as $addressee) {
561
+				if ( ! $addressee instanceof EE_Messages_Addressee) {
562 562
 					return false;
563 563
 				}
564 564
 			}
@@ -579,19 +579,19 @@  discard block
 block discarded – undo
579 579
 	protected function _validate_messenger_and_message_type() {
580 580
 
581 581
 		//first are there any existing error messages?  If so then return.
582
-		if ( $this->_error_msg ) {
582
+		if ($this->_error_msg) {
583 583
 			return false;
584 584
 		}
585 585
 		/** @type EE_Message $message */
586 586
 		$message = $this->_generation_queue->get_message_repository()->current();
587 587
 		try {
588
-			$this->_current_messenger = $message->valid_messenger( true ) ? $message->messenger_object() : null;
589
-		} catch ( Exception $e ) {
588
+			$this->_current_messenger = $message->valid_messenger(true) ? $message->messenger_object() : null;
589
+		} catch (Exception $e) {
590 590
 			$this->_error_msg[] = $e->getMessage();
591 591
 		}
592 592
 		try {
593
-			$this->_current_message_type = $message->valid_message_type( true ) ? $message->message_type_object() : null;
594
-		} catch ( Exception $e ) {
593
+			$this->_current_message_type = $message->valid_message_type(true) ? $message->message_type_object() : null;
594
+		} catch (Exception $e) {
595 595
 			$this->_error_msg[] = $e->getMessage();
596 596
 		}
597 597
 
@@ -603,10 +603,10 @@  discard block
 block discarded – undo
603 603
 			     ! $this->_generation_queue->get_message_repository()->is_preview()
604 604
 			     && $this->_generation_queue->get_message_repository()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' )
605 605
 		) {
606
-			$this->_error_msg[] = __( 'There is no generation data for this message. Unable to generate.' );
606
+			$this->_error_msg[] = __('There is no generation data for this message. Unable to generate.');
607 607
 		}
608 608
 
609
-		return empty( $this->_error_msg );
609
+		return empty($this->_error_msg);
610 610
 	}
611 611
 
612 612
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 
624 624
 		//First, are there any existing error messages?  If so, return because if there were errors elsewhere this can't
625 625
 		//be used anyways.
626
-		if ( $this->_error_msg ) {
626
+		if ($this->_error_msg) {
627 627
 			return false;
628 628
 		}
629 629
 
@@ -632,29 +632,29 @@  discard block
 block discarded – undo
632 632
 		/** @type EE_Messages_incoming_data $data_handler_class_name - well not really... just the class name actually */
633 633
 		$data_handler_class_name = $this->_generation_queue->get_message_repository()->get_data_handler()
634 634
 			? $this->_generation_queue->get_message_repository()->get_data_handler()
635
-			: 'EE_Messages_' .  $this->_current_message_type->get_data_handler( $generation_data ) . '_incoming_data';
635
+			: 'EE_Messages_'.$this->_current_message_type->get_data_handler($generation_data).'_incoming_data';
636 636
 
637 637
 		//If this EE_Message is for a preview, then let's switch out to the preview data handler.
638
-		if ( $this->_generation_queue->get_message_repository()->is_preview() ) {
639
-			$data_handler_class_name  = 'EE_Messages_Preview_incoming_data';
638
+		if ($this->_generation_queue->get_message_repository()->is_preview()) {
639
+			$data_handler_class_name = 'EE_Messages_Preview_incoming_data';
640 640
 		}
641 641
 
642 642
 		//First get the class name for the data handler (and also verifies it exists.
643
-		if ( ! class_exists( $data_handler_class_name ) ) {
643
+		if ( ! class_exists($data_handler_class_name)) {
644 644
 			$this->_error_msg[] = sprintf(
645
-				__( 'The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes.  Looking for %s.', 'event_espresso' ),
645
+				__('The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes.  Looking for %s.', 'event_espresso'),
646 646
 				$data_handler_class_name
647 647
 			);
648 648
 			return false;
649 649
 		}
650 650
 
651 651
 		//convert generation_data for data_handler_instantiation.
652
-		$generation_data = $data_handler_class_name::convert_data_from_persistent_storage( $generation_data );
652
+		$generation_data = $data_handler_class_name::convert_data_from_persistent_storage($generation_data);
653 653
 
654 654
 		//note, this may set error messages as well.
655
-		$this->_set_data_handler( $generation_data, $data_handler_class_name );
655
+		$this->_set_data_handler($generation_data, $data_handler_class_name);
656 656
 
657
-		return empty( $this->_error_msg );
657
+		return empty($this->_error_msg);
658 658
 	}
659 659
 
660 660
 
@@ -671,16 +671,16 @@  discard block
 block discarded – undo
671 671
 	 *
672 672
 	 * @return void.
673 673
 	 */
674
-	protected function _set_data_handler( $generating_data, $data_handler_class_name ) {
674
+	protected function _set_data_handler($generating_data, $data_handler_class_name) {
675 675
 		//valid classname for the data handler.  Now let's setup the key for the data handler repository to see if there
676 676
 		//is already a ready data handler in the repository.
677
-		$this->_current_data_handler = $this->_data_handler_collection->get_by_key( $this->_data_handler_collection->get_key( $data_handler_class_name, $generating_data ) );
678
-		if ( ! $this->_current_data_handler instanceof EE_messages_incoming_data ) {
677
+		$this->_current_data_handler = $this->_data_handler_collection->get_by_key($this->_data_handler_collection->get_key($data_handler_class_name, $generating_data));
678
+		if ( ! $this->_current_data_handler instanceof EE_messages_incoming_data) {
679 679
 			//no saved data_handler in the repo so let's set one up and add it to the repo.
680 680
 			try {
681
-				$this->_current_data_handler = new $data_handler_class_name( $generating_data );
682
-				$this->_data_handler_collection->add( $this->_current_data_handler, $generating_data );
683
-			} catch( EE_Error $e ) {
681
+				$this->_current_data_handler = new $data_handler_class_name($generating_data);
682
+				$this->_data_handler_collection->add($this->_current_data_handler, $generating_data);
683
+			} catch (EE_Error $e) {
684 684
 				$this->_error_msg[] = $e->get_error();
685 685
 			}
686 686
 		}
@@ -700,13 +700,13 @@  discard block
 block discarded – undo
700 700
 	 * @param bool                   $preview Indicate whether this is being used for a preview or not.
701 701
 	 * @return mixed Prepped data for persisting to the queue.  false is returned if unable to prep data.
702 702
 	 */
703
-	protected function _prepare_data_for_queue( EE_Message_To_Generate $message_to_generate, $preview ) {
703
+	protected function _prepare_data_for_queue(EE_Message_To_Generate $message_to_generate, $preview) {
704 704
 		/** @type EE_Messages_incoming_data $data_handler - well not really... just the class name actually */
705
-		$data_handler = $message_to_generate->get_data_handler_class_name( $preview );
706
-		if ( ! $message_to_generate->valid() ) {
705
+		$data_handler = $message_to_generate->get_data_handler_class_name($preview);
706
+		if ( ! $message_to_generate->valid()) {
707 707
 			return false; //unable to get the data because the info in the EE_Message_To_Generate class is invalid.
708 708
 		}
709
-		return $data_handler::convert_data_for_persistent_storage( $message_to_generate->data() );
709
+		return $data_handler::convert_data_for_persistent_storage($message_to_generate->data());
710 710
 	}
711 711
 
712 712
 
@@ -719,26 +719,26 @@  discard block
 block discarded – undo
719 719
 	 * @param EE_Message_To_Generate $message_to_generate
720 720
 	 * @param bool                   $test_send Whether this is just a test send or not.  Typically used for previews.
721 721
 	 */
722
-	public function create_and_add_message_to_queue( EE_Message_To_Generate $message_to_generate, $test_send = false ) {
722
+	public function create_and_add_message_to_queue(EE_Message_To_Generate $message_to_generate, $test_send = false) {
723 723
 		//prep data
724
-		$data = $this->_prepare_data_for_queue( $message_to_generate, $message_to_generate->preview() );
724
+		$data = $this->_prepare_data_for_queue($message_to_generate, $message_to_generate->preview());
725 725
 
726 726
 		$message = $message_to_generate->get_EE_Message();
727 727
 
728 728
 		//is there a GRP_ID in the request?
729
-		if ( $GRP_ID = EE_Registry::instance()->REQ->get( 'GRP_ID' ) ) {
730
-			$message->set_GRP_ID( $GRP_ID );
729
+		if ($GRP_ID = EE_Registry::instance()->REQ->get('GRP_ID')) {
730
+			$message->set_GRP_ID($GRP_ID);
731 731
 		}
732 732
 
733
-		if ( $data === false ) {
734
-			$message->set_STS_ID( EEM_Message::status_failed );
735
-			$message->set_error_message( __( 'Unable to prepare data for persistence to the database.', 'event_espresso' ) );
733
+		if ($data === false) {
734
+			$message->set_STS_ID(EEM_Message::status_failed);
735
+			$message->set_error_message(__('Unable to prepare data for persistence to the database.', 'event_espresso'));
736 736
 		} else {
737 737
 			//make sure that the data handler is cached on the message as well
738 738
 			$data['data_handler_class_name'] = $message_to_generate->get_data_handler_class_name();
739 739
 		}
740 740
 
741
-		$this->_generation_queue->add( $message, $data, $message_to_generate->preview(), $test_send );
741
+		$this->_generation_queue->add($message, $data, $message_to_generate->preview(), $test_send);
742 742
 	}
743 743
 
744 744
 
Please login to merge, or discard this patch.
form_sections/strategies/display/EE_Select2_Display_Strategy.strategy.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @since 				$VID:$
13 13
  *
14 14
  */
15
-class EE_Select2_Display_Strategy extends EE_Select_Display_Strategy{
15
+class EE_Select2_Display_Strategy extends EE_Select_Display_Strategy {
16 16
 	
17 17
 	/**
18 18
 	 * Arguments that will be passed into the select2 javascript constructor
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @param array $select2_js_args pass in the EXACT array of JS arguments you want
26 26
 	 * to pass into the select2 js/html input. See https://select2.github.io
27 27
 	 */
28
-	public function __construct( $select2_js_args = array() ) {
28
+	public function __construct($select2_js_args = array()) {
29 29
 		$this->_select2_js_args = $select2_js_args;
30 30
 		parent::__construct();
31 31
 	}
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 	 * the select2 css
36 36
 	 */
37 37
 	public function enqueue_js() {
38
-		wp_enqueue_script( 'form_section_select2_init', EE_GLOBAL_ASSETS_URL . 'scripts/form_section_select2_init.js', array( 'select2' ), '1.0.0', true );
39
-		wp_enqueue_style( 'select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all' );
38
+		wp_enqueue_script('form_section_select2_init', EE_GLOBAL_ASSETS_URL.'scripts/form_section_select2_init.js', array('select2'), '1.0.0', true);
39
+		wp_enqueue_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all');
40 40
 	}
41 41
 	
42 42
 	/**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * Sets the exact js args which will be passed into the select2 js/html input
52 52
 	 * @param array $js_args
53 53
 	 */
54
-	public function set_js_args( $js_args ) {
54
+	public function set_js_args($js_args) {
55 55
 		$this->_select2_js_args = $js_args;
56 56
 	}
57 57
 	
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 	 * @param array $other_js_data
61 61
 	 * @return array
62 62
 	 */
63
-	public function get_other_js_data( $other_js_data = array() ) {
64
-		$other_js_data = parent::get_other_js_data( $other_js_data );
65
-		if( ! isset( $other_js_data[ 'select2s' ] ) ) {
63
+	public function get_other_js_data($other_js_data = array()) {
64
+		$other_js_data = parent::get_other_js_data($other_js_data);
65
+		if ( ! isset($other_js_data['select2s'])) {
66 66
 			$other_js_data['select2s'] = array();
67 67
 		}
68
-		$other_js_data[ 'select2s' ][ $this->_input->html_id() ] = $this->get_js_args();
68
+		$other_js_data['select2s'][$this->_input->html_id()] = $this->get_js_args();
69 69
 		return $other_js_data;
70 70
 	}
71 71
 }
72 72
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/form_sections/base/EE_Form_Section_Proper.form.php 1 patch
Spacing   +181 added lines, -181 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * before the hook wp_enqueue_scripts is called (so that the form section can enqueue its needed scripts).
8 8
  * However, you may output the form (usually by calling get_html) anywhere you like.
9 9
  */
10
-class EE_Form_Section_Proper extends EE_Form_Section_Validatable{
10
+class EE_Form_Section_Proper extends EE_Form_Section_Validatable {
11 11
 
12 12
 	/**
13 13
 	 * Subsections
@@ -69,49 +69,49 @@  discard block
 block discarded – undo
69 69
 	 *                               } @see EE_Form_Section_Validatable::__construct()
70 70
 	 * @throws \EE_Error
71 71
 	 */
72
-	public function __construct( $options_array = array() ){
73
-		$options_array = (array) apply_filters( 'FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this );
72
+	public function __construct($options_array = array()) {
73
+		$options_array = (array) apply_filters('FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this);
74 74
 		//call parent first, as it may be setting the name
75 75
 		parent::__construct($options_array);
76 76
 		//if they've included subsections in the constructor, add them now
77
-		if( isset( $options_array['include'] )){
77
+		if (isset($options_array['include'])) {
78 78
 			//we are going to make sure we ONLY have those subsections to include
79 79
 			//AND we are going to make sure they're in that specified order
80 80
 			$reordered_subsections = array();
81
-			foreach($options_array['include'] as $input_name){
82
-				if(isset($this->_subsections[$input_name])){
81
+			foreach ($options_array['include'] as $input_name) {
82
+				if (isset($this->_subsections[$input_name])) {
83 83
 					$reordered_subsections[$input_name] = $this->_subsections[$input_name];
84 84
 				}
85 85
 			}
86 86
 			$this->_subsections = $reordered_subsections;
87 87
 		}
88
-		if(isset($options_array['exclude'])){
88
+		if (isset($options_array['exclude'])) {
89 89
 			$exclude = $options_array['exclude'];
90 90
 			$this->_subsections = array_diff_key($this->_subsections, array_flip($exclude));
91 91
 		}
92
-		if(isset($options_array['layout_strategy'])){
92
+		if (isset($options_array['layout_strategy'])) {
93 93
 			$this->_layout_strategy = $options_array['layout_strategy'];
94 94
 		}
95
-		if( ! $this->_layout_strategy){
95
+		if ( ! $this->_layout_strategy) {
96 96
 			$this->_layout_strategy = new EE_Two_Column_Layout();
97 97
 		}
98 98
 		$this->_layout_strategy->_construct_finalize($this);
99 99
 
100 100
 		//ok so we are definitely going to want the forms JS,
101 101
 		//so enqueue it or remember to enqueue it during wp_enqueue_scripts
102
-		if( did_action( 'wp_enqueue_scripts' )
103
-			|| did_action( 'admin_enqueue_scripts' ) ) {
102
+		if (did_action('wp_enqueue_scripts')
103
+			|| did_action('admin_enqueue_scripts')) {
104 104
 			//ok so they've constructed this object after when they should have.
105 105
 			//just enqueue the generic form scripts and initialize the form immediately in the JS
106
-			\EE_Form_Section_Proper::wp_enqueue_scripts( true );
106
+			\EE_Form_Section_Proper::wp_enqueue_scripts(true);
107 107
 		} else {
108
-			add_action( 'wp_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
109
-			add_action( 'admin_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
108
+			add_action('wp_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
109
+			add_action('admin_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
110 110
 		}
111
-		add_action( 'wp_footer', array( $this, 'ensure_scripts_localized' ), 1 );
111
+		add_action('wp_footer', array($this, 'ensure_scripts_localized'), 1);
112 112
 
113
-		if( isset( $options_array[ 'name' ] ) ) {
114
-			$this->_construct_finalize( null, $options_array[ 'name' ] );
113
+		if (isset($options_array['name'])) {
114
+			$this->_construct_finalize(null, $options_array['name']);
115 115
 		}
116 116
 	}
117 117
 
@@ -124,25 +124,25 @@  discard block
 block discarded – undo
124 124
 	 * @param string                 $name
125 125
 	 * @throws \EE_Error
126 126
 	 */
127
-	public function _construct_finalize( $parent_form_section, $name ) {
127
+	public function _construct_finalize($parent_form_section, $name) {
128 128
 		parent::_construct_finalize($parent_form_section, $name);
129 129
 		$this->_set_default_name_if_empty();
130 130
 		$this->_set_default_html_id_if_empty();
131
-		foreach( $this->_subsections as $subsection_name => $subsection ){
132
-			if ( $subsection instanceof EE_Form_Section_Base ) {
133
-				$subsection->_construct_finalize( $this, $subsection_name );
131
+		foreach ($this->_subsections as $subsection_name => $subsection) {
132
+			if ($subsection instanceof EE_Form_Section_Base) {
133
+				$subsection->_construct_finalize($this, $subsection_name);
134 134
 			} else {
135 135
 				throw new EE_Error(
136 136
 					sprintf(
137
-						__( 'Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso' ),
137
+						__('Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso'),
138 138
 						$subsection_name,
139 139
 						get_class($this),
140
-						$subsection ? get_class($subsection) : __( 'NULL', 'event_espresso' )
140
+						$subsection ? get_class($subsection) : __('NULL', 'event_espresso')
141 141
 					)
142 142
 				);
143 143
 			}
144 144
 		}
145
-		do_action( 'AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name );
145
+		do_action('AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name);
146 146
 	}
147 147
 
148 148
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * Gets the layout strategy for this form section
152 152
 	 * @return EE_Form_Section_Layout_Base
153 153
 	 */
154
-	public function get_layout_strategy(){
154
+	public function get_layout_strategy() {
155 155
 		return $this->_layout_strategy;
156 156
 	}
157 157
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @param EE_Form_Input_Base $input
164 164
 	 * @return string
165 165
 	 */
166
-	public function get_html_for_input($input){
166
+	public function get_html_for_input($input) {
167 167
 		return $this->_layout_strategy->layout_input($input);
168 168
 	}
169 169
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 * @param null $form_data
177 177
 	 * @return boolean
178 178
 	 */
179
-	public function was_submitted($form_data = NULL){
179
+	public function was_submitted($form_data = NULL) {
180 180
 		return $this->form_data_present_in($form_data);
181 181
 	}
182 182
 
@@ -201,17 +201,17 @@  discard block
 block discarded – undo
201 201
 	 *                          (eg you validated the data then stored it in the DB) you may want to skip this step.
202 202
 	 * @return void
203 203
 	 */
204
-	public function receive_form_submission($req_data = NULL, $validate = TRUE){
205
-		$req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate );
206
-		if( $req_data === NULL){
207
-			$req_data = array_merge( $_GET, $_POST );
204
+	public function receive_form_submission($req_data = NULL, $validate = TRUE) {
205
+		$req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate);
206
+		if ($req_data === NULL) {
207
+			$req_data = array_merge($_GET, $_POST);
208 208
 		}
209
-		$req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', $req_data, $this );
209
+		$req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', $req_data, $this);
210 210
 		$this->_normalize($req_data);
211
-		if( $validate ){
211
+		if ($validate) {
212 212
 			$this->_validate();
213 213
 		}
214
-		do_action( 'AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate );
214
+		do_action('AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate);
215 215
 	}
216 216
 
217 217
 
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
 	 * the value being an array formatted in teh same way
225 225
 	 * @param array $default_data
226 226
 	 */
227
-	public function populate_defaults($default_data){
228
-		foreach($this->subsections() as $subsection_name => $subsection){
229
-			if(isset($default_data[$subsection_name])){
230
-				if($subsection instanceof EE_Form_Input_Base){
227
+	public function populate_defaults($default_data) {
228
+		foreach ($this->subsections() as $subsection_name => $subsection) {
229
+			if (isset($default_data[$subsection_name])) {
230
+				if ($subsection instanceof EE_Form_Input_Base) {
231 231
 					$subsection->set_default($default_data[$subsection_name]);
232
-				}elseif($subsection instanceof EE_Form_Section_Proper){
232
+				}elseif ($subsection instanceof EE_Form_Section_Proper) {
233 233
 					$subsection->populate_defaults($default_data[$subsection_name]);
234 234
 				}
235 235
 			}
@@ -251,8 +251,8 @@  discard block
 block discarded – undo
251 251
 	 * @return EE_Form_Section_Base
252 252
 	 * @throws \EE_Error
253 253
 	 */
254
-	public function get_subsection($name, $require_construction_to_be_finalized = TRUE ){
255
-		if( $require_construction_to_be_finalized ){
254
+	public function get_subsection($name, $require_construction_to_be_finalized = TRUE) {
255
+		if ($require_construction_to_be_finalized) {
256 256
 			$this->ensure_construct_finalized_called();
257 257
 		}
258 258
 		return isset($this->_subsections[$name]) ? $this->_subsections[$name] : NULL;
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
 	 * Gets all the validatable subsections of this form section
265 265
 	 * @return EE_Form_Section_Validatable[]
266 266
 	 */
267
-	public function get_validatable_subsections(){
267
+	public function get_validatable_subsections() {
268 268
 		$validatable_subsections = array();
269
-		foreach($this->subsections() as $name=>$obj){
270
-			if($obj instanceof EE_Form_Section_Validatable){
269
+		foreach ($this->subsections() as $name=>$obj) {
270
+			if ($obj instanceof EE_Form_Section_Validatable) {
271 271
 				$validatable_subsections[$name] = $obj;
272 272
 			}
273 273
 		}
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 	 * @return EE_Form_Input_Base
288 288
 	 * @throws EE_Error
289 289
 	 */
290
-	public function get_input($name, $require_construction_to_be_finalized = TRUE ){
290
+	public function get_input($name, $require_construction_to_be_finalized = TRUE) {
291 291
 		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
292
-		if( ! $subsection instanceof EE_Form_Input_Base){
293
-			throw new EE_Error(sprintf(__("Subsection '%s' is not an instanceof EE_Form_Input_Base on form '%s'. It is a '%s'", 'event_espresso'),$name, get_class($this),$subsection ? get_class($subsection) : __("NULL", 'event_espresso')));
292
+		if ( ! $subsection instanceof EE_Form_Input_Base) {
293
+			throw new EE_Error(sprintf(__("Subsection '%s' is not an instanceof EE_Form_Input_Base on form '%s'. It is a '%s'", 'event_espresso'), $name, get_class($this), $subsection ? get_class($subsection) : __("NULL", 'event_espresso')));
294 294
 		}
295 295
 		return $subsection;
296 296
 	}
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
 	 * @return EE_Form_Section_Proper
309 309
 	 * @throws EE_Error
310 310
 	 */
311
-	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE ){
312
-		$subsection = $this->get_subsection( $name, $require_construction_to_be_finalized );
313
-		if( ! $subsection instanceof EE_Form_Section_Proper){
314
-			throw new EE_Error(sprintf(__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'),$name, get_class($this)));
311
+	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE) {
312
+		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
313
+		if ( ! $subsection instanceof EE_Form_Section_Proper) {
314
+			throw new EE_Error(sprintf(__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'), $name, get_class($this)));
315 315
 		}
316 316
 		return $subsection;
317 317
 	}
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	 * @return mixed depending on the input's type and its normalization strategy
327 327
 	 * @throws \EE_Error
328 328
 	 */
329
-	public function get_input_value($name){
329
+	public function get_input_value($name) {
330 330
 		$input = $this->get_input($name);
331 331
 		return $input->normalized_value();
332 332
 	}
@@ -339,16 +339,16 @@  discard block
 block discarded – undo
339 339
 	 * @return boolean
340 340
 	 */
341 341
 	public function is_valid() {
342
-		if( ! $this->has_received_submission()){
342
+		if ( ! $this->has_received_submission()) {
343 343
 			throw new EE_Error(sprintf(__("You cannot check if a form is valid before receiving the form submission using receive_form_submission", "event_espresso")));
344 344
 		}
345
-		if( ! parent::is_valid()){
345
+		if ( ! parent::is_valid()) {
346 346
 			return false;
347 347
 		}
348 348
 		//ok so no errors general to this entire form section. so let's check the subsections
349
-		foreach( $this->get_validatable_subsections() as $subsection ){
350
-			if( ! $subsection->is_valid() || $subsection->get_validation_error_string() !== '' ){
351
-				$this->set_submission_error_message( $subsection->get_validation_error_string() );
349
+		foreach ($this->get_validatable_subsections() as $subsection) {
350
+			if ( ! $subsection->is_valid() || $subsection->get_validation_error_string() !== '') {
351
+				$this->set_submission_error_message($subsection->get_validation_error_string());
352 352
 				return false;
353 353
 			}
354 354
 		}
@@ -361,11 +361,11 @@  discard block
 block discarded – undo
361 361
 	 * gets teh default name of this form section if none is specified
362 362
 	 * @return string
363 363
 	 */
364
-	protected function _set_default_name_if_empty(){
365
-		if( ! $this->_name ){
364
+	protected function _set_default_name_if_empty() {
365
+		if ( ! $this->_name) {
366 366
 			$classname = get_class($this);
367 367
 			$default_name = str_replace("EE_", "", $classname);
368
-			$this->_name =  $default_name;
368
+			$this->_name = $default_name;
369 369
 		}
370 370
 	}
371 371
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	 *             and get_html when you are about to display the form.
381 381
 	 * @throws \EE_Error
382 382
 	 */
383
-	public function get_html_and_js(){
383
+	public function get_html_and_js() {
384 384
 		//no doing_it_wrong yet because we ourselves are still doing it wrong...
385 385
 		//and theoretically this CAN be used properly, provided its used during "wp_enqueue_scripts"
386 386
 		$this->enqueue_js();
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 	 * @return string
396 396
 	 * @throws \EE_Error
397 397
 	 */
398
-	public function get_html(){
398
+	public function get_html() {
399 399
 		$this->ensure_construct_finalized_called();
400 400
 		return $this->_layout_strategy->layout_form();
401 401
 	}
@@ -408,9 +408,9 @@  discard block
 block discarded – undo
408 408
 	 * @return string
409 409
 	 * @throws \EE_Error
410 410
 	 */
411
-	public function enqueue_js(){
411
+	public function enqueue_js() {
412 412
 		$this->_enqueue_and_localize_form_js();
413
-		foreach( $this->subsections() as $subsection ) {
413
+		foreach ($this->subsections() as $subsection) {
414 414
 			$subsection->enqueue_js();
415 415
 		}
416 416
 	}
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
 	 * @param boolean $init_form_validation_automatically whether or not we want the form validation to be triggered automatically or not
428 428
 	 * @return void
429 429
 	 */
430
-	public static function wp_enqueue_scripts( $init_form_validation_automatically = true ){
431
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
432
-		wp_register_script( 'ee_form_section_validation', EE_GLOBAL_ASSETS_URL . 'scripts' . DS . 'form_section_validation.js', array( 'jquery-validate', 'jquery-ui-datepicker', 'jquery-validate-extra-methods' ), EVENT_ESPRESSO_VERSION, TRUE );
433
-		wp_localize_script( 'ee_form_section_validation', 'ee_form_section_validation_init', array( 'init' => $init_form_validation_automatically ? true : false ) );
430
+	public static function wp_enqueue_scripts($init_form_validation_automatically = true) {
431
+		add_filter('FHEE_load_jquery_validate', '__return_true');
432
+		wp_register_script('ee_form_section_validation', EE_GLOBAL_ASSETS_URL.'scripts'.DS.'form_section_validation.js', array('jquery-validate', 'jquery-ui-datepicker', 'jquery-validate-extra-methods'), EVENT_ESPRESSO_VERSION, TRUE);
433
+		wp_localize_script('ee_form_section_validation', 'ee_form_section_validation_init', array('init' => $init_form_validation_automatically ? true : false));
434 434
 	}
435 435
 
436 436
 
@@ -442,14 +442,14 @@  discard block
 block discarded – undo
442 442
 	 *
443 443
 	 * @throws \EE_Error
444 444
 	 */
445
-	public function _enqueue_and_localize_form_js(){
445
+	public function _enqueue_and_localize_form_js() {
446 446
 		$this->ensure_construct_finalized_called();
447 447
 		//actually, we don't want to localize just yet. There may be other forms on the page.
448 448
 		//so we need to add our form section data to a static variable accessible by all form sections
449 449
 		//and localize it just before the footer
450 450
 		$this->localize_validation_rules();
451
-		add_action( 'wp_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ), 2 );
452
-		add_action( 'admin_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ) );
451
+		add_action('wp_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'), 2);
452
+		add_action('admin_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'));
453 453
 	}
454 454
 
455 455
 
@@ -461,11 +461,11 @@  discard block
 block discarded – undo
461 461
 	 * @return void
462 462
 	 * @throws \EE_Error
463 463
 	 */
464
-	public function localize_validation_rules( $return_for_subsection = FALSE ){
464
+	public function localize_validation_rules($return_for_subsection = FALSE) {
465 465
 		// we only want to localize vars ONCE for the entire form, so if the form section doesn't have a parent, then it must be the top dog
466
-		if ( $return_for_subsection || ! $this->parent_section() ) {
467
-			EE_Form_Section_Proper::$_js_localization['form_data'][ $this->html_id() ] = array(
468
-				'form_section_id'=> $this->html_id( TRUE ),
466
+		if ($return_for_subsection || ! $this->parent_section()) {
467
+			EE_Form_Section_Proper::$_js_localization['form_data'][$this->html_id()] = array(
468
+				'form_section_id'=> $this->html_id(TRUE),
469 469
 				'validation_rules'=> $this->get_jquery_validation_rules(),
470 470
 				'other_data' => $this->get_other_js_data(),
471 471
 				'errors'=> $this->subsection_validation_errors_by_html_name()
@@ -481,9 +481,9 @@  discard block
 block discarded – undo
481 481
 	 * @param array $form_other_js_data
482 482
 	 * @return array
483 483
 	 */
484
-	public function get_other_js_data( $form_other_js_data = array() ) {
485
-		foreach( $this->subsections() as $subsection ) {
486
-			$form_other_js_data = $subsection->get_other_js_data( $form_other_js_data );
484
+	public function get_other_js_data($form_other_js_data = array()) {
485
+		foreach ($this->subsections() as $subsection) {
486
+			$form_other_js_data = $subsection->get_other_js_data($form_other_js_data);
487 487
 		}
488 488
 		return $form_other_js_data;
489 489
 	}
@@ -494,12 +494,12 @@  discard block
 block discarded – undo
494 494
 	 * Keys are their form names, and values are the inputs themselves
495 495
 	 * @return EE_Form_Input_Base
496 496
 	 */
497
-	public function inputs_in_subsections(){
497
+	public function inputs_in_subsections() {
498 498
 		$inputs = array();
499
-		foreach($this->subsections() as $subsection){
500
-			if( $subsection instanceof EE_Form_Input_Base ){
501
-				$inputs[ $subsection->html_name() ] = $subsection;
502
-			}elseif($subsection instanceof EE_Form_Section_Proper ){
499
+		foreach ($this->subsections() as $subsection) {
500
+			if ($subsection instanceof EE_Form_Input_Base) {
501
+				$inputs[$subsection->html_name()] = $subsection;
502
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
503 503
 				$inputs += $subsection->inputs_in_subsections();
504 504
 			}
505 505
 		}
@@ -512,12 +512,12 @@  discard block
 block discarded – undo
512 512
 	 * and values are a string of all their validation errors
513 513
 	 * @return string[]
514 514
 	 */
515
-	public function subsection_validation_errors_by_html_name(){
515
+	public function subsection_validation_errors_by_html_name() {
516 516
 		$inputs = $this->inputs();
517 517
 		$errors = array();
518
-		foreach( $inputs as $form_input ){
519
-			if ( $form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors() ){
520
-				$errors[ $form_input->html_name() ] = $form_input->get_validation_error_string();
518
+		foreach ($inputs as $form_input) {
519
+			if ($form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors()) {
520
+				$errors[$form_input->html_name()] = $form_input->get_validation_error_string();
521 521
 			}
522 522
 		}
523 523
 		return $errors;
@@ -529,16 +529,16 @@  discard block
 block discarded – undo
529 529
 	 * passes all the form data required by the JS to the JS, and enqueues the few required JS files.
530 530
 	 * Should be setup by each form during the _enqueues_and_localize_form_js
531 531
 	 */
532
-	public static function localize_script_for_all_forms(){
532
+	public static function localize_script_for_all_forms() {
533 533
 		//allow inputs and stuff to hook in their JS and stuff here
534 534
 		do_action('AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin');
535 535
 		EE_Form_Section_Proper::$_js_localization['localized_error_messages'] = EE_Form_Section_Proper::_get_localized_error_messages();
536
-		$email_validation_level = isset( EE_Registry::instance()->CFG->registration->email_validation_level )
536
+		$email_validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level)
537 537
 			? EE_Registry::instance()->CFG->registration->email_validation_level
538 538
 			: 'wp_default';
539 539
 		EE_Form_Section_Proper::$_js_localization['email_validation_level'] = $email_validation_level;
540
-		wp_enqueue_script( 'ee_form_section_validation' );
541
-		wp_localize_script( 'ee_form_section_validation', 'ee_form_section_vars', EE_Form_Section_Proper::$_js_localization );
540
+		wp_enqueue_script('ee_form_section_validation');
541
+		wp_localize_script('ee_form_section_validation', 'ee_form_section_vars', EE_Form_Section_Proper::$_js_localization);
542 542
 	}
543 543
 
544 544
 
@@ -546,8 +546,8 @@  discard block
 block discarded – undo
546 546
 	/**
547 547
 	 * ensure_scripts_localized
548 548
 	 */
549
-	public function ensure_scripts_localized(){
550
-		if ( ! EE_Form_Section_Proper::$_scripts_localized ) {
549
+	public function ensure_scripts_localized() {
550
+		if ( ! EE_Form_Section_Proper::$_scripts_localized) {
551 551
 			$this->_enqueue_and_localize_form_js();
552 552
 		}
553 553
 	}
@@ -559,10 +559,10 @@  discard block
 block discarded – undo
559 559
 	 * is that the key here should be the same as the custom validation rule put in the JS file
560 560
 	 * @return array keys are custom validation rules, and values are internationalized strings
561 561
 	 */
562
-	private static function _get_localized_error_messages(){
562
+	private static function _get_localized_error_messages() {
563 563
 		return array(
564 564
 			'validUrl'=>  __("This is not a valid absolute URL. Eg, http://domain.com/monkey.jpg", "event_espresso"),
565
-			'regex' => __( 'Please check your input', 'event_espresso' ),
565
+			'regex' => __('Please check your input', 'event_espresso'),
566 566
 		);
567 567
 	}
568 568
 
@@ -590,10 +590,10 @@  discard block
 block discarded – undo
590 590
 	 * Gets the JS to put inside the jquery validation rules for subsection of this form section. See parent function for more...
591 591
 	 * @return array
592 592
 	 */
593
-	public function get_jquery_validation_rules(){
593
+	public function get_jquery_validation_rules() {
594 594
 		$jquery_validation_rules = array();
595
-		foreach($this->get_validatable_subsections() as $subsection){
596
-			$jquery_validation_rules = array_merge( $jquery_validation_rules,  $subsection->get_jquery_validation_rules() );
595
+		foreach ($this->get_validatable_subsections() as $subsection) {
596
+			$jquery_validation_rules = array_merge($jquery_validation_rules, $subsection->get_jquery_validation_rules());
597 597
 		}
598 598
 		return $jquery_validation_rules;
599 599
 	}
@@ -608,11 +608,11 @@  discard block
 block discarded – undo
608 608
 	protected function _normalize($req_data) {
609 609
 		$this->_received_submission = TRUE;
610 610
 		$this->_validation_errors = array();
611
-		foreach($this->get_validatable_subsections() as $subsection){
612
-			try{
611
+		foreach ($this->get_validatable_subsections() as $subsection) {
612
+			try {
613 613
 				$subsection->_normalize($req_data);
614
-			}catch( EE_Validation_Error $e ){
615
-				$subsection->add_validation_error( $e );
614
+			} catch (EE_Validation_Error $e) {
615
+				$subsection->add_validation_error($e);
616 616
 			}
617 617
 		}
618 618
 	}
@@ -626,9 +626,9 @@  discard block
 block discarded – undo
626 626
 	 * calling parent::_validate() first.
627 627
 	 */
628 628
 	protected function _validate() {
629
-		foreach($this->get_validatable_subsections() as $subsection_name => $subsection){
630
-			if(method_exists($this,'_validate_'.$subsection_name)){
631
-				call_user_func_array(array($this,'_validate_'.$subsection_name), array($subsection));
629
+		foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) {
630
+			if (method_exists($this, '_validate_'.$subsection_name)) {
631
+				call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection));
632 632
 			}
633 633
 			$subsection->_validate();
634 634
 		}
@@ -640,13 +640,13 @@  discard block
 block discarded – undo
640 640
 	 * Gets all the validated inputs for the form section
641 641
 	 * @return array
642 642
 	 */
643
-	public function valid_data(){
643
+	public function valid_data() {
644 644
 		$inputs = array();
645
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
646
-			if ( $subsection instanceof EE_Form_Section_Proper ) {
647
-				$inputs[ $subsection_name ] = $subsection->valid_data();
648
-			} else if ( $subsection instanceof EE_Form_Input_Base ){
649
-				$inputs[ $subsection_name ] = $subsection->normalized_value();
645
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
646
+			if ($subsection instanceof EE_Form_Section_Proper) {
647
+				$inputs[$subsection_name] = $subsection->valid_data();
648
+			} else if ($subsection instanceof EE_Form_Input_Base) {
649
+				$inputs[$subsection_name] = $subsection->normalized_value();
650 650
 			}
651 651
 		}
652 652
 		return $inputs;
@@ -658,11 +658,11 @@  discard block
 block discarded – undo
658 658
 	 * Gets all the inputs on this form section
659 659
 	 * @return EE_Form_Input_Base[]
660 660
 	 */
661
-	public function inputs(){
661
+	public function inputs() {
662 662
 		$inputs = array();
663
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
664
-			if ( $subsection instanceof EE_Form_Input_Base ){
665
-				$inputs[ $subsection_name ] = $subsection;
663
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
664
+			if ($subsection instanceof EE_Form_Input_Base) {
665
+				$inputs[$subsection_name] = $subsection;
666 666
 			}
667 667
 		}
668 668
 		return $inputs;
@@ -674,10 +674,10 @@  discard block
 block discarded – undo
674 674
 	 * Gets all the subsections which are a proper form
675 675
 	 * @return EE_Form_Section_Proper[]
676 676
 	 */
677
-	public function subforms(){
677
+	public function subforms() {
678 678
 		$form_sections = array();
679
-		foreach($this->subsections() as $name=>$obj){
680
-			if($obj instanceof EE_Form_Section_Proper){
679
+		foreach ($this->subsections() as $name=>$obj) {
680
+			if ($obj instanceof EE_Form_Section_Proper) {
681 681
 				$form_sections[$name] = $obj;
682 682
 			}
683 683
 		}
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 	 * if you only want form inputs or proper form sections.
693 693
 	 * @return EE_Form_Section_Proper[]
694 694
 	 */
695
-	public function subsections(){
695
+	public function subsections() {
696 696
 		$this->ensure_construct_finalized_called();
697 697
 		return $this->_subsections;
698 698
 	}
@@ -710,8 +710,8 @@  discard block
 block discarded – undo
710 710
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
711 711
 	 * input's normalized value, or an array like the top-level array
712 712
 	 */
713
-	public function input_values( $include_subform_inputs = false, $flatten = false ){
714
-		return $this->_input_values( false, $include_subform_inputs, $flatten );
713
+	public function input_values($include_subform_inputs = false, $flatten = false) {
714
+		return $this->_input_values(false, $include_subform_inputs, $flatten);
715 715
 	}
716 716
 
717 717
 	/**
@@ -727,8 +727,8 @@  discard block
 block discarded – undo
727 727
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
728 728
 	 * input's normalized value, or an array like the top-level array
729 729
 	 */
730
-	public function input_pretty_values(  $include_subform_inputs = false, $flatten = false ){
731
-		return $this->_input_values( true, $include_subform_inputs, $flatten );
730
+	public function input_pretty_values($include_subform_inputs = false, $flatten = false) {
731
+		return $this->_input_values(true, $include_subform_inputs, $flatten);
732 732
 	}
733 733
 
734 734
 	/**
@@ -741,17 +741,17 @@  discard block
 block discarded – undo
741 741
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
742 742
 	 * input's normalized value, or an array like the top-level array
743 743
 	 */
744
-	public function _input_values( $pretty = false, $include_subform_inputs = false, $flatten = false ) {
744
+	public function _input_values($pretty = false, $include_subform_inputs = false, $flatten = false) {
745 745
 		$input_values = array();
746
-		foreach( $this->subsections() as $subsection_name => $subsection ) {
747
-			if( $subsection instanceof EE_Form_Input_Base ) {
748
-				$input_values[ $subsection_name ] = $pretty ? $subsection->pretty_value() : $subsection->normalized_value();
749
-			} else if( $subsection instanceof EE_Form_Section_Proper && $include_subform_inputs ) {
750
-				$subform_input_values = $subsection->_input_values( $pretty, $include_subform_inputs, $flatten );
751
-				if( $flatten ) {
752
-					$input_values = array_merge( $input_values, $subform_input_values );
746
+		foreach ($this->subsections() as $subsection_name => $subsection) {
747
+			if ($subsection instanceof EE_Form_Input_Base) {
748
+				$input_values[$subsection_name] = $pretty ? $subsection->pretty_value() : $subsection->normalized_value();
749
+			} else if ($subsection instanceof EE_Form_Section_Proper && $include_subform_inputs) {
750
+				$subform_input_values = $subsection->_input_values($pretty, $include_subform_inputs, $flatten);
751
+				if ($flatten) {
752
+					$input_values = array_merge($input_values, $subform_input_values);
753 753
 				} else {
754
-					$input_values[ $subsection_name ] = $subform_input_values;
754
+					$input_values[$subsection_name] = $subform_input_values;
755 755
 				}
756 756
 			}
757 757
 		}
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 	 * @return boolean
768 768
 	 * @throws \EE_Error
769 769
 	 */
770
-	public function has_received_submission(){
770
+	public function has_received_submission() {
771 771
 		$this->ensure_construct_finalized_called();
772 772
 		return $this->_received_submission;
773 773
 	}
@@ -780,8 +780,8 @@  discard block
 block discarded – undo
780 780
 	 * @param array $inputs_to_exclude values are the input names
781 781
 	 * @return void
782 782
 	 */
783
-	public function exclude($inputs_to_exclude = array()){
784
-		foreach($inputs_to_exclude as $input_to_exclude_name){
783
+	public function exclude($inputs_to_exclude = array()) {
784
+		foreach ($inputs_to_exclude as $input_to_exclude_name) {
785 785
 			unset($this->_subsections[$input_to_exclude_name]);
786 786
 		}
787 787
 	}
@@ -792,8 +792,8 @@  discard block
 block discarded – undo
792 792
 	 * @param array $inputs_to_hide
793 793
 	 * @throws \EE_Error
794 794
 	 */
795
-	public function hide($inputs_to_hide= array()){
796
-		foreach($inputs_to_hide as $input_to_hide){
795
+	public function hide($inputs_to_hide = array()) {
796
+		foreach ($inputs_to_hide as $input_to_hide) {
797 797
 			$input = $this->get_input($input_to_hide);
798 798
 
799 799
 			$input->set_display_strategy(new EE_Hidden_Display_Strategy());
@@ -818,13 +818,13 @@  discard block
 block discarded – undo
818 818
 	 * @return void
819 819
 	 * @throws \EE_Error
820 820
 	 */
821
-	public function add_subsections( $new_subsections, $subsection_name_to_target = NULL, $add_before = true ){
822
-		foreach($new_subsections as $subsection_name => $subsection){
823
-			if( ! $subsection instanceof EE_Form_Section_Base){
821
+	public function add_subsections($new_subsections, $subsection_name_to_target = NULL, $add_before = true) {
822
+		foreach ($new_subsections as $subsection_name => $subsection) {
823
+			if ( ! $subsection instanceof EE_Form_Section_Base) {
824 824
 				EE_Error::add_error(
825 825
 					sprintf(
826 826
 						__("Trying to add a %s as a subsection (it was named '%s') to the form section '%s'. It was removed.", "event_espresso"),
827
-						get_class( $subsection ),
827
+						get_class($subsection),
828 828
 						$subsection_name,
829 829
 						$this->name()
830 830
 					)
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 			}
834 834
 		}
835 835
 
836
-		$this->_subsections = EEH_Array::insert_into_array( $this->_subsections, $new_subsections, $subsection_name_to_target, $add_before );
836
+		$this->_subsections = EEH_Array::insert_into_array($this->_subsections, $new_subsections, $subsection_name_to_target, $add_before);
837 837
 
838 838
 		/*$subsections_before = array();
839 839
 		if( $subsection_name_to_target ){
@@ -864,8 +864,8 @@  discard block
 block discarded – undo
864 864
 				$this->_subsections = $new_subsections;
865 865
 			}
866 866
 		}*/
867
-		if( $this->_construction_finalized ){
868
-			foreach($this->_subsections as $name => $subsection){
867
+		if ($this->_construction_finalized) {
868
+			foreach ($this->_subsections as $name => $subsection) {
869 869
 				$subsection->_construct_finalize($this, $name);
870 870
 			}
871 871
 		}
@@ -876,8 +876,8 @@  discard block
 block discarded – undo
876 876
 	/**
877 877
 	 * Just gets all validatable subsections to clean their sensitive data
878 878
 	 */
879
-	public function clean_sensitive_data(){
880
-		foreach($this->get_validatable_subsections() as $subsection){
879
+	public function clean_sensitive_data() {
880
+		foreach ($this->get_validatable_subsections() as $subsection) {
881 881
 			$subsection->clean_sensitive_data();
882 882
 		}
883 883
 	}
@@ -887,8 +887,8 @@  discard block
 block discarded – undo
887 887
 	/**
888 888
 	 * @param string $form_submission_error_message
889 889
 	 */
890
-	public function set_submission_error_message( $form_submission_error_message = '' ) {
891
-		$this->_form_submission_error_message .= ! empty( $form_submission_error_message ) ? $form_submission_error_message : __( 'Form submission failed due to errors', 'event_espresso' );
890
+	public function set_submission_error_message($form_submission_error_message = '') {
891
+		$this->_form_submission_error_message .= ! empty($form_submission_error_message) ? $form_submission_error_message : __('Form submission failed due to errors', 'event_espresso');
892 892
 	}
893 893
 
894 894
 
@@ -905,8 +905,8 @@  discard block
 block discarded – undo
905 905
 	/**
906 906
 	 * @param string $form_submission_success_message
907 907
 	 */
908
-	public function set_submission_success_message( $form_submission_success_message ) {
909
-		$this->_form_submission_success_message .= ! empty( $form_submission_success_message ) ? $form_submission_success_message : __( 'Form submitted successfully', 'event_espresso' );
908
+	public function set_submission_success_message($form_submission_success_message) {
909
+		$this->_form_submission_success_message .= ! empty($form_submission_success_message) ? $form_submission_success_message : __('Form submitted successfully', 'event_espresso');
910 910
 	}
911 911
 
912 912
 
@@ -929,10 +929,10 @@  discard block
 block discarded – undo
929 929
 	 * @return string
930 930
 	 * @throws \EE_Error
931 931
 	 */
932
-	public function html_name_prefix(){
933
-		if( $this->parent_section() instanceof EE_Form_Section_Proper ){
934
-			return $this->parent_section()->html_name_prefix() . '[' . $this->name() . ']';
935
-		}else{
932
+	public function html_name_prefix() {
933
+		if ($this->parent_section() instanceof EE_Form_Section_Proper) {
934
+			return $this->parent_section()->html_name_prefix().'['.$this->name().']';
935
+		} else {
936 936
 			return $this->name();
937 937
 		}
938 938
 	}
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
 	 * @return string
948 948
 	 * @throws \EE_Error
949 949
 	 */
950
-	public function name(){
950
+	public function name() {
951 951
 		$this->ensure_construct_finalized_called();
952 952
 		return parent::name();
953 953
 	}
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 	 * @return EE_Form_Section_Proper
959 959
 	 * @throws \EE_Error
960 960
 	 */
961
-	public function parent_section(){
961
+	public function parent_section() {
962 962
 		$this->ensure_construct_finalized_called();
963 963
 		return parent::parent_section();
964 964
 	}
@@ -971,9 +971,9 @@  discard block
 block discarded – undo
971 971
 	 * @return void
972 972
 	 * @throws \EE_Error
973 973
 	 */
974
-	public function ensure_construct_finalized_called(){
975
-		if( ! $this->_construction_finalized ){
976
-			$this->_construct_finalize($this->_parent_section, $this->_name );
974
+	public function ensure_construct_finalized_called() {
975
+		if ( ! $this->_construction_finalized) {
976
+			$this->_construct_finalize($this->_parent_section, $this->_name);
977 977
 		}
978 978
 	}
979 979
 
@@ -985,17 +985,17 @@  discard block
 block discarded – undo
985 985
 	 * @param array $req_data
986 986
 	 * @return boolean
987 987
 	 */
988
-	public function form_data_present_in( $req_data = NULL ) {
989
-		if( $req_data === NULL){
988
+	public function form_data_present_in($req_data = NULL) {
989
+		if ($req_data === NULL) {
990 990
 			$req_data = $_POST;
991 991
 		}
992
-		foreach( $this->subsections() as $subsection ) {
993
-			if($subsection instanceof EE_Form_Input_Base ) {
994
-				if( $subsection->form_data_present_in( $req_data ) ) {
992
+		foreach ($this->subsections() as $subsection) {
993
+			if ($subsection instanceof EE_Form_Input_Base) {
994
+				if ($subsection->form_data_present_in($req_data)) {
995 995
 					return TRUE;
996 996
 				}
997
-			}elseif( $subsection instanceof EE_Form_Section_Proper ) {
998
-				if( $subsection->form_data_present_in( $req_data ) ) {
997
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
998
+				if ($subsection->form_data_present_in($req_data)) {
999 999
 					return TRUE;
1000 1000
 				}
1001 1001
 			}
@@ -1012,14 +1012,14 @@  discard block
 block discarded – undo
1012 1012
 	 */
1013 1013
 	public function get_validation_errors_accumulated() {
1014 1014
 		$validation_errors = $this->get_validation_errors();
1015
-		foreach($this->get_validatable_subsections() as $subsection ) {
1016
-			if( $subsection instanceof EE_Form_Section_Proper ) {
1015
+		foreach ($this->get_validatable_subsections() as $subsection) {
1016
+			if ($subsection instanceof EE_Form_Section_Proper) {
1017 1017
 				$validation_errors_on_this_subsection = $subsection->get_validation_errors_accumulated();
1018 1018
 			} else {
1019
-				$validation_errors_on_this_subsection =  $subsection->get_validation_errors();
1019
+				$validation_errors_on_this_subsection = $subsection->get_validation_errors();
1020 1020
 			}
1021
-			if( $validation_errors_on_this_subsection ){
1022
-				$validation_errors = array_merge( $validation_errors, $validation_errors_on_this_subsection );
1021
+			if ($validation_errors_on_this_subsection) {
1022
+				$validation_errors = array_merge($validation_errors, $validation_errors_on_this_subsection);
1023 1023
 			}
1024 1024
 		}
1025 1025
 		return $validation_errors;
@@ -1041,24 +1041,24 @@  discard block
 block discarded – undo
1041 1041
 	 * @param string|false $form_section_path we accept false also because substr( '../', '../' ) = false
1042 1042
 	 * @return EE_Form_Section_Base
1043 1043
 	 */
1044
-	public function find_section_from_path( $form_section_path ) {
1044
+	public function find_section_from_path($form_section_path) {
1045 1045
 		//check if we can find the input from purely going straight up the tree
1046
-		$input = parent::find_section_from_path( $form_section_path );
1047
-		if( $input instanceof EE_Form_Section_Base ) {
1046
+		$input = parent::find_section_from_path($form_section_path);
1047
+		if ($input instanceof EE_Form_Section_Base) {
1048 1048
 			return $input;
1049 1049
 		}
1050 1050
 
1051
-		$next_slash_pos = strpos( $form_section_path, '/' );
1052
-		if( $next_slash_pos !== false ) {
1053
-			$child_section_name = substr( $form_section_path, 0, $next_slash_pos );
1054
-			$subpath = substr( $form_section_path, $next_slash_pos + 1 );
1051
+		$next_slash_pos = strpos($form_section_path, '/');
1052
+		if ($next_slash_pos !== false) {
1053
+			$child_section_name = substr($form_section_path, 0, $next_slash_pos);
1054
+			$subpath = substr($form_section_path, $next_slash_pos + 1);
1055 1055
 		} else {
1056 1056
 			$child_section_name = $form_section_path;
1057 1057
 			$subpath = '';
1058 1058
 		}
1059
-		$child_section =  $this->get_subsection( $child_section_name );
1060
-		if ( $child_section instanceof EE_Form_Section_Base ) {
1061
-			return $child_section->find_section_from_path( $subpath );
1059
+		$child_section = $this->get_subsection($child_section_name);
1060
+		if ($child_section instanceof EE_Form_Section_Base) {
1061
+			return $child_section->find_section_from_path($subpath);
1062 1062
 		} else {
1063 1063
 			return null;
1064 1064
 		}
Please login to merge, or discard this patch.
core/db_models/helpers/EE_Table_Base.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  * Base class for defining the tables that comprise models. This is used to store information
5 5
  * about the table\s alias, private key, etc.
6 6
  */
7
-abstract class EE_Table_Base{
7
+abstract class EE_Table_Base {
8 8
 
9 9
 	/**
10 10
 	 * This holds the table_name without the table prefix.
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 	 * @param boolean $global whether the table is "global" as in there is only 1 table on an entire multisite install,
42 42
 	 *					or whether each site on a multisite install has a copy of this table
43 43
 	 */
44
-	function __construct($table_name, $pk_column, $global = false ){
44
+	function __construct($table_name, $pk_column, $global = false) {
45 45
 		$this->_global = $global;
46 46
 		$prefix = $this->get_table_prefix();
47 47
 		//if they added the prefix, let's remove it because we delay adding the prefix until right when its needed.
48
-		if ( strpos( $table_name, $prefix ) === 0 ) {
49
-			$table_name = ltrim( $table_name, $prefix );
48
+		if (strpos($table_name, $prefix) === 0) {
49
+			$table_name = ltrim($table_name, $prefix);
50 50
 		}
51 51
 		$this->_table_name = $table_name;
52 52
 		$this->_pk_column = $pk_column;
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 	public function get_table_prefix() {
65 65
 		global $wpdb;
66 66
 
67
-		if ( $this->_global ) {
67
+		if ($this->_global) {
68 68
 			$prefix = $wpdb->base_prefix;
69 69
 		} else {
70
-			$prefix = $wpdb->get_blog_prefix( EEM_Base::get_model_query_blog_id() );
70
+			$prefix = $wpdb->get_blog_prefix(EEM_Base::get_model_query_blog_id());
71 71
 		}
72 72
 		return $prefix;
73 73
 	}
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @param string $table_alias
80 80
 	 */
81
-	function _construct_finalize_with_alias($table_alias){
81
+	function _construct_finalize_with_alias($table_alias) {
82 82
 		$this->_table_alias = $table_alias;
83 83
 	}
84 84
 
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 * Returns the fully qualified table name for the database (includes the table prefix current for the blog).
88 88
 	 * @return string
89 89
 	 */
90
-	function get_table_name(){
91
-		return $this->get_table_prefix() . $this->_table_name;
90
+	function get_table_name() {
91
+		return $this->get_table_prefix().$this->_table_name;
92 92
 	}
93 93
 
94 94
 
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 	 * @return string
101 101
 	 * @throws EE_Error
102 102
 	 */
103
-	function get_table_alias(){
104
-		if( ! $this->_table_alias){
103
+	function get_table_alias() {
104
+		if ( ! $this->_table_alias) {
105 105
 			throw new EE_Error("You must call _construct_finalize_with_alias before using the EE_Table_Base. Did you forget to call parent::__construct at the end of your EEMerimental_Base child's __construct?");
106 106
 		}
107 107
 		return $this->_table_alias;
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return string name of column of PK
115 115
 	 */
116
-	function get_pk_column(){
116
+	function get_pk_column() {
117 117
 		return $this->_pk_column;
118 118
 	}
119 119
 
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 	 * returns a string with the table alias, a period, and the private key's column.
124 124
 	 * @return string
125 125
 	 */
126
-	function get_fully_qualified_pk_column(){
127
-		$sql =  $this->get_table_alias().".".$this->get_pk_column();
126
+	function get_fully_qualified_pk_column() {
127
+		$sql = $this->get_table_alias().".".$this->get_pk_column();
128 128
 		return $sql;
129 129
 	}
130 130
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
 	 * returns the special sql for a inner select with a limit.
134 134
 	 * @return string    SQL select
135 135
 	 */
136
-	public function get_select_join_limit( $limit ) {
137
-		$limit = is_array( $limit ) ? 'LIMIT ' . implode(',', array_map( 'intval', $limit ) ) : 'LIMIT ' . (int) $limit;
138
-		$SQL = SP . '(SELECT * FROM ' . $this->_table_name . SP . $limit . ') AS ' . $this->_table_alias;
136
+	public function get_select_join_limit($limit) {
137
+		$limit = is_array($limit) ? 'LIMIT '.implode(',', array_map('intval', $limit)) : 'LIMIT '.(int) $limit;
138
+		$SQL = SP.'(SELECT * FROM '.$this->_table_name.SP.$limit.') AS '.$this->_table_alias;
139 139
 		return $SQL;
140 140
 	}
141 141
 }
Please login to merge, or discard this patch.