Completed
Branch old/BUG-7514-7935-7936-price-o... (518ae6)
by
unknown
11:51 queued 09:31
created
libraries/messages/defaults/default/html_receipt_ticket_list.template.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@  discard block
 block discarded – undo
8 8
 		<table class="invoice-amount">
9 9
 			<thead>
10 10
 				<tr class="header_row">
11
-					<th class="name-column"><?php _e( "Ticket", "event_espresso" ); ?></th>
12
-					<th colspan="2" class="desc-column"><?php _e( "Description", "event_espresso" ); ?></th>
13
-					<th class="number-column item_c"><?php _e( "Quantity", "event_espresso" ); ?></th>
14
-					<th class="number-column item_c"><?php _e( "Price", "event_espresso" ); ?></th>
15
-					<th class="number-column item_r"><?php _e( "Total", "event_espresso" ); ?></th>
11
+					<th class="name-column"><?php _e("Ticket", "event_espresso"); ?></th>
12
+					<th colspan="2" class="desc-column"><?php _e("Description", "event_espresso"); ?></th>
13
+					<th class="number-column item_c"><?php _e("Quantity", "event_espresso"); ?></th>
14
+					<th class="number-column item_c"><?php _e("Price", "event_espresso"); ?></th>
15
+					<th class="number-column item_r"><?php _e("Total", "event_espresso"); ?></th>
16 16
 				</tr>
17 17
 			</thead>
18 18
 			<tbody>[TICKET_LINE_ITEM_LIST]</tbody>
@@ -22,25 +22,25 @@  discard block
 block discarded – undo
22 22
 		<div class="ticket-time-and-place-details">
23 23
 			<div class="ticket-time-details">
24 24
 				<h4 class="sub-section-title no-bottom-margin">
25
-					<img class="icon" src="<?php echo EE_IMAGES_URL . 'clock-16x16.png'; ?>"><?php _e( 'Date/Time:', 'event_espresso' ); ?>
25
+					<img class="icon" src="<?php echo EE_IMAGES_URL.'clock-16x16.png'; ?>"><?php _e('Date/Time:', 'event_espresso'); ?>
26 26
 				</h4>
27 27
 				<ul class="event-dates">[DATETIME_LIST]</ul>
28 28
 			</div>
29 29
 			<div class="ticket-place-details">
30 30
 				<h4 class="sub-section-title no-bottom-margin">
31
-					<img class="icon" src="<?php echo EE_IMAGES_URL . 'location-pin-16x16.png'; ?>"><?php _e( 'Venue', 'event_espresso' ); ?>
31
+					<img class="icon" src="<?php echo EE_IMAGES_URL.'location-pin-16x16.png'; ?>"><?php _e('Venue', 'event_espresso'); ?>
32 32
 				</h4>
33 33
 				<ul class="event-venues">
34 34
 					<li>[VENUE_TITLE]
35
-						<span class="small-text">( <a href="[VENUE_URL]"><?php _e( 'view', 'event_espresso' ); ?></a> )</span>
35
+						<span class="small-text">( <a href="[VENUE_URL]"><?php _e('view', 'event_espresso'); ?></a> )</span>
36 36
 					</li>
37 37
 				</ul>
38 38
 			</div>
39 39
 		</div>
40 40
 		<div class="ticket-registrations-area">
41 41
 			<h4 class="sub-section-title">
42
-				<img class="icon" src="<?php echo EE_IMAGES_URL . 'users-16x16.png'; ?>"><?php _e( "Registration Details", "event_espresso" ); ?>
43
-				<span class="small-text link">( <a class="print_button noPrint" href="[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]"><?php _e( 'edit', 'event_espresso' ); ?></a> )</span>
42
+				<img class="icon" src="<?php echo EE_IMAGES_URL.'users-16x16.png'; ?>"><?php _e("Registration Details", "event_espresso"); ?>
43
+				<span class="small-text link">( <a class="print_button noPrint" href="[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]"><?php _e('edit', 'event_espresso'); ?></a> )</span>
44 44
 			</h4>
45 45
 			<ul class="ticket-registrations-list">[ATTENDEE_LIST]</ul>
46 46
 		</div>
Please login to merge, or discard this patch.
core/libraries/messages/message_type/EE_Invoice_message_type.class.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 
34 34
 	protected function _set_admin_pages() {
35
-		$this->admin_registered_pages = array( 'events_edit' => TRUE );
35
+		$this->admin_registered_pages = array('events_edit' => TRUE);
36 36
 	}
37 37
 
38 38
 
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
 
46 46
 	protected function _set_with_messengers() {
47 47
 		$this->_with_messengers = array(
48
-			'html' => array( 'pdf' )
48
+			'html' => array('pdf')
49 49
 			);
50 50
 	}
51 51
 
52 52
 
53 53
 
