Completed
Branch BUG-7537 (396ea7)
by
unknown
310:09 queued 289:41
created
admin_pages/events/templates/event_tickets_metabox_main.template.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php do_action( 'AHEE__event_tickets_metabox_main__before_content' ); ?>
1
+<?php do_action('AHEE__event_tickets_metabox_main__before_content'); ?>
2 2
 <div id="event-and-ticket-form-content">
3 3
 	<h4 class="event-tickets-datetimes-title"><?php _e('Event Datetime', 'event_espresso'); ?></h4><?php echo $event_datetime_help_link; ?>
4 4
 	<div class="event-datetimes-container">
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 						</td>
30 30
 						<td class="event-datetime-column reg-limit-column">
31 31
 							<?php
32
-								$reg_limit = $time->get_pretty('DTT_reg_limit','input');
32
+								$reg_limit = $time->get_pretty('DTT_reg_limit', 'input');
33 33
 							?>
34 34
 							<input type="text" name="edit_event_datetimes[1][DTT_reg_limit]" id="event-datetime-DTT_reg_limit-1" class="ee-small-text-inp ee-inp-right event-datetime-DTT_reg_limit" value="<?php echo $reg_limit; ?>">
35 35
 						</td>
36
-						<td class="datetime-tickets-sold"><?php printf( __('Tickets Sold: %s', 'event_espresso'), $time->get('DTT_sold') ); ?></td>
36
+						<td class="datetime-tickets-sold"><?php printf(__('Tickets Sold: %s', 'event_espresso'), $time->get('DTT_sold')); ?></td>
37 37
 					</tr>
38 38
 				</tbody>
39 39
 			</table>
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	<div style="clear:both"></div>
72 72
 </div> <!-- end #event-and-ticket-form-content -->
73 73
 
74
-<?php do_action( 'AHEE__event_tickets_metabox_main__after_content' ); ?>
74
+<?php do_action('AHEE__event_tickets_metabox_main__after_content'); ?>
75 75
 
76 76
 <table id="new-ticket-row-form" class="hidden">
77 77
 	<tbody><?php echo $ticket_js_structure; ?></tbody>
Please login to merge, or discard this patch.
general_settings/help_tabs/general_settings_critical_pages.help_tab.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,41 +6,41 @@
 block discarded – undo
6 6
 <ul>
7 7
 <li>
8 8
 <strong><?php _e('Registration Checkout Page', 'event_espresso'); ?></strong><br />
