Completed
Branch BUG-9961-paypal-pro-items (52e78c)
by
unknown
49:07 queued 32:43
created
core/libraries/messages/data_class/EE_Messages_Addressee.class.php 1 patch
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
-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
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 * @param array $addressee_data We're expecting an incoming array of data that will be used to fill the properties
261 261
 	 *                              for the object.
262 262
 	 */
263
-	public function __construct( $addressee_data ) {
263
+	public function __construct($addressee_data) {
264 264
 		$this->_data = $addressee_data;
265 265
 		$this->_set_properties();
266 266
 	}
@@ -275,15 +275,15 @@  discard block
 block discarded – undo
275 275
 	 * @return void.
276 276
 	 */
277 277
 	protected function _set_properties() {
278
-		foreach ( $this->_data as $prop => $value ) {
279
-			if ( property_exists( $this, $prop ) ) {
278
+		foreach ($this->_data as $prop => $value) {
279
+			if (property_exists($this, $prop)) {
280 280
 				$this->{$prop} = $value;
281 281
 			}
282 282
 		}
283 283
 		//if user_id present we'll use this to set the fname and lname and admin_email.
284
-		if ( ! empty( $this->user_id ) ) {
284
+		if ( ! empty($this->user_id)) {
285 285
 			$this->user_id = (int) $this->user_id;
286
-			$user = get_userdata( $this->user_id );
286
+			$user = get_userdata($this->user_id);
287 287
 			$this->fname = $user->user_firstname;
288 288
 			$this->lname = $user->user_lastname;
289 289
 			$this->admin_email = $user->user_email;
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Transaction_Shortcodes.lib.php 1 patch
Spacing   +162 added lines, -162 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
 /**
@@ -40,50 +40,50 @@  discard block
 block discarded – undo
40 40
 
41 41
 
42 42
 	protected function _init_props() {
43
-		$this->label = esc_html__( 'Transaction Shortcodes', 'event_espresso' );
44
-		$this->description = esc_html__( 'All shortcodes specific to transaction related data', 'event_espresso' );
43
+		$this->label = esc_html__('Transaction Shortcodes', 'event_espresso');
44
+		$this->description = esc_html__('All shortcodes specific to transaction related data', 'event_espresso');
45 45
 		$this->_shortcodes = array(
46
-			'[TXN_ID]' => esc_html__( 'The transaction id for the purchase.', 'event_espresso' ),
47
-			'[PAYMENT_URL]' => esc_html__( 'This is a link to make a payment for the event', 'event_espresso' ),
48
-			'[PAYMENT_LINK_IF_NEEDED_*]' => esc_html__( 'This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso' ) . '<ul>'
49
-				. '<li>' . sprintf( esc_html__( '%sclass:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
50
-				. '<li>' . sprintf( esc_html__( '%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
51
-				. '<li>' . sprintf( esc_html__( '%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
46
+			'[TXN_ID]' => esc_html__('The transaction id for the purchase.', 'event_espresso'),
47
+			'[PAYMENT_URL]' => esc_html__('This is a link to make a payment for the event', 'event_espresso'),
48
+			'[PAYMENT_LINK_IF_NEEDED_*]' => esc_html__('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso').'<ul>'
49
+				. '<li>'.sprintf(esc_html__('%sclass:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso'), '<strong>', '</strong>').'</li>'
50
+				. '<li>'.sprintf(esc_html__('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso'), '<strong>', '</strong>').'</li>'
51
+				. '<li>'.sprintf(esc_html__('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso'), '<strong>', '</strong>').'</li>'
52 52
 				. '</ul>',
53
-			'[PAYMENT_DUE_DATE_*]' => esc_html__( 'This is a special dynamic shortcode that allows one to output a payment due date.  It will only result in a date shown if there is money owing.  Three parameters are available on this shortcode:', 'event_espresso' )
53
+			'[PAYMENT_DUE_DATE_*]' => esc_html__('This is a special dynamic shortcode that allows one to output a payment due date.  It will only result in a date shown if there is money owing.  Three parameters are available on this shortcode:', 'event_espresso')
54 54
 				. '<ul>'
55
-				. '<li>' . sprintf( esc_html__( '%sformat:%s This is used to indicate what format the date is in.  Default is whatever is set as date formats for your website.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
56
-				. '<li>' . sprintf( esc_html__( '%sdays_until_due:%s This is the number of days form the transaction creation date that the payment is due.  Defaults to 30.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
57
-				. '<li>' . sprintf( esc_html__( '%sprefix_text:%s You can use this to indicate what text will prefix the date string.  Defaults to "Payment in full due by:"', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>',
58
-			'[INVOICE_LINK]' => esc_html__( 'This is a full html link to the invoice', 'event_espresso' ),
59
-			'[INVOICE_URL]' => esc_html__( 'This is just the url for the invoice', 'event_espresso' ),
60
-			'[INVOICE_LOGO_URL]' => esc_html__( 'This returns the url for the logo uploaded via the invoice settings page.', 'event_espresso' ),
61
-			'[INVOICE_LOGO]' => esc_html__( 'This returns the logo uploaded via the invoice settings page wrapped in img_tags and with a "logo screen" classes. The image size is also set in the img tags automatically to match the uploaded logo.', 'event_espresso' ),
62
-			'[INVOICE_PAYEE_NAME]' => esc_html__( 'This will parse to either: the value of the "Company Name" field in the invoice payment method settings; if that is blank, then the value of the Company Name in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ),
63
-			'[INVOICE_PAYEE_ADDRESS]' => esc_html__( 'This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ),
64
-			'[INVOICE_PAYMENT_INSTRUCTIONS]' => esc_html__( 'This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso' ),
65
-			'[INVOICE_PAYEE_EMAIL]' => esc_html__( 'This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ),
66
-			'[INVOICE_PAYEE_TAX_NUMBER_*]' => sprintf( esc_html__( 'This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number.  It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: %1$s[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]%2$s and that will output: GST: 12345t56.  If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso' ), '<code>', '</code>' ),
67
-			'[TOTAL_COST]' => esc_html__( 'The total cost for the transaction', 'event_espresso' ),
68
-			'[TXN_STATUS]' => esc_html__( 'The transaction status for the transaction.', 'event_espresso' ),
69
-			'[TXN_STATUS_ID]' => esc_html__( 'The ID representing the transaction status as saved in the db.  This tends to be useful for including with css classes for styling certain statuses differently from others.', 'event_espresso' ),
70
-			'[PAYMENT_STATUS]' => esc_html__( 'The transaction status for the transaction. This parses to the same value as the [TXN_STATUS] shortcode and still remains here for legacy support.', 'event_espresso' ),
71
-			'[PAYMENT_GATEWAY]' => esc_html__( 'The payment gateway used for the transaction', 'event_espresso' ),
72
-			'[AMOUNT_PAID]' => esc_html__( 'The amount paid or refunded.  This will only have a value if there was a payment or refund at the time of generating the message.', 'event_espresso' ),
73
-			'[LAST_AMOUNT_PAID]' => esc_html__( 'This is the last payment or refund made on the transaction related to the message being generated.', 'event_espresso' ),
74
-			'[TOTAL_AMOUNT_PAID]' => esc_html__( 'This parses to the total amount paid over all payments', 'event_espresso' ),
75
-			'[TOTAL_OWING]' => esc_html__( 'The total owing on a transaction with no attributes.', 'event_espresso' ),
76
-			'[TXN_SUBTOTAL]' => esc_html__( 'The subtotal for all txn line items.', 'event_espresso' ),
77
-			'[TXN_TAX_SUBTOTAL]' => esc_html__( 'The subtotal for all tax line items.', 'event_espresso' ),
78
-			'[OWING_STATUS_MESSAGE_*]' => esc_html__( 'A dynamic shortcode for adjusting how total owing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso' ) . '<p></ul>' .
79
-				'<li><strong>still_owing</strong>:' . esc_html__( 'If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount owing). The default is:', 'event_espresso' ) . sprintf( esc_html__( '%sPlease make a payment.%s', 'event_espresso' ),  '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' ) . '</li>' .
80
-				'<li><strong>none_owing</strong>:' . esc_html__( 'If the transaction is paid in full, then you can indicate how this gets displayed.  Note, that it defaults to just be the total owing.', 'event_espresso' ) . '</li></ul></p>',
81
-			'[TXN_TOTAL_TICKETS]' => esc_html__( 'The total number of all tickets purchased in a transaction', 'event_espresso' ),
82
-			'[TKT_QTY_PURCHASED]' => sprintf( esc_html__( 'The total number of all tickets purchased in a transaction. %1$sNOTE: This shortcode is good to use in the "[TICKET_LIST]" field but has been deprecated from all other contexts in favor of the more explicit [TXN_TOTAL_TICKETS] shortcode.%2$s', 'event_espresso' ), '<strong>', '</strong>' ),
83
-			'[TRANSACTION_ADMIN_URL]' => esc_html__( 'The url to the admin page for this transaction', 'event_espresso' ),
84
-			'[RECEIPT_URL]' => esc_html__( 'This parses to the generated url for retrieving the receipt for the transaction', 'event_espresso' ),
85
-			'[INVOICE_RECEIPT_SWITCHER_URL]' => esc_html__( 'This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active  then will parse to an empty string.', 'event_espresso' ),
86
-			'[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf( esc_html__( 'The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso' ), '<code>', '</code>' )
55
+				. '<li>'.sprintf(esc_html__('%sformat:%s This is used to indicate what format the date is in.  Default is whatever is set as date formats for your website.', 'event_espresso'), '<strong>', '</strong>').'</li>'
56
+				. '<li>'.sprintf(esc_html__('%sdays_until_due:%s This is the number of days form the transaction creation date that the payment is due.  Defaults to 30.', 'event_espresso'), '<strong>', '</strong>').'</li>'
57
+				. '<li>'.sprintf(esc_html__('%sprefix_text:%s You can use this to indicate what text will prefix the date string.  Defaults to "Payment in full due by:"', 'event_espresso'), '<strong>', '</strong>').'</li>',
58
+			'[INVOICE_LINK]' => esc_html__('This is a full html link to the invoice', 'event_espresso'),
59
+			'[INVOICE_URL]' => esc_html__('This is just the url for the invoice', 'event_espresso'),
60
+			'[INVOICE_LOGO_URL]' => esc_html__('This returns the url for the logo uploaded via the invoice settings page.', 'event_espresso'),
61
+			'[INVOICE_LOGO]' => esc_html__('This returns the logo uploaded via the invoice settings page wrapped in img_tags and with a "logo screen" classes. The image size is also set in the img tags automatically to match the uploaded logo.', 'event_espresso'),
62
+			'[INVOICE_PAYEE_NAME]' => esc_html__('This will parse to either: the value of the "Company Name" field in the invoice payment method settings; if that is blank, then the value of the Company Name in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'),
63
+			'[INVOICE_PAYEE_ADDRESS]' => esc_html__('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'),
64
+			'[INVOICE_PAYMENT_INSTRUCTIONS]' => esc_html__('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso'),
65
+			'[INVOICE_PAYEE_EMAIL]' => esc_html__('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'),
66
+			'[INVOICE_PAYEE_TAX_NUMBER_*]' => sprintf(esc_html__('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number.  It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: %1$s[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]%2$s and that will output: GST: 12345t56.  If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso'), '<code>', '</code>'),
67
+			'[TOTAL_COST]' => esc_html__('The total cost for the transaction', 'event_espresso'),
68
+			'[TXN_STATUS]' => esc_html__('The transaction status for the transaction.', 'event_espresso'),
69
+			'[TXN_STATUS_ID]' => esc_html__('The ID representing the transaction status as saved in the db.  This tends to be useful for including with css classes for styling certain statuses differently from others.', 'event_espresso'),
70
+			'[PAYMENT_STATUS]' => esc_html__('The transaction status for the transaction. This parses to the same value as the [TXN_STATUS] shortcode and still remains here for legacy support.', 'event_espresso'),
71
+			'[PAYMENT_GATEWAY]' => esc_html__('The payment gateway used for the transaction', 'event_espresso'),
72
+			'[AMOUNT_PAID]' => esc_html__('The amount paid or refunded.  This will only have a value if there was a payment or refund at the time of generating the message.', 'event_espresso'),
73
+			'[LAST_AMOUNT_PAID]' => esc_html__('This is the last payment or refund made on the transaction related to the message being generated.', 'event_espresso'),
74
+			'[TOTAL_AMOUNT_PAID]' => esc_html__('This parses to the total amount paid over all payments', 'event_espresso'),
75
+			'[TOTAL_OWING]' => esc_html__('The total owing on a transaction with no attributes.', 'event_espresso'),
76
+			'[TXN_SUBTOTAL]' => esc_html__('The subtotal for all txn line items.', 'event_espresso'),
77
+			'[TXN_TAX_SUBTOTAL]' => esc_html__('The subtotal for all tax line items.', 'event_espresso'),
78
+			'[OWING_STATUS_MESSAGE_*]' => esc_html__('A dynamic shortcode for adjusting how total owing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso').'<p></ul>'.
79
+				'<li><strong>still_owing</strong>:'.esc_html__('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount owing). The default is:', 'event_espresso').sprintf(esc_html__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>').'</li>'.
80
+				'<li><strong>none_owing</strong>:'.esc_html__('If the transaction is paid in full, then you can indicate how this gets displayed.  Note, that it defaults to just be the total owing.', 'event_espresso').'</li></ul></p>',
81
+			'[TXN_TOTAL_TICKETS]' => esc_html__('The total number of all tickets purchased in a transaction', 'event_espresso'),
82
+			'[TKT_QTY_PURCHASED]' => sprintf(esc_html__('The total number of all tickets purchased in a transaction. %1$sNOTE: This shortcode is good to use in the "[TICKET_LIST]" field but has been deprecated from all other contexts in favor of the more explicit [TXN_TOTAL_TICKETS] shortcode.%2$s', 'event_espresso'), '<strong>', '</strong>'),
83
+			'[TRANSACTION_ADMIN_URL]' => esc_html__('The url to the admin page for this transaction', 'event_espresso'),
84
+			'[RECEIPT_URL]' => esc_html__('This parses to the generated url for retrieving the receipt for the transaction', 'event_espresso'),
85
+			'[INVOICE_RECEIPT_SWITCHER_URL]' => esc_html__('This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active  then will parse to an empty string.', 'event_espresso'),
86
+			'[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf(esc_html__('The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso'), '<code>', '</code>')
87 87
 			);
88 88
 	}
89 89
 
@@ -94,40 +94,40 @@  discard block
 block discarded – undo
94 94
 	 * @param  string $shortcode the shortcode to be parsed.
95 95
 	 * @return string parsed shortcode
96 96
 	 */
97
-	protected function _parser( $shortcode ) {
97
+	protected function _parser($shortcode) {
98 98
 
99 99
 		//attempt to get the transaction.  Since this is potentially used in more fields, we may have to look in the _extra_data for the transaction.
100 100
 		$transaction = $this->_data->txn instanceof EE_Transaction ? $this->_data->txn : null;
101
-		$transaction = ! $transaction instanceof EE_Transaction && is_array( $this->_extra_data ) &&  isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn: $transaction;
101
+		$transaction = ! $transaction instanceof EE_Transaction && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn : $transaction;
102 102
 
103 103
 		//payment
104 104
 		$payment = $this->_data->payment instanceof EE_Payment ? $this->_data->payment : null;
105
-		$payment = ! $payment instanceof EE_Payment && is_array( $this->_extra_data ) &&  isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment: $payment;
105
+		$payment = ! $payment instanceof EE_Payment && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment : $payment;
106 106
 
107 107
 
108
-		if ( ! $transaction instanceof EE_Transaction ) {
108
+		if ( ! $transaction instanceof EE_Transaction) {
109 109
 			return '';
110 110
 		}
111 111
 
112
-		switch ( $shortcode ) {
112
+		switch ($shortcode) {
113 113
 			case '[TXN_ID]' :
114 114
 				return $transaction->ID();
115 115
 				break;
116 116
 
117 117
 			case '[PAYMENT_URL]' :
118 118
 				$payment_url = $transaction->payment_overview_url();
119
-				return empty( $payment_url ) ? esc_html__( 'http://dummypaymenturlforpreview.com', 'event_espresso' ) : $payment_url;
119
+				return empty($payment_url) ? esc_html__('http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url;
120 120
 				break;
121 121
 
122 122
 			case '[INVOICE_LINK]' :
123 123
 				$invoice_url = $transaction->invoice_url();
124
-				$invoice_url = empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
125
-				return sprintf( esc_html__( '%sClick here for Invoice%s', 'event_espresso' ), '<a href="' . $invoice_url . '">', '</a>' );
124
+				$invoice_url = empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
125
+				return sprintf(esc_html__('%sClick here for Invoice%s', 'event_espresso'), '<a href="'.$invoice_url.'">', '</a>');
126 126
 				break; /**/
127 127
 
128 128
 			case '[INVOICE_URL]' :
129 129
 				$invoice_url = $transaction->invoice_url();
130
-				return empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
130
+				return empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
131 131
 				break;
132 132
 
133 133
 			case '[INVOICE_LOGO_URL]' :
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 				break;
136 136
 
137 137
 			case '[INVOICE_LOGO]' :
138
-				return $this->_get_invoice_logo( true );
138
+				return $this->_get_invoice_logo(true);
139 139
 				break;
140 140
 
141 141
 			case '[INVOICE_PAYEE_NAME]' :
@@ -157,18 +157,18 @@  discard block
 block discarded – undo
157 157
 
158 158
 			case '[TOTAL_COST]' :
159 159
 				$total = $transaction->total();
160
-				return ! empty($total) ? EEH_Template::format_currency( $total ) : '';
160
+				return ! empty($total) ? EEH_Template::format_currency($total) : '';
161 161
 				break;
162 162
 
163 163
 			case '[PAYMENT_STATUS]' :
164 164
 				$status = $transaction->pretty_status();
165
-				return ! empty($status) ? $status : esc_html__( 'Unknown', 'event_espresso' );
165
+				return ! empty($status) ? $status : esc_html__('Unknown', 'event_espresso');
166 166
 				break; /**/
167 167
 
168 168
 			// note the [payment_status] shortcode is kind of misleading because payment status might be different from txn status so I'm adding this here for clarity.
169 169
 			case '[TXN_STATUS]':
170 170
 				$status = $transaction->pretty_status();
171
-				return ! empty( $status ) ? $status : esc_html__( 'Unknown', 'event_espresso' );
171
+				return ! empty($status) ? $status : esc_html__('Unknown', 'event_espresso');
172 172
 				break;
173 173
 
174 174
 			case '[TXN_STATUS_ID]' :
@@ -176,36 +176,36 @@  discard block
 block discarded – undo
176 176
 				break;
177 177
 
178 178
 			case '[PAYMENT_GATEWAY]' :
179
-				return $this->_get_payment_gateway( $transaction );
179
+				return $this->_get_payment_gateway($transaction);
180 180
 				break;
181 181
 
182 182
 			case '[AMOUNT_PAID]' :
183 183
 				return $payment instanceof EE_Payment
184
-					? EEH_Template::format_currency( $payment->amount() )
185
-					: EEH_Template::format_currency( 0 );
184
+					? EEH_Template::format_currency($payment->amount())
185
+					: EEH_Template::format_currency(0);
186 186
 				break;
187 187
 
188 188
 			case '[LAST_AMOUNT_PAID]' :
189 189
 				$last_payment = $transaction->last_payment();
190 190
 				return $last_payment instanceof EE_Payment
191
-					? EEH_Template::format_currency( $last_payment->amount() )
192
-					: EEH_Template::format_currency( 0 );
191
+					? EEH_Template::format_currency($last_payment->amount())
192
+					: EEH_Template::format_currency(0);
193 193
 
194 194
 			case '[TOTAL_AMOUNT_PAID]' :
195
-				return EEH_Template::format_currency( $transaction->paid() );
195
+				return EEH_Template::format_currency($transaction->paid());
196 196
 				break;
197 197
 
198 198
 			case '[TOTAL_OWING]' :
199 199
 				$total_owing = $transaction->remaining();
200
-				return EEH_Template::format_currency( $total_owing );
200
+				return EEH_Template::format_currency($total_owing);
201 201
 				break;
202 202
 
203 203
 			case '[TXN_SUBTOTAL]' :
204
-				return EEH_Template::format_currency( $this->_get_subtotal() );
204
+				return EEH_Template::format_currency($this->_get_subtotal());
205 205
 				break;
206 206
 
207 207
 			case '[TXN_TAX_SUBTOTAL]' :
208
-				return EEH_Template::format_currency( $this->_get_subtotal( true ) );
208
+				return EEH_Template::format_currency($this->_get_subtotal(true));
209 209
 				break;
210 210
 
211 211
 			case '[TKT_QTY_PURCHASED]' :
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
 				break;
215 215
 
216 216
 			case '[TRANSACTION_ADMIN_URL]' :
217
-				require_once EE_CORE . 'admin/EE_Admin_Page.core.php';
218
-				$query_args = array( 'page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID() );
219
-				$url = EE_Admin_Page::add_query_args_and_nonce( $query_args, admin_url( 'admin.php' ) );
217
+				require_once EE_CORE.'admin/EE_Admin_Page.core.php';
218
+				$query_args = array('page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID());
219
+				$url = EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php'));
220 220
 				return $url;
221 221
 				break;
222 222
 
@@ -224,14 +224,14 @@  discard block
 block discarded – undo
224 224
 				//get primary_registration
225 225
 				$reg = $this->_data->primary_reg_obj;
226 226
 
227
-				if ( ! $reg instanceof EE_Registration ) {
227
+				if ( ! $reg instanceof EE_Registration) {
228 228
 					return '';
229 229
 				}
230 230
 				return $reg->receipt_url();
231 231
 				break;
232 232
 
233 233
 			case '[INVOICE_RECEIPT_SWITCHER_URL]' :
234
-				return $this->_get_invoice_receipt_switcher( false );
234
+				return $this->_get_invoice_receipt_switcher(false);
235 235
 				break;
236 236
 
237 237
 			case '[INVOICE_RECEIPT_SWITCHER_BUTTON]' :
@@ -241,20 +241,20 @@  discard block
 block discarded – undo
241 241
 
242 242
 		}
243 243
 
244
-		if ( strpos( $shortcode, '[OWING_STATUS_MESSAGE_*' ) !== false ) {
245
-			return $this->_get_custom_total_owing( $shortcode );
244
+		if (strpos($shortcode, '[OWING_STATUS_MESSAGE_*') !== false) {
245
+			return $this->_get_custom_total_owing($shortcode);
246 246
 		}
247 247
 
248
-		if ( strpos( $shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*' ) !== false ) {
249
-			return $this->_get_invoice_payee_tax_number( $shortcode );
248
+		if (strpos($shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*') !== false) {
249
+			return $this->_get_invoice_payee_tax_number($shortcode);
250 250
 		}
251 251
 
252
-		if ( strpos( $shortcode, '[PAYMENT_LINK_IF_NEEDED_*' ) !== false ) {
253
-			return $this->_get_payment_link_if_needed( $shortcode );
252
+		if (strpos($shortcode, '[PAYMENT_LINK_IF_NEEDED_*') !== false) {
253
+			return $this->_get_payment_link_if_needed($shortcode);
254 254
 		}
255 255
 
256
-		if ( strpos( $shortcode, '[PAYMENT_DUE_DATE_*' ) !== false ) {
257
-			return $this->_get_payment_due_date( $shortcode, $transaction );
256
+		if (strpos($shortcode, '[PAYMENT_DUE_DATE_*') !== false) {
257
+			return $this->_get_payment_due_date($shortcode, $transaction);
258 258
 		}
259 259
 
260 260
 		return '';
@@ -271,19 +271,19 @@  discard block
 block discarded – undo
271 271
 	 *
272 272
 	 * @return string parsed.
273 273
 	 */
274
-	private function _get_custom_total_owing( $shortcode ) {
275
-		$valid_shortcodes = array( 'transaction' );
276
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
274
+	private function _get_custom_total_owing($shortcode) {
275
+		$valid_shortcodes = array('transaction');
276
+		$attrs = $this->_get_shortcode_attrs($shortcode);
277 277
 
278 278
 		//ensure default is set.
279 279
 		$addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
280 280
 		$total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0;
281 281
 
282
-		if ( $total_owing > 0 ) {
283
-			$owing_content = ! empty( $attrs['still_owing'] ) ? $attrs['still_owing'] : sprintf( esc_html__( '%sPlease make a payment.%s', 'event_espresso' ),  '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' );
284
-			$owing_content = $this->_shortcode_helper->parse_message_template( $owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message );
282
+		if ($total_owing > 0) {
283
+			$owing_content = ! empty($attrs['still_owing']) ? $attrs['still_owing'] : sprintf(esc_html__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>');
284
+			$owing_content = $this->_shortcode_helper->parse_message_template($owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message);
285 285
 		} else {
286
-			$owing_content = ! empty( $attrs['none_owing']) ? $attrs['none_owing'] : '';
286
+			$owing_content = ! empty($attrs['none_owing']) ? $attrs['none_owing'] : '';
287 287
 		}
288 288
 
289 289
 		return $owing_content;
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
 	 * @param EE_Transaction $transaction
296 296
 	 * @return string
297 297
 	 */
298
-	private function _get_payment_gateway( $transaction ) {
299
-		$pm = $this->_get_payment_method( $transaction );
298
+	private function _get_payment_gateway($transaction) {
299
+		$pm = $this->_get_payment_method($transaction);
300 300
 		return $pm instanceof EE_Payment_Method ? $pm->name() : '';
301 301
 	}
302 302
 
@@ -311,37 +311,37 @@  discard block
 block discarded – undo
311 311
 	 *
312 312
 	 * @return string url or html
313 313
 	 */
314
-	private function _get_invoice_logo( $img_tags = false ) {
314
+	private function _get_invoice_logo($img_tags = false) {
315 315
 		//try to get the invoice payment method's logo for this transaction image first
316 316
 		$pm = $this->_get_payment_method();
317
-		if ( $pm instanceof EE_Payment_Method ){
318
-			$invoice_logo_url = $pm->get_extra_meta( 'pdf_logo_image', true );
317
+		if ($pm instanceof EE_Payment_Method) {
318
+			$invoice_logo_url = $pm->get_extra_meta('pdf_logo_image', true);
319 319
 		} else {
320 320
 			$invoice_logo_url = null;
321 321
 		}
322
-		if ( empty( $invoice_logo_url ) ){
322
+		if (empty($invoice_logo_url)) {
323 323
 			$invoice_logo_url = EE_Registry::instance()->CFG->organization->logo_url;
324 324
 		}
325 325
 
326
-		if ( empty( $invoice_logo_url ) ) {
326
+		if (empty($invoice_logo_url)) {
327 327
 			return '';
328 328
 		}
329 329
 
330
-		if ( ! $img_tags ) {
330
+		if ( ! $img_tags) {
331 331
 			return $invoice_logo_url;
332 332
 		}
333 333
 
334 334
 		//image tags have been requested.
335
-		$image_size = getimagesize( $invoice_logo_url );
335
+		$image_size = getimagesize($invoice_logo_url);
336 336
 
337 337
 		//if image is wider than 200px, set the width to 200
338
-		if ( $image_size[0] > 300 ) {
338
+		if ($image_size[0] > 300) {
339 339
 			$image_width = 300;
340 340
 		} else {
341 341
 			$image_width = $image_size[0];
342 342
 		}
343 343
 
344
-		return '<img class="logo screen" src="' . $invoice_logo_url . '" width="' . $image_width . '" alt="logo" />';
344
+		return '<img class="logo screen" src="'.$invoice_logo_url.'" width="'.$image_width.'" alt="logo" />';
345 345
 	}
346 346
 
347 347
 
@@ -358,10 +358,10 @@  discard block
 block discarded – undo
358 358
 	private function _get_invoice_payee_name() {
359 359
 		$payee_name = null;
360 360
 		$pm = $this->_get_payment_method();
361
-		if ( $pm instanceof EE_Payment_Method ){
362
-			$payee_name = $pm->get_extra_meta( 'pdf_payee_name', true );
361
+		if ($pm instanceof EE_Payment_Method) {
362
+			$payee_name = $pm->get_extra_meta('pdf_payee_name', true);
363 363
 		}
364
-		$payee_name = empty( $payee_name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : $payee_name;
364
+		$payee_name = empty($payee_name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : $payee_name;
365 365
 		return $payee_name;
366 366
 	}
367 367
 
@@ -373,16 +373,16 @@  discard block
 block discarded – undo
373 373
 	 * @param EE_Transaction|null $transaction
374 374
 	 * @return \EE_Payment_Method|mixed|null|void
375 375
 	 */
376
-	private function _get_payment_method( $transaction = null ){
377
-		if ( $transaction instanceof EE_Transaction ) {
376
+	private function _get_payment_method($transaction = null) {
377
+		if ($transaction instanceof EE_Transaction) {
378 378
 			$payment_method = $transaction->payment_method();
379
-			if ( empty( $payment_method ) ) {
380
-				return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type( 'Invoice' ) );
379
+			if (empty($payment_method)) {
380
+				return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
381 381
 			}
382 382
 			return $payment_method;
383 383
 		} else {
384 384
 			//get the first payment method we can find
385
-			return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type( 'Invoice' ) );
385
+			return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
386 386
 		}
387 387
 	}
388 388
 
@@ -399,10 +399,10 @@  discard block
 block discarded – undo
399 399
 	private function _get_invoice_payee_email() {
400 400
 		$payee_email = null;
401 401
 		$pm = $this->_get_payment_method();
402
-		if ( $pm instanceof EE_Payment_Method ){
403
-			$payee_email = $pm->get_extra_meta( 'pdf_payee_email', true );
402
+		if ($pm instanceof EE_Payment_Method) {
403
+			$payee_email = $pm->get_extra_meta('pdf_payee_email', true);
404 404
 		}
405
-		$payee_email = empty( $payee_email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : $payee_email;
405
+		$payee_email = empty($payee_email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : $payee_email;
406 406
 		return $payee_email;
407 407
 	}
408 408
 
@@ -418,24 +418,24 @@  discard block
 block discarded – undo
418 418
 	 *
419 419
 	 * @return string
420 420
 	 */
421
-	private function _get_invoice_payee_tax_number( $shortcode ) {
421
+	private function _get_invoice_payee_tax_number($shortcode) {
422 422
 		$payee_tax_number = null;
423 423
 		$pm = $this->_get_payment_method();
424
-		if ( $pm instanceof EE_Payment_Method ){
425
-			$payee_tax_number = $pm->get_extra_meta( 'pdf_payee_tax_number', true );
424
+		if ($pm instanceof EE_Payment_Method) {
425
+			$payee_tax_number = $pm->get_extra_meta('pdf_payee_tax_number', true);
426 426
 		}
427
-		$payee_tax_number = empty( $payee_tax_number ) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number;
427
+		$payee_tax_number = empty($payee_tax_number) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number;
428 428
 
429
-		if ( empty( $payee_tax_number ) ) {
429
+		if (empty($payee_tax_number)) {
430 430
 			return '';
431 431
 		}
432 432
 
433 433
 		//any attributes?
434
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
434
+		$attrs = $this->_get_shortcode_attrs($shortcode);
435 435
 
436 436
 		//prefix?
437
-		$prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : esc_html__( 'VAT/Tax Number: ', 'event_espresso' );
438
-		return $prefix . $payee_tax_number;
437
+		$prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso');
438
+		return $prefix.$payee_tax_number;
439 439
 	}
440 440
 
441 441
 
@@ -452,22 +452,22 @@  discard block
 block discarded – undo
452 452
 	private function _get_invoice_payee_address() {
453 453
 		$payee_address = null;
454 454
 		$pm = $this->_get_payment_method();
455
-		if ( $pm instanceof EE_Payment_Method ){
456
-			$payee_address = $pm->get_extra_meta( 'pdf_payee_address', true );
455
+		if ($pm instanceof EE_Payment_Method) {
456
+			$payee_address = $pm->get_extra_meta('pdf_payee_address', true);
457 457
 		}
458
-		if ( empty( $payee_address ) ) {
458
+		if (empty($payee_address)) {
459 459
 			$organization = EE_Registry::instance()->CFG->organization;
460
-			$payee_address = $organization->get_pretty( 'address_1' ) . '<br>';
461
-			$payee_address .= ! empty( $organization->address_2 ) ? $organization->get_pretty( 'address_2' ) . '<br>' : '';
462
-			$payee_address .= $organization->get_pretty( 'city' ) . '<br>';
460
+			$payee_address = $organization->get_pretty('address_1').'<br>';
461
+			$payee_address .= ! empty($organization->address_2) ? $organization->get_pretty('address_2').'<br>' : '';
462
+			$payee_address .= $organization->get_pretty('city').'<br>';
463 463
 
464 464
 			//state
465
-			$state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $organization->STA_ID );
466
-			$payee_address .= $state instanceof EE_State ? $state->name()  : '';
465
+			$state = EE_Registry::instance()->load_model('State')->get_one_by_ID($organization->STA_ID);
466
+			$payee_address .= $state instanceof EE_State ? $state->name() : '';
467 467
 
468 468
 			//Country
469
-			$payee_address .= ! empty( $organization->CNT_ISO ) ? ', ' . $organization->CNT_ISO . '<br>' : '';
470
-			$payee_address .= ! empty( $organization->zip ) ? $organization->zip : '';
469
+			$payee_address .= ! empty($organization->CNT_ISO) ? ', '.$organization->CNT_ISO.'<br>' : '';
470
+			$payee_address .= ! empty($organization->zip) ? $organization->zip : '';
471 471
 		}
472 472
 		return $payee_address;
473 473
 	}
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 	private function _get_invoice_payment_instructions() {
486 486
 		$instructions = null;
487 487
 		$pm = $this->_get_payment_method();
488
-		return ( $pm instanceof EE_Payment_Method ) ? $pm->get_extra_meta( 'pdf_instructions', true ) : '';
488
+		return ($pm instanceof EE_Payment_Method) ? $pm->get_extra_meta('pdf_instructions', true) : '';
489 489
 	}
490 490
 
491 491
 
@@ -499,27 +499,27 @@  discard block
 block discarded – undo
499 499
 	 *
500 500
 	 * @return string
501 501
 	 */
502
-	protected function _get_invoice_receipt_switcher( $button = true ) {
502
+	protected function _get_invoice_receipt_switcher($button = true) {
503 503
 		$reg = $this->_data->primary_reg_obj;
504
-		$message_type = isset( $this->_extra_data['message_type'] ) ? $this->_extra_data['message_type'] : '';
505
-		if ( ! $reg instanceof EE_Registration || empty( $message_type ) ) {
504
+		$message_type = isset($this->_extra_data['message_type']) ? $this->_extra_data['message_type'] : '';
505
+		if ( ! $reg instanceof EE_Registration || empty($message_type)) {
506 506
 			return '';
507 507
 		}
508 508
 
509
-		$switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type  ? true : false;
510
-		$switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? esc_html__( 'View Invoice', 'event_espresso' ) : esc_html__( 'Switch to Invoice', 'event_espresso' );
511
-		$switch_to_label = ! $switch_to_invoice ? esc_html__( 'Switch to Receipt', 'event_espresso' ) : $switch_to_label;
509
+		$switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type ? true : false;
510
+		$switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? esc_html__('View Invoice', 'event_espresso') : esc_html__('Switch to Invoice', 'event_espresso');
511
+		$switch_to_label = ! $switch_to_invoice ? esc_html__('Switch to Receipt', 'event_espresso') : $switch_to_label;
512 512
 		$switch_to_url = $switch_to_invoice ? $reg->invoice_url() : $reg->receipt_url();
513 513
 
514
-		if ( ! $button ) {
514
+		if ( ! $button) {
515 515
 			return $switch_to_url;
516 516
 		}
517 517
 
518
-		if ( ! empty( $switch_to_url ) ) {
518
+		if ( ! empty($switch_to_url)) {
519 519
 
520 520
 			return  '
521
-	<form method="post" action="' . $switch_to_url . '" >
522
-		<input class="print_button" type="submit" value="' . $switch_to_label . '" />
521
+	<form method="post" action="' . $switch_to_url.'" >
522
+		<input class="print_button" type="submit" value="' . $switch_to_label.'" />
523 523
 	</form>
524 524
 			';
525 525
 		}
@@ -559,10 +559,10 @@  discard block
 block discarded – undo
559 559
 	 *
560 560
 	 * @return int
561 561
 	 */
562
-	private function _get_subtotal( $tax = false ) {
563
-		$grand_total = isset( $this->_data->grand_total_line_item ) ? $this->_data->grand_total_line_item : null;
562
+	private function _get_subtotal($tax = false) {
563
+		$grand_total = isset($this->_data->grand_total_line_item) ? $this->_data->grand_total_line_item : null;
564 564
 
565
-		if ( ! $grand_total instanceof EE_Line_Item ) {
565
+		if ( ! $grand_total instanceof EE_Line_Item) {
566 566
 			return 0;
567 567
 		}
568 568
 
@@ -581,26 +581,26 @@  discard block
 block discarded – undo
581 581
 	 *
582 582
 	 * @return string parsed.
583 583
 	 */
584
-	private function _get_payment_link_if_needed( $shortcode ) {
585
-		$valid_shortcodes = array( 'transaction' );
586
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
584
+	private function _get_payment_link_if_needed($shortcode) {
585
+		$valid_shortcodes = array('transaction');
586
+		$attrs = $this->_get_shortcode_attrs($shortcode);
587 587
 
588 588
 		//ensure default is set.
589 589
 		$addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
590 590
 		$total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0;
591 591
 
592
-		if ( $total_owing > 0 ) {
593
-			$class = isset( $attrs['class'] ) ? $attrs['class'] : 'callout';
594
-			$custom_text = isset( $attrs['custom_text'] ) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.';
595
-			$container_tag = isset( $attrs['container_tag'] ) ? $attrs['container_tag'] : 'p';
596
-			$opening_tag = ! empty( $container_tag ) ? '<' . $container_tag : '';
597
-			$opening_tag .= ! empty( $opening_tag ) && ! empty( $class ) ? ' class="' . $class . '"' : $opening_tag;
598
-			$opening_tag .= ! empty( $opening_tag ) ? '>' : $opening_tag;
599
-			$closing_tag = ! empty( $container_tag ) ? '</' . $container_tag .'>' : '';
600
-			$content = $opening_tag . sprintf( $custom_text, '<a href="[PAYMENT_URL]">', '</a>' ) . $closing_tag;
592
+		if ($total_owing > 0) {
593
+			$class = isset($attrs['class']) ? $attrs['class'] : 'callout';
594
+			$custom_text = isset($attrs['custom_text']) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.';
595
+			$container_tag = isset($attrs['container_tag']) ? $attrs['container_tag'] : 'p';
596
+			$opening_tag = ! empty($container_tag) ? '<'.$container_tag : '';
597
+			$opening_tag .= ! empty($opening_tag) && ! empty($class) ? ' class="'.$class.'"' : $opening_tag;
598
+			$opening_tag .= ! empty($opening_tag) ? '>' : $opening_tag;
599
+			$closing_tag = ! empty($container_tag) ? '</'.$container_tag.'>' : '';
600
+			$content = $opening_tag.sprintf($custom_text, '<a href="[PAYMENT_URL]">', '</a>').$closing_tag;
601 601
 
602 602
 			//we need to re run this string through the parser to catch any shortcodes that are in it.
603
-			$owing_content = $this->_shortcode_helper->parse_message_template( $content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message );
603
+			$owing_content = $this->_shortcode_helper->parse_message_template($content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message);
604 604
 		} else {
605 605
 			return '';
606 606
 		}
@@ -620,31 +620,31 @@  discard block
 block discarded – undo
620 620
 	 * @param EE_Transaction $transaction
621 621
 	 * @return string
622 622
 	 */
623
-	protected function _get_payment_due_date( $shortcode, EE_Transaction $transaction ) {
623
+	protected function _get_payment_due_date($shortcode, EE_Transaction $transaction) {
624 624
 		//if transaction is paid in full then we can just return an empty string
625
-		if ( $transaction->remaining() === 0 ) {
625
+		if ($transaction->remaining() === 0) {
626 626
 			return '';
627 627
 		}
628 628
 
629
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
630
-		$format = isset( $attrs['format'] ) ? $attrs['format'] : get_option( 'date_format' );
631
-		$days_until_due = isset( $attrs['days_until_due'] ) ? (int) $attrs['days_until_due'] : 30;
632
-		$prefix_text = isset( $attrs['prefix_text'] ) ? $attrs['prefix_text'] : esc_html__( 'Payment in full due by: ', 'event_espresso' );
633
-		$transaction_created = $transaction->get_DateTime_object( 'TXN_timestamp' );
629
+		$attrs = $this->_get_shortcode_attrs($shortcode);
630
+		$format = isset($attrs['format']) ? $attrs['format'] : get_option('date_format');
631
+		$days_until_due = isset($attrs['days_until_due']) ? (int) $attrs['days_until_due'] : 30;
632
+		$prefix_text = isset($attrs['prefix_text']) ? $attrs['prefix_text'] : esc_html__('Payment in full due by: ', 'event_espresso');
633
+		$transaction_created = $transaction->get_DateTime_object('TXN_timestamp');
634 634
 
635 635
 		//setup date due:
636 636
 		try {
637
-			if ( $transaction_created instanceof DateTime ) {
638
-				$date_due = $transaction_created->add( new DateInterval( 'P' . $days_until_due . 'D' ) )->format( $format );
637
+			if ($transaction_created instanceof DateTime) {
638
+				$date_due = $transaction_created->add(new DateInterval('P'.$days_until_due.'D'))->format($format);
639 639
 			} else {
640 640
 				throw new Exception();
641 641
 			}
642
-		} catch( Exception $e ) {
642
+		} catch (Exception $e) {
643 643
 			//format was likely invalid.
644 644
 			$date_due = 'Unable to calculate date due, likely the format string is invalid.';
645 645
 		}
646 646
 
647
-		return $prefix_text . $date_due;
647
+		return $prefix_text.$date_due;
648 648
 	}
649 649
 
650 650
 } //end EE_Transaction Shortcodes library
Please login to merge, or discard this patch.
admin/extend/registration_form/Extend_Registration_Form_Admin_Page.core.php 2 patches
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -245,13 +245,13 @@  discard block
 block discarded – undo
245 245
 					'persistent' => FALSE
246 246
 					),
247 247
 				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
248
-                'help_tabs' => array(
248
+				'help_tabs' => array(
249 249
 					'registration_form_add_question_help_tab' => array(
250 250
 						'title' => esc_html__('Add Question', 'event_espresso'),
251 251
 						'filename' => 'registration_form_add_question'
252 252
 						),
253 253
 					),
254
-                'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'),
254
+				'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'),
255 255
 				'require_nonce' => FALSE
256 256
 				),
257 257
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 						'filename' => 'registration_form_add_question_group'
269 269
 						),
270 270
 					),
271
-                'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'),
271
+				'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'),
272 272
 				'require_nonce' => FALSE
273 273
 				),
274 274
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 						'filename' => 'registration_form_edit_question_group'
287 287
 						),
288 288
 					),
289
-                'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'),
289
+				'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'),
290 290
 				'require_nonce' => FALSE
291 291
 				),
292 292
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 						'filename' => 'registration_form_reg_form_settings'
306 306
 						),
307 307
 					),
308
-                'help_tour' => array( 'Registration_Form_Settings_Help_Tour'),
308
+				'help_tour' => array( 'Registration_Form_Settings_Help_Tour'),
309 309
 				'require_nonce' => FALSE
310 310
 				)
311 311
 
@@ -430,11 +430,11 @@  discard block
 block discarded – undo
430 430
 
431 431
 	protected function _questions_overview_list_table() {
432 432
 		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
433
-		    'add_question',
434
-            'add_question',
435
-            array(),
436
-            'add-new-h2'
437
-        );
433
+			'add_question',
434
+			'add_question',
435
+			array(),
436
+			'add-new-h2'
437
+		);
438 438
 		parent::_questions_overview_list_table();
439 439
 	}
440 440
 
@@ -443,11 +443,11 @@  discard block
 block discarded – undo
443 443
 	protected function _question_groups_overview_list_table() {
444 444
 		$this->_search_btn_label = esc_html__('Question Groups', 'event_espresso');
445 445
 		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
446
-		    'add_question_group',
447
-            'add_question_group',
448
-            array(),
449
-            'add-new-h2'
450
-        );
446
+			'add_question_group',
447
+			'add_question_group',
448
+			array(),
449
+			'add-new-h2'
450
+		);
451 451
 		$this->display_admin_list_table_page_with_sidebar();
452 452
 	}
453 453
 
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
 	 * @return EE_Form_Section_Proper
944 944
 	 */
945 945
 	protected function _email_validation_settings_form() {
946
-        return new EE_Form_Section_Proper(
946
+		return new EE_Form_Section_Proper(
947 947
 			array(
948 948
 				'name'            => 'email_validation_settings',
949 949
 				'html_id'         => 'email_validation_settings',
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
 						),
962 962
 						array(
963 963
 							'html_label_text' => esc_html__( 'Email Validation Level', 'event_espresso' )
964
-							                     . EEH_Template::get_help_tab_link( 'email_validation_info' ),
964
+												 . EEH_Template::get_help_tab_link( 'email_validation_info' ),
965 965
 							'html_help_text'  => esc_html__( 'These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'),
966 966
 							'default' => isset( EE_Registry::instance()->CFG->registration->email_validation_level )
967 967
 								? EE_Registry::instance()->CFG->registration->email_validation_level
@@ -983,8 +983,8 @@  discard block
 block discarded – undo
983 983
 	 * @return \EE_Registration_Config
984 984
 	 */
985 985
 	public function update_email_validation_settings_form( EE_Registration_Config $EE_Registration_Config ) {
986
-        $prev_email_validation_level = $EE_Registration_Config->email_validation_level;
987
-        try {
986
+		$prev_email_validation_level = $EE_Registration_Config->email_validation_level;
987
+		try {
988 988
 			$email_validation_settings_form = $this->_email_validation_settings_form();
989 989
 			// if not displaying a form, then check for form submission
990 990
 			if ( $email_validation_settings_form->was_submitted() ) {
@@ -995,38 +995,38 @@  discard block
 block discarded – undo
995 995
 					// grab validated data from form
996 996
 					$valid_data = $email_validation_settings_form->valid_data();
997 997
 					if ( isset( $valid_data['email_validation_level'] ) ) {
998
-					    $email_validation_level = $valid_data['email_validation_level'];
999
-                        // now if they want to use international email addresses
1000
-                        if ( $email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns' ) {
1001
-                            // in case we need to reset their email validation level,
1002
-                            // make sure that the previous value wasn't already set to one of the i18n options.
1003
-                            if ( $prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns' ) {
1004
-                                // if so, then reset it back to "basic" since that is the only other option that,
1005
-                                // despite offering poor validation, supports i18n email addresses
1006
-                                $prev_email_validation_level = 'basic';
1007
-                            }
1008
-                            // confirm our i18n email validation will work on the server
1009
-                            if ( ! $this->_verify_pcre_support($EE_Registration_Config, $email_validation_level)) {
1010
-                                // or reset email validation level to previous value
1011
-                                $email_validation_level = $prev_email_validation_level;
1012
-                            }
1013
-                        }
1014
-                        $EE_Registration_Config->email_validation_level = $email_validation_level;
1015
-                    } else {
998
+						$email_validation_level = $valid_data['email_validation_level'];
999
+						// now if they want to use international email addresses
1000
+						if ( $email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns' ) {
1001
+							// in case we need to reset their email validation level,
1002
+							// make sure that the previous value wasn't already set to one of the i18n options.
1003
+							if ( $prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns' ) {
1004
+								// if so, then reset it back to "basic" since that is the only other option that,
1005
+								// despite offering poor validation, supports i18n email addresses
1006
+								$prev_email_validation_level = 'basic';
1007
+							}
1008
+							// confirm our i18n email validation will work on the server
1009
+							if ( ! $this->_verify_pcre_support($EE_Registration_Config, $email_validation_level)) {
1010
+								// or reset email validation level to previous value
1011
+								$email_validation_level = $prev_email_validation_level;
1012
+							}
1013
+						}
1014
+						$EE_Registration_Config->email_validation_level = $email_validation_level;
1015
+					} else {
1016 1016
 						EE_Error::add_error(
1017 1017
 							esc_html__(
1018 1018
 								'Invalid or missing Email Validation settings. Please refresh the form and try again.',
1019 1019
 								'event_espresso'
1020 1020
 							),
1021
-                            __FILE__, __FUNCTION__, __LINE__
1022
-                        );
1021
+							__FILE__, __FUNCTION__, __LINE__
1022
+						);
1023 1023
 					}
1024 1024
 				} else {
1025 1025
 					if ( $email_validation_settings_form->submission_error_message() !== '' ) {
1026 1026
 						EE_Error::add_error(
1027 1027
 							$email_validation_settings_form->submission_error_message(),
1028
-                            __FILE__, __FUNCTION__, __LINE__
1029
-                        );
1028
+							__FILE__, __FUNCTION__, __LINE__
1029
+						);
1030 1030
 					}
1031 1031
 				}
1032 1032
 			}
@@ -1038,61 +1038,61 @@  discard block
 block discarded – undo
1038 1038
 
1039 1039
 
1040 1040
 
1041
-    /**
1042
-     * confirms that the server's PHP version has the PCRE module enabled,
1043
-     * and that the PCRE version works with our i18n email validation
1044
-     *
1045
-     * @param \EE_Registration_Config $EE_Registration_Config
1046
-     * @param string                  $email_validation_level
1047
-     * @return bool
1048
-     */
1049
-    private function _verify_pcre_support(EE_Registration_Config $EE_Registration_Config, $email_validation_level)
1050
-    {
1051
-        // first check that PCRE is enabled
1052
-        if ( ! defined('PREG_BAD_UTF8_ERROR')) {
1053
-            EE_Error::add_error(
1054
-                sprintf(
1055
-                    esc_html__(
1056
-                        'We\'re sorry, but it appears that your server\'s version of PHP was not compiled with PCRE unicode support.%1$sPlease contact your hosting company and ask them whether the PCRE compiled with your version of PHP on your server can be been built with the "--enable-unicode-properties" and "--enable-utf8" configuration switches to enable more complex regex expressions.%1$sIf they are unable, or unwilling to do so, then your server will not support international email addresses using UTF-8 unicode characters. This means you will either have to lower your email validation level to "Basic" or "WordPress Default", or switch to a hosting company that has/can enable PCRE unicode support on the server.',
1057
-                        'event_espresso'
1058
-                    ),
1059
-                    '<br />'
1060
-                ),
1061
-                __FILE__,
1062
-                __FUNCTION__,
1063
-                __LINE__
1064
-            );
1065
-            return false;
1066
-        } else {
1067
-            // PCRE support is enabled, but let's still
1068
-            // perform a test to see if the server will support it.
1069
-            // but first, save the updated validation level to the config,
1070
-            // so that the validation strategy picks it up.
1071
-            // this will get bumped back down if it doesn't work
1072
-            $EE_Registration_Config->email_validation_level = $email_validation_level;
1073
-            try {
1074
-                $email_validator = new EE_Email_Validation_Strategy();
1075
-                $i18n_email_address = apply_filters(
1076
-                    'FHEE__Extend_Registration_Form_Admin_Page__update_email_validation_settings_form__i18n_email_address',
1077
-                    'jägerjü[email protected]'
1078
-                );
1079
-                $email_validator->validate($i18n_email_address);
1080
-            } catch (Exception $e) {
1081
-                EE_Error::add_error(
1082
-                    sprintf(
1083
-                        esc_html__(
1084
-                            'We\'re sorry, but it appears that your server\'s configuration will not support the "International" or "International + DNS Check" email validation levels.%1$sTo correct this issue, please consult with your hosting company regarding your server\'s PCRE settings.%1$sIt is recommended that your PHP version be configured to use PCRE 8.10 or newer.%1$sMore information regarding PCRE versions and installation can be found here: %2$s',
1085
-                            'event_espresso'
1086
-                        ),
1087
-                        '<br />',
1088
-                        '<a href="http://php.net/manual/en/pcre.installation.php" target="_blank">http://php.net/manual/en/pcre.installation.php</a>'
1089
-                    ),
1090
-                    __FILE__, __FUNCTION__, __LINE__
1091
-                );
1092
-                return false;
1093
-            }
1094
-        }
1095
-        return true;
1096
-    }
1041
+	/**
1042
+	 * confirms that the server's PHP version has the PCRE module enabled,
1043
+	 * and that the PCRE version works with our i18n email validation
1044
+	 *
1045
+	 * @param \EE_Registration_Config $EE_Registration_Config
1046
+	 * @param string                  $email_validation_level
1047
+	 * @return bool
1048
+	 */
1049
+	private function _verify_pcre_support(EE_Registration_Config $EE_Registration_Config, $email_validation_level)
1050
+	{
1051
+		// first check that PCRE is enabled
1052
+		if ( ! defined('PREG_BAD_UTF8_ERROR')) {
1053
+			EE_Error::add_error(
1054
+				sprintf(
1055
+					esc_html__(
1056
+						'We\'re sorry, but it appears that your server\'s version of PHP was not compiled with PCRE unicode support.%1$sPlease contact your hosting company and ask them whether the PCRE compiled with your version of PHP on your server can be been built with the "--enable-unicode-properties" and "--enable-utf8" configuration switches to enable more complex regex expressions.%1$sIf they are unable, or unwilling to do so, then your server will not support international email addresses using UTF-8 unicode characters. This means you will either have to lower your email validation level to "Basic" or "WordPress Default", or switch to a hosting company that has/can enable PCRE unicode support on the server.',
1057
+						'event_espresso'
1058
+					),
1059
+					'<br />'
1060
+				),
1061
+				__FILE__,
1062
+				__FUNCTION__,
1063
+				__LINE__
1064
+			);
1065
+			return false;
1066
+		} else {
1067
+			// PCRE support is enabled, but let's still
1068
+			// perform a test to see if the server will support it.
1069
+			// but first, save the updated validation level to the config,
1070
+			// so that the validation strategy picks it up.
1071
+			// this will get bumped back down if it doesn't work
1072
+			$EE_Registration_Config->email_validation_level = $email_validation_level;
1073
+			try {
1074
+				$email_validator = new EE_Email_Validation_Strategy();
1075
+				$i18n_email_address = apply_filters(
1076
+					'FHEE__Extend_Registration_Form_Admin_Page__update_email_validation_settings_form__i18n_email_address',
1077
+					'jägerjü[email protected]'
1078
+				);
1079
+				$email_validator->validate($i18n_email_address);
1080
+			} catch (Exception $e) {
1081
+				EE_Error::add_error(
1082
+					sprintf(
1083
+						esc_html__(
1084
+							'We\'re sorry, but it appears that your server\'s configuration will not support the "International" or "International + DNS Check" email validation levels.%1$sTo correct this issue, please consult with your hosting company regarding your server\'s PCRE settings.%1$sIt is recommended that your PHP version be configured to use PCRE 8.10 or newer.%1$sMore information regarding PCRE versions and installation can be found here: %2$s',
1085
+							'event_espresso'
1086
+						),
1087
+						'<br />',
1088
+						'<a href="http://php.net/manual/en/pcre.installation.php" target="_blank">http://php.net/manual/en/pcre.installation.php</a>'
1089
+					),
1090
+					__FILE__, __FUNCTION__, __LINE__
1091
+				);
1092
+				return false;
1093
+			}
1094
+		}
1095
+		return true;
1096
+	}
1097 1097
 
1098 1098
 }
Please login to merge, or discard this patch.
Spacing   +189 added lines, -189 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
 /**
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 	 * 		@param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
37 37
 	 * 		@access public
38 38
 	 */
39
-	public function __construct( $routing = TRUE ) {
40
-		define( 'REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND . 'registration_form' . DS );
41
-		define( 'REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN . 'assets' . DS );
42
-		define( 'REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/assets/' );
43
-		define( 'REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN . 'templates' . DS );
44
-		define( 'REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/templates/' );
45
-		parent::__construct( $routing );
39
+	public function __construct($routing = TRUE) {
40
+		define('REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND.'registration_form'.DS);
41
+		define('REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN.'assets'.DS);
42
+		define('REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/assets/');
43
+		define('REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN.'templates'.DS);
44
+		define('REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/templates/');
45
+		parent::__construct($routing);
46 46
 	}
47 47
 
48 48
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 
53 53
 	protected function _extend_page_config() {
54 54
 		$this->_admin_base_path = REGISTRATION_FORM_CAF_ADMIN;
55
-		$qst_id = ! empty( $this->_req_data['QST_ID'] ) && ! is_array( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0;
56
-		$qsg_id = ! empty( $this->_req_data['QSG_ID'] ) && ! is_array( $this->_req_data['QSG_ID'] ) ? $this->_req_data['QSG_ID'] : 0;
55
+		$qst_id = ! empty($this->_req_data['QST_ID']) && ! is_array($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0;
56
+		$qsg_id = ! empty($this->_req_data['QSG_ID']) && ! is_array($this->_req_data['QSG_ID']) ? $this->_req_data['QSG_ID'] : 0;
57 57
 
58 58
 		$new_page_routes = array(
59 59
 			'question_groups' => array(
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 				'func' => '_trash_or_restore_questions',
87 87
 				'capability' => 'ee_delete_question',
88 88
 				'obj_id' => $qst_id,
89
-				'args' => array( 'trash' => FALSE ),
89
+				'args' => array('trash' => FALSE),
90 90
 				'noheader' => TRUE
91 91
 				),
92 92
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
 			'trash_question_group' => array(
147 147
 				'func' => '_trash_or_restore_question_groups',
148
-				'args' => array( 'trash' => TRUE ),
148
+				'args' => array('trash' => TRUE),
149 149
 				'capability' => 'ee_delete_question_group',
150 150
 				'obj_id' => $qsg_id,
151 151
 				'noheader' => TRUE
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
 			'restore_question_group' => array(
155 155
 				'func' => '_trash_or_restore_question_groups',
156
-				'args' => array( 'trash' => FALSE ),
156
+				'args' => array('trash' => FALSE),
157 157
 				'capability' => 'ee_delete_question_group',
158 158
 				'obj_id' => $qsg_id,
159 159
 				'noheader' => TRUE
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
 			'update_question_group' => array(
170 170
 				'func' => '_insert_or_update_question_group',
171
-				'args' => array('new_question_group' => FALSE ),
171
+				'args' => array('new_question_group' => FALSE),
172 172
 				'capability' => 'ee_edit_question_group',
173 173
 				'obj_id' => $qsg_id,
174 174
 				'noheader' => TRUE,
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 					'noheader' => TRUE
207 207
 				),
208 208
 			);
209
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
209
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
210 210
 
211 211
 		$new_page_config = array(
212 212
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 						'filename' => 'registration_form_question_groups_views_bulk_actions_search'
231 231
 						),
232 232
 					),
233
-				'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'),
233
+				'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'),
234 234
 				'metaboxes' => $this->_default_espresso_metaboxes,
235 235
 				'require_nonce' => FALSE,
236 236
 				'qtips' => array(
@@ -244,14 +244,14 @@  discard block
 block discarded – undo
244 244
 					'order' => 5,
245 245
 					'persistent' => FALSE
246 246
 					),
247
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
247
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
248 248
                 'help_tabs' => array(
249 249
 					'registration_form_add_question_help_tab' => array(
250 250
 						'title' => esc_html__('Add Question', 'event_espresso'),
251 251
 						'filename' => 'registration_form_add_question'
252 252
 						),
253 253
 					),
254
-                'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'),
254
+                'help_tour' => array('Registration_Form_Add_Question_Help_Tour'),
255 255
 				'require_nonce' => FALSE
256 256
 				),
257 257
 
@@ -261,14 +261,14 @@  discard block
 block discarded – undo
261 261
 					'order' => 5,
262 262
 					'persistent' => FALSE
263 263
 					),
264
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
264
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
265 265
 				'help_tabs' => array(
266 266
 					'registration_form_add_question_group_help_tab' => array(
267 267
 						'title' => esc_html__('Add Question Group', 'event_espresso'),
268 268
 						'filename' => 'registration_form_add_question_group'
269 269
 						),
270 270
 					),
271
-                'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'),
271
+                'help_tour' => array('Registration_Form_Add_Question_Group_Help_Tour'),
272 272
 				'require_nonce' => FALSE
273 273
 				),
274 274
 
@@ -277,16 +277,16 @@  discard block
 block discarded – undo
277 277
 					'label' => esc_html__('Edit Question Group', 'event_espresso'),
278 278
 					'order' => 5,
279 279
 					'persistent' => FALSE,
280
-					'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id'] ), $this->_current_page_view_url )  : $this->_admin_base_url
280
+					'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id']), $this->_current_page_view_url) : $this->_admin_base_url
281 281
 					),
282
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
282
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
283 283
 				'help_tabs' => array(
284 284
 					'registration_form_edit_question_group_help_tab' => array(
285 285
 						'title' => esc_html__('Edit Question Group', 'event_espresso'),
286 286
 						'filename' => 'registration_form_edit_question_group'
287 287
 						),
288 288
 					),
289
-                'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'),
289
+                'help_tour' => array('Registration_Form_Edit_Question_Group_Help_Tour'),
290 290
 				'require_nonce' => FALSE
291 291
 				),
292 292
 
@@ -298,19 +298,19 @@  discard block
 block discarded – undo
298 298
 				'labels' => array(
299 299
 					'publishbox' => esc_html__('Update Settings', 'event_espresso')
300 300
 					),
301
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
301
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
302 302
 				'help_tabs' => array(
303 303
 					'registration_form_reg_form_settings_help_tab' => array(
304 304
 						'title' => esc_html__('Registration Form Settings', 'event_espresso'),
305 305
 						'filename' => 'registration_form_reg_form_settings'
306 306
 						),
307 307
 					),
308
-                'help_tour' => array( 'Registration_Form_Settings_Help_Tour'),
308
+                'help_tour' => array('Registration_Form_Settings_Help_Tour'),
309 309
 				'require_nonce' => FALSE
310 310
 				)
311 311
 
312 312
 			);
313
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
313
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
314 314
 
315 315
 		//change the list table we're going to use so it's the NEW list table!
316 316
 		$this->_page_config['default']['list_table'] = 'Extend_Registration_Form_Questions_Admin_List_Table';
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 			'edit_question_group' => esc_html__('Edit Question Group', 'event_espresso'),
325 325
 			'delete_question_group' => esc_html__('Delete Question Group', 'event_espresso'),
326 326
 			);
327
-		$this->_labels['buttons'] = array_merge( $this->_labels['buttons'], $new_labels );
327
+		$this->_labels['buttons'] = array_merge($this->_labels['buttons'], $new_labels);
328 328
 
329 329
 	}
330 330
 
@@ -333,14 +333,14 @@  discard block
 block discarded – undo
333 333
 
334 334
 
335 335
 	protected function _ajax_hooks() {
336
-		add_action('wp_ajax_espresso_update_question_group_order', array( $this, 'update_question_group_order' ));
336
+		add_action('wp_ajax_espresso_update_question_group_order', array($this, 'update_question_group_order'));
337 337
 	}
338 338
 
339 339
 
340 340
 
341 341
 
342 342
 	public function load_scripts_styles_question_groups() {
343
-		wp_enqueue_script( 'espresso_ajax_table_sorting' );
343
+		wp_enqueue_script('espresso_ajax_table_sorting');
344 344
 	}
345 345
 
346 346
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 	 * @return void
362 362
 	 */
363 363
 	public function load_sortable_question_script() {
364
-		wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL . 'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true);
364
+		wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL.'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true);
365 365
 		wp_enqueue_script('ee-question-sortable');
366 366
 	}
367 367
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 				)
381 381
 		);
382 382
 
383
-		if ( EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) {
383
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) {
384 384
 			$this->_views['trash'] = array(
385 385
 				'slug' => 'trash',
386 386
 				'label' => esc_html__('Trash', 'event_espresso'),
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 				)
411 411
 		);
412 412
 
413
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_groups' ) ) {
413
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_groups')) {
414 414
 			$this->_views['trash'] = array(
415 415
 				'slug' => 'trash',
416 416
 				'label' => esc_html__('Trash', 'event_espresso'),
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 
430 430
 
431 431
 	protected function _questions_overview_list_table() {
432
-		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
432
+		$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
433 433
 		    'add_question',
434 434
             'add_question',
435 435
             array(),
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 
443 443
 	protected function _question_groups_overview_list_table() {
444 444
 		$this->_search_btn_label = esc_html__('Question Groups', 'event_espresso');
445
-		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
445
+		$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
446 446
 		    'add_question_group',
447 447
             'add_question_group',
448 448
             array(),
@@ -456,24 +456,24 @@  discard block
 block discarded – undo
456 456
 
457 457
 
458 458
 
459
-	protected function _delete_question(){
460
-		$success = $this->_delete_items( $this->_question_model );
459
+	protected function _delete_question() {
460
+		$success = $this->_delete_items($this->_question_model);
461 461
 		$this->_redirect_after_action(
462 462
 			$success,
463
-			$this->_question_model->item_name( $success ),
463
+			$this->_question_model->item_name($success),
464 464
 			'deleted',
465
-			array( 'action' => 'default', 'status' => 'all' )
465
+			array('action' => 'default', 'status' => 'all')
466 466
 		);
467 467
 	}
468 468
 
469 469
 
470 470
 	protected function _delete_questions() {
471
-		$success = $this->_delete_items( $this->_question_model );
471
+		$success = $this->_delete_items($this->_question_model);
472 472
 		$this->_redirect_after_action(
473 473
 			$success,
474
-			$this->_question_model->item_name( $success ),
474
+			$this->_question_model->item_name($success),
475 475
 			'deleted permanently',
476
-			array( 'action' => 'default', 'status' => 'trash' )
476
+			array('action' => 'default', 'status' => 'trash')
477 477
 		);
478 478
 	}
479 479
 
@@ -484,26 +484,26 @@  discard block
 block discarded – undo
484 484
  * @param EEM_Soft_Delete_Base $model
485 485
  * @return int number of items deleted permanently
486 486
  */
487
-	private function _delete_items(EEM_Soft_Delete_Base $model){
487
+	private function _delete_items(EEM_Soft_Delete_Base $model) {
488 488
 		$success = 0;
489
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
490
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
489
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
490
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
491 491
 			// if array has more than one element than success message should be plural
492
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
492
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
493 493
 			// cycle thru bulk action checkboxes
494
-			while (list( $ID, $value ) = each($this->_req_data['checkbox'])) {
495
-				if ( ! $this->_delete_item( $ID, $model ) ) {
494
+			while (list($ID, $value) = each($this->_req_data['checkbox'])) {
495
+				if ( ! $this->_delete_item($ID, $model)) {
496 496
 					$success = 0;
497 497
 				}
498 498
 			}
499 499
 
500
-		}elseif( !empty($this->_req_data['QSG_ID'])){
501
-			$success = $this->_delete_item( $this->_req_data['QSG_ID'], $model );
500
+		}elseif ( ! empty($this->_req_data['QSG_ID'])) {
501
+			$success = $this->_delete_item($this->_req_data['QSG_ID'], $model);
502 502
 
503
-		}elseif( !empty($this->_req_data['QST_ID'])){
504
-			$success = $this->_delete_item( $this->_req_data['QST_ID'], $model );
505
-		}else{
506
-			EE_Error::add_error( sprintf(esc_html__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__ );
503
+		}elseif ( ! empty($this->_req_data['QST_ID'])) {
504
+			$success = $this->_delete_item($this->_req_data['QST_ID'], $model);
505
+		} else {
506
+			EE_Error::add_error(sprintf(esc_html__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__);
507 507
 		}
508 508
 		return $success;
509 509
 	}
@@ -514,11 +514,11 @@  discard block
 block discarded – undo
514 514
 	 * @param EEM_Soft_Delete_Base $model
515 515
 	 * @return boolean
516 516
 	 */
517
-	protected function _delete_item( $id, $model ) {
518
-		if( $model instanceof EEM_Question ) {
519
-			EEM_Question_Option::instance()->delete_permanently( array( array( 'QST_ID' => absint( $id ) ) ) );
517
+	protected function _delete_item($id, $model) {
518
+		if ($model instanceof EEM_Question) {
519
+			EEM_Question_Option::instance()->delete_permanently(array(array('QST_ID' => absint($id))));
520 520
 		}
521
-		return $model->delete_permanently_by_ID( absint( $id ) );
521
+		return $model->delete_permanently_by_ID(absint($id));
522 522
 	}
523 523
 
524 524
 
@@ -530,41 +530,41 @@  discard block
 block discarded – undo
530 530
 
531 531
 
532 532
 
533
-	protected function _edit_question_group( $type = 'add' ) {
534
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
535
-		$ID=isset( $this->_req_data['QSG_ID'] ) && ! empty( $this->_req_data['QSG_ID'] ) ? absint( $this->_req_data['QSG_ID'] ) : FALSE;
533
+	protected function _edit_question_group($type = 'add') {
534
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
535
+		$ID = isset($this->_req_data['QSG_ID']) && ! empty($this->_req_data['QSG_ID']) ? absint($this->_req_data['QSG_ID']) : FALSE;
536 536
 
537
-		switch( $this->_req_action ) {
537
+		switch ($this->_req_action) {
538 538
 			case 'add_question_group' :
539
-				$this->_admin_page_title = esc_html__( 'Add Question Group', 'event_espresso' );
539
+				$this->_admin_page_title = esc_html__('Add Question Group', 'event_espresso');
540 540
 				break;
541 541
 			case 'edit_question_group' :
542
-				$this->_admin_page_title = esc_html__( 'Edit Question Group', 'event_espresso' );
542
+				$this->_admin_page_title = esc_html__('Edit Question Group', 'event_espresso');
543 543
 				break;
544 544
 			default :
545
-				$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
545
+				$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
546 546
 		}
547 547
 		// add ID to title if editing
548
-		$this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;
549
-		if($ID){
548
+		$this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title;
549
+		if ($ID) {
550 550
 			/** @var EE_Question_Group $questionGroup */
551
-			$questionGroup=$this->_question_group_model->get_one_by_ID( $ID);
552
-			$additional_hidden_fields=array('QSG_ID'=>array('type'=>'hidden','value'=>$ID));
551
+			$questionGroup = $this->_question_group_model->get_one_by_ID($ID);
552
+			$additional_hidden_fields = array('QSG_ID'=>array('type'=>'hidden', 'value'=>$ID));
553 553
 			$this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields);
554
-		}else{
554
+		} else {
555 555
 			/** @var EE_Question_Group $questionGroup */
556 556
 			$questionGroup = EEM_Question_Group::instance()->create_default_object();
557 557
 			$questionGroup->set_order_to_latest();
558 558
 			$this->_set_add_edit_form_tags('insert_question_group');
559 559
 		}
560 560
 		$this->_template_args['values'] = $this->_yes_no_values;
561
-		$this->_template_args['all_questions']=$questionGroup->questions_in_and_not_in_group();
562
-		$this->_template_args['QSG_ID']=$ID ? $ID : TRUE;
563
-		$this->_template_args['question_group']=$questionGroup;
561
+		$this->_template_args['all_questions'] = $questionGroup->questions_in_and_not_in_group();
562
+		$this->_template_args['QSG_ID'] = $ID ? $ID : TRUE;
563
+		$this->_template_args['question_group'] = $questionGroup;
564 564
 
565
-		$redirect_URL = add_query_arg( array( 'action' => 'question_groups'), $this->_admin_base_url );
566
-		$this->_set_publish_post_box_vars( 'id', $ID, FALSE, $redirect_URL  );
567
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'question_groups_main_meta_box.template.php', $this->_template_args, TRUE );
565
+		$redirect_URL = add_query_arg(array('action' => 'question_groups'), $this->_admin_base_url);
566
+		$this->_set_publish_post_box_vars('id', $ID, FALSE, $redirect_URL);
567
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_CAF_TEMPLATE_PATH.'question_groups_main_meta_box.template.php', $this->_template_args, TRUE);
568 568
 
569 569
 		// the details template wrapper
570 570
 		$this->display_admin_page_with_sidebar();
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 
576 576
 	protected function _delete_question_groups() {
577 577
 		$success = $this->_delete_items($this->_question_group_model);
578
-		$this->_redirect_after_action( $success, $this->_question_group_model->item_name($success), 'deleted permanently', array( 'action'=>'question_groups', 'status'=>'trash' ));
578
+		$this->_redirect_after_action($success, $this->_question_group_model->item_name($success), 'deleted permanently', array('action'=>'question_groups', 'status'=>'trash'));
579 579
 	}
580 580
 
581 581
 
@@ -583,71 +583,71 @@  discard block
 block discarded – undo
583 583
 	/**
584 584
 	 * @param bool $new_question_group
585 585
 	 */
586
-	protected function _insert_or_update_question_group( $new_question_group = TRUE) {
587
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
588
-		$set_column_values=$this->_set_column_values_for($this->_question_group_model);
589
-		if ( $new_question_group ){
586
+	protected function _insert_or_update_question_group($new_question_group = TRUE) {
587
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
588
+		$set_column_values = $this->_set_column_values_for($this->_question_group_model);
589
+		if ($new_question_group) {
590 590
 			$QSG_ID = $this->_question_group_model->insert($set_column_values);
591 591
 			$success = $QSG_ID ? 1 : 0;
592 592
 		} else {
593 593
 			$QSG_ID = absint($this->_req_data['QSG_ID']);
594
-			unset( $set_column_values[ 'QSG_ID' ] );
595
-			$success= $this->_question_group_model->update( $set_column_values, array( array( 'QSG_ID' => $QSG_ID )));
594
+			unset($set_column_values['QSG_ID']);
595
+			$success = $this->_question_group_model->update($set_column_values, array(array('QSG_ID' => $QSG_ID)));
596 596
 		}
597
-		$phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string( EEM_Attendee::system_question_phone );
597
+		$phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string(EEM_Attendee::system_question_phone);
598 598
 		// update the existing related questions
599 599
 		// BUT FIRST...  delete the phone question from the Question_Group_Question if it is being added to this question group (therefore removed from the existing group)
600
-		if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $phone_question_id ] )) {
600
+		if (isset($this->_req_data['questions'], $this->_req_data['questions'][$phone_question_id])) {
601 601
 			// delete where QST ID = system phone question ID and Question Group ID is NOT this group
602
-			EEM_Question_Group_Question::instance()->delete( array( array( 'QST_ID' => $phone_question_id, 'QSG_ID' => array( '!=', $QSG_ID ))));
602
+			EEM_Question_Group_Question::instance()->delete(array(array('QST_ID' => $phone_question_id, 'QSG_ID' => array('!=', $QSG_ID))));
603 603
 		}
604 604
 		/** @type EE_Question_Group $question_group */
605
-		$question_group=$this->_question_group_model->get_one_by_ID( $QSG_ID );
605
+		$question_group = $this->_question_group_model->get_one_by_ID($QSG_ID);
606 606
 		$questions = $question_group->questions();
607 607
 		// make sure system phone question is added to list of questions for this group
608
-		if ( ! isset( $questions[$phone_question_id ] )) {
609
-			$questions[ $phone_question_id ] = EEM_Question::instance()->get_one_by_ID( $phone_question_id );
608
+		if ( ! isset($questions[$phone_question_id])) {
609
+			$questions[$phone_question_id] = EEM_Question::instance()->get_one_by_ID($phone_question_id);
610 610
 		}
611 611
 
612
-		foreach( $questions as $question_ID => $question ){
612
+		foreach ($questions as $question_ID => $question) {
613 613
 			// first we always check for order.
614
-			if ( ! empty( $this->_req_data['question_orders'][ $question_ID ] ) ){
614
+			if ( ! empty($this->_req_data['question_orders'][$question_ID])) {
615 615
 				//update question order
616
-				$question_group->update_question_order( $question_ID, $this->_req_data['question_orders'][ $question_ID ] );
616
+				$question_group->update_question_order($question_ID, $this->_req_data['question_orders'][$question_ID]);
617 617
 			}
618 618
 
619 619
 			// then we always check if adding or removing.
620
-			if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $question_ID ] )) {
621
-				$question_group->add_question( $question_ID );
620
+			if (isset($this->_req_data['questions'], $this->_req_data['questions'][$question_ID])) {
621
+				$question_group->add_question($question_ID);
622 622
 			} else {
623 623
 				// not found, remove it (but only if not a system question for the personal group with the exception of lname system question - we allow removal of it)
624 624
 				if (
625 625
 					in_array(
626 626
 						$question->system_ID(),
627
-						EEM_Question::instance()->required_system_questions_in_system_question_group( $question_group->system_group() )
627
+						EEM_Question::instance()->required_system_questions_in_system_question_group($question_group->system_group())
628 628
 					)
629 629
 				) {
630 630
 					continue;
631 631
 				} else {
632
-					$question_group->remove_question( $question_ID );
632
+					$question_group->remove_question($question_ID);
633 633
 				}
634 634
 			}
635 635
 		}
636 636
 		// save new related questions
637
-		if ( isset( $this->_req_data['questions'] )) {
638
-			foreach( $this->_req_data['questions'] as $QST_ID ){
639
-				$question_group->add_question( $QST_ID );
640
-				if ( isset( $this->_req_data['question_orders'][ $QST_ID ] )) {
641
-					$question_group->update_question_order( $QST_ID, $this->_req_data['question_orders'][ $QST_ID ] );
637
+		if (isset($this->_req_data['questions'])) {
638
+			foreach ($this->_req_data['questions'] as $QST_ID) {
639
+				$question_group->add_question($QST_ID);
640
+				if (isset($this->_req_data['question_orders'][$QST_ID])) {
641
+					$question_group->update_question_order($QST_ID, $this->_req_data['question_orders'][$QST_ID]);
642 642
 				}
643 643
 			}
644 644
 		}
645 645
 
646
-		if ( $success !== FALSE ) {
647
-			$msg = $new_question_group ? sprintf( esc_html__('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name() ) : sprintf( esc_html__('The %s has been updated', 'event_espresso' ), $this->_question_group_model->item_name() );
648
-			EE_Error::add_success( $msg );
646
+		if ($success !== FALSE) {
647
+			$msg = $new_question_group ? sprintf(esc_html__('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name()) : sprintf(esc_html__('The %s has been updated', 'event_espresso'), $this->_question_group_model->item_name());
648
+			EE_Error::add_success($msg);
649 649
 		}
650
-		$this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group','QSG_ID'=>$QSG_ID), TRUE);
650
+		$this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group', 'QSG_ID'=>$QSG_ID), TRUE);
651 651
 
652 652
 	}
653 653
 
@@ -655,20 +655,20 @@  discard block
 block discarded – undo
655 655
 	 * duplicates a question and all its question options and redirects to the new question.
656 656
 	 */
657 657
 	public function _duplicate_question() {
658
-		$question_ID = (int)$this->_req_data[ 'QST_ID' ];
659
-		$question = EEM_Question::instance()->get_one_by_ID( $question_ID );
660
-		if( $question instanceof EE_Question ) {
658
+		$question_ID = (int) $this->_req_data['QST_ID'];
659
+		$question = EEM_Question::instance()->get_one_by_ID($question_ID);
660
+		if ($question instanceof EE_Question) {
661 661
 			$new_question = $question->duplicate();
662
-			if( $new_question instanceof EE_Question ) {
663
-				$this->_redirect_after_action( true, esc_html__( 'Question', 'event_espresso' ), esc_html__( 'Duplicated', 'event_espresso' ), array('action'=>'edit_question', 'QST_ID' => $new_question->ID() ), TRUE);
662
+			if ($new_question instanceof EE_Question) {
663
+				$this->_redirect_after_action(true, esc_html__('Question', 'event_espresso'), esc_html__('Duplicated', 'event_espresso'), array('action'=>'edit_question', 'QST_ID' => $new_question->ID()), TRUE);
664 664
 			} else {
665 665
 				global $wpdb;
666
-				EE_Error::add_error( sprintf( esc_html__( 'Could not duplicate question with ID %1$d because: %2$s', 'event_espresso' ), $question_ID, $wpdb->last_error ), __FILE__, __FUNCTION__, __LINE__ );
667
-			$this->_redirect_after_action(false, '', '', array('action'=>'default'), false );
666
+				EE_Error::add_error(sprintf(esc_html__('Could not duplicate question with ID %1$d because: %2$s', 'event_espresso'), $question_ID, $wpdb->last_error), __FILE__, __FUNCTION__, __LINE__);
667
+			$this->_redirect_after_action(false, '', '', array('action'=>'default'), false);
668 668
 			}
669 669
 		} else {
670
-			EE_Error::add_error( sprintf( esc_html__( 'Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso' ), $question_ID ), __FILE__, __FUNCTION__, __LINE__ );
671
-			$this->_redirect_after_action( false, '', '', array( 'action' => 'default' ), false );
670
+			EE_Error::add_error(sprintf(esc_html__('Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso'), $question_ID), __FILE__, __FUNCTION__, __LINE__);
671
+			$this->_redirect_after_action(false, '', '', array('action' => 'default'), false);
672 672
 		}
673 673
 	}
674 674
 
@@ -677,8 +677,8 @@  discard block
 block discarded – undo
677 677
 	/**
678 678
 	 * @param bool $trash
679 679
 	 */
680
-	protected function _trash_or_restore_question_groups( $trash = TRUE) {
681
-		$this->_trash_or_restore_items( $this->_question_group_model, $trash );
680
+	protected function _trash_or_restore_question_groups($trash = TRUE) {
681
+		$this->_trash_or_restore_items($this->_question_group_model, $trash);
682 682
 	}
683 683
 
684 684
 
@@ -686,9 +686,9 @@  discard block
 block discarded – undo
686 686
 	/**
687 687
 	 *_trash_question
688 688
 	 */
689
-	protected function _trash_question(){
690
-		$success=$this->_question_model->delete_by_ID( (int)$this->_req_data['QST_ID'] );
691
-		$query_args=array('action'=>'default','status'=>'all');
689
+	protected function _trash_question() {
690
+		$success = $this->_question_model->delete_by_ID((int) $this->_req_data['QST_ID']);
691
+		$query_args = array('action'=>'default', 'status'=>'all');
692 692
 		$this->_redirect_after_action($success, $this->_question_model->item_name($success), 'trashed', $query_args);
693 693
 	}
694 694
 
@@ -697,8 +697,8 @@  discard block
 block discarded – undo
697 697
 	/**
698 698
 	 * @param bool $trash
699 699
 	 */
700
-	protected function _trash_or_restore_questions( $trash=TRUE){
701
-		$this->_trash_or_restore_items( $this->_question_model, $trash );
700
+	protected function _trash_or_restore_questions($trash = TRUE) {
701
+		$this->_trash_or_restore_items($this->_question_model, $trash);
702 702
 	}
703 703
 
704 704
 
@@ -710,21 +710,21 @@  discard block
 block discarded – undo
710 710
 *@param EEM_Soft_Delete_Base $model
711 711
 	 * @param boolean $trash whether to trash or restore
712 712
 	 */
713
-	private function _trash_or_restore_items( EEM_Soft_Delete_Base $model, $trash = TRUE ) {
713
+	private function _trash_or_restore_items(EEM_Soft_Delete_Base $model, $trash = TRUE) {
714 714
 
715
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
715
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
716 716
 
717 717
 		$success = 1;
718 718
 		//Checkboxes
719 719
 		//echo "trash $trash";
720 720
 		//var_dump($this->_req_data['checkbox']);die;
721
-		if ( isset( $this->_req_data['checkbox'] )) {
722
-			if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) {
721
+		if (isset($this->_req_data['checkbox'])) {
722
+			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
723 723
 				// if array has more than one element than success message should be plural
724
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
724
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
725 725
 				// cycle thru bulk action checkboxes
726
-				while (list( $ID, $value ) = each($this->_req_data['checkbox'])) {
727
-					if ( ! $model->delete_or_restore_by_ID($trash,absint($ID))) {
726
+				while (list($ID, $value) = each($this->_req_data['checkbox'])) {
727
+					if ( ! $model->delete_or_restore_by_ID($trash, absint($ID))) {
728 728
 						$success = 0;
729 729
 					}
730 730
 				}
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 			} else {
733 733
 				// grab single id and delete
734 734
 				$ID = absint($this->_req_data['checkbox']);
735
-				if ( ! $model->delete_or_restore_by_ID($trash,$ID)) {
735
+				if ( ! $model->delete_or_restore_by_ID($trash, $ID)) {
736 736
 					$success = 0;
737 737
 				}
738 738
 			}
@@ -740,25 +740,25 @@  discard block
 block discarded – undo
740 740
 		} else {
741 741
 			// delete via trash link
742 742
 			// grab single id and delete
743
-			$ID = absint($this->_req_data[ $model->primary_key_name() ]);
744
-			if ( ! $model->delete_or_restore_by_ID($trash,$ID)) {
743
+			$ID = absint($this->_req_data[$model->primary_key_name()]);
744
+			if ( ! $model->delete_or_restore_by_ID($trash, $ID)) {
745 745
 				$success = 0;
746 746
 			}
747 747
 
748 748
 		}
749 749
 
750 750
 
751
-		$action = $model instanceof EEM_Question ? 'default' : 'question_groups';//strtolower( $model->item_name(2) );
751
+		$action = $model instanceof EEM_Question ? 'default' : 'question_groups'; //strtolower( $model->item_name(2) );
752 752
 		//echo "action :$action";
753 753
 		//$action = 'questions' ? 'default' : $action;
754
-		if($trash){
754
+		if ($trash) {
755 755
 			$action_desc = 'trashed';
756 756
 			$status = 'trash';
757
-		}else{
757
+		} else {
758 758
 			$action_desc = 'restored';
759 759
 			$status = 'all';
760 760
 		}
761
-		$this->_redirect_after_action( $success, $model->item_name($success), $action_desc, array( 'action' => $action, 'status'=>$status ) );
761
+		$this->_redirect_after_action($success, $model->item_name($success), $action_desc, array('action' => $action, 'status'=>$status));
762 762
 	}
763 763
 
764 764
 
@@ -769,16 +769,16 @@  discard block
 block discarded – undo
769 769
 	 * @param bool|false $count
770 770
 	 * @return \EE_Soft_Delete_Base_Class[]|int
771 771
 	 */
772
-	public function get_trashed_questions( $per_page, $current_page = 1, $count = FALSE ) {
772
+	public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) {
773 773
 		$query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page);
774 774
 
775
-		if( $count ){
775
+		if ($count) {
776 776
 			//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
777
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
778
-			$results=$this->_question_model->count_deleted($where);
779
-		}else{
777
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
778
+			$results = $this->_question_model->count_deleted($where);
779
+		} else {
780 780
 			//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
781
-			$results=$this->_question_model->get_all_deleted($query_params);
781
+			$results = $this->_question_model->get_all_deleted($query_params);
782 782
 		}
783 783
 		return $results;
784 784
 	}
@@ -791,13 +791,13 @@  discard block
 block discarded – undo
791 791
 	 * @param bool|false $count
792 792
 	 * @return \EE_Soft_Delete_Base_Class[]
793 793
 	 */
794
-	public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) {
795
-		$questionGroupModel=EEM_Question_Group::instance();
796
-		$query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page);
797
-		if ($count){
798
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
794
+	public function get_question_groups($per_page, $current_page = 1, $count = FALSE) {
795
+		$questionGroupModel = EEM_Question_Group::instance();
796
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
797
+		if ($count) {
798
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
799 799
 			$results = $questionGroupModel->count($where);
800
-		}else{
800
+		} else {
801 801
 			$results = $questionGroupModel->get_all($query_params);
802 802
 		}
803 803
 		return $results;
@@ -811,14 +811,14 @@  discard block
 block discarded – undo
811 811
 	 * @param bool $count
812 812
 	 * @return \EE_Soft_Delete_Base_Class[]|int
813 813
 	 */
814
-	public function get_trashed_question_groups( $per_page, $current_page = 1, $count = FALSE ) {
815
-		$questionGroupModel=EEM_Question_Group::instance();
816
-		$query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page);
817
-		if($count){
818
-			$where = isset( $query_params[0] ) ? array($query_params[0]) : array();
814
+	public function get_trashed_question_groups($per_page, $current_page = 1, $count = FALSE) {
815
+		$questionGroupModel = EEM_Question_Group::instance();
816
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
817
+		if ($count) {
818
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
819 819
 			$query_params['limit'] = NULL;
820 820
 			$results = $questionGroupModel->count_deleted($where);
821
-		}else{
821
+		} else {
822 822
 			$results = $questionGroupModel->get_all_deleted($query_params);
823 823
 		}
824 824
 		return $results;
@@ -831,32 +831,32 @@  discard block
 block discarded – undo
831 831
 	 */
832 832
 	public function update_question_group_order() {
833 833
 
834
-		$success = esc_html__( 'Question group order was updated successfully.', 'event_espresso' );
834
+		$success = esc_html__('Question group order was updated successfully.', 'event_espresso');
835 835
 
836 836
 		// grab our row IDs
837
-		$row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] )
838
-			? explode( ',', rtrim( $this->_req_data['row_ids'], ',' ))
837
+		$row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids'])
838
+			? explode(',', rtrim($this->_req_data['row_ids'], ','))
839 839
 			: array();
840 840
 
841
-		$perpage = !empty( $this->_req_data['perpage'] )
841
+		$perpage = ! empty($this->_req_data['perpage'])
842 842
 			? (int) $this->_req_data['perpage']
843 843
 			: NULL;
844
-		$curpage = !empty( $this->_req_data['curpage'] )
844
+		$curpage = ! empty($this->_req_data['curpage'])
845 845
 			? (int) $this->_req_data['curpage']
846 846
 			: NULL;
847 847
 
848
-		if ( ! empty( $row_ids ) ) {
848
+		if ( ! empty($row_ids)) {
849 849
 			//figure out where we start the row_id count at for the current page.
850
-			$qsgcount = empty( $curpage ) ? 0 : ($curpage - 1 ) * $perpage;
850
+			$qsgcount = empty($curpage) ? 0 : ($curpage - 1) * $perpage;
851 851
 
852
-			$row_count = count( $row_ids );
853
-			for( $i = 0; $i < $row_count; $i++ ) {
852
+			$row_count = count($row_ids);
853
+			for ($i = 0; $i < $row_count; $i++) {
854 854
 				//Update the questions when re-ordering
855 855
 				$updated = EEM_Question_Group::instance()->update(
856
-					array( 'QSG_order' => $qsgcount ),
857
-					array( array( 'QSG_ID' => $row_ids[ $i ] ) )
856
+					array('QSG_order' => $qsgcount),
857
+					array(array('QSG_ID' => $row_ids[$i]))
858 858
 				);
859
-				if ( $updated === false ) {
859
+				if ($updated === false) {
860 860
 					$success = false;
861 861
 				}
862 862
 				$qsgcount++;
@@ -866,10 +866,10 @@  discard block
 block discarded – undo
866 866
 		}
867 867
 
868 868
 		$errors = ! $success
869
-			? esc_html__( 'An error occurred. The question group order was not updated.', 'event_espresso' )
869
+			? esc_html__('An error occurred. The question group order was not updated.', 'event_espresso')
870 870
 			: false;
871 871
 
872
-		echo json_encode( array( 'return_data' => false, 'success' => $success, 'errors' => $errors ));
872
+		echo json_encode(array('return_data' => false, 'success' => $success, 'errors' => $errors));
873 873
 		die();
874 874
 
875 875
 	}
@@ -888,17 +888,17 @@  discard block
 block discarded – undo
888 888
 		$this->_template_args['values'] = $this->_yes_no_values;
889 889
 		add_action(
890 890
 			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
891
-			array( $this, 'email_validation_settings_form' ),
891
+			array($this, 'email_validation_settings_form'),
892 892
 			2
893 893
 		);
894
-		$this->_template_args = (array)apply_filters(
894
+		$this->_template_args = (array) apply_filters(
895 895
 			'FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args',
896 896
 			$this->_template_args
897 897
 		);
898
-		$this->_set_add_edit_form_tags( 'update_reg_form_settings' );
899
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
898
+		$this->_set_add_edit_form_tags('update_reg_form_settings');
899
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
900 900
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
901
-			REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'reg_form_settings.template.php',
901
+			REGISTRATION_FORM_CAF_TEMPLATE_PATH.'reg_form_settings.template.php',
902 902
 			$this->_template_args,
903 903
 			TRUE
904 904
 		);
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 			EE_Registry::instance()->CFG,
920 920
 			__FILE__, __FUNCTION__, __LINE__
921 921
 		);
922
-		$this->_redirect_after_action( $success, esc_html__('Registration Form Options', 'event_espresso'), 'updated', array( 'action' => 'view_reg_form_settings' ) );
922
+		$this->_redirect_after_action($success, esc_html__('Registration Form Options', 'event_espresso'), 'updated', array('action' => 'view_reg_form_settings'));
923 923
 	}
924 924
 
925 925
 
@@ -950,20 +950,20 @@  discard block
 block discarded – undo
950 950
 				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
951 951
 				'subsections'     => array(
952 952
 					'email_validation_hdr'           => new EE_Form_Section_HTML(
953
-						EEH_HTML::h2( esc_html__( 'Email Validation Settings', 'event_espresso' ) )
953
+						EEH_HTML::h2(esc_html__('Email Validation Settings', 'event_espresso'))
954 954
 					),
955 955
 					'email_validation_level' => new EE_Select_Input(
956 956
 						array(
957
-							'basic'      => esc_html__( 'Basic', 'event_espresso' ),
958
-							'wp_default' => esc_html__( 'WordPress Default', 'event_espresso' ),
959
-							'i18n'       => esc_html__( 'International', 'event_espresso' ),
960
-							'i18n_dns'   => esc_html__( 'International + DNS Check', 'event_espresso' ),
957
+							'basic'      => esc_html__('Basic', 'event_espresso'),
958
+							'wp_default' => esc_html__('WordPress Default', 'event_espresso'),
959
+							'i18n'       => esc_html__('International', 'event_espresso'),
960
+							'i18n_dns'   => esc_html__('International + DNS Check', 'event_espresso'),
961 961
 						),
962 962
 						array(
963
-							'html_label_text' => esc_html__( 'Email Validation Level', 'event_espresso' )
964
-							                     . EEH_Template::get_help_tab_link( 'email_validation_info' ),
965
-							'html_help_text'  => esc_html__( 'These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'),
966
-							'default' => isset( EE_Registry::instance()->CFG->registration->email_validation_level )
963
+							'html_label_text' => esc_html__('Email Validation Level', 'event_espresso')
964
+							                     . EEH_Template::get_help_tab_link('email_validation_info'),
965
+							'html_help_text'  => esc_html__('These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'),
966
+							'default' => isset(EE_Registry::instance()->CFG->registration->email_validation_level)
967 967
 								? EE_Registry::instance()->CFG->registration->email_validation_level
968 968
 								: 'wp_default',
969 969
 							'required'        => false
@@ -982,25 +982,25 @@  discard block
 block discarded – undo
982 982
 	 * @param \EE_Registration_Config $EE_Registration_Config
983 983
 	 * @return \EE_Registration_Config
984 984
 	 */
985
-	public function update_email_validation_settings_form( EE_Registration_Config $EE_Registration_Config ) {
985
+	public function update_email_validation_settings_form(EE_Registration_Config $EE_Registration_Config) {
986 986
         $prev_email_validation_level = $EE_Registration_Config->email_validation_level;
987 987
         try {
988 988
 			$email_validation_settings_form = $this->_email_validation_settings_form();
989 989
 			// if not displaying a form, then check for form submission
990
-			if ( $email_validation_settings_form->was_submitted() ) {
990
+			if ($email_validation_settings_form->was_submitted()) {
991 991
 				// capture form data
992 992
 				$email_validation_settings_form->receive_form_submission();
993 993
 				// validate form data
994
-				if ( $email_validation_settings_form->is_valid() ) {
994
+				if ($email_validation_settings_form->is_valid()) {
995 995
 					// grab validated data from form
996 996
 					$valid_data = $email_validation_settings_form->valid_data();
997
-					if ( isset( $valid_data['email_validation_level'] ) ) {
997
+					if (isset($valid_data['email_validation_level'])) {
998 998
 					    $email_validation_level = $valid_data['email_validation_level'];
999 999
                         // now if they want to use international email addresses
1000
-                        if ( $email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns' ) {
1000
+                        if ($email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns') {
1001 1001
                             // in case we need to reset their email validation level,
1002 1002
                             // make sure that the previous value wasn't already set to one of the i18n options.
1003
-                            if ( $prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns' ) {
1003
+                            if ($prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns') {
1004 1004
                                 // if so, then reset it back to "basic" since that is the only other option that,
1005 1005
                                 // despite offering poor validation, supports i18n email addresses
1006 1006
                                 $prev_email_validation_level = 'basic';
@@ -1022,7 +1022,7 @@  discard block
 block discarded – undo
1022 1022
                         );
1023 1023
 					}
1024 1024
 				} else {
1025
-					if ( $email_validation_settings_form->submission_error_message() !== '' ) {
1025
+					if ($email_validation_settings_form->submission_error_message() !== '') {
1026 1026
 						EE_Error::add_error(
1027 1027
 							$email_validation_settings_form->submission_error_message(),
1028 1028
                             __FILE__, __FUNCTION__, __LINE__
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
 					}
1031 1031
 				}
1032 1032
 			}
1033
-		} catch ( EE_Error $e ) {
1033
+		} catch (EE_Error $e) {
1034 1034
 			$e->get_error();
1035 1035
 		}
1036 1036
 		return $EE_Registration_Config;
Please login to merge, or discard this patch.
admin_pages/maintenance/Maintenance_Admin_Page.core.php 1 patch
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 class Maintenance_Admin_Page extends EE_Admin_Page {
31 31
 
32 32
 
33
-	public function __construct( $routing = TRUE ) {
34
-		parent::__construct( $routing );
33
+	public function __construct($routing = TRUE) {
34
+		parent::__construct($routing);
35 35
 	}
36 36
 
37 37
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 
47 47
 
48 48
 	protected function _ajax_hooks() {
49
-		add_action('wp_ajax_migration_step',array($this,'migration_step'));
50
-		add_action('wp_ajax_add_error_to_migrations_ran',array($this,'add_error_to_migrations_ran'));
49
+		add_action('wp_ajax_migration_step', array($this, 'migration_step'));
50
+		add_action('wp_ajax_add_error_to_migrations_ran', array($this, 'add_error_to_migrations_ran'));
51 51
 	}
52 52
 
53 53
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		$this->_admin_page_title = EE_MAINTENANCE_LABEL;
57 57
 		$this->_labels = array(
58 58
 			'buttons' => array(
59
-				'reset_capabilities' => __( 'Reset Event Espresso Capabilities', 'event_espresso' )
59
+				'reset_capabilities' => __('Reset Event Espresso Capabilities', 'event_espresso')
60 60
 				)
61 61
 			);
62 62
 	}
@@ -155,23 +155,23 @@  discard block
 block discarded – undo
155 155
 	 * default maintenance page. If we're in maintenance mode level 2, then we need to show
156 156
 	 * the migration scripts and all that UI.
157 157
 	 */
158
-	public function _maintenance(){
158
+	public function _maintenance() {
159 159
 		//it all depends if we're in maintenance model level 1 (frontend-only) or
160 160
 		//level 2 (everything except maintenance page)
161
-		try{
161
+		try {
162 162
 			//get the current maintenance level and check if
163 163
 			//we are removed
164 164
 			$mm = EE_Maintenance_Mode::instance()->level();
165 165
 			$placed_in_mm = EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
166
-			if( $mm == EE_Maintenance_Mode::level_2_complete_maintenance && ! $placed_in_mm){
166
+			if ($mm == EE_Maintenance_Mode::level_2_complete_maintenance && ! $placed_in_mm) {
167 167
 				//we just took the site out of maintenance mode, so notify the user.
168 168
 				//unfortunately this message appears to be echoed on the NEXT page load...
169 169
 				//oh well, we should really be checking for this on addon deactivation anyways
170
-				EE_Error::add_attention( __( 'Site taken out of maintenance mode because no data migration scripts are required', 'event_espresso' ) );
171
-				$this->_process_notices( array( 'page' => 'espresso_maintenance_settings'), false );
170
+				EE_Error::add_attention(__('Site taken out of maintenance mode because no data migration scripts are required', 'event_espresso'));
171
+				$this->_process_notices(array('page' => 'espresso_maintenance_settings'), false);
172 172
 			}
173 173
 			//in case an exception is thrown while trying to handle migrations
174
-			switch(EE_Maintenance_Mode::instance()->level()){
174
+			switch (EE_Maintenance_Mode::instance()->level()) {
175 175
 				case EE_Maintenance_Mode::level_0_not_in_maintenance:
176 176
 				case EE_Maintenance_Mode::level_1_frontend_only_maintenance:
177 177
 					$show_maintenance_switch = true;
@@ -183,18 +183,18 @@  discard block
 block discarded – undo
183 183
 				case EE_Maintenance_Mode::level_2_complete_maintenance:
184 184
 					$show_maintenance_switch = false;
185 185
 					$show_migration_progress = true;
186
-					if(isset($this->_req_data['continue_migration'])){
186
+					if (isset($this->_req_data['continue_migration'])) {
187 187
 						$show_backup_db_text = false;
188
-					}else{
188
+					} else {
189 189
 						$show_backup_db_text = true;
190 190
 					}
191 191
 					$scripts_needing_to_run = EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts();
192 192
 					$addons_should_be_upgraded_first = EE_Data_Migration_Manager::instance()->addons_need_updating();
193 193
 					$script_names = array();
194 194
 					$current_script = NULL;
195
-					foreach($scripts_needing_to_run as $script){
196
-						if($script instanceof EE_Data_Migration_Script_Base){
197
-							if( ! $current_script){
195
+					foreach ($scripts_needing_to_run as $script) {
196
+						if ($script instanceof EE_Data_Migration_Script_Base) {
197
+							if ( ! $current_script) {
198 198
 								$current_script = $script;
199 199
 								$current_script->migration_page_hooks();
200 200
 							}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 			}
206 206
 			$most_recent_migration = EE_Data_Migration_Manager::instance()->get_last_ran_script(true);
207 207
 			$exception_thrown = false;
208
-		}catch(EE_Error $e){
208
+		} catch (EE_Error $e) {
209 209
 
210 210
 			EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($e->getMessage());
211 211
 			//now, just so we can display the page correctly, make a error migration script stage object
@@ -215,54 +215,54 @@  discard block
 block discarded – undo
215 215
 			$exception_thrown = true;
216 216
 		}
217 217
 		$current_db_state = EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set();
218
-		$current_db_state = str_replace( '.decaf', '', $current_db_state );
219
-		if($exception_thrown ||
220
-				(	$most_recent_migration &&
218
+		$current_db_state = str_replace('.decaf', '', $current_db_state);
219
+		if ($exception_thrown ||
220
+				($most_recent_migration &&
221 221
 					$most_recent_migration instanceof EE_Data_Migration_Script_Base &&
222 222
 					$most_recent_migration->is_broken()
223
-				)){
224
-			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_was_borked_page.template.php';
225
-			$this->_template_args[ 'support_url' ] = 'http://eventespresso.com/support/forums/';
226
-			$this->_template_args[ 'next_url' ] = EEH_URL::add_query_args_and_nonce(array( 'action' => 'confirm_migration_crash_report_sent', 'success' => '0' ), EE_MAINTENANCE_ADMIN_URL );
227
-		}elseif($addons_should_be_upgraded_first){
228
-			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_upgrade_addons_before_migrating.template.php';
229
-		}else{
230
-			if($most_recent_migration &&
231
-					$most_recent_migration instanceof EE_Data_Migration_Script_Base  &&
232
-					$most_recent_migration->can_continue()){
223
+				)) {
224
+			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_migration_was_borked_page.template.php';
225
+			$this->_template_args['support_url'] = 'http://eventespresso.com/support/forums/';
226
+			$this->_template_args['next_url'] = EEH_URL::add_query_args_and_nonce(array('action' => 'confirm_migration_crash_report_sent', 'success' => '0'), EE_MAINTENANCE_ADMIN_URL);
227
+		}elseif ($addons_should_be_upgraded_first) {
228
+			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_upgrade_addons_before_migrating.template.php';
229
+		} else {
230
+			if ($most_recent_migration &&
231
+					$most_recent_migration instanceof EE_Data_Migration_Script_Base &&
232
+					$most_recent_migration->can_continue()) {
233 233
 				$show_backup_db_text = false;
234 234
 				$show_continue_current_migration_script = true;
235 235
 				$show_most_recent_migration = true;
236
-			}elseif(isset($this->_req_data['continue_migration'])){
236
+			}elseif (isset($this->_req_data['continue_migration'])) {
237 237
 				$show_most_recent_migration = true;
238 238
 				$show_continue_current_migration_script = false;
239
-			}else{
239
+			} else {
240 240
 				$show_most_recent_migration = false;
241 241
 				$show_continue_current_migration_script = false;
242 242
 			}
243 243
 
244
-			if(isset($current_script)){
244
+			if (isset($current_script)) {
245 245
 				$migrates_to = $current_script->migrates_to_version();
246
-				$plugin_slug = $migrates_to[ 'slug' ];
247
-				$new_version = $migrates_to[ 'version' ];
248
-				$this->_template_args = array_merge($this->_template_args,array(
249
-					'current_db_state'=>  sprintf(__("EE%s (%s)", "event_espresso"), isset($current_db_state[$plugin_slug]) ? $current_db_state[$plugin_slug] : 3,$plugin_slug),
250
-					'next_db_state'=>isset($current_script) ? sprintf(__("EE%s (%s)", 'event_espresso'),$new_version,$plugin_slug) : NULL));
246
+				$plugin_slug = $migrates_to['slug'];
247
+				$new_version = $migrates_to['version'];
248
+				$this->_template_args = array_merge($this->_template_args, array(
249
+					'current_db_state'=>  sprintf(__("EE%s (%s)", "event_espresso"), isset($current_db_state[$plugin_slug]) ? $current_db_state[$plugin_slug] : 3, $plugin_slug),
250
+					'next_db_state'=>isset($current_script) ? sprintf(__("EE%s (%s)", 'event_espresso'), $new_version, $plugin_slug) : NULL));
251 251
 			}
252 252
 
253
-			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_page.template.php';
253
+			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_migration_page.template.php';
254 254
 			$this->_template_args = array_merge(
255 255
 				$this->_template_args,
256 256
 				array(
257
-					'show_most_recent_migration' => $show_most_recent_migration,//flag for showing the most recent migration's status and/or errors
258
-					'show_migration_progress' => $show_migration_progress,//flag for showing the option to run migrations and see their progress
259
-					'show_backup_db_text' => $show_backup_db_text,//flag for showing text telling the user to backup their DB
260
-					'show_maintenance_switch'=> $show_maintenance_switch,//flag for showing the option to change maintenance mode between levels 0 and 1
261
-					'script_names'=>$script_names,//array of names of scripts that have run
262
-					'show_continue_current_migration_script'=>$show_continue_current_migration_script,//flag to change wording to indicating that we're only CONTINUING a migration script (somehow it got interrupted0
257
+					'show_most_recent_migration' => $show_most_recent_migration, //flag for showing the most recent migration's status and/or errors
258
+					'show_migration_progress' => $show_migration_progress, //flag for showing the option to run migrations and see their progress
259
+					'show_backup_db_text' => $show_backup_db_text, //flag for showing text telling the user to backup their DB
260
+					'show_maintenance_switch'=> $show_maintenance_switch, //flag for showing the option to change maintenance mode between levels 0 and 1
261
+					'script_names'=>$script_names, //array of names of scripts that have run
262
+					'show_continue_current_migration_script'=>$show_continue_current_migration_script, //flag to change wording to indicating that we're only CONTINUING a migration script (somehow it got interrupted0
263 263
 					'reset_db_page_link' => EE_Admin_Page::add_query_args_and_nonce(array('action'=>'reset_db'), EE_MAINTENANCE_ADMIN_URL),
264
-					'update_migration_script_page_link' => EE_Admin_Page::add_query_args_and_nonce(array('action'=>'change_maintenance_level'),EE_MAINTENANCE_ADMIN_URL),
265
-					'ultimate_db_state'=>  sprintf(__("EE%s", 'event_espresso'),espresso_version()),
264
+					'update_migration_script_page_link' => EE_Admin_Page::add_query_args_and_nonce(array('action'=>'change_maintenance_level'), EE_MAINTENANCE_ADMIN_URL),
265
+					'ultimate_db_state'=>  sprintf(__("EE%s", 'event_espresso'), espresso_version()),
266 266
 				)
267 267
 			);
268 268
 		//make sure we have the form fields helper available. It usually is, but sometimes it isn't
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 			'status_fatal_error'=>  EE_Data_Migration_Manager::status_fatal_error,
277 277
 			'status_completed'=>  EE_Data_Migration_Manager::status_completed));
278 278
 		}
279
-		$this->_template_args['most_recent_migration'] = $most_recent_migration;//the actual most recently ran migration
279
+		$this->_template_args['most_recent_migration'] = $most_recent_migration; //the actual most recently ran migration
280 280
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
281 281
 		$this->display_admin_page_with_sidebar();
282 282
 	}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	/**
287 287
 	 * returns JSON and executes another step of the currently-executing data migration (called via ajax)
288 288
 	 */
289
-	public function migration_step(){
289
+	public function migration_step() {
290 290
 		$this->_template_args['data'] = EE_Data_Migration_Manager::instance()->response_to_migration_ajax_request();
291 291
 		$this->_return_json();
292 292
 	}
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * Can be used by js when it notices a response with HTML in it in order
298 298
 	 * to log the malformed response
299 299
 	 */
300
-	public function add_error_to_migrations_ran(){
300
+	public function add_error_to_migrations_ran() {
301 301
 		EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($this->_req_data['message']);
302 302
 		$this->_template_args['data'] = array('ok'=>true);
303 303
 		$this->_return_json();
@@ -308,14 +308,14 @@  discard block
 block discarded – undo
308 308
 	/**
309 309
 	 * changes the maintenance level, provided there are still no migration scripts that shoudl run
310 310
 	 */
311
-	public function _change_maintenance_level(){
311
+	public function _change_maintenance_level() {
312 312
 		$new_level = intval($this->_req_data['maintenance_mode_level']);
313
-		if( ! EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()){
313
+		if ( ! EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) {
314 314
 			EE_Maintenance_Mode::instance()->set_maintenance_level($new_level);
315 315
 			$success = true;
316
-		}else{
316
+		} else {
317 317
 			EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
318
-			$success= false;
318
+			$success = false;
319 319
 		}
320 320
 		$this->_redirect_after_action($success, 'Maintenance Mode', __("Updated", "event_espresso"));
321 321
 	}
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
 	 *
328 328
 	 * @throws \EE_Error
329 329
 	 */
330
-	public function _data_reset_and_delete(){
331
-		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_data_reset_and_delete.template.php';
330
+	public function _data_reset_and_delete() {
331
+		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_data_reset_and_delete.template.php';
332 332
 		$this->_template_args['reset_capabilities_button'] = $this->get_action_link_or_button(
333 333
 			'reset_capabilities',
334 334
 			'reset_capabilities',
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
 			false
339 339
 		);
340 340
 		$this->_template_args['delete_db_url'] = EE_Admin_Page::add_query_args_and_nonce(
341
-			array( 'action' => 'delete_db' ),
341
+			array('action' => 'delete_db'),
342 342
 			EE_MAINTENANCE_ADMIN_URL
343 343
 		);
344 344
 		$this->_template_args['reset_db_url'] = EE_Admin_Page::add_query_args_and_nonce(
345
-			array( 'action' => 'reset_db' ),
345
+			array('action' => 'reset_db'),
346 346
 			EE_MAINTENANCE_ADMIN_URL
347 347
 		);
348 348
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 
357 357
 
358 358
 	protected function _reset_capabilities() {
359
-		EE_Registry::instance()->CAP->init_caps( true );
360
-		EE_Error::add_success( __('Default Event Espresso capabilities have been restored for all current roles.', 'event_espresso' ) );
361
-		$this->_redirect_after_action( FALSE, '', '', array( 'action' => 'data_reset' ), TRUE );
359
+		EE_Registry::instance()->CAP->init_caps(true);
360
+		EE_Error::add_success(__('Default Event Espresso capabilities have been restored for all current roles.', 'event_espresso'));
361
+		$this->_redirect_after_action(FALSE, '', '', array('action' => 'data_reset'), TRUE);
362 362
 	}
363 363
 
364 364
 	/**
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	 */
369 369
 	protected function _reattempt_migration() {
370 370
 		EE_Data_Migration_Manager::instance()->reattempt();
371
-		$this->_redirect_after_action( FALSE, '', '', array( 'action' => 'default' ), TRUE );
371
+		$this->_redirect_after_action(FALSE, '', '', array('action' => 'default'), TRUE);
372 372
 	}
373 373
 
374 374
 
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
 	/**
378 378
 	 * shows the big ol' System Information page
379 379
 	 */
380
-	public function _system_status(){
381
-		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_system_stati_page.template.php';
380
+	public function _system_status() {
381
+		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_system_stati_page.template.php';
382 382
 		$this->_template_args['system_stati'] = EEM_System_Status::instance()->get_system_stati();
383 383
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
384 384
 		$this->display_admin_page_with_sidebar();
@@ -386,30 +386,30 @@  discard block
 block discarded – undo
386 386
 
387 387
 
388 388
 
389
-	public function _send_migration_crash_report(){
389
+	public function _send_migration_crash_report() {
390 390
 		$from = $this->_req_data['from'];
391 391
 		$from_name = $this->_req_data['from_name'];
392 392
 		$body = $this->_req_data['body'];
393
-		try{
393
+		try {
394 394
 		$success = wp_mail(EE_SUPPORT_EMAIL,
395 395
 				'Migration Crash Report',
396
-				$body."/r/n<br>".  print_r(EEM_System_Status::instance()->get_system_stati(),true),
396
+				$body."/r/n<br>".print_r(EEM_System_Status::instance()->get_system_stati(), true),
397 397
 				array(
398 398
 					"from:$from_name<$from>",
399 399
 //					'content-type:text/html charset=UTF-8'
400 400
 					));
401
-		}catch( Exception $e ){
401
+		} catch (Exception $e) {
402 402
 			$success = FALSE;
403 403
 		}
404
-		$this->_redirect_after_action($success, __("Migration Crash Report", "event_espresso"), __("sent", "event_espresso"),array('success'=>$success,'action'=>'confirm_migration_crash_report_sent'));
404
+		$this->_redirect_after_action($success, __("Migration Crash Report", "event_espresso"), __("sent", "event_espresso"), array('success'=>$success, 'action'=>'confirm_migration_crash_report_sent'));
405 405
 	}
406 406
 
407 407
 
408 408
 
409
-	public function _confirm_migration_crash_report_sent(){
410
-		try{
409
+	public function _confirm_migration_crash_report_sent() {
410
+		try {
411 411
 			$most_recent_migration = EE_Data_Migration_Manager::instance()->get_last_ran_script(true);
412
-		}catch(EE_Error $e){
412
+		} catch (EE_Error $e) {
413 413
 
414 414
 			EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($e->getMessage());
415 415
 			//now, just so we can display the page correctly, make a error migration script stage object
@@ -417,14 +417,14 @@  discard block
 block discarded – undo
417 417
 			$most_recent_migration = new EE_DMS_Unknown_1_0_0();
418 418
 			$most_recent_migration->add_error($e->getMessage());
419 419
 		}
420
-		$success = $this->_req_data['success']=='1' ? true : false;
420
+		$success = $this->_req_data['success'] == '1' ? true : false;
421 421
 		$this->_template_args['success'] = $success;
422
-		$this->_template_args[ 'most_recent_migration' ] = $most_recent_migration;
422
+		$this->_template_args['most_recent_migration'] = $most_recent_migration;
423 423
 		$this->_template_args['reset_db_action_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'reset_db'), EE_MAINTENANCE_ADMIN_URL);
424
-		$this->_template_args[ 'reset_db_page_url' ] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'data_reset'), EE_MAINTENANCE_ADMIN_URL);
425
-		$this->_template_args[ 'reattempt_action_url' ] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'reattempt_migration'), EE_MAINTENANCE_ADMIN_URL );
426
-		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_confirm_migration_crash_report_sent.template.php';
427
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path,$this->_template_args,TRUE);
424
+		$this->_template_args['reset_db_page_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'data_reset'), EE_MAINTENANCE_ADMIN_URL);
425
+		$this->_template_args['reattempt_action_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'reattempt_migration'), EE_MAINTENANCE_ADMIN_URL);
426
+		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_confirm_migration_crash_report_sent.template.php';
427
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
428 428
 		$this->display_admin_page_with_sidebar();
429 429
 	}
430 430
 
@@ -437,18 +437,18 @@  discard block
 block discarded – undo
437 437
 	 * @param boolean $nuke_old_ee4_data controls whether or not we
438 438
 	 * destroy the old ee4 data, or just try initializing ee4 default data
439 439
 	 */
440
-	public function _reset_db( $nuke_old_ee4_data = TRUE ){
440
+	public function _reset_db($nuke_old_ee4_data = TRUE) {
441 441
 		EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
442 442
 
443
-		if( $nuke_old_ee4_data ){
443
+		if ($nuke_old_ee4_data) {
444 444
 			EEH_Activation::delete_all_espresso_cpt_data();
445
-			EEH_Activation::delete_all_espresso_tables_and_data( FALSE );
445
+			EEH_Activation::delete_all_espresso_tables_and_data(FALSE);
446 446
 			EEH_Activation::remove_cron_tasks();
447 447
 		}
448 448
 		//make sure when we reset the registry's config that it
449 449
 		//switches to using the new singleton
450
-		EE_Registry::instance()->CFG = EE_Registry::instance()->CFG->reset( TRUE );
451
-		EE_System::instance()->initialize_db_if_no_migrations_required( TRUE );
450
+		EE_Registry::instance()->CFG = EE_Registry::instance()->CFG->reset(TRUE);
451
+		EE_System::instance()->initialize_db_if_no_migrations_required(TRUE);
452 452
 		EE_System::instance()->redirect_to_about_ee();
453 453
 	}
454 454
 
@@ -457,20 +457,20 @@  discard block
 block discarded – undo
457 457
 	/**
458 458
 	 * Deletes ALL EE tables, Records, and Options from the database.
459 459
 	 */
460
-	public function _delete_db(){
460
+	public function _delete_db() {
461 461
 		EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
462 462
 		EEH_Activation::delete_all_espresso_cpt_data();
463 463
 		EEH_Activation::delete_all_espresso_tables_and_data();
464 464
 		EEH_Activation::remove_cron_tasks();
465 465
 		EEH_Activation::deactivate_event_espresso();
466
-		wp_safe_redirect( admin_url( 'plugins.php' ));
466
+		wp_safe_redirect(admin_url('plugins.php'));
467 467
 		exit;
468 468
 	}
469 469
 
470 470
 	/**
471 471
 	 * sets up EE4 to rerun the migrations from ee3 to ee4
472 472
 	 */
473
-	public function _rerun_migration_from_ee3(){
473
+	public function _rerun_migration_from_ee3() {
474 474
 		EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
475 475
 		EEH_Activation::delete_all_espresso_cpt_data();
476 476
 		EEH_Activation::delete_all_espresso_tables_and_data(false);
@@ -497,9 +497,9 @@  discard block
 block discarded – undo
497 497
 		wp_enqueue_script('ee_admin_js');
498 498
 //		wp_enqueue_media();
499 499
 //		wp_enqueue_script('media-upload');
500
-		wp_enqueue_script('ee-maintenance',EE_MAINTENANCE_ASSETS_URL.'/ee-maintenance.js',array('jquery'),EVENT_ESPRESSO_VERSION,true);
500
+		wp_enqueue_script('ee-maintenance', EE_MAINTENANCE_ASSETS_URL.'/ee-maintenance.js', array('jquery'), EVENT_ESPRESSO_VERSION, true);
501 501
 
502
-		wp_register_style( 'espresso_maintenance', EE_MAINTENANCE_ASSETS_URL . 'ee-maintenance.css', array(), EVENT_ESPRESSO_VERSION );
502
+		wp_register_style('espresso_maintenance', EE_MAINTENANCE_ASSETS_URL.'ee-maintenance.css', array(), EVENT_ESPRESSO_VERSION);
503 503
 		wp_enqueue_style('espresso_maintenance');
504 504
 	}
505 505
 
Please login to merge, or discard this patch.
admin/extend/messages/Custom_Messages_Template_List_Table.class.php 2 patches
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 class Custom_Messages_Template_List_Table extends EE_Admin_List_Table {
31 31
 
32 32
 
33
-	public function __construct( $admin_page ) {
33
+	public function __construct($admin_page) {
34 34
 		//Set parent defaults
35 35
 		parent::__construct($admin_page);
36 36
 	}
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
 	protected function _setup_data() {
52
-		$this->_data = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, FALSE, FALSE, FALSE );
53
-		$this->_all_data_count = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, TRUE, TRUE, FALSE );
52
+		$this->_data = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, FALSE, FALSE, FALSE);
53
+		$this->_all_data_count = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, TRUE, TRUE, FALSE);
54 54
 	}
55 55
 
56 56
 
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 
60 60
 	protected function _set_properties() {
61 61
 		$this->_wp_list_args = array(
62
-			'singular' => __('Message Template Group', 'event_espresso' ),
63
-			'plural' => __('Message Template', 'event_espresso' ),
62
+			'singular' => __('Message Template Group', 'event_espresso'),
63
+			'plural' => __('Message Template', 'event_espresso'),
64 64
 			'ajax' => TRUE, //for now,
65 65
 			'screen' => $this->get_admin_page()->get_current_screen()->id
66 66
 			);
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
 			'cb' => '<input type="checkbox" />',
70 70
 			'name' => __('Template Name', 'event_espresso'),
71 71
 			'message_type' => __('Message Type', 'event_espresso'),
72
-			'messenger' => __( 'Messenger', 'event_espresso'),
73
-			'description' => __( 'Description', 'event_espresso' ),
74
-			'events' => __( 'Events', 'event_espresso'), //count of events using this template.
72
+			'messenger' => __('Messenger', 'event_espresso'),
73
+			'description' => __('Description', 'event_espresso'),
74
+			'events' => __('Events', 'event_espresso'), //count of events using this template.
75 75
 			'actions' => ''
76 76
 			//'messages_sent' => __( 'Total Sent', 'event_espresso' ) //todo this will come later when we've got message tracking in place.
77 77
 			);
78 78
 
79 79
 		$this->_sortable_columns = array(
80
-			'messenger' => array( 'MTP_messenger' => TRUE ),
80
+			'messenger' => array('MTP_messenger' => TRUE),
81 81
 			//'message_type' => array( 'MTP_message_type' => FALSE )
82 82
 			);
83 83
 
@@ -96,16 +96,16 @@  discard block
 block discarded – undo
96 96
 	 *
97 97
 	 * @return string
98 98
 	 */
99
-	public function single_row( $item ) {
99
+	public function single_row($item) {
100 100
 		$message_type = $item->message_type_obj();
101 101
 		$messenger = $item->messenger_obj();
102 102
 
103
-		if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger ) {
103
+		if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) {
104 104
 			echo '';
105 105
 			return;
106 106
 		}
107 107
 
108
-		parent::single_row( $item );
108
+		parent::single_row($item);
109 109
 	}
110 110
 
111 111
 
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 		);
124 124
 
125 125
 		//set filters to select inputs if they aren't empty
126
-		foreach ( $select_inputs as $select_input ) {
127
-			if ( $select_input ) {
126
+		foreach ($select_inputs as $select_input) {
127
+			if ($select_input) {
128 128
 				$filters[] = $select_input;
129 129
 			}
130 130
 		}
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
 	 * we're just removing the search box for message templates, not needed.
136 136
 	 * @return string (empty);
137 137
 	 */
138
-	function search_box( $text, $input_id ) {
138
+	function search_box($text, $input_id) {
139 139
 		return '';
140 140
 	}
141 141
 
142 142
 
143 143
 	protected function _add_view_counts() {
144
-		foreach ( $this->_views as $view => $args )  {
145
-			$this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates( $this->_per_page, $view, TRUE, TRUE, FALSE );
144
+		foreach ($this->_views as $view => $args) {
145
+			$this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates($this->_per_page, $view, TRUE, TRUE, FALSE);
146 146
 		}
147 147
 	}
148 148
 
@@ -156,16 +156,16 @@  discard block
 block discarded – undo
156 156
 	 * @return string
157 157
 	 */
158 158
 	public function no_items() {
159
-		if ( $this->_view !== 'trashed' )
160
-			printf( __('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>' );
159
+		if ($this->_view !== 'trashed')
160
+			printf(__('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>');
161 161
 		else
162 162
 			parent::no_items();
163 163
 	}
164 164
 
165 165
 
166 166
 
167
-	public function column_cb( $item ) {
168
-		return sprintf( '<input type="checkbox" name="checkbox[%s] value="1" />', $item->GRP_ID() );
167
+	public function column_cb($item) {
168
+		return sprintf('<input type="checkbox" name="checkbox[%s] value="1" />', $item->GRP_ID());
169 169
 	}
170 170
 
171 171
 
@@ -173,29 +173,29 @@  discard block
 block discarded – undo
173 173
 
174 174
 
175 175
 
176
-	function column_name( $item ) {
177
-		return '<p>' . $item->name() . '</p>';
176
+	function column_name($item) {
177
+		return '<p>'.$item->name().'</p>';
178 178
 	}
179 179
 
180 180
 
181 181
 
182 182
 
183
-	function column_description( $item ) {
184
-		return '<p>' . $item->description() . '</p>';
183
+	function column_description($item) {
184
+		return '<p>'.$item->description().'</p>';
185 185
 	}
186 186
 
187 187
 
188 188
 
189
-	function column_actions( $item ) {
190
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messages_add_new_message_template' ) ) {
189
+	function column_actions($item) {
190
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messages_add_new_message_template')) {
191 191
 			$create_args = array(
192 192
 				'GRP_ID' => $item->ID(),
193 193
 				'messenger' => $item->messenger(),
194 194
 				'message_type' => $item->message_type(),
195 195
 				'action' => 'add_new_message_template'
196 196
 				);
197
-			$create_link = EE_Admin_Page::add_query_args_and_nonce( $create_args, EE_MSG_ADMIN_URL );
198
-			return sprintf( '<p><a href="%s" class="button button-small">%s</a></p>', $create_link, __('Create Custom', 'event_espresso') );
197
+			$create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL);
198
+			return sprintf('<p><a href="%s" class="button button-small">%s</a></p>', $create_link, __('Create Custom', 'event_espresso'));
199 199
 		}
200 200
 		return '';
201 201
 	}
@@ -212,27 +212,27 @@  discard block
 block discarded – undo
212 212
 		$actions = array();
213 213
 
214 214
 		// edit link but only if item isn't trashed.
215
-		if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ) {
216
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_message_template', 'id'=>$item->GRP_ID() ), EE_MSG_ADMIN_URL );
217
-			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>';
215
+		if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID())) {
216
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID()), EE_MSG_ADMIN_URL);
217
+			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>';
218 218
 		}
219 219
 
220
-		$name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() )? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template', 'event_espresso' ) . '">' . ucwords( $item->messenger_obj()->label['singular'] ) . '</a>' : ucwords( $item->messenger_obj()->label['singular'] );
221
-		$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
220
+		$name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template', 'event_espresso').'">'.ucwords($item->messenger_obj()->label['singular']).'</a>' : ucwords($item->messenger_obj()->label['singular']);
221
+		$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL);
222 222
 		// restore link
223
-		$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
223
+		$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL);
224 224
 		// delete price link
225
-		$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
225
+		$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL);
226 226
 
227
-		if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_trash_message_template', $item->ID() ) ) {
228
-			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Move Template Group to Trash', 'event_espresso' ) . '">' . __( 'Move to Trash', 'event_espresso' ) . '</a>';
227
+		if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_trash_message_template', $item->ID())) {
228
+			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Move Template Group to Trash', 'event_espresso').'">'.__('Move to Trash', 'event_espresso').'</a>';
229 229
 		} else {
230
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_restore_message_template', $item->ID() ) ) {
231
-				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Message Template', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>';
230
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_restore_message_template', $item->ID())) {
231
+				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Message Template', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
232 232
 			}
233 233
 
234
-			if ( $this->_view == 'trashed' && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_delete_message_template', $item->ID() ) ) {
235
-				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Template Group Permanently', 'event_espresso' ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>';
234
+			if ($this->_view == 'trashed' && EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_delete_message_template', $item->ID())) {
235
+				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Template Group Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>';
236 236
 			}
237 237
 		}
238 238
 
@@ -241,15 +241,15 @@  discard block
 block discarded – undo
241 241
 		$c_configs = $item->contexts_config();
242 242
 		$ctxt = array();
243 243
 		$context_templates = $item->context_templates();
244
-		foreach ( $context_templates as $context => $template_fields ) {
245
-			$mtp_to = !empty( $context_templates[$context]['to'] ) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL;
246
-			$inactive = empty( $mtp_to ) && !empty( $context_templates[$context]['to'] ) ? ' class="mtp-inactive"' : '';
244
+		foreach ($context_templates as $context => $template_fields) {
245
+			$mtp_to = ! empty($context_templates[$context]['to']) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL;
246
+			$inactive = empty($mtp_to) && ! empty($context_templates[$context]['to']) ? ' class="mtp-inactive"' : '';
247 247
 			$context_title = ucwords($c_configs[$context]['label']);
248
-			$edit_link = EE_Admin_Page::add_query_args_and_nonce( array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL );
249
-			$ctxt[] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a' . $inactive . ' href="'. $edit_link . '" title="' . esc_attr__('Edit Context', 'event_espresso') . '">' . $context_title . '</a>' : $context_title;
248
+			$edit_link = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL);
249
+			$ctxt[] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a'.$inactive.' href="'.$edit_link.'" title="'.esc_attr__('Edit Context', 'event_espresso').'">'.$context_title.'</a>' : $context_title;
250 250
 		}
251 251
 
252
-		$ctx_content = !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? sprintf( __('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural']) ) . implode(' | ', $ctxt) : '';
252
+		$ctx_content = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? sprintf(__('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural'])).implode(' | ', $ctxt) : '';
253 253
 
254 254
 
255 255
 		//Return the name contents
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 										/* $1%s */ $name_link,
258 258
 										/* $2%s */ $item->GRP_ID(),
259 259
 										/* %4$s */ $ctx_content,
260
-										/* $3%s */ $this->row_actions( $actions )
260
+										/* $3%s */ $this->row_actions($actions)
261 261
 		);
262 262
 	}
263 263
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 * @return string       message_type name
279 279
 	 */
280 280
 	function column_message_type($item) {
281
-		return ucwords($item->message_type_obj()->label['singular'] );
281
+		return ucwords($item->message_type_obj()->label['singular']);
282 282
 	}
283 283
 
284 284
 
@@ -305,16 +305,16 @@  discard block
 block discarded – undo
305 305
 			)
306 306
 		);
307 307
 
308
-		foreach ( $active_message_template_groups_grouped_by_messenger as $active_message_template_group ) {
309
-			if ( $active_message_template_group instanceof EE_Message_Template_Group ) {
308
+		foreach ($active_message_template_groups_grouped_by_messenger as $active_message_template_group) {
309
+			if ($active_message_template_group instanceof EE_Message_Template_Group) {
310 310
 				$messenger = $active_message_template_group->messenger_obj();
311 311
 				$messenger_label = $messenger instanceof EE_messenger
312 312
 					? $messenger->label['singular']
313 313
 					: $active_message_template_group->messenger();
314
-				$messenger_options[ $active_message_template_group->messenger() ] = ucwords( $messenger_label );
314
+				$messenger_options[$active_message_template_group->messenger()] = ucwords($messenger_label);
315 315
 			}
316 316
 		}
317
-		return $this->get_admin_page()->get_messengers_select_input( $messenger_options );
317
+		return $this->get_admin_page()->get_messengers_select_input($messenger_options);
318 318
 	}
319 319
 
320 320
 
@@ -334,16 +334,16 @@  discard block
 block discarded – undo
334 334
 			)
335 335
 		);
336 336
 
337
-		foreach ( $active_message_template_groups_grouped_by_message_type as $active_message_template_group ) {
338
-			if ( $active_message_template_group instanceof EE_Message_Template_Group ) {
337
+		foreach ($active_message_template_groups_grouped_by_message_type as $active_message_template_group) {
338
+			if ($active_message_template_group instanceof EE_Message_Template_Group) {
339 339
 				$message_type = $active_message_template_group->message_type_obj();
340 340
 				$message_type_label = $message_type instanceof EE_message_type
341 341
 					? $message_type->label['singular']
342 342
 					: $active_message_template_group->message_type();
343
-				$message_type_options[ $active_message_template_group->message_type() ] = ucwords( $message_type_label );
343
+				$message_type_options[$active_message_template_group->message_type()] = ucwords($message_type_label);
344 344
 			}
345 345
 		}
346
-		return $this->get_admin_page()->get_message_types_select_input( $message_type_options );
346
+		return $this->get_admin_page()->get_message_types_select_input($message_type_options);
347 347
 	}
348 348
 
349 349
 }
Please login to merge, or discard this patch.
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -156,10 +157,11 @@  discard block
 block discarded – undo
156 157
 	 * @return string
157 158
 	 */
158 159
 	public function no_items() {
159
-		if ( $this->_view !== 'trashed' )
160
-			printf( __('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>' );
161
-		else
162
-			parent::no_items();
160
+		if ( $this->_view !== 'trashed' ) {
161
+					printf( __('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>' );
162
+		} else {
163
+					parent::no_items();
164
+		}
163 165
 	}
164 166
 
165 167
 
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Admin_Page.core.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 *
103 103
 	 * @throws EE_Error
104
-	*/
104
+	 */
105 105
 	protected function _load_message_resource_manager() {
106 106
 		$this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
107 107
 	}
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 	public function get_messengers_select_input( $messenger_options ) {
203 203
 		//if empty or just one value then just return an empty string
204 204
 		if ( empty( $messenger_options )
205
-		     || ! is_array( $messenger_options )
206
-		     ||  count( $messenger_options ) === 1
205
+			 || ! is_array( $messenger_options )
206
+			 ||  count( $messenger_options ) === 1
207 207
 		) {
208 208
 			return '';
209 209
 		}
@@ -333,9 +333,9 @@  discard block
 block discarded – undo
333 333
 
334 334
 	/**
335 335
 	 * 		an array for storing key => value pairs of request actions and their corresponding methods
336
-	*		@access protected
337
-	*		@return void
338
-	*/
336
+	 *		@access protected
337
+	 *		@return void
338
+	 */
339 339
 	protected function _set_page_routes() {
340 340
 		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] )
341 341
 			? $this->_req_data['GRP_ID']
@@ -644,8 +644,8 @@  discard block
 block discarded – undo
644 644
 	protected function _add_screen_options_global_mtps() {
645 645
 		/**
646 646
 		 * Note: the reason for the value swap here on $this->_admin_page_title is because $this->_per_page_screen_options
647
-         * uses the $_admin_page_title property and we want different outputs in the different spots.
648
-         */
647
+		 * uses the $_admin_page_title property and we want different outputs in the different spots.
648
+		 */
649 649
 		$page_title = $this->_admin_page_title;
650 650
 		$this->_admin_page_title = __('Global Message Templates', 'event_espresso');
651 651
 		$this->_per_page_screen_option();
@@ -848,9 +848,9 @@  discard block
 block discarded – undo
848 848
 		$common_bulk_actions = EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'message_list_table_bulk_actions' )
849 849
 			? array(
850 850
 				'generate_now' => __( 'Generate Now', 'event_espresso' ),
851
-		        'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ),
852
-		        'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ),
853
-		        'send_now' => __( 'Send Now', 'event_espresso' )
851
+				'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ),
852
+				'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ),
853
+				'send_now' => __( 'Send Now', 'event_espresso' )
854 854
 				)
855 855
 			: array();
856 856
 
@@ -861,10 +861,10 @@  discard block
 block discarded – undo
861 861
 
862 862
 		$this->_views = array(
863 863
 			 'all' => array(
864
-			    'slug' => 'all',
865
-			    'label' => __( 'All', 'event_espresso' ),
866
-			    'count' => 0,
867
-			    'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action )
864
+				'slug' => 'all',
865
+				'label' => __( 'All', 'event_espresso' ),
866
+				'count' => 0,
867
+				'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action )
868 868
 			 )
869 869
 		);
870 870
 
@@ -1254,9 +1254,9 @@  discard block
 block discarded – undo
1254 1254
 																			&& in_array($extra_field, $v_fields)
1255 1255
 																			&&
1256 1256
 																			(
1257
-								                                                is_array($validators[$extra_field] )
1257
+																				is_array($validators[$extra_field] )
1258 1258
 																				&& isset( $validators[$extra_field]['msg'] )
1259
-							                                                )
1259
+																			)
1260 1260
 								? 'validate-error ' . $css_class
1261 1261
 								: $css_class;
1262 1262
 
@@ -1541,8 +1541,8 @@  discard block
 block discarded – undo
1541 1541
 			 $GRP_ID,
1542 1542
 			 false,
1543 1543
 			 add_query_arg(
1544
-			    array( 'action' => 'global_mtps' ),
1545
-			    $this->_admin_base_url
1544
+				array( 'action' => 'global_mtps' ),
1545
+				$this->_admin_base_url
1546 1546
 			 )
1547 1547
 		);
1548 1548
 
@@ -2017,14 +2017,14 @@  discard block
 block discarded – undo
2017 2017
 
2018 2018
 
2019 2019
 	/**
2020
-     * This returns the shortcode selector skeleton for a given context and field.
2021
-     *
2022
-     * @since 4.9.rc.000
2023
-     *
2020
+	 * This returns the shortcode selector skeleton for a given context and field.
2021
+	 *
2022
+	 * @since 4.9.rc.000
2023
+	 *
2024 2024
 	 * @param string $field  The name of the field retrieving shortcodes for.
2025
-     * @param string $linked_input_id The css id of the input that the shortcodes get added to.
2026
-     * @return string
2027
-    */
2025
+	 * @param string $linked_input_id The css id of the input that the shortcodes get added to.
2026
+	 * @return string
2027
+	 */
2028 2028
 	protected function _get_shortcode_selector( $field, $linked_input_id ) {
2029 2029
 		$template_args = array(
2030 2030
 			'shortcodes' => $this->_get_shortcodes( array( $field ), true ),
@@ -2622,9 +2622,9 @@  discard block
 block discarded – undo
2622 2622
 
2623 2623
 	/**
2624 2624
 	 * 	_learn_more_about_message_templates_link
2625
-	*	@access protected
2626
-	*	@return string
2627
-	*/
2625
+	 *	@access protected
2626
+	 *	@return string
2627
+	 */
2628 2628
 	protected function _learn_more_about_message_templates_link() {
2629 2629
 		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2630 2630
 	}
@@ -3268,7 +3268,7 @@  discard block
 block discarded – undo
3268 3268
 			/** @var EE_message_type $message_type */
3269 3269
 			$message_type = $this->_message_resource_manager->get_message_type( $message_type_name );
3270 3270
 			if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name )
3271
-			     && $message_type instanceof EE_message_type
3271
+				 && $message_type instanceof EE_message_type
3272 3272
 			) {
3273 3273
 				$this->_template_args['data']['active_mts'][] = $message_type_name;
3274 3274
 				if ( $message_type->get_admin_settings_fields() ) {
@@ -3604,10 +3604,10 @@  discard block
 block discarded – undo
3604 3604
 
3605 3605
 	/**
3606 3606
 	 * This immediately generates any EE_Message ID's that are selected that are EEM_Message::status_incomplete
3607
-     * However, this does not send immediately, it just queues for sending.
3608
-     *
3609
-     * @since 4.9.0
3610
-     */
3607
+	 * However, this does not send immediately, it just queues for sending.
3608
+	 *
3609
+	 * @since 4.9.0
3610
+	 */
3611 3611
 	protected function _generate_now() {
3612 3612
 		$msg_ids = $this->_get_msg_ids_from_request();
3613 3613
 		EED_Messages::generate_now( $msg_ids );
@@ -3618,11 +3618,11 @@  discard block
 block discarded – undo
3618 3618
 
3619 3619
 	/**
3620 3620
 	 * This immediately generates AND sends any EE_Message's selected that are EEM_Message::status_incomplete or that are
3621
-     * EEM_Message::status_resend or EEM_Message::status_idle
3622
-     *
3623
-     * @since 4.9.0
3624
-     *
3625
-     */
3621
+	 * EEM_Message::status_resend or EEM_Message::status_idle
3622
+	 *
3623
+	 * @since 4.9.0
3624
+	 *
3625
+	 */
3626 3626
 	protected function _generate_and_send_now() {
3627 3627
 		$this->_generate_now();
3628 3628
 		$this->_send_now();
@@ -3635,9 +3635,9 @@  discard block
 block discarded – undo
3635 3635
 
3636 3636
 	/**
3637 3637
 	 * This queues any EEM_Message::status_sent EE_Message ids in the request for resending.
3638
-     *
3639
-     * @since 4.9.0
3640
-     */
3638
+	 *
3639
+	 * @since 4.9.0
3640
+	 */
3641 3641
 	protected function _queue_for_resending() {
3642 3642
 		$msg_ids = $this->_get_msg_ids_from_request();
3643 3643
 		EED_Messages::queue_for_resending( $msg_ids );
@@ -3649,9 +3649,9 @@  discard block
 block discarded – undo
3649 3649
 
3650 3650
 	/**
3651 3651
 	 *  This sends immediately any EEM_Message::status_idle or EEM_Message::status_resend messages in the queue
3652
-     *
3653
-     *  @since 4.9.0
3654
-     */
3652
+	 *
3653
+	 *  @since 4.9.0
3654
+	 */
3655 3655
 	protected function _send_now() {
3656 3656
 		$msg_ids = $this->_get_msg_ids_from_request();
3657 3657
 		EED_Messages::send_now( $msg_ids );
@@ -3663,9 +3663,9 @@  discard block
 block discarded – undo
3663 3663
 
3664 3664
 	/**
3665 3665
 	 * Deletes EE_messages for IDs in the request.
3666
-     *
3667
-     * @since 4.9.0
3668
-     */
3666
+	 *
3667
+	 * @since 4.9.0
3668
+	 */
3669 3669
 	protected function _delete_ee_messages() {
3670 3670
 		$msg_ids = $this->_get_msg_ids_from_request();
3671 3671
 		$deleted_count = 0;
@@ -3694,9 +3694,9 @@  discard block
 block discarded – undo
3694 3694
 
3695 3695
 	/**
3696 3696
 	 *  This looks for 'MSG_ID' key in the request and returns an array of MSG_ID's if present.
3697
-     *  @since 4.9.0
3698
-     *  @return array
3699
-     */
3697
+	 *  @since 4.9.0
3698
+	 *  @return array
3699
+	 */
3700 3700
 	protected function _get_msg_ids_from_request() {
3701 3701
 		if ( ! isset( $this->_req_data['MSG_ID'] ) ) {
3702 3702
 			return array();
Please login to merge, or discard this patch.
Spacing   +655 added lines, -655 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
2
-	{exit('NO direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION'))
2
+	{exit('NO direct script access allowed'); }
3 3
 
4 4
 /**
5 5
  *
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 	/**
75 75
 	 * @param bool $routing
76 76
 	 */
77
-	public function __construct( $routing = true ) {
77
+	public function __construct($routing = true) {
78 78
 		//make sure messages autoloader is running
79 79
 		EED_Messages::set_autoloaders();
80
-		parent::__construct( $routing );
80
+		parent::__construct($routing);
81 81
 	}
82 82
 
83 83
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 		$this->_activate_state = isset($this->_req_data['activate_state']) ? (array) $this->_req_data['activate_state'] : array();
93 93
 
94
-		$this->_active_messenger = isset( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : null;
94
+		$this->_active_messenger = isset($this->_req_data['messenger']) ? $this->_req_data['messenger'] : null;
95 95
 		$this->_load_message_resource_manager();
96 96
 	}
97 97
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @throws EE_Error
106 106
 	*/
107 107
 	protected function _load_message_resource_manager() {
108
-		$this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
108
+		$this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
109 109
 	}
110 110
 
111 111
 
@@ -116,21 +116,21 @@  discard block
 block discarded – undo
116 116
 	public function get_messengers_for_list_table() {
117 117
 		EE_Error::doing_it_wrong(
118 118
 			__METHOD__,
119
-			__( 'This method is no longer in use.  There is no replacement for it. The method was used to generate a set of
119
+			__('This method is no longer in use.  There is no replacement for it. The method was used to generate a set of
120 120
 			values for use in creating a messenger filter dropdown which is now generated differently via
121
-			 Messages_Admin_Page::get_messengers_select_input', 'event_espresso' ),
121
+			 Messages_Admin_Page::get_messengers_select_input', 'event_espresso'),
122 122
 			'4.9.9.rc.014'
123 123
 		);
124 124
 
125 125
 		$m_values = array();
126
-		$active_messengers = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_messenger' ) );
126
+		$active_messengers = EEM_Message::instance()->get_all(array('group_by' => 'MSG_messenger'));
127 127
 		//setup messengers for selects
128 128
 		$i = 1;
129
-		foreach ( $active_messengers as $active_messenger ) {
130
-			if ( $active_messenger instanceof EE_Message ) {
131
-				$m_values[ $i ]['id']   = $active_messenger->messenger();
132
-				$m_values[ $i ]['text'] = ucwords( $active_messenger->messenger_label() );
133
-				$i ++;
129
+		foreach ($active_messengers as $active_messenger) {
130
+			if ($active_messenger instanceof EE_Message) {
131
+				$m_values[$i]['id']   = $active_messenger->messenger();
132
+				$m_values[$i]['text'] = ucwords($active_messenger->messenger_label());
133
+				$i++;
134 134
 			}
135 135
 		}
136 136
 		return $m_values;
@@ -144,20 +144,20 @@  discard block
 block discarded – undo
144 144
 	public function get_message_types_for_list_table() {
145 145
 		EE_Error::doing_it_wrong(
146 146
 			__METHOD__,
147
-			__( 'This method is no longer in use.  There is no replacement for it. The method was used to generate a set of
147
+			__('This method is no longer in use.  There is no replacement for it. The method was used to generate a set of
148 148
 			values for use in creating a message type filter dropdown which is now generated differently via
149
-			 Messages_Admin_Page::get_message_types_select_input', 'event_espresso' ),
149
+			 Messages_Admin_Page::get_message_types_select_input', 'event_espresso'),
150 150
 			'4.9.9.rc.014'
151 151
 		);
152 152
 
153 153
 		$mt_values = array();
154
-		$active_messages = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_message_type' ) );
154
+		$active_messages = EEM_Message::instance()->get_all(array('group_by' => 'MSG_message_type'));
155 155
 		$i = 1;
156
-		foreach ( $active_messages as $active_message ) {
157
-			if ( $active_message instanceof EE_Message ) {
158
-				$mt_values[ $i ]['id']   = $active_message->message_type();
159
-				$mt_values[ $i ]['text'] = ucwords( $active_message->message_type_label() );
160
-				$i ++;
156
+		foreach ($active_messages as $active_message) {
157
+			if ($active_message instanceof EE_Message) {
158
+				$mt_values[$i]['id']   = $active_message->message_type();
159
+				$mt_values[$i]['text'] = ucwords($active_message->message_type_label());
160
+				$i++;
161 161
 			}
162 162
 		}
163 163
 		return $mt_values;
@@ -171,21 +171,21 @@  discard block
 block discarded – undo
171 171
 	public function get_contexts_for_message_types_for_list_table() {
172 172
 		EE_Error::doing_it_wrong(
173 173
 			__METHOD__,
174
-			__( 'This method is no longer in use.  There is no replacement for it. The method was used to generate a set of
174
+			__('This method is no longer in use.  There is no replacement for it. The method was used to generate a set of
175 175
 			values for use in creating a message type context filter dropdown which is now generated differently via
176
-			 Messages_Admin_Page::get_contexts_for_message_types_select_input', 'event_espresso' ),
176
+			 Messages_Admin_Page::get_contexts_for_message_types_select_input', 'event_espresso'),
177 177
 			'4.9.9.rc.014'
178 178
 		);
179 179
 
180 180
 		$contexts = array();
181
-		$active_message_contexts = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_context' ) );
182
-		foreach ( $active_message_contexts as $active_message ) {
183
-			if ( $active_message instanceof EE_Message ) {
181
+		$active_message_contexts = EEM_Message::instance()->get_all(array('group_by' => 'MSG_context'));
182
+		foreach ($active_message_contexts as $active_message) {
183
+			if ($active_message instanceof EE_Message) {
184 184
 				$message_type = $active_message->message_type_object();
185
-				if ( $message_type instanceof EE_message_type ) {
185
+				if ($message_type instanceof EE_message_type) {
186 186
 					$message_type_contexts = $message_type->get_contexts();
187
-					foreach ( $message_type_contexts as $context => $context_details ) {
188
-						$contexts[ $context ] = $context_details['label'];
187
+					foreach ($message_type_contexts as $context => $context_details) {
188
+						$contexts[$context] = $context_details['label'];
189 189
 					}
190 190
 				}
191 191
 			}
@@ -201,17 +201,17 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @return string
203 203
 	 */
204
-	public function get_messengers_select_input( $messenger_options ) {
204
+	public function get_messengers_select_input($messenger_options) {
205 205
 		//if empty or just one value then just return an empty string
206
-		if ( empty( $messenger_options )
207
-		     || ! is_array( $messenger_options )
208
-		     ||  count( $messenger_options ) === 1
206
+		if (empty($messenger_options)
207
+		     || ! is_array($messenger_options)
208
+		     ||  count($messenger_options) === 1
209 209
 		) {
210 210
 			return '';
211 211
 		}
212 212
 		//merge in default
213 213
 		$messenger_options = array_merge(
214
-			array( 'none_selected' => __( 'Show All Messengers', 'event_espresso' ) ),
214
+			array('none_selected' => __('Show All Messengers', 'event_espresso')),
215 215
 			$messenger_options
216 216
 		);
217 217
 		$input = new EE_Select_Input(
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 				'html_name'  => 'ee_messenger_filter_by',
221 221
 				'html_id'    => 'ee_messenger_filter_by',
222 222
 				'html_class' => 'wide',
223
-				'default'    => isset( $this->_req_data['ee_messenger_filter_by'] )
224
-					? sanitize_title( $this->_req_data['ee_messenger_filter_by'] )
223
+				'default'    => isset($this->_req_data['ee_messenger_filter_by'])
224
+					? sanitize_title($this->_req_data['ee_messenger_filter_by'])
225 225
 					: 'none_selected'
226 226
 			)
227 227
 		);
@@ -237,17 +237,17 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @return string
239 239
 	 */
240
-	public function get_message_types_select_input( $message_type_options ) {
240
+	public function get_message_types_select_input($message_type_options) {
241 241
 		//if empty or count of options is 1 then just return an empty string
242
-		if ( empty( $message_type_options )
243
-			|| ! is_array( $message_type_options )
244
-			|| count( $message_type_options ) === 1
242
+		if (empty($message_type_options)
243
+			|| ! is_array($message_type_options)
244
+			|| count($message_type_options) === 1
245 245
 		) {
246 246
 			return '';
247 247
 		}
248 248
 		//merge in default
249 249
 		$message_type_options = array_merge(
250
-			array( 'none_selected' => __( 'Show All Message Types', 'event_espresso' ) ),
250
+			array('none_selected' => __('Show All Message Types', 'event_espresso')),
251 251
 			$message_type_options
252 252
 		);
253 253
 		$input = new EE_Select_Input(
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 				'html_name'  => 'ee_message_type_filter_by',
257 257
 				'html_id'    => 'ee_message_type_filter_by',
258 258
 				'html_class' => 'wide',
259
-				'default'    => isset( $this->_req_data['ee_message_type_filter_by'] )
260
-					? sanitize_title( $this->_req_data['ee_message_type_filter_by'] )
259
+				'default'    => isset($this->_req_data['ee_message_type_filter_by'])
260
+					? sanitize_title($this->_req_data['ee_message_type_filter_by'])
261 261
 					: 'none_selected',
262 262
 			)
263 263
 		);
@@ -273,17 +273,17 @@  discard block
 block discarded – undo
273 273
 	 *
274 274
 	 * @return string
275 275
 	 */
276
-	public function get_contexts_for_message_types_select_input( $context_options ) {
276
+	public function get_contexts_for_message_types_select_input($context_options) {
277 277
 		//if empty or count of options is one then just return empty string
278
-		if ( empty( $context_options )
279
-			|| ! is_array( $context_options )
280
-			|| count( $context_options ) === 1
278
+		if (empty($context_options)
279
+			|| ! is_array($context_options)
280
+			|| count($context_options) === 1
281 281
 		) {
282 282
 			return '';
283 283
 		}
284 284
 		//merge in default
285 285
 		$context_options = array_merge(
286
-			array( 'none_selected' => __( 'Show all Contexts', 'event_espresso' ) ),
286
+			array('none_selected' => __('Show all Contexts', 'event_espresso')),
287 287
 			$context_options
288 288
 		);
289 289
 		$input = new EE_Select_Input(
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
 				'html_name'  => 'ee_context_filter_by',
293 293
 				'html_id'    => 'ee_context_filter_by',
294 294
 				'html_class' => 'wide',
295
-				'default'    => isset( $this->_req_data['ee_context_filter_by'] )
296
-					? sanitize_title( $this->_req_data['ee_context_filter_by'] )
295
+				'default'    => isset($this->_req_data['ee_context_filter_by'])
296
+					? sanitize_title($this->_req_data['ee_context_filter_by'])
297 297
 					: 'none_selected',
298 298
 			)
299 299
 		);
@@ -303,11 +303,11 @@  discard block
 block discarded – undo
303 303
 
304 304
 
305 305
 	protected function _ajax_hooks() {
306
-		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle' ) );
307
-		add_action('wp_ajax_activate_mt', array( $this, 'activate_mt_toggle') );
308
-		add_action('wp_ajax_ee_msgs_save_settings', array( $this, 'save_settings') );
309
-		add_action('wp_ajax_ee_msgs_update_mt_form', array( $this, 'update_mt_form' ) );
310
-		add_action('wp_ajax_switch_template_pack', array( $this, 'switch_template_pack' ) );
306
+		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle'));
307
+		add_action('wp_ajax_activate_mt', array($this, 'activate_mt_toggle'));
308
+		add_action('wp_ajax_ee_msgs_save_settings', array($this, 'save_settings'));
309
+		add_action('wp_ajax_ee_msgs_update_mt_form', array($this, 'update_mt_form'));
310
+		add_action('wp_ajax_switch_template_pack', array($this, 'switch_template_pack'));
311 311
 	}
312 312
 
313 313
 
@@ -339,13 +339,13 @@  discard block
 block discarded – undo
339 339
 	*		@return void
340 340
 	*/
341 341
 	protected function _set_page_routes() {
342
-		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] )
342
+		$grp_id = ! empty($this->_req_data['GRP_ID']) && ! is_array($this->_req_data['GRP_ID'])
343 343
 			? $this->_req_data['GRP_ID']
344 344
 			: 0;
345
-		$grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] )
345
+		$grp_id = empty($grp_id) && ! empty($this->_req_data['id'])
346 346
 			? $this->_req_data['id']
347 347
 			: $grp_id;
348
-		$msg_id = ! empty( $this->_req_data['MSG_ID'] ) && ! is_array( $this->_req_data['MSG_ID'] )
348
+		$msg_id = ! empty($this->_req_data['MSG_ID']) && ! is_array($this->_req_data['MSG_ID'])
349 349
 			? $this->_req_data['MSG_ID']
350 350
 			: 0;
351 351
 
@@ -387,35 +387,35 @@  discard block
 block discarded – undo
387 387
 			'insert_message_template' => array(
388 388
 				'func' => '_insert_or_update_message_template',
389 389
 				'capability' => 'ee_edit_messages',
390
-				'args' => array( 'new_template' => true ),
390
+				'args' => array('new_template' => true),
391 391
 				'noheader' => true
392 392
 			 ),
393 393
 			'update_message_template' => array(
394 394
 				'func' => '_insert_or_update_message_template',
395 395
 				'capability' => 'ee_edit_message',
396 396
 				'obj_id' => $grp_id,
397
-				'args' => array( 'new_template' => false ),
397
+				'args' => array('new_template' => false),
398 398
 				'noheader' => true
399 399
 			),
400 400
 			'trash_message_template' => array(
401 401
 				'func' => '_trash_or_restore_message_template',
402 402
 				'capability' => 'ee_delete_message',
403 403
 				'obj_id' => $grp_id,
404
-				'args' => array( 'trash' => true, 'all' => true ),
404
+				'args' => array('trash' => true, 'all' => true),
405 405
 				'noheader' => true
406 406
 			),
407 407
 			'trash_message_template_context' => array(
408 408
 				'func' => '_trash_or_restore_message_template',
409 409
 				'capability' => 'ee_delete_message',
410 410
 				'obj_id' => $grp_id,
411
-				'args' => array( 'trash' => true ),
411
+				'args' => array('trash' => true),
412 412
 				'noheader' => true
413 413
 			),
414 414
 			'restore_message_template' => array(
415 415
 				'func' => '_trash_or_restore_message_template',
416 416
 				'capability' => 'ee_delete_message',
417 417
 				'obj_id' => $grp_id,
418
-				'args' => array( 'trash' => false, 'all' => true ),
418
+				'args' => array('trash' => false, 'all' => true),
419 419
 				'noheader' => true
420 420
 			),
421 421
 			'restore_message_template_context' => array(
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 						'filename' => 'messages_overview_other',
535 535
 					),
536 536
 				),
537
-				'help_tour' => array( 'Messages_Overview_Help_Tour' ),
537
+				'help_tour' => array('Messages_Overview_Help_Tour'),
538 538
 				'require_nonce' => false
539 539
 			),
540 540
 			'custom_mtps' => array(
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 				),
570 570
 				'metaboxes' => array('_publish_post_box', '_register_edit_meta_boxes'),
571 571
 				'has_metaboxes' => true,
572
-				'help_tour' => array( 'Message_Templates_Edit_Help_Tour' ),
572
+				'help_tour' => array('Message_Templates_Edit_Help_Tour'),
573 573
 				'help_tabs' => array(
574 574
 					'edit_message_template' => array(
575 575
 						'title' => __('Message Template Editor', 'event_espresso'),
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 						'filename' => 'messages_settings_messengers'
626 626
 					),
627 627
 				),
628
-				'help_tour' => array( 'Messages_Settings_Help_Tour' ),
628
+				'help_tour' => array('Messages_Settings_Help_Tour'),
629 629
 				'require_nonce' => false
630 630
 			)
631 631
 		);
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 
659 659
 
660 660
 	protected function _add_screen_options_default() {
661
-		$this->_admin_page_title = __( 'Message Activity', 'event_espresso' );
661
+		$this->_admin_page_title = __('Message Activity', 'event_espresso');
662 662
 		$this->_per_page_screen_option();
663 663
 	}
664 664
 
@@ -680,37 +680,37 @@  discard block
 block discarded – undo
680 680
 
681 681
 
682 682
 	public function messages_help_tab() {
683
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php' );
683
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php');
684 684
 	}
685 685
 
686 686
 
687 687
 	public function messengers_help_tab() {
688
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php' );
688
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php');
689 689
 	}
690 690
 
691 691
 
692 692
 	public function message_types_help_tab() {
693
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php' );
693
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php');
694 694
 	}
695 695
 
696 696
 
697 697
 	public function messages_overview_help_tab() {
698
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php' );
698
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php');
699 699
 	}
700 700
 
701 701
 
702 702
 	public function message_templates_help_tab() {
703
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php' );
703
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php');
704 704
 	}
705 705
 
706 706
 
707 707
 	public function edit_message_template_help_tab() {
708
-		$args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />';
709
-		$args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />';
710
-		$args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />';
711
-		$args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />';
712
-		$args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />';
713
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php', $args);
708
+		$args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />';
709
+		$args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />';
710
+		$args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />';
711
+		$args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />';
712
+		$args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />';
713
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php', $args);
714 714
 	}
715 715
 
716 716
 
@@ -718,22 +718,22 @@  discard block
 block discarded – undo
718 718
 	public function message_template_shortcodes_help_tab() {
719 719
 		$this->_set_shortcodes();
720 720
 		$args['shortcodes'] = $this->_shortcodes;
721
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php', $args );
721
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php', $args);
722 722
 	}
723 723
 
724 724
 
725 725
 
726 726
 	public function preview_message_help_tab() {
727
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php' );
727
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php');
728 728
 	}
729 729
 
730 730
 
731 731
 	public function settings_help_tab() {
732
-		$args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />';
733
-		$args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />';
732
+		$args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />';
733
+		$args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />';
734 734
 		$args['img3'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked"><label for="ee-on-off-toggle-on"></label>';
735 735
 		$args['img4'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox"><label for="ee-on-off-toggle-on"></label>';
736
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php', $args);
736
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php', $args);
737 737
 	}
738 738
 
739 739
 
@@ -741,31 +741,31 @@  discard block
 block discarded – undo
741 741
 
742 742
 
743 743
 	public function load_scripts_styles() {
744
-		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION );
744
+		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION);
745 745
 		wp_enqueue_style('espresso_ee_msg');
746 746
 
747
-		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL . 'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true );
748
-		wp_register_script( 'ee-msg-list-table-js', EE_MSG_ASSETS_URL. 'ee_message_admin_list_table.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION );
747
+		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL.'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true);
748
+		wp_register_script('ee-msg-list-table-js', EE_MSG_ASSETS_URL.'ee_message_admin_list_table.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION);
749 749
 	}
750 750
 
751 751
 
752 752
 
753 753
 	public function load_scripts_styles_default() {
754
-		wp_enqueue_script( 'ee-msg-list-table-js' );
754
+		wp_enqueue_script('ee-msg-list-table-js');
755 755
 	}
756 756
 
757 757
 
758 758
 
759 759
 
760 760
 
761
-	public function wp_editor_css( $mce_css ) {
761
+	public function wp_editor_css($mce_css) {
762 762
 		//if we're on the edit_message_template route
763
-		if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger  ) {
763
+		if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) {
764 764
 			$message_type_name = $this->_active_message_type_name;
765 765
 
766 766
 			//we're going to REPLACE the existing mce css
767 767
 			//we need to get the css file location from the active messenger
768
-			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation );
768
+			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation);
769 769
 		}
770 770
 
771 771
 		return $mce_css;
@@ -783,15 +783,15 @@  discard block
 block discarded – undo
783 783
 			$this->_message_template_group->messenger_obj()->label['singular'],
784 784
 			$this->_message_template_group->message_type_obj()->label['singular']
785 785
 		);
786
-		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso' );
786
+		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso');
787 787
 
788
-		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION );
788
+		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION);
789 789
 
790 790
 		wp_enqueue_script('ee_admin_js');
791 791
 		wp_enqueue_script('ee_msgs_edit_js');
792 792
 
793 793
 		//add in special css for tiny_mce
794
-		add_filter( 'mce_css', array( $this, 'wp_editor_css' ) );
794
+		add_filter('mce_css', array($this, 'wp_editor_css'));
795 795
 	}
796 796
 
797 797
 
@@ -800,22 +800,22 @@  discard block
 block discarded – undo
800 800
 
801 801
 		$this->_set_message_template_group();
802 802
 
803
-		if ( isset( $this->_req_data['messenger'] ) ) {
804
-			$this->_active_messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] );
803
+		if (isset($this->_req_data['messenger'])) {
804
+			$this->_active_messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']);
805 805
 		}
806 806
 
807
-		$message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : '';
807
+		$message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : '';
808 808
 
809 809
 
810
-		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, true, 'preview', $this->_variation ) );
810
+		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'preview', $this->_variation));
811 811
 	}
812 812
 
813 813
 
814 814
 
815 815
 	public function load_scripts_styles_settings() {
816
-		wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION );
817
-		wp_enqueue_style( 'ee-text-links' );
818
-		wp_enqueue_style( 'ee-message-settings' );
816
+		wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION);
817
+		wp_enqueue_style('ee-text-links');
818
+		wp_enqueue_style('ee-message-settings');
819 819
 
820 820
 		wp_enqueue_script('ee-messages-settings');
821 821
 	}
@@ -845,40 +845,40 @@  discard block
 block discarded – undo
845 845
 	 * set views array for message queue list table
846 846
 	 */
847 847
 	public function _set_list_table_views_default() {
848
-		EE_Registry::instance()->load_helper( 'Template' );
848
+		EE_Registry::instance()->load_helper('Template');
849 849
 
850
-		$common_bulk_actions = EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'message_list_table_bulk_actions' )
850
+		$common_bulk_actions = EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'message_list_table_bulk_actions')
851 851
 			? array(
852
-				'generate_now' => __( 'Generate Now', 'event_espresso' ),
853
-		        'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ),
854
-		        'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ),
855
-		        'send_now' => __( 'Send Now', 'event_espresso' )
852
+				'generate_now' => __('Generate Now', 'event_espresso'),
853
+		        'generate_and_send_now' => __('Generate and Send Now', 'event_espresso'),
854
+		        'queue_for_resending' => __('Queue for Resending', 'event_espresso'),
855
+		        'send_now' => __('Send Now', 'event_espresso')
856 856
 				)
857 857
 			: array();
858 858
 
859
-		$delete_bulk_action = EE_Registry::instance()->CAP->current_user_can( 'ee_delete_messages', 'message_list_table_bulk_actions' )
860
-			? array( 'delete_ee_messages' => __( 'Delete Messages', 'event_espresso' ) )
859
+		$delete_bulk_action = EE_Registry::instance()->CAP->current_user_can('ee_delete_messages', 'message_list_table_bulk_actions')
860
+			? array('delete_ee_messages' => __('Delete Messages', 'event_espresso'))
861 861
 			: array();
862 862
 
863 863
 
864 864
 		$this->_views = array(
865 865
 			 'all' => array(
866 866
 			    'slug' => 'all',
867
-			    'label' => __( 'All', 'event_espresso' ),
867
+			    'label' => __('All', 'event_espresso'),
868 868
 			    'count' => 0,
869
-			    'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action )
869
+			    'bulk_action' => array_merge($common_bulk_actions, $delete_bulk_action)
870 870
 			 )
871 871
 		);
872 872
 
873 873
 
874
-		foreach ( EEM_Message::instance()->all_statuses() as $status ) {
875
-			if ( $status === EEM_Message::status_debug_only && ! EEM_Message::debug() ) {
874
+		foreach (EEM_Message::instance()->all_statuses() as $status) {
875
+			if ($status === EEM_Message::status_debug_only && ! EEM_Message::debug()) {
876 876
 				continue;
877 877
 			}
878 878
 			$status_bulk_actions = $common_bulk_actions;
879 879
 			//unset bulk actions not applying to status
880
-			if ( ! empty( $status_bulk_actions ) ) {
881
-				switch ( $status ) {
880
+			if ( ! empty($status_bulk_actions)) {
881
+				switch ($status) {
882 882
 					case EEM_Message::status_idle :
883 883
 					case EEM_Message::status_resend :
884 884
 						$status_bulk_actions['send_now'] = $common_bulk_actions['send_now'];
@@ -890,21 +890,21 @@  discard block
 block discarded – undo
890 890
 						break;
891 891
 
892 892
 					case EEM_Message::status_incomplete :
893
-						unset( $status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now'] );
893
+						unset($status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now']);
894 894
 						break;
895 895
 
896 896
 					case EEM_Message::status_retry :
897 897
 					case EEM_Message::status_sent :
898
-						unset( $status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now'] );
898
+						unset($status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now']);
899 899
 						break;
900 900
 				}
901 901
 			}
902 902
 
903
-			$this->_views[ strtolower( $status ) ] = array(
904
-				'slug' => strtolower( $status ),
905
-				'label' => EEH_Template::pretty_status( $status, false, 'sentence' ),
903
+			$this->_views[strtolower($status)] = array(
904
+				'slug' => strtolower($status),
905
+				'label' => EEH_Template::pretty_status($status, false, 'sentence'),
906 906
 				'count' => 0,
907
-				'bulk_action' => array_merge( $status_bulk_actions, $delete_bulk_action )
907
+				'bulk_action' => array_merge($status_bulk_actions, $delete_bulk_action)
908 908
 			);
909 909
 		}
910 910
 	}
@@ -923,8 +923,8 @@  discard block
 block discarded – undo
923 923
 	protected function _message_queue_list_table() {
924 924
 		$this->_search_btn_label = __('Message Activity', 'event_espresso');
925 925
 		$this->_template_args['per_column'] = 6;
926
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_message_legend_items() );
927
-		$this->_template_args['before_list_table'] = '<h3>' . EEM_Message::instance()->get_pretty_label_for_results() . '</h3>';
926
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_message_legend_items());
927
+		$this->_template_args['before_list_table'] = '<h3>'.EEM_Message::instance()->get_pretty_label_for_results().'</h3>';
928 928
 		$this->display_admin_list_table_page_with_no_sidebar();
929 929
 	}
930 930
 
@@ -937,8 +937,8 @@  discard block
 block discarded – undo
937 937
 		$action_css_classes = EEH_MSG_Template::get_message_action_icons();
938 938
 		$action_items = array();
939 939
 
940
-		foreach( $action_css_classes as $action_item => $action_details ) {
941
-			if ( $action_item === 'see_notifications_for' ) {
940
+		foreach ($action_css_classes as $action_item => $action_details) {
941
+			if ($action_item === 'see_notifications_for') {
942 942
 				continue;
943 943
 			}
944 944
 			$action_items[$action_item] = array(
@@ -950,37 +950,37 @@  discard block
 block discarded – undo
950 950
 		/** @type array $status_items status legend setup*/
951 951
 		$status_items = array(
952 952
 			'sent_status' => array(
953
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_sent,
954
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_sent, false, 'sentence' )
953
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_sent,
954
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_sent, false, 'sentence')
955 955
 				),
956 956
 			'idle_status' => array(
957
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_idle,
958
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_idle, false, 'sentence' )
957
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_idle,
958
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_idle, false, 'sentence')
959 959
 				),
960 960
 			'failed_status' => array(
961
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_failed,
962
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_failed, false, 'sentence' )
961
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_failed,
962
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_failed, false, 'sentence')
963 963
 			),
964 964
 			'resend_status' => array(
965
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_resend,
966
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_resend, false, 'sentence' )
965
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_resend,
966
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_resend, false, 'sentence')
967 967
 				),
968 968
 			'incomplete_status' => array(
969
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_incomplete,
970
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_incomplete, false, 'sentence' )
969
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_incomplete,
970
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_incomplete, false, 'sentence')
971 971
 				),
972 972
 			'retry_status' => array(
973
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_retry,
974
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_retry, false, 'sentence' )
973
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_retry,
974
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_retry, false, 'sentence')
975 975
 				)
976 976
 		);
977
-		if ( EEM_Message::debug() ) {
977
+		if (EEM_Message::debug()) {
978 978
 			$status_items['debug_only_status'] = array(
979
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_debug_only,
980
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_debug_only, false, 'sentence' )
979
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_debug_only,
980
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_debug_only, false, 'sentence')
981 981
 			);
982 982
 		}
983
-		return array_merge( $action_items, $status_items );
983
+		return array_merge($action_items, $status_items);
984 984
 	}
985 985
 
986 986
 
@@ -990,9 +990,9 @@  discard block
 block discarded – undo
990 990
 
991 991
 	protected function _custom_mtps_preview() {
992 992
 		$this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso');
993
-		$this->_template_args['preview_img'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/custom_mtps_preview.png" alt="' . esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso' ) . '" />';
993
+		$this->_template_args['preview_img'] = '<img src="'.EE_MSG_ASSETS_URL.'images/custom_mtps_preview.png" alt="'.esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso').'" />';
994 994
 		$this->_template_args['preview_text'] = '<strong>'.__('Custom Message Templates is a feature that is only available in the caffeinated version of Event Espresso.  With the Custom Message Templates feature, you are able to create custom templates and set them per event.', 'event_espresso').'</strong>';
995
-		$this->display_admin_caf_preview_page( 'custom_message_types', false );
995
+		$this->display_admin_caf_preview_page('custom_message_types', false);
996 996
 	}
997 997
 
998 998
 
@@ -1016,31 +1016,31 @@  discard block
 block discarded – undo
1016 1016
 	 *
1017 1017
 	 * @return array
1018 1018
 	 */
1019
-	public function get_message_templates( $perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true ) {
1019
+	public function get_message_templates($perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true) {
1020 1020
 
1021 1021
 		$MTP = EEM_Message_Template_Group::instance();
1022 1022
 
1023 1023
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby'];
1024 1024
 		$orderby = $this->_req_data['orderby'];
1025 1025
 
1026
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC';
1026
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
1027 1027
 
1028
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1029
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage;
1028
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1029
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage;
1030 1030
 
1031
-		$offset = ($current_page-1)*$per_page;
1032
-		$limit = $all ? null : array( $offset, $per_page );
1031
+		$offset = ($current_page - 1) * $per_page;
1032
+		$limit = $all ? null : array($offset, $per_page);
1033 1033
 
1034 1034
 
1035 1035
 		//options will match what is in the _views array property
1036
-		switch( $type ) {
1036
+		switch ($type) {
1037 1037
 
1038 1038
 			case 'in_use':
1039
-				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true );
1039
+				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true);
1040 1040
 				break;
1041 1041
 
1042 1042
 			default:
1043
-				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global );
1043
+				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global);
1044 1044
 
1045 1045
 		}
1046 1046
 
@@ -1059,8 +1059,8 @@  discard block
 block discarded – undo
1059 1059
 		$installed_message_types = $this->_message_resource_manager->installed_message_types();
1060 1060
 		$installed = array();
1061 1061
 
1062
-		foreach ( $installed_message_types as $message_type ) {
1063
-			$installed[ $message_type->name ] = $message_type;
1062
+		foreach ($installed_message_types as $message_type) {
1063
+			$installed[$message_type->name] = $message_type;
1064 1064
 		}
1065 1065
 
1066 1066
 		return $installed;
@@ -1079,24 +1079,24 @@  discard block
 block discarded – undo
1079 1079
 	 *
1080 1080
 	 * @throws EE_error
1081 1081
 	 */
1082
-	protected function _add_message_template(  $message_type = '', $messenger='', $GRP_ID = '' ) {
1082
+	protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') {
1083 1083
 		//set values override any request data
1084
-		$message_type = !empty( $message_type ) ? $message_type : '';
1085
-		$message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type;
1084
+		$message_type = ! empty($message_type) ? $message_type : '';
1085
+		$message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type;
1086 1086
 
1087
-		$messenger = !empty( $messenger ) ? $messenger : '';
1088
-		$messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger;
1087
+		$messenger = ! empty($messenger) ? $messenger : '';
1088
+		$messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger;
1089 1089
 
1090
-		$GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : '';
1091
-		$GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID;
1090
+		$GRP_ID = ! empty($GRP_ID) ? $GRP_ID : '';
1091
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID;
1092 1092
 
1093 1093
 		//we need messenger and message type.  They should be coming from the event editor. If not here then return error
1094
-		if ( empty( $message_type ) || empty( $messenger )  )
1095
-			{throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));}
1094
+		if (empty($message_type) || empty($messenger))
1095
+			{throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso')); }
1096 1096
 
1097 1097
 		//we need the GRP_ID for the template being used as the base for the new template
1098
-		if ( empty( $GRP_ID ) )
1099
-			{throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );}
1098
+		if (empty($GRP_ID))
1099
+			{throw new EE_Error(__('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso')); }
1100 1100
 
1101 1101
 		//let's just make sure the template gets generated!
1102 1102
 
@@ -1117,8 +1117,8 @@  discard block
 block discarded – undo
1117 1117
 	 * @param int      $GRP_ID         GRP_ID for the related message template group this new template will be based
1118 1118
 	 *                                 off of.
1119 1119
 	 */
1120
-	public function add_message_template( $message_type, $messenger, $GRP_ID ) {
1121
-		$this->_add_message_template( $message_type, $messenger, $GRP_ID );
1120
+	public function add_message_template($message_type, $messenger, $GRP_ID) {
1121
+		$this->_add_message_template($message_type, $messenger, $GRP_ID);
1122 1122
 	}
1123 1123
 
1124 1124
 
@@ -1129,14 +1129,14 @@  discard block
 block discarded – undo
1129 1129
 	 * @return void
1130 1130
 	 */
1131 1131
 	protected function _edit_message_template() {
1132
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '');
1132
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1133 1133
 		$template_fields = '';
1134 1134
 		$sidebar_fields = '';
1135 1135
 		//we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates.
1136
-		add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 );
1136
+		add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2);
1137 1137
 
1138
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] )
1139
-			? absint( $this->_req_data['id'] )
1138
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id'])
1139
+			? absint($this->_req_data['id'])
1140 1140
 			: false;
1141 1141
 
1142 1142
 		$this->_set_shortcodes(); //this also sets the _message_template property.
@@ -1144,20 +1144,20 @@  discard block
 block discarded – undo
1144 1144
 		$c_label = $message_template_group->context_label();
1145 1145
 		$c_config = $message_template_group->contexts_config();
1146 1146
 
1147
-		reset( $c_config );
1148
-		$context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] )
1147
+		reset($c_config);
1148
+		$context = isset($this->_req_data['context']) && ! empty($this->_req_data['context'])
1149 1149
 			? strtolower($this->_req_data['context'])
1150 1150
 			: key($c_config);
1151 1151
 
1152 1152
 
1153
-		if ( empty($GRP_ID) ) {
1153
+		if (empty($GRP_ID)) {
1154 1154
 			$action = 'insert_message_template';
1155 1155
 			//$button_both = false;
1156 1156
 			//$button_text = array( __( 'Save','event_espresso') );
1157 1157
 			//$button_actions = array('something_different');
1158 1158
 			//$referrer = false;
1159 1159
 			$edit_message_template_form_url = add_query_arg(
1160
-				array( 'action' => $action, 'noheader' => true ),
1160
+				array('action' => $action, 'noheader' => true),
1161 1161
 				EE_MSG_ADMIN_URL
1162 1162
 			);
1163 1163
 		} else {
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 			//$button_actions = array();
1168 1168
 			//$referrer = $this->_admin_base_url;
1169 1169
 			$edit_message_template_form_url = add_query_arg(
1170
-				array( 'action' => $action, 'noheader' => true ),
1170
+				array('action' => $action, 'noheader' => true),
1171 1171
 				EE_MSG_ADMIN_URL
1172 1172
 			);
1173 1173
 		}
@@ -1181,14 +1181,14 @@  discard block
 block discarded – undo
1181 1181
 
1182 1182
 		//Do we have any validation errors?
1183 1183
 		$validators = $this->_get_transient();
1184
-		$v_fields = !empty($validators) ? array_keys($validators) : array();
1184
+		$v_fields = ! empty($validators) ? array_keys($validators) : array();
1185 1185
 
1186 1186
 
1187 1187
 		//we need to assemble the title from Various details
1188 1188
 		$context_label = sprintf(
1189 1189
 			__('(%s %s)', 'event_espresso'),
1190 1190
 			$c_config[$context]['label'],
1191
-			ucwords($c_label['label'] )
1191
+			ucwords($c_label['label'])
1192 1192
 		);
1193 1193
 
1194 1194
 		$title = sprintf(
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
 			$message_template_group->message_type()
1210 1210
 		);
1211 1211
 
1212
-		if ( !$template_field_structure ) {
1212
+		if ( ! $template_field_structure) {
1213 1213
 			$template_field_structure = false;
1214 1214
 			$template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso');
1215 1215
 		}
@@ -1219,51 +1219,51 @@  discard block
 block discarded – undo
1219 1219
 
1220 1220
 
1221 1221
 		//if we have the extra key.. then we need to remove the content index from the template_field_structure as it will get handled in the "extra" array.
1222
-		if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) {
1223
-			foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) {
1224
-				unset( $template_field_structure[$context][$reference_field] );
1222
+		if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) {
1223
+			foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) {
1224
+				unset($template_field_structure[$context][$reference_field]);
1225 1225
 			}
1226 1226
 		}
1227 1227
 
1228 1228
 		//let's loop through the template_field_structure and actually assemble the input fields!
1229
-		if ( !empty($template_field_structure) ) {
1230
-			foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) {
1229
+		if ( ! empty($template_field_structure)) {
1230
+			foreach ($template_field_structure[$context] as $template_field => $field_setup_array) {
1231 1231
 				//if this is an 'extra' template field then we need to remove any existing fields that are keyed up in the extra array and reset them.
1232
-				if ( $template_field == 'extra' ) {
1232
+				if ($template_field == 'extra') {
1233 1233
 					$this->_template_args['is_extra_fields'] = true;
1234
-					foreach ( $field_setup_array as $reference_field => $new_fields_array ) {
1235
-						$message_template = $message_templates[ $context ][ $reference_field ];
1234
+					foreach ($field_setup_array as $reference_field => $new_fields_array) {
1235
+						$message_template = $message_templates[$context][$reference_field];
1236 1236
 						$content = $message_template instanceof EE_Message_Template
1237
-							? $message_template->get( 'MTP_content' )
1237
+							? $message_template->get('MTP_content')
1238 1238
 							: '';
1239
-						foreach ( $new_fields_array as $extra_field =>  $extra_array ) {
1239
+						foreach ($new_fields_array as $extra_field =>  $extra_array) {
1240 1240
 							//let's verify if we need this extra field via the shortcodes parameter.
1241 1241
 							$continue = false;
1242
-							if ( isset( $extra_array['shortcodes_required'] ) ) {
1243
-								foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) {
1244
-									if ( !array_key_exists( $shortcode, $this->_shortcodes ) )
1245
-										{$continue = true;}
1242
+							if (isset($extra_array['shortcodes_required'])) {
1243
+								foreach ((array) $extra_array['shortcodes_required'] as $shortcode) {
1244
+									if ( ! array_key_exists($shortcode, $this->_shortcodes))
1245
+										{$continue = true; }
1246 1246
 								}
1247
-								if ( $continue ) {continue;}
1247
+								if ($continue) {continue; }
1248 1248
 							}
1249 1249
 
1250
-							$field_id = $reference_field . '-' . $extra_field . '-content';
1250
+							$field_id = $reference_field.'-'.$extra_field.'-content';
1251 1251
 							$template_form_fields[$field_id] = $extra_array;
1252
-							$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']';
1253
-							$css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : '';
1252
+							$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']';
1253
+							$css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : '';
1254 1254
 
1255
-							$template_form_fields[$field_id]['css_class'] = ! empty( $v_fields )
1255
+							$template_form_fields[$field_id]['css_class'] = ! empty($v_fields)
1256 1256
 																			&& in_array($extra_field, $v_fields)
1257 1257
 																			&&
1258 1258
 																			(
1259
-								                                                is_array($validators[$extra_field] )
1260
-																				&& isset( $validators[$extra_field]['msg'] )
1259
+								                                                is_array($validators[$extra_field])
1260
+																				&& isset($validators[$extra_field]['msg'])
1261 1261
 							                                                )
1262
-								? 'validate-error ' . $css_class
1262
+								? 'validate-error '.$css_class
1263 1263
 								: $css_class;
1264 1264
 
1265
-							$template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field])
1266
-								? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") )
1265
+							$template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field])
1266
+								? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8"))
1267 1267
 								: '';
1268 1268
 
1269 1269
 							//do we have a validation error?  if we do then let's use that value instead
@@ -1279,32 +1279,32 @@  discard block
 block discarded – undo
1279 1279
 								$field_id
1280 1280
 							);
1281 1281
 
1282
-							if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) {
1282
+							if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') {
1283 1283
 								//we want to decode the entities
1284 1284
 								$template_form_fields[$field_id]['value'] = stripslashes(
1285
-									html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8")
1285
+									html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8")
1286 1286
 								);
1287 1287
 
1288 1288
 							}/**/
1289 1289
 						}
1290
-						$templatefield_MTP_id = $reference_field . '-MTP_ID';
1291
-						$templatefield_templatename_id = $reference_field . '-name';
1290
+						$templatefield_MTP_id = $reference_field.'-MTP_ID';
1291
+						$templatefield_templatename_id = $reference_field.'-name';
1292 1292
 
1293 1293
 						$template_form_fields[$templatefield_MTP_id] = array(
1294
-							'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]',
1294
+							'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]',
1295 1295
 							'label' => null,
1296 1296
 							'input' => 'hidden',
1297 1297
 							'type' => 'int',
1298 1298
 							'required' => false,
1299 1299
 							'validation' => false,
1300
-							'value' => !empty($message_templates) ? $message_template->ID() : '',
1300
+							'value' => ! empty($message_templates) ? $message_template->ID() : '',
1301 1301
 							'css_class' => '',
1302 1302
 							'format' => '%d',
1303 1303
 							'db-col' => 'MTP_ID'
1304 1304
 						);
1305 1305
 
1306 1306
 						$template_form_fields[$templatefield_templatename_id] = array(
1307
-							'name' => 'MTP_template_fields[' . $reference_field . '][name]',
1307
+							'name' => 'MTP_template_fields['.$reference_field.'][name]',
1308 1308
 							'label' => null,
1309 1309
 							'input' => 'hidden',
1310 1310
 							'type' => 'string',
@@ -1318,14 +1318,14 @@  discard block
 block discarded – undo
1318 1318
 					}
1319 1319
 					continue; //skip the next stuff, we got the necessary fields here for this dataset.
1320 1320
 				} else {
1321
-					$field_id = $template_field . '-content';
1321
+					$field_id = $template_field.'-content';
1322 1322
 					$template_form_fields[$field_id] = $field_setup_array;
1323
-					$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]';
1324
-					$message_template = isset( $message_templates[ $context ][ $template_field ] )
1325
-						? $message_templates[ $context ][ $template_field ]
1323
+					$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]';
1324
+					$message_template = isset($message_templates[$context][$template_field])
1325
+						? $message_templates[$context][$template_field]
1326 1326
 						: null;
1327
-					$template_form_fields[$field_id]['value'] = ! empty( $message_templates )
1328
-																&& is_array( $message_templates[$context] )
1327
+					$template_form_fields[$field_id]['value'] = ! empty($message_templates)
1328
+																&& is_array($message_templates[$context])
1329 1329
 																&& $message_template instanceof EE_Message_Template
1330 1330
 						? $message_template->get('MTP_content')
1331 1331
 						: '';
@@ -1338,10 +1338,10 @@  discard block
 block discarded – undo
1338 1338
 
1339 1339
 					$template_form_fields[$field_id]['db-col'] = 'MTP_content';
1340 1340
 					$css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : '';
1341
-					$template_form_fields[$field_id]['css_class'] =  ! empty( $v_fields )
1342
-																	 && in_array( $template_field, $v_fields )
1343
-																	 && isset( $validators[$template_field]['msg'] )
1344
-						? 'validate-error ' . $css_class
1341
+					$template_form_fields[$field_id]['css_class'] = ! empty($v_fields)
1342
+																	 && in_array($template_field, $v_fields)
1343
+																	 && isset($validators[$template_field]['msg'])
1344
+						? 'validate-error '.$css_class
1345 1345
 						: $css_class;
1346 1346
 
1347 1347
 					//shortcode selector
@@ -1352,12 +1352,12 @@  discard block
 block discarded – undo
1352 1352
 
1353 1353
 				//k took care of content field(s) now let's take care of others.
1354 1354
 
1355
-				$templatefield_MTP_id = $template_field . '-MTP_ID';
1356
-				$templatefield_field_templatename_id = $template_field . '-name';
1355
+				$templatefield_MTP_id = $template_field.'-MTP_ID';
1356
+				$templatefield_field_templatename_id = $template_field.'-name';
1357 1357
 
1358 1358
 				//foreach template field there are actually two form fields created
1359 1359
 				$template_form_fields[$templatefield_MTP_id] = array(
1360
-					'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]',
1360
+					'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]',
1361 1361
 					'label' => null,
1362 1362
 					'input' => 'hidden',
1363 1363
 					'type' => 'int',
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
 				);
1371 1371
 
1372 1372
 				$template_form_fields[$templatefield_field_templatename_id] = array(
1373
-					'name' => 'MTP_template_fields[' . $template_field . '][name]',
1373
+					'name' => 'MTP_template_fields['.$template_field.'][name]',
1374 1374
 					'label' => null,
1375 1375
 					'input' => 'hidden',
1376 1376
 					'type' => 'string',
@@ -1514,13 +1514,13 @@  discard block
 block discarded – undo
1514 1514
 				'value' => $GRP_ID
1515 1515
 				);
1516 1516
 			$sidebar_form_fields['ee-msg-evt-nonce'] = array(
1517
-				'name' => $action . '_nonce',
1517
+				'name' => $action.'_nonce',
1518 1518
 				'input' => 'hidden',
1519 1519
 				'type' => 'string',
1520
-				'value' => wp_create_nonce( $action . '_nonce')
1520
+				'value' => wp_create_nonce($action.'_nonce')
1521 1521
 				);
1522 1522
 
1523
-			if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) {
1523
+			if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) {
1524 1524
 				$sidebar_form_fields['ee-msg-template-switch'] = array(
1525 1525
 					'name' => 'template_switch',
1526 1526
 					'input' => 'hidden',
@@ -1530,8 +1530,8 @@  discard block
 block discarded – undo
1530 1530
 			}
1531 1531
 
1532 1532
 
1533
-			$template_fields = $this->_generate_admin_form_fields( $template_form_fields );
1534
-			$sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields );
1533
+			$template_fields = $this->_generate_admin_form_fields($template_form_fields);
1534
+			$sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields);
1535 1535
 
1536 1536
 
1537 1537
 		} //end if ( !empty($template_field_structure) )
@@ -1543,7 +1543,7 @@  discard block
 block discarded – undo
1543 1543
 			 $GRP_ID,
1544 1544
 			 false,
1545 1545
 			 add_query_arg(
1546
-			    array( 'action' => 'global_mtps' ),
1546
+			    array('action' => 'global_mtps'),
1547 1547
 			    $this->_admin_base_url
1548 1548
 			 )
1549 1549
 		);
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
 			),
1560 1560
 			$this->_admin_base_url
1561 1561
 		);
1562
-		$preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>';
1562
+		$preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>';
1563 1563
 
1564 1564
 
1565 1565
 		//setup context switcher
@@ -1587,17 +1587,17 @@  discard block
 block discarded – undo
1587 1587
 		$this->_template_args['after_admin_page_content'] = $this->_add_form_element_after();
1588 1588
 
1589 1589
 		$this->_template_path = $this->_template_args['GRP_ID']
1590
-			? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php'
1591
-			: EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_add_meta_box.template.php';
1590
+			? EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_edit_meta_box.template.php'
1591
+			: EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_add_meta_box.template.php';
1592 1592
 
1593 1593
 		//send along EE_Message_Template_Group object for further template use.
1594 1594
 		$this->_template_args['MTP'] = $message_template_group;
1595 1595
 
1596
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, true );
1596
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, true);
1597 1597
 
1598 1598
 
1599 1599
 		//finally, let's set the admin_page title
1600
-		$this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title );
1600
+		$this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title);
1601 1601
 
1602 1602
 
1603 1603
 		//we need to take care of setting the shortcodes property for use elsewhere.
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
 	}
1611 1611
 
1612 1612
 
1613
-	public function filter_tinymce_init( $mceInit, $editor_id ) {
1613
+	public function filter_tinymce_init($mceInit, $editor_id) {
1614 1614
 		return $mceInit;
1615 1615
 	}
1616 1616
 
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
 	}
1622 1622
 
1623 1623
 	public function _add_form_element_before() {
1624
-		return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">';
1624
+		return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">';
1625 1625
 	}
1626 1626
 
1627 1627
 	public function _add_form_element_after() {
@@ -1638,25 +1638,25 @@  discard block
 block discarded – undo
1638 1638
 	 *
1639 1639
 	 */
1640 1640
 	public function switch_template_pack() {
1641
-		$GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1642
-		$template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : '';
1641
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1642
+		$template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : '';
1643 1643
 
1644 1644
 		//verify we have needed values.
1645
-		if ( empty( $GRP_ID ) || empty( $template_pack ) ) {
1645
+		if (empty($GRP_ID) || empty($template_pack)) {
1646 1646
 			$this->_template_args['error'] = true;
1647
-			EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
1647
+			EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1648 1648
 		} else {
1649 1649
 			//get template, set the new template_pack and then reset to default
1650 1650
 			/** @type EE_Message_Template_Group $message_template_group */
1651
-			$message_template_group = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1651
+			$message_template_group = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1652 1652
 
1653
-			$message_template_group->set_template_pack_name( $template_pack );
1653
+			$message_template_group->set_template_pack_name($template_pack);
1654 1654
 			$this->_req_data['msgr'] = $message_template_group->messenger();
1655 1655
 			$this->_req_data['mt'] = $message_template_group->message_type();
1656 1656
 
1657 1657
 			$query_args = $this->_reset_to_default_template();
1658 1658
 
1659
-			if ( empty( $query_args['id'] ) ) {
1659
+			if (empty($query_args['id'])) {
1660 1660
 				EE_Error::add_error(
1661 1661
 					__(
1662 1662
 						'Something went wrong with switching the template pack. Please try again or contact EE support',
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
 				);
1667 1667
 				$this->_template_args['error'] = true;
1668 1668
 			} else {
1669
-				$template_label =$message_template_group->get_template_pack()->label;
1669
+				$template_label = $message_template_group->get_template_pack()->label;
1670 1670
 				$template_pack_labels = $message_template_group->messenger_obj()->get_supports_labels();
1671 1671
 				EE_Error::add_success(
1672 1672
 					sprintf(
@@ -1679,7 +1679,7 @@  discard block
 block discarded – undo
1679 1679
 					)
1680 1680
 				);
1681 1681
 				//generate the redirect url for js.
1682
-				$url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1682
+				$url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1683 1683
 				$this->_template_args['data']['redirect_url'] = $url;
1684 1684
 				$this->_template_args['success'] = true;
1685 1685
 			}
@@ -1701,9 +1701,9 @@  discard block
 block discarded – undo
1701 1701
 	protected function _reset_to_default_template() {
1702 1702
 
1703 1703
 		$templates = array();
1704
-		$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1704
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1705 1705
 		//we need to make sure we've got the info we need.
1706
-		if ( ! isset( $this->_req_data['msgr'], $this->_req_data['mt'], $this->_req_data['GRP_ID'] ) ) {
1706
+		if ( ! isset($this->_req_data['msgr'], $this->_req_data['mt'], $this->_req_data['GRP_ID'])) {
1707 1707
 			EE_Error::add_error(
1708 1708
 				__(
1709 1709
 					'In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.',
@@ -1715,9 +1715,9 @@  discard block
 block discarded – undo
1715 1715
 
1716 1716
 		// all templates will be reset to whatever the defaults are
1717 1717
 		// for the global template matching the messenger and message type.
1718
-		$success = !empty( $GRP_ID ) ? true : false;
1718
+		$success = ! empty($GRP_ID) ? true : false;
1719 1719
 
1720
-		if ( $success ) {
1720
+		if ($success) {
1721 1721
 
1722 1722
 			//let's first determine if the incoming template is a global template,
1723 1723
 			// if it isn't then we need to get the global template matching messenger and message type.
@@ -1725,9 +1725,9 @@  discard block
 block discarded – undo
1725 1725
 
1726 1726
 
1727 1727
 			//note this is ONLY deleting the template fields (Message Template rows) NOT the message template group.
1728
-			$success = $this->_delete_mtp_permanently( $GRP_ID, false );
1728
+			$success = $this->_delete_mtp_permanently($GRP_ID, false);
1729 1729
 
1730
-			if ( $success ) {
1730
+			if ($success) {
1731 1731
 				// if successfully deleted, lets generate the new ones.
1732 1732
 				// Note. We set GLOBAL to true, because resets on ANY template
1733 1733
 				// will use the related global template defaults for regeneration.
@@ -1745,32 +1745,32 @@  discard block
 block discarded – undo
1745 1745
 		}
1746 1746
 
1747 1747
 		//any error messages?
1748
-		if ( !$success ) {
1748
+		if ( ! $success) {
1749 1749
 			EE_Error::add_error(
1750
-				__( 'Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso' ),
1750
+				__('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'),
1751 1751
 				__FILE__, __FUNCTION__, __LINE__
1752 1752
 			);
1753 1753
 		}
1754 1754
 
1755 1755
 		//all good, let's add a success message!
1756
-		if ( $success && ! empty( $templates ) ) {
1756
+		if ($success && ! empty($templates)) {
1757 1757
 			$templates = $templates[0]; //the info for the template we generated is the first element in the returned array.
1758 1758
 			EE_Error::overwrite_success();
1759
-			EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') );
1759
+			EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso'));
1760 1760
 		}
1761 1761
 
1762 1762
 
1763 1763
 		$query_args = array(
1764
-			'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : null,
1765
-			'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : null,
1766
-			'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'global_mtps'
1764
+			'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : null,
1765
+			'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : null,
1766
+			'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'global_mtps'
1767 1767
 			);
1768 1768
 
1769 1769
 		//if called via ajax then we return query args otherwise redirect
1770
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1770
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1771 1771
 			return $query_args;
1772 1772
 		} else {
1773
-			$this->_redirect_after_action( false, '', '', $query_args, true );
1773
+			$this->_redirect_after_action(false, '', '', $query_args, true);
1774 1774
 			return null;
1775 1775
 		}
1776 1776
 	}
@@ -1783,7 +1783,7 @@  discard block
 block discarded – undo
1783 1783
 	 * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview.
1784 1784
 	 * @return string
1785 1785
 	 */
1786
-	public function _preview_message( $send = false ) {
1786
+	public function _preview_message($send = false) {
1787 1787
 		//first make sure we've got the necessary parameters
1788 1788
 		if (
1789 1789
 			! isset(
@@ -1799,13 +1799,13 @@  discard block
 block discarded – undo
1799 1799
 			);
1800 1800
 		}
1801 1801
 
1802
-		EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] );
1802
+		EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']);
1803 1803
 
1804 1804
 
1805 1805
 		//get the preview!
1806
-		$preview = EED_Messages::preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send );
1806
+		$preview = EED_Messages::preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send);
1807 1807
 
1808
-		if ( $send ) {
1808
+		if ($send) {
1809 1809
 			return $preview;
1810 1810
 		}
1811 1811
 
@@ -1815,22 +1815,22 @@  discard block
 block discarded – undo
1815 1815
 			'context' => $this->_req_data['context'],
1816 1816
 			'action' => 'edit_message_template'
1817 1817
 			);
1818
-		$go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1819
-		$preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>';
1818
+		$go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1819
+		$preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>';
1820 1820
 		$message_types = $this->get_installed_message_types();
1821
-		$active_messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] );
1821
+		$active_messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']);
1822 1822
 		$active_messenger_label = $active_messenger instanceof EE_messenger
1823
-			? ucwords( $active_messenger->label['singular'] )
1824
-			: esc_html__( 'Unknown Messenger', 'event_espresso' );
1823
+			? ucwords($active_messenger->label['singular'])
1824
+			: esc_html__('Unknown Messenger', 'event_espresso');
1825 1825
 		//let's provide a helpful title for context
1826 1826
 		$preview_title = sprintf(
1827
-			__( 'Viewing Preview for %s %s Message Template', 'event_espresso' ),
1827
+			__('Viewing Preview for %s %s Message Template', 'event_espresso'),
1828 1828
 			$active_messenger_label,
1829
-			ucwords( $message_types[ $this->_req_data[ 'message_type' ] ]->label[ 'singular' ] )
1829
+			ucwords($message_types[$this->_req_data['message_type']]->label['singular'])
1830 1830
 		);
1831 1831
 		//setup display of preview.
1832 1832
 		$this->_admin_page_title = $preview_title;
1833
-		$this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview);
1833
+		$this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview);
1834 1834
 		$this->_template_args['data']['force_json'] = true;
1835 1835
 		return '';
1836 1836
 	}
@@ -1860,9 +1860,9 @@  discard block
 block discarded – undo
1860 1860
 	 * @return void
1861 1861
 	 */
1862 1862
 	protected function _register_edit_meta_boxes() {
1863
-		add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' );
1864
-		add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1865
-		add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1863
+		add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default');
1864
+		add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high');
1865
+		add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high');
1866 1866
 	}
1867 1867
 
1868 1868
 
@@ -1881,14 +1881,14 @@  discard block
 block discarded – undo
1881 1881
 
1882 1882
 		$tp_select_values = array();
1883 1883
 
1884
-		foreach ( $tp_collection as $tp ) {
1884
+		foreach ($tp_collection as $tp) {
1885 1885
 			//only include template packs that support this messenger and message type!
1886 1886
 			$supports = $tp->get_supports();
1887 1887
 			if (
1888
-				! isset( $supports[ $this->_message_template_group->messenger() ] )
1888
+				! isset($supports[$this->_message_template_group->messenger()])
1889 1889
 				|| ! in_array(
1890 1890
 					$this->_message_template_group->message_type(),
1891
-					$supports[ $this->_message_template_group->messenger() ]
1891
+					$supports[$this->_message_template_group->messenger()]
1892 1892
 				)
1893 1893
 			) {
1894 1894
 				//not supported
@@ -1902,7 +1902,7 @@  discard block
 block discarded – undo
1902 1902
 		}
1903 1903
 
1904 1904
 		//if empty $tp_select_values then we make sure default is set because EVERY message type should be supported by the default template pack.  This still allows for the odd template pack to override.
1905
-		if ( empty( $tp_select_values ) ) {
1905
+		if (empty($tp_select_values)) {
1906 1906
 			$tp_select_values[] = array(
1907 1907
 				'text' => __('Default', 'event_espresso'),
1908 1908
 				'id' => 'default'
@@ -1915,14 +1915,14 @@  discard block
 block discarded – undo
1915 1915
 			$this->_message_template_group->message_type()
1916 1916
 		);
1917 1917
 		$variations_select_values = array();
1918
-		foreach ( $variations as $variation => $label ) {
1918
+		foreach ($variations as $variation => $label) {
1919 1919
 			$variations_select_values[] = array(
1920 1920
 				'text' => $label,
1921 1921
 				'id' => $variation
1922 1922
 			);
1923 1923
 		}
1924 1924
 
1925
-		$template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels();
1925
+		$template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels();
1926 1926
 
1927 1927
 		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input(
1928 1928
 			'MTP_template_pack',
@@ -1939,9 +1939,9 @@  discard block
 block discarded – undo
1939 1939
 		$template_args['template_pack_description'] = $template_pack_labels->template_pack_description;
1940 1940
 		$template_args['template_variation_description'] = $template_pack_labels->template_variation_description;
1941 1941
 
1942
-		$template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php';
1942
+		$template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php';
1943 1943
 
1944
-		EEH_Template::display_template( $template, $template_args );
1944
+		EEH_Template::display_template($template, $template_args);
1945 1945
 	}
1946 1946
 
1947 1947
 
@@ -1965,46 +1965,46 @@  discard block
 block discarded – undo
1965 1965
 		//first we need to see if there are any fields
1966 1966
 		$fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields();
1967 1967
 
1968
-		if ( !empty( $fields ) ) {
1968
+		if ( ! empty($fields)) {
1969 1969
 			//yup there be fields
1970
-			foreach ( $fields as $field => $config ) {
1971
-				$field_id = $this->_message_template_group->messenger() . '_' . $field;
1970
+			foreach ($fields as $field => $config) {
1971
+				$field_id = $this->_message_template_group->messenger().'_'.$field;
1972 1972
 				$existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings();
1973
-				$default = isset( $config['default'] ) ? $config['default'] : '';
1974
-				$default = isset( $config['value'] ) ? $config['value'] : $default;
1973
+				$default = isset($config['default']) ? $config['default'] : '';
1974
+				$default = isset($config['value']) ? $config['value'] : $default;
1975 1975
 
1976 1976
 				// if type is hidden and the value is empty
1977 1977
 				// something may have gone wrong so let's correct with the defaults
1978 1978
 				$fix = $config['input'] === 'hidden' && isset($existing[$field]) && empty($existing[$field])
1979 1979
 					? $default
1980 1980
 					: '';
1981
-				$existing[$field] = isset( $existing[$field] ) && empty( $fix )
1981
+				$existing[$field] = isset($existing[$field]) && empty($fix)
1982 1982
 					? $existing[$field]
1983 1983
 					: $fix;
1984 1984
 
1985 1985
 				$template_form_fields[$field_id] = array(
1986
-					'name'       => 'test_settings_fld[' . $field . ']',
1986
+					'name'       => 'test_settings_fld['.$field.']',
1987 1987
 					'label'      => $config['label'],
1988 1988
 					'input'      => $config['input'],
1989 1989
 					'type'       => $config['type'],
1990 1990
 					'required'   => $config['required'],
1991 1991
 					'validation' => $config['validation'],
1992
-					'value'      => isset( $existing[ $field ] ) ? $existing[ $field ] : $default,
1992
+					'value'      => isset($existing[$field]) ? $existing[$field] : $default,
1993 1993
 					'css_class'  => $config['css_class'],
1994
-					'options'    => isset( $config['options'] ) ? $config['options'] : array(),
1994
+					'options'    => isset($config['options']) ? $config['options'] : array(),
1995 1995
 					'default'    => $default,
1996 1996
 					'format'     => $config['format']
1997 1997
 				);
1998 1998
 			}
1999 1999
 		}
2000 2000
 
2001
-		$test_settings_fields = !empty( $template_form_fields)
2002
-			? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' )
2001
+		$test_settings_fields = ! empty($template_form_fields)
2002
+			? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds')
2003 2003
 			: '';
2004 2004
 
2005 2005
 		$test_settings_html = '';
2006 2006
 		//print out $test_settings_fields
2007
-		if ( !empty( $test_settings_fields ) ) {
2007
+		if ( ! empty($test_settings_fields)) {
2008 2008
 			echo $test_settings_fields;
2009 2009
 			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" ';
2010 2010
 			$test_settings_html .= 'name="test_button" value="';
@@ -2013,7 +2013,7 @@  discard block
 block discarded – undo
2013 2013
 		}
2014 2014
 
2015 2015
 		//and button
2016
-		$test_settings_html .= '<p>' . __('Need to reset this message type and start over?', 'event_espresso') . '</p>';
2016
+		$test_settings_html .= '<p>'.__('Need to reset this message type and start over?', 'event_espresso').'</p>';
2017 2017
 		$test_settings_html .= '<div class="publishing-action alignright resetbutton">';
2018 2018
 		$test_settings_html .= $this->get_action_link_or_button(
2019 2019
 			'reset_to_default',
@@ -2037,13 +2037,13 @@  discard block
 block discarded – undo
2037 2037
      * @param string $linked_input_id The css id of the input that the shortcodes get added to.
2038 2038
      * @return string
2039 2039
     */
2040
-	protected function _get_shortcode_selector( $field, $linked_input_id ) {
2040
+	protected function _get_shortcode_selector($field, $linked_input_id) {
2041 2041
 		$template_args = array(
2042
-			'shortcodes' => $this->_get_shortcodes( array( $field ), true ),
2042
+			'shortcodes' => $this->_get_shortcodes(array($field), true),
2043 2043
 			'fieldname' => $field,
2044 2044
 			'linked_input_id' => $linked_input_id
2045 2045
 		);
2046
-		return EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'shortcode_selector_skeleton.template.php', $template_args, true );
2046
+		return EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'shortcode_selector_skeleton.template.php', $template_args, true);
2047 2047
 	}
2048 2048
 
2049 2049
 
@@ -2058,13 +2058,13 @@  discard block
 block discarded – undo
2058 2058
 		$shortcodes = $this->_get_shortcodes(array(), false); //just make sure shortcodes property is set
2059 2059
 		//$messenger = $this->_message_template_group->messenger_obj();
2060 2060
 		//now let's set the content depending on the status of the shortcodes array
2061
-		if ( empty( $shortcodes ) ) {
2062
-			$content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>';
2061
+		if (empty($shortcodes)) {
2062
+			$content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>';
2063 2063
 			echo $content;
2064 2064
 		} else {
2065 2065
 			//$alt = 0;
2066 2066
 			?>
2067
-			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf( __('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p>
2067
+			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf(__('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso'), '<span class="dashicons dashicons-menu"></span>'); ?></p>
2068 2068
 			<?php
2069 2069
 		}
2070 2070
 
@@ -2081,7 +2081,7 @@  discard block
 block discarded – undo
2081 2081
 	protected function _set_shortcodes() {
2082 2082
 
2083 2083
 		//no need to run this if the property is already set
2084
-		if ( !empty($this->_shortcodes ) ) {return;}
2084
+		if ( ! empty($this->_shortcodes)) {return; }
2085 2085
 
2086 2086
 		$this->_shortcodes = $this->_get_shortcodes();
2087 2087
 	}
@@ -2103,14 +2103,14 @@  discard block
 block discarded – undo
2103 2103
 	 * @return array          Shortcodes indexed by fieldname and the an array of shortcode/label pairs OR if merged is true
2104 2104
 	 *                       just an array of shortcode/label pairs.
2105 2105
 	 */
2106
-	protected function _get_shortcodes( $fields = array(), $merged = true ) {
2106
+	protected function _get_shortcodes($fields = array(), $merged = true) {
2107 2107
 		$this->_set_message_template_group();
2108 2108
 
2109 2109
 		//we need the messenger and message template to retrieve the valid shortcodes array.
2110
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : false;
2111
-		$context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() );
2110
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : false;
2111
+		$context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config());
2112 2112
 
2113
-		return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array();
2113
+		return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array();
2114 2114
 	}
2115 2115
 
2116 2116
 
@@ -2123,19 +2123,19 @@  discard block
 block discarded – undo
2123 2123
 	 */
2124 2124
 	protected function _set_message_template_group() {
2125 2125
 
2126
-		if ( !empty( $this->_message_template_group ) )
2127
-			{return;} //get out if this is already set.
2126
+		if ( ! empty($this->_message_template_group))
2127
+			{return; } //get out if this is already set.
2128 2128
 
2129
-		$GRP_ID =  ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : false;
2130
-		$GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID;
2129
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : false;
2130
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID;
2131 2131
 
2132 2132
 		//let's get the message templates
2133 2133
 		$MTP = EEM_Message_Template_Group::instance();
2134 2134
 
2135
-		if ( empty($GRP_ID) )
2136
-			{$this->_message_template_group = $MTP->create_default_object();}
2135
+		if (empty($GRP_ID))
2136
+			{$this->_message_template_group = $MTP->create_default_object(); }
2137 2137
 		else
2138
-			{$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );}
2138
+			{$this->_message_template_group = $MTP->get_one_by_ID($GRP_ID); }
2139 2139
 
2140 2140
 		$this->_template_pack = $this->_message_template_group->get_template_pack();
2141 2141
 		$this->_variation = $this->_message_template_group->get_template_pack_variation();
@@ -2154,7 +2154,7 @@  discard block
 block discarded – undo
2154 2154
 	 * @param array $args various things the context switcher needs.
2155 2155
 	 *
2156 2156
 	 */
2157
-	protected function _set_context_switcher( EE_Message_Template_Group $template_group_object, $args) {
2157
+	protected function _set_context_switcher(EE_Message_Template_Group $template_group_object, $args) {
2158 2158
 		$context_details = $template_group_object->contexts_config();
2159 2159
 		$context_label = $template_group_object->context_label();
2160 2160
 		ob_start();
@@ -2162,20 +2162,20 @@  discard block
 block discarded – undo
2162 2162
 		<div class="ee-msg-switcher-container">
2163 2163
 			<form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm">
2164 2164
 				<?php
2165
-					foreach ( $args as $name => $value ) {
2166
-						if ( $name == 'context' || empty($value) || $name == 'extra' ) {continue;}
2165
+					foreach ($args as $name => $value) {
2166
+						if ($name == 'context' || empty($value) || $name == 'extra') {continue; }
2167 2167
 						?>
2168 2168
 						<input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" />
2169 2169
 						<?php
2170 2170
 					}
2171 2171
 					//setup nonce_url
2172
-					wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false);
2172
+					wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false);
2173 2173
 				?>
2174 2174
 				<select name="context">
2175 2175
 					<?php
2176 2176
 					$context_templates = $template_group_object->context_templates();
2177
-					if ( is_array($context_templates) ) :
2178
-							foreach ( $context_templates as $context => $template_fields ) :
2177
+					if (is_array($context_templates)) :
2178
+							foreach ($context_templates as $context => $template_fields) :
2179 2179
 								$checked = ($context == $args['context']) ? 'selected="selected"' : '';
2180 2180
 					?>
2181 2181
 					<option value="<?php echo $context; ?>" <?php echo $checked; ?>>
@@ -2183,7 +2183,7 @@  discard block
 block discarded – undo
2183 2183
 					</option>
2184 2184
 					<?php endforeach; endif; ?>
2185 2185
 				</select>
2186
-				<?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?>
2186
+				<?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?>
2187 2187
 				<input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>">
2188 2188
 			</form>
2189 2189
 			<?php echo $args['extra']; ?>
@@ -2210,8 +2210,8 @@  discard block
 block discarded – undo
2210 2210
 	 * @return array
2211 2211
 	 */
2212 2212
 	protected function _set_message_template_column_values($index) {
2213
-		if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) {
2214
-			foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) {
2213
+		if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) {
2214
+			foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) {
2215 2215
 				$this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value;
2216 2216
 			}
2217 2217
 		} /*else {
@@ -2220,22 +2220,22 @@  discard block
 block discarded – undo
2220 2220
 
2221 2221
 
2222 2222
 		$set_column_values = array(
2223
-			'MTP_ID'             => absint( $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'MTP_ID' ] ),
2224
-			'GRP_ID'             => absint( $this->_req_data[ 'GRP_ID' ] ),
2225
-			'MTP_user_id'        => absint( $this->_req_data[ 'MTP_user_id' ] ),
2226
-			'MTP_messenger'      => strtolower( $this->_req_data[ 'MTP_messenger' ] ),
2227
-			'MTP_message_type'   => strtolower( $this->_req_data[ 'MTP_message_type' ] ),
2228
-			'MTP_template_field' => strtolower( $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'name' ] ),
2229
-			'MTP_context'        => strtolower( $this->_req_data[ 'MTP_context' ] ),
2230
-			'MTP_content'        => $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'content' ],
2231
-			'MTP_is_global'      => isset( $this->_req_data[ 'MTP_is_global' ] )
2232
-				? absint( $this->_req_data[ 'MTP_is_global' ] )
2223
+			'MTP_ID'             => absint($this->_req_data['MTP_template_fields'][$index]['MTP_ID']),
2224
+			'GRP_ID'             => absint($this->_req_data['GRP_ID']),
2225
+			'MTP_user_id'        => absint($this->_req_data['MTP_user_id']),
2226
+			'MTP_messenger'      => strtolower($this->_req_data['MTP_messenger']),
2227
+			'MTP_message_type'   => strtolower($this->_req_data['MTP_message_type']),
2228
+			'MTP_template_field' => strtolower($this->_req_data['MTP_template_fields'][$index]['name']),
2229
+			'MTP_context'        => strtolower($this->_req_data['MTP_context']),
2230
+			'MTP_content'        => $this->_req_data['MTP_template_fields'][$index]['content'],
2231
+			'MTP_is_global'      => isset($this->_req_data['MTP_is_global'])
2232
+				? absint($this->_req_data['MTP_is_global'])
2233 2233
 				: 0,
2234
-			'MTP_is_override'    => isset( $this->_req_data[ 'MTP_is_override' ] )
2235
-				? absint( $this->_req_data[ 'MTP_is_override' ] )
2234
+			'MTP_is_override'    => isset($this->_req_data['MTP_is_override'])
2235
+				? absint($this->_req_data['MTP_is_override'])
2236 2236
 				: 0,
2237
-			'MTP_deleted'        => absint( $this->_req_data[ 'MTP_deleted' ] ),
2238
-			'MTP_is_active'      => absint( $this->_req_data[ 'MTP_is_active' ] )
2237
+			'MTP_deleted'        => absint($this->_req_data['MTP_deleted']),
2238
+			'MTP_is_active'      => absint($this->_req_data['MTP_is_active'])
2239 2239
 		);
2240 2240
 
2241 2241
 
@@ -2247,36 +2247,36 @@  discard block
 block discarded – undo
2247 2247
 
2248 2248
 
2249 2249
 
2250
-	protected function _insert_or_update_message_template($new = false ) {
2250
+	protected function _insert_or_update_message_template($new = false) {
2251 2251
 
2252
-		do_action ( 'AHEE_log', __FILE__, __FUNCTION__, '');
2252
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2253 2253
 		$success = 0;
2254 2254
 		$override = false;
2255 2255
 
2256 2256
 		//setup notices description
2257
-		$messenger = ! empty( $this->_req_data['MTP_messenger'] )
2258
-			? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_messenger'] ) )
2257
+		$messenger = ! empty($this->_req_data['MTP_messenger'])
2258
+			? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger']))
2259 2259
 			: false;
2260 2260
 
2261
-		$message_type = ! empty( $this->_req_data['MTP_message_type'] )
2262
-			? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_message_type'] ) )
2261
+		$message_type = ! empty($this->_req_data['MTP_message_type'])
2262
+			? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type']))
2263 2263
 			: false;
2264 2264
 
2265
-		$context = ! empty( $this->_req_data['MTP_context'] )
2266
-			? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_context'] ) )
2265
+		$context = ! empty($this->_req_data['MTP_context'])
2266
+			? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context']))
2267 2267
 			: false;
2268 2268
 
2269
-		$item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : '';
2269
+		$item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : '';
2270 2270
 		$item_desc .= 'Message Template';
2271 2271
 		$query_args = array();
2272 2272
 		$edit_array = array();
2273 2273
 		$action_desc = '';
2274 2274
 
2275 2275
 		//if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit.
2276
-		if ( $new ) {
2277
-			$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
2278
-			if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) {
2279
-				if ( empty($edit_array) ) {
2276
+		if ($new) {
2277
+			$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
2278
+			if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) {
2279
+				if (empty($edit_array)) {
2280 2280
 					$success = 0;
2281 2281
 				} else {
2282 2282
 					$success = 1;
@@ -2295,7 +2295,7 @@  discard block
 block discarded – undo
2295 2295
 
2296 2296
 
2297 2297
 			//run update for each template field in displayed context
2298
-			if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) {
2298
+			if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) {
2299 2299
 				EE_Error::add_error(
2300 2300
 					__('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'),
2301 2301
 					__FILE__, __FUNCTION__, __LINE__
@@ -2304,25 +2304,25 @@  discard block
 block discarded – undo
2304 2304
 
2305 2305
 			} else {
2306 2306
 				//first validate all fields!
2307
-				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
2307
+				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
2308 2308
 
2309 2309
 				//if $validate returned error messages (i.e. is_array()) then we need to process them and setup an appropriate response. HMM, dang this isn't correct, $validates will ALWAYS be an array.  WE need to make sure there is no actual error messages in validates.
2310
-				if ( is_array($validates) && !empty($validates) ) {
2310
+				if (is_array($validates) && ! empty($validates)) {
2311 2311
 					//add the transient so when the form loads we know which fields to highlight
2312
-					$this->_add_transient( 'edit_message_template', $validates );
2312
+					$this->_add_transient('edit_message_template', $validates);
2313 2313
 
2314 2314
 					$success = 0;
2315 2315
 
2316 2316
 					//setup notices
2317
-					foreach ( $validates as $field => $error ) {
2318
-						if ( isset($error['msg'] ) ) {
2319
-							EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );
2317
+					foreach ($validates as $field => $error) {
2318
+						if (isset($error['msg'])) {
2319
+							EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__);
2320 2320
 						}
2321 2321
 					}
2322 2322
 
2323 2323
 				} else {
2324 2324
 					$set_column_values = array();
2325
-					foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) {
2325
+					foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) {
2326 2326
 						$set_column_values = $this->_set_message_template_column_values($template_field);
2327 2327
 
2328 2328
 						$where_cols_n_values = array(
@@ -2335,11 +2335,11 @@  discard block
 block discarded – undo
2335 2335
 							'MTP_context' => $set_column_values['MTP_context'],
2336 2336
 							'MTP_content' => $set_column_values['MTP_content']
2337 2337
 						);
2338
-						if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) {
2339
-							if ( $updated === false ) {
2338
+						if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) {
2339
+							if ($updated === false) {
2340 2340
 								EE_Error::add_error(
2341 2341
 									sprintf(
2342
-										__( '%s field was NOT updated for some reason', 'event_espresso' ),
2342
+										__('%s field was NOT updated for some reason', 'event_espresso'),
2343 2343
 										$template_field
2344 2344
 									),
2345 2345
 									__FILE__, __FUNCTION__, __LINE__
@@ -2353,46 +2353,46 @@  discard block
 block discarded – undo
2353 2353
 
2354 2354
 					//we can use the last set_column_values for the MTPG update (because its the same for all of these specific MTPs)
2355 2355
 					$mtpg_fields = array(
2356
-						'MTP_user_id'      => $set_column_values[ 'MTP_user_id' ],
2357
-						'MTP_messenger'    => $set_column_values[ 'MTP_messenger' ],
2358
-						'MTP_message_type' => $set_column_values[ 'MTP_message_type' ],
2359
-						'MTP_is_global'    => $set_column_values[ 'MTP_is_global' ],
2360
-						'MTP_is_override'  => $set_column_values[ 'MTP_is_override' ],
2361
-						'MTP_deleted'      => $set_column_values[ 'MTP_deleted' ],
2362
-						'MTP_is_active'    => $set_column_values[ 'MTP_is_active' ],
2363
-						'MTP_name'         => ! empty( $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_name' ] )
2364
-							? $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_name' ]
2356
+						'MTP_user_id'      => $set_column_values['MTP_user_id'],
2357
+						'MTP_messenger'    => $set_column_values['MTP_messenger'],
2358
+						'MTP_message_type' => $set_column_values['MTP_message_type'],
2359
+						'MTP_is_global'    => $set_column_values['MTP_is_global'],
2360
+						'MTP_is_override'  => $set_column_values['MTP_is_override'],
2361
+						'MTP_deleted'      => $set_column_values['MTP_deleted'],
2362
+						'MTP_is_active'    => $set_column_values['MTP_is_active'],
2363
+						'MTP_name'         => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name'])
2364
+							? $this->_req_data['ee_msg_non_global_fields']['MTP_name']
2365 2365
 							: '',
2366
-						'MTP_description'  => ! empty( $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_description' ] )
2367
-							? $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_description' ]
2366
+						'MTP_description'  => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description'])
2367
+							? $this->_req_data['ee_msg_non_global_fields']['MTP_description']
2368 2368
 							: ''
2369 2369
 					);
2370 2370
 
2371
-					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] );
2372
-					$updated = $MTPG->update( $mtpg_fields, array($mtpg_where) );
2371
+					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']);
2372
+					$updated = $MTPG->update($mtpg_fields, array($mtpg_where));
2373 2373
 
2374
-					if ( $updated === false ) {
2374
+					if ($updated === false) {
2375 2375
 						EE_Error::add_error(
2376 2376
 							sprintf(
2377
-								__( 'The Message Template Group (%d) was NOT updated for some reason', 'event_espresso' ),
2378
-								$set_column_values[ 'GRP_ID' ]
2377
+								__('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'),
2378
+								$set_column_values['GRP_ID']
2379 2379
 							),
2380 2380
 							__FILE__, __FUNCTION__, __LINE__
2381 2381
 						);
2382 2382
 					} else {
2383 2383
 						//k now we need to ensure the template_pack and template_variation fields are set.
2384
-						$template_pack = ! empty( $this->_req_data['MTP_template_pack' ] )
2384
+						$template_pack = ! empty($this->_req_data['MTP_template_pack'])
2385 2385
 							? $this->_req_data['MTP_template_pack']
2386 2386
 							: 'default';
2387 2387
 
2388
-						$template_variation = ! empty( $this->_req_data['MTP_template_variation'] )
2388
+						$template_variation = ! empty($this->_req_data['MTP_template_variation'])
2389 2389
 							? $this->_req_data['MTP_template_variation']
2390 2390
 							: 'default';
2391 2391
 
2392
-						$mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] );
2393
-						if ( $mtpg_obj instanceof EE_Message_Template_Group ) {
2394
-							$mtpg_obj->set_template_pack_name( $template_pack );
2395
-							$mtpg_obj->set_template_pack_variation( $template_variation );
2392
+						$mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']);
2393
+						if ($mtpg_obj instanceof EE_Message_Template_Group) {
2394
+							$mtpg_obj->set_template_pack_name($template_pack);
2395
+							$mtpg_obj->set_template_pack_variation($template_variation);
2396 2396
 						}
2397 2397
 						$success = 1;
2398 2398
 					}
@@ -2402,7 +2402,7 @@  discard block
 block discarded – undo
2402 2402
 		}
2403 2403
 
2404 2404
 		//we return things differently if doing ajax
2405
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
2405
+		if (defined('DOING_AJAX') && DOING_AJAX) {
2406 2406
 			$this->_template_args['success'] = $success;
2407 2407
 			$this->_template_args['error'] = ! $success ? true : false;
2408 2408
 			$this->_template_args['content'] = '';
@@ -2410,9 +2410,9 @@  discard block
 block discarded – undo
2410 2410
 				'grpID' => $edit_array['GRP_ID'],
2411 2411
 				'templateName' => $edit_array['template_name']
2412 2412
 				);
2413
-			if ( $success ) {
2413
+			if ($success) {
2414 2414
 				EE_Error::overwrite_success();
2415
-				EE_Error::add_success( __('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso') );
2415
+				EE_Error::add_success(__('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso'));
2416 2416
 			}
2417 2417
 
2418 2418
 			$this->_return_json();
@@ -2420,13 +2420,13 @@  discard block
 block discarded – undo
2420 2420
 
2421 2421
 
2422 2422
 		//was a test send triggered?
2423
-		if ( isset( $this->_req_data['test_button'] ) ) {
2423
+		if (isset($this->_req_data['test_button'])) {
2424 2424
 			EE_Error::overwrite_success();
2425
-			$this->_do_test_send( $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] );
2425
+			$this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
2426 2426
 			$override = true;
2427 2427
 		}
2428 2428
 
2429
-		if ( empty( $query_args ) ) {
2429
+		if (empty($query_args)) {
2430 2430
 			$query_args = array(
2431 2431
 				'id' => $this->_req_data['GRP_ID'],
2432 2432
 				'context' => $this->_req_data['MTP_context'],
@@ -2434,7 +2434,7 @@  discard block
 block discarded – undo
2434 2434
 				);
2435 2435
 		}
2436 2436
 
2437
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override );
2437
+		$this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override);
2438 2438
 	}
2439 2439
 
2440 2440
 
@@ -2448,28 +2448,28 @@  discard block
 block discarded – undo
2448 2448
 	 * @param  string $message_type message type being tested
2449 2449
 	 *
2450 2450
 	 */
2451
-	protected function _do_test_send( $context, $messenger, $message_type ) {
2451
+	protected function _do_test_send($context, $messenger, $message_type) {
2452 2452
 		//set things up for preview
2453 2453
 		$this->_req_data['messenger'] = $messenger;
2454 2454
 		$this->_req_data['message_type'] = $message_type;
2455 2455
 		$this->_req_data['context'] = $context;
2456
-		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : '';
2457
-		$active_messenger = $this->_message_resource_manager->get_active_messenger( $messenger );
2456
+		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : '';
2457
+		$active_messenger = $this->_message_resource_manager->get_active_messenger($messenger);
2458 2458
 
2459 2459
 		//let's save any existing fields that might be required by the messenger
2460 2460
 		if (
2461
-			isset( $this->_req_data['test_settings_fld'] )
2461
+			isset($this->_req_data['test_settings_fld'])
2462 2462
 			&& $active_messenger instanceof EE_messenger
2463 2463
 		) {
2464
-			$active_messenger->set_existing_test_settings( $this->_req_data['test_settings_fld'] );
2464
+			$active_messenger->set_existing_test_settings($this->_req_data['test_settings_fld']);
2465 2465
 		}
2466 2466
 
2467 2467
 		$success = $this->_preview_message(true);
2468 2468
 
2469
-		if ( $success ) {
2470
-			EE_Error::add_success( __('Test message sent', 'event_espresso') );
2469
+		if ($success) {
2470
+			EE_Error::add_success(__('Test message sent', 'event_espresso'));
2471 2471
 		} else {
2472
-			EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
2472
+			EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2473 2473
 		}
2474 2474
 	}
2475 2475
 
@@ -2495,11 +2495,11 @@  discard block
 block discarded – undo
2495 2495
 	protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = false) {
2496 2496
 
2497 2497
 		//if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates.
2498
-		if ( empty( $message_types ) ) {
2498
+		if (empty($message_types)) {
2499 2499
 			return true;
2500 2500
 		}
2501 2501
 
2502
-		return EEH_MSG_Template::generate_new_templates( $messenger, $message_types, $GRP_ID, $global );
2502
+		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global);
2503 2503
 	}
2504 2504
 
2505 2505
 
@@ -2515,33 +2515,33 @@  discard block
 block discarded – undo
2515 2515
 	 *
2516 2516
 	 * @return void
2517 2517
 	 */
2518
-	protected function _trash_or_restore_message_template($trash = true, $all = false ) {
2519
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2518
+	protected function _trash_or_restore_message_template($trash = true, $all = false) {
2519
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2520 2520
 		$MTP = EEM_Message_Template_Group::instance();
2521 2521
 
2522 2522
 		$success = 1;
2523 2523
 
2524 2524
 		//incoming GRP_IDs
2525
-		if ( $all ) {
2525
+		if ($all) {
2526 2526
 			//Checkboxes
2527
-			if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) {
2527
+			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2528 2528
 				//if array has more than one element then success message should be plural.
2529 2529
 				//todo: what about nonce?
2530
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2530
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2531 2531
 
2532 2532
 				//cycle through checkboxes
2533
-				while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) {
2534
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2535
-					if ( ! $trashed_or_restored ) {
2533
+				while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2534
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2535
+					if ( ! $trashed_or_restored) {
2536 2536
 						$success = 0;
2537 2537
 					}
2538 2538
 				}
2539 2539
 			} else {
2540 2540
 				//grab single GRP_ID and handle
2541
-				$GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
2542
-				if ( ! empty( $GRP_ID ) ) {
2543
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2544
-					if ( ! $trashed_or_restored ) {
2541
+				$GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
2542
+				if ( ! empty($GRP_ID)) {
2543
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2544
+					if ( ! $trashed_or_restored) {
2545 2545
 						$success = 0;
2546 2546
 					}
2547 2547
 				} else {
@@ -2553,13 +2553,13 @@  discard block
 block discarded – undo
2553 2553
 
2554 2554
 		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2555 2555
 
2556
-		$action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc;
2556
+		$action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc;
2557 2557
 
2558 2558
 		$item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso');
2559 2559
 
2560
-		$item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2560
+		$item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2561 2561
 
2562
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, array() );
2562
+		$this->_redirect_after_action($success, $item_desc, $action_desc, array());
2563 2563
 
2564 2564
 	}
2565 2565
 
@@ -2575,24 +2575,24 @@  discard block
 block discarded – undo
2575 2575
 	 * @return void
2576 2576
 	 */
2577 2577
 	protected function _delete_message_template() {
2578
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2578
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2579 2579
 
2580 2580
 		//checkboxes
2581
-		if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) {
2581
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2582 2582
 			//if array has more than one element then success message should be plural
2583
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2583
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2584 2584
 
2585 2585
 			//cycle through bulk action checkboxes
2586
-			while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) {
2587
-				$success = $this->_delete_mtp_permanently( $GRP_ID );
2586
+			while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2587
+				$success = $this->_delete_mtp_permanently($GRP_ID);
2588 2588
 			}
2589 2589
 		} else {
2590 2590
 			//grab single grp_id and delete
2591
-			$GRP_ID = absint($this->_req_data['id'] );
2592
-			$success = $this->_delete_mtp_permanently( $GRP_ID );
2591
+			$GRP_ID = absint($this->_req_data['id']);
2592
+			$success = $this->_delete_mtp_permanently($GRP_ID);
2593 2593
 		}
2594 2594
 
2595
-		$this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() );
2595
+		$this->_redirect_after_action($success, 'Message Templates', 'deleted', array());
2596 2596
 
2597 2597
 	}
2598 2598
 
@@ -2607,20 +2607,20 @@  discard block
 block discarded – undo
2607 2607
 	 *
2608 2608
 	 * @return bool        boolean to indicate the success of the deletes or not.
2609 2609
 	 */
2610
-	private function _delete_mtp_permanently( $GRP_ID, $include_group = true ) {
2610
+	private function _delete_mtp_permanently($GRP_ID, $include_group = true) {
2611 2611
 		$success = 1;
2612 2612
 		$MTPG = EEM_Message_Template_Group::instance();
2613 2613
 		//first let's GET this group
2614
-		$MTG = $MTPG->get_one_by_ID( $GRP_ID );
2614
+		$MTG = $MTPG->get_one_by_ID($GRP_ID);
2615 2615
 		//then delete permanently all the related Message Templates
2616
-		$deleted = $MTG->delete_related_permanently( 'Message_Template' );
2616
+		$deleted = $MTG->delete_related_permanently('Message_Template');
2617 2617
 
2618
-		if ( $deleted === 0 )
2619
-			{$success = 0;}
2618
+		if ($deleted === 0)
2619
+			{$success = 0; }
2620 2620
 
2621 2621
 		//now delete permanently this particular group
2622 2622
 
2623
-		if ( $include_group && ! $MTG->delete_permanently() ) {
2623
+		if ($include_group && ! $MTG->delete_permanently()) {
2624 2624
 			$success = 0;
2625 2625
 		}
2626 2626
 		return $success;
@@ -2638,7 +2638,7 @@  discard block
 block discarded – undo
2638 2638
 	*	@return string
2639 2639
 	*/
2640 2640
 	protected function _learn_more_about_message_templates_link() {
2641
-		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2641
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>';
2642 2642
 	}
2643 2643
 
2644 2644
 
@@ -2656,10 +2656,10 @@  discard block
 block discarded – undo
2656 2656
 
2657 2657
 		$this->_set_m_mt_settings();
2658 2658
 
2659
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2659
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2660 2660
 
2661 2661
 		//let's setup the messenger tabs
2662
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger );
2662
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger);
2663 2663
 		$this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">';
2664 2664
 		$this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->';
2665 2665
 
@@ -2678,7 +2678,7 @@  discard block
 block discarded – undo
2678 2678
 	 */
2679 2679
 	protected function _set_m_mt_settings() {
2680 2680
 		//first if this is already set then lets get out no need to regenerate data.
2681
-		if ( !empty($this->_m_mt_settings) ) {
2681
+		if ( ! empty($this->_m_mt_settings)) {
2682 2682
 			return;
2683 2683
 		}
2684 2684
 
@@ -2693,10 +2693,10 @@  discard block
 block discarded – undo
2693 2693
 
2694 2694
 		//assemble the array for the _tab_text_links helper
2695 2695
 
2696
-		foreach ( $messengers as $messenger ) {
2696
+		foreach ($messengers as $messenger) {
2697 2697
 			$this->_m_mt_settings['messenger_tabs'][$messenger->name] = array(
2698 2698
 				'label' => ucwords($messenger->label['singular']),
2699
-				'class' => $this->_message_resource_manager->is_messenger_active( $messenger->name ) ? 'messenger-active' : '',
2699
+				'class' => $this->_message_resource_manager->is_messenger_active($messenger->name) ? 'messenger-active' : '',
2700 2700
 				'href' => $messenger->name,
2701 2701
 				'title' => __('Modify this Messenger', 'event_espresso'),
2702 2702
 				'slug' => $messenger->name,
@@ -2706,26 +2706,26 @@  discard block
 block discarded – undo
2706 2706
 
2707 2707
 			$message_types_for_messenger = $messenger->get_valid_message_types();
2708 2708
 
2709
-			foreach ( $message_types as $message_type ) {
2709
+			foreach ($message_types as $message_type) {
2710 2710
 				//first we need to verify that this message type is valid with this messenger. Cause if it isn't then it shouldn't show in either the inactive OR active metabox.
2711
-				if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) {
2711
+				if ( ! in_array($message_type->name, $message_types_for_messenger)) {
2712 2712
 					continue;
2713 2713
 				}
2714 2714
 
2715
-				$a_or_i = $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger->name, $message_type->name ) ? 'active' : 'inactive';
2715
+				$a_or_i = $this->_message_resource_manager->is_message_type_active_for_messenger($messenger->name, $message_type->name) ? 'active' : 'inactive';
2716 2716
 
2717 2717
 				$this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array(
2718
-					'label'    => ucwords( $message_type->label[ 'singular' ] ),
2719
-					'class'    => 'message-type-' . $a_or_i,
2720
-					'slug_id'  => $message_type->name . '-messagetype-' . $messenger->name,
2721
-					'mt_nonce' => wp_create_nonce( $message_type->name . '_nonce' ),
2722
-					'href'     => 'espresso_' . $message_type->name . '_message_type_settings',
2718
+					'label'    => ucwords($message_type->label['singular']),
2719
+					'class'    => 'message-type-'.$a_or_i,
2720
+					'slug_id'  => $message_type->name.'-messagetype-'.$messenger->name,
2721
+					'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'),
2722
+					'href'     => 'espresso_'.$message_type->name.'_message_type_settings',
2723 2723
 					'title'    => $a_or_i == 'active'
2724
-						? __( 'Drag this message type to the Inactive window to deactivate', 'event_espresso' )
2725
-						: __( 'Drag this message type to the messenger to activate', 'event_espresso' ),
2724
+						? __('Drag this message type to the Inactive window to deactivate', 'event_espresso')
2725
+						: __('Drag this message type to the messenger to activate', 'event_espresso'),
2726 2726
 					'content'  => $a_or_i == 'active'
2727
-						? $this->_message_type_settings_content( $message_type, $messenger, true )
2728
-						: $this->_message_type_settings_content( $message_type, $messenger ),
2727
+						? $this->_message_type_settings_content($message_type, $messenger, true)
2728
+						: $this->_message_type_settings_content($message_type, $messenger),
2729 2729
 					'slug'     => $message_type->name,
2730 2730
 					'active'   => $a_or_i == 'active' ? true : false,
2731 2731
 					'obj'      => $message_type
@@ -2744,34 +2744,34 @@  discard block
 block discarded – undo
2744 2744
 	 *
2745 2745
 	 * @return string                html output for the content
2746 2746
 	 */
2747
-	protected function _message_type_settings_content( $message_type, $messenger, $active = false ) {
2747
+	protected function _message_type_settings_content($message_type, $messenger, $active = false) {
2748 2748
 		//get message type fields
2749 2749
 		$fields = $message_type->get_admin_settings_fields();
2750
-		$settings_template_args['template_form_fields']= '';
2750
+		$settings_template_args['template_form_fields'] = '';
2751 2751
 
2752
-		if ( !empty( $fields ) && $active ) {
2752
+		if ( ! empty($fields) && $active) {
2753 2753
 
2754
-			$existing_settings = $message_type->get_existing_admin_settings( $messenger->name );
2754
+			$existing_settings = $message_type->get_existing_admin_settings($messenger->name);
2755 2755
 
2756
-			foreach( $fields as $fldname => $fldprops ) {
2757
-				$field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname;
2756
+			foreach ($fields as $fldname => $fldprops) {
2757
+				$field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname;
2758 2758
 				$template_form_field[$field_id] = array(
2759
-					'name' => 'message_type_settings[' . $fldname . ']',
2759
+					'name' => 'message_type_settings['.$fldname.']',
2760 2760
 					'label' => $fldprops['label'],
2761 2761
 					'input' => $fldprops['field_type'],
2762 2762
 					'type' => $fldprops['value_type'],
2763 2763
 					'required' => $fldprops['required'],
2764 2764
 					'validation' => $fldprops['validation'],
2765
-					'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2766
-					'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(),
2767
-					'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'],
2765
+					'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2766
+					'options' => isset($fldprops['options']) ? $fldprops['options'] : array(),
2767
+					'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2768 2768
 					'css_class' => 'no-drag',
2769 2769
 					'format' => $fldprops['format']
2770 2770
 				);
2771 2771
 			}
2772 2772
 
2773 2773
 
2774
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : '';
2774
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : '';
2775 2775
 		}
2776 2776
 
2777 2777
 		$settings_template_args['description'] = $message_type->description;
@@ -2791,13 +2791,13 @@  discard block
 block discarded – undo
2791 2791
 					)
2792 2792
 				);
2793 2793
 
2794
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2795
-		$settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : '';
2794
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2795
+		$settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : '';
2796 2796
 
2797 2797
 
2798 2798
 
2799
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php';
2800
-		$content = EEH_Template::display_template( $template, $settings_template_args, true );
2799
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php';
2800
+		$content = EEH_Template::display_template($template, $settings_template_args, true);
2801 2801
 		return $content;
2802 2802
 	}
2803 2803
 
@@ -2814,27 +2814,27 @@  discard block
 block discarded – undo
2814 2814
 		$m_boxes = $mt_boxes = array();
2815 2815
 		$m_template_args = $mt_template_args = array();
2816 2816
 
2817
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2817
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2818 2818
 
2819
-		if ( isset( $this->_m_mt_settings[ 'messenger_tabs' ] ) ) {
2820
-			foreach ( $this->_m_mt_settings[ 'messenger_tabs' ] as $messenger => $tab_array ) {
2821
-				$hide_on_message = $this->_message_resource_manager->is_messenger_active( $messenger ) ? '' : 'hidden';
2822
-				$hide_off_message = $this->_message_resource_manager->is_messenger_active( $messenger ) ? 'hidden' : '';
2819
+		if (isset($this->_m_mt_settings['messenger_tabs'])) {
2820
+			foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) {
2821
+				$hide_on_message = $this->_message_resource_manager->is_messenger_active($messenger) ? '' : 'hidden';
2822
+				$hide_off_message = $this->_message_resource_manager->is_messenger_active($messenger) ? 'hidden' : '';
2823 2823
 				//messenger meta boxes
2824 2824
 				$active = $selected_messenger == $messenger ? true : false;
2825
-				$active_mt_tabs = isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'active' ] )
2826
-				? $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'active' ]
2825
+				$active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active'])
2826
+				? $this->_m_mt_settings['message_type_tabs'][$messenger]['active']
2827 2827
 				: '';
2828
-				$m_boxes[ $messenger . '_a_box' ] = sprintf(
2829
-				__( '%s Settings', 'event_espresso' ),
2830
-				$tab_array[ 'label' ]
2828
+				$m_boxes[$messenger.'_a_box'] = sprintf(
2829
+				__('%s Settings', 'event_espresso'),
2830
+				$tab_array['label']
2831 2831
 				);
2832
-				$m_template_args[ $messenger . '_a_box' ] = array(
2833
-				'active_message_types'   => ! empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2834
-				'inactive_message_types' => isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] )
2835
-				? $this->_get_mt_tabs( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] )
2832
+				$m_template_args[$messenger.'_a_box'] = array(
2833
+				'active_message_types'   => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2834
+				'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'])
2835
+				? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'])
2836 2836
 				: '',
2837
-				'content'                => $this->_get_messenger_box_content( $tab_array[ 'obj' ] ),
2837
+				'content'                => $this->_get_messenger_box_content($tab_array['obj']),
2838 2838
 				'hidden'                 => $active ? '' : ' hidden',
2839 2839
 				'hide_on_message'        => $hide_on_message,
2840 2840
 				'messenger'              => $messenger,
@@ -2843,11 +2843,11 @@  discard block
 block discarded – undo
2843 2843
 				// message type meta boxes
2844 2844
 				// (which is really just the inactive container for each messenger
2845 2845
 				// showing inactive message types for that messenger)
2846
-				$mt_boxes[ $messenger . '_i_box' ] = __( 'Inactive Message Types', 'event_espresso' );
2847
-				$mt_template_args[ $messenger . '_i_box' ] = array(
2848
-				'active_message_types'   => ! empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2849
-				'inactive_message_types' => isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] )
2850
-				? $this->_get_mt_tabs( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] )
2846
+				$mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso');
2847
+				$mt_template_args[$messenger.'_i_box'] = array(
2848
+				'active_message_types'   => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2849
+				'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'])
2850
+				? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'])
2851 2851
 				: '',
2852 2852
 				'hidden'                 => $active ? '' : ' hidden',
2853 2853
 				'hide_on_message'        => $hide_on_message,
@@ -2860,15 +2860,15 @@  discard block
 block discarded – undo
2860 2860
 
2861 2861
 
2862 2862
 		//register messenger metaboxes
2863
-		$m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php';
2864
-		foreach ( $m_boxes as $box => $label ) {
2865
-			$callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] );
2866
-			$msgr = str_replace( '_a_box', '', $box );
2863
+		$m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php';
2864
+		foreach ($m_boxes as $box => $label) {
2865
+			$callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]);
2866
+			$msgr = str_replace('_a_box', '', $box);
2867 2867
 			add_meta_box(
2868
-				'espresso_' . $msgr . '_settings',
2868
+				'espresso_'.$msgr.'_settings',
2869 2869
 				$label,
2870
-				function( $post, $metabox ) {
2871
-					echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );
2870
+				function($post, $metabox) {
2871
+					echo EEH_Template::display_template($metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE);
2872 2872
 				},
2873 2873
 				$this->_current_screen->id,
2874 2874
 				'normal',
@@ -2878,17 +2878,17 @@  discard block
 block discarded – undo
2878 2878
 		}
2879 2879
 
2880 2880
 		//register message type metaboxes
2881
-		$mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php';
2882
-		foreach ( $mt_boxes as $box => $label ) {
2881
+		$mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php';
2882
+		foreach ($mt_boxes as $box => $label) {
2883 2883
 			$callback_args = array(
2884
-				'template_path' => $mt_template_path, 'template_args' => $mt_template_args[ $box ]
2884
+				'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box]
2885 2885
 			);
2886
-			$mt = str_replace( '_i_box', '', $box );
2886
+			$mt = str_replace('_i_box', '', $box);
2887 2887
 			add_meta_box(
2888
-				'espresso_' . $mt . '_inactive_mts',
2888
+				'espresso_'.$mt.'_inactive_mts',
2889 2889
 				$label,
2890
-				function( $post, $metabox ) {
2891
-					echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );
2890
+				function($post, $metabox) {
2891
+					echo EEH_Template::display_template($metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE);
2892 2892
 				},
2893 2893
 				$this->_current_screen->id,
2894 2894
 				'side',
@@ -2899,11 +2899,11 @@  discard block
 block discarded – undo
2899 2899
 
2900 2900
 		//register metabox for global messages settings but only when on the main site.  On single site installs this will
2901 2901
 		//always result in the metabox showing, on multisite installs the metabox will only show on the main site.
2902
-		if ( is_main_site() ) {
2902
+		if (is_main_site()) {
2903 2903
 			add_meta_box(
2904 2904
 				'espresso_global_message_settings',
2905
-				__( 'Global Message Settings', 'event_espresso' ),
2906
-				array( $this, 'global_messages_settings_metabox_content' ),
2905
+				__('Global Message Settings', 'event_espresso'),
2906
+				array($this, 'global_messages_settings_metabox_content'),
2907 2907
 				$this->_current_screen->id,
2908 2908
 				'normal',
2909 2909
 				'low',
@@ -2923,7 +2923,7 @@  discard block
 block discarded – undo
2923 2923
 	public function global_messages_settings_metabox_content() {
2924 2924
 		$form = $this->_generate_global_settings_form();
2925 2925
 		echo $form->form_open(
2926
-			$this->add_query_args_and_nonce( array( 'action' => 'update_global_settings' ), EE_MSG_ADMIN_URL ),
2926
+			$this->add_query_args_and_nonce(array('action' => 'update_global_settings'), EE_MSG_ADMIN_URL),
2927 2927
 			'POST'
2928 2928
 		)
2929 2929
 		. $form->get_html()
@@ -2936,7 +2936,7 @@  discard block
 block discarded – undo
2936 2936
 	 * @return EE_Form_Section_Proper
2937 2937
 	 */
2938 2938
 	protected function _generate_global_settings_form() {
2939
-		EE_Registry::instance()->load_helper( 'HTML' );
2939
+		EE_Registry::instance()->load_helper('HTML');
2940 2940
 		/** @var EE_Network_Core_Config $network_config */
2941 2941
 		$network_config = EE_Registry::instance()->NET_CFG->core;
2942 2942
 		return new EE_Form_Section_Proper(
@@ -2955,13 +2955,13 @@  discard block
 block discarded – undo
2955 2955
 							),
2956 2956
 							array(
2957 2957
 								'default' => $network_config->do_messages_on_same_request,
2958
-								'html_label_text' => __( 'Generate and send all messages:', 'event_espresso' ),
2959
-								'html_help_text' => __( 'By default the messages system uses a more efficient means of processing messages on separate requests and utilizes the wp-cron scheduling system.  This makes things execute faster for people registering for your events.  However, if the wp-cron system is disabled on your site and there is no alternative in place, then you can change this so messages are always executed on the same request.', 'event_espresso' ),
2958
+								'html_label_text' => __('Generate and send all messages:', 'event_espresso'),
2959
+								'html_help_text' => __('By default the messages system uses a more efficient means of processing messages on separate requests and utilizes the wp-cron scheduling system.  This makes things execute faster for people registering for your events.  However, if the wp-cron system is disabled on your site and there is no alternative in place, then you can change this so messages are always executed on the same request.', 'event_espresso'),
2960 2960
 							)
2961 2961
 						),
2962 2962
 						'update_settings' => new EE_Submit_Input(
2963 2963
 							array(
2964
-								'default' => __( 'Update', 'event_espresso' ),
2964
+								'default' => __('Update', 'event_espresso'),
2965 2965
 								'html_label_text' => '&nbsp'
2966 2966
 							)
2967 2967
 						)
@@ -2980,28 +2980,28 @@  discard block
 block discarded – undo
2980 2980
 		/** @var EE_Network_Core_Config $network_config */
2981 2981
 		$network_config = EE_Registry::instance()->NET_CFG->core;
2982 2982
 		$form = $this->_generate_global_settings_form();
2983
-		if ( $form->was_submitted() ) {
2983
+		if ($form->was_submitted()) {
2984 2984
 			$form->receive_form_submission();
2985
-			if ( $form->is_valid() ) {
2985
+			if ($form->is_valid()) {
2986 2986
 				$valid_data = $form->valid_data();
2987
-				foreach( $valid_data as $property => $value ) {
2988
-					$setter = 'set_' . $property;
2989
-					if ( method_exists( $network_config, $setter ) ) {
2990
-						$network_config->{$setter}( $value );
2987
+				foreach ($valid_data as $property => $value) {
2988
+					$setter = 'set_'.$property;
2989
+					if (method_exists($network_config, $setter)) {
2990
+						$network_config->{$setter}($value);
2991 2991
 					} else if (
2992
-						property_exists( $network_config, $property )
2992
+						property_exists($network_config, $property)
2993 2993
 						&& $network_config->{$property} !== $value
2994 2994
 					) {
2995 2995
 						$network_config->{$property} = $value;
2996 2996
 					}
2997 2997
 				}
2998 2998
 				//only update if the form submission was valid!
2999
-				EE_Registry::instance()->NET_CFG->update_config( true, false );
2999
+				EE_Registry::instance()->NET_CFG->update_config(true, false);
3000 3000
 				EE_Error::overwrite_success();
3001
-				EE_Error::add_success( __( 'Global message settings were updated', 'event_espresso' ) );
3001
+				EE_Error::add_success(__('Global message settings were updated', 'event_espresso'));
3002 3002
 			}
3003 3003
 		}
3004
-		$this->_redirect_after_action( 0, '', '', array( 'action' => 'settings' ), true );
3004
+		$this->_redirect_after_action(0, '', '', array('action' => 'settings'), true);
3005 3005
 	}
3006 3006
 
3007 3007
 
@@ -3012,13 +3012,13 @@  discard block
 block discarded – undo
3012 3012
 	 *
3013 3013
 	 * @return string            html formatted tabs
3014 3014
 	 */
3015
-	protected function _get_mt_tabs( $tab_array ) {
3015
+	protected function _get_mt_tabs($tab_array) {
3016 3016
 		$tab_array = (array) $tab_array;
3017
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php';
3017
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php';
3018 3018
 		$tabs = '';
3019 3019
 
3020
-		foreach ( $tab_array as $tab ) {
3021
-			$tabs .=  EEH_Template::display_template( $template, $tab, true );
3020
+		foreach ($tab_array as $tab) {
3021
+			$tabs .= EEH_Template::display_template($template, $tab, true);
3022 3022
 		}
3023 3023
 
3024 3024
 		return $tabs;
@@ -3034,29 +3034,29 @@  discard block
 block discarded – undo
3034 3034
 	 *
3035 3035
 	 * @return string            html formatted content
3036 3036
 	 */
3037
-	protected function _get_messenger_box_content( EE_messenger $messenger ) {
3037
+	protected function _get_messenger_box_content(EE_messenger $messenger) {
3038 3038
 
3039 3039
 		$fields = $messenger->get_admin_settings_fields();
3040 3040
 		$settings_template_args['template_form_fields'] = '';
3041 3041
 
3042 3042
 		//is $messenger active?
3043
-		$settings_template_args['active'] = $this->_message_resource_manager->is_messenger_active( $messenger->name );
3043
+		$settings_template_args['active'] = $this->_message_resource_manager->is_messenger_active($messenger->name);
3044 3044
 
3045 3045
 
3046
-		if ( ! empty( $fields ) ) {
3046
+		if ( ! empty($fields)) {
3047 3047
 
3048 3048
 			$existing_settings = $messenger->get_existing_admin_settings();
3049 3049
 
3050
-			foreach( $fields as $fldname => $fldprops ) {
3051
-				$field_id = $messenger->name . '-' . $fldname;
3050
+			foreach ($fields as $fldname => $fldprops) {
3051
+				$field_id = $messenger->name.'-'.$fldname;
3052 3052
 				$template_form_field[$field_id] = array(
3053
-					'name' => 'messenger_settings[' . $field_id . ']',
3053
+					'name' => 'messenger_settings['.$field_id.']',
3054 3054
 					'label' => $fldprops['label'],
3055 3055
 					'input' => $fldprops['field_type'],
3056 3056
 					'type' => $fldprops['value_type'],
3057 3057
 					'required' => $fldprops['required'],
3058 3058
 					'validation' => $fldprops['validation'],
3059
-					'value' => isset( $existing_settings[$field_id])
3059
+					'value' => isset($existing_settings[$field_id])
3060 3060
 						? $existing_settings[$field_id]
3061 3061
 						: $fldprops['default'],
3062 3062
 					'css_class' => '',
@@ -3065,8 +3065,8 @@  discard block
 block discarded – undo
3065 3065
 			}
3066 3066
 
3067 3067
 
3068
-			$settings_template_args['template_form_fields'] = !empty($template_form_field)
3069
-				? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' )
3068
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field)
3069
+				? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form')
3070 3070
 				: '';
3071 3071
 		}
3072 3072
 
@@ -3083,39 +3083,39 @@  discard block
 block discarded – undo
3083 3083
 			);
3084 3084
 
3085 3085
 		//make sure any active message types that are existing are included in the hidden fields
3086
-		if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) {
3087
-			foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) {
3086
+		if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) {
3087
+			foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) {
3088 3088
 				$settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array(
3089 3089
 						'type' => 'hidden',
3090 3090
 						'value' => $mt
3091 3091
 					);
3092 3092
 			}
3093 3093
 		}
3094
-		$settings_template_args[ 'hidden_fields' ] = $this->_generate_admin_form_fields(
3095
-			$settings_template_args[ 'hidden_fields' ],
3094
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields(
3095
+			$settings_template_args['hidden_fields'],
3096 3096
 			'array'
3097 3097
 		);
3098
-		$active = $this->_message_resource_manager->is_messenger_active( $messenger->name );
3098
+		$active = $this->_message_resource_manager->is_messenger_active($messenger->name);
3099 3099
 
3100 3100
 		$settings_template_args['messenger'] = $messenger->name;
3101 3101
 		$settings_template_args['description'] = $messenger->description;
3102 3102
 		$settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden';
3103 3103
 
3104 3104
 
3105
-		$settings_template_args['show_hide_edit_form'] = $this->_message_resource_manager->is_messenger_active( $messenger->name )
3105
+		$settings_template_args['show_hide_edit_form'] = $this->_message_resource_manager->is_messenger_active($messenger->name)
3106 3106
 			? $settings_template_args['show_hide_edit_form']
3107 3107
 			: ' hidden';
3108 3108
 
3109
-		$settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] )
3109
+		$settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields'])
3110 3110
 			? ' hidden'
3111 3111
 			: $settings_template_args['show_hide_edit_form'];
3112 3112
 
3113 3113
 
3114 3114
 		$settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on';
3115
-		$settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce');
3115
+		$settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce');
3116 3116
 		$settings_template_args['on_off_status'] = $active ? true : false;
3117
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php';
3118
-		$content = EEH_Template::display_template( $template, $settings_template_args, true);
3117
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php';
3118
+		$content = EEH_Template::display_template($template, $settings_template_args, true);
3119 3119
 		return $content;
3120 3120
 	}
3121 3121
 
@@ -3129,9 +3129,9 @@  discard block
 block discarded – undo
3129 3129
 		$success = true;
3130 3130
 		$this->_prep_default_response_for_messenger_or_message_type_toggle();
3131 3131
 		//let's check that we have required data
3132
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
3132
+		if ( ! isset($this->_req_data['messenger'])) {
3133 3133
 			EE_Error::add_error(
3134
-				__( 'Messenger name needed to toggle activation. None given', 'event_espresso' ),
3134
+				__('Messenger name needed to toggle activation. None given', 'event_espresso'),
3135 3135
 				__FILE__,
3136 3136
 				__FUNCTION__,
3137 3137
 				__LINE__
@@ -3140,14 +3140,14 @@  discard block
 block discarded – undo
3140 3140
 		}
3141 3141
 
3142 3142
 		//do a nonce check here since we're not arriving via a normal route
3143
-		$nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : '';
3144
-		$nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce';
3143
+		$nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : '';
3144
+		$nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce';
3145 3145
 
3146
-		$this->_verify_nonce( $nonce, $nonce_ref );
3146
+		$this->_verify_nonce($nonce, $nonce_ref);
3147 3147
 
3148 3148
 
3149 3149
 
3150
-		if ( !isset( $this->_req_data[ 'status' ])) {
3150
+		if ( ! isset($this->_req_data['status'])) {
3151 3151
 			EE_Error::add_error(
3152 3152
 				__(
3153 3153
 					'Messenger status needed to know whether activation or deactivation is happening. No status is given',
@@ -3163,11 +3163,11 @@  discard block
 block discarded – undo
3163 3163
 		//do check to verify we have a valid status.
3164 3164
 		$status = $this->_req_data['status'];
3165 3165
 
3166
-		if ( $status != 'off' && $status != 'on' ) {
3166
+		if ($status != 'off' && $status != 'on') {
3167 3167
 			EE_Error::add_error(
3168 3168
 				sprintf(
3169
-					__( 'The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso' ),
3170
-					$this->_req_data[ 'status' ]
3169
+					__('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'),
3170
+					$this->_req_data['status']
3171 3171
 				),
3172 3172
 				__FILE__,
3173 3173
 				__FUNCTION__,
@@ -3176,11 +3176,11 @@  discard block
 block discarded – undo
3176 3176
 			$success = false;
3177 3177
 		}
3178 3178
 
3179
-		if ( $success ) {
3179
+		if ($success) {
3180 3180
 			//made it here?  Stop dawdling then!!
3181 3181
 			$success = $status == 'off'
3182
-				? $this->_deactivate_messenger( $this->_req_data['messenger'] )
3183
-				: $this->_activate_messenger( $this->_req_data['messenger'] );
3182
+				? $this->_deactivate_messenger($this->_req_data['messenger'])
3183
+				: $this->_activate_messenger($this->_req_data['messenger']);
3184 3184
 		}
3185 3185
 
3186 3186
 		$this->_template_args['success'] = $success;
@@ -3203,7 +3203,7 @@  discard block
 block discarded – undo
3203 3203
 		$this->_prep_default_response_for_messenger_or_message_type_toggle();
3204 3204
 
3205 3205
 		//let's make sure we have the necessary data
3206
-		if ( ! isset( $this->_req_data[ 'message_type' ] ) ) {
3206
+		if ( ! isset($this->_req_data['message_type'])) {
3207 3207
 			EE_Error::add_error(
3208 3208
 				__('Message Type name needed to toggle activation. None given', 'event_espresso'),
3209 3209
 				__FILE__, __FUNCTION__, __LINE__
@@ -3211,7 +3211,7 @@  discard block
 block discarded – undo
3211 3211
 			$success = false;
3212 3212
 		}
3213 3213
 
3214
-		if ( ! isset( $this->_req_data[ 'messenger' ] ) ) {
3214
+		if ( ! isset($this->_req_data['messenger'])) {
3215 3215
 			EE_Error::add_error(
3216 3216
 				__('Messenger name needed to toggle activation. None given', 'event_espresso'),
3217 3217
 				__FILE__, __FUNCTION__, __LINE__
@@ -3219,7 +3219,7 @@  discard block
 block discarded – undo
3219 3219
 			$success = false;
3220 3220
 		}
3221 3221
 
3222
-		if ( ! isset( $this->_req_data[ 'status' ])) {
3222
+		if ( ! isset($this->_req_data['status'])) {
3223 3223
 			EE_Error::add_error(
3224 3224
 				__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'),
3225 3225
 				__FILE__, __FUNCTION__, __LINE__
@@ -3231,7 +3231,7 @@  discard block
 block discarded – undo
3231 3231
 		//do check to verify we have a valid status.
3232 3232
 		$status = $this->_req_data['status'];
3233 3233
 
3234
-		if ( $status != 'activate' && $status != 'deactivate' ) {
3234
+		if ($status != 'activate' && $status != 'deactivate') {
3235 3235
 			EE_Error::add_error(
3236 3236
 				sprintf(
3237 3237
 					__('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'),
@@ -3244,16 +3244,16 @@  discard block
 block discarded – undo
3244 3244
 
3245 3245
 
3246 3246
 		//do a nonce check here since we're not arriving via a normal route
3247
-		$nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : '';
3248
-		$nonce_ref = $this->_req_data['message_type'] . '_nonce';
3247
+		$nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : '';
3248
+		$nonce_ref = $this->_req_data['message_type'].'_nonce';
3249 3249
 
3250
-		$this->_verify_nonce( $nonce, $nonce_ref );
3250
+		$this->_verify_nonce($nonce, $nonce_ref);
3251 3251
 
3252
-		if ( $success ) {
3252
+		if ($success) {
3253 3253
 			//made it here? um, what are you waiting for then?
3254 3254
 			$success = $status == 'deactivate'
3255
-				? $this->_deactivate_message_type_for_messenger( $this->_req_data['messenger'], $this->_req_data['message_type'] )
3256
-				: $this->_activate_message_type_for_messenger( $this->_req_data['messenger'], $this->_req_data['message_type'] );
3255
+				? $this->_deactivate_message_type_for_messenger($this->_req_data['messenger'], $this->_req_data['message_type'])
3256
+				: $this->_activate_message_type_for_messenger($this->_req_data['messenger'], $this->_req_data['message_type']);
3257 3257
 		}
3258 3258
 
3259 3259
 		$this->_template_args['success'] = $success;
@@ -3267,30 +3267,30 @@  discard block
 block discarded – undo
3267 3267
 	 * @param string $messenger_name The name of the messenger being activated
3268 3268
 	 * @return bool
3269 3269
 	 */
3270
-	protected function _activate_messenger( $messenger_name ) {
3270
+	protected function _activate_messenger($messenger_name) {
3271 3271
 		/** @var EE_messenger $active_messenger  This will be present because it can't be toggled if it isn't*/
3272
-		$active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name );
3272
+		$active_messenger = $this->_message_resource_manager->get_messenger($messenger_name);
3273 3273
 		$message_types_to_activate = $active_messenger instanceof EE_Messenger ? $active_messenger->get_default_message_types() : array();
3274 3274
 
3275 3275
 		//ensure is active
3276
-		$this->_message_resource_manager->activate_messenger( $messenger_name, $message_types_to_activate );
3276
+		$this->_message_resource_manager->activate_messenger($messenger_name, $message_types_to_activate);
3277 3277
 
3278 3278
 		//set response_data for reload
3279
-		foreach( $message_types_to_activate as $message_type_name ) {
3279
+		foreach ($message_types_to_activate as $message_type_name) {
3280 3280
 			/** @var EE_message_type $message_type */
3281
-			$message_type = $this->_message_resource_manager->get_message_type( $message_type_name );
3282
-			if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name )
3281
+			$message_type = $this->_message_resource_manager->get_message_type($message_type_name);
3282
+			if ($this->_message_resource_manager->is_message_type_active_for_messenger($messenger_name, $message_type_name)
3283 3283
 			     && $message_type instanceof EE_message_type
3284 3284
 			) {
3285 3285
 				$this->_template_args['data']['active_mts'][] = $message_type_name;
3286
-				if ( $message_type->get_admin_settings_fields() ) {
3286
+				if ($message_type->get_admin_settings_fields()) {
3287 3287
 					$this->_template_args['data']['mt_reload'][] = $message_type_name;
3288 3288
 				}
3289 3289
 			}
3290 3290
 		}
3291 3291
 
3292 3292
 		//add success message for activating messenger
3293
-		return $this->_setup_response_message_for_activating_messenger_with_message_types( $active_messenger );
3293
+		return $this->_setup_response_message_for_activating_messenger_with_message_types($active_messenger);
3294 3294
 
3295 3295
 	}
3296 3296
 
@@ -3301,11 +3301,11 @@  discard block
 block discarded – undo
3301 3301
 	 * @param string $messenger_name The name of the messenger being activated
3302 3302
 	 * @return bool
3303 3303
 	 */
3304
-	protected function _deactivate_messenger( $messenger_name ) {
3304
+	protected function _deactivate_messenger($messenger_name) {
3305 3305
 		/** @var EE_messenger $active_messenger  This will be present because it can't be toggled if it isn't*/
3306
-		$active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name );
3307
-		$this->_message_resource_manager->deactivate_messenger( $messenger_name );
3308
-		return $this->_setup_response_message_for_deactivating_messenger_with_message_types( $active_messenger );
3306
+		$active_messenger = $this->_message_resource_manager->get_messenger($messenger_name);
3307
+		$this->_message_resource_manager->deactivate_messenger($messenger_name);
3308
+		return $this->_setup_response_message_for_deactivating_messenger_with_message_types($active_messenger);
3309 3309
 	}
3310 3310
 
3311 3311
 
@@ -3316,23 +3316,23 @@  discard block
 block discarded – undo
3316 3316
 	 * @param string $message_type_name  The name of the message type being activated for the messenger
3317 3317
 	 * @return bool
3318 3318
 	 */
3319
-	protected function _activate_message_type_for_messenger( $messenger_name, $message_type_name ) {
3319
+	protected function _activate_message_type_for_messenger($messenger_name, $message_type_name) {
3320 3320
 		/** @var EE_messenger $active_messenger  This will be present because it can't be toggled if it isn't*/
3321
-		$active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name );
3321
+		$active_messenger = $this->_message_resource_manager->get_messenger($messenger_name);
3322 3322
 		/** @var EE_message_type $message_type_to_activate This will be present because it can't be toggled if it isn't*/
3323
-		$message_type_to_activate = $this->_message_resource_manager->get_message_type( $message_type_name );
3323
+		$message_type_to_activate = $this->_message_resource_manager->get_message_type($message_type_name);
3324 3324
 
3325 3325
 		//ensure is active
3326
-		$this->_message_resource_manager->activate_messenger( $messenger_name, $message_type_name );
3326
+		$this->_message_resource_manager->activate_messenger($messenger_name, $message_type_name);
3327 3327
 
3328 3328
 		//set response for load
3329
-		if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
3329
+		if ($this->_message_resource_manager->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
3330 3330
 			$this->_template_args['data']['active_mts'][] = $message_type_name;
3331
-			if ( $message_type_to_activate->get_admin_settings_fields() ) {
3331
+			if ($message_type_to_activate->get_admin_settings_fields()) {
3332 3332
 				$this->_template_args['data']['mt_reload'][] = $message_type_name;
3333 3333
 			}
3334 3334
 		}
3335
-		return $this->_setup_response_message_for_activating_messenger_with_message_types( $active_messenger, $message_type_to_activate );
3335
+		return $this->_setup_response_message_for_activating_messenger_with_message_types($active_messenger, $message_type_to_activate);
3336 3336
 	}
3337 3337
 
3338 3338
 
@@ -3344,13 +3344,13 @@  discard block
 block discarded – undo
3344 3344
 	 * @param string $message_type_name  The name of the message type being deactivated for the messenger
3345 3345
 	 * @return bool
3346 3346
 	 */
3347
-	protected function _deactivate_message_type_for_messenger( $messenger_name, $message_type_name ) {
3347
+	protected function _deactivate_message_type_for_messenger($messenger_name, $message_type_name) {
3348 3348
 		/** @var EE_messenger $active_messenger  This will be present because it can't be toggled if it isn't*/
3349
-		$active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name );
3349
+		$active_messenger = $this->_message_resource_manager->get_messenger($messenger_name);
3350 3350
 		/** @var EE_message_type $message_type_to_activate This will be present because it can't be toggled if it isn't*/
3351
-		$message_type_to_deactivate = $this->_message_resource_manager->get_message_type( $message_type_name );
3352
-		$this->_message_resource_manager->deactivate_message_type_for_messenger( $message_type_name, $messenger_name );
3353
-		return $this->_setup_response_message_for_deactivating_messenger_with_message_types( $active_messenger, $message_type_to_deactivate );
3351
+		$message_type_to_deactivate = $this->_message_resource_manager->get_message_type($message_type_name);
3352
+		$this->_message_resource_manager->deactivate_message_type_for_messenger($message_type_name, $messenger_name);
3353
+		return $this->_setup_response_message_for_deactivating_messenger_with_message_types($active_messenger, $message_type_to_deactivate);
3354 3354
 	}
3355 3355
 
3356 3356
 
@@ -3381,9 +3381,9 @@  discard block
 block discarded – undo
3381 3381
 		EE_Message_Type $message_type = null
3382 3382
 	) {
3383 3383
 		//if $messenger isn't a valid messenger object then get out.
3384
-		if ( ! $messenger instanceof EE_Messenger ) {
3384
+		if ( ! $messenger instanceof EE_Messenger) {
3385 3385
 			EE_Error::add_error(
3386
-				__( 'The messenger being activated is not a valid messenger', 'event_espresso' ),
3386
+				__('The messenger being activated is not a valid messenger', 'event_espresso'),
3387 3387
 				__FILE__,
3388 3388
 				__FUNCTION__,
3389 3389
 				__LINE__
@@ -3391,32 +3391,32 @@  discard block
 block discarded – undo
3391 3391
 			return false;
3392 3392
 		}
3393 3393
 		//activated
3394
-		if ( $this->_template_args['data']['active_mts'] ) {
3394
+		if ($this->_template_args['data']['active_mts']) {
3395 3395
 			EE_Error::overwrite_success();
3396 3396
 			//activated a message type with the messenger
3397
-			if ( $message_type instanceof EE_message_type ) {
3397
+			if ($message_type instanceof EE_message_type) {
3398 3398
 				EE_Error::add_success(
3399 3399
 					sprintf(
3400 3400
 						__('%s message type has been successfully activated with the %s messenger', 'event_espresso'),
3401
-						ucwords( $message_type->label['singular'] ),
3402
-						ucwords( $messenger->label['singular'] )
3401
+						ucwords($message_type->label['singular']),
3402
+						ucwords($messenger->label['singular'])
3403 3403
 					)
3404 3404
 				);
3405 3405
 
3406 3406
 				//if message type was invoice then let's make sure we activate the invoice payment method.
3407
-				if ( $message_type->name == 'invoice' ) {
3408
-					EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
3409
-					$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
3410
-					if ( $pm instanceof EE_Payment_Method ) {
3411
-						EE_Error::add_attention( __('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso' ) );
3407
+				if ($message_type->name == 'invoice') {
3408
+					EE_Registry::instance()->load_lib('Payment_Method_Manager');
3409
+					$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
3410
+					if ($pm instanceof EE_Payment_Method) {
3411
+						EE_Error::add_attention(__('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso'));
3412 3412
 					}
3413 3413
 				}
3414 3414
 			//just toggles the entire messenger
3415 3415
 			} else {
3416 3416
 				EE_Error::add_success(
3417 3417
 					sprintf(
3418
-						__( '%s messenger has been successfully activated', 'event_espresso' ),
3419
-						ucwords( $messenger->label[ 'singular' ] )
3418
+						__('%s messenger has been successfully activated', 'event_espresso'),
3419
+						ucwords($messenger->label['singular'])
3420 3420
 					)
3421 3421
 				);
3422 3422
 			}
@@ -3426,12 +3426,12 @@  discard block
 block discarded – undo
3426 3426
 		//message types after the activation process.  However its possible some messengers don't HAVE any default_message_types
3427 3427
 		//in which case we just give a success message for the messenger being successfully activated.
3428 3428
 		} else {
3429
-			if ( ! $messenger->get_default_message_types() ) {
3429
+			if ( ! $messenger->get_default_message_types()) {
3430 3430
 				//messenger doesn't have any default message types so still a success.
3431 3431
 				EE_Error::add_success(
3432 3432
 					sprintf(
3433
-						__('%s messenger was successfully activated.', 'event_espresso' ),
3434
-						ucwords( $messenger->label['singular'] )
3433
+						__('%s messenger was successfully activated.', 'event_espresso'),
3434
+						ucwords($messenger->label['singular'])
3435 3435
 						)
3436 3436
 				);
3437 3437
 				return true;
@@ -3439,13 +3439,13 @@  discard block
 block discarded – undo
3439 3439
 				EE_Error::add_error(
3440 3440
 					$message_type instanceof EE_message_type
3441 3441
 						? sprintf(
3442
-						__( '%s message type was not successfully activated with the %s messenger', 'event_espresso' ),
3443
-						ucwords( $message_type->label['singular'] ),
3444
-						ucwords( $messenger->label['singular'] )
3442
+						__('%s message type was not successfully activated with the %s messenger', 'event_espresso'),
3443
+						ucwords($message_type->label['singular']),
3444
+						ucwords($messenger->label['singular'])
3445 3445
 					)
3446 3446
 						: sprintf(
3447
-						__( '%s messenger was not successfully activated', 'event_espresso' ),
3448
-						ucwords( $messenger->label['singular'] )
3447
+						__('%s messenger was not successfully activated', 'event_espresso'),
3448
+						ucwords($messenger->label['singular'])
3449 3449
 					),
3450 3450
 					__FILE__,
3451 3451
 					__FUNCTION__,
@@ -3473,9 +3473,9 @@  discard block
 block discarded – undo
3473 3473
 		EE_Error::overwrite_success();
3474 3474
 
3475 3475
 		//if $messenger isn't a valid messenger object then get out.
3476
-		if ( ! $messenger instanceof EE_Messenger ) {
3476
+		if ( ! $messenger instanceof EE_Messenger) {
3477 3477
 			EE_Error::add_error(
3478
-				__( 'The messenger being deactivated is not a valid messenger', 'event_espresso' ),
3478
+				__('The messenger being deactivated is not a valid messenger', 'event_espresso'),
3479 3479
 				__FILE__,
3480 3480
 				__FUNCTION__,
3481 3481
 				__LINE__
@@ -3483,13 +3483,13 @@  discard block
 block discarded – undo
3483 3483
 			return false;
3484 3484
 		}
3485 3485
 
3486
-		if ( $message_type instanceof EE_message_type ) {
3486
+		if ($message_type instanceof EE_message_type) {
3487 3487
 			$message_type_name = $message_type->name;
3488 3488
 			EE_Error::add_success(
3489 3489
 				sprintf(
3490 3490
 					__('%s message type has been successfully deactivated for the %s messenger.', 'event_espresso'),
3491
-					ucwords( $message_type->label['singular'] ),
3492
-					ucwords ( $messenger->label['singular'] )
3491
+					ucwords($message_type->label['singular']),
3492
+					ucwords($messenger->label['singular'])
3493 3493
 				)
3494 3494
 			);
3495 3495
 		} else {
@@ -3497,20 +3497,20 @@  discard block
 block discarded – undo
3497 3497
 			EE_Error::add_success(
3498 3498
 				sprintf(
3499 3499
 					__('%s messenger has been successfully deactivated.', 'event_espresso'),
3500
-					ucwords( $messenger->label['singular'] )
3500
+					ucwords($messenger->label['singular'])
3501 3501
 				)
3502 3502
 			);
3503 3503
 		}
3504 3504
 
3505 3505
 		//if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method.
3506
-		if ( $messenger->name == 'html'  || $message_type_name == 'invoice') {
3507
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
3508
-			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' );
3509
-			if ( $count_updated > 0 ) {
3506
+		if ($messenger->name == 'html' || $message_type_name == 'invoice') {
3507
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
3508
+			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice');
3509
+			if ($count_updated > 0) {
3510 3510
 				$msg = $message_type_name == 'invoice'
3511
-					? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' )
3512
-					: __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' );
3513
-				EE_Error::add_attention( $msg );
3511
+					? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso')
3512
+					: __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso');
3513
+				EE_Error::add_attention($msg);
3514 3514
 			}
3515 3515
 		}
3516 3516
 		return true;
@@ -3521,17 +3521,17 @@  discard block
 block discarded – undo
3521 3521
 	 * handles updating a message type form on messenger activation IF the message type has settings fields. (via ajax)
3522 3522
 	 */
3523 3523
 	public function update_mt_form() {
3524
-		if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) {
3525
-			EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ );
3524
+		if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) {
3525
+			EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__);
3526 3526
 			$this->_return_json();
3527 3527
 		}
3528 3528
 
3529 3529
 		$message_types = $this->get_installed_message_types();
3530 3530
 
3531
-		$message_type = $message_types[ $this->_req_data['message_type'] ];
3532
-		$messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] );
3531
+		$message_type = $message_types[$this->_req_data['message_type']];
3532
+		$messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']);
3533 3533
 
3534
-		$content = $this->_message_type_settings_content ( $message_type, $messenger, true );
3534
+		$content = $this->_message_type_settings_content($message_type, $messenger, true);
3535 3535
 		$this->_template_args['success'] = true;
3536 3536
 		$this->_template_args['content'] = $content;
3537 3537
 		$this->_return_json();
@@ -3545,45 +3545,45 @@  discard block
 block discarded – undo
3545 3545
 	 *
3546 3546
 	 */
3547 3547
 	public function save_settings() {
3548
-		if ( !isset( $this->_req_data['type'] ) ) {
3549
-			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
3548
+		if ( ! isset($this->_req_data['type'])) {
3549
+			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
3550 3550
 			$this->_template_args['error'] = true;
3551 3551
 			$this->_return_json();
3552 3552
 		}
3553 3553
 
3554 3554
 
3555
-		if ( $this->_req_data['type'] == 'messenger' ) {
3555
+		if ($this->_req_data['type'] == 'messenger') {
3556 3556
 			$settings = $this->_req_data['messenger_settings']; //this should be an array.
3557 3557
 			$messenger = $settings['messenger'];
3558 3558
 			//let's setup the settings data
3559
-			foreach ( $settings as $key => $value ) {
3560
-				switch ( $key ) {
3559
+			foreach ($settings as $key => $value) {
3560
+				switch ($key) {
3561 3561
 					case 'messenger' :
3562
-						unset( $settings['messenger'] );
3562
+						unset($settings['messenger']);
3563 3563
 						break;
3564 3564
 					case 'message_types' :
3565
-						unset( $settings['message_types'] );
3565
+						unset($settings['message_types']);
3566 3566
 						break;
3567 3567
 					default :
3568 3568
 						$settings[$key] = $value;
3569 3569
 						break;
3570 3570
 				}
3571 3571
 			}
3572
-			$this->_message_resource_manager->add_settings_for_messenger( $messenger, $settings );
3572
+			$this->_message_resource_manager->add_settings_for_messenger($messenger, $settings);
3573 3573
 		}
3574 3574
 
3575
-		else if ( $this->_req_data['type'] == 'message_type' ) {
3575
+		else if ($this->_req_data['type'] == 'message_type') {
3576 3576
 			$settings = $this->_req_data['message_type_settings'];
3577 3577
 			$messenger = $settings['messenger'];
3578 3578
 			$message_type = $settings['message_type'];
3579 3579
 
3580
-			foreach ( $settings as $key => $value ) {
3581
-				switch ( $key ) {
3580
+			foreach ($settings as $key => $value) {
3581
+				switch ($key) {
3582 3582
 					case 'messenger' :
3583
-						unset( $settings['messenger'] );
3583
+						unset($settings['messenger']);
3584 3584
 						break;
3585 3585
 					case 'message_type' :
3586
-						unset( $settings['message_type'] );
3586
+						unset($settings['message_type']);
3587 3587
 						break;
3588 3588
 					default :
3589 3589
 						$settings[$key] = $value;
@@ -3591,16 +3591,16 @@  discard block
 block discarded – undo
3591 3591
 				}
3592 3592
 			}
3593 3593
 
3594
-			$this->_message_resource_manager->add_settings_for_message_type( $messenger, $message_type, $settings );
3594
+			$this->_message_resource_manager->add_settings_for_message_type($messenger, $message_type, $settings);
3595 3595
 		}
3596 3596
 
3597 3597
 		//okay we should have the data all setup.  Now we just update!
3598 3598
 		$success = $this->_message_resource_manager->update_active_messengers_option();
3599 3599
 
3600
-		if ( $success ) {
3601
-			EE_Error::add_success( __('Settings updated', 'event_espresso') );
3600
+		if ($success) {
3601
+			EE_Error::add_success(__('Settings updated', 'event_espresso'));
3602 3602
 		} else {
3603
-			EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
3603
+			EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
3604 3604
 		}
3605 3605
 
3606 3606
 		$this->_template_args['success'] = $success;
@@ -3622,8 +3622,8 @@  discard block
 block discarded – undo
3622 3622
      */
3623 3623
 	protected function _generate_now() {
3624 3624
 		$msg_ids = $this->_get_msg_ids_from_request();
3625
-		EED_Messages::generate_now( $msg_ids );
3626
-		$this->_redirect_after_action( false, '', '', array(), true );
3625
+		EED_Messages::generate_now($msg_ids);
3626
+		$this->_redirect_after_action(false, '', '', array(), true);
3627 3627
 	}
3628 3628
 
3629 3629
 
@@ -3638,7 +3638,7 @@  discard block
 block discarded – undo
3638 3638
 	protected function _generate_and_send_now() {
3639 3639
 		$this->_generate_now();
3640 3640
 		$this->_send_now();
3641
-		$this->_redirect_after_action( false, '', '', array(), true );
3641
+		$this->_redirect_after_action(false, '', '', array(), true);
3642 3642
 	}
3643 3643
 
3644 3644
 
@@ -3652,8 +3652,8 @@  discard block
 block discarded – undo
3652 3652
      */
3653 3653
 	protected function _queue_for_resending() {
3654 3654
 		$msg_ids = $this->_get_msg_ids_from_request();
3655
-		EED_Messages::queue_for_resending( $msg_ids );
3656
-		$this->_redirect_after_action( false, '', '', array(), true );
3655
+		EED_Messages::queue_for_resending($msg_ids);
3656
+		$this->_redirect_after_action(false, '', '', array(), true);
3657 3657
 	}
3658 3658
 
3659 3659
 
@@ -3666,8 +3666,8 @@  discard block
 block discarded – undo
3666 3666
      */
3667 3667
 	protected function _send_now() {
3668 3668
 		$msg_ids = $this->_get_msg_ids_from_request();
3669
-		EED_Messages::send_now( $msg_ids );
3670
-		$this->_redirect_after_action( false, '', '', array(), true );
3669
+		EED_Messages::send_now($msg_ids);
3670
+		$this->_redirect_after_action(false, '', '', array(), true);
3671 3671
 	}
3672 3672
 
3673 3673
 
@@ -3681,23 +3681,23 @@  discard block
 block discarded – undo
3681 3681
 	protected function _delete_ee_messages() {
3682 3682
 		$msg_ids = $this->_get_msg_ids_from_request();
3683 3683
 		$deleted_count = 0;
3684
-		foreach ( $msg_ids as $msg_id ) {
3685
-			if ( EEM_Message::instance()->delete_by_ID( $msg_id ) ) {
3684
+		foreach ($msg_ids as $msg_id) {
3685
+			if (EEM_Message::instance()->delete_by_ID($msg_id)) {
3686 3686
 				$deleted_count++;
3687 3687
 			}
3688 3688
 		}
3689
-		if ( $deleted_count ) {
3689
+		if ($deleted_count) {
3690 3690
 			$this->_redirect_after_action(
3691 3691
 				true,
3692
-				_n( 'message', 'messages', $deleted_count, 'event_espresso' ),
3692
+				_n('message', 'messages', $deleted_count, 'event_espresso'),
3693 3693
 				__('deleted', 'event_espresso')
3694 3694
 			);
3695 3695
 		} else {
3696 3696
 			EE_Error::add_error(
3697
-				_n( 'The message was not deleted.', 'The messages were not deleted', count( $msg_ids ), 'event_espresso' ),
3697
+				_n('The message was not deleted.', 'The messages were not deleted', count($msg_ids), 'event_espresso'),
3698 3698
 				__FILE__, __FUNCTION__, __LINE__
3699 3699
 			);
3700
-			$this->_redirect_after_action( false, '', '', array(), true );
3700
+			$this->_redirect_after_action(false, '', '', array(), true);
3701 3701
 		}
3702 3702
 	}
3703 3703
 
@@ -3710,10 +3710,10 @@  discard block
 block discarded – undo
3710 3710
      *  @return array
3711 3711
      */
3712 3712
 	protected function _get_msg_ids_from_request() {
3713
-		if ( ! isset( $this->_req_data['MSG_ID'] ) ) {
3713
+		if ( ! isset($this->_req_data['MSG_ID'])) {
3714 3714
 			return array();
3715 3715
 		}
3716
-		return is_array( $this->_req_data['MSG_ID'] ) ? array_keys( $this->_req_data['MSG_ID'] ) : array( $this->_req_data['MSG_ID'] );
3716
+		return is_array($this->_req_data['MSG_ID']) ? array_keys($this->_req_data['MSG_ID']) : array($this->_req_data['MSG_ID']);
3717 3717
 	}
3718 3718
 
3719 3719
 
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Template_List_Table.class.php 1 patch
Spacing   +39 added lines, -39 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
 /**
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 
42 42
 
43 43
 	protected function _setup_data() {
44
-		$this->_data = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, FALSE);
45
-		$this->_all_data_count = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, TRUE, TRUE );
44
+		$this->_data = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, FALSE);
45
+		$this->_all_data_count = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, TRUE, TRUE);
46 46
 	}
47 47
 
48 48
 
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
 
52 52
 	protected function _set_properties() {
53 53
 		$this->_wp_list_args = array(
54
-			'singular' => __('Message Template Group', 'event_espresso' ),
55
-			'plural' => __('Message Template', 'event_espresso' ),
54
+			'singular' => __('Message Template Group', 'event_espresso'),
55
+			'plural' => __('Message Template', 'event_espresso'),
56 56
 			'ajax' => TRUE, //for now,
57 57
 			'screen' => $this->get_admin_page()->get_current_screen()->id
58 58
 			);
59 59
 		$this->_columns = array(
60 60
 			//'cb' => '<input type="checkbox" />', //no deleting default (global) templates!
61 61
 			'message_type' => __('Message Type', 'event_espresso'),
62
-			'messenger' => __( 'Messenger', 'event_espresso'),
63
-			'description' => __( 'Description', 'event_espresso' ),
62
+			'messenger' => __('Messenger', 'event_espresso'),
63
+			'description' => __('Description', 'event_espresso'),
64 64
 			//'messages_sent' => __( 'Total Sent', 'event_espresso' ) //todo this will come later when we've got message tracking in place.
65 65
 			);
66 66
 
67 67
 		$this->_sortable_columns = array(
68
-			'messenger' => array( 'MTP_messenger' => TRUE ),
68
+			'messenger' => array('MTP_messenger' => TRUE),
69 69
 			//'message_type' => array( 'MTP_message_type' => FALSE )
70 70
 			);
71 71
 
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return string
86 86
 	 */
87
-	public function single_row( $item ) {
87
+	public function single_row($item) {
88 88
 		$message_type = $item->message_type_obj();
89 89
 		$messenger = $item->messenger_obj();
90 90
 
91
-		if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger ) {
91
+		if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) {
92 92
 			echo '';
93 93
 			return;
94 94
 		}
95 95
 
96
-		parent::single_row( $item );
96
+		parent::single_row($item);
97 97
 	}
98 98
 
99 99
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 		);
112 112
 
113 113
 		//set filters to select inputs if they aren't empty
114
-		foreach ( $select_inputs as $select_input ) {
115
-			if ( $select_input ) {
114
+		foreach ($select_inputs as $select_input) {
115
+			if ($select_input) {
116 116
 				$filters[] = $select_input;
117 117
 			}
118 118
 		}
@@ -123,20 +123,20 @@  discard block
 block discarded – undo
123 123
 	 * we're just removing the search box for message templates, not needed.
124 124
 	 * @return string (empty);
125 125
 	 */
126
-	function search_box( $text, $input_id ) {
126
+	function search_box($text, $input_id) {
127 127
 		return '';
128 128
 	}
129 129
 
130 130
 
131 131
 	protected function _add_view_counts() {
132
-		foreach ( $this->_views as $view => $args )  {
133
-			$this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates( $this->_per_page, $view, TRUE, TRUE );
132
+		foreach ($this->_views as $view => $args) {
133
+			$this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates($this->_per_page, $view, TRUE, TRUE);
134 134
 		}
135 135
 	}
136 136
 
137 137
 
138 138
 
139
-	public function column_cb( $item ) {
139
+	public function column_cb($item) {
140 140
 		return '';
141 141
 	}
142 142
 
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 
145 145
 
146 146
 
147
-	function column_description( $item ) {
148
-		return '<p>' . $item->message_type_obj()->description . '</p>';
147
+	function column_description($item) {
148
+		return '<p>'.$item->message_type_obj()->description.'</p>';
149 149
 	}
150 150
 
151 151
 
@@ -160,27 +160,27 @@  discard block
 block discarded – undo
160 160
 		$actions = array();
161 161
 
162 162
 		// edit link but only if item isn't trashed.
163
-		if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ) {
164
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_message_template', 'id'=>$item->GRP_ID() ), EE_MSG_ADMIN_URL );
165
-			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template Group', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>';
163
+		if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID())) {
164
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID()), EE_MSG_ADMIN_URL);
165
+			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template Group', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>';
166 166
 		}
167 167
 
168
-		$name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template Group', 'event_espresso' ) . '">' . ucwords( $item->messenger_obj()->label['singular'] ) . '</a>' : ucwords( $item->messenger_obj()->label['singular'] );
168
+		$name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template Group', 'event_espresso').'">'.ucwords($item->messenger_obj()->label['singular']).'</a>' : ucwords($item->messenger_obj()->label['singular']);
169 169
 
170 170
 		//we want to display the contexts in here so we need to set them up
171 171
 		$c_label = $item->context_label();
172 172
 		$c_configs = $item->contexts_config();
173 173
 		$ctxt = array();
174 174
 		$context_templates = $item->context_templates();
175
-		foreach ( $context_templates as $context => $template_fields ) {
176
-			$mtp_to = !empty( $context_templates[$context]['to'] ) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL;
177
-			$inactive = empty( $mtp_to ) && !empty( $context_templates[$context]['to'] ) ? ' class="mtp-inactive"' : '';
175
+		foreach ($context_templates as $context => $template_fields) {
176
+			$mtp_to = ! empty($context_templates[$context]['to']) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL;
177
+			$inactive = empty($mtp_to) && ! empty($context_templates[$context]['to']) ? ' class="mtp-inactive"' : '';
178 178
 			$context_title = ucwords($c_configs[$context]['label']);
179
-			$edit_link = EE_Admin_Page::add_query_args_and_nonce( array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL );
180
-			$ctxt[] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a' . $inactive . ' href="'. $edit_link . '" title="' . esc_attr__('Edit Context', 'event_espresso') . '">' . $context_title . '</a>' : $context_title;
179
+			$edit_link = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL);
180
+			$ctxt[] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a'.$inactive.' href="'.$edit_link.'" title="'.esc_attr__('Edit Context', 'event_espresso').'">'.$context_title.'</a>' : $context_title;
181 181
 		}
182 182
 
183
-		$ctx_content = !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? sprintf( __('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural']) ) . implode(' | ', $ctxt) : '';
183
+		$ctx_content = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? sprintf(__('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural'])).implode(' | ', $ctxt) : '';
184 184
 
185 185
 
186 186
 		//Return the name contents
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 										/* $1%s */ $name_link,
189 189
 										/* $2%s */ $item->GRP_ID(),
190 190
 										/* %4$s */ $ctx_content,
191
-										/* $3%s */ $this->row_actions( $actions )
191
+										/* $3%s */ $this->row_actions($actions)
192 192
 		);
193 193
 	}
194 194
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 * @return string       message_type name
199 199
 	 */
200 200
 	function column_message_type($item) {
201
-		return ucwords($item->message_type_obj()->label['singular'] );
201
+		return ucwords($item->message_type_obj()->label['singular']);
202 202
 	}
203 203
 
204 204
 
@@ -225,16 +225,16 @@  discard block
 block discarded – undo
225 225
 			)
226 226
 		);
227 227
 
228
-		foreach ( $active_message_template_groups_grouped_by_messenger as $active_message_template_group ) {
229
-			if ( $active_message_template_group instanceof EE_Message_Template_Group ) {
228
+		foreach ($active_message_template_groups_grouped_by_messenger as $active_message_template_group) {
229
+			if ($active_message_template_group instanceof EE_Message_Template_Group) {
230 230
 				$messenger = $active_message_template_group->messenger_obj();
231 231
 				$messenger_label = $messenger instanceof EE_messenger
232 232
 					? $messenger->label['singular']
233 233
 					: $active_message_template_group->messenger();
234
-				$messenger_options[ $active_message_template_group->messenger() ] = ucwords( $messenger_label );
234
+				$messenger_options[$active_message_template_group->messenger()] = ucwords($messenger_label);
235 235
 			}
236 236
 		}
237
-		return $this->get_admin_page()->get_messengers_select_input( $messenger_options );
237
+		return $this->get_admin_page()->get_messengers_select_input($messenger_options);
238 238
 	}
239 239
 
240 240
 
@@ -254,16 +254,16 @@  discard block
 block discarded – undo
254 254
 			)
255 255
 		);
256 256
 
257
-		foreach ( $active_message_template_groups_grouped_by_message_type as $active_message_template_group ) {
258
-			if ( $active_message_template_group instanceof EE_Message_Template_Group ) {
257
+		foreach ($active_message_template_groups_grouped_by_message_type as $active_message_template_group) {
258
+			if ($active_message_template_group instanceof EE_Message_Template_Group) {
259 259
 				$message_type = $active_message_template_group->message_type_obj();
260 260
 				$message_type_label = $message_type instanceof EE_message_type
261 261
 					? $message_type->label['singular']
262 262
 					: $active_message_template_group->message_type();
263
-				$message_type_options[ $active_message_template_group->message_type() ] = ucwords( $message_type_label );
263
+				$message_type_options[$active_message_template_group->message_type()] = ucwords($message_type_label);
264 264
 			}
265 265
 		}
266
-		return $this->get_admin_page()->get_message_types_select_input( $message_type_options );
266
+		return $this->get_admin_page()->get_message_types_select_input($message_type_options);
267 267
 	}
268 268
 
269 269
 }
Please login to merge, or discard this patch.
admin_pages/messages/EE_Message_List_Table.class.php 1 patch
Spacing   +104 added lines, -104 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
 /**
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 
27 27
 
28 28
 	protected function _setup_data() {
29
-		$this->_data = $this->_get_messages( $this->_per_page, $this->_view );
30
-		$this->_all_data_count = $this->_get_messages( $this->_per_page, $this->_view, true );
29
+		$this->_data = $this->_get_messages($this->_per_page, $this->_view);
30
+		$this->_all_data_count = $this->_get_messages($this->_per_page, $this->_view, true);
31 31
 	}
32 32
 
33 33
 
@@ -35,32 +35,32 @@  discard block
 block discarded – undo
35 35
 
36 36
 	protected function _set_properties() {
37 37
 		$this->_wp_list_args = array(
38
-			'singular' => __( 'Message', 'event_espresso' ),
39
-			'plural' => __( 'Messages', 'event_espresso' ),
38
+			'singular' => __('Message', 'event_espresso'),
39
+			'plural' => __('Messages', 'event_espresso'),
40 40
 			'ajax' => true,
41 41
 			'screen' => $this->get_admin_page()->get_current_screen()->id
42 42
 		);
43 43
 
44 44
 		$this->_columns = array(
45 45
 			'cb' => '<input type="checkbox" />',
46
-			'to' => __( 'To', 'event_espresso' ),
47
-			'from' => __( 'From', 'event_espresso' ),
48
-			'messenger' => __( 'Messenger', 'event_espresso' ),
49
-			'message_type' => __( 'Message Type', 'event_espresso' ),
50
-			'context' => __( 'Context', 'event_espresso' ),
51
-			'modified' => __( 'Modified', 'event_espresso' ),
52
-			'action' => __( 'Actions', 'event_espresso' ),
53
-			'msg_id' => __( 'ID', 'event_espresso' ),
46
+			'to' => __('To', 'event_espresso'),
47
+			'from' => __('From', 'event_espresso'),
48
+			'messenger' => __('Messenger', 'event_espresso'),
49
+			'message_type' => __('Message Type', 'event_espresso'),
50
+			'context' => __('Context', 'event_espresso'),
51
+			'modified' => __('Modified', 'event_espresso'),
52
+			'action' => __('Actions', 'event_espresso'),
53
+			'msg_id' => __('ID', 'event_espresso'),
54 54
 		);
55 55
 
56 56
 		$this->_sortable_columns = array(
57
-			'modified' => array( 'MSG_modified' => true ),
58
-			'message_type' => array( 'MSG_message_type' => false ),
59
-			'messenger' => array( 'MSG_messenger' => false ),
60
-			'to' => array( 'MSG_to' => false ),
61
-			'from' => array( 'MSG_from' => false ),
62
-			'context' => array( 'MSG_context' => false ),
63
-			'msg_id' => array( 'MSG_ID', false ),
57
+			'modified' => array('MSG_modified' => true),
58
+			'message_type' => array('MSG_message_type' => false),
59
+			'messenger' => array('MSG_messenger' => false),
60
+			'to' => array('MSG_to' => false),
61
+			'from' => array('MSG_from' => false),
62
+			'context' => array('MSG_context' => false),
63
+			'msg_id' => array('MSG_ID', false),
64 64
 		);
65 65
 
66 66
 		$this->_primary_column = 'to';
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 	 * @param  object $item the current item
79 79
 	 * @return string
80 80
 	 */
81
-	protected function _get_row_class( $item ) {
82
-		$class = parent::_get_row_class( $item );
81
+	protected function _get_row_class($item) {
82
+		$class = parent::_get_row_class($item);
83 83
 		//add status class
84
-		$class .= ' ee-status-strip msg-status-' . $item->STS_ID();
85
-		if ( $this->_has_checkbox_column ) {
84
+		$class .= ' ee-status-strip msg-status-'.$item->STS_ID();
85
+		if ($this->_has_checkbox_column) {
86 86
 			$class .= ' has-checkbox-column';
87 87
 		}
88 88
 		return $class;
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 		);
111 111
 
112 112
 		//set filters to select inputs if they aren't empty
113
-		foreach ( $select_inputs as $select_input ) {
114
-			if ( $select_input ) {
113
+		foreach ($select_inputs as $select_input) {
114
+			if ($select_input) {
115 115
 				$filters[] = $select_input;
116 116
 			}
117 117
 		}
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 
122 122
 
123 123
 	protected function _add_view_counts() {
124
-		foreach ( $this->_views as $view => $args ) {
125
-			$this->_views[ $view ]['count'] = $this->_get_messages( $this->_per_page, $view, true, true );
124
+		foreach ($this->_views as $view => $args) {
125
+			$this->_views[$view]['count'] = $this->_get_messages($this->_per_page, $view, true, true);
126 126
 		}
127 127
 	}
128 128
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	 * @return string   checkbox
134 134
 	 * @throws \EE_Error
135 135
 	 */
136
-	public function column_cb( $message ) {
137
-		return sprintf( '<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID() );
136
+	public function column_cb($message) {
137
+		return sprintf('<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID());
138 138
 	}
139 139
 
140 140
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @return string
145 145
 	 * @throws \EE_Error
146 146
 	 */
147
-	public function column_msg_id( EE_Message $message ) {
147
+	public function column_msg_id(EE_Message $message) {
148 148
 		return $message->ID();
149 149
 	}
150 150
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 * @return string    The recipient of the message
156 156
 	 * @throws \EE_Error
157 157
 	 */
158
-	public function column_to( EE_Message $message ) {
159
-		EE_Registry::instance()->load_helper( 'URL' );
158
+	public function column_to(EE_Message $message) {
159
+		EE_Registry::instance()->load_helper('URL');
160 160
 		$actions = array();
161 161
 		$actions['delete'] = '<a href="'
162 162
 			. EEH_URL::add_query_args_and_nonce(
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 					'action' => 'delete_ee_message',
166 166
 					'MSG_ID' => $message->ID()
167 167
 				),
168
-				admin_url( 'admin.php' )
168
+				admin_url('admin.php')
169 169
 			)
170
-			. '">' . __( 'Delete', 'event_espresso' ) . '</a>';
171
-		return $message->to() . $this->row_actions( $actions );
170
+			. '">'.__('Delete', 'event_espresso').'</a>';
171
+		return $message->to().$this->row_actions($actions);
172 172
 	}
173 173
 
174 174
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 * @param EE_Message $message
177 177
 	 * @return string   The sender of the message
178 178
 	 */
179
-	public function column_from( EE_Message $message ) {
179
+	public function column_from(EE_Message $message) {
180 180
 		return $message->from();
181 181
 	}
182 182
 
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 	 * @param EE_Message $message
187 187
 	 * @return string  The messenger used to send the message.
188 188
 	 */
189
-	public function column_messenger( EE_Message $message ) {
190
-		return ucwords( $message->messenger_label() );
189
+	public function column_messenger(EE_Message $message) {
190
+		return ucwords($message->messenger_label());
191 191
 	}
192 192
 
193 193
 
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
 	 * @param EE_Message $message
196 196
 	 * @return string  The message type used to generate the message.
197 197
 	 */
198
-	public function column_message_type( EE_Message $message ) {
199
-		return ucwords( $message->message_type_label() );
198
+	public function column_message_type(EE_Message $message) {
199
+		return ucwords($message->message_type_label());
200 200
 	}
201 201
 
202 202
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 * @param EE_Message $message
205 205
 	 * @return string  The context the message was generated for.
206 206
 	 */
207
-	public function column_context( EE_Message $message ) {
207
+	public function column_context(EE_Message $message) {
208 208
 		return $message->context_label();
209 209
 	}
210 210
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @param EE_Message $message
214 214
 	 * @return string    The timestamp when this message was last modified.
215 215
 	 */
216
-	public function column_modified( EE_Message $message ) {
216
+	public function column_modified(EE_Message $message) {
217 217
 		return $message->modified();
218 218
 	}
219 219
 
@@ -222,36 +222,36 @@  discard block
 block discarded – undo
222 222
 	 * @param EE_Message $message
223 223
 	 * @return string   Actions that can be done on the current message.
224 224
 	 */
225
-	public function column_action( EE_Message $message ) {
226
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
225
+	public function column_action(EE_Message $message) {
226
+		EE_Registry::instance()->load_helper('MSG_Template');
227 227
 		$action_links = array(
228
-			'view' => EEH_MSG_Template::get_message_action_link( 'view', $message ),
229
-			'error' => EEH_MSG_Template::get_message_action_link( 'error', $message ),
230
-			'generate_now' => EEH_MSG_Template::get_message_action_link( 'generate_now', $message ),
231
-			'send_now' => EEH_MSG_Template::get_message_action_link( 'send_now', $message ),
232
-			'queue_for_resending' => EEH_MSG_Template::get_message_action_link( 'queue_for_resending', $message ),
233
-			'view_transaction' => EEH_MSG_Template::get_message_action_link( 'view_transaction', $message ),
228
+			'view' => EEH_MSG_Template::get_message_action_link('view', $message),
229
+			'error' => EEH_MSG_Template::get_message_action_link('error', $message),
230
+			'generate_now' => EEH_MSG_Template::get_message_action_link('generate_now', $message),
231
+			'send_now' => EEH_MSG_Template::get_message_action_link('send_now', $message),
232
+			'queue_for_resending' => EEH_MSG_Template::get_message_action_link('queue_for_resending', $message),
233
+			'view_transaction' => EEH_MSG_Template::get_message_action_link('view_transaction', $message),
234 234
 		);
235 235
 		$content = '';
236
-		switch ( $message->STS_ID() ) {
236
+		switch ($message->STS_ID()) {
237 237
 			case EEM_Message::status_sent :
238
-				$content = $action_links['view'] . $action_links['queue_for_resending'] . $action_links['view_transaction'];
238
+				$content = $action_links['view'].$action_links['queue_for_resending'].$action_links['view_transaction'];
239 239
 				break;
240 240
 			case EEM_Message::status_resend :
241
-				$content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction'];
241
+				$content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction'];
242 242
 				break;
243 243
 			case EEM_Message::status_retry :
244
-				$content = $action_links['view'] . $action_links['send_now'] . $action_links['error'] . $action_links['view_transaction'];
244
+				$content = $action_links['view'].$action_links['send_now'].$action_links['error'].$action_links['view_transaction'];
245 245
 				break;
246 246
 			case EEM_Message::status_failed :
247 247
 			case EEM_Message::status_debug_only :
248
-				$content = $action_links['error'] . $action_links['view_transaction'];
248
+				$content = $action_links['error'].$action_links['view_transaction'];
249 249
 				break;
250 250
 			case EEM_Message::status_idle :
251
-				$content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction'];
251
+				$content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction'];
252 252
 				break;
253 253
 			case EEM_Message::status_incomplete;
254
-				$content = $action_links['generate_now'] . $action_links['view_transaction'];
254
+				$content = $action_links['generate_now'].$action_links['view_transaction'];
255 255
 				break;
256 256
 		}
257 257
 		return $content;
@@ -269,54 +269,54 @@  discard block
 block discarded – undo
269 269
 	 * @return int | EE_Message[]
270 270
 	 * @throws \EE_Error
271 271
 	 */
272
-	protected function _get_messages( $perpage = 10, $view = 'all', $count = false, $all = false ) {
272
+	protected function _get_messages($perpage = 10, $view = 'all', $count = false, $all = false) {
273 273
 
274
-		$current_page = isset( $this->_req_data['paged'] ) && ! empty( $this->_req_data['paged'] )
274
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
275 275
 			? $this->_req_data['paged']
276 276
 			: 1;
277 277
 
278
-		$per_page = isset( $this->_req_data['perpage'] ) && ! empty( $this->_req_data['perpage'] )
278
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
279 279
 			? $this->_req_data['perpage']
280 280
 			: $perpage;
281 281
 
282
-		$offset = ( $current_page - 1 ) * $per_page;
283
-		$limit = $all || $count ? null : array( $offset, $per_page );
282
+		$offset = ($current_page - 1) * $per_page;
283
+		$limit = $all || $count ? null : array($offset, $per_page);
284 284
 		$query_params = array(
285
-			'order_by' => empty( $this->_req_data[ 'orderby' ] ) ? 'MSG_modified' : $this->_req_data[ 'orderby' ],
286
-			'order'    => empty( $this->_req_data[ 'order' ] ) ? 'DESC' : $this->_req_data[ 'order' ],
285
+			'order_by' => empty($this->_req_data['orderby']) ? 'MSG_modified' : $this->_req_data['orderby'],
286
+			'order'    => empty($this->_req_data['order']) ? 'DESC' : $this->_req_data['order'],
287 287
 			'limit'    => $limit,
288 288
 		);
289 289
 
290 290
 		/**
291 291
 		 * Any filters coming in from other routes?
292 292
 		 */
293
-		if ( isset( $this->_req_data['filterby'] ) ) {
294
-			$query_params = array_merge( $query_params, EEM_Message::instance()->filter_by_query_params() );
295
-			if ( ! $count ) {
293
+		if (isset($this->_req_data['filterby'])) {
294
+			$query_params = array_merge($query_params, EEM_Message::instance()->filter_by_query_params());
295
+			if ( ! $count) {
296 296
 				$query_params['group_by'] = 'MSG_ID';
297 297
 			}
298 298
 		}
299 299
 
300 300
 		//view conditionals
301
-		if ( $view !== 'all' && $count && $all ) {
301
+		if ($view !== 'all' && $count && $all) {
302 302
 			$query_params[0]['AND*view_conditional'] = array(
303
-				'STS_ID' => strtoupper( $view ),
303
+				'STS_ID' => strtoupper($view),
304 304
 			);
305 305
 		}
306 306
 
307
-		if ( ! $all && ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] !== 'all' ) {
307
+		if ( ! $all && ! empty($this->_req_data['status']) && $this->_req_data['status'] !== 'all') {
308 308
 			$query_params[0]['AND*view_conditional'] = array(
309
-				'STS_ID' => strtoupper( $this->_req_data['status'] ),
309
+				'STS_ID' => strtoupper($this->_req_data['status']),
310 310
 			);
311 311
 		}
312 312
 
313
-		if ( ! $all && ! empty( $this->_req_data['s'] ) ) {
314
-			$search_string = '%' . $this->_req_data['s'] . '%';
313
+		if ( ! $all && ! empty($this->_req_data['s'])) {
314
+			$search_string = '%'.$this->_req_data['s'].'%';
315 315
 			$query_params[0]['OR'] = array(
316
-				'MSG_to' => array( 'LIKE', $search_string ),
317
-				'MSG_from' => array( 'LIKE', $search_string ),
318
-				'MSG_subject' => array( 'LIKE', $search_string ),
319
-				'MSG_content' => array( 'LIKE', $search_string ),
316
+				'MSG_to' => array('LIKE', $search_string),
317
+				'MSG_from' => array('LIKE', $search_string),
318
+				'MSG_subject' => array('LIKE', $search_string),
319
+				'MSG_content' => array('LIKE', $search_string),
320 320
 			);
321 321
 		}
322 322
 
@@ -324,16 +324,16 @@  discard block
 block discarded – undo
324 324
 		//the messages system is in debug mode.
325 325
 		//Note: for backward compat with previous iterations, this is necessary because there may be EEM_Message::status_debug_only
326 326
 		//messages in the database.
327
-		if ( ! EEM_Message::debug() ) {
327
+		if ( ! EEM_Message::debug()) {
328 328
 			$query_params[0]['AND*debug_only_conditional'] = array(
329
-				'STS_ID' => array( '!=', EEM_Message::status_debug_only )
329
+				'STS_ID' => array('!=', EEM_Message::status_debug_only)
330 330
 			);
331 331
 		}
332 332
 
333 333
 		//account for filters
334 334
 		if (
335 335
 			! $all
336
-			&& isset( $this->_req_data['ee_messenger_filter_by'] )
336
+			&& isset($this->_req_data['ee_messenger_filter_by'])
337 337
 			&& $this->_req_data['ee_messenger_filter_by'] !== 'none_selected'
338 338
 		) {
339 339
 			$query_params[0]['AND*messenger_filter'] = array(
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 		}
343 343
 		if (
344 344
 			! $all
345
-			&& ! empty( $this->_req_data['ee_message_type_filter_by'] )
345
+			&& ! empty($this->_req_data['ee_message_type_filter_by'])
346 346
 			&& $this->_req_data['ee_message_type_filter_by'] !== 'none_selected'
347 347
 		) {
348 348
 			$query_params[0]['AND*message_type_filter'] = array(
@@ -352,17 +352,17 @@  discard block
 block discarded – undo
352 352
 
353 353
 		if (
354 354
 			! $all
355
-			&& ! empty( $this->_req_data['ee_context_filter_by'] )
355
+			&& ! empty($this->_req_data['ee_context_filter_by'])
356 356
 			&& $this->_req_data['ee_context_filter_by'] !== 'none_selected'
357 357
 		) {
358 358
 			$query_params[0]['AND*context_filter'] = array(
359
-				'MSG_context' => array( 'IN', explode( ',', $this->_req_data['ee_context_filter_by'] ) )
359
+				'MSG_context' => array('IN', explode(',', $this->_req_data['ee_context_filter_by']))
360 360
 			);
361 361
 		}
362 362
 
363 363
 		return $count
364
-			? EEM_Message::instance()->count( $query_params, null, true )
365
-			: EEM_Message::instance()->get_all( $query_params );
364
+			? EEM_Message::instance()->count($query_params, null, true)
365
+			: EEM_Message::instance()->get_all($query_params);
366 366
 	}
367 367
 
368 368
 
@@ -372,15 +372,15 @@  discard block
 block discarded – undo
372 372
 	 */
373 373
 	protected function _get_messengers_dropdown_filter() {
374 374
 		$messenger_options = array();
375
-		$active_messages_grouped_by_messenger = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_messenger' ) );
375
+		$active_messages_grouped_by_messenger = EEM_Message::instance()->get_all(array('group_by' => 'MSG_messenger'));
376 376
 
377 377
 		//setup array of messenger options
378
-		foreach ( $active_messages_grouped_by_messenger as $active_message ) {
379
-			if ( $active_message instanceof EE_Message ) {
380
-				$messenger_options[ $active_message->messenger() ] = ucwords( $active_message->messenger_label() );
378
+		foreach ($active_messages_grouped_by_messenger as $active_message) {
379
+			if ($active_message instanceof EE_Message) {
380
+				$messenger_options[$active_message->messenger()] = ucwords($active_message->messenger_label());
381 381
 			}
382 382
 		}
383
-		return $this->get_admin_page()->get_messengers_select_input( $messenger_options );
383
+		return $this->get_admin_page()->get_messengers_select_input($messenger_options);
384 384
 	}
385 385
 
386 386
 
@@ -391,15 +391,15 @@  discard block
 block discarded – undo
391 391
 	 */
392 392
 	protected function _get_message_types_dropdown_filter() {
393 393
 		$message_type_options = array();
394
-		$active_messages_grouped_by_message_type = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_message_type' ) );
394
+		$active_messages_grouped_by_message_type = EEM_Message::instance()->get_all(array('group_by' => 'MSG_message_type'));
395 395
 
396 396
 		//setup array of message type options
397
-		foreach ( $active_messages_grouped_by_message_type as $active_message ) {
398
-			if ( $active_message instanceof EE_Message ) {
399
-				$message_type_options[ $active_message->message_type() ] = ucwords( $active_message->message_type_label() );
397
+		foreach ($active_messages_grouped_by_message_type as $active_message) {
398
+			if ($active_message instanceof EE_Message) {
399
+				$message_type_options[$active_message->message_type()] = ucwords($active_message->message_type_label());
400 400
 			}
401 401
 		}
402
-		return $this->get_admin_page()->get_message_types_select_input( $message_type_options );
402
+		return $this->get_admin_page()->get_message_types_select_input($message_type_options);
403 403
 	}
404 404
 
405 405
 
@@ -409,21 +409,21 @@  discard block
 block discarded – undo
409 409
 	 */
410 410
 	protected function _get_contexts_for_message_types_dropdown_filter() {
411 411
 		$context_options = array();
412
-		$active_messages_grouped_by_context = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_context' ) );
412
+		$active_messages_grouped_by_context = EEM_Message::instance()->get_all(array('group_by' => 'MSG_context'));
413 413
 
414 414
 		//setup array of context options
415
-		foreach ( $active_messages_grouped_by_context as $active_message ) {
416
-			if ( $active_message instanceof EE_Message ) {
415
+		foreach ($active_messages_grouped_by_context as $active_message) {
416
+			if ($active_message instanceof EE_Message) {
417 417
 				$message_type = $active_message->message_type_object();
418
-				if ( $message_type instanceof EE_message_type ) {
419
-					foreach ( $message_type->get_contexts() as $context => $context_details ) {
420
-						if ( isset( $context_details['label'] ) ) {
421
-							$context_options[ $context ] = $context_details['label'];
418
+				if ($message_type instanceof EE_message_type) {
419
+					foreach ($message_type->get_contexts() as $context => $context_details) {
420
+						if (isset($context_details['label'])) {
421
+							$context_options[$context] = $context_details['label'];
422 422
 						}
423 423
 					}
424 424
 				}
425 425
 			}
426 426
 		}
427
-		return $this->get_admin_page()->get_contexts_for_message_types_select_input( $context_options );
427
+		return $this->get_admin_page()->get_contexts_for_message_types_select_input($context_options);
428 428
 	}
429 429
 } //end EE_Message_List_Table class
430 430
\ No newline at end of file
Please login to merge, or discard this patch.
core/EE_Registry.core.php 1 patch
Spacing   +209 added lines, -209 removed lines patch added patch discarded remove patch
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
 	 * @param  \EE_Dependency_Map $dependency_map
185 185
 	 * @return \EE_Registry instance
186 186
 	 */
187
-	public static function instance( \EE_Dependency_Map $dependency_map = null ) {
187
+	public static function instance(\EE_Dependency_Map $dependency_map = null) {
188 188
 		// check if class object is instantiated
189
-		if ( ! self::$_instance instanceof EE_Registry ) {
190
-			self::$_instance = new EE_Registry( $dependency_map );
189
+		if ( ! self::$_instance instanceof EE_Registry) {
190
+			self::$_instance = new EE_Registry($dependency_map);
191 191
 		}
192 192
 		return self::$_instance;
193 193
 	}
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
 	 * @param  \EE_Dependency_Map $dependency_map
203 203
 	 * @return \EE_Registry
204 204
 	 */
205
-	protected function __construct( \EE_Dependency_Map $dependency_map ) {
205
+	protected function __construct(\EE_Dependency_Map $dependency_map) {
206 206
 		$this->_dependency_map = $dependency_map;
207
-		add_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', array( $this, 'initialize' ) );
207
+		add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize'));
208 208
 	}
209 209
 
210 210
 
@@ -232,19 +232,19 @@  discard block
 block discarded – undo
232 232
 		$this->modules = new stdClass();
233 233
 		$this->shortcodes = new stdClass();
234 234
 		$this->widgets = new stdClass();
235
-		$this->load_core( 'Base', array(), true );
235
+		$this->load_core('Base', array(), true);
236 236
 		// add our request and response objects to the cache
237
-		$request_loader = $this->_dependency_map->class_loader( 'EE_Request' );
237
+		$request_loader = $this->_dependency_map->class_loader('EE_Request');
238 238
 		$this->_set_cached_class(
239 239
 			$request_loader(),
240 240
 			'EE_Request'
241 241
 		);
242
-		$response_loader = $this->_dependency_map->class_loader( 'EE_Response' );
242
+		$response_loader = $this->_dependency_map->class_loader('EE_Response');
243 243
 		$this->_set_cached_class(
244 244
 			$response_loader(),
245 245
 			'EE_Response'
246 246
 		);
247
-		add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'init' ) );
247
+		add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init'));
248 248
 	}
249 249
 
250 250
 
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	public function init() {
259 259
 		// Get current page protocol
260
-		$protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://';
260
+		$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
261 261
 		// Output admin-ajax.php URL with same protocol as current page
262
-		self::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php', $protocol );
263
-		self::$i18n_js_strings[ 'wp_debug' ] = defined( 'WP_DEBUG' ) ? WP_DEBUG : false;
262
+		self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol);
263
+		self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : false;
264 264
 	}
265 265
 
266 266
 
@@ -271,14 +271,14 @@  discard block
 block discarded – undo
271 271
 	 * @return string
272 272
 	 */
273 273
 	public static function localize_i18n_js_strings() {
274
-		$i18n_js_strings = (array)EE_Registry::$i18n_js_strings;
275
-		foreach ( $i18n_js_strings as $key => $value ) {
276
-			if ( is_scalar( $value ) ) {
277
-				$i18n_js_strings[ $key ] = html_entity_decode( (string)$value, ENT_QUOTES, 'UTF-8' );
274
+		$i18n_js_strings = (array) EE_Registry::$i18n_js_strings;
275
+		foreach ($i18n_js_strings as $key => $value) {
276
+			if (is_scalar($value)) {
277
+				$i18n_js_strings[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
278 278
 			}
279 279
 		}
280 280
 
281
-		return "/* <![CDATA[ */ var eei18n = " . wp_json_encode( $i18n_js_strings ) . '; /* ]]> */';
281
+		return "/* <![CDATA[ */ var eei18n = ".wp_json_encode($i18n_js_strings).'; /* ]]> */';
282 282
 	}
283 283
 
284 284
 
@@ -286,15 +286,15 @@  discard block
 block discarded – undo
286 286
 	/**
287 287
 	 * @param mixed string | EED_Module $module
288 288
 	 */
289
-	public function add_module( $module ) {
290
-		if ( $module instanceof EED_Module ) {
291
-			$module_class = get_class( $module );
289
+	public function add_module($module) {
290
+		if ($module instanceof EED_Module) {
291
+			$module_class = get_class($module);
292 292
 			$this->modules->{$module_class} = $module;
293 293
 		} else {
294
-			if ( ! class_exists( 'EE_Module_Request_Router' ) ) {
295
-				$this->load_core( 'Module_Request_Router' );
294
+			if ( ! class_exists('EE_Module_Request_Router')) {
295
+				$this->load_core('Module_Request_Router');
296 296
 			}
297
-			$this->modules->{$module} = EE_Module_Request_Router::module_factory( $module );
297
+			$this->modules->{$module} = EE_Module_Request_Router::module_factory($module);
298 298
 		}
299 299
 	}
300 300
 
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 	 * @param string $module_name
305 305
 	 * @return mixed EED_Module | NULL
306 306
 	 */
307
-	public function get_module( $module_name = '' ) {
308
-		return isset( $this->modules->{$module_name} ) ? $this->modules->{$module_name} : null;
307
+	public function get_module($module_name = '') {
308
+		return isset($this->modules->{$module_name} ) ? $this->modules->{$module_name} : null;
309 309
 	}
310 310
 
311 311
 
@@ -319,20 +319,20 @@  discard block
 block discarded – undo
319 319
 	 * @param bool $load_only
320 320
 	 * @return mixed
321 321
 	 */
322
-	public function load_core( $class_name, $arguments = array(), $load_only = false ) {
322
+	public function load_core($class_name, $arguments = array(), $load_only = false) {
323 323
 		$core_paths = apply_filters(
324 324
 			'FHEE__EE_Registry__load_core__core_paths',
325 325
 			array(
326 326
 				EE_CORE,
327 327
 				EE_ADMIN,
328 328
 				EE_CPTS,
329
-				EE_CORE . 'data_migration_scripts' . DS,
330
-				EE_CORE . 'request_stack' . DS,
331
-				EE_CORE . 'middleware' . DS,
329
+				EE_CORE.'data_migration_scripts'.DS,
330
+				EE_CORE.'request_stack'.DS,
331
+				EE_CORE.'middleware'.DS,
332 332
 			)
333 333
 		);
334 334
 		// retrieve instantiated class
335
-		return $this->_load( $core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only );
335
+		return $this->_load($core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only);
336 336
 	}
337 337
 
338 338
 
@@ -346,15 +346,15 @@  discard block
 block discarded – undo
346 346
 	 * @param bool $load_only
347 347
 	 * @return mixed
348 348
 	 */
349
-	public function load_service( $class_name, $arguments = array(), $load_only = false ) {
349
+	public function load_service($class_name, $arguments = array(), $load_only = false) {
350 350
 		$service_paths = apply_filters(
351 351
 			'FHEE__EE_Registry__load_service__service_paths',
352 352
 			array(
353
-				EE_CORE . 'services' . DS,
353
+				EE_CORE.'services'.DS,
354 354
 			)
355 355
 		);
356 356
 		// retrieve instantiated class
357
-		return $this->_load( $service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only );
357
+		return $this->_load($service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only);
358 358
 	}
359 359
 
360 360
 
@@ -367,9 +367,9 @@  discard block
 block discarded – undo
367 367
 	 * @param mixed $arguments
368 368
 	 * @return EE_Data_Migration_Script_Base|mixed
369 369
 	 */
370
-	public function load_dms( $class_name, $arguments = array() ) {
370
+	public function load_dms($class_name, $arguments = array()) {
371 371
 		// retrieve instantiated class
372
-		return $this->_load( EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false );
372
+		return $this->_load(EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false);
373 373
 	}
374 374
 
375 375
 
@@ -384,14 +384,14 @@  discard block
 block discarded – undo
384 384
 	 * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default)
385 385
 	 * @return EE_Base_Class | bool
386 386
 	 */
387
-	public function load_class( $class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false ) {
388
-		$paths = apply_filters( 'FHEE__EE_Registry__load_class__paths', array(
387
+	public function load_class($class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false) {
388
+		$paths = apply_filters('FHEE__EE_Registry__load_class__paths', array(
389 389
 			EE_CORE,
390 390
 			EE_CLASSES,
391 391
 			EE_BUSINESS
392
-		) );
392
+		));
393 393
 		// retrieve instantiated class
394
-		return $this->_load( $paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only );
394
+		return $this->_load($paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only);
395 395
 	}
396 396
 
397 397
 
@@ -404,11 +404,11 @@  discard block
 block discarded – undo
404 404
 	 * @param bool $load_only
405 405
 	 * @return EEH_Base | bool
406 406
 	 */
407
-	public function load_helper( $class_name, $arguments = array(), $load_only = true ) {
407
+	public function load_helper($class_name, $arguments = array(), $load_only = true) {
408 408
 		// todo: add doing_it_wrong() in a few versions after all addons have had calls to this method removed
409
-		$helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array( EE_HELPERS ) );
409
+		$helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS));
410 410
 		// retrieve instantiated class
411
-		return $this->_load( $helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only );
411
+		return $this->_load($helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only);
412 412
 	}
413 413
 
414 414
 
@@ -423,16 +423,16 @@  discard block
 block discarded – undo
423 423
 	 * @param bool $cache  whether to cache the object or not.
424 424
 	 * @return mixed
425 425
 	 */
426
-	public function load_lib( $class_name, $arguments = array(), $load_only = false, $cache = true ) {
426
+	public function load_lib($class_name, $arguments = array(), $load_only = false, $cache = true) {
427 427
 		$paths = array(
428 428
 			EE_LIBRARIES,
429
-			EE_LIBRARIES . 'messages' . DS,
430
-			EE_LIBRARIES . 'shortcodes' . DS,
431
-			EE_LIBRARIES . 'qtips' . DS,
432
-			EE_LIBRARIES . 'payment_methods' . DS,
429
+			EE_LIBRARIES.'messages'.DS,
430
+			EE_LIBRARIES.'shortcodes'.DS,
431
+			EE_LIBRARIES.'qtips'.DS,
432
+			EE_LIBRARIES.'payment_methods'.DS,
433 433
 		);
434 434
 		// retrieve instantiated class
435
-		return $this->_load( $paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only );
435
+		return $this->_load($paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only);
436 436
 	}
437 437
 
438 438
 
@@ -445,13 +445,13 @@  discard block
 block discarded – undo
445 445
 	 * @param bool $load_only
446 446
 	 * @return EEM_Base | bool
447 447
 	 */
448
-	public function load_model( $class_name, $arguments = array(), $load_only = false ) {
449
-		$paths = apply_filters( 'FHEE__EE_Registry__load_model__paths', array(
448
+	public function load_model($class_name, $arguments = array(), $load_only = false) {
449
+		$paths = apply_filters('FHEE__EE_Registry__load_model__paths', array(
450 450
 			EE_MODELS,
451 451
 			EE_CORE
452
-		) );
452
+		));
453 453
 		// retrieve instantiated class
454
-		return $this->_load( $paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only );
454
+		return $this->_load($paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only);
455 455
 	}
456 456
 
457 457
 
@@ -464,15 +464,15 @@  discard block
 block discarded – undo
464 464
 	 * @param bool $load_only
465 465
 	 * @return mixed | bool
466 466
 	 */
467
-	public function load_model_class( $class_name, $arguments = array(), $load_only = true ) {
467
+	public function load_model_class($class_name, $arguments = array(), $load_only = true) {
468 468
 		$paths = array(
469
-			EE_MODELS . 'fields' . DS,
470
-			EE_MODELS . 'helpers' . DS,
471
-			EE_MODELS . 'relations' . DS,
472
-			EE_MODELS . 'strategies' . DS
469
+			EE_MODELS.'fields'.DS,
470
+			EE_MODELS.'helpers'.DS,
471
+			EE_MODELS.'relations'.DS,
472
+			EE_MODELS.'strategies'.DS
473 473
 		);
474 474
 		// retrieve instantiated class
475
-		return $this->_load( $paths, 'EE_', $class_name, '', $arguments, false, true, $load_only );
475
+		return $this->_load($paths, 'EE_', $class_name, '', $arguments, false, true, $load_only);
476 476
 	}
477 477
 
478 478
 
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 	 * @param string $model_name like Event, Attendee, Question_Group_Question, etc.
483 483
 	 * @return boolean
484 484
 	 */
485
-	public function is_model_name( $model_name ) {
486
-		return isset( $this->models[ $model_name ] ) ? true : false;
485
+	public function is_model_name($model_name) {
486
+		return isset($this->models[$model_name]) ? true : false;
487 487
 	}
488 488
 
489 489
 
@@ -498,9 +498,9 @@  discard block
 block discarded – undo
498 498
 	 * @param bool $load_only
499 499
 	 * @return mixed
500 500
 	 */
501
-	public function load_file( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true ) {
501
+	public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true) {
502 502
 		// retrieve instantiated class
503
-		return $this->_load( $path_to_file, '', $file_name, $type, $arguments, false, true, $load_only );
503
+		return $this->_load($path_to_file, '', $file_name, $type, $arguments, false, true, $load_only);
504 504
 	}
505 505
 
506 506
 
@@ -515,9 +515,9 @@  discard block
 block discarded – undo
515 515
 	 * @param bool $load_only
516 516
 	 * @return EE_Addon
517 517
 	 */
518
-	public function load_addon( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false ) {
518
+	public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false) {
519 519
 		// retrieve instantiated class
520
-		return $this->_load( $path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only );
520
+		return $this->_load($path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only);
521 521
 	}
522 522
 
523 523
 
@@ -548,35 +548,35 @@  discard block
 block discarded – undo
548 548
 		$load_only = false,
549 549
 		$addon = false
550 550
 	) {
551
-		$class_name = $this->_dependency_map->get_alias( $class_name );
552
-		if ( ! class_exists( $class_name ) ) {
551
+		$class_name = $this->_dependency_map->get_alias($class_name);
552
+		if ( ! class_exists($class_name)) {
553 553
 			// maybe the class is registered with a preceding \
554
-			$class_name = strpos( $class_name, '\\' ) !== 0 ? '\\' . $class_name : $class_name;
554
+			$class_name = strpos($class_name, '\\') !== 0 ? '\\'.$class_name : $class_name;
555 555
 			// still doesn't exist ?
556
-			if ( ! class_exists( $class_name ) ) {
556
+			if ( ! class_exists($class_name)) {
557 557
 				return null;
558 558
 			}
559 559
 		}
560 560
 		// if we're only loading the class and it already exists, then let's just return true immediately
561
-		if ( $load_only ) {
561
+		if ($load_only) {
562 562
 			return true;
563 563
 		}
564 564
 		$addon = $addon ? 'addon' : '';
565 565
 		// $this->_cache_on is toggled during the recursive loading that can occur with dependency injection
566 566
 		// $cache is controlled by individual calls to separate Registry loader methods like load_class()
567 567
 		// $load_only is also controlled by individual calls to separate Registry loader methods like load_file()
568
-		if ( $this->_cache_on && $cache && ! $load_only ) {
568
+		if ($this->_cache_on && $cache && ! $load_only) {
569 569
 			// return object if it's already cached
570
-			$cached_class = $this->_get_cached_class( $class_name, $addon );
571
-			if ( $cached_class !== null ) {
570
+			$cached_class = $this->_get_cached_class($class_name, $addon);
571
+			if ($cached_class !== null) {
572 572
 				return $cached_class;
573 573
 			}
574 574
 		}
575 575
 		// instantiate the requested object
576
-		$class_obj = $this->_create_object( $class_name, $arguments, $addon, $from_db );
577
-		if ( $this->_cache_on && $cache ) {
576
+		$class_obj = $this->_create_object($class_name, $arguments, $addon, $from_db);
577
+		if ($this->_cache_on && $cache) {
578 578
 			// save it for later... kinda like gum  { : $
579
-			$this->_set_cached_class( $class_obj, $class_name, $addon, $from_db );
579
+			$this->_set_cached_class($class_obj, $class_name, $addon, $from_db);
580 580
 		}
581 581
 		$this->_cache_on = true;
582 582
 		return $class_obj;
@@ -611,47 +611,47 @@  discard block
 block discarded – undo
611 611
 		$load_only = false
612 612
 	) {
613 613
 		// strip php file extension
614
-		$class_name = str_replace( '.php', '', trim( $class_name ) );
614
+		$class_name = str_replace('.php', '', trim($class_name));
615 615
 		// does the class have a prefix ?
616
-		if ( ! empty( $class_prefix ) && $class_prefix != 'addon' ) {
616
+		if ( ! empty($class_prefix) && $class_prefix != 'addon') {
617 617
 			// make sure $class_prefix is uppercase
618
-			$class_prefix = strtoupper( trim( $class_prefix ) );
618
+			$class_prefix = strtoupper(trim($class_prefix));
619 619
 			// add class prefix ONCE!!!
620
-			$class_name = $class_prefix . str_replace( $class_prefix, '', $class_name );
620
+			$class_name = $class_prefix.str_replace($class_prefix, '', $class_name);
621 621
 		}
622
-		$class_name = $this->_dependency_map->get_alias( $class_name );
623
-		$class_exists = class_exists( $class_name );
622
+		$class_name = $this->_dependency_map->get_alias($class_name);
623
+		$class_exists = class_exists($class_name);
624 624
 		// if we're only loading the class and it already exists, then let's just return true immediately
625
-		if ( $load_only && $class_exists ) {
625
+		if ($load_only && $class_exists) {
626 626
 			return true;
627 627
 		}
628 628
 		// $this->_cache_on is toggled during the recursive loading that can occur with dependency injection
629 629
 		// $cache is controlled by individual calls to separate Registry loader methods like load_class()
630 630
 		// $load_only is also controlled by individual calls to separate Registry loader methods like load_file()
631
-		if ( $this->_cache_on && $cache && ! $load_only ) {
631
+		if ($this->_cache_on && $cache && ! $load_only) {
632 632
 			// return object if it's already cached
633
-			$cached_class = $this->_get_cached_class( $class_name, $class_prefix );
634
-			if ( $cached_class !== null ) {
633
+			$cached_class = $this->_get_cached_class($class_name, $class_prefix);
634
+			if ($cached_class !== null) {
635 635
 				return $cached_class;
636 636
 			}
637 637
 		}
638 638
 		// if the class doesn't already exist.. then we need to try and find the file and load it
639
-		if ( ! $class_exists ) {
639
+		if ( ! $class_exists) {
640 640
 			// get full path to file
641
-			$path = $this->_resolve_path( $class_name, $type, $file_paths );
641
+			$path = $this->_resolve_path($class_name, $type, $file_paths);
642 642
 			// load the file
643
-			$loaded = $this->_require_file( $path, $class_name, $type, $file_paths );
643
+			$loaded = $this->_require_file($path, $class_name, $type, $file_paths);
644 644
 			// if loading failed, or we are only loading a file but NOT instantiating an object
645
-			if ( ! $loaded || $load_only ) {
645
+			if ( ! $loaded || $load_only) {
646 646
 				// return boolean if only loading, or null if an object was expected
647 647
 				return $load_only ? $loaded : null;
648 648
 			}
649 649
 		}
650 650
 		// instantiate the requested object
651
-		$class_obj = $this->_create_object( $class_name, $arguments, $type, $from_db );
652
-		if ( $this->_cache_on && $cache ) {
651
+		$class_obj = $this->_create_object($class_name, $arguments, $type, $from_db);
652
+		if ($this->_cache_on && $cache) {
653 653
 			// save it for later... kinda like gum  { : $
654
-			$this->_set_cached_class( $class_obj, $class_name, $class_prefix, $from_db );
654
+			$this->_set_cached_class($class_obj, $class_name, $class_prefix, $from_db);
655 655
 		}
656 656
 		$this->_cache_on = true;
657 657
 		return $class_obj;
@@ -674,21 +674,21 @@  discard block
 block discarded – undo
674 674
 	 * @param string $class_prefix
675 675
 	 * @return mixed
676 676
 	 */
677
-	protected function _get_cached_class( $class_name, $class_prefix = '' ) {
678
-		if ( isset( $this->_class_abbreviations[ $class_name ] ) ) {
679
-			$class_abbreviation = $this->_class_abbreviations[ $class_name ];
677
+	protected function _get_cached_class($class_name, $class_prefix = '') {
678
+		if (isset($this->_class_abbreviations[$class_name])) {
679
+			$class_abbreviation = $this->_class_abbreviations[$class_name];
680 680
 		} else {
681 681
 			// have to specify something, but not anything that will conflict
682 682
 			$class_abbreviation = 'FANCY_BATMAN_PANTS';
683 683
 		}
684 684
 		// check if class has already been loaded, and return it if it has been
685
-		if ( isset( $this->{$class_abbreviation} ) && ! is_null( $this->{$class_abbreviation} ) ) {
685
+		if (isset($this->{$class_abbreviation} ) && ! is_null($this->{$class_abbreviation} )) {
686 686
 			return $this->{$class_abbreviation};
687
-		} else if ( isset ( $this->{$class_name} ) ) {
687
+		} else if (isset ($this->{$class_name} )) {
688 688
 			return $this->{$class_name};
689
-		} else if ( isset ( $this->LIB->{$class_name} ) ) {
689
+		} else if (isset ($this->LIB->{$class_name} )) {
690 690
 			return $this->LIB->{$class_name};
691
-		} else if ( $class_prefix == 'addon' && isset ( $this->addons->{$class_name} ) ) {
691
+		} else if ($class_prefix == 'addon' && isset ($this->addons->{$class_name} )) {
692 692
 			return $this->addons->{$class_name};
693 693
 		}
694 694
 		return null;
@@ -709,20 +709,20 @@  discard block
 block discarded – undo
709 709
 	 * @param array $file_paths
710 710
 	 * @return string | bool
711 711
 	 */
712
-	protected function _resolve_path( $class_name, $type = '', $file_paths = array() ) {
712
+	protected function _resolve_path($class_name, $type = '', $file_paths = array()) {
713 713
 		// make sure $file_paths is an array
714
-		$file_paths = is_array( $file_paths ) ? $file_paths : array( $file_paths );
714
+		$file_paths = is_array($file_paths) ? $file_paths : array($file_paths);
715 715
 		// cycle thru paths
716
-		foreach ( $file_paths as $key => $file_path ) {
716
+		foreach ($file_paths as $key => $file_path) {
717 717
 			// convert all separators to proper DS, if no filepath, then use EE_CLASSES
718
-			$file_path = $file_path ? str_replace( array( '/', '\\' ), DS, $file_path ) : EE_CLASSES;
718
+			$file_path = $file_path ? str_replace(array('/', '\\'), DS, $file_path) : EE_CLASSES;
719 719
 			// prep file type
720
-			$type = ! empty( $type ) ? trim( $type, '.' ) . '.' : '';
720
+			$type = ! empty($type) ? trim($type, '.').'.' : '';
721 721
 			// build full file path
722
-			$file_paths[ $key ] = rtrim( $file_path, DS ) . DS . $class_name . '.' . $type . 'php';
722
+			$file_paths[$key] = rtrim($file_path, DS).DS.$class_name.'.'.$type.'php';
723 723
 			//does the file exist and can be read ?
724
-			if ( is_readable( $file_paths[ $key ] ) ) {
725
-				return $file_paths[ $key ];
724
+			if (is_readable($file_paths[$key])) {
725
+				return $file_paths[$key];
726 726
 			}
727 727
 		}
728 728
 		return false;
@@ -744,29 +744,29 @@  discard block
 block discarded – undo
744 744
 	 * @return boolean
745 745
 	 * @throws \EE_Error
746 746
 	 */
747
-	protected function _require_file( $path, $class_name, $type = '', $file_paths = array() ) {
747
+	protected function _require_file($path, $class_name, $type = '', $file_paths = array()) {
748 748
 		// don't give up! you gotta...
749 749
 		try {
750 750
 			//does the file exist and can it be read ?
751
-			if ( ! $path ) {
751
+			if ( ! $path) {
752 752
 				// so sorry, can't find the file
753
-				throw new EE_Error (
753
+				throw new EE_Error(
754 754
 					sprintf(
755
-						__( 'The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso' ),
756
-						trim( $type, '.' ),
755
+						__('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso'),
756
+						trim($type, '.'),
757 757
 						$class_name,
758
-						'<br />' . implode( ',<br />', $file_paths )
758
+						'<br />'.implode(',<br />', $file_paths)
759 759
 					)
760 760
 				);
761 761
 			}
762 762
 			// get the file
763
-			require_once( $path );
763
+			require_once($path);
764 764
 			// if the class isn't already declared somewhere
765
-			if ( class_exists( $class_name, false ) === false ) {
765
+			if (class_exists($class_name, false) === false) {
766 766
 				// so sorry, not a class
767 767
 				throw new EE_Error(
768 768
 					sprintf(
769
-						__( 'The %s file %s does not appear to contain the %s Class.', 'event_espresso' ),
769
+						__('The %s file %s does not appear to contain the %s Class.', 'event_espresso'),
770 770
 						$type,
771 771
 						$path,
772 772
 						$class_name
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 				);
775 775
 			}
776 776
 
777
-		} catch ( EE_Error $e ) {
777
+		} catch (EE_Error $e) {
778 778
 			$e->get_error();
779 779
 			return false;
780 780
 		}
@@ -806,61 +806,61 @@  discard block
 block discarded – undo
806 806
 	 * @return null | object
807 807
 	 * @throws \EE_Error
808 808
 	 */
809
-	protected function _create_object( $class_name, $arguments = array(), $type = '', $from_db = false ) {
809
+	protected function _create_object($class_name, $arguments = array(), $type = '', $from_db = false) {
810 810
 		$class_obj = null;
811 811
 		$instantiation_mode = '0) none';
812 812
 		// don't give up! you gotta...
813 813
 		try {
814 814
 			// create reflection
815
-			$reflector = $this->get_ReflectionClass( $class_name );
815
+			$reflector = $this->get_ReflectionClass($class_name);
816 816
 			// make sure arguments are an array
817
-			$arguments = is_array( $arguments ) ? $arguments : array( $arguments );
817
+			$arguments = is_array($arguments) ? $arguments : array($arguments);
818 818
 			// and if arguments array is numerically and sequentially indexed, then we want it to remain as is,
819 819
 			// else wrap it in an additional array so that it doesn't get split into multiple parameters
820
-			$arguments = $this->_array_is_numerically_and_sequentially_indexed( $arguments )
820
+			$arguments = $this->_array_is_numerically_and_sequentially_indexed($arguments)
821 821
 				? $arguments
822
-				: array( $arguments );
822
+				: array($arguments);
823 823
 			// attempt to inject dependencies ?
824
-			if ( $this->_dependency_map->has( $class_name ) ) {
825
-				$arguments = $this->_resolve_dependencies( $reflector, $class_name, $arguments );
824
+			if ($this->_dependency_map->has($class_name)) {
825
+				$arguments = $this->_resolve_dependencies($reflector, $class_name, $arguments);
826 826
 			}
827 827
 			// instantiate the class if possible
828
-			if ( $reflector->isAbstract() ) {
828
+			if ($reflector->isAbstract()) {
829 829
 				// nothing to instantiate, loading file was enough
830 830
 				// does not throw an exception so $instantiation_mode is unused
831 831
 				// $instantiation_mode = "1) no constructor abstract class";
832 832
 				$class_obj = true;
833
-			} else if ( $reflector->getConstructor() === null && $reflector->isInstantiable() && empty( $arguments ) ) {
833
+			} else if ($reflector->getConstructor() === null && $reflector->isInstantiable() && empty($arguments)) {
834 834
 				// no constructor = static methods only... nothing to instantiate, loading file was enough
835 835
 				$instantiation_mode = "2) no constructor but instantiable";
836 836
 				$class_obj = $reflector->newInstance();
837
-			} else if ( $from_db && method_exists( $class_name, 'new_instance_from_db' ) ) {
837
+			} else if ($from_db && method_exists($class_name, 'new_instance_from_db')) {
838 838
 				$instantiation_mode = "3) new_instance_from_db()";
839
-				$class_obj = call_user_func_array( array( $class_name, 'new_instance_from_db' ), $arguments );
840
-			} else if ( method_exists( $class_name, 'new_instance' ) ) {
839
+				$class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments);
840
+			} else if (method_exists($class_name, 'new_instance')) {
841 841
 				$instantiation_mode = "4) new_instance()";
842
-				$class_obj = call_user_func_array( array( $class_name, 'new_instance' ), $arguments );
843
-			} else if ( method_exists( $class_name, 'instance' ) ) {
842
+				$class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments);
843
+			} else if (method_exists($class_name, 'instance')) {
844 844
 				$instantiation_mode = "5) instance()";
845
-				$class_obj = call_user_func_array( array( $class_name, 'instance' ), $arguments );
846
-			} else if ( $reflector->isInstantiable() ) {
845
+				$class_obj = call_user_func_array(array($class_name, 'instance'), $arguments);
846
+			} else if ($reflector->isInstantiable()) {
847 847
 				$instantiation_mode = "6) constructor";
848
-				$class_obj = $reflector->newInstanceArgs( $arguments );
848
+				$class_obj = $reflector->newInstanceArgs($arguments);
849 849
 			} else {
850 850
 				// heh ? something's not right !
851 851
 				throw new EE_Error(
852 852
 					sprintf(
853
-						__( 'The %s file %s could not be instantiated.', 'event_espresso' ),
853
+						__('The %s file %s could not be instantiated.', 'event_espresso'),
854 854
 						$type,
855 855
 						$class_name
856 856
 					)
857 857
 				);
858 858
 			}
859
-		} catch ( Exception $e ) {
860
-			if ( ! $e instanceof EE_Error ) {
859
+		} catch (Exception $e) {
860
+			if ( ! $e instanceof EE_Error) {
861 861
 				$e = new EE_Error(
862 862
 					sprintf(
863
-						__( 'The following error occurred while attempting to instantiate "%1$s": %2$s %3$s %2$s instantiation mode : %4$s', 'event_espresso' ),
863
+						__('The following error occurred while attempting to instantiate "%1$s": %2$s %3$s %2$s instantiation mode : %4$s', 'event_espresso'),
864 864
 						$class_name,
865 865
 						'<br />',
866 866
 						$e->getMessage(),
@@ -880,8 +880,8 @@  discard block
 block discarded – undo
880 880
 	 * @param array $array
881 881
 	 * @return bool
882 882
 	 */
883
-	protected function _array_is_numerically_and_sequentially_indexed( array $array ) {
884
-		return ! empty( $array ) ? array_keys( $array ) === range( 0, count( $array ) - 1 ) : true;
883
+	protected function _array_is_numerically_and_sequentially_indexed(array $array) {
884
+		return ! empty($array) ? array_keys($array) === range(0, count($array) - 1) : true;
885 885
 	}
886 886
 
887 887
 
@@ -896,14 +896,14 @@  discard block
 block discarded – undo
896 896
 	 * @param string $class_name
897 897
 	 * @return ReflectionClass
898 898
 	 */
899
-	public function get_ReflectionClass( $class_name ) {
899
+	public function get_ReflectionClass($class_name) {
900 900
 		if (
901
-			! isset( $this->_reflectors[ $class_name ] )
902
-			|| ! $this->_reflectors[ $class_name ] instanceof ReflectionClass
901
+			! isset($this->_reflectors[$class_name])
902
+			|| ! $this->_reflectors[$class_name] instanceof ReflectionClass
903 903
 		) {
904
-			$this->_reflectors[ $class_name ] = new ReflectionClass( $class_name );
904
+			$this->_reflectors[$class_name] = new ReflectionClass($class_name);
905 905
 		}
906
-		return $this->_reflectors[ $class_name ];
906
+		return $this->_reflectors[$class_name];
907 907
 	}
908 908
 
909 909
 
@@ -928,50 +928,50 @@  discard block
 block discarded – undo
928 928
 	 * @return array
929 929
 	 * @throws \ReflectionException
930 930
 	 */
931
-	protected function _resolve_dependencies( ReflectionClass $reflector, $class_name, $arguments = array() ) {
931
+	protected function _resolve_dependencies(ReflectionClass $reflector, $class_name, $arguments = array()) {
932 932
 		// let's examine the constructor
933 933
 		$constructor = $reflector->getConstructor();
934 934
 		// whu? huh? nothing?
935
-		if ( ! $constructor ) {
935
+		if ( ! $constructor) {
936 936
 			return $arguments;
937 937
 		}
938 938
 		// get constructor parameters
939 939
 		$params = $constructor->getParameters();
940 940
 		// and the keys for the incoming arguments array so that we can compare existing arguments with what is expected
941
-		$argument_keys = array_keys( $arguments );
941
+		$argument_keys = array_keys($arguments);
942 942
 		// now loop thru all of the constructors expected parameters
943
-		foreach ( $params as $index => $param ) {
943
+		foreach ($params as $index => $param) {
944 944
 			// is this a dependency for a specific class ?
945 945
 			$param_class = $param->getClass() ? $param->getClass()->name : null;
946 946
 			if (
947 947
 				// param is not even a class
948
-				empty( $param_class )
948
+				empty($param_class)
949 949
 				// and something already exists in the incoming arguments for this param
950
-				&& isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] )
950
+				&& isset($argument_keys[$index], $arguments[$argument_keys[$index]])
951 951
 			) {
952 952
 				// so let's skip this argument and move on to the next
953 953
 				continue;
954 954
 			} else if (
955 955
 				// parameter is type hinted as a class, exists as an incoming argument, AND it's the correct class
956
-				! empty( $param_class )
957
-				&& isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] )
958
-				&& $arguments[ $argument_keys[ $index ] ] instanceof $param_class
956
+				! empty($param_class)
957
+				&& isset($argument_keys[$index], $arguments[$argument_keys[$index]])
958
+				&& $arguments[$argument_keys[$index]] instanceof $param_class
959 959
 			) {
960 960
 				// skip this argument and move on to the next
961 961
 				continue;
962 962
 			} else if (
963 963
 				// parameter is type hinted as a class, and should be injected
964
-				! empty( $param_class )
965
-				&& $this->_dependency_map->has_dependency_for_class( $class_name, $param_class )
964
+				! empty($param_class)
965
+				&& $this->_dependency_map->has_dependency_for_class($class_name, $param_class)
966 966
 			) {
967
-				$arguments = $this->_resolve_dependency( $class_name, $param_class, $arguments, $index );
967
+				$arguments = $this->_resolve_dependency($class_name, $param_class, $arguments, $index);
968 968
 			} else {
969 969
 				try {
970
-					$arguments[ $index ] = $param->getDefaultValue();
971
-				} catch ( ReflectionException $e ) {
970
+					$arguments[$index] = $param->getDefaultValue();
971
+				} catch (ReflectionException $e) {
972 972
 					throw new ReflectionException(
973 973
 						sprintf(
974
-							__( '%1$s for parameter "$%2$s"', 'event_espresso' ),
974
+							__('%1$s for parameter "$%2$s"', 'event_espresso'),
975 975
 							$e->getMessage(),
976 976
 							$param->getName()
977 977
 						)
@@ -993,30 +993,30 @@  discard block
 block discarded – undo
993 993
 	 * @param mixed $index
994 994
 	 * @return array
995 995
 	 */
996
-	protected function _resolve_dependency( $class_name, $param_class , $arguments, $index ) {
996
+	protected function _resolve_dependency($class_name, $param_class, $arguments, $index) {
997 997
 		$dependency = null;
998 998
 		// should dependency be loaded from cache ?
999
-		$cache_on = $this->_dependency_map->loading_strategy_for_class_dependency( $class_name, $param_class )
999
+		$cache_on = $this->_dependency_map->loading_strategy_for_class_dependency($class_name, $param_class)
1000 1000
 		            !== EE_Dependency_Map::load_new_object
1001 1001
 			? true
1002 1002
 			: false;
1003 1003
 		// we might have a dependency...
1004 1004
 		// let's MAYBE try and find it in our cache if that's what's been requested
1005
-		$cached_class = $cache_on ? $this->_get_cached_class( $param_class ) : null;
1005
+		$cached_class = $cache_on ? $this->_get_cached_class($param_class) : null;
1006 1006
 		// and grab it if it exists
1007
-		if ( $cached_class instanceof $param_class ) {
1007
+		if ($cached_class instanceof $param_class) {
1008 1008
 			$dependency = $cached_class;
1009
-		} else if ( $param_class != $class_name ) {
1009
+		} else if ($param_class != $class_name) {
1010 1010
 			// obtain the loader method from the dependency map
1011
-			$loader = $this->_dependency_map->class_loader( $param_class );
1011
+			$loader = $this->_dependency_map->class_loader($param_class);
1012 1012
 			// is loader a custom closure ?
1013
-			if ( $loader instanceof Closure ) {
1013
+			if ($loader instanceof Closure) {
1014 1014
 				$dependency = $loader();
1015 1015
 			} else {
1016 1016
 				// set the cache on property for the recursive loading call
1017 1017
 				$this->_cache_on = $cache_on;
1018 1018
 				// if not, then let's try and load it via the registry
1019
-				if ( method_exists( $this, $loader ) ) {
1019
+				if (method_exists($this, $loader)) {
1020 1020
 					$dependency = $this->{$loader}($param_class);
1021 1021
 				} else {
1022 1022
 					$dependency = $this->create($param_class, array(), $cache_on);
@@ -1024,12 +1024,12 @@  discard block
 block discarded – undo
1024 1024
 			}
1025 1025
 		}
1026 1026
 		// did we successfully find the correct dependency ?
1027
-		if ( $dependency instanceof $param_class ) {
1027
+		if ($dependency instanceof $param_class) {
1028 1028
 			// then let's inject it into the incoming array of arguments at the correct location
1029
-			if ( isset( $argument_keys[ $index ] ) ) {
1030
-				$arguments[ $argument_keys[ $index ] ] = $dependency;
1029
+			if (isset($argument_keys[$index])) {
1030
+				$arguments[$argument_keys[$index]] = $dependency;
1031 1031
 			} else {
1032
-				$arguments[ $index ] = $dependency;
1032
+				$arguments[$index] = $dependency;
1033 1033
 			}
1034 1034
 		}
1035 1035
 		return $arguments;
@@ -1054,19 +1054,19 @@  discard block
 block discarded – undo
1054 1054
 	 * @param bool $from_db
1055 1055
 	 * @return void
1056 1056
 	 */
1057
-	protected function _set_cached_class( $class_obj, $class_name, $class_prefix = '', $from_db = false ) {
1058
-		if ( empty( $class_obj ) ) {
1057
+	protected function _set_cached_class($class_obj, $class_name, $class_prefix = '', $from_db = false) {
1058
+		if (empty($class_obj)) {
1059 1059
 			return;
1060 1060
 		}
1061 1061
 		// return newly instantiated class
1062
-		if ( isset( $this->_class_abbreviations[ $class_name ] ) ) {
1063
-			$class_abbreviation = $this->_class_abbreviations[ $class_name ];
1062
+		if (isset($this->_class_abbreviations[$class_name])) {
1063
+			$class_abbreviation = $this->_class_abbreviations[$class_name];
1064 1064
 			$this->{$class_abbreviation} = $class_obj;
1065
-		} else if ( property_exists( $this, $class_name ) ) {
1065
+		} else if (property_exists($this, $class_name)) {
1066 1066
 			$this->{$class_name} = $class_obj;
1067
-		} else if ( $class_prefix == 'addon' ) {
1067
+		} else if ($class_prefix == 'addon') {
1068 1068
 			$this->addons->{$class_name} = $class_obj;
1069
-		} else if ( ! $from_db ) {
1069
+		} else if ( ! $from_db) {
1070 1070
 			$this->LIB->{$class_name} = $class_obj;
1071 1071
 		}
1072 1072
 	}
@@ -1083,12 +1083,12 @@  discard block
 block discarded – undo
1083 1083
 	 * @param array  $arguments
1084 1084
 	 * @return object
1085 1085
 	 */
1086
-	public static function factory( $classname, $arguments = array() ) {
1087
-		$loader = self::instance()->_dependency_map->class_loader( $classname );
1088
-		if ( $loader instanceof Closure ) {
1089
-			return $loader( $arguments );
1090
-		} else if ( method_exists( EE_Registry::instance(), $loader ) ) {
1091
-			return EE_Registry::instance()->{$loader}( $classname, $arguments );
1086
+	public static function factory($classname, $arguments = array()) {
1087
+		$loader = self::instance()->_dependency_map->class_loader($classname);
1088
+		if ($loader instanceof Closure) {
1089
+			return $loader($arguments);
1090
+		} else if (method_exists(EE_Registry::instance(), $loader)) {
1091
+			return EE_Registry::instance()->{$loader}($classname, $arguments);
1092 1092
 		}
1093 1093
 		return null;
1094 1094
 	}
@@ -1101,9 +1101,9 @@  discard block
 block discarded – undo
1101 1101
 	 * @param string $name
1102 1102
 	 * @return EE_Addon
1103 1103
 	 */
1104
-	public function get_addon_by_name( $name ) {
1105
-		foreach ( $this->addons as $addon ) {
1106
-			if ( $addon->name() == $name ) {
1104
+	public function get_addon_by_name($name) {
1105
+		foreach ($this->addons as $addon) {
1106
+			if ($addon->name() == $name) {
1107 1107
 				return $addon;
1108 1108
 			}
1109 1109
 		}
@@ -1119,8 +1119,8 @@  discard block
 block discarded – undo
1119 1119
 	 */
1120 1120
 	public function get_addons_by_name() {
1121 1121
 		$addons = array();
1122
-		foreach ( $this->addons as $addon ) {
1123
-			$addons[ $addon->name() ] = $addon;
1122
+		foreach ($this->addons as $addon) {
1123
+			$addons[$addon->name()] = $addon;
1124 1124
 		}
1125 1125
 		return $addons;
1126 1126
 	}
@@ -1135,16 +1135,16 @@  discard block
 block discarded – undo
1135 1135
 	 * @return \EEM_Base
1136 1136
 	 * @throws \EE_Error
1137 1137
 	 */
1138
-	public function reset_model( $model_name ) {
1139
-		$model_class_name = strpos( $model_name, 'EEM_' ) !== 0 ? "EEM_{$model_name}" : $model_name;
1140
-		if( ! isset( $this->LIB->{$model_class_name} ) || ! $this->LIB->{$model_class_name} instanceof EEM_Base ) {
1138
+	public function reset_model($model_name) {
1139
+		$model_class_name = strpos($model_name, 'EEM_') !== 0 ? "EEM_{$model_name}" : $model_name;
1140
+		if ( ! isset($this->LIB->{$model_class_name} ) || ! $this->LIB->{$model_class_name} instanceof EEM_Base) {
1141 1141
 			return null;
1142 1142
 		}
1143 1143
 		//get that model reset it and make sure we nuke the old reference to it
1144
-		if ( $this->LIB->{$model_class_name} instanceof $model_class_name && is_callable( array( $model_class_name, 'reset' ))) {
1144
+		if ($this->LIB->{$model_class_name} instanceof $model_class_name && is_callable(array($model_class_name, 'reset'))) {
1145 1145
 			$this->LIB->{$model_class_name} = $this->LIB->{$model_class_name}->reset();
1146 1146
 		} else {
1147
-			throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) );
1147
+			throw new EE_Error(sprintf(__('Model %s does not have a method "reset"', 'event_espresso'), $model_name));
1148 1148
 		}
1149 1149
 		return $this->LIB->{$model_class_name};
1150 1150
 	}
@@ -1181,13 +1181,13 @@  discard block
 block discarded – undo
1181 1181
 	 *
1182 1182
 	 * @return EE_Registry
1183 1183
 	 */
1184
-	public static function reset( $hard = false, $reinstantiate = true, $reset_models = true ) {
1184
+	public static function reset($hard = false, $reinstantiate = true, $reset_models = true) {
1185 1185
 		$instance = self::instance();
1186 1186
 		EEH_Activation::reset();
1187 1187
 
1188 1188
 		//properties that get reset
1189 1189
 		$instance->_cache_on = true;
1190
-		$instance->CFG = EE_Config::reset( $hard, $reinstantiate );
1190
+		$instance->CFG = EE_Config::reset($hard, $reinstantiate);
1191 1191
 		$instance->CART = null;
1192 1192
 		$instance->MRM = null;
1193 1193
 		$instance->LIB = new stdClass();
@@ -1195,9 +1195,9 @@  discard block
 block discarded – undo
1195 1195
 		//messages reset
1196 1196
 		EED_Messages::reset();
1197 1197
 
1198
-		if ( $reset_models ) {
1199
-			foreach ( array_keys( $instance->non_abstract_db_models ) as $model_name ) {
1200
-				$instance->reset_model( $model_name );
1198
+		if ($reset_models) {
1199
+			foreach (array_keys($instance->non_abstract_db_models) as $model_name) {
1200
+				$instance->reset_model($model_name);
1201 1201
 			}
1202 1202
 		}
1203 1203
 
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 	 * @param $a
1220 1220
 	 * @param $b
1221 1221
 	 */
1222
-	final function __call( $a, $b ) {
1222
+	final function __call($a, $b) {
1223 1223
 	}
1224 1224
 
1225 1225
 
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 	/**
1228 1228
 	 * @param $a
1229 1229
 	 */
1230
-	final function __get( $a ) {
1230
+	final function __get($a) {
1231 1231
 	}
1232 1232
 
1233 1233
 
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 	 * @param $a
1237 1237
 	 * @param $b
1238 1238
 	 */
1239
-	final function __set( $a, $b ) {
1239
+	final function __set($a, $b) {
1240 1240
 	}
1241 1241
 
1242 1242
 
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
 	/**
1245 1245
 	 * @param $a
1246 1246
 	 */
1247
-	final function __isset( $a ) {
1247
+	final function __isset($a) {
1248 1248
 	}
1249 1249
 
1250 1250
 
@@ -1252,7 +1252,7 @@  discard block
 block discarded – undo
1252 1252
 	/**
1253 1253
 	 * @param $a
1254 1254
 	 */
1255
-	final function __unset( $a ) {
1255
+	final function __unset($a) {
1256 1256
 	}
1257 1257
 
1258 1258
 
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
 	 * @param $a
1300 1300
 	 * @param $b
1301 1301
 	 */
1302
-	final static function __callStatic( $a, $b ) {
1302
+	final static function __callStatic($a, $b) {
1303 1303
 	}
1304 1304
 
1305 1305
 	/**
@@ -1308,9 +1308,9 @@  discard block
 block discarded – undo
1308 1308
 	 */
1309 1309
 	public function cpt_models() {
1310 1310
 		$cpt_models = array();
1311
-		foreach( $this->non_abstract_db_models as $short_name => $classname ) {
1312
-			if( is_subclass_of(  $classname, 'EEM_CPT_Base' ) ) {
1313
-				$cpt_models[ $short_name ] = $classname;
1311
+		foreach ($this->non_abstract_db_models as $short_name => $classname) {
1312
+			if (is_subclass_of($classname, 'EEM_CPT_Base')) {
1313
+				$cpt_models[$short_name] = $classname;
1314 1314
 			}
1315 1315
 		}
1316 1316
 		return $cpt_models;
Please login to merge, or discard this patch.