54
-	protected function _get_data_for_context( $context, EE_Registration $registration, $id ) {
54
+	protected function _get_data_for_context($context, EE_Registration $registration, $id) {
55 55
 		//receipt message type data handler is 'Gateways' and it expects a transaction object.
56 56
 		$transaction = $registration->transaction();
57
-		if ( $transaction instanceof EE_Transaction ) {
58
-			return array( $transaction );
57
+		if ($transaction instanceof EE_Transaction) {
58
+			return array($transaction);
59 59
 		}
60 60
 		return array();
61 61
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
  * @subpackage messages
6 6
  * @since           4.5.0
7 7
  */
8
-if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10
+}
9 11
 
10 12
 /**
11 13
  * The message type for invoices.
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -87,12 +87,12 @@
 block discarded – undo
87 87
 
88 88
 
89 89
 	/**
90
-	* used to set the valid shortcodes for the receipt message type
91
-	*
92
-	* @since   4.5.0
93
-	*
94
-	* @return  void
95
-	*/
90
+	 * used to set the valid shortcodes for the receipt message type
91
+	 *
92
+	 * @since   4.5.0
93
+	 *
94
+	 * @return  void
95
+	 */
96 96
 	protected function _set_valid_shortcodes() {
97 97
 		$this->_valid_shortcodes['purchaser'] = array(
98 98
 			'attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event', 'event_meta', 'messenger', 'organization', 'primary_registration_list', 'primary_registration_details', 'ticket_list', 'ticket', 'transaction', 'venue', 'line_item_list', 'payment_list', 'line_item', 'payment', 'question_list', 'question'
Please login to merge, or discard this patch.
core/libraries/messages/message_type/EE_Receipt_message_type.class.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
  * @subpackage messages
6 6
  * @since           4.5.0
7 7
  */
8
-if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10
+}
9 11
 
10 12
 /**
11 13
  * The message type for transaction receipts.
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 
34 34
 	protected function _set_admin_pages() {
35
-		$this->admin_registered_pages = array( 'events_edit' => TRUE );
35
+		$this->admin_registered_pages = array('events_edit' => TRUE);
36 36
 	}
37 37
 
38 38
 
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
 
46 46
 	protected function _set_with_messengers() {
47 47
 		$this->_with_messengers = array(
48
-			'html' => array( 'pdf' )
48
+			'html' => array('pdf')
49 49
 			);
50 50
 	}
51 51
 
52 52
 
53 53
 
54
-	protected function _get_data_for_context( $context, EE_Registration $registration, $id ) {
54
+	protected function _get_data_for_context($context, EE_Registration $registration, $id) {
55 55
 		//receipt message type data handler is 'Gateways' and it expects a transaction object.
56 56
 		$transaction = $registration->transaction();
57
-		if ( $transaction instanceof EE_Transaction ) {
58
-			return array( $transaction );
57
+		if ($transaction instanceof EE_Transaction) {
58
+			return array($transaction);
59 59
 		}
60 60
 		return array();
61 61
 	}
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -87,12 +87,12 @@
 block discarded – undo
87 87
 
88 88
 
89 89
 	/**
90
-	* used to set the valid shortcodes for the receipt message type
91
-	*
92
-	* @since   4.5.0
93
-	*
94
-	* @return  void
95
-	*/
90
+	 * used to set the valid shortcodes for the receipt message type
91
+	 *
92
+	 * @since   4.5.0
93
+	 *
94
+	 * @return  void
95
+	 */
96 96
 	protected function _set_valid_shortcodes() {
97 97
 		$this->_valid_shortcodes['purchaser'] = array(
98 98
 			'attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event', 'event_meta', 'messenger', 'organization', 'primary_registration_list', 'primary_registration_details', 'ticket_list', 'ticket', 'transaction', 'venue', 'line_item_list', 'payment_list', 'line_item', 'payment', 'question_list', 'question'
Please login to merge, or discard this patch.
core/libraries/messages/messenger/EE_Html_messenger.class.php 2 patches
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
10 10
 	exit('NO direct script access allowed');
11 11
 
12 12
 /**
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  * @subpackage		messages
20 20
  * @author			Darren Ethier
21 21
  */
22
-class EE_Html_messenger extends EE_messenger  {
22
+class EE_Html_messenger extends EE_messenger {
23 23
 
24 24
 
25 25
 	/**
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @see abstract declaration in EE_messenger for details.
63 63
 	 */
64 64
 	protected function _set_admin_pages() {
65
-		$this->admin_registered_pages = array( 'events_edit' => true );
65
+		$this->admin_registered_pages = array('events_edit' => true);
66 66
 	}
67 67
 
68 68
 
@@ -82,29 +82,29 @@  discard block
 block discarded – undo
82 82
 	protected function _set_validator_config() {
83 83
 		$this->_validator_config = array(
84 84
 			'subject' => array(
85
-				'shortcodes' => array('organization', 'primary_registration_details', 'email', 'transaction' )
85
+				'shortcodes' => array('organization', 'primary_registration_details', 'email', 'transaction')
86 86
 				),
87 87
 			'content' => array(
88
-				'shortcodes' => array( 'organization',  'primary_registration_list', 'primary_registration_details',  'email', 'transaction', 'event_list', 'payment_list', 'venue', 'line_item_list', 'messenger', 'ticket_list')
88
+				'shortcodes' => array('organization', 'primary_registration_list', 'primary_registration_details', 'email', 'transaction', 'event_list', 'payment_list', 'venue', 'line_item_list', 'messenger', 'ticket_list')
89 89
 				),
90 90
 			'event_list' => array(
91
-				'shortcodes' => array( 'event', 'ticket_list', 'venue',  'primary_registration_details', 'primary_registration_list', 'event_author' ),
91
+				'shortcodes' => array('event', 'ticket_list', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author'),
92 92
 				'required' => array('[EVENT_LIST]')
93 93
 				),
94 94
 			'ticket_list' => array(
95
-				'shortcodes' => array( 'attendee_list', 'ticket', 'datetime_list','primary_registration_details', 'line_item_list', 'venue'),
95
+				'shortcodes' => array('attendee_list', 'ticket', 'datetime_list', 'primary_registration_details', 'line_item_list', 'venue'),
96 96
 				'required' => array('[TICKET_LIST]')
97 97
 				),
98 98
 			'ticket_line_item_no_pms' => array(
99
-				'shortcodes' => array( 'line_item', 'ticket' ),
99
+				'shortcodes' => array('line_item', 'ticket'),
100 100
 				'required' => array('[TICKET_LINE_ITEM_LIST]')
101 101
 				),
102 102
 			'ticket_line_item_pms' => array(
103
-				'shortcodes' => array( 'line_item', 'ticket', 'line_item_list' ),
103
+				'shortcodes' => array('line_item', 'ticket', 'line_item_list'),
104 104
 				'required' => array('[TICKET_LINE_ITEM_LIST]'),
105 105
 				),
106 106
 			'price_modifier_line_item_list' => array(
107
-				'shortcodes' => array( 'line_item' ),
107
+				'shortcodes' => array('line_item'),
108 108
 				'required' => array('[PRICE_MODIFIER_LINE_ITEM_LIST]')
109 109
 				),
110 110
 			'datetime_list' => array(
@@ -132,16 +132,16 @@  discard block
 block discarded – undo
132 132
 
133 133
 
134 134
 
135
-	public function do_secondary_messenger_hooks( $sending_messenger_name ) {
136
-		if ( $sending_messenger_name = 'pdf' ) {
137
-			add_filter( 'EE_messenger__get_variation__variation', array( $this, 'add_html_css' ), 10, 8 );
135
+	public function do_secondary_messenger_hooks($sending_messenger_name) {
136
+		if ($sending_messenger_name = 'pdf') {
137
+			add_filter('EE_messenger__get_variation__variation', array($this, 'add_html_css'), 10, 8);
138 138
 		}
139 139
 	}
140 140
 
141 141
 
142 142
 
143
-	public function add_html_css( $variation_path, EE_Messages_Template_Pack $template_pack, $messenger_name, $message_type_name, $url, $type, $variation, $skip_filters ) {
144
-		$variation = $template_pack->get_variation( $this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters );
143
+	public function add_html_css($variation_path, EE_Messages_Template_Pack $template_pack, $messenger_name, $message_type_name, $url, $type, $variation, $skip_filters) {
144
+		$variation = $template_pack->get_variation($this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters);
145 145
 		return $variation;
146 146
 	}
147 147
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	public  function enqueue_scripts_styles() {
156 156
 		parent::enqueue_scripts_styles();
157
-		do_action( 'AHEE__EE_Html_messenger__enqueue_scripts_styles');
157
+		do_action('AHEE__EE_Html_messenger__enqueue_scripts_styles');
158 158
 	}
159 159
 
160 160
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 						),
215 215
 					'ticket_line_item_no_pms' => array(
216 216
 						'input' => 'textarea',
217
-						'label' => '[TICKET_LINE_ITEM_LIST] <br>' . __('Ticket Line Item List with no Price Modifiers', 'event_espresso'),
217
+						'label' => '[TICKET_LINE_ITEM_LIST] <br>'.__('Ticket Line Item List with no Price Modifiers', 'event_espresso'),
218 218
 						'type' => 'string',
219 219
 						'required' => FALSE,
220 220
 						'validation' => TRUE,
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 						),
226 226
 					'ticket_line_item_pms' => array(
227 227
 						'input' => 'textarea',
228
-						'label' => '[TICKET_LINE_ITEM_LIST] <br>' . __('Ticket Line Item List with Price Modifiers', 'event_espresso'),
228
+						'label' => '[TICKET_LINE_ITEM_LIST] <br>'.__('Ticket Line Item List with Price Modifiers', 'event_espresso'),
229 229
 						'type' => 'string',
230 230
 						'required' => FALSE,
231 231
 						'validation' => TRUE,
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 *
319 319
 	 */
320 320
 	protected function _set_default_message_types() {
321
-		$this->_default_message_types = array( 'receipt', 'invoice' );
321
+		$this->_default_message_types = array('receipt', 'invoice');
322 322
 	}
323 323
 
324 324
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	 * @since 4.5.0
330 330
 	 */
331 331
 	protected function _set_valid_message_types() {
332
-		$this->_valid_message_types = array( 'receipt', 'invoice' );
332
+		$this->_valid_message_types = array('receipt', 'invoice');
333 333
 	}
334 334
 
335 335
 
@@ -344,15 +344,15 @@  discard block
 block discarded – undo
344 344
 	 */
345 345
 	protected function _send_message() {
346 346
 		$this->_template_args = array(
347
-			'page_title' => html_entity_decode( stripslashes( $this->_subject ), ENT_QUOTES, "UTF-8"),
348
-			'base_css' => $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'base', $this->_variation ),
349
-			'print_css' => $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'print', $this->_variation ),
350
-			'main_css' => $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'main', $this->_variation ),
351
-			'main_body' => apply_filters( 'FHEE__EE_Html_messenger___send_message__main_body', wpautop(stripslashes_deep( html_entity_decode($this->_content,  ENT_QUOTES,"UTF-8" ) )), $this->_content )
347
+			'page_title' => html_entity_decode(stripslashes($this->_subject), ENT_QUOTES, "UTF-8"),
348
+			'base_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'base', $this->_variation),
349
+			'print_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'print', $this->_variation),
350
+			'main_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'main', $this->_variation),
351
+			'main_body' => apply_filters('FHEE__EE_Html_messenger___send_message__main_body', wpautop(stripslashes_deep(html_entity_decode($this->_content, ENT_QUOTES, "UTF-8"))), $this->_content)
352 352
 			);
353 353
 
354 354
 		$this->_deregister_wp_hooks();
355
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) );
355
+		add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles'));
356 356
 		echo $this->_get_main_template();
357 357
 		exit();
358 358
 	}
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
 		$wp_scripts = $wp_styles = array();
377 377
 
378 378
 		//just add back in wp_enqueue_scripts and wp_print_footer_scripts cause that's all we want to load.
379
-		add_action( 'wp_footer', 'wp_print_footer_scripts' );
380
-		add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' );
379
+		add_action('wp_footer', 'wp_print_footer_scripts');
380
+		add_action('wp_print_footer_scripts', '_wp_footer_scripts');
381 381
 		add_action('wp_head', 'wp_enqueue_scripts');
382 382
 	}
383 383
 
@@ -391,12 +391,12 @@  discard block
 block discarded – undo
391 391
 	 *
392 392
 	 * @return string
393 393
 	 */
394
-	protected function _get_main_template( $preview = FALSE ) {
395
-		$wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, 'main' );
394
+	protected function _get_main_template($preview = FALSE) {
395
+		$wrapper_template = $this->_tmp_pack->get_wrapper($this->name, 'main');
396 396
 
397 397
 		//require template helper
398
-		EE_Registry::instance()->load_helper( 'Template' );
399
-		return EEH_Template::display_template( $wrapper_template, $this->_template_args, TRUE );
398
+		EE_Registry::instance()->load_helper('Template');
399
+		return EEH_Template::display_template($wrapper_template, $this->_template_args, TRUE);
400 400
 	}
401 401
 
402 402
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
core/libraries/messages/validators/EE_Messages_Validator.core.php 2 patches
Spacing   +96 added lines, -96 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
 /**
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 	 * @param array $fields The fields sent by the EEM object.
124 124
 	 * @return void
125 125
 	 */
126
-	public function __construct( $fields, $context ) {
126
+	public function __construct($fields, $context) {
127 127
 		//check that _m_name and _mt_name have been set by child class otherwise we get out.
128
-		if ( empty($this->_m_name ) || empty( $this->_mt_name) )
129
-			throw new EE_Error( __('EE_Messages_Validator child classes MUST set the $_m_name and $_mt_name property.  Check that the child class is doing this', 'event_espresso') );
128
+		if (empty($this->_m_name) || empty($this->_mt_name))
129
+			throw new EE_Error(__('EE_Messages_Validator child classes MUST set the $_m_name and $_mt_name property.  Check that the child class is doing this', 'event_espresso'));
130 130
 
131 131
 		$this->_fields = $fields;
132 132
 		$this->_context = $context;
@@ -162,27 +162,27 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	private function _load_objects() {
164 164
 		//load messenger
165
-		$messenger = ucwords( str_replace( '_', ' ', $this->_m_name ) );
166
-		$messenger = str_replace( ' ', '_', $messenger );
167
-		$messenger = 'EE_' . $messenger . '_messenger';
165
+		$messenger = ucwords(str_replace('_', ' ', $this->_m_name));
166
+		$messenger = str_replace(' ', '_', $messenger);
167
+		$messenger = 'EE_'.$messenger.'_messenger';
168 168
 
169
-		if ( !class_exists( $messenger ) ) {
170
-			$msg = sprintf( __('There is no messenger class for the given string (%s)', 'event_espresso'), $this->_m_name );
169
+		if ( ! class_exists($messenger)) {
170
+			$msg = sprintf(__('There is no messenger class for the given string (%s)', 'event_espresso'), $this->_m_name);
171 171
 		}
172 172
 
173
-		$a = new ReflectionClass( $messenger );
173
+		$a = new ReflectionClass($messenger);
174 174
 		$this->_MSGR = $a->newInstance();
175 175
 
176 176
 		//load message type
177
-		$message_type = ucwords( str_replace( '_', ' ', $this->_mt_name ) );
178
-		$message_type = str_replace( ' ', '_', $message_type );
179
-		$message_type = 'EE_' . $message_type . '_message_type';
177
+		$message_type = ucwords(str_replace('_', ' ', $this->_mt_name));
178
+		$message_type = str_replace(' ', '_', $message_type);
179
+		$message_type = 'EE_'.$message_type.'_message_type';
180 180
 
181
-		if ( !class_exists( $message_type ) ) {
182
-			$msg = sprintf( __('There is no message type class for the given string (%s)', 'event_espresso'), $this->_mt_name );
181
+		if ( ! class_exists($message_type)) {
182
+			$msg = sprintf(__('There is no message type class for the given string (%s)', 'event_espresso'), $this->_mt_name);
183 183
 		}
184 184
 
185
-		$a = new ReflectionClass( $message_type );
185
+		$a = new ReflectionClass($message_type);
186 186
 		$this->_MSGTYP = $a->newInstance();
187 187
 
188 188
 	}
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 		$shrtcode_grps = $mt_codes;
213 213
 		$groups_per_field = array();
214 214
 
215
-		foreach ( $msgr_validator as $field => $config ) {
216
-			if ( empty($config) || !isset($config['shortcodes']) )
217
-				continue;  //Nothing to see here.
218
-			$groups_per_field[$field] = array_intersect( $config['shortcodes'], $mt_codes );
219
-			$shrtcode_grps = array_merge( $config['shortcodes'], $shrtcode_grps );
215
+		foreach ($msgr_validator as $field => $config) {
216
+			if (empty($config) || ! isset($config['shortcodes']))
217
+				continue; //Nothing to see here.
218
+			$groups_per_field[$field] = array_intersect($config['shortcodes'], $mt_codes);
219
+			$shrtcode_grps = array_merge($config['shortcodes'], $shrtcode_grps);
220 220
 		}
221 221
 
222 222
 		$shrtcode_grps = array_unique($shrtcode_grps);
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
 		//okay now we've got our grps. Let's get the codes from the objects into an array indexed by group for easy retrieval later.
225 225
 		$codes_from_objs = array();
226 226
 
227
-		foreach ( $shrtcode_grps as $group ) {
228
-			$ref = ucwords( str_replace('_', ' ', $group ) );
229
-			$ref = str_replace( ' ', '_', $ref );
230
-			$classname = 'EE_' . $ref . '_Shortcodes';
231
-			if ( class_exists( $classname ) ) {
232
-				$a = new ReflectionClass( $classname );
227
+		foreach ($shrtcode_grps as $group) {
228
+			$ref = ucwords(str_replace('_', ' ', $group));
229
+			$ref = str_replace(' ', '_', $ref);
230
+			$classname = 'EE_'.$ref.'_Shortcodes';
231
+			if (class_exists($classname)) {
232
+				$a = new ReflectionClass($classname);
233 233
 				$obj = $a->newInstance();
234 234
 				$codes_from_objs[$group] = $obj->get_shortcodes();
235 235
 			}
@@ -238,58 +238,58 @@  discard block
 block discarded – undo
238 238
 
239 239
 		//let's just replace the $mt shortcode group indexes with the actual shortcodes (unique)
240 240
 		$final_mt_codes = array();
241
-		foreach ( $mt_codes as $group ) {
242
-			$final_mt_codes = array_merge( $final_mt_codes, $codes_from_objs[$group] );
241
+		foreach ($mt_codes as $group) {
242
+			$final_mt_codes = array_merge($final_mt_codes, $codes_from_objs[$group]);
243 243
 		}
244 244
 
245 245
 		$mt_codes = $final_mt_codes;
246 246
 
247 247
 
248 248
 		//k now in this next loop we're going to loop through $msgr_validator again and setup the _validators property from the data we've setup so far.
249
-		foreach ( $msgr_validator as $field => $config ) {
249
+		foreach ($msgr_validator as $field => $config) {
250 250
 			//if required shortcode is not in our list of codes for the given field, then we skip this field.
251 251
 			$required = isset($config['required']) ? array_intersect($config['required'], array_keys($mt_codes)) : true;
252
-			if ( empty($required) )
252
+			if (empty($required))
253 253
 				continue;
254 254
 
255 255
 			//If we have an override then we use it to indicate the codes we want.
256
-			if ( isset( $this->_valid_shortcodes_modifier[$context][$field] ) ) {
257
-				$this->_validators[$field]['shortcodes'] = $this->_reassemble_valid_shortcodes_from_group( $this->_valid_shortcodes_modifier[$context][$field], $codes_from_objs );
256
+			if (isset($this->_valid_shortcodes_modifier[$context][$field])) {
257
+				$this->_validators[$field]['shortcodes'] = $this->_reassemble_valid_shortcodes_from_group($this->_valid_shortcodes_modifier[$context][$field], $codes_from_objs);
258 258
 			}
259 259
 
260 260
 			//if we have specific shortcodes for a field then we need to use them
261
-			else if ( isset( $groups_per_field[$field] ) ) {
262
-				$this->_validators[$field]['shortcodes'] = $this->_reassemble_valid_shortcodes_from_group($groups_per_field[$field], $codes_from_objs );
261
+			else if (isset($groups_per_field[$field])) {
262
+				$this->_validators[$field]['shortcodes'] = $this->_reassemble_valid_shortcodes_from_group($groups_per_field[$field], $codes_from_objs);
263 263
 			}
264 264
 
265 265
 			//if empty config then we're assuming we're just going to use the shortcodes from the message type context
266
-			else if ( empty( $config ) ) {
266
+			else if (empty($config)) {
267 267
 				$this->_validators[$field]['shortcodes'] = $mt_codes;
268 268
 			}
269 269
 
270 270
 			//if we have specific shortcodes then we need to use them
271
-			else if ( isset($config['specific_shortcodes'] ) ) {
271
+			else if (isset($config['specific_shortcodes'])) {
272 272
 				$this->_validators[$field]['shortcodes'] = $config['specific_shortcodes'];
273 273
 			}
274 274
 
275 275
 			//otherwise the shortcodes are what is set by the messenger for that field
276 276
 			else {
277
-				foreach ( $config['shortcodes'] as $group ) {
278
-					$this->_validators[$field]['shortcodes'] = isset($this->_validators[$field]['shortcodes']) ? array_merge( $this->_validators[$field]['shortcodes'], $codes_from_objs[$group] ) : $codes_from_objs[$group];
277
+				foreach ($config['shortcodes'] as $group) {
278
+					$this->_validators[$field]['shortcodes'] = isset($this->_validators[$field]['shortcodes']) ? array_merge($this->_validators[$field]['shortcodes'], $codes_from_objs[$group]) : $codes_from_objs[$group];
279 279
 				}
280 280
 			}
281 281
 
282 282
 			//now let's just make sure that any excluded specific shortcodes are removed.
283 283
 			$specific_excludes = $this->get_specific_shortcode_excludes();
284
-			if ( isset( $specific_excludes[$field] ) ) {
285
-				foreach( $specific_excludes[$field] as $sex ) {
286
-					if ( isset( $this->_validators[$field]['shortcodes'][$sex] ) )
287
-						unset( $this->_validators[$field]['shortcodes'][$sex] );
284
+			if (isset($specific_excludes[$field])) {
285
+				foreach ($specific_excludes[$field] as $sex) {
286
+					if (isset($this->_validators[$field]['shortcodes'][$sex]))
287
+						unset($this->_validators[$field]['shortcodes'][$sex]);
288 288
 				}
289 289
 			}
290 290
 
291 291
 			//hey! don't forget to include the type if present!
292
-			$this->_validators[$field]['type'] = isset( $config['type'] ) ? $config['type'] : NULL;
292
+			$this->_validators[$field]['type'] = isset($config['type']) ? $config['type'] : NULL;
293 293
 		}
294 294
 	}
295 295
 
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
 	 */
316 316
 	public function get_specific_shortcode_excludes() {
317 317
 		//specific validator filter
318
-		$shortcode_excludes = apply_filters( 'FHEE__' . get_class( $this ) . '__get_specific_shortcode_excludes;', $this->_specific_shortcode_excludes, $this->_context );
318
+		$shortcode_excludes = apply_filters('FHEE__'.get_class($this).'__get_specific_shortcode_excludes;', $this->_specific_shortcode_excludes, $this->_context);
319 319
 		//global filter
320
-		return apply_filters( 'FHEE__EE_Messages_Validator__get_specific_shortcode_excludes', $shortcode_excludes, $this->_context, $this );
320
+		return apply_filters('FHEE__EE_Messages_Validator__get_specific_shortcode_excludes', $shortcode_excludes, $this->_context, $this);
321 321
 	}
322 322
 
323 323
 
@@ -335,63 +335,63 @@  discard block
 block discarded – undo
335 335
 		$invalid_shortcodes = '';
336 336
 		$template_fields = $this->_MSGR->get_template_fields();
337 337
 		//loop through the fields and check!
338
-		foreach ( $this->_fields as $field => $value ) {
338
+		foreach ($this->_fields as $field => $value) {
339 339
 			$this->_errors[$field] = array();
340 340
 			$err_msg = '';
341 341
 			$field_label = '';
342 342
 
343 343
 			//if field is not present in the _validators array then we continue
344
-			if ( !isset( $this->_validators[$field] ) ) {
345
-				unset( $this->_errors[$field] );
344
+			if ( ! isset($this->_validators[$field])) {
345
+				unset($this->_errors[$field]);
346 346
 				continue;
347 347
 			}
348 348
 
349 349
 			//get the translated field label!
350 350
 			//first check if it's in the main fields list
351
-			if ( isset( $template_fields[$field] ) ) {
352
-				if ( empty( $template_fields[$field] ) )
351
+			if (isset($template_fields[$field])) {
352
+				if (empty($template_fields[$field]))
353 353
 					$field_label = $field; //most likely the field is found in the 'extra' array.
354 354
 				else
355 355
 					$field_label = $template_fields[$field]['label'];
356 356
 			}
357 357
 
358 358
 			//if field label is empty OR is equal to the current field then we need to loop through the 'extra' fields in the template_fields config (if present)
359
-			if ( isset( $template_fields['extra'] ) && ( empty($field_label) ) || $field_label == $field ) {
360
-				foreach( $template_fields['extra'] as $main_field => $secondary_field ) {
361
-					foreach ( $secondary_field as $name => $values ) {
362
-						if ( $name == $field ) {
359
+			if (isset($template_fields['extra']) && (empty($field_label)) || $field_label == $field) {
360
+				foreach ($template_fields['extra'] as $main_field => $secondary_field) {
361
+					foreach ($secondary_field as $name => $values) {
362
+						if ($name == $field) {
363 363
 							$field_label = $values['label'];
364 364
 						}
365 365
 
366 366
 						//if we've got a 'main' secondary field, let's see if that matches what field we're on which means it contains the label for this field.
367
-						if ( $name == 'main' && $main_field == $field_label )
367
+						if ($name == 'main' && $main_field == $field_label)
368 368
 							$field_label = $values['label'];
369 369
 					}
370 370
 				}
371 371
 			}
372 372
 
373 373
 			//field is present. Let's validate shortcodes first (but only if shortcodes present).
374
-			if ( isset( $this->_validators[$field]['shortcodes'] ) && !empty( $this->_validators[$field]['shortcodes'] ) ) {
375
-				$invalid_shortcodes = $this->_invalid_shortcodes( $value, $this->_validators[$field]['shortcodes'] );
374
+			if (isset($this->_validators[$field]['shortcodes']) && ! empty($this->_validators[$field]['shortcodes'])) {
375
+				$invalid_shortcodes = $this->_invalid_shortcodes($value, $this->_validators[$field]['shortcodes']);
376 376
 				//if true then that means there is a returned error message that we'll need to add to the _errors array for this field.
377
-				if ( $invalid_shortcodes ) {
377
+				if ($invalid_shortcodes) {
378 378
 					$v_s = array_keys($this->_validators[$field]['shortcodes']);
379
-					$err_msg = sprintf( __('<p>The following shortcodes were found in the "%s" field that ARE not valid: %s</p>', 'event_espresso'), '<strong>' . $field_label . '</strong>', $invalid_shortcodes );
380
-					$err_msg .= sprintf( __('<p>Valid shortcodes for this field are: %s', 'event_espresso'), implode(', ', $v_s ) );
379
+					$err_msg = sprintf(__('<p>The following shortcodes were found in the "%s" field that ARE not valid: %s</p>', 'event_espresso'), '<strong>'.$field_label.'</strong>', $invalid_shortcodes);
380
+					$err_msg .= sprintf(__('<p>Valid shortcodes for this field are: %s', 'event_espresso'), implode(', ', $v_s));
381 381
 				}
382 382
 			}
383 383
 
384 384
 			//if there's a "type" to be validated then let's do that too.
385
-			if ( isset( $this->_validators[$field]['type'] ) && !empty( $this->_validators[$field]['type'] ) ) {
386
-				switch ( $this->_validators[$field]['type'] ) {
385
+			if (isset($this->_validators[$field]['type']) && ! empty($this->_validators[$field]['type'])) {
386
+				switch ($this->_validators[$field]['type']) {
387 387
 					case 'number' :
388
-						if ( !is_numeric($value) )
389
-							$err_msg .= sprintf( __('<p>The %s field is supposed to be a number. The value given (%s)  is not.  Please doublecheck and make sure the field contains a number</p>', 'event_espresso'), $field_label, $value );
388
+						if ( ! is_numeric($value))
389
+							$err_msg .= sprintf(__('<p>The %s field is supposed to be a number. The value given (%s)  is not.  Please doublecheck and make sure the field contains a number</p>', 'event_espresso'), $field_label, $value);
390 390
 						break;
391 391
 					case 'email' :
392 392
 						$valid_email = $this->_validate_email($value);
393
-						if ( !$valid_email )
394
-							$err_msg .= htmlentities( sprintf( __('The %s field has at least one string that is not a valid email address record.  Valid emails are in the format: "Name <[email protected]>" or "[email protected]" and multiple emails can be separated by a comma.'), $field_label ) );
393
+						if ( ! $valid_email)
394
+							$err_msg .= htmlentities(sprintf(__('The %s field has at least one string that is not a valid email address record.  Valid emails are in the format: "Name <[email protected]>" or "[email protected]" and multiple emails can be separated by a comma.'), $field_label));
395 395
 						break;
396 396
 					default :
397 397
 						break;
@@ -399,22 +399,22 @@  discard block
 block discarded – undo
399 399
 			}
400 400
 
401 401
 			//if $err_msg isn't empty let's setup the _errors array for this field.
402
-			if ( !empty($err_msg ) ) {
402
+			if ( ! empty($err_msg)) {
403 403
 				$this->_errors[$field]['msg'] = $err_msg;
404 404
 			} else {
405
-				unset( $this->_errors[$field] );
405
+				unset($this->_errors[$field]);
406 406
 			}
407 407
 		}
408 408
 
409 409
 		//if we have ANY errors, then we want to make sure we return the values for ALL the fields so the user doesn't have to retype them all.
410
-		if ( !empty( $this->_errors ) ) {
411
-			foreach ( $this->_fields as $field => $value ) {
410
+		if ( ! empty($this->_errors)) {
411
+			foreach ($this->_fields as $field => $value) {
412 412
 				$this->_errors[$field]['value'] = stripslashes($value);
413 413
 			}
414 414
 		}
415 415
 
416 416
 		//return any errors or just TRUE if everything validates
417
-		return empty( $this->_errors ) ? TRUE : $this->_errors;
417
+		return empty($this->_errors) ? TRUE : $this->_errors;
418 418
 	}
419 419
 
420 420
 
@@ -425,10 +425,10 @@  discard block
 block discarded – undo
425 425
 	 * @param  array  $codes_from_objs All the codes available.
426 426
 	 * @return array                   an array of actual shortcodes (that will be used for validation).
427 427
 	 */
428
-	private function _reassemble_valid_shortcodes_from_group( $groups, $codes_from_objs ) {
428
+	private function _reassemble_valid_shortcodes_from_group($groups, $codes_from_objs) {
429 429
 		$shortcodes = array();
430
-		foreach ( $groups as $group ) {
431
-			$shortcodes = array_merge( $shortcodes, $codes_from_objs[$group] );
430
+		foreach ($groups as $group) {
431
+			$shortcodes = array_merge($shortcodes, $codes_from_objs[$group]);
432 432
 		}
433 433
 		return $shortcodes;
434 434
 	}
@@ -446,29 +446,29 @@  discard block
 block discarded – undo
446 446
 	 */
447 447
 	protected function _invalid_shortcodes($value, $valid_shortcodes) {
448 448
 		//first we need to go through the string and get the shortcodes in the string
449
-		$sc = preg_match_all( '/(\[.+?\])/', $value, $matches );
449
+		$sc = preg_match_all('/(\[.+?\])/', $value, $matches);
450 450
 		$incoming_shortcodes = (array) $matches[0];
451 451
 
452 452
 		//get a diff of the shortcodes in the string vs the valid shortcodes
453
-		$diff = array_diff( $incoming_shortcodes, array_keys($valid_shortcodes) );
453
+		$diff = array_diff($incoming_shortcodes, array_keys($valid_shortcodes));
454 454
 
455 455
 		//we need to account for custom codes so let's loop through the diff and remove any of those type of codes
456
-		foreach ( $diff as $ind => $code ) {
457
-			if ( preg_match('/(\[[A-Za-z0-9\_]+_\*)/', $code ) ) {
456
+		foreach ($diff as $ind => $code) {
457
+			if (preg_match('/(\[[A-Za-z0-9\_]+_\*)/', $code)) {
458 458
 				//strip the shortcode so we just have the BASE string (i.e. [ANSWER_*] )
459 459
 				$dynamic_sc = preg_replace('/(_\*+.+)/', '_*]', $code);
460 460
 				//does this exist in the $valid_shortcodes?  If so then unset.
461
-				if ( isset( $valid_shortcodes[$dynamic_sc] ) ) {
462
-					unset( $diff[$ind] );
461
+				if (isset($valid_shortcodes[$dynamic_sc])) {
462
+					unset($diff[$ind]);
463 463
 				}
464 464
 			}
465 465
 		}
466 466
 
467
-		if ( empty( $diff ) ) return FALSE; //there is no diff, we have no invalid shortcodes, so return
467
+		if (empty($diff)) return FALSE; //there is no diff, we have no invalid shortcodes, so return
468 468
 
469 469
 		//made it here? then let's assemble the error message
470
-		$invalid_shortcodes = implode( '</strong>,<strong>', $diff );
471
-		$invalid_shortcodes = '<strong>' . $invalid_shortcodes . '</strong>';
470
+		$invalid_shortcodes = implode('</strong>,<strong>', $diff);
471
+		$invalid_shortcodes = '<strong>'.$invalid_shortcodes.'</strong>';
472 472
 		return $invalid_shortcodes;
473 473
 	}
474 474
 
@@ -480,13 +480,13 @@  discard block
 block discarded – undo
480 480
 	 * @param  string $value incoming value to validate
481 481
 	 * @return bool        true if the string validates, false if it doesn't
482 482
 	 */
483
-	protected function _validate_email( $value ) {
483
+	protected function _validate_email($value) {
484 484
 		$validate = TRUE;
485 485
 		$fail = FALSE;
486 486
 		$or_val = $value;
487 487
 
488 488
 		//empty strings will validate because this is how a message template for a particula context can be "turned off" (if there is no email then no message)
489
-		if ( empty( $value ) )
489
+		if (empty($value))
490 490
 			return $validate;
491 491
 
492 492
 		//first determine if there ARE any shortcodes.  If there are shortcodes and then later we find that there were no other valid emails but the field isn't empty... that means we've got extra commas that were left after stripping out shortcodes so probably still valid.
@@ -498,19 +498,19 @@  discard block
 block discarded – undo
498 498
 		//if original value is not empty and new value is, then we've parsed out a shortcode and we now have an empty string which DOES validate. We also validate complete empty field for email because its possible that this message is being "turned off" for a particular context
499 499
 
500 500
 
501
-		if ( !empty($or_val) && empty($value) )
501
+		if ( ! empty($or_val) && empty($value))
502 502
 			return $validate;
503 503
 
504 504
 		//trim any commas from beginning and end of string ( after whitespace trimmed );
505
-		$value = trim( trim($value), ',' );
505
+		$value = trim(trim($value), ',');
506 506
 
507 507
 
508 508
 		//next we need to split up the string if its comma delimited.
509 509
 		$emails = explode(',', $value);
510 510
 		$empty = FALSE; //used to indicate that there is an empty comma.
511 511
 		//now let's loop through the emails and do our checks
512
-		foreach ( $emails as $email ) {
513
-			if ( empty($email) ) {
512
+		foreach ($emails as $email) {
513
+			if (empty($email)) {
514 514
 				$empty = TRUE;
515 515
 				continue;
516 516
 			}
@@ -518,20 +518,20 @@  discard block
 block discarded – undo
518 518
 			//trim whitespace
519 519
 			$email = trim($email);
520 520
 			//either its of type "[email protected]", or its of type "fname lname <[email protected]>"
521
-			if(is_email($email)){
521
+			if (is_email($email)) {
522 522
 				continue;
523
-			}else{
523
+			} else {
524 524
 				$matches = array();
525
-				$validate = preg_match( '/(.*)<(.+)>/', $email, $matches ) ? TRUE : FALSE;
526
-				if( $validate && is_email($matches[2])){
525
+				$validate = preg_match('/(.*)<(.+)>/', $email, $matches) ? TRUE : FALSE;
526
+				if ($validate && is_email($matches[2])) {
527 527
 					continue;
528
-				}else{
528
+				} else {
529 529
 					return false;
530 530
 				}
531 531
 			}
532 532
 		}
533 533
 
534
-		$validate = $empty && !$has_shortcodes ? FALSE : $validate;
534
+		$validate = $empty && ! $has_shortcodes ? FALSE : $validate;
535 535
 
536 536
 		return $validate;
537 537
 
Please login to merge, or discard this patch.
Braces   +43 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  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 7
 /**
7 8
  * Event Espresso
@@ -125,8 +126,9 @@  discard block
 block discarded – undo
125 126
 	 */
126 127
 	public function __construct( $fields, $context ) {
127 128
 		//check that _m_name and _mt_name have been set by child class otherwise we get out.
128
-		if ( empty($this->_m_name ) || empty( $this->_mt_name) )
129
-			throw new EE_Error( __('EE_Messages_Validator child classes MUST set the $_m_name and $_mt_name property.  Check that the child class is doing this', 'event_espresso') );
129
+		if ( empty($this->_m_name ) || empty( $this->_mt_name) ) {
130
+					throw new EE_Error( __('EE_Messages_Validator child classes MUST set the $_m_name and $_mt_name property.  Check that the child class is doing this', 'event_espresso') );
131
+		}
130 132
 
131 133
 		$this->_fields = $fields;
132 134
 		$this->_context = $context;
@@ -213,8 +215,10 @@  discard block
 block discarded – undo
213 215
 		$groups_per_field = array();
214 216
 
215 217
 		foreach ( $msgr_validator as $field => $config ) {
216
-			if ( empty($config) || !isset($config['shortcodes']) )
217
-				continue;  //Nothing to see here.
218
+			if ( empty($config) || !isset($config['shortcodes']) ) {
219
+							continue;
220
+			}
221
+			//Nothing to see here.
218 222
 			$groups_per_field[$field] = array_intersect( $config['shortcodes'], $mt_codes );
219 223
 			$shrtcode_grps = array_merge( $config['shortcodes'], $shrtcode_grps );
220 224
 		}
@@ -249,8 +253,9 @@  discard block
 block discarded – undo
249 253
 		foreach ( $msgr_validator as $field => $config ) {
250 254
 			//if required shortcode is not in our list of codes for the given field, then we skip this field.
251 255
 			$required = isset($config['required']) ? array_intersect($config['required'], array_keys($mt_codes)) : true;
252
-			if ( empty($required) )
253
-				continue;
256
+			if ( empty($required) ) {
257
+							continue;
258
+			}
254 259
 
255 260
 			//If we have an override then we use it to indicate the codes we want.
256 261
 			if ( isset( $this->_valid_shortcodes_modifier[$context][$field] ) ) {
@@ -283,8 +288,9 @@  discard block
 block discarded – undo
283 288
 			$specific_excludes = $this->get_specific_shortcode_excludes();
284 289
 			if ( isset( $specific_excludes[$field] ) ) {
285 290
 				foreach( $specific_excludes[$field] as $sex ) {
286
-					if ( isset( $this->_validators[$field]['shortcodes'][$sex] ) )
287
-						unset( $this->_validators[$field]['shortcodes'][$sex] );
291
+					if ( isset( $this->_validators[$field]['shortcodes'][$sex] ) ) {
292
+											unset( $this->_validators[$field]['shortcodes'][$sex] );
293
+					}
288 294
 				}
289 295
 			}
290 296
 
@@ -349,10 +355,13 @@  discard block
 block discarded – undo
349 355
 			//get the translated field label!
350 356
 			//first check if it's in the main fields list
351 357
 			if ( isset( $template_fields[$field] ) ) {
352
-				if ( empty( $template_fields[$field] ) )
353
-					$field_label = $field; //most likely the field is found in the 'extra' array.
354
-				else
355
-					$field_label = $template_fields[$field]['label'];
358
+				if ( empty( $template_fields[$field] ) ) {
359
+									$field_label = $field;
360
+				}
361
+				//most likely the field is found in the 'extra' array.
362
+				else {
363
+									$field_label = $template_fields[$field]['label'];
364
+				}
356 365
 			}
357 366
 
358 367
 			//if field label is empty OR is equal to the current field then we need to loop through the 'extra' fields in the template_fields config (if present)
@@ -364,8 +373,9 @@  discard block
 block discarded – undo
364 373
 						}
365 374
 
366 375
 						//if we've got a 'main' secondary field, let's see if that matches what field we're on which means it contains the label for this field.
367
-						if ( $name == 'main' && $main_field == $field_label )
368
-							$field_label = $values['label'];
376
+						if ( $name == 'main' && $main_field == $field_label ) {
377
+													$field_label = $values['label'];
378
+						}
369 379
 					}
370 380
 				}
371 381
 			}
@@ -385,13 +395,15 @@  discard block
 block discarded – undo
385 395
 			if ( isset( $this->_validators[$field]['type'] ) && !empty( $this->_validators[$field]['type'] ) ) {
386 396
 				switch ( $this->_validators[$field]['type'] ) {
387 397
 					case 'number' :
388
-						if ( !is_numeric($value) )
389
-							$err_msg .= sprintf( __('<p>The %s field is supposed to be a number. The value given (%s)  is not.  Please doublecheck and make sure the field contains a number</p>', 'event_espresso'), $field_label, $value );
398
+						if ( !is_numeric($value) ) {
399
+													$err_msg .= sprintf( __('<p>The %s field is supposed to be a number. The value given (%s)  is not.  Please doublecheck and make sure the field contains a number</p>', 'event_espresso'), $field_label, $value );
400
+						}
390 401
 						break;
391 402
 					case 'email' :
392 403
 						$valid_email = $this->_validate_email($value);
393
-						if ( !$valid_email )
394
-							$err_msg .= htmlentities( sprintf( __('The %s field has at least one string that is not a valid email address record.  Valid emails are in the format: "Name <[email protected]>" or "[email protected]" and multiple emails can be separated by a comma.'), $field_label ) );
404
+						if ( !$valid_email ) {
405
+													$err_msg .= htmlentities( sprintf( __('The %s field has at least one string that is not a valid email address record.  Valid emails are in the format: "Name <[email protected]>" or "[email protected]" and multiple emails can be separated by a comma.'), $field_label ) );
406
+						}
395 407
 						break;
396 408
 					default :
397 409
 						break;
@@ -464,7 +476,10 @@  discard block
 block discarded – undo
464 476
 			}
465 477
 		}
466 478
 
467
-		if ( empty( $diff ) ) return FALSE; //there is no diff, we have no invalid shortcodes, so return
479
+		if ( empty( $diff ) ) {
480
+			return FALSE;
481
+		}
482
+		//there is no diff, we have no invalid shortcodes, so return
468 483
 
469 484
 		//made it here? then let's assemble the error message
470 485
 		$invalid_shortcodes = implode( '</strong>,<strong>', $diff );
@@ -486,8 +501,9 @@  discard block
 block discarded – undo
486 501
 		$or_val = $value;
487 502
 
488 503
 		//empty strings will validate because this is how a message template for a particula context can be "turned off" (if there is no email then no message)
489
-		if ( empty( $value ) )
490
-			return $validate;
504
+		if ( empty( $value ) ) {
505
+					return $validate;
506
+		}
491 507
 
492 508
 		//first determine if there ARE any shortcodes.  If there are shortcodes and then later we find that there were no other valid emails but the field isn't empty... that means we've got extra commas that were left after stripping out shortcodes so probably still valid.
493 509
 		$has_shortcodes = preg_match('/(\[.+?\])/', $value);
@@ -498,8 +514,9 @@  discard block
 block discarded – undo
498 514
 		//if original value is not empty and new value is, then we've parsed out a shortcode and we now have an empty string which DOES validate. We also validate complete empty field for email because its possible that this message is being "turned off" for a particular context
499 515
 
500 516
 
501
-		if ( !empty($or_val) && empty($value) )
502
-			return $validate;
517
+		if ( !empty($or_val) && empty($value) ) {
518
+					return $validate;
519
+		}
503 520
 
504 521
 		//trim any commas from beginning and end of string ( after whitespace trimmed );
505 522
 		$value = trim( trim($value), ',' );
@@ -520,12 +537,12 @@  discard block
 block discarded – undo
520 537
 			//either its of type "[email protected]", or its of type "fname lname <[email protected]>"
521 538
 			if(is_email($email)){
522 539
 				continue;
523
-			}else{
540
+			} else{
524 541
 				$matches = array();
525 542
 				$validate = preg_match( '/(.*)<(.+)>/', $email, $matches ) ? TRUE : FALSE;
526 543
 				if( $validate && is_email($matches[2])){
527 544
 					continue;
528
-				}else{
545
+				} else{
529 546
 					return false;
530 547
 				}
531 548
 			}
Please login to merge, or discard this patch.
email/EE_Messages_Email_Not_Approved_Registration_Validator.class.php 2 patches
Spacing   +5 added lines, -5 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
 /**
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 class EE_Messages_Email_Not_Approved_Registration_Validator extends EE_Messages_Validator {
31 31
 
32 32
 
33
-	public function __construct( $fields, $context ) {
33
+	public function __construct($fields, $context) {
34 34
 		$this->_m_name = 'email';
35 35
 		$this->_mt_name = 'not_approved_registration';
36 36
 
37
-		parent::__construct( $fields, $context );
37
+		parent::__construct($fields, $context);
38 38
 	}
39 39
 
40 40
 	/**
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 			'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'),
47 47
 			'required' => array('[EVENT_LIST]')
48 48
 			);
49
-		$this->_MSGR->set_validator_config( $new_config );
49
+		$this->_MSGR->set_validator_config($new_config);
50 50
 
51
-		if ( $this->_context != 'admin' )
51
+		if ($this->_context != 'admin')
52 52
 			$this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
53 53
 
54 54
 		$this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]');
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  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 7
 /**
7 8
  * Event Espresso
@@ -48,8 +49,9 @@  discard block
 block discarded – undo
48 49
 			);
49 50
 		$this->_MSGR->set_validator_config( $new_config );
50 51
 
51
-		if ( $this->_context != 'admin' )
52
-			$this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
52
+		if ( $this->_context != 'admin' ) {
53
+					$this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
54
+		}
53 55
 
54 56
 		$this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]');
55 57
 	}
Please login to merge, or discard this patch.
validators/email/EE_Messages_Email_Payment_Refund_Validator.class.php 2 patches
Spacing   +7 added lines, -7 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
 /**
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 class EE_Messages_Email_Payment_Refund_Validator extends EE_Messages_Validator {
31 31
 
32 32
 
33
-	public function __construct( $fields, $context ) {
33
+	public function __construct($fields, $context) {
34 34
 		$this->_m_name = 'email';
35 35
 		$this->_mt_name = 'payment_refund';
36 36
 
37
-		parent::__construct( $fields, $context );
37
+		parent::__construct($fields, $context);
38 38
 	}
39 39
 
40 40
 	/**
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
 
46 46
 		//modify just event_list
47 47
 		$new_config['event_list'] = array(
48
-			'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list')
48
+			'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list')
49 49
 			);
50 50
 		$new_config['ticket_list'] = array(
51 51
 			'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction')
52 52
 			);
53 53
 		$new_config['content'] = array(
54
-			'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger')
54
+			'shortcodes' => array('event_list', 'attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger')
55 55
 			);
56
-		$this->_MSGR->set_validator_config( $new_config );
56
+		$this->_MSGR->set_validator_config($new_config);
57 57
 
58
-		if ( $this->_context != 'admin' )
58
+		if ($this->_context != 'admin')
59 59
 			$this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
60 60
 
61 61
 		$this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]');
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  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 7
 /**
7 8
  * Event Espresso
@@ -48,8 +49,9 @@  discard block
 block discarded – undo
48 49
 			);
49 50
 		$this->_MSGR->set_validator_config( $new_config );
50 51
 
51
-		if ( $this->_context != 'admin' )
52
-			$this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
52
+		if ( $this->_context != 'admin' ) {
53
+					$this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
54
+		}
53 55
 
54 56
 		$this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]');
55 57
 	}
Please login to merge, or discard this patch.
messages/validators/email/EE_Messages_Email_Payment_Validator.class.php 2 patches
Spacing   +7 added lines, -7 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
 /**
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 class EE_Messages_Email_Payment_Validator extends EE_Messages_Validator {
31 31
 
32 32
 
33
-	public function __construct( $fields, $context ) {
33
+	public function __construct($fields, $context) {
34 34
 		$this->_m_name = 'email';
35 35
 		$this->_mt_name = 'payment';
36 36
 
37
-		parent::__construct( $fields, $context );
37
+		parent::__construct($fields, $context);
38 38
 	}
39 39
 
40 40
 	/**
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
 
46 46
 		//modify just event_list
47 47
 		$new_config['event_list'] = array(
48
-			'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list')
48
+			'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list')
49 49
 			);
50 50
 		$new_config['ticket_list'] = array(
51 51
 			'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction')
52 52
 			);
53 53
 		$new_config['content'] = array(
54
-			'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger')
54
+			'shortcodes' => array('event_list', 'attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger')
55 55
 			);
56
-		$this->_MSGR->set_validator_config( $new_config );
56
+		$this->_MSGR->set_validator_config($new_config);
57 57
 
58
-		if ( $this->_context != 'admin' )
58
+		if ($this->_context != 'admin')
59 59
 			$this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
60 60
 
61 61
 		$this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]');
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  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 7
 /**
7 8
  * Event Espresso
@@ -48,8 +49,9 @@  discard block
 block discarded – undo
48 49
 			);
49 50
 		$this->_MSGR->set_validator_config( $new_config );
50 51
 
51
-		if ( $this->_context != 'admin' )
52
-			$this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
52
+		if ( $this->_context != 'admin' ) {
53
+					$this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
54
+		}
53 55
 
54 56
 		$this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]');
55 57
 	}
Please login to merge, or discard this patch.
validators/email/EE_Messages_Email_Pending_Approval_Validator.class.php 2 patches
Spacing   +5 added lines, -5 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
 /**
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 class EE_Messages_Email_Pending_Approval_Validator extends EE_Messages_Validator {
31 31
 
32 32
 
33
-	public function __construct( $fields, $context ) {
33
+	public function __construct($fields, $context) {
34 34
 		$this->_m_name = 'email';
35 35
 		$this->_mt_name = 'pending_approval';
36 36
 
37
-		parent::__construct( $fields, $context );
37
+		parent::__construct($fields, $context);
38 38
 	}
39 39
 
40 40
 	/**
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 			'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'),
48 48
 			'required' => array('[EVENT_LIST]')
49 49
 			);
50
-		$this->_MSGR->set_validator_config( $new_config );
50
+		$this->_MSGR->set_validator_config($new_config);
51 51
 
52
-		if ( $this->_context != 'admin' )
52
+		if ($this->_context != 'admin')
53 53
 			$this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
54 54
 
55 55
 		$this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]');
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  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 7
 /**
7 8
  * Event Espresso
@@ -48,8 +49,9 @@  discard block
 block discarded – undo
48 49
 			);
49 50
 		$this->_MSGR->set_validator_config( $new_config );
50 51
 
51
-		if ( $this->_context != 'admin' )
52
-			$this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
52
+		if ( $this->_context != 'admin' ) {
53
+					$this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
54
+		}
53 55
 
54 56
 		$this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]');
55 57
 	}
Please login to merge, or discard this patch.