9
-<?php printf( __('This page displays all your events and is required. It is important that this page always contain the %s shortcode. It is not required to be in your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_CHECKOUT]</strong>' ); ?>
9
+<?php printf(__('This page displays all your events and is required. It is important that this page always contain the %s shortcode. It is not required to be in your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_CHECKOUT]</strong>'); ?>
10 10
 </li>
11 11
 <li>
12 12
 <strong><?php _e('Transactions Page', 'event_espresso'); ?></strong><br />
13
-<?php printf( __('This page processes the payments and is required. It should only contain the %s shortcode. No other content should be added and it should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_TXN_PAGE]</strong>' ); ?>
13
+<?php printf(__('This page processes the payments and is required. It should only contain the %s shortcode. No other content should be added and it should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_TXN_PAGE]</strong>'); ?>
14 14
 </li>
15 15
 <li>
16 16
 <strong><?php _e('Thank You Page', 'event_espresso'); ?></strong><br />
17
-<?php printf( __('This page is displayed after a successful transaction and is required. It should contain the %s shortcode. Additionally, you may customize this page by adding extra content to the page. It should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_THANK_YOU]</strong>' ); ?>
17
+<?php printf(__('This page is displayed after a successful transaction and is required. It should contain the %s shortcode. Additionally, you may customize this page by adding extra content to the page. It should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_THANK_YOU]</strong>'); ?>
18 18
 </li>
19 19
 <li>
20 20
 <strong><?php _e('Cancel / Return Page', 'event_espresso'); ?></strong><br />
21
-<?php printf( __('This page is displayed after an unsuccessful transaction and is required.  It should contain the %s shortcode. Additionally, you may customize this page by adding extra content to the page. It should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_CANCELLED]</strong>' ); ?>
21
+<?php printf(__('This page is displayed after an unsuccessful transaction and is required.  It should contain the %s shortcode. Additionally, you may customize this page by adding extra content to the page. It should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_CANCELLED]</strong>'); ?>
22 22
 </li>
23 23
 <li>
24 24
 <strong><?php _e('Event List', 'event_espresso'); ?></strong><br />
25
-<?php printf(__('If you would like to style the look of your events archive page, then follow the WordPress instructions for %1$screating a custom template for archive pages%2$s.', 'event_espresso'), '<a href="http://codex.wordpress.org/Post_Type_Templates">','</a>'); ?>
25
+<?php printf(__('If you would like to style the look of your events archive page, then follow the WordPress instructions for %1$screating a custom template for archive pages%2$s.', 'event_espresso'), '<a href="http://codex.wordpress.org/Post_Type_Templates">', '</a>'); ?>
26 26
 <ul>
27 27
 <li style="list-style-type: circle;">
28
-<?php printf( __('Build a template for your events - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>archive-espresso_events.php</strong>','wp-content/themes/twenty-fourteen' ); ?>
28
+<?php printf(__('Build a template for your events - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>archive-espresso_events.php</strong>', 'wp-content/themes/twenty-fourteen'); ?>
29 29
 </li>
30 30
 <li style="list-style-type: circle;">
31
-<?php printf( __('Build a template for a single event - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>single-espresso_events.php</strong>','wp-content/themes/twenty-fourteen' ); ?>
31
+<?php printf(__('Build a template for a single event - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>single-espresso_events.php</strong>', 'wp-content/themes/twenty-fourteen'); ?>
32 32
 </li>
33 33
 </ul>
34 34
 </li>
35 35
 <li>
36 36
 <strong><?php _e('Venue List', 'event_espresso'); ?></strong><br />
37
-<?php printf(__('If you would like to style the look of your venues archive page, then follow the WordPress instructions for %1$screating a custom template for archive pages%2$s.', 'event_espresso'), '<a href="http://codex.wordpress.org/Post_Type_Templates">','</a>'); ?>
37
+<?php printf(__('If you would like to style the look of your venues archive page, then follow the WordPress instructions for %1$screating a custom template for archive pages%2$s.', 'event_espresso'), '<a href="http://codex.wordpress.org/Post_Type_Templates">', '</a>'); ?>
38 38
 <ul>
39 39
 <li style="list-style-type: circle;">
40
-<?php printf( __('Build a template for your events - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>archive-espresso_venues.php</strong>','wp-content/themes/twenty-fourteen' ); ?>
40
+<?php printf(__('Build a template for your events - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>archive-espresso_venues.php</strong>', 'wp-content/themes/twenty-fourteen'); ?>
41 41
 </li>
42 42
 <li style="list-style-type: circle;">
43
-<?php printf( __('Build a template for a single event - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>single-espresso_venues.php</strong>','wp-content/themes/twenty-fourteen' ); ?>
43
+<?php printf(__('Build a template for a single event - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>single-espresso_venues.php</strong>', 'wp-content/themes/twenty-fourteen'); ?>
44 44
 </li>
45 45
 </ul>
46 46
 </li>
Please login to merge, or discard this patch.
admin_pages/general_settings/templates/espresso_page_settings.template.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 						</strong>
25 25
 						<?php echo EEH_Template::get_help_tab_link('registration_page_info'); ?>
26 26
 						<br />
27
-						<?php echo General_Settings_Admin_Page::edit_view_links( $reg_page_id );?>
27
+						<?php echo General_Settings_Admin_Page::edit_view_links($reg_page_id); ?>
28 28
 					</label>
29 29
 				</th>
30 30
 				<td>
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 						<option value="0">
33 33
 							<?php _e('Main Page', 'event_espresso'); ?>
34 34
 						</option>
35
-						<?php General_Settings_Admin_Page::page_settings_dropdown( $reg_page_id ); ?>
35
+						<?php General_Settings_Admin_Page::page_settings_dropdown($reg_page_id); ?>
36 36
 					</select>
37 37
 					<span>
38
-						<?php echo General_Settings_Admin_Page::page_and_shortcode_status( $reg_page_obj, '[ESPRESSO_CHECKOUT]' ); ?>
38
+						<?php echo General_Settings_Admin_Page::page_and_shortcode_status($reg_page_obj, '[ESPRESSO_CHECKOUT]'); ?>
39 39
 					</span>
40 40
 					<br />
41 41
 					<p class="description">
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 						<?php echo EEH_Template::get_help_tab_link('notify_url_info'); ?>
60 60
 						<br />
61 61
 						<span class="lt-grey-text"><?php _e('Notify URL (processes payments)', 'event_espresso'); ?></span><br/>
62
-						<?php echo General_Settings_Admin_Page::edit_view_links( $txn_page_id );?>
62
+						<?php echo General_Settings_Admin_Page::edit_view_links($txn_page_id); ?>
63 63
 					</label>
64 64
 				</th>
65 65
 				<td>
@@ -67,16 +67,16 @@  discard block
 block discarded – undo
67 67
 						<option value="0">
68 68
 							<?php _e('Main Page', 'event_espresso'); ?>
69 69
 						</option>
70
-						<?php General_Settings_Admin_Page::page_settings_dropdown( $txn_page_id ); ?>
70
+						<?php General_Settings_Admin_Page::page_settings_dropdown($txn_page_id); ?>
71 71
 					</select>
72 72
 					<span>
73
-						<?php echo General_Settings_Admin_Page::page_and_shortcode_status( $txn_page_obj, '[ESPRESSO_TXN_PAGE]' ); ?>
73
+						<?php echo General_Settings_Admin_Page::page_and_shortcode_status($txn_page_obj, '[ESPRESSO_TXN_PAGE]'); ?>
74 74
 					</span>
75 75
 					<br />
76 76
 					<p class="description">
77 77
 						<?php
78 78
 						echo sprintf(
79
-							__( 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain the %s shortcode.', 'event_espresso' ),
79
+							__('This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain the %s shortcode.', 'event_espresso'),
80 80
 							'<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_TXN_PAGE]</span>'
81 81
 						);
82 82
 						?>
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 						</strong>
94 94
 						<?php echo EEH_Template::get_help_tab_link('return_url_info'); ?>
95 95
 						<br />
96
-						<?php echo General_Settings_Admin_Page::edit_view_links( $thank_you_page_id );?>
96
+						<?php echo General_Settings_Admin_Page::edit_view_links($thank_you_page_id); ?>
97 97
 					</label>
98 98
 				</th>
99 99
 				<td>
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
 						<option value="0">
102 102
 							<?php _e('Main Page', 'event_espresso'); ?>
103 103
 						</option>
104
-						<?php General_Settings_Admin_Page::page_settings_dropdown( $thank_you_page_id ); ?>
104
+						<?php General_Settings_Admin_Page::page_settings_dropdown($thank_you_page_id); ?>
105 105
 					</select>
106 106
 					<span>
107
-						<?php echo General_Settings_Admin_Page::page_and_shortcode_status( $thank_you_page_obj, '[ESPRESSO_THANK_YOU]' ); ?>
107
+						<?php echo General_Settings_Admin_Page::page_and_shortcode_status($thank_you_page_obj, '[ESPRESSO_THANK_YOU]'); ?>
108 108
 					</span>
109 109
 					<br />
110 110
 					<p class="description">
111 111
 						<?php
112 112
 						echo sprintf(
113
-							__( 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain the %s shortcode.', 'event_espresso' ),
113
+							__('This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain the %s shortcode.', 'event_espresso'),
114 114
 							'<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_THANK_YOU]</span>'
115 115
 						);
116 116
 						?>
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 						</strong>
128 128
 						<?php echo EEH_Template::get_help_tab_link('cancel_return_info'); ?>
129 129
 						<br />
130
-						<?php echo General_Settings_Admin_Page::edit_view_links( $cancel_page_id );?>
130
+						<?php echo General_Settings_Admin_Page::edit_view_links($cancel_page_id); ?>
131 131
 					</label>
132 132
 				</th>
133 133
 				<td>
@@ -135,16 +135,16 @@  discard block
 block discarded – undo
135 135
 						<option value="0">
136 136
 							<?php _e('Main Page', 'event_espresso'); ?>
137 137
 						</option>
138
-						<?php General_Settings_Admin_Page::page_settings_dropdown( $cancel_page_id ); ?>
138
+						<?php General_Settings_Admin_Page::page_settings_dropdown($cancel_page_id); ?>
139 139
 					</select>
140 140
 					<span>
141
-						<?php echo General_Settings_Admin_Page::page_and_shortcode_status( $cancel_page_obj, '[ESPRESSO_CANCELLED]' ); ?>
141
+						<?php echo General_Settings_Admin_Page::page_and_shortcode_status($cancel_page_obj, '[ESPRESSO_CANCELLED]'); ?>
142 142
 					</span>
143 143
 					<br />
144 144
 					<p class="description">
145 145
 						<?php
146 146
 						echo sprintf(
147
-							__( 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain a "cancelled transaction" message and the %s shortcode.', 'event_espresso' ),
147
+							__('This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain a "cancelled transaction" message and the %s shortcode.', 'event_espresso'),
148 148
 							'<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_CANCELLED]</span>'
149 149
 						);
150 150
 						?>
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 						</strong>
162 162
 						<?php echo EEH_Template::get_help_tab_link('event_list_cpt_info'); ?>
163 163
 						<br />
164
-						<a href='<?php echo get_post_type_archive_link('espresso_events') ?>'><?php	_e('View', 'event_espresso');?></a>
164
+						<a href='<?php echo get_post_type_archive_link('espresso_events') ?>'><?php	_e('View', 'event_espresso'); ?></a>
165 165
 					</label>
166 166
 				</th>
167 167
 				<td>
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 						<?php echo __('Events are custom post types and use WordPress\' normal archive pages for displaying events.', 'event_espresso') ?>
170 170
 					</p>
171 171
 					<p class="description">
172
-						<?php printf(__('If you would still like your events on a page like in Event Espresso 3.1 or earlier, simply create a page and place a shortcode to display them on the page, as described %s here %s', 'event_espresso'),'<a href="admin.php?page=espresso_support">','</a>') ?>
172
+						<?php printf(__('If you would still like your events on a page like in Event Espresso 3.1 or earlier, simply create a page and place a shortcode to display them on the page, as described %s here %s', 'event_espresso'), '<a href="admin.php?page=espresso_support">', '</a>') ?>
173 173
 					</p>
174 174
 					<br/><br/>
175 175
 				</td>
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 						</strong>
184 184
 						<?php echo EEH_Template::get_help_tab_link('venue_list_cpt_info'); ?>
185 185
 						<br />
186
-						<a href='<?php echo get_post_type_archive_link('espresso_venues') ?>'><?php	_e('View', 'event_espresso');?></a>
186
+						<a href='<?php echo get_post_type_archive_link('espresso_venues') ?>'><?php	_e('View', 'event_espresso'); ?></a>
187 187
 					</label>
188 188
 				</th>
189 189
 				<td>
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 						<?php echo __('Venues are custom post types and use WordPress\' normal archive pages for displaying events.', 'event_espresso') ?>
192 192
 					</p>
193 193
 					<p class="description">
194
-						<?php printf(__('If you would still like your venues on a page like in Event Espresso 3.1 or earlier, simply create a page and place a shortcode to display them on the page, as described %s here %s', 'event_espresso'),'<a href="admin.php?page=espresso_support">','</a>') ?>
194
+						<?php printf(__('If you would still like your venues on a page like in Event Espresso 3.1 or earlier, simply create a page and place a shortcode to display them on the page, as described %s here %s', 'event_espresso'), '<a href="admin.php?page=espresso_support">', '</a>') ?>
195 195
 					</p>
196 196
 				</td>
197 197
 			</tr>
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Admin_Page.core.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 
191 191
 	/**
192 192
 	 * 		an array for storing key => value pairs of request actions and their corresponding methods
193
-	*		@access protected
194
-	*		@return void
195
-	*/
193
+	 *		@access protected
194
+	 *		@return void
195
+	 */
196 196
 	protected function _set_page_routes() {
197 197
 		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
198 198
 		$grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $grp_id;
@@ -379,18 +379,18 @@  discard block
 block discarded – undo
379 379
 							'title' => __('Message Template Editor', 'event_espresso'),
380 380
 							'callback' => 'edit_message_template_help_tab'
381 381
 							),
382
-                        'message_templates_help_tab' => array(
383
-                            'title' => __('Message Templates', 'event_espresso'),
384
-                            'filename' => 'messages_templates'
385
-                            ),
382
+						'message_templates_help_tab' => array(
383
+							'title' => __('Message Templates', 'event_espresso'),
384
+							'filename' => 'messages_templates'
385
+							),
386 386
 						'message_template_shortcodes' => array(
387 387
 							'title' => __('Message Shortcodes', 'event_espresso'),
388 388
 							'callback' => 'message_template_shortcodes_help_tab'
389 389
 							),
390
-                        'message_preview_help_tab' => array(
391
-                            'title' => __('Message Preview', 'event_espresso'),
392
-                            'filename' => 'messages_preview'
393
-                            ),
390
+						'message_preview_help_tab' => array(
391
+							'title' => __('Message Preview', 'event_espresso'),
392
+							'filename' => 'messages_preview'
393
+							),
394 394
 					),
395 395
 				'require_nonce' => FALSE
396 396
 				),
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 					'order' => 20
416 416
 					),
417 417
 				'metaboxes' => array('_messages_settings_metaboxes'),
418
-                'help_tabs' => array(
418
+				'help_tabs' => array(
419 419
 						'messages_settings_help_tab' => array(
420 420
 							'title' => __('Messages Settings', 'event_espresso'),
421 421
 							'filename' => 'messages_settings'
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 							'title' => __('Activating / Deactivating Messengers', 'event_espresso'),
429 429
 							'filename' => 'messages_settings_messengers'
430 430
 							),
431
-                    ),
431
+					),
432 432
 				'help_tour' => array( 'Messages_Settings_Help_Tour' ),
433 433
 				'require_nonce' => FALSE
434 434
 				)
@@ -1564,14 +1564,14 @@  discard block
 block discarded – undo
1564 1564
 
1565 1565
 
1566 1566
 	/**
1567
-     * This returns the shortcode selector skeleton for a given context and field.
1568
-     *
1569
-     * @since 4.9.rc.000
1570
-     *
1567
+	 * This returns the shortcode selector skeleton for a given context and field.
1568
+	 *
1569
+	 * @since 4.9.rc.000
1570
+	 *
1571 1571
 	 * @param string $field  The name of the field retrieving shortcodes for.
1572
-     * @param string $linked_input_id The css id of the input that the shortcodes get added to.
1573
-     * @return string
1574
-    */
1572
+	 * @param string $linked_input_id The css id of the input that the shortcodes get added to.
1573
+	 * @return string
1574
+	 */
1575 1575
 	protected function _get_shortcode_selector( $field, $linked_input_id ) {
1576 1576
 		$template_args = array(
1577 1577
 			'shortcodes' => $this->_get_shortcodes( array( $field ), true ),
@@ -2111,9 +2111,9 @@  discard block
 block discarded – undo
2111 2111
 
2112 2112
 	/**
2113 2113
 	 * 	_learn_more_about_message_templates_link
2114
-	*	@access protected
2115
-	*	@return string
2116
-	*/
2114
+	 *	@access protected
2115
+	 *	@return string
2116
+	 */
2117 2117
 	protected function _learn_more_about_message_templates_link() {
2118 2118
 		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2119 2119
 	}
Please login to merge, or discard this patch.
Spacing   +505 added lines, -505 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION'))
2 2
 	exit('NO direct script access allowed');
3 3
 
4 4
 /**
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * @access public
74 74
 	 * @return void
75 75
 	 */
76
-	public function __construct( $routing = TRUE ) {
76
+	public function __construct($routing = TRUE) {
77 77
 		//make sure MSG Template helper is loaded.
78 78
 		EE_Registry::instance()->load_helper('MSG_Template');
79 79
 		//make sure messages autoloader is running
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 
95 95
 		$this->_activate_state = isset($this->_req_data['activate_state']) ? (array) $this->_req_data['activate_state'] : array();
96 96
 
97
-		$this->_active_messenger = isset( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : NULL;
97
+		$this->_active_messenger = isset($this->_req_data['messenger']) ? $this->_req_data['messenger'] : NULL;
98 98
 
99
-		EE_Registry::instance()->load_lib( 'messages' );
99
+		EE_Registry::instance()->load_lib('messages');
100 100
 		//we're also going to set the active messengers and active message types in here.
101 101
 		$this->_active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
102
-		$this->_active_messengers = !empty($this->_active_messengers) ?  $this->_active_messengers : array();
103
-		$this->_active_message_types = !empty($this->_active_messenger) && !empty($this->_active_messengers[$this->_active_messenger]) && ! empty(  $this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger . '-message_types'] ) ? array_keys($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger . '-message_types']) : array();
102
+		$this->_active_messengers = ! empty($this->_active_messengers) ? $this->_active_messengers : array();
103
+		$this->_active_message_types = ! empty($this->_active_messenger) && ! empty($this->_active_messengers[$this->_active_messenger]) && ! empty($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger.'-message_types']) ? array_keys($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger.'-message_types']) : array();
104 104
 
105 105
 
106 106
 		//what about saving the objects in the active_messengers and active_message_types?
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 	 * @return void
119 119
 	 */
120 120
 	protected function _load_active_messenger_objects() {
121
-		foreach ( $this->_active_messengers as $messenger => $values ) {
122
-			$ref = ucwords( str_replace( '_' , ' ', $messenger) );
123
-			$ref = str_replace( ' ', '_', $ref );
124
-			$classname = 'EE_' . $ref . '_messenger';
125
-			require_once( EE_LIBRARIES . 'messages'. DS .'messenger' . DS . $classname . '.class.php' );
126
-			if ( !class_exists($classname) )
127
-				throw new EE_Error( sprintf( __('There is no messenger for the given classname (%s)', 'event_espresso'), $classname ) );
128
-
129
-			$a = new ReflectionClass( $classname );
121
+		foreach ($this->_active_messengers as $messenger => $values) {
122
+			$ref = ucwords(str_replace('_', ' ', $messenger));
123
+			$ref = str_replace(' ', '_', $ref);
124
+			$classname = 'EE_'.$ref.'_messenger';
125
+			require_once(EE_LIBRARIES.'messages'.DS.'messenger'.DS.$classname.'.class.php');
126
+			if ( ! class_exists($classname))
127
+				throw new EE_Error(sprintf(__('There is no messenger for the given classname (%s)', 'event_espresso'), $classname));
128
+
129
+			$a = new ReflectionClass($classname);
130 130
 			$this->_active_messengers[$messenger]['obj'] = $a->newInstance();
131 131
 		}
132 132
 	}
@@ -141,16 +141,16 @@  discard block
 block discarded – undo
141 141
 	 * @return void
142 142
 	 */
143 143
 	protected function _load_active_message_type_objects() {
144
-		if ( empty($this->_active_message_types) ) return;
145
-		foreach ( $this->_active_message_types as $message_type ) {
146
-			$ref = ucwords( str_replace( '_' , ' ', $message_type) );
147
-			$ref = str_replace( ' ', '_', $ref );
148
-			$classname = 'EE_' . $ref . '_message_type';
144
+		if (empty($this->_active_message_types)) return;
145
+		foreach ($this->_active_message_types as $message_type) {
146
+			$ref = ucwords(str_replace('_', ' ', $message_type));
147
+			$ref = str_replace(' ', '_', $ref);
148
+			$classname = 'EE_'.$ref.'_message_type';
149 149
 
150
-			if ( !class_exists($classname) )
151
-				throw new EE_Error( sprintf( __('There is no message type for the given classname (%s)', 'event_espresso'), $classname ) );
150
+			if ( ! class_exists($classname))
151
+				throw new EE_Error(sprintf(__('There is no message type for the given classname (%s)', 'event_espresso'), $classname));
152 152
 
153
-			$a = new ReflectionClass( $classname );
153
+			$a = new ReflectionClass($classname);
154 154
 			$this->_active_message_types[$message_type]['obj'] = $a->newInstance();
155 155
 		}
156 156
 	}
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 
159 159
 
160 160
 	protected function _ajax_hooks() {
161
-		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle' ) );
162
-		add_action('wp_ajax_activate_mt', array( $this, 'activate_mt_toggle') );
163
-		add_action('wp_ajax_ee_msgs_save_settings', array( $this, 'save_settings') );
164
-		add_action('wp_ajax_ee_msgs_update_mt_form', array( $this, 'update_mt_form' ) );
165
-		add_action('wp_ajax_switch_template_pack', array( $this, 'switch_template_pack' ) );
161
+		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle'));
162
+		add_action('wp_ajax_activate_mt', array($this, 'activate_mt_toggle'));
163
+		add_action('wp_ajax_ee_msgs_save_settings', array($this, 'save_settings'));
164
+		add_action('wp_ajax_ee_msgs_update_mt_form', array($this, 'update_mt_form'));
165
+		add_action('wp_ajax_switch_template_pack', array($this, 'switch_template_pack'));
166 166
 	}
167 167
 
168 168
 
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	*		@return void
195 195
 	*/
196 196
 	protected function _set_page_routes() {
197
-		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
198
-		$grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $grp_id;
197
+		$grp_id = ! empty($this->_req_data['GRP_ID']) && ! is_array($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
198
+		$grp_id = empty($grp_id) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $grp_id;
199 199
 
200 200
 		$this->_page_routes = array(
201 201
 				'default'=> array(
@@ -231,35 +231,35 @@  discard block
 block discarded – undo
231 231
 				'insert_message_template' => array(
232 232
 					'func' => '_insert_or_update_message_template',
233 233
 					'capability' => 'ee_edit_messages',
234
-					'args' => array( 'new_template' => TRUE ),
234
+					'args' => array('new_template' => TRUE),
235 235
 					'noheader' => TRUE
236 236
 					 ),
237 237
 				'update_message_template' => array(
238 238
 					'func' => '_insert_or_update_message_template',
239 239
 					'capability' => 'ee_edit_message',
240 240
 					'obj_id' => $grp_id,
241
-					'args' => array( 'new_template' => FALSE ),
241
+					'args' => array('new_template' => FALSE),
242 242
 					'noheader' => TRUE
243 243
 					),
244 244
 				'trash_message_template' => array(
245 245
 					'func' => '_trash_or_restore_message_template',
246 246
 					'capability' => 'ee_delete_message',
247 247
 					'obj_id' => $grp_id,
248
-					'args' => array( 'trash' => TRUE, 'all' => TRUE ),
248
+					'args' => array('trash' => TRUE, 'all' => TRUE),
249 249
 					'noheader' => TRUE
250 250
 					),
251 251
 				'trash_message_template_context' => array(
252 252
 					'func' => '_trash_or_restore_message_template',
253 253
 					'capability' => 'ee_delete_message',
254 254
 					'obj_id' => $grp_id,
255
-					'args' => array( 'trash' => TRUE ),
255
+					'args' => array('trash' => TRUE),
256 256
 					'noheader' => TRUE
257 257
 					),
258 258
 				'restore_message_template' => array(
259 259
 					'func' => '_trash_or_restore_message_template',
260 260
 					'capability' => 'ee_delete_message',
261 261
 					'obj_id' => $grp_id,
262
-					'args' => array( 'trash' => FALSE, 'all' => TRUE ),
262
+					'args' => array('trash' => FALSE, 'all' => TRUE),
263 263
 					'noheader' => TRUE
264 264
 					),
265 265
 				'restore_message_template_context' => array(
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 						'filename' => 'messages_overview_other',
339 339
 					),
340 340
 				),
341
-				'help_tour' => array( 'Messages_Overview_Help_Tour' ),
341
+				'help_tour' => array('Messages_Overview_Help_Tour'),
342 342
 				'require_nonce' => FALSE
343 343
 				),
344 344
 			'custom_mtps' => array(
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 					),
374 374
 				'metaboxes' => array('_publish_post_box', '_register_edit_meta_boxes'),
375 375
 				'has_metaboxes' => TRUE,
376
-				'help_tour' => array( 'Message_Templates_Edit_Help_Tour' ),
376
+				'help_tour' => array('Message_Templates_Edit_Help_Tour'),
377 377
 				'help_tabs' => array(
378 378
 						'edit_message_template' => array(
379 379
 							'title' => __('Message Template Editor', 'event_espresso'),
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 							'filename' => 'messages_settings_messengers'
430 430
 							),
431 431
                     ),
432
-				'help_tour' => array( 'Messages_Settings_Help_Tour' ),
432
+				'help_tour' => array('Messages_Settings_Help_Tour'),
433 433
 				'require_nonce' => FALSE
434 434
 				)
435 435
 			/*'reports' => array(
@@ -479,43 +479,43 @@  discard block
 block discarded – undo
479 479
 
480 480
 
481 481
 	public function messages_help_tab() {
482
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php';
483
-		EEH_Template::display_template( $templatepath, array());
482
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php';
483
+		EEH_Template::display_template($templatepath, array());
484 484
 	}
485 485
 
486 486
 
487 487
 	public function messengers_help_tab() {
488
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php';
489
-		EEH_Template::display_template( $templatepath, array());
488
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php';
489
+		EEH_Template::display_template($templatepath, array());
490 490
 	}
491 491
 
492 492
 
493 493
 	public function message_types_help_tab() {
494
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php';
495
-		EEH_Template::display_template( $templatepath, array());
494
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php';
495
+		EEH_Template::display_template($templatepath, array());
496 496
 	}
497 497
 
498 498
 
499 499
 	public function messages_overview_help_tab() {
500
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php';
501
-		EEH_Template::display_template( $templatepath, array());
500
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php';
501
+		EEH_Template::display_template($templatepath, array());
502 502
 	}
503 503
 
504 504
 
505 505
 	public function message_templates_help_tab() {
506
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php';
507
-		EEH_Template::display_template( $templatepath, array());
506
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php';
507
+		EEH_Template::display_template($templatepath, array());
508 508
 	}
509 509
 
510 510
 
511 511
 	public function edit_message_template_help_tab() {
512
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php';
513
-		$args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />';
514
-		$args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />';
515
-		$args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />';
516
-		$args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />';
517
-		$args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />';
518
-		EEH_Template::display_template( $templatepath, $args);
512
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php';
513
+		$args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />';
514
+		$args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />';
515
+		$args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />';
516
+		$args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />';
517
+		$args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />';
518
+		EEH_Template::display_template($templatepath, $args);
519 519
 	}
520 520
 
521 521
 
@@ -523,25 +523,25 @@  discard block
 block discarded – undo
523 523
 	public function message_template_shortcodes_help_tab() {
524 524
 		$this->_set_shortcodes();
525 525
 		$args['shortcodes'] = $this->_shortcodes;
526
-		$template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php';
527
-		EEH_Template::display_template( $template_path, $args );
526
+		$template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php';
527
+		EEH_Template::display_template($template_path, $args);
528 528
 	}
529 529
 
530 530
 
531 531
 
532 532
 	public function preview_message_help_tab() {
533
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php';
534
-		EEH_Template::display_template( $templatepath, array());
533
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php';
534
+		EEH_Template::display_template($templatepath, array());
535 535
 	}
536 536
 
537 537
 
538 538
 	public function settings_help_tab() {
539
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php';
540
-		$args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />';
541
-		$args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />';
539
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php';
540
+		$args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />';
541
+		$args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />';
542 542
 		$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>';
543 543
 		$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>';
544
-		EEH_Template::display_template( $templatepath, $args);
544
+		EEH_Template::display_template($templatepath, $args);
545 545
 	}
546 546
 
547 547
 
@@ -549,24 +549,24 @@  discard block
 block discarded – undo
549 549
 
550 550
 
551 551
 	public function load_scripts_styles() {
552
-		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION );
552
+		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION);
553 553
 		wp_enqueue_style('espresso_ee_msg');
554 554
 
555
-		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 );
555
+		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);
556 556
 	}
557 557
 
558 558
 
559 559
 
560 560
 
561 561
 
562
-	public function wp_editor_css( $mce_css ) {
562
+	public function wp_editor_css($mce_css) {
563 563
 		//if we're on the edit_message_template route
564
-		if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger  ) {
564
+		if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) {
565 565
 			$message_type_name = $this->_active_message_type_name;
566 566
 
567 567
 			//we're going to REPLACE the existing mce css
568 568
 			//we need to get the css file location from the active messenger
569
-			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation );
569
+			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation);
570 570
 		}
571 571
 
572 572
 		return $mce_css;
@@ -584,37 +584,37 @@  discard block
 block discarded – undo
584 584
 			$this->_message_template_group->messenger_obj()->label['singular'],
585 585
 			$this->_message_template_group->message_type_obj()->label['singular']
586 586
 		);
587
-		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' );
587
+		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');
588 588
 
589
-		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION );
589
+		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION);
590 590
 
591 591
 		wp_enqueue_script('ee_admin_js');
592 592
 		wp_enqueue_script('ee_msgs_edit_js');
593 593
 
594 594
 		//add in special css for tiny_mce
595
-		add_filter( 'mce_css', array( $this, 'wp_editor_css' ) );
595
+		add_filter('mce_css', array($this, 'wp_editor_css'));
596 596
 	}
597 597
 
598 598
 
599 599
 
600 600
 	public function load_scripts_styles_display_preview_message() {
601 601
 		$this->_set_message_template_group();
602
-		if ( isset( $this->_req_data['messenger'] ) ) {
602
+		if (isset($this->_req_data['messenger'])) {
603 603
 			$this->_active_messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
604 604
 		}
605 605
 
606
-		$message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : '';
606
+		$message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : '';
607 607
 
608 608
 
609
-		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation ) );
609
+		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation));
610 610
 	}
611 611
 
612 612
 
613 613
 
614 614
 	public function load_scripts_styles_settings() {
615
-		wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION );
616
-		wp_enqueue_style( 'ee-text-links' );
617
-		wp_enqueue_style( 'ee-message-settings' );
615
+		wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION);
616
+		wp_enqueue_style('ee-text-links');
617
+		wp_enqueue_style('ee-message-settings');
618 618
 
619 619
 		wp_enqueue_script('ee-messages-settings');
620 620
 	}
@@ -650,9 +650,9 @@  discard block
 block discarded – undo
650 650
 
651 651
 	protected function _custom_mtps_preview() {
652 652
 		$this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso');
653
-		$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' ) . '" />';
653
+		$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').'" />';
654 654
 		$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>';
655
-		$this->display_admin_caf_preview_page( 'custom_message_types', FALSE );
655
+		$this->display_admin_caf_preview_page('custom_message_types', FALSE);
656 656
 	}
657 657
 
658 658
 
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 	 * @param bool $global whether to return just global (true) or custom templates (false)
675 675
 	 * @return array|WP_Error object
676 676
 	 */
677
-	public function get_message_templates( $perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE ) {
677
+	public function get_message_templates($perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE) {
678 678
 		global $espresso_wp_user;
679 679
 		// start with an empty array
680 680
 		$message_templates = array();
@@ -684,24 +684,24 @@  discard block
 block discarded – undo
684 684
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby'];
685 685
 		$orderby = $this->_req_data['orderby'];
686 686
 
687
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC';
687
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
688 688
 
689
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
690
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage;
689
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
690
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage;
691 691
 
692
-		$offset = ($current_page-1)*$per_page;
693
-		$limit = $all ? NULL : array( $offset, $per_page );
692
+		$offset = ($current_page - 1) * $per_page;
693
+		$limit = $all ? NULL : array($offset, $per_page);
694 694
 
695 695
 
696 696
 		//options will match what is in the _views array property
697
-		switch( $type ) {
697
+		switch ($type) {
698 698
 
699 699
 			case 'in_use':
700
-				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE );
700
+				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE);
701 701
 				break;
702 702
 
703 703
 			default:
704
-				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global );
704
+				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global);
705 705
 
706 706
 		}
707 707
 
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 		$imts = $installed_objects['message_types'];
738 738
 		$installed = array();
739 739
 
740
-		foreach ( $imts as $message_type ) {
740
+		foreach ($imts as $message_type) {
741 741
 			$installed[$message_type->name]['obj'] = $message_type;
742 742
 		}
743 743
 
@@ -769,24 +769,24 @@  discard block
 block discarded – undo
769 769
 	 * @access  protected
770 770
 	 * @return void
771 771
 	 */
772
-	protected function _add_message_template(  $message_type = '', $messenger='', $GRP_ID = '' ) {
772
+	protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') {
773 773
 		//set values override any request data
774
-		$message_type = !empty( $message_type ) ? $message_type : '';
775
-		$message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type;
774
+		$message_type = ! empty($message_type) ? $message_type : '';
775
+		$message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type;
776 776
 
777
-		$messenger = !empty( $messenger ) ? $messenger : '';
778
-		$messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger;
777
+		$messenger = ! empty($messenger) ? $messenger : '';
778
+		$messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger;
779 779
 
780
-		$GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : '';
781
-		$GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID;
780
+		$GRP_ID = ! empty($GRP_ID) ? $GRP_ID : '';
781
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID;
782 782
 
783 783
 		//we need messenger and message type.  They should be coming from the event editor. If not here then return error
784
-		if ( empty( $message_type ) || empty( $messenger )  )
784
+		if (empty($message_type) || empty($messenger))
785 785
 			throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));
786 786
 
787 787
 		//we need the GRP_ID for the template being used as the base for the new template
788
-		if ( empty( $GRP_ID ) )
789
-			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' ) );
788
+		if (empty($GRP_ID))
789
+			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'));
790 790
 
791 791
 		//let's just make sure the template gets generated!
792 792
 
@@ -805,8 +805,8 @@  discard block
 block discarded – undo
805 805
 	 * @param string $messenger    messenger slug
806 806
 	 * @param int      $GRP_ID         GRP_ID for the related message template group this new template will be based off of.
807 807
 	 */
808
-	public function add_message_template( $message_type, $messenger, $GRP_ID ) {
809
-		$this->_add_message_template( $message_type, $messenger, $GRP_ID );
808
+	public function add_message_template($message_type, $messenger, $GRP_ID) {
809
+		$this->_add_message_template($message_type, $messenger, $GRP_ID);
810 810
 	}
811 811
 
812 812
 
@@ -817,36 +817,36 @@  discard block
 block discarded – undo
817 817
 	 * @return void
818 818
 	 */
819 819
 	protected function _edit_message_template() {
820
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '');
820
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
821 821
 
822 822
 		//we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates.
823
-		add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 );
823
+		add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2);
824 824
 
825
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
825
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
826 826
 
827 827
 		$this->_set_shortcodes(); //this also sets the _message_template property.
828 828
 		$message_template_group = $this->_message_template_group;
829 829
 		$c_label = $message_template_group->context_label();
830 830
 		$c_config = $message_template_group->contexts_config();
831 831
 
832
-		reset( $c_config );
833
-		$context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] ) ? strtolower($this->_req_data['context']) : key($c_config);
832
+		reset($c_config);
833
+		$context = isset($this->_req_data['context']) && ! empty($this->_req_data['context']) ? strtolower($this->_req_data['context']) : key($c_config);
834 834
 
835 835
 
836
-		if ( empty($GRP_ID) ) {
836
+		if (empty($GRP_ID)) {
837 837
 			$action = 'insert_message_template';
838 838
 			$button_both = FALSE;
839
-			$button_text = array( __( 'Save','event_espresso') );
839
+			$button_text = array(__('Save', 'event_espresso'));
840 840
 			$button_actions = array('something_different');
841 841
 			$referrer = FALSE;
842
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
842
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL);
843 843
 		} else {
844 844
 			$action = 'update_message_template';
845 845
 			$button_both = TRUE;
846 846
 			$button_text = array();
847 847
 			$button_actions = array();
848 848
 			$referrer = $this->_admin_base_url;
849
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
849
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL);
850 850
 		}
851 851
 
852 852
 		//set active messenger for this view
@@ -856,13 +856,13 @@  discard block
 block discarded – undo
856 856
 
857 857
 		//Do we have any validation errors?
858 858
 		$validators = $this->_get_transient();
859
-		$v_fields = !empty($validators) ? array_keys($validators) : array();
859
+		$v_fields = ! empty($validators) ? array_keys($validators) : array();
860 860
 
861 861
 
862 862
 		//we need to assemble the title from Various details
863
-		$context_label = sprintf( __('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label'] ));
863
+		$context_label = sprintf(__('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label']));
864 864
 
865
-		$title = sprintf( __(' %s %s Template %s', 'event_espresso'), ucwords($message_template_group->messenger_obj()->label['singular']), ucwords($message_template_group->message_type_obj()->label['singular']), $context_label );
865
+		$title = sprintf(__(' %s %s Template %s', 'event_espresso'), ucwords($message_template_group->messenger_obj()->label['singular']), ucwords($message_template_group->message_type_obj()->label['singular']), $context_label);
866 866
 
867 867
 		$this->_template_args['GRP_ID'] = $GRP_ID;
868 868
 		$this->_template_args['message_template'] = $message_template_group;
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
 		$MSG = new EE_messages();
874 874
 		$template_field_structure = $MSG->get_fields($message_template_group->messenger(), $message_template_group->message_type());
875 875
 
876
-		if ( !$template_field_structure ) {
876
+		if ( ! $template_field_structure) {
877 877
 			$template_field_structure = FALSE;
878 878
 			$template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso');
879 879
 		}
@@ -883,38 +883,38 @@  discard block
 block discarded – undo
883 883
 
884 884
 
885 885
 		//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.
886
-		if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) {
887
-			foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) {
888
-				unset( $template_field_structure[$context][$reference_field] );
886
+		if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) {
887
+			foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) {
888
+				unset($template_field_structure[$context][$reference_field]);
889 889
 			}
890 890
 		}
891 891
 
892 892
 		//let's loop through the template_field_structure and actually assemble the input fields!
893
-		if ( !empty($template_field_structure) ) {
894
-			$id_prefix= 'ee-msg-edit-template-fields-';
895
-			foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) {
893
+		if ( ! empty($template_field_structure)) {
894
+			$id_prefix = 'ee-msg-edit-template-fields-';
895
+			foreach ($template_field_structure[$context] as $template_field => $field_setup_array) {
896 896
 				//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.
897
-				if ( $template_field == 'extra' ) {
897
+				if ($template_field == 'extra') {
898 898
 					$this->_template_args['is_extra_fields'] = TRUE;
899
-					foreach ( $field_setup_array as $reference_field => $new_fields_array ) {
900
-						foreach ( $new_fields_array as $extra_field =>  $extra_array ) {
899
+					foreach ($field_setup_array as $reference_field => $new_fields_array) {
900
+						foreach ($new_fields_array as $extra_field =>  $extra_array) {
901 901
 							//let's verify if we need this extra field via the shortcodes parameter.
902 902
 							$continue = FALSE;
903
-							if ( isset( $extra_array['shortcodes_required'] ) ) {
904
-								foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) {
905
-									if ( !array_key_exists( $shortcode, $this->_shortcodes ) )
903
+							if (isset($extra_array['shortcodes_required'])) {
904
+								foreach ((array) $extra_array['shortcodes_required'] as $shortcode) {
905
+									if ( ! array_key_exists($shortcode, $this->_shortcodes))
906 906
 										$continue = TRUE;
907 907
 								}
908
-								if ( $continue ) continue;
908
+								if ($continue) continue;
909 909
 							}
910 910
 
911
-							$field_id = $reference_field . '-' . $extra_field . '-content';
911
+							$field_id = $reference_field.'-'.$extra_field.'-content';
912 912
 							$template_form_fields[$field_id] = $extra_array;
913
-							$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']';
914
-							$css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : '';
915
-							$template_form_fields[$field_id]['css_class'] = !empty( $v_fields ) && in_array($extra_field, $v_fields) && ( is_array($validators[$extra_field] ) && isset( $validators[$extra_field]['msg'] ) ) ? 'validate-error ' . $css_class : $css_class;
913
+							$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']';
914
+							$css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : '';
915
+							$template_form_fields[$field_id]['css_class'] = ! empty($v_fields) && in_array($extra_field, $v_fields) && (is_array($validators[$extra_field]) && isset($validators[$extra_field]['msg'])) ? 'validate-error '.$css_class : $css_class;
916 916
 							$content = $message_templates[$context][$reference_field]->get('MTP_content');
917
-							$template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field]) ? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") ) : '';
917
+							$template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field]) ? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8")) : '';
918 918
 
919 919
 							//do we have a validation error?  if we do then let's use that value instead
920 920
 							$template_form_fields[$field_id]['value'] = isset($validators[$extra_field]) ? $validators[$extra_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -924,32 +924,32 @@  discard block
 block discarded – undo
924 924
 
925 925
 							//shortcode selector
926 926
 							$field_name_to_use = $extra_field == 'main' ? 'content' : $extra_field;
927
-							$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector( $field_name_to_use, $field_id );
927
+							$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector($field_name_to_use, $field_id);
928 928
 
929
-							if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) {
929
+							if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') {
930 930
 								//we want to decode the entities
931
-								$template_form_fields[$field_id]['value'] = stripslashes( html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") );
931
+								$template_form_fields[$field_id]['value'] = stripslashes(html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8"));
932 932
 
933 933
 							}/**/
934 934
 						}
935
-						$templatefield_MTP_id = $reference_field . '-MTP_ID';
936
-						$templatefield_templatename_id = $reference_field . '-name';
935
+						$templatefield_MTP_id = $reference_field.'-MTP_ID';
936
+						$templatefield_templatename_id = $reference_field.'-name';
937 937
 
938 938
 						$template_form_fields[$templatefield_MTP_id] = array(
939
-							'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]',
939
+							'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]',
940 940
 							'label' => NULL,
941 941
 							'input' => 'hidden',
942 942
 							'type' => 'int',
943 943
 							'required' => FALSE,
944 944
 							'validation' => FALSE,
945
-							'value' => !empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
945
+							'value' => ! empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
946 946
 							'css_class' => '',
947 947
 							'format' => '%d',
948 948
 							'db-col' => 'MTP_ID'
949 949
 						);
950 950
 
951 951
 						$template_form_fields[$templatefield_templatename_id] = array(
952
-							'name' => 'MTP_template_fields[' . $reference_field . '][name]',
952
+							'name' => 'MTP_template_fields['.$reference_field.'][name]',
953 953
 							'label' => NULL,
954 954
 							'input' => 'hidden',
955 955
 							'type' => 'string',
@@ -963,10 +963,10 @@  discard block
 block discarded – undo
963 963
 					}
964 964
 					continue; //skip the next stuff, we got the necessary fields here for this dataset.
965 965
 				} else {
966
-					$field_id = $template_field . '-content';
966
+					$field_id = $template_field.'-content';
967 967
 					$template_form_fields[$field_id] = $field_setup_array;
968
-					$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]';
969
-					$template_form_fields[$field_id]['value'] = !empty($message_templates) && is_array($message_templates[$context]) && isset($message_templates[$context][$template_field]) ?$message_templates[$context][$template_field]->get('MTP_content') : '';
968
+					$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]';
969
+					$template_form_fields[$field_id]['value'] = ! empty($message_templates) && is_array($message_templates[$context]) && isset($message_templates[$context][$template_field]) ? $message_templates[$context][$template_field]->get('MTP_content') : '';
970 970
 
971 971
 					//do we have a validator error for this field?  if we do then we'll use that value instead
972 972
 					$template_form_fields[$field_id]['value'] = isset($validators[$template_field]) ? $validators[$template_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -974,12 +974,12 @@  discard block
 block discarded – undo
974 974
 
975 975
 					$template_form_fields[$field_id]['db-col'] = 'MTP_content';
976 976
 					$css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : '';
977
-					$template_form_fields[$field_id]['css_class'] = !empty( $v_fields ) && in_array( $template_field, $v_fields ) && isset( $validators[$template_field]['msg'] ) ? 'validate-error ' . $css_class : $css_class;
977
+					$template_form_fields[$field_id]['css_class'] = ! empty($v_fields) && in_array($template_field, $v_fields) && isset($validators[$template_field]['msg']) ? 'validate-error '.$css_class : $css_class;
978 978
 
979 979
 					//shortcode selector
980
-					$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector( $template_field, $field_id );
980
+					$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector($template_field, $field_id);
981 981
 
982
-					if ( isset( $field_setup_array['input'] ) && $field_setup_array['input'] == 'wp_editor' ) {
982
+					if (isset($field_setup_array['input']) && $field_setup_array['input'] == 'wp_editor') {
983 983
 						//we want to decode the entities
984 984
 						$template_form_fields[$field_id]['value'] = $template_form_fields[$field_id]['value'];
985 985
 					}/**/
@@ -987,25 +987,25 @@  discard block
 block discarded – undo
987 987
 
988 988
 				//k took care of content field(s) now let's take care of others.
989 989
 
990
-				$templatefield_MTP_id = $template_field . '-MTP_ID';
991
-				$templatefield_field_templatename_id = $template_field . '-name';
990
+				$templatefield_MTP_id = $template_field.'-MTP_ID';
991
+				$templatefield_field_templatename_id = $template_field.'-name';
992 992
 
993 993
 				//foreach template field there are actually two form fields created
994 994
 				$template_form_fields[$templatefield_MTP_id] = array(
995
-					'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]',
995
+					'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]',
996 996
 					'label' => NULL,
997 997
 					'input' => 'hidden',
998 998
 					'type' => 'int',
999 999
 					'required' => FALSE,
1000 1000
 					'validation' => TRUE,
1001
-					'value' => !empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
1001
+					'value' => ! empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
1002 1002
 					'css_class' => '',
1003 1003
 					'format' => '%d',
1004 1004
 					'db-col' => 'MTP_ID'
1005 1005
 				);
1006 1006
 
1007 1007
 				$template_form_fields[$templatefield_field_templatename_id] = array(
1008
-					'name' => 'MTP_template_fields[' . $template_field . '][name]',
1008
+					'name' => 'MTP_template_fields['.$template_field.'][name]',
1009 1009
 					'label' => NULL,
1010 1010
 					'input' => 'hidden',
1011 1011
 					'type' => 'string',
@@ -1149,15 +1149,15 @@  discard block
 block discarded – undo
1149 1149
 				'value' => $GRP_ID
1150 1150
 				);
1151 1151
 			$sidebar_form_fields['ee-msg-evt-nonce'] = array(
1152
-				'name' => $action . '_nonce',
1152
+				'name' => $action.'_nonce',
1153 1153
 				'input' => 'hidden',
1154 1154
 				'type' => 'string',
1155
-				'value' => wp_create_nonce( $action . '_nonce')
1155
+				'value' => wp_create_nonce($action.'_nonce')
1156 1156
 				);
1157 1157
 
1158 1158
 			$sidebar_array = array('ee-msg-is-global', 'ee-msg-is-override', 'ee-msg-deleted', 'ee-msg-is-active');
1159 1159
 
1160
-			if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) {
1160
+			if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) {
1161 1161
 				$sidebar_form_fields['ee-msg-template-switch'] = array(
1162 1162
 					'name' => 'template_switch',
1163 1163
 					'input' => 'hidden',
@@ -1167,19 +1167,19 @@  discard block
 block discarded – undo
1167 1167
 			}
1168 1168
 
1169 1169
 
1170
-			$template_fields = $this->_generate_admin_form_fields( $template_form_fields );
1171
-			$sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields );
1170
+			$template_fields = $this->_generate_admin_form_fields($template_form_fields);
1171
+			$sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields);
1172 1172
 
1173 1173
 
1174 1174
 		} //end if ( !empty($template_field_structure) )
1175 1175
 
1176 1176
 		//set extra content for publish box
1177 1177
 		$this->_template_args['publish_box_extra_content'] = $sidebar_fields;
1178
-		$this->_set_publish_post_box_vars( 'id', $GRP_ID );
1178
+		$this->_set_publish_post_box_vars('id', $GRP_ID);
1179 1179
 
1180 1180
 		//add preview button
1181
-		$preview_url = parent::add_query_args_and_nonce( array( 'message_type' => $message_template_group->message_type(), 'messenger' => $message_template_group->messenger(), 'context' => $context,'GRP_ID' => $GRP_ID, 'action' => 'preview_message' ), $this->_admin_base_url );
1182
-		$preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>';
1181
+		$preview_url = parent::add_query_args_and_nonce(array('message_type' => $message_template_group->message_type(), 'messenger' => $message_template_group->messenger(), 'context' => $context, 'GRP_ID' => $GRP_ID, 'action' => 'preview_message'), $this->_admin_base_url);
1182
+		$preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>';
1183 1183
 
1184 1184
 
1185 1185
 		//setup context switcher
@@ -1206,16 +1206,16 @@  discard block
 block discarded – undo
1206 1206
 		$this->_template_args['before_admin_page_content'] .= $this->_add_form_element_before();
1207 1207
 		$this->_template_args['after_admin_page_content'] = $this->_add_form_element_after();
1208 1208
 
1209
-		$this->_template_path = $this->_template_args['GRP_ID'] ? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php' : EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_add_meta_box.template.php';
1209
+		$this->_template_path = $this->_template_args['GRP_ID'] ? EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_edit_meta_box.template.php' : EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_add_meta_box.template.php';
1210 1210
 
1211 1211
 		//send along EE_Message_Template_Group object for further template use.
1212 1212
 		$this->_template_args['MTP'] = $message_template_group;
1213 1213
 
1214
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, TRUE );
1214
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
1215 1215
 
1216 1216
 
1217 1217
 		//finally, let's set the admin_page title
1218
-		$this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title );
1218
+		$this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title);
1219 1219
 
1220 1220
 
1221 1221
 		//we need to take care of setting the shortcodes property for use elsewhere.
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
 	}
1229 1229
 
1230 1230
 
1231
-	public function filter_tinymce_init( $mceInit, $editor_id ) {
1231
+	public function filter_tinymce_init($mceInit, $editor_id) {
1232 1232
 		return $mceInit;
1233 1233
 	}
1234 1234
 
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
 	}
1240 1240
 
1241 1241
 	public function _add_form_element_before() {
1242
-		return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">';
1242
+		return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">';
1243 1243
 	}
1244 1244
 
1245 1245
 	public function _add_form_element_after() {
@@ -1257,32 +1257,32 @@  discard block
 block discarded – undo
1257 1257
 	 * @return json json object
1258 1258
 	 */
1259 1259
 	public function switch_template_pack() {
1260
-		$GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1261
-		$template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : '';
1260
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1261
+		$template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : '';
1262 1262
 
1263 1263
 		//verify we have needed values.
1264
-		if ( empty( $GRP_ID ) || empty( $template_pack ) ) {
1264
+		if (empty($GRP_ID) || empty($template_pack)) {
1265 1265
 			$this->_template_args['error'] = TRUE;
1266
-			EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
1266
+			EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1267 1267
 		} else {
1268 1268
 			//get template, set the new template_pack and then reset to default
1269
-			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1269
+			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1270 1270
 
1271
-			$mtpg->set_template_pack_name( $template_pack );
1271
+			$mtpg->set_template_pack_name($template_pack);
1272 1272
 			$this->_req_data['msgr'] = $mtpg->messenger();
1273 1273
 			$this->_req_data['mt'] = $mtpg->message_type();
1274 1274
 
1275 1275
 			$query_args = $this->_reset_to_default_template();
1276 1276
 
1277
-			if ( empty( $query_args['id'] ) ) {
1278
-				EE_Error::add_error( __('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1277
+			if (empty($query_args['id'])) {
1278
+				EE_Error::add_error(__('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1279 1279
 				$this->_template_args['error'] = TRUE;
1280 1280
 			} else {
1281
-				$template_label =$mtpg->get_template_pack()->label;
1281
+				$template_label = $mtpg->get_template_pack()->label;
1282 1282
 				$template_pack_labels = $mtpg->messenger_obj()->get_supports_labels();
1283
-				EE_Error::add_success( sprintf( __('This message template has been successfully switched to use the %s %s.  Please wait while the page reloads with your new template.', 'event_espresso'), $template_label, $template_pack_labels->template_pack ) );
1283
+				EE_Error::add_success(sprintf(__('This message template has been successfully switched to use the %s %s.  Please wait while the page reloads with your new template.', 'event_espresso'), $template_label, $template_pack_labels->template_pack));
1284 1284
 				//generate the redirect url for js.
1285
-				$url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1285
+				$url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1286 1286
 				$this->_template_args['data']['redirect_url'] = $url;
1287 1287
 				$this->_template_args['success'] = true;
1288 1288
 			}
@@ -1303,56 +1303,56 @@  discard block
 block discarded – undo
1303 1303
 	protected function _reset_to_default_template() {
1304 1304
 		$success = TRUE;
1305 1305
 		$templates = array();
1306
-		$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1306
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1307 1307
 		//we need to make sure we've got the info we need.
1308
-		if ( !isset( $this->_req_data['msgr'] ) && !isset( $this->_req_data['mt'] ) && !isset( $this->_req_data['GRP_ID'] ) ) {
1309
-			EE_Error::add_error( __('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.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1308
+		if ( ! isset($this->_req_data['msgr']) && ! isset($this->_req_data['mt']) && ! isset($this->_req_data['GRP_ID'])) {
1309
+			EE_Error::add_error(__('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.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1310 1310
 			$success = FALSE;
1311 1311
 		}
1312 1312
 
1313 1313
 		//all templates will be reset to whatever the defaults are for the global template matching the messenger and message type.
1314
-		$success = !empty( $GRP_ID ) ? TRUE : FALSE;
1314
+		$success = ! empty($GRP_ID) ? TRUE : FALSE;
1315 1315
 
1316
-		if ( $success ) {
1316
+		if ($success) {
1317 1317
 
1318 1318
 			//let's first determine if the incoming template is a global template, if it isn't then we need to get the global template matching messenger and message type.
1319
-			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1319
+			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1320 1320
 
1321 1321
 
1322 1322
 			//note this is ONLY deleteing the template fields (Message Template rows) NOT the message template group.
1323
-			$success = $this->_delete_mtp_permanently( $GRP_ID, FALSE );
1323
+			$success = $this->_delete_mtp_permanently($GRP_ID, FALSE);
1324 1324
 
1325
-			if ( $success ) {
1325
+			if ($success) {
1326 1326
 				//if successfully deleted, lets generate the new ones.  Note. We set GLOBAL to true, because resets on ANY template will use the related global template defaults for regeneration.  This means that if a custom template is reset it resets to whatever the related global template is.  HOWEVER, we DO keep the template pack and template variation set for the current custom template when resetting.
1327
-				$templates = $this->_generate_new_templates( $this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE );
1327
+				$templates = $this->_generate_new_templates($this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE);
1328 1328
 			}
1329 1329
 
1330 1330
 		}
1331 1331
 
1332 1332
 		//any error messages?
1333
-		if ( !$success ) {
1334
-			EE_Error::add_error( __('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1333
+		if ( ! $success) {
1334
+			EE_Error::add_error(__('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1335 1335
 		}
1336 1336
 
1337 1337
 		//all good, let's add a success message!
1338
-		if ( $success && ! empty( $templates ) ) {
1338
+		if ($success && ! empty($templates)) {
1339 1339
 			$templates = $templates[0]; //the info for the template we generated is the first element in the returned array.
1340 1340
 			EE_Error::overwrite_success();
1341
-			EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') );
1341
+			EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso'));
1342 1342
 		}
1343 1343
 
1344 1344
 
1345 1345
 		$query_args = array(
1346
-			'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : NULL,
1347
-			'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : NULL,
1348
-			'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'default'
1346
+			'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : NULL,
1347
+			'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : NULL,
1348
+			'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'default'
1349 1349
 			);
1350 1350
 
1351 1351
 		//if called via ajax then we return query args otherwise redirect
1352
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1352
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1353 1353
 			return $query_args;
1354 1354
 		} else {
1355
-			$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
1355
+			$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
1356 1356
 		}
1357 1357
 
1358 1358
 	}
@@ -1365,20 +1365,20 @@  discard block
 block discarded – undo
1365 1365
 	 * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview.
1366 1366
 	 * @return void
1367 1367
 	 */
1368
-	public function _preview_message( $send = FALSE ) {
1368
+	public function _preview_message($send = FALSE) {
1369 1369
 		//first make sure we've got the necessary parameters
1370
-		if ( !isset( $this->_req_data['message_type'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['GRP_ID'] ) ) {
1371
-			EE_Error::add_error( __('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1370
+		if ( ! isset($this->_req_data['message_type']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['GRP_ID'])) {
1371
+			EE_Error::add_error(__('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1372 1372
 		}
1373 1373
 
1374
-		EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] );
1374
+		EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']);
1375 1375
 
1376 1376
 		$MSG = new EE_messages();
1377 1377
 
1378 1378
 		//get the preview!
1379
-		$preview = $MSG->preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send );
1379
+		$preview = $MSG->preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send);
1380 1380
 
1381
-		if ( $send ) {
1381
+		if ($send) {
1382 1382
 			return $preview;
1383 1383
 		}
1384 1384
 
@@ -1388,16 +1388,16 @@  discard block
 block discarded – undo
1388 1388
 			'context' => $this->_req_data['context'],
1389 1389
 			'action' => 'edit_message_template'
1390 1390
 			);
1391
-		$go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1392
-		$preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>';
1391
+		$go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1392
+		$preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>';
1393 1393
 
1394 1394
 		//let's provide a helpful title for context
1395
-		$preview_title = sprintf( __('Viewing Preview for %s %s Message Template', 'event_espresso'), ucwords($this->_active_messengers[$this->_req_data['messenger']]['obj']->label['singular']), ucwords($this->_active_message_types[$this->_req_data['message_type']]['obj']->label['singular']) );
1395
+		$preview_title = sprintf(__('Viewing Preview for %s %s Message Template', 'event_espresso'), ucwords($this->_active_messengers[$this->_req_data['messenger']]['obj']->label['singular']), ucwords($this->_active_message_types[$this->_req_data['message_type']]['obj']->label['singular']));
1396 1396
 
1397 1397
 
1398 1398
 		//setup display of preview.
1399 1399
 		$this->_admin_page_title = $preview_title;
1400
-		$this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview);
1400
+		$this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview);
1401 1401
 		$this->_template_args['data']['force_json'] = TRUE;
1402 1402
 	}
1403 1403
 
@@ -1425,9 +1425,9 @@  discard block
 block discarded – undo
1425 1425
 	 * @return void
1426 1426
 	 */
1427 1427
 	protected function _register_edit_meta_boxes() {
1428
-		add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' );
1429
-		add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1430
-		add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1428
+		add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default');
1429
+		add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high');
1430
+		add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high');
1431 1431
 	}
1432 1432
 
1433 1433
 
@@ -1448,10 +1448,10 @@  discard block
 block discarded – undo
1448 1448
 
1449 1449
 		$tp_select_values = array();
1450 1450
 
1451
-		foreach ( $template_packs as $tp ) {
1451
+		foreach ($template_packs as $tp) {
1452 1452
 			//only include template packs that support this messenger and message type!
1453 1453
 			$supports = $tp->get_supports();
1454
-			if ( ! isset( $supports[$this->_message_template_group->messenger()] ) || ! in_array( $this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()] ) ) {
1454
+			if ( ! isset($supports[$this->_message_template_group->messenger()]) || ! in_array($this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()])) {
1455 1455
 				//not supported
1456 1456
 				continue;
1457 1457
 			}
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
 		}
1464 1464
 
1465 1465
 		//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.
1466
-		if ( empty( $tp_select_values ) ) {
1466
+		if (empty($tp_select_values)) {
1467 1467
 			$tp_select_values[] = array(
1468 1468
 				'text' => __('Default', 'event_espresso'),
1469 1469
 				'id' => 'default'
@@ -1471,27 +1471,27 @@  discard block
 block discarded – undo
1471 1471
 		}
1472 1472
 
1473 1473
 		//setup variation select values for the currently selected template.
1474
-		$variations = $this->_message_template_group->get_template_pack()->get_variations( $this->_message_template_group->messenger(), $this->_message_template_group->message_type() );
1474
+		$variations = $this->_message_template_group->get_template_pack()->get_variations($this->_message_template_group->messenger(), $this->_message_template_group->message_type());
1475 1475
 		$variations_select_values = array();
1476
-		foreach ( $variations as $variation => $label ) {
1476
+		foreach ($variations as $variation => $label) {
1477 1477
 			$variations_select_values[] = array(
1478 1478
 				'text' => $label,
1479 1479
 				'id' => $variation
1480 1480
 				);
1481 1481
 		}
1482 1482
 
1483
-		$template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels();
1483
+		$template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels();
1484 1484
 
1485
-		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input( 'MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name() );
1486
-		$template_args['variations_selector'] = EEH_Form_Fields::select_input( 'MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation() );
1485
+		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input('MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name());
1486
+		$template_args['variations_selector'] = EEH_Form_Fields::select_input('MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation());
1487 1487
 		$template_args['template_pack_label'] = $template_pack_labels->template_pack;
1488 1488
 		$template_args['template_variation_label'] = $template_pack_labels->template_variation;
1489 1489
 		$template_args['template_pack_description'] = $template_pack_labels->template_pack_description;
1490 1490
 		$template_args['template_variation_description'] = $template_pack_labels->template_variation_description;
1491 1491
 
1492
-		$template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php';
1492
+		$template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php';
1493 1493
 
1494
-		EEH_Template::display_template( $template, $template_args );
1494
+		EEH_Template::display_template($template, $template_args);
1495 1495
 	}
1496 1496
 
1497 1497
 
@@ -1512,52 +1512,52 @@  discard block
 block discarded – undo
1512 1512
 			'GRP_ID' => $this->_message_template_group->GRP_ID()
1513 1513
 			);
1514 1514
 
1515
-		$button = $this->get_action_link_or_button( 'reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button' );
1515
+		$button = $this->get_action_link_or_button('reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button');
1516 1516
 
1517 1517
 
1518 1518
 		//test button
1519 1519
 		//first we need to see if there are any fields
1520 1520
 		$fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields();
1521 1521
 
1522
-		if ( !empty( $fields ) ) {
1522
+		if ( ! empty($fields)) {
1523 1523
 			//yup there be fields
1524
-			foreach ( $fields as $field => $config ) {
1525
-				$field_id = $this->_message_template_group->messenger() . '_' . $field;
1524
+			foreach ($fields as $field => $config) {
1525
+				$field_id = $this->_message_template_group->messenger().'_'.$field;
1526 1526
 				$existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings();
1527
-				$default = isset( $config['default'] ) ? $config['default'] : '';
1528
-				$default = isset( $config['value'] ) ? $config['value'] : $default;
1527
+				$default = isset($config['default']) ? $config['default'] : '';
1528
+				$default = isset($config['value']) ? $config['value'] : $default;
1529 1529
 
1530 1530
 				//if type is hidden and the value is empty something may have gone wrong so let's correct with the defaults
1531 1531
 				$fix = $config['input'] == 'hidden' && isset($existing[$field]) && empty($existing[$field]) ? $default : '';
1532
-				$existing[$field] = isset( $existing[$field] ) && empty( $fix ) ? $existing[$field] : $fix;
1532
+				$existing[$field] = isset($existing[$field]) && empty($fix) ? $existing[$field] : $fix;
1533 1533
 
1534 1534
 				$template_form_fields[$field_id] = array(
1535
-					'name' => 'test_settings_fld[' . $field . ']',
1535
+					'name' => 'test_settings_fld['.$field.']',
1536 1536
 					'label' => $config['label'],
1537 1537
 					'input' => $config['input'],
1538 1538
 					'type' => $config['type'],
1539 1539
 					'required' => $config['required'],
1540 1540
 					'validation' => $config['validation'],
1541
-					'value' => isset( $existing[$field] ) ? $existing[$field] : $default,
1541
+					'value' => isset($existing[$field]) ? $existing[$field] : $default,
1542 1542
 					'css_class' => $config['css_class'],
1543
-					'options' => isset( $config['options'] ) ? $config['options'] : array(),
1543
+					'options' => isset($config['options']) ? $config['options'] : array(),
1544 1544
 					'default' => $default,
1545 1545
 					'format' => $config['format']
1546 1546
 					);
1547 1547
 			}
1548 1548
 		}
1549 1549
 
1550
-		$test_settings_fields = !empty( $template_form_fields) ? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' ) : '';
1550
+		$test_settings_fields = ! empty($template_form_fields) ? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds') : '';
1551 1551
 
1552 1552
 		$test_settings_html = '';
1553 1553
 		//print out $test_settings_fields
1554
-		if ( !empty( $test_settings_fields ) ) {
1554
+		if ( ! empty($test_settings_fields)) {
1555 1555
 			echo $test_settings_fields;
1556
-			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="' . __('Test Send', 'event_espresso') . '" /><div style="clear:both"></div>';
1556
+			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="'.__('Test Send', 'event_espresso').'" /><div style="clear:both"></div>';
1557 1557
 		}
1558 1558
 
1559 1559
 		//and button
1560
-		echo $test_settings_html . '<p>' . __('Need to reset this message type and start over?', 'event_espresso') . '</p>' . '<div class="publishing-action alignright resetbutton">' . $button . '</div><div style="clear:both"></div>';
1560
+		echo $test_settings_html.'<p>'.__('Need to reset this message type and start over?', 'event_espresso').'</p>'.'<div class="publishing-action alignright resetbutton">'.$button.'</div><div style="clear:both"></div>';
1561 1561
 	}
1562 1562
 
1563 1563
 
@@ -1572,13 +1572,13 @@  discard block
 block discarded – undo
1572 1572
      * @param string $linked_input_id The css id of the input that the shortcodes get added to.
1573 1573
      * @return string
1574 1574
     */
1575
-	protected function _get_shortcode_selector( $field, $linked_input_id ) {
1575
+	protected function _get_shortcode_selector($field, $linked_input_id) {
1576 1576
 		$template_args = array(
1577
-			'shortcodes' => $this->_get_shortcodes( array( $field ), true ),
1577
+			'shortcodes' => $this->_get_shortcodes(array($field), true),
1578 1578
 			'fieldname' => $field,
1579 1579
 			'linked_input_id' => $linked_input_id
1580 1580
 		);
1581
-		return EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'shortcode_selector_skeleton.template.php', $template_args, true );
1581
+		return EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'shortcode_selector_skeleton.template.php', $template_args, true);
1582 1582
 	}
1583 1583
 
1584 1584
 
@@ -1592,13 +1592,13 @@  discard block
 block discarded – undo
1592 1592
 		$shortcodes = $this->_get_shortcodes(array(), FALSE); //just make sure shortcodes property is set
1593 1593
 		$messenger = $this->_message_template_group->messenger_obj();
1594 1594
 		//now let's set the content depending on the status of the shortcodes array
1595
-		if ( empty( $shortcodes ) ) {
1596
-			$content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>';
1595
+		if (empty($shortcodes)) {
1596
+			$content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>';
1597 1597
 			echo $content;
1598 1598
 		} else {
1599 1599
 			$alt = 0;
1600 1600
 			?>
1601
-			<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>
1601
+			<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>
1602 1602
 			<?php
1603 1603
 		}
1604 1604
 
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
 	protected function _set_shortcodes() {
1616 1616
 
1617 1617
 		//no need to run this if the property is already set
1618
-		if ( !empty($this->_shortcodes ) ) return;
1618
+		if ( ! empty($this->_shortcodes)) return;
1619 1619
 
1620 1620
 		$this->_shortcodes = $this->_get_shortcodes();
1621 1621
 	}
@@ -1632,14 +1632,14 @@  discard block
 block discarded – undo
1632 1632
 	 * @param  boolean $merged Whether to merge all the shortcodes into one list of unique shortcodes
1633 1633
 	 * @return array          Shortcodes indexed by fieldname and the an array of shortcode/label pairs OR if merged is true just an array of shortcode/label pairs.
1634 1634
 	 */
1635
-	protected function _get_shortcodes( $fields = array(), $merged = TRUE ) {
1635
+	protected function _get_shortcodes($fields = array(), $merged = TRUE) {
1636 1636
 		$this->_set_message_template_group();
1637 1637
 
1638 1638
 		//we need the messenger and message template to retrieve the valid shortcodes array.
1639
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
1640
-		$context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() );
1639
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
1640
+		$context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config());
1641 1641
 
1642
-		return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array();
1642
+		return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array();
1643 1643
 	}
1644 1644
 
1645 1645
 
@@ -1652,19 +1652,19 @@  discard block
 block discarded – undo
1652 1652
 	 */
1653 1653
 	protected function _set_message_template_group() {
1654 1654
 
1655
-		if ( !empty( $this->_message_template_group ) )
1655
+		if ( ! empty($this->_message_template_group))
1656 1656
 			return; //get out if this is already set.
1657 1657
 
1658
-		$GRP_ID =  ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : FALSE;
1659
-		$GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID;
1658
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : FALSE;
1659
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID;
1660 1660
 
1661 1661
 		//let's get the message templates
1662 1662
 		$MTP = EEM_Message_Template_Group::instance();
1663 1663
 
1664
-		if ( empty($GRP_ID) )
1664
+		if (empty($GRP_ID))
1665 1665
 			$this->_message_template_group = $MTP->create_default_object();
1666 1666
 		else
1667
-			$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );
1667
+			$this->_message_template_group = $MTP->get_one_by_ID($GRP_ID);
1668 1668
 
1669 1669
 		$this->_template_pack = $this->_message_template_group->get_template_pack();
1670 1670
 		$this->_variation = $this->_message_template_group->get_template_pack_variation();
@@ -1690,26 +1690,26 @@  discard block
 block discarded – undo
1690 1690
 		<div class="ee-msg-switcher-container">
1691 1691
 			<form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm">
1692 1692
 				<?php
1693
-					foreach ( $args as $name => $value ) {
1694
-						if ( $name == 'context' || empty($value) || $name == 'extra' ) continue;
1693
+					foreach ($args as $name => $value) {
1694
+						if ($name == 'context' || empty($value) || $name == 'extra') continue;
1695 1695
 						?>
1696 1696
 						<input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" />
1697 1697
 						<?php
1698 1698
 					}
1699 1699
 					//setup nonce_url
1700
-					wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false);
1700
+					wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false);
1701 1701
 				?>
1702 1702
 				<select name="context">
1703 1703
 					<?php
1704 1704
 					$context_templates = $template_group_object->context_templates();
1705
-					if ( is_array($context_templates) ) :
1706
-							foreach ( $context_templates as $context => $template_fields ) :
1705
+					if (is_array($context_templates)) :
1706
+							foreach ($context_templates as $context => $template_fields) :
1707 1707
 								$checked = ($context == $args['context']) ? 'selected="selected"' : '';
1708 1708
 					?>
1709 1709
 					<option value="<?php echo $context; ?>" <?php echo $checked; ?>><?php echo $context_details[$context]['label']; ?></option>
1710 1710
 					<?php endforeach; endif; ?>
1711 1711
 				</select>
1712
-				<?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?>
1712
+				<?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?>
1713 1713
 				<input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>">
1714 1714
 			</form>
1715 1715
 			<?php echo $args['extra']; ?>
@@ -1733,8 +1733,8 @@  discard block
 block discarded – undo
1733 1733
 	 * @param int $index This helps us know which template field to select from the request array.
1734 1734
 	 */
1735 1735
 	protected function _set_message_template_column_values($index) {
1736
-		if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) {
1737
-			foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) {
1736
+		if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) {
1737
+			foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) {
1738 1738
 				$this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value;
1739 1739
 			}
1740 1740
 		} else {
@@ -1766,27 +1766,27 @@  discard block
 block discarded – undo
1766 1766
 
1767 1767
 
1768 1768
 
1769
-	protected function _insert_or_update_message_template($new = FALSE ) {
1769
+	protected function _insert_or_update_message_template($new = FALSE) {
1770 1770
 
1771
-		do_action ( 'AHEE_log', __FILE__, __FUNCTION__, '');
1771
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1772 1772
 		$success = 0;
1773 1773
 		$override = FALSE;
1774 1774
 
1775 1775
 		//setup notices description
1776
-		$messenger = !empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'] ) ) : false;
1777
-		$message_type = !empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'] ) ) : false;
1778
-		$context = !empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'] ) ) : false;
1776
+		$messenger = ! empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'])) : false;
1777
+		$message_type = ! empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'])) : false;
1778
+		$context = ! empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'])) : false;
1779 1779
 
1780
-		$item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : '';
1780
+		$item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : '';
1781 1781
 		$item_desc .= 'Message Template';
1782 1782
 		$query_args = array();
1783 1783
 		$validates = '';
1784 1784
 
1785 1785
 		//if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit.
1786
-		if ( $new ) {
1787
-			$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1788
-			if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) {
1789
-				if ( empty($edit_array) ) {
1786
+		if ($new) {
1787
+			$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1788
+			if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) {
1789
+				if (empty($edit_array)) {
1790 1790
 					$success = 0;
1791 1791
 				} else {
1792 1792
 					$success = 1;
@@ -1805,34 +1805,34 @@  discard block
 block discarded – undo
1805 1805
 
1806 1806
 
1807 1807
 			//run update for each template field in displayed context
1808
-			if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) {
1809
-				EE_Error::add_error( __('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1808
+			if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) {
1809
+				EE_Error::add_error(__('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1810 1810
 				$success = 0;
1811 1811
 				$action_desc = '';
1812 1812
 
1813 1813
 			} else {
1814 1814
 				//first validate all fields!
1815
-				$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']);
1815
+				$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']);
1816 1816
 
1817 1817
 				//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.
1818
-				if ( is_array($validates) && !empty($validates) ) {
1818
+				if (is_array($validates) && ! empty($validates)) {
1819 1819
 					//add the transient so when the form loads we know which fields to highlight
1820
-					$this->_add_transient( 'edit_message_template', $validates );
1820
+					$this->_add_transient('edit_message_template', $validates);
1821 1821
 
1822 1822
 					$success = 0;
1823
-					$action_desc ='';
1823
+					$action_desc = '';
1824 1824
 
1825 1825
 					//setup notices
1826
-					foreach ( $validates as $field => $error ) {
1827
-						if ( isset($error['msg'] ) )
1828
-							EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );
1826
+					foreach ($validates as $field => $error) {
1827
+						if (isset($error['msg']))
1828
+							EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__);
1829 1829
 					}
1830 1830
 
1831 1831
 				} else {
1832
-					foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) {
1832
+					foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) {
1833 1833
 						$set_column_values = $this->_set_message_template_column_values($template_field);
1834 1834
 
1835
-						$where_cols_n_values = array( 'MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
1835
+						$where_cols_n_values = array('MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
1836 1836
 
1837 1837
 						$message_template_fields = array(
1838 1838
 							'GRP_ID' => $set_column_values['GRP_ID'],
@@ -1840,10 +1840,10 @@  discard block
 block discarded – undo
1840 1840
 							'MTP_context' => $set_column_values['MTP_context'],
1841 1841
 							'MTP_content' => $set_column_values['MTP_content']
1842 1842
 							);
1843
-						if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) {
1844
-							if ( $updated === FALSE ) {
1845
-								$msg = sprintf( __('%s field was NOT updated for some reason', 'event_espresso'), $template_field );
1846
-								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
1843
+						if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) {
1844
+							if ($updated === FALSE) {
1845
+								$msg = sprintf(__('%s field was NOT updated for some reason', 'event_espresso'), $template_field);
1846
+								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1847 1847
 							} else {
1848 1848
 								$success = 1;
1849 1849
 							}
@@ -1860,24 +1860,24 @@  discard block
 block discarded – undo
1860 1860
 						'MTP_is_override' => $set_column_values['MTP_is_override'],
1861 1861
 						'MTP_deleted' => $set_column_values['MTP_deleted'],
1862 1862
 						'MTP_is_active' => $set_column_values['MTP_is_active'],
1863
-						'MTP_name' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_name'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
1864
-						'MTP_description' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_description'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
1863
+						'MTP_name' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
1864
+						'MTP_description' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
1865 1865
 						);
1866 1866
 
1867
-					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] );
1868
-					$updated = $MTPG->update( $mtpg_fields, array($mtpg_where) );
1867
+					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']);
1868
+					$updated = $MTPG->update($mtpg_fields, array($mtpg_where));
1869 1869
 
1870
-					if ( $updated === FALSE ) {
1871
-						$msg = sprintf( __('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID'] );
1872
-						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
1870
+					if ($updated === FALSE) {
1871
+						$msg = sprintf(__('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID']);
1872
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1873 1873
 					} else {
1874 1874
 						//k now we need to ensure the template_pack and template_variation fields are set.
1875
-						$template_pack = ! empty( $this->_req_data['MTP_template_pack' ] ) ? $this->_req_data['MTP_template_pack'] : 'default';
1876
-						$template_variation = ! empty( $this->_req_data['MTP_template_variation'] ) ? $this->_req_data['MTP_template_variation'] : 'default';
1877
-						$mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] );
1878
-						if ( $mtpg_obj instanceof EE_Message_Template_Group ) {
1879
-							$mtpg_obj->set_template_pack_name( $template_pack );
1880
-							$mtpg_obj->set_template_pack_variation( $template_variation );
1875
+						$template_pack = ! empty($this->_req_data['MTP_template_pack']) ? $this->_req_data['MTP_template_pack'] : 'default';
1876
+						$template_variation = ! empty($this->_req_data['MTP_template_variation']) ? $this->_req_data['MTP_template_variation'] : 'default';
1877
+						$mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']);
1878
+						if ($mtpg_obj instanceof EE_Message_Template_Group) {
1879
+							$mtpg_obj->set_template_pack_name($template_pack);
1880
+							$mtpg_obj->set_template_pack_variation($template_variation);
1881 1881
 						}
1882 1882
 						$success = 1;
1883 1883
 					}
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
 		}
1888 1888
 
1889 1889
 		//we return things differently if doing ajax
1890
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1890
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1891 1891
 			$this->_template_args['success'] = $success;
1892 1892
 			$this->_template_args['error'] = ! $success ? TRUE : FALSE;
1893 1893
 			$this->_template_args['content'] = '';
@@ -1895,9 +1895,9 @@  discard block
 block discarded – undo
1895 1895
 				'grpID' => $edit_array['GRP_ID'],
1896 1896
 				'templateName' => $edit_array['template_name']
1897 1897
 				);
1898
-			if ( $success ) {
1898
+			if ($success) {
1899 1899
 				EE_Error::overwrite_success();
1900
-				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') );
1900
+				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'));
1901 1901
 			}
1902 1902
 
1903 1903
 			$this->_return_json();
@@ -1905,13 +1905,13 @@  discard block
 block discarded – undo
1905 1905
 
1906 1906
 
1907 1907
 		//was a test send triggered?
1908
-		if ( isset( $this->_req_data['test_button'] ) ) {
1908
+		if (isset($this->_req_data['test_button'])) {
1909 1909
 			EE_Error::overwrite_success();
1910
-			$this->_do_test_send( $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] );
1910
+			$this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1911 1911
 			$override = TRUE;
1912 1912
 		}
1913 1913
 
1914
-		if ( empty( $query_args ) ) {
1914
+		if (empty($query_args)) {
1915 1915
 			$query_args = array(
1916 1916
 				'id' => $this->_req_data['GRP_ID'],
1917 1917
 				'context' => $this->_req_data['MTP_context'],
@@ -1919,7 +1919,7 @@  discard block
 block discarded – undo
1919 1919
 				);
1920 1920
 		}
1921 1921
 
1922
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override );
1922
+		$this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override);
1923 1923
 	}
1924 1924
 
1925 1925
 
@@ -1932,24 +1932,24 @@  discard block
 block discarded – undo
1932 1932
 	 * @param  string $message_type message type being tested
1933 1933
 	 * @return void
1934 1934
 	 */
1935
-	protected function _do_test_send( $context, $messenger, $message_type ) {
1935
+	protected function _do_test_send($context, $messenger, $message_type) {
1936 1936
 		//set things up for preview
1937 1937
 		$this->_req_data['messenger'] = $messenger;
1938 1938
 		$this->_req_data['message_type'] = $message_type;
1939 1939
 		$this->_req_data['context'] = $context;
1940
-		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : '';
1940
+		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : '';
1941 1941
 
1942 1942
 		//let's save any existing fields that might be required by the messenger
1943
-		if ( isset( $this->_req_data['test_settings_fld'] ) ) {
1944
-			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings( $this->_req_data['test_settings_fld'] );
1943
+		if (isset($this->_req_data['test_settings_fld'])) {
1944
+			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings($this->_req_data['test_settings_fld']);
1945 1945
 		}
1946 1946
 
1947 1947
 		$success = $this->_preview_message(TRUE);
1948 1948
 
1949
-		if ( $success ) {
1950
-			EE_Error::add_success( __('Test message sent', 'event_espresso') );
1949
+		if ($success) {
1950
+			EE_Error::add_success(__('Test message sent', 'event_espresso'));
1951 1951
 		} else {
1952
-			EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1952
+			EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1953 1953
 		}
1954 1954
 	}
1955 1955
 
@@ -1971,12 +1971,12 @@  discard block
 block discarded – undo
1971 1971
 	protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = FALSE) {
1972 1972
 
1973 1973
 		//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.
1974
-		if ( empty( $message_types ) )
1974
+		if (empty($message_types))
1975 1975
 			return true;
1976 1976
 
1977
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1977
+		EE_Registry::instance()->load_helper('MSG_Template');
1978 1978
 
1979
-		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID,  $global);
1979
+		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global);
1980 1980
 
1981 1981
 	}
1982 1982
 
@@ -1992,33 +1992,33 @@  discard block
 block discarded – undo
1992 1992
 	 * @param boolean $all whether this is going to trash/restore all contexts within a template group (TRUE) OR just an individual context (FALSE).
1993 1993
 	 * @return void
1994 1994
 	 */
1995
-	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE ) {
1996
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1995
+	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE) {
1996
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1997 1997
 		$MTP = EEM_Message_Template_Group::instance();
1998 1998
 
1999 1999
 		$success = 1;
2000 2000
 
2001 2001
 		//incoming GRP_IDs
2002
-		if ( $all ) {
2002
+		if ($all) {
2003 2003
 			//Checkboxes
2004
-			if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) {
2004
+			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2005 2005
 				//if array has more than one element then success message should be plural.
2006 2006
 				//todo: what about nonce?
2007
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2007
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2008 2008
 
2009 2009
 				//cycle through checkboxes
2010
-				while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) {
2011
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2012
-					if ( ! $trashed_or_restored ) {
2010
+				while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2011
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2012
+					if ( ! $trashed_or_restored) {
2013 2013
 						$success = 0;
2014 2014
 					}
2015 2015
 				}
2016 2016
 			} else {
2017 2017
 				//grab single GRP_ID and handle
2018
-				$GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
2019
-				if ( ! empty( $GRP_ID ) ) {
2020
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2021
-					if ( ! $trashed_or_restored ) {
2018
+				$GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
2019
+				if ( ! empty($GRP_ID)) {
2020
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2021
+					if ( ! $trashed_or_restored) {
2022 2022
 						$success = 0;
2023 2023
 					}
2024 2024
 				} else {
@@ -2030,13 +2030,13 @@  discard block
 block discarded – undo
2030 2030
 
2031 2031
 		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2032 2032
 
2033
-		$action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc;
2033
+		$action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc;
2034 2034
 
2035 2035
 		$item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso');
2036 2036
 
2037
-		$item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2037
+		$item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2038 2038
 
2039
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, array() );
2039
+		$this->_redirect_after_action($success, $item_desc, $action_desc, array());
2040 2040
 
2041 2041
 	}
2042 2042
 
@@ -2052,26 +2052,26 @@  discard block
 block discarded – undo
2052 2052
 	 * @return void
2053 2053
 	 */
2054 2054
 	protected function _delete_message_template() {
2055
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2055
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2056 2056
 
2057 2057
 		$success = 1;
2058 2058
 
2059 2059
 		//checkboxes
2060
-		if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) {
2060
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2061 2061
 			//if array has more than one element then success message should be plural
2062
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2062
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2063 2063
 
2064 2064
 			//cycle through bulk action checkboxes
2065
-			while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) {
2066
-				$success = $this->_delete_mtp_permanently( $GRP_ID );
2065
+			while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2066
+				$success = $this->_delete_mtp_permanently($GRP_ID);
2067 2067
 			}
2068 2068
 		} else {
2069 2069
 			//grab single grp_id and delete
2070
-			$GRP_ID = absint($this->_req_data['id'] );
2071
-			$success = $this->_delete_mtp_permanently( $GRP_ID );
2070
+			$GRP_ID = absint($this->_req_data['id']);
2071
+			$success = $this->_delete_mtp_permanently($GRP_ID);
2072 2072
 		}
2073 2073
 
2074
-		$this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() );
2074
+		$this->_redirect_after_action($success, 'Message Templates', 'deleted', array());
2075 2075
 
2076 2076
 	}
2077 2077
 
@@ -2084,20 +2084,20 @@  discard block
 block discarded – undo
2084 2084
 	 * @param  bool $include_group whether to delete the Message Template Group as well.
2085 2085
 	 * @return success        boolean to indicate the success of the deletes or not.
2086 2086
 	 */
2087
-	private function _delete_mtp_permanently( $GRP_ID, $include_group = TRUE ) {
2087
+	private function _delete_mtp_permanently($GRP_ID, $include_group = TRUE) {
2088 2088
 		$success = 1;
2089 2089
 		$MTPG = EEM_Message_Template_Group::instance();
2090 2090
 		//first let's GET this group
2091
-		$MTG = $MTPG->get_one_by_ID( $GRP_ID );
2091
+		$MTG = $MTPG->get_one_by_ID($GRP_ID);
2092 2092
 		//then delete permanently all the related Message Templates
2093
-		$deleted = $MTG->delete_related_permanently( 'Message_Template' );
2093
+		$deleted = $MTG->delete_related_permanently('Message_Template');
2094 2094
 
2095
-		if ( $deleted === 0 )
2095
+		if ($deleted === 0)
2096 2096
 			$success = 0;
2097 2097
 
2098 2098
 		//now delete permanently this particular group
2099 2099
 
2100
-		if ( $include_group && ! $MTG->delete_permanently() ) {
2100
+		if ($include_group && ! $MTG->delete_permanently()) {
2101 2101
 			$success = 0;
2102 2102
 		}
2103 2103
 		return $success;
@@ -2115,7 +2115,7 @@  discard block
 block discarded – undo
2115 2115
 	*	@return string
2116 2116
 	*/
2117 2117
 	protected function _learn_more_about_message_templates_link() {
2118
-		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2118
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>';
2119 2119
 	}
2120 2120
 
2121 2121
 
@@ -2129,14 +2129,14 @@  discard block
 block discarded – undo
2129 2129
 	 */
2130 2130
 	protected function _settings() {
2131 2131
 
2132
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
2132
+		EE_Registry::instance()->load_helper('Tabbed_Content');
2133 2133
 
2134 2134
 		$this->_set_m_mt_settings();
2135 2135
 
2136
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2136
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2137 2137
 
2138 2138
 		//let's setup the messenger tabs
2139
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger );
2139
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger);
2140 2140
 		$this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">';
2141 2141
 		$this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->';
2142 2142
 
@@ -2155,10 +2155,10 @@  discard block
 block discarded – undo
2155 2155
 	 */
2156 2156
 	protected function _set_m_mt_settings() {
2157 2157
 		//first if this is already set then lets get out no need to regenerate data.
2158
-		if ( !empty($this->_m_mt_settings) )
2158
+		if ( ! empty($this->_m_mt_settings))
2159 2159
 			return;
2160 2160
 
2161
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2161
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2162 2162
 
2163 2163
 		//get all installed messengers and message_types
2164 2164
 		$installed_message_objects = $this->_get_installed_message_objects();
@@ -2168,10 +2168,10 @@  discard block
 block discarded – undo
2168 2168
 
2169 2169
 		//assemble the array for the _tab_text_links helper
2170 2170
 
2171
-		foreach ( $messengers as $messenger ) {
2171
+		foreach ($messengers as $messenger) {
2172 2172
 			$this->_m_mt_settings['messenger_tabs'][$messenger->name] = array(
2173 2173
 				'label' => ucwords($messenger->label['singular']),
2174
-				'class' => isset( $this->_active_messengers[$messenger->name] ) ? 'messenger-active' : '',
2174
+				'class' => isset($this->_active_messengers[$messenger->name]) ? 'messenger-active' : '',
2175 2175
 				'href' => $messenger->name,
2176 2176
 				'title' => __('Modify this Messenger', 'event_espresso'),
2177 2177
 				'slug' => $messenger->name,
@@ -2181,23 +2181,23 @@  discard block
 block discarded – undo
2181 2181
 			$message_types_for_messenger = $messenger->get_valid_message_types();
2182 2182
 
2183 2183
 			//assemble the array for the ACTIVE and INACTIVE message types with the selected messenger //note that all message types will be in the inactive box if the messenger is NOT active.
2184
-			$selected_settings = isset( $this->_active_messengers[$messenger->name]['settings'] ) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2185
-			foreach ( $message_types as $message_type ) {
2184
+			$selected_settings = isset($this->_active_messengers[$messenger->name]['settings']) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2185
+			foreach ($message_types as $message_type) {
2186 2186
 				//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.
2187
-				if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) {
2187
+				if ( ! in_array($message_type->name, $message_types_for_messenger)) {
2188 2188
 					continue;
2189 2189
 				}
2190 2190
 
2191
-				$a_or_i = isset( $selected_settings[$messenger->name . '-message_types'][$message_type->name] ) && $selected_settings[$messenger->name . '-message_types'][$message_type->name] ? 'active' : 'inactive';
2191
+				$a_or_i = isset($selected_settings[$messenger->name.'-message_types'][$message_type->name]) && $selected_settings[$messenger->name.'-message_types'][$message_type->name] ? 'active' : 'inactive';
2192 2192
 
2193 2193
 				$this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array(
2194 2194
 						'label' => ucwords($message_type->label['singular']),
2195
-						'class' => 'message-type-' . $a_or_i,
2196
-						'slug_id' => $message_type->name . '-messagetype-' . $messenger->name,
2197
-						'mt_nonce' => wp_create_nonce($message_type->name . '_nonce'),
2198
-						'href' => 'espresso_' . $message_type->name . '_message_type_settings',
2195
+						'class' => 'message-type-'.$a_or_i,
2196
+						'slug_id' => $message_type->name.'-messagetype-'.$messenger->name,
2197
+						'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'),
2198
+						'href' => 'espresso_'.$message_type->name.'_message_type_settings',
2199 2199
 						'title' => $a_or_i == 'active' ? __('Drag this message type to the Inactive window to deactivate', 'event_espresso') : __('Drag this message type to the messenger to activate', 'event_espresso'),
2200
-						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content( $message_type, $messenger, TRUE ) : $this->_message_type_settings_content( $message_type, $messenger ),
2200
+						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content($message_type, $messenger, TRUE) : $this->_message_type_settings_content($message_type, $messenger),
2201 2201
 						'slug' => $message_type->name,
2202 2202
 						'active' => $a_or_i == 'active' ? TRUE : FALSE,
2203 2203
 						'obj' => $message_type
@@ -2214,34 +2214,34 @@  discard block
 block discarded – undo
2214 2214
 	 * @param  boolean $active       Whether the message type is active or not
2215 2215
 	 * @return string                html output for the content
2216 2216
 	 */
2217
-	protected function _message_type_settings_content( $message_type, $messenger, $active = FALSE ) {
2217
+	protected function _message_type_settings_content($message_type, $messenger, $active = FALSE) {
2218 2218
 		//get message type fields
2219 2219
 		$fields = $message_type->get_admin_settings_fields();
2220
-		$settings_template_args['template_form_fields']= '';
2220
+		$settings_template_args['template_form_fields'] = '';
2221 2221
 
2222
-		if ( !empty( $fields ) && $active ) {
2222
+		if ( ! empty($fields) && $active) {
2223 2223
 
2224
-			$existing_settings = $message_type->get_existing_admin_settings( $messenger->name );
2224
+			$existing_settings = $message_type->get_existing_admin_settings($messenger->name);
2225 2225
 
2226
-			foreach( $fields as $fldname => $fldprops ) {
2227
-				$field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname;
2226
+			foreach ($fields as $fldname => $fldprops) {
2227
+				$field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname;
2228 2228
 				$template_form_field[$field_id] = array(
2229
-					'name' => 'message_type_settings[' . $fldname . ']',
2229
+					'name' => 'message_type_settings['.$fldname.']',
2230 2230
 					'label' => $fldprops['label'],
2231 2231
 					'input' => $fldprops['field_type'],
2232 2232
 					'type' => $fldprops['value_type'],
2233 2233
 					'required' => $fldprops['required'],
2234 2234
 					'validation' => $fldprops['validation'],
2235
-					'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2236
-					'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(),
2237
-					'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'],
2235
+					'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2236
+					'options' => isset($fldprops['options']) ? $fldprops['options'] : array(),
2237
+					'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2238 2238
 					'css_class' => 'no-drag',
2239 2239
 					'format' => $fldprops['format']
2240 2240
 					);
2241 2241
 			}
2242 2242
 
2243 2243
 
2244
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : '';
2244
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : '';
2245 2245
 		}
2246 2246
 
2247 2247
 		$settings_template_args['description'] = $message_type->description;
@@ -2261,13 +2261,13 @@  discard block
 block discarded – undo
2261 2261
 					)
2262 2262
 				);
2263 2263
 
2264
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2265
-		$settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : '';
2264
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2265
+		$settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : '';
2266 2266
 
2267 2267
 
2268 2268
 
2269
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php';
2270
-		$content = EEH_Template::display_template( $template, $settings_template_args, TRUE );
2269
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php';
2270
+		$content = EEH_Template::display_template($template, $settings_template_args, TRUE);
2271 2271
 		return $content;
2272 2272
 	}
2273 2273
 
@@ -2284,21 +2284,21 @@  discard block
 block discarded – undo
2284 2284
 		$m_boxes = $mt_boxes = array();
2285 2285
 		$m_template_args = $mt_template_args = array();
2286 2286
 
2287
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2287
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2288 2288
 
2289
-		foreach ( $this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array ) {
2289
+		foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) {
2290 2290
 
2291
-			$hide_on_message = isset( $this->_active_messengers[$messenger] ) ? '' : 'hidden';
2292
-			$hide_off_message = isset( $this->_active_messengers[$messenger] ) ? 'hidden' : '';
2291
+			$hide_on_message = isset($this->_active_messengers[$messenger]) ? '' : 'hidden';
2292
+			$hide_off_message = isset($this->_active_messengers[$messenger]) ? 'hidden' : '';
2293 2293
 
2294 2294
 			//messenger meta boxes
2295 2295
 			$active = $selected_messenger == $messenger ? TRUE : FALSE;
2296
-			$active_mt_tabs = isset(  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] ) ?  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2297
-			$m_boxes[$messenger . '_a_box'] = sprintf( __('%s Settings', 'event_espresso'), $tab_array['label'] );
2298
-			$m_template_args[$messenger . '_a_box'] = array(
2299
-					'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2300
-					'inactive_message_types' => isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) ? $this->_get_mt_tabs( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) : '',
2301
-					'content' => $this->_get_messenger_box_content( $tab_array['obj'] ),
2296
+			$active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active']) ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2297
+			$m_boxes[$messenger.'_a_box'] = sprintf(__('%s Settings', 'event_espresso'), $tab_array['label']);
2298
+			$m_template_args[$messenger.'_a_box'] = array(
2299
+					'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2300
+					'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) : '',
2301
+					'content' => $this->_get_messenger_box_content($tab_array['obj']),
2302 2302
 					'hidden' => $active ? '' : ' hidden',
2303 2303
 					'hide_on_message' => $hide_on_message,
2304 2304
 					'messenger' => $messenger,
@@ -2307,10 +2307,10 @@  discard block
 block discarded – undo
2307 2307
 
2308 2308
 
2309 2309
 			//message type meta boxes (which is really just the inactive container for each messenger showing inactive message types for that messenger)
2310
-			$mt_boxes[$messenger . '_i_box'] = __('Inactive Message Types', 'event_espresso');
2311
-			$mt_template_args[$messenger . '_i_box'] = array(
2312
-				'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2313
-				'inactive_message_types' => isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) ? $this->_get_mt_tabs( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) : '',
2310
+			$mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso');
2311
+			$mt_template_args[$messenger.'_i_box'] = array(
2312
+				'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2313
+				'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) : '',
2314 2314
 				'hidden' => $active ? '' : ' hidden',
2315 2315
 				'hide_on_message' => $hide_on_message,
2316 2316
 				'hide_off_message' => $hide_off_message,
@@ -2320,19 +2320,19 @@  discard block
 block discarded – undo
2320 2320
 		}
2321 2321
 
2322 2322
 		//register messenger metaboxes
2323
-		$m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php';
2324
-		foreach ( $m_boxes as $box => $label ) {
2325
-			$callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] );
2326
-			$msgr = str_replace( '_a_box', '', $box );
2327
-			add_meta_box( 'espresso_' . $msgr . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args );
2323
+		$m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php';
2324
+		foreach ($m_boxes as $box => $label) {
2325
+			$callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]);
2326
+			$msgr = str_replace('_a_box', '', $box);
2327
+			add_meta_box('espresso_'.$msgr.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args);
2328 2328
 		}
2329 2329
 
2330 2330
 		//register message type metaboxes
2331
-		$mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php';
2332
-		foreach ( $mt_boxes as $box => $label ) {
2333
-			$callback_args = array( 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box] );
2334
-			$mt = str_replace( '_i_box', '', $box );
2335
-			add_meta_box( 'espresso_' . $mt . '_inactive_mts', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'side', 'high', $callback_args );
2331
+		$mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php';
2332
+		foreach ($mt_boxes as $box => $label) {
2333
+			$callback_args = array('template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box]);
2334
+			$mt = str_replace('_i_box', '', $box);
2335
+			add_meta_box('espresso_'.$mt.'_inactive_mts', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'side', 'high', $callback_args);
2336 2336
 		}
2337 2337
 
2338 2338
 	}
@@ -2343,13 +2343,13 @@  discard block
 block discarded – undo
2343 2343
 	 * @param  array $tab_array  This is an array of message type tab details used to generate the tabs
2344 2344
 	 * @return string            html formatted tabs
2345 2345
 	 */
2346
-	protected function _get_mt_tabs( $tab_array ) {
2346
+	protected function _get_mt_tabs($tab_array) {
2347 2347
 		$tab_array = (array) $tab_array;
2348
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php';
2348
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php';
2349 2349
 		$tabs = '';
2350 2350
 
2351
-		foreach ( $tab_array as $tab ) {
2352
-			$tabs .=  EEH_Template::display_template( $template, $tab, TRUE );
2351
+		foreach ($tab_array as $tab) {
2352
+			$tabs .= EEH_Template::display_template($template, $tab, TRUE);
2353 2353
 		}
2354 2354
 
2355 2355
 		return $tabs;
@@ -2363,7 +2363,7 @@  discard block
 block discarded – undo
2363 2363
 	 * @param  object $messenger The messenger we're setting up content for
2364 2364
 	 * @return string            html formatted content
2365 2365
 	 */
2366
-	protected function _get_messenger_box_content( $messenger ) {
2366
+	protected function _get_messenger_box_content($messenger) {
2367 2367
 
2368 2368
 		$fields = $messenger->get_admin_settings_fields();
2369 2369
 		$settings_template_args['template_form_fields'] = '';
@@ -2372,27 +2372,27 @@  discard block
 block discarded – undo
2372 2372
 		$settings_template_args['active'] = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;
2373 2373
 
2374 2374
 
2375
-		if ( !empty( $fields ) ) {
2375
+		if ( ! empty($fields)) {
2376 2376
 
2377 2377
 			$existing_settings = $messenger->get_existing_admin_settings();
2378 2378
 
2379
-			foreach( $fields as $fldname => $fldprops ) {
2380
-				$field_id = $messenger->name . '-' . $fldname;
2379
+			foreach ($fields as $fldname => $fldprops) {
2380
+				$field_id = $messenger->name.'-'.$fldname;
2381 2381
 				$template_form_field[$field_id] = array(
2382
-					'name' => 'messenger_settings[' . $field_id . ']',
2382
+					'name' => 'messenger_settings['.$field_id.']',
2383 2383
 					'label' => $fldprops['label'],
2384 2384
 					'input' => $fldprops['field_type'],
2385 2385
 					'type' => $fldprops['value_type'],
2386 2386
 					'required' => $fldprops['required'],
2387 2387
 					'validation' => $fldprops['validation'],
2388
-					'value' => isset( $existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2388
+					'value' => isset($existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2389 2389
 					'css_class' => '',
2390 2390
 					'format' => $fldprops['format']
2391 2391
 					);
2392 2392
 			}
2393 2393
 
2394 2394
 
2395
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' ) : '';
2395
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form') : '';
2396 2396
 		}
2397 2397
 
2398 2398
 		//we also need some hidden fields
@@ -2408,8 +2408,8 @@  discard block
 block discarded – undo
2408 2408
 			);
2409 2409
 
2410 2410
 		//make sure any active message types that are existing are included in the hidden fields
2411
-		if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) {
2412
-			foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) {
2411
+		if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) {
2412
+			foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) {
2413 2413
 				$settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array(
2414 2414
 						'type' => 'hidden',
2415 2415
 						'value' => $mt
@@ -2417,25 +2417,25 @@  discard block
 block discarded – undo
2417 2417
 			}
2418 2418
 		}
2419 2419
 
2420
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2420
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2421 2421
 
2422
-		$active = isset( $this->_active_messengers[$messenger->name] ) ? TRUE : FALSE;
2422
+		$active = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;
2423 2423
 
2424 2424
 		$settings_template_args['messenger'] = $messenger->name;
2425 2425
 		$settings_template_args['description'] = $messenger->description;
2426 2426
 		$settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden';
2427 2427
 
2428 2428
 
2429
-		$settings_template_args['show_hide_edit_form'] = isset( $this->_active_messengers[$messenger->name] ) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2429
+		$settings_template_args['show_hide_edit_form'] = isset($this->_active_messengers[$messenger->name]) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2430 2430
 
2431
-		$settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2431
+		$settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2432 2432
 
2433 2433
 
2434 2434
 		$settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on';
2435
-		$settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce');
2435
+		$settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce');
2436 2436
 		$settings_template_args['on_off_status'] = $active ? true : false;
2437
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php';
2438
-		$content = EEH_Template::display_template( $template, $settings_template_args, TRUE);
2437
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php';
2438
+		$content = EEH_Template::display_template($template, $settings_template_args, TRUE);
2439 2439
 		return $content;
2440 2440
 	}
2441 2441
 
@@ -2449,39 +2449,39 @@  discard block
 block discarded – undo
2449 2449
 	public function activate_messenger_toggle() {
2450 2450
 		$success = TRUE;
2451 2451
 		//let's check that we have required data
2452
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2453
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2452
+		if ( ! isset($this->_req_data['messenger'])) {
2453
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2454 2454
 			$success = FALSE;
2455 2455
 		}
2456 2456
 
2457 2457
 		//do a nonce check here since we're not arriving via a normal route
2458
-		$nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : '';
2459
-		$nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce';
2458
+		$nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : '';
2459
+		$nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce';
2460 2460
 
2461
-		$this->_verify_nonce( $nonce, $nonce_ref );
2461
+		$this->_verify_nonce($nonce, $nonce_ref);
2462 2462
 
2463 2463
 
2464 2464
 
2465
-		if ( !isset( $this->_req_data[ 'status' ])) {
2466
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2465
+		if ( ! isset($this->_req_data['status'])) {
2466
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2467 2467
 			$success = FALSE;
2468 2468
 		}
2469 2469
 
2470 2470
 		//do check to verify we have a valid status.
2471 2471
 		$status = $this->_req_data['status'];
2472 2472
 
2473
-		if ( $status != 'off' && $status != 'on' ) {
2474
-			EE_Error::add_error( sprintf( __('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), $this->_req_data['status'] ), __FILE__, __FUNCTION__, __LINE__ );
2473
+		if ($status != 'off' && $status != 'on') {
2474
+			EE_Error::add_error(sprintf(__('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), $this->_req_data['status']), __FILE__, __FUNCTION__, __LINE__);
2475 2475
 			$success = FALSE;
2476 2476
 		}
2477 2477
 
2478
-		if ( $success ) {
2478
+		if ($success) {
2479 2479
 			//made it here?  Stop dawdling then!!
2480
-			if ( $status == 'off' ) {
2480
+			if ($status == 'off') {
2481 2481
 				//off = deactivate.  get it?
2482
-				$success = $this->_activate_messenger( $this->_req_data['messenger'], TRUE );
2482
+				$success = $this->_activate_messenger($this->_req_data['messenger'], TRUE);
2483 2483
 			} else {
2484
-				$success = $this->_activate_messenger( $this->_req_data['messenger'] );
2484
+				$success = $this->_activate_messenger($this->_req_data['messenger']);
2485 2485
 			}
2486 2486
 		}
2487 2487
 
@@ -2507,26 +2507,26 @@  discard block
 block discarded – undo
2507 2507
 
2508 2508
 
2509 2509
 		//let's make sure we have the necessary data
2510
-		if ( !isset( $this->_req_data[ 'message_type' ] ) ) {
2511
-			EE_Error::add_error( __('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2510
+		if ( ! isset($this->_req_data['message_type'])) {
2511
+			EE_Error::add_error(__('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2512 2512
 			$success = FALSE;
2513 2513
 		}
2514 2514
 
2515 2515
 
2516 2516
 		//do a nonce check here since we're not arriving via a normal route
2517
-		$nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : '';
2518
-		$nonce_ref = $this->_req_data['message_type'] . '_nonce';
2517
+		$nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : '';
2518
+		$nonce_ref = $this->_req_data['message_type'].'_nonce';
2519 2519
 
2520
-		$this->_verify_nonce( $nonce, $nonce_ref );
2520
+		$this->_verify_nonce($nonce, $nonce_ref);
2521 2521
 
2522 2522
 
2523
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2524
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2523
+		if ( ! isset($this->_req_data['messenger'])) {
2524
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2525 2525
 			$success = FALSE;
2526 2526
 		}
2527 2527
 
2528
-		if ( !isset( $this->_req_data[ 'status' ])) {
2529
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2528
+		if ( ! isset($this->_req_data['status'])) {
2529
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2530 2530
 			$success = FALSE;
2531 2531
 		}
2532 2532
 
@@ -2534,16 +2534,16 @@  discard block
 block discarded – undo
2534 2534
 		//do check to verify we have a valid status.
2535 2535
 		$status = $this->_req_data['status'];
2536 2536
 
2537
-		if ( $status != 'activate' && $status != 'deactivate' ) {
2538
-			EE_Error::add_error( sprintf( __('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), $this->_req_data['status'] ), __FILE__, __FUNCTION__, __LINE__ );
2537
+		if ($status != 'activate' && $status != 'deactivate') {
2538
+			EE_Error::add_error(sprintf(__('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), $this->_req_data['status']), __FILE__, __FUNCTION__, __LINE__);
2539 2539
 			$success = FALSE;
2540 2540
 		}
2541 2541
 
2542 2542
 
2543
-		if ( $success ) {
2543
+		if ($success) {
2544 2544
 			//made it here? um, what are you waiting for then?
2545 2545
 			$deactivate = $status == 'deactivate' ? TRUE : FALSE;
2546
-			$success = $this->_activate_messenger( $this->_req_data['messenger'], $deactivate, $this->_req_data['message_type'] );
2546
+			$success = $this->_activate_messenger($this->_req_data['messenger'], $deactivate, $this->_req_data['message_type']);
2547 2547
 		}
2548 2548
 
2549 2549
 		$this->_template_args['success'] = $success;
@@ -2570,28 +2570,28 @@  discard block
 block discarded – undo
2570 2570
 		$templates = TRUE;
2571 2571
 		$this->_set_m_mt_settings();
2572 2572
 
2573
-		if ( !$deactivate ) {
2573
+		if ( ! $deactivate) {
2574 2574
 
2575 2575
 
2576 2576
 			//we are activating.  we can use $this->_m_mt_settings to get all the installed messengers
2577
-			$this->_active_messengers[$messenger]['settings'] = !isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2577
+			$this->_active_messengers[$messenger]['settings'] = ! isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2578 2578
 			$this->_active_messengers[$messenger]['obj'] = $this->_m_mt_settings['messenger_tabs'][$messenger]['obj'];
2579 2579
 
2580 2580
 			//get has_active so we can sure its kept up to date.
2581
-			$has_activated = get_option( 'ee_has_activated_messages' );
2581
+			$has_activated = get_option('ee_has_activated_messages');
2582 2582
 
2583
-			if ( empty( $has_activated[$messenger] ) ) {
2583
+			if (empty($has_activated[$messenger])) {
2584 2584
 				$has_activated[$messenger] = array();
2585 2585
 			}
2586 2586
 
2587 2587
 			//k we need to get what default message types are to be associated with the messenger that's been activated.
2588 2588
 			$default_types = $message_type ? (array) $message_type : $this->_active_messengers[$messenger]['obj']->get_default_message_types();
2589 2589
 
2590
-			foreach ( $default_types as $type ) {
2590
+			foreach ($default_types as $type) {
2591 2591
 				$settings_fields = $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$type]['obj']->get_admin_settings_fields();
2592
-				if ( !empty( $settings_fields ) ) {
2592
+				if ( ! empty($settings_fields)) {
2593 2593
 					//we have fields for this message type so let's get the defaults for saving.
2594
-					foreach ( $settings_fields as $field => $values ) {
2594
+					foreach ($settings_fields as $field => $values) {
2595 2595
 						$settings[$field] = $values['default'];
2596 2596
 					}
2597 2597
 					//let's set the data for reloading this message type form in ajax
@@ -2599,9 +2599,9 @@  discard block
 block discarded – undo
2599 2599
 				} else {
2600 2600
 					$settings = array();
2601 2601
 				}
2602
-				$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$type]['settings'] =  $settings;
2602
+				$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$type]['settings'] = $settings;
2603 2603
 
2604
-				if ( ! in_array( $type, $has_activated[$messenger] ) ) {
2604
+				if ( ! in_array($type, $has_activated[$messenger])) {
2605 2605
 					$has_activated[$messenger][] = $type;
2606 2606
 				}
2607 2607
 			}
@@ -2609,41 +2609,41 @@  discard block
 block discarded – undo
2609 2609
 			//any default settings for the messenger?
2610 2610
 			$msgr_settings = $this->_active_messengers[$messenger]['obj']->get_admin_settings_fields();
2611 2611
 
2612
-			if ( !empty( $msgr_settings ) ) {
2613
-				foreach ( $msgr_settings as $field => $value ) {
2612
+			if ( ! empty($msgr_settings)) {
2613
+				foreach ($msgr_settings as $field => $value) {
2614 2614
 					$this->_active_messengers[$messenger]['settings'][$field] = $value;
2615 2615
 				}
2616 2616
 			}
2617 2617
 
2618 2618
 			//update settings in database
2619
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2620
-			update_option( 'ee_has_activated_messages', $has_activated );
2619
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2620
+			update_option('ee_has_activated_messages', $has_activated);
2621 2621
 
2622 2622
 
2623 2623
 			//generate new templates (if necessary)
2624
-			$templates = $this->_generate_new_templates( $messenger, $default_types, 0, TRUE );
2624
+			$templates = $this->_generate_new_templates($messenger, $default_types, 0, TRUE);
2625 2625
 
2626 2626
 			EE_Error::overwrite_success();
2627 2627
 
2628 2628
 			//if generation failed then we need to remove the active messenger.
2629
-			if ( !$templates ) {
2629
+			if ( ! $templates) {
2630 2630
 				unset($this->_active_messengers[$messenger]);
2631
-				EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2631
+				EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2632 2632
 			} else {
2633 2633
 				//all is good let's do a success message
2634
-				if ( $message_type ) {
2635
-					EE_Error::add_success( sprintf( __('%s message type has been successfully activated with the %s messenger', 'event_espresso'),ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$message_type]['obj']->label['singular']), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) );
2634
+				if ($message_type) {
2635
+					EE_Error::add_success(sprintf(__('%s message type has been successfully activated with the %s messenger', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$message_type]['obj']->label['singular']), ucwords($this->_active_messengers[$messenger]['obj']->label['singular'])));
2636 2636
 
2637 2637
 					//if message type was invoice then let's make sure we activate the invoice payment method.
2638
-					if ( $message_type == 'invoice' ) {
2639
-						EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2640
-						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
2641
-						if ( $pm instanceof EE_Payment_Method ) {
2642
-							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' ) );
2638
+					if ($message_type == 'invoice') {
2639
+						EE_Registry::instance()->load_lib('Payment_Method_Manager');
2640
+						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
2641
+						if ($pm instanceof EE_Payment_Method) {
2642
+							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'));
2643 2643
 						}
2644 2644
 					}
2645 2645
 				} else {
2646
-					EE_Error::add_success( sprintf( __('%s messenger has been successfully activated', 'event_espresso'), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) );
2646
+					EE_Error::add_success(sprintf(__('%s messenger has been successfully activated', 'event_espresso'), ucwords($this->_active_messengers[$messenger]['obj']->label['singular'])));
2647 2647
 				}
2648 2648
 			}
2649 2649
 
@@ -2659,36 +2659,36 @@  discard block
 block discarded – undo
2659 2659
 			$update_array = array(
2660 2660
 				'MTP_messenger' => $messenger);
2661 2661
 
2662
-			if ( $message_type ) {
2662
+			if ($message_type) {
2663 2663
 				$update_array['MTP_message_type'] = $message_type;
2664 2664
 			}
2665 2665
 
2666
-			$success = $MTP->update( array( 'MTP_is_active' => 0 ), array($update_array) );
2666
+			$success = $MTP->update(array('MTP_is_active' => 0), array($update_array));
2667 2667
 
2668 2668
 			$messenger_obj = $this->_active_messengers[$messenger]['obj'];
2669 2669
 
2670 2670
 			//if this is a message type deactivation then we're only unsetting the message type otherwise unset the messenger
2671
-			if ( $message_type ) {
2672
-				unset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] );
2671
+			if ($message_type) {
2672
+				unset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type]);
2673 2673
 			} else {
2674
-				unset( $this->_active_messengers[$messenger] );
2674
+				unset($this->_active_messengers[$messenger]);
2675 2675
 			}
2676 2676
 
2677
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2677
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2678 2678
 			EE_Error::overwrite_success();
2679
-			if ( $message_type ) {
2680
-				EE_Error::add_success( sprintf( __('%s message type has been successfully deactivated', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['active'][$message_type]['obj']->label['singular']) ) );
2679
+			if ($message_type) {
2680
+				EE_Error::add_success(sprintf(__('%s message type has been successfully deactivated', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['active'][$message_type]['obj']->label['singular'])));
2681 2681
 			} else {
2682
-				EE_Error::add_success( sprintf( __('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'] ) ) );
2682
+				EE_Error::add_success(sprintf(__('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'])));
2683 2683
 			}
2684 2684
 
2685 2685
 			//if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method.
2686
-			if ( $messenger == 'html'  || $message_type == 'invoice') {
2687
-				EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2688
-				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' );
2689
-				if ( $count_updated > 0 ) {
2690
-					$msg = $message_type == 'invoice' ? __('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 vist the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ) : __('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' );
2691
-					EE_Error::add_attention( $msg );
2686
+			if ($messenger == 'html' || $message_type == 'invoice') {
2687
+				EE_Registry::instance()->load_lib('Payment_Method_Manager');
2688
+				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice');
2689
+				if ($count_updated > 0) {
2690
+					$msg = $message_type == 'invoice' ? __('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 vist the payment methods admin page to reactivate the invoice payment method.', 'event_espresso') : __('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');
2691
+					EE_Error::add_attention($msg);
2692 2692
 				}
2693 2693
 			}
2694 2694
 
@@ -2705,8 +2705,8 @@  discard block
 block discarded – undo
2705 2705
 	 * @return string html data
2706 2706
 	 */
2707 2707
 	public function update_mt_form() {
2708
-		if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) {
2709
-			EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ );
2708
+		if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) {
2709
+			EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__);
2710 2710
 			$this->_return_json();
2711 2711
 		}
2712 2712
 
@@ -2715,7 +2715,7 @@  discard block
 block discarded – undo
2715 2715
 		$message_type = $message_types[$this->_req_data['message_type']]['obj'];
2716 2716
 		$messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
2717 2717
 
2718
-		$content = $this->_message_type_settings_content ( $message_type, $messenger, TRUE, TRUE );
2718
+		$content = $this->_message_type_settings_content($message_type, $messenger, TRUE, TRUE);
2719 2719
 		$this->_template_args['success'] = true;
2720 2720
 		$this->_template_args['content'] = $content;
2721 2721
 		$this->_return_json();
@@ -2729,36 +2729,36 @@  discard block
 block discarded – undo
2729 2729
 	 * @return json success or fail message
2730 2730
 	 */
2731 2731
 	public function save_settings() {
2732
-		if ( !isset( $this->_req_data['type'] ) ) {
2733
-			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2732
+		if ( ! isset($this->_req_data['type'])) {
2733
+			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2734 2734
 			$this->_template_args['error'] = TRUE;
2735 2735
 			$this->_return_json();
2736 2736
 		}
2737 2737
 
2738 2738
 
2739
-		if ( $this->_req_data['type'] == 'messenger' ) {
2739
+		if ($this->_req_data['type'] == 'messenger') {
2740 2740
 			$settings = $this->_req_data['messenger_settings']; //this should be an array.
2741 2741
 			$messenger = $settings['messenger'];
2742 2742
 			//let's setup the settings data
2743
-			foreach ( $settings as $key => $value ) {
2744
-				switch ( $key ) {
2743
+			foreach ($settings as $key => $value) {
2744
+				switch ($key) {
2745 2745
 					case 'messenger' :
2746
-						unset( $settings['messenger'] );
2746
+						unset($settings['messenger']);
2747 2747
 						break;
2748 2748
 					case 'message_types' :
2749
-						if ( isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] ) ) {
2750
-							foreach ( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] as $mt => $v ) {
2751
-								if ( isset( $settings['message_types'][$mt] ) )
2752
-									$settings[$messenger . '-message_types'][$mt]['settings'] = isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ? $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] : array();
2749
+						if (isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'])) {
2750
+							foreach ($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'] as $mt => $v) {
2751
+								if (isset($settings['message_types'][$mt]))
2752
+									$settings[$messenger.'-message_types'][$mt]['settings'] = isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) ? $this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt] : array();
2753 2753
 							}
2754 2754
 						} else {
2755
-							foreach ( $value as $mt => $v ) {
2755
+							foreach ($value as $mt => $v) {
2756 2756
 								//let's see if this message type is already present and has settings.
2757
-								$settings[$messenger . '-message_types'][$mt]['settings'] = array();
2757
+								$settings[$messenger.'-message_types'][$mt]['settings'] = array();
2758 2758
 							}
2759 2759
 						}
2760 2760
 						//k settings are set let's get rid of the message types index
2761
-						unset( $settings['message_types'] );
2761
+						unset($settings['message_types']);
2762 2762
 						break;
2763 2763
 					default :
2764 2764
 						$settings[$key] = $value;
@@ -2768,36 +2768,36 @@  discard block
 block discarded – undo
2768 2768
 			$this->_active_messengers[$messenger]['settings'] = $settings;
2769 2769
 		}
2770 2770
 
2771
-		else if ( $this->_req_data['type'] == 'message_type' ) {
2771
+		else if ($this->_req_data['type'] == 'message_type') {
2772 2772
 			$settings = $this->_req_data['message_type_settings'];
2773 2773
 			$messenger = $settings['messenger'];
2774 2774
 			$message_type = $settings['message_type'];
2775 2775
 
2776
-			foreach ( $settings as $key => $value ) {
2777
-				switch ( $key ) {
2776
+			foreach ($settings as $key => $value) {
2777
+				switch ($key) {
2778 2778
 					case 'messenger' :
2779
-						unset( $settings['messenger'] );
2779
+						unset($settings['messenger']);
2780 2780
 						break;
2781 2781
 					case 'message_type' :
2782
-						unset( $settings['message_type'] );
2782
+						unset($settings['message_type']);
2783 2783
 						break;
2784 2784
 					default :
2785 2785
 						$settings['settings'][$key] = $value;
2786
-						unset( $settings[$key] );
2786
+						unset($settings[$key]);
2787 2787
 						break;
2788 2788
 				}
2789 2789
 			}
2790 2790
 
2791
-			$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] = $settings;
2791
+			$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type] = $settings;
2792 2792
 		}
2793 2793
 
2794 2794
 		//okay we should have the data all setup.  Now we just update!
2795
-		$success = EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2795
+		$success = EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2796 2796
 
2797
-		if ( $success ) {
2798
-			EE_Error::add_success( __('Settings updated', 'event_espresso') );
2797
+		if ($success) {
2798
+			EE_Error::add_success(__('Settings updated', 'event_espresso'));
2799 2799
 		} else {
2800
-			EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2800
+			EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2801 2801
 		}
2802 2802
 
2803 2803
 		$this->_template_args['success'] = $success;
Please login to merge, or discard this patch.
admin_pages/messages/templates/shortcode_selector_skeleton.template.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * This file contains the template for the Messages Shortcode selector.
4
- *
5
- * Template args available are:
6
- * @type    array   $shortcodes An array indexed by shortcode and the values are the labels.
7
- * @type    string  $fieldname  The name of the field the chooser is associated with.
8
- * @type    string  $linked_input_id The name of the input that the shortcode gets inserted to.
9
- */
3
+			 * This file contains the template for the Messages Shortcode selector.
4
+			 *
5
+			 * Template args available are:
6
+			 * @type    array   $shortcodes An array indexed by shortcode and the values are the labels.
7
+			 * @type    string  $fieldname  The name of the field the chooser is associated with.
8
+			 * @type    string  $linked_input_id The name of the input that the shortcode gets inserted to.
9
+			 */
10 10
 if ( ! empty( $shortcodes ) ) : ?>
11 11
 <span class="ee-messages-shortcodes-chooser js-open-list-trigger dashicons dashicons-menu">
12 12
 	<ul id="ee_shortcode_chooser_<?php echo $fieldname; ?>" class="ee_shortcode_chooser_container hidden">
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 block discarded – undo
7 7
  * @type    string  $fieldname  The name of the field the chooser is associated with.
8 8
  * @type    string  $linked_input_id The name of the input that the shortcode gets inserted to.
9 9
  */
10
-if ( ! empty( $shortcodes ) ) : ?>
10
+if ( ! empty($shortcodes)) : ?>
11 11
 <span class="ee-messages-shortcodes-chooser js-open-list-trigger dashicons dashicons-menu">
12 12
 	<ul id="ee_shortcode_chooser_<?php echo $fieldname; ?>" class="ee_shortcode_chooser_container hidden">
13
-		<?php foreach( $shortcodes as $shortcode => $label ) : ?>
13
+		<?php foreach ($shortcodes as $shortcode => $label) : ?>
14 14
 			<li>
15
-				<span class="js-shortcode-selection" data-value="<?php echo esc_attr( $shortcode ); ?>" data-linked-input-id="<?php echo esc_attr( $linked_input_id ); ?>"><?php echo $shortcode; ?></span>
15
+				<span class="js-shortcode-selection" data-value="<?php echo esc_attr($shortcode); ?>" data-linked-input-id="<?php echo esc_attr($linked_input_id); ?>"><?php echo $shortcode; ?></span>
16 16
 			</li>
17 17
 		<?php endforeach; ?>
18 18
 	</ul>
19 19
 </span>
20
-<?php endif ; ?>
21 20
\ No newline at end of file
21
+<?php endif; ?>
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
admin_pages/registration_form/Registration_Form_Admin_Page.core.php 2 patches
Spacing   +135 added lines, -135 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
 /**
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 
59 59
 
60 60
 
61
-	public function __construct( $routing = TRUE ) {
62
-		require_once( EE_MODELS . 'EEM_Question.model.php' );
63
-		require_once( EE_MODELS . 'EEM_Question_Group.model.php' );
64
-		$this->_question_model=  EEM_Question::instance();
65
-		$this->_question_group_model=EEM_Question_Group::instance();
66
-		parent::__construct( $routing );
61
+	public function __construct($routing = TRUE) {
62
+		require_once(EE_MODELS.'EEM_Question.model.php');
63
+		require_once(EE_MODELS.'EEM_Question_Group.model.php');
64
+		$this->_question_model = EEM_Question::instance();
65
+		$this->_question_group_model = EEM_Question_Group::instance();
66
+		parent::__construct($routing);
67 67
 	}
68 68
 
69 69
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
 
99 99
 	protected function _set_page_routes() {
100
-		$qst_id = ! empty( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0;
100
+		$qst_id = ! empty($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0;
101 101
 		$this->_page_routes = array(
102 102
 			'default' => array(
103 103
 				'func' => '_questions_overview_list_table',
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
 			'update_question' => array(
120 120
 				'func' => '_insert_or_update_question',
121
-				'args' => array('new_question' => FALSE ),
121
+				'args' => array('new_question' => FALSE),
122 122
 				'capability' => 'ee_edit_question',
123 123
 				'obj_id' => $qst_id,
124 124
 				'noheader' => TRUE,
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 						'filename' => 'registration_form_questions_overview_views_bulk_actions_search'
154 154
 						)
155 155
 					),
156
-				'help_tour' => array( 'Registration_Form_Questions_Overview_Help_Tour'),
156
+				'help_tour' => array('Registration_Form_Questions_Overview_Help_Tour'),
157 157
 				'require_nonce' => FALSE,
158 158
 				'qtips' => array(
159 159
 					'EE_Registration_Form_Tips'
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 						'filename' => 'registration_form_question_groups'
173 173
 						),
174 174
 					),
175
-				'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'),
175
+				'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'),
176 176
 				'require_nonce' => FALSE
177 177
 				),
178 178
 
@@ -181,16 +181,16 @@  discard block
 block discarded – undo
181 181
 					'label' => __('Edit Question', 'event_espresso'),
182 182
 					'order' => 15,
183 183
 					'persistent' => FALSE,
184
-					'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id'] ), $this->_current_page_view_url )  : $this->_admin_base_url
184
+					'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id']), $this->_current_page_view_url) : $this->_admin_base_url
185 185
 					),
186
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
186
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
187 187
 				'help_tabs' => array(
188 188
 					'registration_form_edit_question_group_help_tab' => array(
189 189
 						'title' => __('Edit Question', 'event_espresso'),
190 190
 						'filename' => 'registration_form_edit_question'
191 191
 						),
192 192
 					),
193
-                'help_tour' => array( 'Registration_Form_Edit_Question_Help_Tour'),
193
+                'help_tour' => array('Registration_Form_Edit_Question_Help_Tour'),
194 194
 				'require_nonce' => FALSE
195 195
 				),
196 196
 			);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	//none of the below group are currently used for Event Categories
219 219
 	protected function _add_feature_pointers() {}
220 220
 	public function load_scripts_styles() {
221
-		wp_register_style( 'espresso_registration', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION );
221
+		wp_register_style('espresso_registration', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION);
222 222
 		wp_enqueue_style('espresso_registration');
223 223
 	}
224 224
 	public function admin_init() {}
@@ -234,20 +234,20 @@  discard block
 block discarded – undo
234 234
 
235 235
 	public function load_scripts_styles_add_question() {
236 236
 		$this->load_scripts_styles_forms();
237
-		wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE );
238
-		wp_enqueue_script( 'espresso_registration_form_single' );
237
+		wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
238
+		wp_enqueue_script('espresso_registration_form_single');
239 239
 	}
240 240
 	public function load_scripts_styles_edit_question() {
241 241
 		$this->load_scripts_styles_forms();
242
-		wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE );
243
-		wp_enqueue_script( 'espresso_registration_form_single' );
242
+		wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
243
+		wp_enqueue_script('espresso_registration_form_single');
244 244
 	}
245 245
 
246 246
 
247 247
 
248 248
 
249 249
 	public function recaptcha_info_help_tab() {
250
-		$template = REGISTRATION_FORM_TEMPLATE_PATH . 'recaptcha_info_help_tab.template.php';
250
+		$template = REGISTRATION_FORM_TEMPLATE_PATH.'recaptcha_info_help_tab.template.php';
251 251
 		EEH_Template::display_template($template, array());
252 252
 	}
253 253
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 				)
280 280
 		);
281 281
 
282
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) {
282
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) {
283 283
 			$this->_views['trash'] = array(
284 284
 				'slug' => 'trash',
285 285
 				'label' => __('Trash', 'event_espresso'),
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
 	 */
298 298
 	protected function _questions_groups_preview() {
299 299
 		$this->_admin_page_title = __('Question Groups (Preview)', 'event_espresso');
300
-		$this->_template_args['preview_img'] = '<img src="' . REGISTRATION_FORM_ASSETS_URL . 'caf_reg_form_preview.jpg" alt="' . esc_attr__( 'Preview Question Groups Overview List Table screenshot', 'event_espresso' ) . '" />';
301
-		$this->_template_args['preview_text'] = '<strong>'.__( 'Question Groups is a feature that is only available in the Caffeinated version of Event Espresso.  With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso' ).'</strong>';
302
-		$this->display_admin_caf_preview_page( 'question_groups_tab' );
300
+		$this->_template_args['preview_img'] = '<img src="'.REGISTRATION_FORM_ASSETS_URL.'caf_reg_form_preview.jpg" alt="'.esc_attr__('Preview Question Groups Overview List Table screenshot', 'event_espresso').'" />';
301
+		$this->_template_args['preview_text'] = '<strong>'.__('Question Groups is a feature that is only available in the Caffeinated version of Event Espresso.  With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso').'</strong>';
302
+		$this->display_admin_caf_preview_page('question_groups_tab');
303 303
 	}
304 304
 
305 305
 
@@ -308,41 +308,41 @@  discard block
 block discarded – undo
308 308
 	 * Extracts the question field's values from the POST request to update or insert them
309 309
 	 * @return array where each key is the name of a model's field/db column, and each value is its value.
310 310
 	 */
311
-	protected function _set_column_values_for(EEM_Base $model){
312
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
313
-		$set_column_values=array();
311
+	protected function _set_column_values_for(EEM_Base $model) {
312
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
313
+		$set_column_values = array();
314 314
 
315 315
 		//some initial checks for proper values.
316 316
 		//if QST_admin_only, then no matter what QST_required is we disable.
317
-		if ( !empty( $this->_req_data['QST_admin_only'] ) ) {
317
+		if ( ! empty($this->_req_data['QST_admin_only'])) {
318 318
 			$this->_req_data['QST_required'] = 0;
319 319
 		}
320
-		foreach($model->field_settings() as $fieldName=>$settings){
320
+		foreach ($model->field_settings() as $fieldName=>$settings) {
321 321
 			// basically if QSG_identifier is empty or not set
322
-			if ( $fieldName == 'QSG_identifier' && ( isset( $this->_req_data['QSG_identifier'] ) && empty( $this->_req_data['QSG_identifier'] ) )) {
323
-				$QSG_name = isset( $this->_req_data['QSG_name'] ) ? $this->_req_data['QSG_name'] : '' ;
324
-				$set_column_values[$fieldName] = sanitize_title($QSG_name ) . '-' . uniqid();
322
+			if ($fieldName == 'QSG_identifier' && (isset($this->_req_data['QSG_identifier']) && empty($this->_req_data['QSG_identifier']))) {
323
+				$QSG_name = isset($this->_req_data['QSG_name']) ? $this->_req_data['QSG_name'] : '';
324
+				$set_column_values[$fieldName] = sanitize_title($QSG_name).'-'.uniqid();
325 325
 //				dd($set_column_values);
326 326
 			}
327 327
 			//if the admin label is blank, use a slug version of the question text
328
-			else if ( $fieldName == 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] )  )) {
329
-				$QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ;
330
-				$set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10));
328
+			else if ($fieldName == 'QST_admin_label' && (isset($this->_req_data['QST_admin_label']) && empty($this->_req_data['QST_admin_label']))) {
329
+				$QST_text = isset($this->_req_data['QST_display_text']) ? $this->_req_data['QST_display_text'] : '';
330
+				$set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text, 10));
331 331
 			}
332 332
 
333 333
 
334
-			else if ( $fieldName == 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) {
334
+			else if ($fieldName == 'QST_admin_only' && ( ! isset($this->_req_data['QST_admin_only']))) {
335 335
 				$set_column_values[$fieldName] = 0;
336 336
 			}
337 337
 
338 338
 
339 339
 			//only add a property to the array if it's not null (otherwise the model should just use the default value)
340
-			else if(isset($this->_req_data[$fieldName])){
341
-				$set_column_values[$fieldName]=$this->_req_data[$fieldName];
340
+			else if (isset($this->_req_data[$fieldName])) {
341
+				$set_column_values[$fieldName] = $this->_req_data[$fieldName];
342 342
 			}
343 343
 
344 344
 		}
345
-		return $set_column_values;//validation fo this data to be performed by the model before insertion.
345
+		return $set_column_values; //validation fo this data to be performed by the model before insertion.
346 346
 	}
347 347
 
348 348
 
@@ -355,29 +355,29 @@  discard block
 block discarded – undo
355 355
 
356 356
 
357 357
 
358
-	protected function _edit_question( $action= 'add' ) {
359
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
360
-		$ID=isset( $this->_req_data['QST_ID'] ) && ! empty( $this->_req_data['QST_ID'] ) ? absint( $this->_req_data['QST_ID'] ) : FALSE;
358
+	protected function _edit_question($action = 'add') {
359
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
360
+		$ID = isset($this->_req_data['QST_ID']) && ! empty($this->_req_data['QST_ID']) ? absint($this->_req_data['QST_ID']) : FALSE;
361 361
 
362
-		$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
362
+		$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
363 363
 		// add PRC_ID to title if editing
364
-		$this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;
365
-		if($ID){
366
-			$question=$this->_question_model->get_one_by_ID($ID);
367
-			$additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID));
364
+		$this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title;
365
+		if ($ID) {
366
+			$question = $this->_question_model->get_one_by_ID($ID);
367
+			$additional_hidden_fields = array('QST_ID'=>array('type'=>'hidden', 'value'=>$ID));
368 368
 			$this->_set_add_edit_form_tags('update_question', $additional_hidden_fields);
369
-		}else{
370
-			$question= EE_Question::new_instance();
369
+		} else {
370
+			$question = EE_Question::new_instance();
371 371
 			$question->set_order_to_latest();
372 372
 			$this->_set_add_edit_form_tags('insert_question');
373 373
 		}
374
-		$question_types = $question->has_answers() ?  $this->_question_model->question_types_in_same_category( $question->type() ) : $this->_question_model->allowed_question_types();
375
-		$this->_template_args['QST_ID']=$ID;
376
-		$this->_template_args['question']=$question;
377
-		$this->_template_args['question_types']= $question_types;;
374
+		$question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category($question->type()) : $this->_question_model->allowed_question_types();
375
+		$this->_template_args['QST_ID'] = $ID;
376
+		$this->_template_args['question'] = $question;
377
+		$this->_template_args['question_types'] = $question_types; ;
378 378
 
379
-		$this->_set_publish_post_box_vars( 'id', $ID );
380
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'questions_main_meta_box.template.php', $this->_template_args, TRUE );
379
+		$this->_set_publish_post_box_vars('id', $ID);
380
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'questions_main_meta_box.template.php', $this->_template_args, TRUE);
381 381
 
382 382
 		// the details template wrapper
383 383
 		$this->display_admin_page_with_sidebar();
@@ -395,57 +395,57 @@  discard block
 block discarded – undo
395 395
 
396 396
 
397 397
 	protected function _insert_or_update_question($new_question = TRUE) {
398
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
399
-		$set_column_values=$this->_set_column_values_for($this->_question_model);
400
-		if($new_question){
401
-			$ID=$this->_question_model->insert($set_column_values);
398
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
399
+		$set_column_values = $this->_set_column_values_for($this->_question_model);
400
+		if ($new_question) {
401
+			$ID = $this->_question_model->insert($set_column_values);
402 402
 			$success = $ID ? true : false;
403 403
 			$action_desc = 'added';
404
-		}else{
405
-			$ID=absint($this->_req_data['QST_ID']);
406
-			$pk=$this->_question_model->primary_key_name();
407
-			$wheres=array($pk=>$ID);
404
+		} else {
405
+			$ID = absint($this->_req_data['QST_ID']);
406
+			$pk = $this->_question_model->primary_key_name();
407
+			$wheres = array($pk=>$ID);
408 408
 			unset($set_column_values[$pk]);
409
-			$success= $this->_question_model->update($set_column_values,array($wheres));
410
-			$action_desc='updated';
409
+			$success = $this->_question_model->update($set_column_values, array($wheres));
410
+			$action_desc = 'updated';
411 411
 		}
412 412
 
413
-		if ($ID){
413
+		if ($ID) {
414 414
 			//save the related options
415 415
 			//trash removed options, save old ones
416 416
 			//get list of all options
417 417
 			/** @type EE_Question $question */
418
-			$question=$this->_question_model->get_one_by_ID($ID);
419
-			$options=$question->options();
420
-			if(! empty($options)){
421
-				foreach($options as $option_ID=>$option){
422
-					$option_req_index=$this->_get_option_req_data_index($option_ID);
423
-					if($option_req_index!==FALSE){
418
+			$question = $this->_question_model->get_one_by_ID($ID);
419
+			$options = $question->options();
420
+			if ( ! empty($options)) {
421
+				foreach ($options as $option_ID=>$option) {
422
+					$option_req_index = $this->_get_option_req_data_index($option_ID);
423
+					if ($option_req_index !== FALSE) {
424 424
 						$option->save($this->_req_data['question_options'][$option_req_index]);
425
-					}else{
425
+					} else {
426 426
 						//not found, remove it
427 427
 						$option->delete();
428 428
 					}
429 429
 				}
430 430
 			}
431 431
 			//save new related options
432
-			foreach($this->_req_data['question_options'] as $index=>$option_req_data){
433
-				if( empty($option_req_data['QSO_ID'] ) && (  ( isset( $option_req_data['QSO_value'] ) && $option_req_data['QSO_value'] !== '' ) || ! empty( $option_req_data['QSO_desc'] ) ) ) {//no ID! save it!
434
-					if( ! isset( $option_req_data['QSO_value'] ) || $option_req_data['QSO_value'] === ''  ){
435
-						$option_req_data['QSO_value']=$option_req_data['QSO_desc'];
432
+			foreach ($this->_req_data['question_options'] as $index=>$option_req_data) {
433
+				if (empty($option_req_data['QSO_ID']) && ((isset($option_req_data['QSO_value']) && $option_req_data['QSO_value'] !== '') || ! empty($option_req_data['QSO_desc']))) {//no ID! save it!
434
+					if ( ! isset($option_req_data['QSO_value']) || $option_req_data['QSO_value'] === '') {
435
+						$option_req_data['QSO_value'] = $option_req_data['QSO_desc'];
436 436
 					}
437
-					$new_option=EE_Question_Option::new_instance( array( 'QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID()));
437
+					$new_option = EE_Question_Option::new_instance(array('QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID()));
438 438
 					$new_option->save();
439 439
 				}
440 440
 			}
441 441
 		}
442
-		$query_args = array( 'action' => 'edit_question', 'QST_ID' => $ID );
443
-		if ( $success !== FALSE ) {
444
-			$msg = $new_question ? sprintf( __('The %s has been created', 'event_espresso'), $this->_question_model->item_name() ) : sprintf( __('The %s has been updated', 'event_espresso' ), $this->_question_model->item_name() );
445
-			EE_Error::add_success( $msg );
442
+		$query_args = array('action' => 'edit_question', 'QST_ID' => $ID);
443
+		if ($success !== FALSE) {
444
+			$msg = $new_question ? sprintf(__('The %s has been created', 'event_espresso'), $this->_question_model->item_name()) : sprintf(__('The %s has been updated', 'event_espresso'), $this->_question_model->item_name());
445
+			EE_Error::add_success($msg);
446 446
 		}
447 447
 
448
-		$this->_redirect_after_action( FALSE, '', $action_desc, $query_args, TRUE);
448
+		$this->_redirect_after_action(FALSE, '', $action_desc, $query_args, TRUE);
449 449
 	}
450 450
 
451 451
 
@@ -458,10 +458,10 @@  discard block
 block discarded – undo
458 458
 	 * @param int $ID of the question option to find
459 459
 	 * @return int index in question_options array if successful, FALSE if unsuccessful
460 460
 	 */
461
-	protected function _get_option_req_data_index($ID){
462
-		$req_data_for_question_options=$this->_req_data['question_options'];
463
-		foreach($req_data_for_question_options as $num=>$option_data){
464
-			if(array_key_exists('QSO_ID',$option_data) && intval($option_data['QSO_ID'])==$ID){
461
+	protected function _get_option_req_data_index($ID) {
462
+		$req_data_for_question_options = $this->_req_data['question_options'];
463
+		foreach ($req_data_for_question_options as $num=>$option_data) {
464
+			if (array_key_exists('QSO_ID', $option_data) && intval($option_data['QSO_ID']) == $ID) {
465 465
 				return $num;
466 466
 			}
467 467
 		}
@@ -482,25 +482,25 @@  discard block
 block discarded – undo
482 482
 	 * @param EEM_Base $model either EEM_Question or EEM_Question_Group
483 483
 	 * @return array lik EEM_Base::get_all's $query_params parameter
484 484
 	 */
485
-	protected function get_query_params($model, $per_page=10,$current_page=10){
485
+	protected function get_query_params($model, $per_page = 10, $current_page = 10) {
486 486
 		$query_params = array();
487
-		$offset=($current_page-1)*$per_page;
488
-		$query_params['limit']=array($offset,$per_page);
489
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
487
+		$offset = ($current_page - 1) * $per_page;
488
+		$query_params['limit'] = array($offset, $per_page);
489
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
490 490
 		$orderby_field = $model instanceof EEM_Question ? 'QST_ID' : 'QSG_order';
491 491
 		$field_to_order_by = empty($this->_req_data['orderby']) ? $orderby_field : $this->_req_data['orderby'];
492
-		$query_params['order_by']=array( $field_to_order_by => $order );
493
-		$search_string = array_key_exists('s',$this->_req_data) ? $this->_req_data['s'] : null;
494
-		if(! empty($search_string)){
495
-			if($model instanceof EEM_Question_Group){
496
-				$query_params[0]=array(
492
+		$query_params['order_by'] = array($field_to_order_by => $order);
493
+		$search_string = array_key_exists('s', $this->_req_data) ? $this->_req_data['s'] : null;
494
+		if ( ! empty($search_string)) {
495
+			if ($model instanceof EEM_Question_Group) {
496
+				$query_params[0] = array(
497 497
 					'OR'=>array(
498
-						'QSG_name'=>array('LIKE',"%$search_string%"),
499
-						'QSG_desc'=>array('LIKE',"%$search_string%"))
498
+						'QSG_name'=>array('LIKE', "%$search_string%"),
499
+						'QSG_desc'=>array('LIKE', "%$search_string%"))
500 500
 					);
501
-			}else{
502
-				$query_params[0]=array(
503
-					'QST_display_text'=>array('LIKE',"%$search_string%")
501
+			} else {
502
+				$query_params[0] = array(
503
+					'QST_display_text'=>array('LIKE', "%$search_string%")
504 504
 					);
505 505
 			}
506 506
 		}
@@ -542,13 +542,13 @@  discard block
 block discarded – undo
542 542
 
543 543
 
544 544
 
545
-	public function get_questions( $per_page=10,$current_page = 1, $count = FALSE ) {
545
+	public function get_questions($per_page = 10, $current_page = 1, $count = FALSE) {
546 546
 		$QST = EEM_Question::instance();
547 547
 		$query_params = $this->get_query_params($QST, $per_page, $current_page);
548
-		if ($count){
549
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
548
+		if ($count) {
549
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
550 550
 			$results = $QST->count($where);
551
-		}else{
551
+		} else {
552 552
 			$results = $QST->get_all($query_params);
553 553
 		}
554 554
 		return $results;
@@ -557,20 +557,20 @@  discard block
 block discarded – undo
557 557
 
558 558
 
559 559
 
560
-	public function get_trashed_questions( $per_page,$current_page = 1, $count = FALSE ) {
561
-		$query_params=$this->get_query_params(EEM_Question::instance(),$per_page,$current_page);
562
-		$where = isset( $query_params[0] ) ? array($query_params[0]) : array();
563
-		$questions=$count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params);
560
+	public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) {
561
+		$query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page);
562
+		$where = isset($query_params[0]) ? array($query_params[0]) : array();
563
+		$questions = $count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params);
564 564
 		return $questions;
565 565
 	}
566 566
 
567 567
 
568 568
 
569
-	public function get_question_groups( $per_page,$current_page = 1, $count = FALSE ) {
569
+	public function get_question_groups($per_page, $current_page = 1, $count = FALSE) {
570 570
 		/** @type EEM_Question_Group $questionGroupModel */
571
-		$questionGroupModel=EEM_Question_Group::instance();
572
-		$query_params=$this->get_query_params( $questionGroupModel, $per_page, $current_page );
573
-		$questionGroups=$questionGroupModel->get_all($query_params);//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
571
+		$questionGroupModel = EEM_Question_Group::instance();
572
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
573
+		$questionGroups = $questionGroupModel->get_all($query_params); //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
574 574
 		return $questionGroups;
575 575
 	}
576 576
 
@@ -587,36 +587,36 @@  discard block
 block discarded – undo
587 587
 
588 588
 		$this->_template_args['values'] = $this->_yes_no_values;
589 589
 
590
-		$this->_template_args['use_captcha'] = isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE;
591
-		$this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"': '';
590
+		$this->_template_args['use_captcha'] = isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE;
591
+		$this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"' : '';
592 592
 
593
-		$this->_template_args['recaptcha_publickey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : '';
594
-		$this->_template_args['recaptcha_privatekey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : '';
595
-		$this->_template_args['recaptcha_width'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_width ) ? absint( EE_Registry::instance()->CFG->registration->recaptcha_width ) : 500;
593
+		$this->_template_args['recaptcha_publickey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : '';
594
+		$this->_template_args['recaptcha_privatekey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : '';
595
+		$this->_template_args['recaptcha_width'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_width) ? absint(EE_Registry::instance()->CFG->registration->recaptcha_width) : 500;
596 596
 
597 597
 		$this->_template_args['recaptcha_theme_options'] = array(
598
-				array('id'  => 'red','text'=> __('Red', 'event_espresso')),
599
-				array('id'  => 'white','text'=> __('White', 'event_espresso')),
600
-				array('id'  => 'blackglass','text'=> __('Blackglass', 'event_espresso')),
601
-				array('id'  => 'clean','text'=> __('Clean', 'event_espresso'))
598
+				array('id'  => 'red', 'text'=> __('Red', 'event_espresso')),
599
+				array('id'  => 'white', 'text'=> __('White', 'event_espresso')),
600
+				array('id'  => 'blackglass', 'text'=> __('Blackglass', 'event_espresso')),
601
+				array('id'  => 'clean', 'text'=> __('Clean', 'event_espresso'))
602 602
 			);
603
-		$this->_template_args['recaptcha_theme'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->get_pretty( 'recaptcha_theme' ) : 'clean';
603
+		$this->_template_args['recaptcha_theme'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->get_pretty('recaptcha_theme') : 'clean';
604 604
 
605 605
 		$this->_template_args['recaptcha_language_options'] = array(
606
-				array('id'  => 'en','text'=> __('English', 'event_espresso')),
607
-				array('id'  => 'es','text'=> __('Spanish', 'event_espresso')),
608
-				array('id'  => 'nl','text'=> __('Dutch', 'event_espresso')),
609
-				array('id'  => 'fr','text'=> __('French', 'event_espresso')),
610
-				array('id'  => 'de','text'=> __('German', 'event_espresso')),
611
-				array('id'  => 'pt','text'=> __('Portuguese', 'event_espresso')),
612
-				array('id'  => 'ru','text'=> __('Russian', 'event_espresso')),
613
-				array('id'  => 'tr','text'=> __('Turkish', 'event_espresso'))
606
+				array('id'  => 'en', 'text'=> __('English', 'event_espresso')),
607
+				array('id'  => 'es', 'text'=> __('Spanish', 'event_espresso')),
608
+				array('id'  => 'nl', 'text'=> __('Dutch', 'event_espresso')),
609
+				array('id'  => 'fr', 'text'=> __('French', 'event_espresso')),
610
+				array('id'  => 'de', 'text'=> __('German', 'event_espresso')),
611
+				array('id'  => 'pt', 'text'=> __('Portuguese', 'event_espresso')),
612
+				array('id'  => 'ru', 'text'=> __('Russian', 'event_espresso')),
613
+				array('id'  => 'tr', 'text'=> __('Turkish', 'event_espresso'))
614 614
 			);
615
-		$this->_template_args['recaptcha_language'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en';
615
+		$this->_template_args['recaptcha_language'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en';
616 616
 
617
-		$this->_set_add_edit_form_tags( 'update_reg_form_settings' );
618
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
619
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'reg_form_settings.template.php', $this->_template_args, TRUE );
617
+		$this->_set_add_edit_form_tags('update_reg_form_settings');
618
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
619
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'reg_form_settings.template.php', $this->_template_args, TRUE);
620 620
 		$this->display_admin_page_with_sidebar();
621 621
 	}
622 622
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -10 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
@@ -328,10 +329,7 @@  discard block
 block discarded – undo
328 329
 			else if ( $fieldName == 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] )  )) {
329 330
 				$QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ;
330 331
 				$set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10));
331
-			}
332
-
333
-
334
-			else if ( $fieldName == 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) {
332
+			} else if ( $fieldName == 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) {
335 333
 				$set_column_values[$fieldName] = 0;
336 334
 			}
337 335
 
@@ -366,7 +364,7 @@  discard block
 block discarded – undo
366 364
 			$question=$this->_question_model->get_one_by_ID($ID);
367 365
 			$additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID));
368 366
 			$this->_set_add_edit_form_tags('update_question', $additional_hidden_fields);
369
-		}else{
367
+		} else{
370 368
 			$question= EE_Question::new_instance();
371 369
 			$question->set_order_to_latest();
372 370
 			$this->_set_add_edit_form_tags('insert_question');
@@ -401,7 +399,7 @@  discard block
 block discarded – undo
401 399
 			$ID=$this->_question_model->insert($set_column_values);
402 400
 			$success = $ID ? true : false;
403 401
 			$action_desc = 'added';
404
-		}else{
402
+		} else{
405 403
 			$ID=absint($this->_req_data['QST_ID']);
406 404
 			$pk=$this->_question_model->primary_key_name();
407 405
 			$wheres=array($pk=>$ID);
@@ -422,7 +420,7 @@  discard block
 block discarded – undo
422 420
 					$option_req_index=$this->_get_option_req_data_index($option_ID);
423 421
 					if($option_req_index!==FALSE){
424 422
 						$option->save($this->_req_data['question_options'][$option_req_index]);
425
-					}else{
423
+					} else{
426 424
 						//not found, remove it
427 425
 						$option->delete();
428 426
 					}
@@ -498,7 +496,7 @@  discard block
 block discarded – undo
498 496
 						'QSG_name'=>array('LIKE',"%$search_string%"),
499 497
 						'QSG_desc'=>array('LIKE',"%$search_string%"))
500 498
 					);
501
-			}else{
499
+			} else{
502 500
 				$query_params[0]=array(
503 501
 					'QST_display_text'=>array('LIKE',"%$search_string%")
504 502
 					);
@@ -548,7 +546,7 @@  discard block
 block discarded – undo
548 546
 		if ($count){
549 547
 			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
550 548
 			$results = $QST->count($where);
551
-		}else{
549
+		} else{
552 550
 			$results = $QST->get_all($query_params);
553 551
 		}
554 552
 		return $results;
Please login to merge, or discard this patch.
registration_form/templates/questions_main_meta_box.template.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		<tbody>
22 22
 			<tr>
23 23
 				<th>
24
-					<label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info');?>
24
+					<label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info'); ?>
25 25
 				</th>
26 26
 				<td>
27 27
 					<input type="text" class="regular-text" id="QST_display_text" name="QST_display_text" value="<?php $question->f('QST_display_text')?>"/>
@@ -31,23 +31,23 @@  discard block
 block discarded – undo
31 31
 
32 32
 			<tr>
33 33
 				<th>
34
-					<label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info');?>
34
+					<label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info'); ?>
35 35
 				</th>
36 36
 				<td>
37 37
 					<?php
38
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
39
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
38
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
39
+						$id = ! empty($QST_system) ? '_disabled' : '';
40 40
 					?>
41 41
 					<input type="text" class="regular-text" id="QST_admin_label<?php echo $id?>" name="QST_admin_label<?php echo $id?>" value="<?php $question->f('QST_admin_label')?>"<?php echo $disabled?>/>
42 42
 					<input class="QST_order" type="hidden" id="QST_order<?php echo $id; ?>" name = "QST_order<?php echo $id; ?>" value="<?php echo $question->get('QST_order'); ?>" />
43
-					<?php if ( ! empty( $QST_system )) { ?>
43
+					<?php if ( ! empty($QST_system)) { ?>
44 44
 						<input type="hidden"  id="QST_admin_label" name="QST_admin_label" value="<?php echo $question->admin_label()?>"/>
45 45
 					<?php } ?>
46 46
 					<br/>
47 47
 					<p class="description">
48
-					<?php if ( ! empty( $QST_system )) { ?>
48
+					<?php if ( ! empty($QST_system)) { ?>
49 49
 					<span class="description" style="color:#D54E21;">
50
-						<?php _e('System question! This field cannot be changed.','event_espresso')?>
50
+						<?php _e('System question! This field cannot be changed.', 'event_espresso')?>
51 51
 					</span>
52 52
 					<?php } ?>
53 53
 
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
 
58 58
 			<tr>
59 59
 				<th>
60
-					<label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info');?>
60
+					<label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info'); ?>
61 61
 				</th>
62 62
 				<td>
63 63
 					<?php
64
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
65
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
64
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
65
+						$id = ! empty($QST_system) ? '_disabled' : '';
66 66
 						$admin_only = $question->get('QST_admin_only');
67
-						$checked = !empty( $admin_only ) ? ' checked="checked"' : '';
67
+						$checked = ! empty($admin_only) ? ' checked="checked"' : '';
68 68
 					?>
69 69
 					<input class="QST_admin_only" type="checkbox" id="QST_admin_only<?php echo $id; ?>" name = "QST_admin_only<?php echo $id; ?>" value="1"<?php echo $disabled; echo $checked; ?>/>
70 70
 					<br/>
71 71
 					<p class="description">
72
-					<?php if ( ! empty( $QST_system )) { ?>
72
+					<?php if ( ! empty($QST_system)) { ?>
73 73
 					<span class="description" style="color:#D54E21;">
74
-						<?php _e('System question! This field cannot be changed.','event_espresso')?>
74
+						<?php _e('System question! This field cannot be changed.', 'event_espresso')?>
75 75
 					</span>
76 76
 					<?php } ?>
77 77
 
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
 
82 82
 			<tr>
83 83
 				<th>
84
-					<label for="QST_type"><?php echo $fields['QST_type']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info');?>
84
+					<label for="QST_type"><?php echo $fields['QST_type']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info'); ?>
85 85
 				</th>
86 86
 				<td>
87 87
 					<?php
88
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
89
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
90
-						echo EEH_Form_Fields::select_input( 'QST_type' . $id, $question_types, $question->type(), 'id="QST_type' . $id . '"' . $disabled );
91
-						if( ! empty( $QST_system ) ) { ?>
88
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
89
+						$id = ! empty($QST_system) ? '_disabled' : '';
90
+						echo EEH_Form_Fields::select_input('QST_type'.$id, $question_types, $question->type(), 'id="QST_type'.$id.'"'.$disabled);
91
+						if ( ! empty($QST_system)) { ?>
92 92
 							<input type="hidden"  id="QST_type" name="QST_type" value="<?php echo $question->type()?>"/>
93 93
 						<?php
94
-							$explanatory_text = __('System question! This field cannot be changed.','event_espresso');
95
-						}else{
96
-							$explanatory_text = __('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.','event_espresso');
94
+							$explanatory_text = __('System question! This field cannot be changed.', 'event_espresso');
95
+						} else {
96
+							$explanatory_text = __('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.', 'event_espresso');
97 97
 						}
98
-						if ( ! empty( $QST_system ) || $has_answers ) { ?>
98
+						if ( ! empty($QST_system) || $has_answers) { ?>
99 99
 							<p><span class="description" style="color:#D54E21;">
100 100
 								<?php echo $explanatory_text; ?>
101 101
 							</span></p>
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 			<tr id="question_options">
110 110
 				<th>
111 111
 					<label>
112
-						<?php _e('Answer Options','event_espresso')?>
112
+						<?php _e('Answer Options', 'event_espresso')?>
113 113
 					</label>
114 114
 				</th>
115 115
 				<td>
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 						<thead>
119 119
 							<tr>
120 120
 								<th class="option-value-header">
121
-									<?php _e('Value','event_espresso')?>
121
+									<?php _e('Value', 'event_espresso')?>
122 122
 								</th>
123 123
 								<th class="option-desc-header">
124
-									<?php _e('Description (optional, only shown on registration form)','event_espresso')?>
124
+									<?php _e('Description (optional, only shown on registration form)', 'event_espresso')?>
125 125
 								</th>
126 126
 								<th>
127 127
 								</th>
@@ -144,17 +144,17 @@  discard block
 block discarded – undo
144 144
 							</tr>
145 145
 
146 146
 							<?php
147
-							$count=0;
147
+							$count = 0;
148 148
 							$question_options = $question->options();
149
-							if ( ! empty( $question_options )) {
150
-								foreach( $question_options as $option_id => $option ) {
151
-									$disabled =  $has_answers || $option->get('QSO_system') ? ' disabled="disabled"'  : '';
149
+							if ( ! empty($question_options)) {
150
+								foreach ($question_options as $option_id => $option) {
151
+									$disabled = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : '';
152 152
 							?>
153 153
 								<tr class="question-option ee-options-sortable">
154 154
 									<td class="option-value-cell">
155 155
 										<input type="hidden" class="QSO_order" name="question_options[<?php echo $count; ?>][QSO_order]" value="<?php echo $count; ?>">
156 156
 										<input type="text" class="option-value regular-text" name="question_options[<?php echo $count?>][QSO_value]" value="<?php  $option->f('QSO_value')?>"<?php echo $disabled; ?>>
157
-										<?php if ( $has_answers ) : ?>
157
+										<?php if ($has_answers) : ?>
158 158
 											<input type="hidden" name="question_options[<?php echo $count; ?>][QSO_value]" value="<?php echo $option->f('QSO_value'); ?>" >
159 159
 										<?php endif; ?>
160 160
 									</td>
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 										<input type="text" class="option-desc regular-text" name="question_options[<?php echo $count?>][QSO_desc]" value="<?php $option->f('QSO_desc')?>">
163 163
 									</td>
164 164
 									<td>
165
-										<?php if ( ! $option->system() ) { ?>
165
+										<?php if ( ! $option->system()) { ?>
166 166
 											<span class="dashicons clickable dashicons-post-trash ee-icon-size-18 remove-option remove-item"></span>
167 167
 										<?php } ?>
168 168
 										<span class="dashicons dashicons-image-flip-vertical sortable-drag-handle ee-icon-size-18"></span>
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
 					</table>
202 202
 
203 203
 					<a id="new-question-option" class="button" style="margin:0 0 1em 3px;">
204
-						<?php _e('Add Another Answer Option','event_espresso')?>
204
+						<?php _e('Add Another Answer Option', 'event_espresso')?>
205 205
 					</a><br/>
206 206
 
207 207
 					<p class="description">
208
-						<?php _e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.','event_espresso')?>
208
+						<?php _e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.', 'event_espresso')?>
209 209
 					</p>
210
-					<?php if ( $has_answers ) : ?>
210
+					<?php if ($has_answers) : ?>
211 211
 					<p class="description" style="color:#D54E21;">
212 212
 							<?php _e('Answer values that are uneditable are this way because there are registrations in the database that have answers for this question.  If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes.  This will ensure that the existing registrations that chose the original answer will preserve that answer.', 'event_espresso'); ?>
213 213
 					</p>
@@ -218,32 +218,32 @@  discard block
 block discarded – undo
218 218
 
219 219
 			<tr>
220 220
 				<th>
221
-					<label for="QST_required"><?php echo $fields['QST_required']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info');?>
221
+					<label for="QST_required"><?php echo $fields['QST_required']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info'); ?>
222 222
 				</th>
223 223
 				<td>
224 224
 					<?php
225
-					$system_required = array( 'fname', 'email' );
226
-					$disabled = in_array( $QST_system, $system_required ) ? ' disabled="disabled"' : '';
225
+					$system_required = array('fname', 'email');
226
+					$disabled = in_array($QST_system, $system_required) ? ' disabled="disabled"' : '';
227 227
 					$required_on = $question->get('QST_admin_only');
228 228
 					$show_required_msg = $required_on ? '' : ' display:none;';
229
-					$disabled = $required_on || ! empty( $disabled ) ? ' disabled="disabled"' : '';
230
-					$id =  ! empty( $disabled ) && in_array( $QST_system, $system_required) ? '_disabled' : '';
231
-					$requiredOptions=array(
232
-						array('text'=>'Optional','id'=>0),
233
-						array('text'=>'Required','id'=>1)
229
+					$disabled = $required_on || ! empty($disabled) ? ' disabled="disabled"' : '';
230
+					$id = ! empty($disabled) && in_array($QST_system, $system_required) ? '_disabled' : '';
231
+					$requiredOptions = array(
232
+						array('text'=>'Optional', 'id'=>0),
233
+						array('text'=>'Required', 'id'=>1)
234 234
 					);
235
-					echo EEH_Form_Fields::select_input('QST_required' . $id, $requiredOptions, $question->required(), 'id="QST_required' . $id . '"' . $disabled );
235
+					echo EEH_Form_Fields::select_input('QST_required'.$id, $requiredOptions, $question->required(), 'id="QST_required'.$id.'"'.$disabled);
236 236
 					?>
237 237
 						<p><span id="required_toggled_on" class="description" style="color:#D54E21;<?php echo $show_required_msg; ?>">
238
-						<?php _e('Required is set to optional, and this field is disabled, because the question is Admin-Only.','event_espresso')?>
238
+						<?php _e('Required is set to optional, and this field is disabled, because the question is Admin-Only.', 'event_espresso')?>
239 239
 						</span></p>
240 240
 						<p><span id="required_toggled_off" class="description" style="color:#D54E21; display: none;">
241
-							<?php _e('Required option field is no longer disabled because the question is not Admin-Only','event_espresso')?>
241
+							<?php _e('Required option field is no longer disabled because the question is not Admin-Only', 'event_espresso')?>
242 242
 						</span></p>
243
-					<?php if ( ! empty( $disabled ) && in_array( $QST_system, $system_required ) ) { ?>
243
+					<?php if ( ! empty($disabled) && in_array($QST_system, $system_required)) { ?>
244 244
 						<input type="hidden"  id="QST_required" name="QST_required" value="1"/>
245 245
 						<p><span class="description" style="color:#D54E21;">
246
-						<?php _e('System question! This field cannot be changed.','event_espresso')?>
246
+						<?php _e('System question! This field cannot be changed.', 'event_espresso')?>
247 247
 					</span></p>
248 248
 					<?php } ?>
249 249
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 
253 253
 			<tr>
254 254
 				<th>
255
-					<label for="QST_required_text"><?php _e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info');?>
255
+					<label for="QST_required_text"><?php _e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info'); ?>
256 256
 				</th>
257 257
 				<td>
258 258
 					<input type="text" class="regular-text" id="QST_required_text" name="QST_required_text" value="<?php  $question->f('QST_required_text')?>"/>
Please login to merge, or discard this patch.
admin_pages/registrations/EE_Registrations_List_Table.class.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -332,12 +332,12 @@  discard block
 block discarded – undo
332 332
 	 * @param \EE_Registration $item
333 333
 	 * @return string
334 334
 	 */
335
-    function column_cb($item){
335
+	function column_cb($item){
336 336
 	/** checkbox/lock **/
337 337
 	$transaction = $item->get_first_related( 'Transaction' );
338 338
 	$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0;
339 339
 	return $payment_count > 0 ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) . '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() );
340
-    }
340
+	}
341 341
 
342 342
 
343 343
 
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	 */
372 372
 	function column__REG_date(EE_Registration $item){
373 373
 		$this->_set_related_details($item);
374
-       		 //Build row actions
374
+	   		 //Build row actions
375 375
 		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL );
376 376
 		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' );
377 377
 		$view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>';
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 		} else {
424 424
 			return __( 'There is no ticket on this registration', 'event_espresso' );
425 425
 		}
426
-    }
426
+	}
427 427
 
428 428
 
429 429
 
@@ -445,14 +445,14 @@  discard block
 block discarded – undo
445 445
 		$t = $item->get_first_related('Transaction');
446 446
 		$payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0;
447 447
 
448
-	    //append group count to name
449
-	    $link .= '&nbsp;' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());
448
+		//append group count to name
449
+		$link .= '&nbsp;' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());
450 450
 
451
-	    //append reg_code
452
-	    $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') );
451
+		//append reg_code
452
+		$link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') );
453 453
 
454
-	    //reg status text for accessibility
455
-	    $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
454
+		//reg status text for accessibility
455
+		$link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
456 456
 
457 457
 		//trash/restore/delete actions
458 458
 		$actions = array();
Please login to merge, or discard this patch.
Spacing   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -57,20 +57,20 @@  discard block
 block discarded – undo
57 57
 	 * @param \EE_Admin_Page $admin_page
58 58
 	 * @return EE_Registrations_List_Table
59 59
 	 */
60
-	function __construct( $admin_page ){
60
+	function __construct($admin_page) {
61 61
 
62
-		if ( ! empty( $_GET['event_id'] ) ) {
62
+		if ( ! empty($_GET['event_id'])) {
63 63
 			$extra_query_args = array();
64
-			foreach ( $admin_page->get_views() as $key => $view_details ) {
65
-				$extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] );
64
+			foreach ($admin_page->get_views() as $key => $view_details) {
65
+				$extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']);
66 66
 			}
67
-			$this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args );
67
+			$this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
68 68
 		}
69 69
 
70 70
 		parent::__construct($admin_page);
71 71
 		$this->_status = $this->_admin_page->get_registration_status_array();
72 72
 
73
-		EE_Registry::instance()->load_helper( 'Template' );
73
+		EE_Registry::instance()->load_helper('Template');
74 74
 	}
75 75
 
76 76
 
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	 * @return void
82 82
 	 */
83 83
 	protected function _setup_data() {
84
-		$this->_data = $this->_admin_page->get_registrations( $this->_per_page );
85
-		$this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE );
84
+		$this->_data = $this->_admin_page->get_registrations($this->_per_page);
85
+		$this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE);
86 86
 	}
87 87
 
88 88
 
@@ -101,36 +101,36 @@  discard block
 block discarded – undo
101 101
 			);
102 102
 
103 103
 
104
-		if ( isset( $_GET['event_id'] )) {
104
+		if (isset($_GET['event_id'])) {
105 105
 			$this->_columns = array(
106 106
 				'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
107
-				'_REG_ID' => __( 'ID', 'event_espresso' ),
108
-				'ATT_fname' => __( 'Name', 'event_espresso' ),
107
+				'_REG_ID' => __('ID', 'event_espresso'),
108
+				'ATT_fname' => __('Name', 'event_espresso'),
109 109
 				'ATT_email' =>  __('Email', 'event_espresso'),
110
-				'_REG_date' => __( 'Reg Date', 'event_espresso' ),
111
-				'PRC_amount' => __( 'TKT Price', 'event_espresso' ),
112
-				'_REG_final_price' => __( 'Final Price', 'event_espresso' ),
113
-				'TXN_total' => __( 'Total Txn', 'event_espresso' ),
110
+				'_REG_date' => __('Reg Date', 'event_espresso'),
111
+				'PRC_amount' => __('TKT Price', 'event_espresso'),
112
+				'_REG_final_price' => __('Final Price', 'event_espresso'),
113
+				'TXN_total' => __('Total Txn', 'event_espresso'),
114 114
 				'TXN_paid' => __('Paid', 'event_espresso'),
115
-				'actions' => __( 'Actions', 'event_espresso' )
115
+				'actions' => __('Actions', 'event_espresso')
116 116
 				);
117 117
 			$this->_bottom_buttons = array(
118 118
 					'report'=> array(
119 119
 					'route' => 'registrations_report',
120
-					'extra_request' => isset( $this->_req_data['event_id'] ) ? array('EVT_ID'=>$this->_req_data['event_id']) : NULL
120
+					'extra_request' => isset($this->_req_data['event_id']) ? array('EVT_ID'=>$this->_req_data['event_id']) : NULL
121 121
 				),
122 122
 			);
123 123
 		} else {
124 124
 			$this->_columns = array(
125 125
 				'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
126
-				'_REG_ID' => __( 'ID', 'event_espresso' ),
127
-				'ATT_fname' => __( 'Name', 'event_espresso' ),
128
-				'_REG_date' => __( 'TXN Date', 'event_espresso' ),
129
-				'event_name' => __( 'Event', 'event_espresso' ),
130
-					'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ),
131
-				'_REG_final_price' => __( 'Price', 'event_espresso' ),
132
-				'_REG_paid' => __( 'Paid', 'event_espresso' ),
133
-				'actions' => __( 'Actions', 'event_espresso' )
126
+				'_REG_ID' => __('ID', 'event_espresso'),
127
+				'ATT_fname' => __('Name', 'event_espresso'),
128
+				'_REG_date' => __('TXN Date', 'event_espresso'),
129
+				'event_name' => __('Event', 'event_espresso'),
130
+					'DTT_EVT_start' => __('Event Date', 'event_espresso'),
131
+				'_REG_final_price' => __('Price', 'event_espresso'),
132
+				'_REG_paid' => __('Paid', 'event_espresso'),
133
+				'actions' => __('Actions', 'event_espresso')
134 134
 			);
135 135
 			$this->_bottom_buttons = array(
136 136
 				'report_all'=> array(
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 		$this->_primary_column = '_REG_ID';
143 143
 
144 144
 		$this->_sortable_columns = array(
145
-			'_REG_date' => array( '_REG_date' => TRUE ),   //true means its already sorted
146
-			'ATT_fname' => array( 'ATT_fname' => FALSE ),
147
-			'event_name' => array( 'event_name' => FALSE ),
148
-			'DTT_EVT_start'	=> array( 'DTT_EVT_start' => FALSE ),
149
-			'_REG_ID' => array( '_REG_ID' => FALSE ),
145
+			'_REG_date' => array('_REG_date' => TRUE), //true means its already sorted
146
+			'ATT_fname' => array('ATT_fname' => FALSE),
147
+			'event_name' => array('event_name' => FALSE),
148
+			'DTT_EVT_start'	=> array('DTT_EVT_start' => FALSE),
149
+			'_REG_ID' => array('_REG_ID' => FALSE),
150 150
 		);
151 151
 
152 152
 		$this->_hidden_columns = array();
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
 
156 156
 
157 157
 
158
-	protected function _get_row_class( $item ) {
159
-		$class = parent::_get_row_class( $item );
158
+	protected function _get_row_class($item) {
159
+		$class = parent::_get_row_class($item);
160 160
 		//add status class
161
-		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
162
-		if ( $this->_has_checkbox_column ) {
161
+		$class .= ' ee-status-strip reg-status-'.$item->status_ID();
162
+		if ($this->_has_checkbox_column) {
163 163
 			$class .= ' has-checkbox-column';
164 164
 		}
165 165
 		return $class;
@@ -172,15 +172,15 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @param EE_Registration $registration
174 174
 	 */
175
-	protected function _set_related_details( EE_Registration $registration ) {
175
+	protected function _set_related_details(EE_Registration $registration) {
176 176
 
177
-		$transaction = $registration->get_first_related( 'Transaction' );
177
+		$transaction = $registration->get_first_related('Transaction');
178 178
 		$status = $transaction instanceof EE_Transaction ? $transaction->status_ID() : EEM_Transaction::failed_status_code;
179 179
 		$this->_transaction_details = array(
180 180
 			'transaction' => $transaction,
181 181
 			'status' => $status,
182 182
 			'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0,
183
-			'title_attr' => sprintf( __('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) )
183
+			'title_attr' => sprintf(__('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence'))
184 184
 			);
185 185
 
186 186
 		$event = $registration->event();
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 			'event' => $event,
190 190
 			'status' => $status,
191 191
 			'id' => $event instanceof EE_Event ? $event->ID() : 0,
192
-			'title_attr' => sprintf( __('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) )
192
+			'title_attr' => sprintf(__('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence'))
193 193
 			);
194 194
 	}
195 195
 
@@ -204,26 +204,26 @@  discard block
 block discarded – undo
204 204
 		$filters = array();
205 205
 
206 206
 		//todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.
207
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
207
+		EE_Registry::instance()->load_helper('Form_Fields');
208 208
 
209
-		$cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : '';
210
-		$cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1;
211
-		$reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : '';
209
+		$cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
210
+		$cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
211
+		$reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : '';
212 212
 
213
-		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category );
214
-		$filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category );
213
+		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
214
+		$filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
215 215
 
216 216
 		$status = array();
217
-		$status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') );
218
-		foreach ( $this->_status as $key => $value ) {
219
-			$status[] = array( 'id' => $key, 'text' => $value );
217
+		$status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso'));
218
+		foreach ($this->_status as $key => $value) {
219
+			$status[] = array('id' => $key, 'text' => $value);
220 220
 		}
221
-		if ( $this->_view != 'incomplete' ) {
222
-			$filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset( $this->_req_data['_reg_status'] ) ? strtoupper( sanitize_key( $this->_req_data['_reg_status'] )) : '' );
221
+		if ($this->_view != 'incomplete') {
222
+			$filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) : '');
223 223
 		}
224 224
 
225
-		if ( isset( $this->_req_data['event_id'] ) ) {
226
-			$filters[] = EEH_Form_Fields::hidden_input( 'event_id',  $this->_req_data['event_id'], 'reg_event_id' );
225
+		if (isset($this->_req_data['event_id'])) {
226
+			$filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id');
227 227
 		}
228 228
 
229 229
 		return $filters;
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
 		$this->_views['all']['count'] = $this->_total_registrations();
241 241
 		$this->_views['month']['count'] = $this->_total_registrations_this_month();
242 242
 		$this->_views['today']['count'] = $this->_total_registrations_today();
243
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) {
244
-			$this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' );
245
-			$this->_views['trash']['count'] = $this->_total_registrations( 'trash' );
243
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) {
244
+			$this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
245
+			$this->_views['trash']['count'] = $this->_total_registrations('trash');
246 246
 		}
247 247
 	}
248 248
 
@@ -254,23 +254,23 @@  discard block
 block discarded – undo
254 254
 	 * @param string $view
255 255
 	 * @return int
256 256
 	 */
257
-	protected function _total_registrations( $view = '' ){
257
+	protected function _total_registrations($view = '') {
258 258
 		$_where = array();
259
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
260
-		if( $EVT_ID ) {
259
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
260
+		if ($EVT_ID) {
261 261
 			$_where['EVT_ID'] = $EVT_ID;
262 262
 		}
263
-		switch ( $view ) {
263
+		switch ($view) {
264 264
 			case 'trash' :
265
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
265
+				return EEM_Registration::instance()->count_deleted(array($_where));
266 266
 				break;
267 267
 			case 'incomplete' :
268 268
 				$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
269 269
 				break;
270 270
 			default :
271
-				$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
271
+				$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
272 272
 		}
273
-		return EEM_Registration::instance()->count( array( $_where ));
273
+		return EEM_Registration::instance()->count(array($_where));
274 274
 	}
275 275
 
276 276
 
@@ -280,24 +280,24 @@  discard block
 block discarded – undo
280 280
 	 * @access protected
281 281
 	 * @return int
282 282
 	 */
283
-	protected function _total_registrations_this_month(){
284
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
285
-		$_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();
283
+	protected function _total_registrations_this_month() {
284
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
285
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
286 286
 		$this_year_r = date('Y', current_time('timestamp'));
287 287
 		$time_start = ' 00:00:00';
288 288
 		$time_end = ' 23:59:59';
289 289
 		$this_month_r = date('m', current_time('timestamp'));
290
-		$days_this_month = date( 't', current_time('timestamp') );
290
+		$days_this_month = date('t', current_time('timestamp'));
291 291
 		//setup date query.
292
-		$beginning_string = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' );
293
-		$end_string = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' );
294
-		$_where['REG_date']= array('BETWEEN',
292
+		$beginning_string = EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s');
293
+		$end_string = EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s');
294
+		$_where['REG_date'] = array('BETWEEN',
295 295
 			array(
296 296
 				$beginning_string,
297 297
 				$end_string
298 298
 		));
299
-		$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
300
-		return EEM_Registration::instance()->count(array( $_where ) );
299
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
300
+		return EEM_Registration::instance()->count(array($_where));
301 301
 	}
302 302
 
303 303
 
@@ -307,20 +307,20 @@  discard block
 block discarded – undo
307 307
 	 * @access protected
308 308
 	 * @return int
309 309
 	 */
310
-	protected function _total_registrations_today(){
310
+	protected function _total_registrations_today() {
311 311
 
312
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
313
-		$_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();
312
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
313
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
314 314
 		$current_date = date('Y-m-d', current_time('timestamp'));
315 315
 		$time_start = ' 00:00:00';
316 316
 		$time_end = ' 23:59:59';
317
-		$_where['REG_date']= array('BETWEEN',
317
+		$_where['REG_date'] = array('BETWEEN',
318 318
 			array(
319
-				EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ),
320
-				EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' )
319
+				EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'),
320
+				EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s')
321 321
 		));
322
-		$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
323
-		return EEM_Registration::instance()->count(array( $_where ) );
322
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
323
+		return EEM_Registration::instance()->count(array($_where));
324 324
 	}
325 325
 
326 326
 
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
 	 * @param \EE_Registration $item
333 333
 	 * @return string
334 334
 	 */
335
-    function column_cb($item){
335
+    function column_cb($item) {
336 336
 	/** checkbox/lock **/
337
-	$transaction = $item->get_first_related( 'Transaction' );
338
-	$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0;
339
-	return $payment_count > 0 ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) . '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() );
337
+	$transaction = $item->get_first_related('Transaction');
338
+	$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0;
339
+	return $payment_count > 0 ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()).'<span class="ee-lock-icon"></span>' : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID());
340 340
     }
341 341
 
342 342
 
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 	 * @param \EE_Registration $item
349 349
 	 * @return string
350 350
 	 */
351
-	function column__REG_ID(EE_Registration $item){
351
+	function column__REG_ID(EE_Registration $item) {
352 352
 		$attendee = $item->attendee();
353 353
 		$content = $item->ID();
354 354
 		$content .= '<div class="show-on-mobile-view-only">';
355 355
 		$content .= '<br>';
356 356
 		$content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
357
-		$content .= '&nbsp;' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());
358
-		$content .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') );
357
+		$content .= '&nbsp;'.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
358
+		$content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
359 359
 		$content .= '</div>';
360 360
 		return $content;
361 361
 	}
@@ -369,12 +369,12 @@  discard block
 block discarded – undo
369 369
 	 * @param \EE_Registration $item
370 370
 	 * @return string
371 371
 	 */
372
-	function column__REG_date(EE_Registration $item){
372
+	function column__REG_date(EE_Registration $item) {
373 373
 		$this->_set_related_details($item);
374 374
        		 //Build row actions
375
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL );
376
-		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' );
377
-		$view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>';
375
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL);
376
+		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date');
377
+		$view_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence').'</span>';
378 378
 		return $view_link;
379 379
 	}
380 380
 
@@ -387,18 +387,18 @@  discard block
 block discarded – undo
387 387
 	 * @param \EE_Registration $item
388 388
 	 * @return string
389 389
 	 */
390
-	function column_event_name(EE_Registration $item){
391
-		$this->_set_related_details( $item );
390
+	function column_event_name(EE_Registration $item) {
391
+		$this->_set_related_details($item);
392 392
 		// page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62
393
-		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$item->event_ID() ), EVENTS_ADMIN_URL );
393
+		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$item->event_ID()), EVENTS_ADMIN_URL);
394 394
 		$event_name = $item->event_name();
395 395
 		$event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso');
396
-		$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID() ) ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr( $this->_event_details['title_attr'] ) .'">' .  wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ) ;
396
+		$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID()) ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...');
397 397
 
398
-		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'event_id'=>$item->event_ID() ), REG_ADMIN_URL );
399
-		$actions['event_filter'] = '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Filter this list to only show registrations for %s', 'event_espresso' ), $event_name ) .'">' .  __( 'View Registrations', 'event_espresso' ) . '</a>';
398
+		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id'=>$item->event_ID()), REG_ADMIN_URL);
399
+		$actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), $event_name).'">'.__('View Registrations', 'event_espresso').'</a>';
400 400
 
401
-		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) );
401
+		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
402 402
 	}
403 403
 
404 404
 
@@ -410,18 +410,18 @@  discard block
 block discarded – undo
410 410
 	 * @param \EE_Registration $item
411 411
 	 * @return string
412 412
 	 */
413
-   	function column_DTT_EVT_start(EE_Registration $item){
413
+   	function column_DTT_EVT_start(EE_Registration $item) {
414 414
 		$datetime_strings = array();
415
-		$ticket = $item->ticket( TRUE );
416
-		if ( $ticket instanceof EE_Ticket ) {
415
+		$ticket = $item->ticket(TRUE);
416
+		if ($ticket instanceof EE_Ticket) {
417 417
 			$remove_defaults = array('default_where_conditions' => 'none');
418 418
 			$datetimes = $ticket->datetimes($remove_defaults);
419
-			foreach($datetimes as $datetime){
420
-				$datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' );
419
+			foreach ($datetimes as $datetime) {
420
+				$datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start');
421 421
 			}
422
-			return implode("<br />",$datetime_strings);
422
+			return implode("<br />", $datetime_strings);
423 423
 		} else {
424
-			return __( 'There is no ticket on this registration', 'event_espresso' );
424
+			return __('There is no ticket on this registration', 'event_espresso');
425 425
 		}
426 426
     }
427 427
 
@@ -434,45 +434,45 @@  discard block
 block discarded – undo
434 434
 	 * @param \EE_Registration $item
435 435
 	 * @return string
436 436
 	 */
437
-   	function column_ATT_fname(EE_Registration $item){
437
+   	function column_ATT_fname(EE_Registration $item) {
438 438
    		$attendee = $item->attendee();
439 439
 
440
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
440
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
441 441
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
442
-		$link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' : $attendee_name;
442
+		$link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' : $attendee_name;
443 443
 		$link .= $item->count() == 1 ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : '';
444 444
 
445 445
 		$t = $item->get_first_related('Transaction');
446 446
 		$payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0;
447 447
 
448 448
 	    //append group count to name
449
-	    $link .= '&nbsp;' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());
449
+	    $link .= '&nbsp;'.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
450 450
 
451 451
 	    //append reg_code
452
-	    $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') );
452
+	    $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
453 453
 
454 454
 	    //reg status text for accessibility
455
-	    $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
455
+	    $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
456 456
 
457 457
 		//trash/restore/delete actions
458 458
 		$actions = array();
459
-		if ( $this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) {
460
-			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
461
-			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>';
462
-		} elseif ( $this->_view == 'trash' ) {
459
+		if ($this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) {
460
+			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
461
+			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>';
462
+		} elseif ($this->_view == 'trash') {
463 463
 			// restore registration link
464
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) {
465
-				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
466
-				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>';
464
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) {
465
+				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
466
+				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
467 467
 			}
468
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) {
469
-				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
468
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) {
469
+				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
470 470
 
471
-				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>';
471
+				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>';
472 472
 			}
473 473
 		}
474 474
 
475
-		return sprintf('%1$s %2$s', $link, $this->row_actions($actions) );
475
+		return sprintf('%1$s %2$s', $link, $this->row_actions($actions));
476 476
 	}
477 477
 
478 478
 
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 	 * @param \EE_Registration $item
485 485
 	 * @return string
486 486
 	 */
487
-	function column_ATT_email( EE_Registration $item ) {
487
+	function column_ATT_email(EE_Registration $item) {
488 488
 		$attendee = $item->get_first_related('Attendee');
489 489
 		return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email();
490 490
 	}
@@ -498,8 +498,8 @@  discard block
 block discarded – undo
498 498
 	 * @param \EE_Registration $item
499 499
 	 * @return string
500 500
 	 */
501
-	function column__REG_count(EE_Registration $item){
502
-		return  sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size());
501
+	function column__REG_count(EE_Registration $item) {
502
+		return  sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size());
503 503
 	}
504 504
 
505 505
 
@@ -511,16 +511,16 @@  discard block
 block discarded – undo
511 511
 	 * @param \EE_Registration $item
512 512
 	 * @return string
513 513
 	 */
514
-	function column_PRC_amount(EE_Registration $item){
514
+	function column_PRC_amount(EE_Registration $item) {
515 515
 		$ticket = $item->ticket();
516 516
 
517
-		$content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : '';
517
+		$content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : '';
518 518
 
519
-		if ( $item->final_price() > 0 ) {
520
-			$content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
519
+		if ($item->final_price() > 0) {
520
+			$content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
521 521
 		} else {
522 522
 			// free event
523
-			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>';
523
+			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>';
524 524
 		}
525 525
 
526 526
 		return $content;
@@ -536,11 +536,11 @@  discard block
 block discarded – undo
536 536
 	 * @param \EE_Registration $item
537 537
 	 * @return string
538 538
 	 */
539
-	function column__REG_final_price(EE_Registration $item){
539
+	function column__REG_final_price(EE_Registration $item) {
540 540
 		$ticket = $item->ticket();
541
-		$content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />';
541
+		$content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />';
542 542
 
543
-		$content .= '<span class="reg-pad-rght">' .  $item->pretty_final_price() . '</span>';
543
+		$content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
544 544
 		return $content;
545 545
 
546 546
 	}
@@ -554,8 +554,8 @@  discard block
 block discarded – undo
554 554
 	 * @param \EE_Registration $item
555 555
 	 * @return string
556 556
 	 */
557
-	function column__REG_paid(EE_Registration $item){
558
-		return '<span class="reg-pad-rght">' .  $item->pretty_paid() . '</span>';
557
+	function column__REG_paid(EE_Registration $item) {
558
+		return '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>';
559 559
 	}
560 560
 
561 561
 
@@ -567,11 +567,11 @@  discard block
 block discarded – undo
567 567
 	 * @param \EE_Registration $item
568 568
 	 * @return string
569 569
 	 */
570
-	function column_TXN_total(EE_Registration $item){
571
-		if($item->transaction()){
572
-			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
573
-			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">'  . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';
574
-		}else{
570
+	function column_TXN_total(EE_Registration $item) {
571
+		if ($item->transaction()) {
572
+			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
573
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>';
574
+		} else {
575 575
 			return __("None", "event_espresso");
576 576
 		}
577 577
 	}
@@ -585,15 +585,15 @@  discard block
 block discarded – undo
585 585
 	 * @param \EE_Registration $item
586 586
 	 * @return string
587 587
 	 */
588
-	function column_TXN_paid(EE_Registration $item){
588
+	function column_TXN_paid(EE_Registration $item) {
589 589
 
590
-		if ( $item->count() == 1 ) {
590
+		if ($item->count() == 1) {
591 591
 			$transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance();
592
-			if ( $transaction->paid() >= $transaction->total() ) {
592
+			if ($transaction->paid() >= $transaction->total()) {
593 593
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
594 594
 			} else {
595
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
596
-				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
595
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
596
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
597 597
 			}
598 598
 		}
599 599
 
@@ -614,44 +614,44 @@  discard block
 block discarded – undo
614 614
 		EE_Registry::instance()->load_helper('MSG_Template');
615 615
 		$attendee = $item->attendee();
616 616
 		$ticket = $item->ticket();
617
-		$this->_set_related_details( $item );
617
+		$this->_set_related_details($item);
618 618
 
619 619
 		//Build row actions
620
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
621
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL );
620
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
621
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL);
622 622
 
623 623
 		// page=attendees&event_admin_reports=resend_email&registration_id=43653465634&event_id=2&form_action=resend_email
624 624
 		//$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID );
625
-		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true );
625
+		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true);
626 626
 
627 627
 
628 628
 		//Build row actions
629
-		$view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '
629
+		$view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '
630 630
 			<li>
631
-			<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">
631
+			<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
632 632
 				<div class="dashicons dashicons-clipboard"></div>
633 633
 			</a>
634 634
 			</li>' : '';
635 635
 
636
-		$edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) &&  $attendee instanceof EE_Attendee ?'
636
+		$edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? '
637 637
 			<li>
638
-			<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text">
638
+			<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text">
639 639
 				<div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div>
640 640
 			</a>
641 641
 			</li>' : '';
642 642
 
643
-		 $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? '
643
+		 $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? '
644 644
 			<li>
645
-			<a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text">
645
+			<a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text">
646 646
 				<div class="dashicons dashicons-email-alt"></div>
647 647
 			</a>
648 648
 			</li>' : '';
649 649
 
650 650
 		// page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb
651
-		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL );
652
-		$view_txn_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? '
651
+		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL);
652
+		$view_txn_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? '
653 653
 			<li>
654
-			<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_txn_lnk_url.'"  title="' . $this->_transaction_details['title_attr'] . '" class="tiny-text">
654
+			<a class="ee-status-color-' . $this->_transaction_details['status'].'" href="'.$view_txn_lnk_url.'"  title="'.$this->_transaction_details['title_attr'].'" class="tiny-text">
655 655
 				<div class="dashicons dashicons-cart"></div>
656 656
 			</a>
657 657
 			</li>' : '';
@@ -659,10 +659,10 @@  discard block
 block discarded – undo
659 659
 		//invoice link
660 660
 		$dl_invoice_lnk_url = $item->invoice_url();
661 661
 		//only show invoice link if message type is active.
662
-		if ( $item->is_primary_registrant() && $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) {
662
+		if ($item->is_primary_registrant() && $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) {
663 663
 			$dl_invoice_lnk = '
664 664
 		<li>
665
-			<a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
665
+			<a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
666 666
 				<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
667 667
 			</a>
668 668
 		</li>';
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 			$dl_invoice_lnk = '';
671 671
 		}
672 672
 
673
-			return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk . $dl_invoice_lnk, $item, 'ul', 'reg-overview-actions-ul' );
673
+			return $this->_action_string($view_lnk.$edit_lnk.$resend_reg_lnk.$view_txn_lnk.$dl_invoice_lnk, $item, 'ul', 'reg-overview-actions-ul');
674 674
 	}
675 675
 
676 676
 }
Please login to merge, or discard this patch.
admin_pages/transactions/EE_Admin_Transactions_List_Table.class.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 	 * @param \EE_Admin_Page $admin_page
34 34
 	 * @return EE_Admin_Transactions_List_Table
35 35
 	 */
36
-	function __construct( EE_Admin_Page $admin_page ){
37
-   		parent::__construct( $admin_page );
36
+	function __construct(EE_Admin_Page $admin_page) {
37
+   		parent::__construct($admin_page);
38 38
    		$this->_status = $this->_admin_page->get_transaction_status_array();
39 39
 
40 40
 	}
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 
45 45
 
46 46
 	protected function _setup_data() {
47
-		$this->_data = $this->_admin_page->get_transactions( $this->_per_page );
48
-		$status = ! empty( $this->_req_data['status'] )? $this->_req_data['status'] : 'all';
49
-		$this->_all_data_count = $this->_admin_page->get_transactions( $this->_per_page, TRUE, $status );
47
+		$this->_data = $this->_admin_page->get_transactions($this->_per_page);
48
+		$status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all';
49
+		$this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, TRUE, $status);
50 50
 	}
51 51
 
52 52
 
@@ -65,20 +65,20 @@  discard block
 block discarded – undo
65 65
 			);
66 66
 
67 67
 		$this->_columns = array(
68
-			'TXN_ID' => __( 'ID', 'event_espresso' ),
69
-			'TXN_timestamp'	=> __( 'Transaction Date', 'event_espresso' ),
70
-			'TXN_total' => __( 'Total', 'event_espresso' ),
71
-			'TXN_paid' => __( 'Paid', 'event_espresso' ),
72
-			'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ),
73
-			'event_name' => __( 'Event', 'event_espresso' ),
74
-			'actions' => __( 'Actions', 'event_espresso' )
68
+			'TXN_ID' => __('ID', 'event_espresso'),
69
+			'TXN_timestamp'	=> __('Transaction Date', 'event_espresso'),
70
+			'TXN_total' => __('Total', 'event_espresso'),
71
+			'TXN_paid' => __('Paid', 'event_espresso'),
72
+			'ATT_fname' => __('Primary Registrant', 'event_espresso'),
73
+			'event_name' => __('Event', 'event_espresso'),
74
+			'actions' => __('Actions', 'event_espresso')
75 75
 		);
76 76
 
77 77
 		$this->_sortable_columns = array(
78
-			'TXN_ID' => array( 'TXN_ID' => FALSE ),
79
-			'event_name' => array( 'event_name'=> FALSE ),
80
-			'ATT_fname'	=> array( 'ATT_fname'=> FALSE ),
81
-			'TXN_timestamp'	=> array( 'TXN_timestamp'=> TRUE ) //true means its already sorted
78
+			'TXN_ID' => array('TXN_ID' => FALSE),
79
+			'event_name' => array('event_name'=> FALSE),
80
+			'ATT_fname'	=> array('ATT_fname'=> FALSE),
81
+			'TXN_timestamp'	=> array('TXN_timestamp'=> TRUE) //true means its already sorted
82 82
 		);
83 83
 
84 84
 		$this->_primary_column = 'TXN_ID';
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 
89 89
 
90 90
 
91
-	protected function _get_row_class( $item ) {
92
-		$class = parent::_get_row_class( $item );
91
+	protected function _get_row_class($item) {
92
+		$class = parent::_get_row_class($item);
93 93
 		//add status class
94
-		$class .= ' ee-status-strip txn-status-' . $item->status_ID();
95
-		if ( $this->_has_checkbox_column ) {
94
+		$class .= ' ee-status-strip txn-status-'.$item->status_ID();
95
+		if ($this->_has_checkbox_column) {
96 96
 			$class .= ' has-checkbox-column';
97 97
 		}
98 98
 		return $class;
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	protected function _get_table_filters() {
111 111
 		$filters = array();
112
-		$start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
113
-		$end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
112
+		$start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year'));
113
+		$end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y');
114 114
 		ob_start();
115 115
 		?>
116 116
 		<label for="txn-filter-start-date">Display Transactions from </label>
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 
129 129
 
130 130
 	protected function _add_view_counts() {
131
-		$this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' );
132
-		$this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' );
133
-		$this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' );
131
+		$this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all');
132
+		$this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned');
133
+		$this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed');
134 134
 	}
135 135
 
136 136
 
@@ -139,29 +139,29 @@  discard block
 block discarded – undo
139 139
 	 * @param \EE_Transaction $item
140 140
 	 * @return string
141 141
 	 */
142
-   function column_TXN_ID( EE_Transaction $item ){
143
-    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
144
-	   $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>';
142
+   function column_TXN_ID(EE_Transaction $item) {
143
+    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
144
+	   $content = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>';
145 145
 
146 146
 	   //txn timestamp
147
-	   $content .= '  <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp( $item ) . '</span>';
147
+	   $content .= '  <span class="show-on-mobile-view-only">'.$this->_get_txn_timestamp($item).'</span>';
148 148
 	   return $content;
149 149
 	}
150 150
 
151 151
 
152 152
 
153
-	protected function _get_txn_timestamp( EE_Transaction $item ) {
153
+	protected function _get_txn_timestamp(EE_Transaction $item) {
154 154
 		//txn timestamp
155 155
 		// is TXN less than 2 hours old ?
156 156
 		if (
157
-			( ( time() - EE_Registry::instance()->SSN->lifespan() )
158
-			< $item->datetime( false, true )
157
+			((time() - EE_Registry::instance()->SSN->lifespan())
158
+			< $item->datetime(false, true)
159 159
 			)
160
-		&& ( $item->failed() || $item->is_abandoned() )
160
+		&& ($item->failed() || $item->is_abandoned())
161 161
 		) {
162
-			$timestamp = __( 'TXN in progress...', 'event_espresso' );
162
+			$timestamp = __('TXN in progress...', 'event_espresso');
163 163
 	   } else {
164
-			$timestamp = $item->get_i18n_datetime( 'TXN_timestamp' );
164
+			$timestamp = $item->get_i18n_datetime('TXN_timestamp');
165 165
 		}
166 166
 		return $timestamp;
167 167
 	}
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @param \EE_Transaction $item
174 174
 	 * @return string
175 175
 	 */
176
-	function column_cb($item ){
177
-		return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'],  $item->ID());
176
+	function column_cb($item) {
177
+		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID());
178 178
 	}
179 179
 
180 180
 
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 	 * @param \EE_Transaction $item
186 186
 	 * @return string
187 187
 	 */
188
-	function column_TXN_timestamp( EE_Transaction $item ){
189
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
190
-		$txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $this->_get_txn_timestamp( $item ) . '</a>';
188
+	function column_TXN_timestamp(EE_Transaction $item) {
189
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
190
+		$txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$this->_get_txn_timestamp($item).'</a>';
191 191
 		//status
192
-		$txn_date .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
192
+		$txn_date .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
193 193
 		return $txn_date;
194 194
 	}
195 195
 
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	 * @param \EE_Transaction $item
200 200
 	 * @return string
201 201
 	 */
202
-	function column_TXN_total( EE_Transaction $item ){
203
-		if ( $item->get('TXN_total') > 0 ) {
204
-			return '<span class="txn-pad-rght">' . apply_filters( 'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item ) . '</span>';
202
+	function column_TXN_total(EE_Transaction $item) {
203
+		if ($item->get('TXN_total') > 0) {
204
+			return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item).'</span>';
205 205
 		} else {
206
-			return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>';
206
+			return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>';
207 207
 		}
208 208
 	}
209 209
 
@@ -213,19 +213,19 @@  discard block
 block discarded – undo
213 213
 	 * @param \EE_Transaction $item
214 214
 	 * @return mixed|string
215 215
 	 */
216
-	function column_TXN_paid( EE_Transaction $item ){
216
+	function column_TXN_paid(EE_Transaction $item) {
217 217
 		$transaction_total = $item->get('TXN_total');
218 218
 		$transaction_paid = $item->get('TXN_paid');
219 219
 
220
-		if (( $transaction_total > 0 ) && ( $transaction_paid >= $transaction_total )) {
220
+		if (($transaction_total > 0) && ($transaction_paid >= $transaction_total)) {
221 221
 			// paid in full
222 222
 			$span_class = 'txn-overview-full-payment-spn';
223 223
 
224
-		} elseif (( $transaction_total > 0 ) && ( $transaction_paid > 0 )) {
224
+		} elseif (($transaction_total > 0) && ($transaction_paid > 0)) {
225 225
 			// monies owing
226 226
 			$span_class = 'txn-overview-part-payment-spn';
227 227
 
228
-		} elseif (( $transaction_total > 0 ) && ( $transaction_paid == 0 )) {
228
+		} elseif (($transaction_total > 0) && ($transaction_paid == 0)) {
229 229
 			// no payments made
230 230
 			$span_class = 'txn-overview-no-payment-spn';
231 231
 
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
 		}
236 236
 
237 237
 		$payment_method = $item->payment_method();
238
-		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' );
238
+		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso');
239 239
 
240
-		$content = '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>';
241
-		if ( $transaction_paid > 0 ) {
242
-			$content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>';
240
+		$content = '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>';
241
+		if ($transaction_paid > 0) {
242
+			$content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>';
243 243
 		}
244 244
 		return $content;
245 245
 	}
@@ -250,13 +250,13 @@  discard block
 block discarded – undo
250 250
 	 * @param \EE_Transaction $item
251 251
 	 * @return string|void
252 252
 	 */
253
-	function column_ATT_fname( EE_Transaction $item ){
253
+	function column_ATT_fname(EE_Transaction $item) {
254 254
 		$primary_reg = $item->primary_registration();
255 255
 		$attendee = $primary_reg->get_first_related('Attendee');
256
-		if ( $attendee instanceof EE_Attendee ) {
257
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL );
258
-			$content = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee->full_name() . '</a>' : $attendee->full_name();
259
-			$content .= '<br>' . $attendee->email();
256
+		if ($attendee instanceof EE_Attendee) {
257
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL);
258
+			$content = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name();
259
+			$content .= '<br>'.$attendee->email();
260 260
 			return $content;
261 261
 		}
262 262
 		return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso');
@@ -268,10 +268,10 @@  discard block
 block discarded – undo
268 268
 	 * @param \EE_Transaction $item
269 269
 	 * @return string|void
270 270
 	 */
271
-	function column_ATT_email( EE_Transaction $item ){
271
+	function column_ATT_email(EE_Transaction $item) {
272 272
 		$attendee = $item->primary_registration()->get_first_related('Attendee');
273
-		if ( !empty( $attendee ) )
274
-			return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>';
273
+		if ( ! empty($attendee))
274
+			return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>';
275 275
 		else
276 276
 			return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso');
277 277
 		;
@@ -283,20 +283,20 @@  discard block
 block discarded – undo
283 283
 	 * @param \EE_Transaction $item
284 284
 	 * @return string|void
285 285
 	 */
286
-    function column_event_name( EE_Transaction $item ){
286
+    function column_event_name(EE_Transaction $item) {
287 287
     	$actions = array();
288 288
 		$event = $item->primary_registration()->get_first_related('Event');
289
-		if ( !empty( $event ) ) {
290
-			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL );
289
+		if ( ! empty($event)) {
290
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL);
291 291
 			$event_name = $event->get('EVT_name');
292 292
 
293 293
 			//filter this view by transactions for this event
294
-			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) );
295
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) {
296
-				$actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event', 'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>';
294
+			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID()));
295
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) {
296
+				$actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event', 'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>';
297 297
 			}
298 298
 
299
-			return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ? '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Edit Event: %s', 'event_espresso' ), $event->get('EVT_name') ) .'">' .  wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ), $this->row_actions($actions) );
299
+			return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s', 'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions));
300 300
 		} else {
301 301
 			return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso');
302 302
 		}
@@ -308,33 +308,33 @@  discard block
 block discarded – undo
308 308
 	 * @param \EE_Transaction $item
309 309
 	 * @return string
310 310
 	 */
311
-    function column_actions( EE_Transaction $item ){
311
+    function column_actions(EE_Transaction $item) {
312 312
 
313 313
     	$registration = $item->primary_registration();
314 314
     	$attendee = $registration->attendee();
315
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
315
+		EE_Registry::instance()->load_helper('MSG_Template');
316 316
 
317 317
         //Build row actions
318
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
318
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
319 319
 		$dl_invoice_lnk_url = $registration->invoice_url();
320 320
 		$dl_receipt_lnk_url = $registration->receipt_url();
321
-		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL );
322
-		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
321
+		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL);
322
+		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
323 323
 
324 324
 		//Build row actions
325 325
 		$view_lnk = '
326 326
 			<li>
327
-				<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text">
327
+				<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text">
328 328
 					<span class="dashicons dashicons-cart"></span>
329 329
 				</a>
330 330
 			</li>';
331 331
 
332 332
 
333 333
 	//only show invoice link if message type is active.
334
-	if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) {
334
+	if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) {
335 335
 		$dl_invoice_lnk = '
336 336
 		<li>
337
-			<a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
337
+			<a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
338 338
 				<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
339 339
 			</a>
340 340
 		</li>';
@@ -343,10 +343,10 @@  discard block
 block discarded – undo
343 343
 	}
344 344
 
345 345
 	//only show receipt link if message type is active.
346
-	if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) {
346
+	if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) {
347 347
 		$dl_receipt_lnk = '
348 348
 		<li>
349
-			<a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
349
+			<a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
350 350
 				<span class="dashicons dashicons-media-default ee-icon-size-18"></span>
351 351
 			</a>
352 352
 		</li>';
@@ -355,10 +355,10 @@  discard block
 block discarded – undo
355 355
 	}
356 356
 
357 357
       		//only show payment reminder link if the message type is active.
358
-      		if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
359
-		$send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? '
358
+      		if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
359
+		$send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder') ? '
360 360
 			<li>
361
-				<a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text">
361
+				<a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text">
362 362
 					<span class="dashicons dashicons-email-alt"></span>
363 363
 				</a>
364 364
 			</li>' : '';
@@ -367,14 +367,14 @@  discard block
 block discarded – undo
367 367
 			$send_pay_lnk = '';
368 368
 		}
369 369
 
370
-		$view_reg_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? '
370
+		$view_reg_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? '
371 371
 			<li>
372
-				<a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">
372
+				<a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
373 373
 					<span class="dashicons dashicons-clipboard"></span>
374 374
 				</a>
375 375
 			</li>' : '';
376 376
 
377
-	return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul' );
377
+	return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul');
378 378
     }
379 379
 
380 380
 
Please login to merge, or discard this patch.