Completed
Branch BUG-9548-transaction-completio... (b1c41e)
by
unknown
519:42 queued 503:28
created
admin/extend/messages/Custom_Messages_Template_List_Table.class.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 class Custom_Messages_Template_List_Table extends EE_Admin_List_Table {
31 31
 
32 32
 
33
-	public function __construct( $admin_page ) {
33
+	public function __construct($admin_page) {
34 34
 		//Set parent defaults
35 35
 		parent::__construct($admin_page);
36 36
 	}
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
 
41 41
 	protected function _setup_data() {
42
-		$this->_data = $this->_admin_page->get_message_templates( $this->_per_page, $this->_view, FALSE, FALSE, FALSE );
43
-		$this->_all_data_count = $this->_admin_page->get_message_templates( $this->_per_page, $this->_view, TRUE, TRUE, FALSE );
42
+		$this->_data = $this->_admin_page->get_message_templates($this->_per_page, $this->_view, FALSE, FALSE, FALSE);
43
+		$this->_all_data_count = $this->_admin_page->get_message_templates($this->_per_page, $this->_view, TRUE, TRUE, FALSE);
44 44
 	}
45 45
 
46 46
 
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 
50 50
 	protected function _set_properties() {
51 51
 		$this->_wp_list_args = array(
52
-			'singular' => __('Message Template Group', 'event_espresso' ),
53
-			'plural' => __('Message Template', 'event_espresso' ),
52
+			'singular' => __('Message Template Group', 'event_espresso'),
53
+			'plural' => __('Message Template', 'event_espresso'),
54 54
 			'ajax' => TRUE, //for now,
55 55
 			'screen' => $this->_admin_page->get_current_screen()->id
56 56
 			);
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
 			'cb' => '<input type="checkbox" />',
60 60
 			'name' => __('Template Name', 'event_espresso'),
61 61
 			'message_type' => __('Message Type', 'event_espresso'),
62
-			'messenger' => __( 'Messenger', 'event_espresso'),
63
-			'description' => __( 'Description', 'event_espresso' ),
64
-			'events' => __( 'Events', 'event_espresso'), //count of events using this template.
62
+			'messenger' => __('Messenger', 'event_espresso'),
63
+			'description' => __('Description', 'event_espresso'),
64
+			'events' => __('Events', 'event_espresso'), //count of events using this template.
65 65
 			'actions' => ''
66 66
 			//'messages_sent' => __( 'Total Sent', 'event_espresso' ) //todo this will come later when we've got message tracking in place.
67 67
 			);
68 68
 
69 69
 		$this->_sortable_columns = array(
70
-			'messenger' => array( 'MTP_messenger' => TRUE ),
70
+			'messenger' => array('MTP_messenger' => TRUE),
71 71
 			//'message_type' => array( 'MTP_message_type' => FALSE )
72 72
 			);
73 73
 
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return string
88 88
 	 */
89
-	public function single_row( $item ) {
89
+	public function single_row($item) {
90 90
 		$message_type = $item->message_type_obj();
91 91
 		$messenger = $item->messenger_obj();
92 92
 
93
-		if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger ) {
93
+		if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) {
94 94
 			echo '';
95 95
 			return;
96 96
 		}
97 97
 
98
-		parent::single_row( $item );
98
+		parent::single_row($item);
99 99
 	}
100 100
 
101 101
 
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
 
109 109
 
110 110
 		//setup messengers for selects
111
-		$i=1;
111
+		$i = 1;
112 112
 		$m_values[0]['id'] = 'all';
113
-		$m_values[0]['text'] = __('All Messengers', 'event_espresso' );
114
-		foreach ( $messengers as $messenger => $args ) {
113
+		$m_values[0]['text'] = __('All Messengers', 'event_espresso');
114
+		foreach ($messengers as $messenger => $args) {
115 115
 			$m_values[$i]['id'] = $messenger;
116 116
 			$m_values[$i]['text'] = ucwords($args['obj']->label['singular']);
117 117
 			$i++;
118 118
 		}
119
-		foreach ( $messengers as $messenger => $args ) {
119
+		foreach ($messengers as $messenger => $args) {
120 120
 			$m_values[$i]['id'] = $messenger;
121 121
 			$m_values[$i]['text'] = ucwords($args['obj']->label['singular']);
122 122
 			$i++;
123 123
 		}
124 124
 
125 125
 		//lets do the same for message types
126
-		$i=1;
127
-		foreach ( $message_types as $message_type => $args ) {
126
+		$i = 1;
127
+		foreach ($message_types as $message_type => $args) {
128 128
 			$mt_values[$i]['id'] = $message_type;
129 129
 			$mt_values[$i]['text'] = ucwords($args['obj']->label['singular']);
130 130
 			$i++;
@@ -140,28 +140,28 @@  discard block
 block discarded – undo
140 140
 			'text' => __('Show All', 'event_espresso')
141 141
 			);
142 142
 
143
-		$msgr_filters = !empty($m_values) ? array_merge( $msgr_default, $m_values ) : array();
144
-		$mt_filters = !empty($mt_values) ? array_merge( $mt_default, $mt_values ) : array();
143
+		$msgr_filters = ! empty($m_values) ? array_merge($msgr_default, $m_values) : array();
144
+		$mt_filters = ! empty($mt_values) ? array_merge($mt_default, $mt_values) : array();
145 145
 
146
-		if ( empty( $m_values ) )
146
+		if (empty($m_values))
147 147
 			$msgr_filters[0] = array(
148 148
 				'id' => 'no_messenger_options',
149 149
 				'text' => __('No Messengers active', 'event_espresso')
150 150
 				);
151 151
 
152
-		if ( empty($mt_values) )
152
+		if (empty($mt_values))
153 153
 			$mt_filters[0] = array(
154 154
 				'id' => 'no_message_type_options',
155 155
 				'text' => __('No Message Types active', 'event_espresso')
156 156
 				);
157 157
 
158
-		if ( count( $messengers ) >= 1  && !empty( $m_values ) ) {
159
-			unset( $msgr_filters[0] );
160
-			$msgr_filters = array_values( $msgr_filters ); //reindex keys
158
+		if (count($messengers) >= 1 && ! empty($m_values)) {
159
+			unset($msgr_filters[0]);
160
+			$msgr_filters = array_values($msgr_filters); //reindex keys
161 161
 		}
162 162
 
163
-		$filters[] = EEH_Form_Fields::select_input('ee_messenger_filter_by', $msgr_filters, isset($this->_req_data['ee_messenger_filter_by']) ? sanitize_key( $this->_req_data['ee_messenger_filter_by']) : '' );
164
-		$filters[] = EEH_Form_Fields::select_input('ee_message_type_filter_by', $mt_filters, isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_key( $this->_req_data['ee_message_type_filter_by']) : '');
163
+		$filters[] = EEH_Form_Fields::select_input('ee_messenger_filter_by', $msgr_filters, isset($this->_req_data['ee_messenger_filter_by']) ? sanitize_key($this->_req_data['ee_messenger_filter_by']) : '');
164
+		$filters[] = EEH_Form_Fields::select_input('ee_message_type_filter_by', $mt_filters, isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_key($this->_req_data['ee_message_type_filter_by']) : '');
165 165
 		return $filters;
166 166
 	}
167 167
 
@@ -169,14 +169,14 @@  discard block
 block discarded – undo
169 169
 	 * we're just removing the search box for message templates, not needed.
170 170
 	 * @return string (empty);
171 171
 	 */
172
-	function search_box( $text, $input_id ) {
172
+	function search_box($text, $input_id) {
173 173
 		return '';
174 174
 	}
175 175
 
176 176
 
177 177
 	protected function _add_view_counts() {
178
-		foreach ( $this->_views as $view => $args )  {
179
-			$this->_views[$view]['count'] = $this->_admin_page->get_message_templates( $this->_per_page, $view, TRUE, TRUE, FALSE );
178
+		foreach ($this->_views as $view => $args) {
179
+			$this->_views[$view]['count'] = $this->_admin_page->get_message_templates($this->_per_page, $view, TRUE, TRUE, FALSE);
180 180
 		}
181 181
 	}
182 182
 
@@ -190,16 +190,16 @@  discard block
 block discarded – undo
190 190
 	 * @return string
191 191
 	 */
192 192
 	public function no_items() {
193
-		if ( $this->_view !== 'trashed' )
194
-			printf( __('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>' );
193
+		if ($this->_view !== 'trashed')
194
+			printf(__('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>');
195 195
 		else
196 196
 			parent::no_items();
197 197
 	}
198 198
 
199 199
 
200 200
 
201
-	public function column_cb( $item ) {
202
-		return sprintf( '<input type="checkbox" name="checkbox[%s] value="1" />', $item->GRP_ID() );
201
+	public function column_cb($item) {
202
+		return sprintf('<input type="checkbox" name="checkbox[%s] value="1" />', $item->GRP_ID());
203 203
 	}
204 204
 
205 205
 
@@ -207,29 +207,29 @@  discard block
 block discarded – undo
207 207
 
208 208
 
209 209
 
210
-	function column_name( $item ) {
211
-		return '<p>' . $item->name() . '</p>';
210
+	function column_name($item) {
211
+		return '<p>'.$item->name().'</p>';
212 212
 	}
213 213
 
214 214
 
215 215
 
216 216
 
217
-	function column_description( $item ) {
218
-		return '<p>' . $item->description() . '</p>';
217
+	function column_description($item) {
218
+		return '<p>'.$item->description().'</p>';
219 219
 	}
220 220
 
221 221
 
222 222
 
223
-	function column_actions( $item ) {
224
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messages_add_new_message_template' ) ) {
223
+	function column_actions($item) {
224
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messages_add_new_message_template')) {
225 225
 			$create_args = array(
226 226
 				'GRP_ID' => $item->ID(),
227 227
 				'messenger' => $item->messenger(),
228 228
 				'message_type' => $item->message_type(),
229 229
 				'action' => 'add_new_message_template'
230 230
 				);
231
-			$create_link = EE_Admin_Page::add_query_args_and_nonce( $create_args, EE_MSG_ADMIN_URL );
232
-			return sprintf( '<p><a href="%s" class="button button-small">%s</a></p>', $create_link, __('Create Custom', 'event_espresso') );
231
+			$create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL);
232
+			return sprintf('<p><a href="%s" class="button button-small">%s</a></p>', $create_link, __('Create Custom', 'event_espresso'));
233 233
 		}
234 234
 		return '';
235 235
 	}
@@ -246,27 +246,27 @@  discard block
 block discarded – undo
246 246
 		$actions = array();
247 247
 
248 248
 		// edit link but only if item isn't trashed.
249
-		if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ) {
250
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_message_template', 'id'=>$item->GRP_ID() ), EE_MSG_ADMIN_URL );
251
-			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>';
249
+		if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID())) {
250
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID()), EE_MSG_ADMIN_URL);
251
+			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>';
252 252
 		}
253 253
 
254
-		$name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() )? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template', 'event_espresso' ) . '">' . ucwords( $item->messenger_obj()->label['singular'] ) . '</a>' : ucwords( $item->messenger_obj()->label['singular'] );
255
-		$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
254
+		$name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template', 'event_espresso').'">'.ucwords($item->messenger_obj()->label['singular']).'</a>' : ucwords($item->messenger_obj()->label['singular']);
255
+		$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL);
256 256
 		// restore link
257
-		$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
257
+		$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL);
258 258
 		// delete price link
259
-		$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
259
+		$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL);
260 260
 
261
-		if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_trash_message_template', $item->ID() ) ) {
262
-			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Move Template Group to Trash', 'event_espresso' ) . '">' . __( 'Move to Trash', 'event_espresso' ) . '</a>';
261
+		if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_trash_message_template', $item->ID())) {
262
+			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Move Template Group to Trash', 'event_espresso').'">'.__('Move to Trash', 'event_espresso').'</a>';
263 263
 		} else {
264
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_restore_message_template', $item->ID() ) ) {
265
-				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Message Template', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>';
264
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_restore_message_template', $item->ID())) {
265
+				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Message Template', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
266 266
 			}
267 267
 
268
-			if ( $this->_view == 'trashed' && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_delete_message_template', $item->ID() ) ) {
269
-				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Template Group Permanently', 'event_espresso' ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>';
268
+			if ($this->_view == 'trashed' && EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_delete_message_template', $item->ID())) {
269
+				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Template Group Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>';
270 270
 			}
271 271
 		}
272 272
 
@@ -275,15 +275,15 @@  discard block
 block discarded – undo
275 275
 		$c_configs = $item->contexts_config();
276 276
 		$ctxt = array();
277 277
 		$context_templates = $item->context_templates();
278
-		foreach ( $context_templates as $context => $template_fields ) {
279
-			$mtp_to = !empty( $context_templates[$context]['to'] ) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL;
280
-			$inactive = empty( $mtp_to ) && !empty( $context_templates[$context]['to'] ) ? ' class="mtp-inactive"' : '';
278
+		foreach ($context_templates as $context => $template_fields) {
279
+			$mtp_to = ! empty($context_templates[$context]['to']) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL;
280
+			$inactive = empty($mtp_to) && ! empty($context_templates[$context]['to']) ? ' class="mtp-inactive"' : '';
281 281
 			$context_title = ucwords($c_configs[$context]['label']);
282
-			$edit_link = EE_Admin_Page::add_query_args_and_nonce( array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL );
283
-			$ctxt[] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a' . $inactive . ' href="'. $edit_link . '" title="' . esc_attr__('Edit Context', 'event_espresso') . '">' . $context_title . '</a>' : $context_title;
282
+			$edit_link = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL);
283
+			$ctxt[] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a'.$inactive.' href="'.$edit_link.'" title="'.esc_attr__('Edit Context', 'event_espresso').'">'.$context_title.'</a>' : $context_title;
284 284
 		}
285 285
 
286
-		$ctx_content = !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? sprintf( __('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural']) ) . implode(' | ', $ctxt) : '';
286
+		$ctx_content = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? sprintf(__('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural'])).implode(' | ', $ctxt) : '';
287 287
 
288 288
 
289 289
 		//Return the name contents
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 										/* $1%s */ $name_link,
292 292
 										/* $2%s */ $item->GRP_ID(),
293 293
 										/* %4$s */ $ctx_content,
294
-										/* $3%s */ $this->row_actions( $actions )
294
+										/* $3%s */ $this->row_actions($actions)
295 295
 		);
296 296
 	}
297 297
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 	 * @return string       message_type name
313 313
 	 */
314 314
 	function column_message_type($item) {
315
-		return ucwords($item->message_type_obj()->label['singular'] );
315
+		return ucwords($item->message_type_obj()->label['singular']);
316 316
 	}
317 317
 
318 318
 
Please login to merge, or discard this patch.
admin/extend/messages/espresso_events_Messages_Hooks_Extend.class.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -30,15 +30,15 @@  discard block
 block discarded – undo
30 30
 class espresso_events_Messages_Hooks_Extend extends espresso_events_Messages_Hooks {
31 31
 
32 32
 
33
-	public function __construct( EE_Admin_Page $adminpage ) {
33
+	public function __construct(EE_Admin_Page $adminpage) {
34 34
 		/**
35 35
 		 * Add cap restriction ... metaboxes should not show if user does not have the ability to edit_custom_messages
36 36
 		 */
37
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'messages_events_editor_metabox' ) ) {
37
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'messages_events_editor_metabox')) {
38 38
 			return;
39 39
 		}
40
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
41
-		parent::__construct( $adminpage );
40
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
41
+		parent::__construct($adminpage);
42 42
 	}
43 43
 
44 44
 	/**
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	protected function _extend_properties() {
51 51
 
52
-		define( 'EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/' );
52
+		define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/');
53 53
 		$this->_ajax_func = array(
54 54
 			'ee_msgs_create_new_custom' => 'create_new_custom'
55 55
 			);
56 56
 		$this->_metaboxes = array(
57 57
 			0 => array(
58
-				'page_route' => array('edit','create_new'),
58
+				'page_route' => array('edit', 'create_new'),
59 59
 				'func' => 'messages_metabox',
60 60
 				'label' => __('Notifications', 'event_espresso'),
61 61
 				'priority' => 'high'
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 		$this->_scripts_styles = array(
67 67
 			'registers' => array(
68 68
 				'events_msg_admin' => array(
69
-					'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js',
69
+					'url' => EE_MSGS_EXTEND_ASSETS_URL.'events_messages_admin.js',
70 70
 					'depends' => array('ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array')
71 71
 					),
72 72
 				'events_msg_admin_css' => array(
73
-					'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css',
73
+					'url' => EE_MSGS_EXTEND_ASSETS_URL.'ee_msg_events_admin.css',
74 74
 					'type' => 'css'
75 75
 					)
76 76
 				),
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	}
83 83
 
84 84
 
85
-	public function caf_updates( $update_callbacks ) {
86
-		$update_callbacks[] = array( $this, 'attach_evt_message_templates' );
85
+	public function caf_updates($update_callbacks) {
86
+		$update_callbacks[] = array($this, 'attach_evt_message_templates');
87 87
 		return $update_callbacks;
88 88
 	}
89 89
 
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
 	 * @param  array       $data   The request data from the form
97 97
 	 * @return bool         success or fail
98 98
 	 */
99
-	public function attach_evt_message_templates( $evtobj, $data ) {
99
+	public function attach_evt_message_templates($evtobj, $data) {
100 100
 		//first we remove all existing relations on the Event for message types.
101 101
 		$evtobj->_remove_relations('Message_Template_Group');
102 102
 
103 103
 		//now let's just loop throught the selected templates and add relations!
104
-		foreach( $data['event_message_templates_relation'] as $grp_ID ) {
105
-			$evtobj->_add_relation_to( $grp_ID, 'Message_Template_Group' );
104
+		foreach ($data['event_message_templates_relation'] as $grp_ID) {
105
+			$evtobj->_add_relation_to($grp_ID, 'Message_Template_Group');
106 106
 		}
107 107
 
108 108
 		//now save
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
 
116 116
 		//let's get the active messengers (b/c messenger objects have the active message templates)
117 117
 		//convert 'evt_id' to 'EVT_ID'
118
-		$this->_req_data['EVT_ID'] = isset( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : NULL;
119
-		$this->_req_data['EVT_ID'] = isset( $this->_req_data['post'] ) && empty( $this->_req_data['EVT_ID'] ) ? $this->_req_data['post'] : $this->_req_data['EVT_ID'];
118
+		$this->_req_data['EVT_ID'] = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;
119
+		$this->_req_data['EVT_ID'] = isset($this->_req_data['post']) && empty($this->_req_data['EVT_ID']) ? $this->_req_data['post'] : $this->_req_data['EVT_ID'];
120 120
 
121
-		$this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID'] ) && isset($this->_req_data['evt_id'] ) ? $this->_req_data['evt_id'] : $this->_req_data['EVT_ID'];
121
+		$this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID']) && isset($this->_req_data['evt_id']) ? $this->_req_data['evt_id'] : $this->_req_data['EVT_ID'];
122 122
 
123 123
 
124 124
 		$EEM_controller = new EE_messages;
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 
128 128
 		//empty messengers?
129 129
 		//Note message types will always have at least one available because every messenger has a default message type associated with it (payment) if no other message types are selected.
130
-		if ( empty( $active_messengers ) ) {
131
-			$msg_activate_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'settings'), EE_MSG_ADMIN_URL );
132
-			$error_msg = sprintf( __('There are no active messengers. So no notifications will go out for <strong>any</strong> events.  You will want to %sActivate a Messenger%s.', 'event_espresso'), '<a href="' . $msg_activate_url . '">', '</a>');
133
-			$error_content = '<div class="error"><p>' . $error_msg . '</p></div>';
134
-			$internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>';
130
+		if (empty($active_messengers)) {
131
+			$msg_activate_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'settings'), EE_MSG_ADMIN_URL);
132
+			$error_msg = sprintf(__('There are no active messengers. So no notifications will go out for <strong>any</strong> events.  You will want to %sActivate a Messenger%s.', 'event_espresso'), '<a href="'.$msg_activate_url.'">', '</a>');
133
+			$error_content = '<div class="error"><p>'.$error_msg.'</p></div>';
134
+			$internal_content = '<div id="messages-error"><p>'.$error_msg.'</p></div>';
135 135
 
136 136
 			echo $error_content;
137 137
 			echo $internal_content;
@@ -140,16 +140,16 @@  discard block
 block discarded – undo
140 140
 
141 141
 		$event_id = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;
142 142
 		//get content for active messengers
143
-		foreach ( $active_messengers as $name => $messenger ) {
143
+		foreach ($active_messengers as $name => $messenger) {
144 144
 			//first check if there are any active message types for this messenger.
145
-			$active_mts = $EEM_controller->get_active_message_types_per_messenger( $name );
146
-			if ( empty( $active_mts ) ) {
145
+			$active_mts = $EEM_controller->get_active_message_types_per_messenger($name);
146
+			if (empty($active_mts)) {
147 147
 				continue;
148 148
 			}
149 149
 
150
-			$tcont = $messenger->get_messenger_admin_page_content('events', 'edit', array('event' => $event_id) );
150
+			$tcont = $messenger->get_messenger_admin_page_content('events', 'edit', array('event' => $event_id));
151 151
 
152
-			if ( ! empty( $tcont ) ) {
152
+			if ( ! empty($tcont)) {
153 153
 				$tabs[$name] = $tcont;
154 154
 			}
155 155
 		}
@@ -157,21 +157,21 @@  discard block
 block discarded – undo
157 157
 
158 158
 		//we want this to be tabbed content so let's use the EEH_Tabbed_Content::display helper.
159 159
 		$tabbed_content = EEH_Tabbed_Content::display($tabs);
160
-		if ( is_wp_error($tabbed_content) ) {
160
+		if (is_wp_error($tabbed_content)) {
161 161
 			$tabbed_content = $tabbed_content->get_error_message();
162 162
 		}
163 163
 
164 164
 		$notices = '<div id="espresso-ajax-loading" class="ajax-loader-grey">
165
-				<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso') . '</span>
165
+				<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso').'</span>
166 166
 			</div><div class="ee-notices"></div>';
167 167
 
168
-		if ( defined('DOING_AJAX' ) ) {
168
+		if (defined('DOING_AJAX')) {
169 169
 			return $tabbed_content;
170 170
 		}
171 171
 
172
-		do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content' );
173
-		echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>';
174
-		do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content' );
172
+		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content');
173
+		echo $notices.'<div class="messages-tabs-content">'.$tabbed_content.'</div>';
174
+		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content');
175 175
 
176 176
 	}
177 177
 
@@ -185,22 +185,22 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	public function create_new_custom() {
187 187
 
188
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'create_new_custom_ajax' ) ) {
189
-			wp_die( __('You don\'t have privileges to do this action', 'event_espresso' ) );
188
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) {
189
+			wp_die(__('You don\'t have privileges to do this action', 'event_espresso'));
190 190
 		}
191 191
 
192 192
 		//let's clean up the _POST global a bit for downstream usage of name and description.
193
-		$_POST['templateName'] = !empty( $this->_req_data['custom_template_args']['MTP_name'] ) ? $this->_req_data['custom_template_args']['MTP_name'] : '';
194
-		$_POST['templateDescription'] = !empty( $this->_req_data['custom_template_args']['MTP_description'] ) ? $this->_req_data['custom_template_args']['MTP_description'] : '';
193
+		$_POST['templateName'] = ! empty($this->_req_data['custom_template_args']['MTP_name']) ? $this->_req_data['custom_template_args']['MTP_name'] : '';
194
+		$_POST['templateDescription'] = ! empty($this->_req_data['custom_template_args']['MTP_description']) ? $this->_req_data['custom_template_args']['MTP_description'] : '';
195 195
 
196 196
 
197 197
 		//set EE_Admin_Page object (see method details in EE_Admin_Hooks parent
198 198
 		$this->_set_page_object();
199 199
 
200 200
 		//is this a template switch if so EE_Admin_Page child needs this object
201
-		$this->_page_object->set_hook_object( $this );
201
+		$this->_page_object->set_hook_object($this);
202 202
 
203
-		$this->_page_object->add_message_template( $this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID'] );
203
+		$this->_page_object->add_message_template($this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID']);
204 204
 	}
205 205
 
206 206
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 * @return string (admin_footer contents)
216 216
 	 */
217 217
 	public function edit_admin_footer() {
218
-		$template_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php';
218
+		$template_path = EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/create_custom_template_form.template.php';
219 219
 		EEH_Template::display_template($template_path, array());
220 220
 	}
221 221
 
Please login to merge, or discard this patch.
admin/extend/transactions/Extend_Transactions_Admin_Page.core.php 1 patch
Spacing   +43 added lines, -43 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
 /**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 	 * @param bool $routing
43 43
 	 * @return \Extend_Transactions_Admin_Page
44 44
 	 */
45
-	public function __construct( $routing = TRUE ) {
46
-		parent::__construct( $routing );
47
-		define( 'TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/templates/');
48
-		define( 'TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/assets/');
49
-		define( 'TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'transactions/assets/');
45
+	public function __construct($routing = TRUE) {
46
+		parent::__construct($routing);
47
+		define('TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'transactions/templates/');
48
+		define('TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'transactions/assets/');
49
+		define('TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'transactions/assets/');
50 50
 	}
51 51
 
52 52
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 * @return void
59 59
 	 */
60 60
 	protected function _extend_page_config() {
61
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'transactions';
61
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'transactions';
62 62
 
63 63
 		$new_page_routes = array(
64 64
 			'reports' => array(
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			)
68 68
 		);
69 69
 
70
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
70
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
71 71
 
72 72
 		$new_page_config = array(
73 73
 			'reports' => array(
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 				'require_nonce' => FALSE
86 86
 			)
87 87
 		);
88
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
88
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
89 89
 	}
90 90
 
91 91
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	 * @return void
98 98
 	 */
99 99
 	public function load_scripts_styles_reports() {
100
-		wp_register_script( 'ee-txn-reports-js', TXN_CAF_ASSETS_URL . 'ee-transaction-admin-reports.js', array( 'google-charts' ), EVENT_ESPRESSO_VERSION, true );
101
-		wp_enqueue_script( 'ee-txn-reports-js' );
100
+		wp_register_script('ee-txn-reports-js', TXN_CAF_ASSETS_URL.'ee-transaction-admin-reports.js', array('google-charts'), EVENT_ESPRESSO_VERSION, true);
101
+		wp_enqueue_script('ee-txn-reports-js');
102 102
 		$this->_transaction_reports_js_setup();
103 103
 		EE_Registry::$i18n_js_strings['currency_format'] = EEH_Money::get_format_for_google_charts();
104 104
 	}
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	* @return void
126 126
 	*/
127 127
 	protected function _transaction_reports() {
128
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
128
+		$template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php';
129 129
 		$this->_admin_page_title = __('Transactions', 'event_espresso');
130
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_reports_template_data, TRUE );
130
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_reports_template_data, TRUE);
131 131
 
132 132
 		// the final template wrapper
133 133
 		$this->display_admin_page_with_no_sidebar();
@@ -142,42 +142,42 @@  discard block
 block discarded – undo
142 142
 	 * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
143 143
 	 * @return string
144 144
 	 */
145
-	private function _revenue_per_day_report( $period = '-1 month' ) {
145
+	private function _revenue_per_day_report($period = '-1 month') {
146 146
 
147 147
 		$report_ID = 'txn-admin-revenue-per-day-report-dv';
148 148
 
149 149
 		$TXN = EEM_Transaction::instance();
150 150
 
151
-		$results = $TXN->get_revenue_per_day_report( $period );
151
+		$results = $TXN->get_revenue_per_day_report($period);
152 152
 		$results = (array) $results;
153 153
 		$revenue = array();
154 154
 		$subtitle = '';
155 155
 
156
-		if ( $results ) {
157
-			$revenue[] = array( __( 'Date (only shows dates that have a revenue greater than 1)', 'event_espresso' ), __( 'Total Revenue', 'event_espresso' ) );
158
-			foreach ( $results as $result ) {
159
-				if ( $result->revenue > 1 ) {
160
-					$revenue[] = array( $result->txnDate, (float) $result->revenue );
156
+		if ($results) {
157
+			$revenue[] = array(__('Date (only shows dates that have a revenue greater than 1)', 'event_espresso'), __('Total Revenue', 'event_espresso'));
158
+			foreach ($results as $result) {
159
+				if ($result->revenue > 1) {
160
+					$revenue[] = array($result->txnDate, (float) $result->revenue);
161 161
 				}
162 162
 			}
163 163
 
164 164
 			//setup the date range.
165
-			$beginning_date = new DateTime( 'now' . $period, new DateTimeZone( EEH_DTT_Helper::get_timezone() ) );
166
-			$ending_date = new DateTime( 'now', new DateTimeZone( EEH_DTT_Helper::get_timezone() ) );
167
-			$subtitle = sprintf( _x( 'For the period: %s to %s', 'Used to give date range', 'event_espresso' ), $beginning_date->format( 'Y-m-d' ), $ending_date->format( 'Y-m-d' ) );
165
+			$beginning_date = new DateTime('now'.$period, new DateTimeZone(EEH_DTT_Helper::get_timezone()));
166
+			$ending_date = new DateTime('now', new DateTimeZone(EEH_DTT_Helper::get_timezone()));
167
+			$subtitle = sprintf(_x('For the period: %s to %s', 'Used to give date range', 'event_espresso'), $beginning_date->format('Y-m-d'), $ending_date->format('Y-m-d'));
168 168
 		}
169 169
 
170
-		$report_title = __( 'Total Revenue per Day' );
170
+		$report_title = __('Total Revenue per Day');
171 171
 
172 172
 		$report_params = array(
173 173
 			'title' 		=> $report_title,
174 174
 			'subtitle' => $subtitle,
175 175
 			'id' 			=> $report_ID,
176 176
 			'revenue' => $revenue,
177
-			'noResults' => empty( $revenue ),
178
-			'noTxnMsg'	=> sprintf( __( '%sThere are currently no transaction records in the last month for this report.%s', 'event_espresso' ), '<h2>' . $report_title . '</h2><p>', '</p>' )
177
+			'noResults' => empty($revenue),
178
+			'noTxnMsg'	=> sprintf(__('%sThere are currently no transaction records in the last month for this report.%s', 'event_espresso'), '<h2>'.$report_title.'</h2><p>', '</p>')
179 179
 		);
180
-		wp_localize_script( 'ee-txn-reports-js', 'txnRevPerDay', $report_params );
180
+		wp_localize_script('ee-txn-reports-js', 'txnRevPerDay', $report_params);
181 181
 
182 182
 		return $report_ID;
183 183
 	}
@@ -191,43 +191,43 @@  discard block
 block discarded – undo
191 191
 	 * @param string $period  The period (acceptable by PHP Datetime constructor) for which the report is generated.
192 192
 	 * @return int
193 193
 	 */
194
-	private function _revenue_per_event_report( $period = '-1 month' ) {
194
+	private function _revenue_per_event_report($period = '-1 month') {
195 195
 
196 196
 		$report_ID = 'txn-admin-revenue-per-event-report-dv';
197 197
 
198 198
 		$TXN = EEM_Transaction::instance();
199
-		$results = $TXN->get_revenue_per_event_report( $period );
199
+		$results = $TXN->get_revenue_per_event_report($period);
200 200
 		$results = (array) $results;
201 201
 		$revenue = array();
202 202
 		$subtitle = '';
203 203
 
204
-		if ( $results ) {
205
-			$revenue[] = array( __( 'Event (only events that have a revenue greater than 1 are shown)', 'event_espresso' ), __( 'Total Revenue', 'event_espresso' ) );
206
-			foreach ( $results as $result ) {
207
-				if ( $result->revenue > 1 ) {
208
-					$event_name = stripslashes( html_entity_decode( $result->event_name, ENT_QUOTES, 'UTF-8' ) );
209
-					$event_name = wp_trim_words( $event_name, 5, '...' );
210
-					$revenue[]  = array( $event_name, (float) $result->revenue );
204
+		if ($results) {
205
+			$revenue[] = array(__('Event (only events that have a revenue greater than 1 are shown)', 'event_espresso'), __('Total Revenue', 'event_espresso'));
206
+			foreach ($results as $result) {
207
+				if ($result->revenue > 1) {
208
+					$event_name = stripslashes(html_entity_decode($result->event_name, ENT_QUOTES, 'UTF-8'));
209
+					$event_name = wp_trim_words($event_name, 5, '...');
210
+					$revenue[]  = array($event_name, (float) $result->revenue);
211 211
 				}
212 212
 			}
213 213
 
214 214
 			//setup the date range.
215
-			$beginning_date = new DateTime( 'now' . $period, new DateTimeZone( EEH_DTT_Helper::get_timezone() ) );
216
-			$ending_date = new DateTime( 'now', new DateTimeZone( EEH_DTT_Helper::get_timezone() ) );
217
-			$subtitle = sprintf( _x( 'For the period: %s to %s', 'Used to give date range', 'event_espresso' ), $beginning_date->format( 'Y-m-d' ), $ending_date->format( 'Y-m-d' ) );
215
+			$beginning_date = new DateTime('now'.$period, new DateTimeZone(EEH_DTT_Helper::get_timezone()));
216
+			$ending_date = new DateTime('now', new DateTimeZone(EEH_DTT_Helper::get_timezone()));
217
+			$subtitle = sprintf(_x('For the period: %s to %s', 'Used to give date range', 'event_espresso'), $beginning_date->format('Y-m-d'), $ending_date->format('Y-m-d'));
218 218
 		}
219 219
 
220
-		$report_title = __( 'Total Revenue per Event' );
220
+		$report_title = __('Total Revenue per Event');
221 221
 
222 222
 		$report_params = array(
223 223
 			'title' 		=> $report_title,
224 224
 			'subtitle' => $subtitle,
225 225
 			'id' 			=> $report_ID,
226 226
 			'revenue' => $revenue,
227
-			'noResults' => empty( $revenue ),
228
-			'noTxnMsg'	=> sprintf( __( '%sThere are currently no transaction records in the last month for this report.%s', 'event_espresso' ), '<h2>' . $report_title . '</h2><p>', '</p>' )
227
+			'noResults' => empty($revenue),
228
+			'noTxnMsg'	=> sprintf(__('%sThere are currently no transaction records in the last month for this report.%s', 'event_espresso'), '<h2>'.$report_title.'</h2><p>', '</p>')
229 229
 		);
230
-		wp_localize_script( 'ee-txn-reports-js', 'txnRevPerEvent', $report_params );
230
+		wp_localize_script('ee-txn-reports-js', 'txnRevPerEvent', $report_params);
231 231
 
232 232
 		return $report_ID;
233 233
 	}
Please login to merge, or discard this patch.
caffeinated/admin/extend/events/Extend_Events_Admin_Page.core.php 1 patch
Spacing   +211 added lines, -211 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -30,25 +30,25 @@  discard block
 block discarded – undo
30 30
 class Extend_Events_Admin_Page extends Events_Admin_Page {
31 31
 
32 32
 
33
-	public function __construct( $routing = TRUE ) {
34
-		parent::__construct( $routing );
35
-		define( 'EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/');
36
-		define( 'EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/');
37
-		define( 'EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/');
33
+	public function __construct($routing = TRUE) {
34
+		parent::__construct($routing);
35
+		define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'events/templates/');
36
+		define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'events/assets/');
37
+		define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'events/assets/');
38 38
 	}
39 39
 
40 40
 
41 41
 	protected function _extend_page_config() {
42 42
 
43
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events';
43
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'events';
44 44
 		$default_espresso_boxes = $this->_default_espresso_metaboxes;
45 45
 
46 46
 		//is there a evt_id in the request?
47
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0;
48
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
47
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0;
48
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
49 49
 
50 50
 		//tkt_id?
51
-		$tkt_id = !empty( $this->_req_data['TKT_ID'] ) && ! is_array( $this->_req_data['TKT_ID'] ) ? $this->_req_data['TKT_ID'] : 0;
51
+		$tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) ? $this->_req_data['TKT_ID'] : 0;
52 52
 
53 53
 		$new_page_routes = array(
54 54
 			'duplicate_event' => array(
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
 				'capability' => 'ee_delete_default_ticket',
67 67
 				'obj_id' => $tkt_id,
68 68
 				'noheader' => TRUE,
69
-				'args' => array( 'trash' => TRUE )
69
+				'args' => array('trash' => TRUE)
70 70
 				),
71 71
 			'trash_tickets' => array(
72 72
 				'func' => '_trash_or_restore_ticket',
73 73
 				'capability' => 'ee_delete_default_tickets',
74 74
 				'noheader' => TRUE,
75
-				'args' => array( 'trash' => TRUE )
75
+				'args' => array('trash' => TRUE)
76 76
 				),
77 77
 			'restore_ticket' => array(
78 78
 				'func' => '_trash_or_restore_ticket',
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 				)
133 133
 			);
134 134
 
135
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
135
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
136 136
 
137 137
 
138 138
 		//partial route/config override
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 		$this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table';
145 145
 
146 146
 		//add tickets tab but only if there are more than one default ticket!
147
-		$tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array( array('TKT_is_default' => 1 ) ), 'TKT_ID', TRUE );
148
-		if ( $tkt_count > 1 ) {
147
+		$tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE);
148
+		if ($tkt_count > 1) {
149 149
 			$new_page_config = array(
150 150
 				'ticket_list_table' => array(
151 151
 					'nav' => array(
@@ -164,14 +164,14 @@  discard block
 block discarded – undo
164 164
 				'label' => __('Templates'),
165 165
 				'order' => 30
166 166
 			),
167
-			'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
167
+			'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
168 168
 			'help_tabs' => array(
169 169
 				'general_settings_templates_help_tab' => array(
170 170
 					'title' => __('Templates', 'event_espresso'),
171 171
 					'filename' => 'general_settings_templates'
172 172
 				)
173 173
 			),
174
-			'help_tour' => array( 'Templates_Help_Tour' ),
174
+			'help_tour' => array('Templates_Help_Tour'),
175 175
 			'require_nonce' => FALSE
176 176
 		);
177 177
 
@@ -190,26 +190,26 @@  discard block
 block discarded – undo
190 190
 //				'metaboxes' => $default_espresso_boxes,
191 191
 //				'require_nonce' => FALSE
192 192
 //		);
193
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
193
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
194 194
 
195 195
 		//add filters and actions
196 196
 		//modifying _views
197
-		add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array( $this, 'add_additional_datetime_button' ), 10, 2 );
198
-		add_filter('FHEE_event_datetime_metabox_clone_button_template', array( $this, 'add_datetime_clone_button' ), 10, 2 );
199
-		add_filter('FHEE_event_datetime_metabox_timezones_template', array( $this, 'datetime_timezones_template'), 10, 2 );
197
+		add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array($this, 'add_additional_datetime_button'), 10, 2);
198
+		add_filter('FHEE_event_datetime_metabox_clone_button_template', array($this, 'add_datetime_clone_button'), 10, 2);
199
+		add_filter('FHEE_event_datetime_metabox_timezones_template', array($this, 'datetime_timezones_template'), 10, 2);
200 200
 
201 201
 
202 202
 		//filters for event list table
203
-		add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array( $this, 'list_table_filters'), 10, 2);
204
-		add_filter('FHEE__Extend_Events_Admin_List_Table__column_actions__action_links', array( $this, 'extra_list_table_actions'), 10, 2 );
203
+		add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array($this, 'list_table_filters'), 10, 2);
204
+		add_filter('FHEE__Extend_Events_Admin_List_Table__column_actions__action_links', array($this, 'extra_list_table_actions'), 10, 2);
205 205
 
206 206
 		//legend item
207
-		add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array( $this, 'additional_legend_items') );
207
+		add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array($this, 'additional_legend_items'));
208 208
 
209
-		add_action('admin_init', array( $this, 'admin_init') );
209
+		add_action('admin_init', array($this, 'admin_init'));
210 210
 
211 211
 		//heartbeat stuff
212
-		add_filter( 'heartbeat_received', array( $this, 'heartbeat_response' ), 10, 2 );
212
+		add_filter('heartbeat_received', array($this, 'heartbeat_response'), 10, 2);
213 213
 
214 214
 	}
215 215
 
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
 		EE_Registry::$i18n_js_strings = array_merge(
223 223
 			EE_Registry::$i18n_js_strings,
224 224
 			array(
225
-				'image_confirm'          => __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' ),
226
-				'event_starts_on'        => __( 'Event Starts on', 'event_espresso' ),
227
-				'event_ends_on'          => __( 'Event Ends on', 'event_espresso' ),
228
-				'event_datetime_actions' => __( 'Actions', 'event_espresso' ),
229
-				'event_clone_dt_msg'     => __( 'Clone this Event Date and Time', 'event_espresso' ),
230
-				'remove_event_dt_msg'    => __( 'Remove this Event Time', 'event_espresso' )
225
+				'image_confirm'          => __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso'),
226
+				'event_starts_on'        => __('Event Starts on', 'event_espresso'),
227
+				'event_ends_on'          => __('Event Ends on', 'event_espresso'),
228
+				'event_datetime_actions' => __('Actions', 'event_espresso'),
229
+				'event_clone_dt_msg'     => __('Clone this Event Date and Time', 'event_espresso'),
230
+				'remove_event_dt_msg'    => __('Remove this Event Time', 'event_espresso')
231 231
 			)
232 232
 		);
233 233
 	}
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @return array  possibly appended response.
244 244
 	 */
245
-	public function heartbeat_response( $response, $data ) {
245
+	public function heartbeat_response($response, $data) {
246 246
 		/**
247 247
 		 * check whether count of tickets is approaching the potential
248 248
 		 * limits for the server.
249 249
 		 */
250
-		if ( ! empty( $data['input_count'] ) ) {
250
+		if ( ! empty($data['input_count'])) {
251 251
 			$response['max_input_vars_check'] = EE_Registry::instance()->CFG->environment->max_input_vars_limit_check($data['input_count']);
252 252
 		}
253 253
 
@@ -262,13 +262,13 @@  discard block
 block discarded – undo
262 262
 
263 263
 
264 264
 
265
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
266
-		$return = parent::extra_permalink_field_buttons( $return, $id, $new_title, $new_slug );
265
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
266
+		$return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug);
267 267
 		//make sure this is only when editing
268
-		if ( !empty( $id ) ) {
269
-			$href = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url );
268
+		if ( ! empty($id)) {
269
+			$href = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url);
270 270
 			$title = esc_attr__('Duplicate Event', 'event_espresso');
271
-			$return .= '<a href="' . $href . '" title="' . $title . '" id="ee-duplicate-event-button" class="button button-small"  value="duplicate_event">' . $title  . '</button>';
271
+			$return .= '<a href="'.$href.'" title="'.$title.'" id="ee-duplicate-event-button" class="button button-small"  value="duplicate_event">'.$title.'</button>';
272 272
 		}
273 273
 		return $return;
274 274
 	}
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 				'label' => __('Trash', 'event_espresso'),
292 292
 				'count' => 0,
293 293
 				'bulk_action' => array(
294
-					'restore_tickets' => __('Restore from Trash' , 'event_espresso'),
294
+					'restore_tickets' => __('Restore from Trash', 'event_espresso'),
295 295
 					'delete_tickets' => __('Delete Permanently', 'event_espresso')
296 296
 					)
297 297
 				)
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
 
303 303
 	public function load_scripts_styles_edit() {
304
-		wp_register_script( 'ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js', array( 'ee_admin_js', 'heartbeat' ), EVENT_ESPRESSO_VERSION, TRUE );
304
+		wp_register_script('ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL.'event-editor-heartbeat.js', array('ee_admin_js', 'heartbeat'), EVENT_ESPRESSO_VERSION, TRUE);
305 305
 
306 306
 		/**
307 307
 		 * load accounting js.
@@ -320,20 +320,20 @@  discard block
 block discarded – undo
320 320
 
321 321
 
322 322
 
323
-	public function add_additional_datetime_button( $template, $template_args ) {
324
-		return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php', $template_args, TRUE);
323
+	public function add_additional_datetime_button($template, $template_args) {
324
+		return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_add_additional_time.template.php', $template_args, TRUE);
325 325
 	}
326 326
 
327 327
 
328 328
 
329
-	public function add_datetime_clone_button( $template, $template_args ) {
330
-		return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php', $template_args, TRUE );
329
+	public function add_datetime_clone_button($template, $template_args) {
330
+		return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_metabox_clone_button.template.php', $template_args, TRUE);
331 331
 	}
332 332
 
333 333
 
334 334
 
335
-	public function datetime_timezones_template( $template, $template_args ) {
336
-		return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php', $template_args, TRUE );
335
+	public function datetime_timezones_template($template, $template_args) {
336
+		return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_timezones.template.php', $template_args, TRUE);
337 337
 	}
338 338
 
339 339
 
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
 	protected function _set_list_table_views_default() {
343 343
 		parent::_set_list_table_views_default();
344 344
 		$export_label = __('Export Events', 'event_espresso');
345
-		if ( EE_Registry::instance()->CAP->current_user_can( 'export', 'espresso_events_export' ) ) {
345
+		if (EE_Registry::instance()->CAP->current_user_can('export', 'espresso_events_export')) {
346 346
 //			$this->_views['all']['bulk_action']['export_events'] = $export_label;
347 347
 //			$this->_views['draft']['bulk_action']['export_events'] = $export_label;
348 348
 
349
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
349
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
350 350
 //				$this->_views['trash']['bulk_action']['export_events'] = $export_label;
351 351
 			}
352 352
 		}
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 			)
373 373
 		);
374 374
 
375
-		$this->_views = array_merge( $this->_views, $new_views);
375
+		$this->_views = array_merge($this->_views, $new_views);
376 376
 	}
377 377
 
378 378
 
@@ -386,14 +386,14 @@  discard block
 block discarded – undo
386 386
 
387 387
 
388 388
 
389
-	public function extra_list_table_actions( $actionlinks, $event ) {
390
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports', $event->ID() ) ) {
389
+	public function extra_list_table_actions($actionlinks, $event) {
390
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports', $event->ID())) {
391 391
 			$reports_query_args = array(
392 392
 					'action' => 'reports',
393 393
 					'EVT_ID' => $event->ID()
394 394
 				);
395
-			$reports_link = EE_Admin_Page::add_query_args_and_nonce( $reports_query_args, REG_ADMIN_URL );
396
-			$actionlinks[] = '<a href="' . $reports_link . '" title="' .  esc_attr__('View Report', 'event_espresso') . '"><div class="dashicons dashicons-chart-bar"></div></a>' . "\n\t";
395
+			$reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL);
396
+			$actionlinks[] = '<a href="'.$reports_link.'" title="'.esc_attr__('View Report', 'event_espresso').'"><div class="dashicons dashicons-chart-bar"></div></a>'."\n\t";
397 397
 		}
398 398
 		return $actionlinks;
399 399
 	}
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 
402 402
 
403 403
 	public function additional_legend_items($items) {
404
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports' ) ) {
404
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports')) {
405 405
 			$items['reports'] = array(
406 406
 					'class' => 'dashicons dashicons-chart-bar',
407 407
 					'desc' => __('Event Reports', 'event_espresso')
@@ -426,17 +426,17 @@  discard block
 block discarded – undo
426 426
 	 */
427 427
 	protected function _duplicate_event() {
428 428
 		//first make sure the ID for the event is in the request.  If it isnt' then we need to bail and redirect back to overview list table (cause how did we get here?)
429
-		if ( !isset( $this->_req_data['EVT_ID'] ) ) {
430
-			EE_Error::add_error( __('In order to duplicate an event an Event ID is required.  None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
431
-			$this->_redirect_after_action( FALSE, '', '', array(), TRUE );
429
+		if ( ! isset($this->_req_data['EVT_ID'])) {
430
+			EE_Error::add_error(__('In order to duplicate an event an Event ID is required.  None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
431
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
432 432
 			return;
433 433
 		}
434 434
 
435 435
 		//k we've got EVT_ID so let's use that to get the event we'll duplicate
436
-		$orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] );
436
+		$orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']);
437 437
 
438
-		if ( ! $orig_event instanceof EE_Event )
439
-			throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID'] ) );
438
+		if ( ! $orig_event instanceof EE_Event)
439
+			throw new EE_Error(sprintf(__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID']));
440 440
 
441 441
 		//k now let's clone the $orig_event before getting relations
442 442
 		$new_event = clone $orig_event;
@@ -449,43 +449,43 @@  discard block
 block discarded – undo
449 449
 
450 450
 
451 451
 		//reset the ID and modify other details to make it clear this is a dupe
452
-		$new_event->set( 'EVT_ID', 0 );
453
-		$new_name = $new_event->name() . ' ' . __('**DUPLICATE**', 'event_espresso');
454
-		$new_event->set( 'EVT_name',  $new_name );
455
-		$new_event->set( 'EVT_slug',  wp_unique_post_slug( sanitize_title( $orig_event->name() ), 0, 'publish', 'espresso_events', 0 ) );
456
-		$new_event->set( 'status', 'draft' );
452
+		$new_event->set('EVT_ID', 0);
453
+		$new_name = $new_event->name().' '.__('**DUPLICATE**', 'event_espresso');
454
+		$new_event->set('EVT_name', $new_name);
455
+		$new_event->set('EVT_slug', wp_unique_post_slug(sanitize_title($orig_event->name()), 0, 'publish', 'espresso_events', 0));
456
+		$new_event->set('status', 'draft');
457 457
 
458 458
 		//duplicate discussion settings
459
-		$new_event->set( 'comment_status', $orig_event->get('comment_status') );
460
-		$new_event->set( 'ping_status', $orig_event->get( 'ping_status' ) );
459
+		$new_event->set('comment_status', $orig_event->get('comment_status'));
460
+		$new_event->set('ping_status', $orig_event->get('ping_status'));
461 461
 
462 462
 		//save the new event
463 463
 		$new_event->save();
464 464
 
465 465
 		//venues
466
-		foreach( $orig_ven as $ven ) {
467
-			$new_event->_add_relation_to( $ven, 'Venue' );
466
+		foreach ($orig_ven as $ven) {
467
+			$new_event->_add_relation_to($ven, 'Venue');
468 468
 		}
469 469
 		$new_event->save();
470 470
 
471 471
 
472 472
 		//now we need to get the question group relations and handle that
473 473
 		//first primary question groups
474
-		$orig_primary_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 1 ) ) );
475
-		if ( !empty( $orig_primary_qgs ) ) {
476
-			foreach ( $orig_primary_qgs as $id => $obj ) {
477
-				if ( $obj instanceof EE_Question_Group ) {
478
-					$new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 1 ) );
474
+		$orig_primary_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 1)));
475
+		if ( ! empty($orig_primary_qgs)) {
476
+			foreach ($orig_primary_qgs as $id => $obj) {
477
+				if ($obj instanceof EE_Question_Group) {
478
+					$new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 1));
479 479
 				}
480 480
 			}
481 481
 		}
482 482
 
483 483
 		//next additional attendee question groups
484
-		$orig_additional_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 0 ) ) );
485
-		if ( !empty( $orig_additional_qgs ) ) {
486
-			foreach ( $orig_additional_qgs as $id => $obj ) {
487
-				if ( $obj instanceof EE_Question_Group ) {
488
-					$new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 0 ) );
484
+		$orig_additional_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0)));
485
+		if ( ! empty($orig_additional_qgs)) {
486
+			foreach ($orig_additional_qgs as $id => $obj) {
487
+				if ($obj instanceof EE_Question_Group) {
488
+					$new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 0));
489 489
 				}
490 490
 			}
491 491
 		}
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 
497 497
 		//k now that we have the new event saved we can loop through the datetimes and start adding relations.
498 498
 		$cloned_tickets = array();
499
-		foreach ( $orig_datetimes as $orig_dtt ) {
499
+		foreach ($orig_datetimes as $orig_dtt) {
500 500
 			$new_dtt = clone $orig_dtt;
501 501
 			$orig_tkts = $orig_dtt->tickets();
502 502
 
@@ -504,22 +504,22 @@  discard block
 block discarded – undo
504 504
 			$new_dtt->set('DTT_ID', 0);
505 505
 			$new_dtt->set('DTT_sold', 0);
506 506
 			$new_dtt->save();
507
-			$new_event->_add_relation_to( $new_dtt, 'Datetime');
507
+			$new_event->_add_relation_to($new_dtt, 'Datetime');
508 508
 			$new_event->save();
509 509
 
510 510
 			//now let's get the ticket relations setup.
511
-			foreach ( (array) $orig_tkts as $orig_tkt ) {
511
+			foreach ((array) $orig_tkts as $orig_tkt) {
512 512
 				//it's possible a datetime will have no tickets so let's verify we HAVE a ticket first.
513
-				if ( ! $orig_tkt instanceof EE_Ticket )
513
+				if ( ! $orig_tkt instanceof EE_Ticket)
514 514
 					continue;
515 515
 
516 516
 				//is this ticket archived?  If it is then let's skip
517
-				if ( $orig_tkt->get( 'TKT_deleted' ) ) {
517
+				if ($orig_tkt->get('TKT_deleted')) {
518 518
 					continue;
519 519
 				}
520 520
 
521 521
 				//does this original ticket already exist in the clone_tickets cache?  If so we'll just use the new ticket from it.
522
-				if ( isset( $cloned_tickets[$orig_tkt->ID()] ) ) {
522
+				if (isset($cloned_tickets[$orig_tkt->ID()])) {
523 523
 					$new_tkt = $cloned_tickets[$orig_tkt->ID()];
524 524
 				} else {
525 525
 					$new_tkt = clone $orig_tkt;
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 					$new_tkt->save(); //make sure new ticket has ID.
532 532
 
533 533
 					//price relations on new ticket need to be setup.
534
-					foreach ( $orig_prices as $orig_price ) {
534
+					foreach ($orig_prices as $orig_price) {
535 535
 						$new_price = clone $orig_price;
536 536
 						$new_price->set('PRC_ID', 0);
537 537
 						$new_price->save();
@@ -548,39 +548,39 @@  discard block
 block discarded – undo
548 548
 		}
549 549
 
550 550
 		//clone taxonomy information
551
-		$taxonomies_to_clone_with = apply_filters( 'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array( 'espresso_event_categories', 'espresso_event_type', 'post_tag' ) );
551
+		$taxonomies_to_clone_with = apply_filters('FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array('espresso_event_categories', 'espresso_event_type', 'post_tag'));
552 552
 
553 553
 		//get terms for original event (notice)
554
-		$orig_terms = wp_get_object_terms( $orig_event->ID(), $taxonomies_to_clone_with );
554
+		$orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with);
555 555
 
556 556
 		//loop through terms and add them to new event.
557
-		foreach ( $orig_terms as $term ) {
558
-			wp_set_object_terms( $new_event->ID(), $term->term_id, $term->taxonomy, true );
557
+		foreach ($orig_terms as $term) {
558
+			wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true);
559 559
 		}
560 560
 
561 561
 
562
-		do_action( 'AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event );
562
+		do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event);
563 563
 
564 564
 		//now let's redirect to the edit page for this duplicated event if we have a new event id.
565
-		if ( $new_event->ID() ) {
565
+		if ($new_event->ID()) {
566 566
 			$redirect_args = array(
567 567
 				'post' => $new_event->ID(),
568 568
 				'action' => 'edit'
569 569
 			);
570
-			EE_Error::add_success( __('Event successfully duplicated.  Please review the details below and make any necessary edits', 'event_espresso') );
570
+			EE_Error::add_success(__('Event successfully duplicated.  Please review the details below and make any necessary edits', 'event_espresso'));
571 571
 		} else {
572 572
 			$redirect_args = array(
573 573
 				'action' => 'default'
574 574
 				);
575
-			EE_Error::add_error( __('Not able to duplicate event.  Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
575
+			EE_Error::add_error(__('Not able to duplicate event.  Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
576 576
 		}
577 577
 
578
-		$this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE );
578
+		$this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE);
579 579
 	}
580 580
 
581 581
 
582 582
 
583
-	protected function _import_page(){
583
+	protected function _import_page() {
584 584
 
585 585
 		$title = __('Import', 'event_espresso');
586 586
 		$intro = __('If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ', 'event_espresso');
@@ -588,8 +588,8 @@  discard block
 block discarded – undo
588 588
 		$action = 'import_events';
589 589
 		$type = 'csv';
590 590
 		$this->_template_args['form'] = EE_Import::instance()->upload_form($title, $intro, $form_url, $action, $type);
591
-		$this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'),$this->_admin_base_url);
592
-		$content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php',$this->_template_args,true);
591
+		$this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'), $this->_admin_base_url);
592
+		$content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'import_page.template.php', $this->_template_args, true);
593 593
 
594 594
 
595 595
 		$this->_template_args['admin_page_content'] = $content;
@@ -602,9 +602,9 @@  discard block
 block discarded – undo
602 602
 	 * @return string html
603 603
 	 */
604 604
 	protected function _import_events() {
605
-		require_once(EE_CLASSES . 'EE_Import.class.php');
605
+		require_once(EE_CLASSES.'EE_Import.class.php');
606 606
 		$success = EE_Import::instance()->import();
607
-		$this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'),true);
607
+		$this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'), true);
608 608
 
609 609
 	}
610 610
 
@@ -618,23 +618,23 @@  discard block
 block discarded – undo
618 618
 	 * @return file
619 619
 	 */
620 620
 	protected function _events_export() {
621
-		if(isset($this->_req_data['EVT_ID'])){
621
+		if (isset($this->_req_data['EVT_ID'])) {
622 622
 			$event_ids = $this->_req_data['EVT_ID'];
623
-		}elseif(isset($this->_req_data['EVT_IDs'])){
623
+		}elseif (isset($this->_req_data['EVT_IDs'])) {
624 624
 			$event_ids = $this->_req_data['EVT_IDs'];
625
-		}else{
625
+		} else {
626 626
 			$event_ids = NULL;
627 627
 		}
628 628
 		//todo: I don't like doing this but it'll do until we modify EE_Export Class.
629 629
 		$new_request_args = array(
630 630
 			'export' => 'report',
631 631
 			'action' => 'all_event_data',
632
-			'EVT_ID' => $event_ids ,
632
+			'EVT_ID' => $event_ids,
633 633
 		);
634 634
 		$this->_req_data = array_merge($this->_req_data, $new_request_args);
635 635
 
636
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
637
-			require_once(EE_CLASSES . 'EE_Export.class.php');
636
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
637
+			require_once(EE_CLASSES.'EE_Export.class.php');
638 638
 			$EE_Export = EE_Export::instance($this->_req_data);
639 639
 			$EE_Export->export();
640 640
 		}
@@ -656,11 +656,11 @@  discard block
 block discarded – undo
656 656
 			'category_ids' => $this->_req_data['EVT_CAT_ID']
657 657
 			);
658 658
 
659
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
659
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
660 660
 
661
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) {
662
-			require_once( EE_CLASSES . 'EE_Export.class.php');
663
-			$EE_Export = EE_Export::instance( $this->_req_data );
661
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
662
+			require_once(EE_CLASSES.'EE_Export.class.php');
663
+			$EE_Export = EE_Export::instance($this->_req_data);
664 664
 			$EE_Export->export();
665 665
 		}
666 666
 
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 	/**
672 672
 	 * Creates a sample CSV file for importing
673 673
 	 */
674
-	protected function _sample_export_file(){
674
+	protected function _sample_export_file() {
675 675
 //		require_once(EE_CLASSES . 'EE_Export.class.php');
676 676
 		EE_Export::instance()->export_sample();
677 677
 	}
@@ -688,10 +688,10 @@  discard block
 block discarded – undo
688 688
 		 * Note leaving this filter in for backward compatibility this was moved in 4.6.x
689 689
 		 * from General_Settings_Admin_Page to here.
690 690
 		 */
691
-		$this->_template_args = apply_filters( 'FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args );
692
-		$this->_set_add_edit_form_tags( 'update_template_settings' );
693
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
694
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php', $this->_template_args, TRUE );
691
+		$this->_template_args = apply_filters('FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args);
692
+		$this->_set_add_edit_form_tags('update_template_settings');
693
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
694
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'template_settings.template.php', $this->_template_args, TRUE);
695 695
 		$this->display_admin_page_with_sidebar();
696 696
 	}
697 697
 
@@ -703,24 +703,24 @@  discard block
 block discarded – undo
703 703
 		 * Note leaving this filter in for backward compatibility this was moved in 4.6.x
704 704
 		 * from General_Settings_Admin_Page to here.
705 705
 		 */
706
-		EE_Registry::instance()->CFG->template_settings = apply_filters( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data );
706
+		EE_Registry::instance()->CFG->template_settings = apply_filters('FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data);
707 707
 
708 708
 
709 709
 		//update custom post type slugs and detect if we need to flush rewrite rules
710 710
 		$old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug;
711
-		EE_Registry::instance()->CFG->core->event_cpt_slug = empty( $this->_req_data['event_cpt_slug'] ) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes( $this->_req_data['event_cpt_slug'] );
711
+		EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug']) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes($this->_req_data['event_cpt_slug']);
712 712
 
713 713
 
714 714
 		$what = 'Template Settings';
715
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__ );
715
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__);
716 716
 
717 717
 
718
-		if ( EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug ) {
719
-			update_option( 'ee_flush_rewrite_rules', true );
718
+		if (EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug) {
719
+			update_option('ee_flush_rewrite_rules', true);
720 720
 		}
721 721
 
722 722
 
723
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'template_settings' ) );
723
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'template_settings'));
724 724
 
725 725
 	}
726 726
 
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 
739 739
 		$this->verify_cpt_object();
740 740
 
741
-		add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array( $this, 'registration_options_meta_box' ), $this->page_slug, 'side', 'core');
741
+		add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array($this, 'registration_options_meta_box'), $this->page_slug, 'side', 'core');
742 742
 		//add_meta_box('espresso_event_types', __('Event Type', 'event_espresso'), array( $this, 'event_type_meta_box' ), $this->page_slug, 'side', 'default' ); //add this back in when the feature is ready.
743 743
 
744 744
 		//todo feature in progress
@@ -762,16 +762,16 @@  discard block
 block discarded – undo
762 762
 			array('id' => true, 'text' => __('Yes', 'event_espresso')),
763 763
 			array('id' => false, 'text' => __('No', 'event_espresso'))
764 764
 		);
765
-		$default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete ), TRUE);
765
+		$default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete), TRUE);
766 766
 		$template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(FALSE);
767 767
 		$template_args['_event'] = $this->_cpt_model_obj;
768 768
 		$template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit();
769 769
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
770 770
 		$template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description());
771 771
 		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false);
772
-		$template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status() );
773
-		$template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values );
774
-		$templatepath = EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php';
772
+		$template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
773
+		$template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values);
774
+		$templatepath = EVENTS_CAF_TEMPLATE_PATH.'event_registration_options.template.php';
775 775
 		EEH_Template::display_template($templatepath, $template_args);
776 776
 	}
777 777
 
@@ -784,9 +784,9 @@  discard block
 block discarded – undo
784 784
 	 * @param  array  $box  metabox args
785 785
 	 * @return string       metabox contents
786 786
 	 */
787
-	public function event_type_meta_box( $post, $box ) {
788
-		$template_args['radio_list'] = $this->wp_terms_radio($post->ID, array( 'taxonomy' => 'espresso_event_type' ) );
789
-		$template = EVENTS_CAF_TEMPLATE_PATH . 'event_type_metabox_contents.template.php';
787
+	public function event_type_meta_box($post, $box) {
788
+		$template_args['radio_list'] = $this->wp_terms_radio($post->ID, array('taxonomy' => 'espresso_event_type'));
789
+		$template = EVENTS_CAF_TEMPLATE_PATH.'event_type_metabox_contents.template.php';
790 790
 		EEH_Template::display_template($template, $template_args);
791 791
 	}
792 792
 
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 
797 797
 
798 798
 
799
-	public function wp_terms_radio( $post_id = 0, $args = array() ) {
799
+	public function wp_terms_radio($post_id = 0, $args = array()) {
800 800
 		$defaults = array(
801 801
 			'descendants_and_self' => 0,
802 802
 			'selected_cats' => false,
@@ -805,11 +805,11 @@  discard block
 block discarded – undo
805 805
 			'taxonomy' => 'category',
806 806
 			'checked_ontop' => true
807 807
 		);
808
-		$args = apply_filters( 'wp_terms_checklist_args', $args, $post_id );
808
+		$args = apply_filters('wp_terms_checklist_args', $args, $post_id);
809 809
 
810
-		extract( wp_parse_args($args, $defaults), EXTR_SKIP );
810
+		extract(wp_parse_args($args, $defaults), EXTR_SKIP);
811 811
 
812
-		if ( empty($walker) || !is_a($walker, 'Walker') )
812
+		if (empty($walker) || ! is_a($walker, 'Walker'))
813 813
 			$walker = new Walker_Radio_Checklist;
814 814
 
815 815
 		$descendants_and_self = (int) $descendants_and_self;
@@ -817,37 +817,37 @@  discard block
 block discarded – undo
817 817
 		$args = array('taxonomy' => $taxonomy);
818 818
 
819 819
 		$tax = get_taxonomy($taxonomy);
820
-		$args['disabled'] = !current_user_can($tax->cap->assign_terms);
820
+		$args['disabled'] = ! current_user_can($tax->cap->assign_terms);
821 821
 
822
-		if ( is_array( $selected_cats ) )
822
+		if (is_array($selected_cats))
823 823
 			$args['selected_cats'] = $selected_cats;
824
-		elseif ( $post_id )
824
+		elseif ($post_id)
825 825
 			$args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids')));
826 826
 		else
827 827
 			$args['selected_cats'] = array();
828 828
 
829
-		if ( is_array( $popular_cats ) )
829
+		if (is_array($popular_cats))
830 830
 			$args['popular_cats'] = $popular_cats;
831 831
 		else
832
-			$args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
832
+			$args['popular_cats'] = get_terms($taxonomy, array('fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false));
833 833
 
834
-		if ( $descendants_and_self ) {
835
-			$categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) );
836
-			$self = get_term( $descendants_and_self, $taxonomy );
837
-			array_unshift( $categories, $self );
834
+		if ($descendants_and_self) {
835
+			$categories = (array) get_terms($taxonomy, array('child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0));
836
+			$self = get_term($descendants_and_self, $taxonomy);
837
+			array_unshift($categories, $self);
838 838
 		} else {
839 839
 			$categories = (array) get_terms($taxonomy, array('get' => 'all'));
840 840
 		}
841 841
 
842
-		if ( $checked_ontop ) {
842
+		if ($checked_ontop) {
843 843
 			// Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
844 844
 			$checked_categories = array();
845
-			$keys = array_keys( $categories );
845
+			$keys = array_keys($categories);
846 846
 
847
-			foreach( $keys as $k ) {
848
-				if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) {
847
+			foreach ($keys as $k) {
848
+				if (in_array($categories[$k]->term_id, $args['selected_cats'])) {
849 849
 					$checked_categories[] = $categories[$k];
850
-					unset( $categories[$k] );
850
+					unset($categories[$k]);
851 851
 				}
852 852
 			}
853 853
 
@@ -872,18 +872,18 @@  discard block
 block discarded – undo
872 872
 	 * @param  array  $list_table_obj the list table object
873 873
 	 * @return array                  new filters
874 874
 	 */
875
-	public function list_table_filters( $oldfilters, $list_table_obj ) {
875
+	public function list_table_filters($oldfilters, $list_table_obj) {
876 876
 		$filters = array();
877 877
 
878 878
 		//first month/year filters
879 879
 		$filters[] = $this->espresso_event_months_dropdown();
880 880
 
881 881
 
882
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
882
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
883 883
 
884 884
 		//active status dropdown
885
-		if ( $status !== 'draft' )
886
-			$filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' );
885
+		if ($status !== 'draft')
886
+			$filter[] = $this->active_status_dropdown(isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : '');
887 887
 
888 888
 		//category filter
889 889
 		$filters[] = $this->category_dropdown();
@@ -905,17 +905,17 @@  discard block
 block discarded – undo
905 905
 	 */
906 906
 	public function espresso_event_months_dropdown() {
907 907
 		//what we need to do is get all PRIMARY datetimes for all events to filter on. Note we need to include any other filters that are set!
908
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
908
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
909 909
 
910 910
 		//categories?
911
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
911
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
912 912
 
913 913
 		//active status?
914
-		$active_status = isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : NULL;
914
+		$active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : NULL;
915 915
 
916 916
 		$cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
917 917
 
918
-		return EEH_Form_Fields::generate_event_months_dropdown( $cur_date, $status, $category, $active_status );
918
+		return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status);
919 919
 	}
920 920
 
921 921
 
@@ -926,12 +926,12 @@  discard block
 block discarded – undo
926 926
 	 * @param  string $current_value whatever the ucrrent active status is
927 927
 	 * @return string                html dropdown.
928 928
 	 */
929
-	public function  active_status_dropdown( $current_value = '' ) {
929
+	public function  active_status_dropdown($current_value = '') {
930 930
 		$select_name = 'active_status';
931
-		$values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso') );
931
+		$values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso'));
932 932
 		$id = 'id="espresso-active-status-dropdown-filter"';
933 933
 		$class = 'wide';
934
-		echo EEH_Form_Fields::select_input( $select_name, $values, $current_value, $id, $class );
934
+		echo EEH_Form_Fields::select_input($select_name, $values, $current_value, $id, $class);
935 935
 	}
936 936
 
937 937
 
@@ -943,9 +943,9 @@  discard block
 block discarded – undo
943 943
 	 * @return string html
944 944
 	 */
945 945
 	public function category_dropdown() {
946
-		$cur_cat = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1;
946
+		$cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
947 947
 
948
-		return EEH_Form_Fields::generate_event_category_dropdown( $cur_cat );
948
+		return EEH_Form_Fields::generate_event_category_dropdown($cur_cat);
949 949
 	}
950 950
 
951 951
 
@@ -957,14 +957,14 @@  discard block
 block discarded – undo
957 957
 	 * @return int
958 958
 	 */
959 959
 	public function total_events_today() {
960
-		$start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 00:00:00', 'Y-m-d H:i:s', 'UTC' );
961
-		$end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' );
960
+		$start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 00:00:00', 'Y-m-d H:i:s', 'UTC');
961
+		$end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 23:59:59', 'Y-m-d H:i:s', 'UTC');
962 962
 
963 963
 		$where = array(
964
-			'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) )
964
+			'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end))
965 965
 			);
966 966
 
967
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
967
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
968 968
 		return $count;
969 969
 	}
970 970
 
@@ -979,14 +979,14 @@  discard block
 block discarded – undo
979 979
 		$this_year_r = date('Y');
980 980
 		$this_month_r = date('m');
981 981
 		$days_this_month = date('t');
982
-		$start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-01 00:00:00', 'Y-m-d H:i:s', 'UTC' );
983
-		$end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' );
982
+		$start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-01 00:00:00', 'Y-m-d H:i:s', 'UTC');
983
+		$end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' 23:59:59', 'Y-m-d H:i:s', 'UTC');
984 984
 
985 985
 		$where = array(
986
-			'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) )
986
+			'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end))
987 987
 			);
988 988
 
989
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
989
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
990 990
 		return $count;
991 991
 	}
992 992
 
@@ -1003,53 +1003,53 @@  discard block
 block discarded – undo
1003 1003
 
1004 1004
 
1005 1005
 
1006
-	public function get_default_tickets( $per_page = 10, $count = FALSE, $trashed = FALSE ) {
1006
+	public function get_default_tickets($per_page = 10, $count = FALSE, $trashed = FALSE) {
1007 1007
 
1008
-		$orderby= empty( $this->_req_data['orderby'] ) ? 'TKT_name' : $this->_req_data['orderby'];
1009
-		$order = empty( $this->_req_data['order'] ) ? 'ASC' : $this->_req_data['order'];
1008
+		$orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby'];
1009
+		$order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order'];
1010 1010
 
1011
-		switch ( $orderby ) {
1011
+		switch ($orderby) {
1012 1012
 			case 'TKT_name' :
1013
-				$orderby = array( 'TKT_name' => $order );
1013
+				$orderby = array('TKT_name' => $order);
1014 1014
 				break;
1015 1015
 
1016 1016
 			case 'TKT_price' :
1017
-				$orderby = array( 'TKT_price' => $order );
1017
+				$orderby = array('TKT_price' => $order);
1018 1018
 				break;
1019 1019
 
1020 1020
 			case 'TKT_uses' :
1021
-				$orderby = array( 'TKT_uses' => $order );
1021
+				$orderby = array('TKT_uses' => $order);
1022 1022
 				break;
1023 1023
 
1024 1024
 			case 'TKT_min' :
1025
-				$orderby = array( 'TKT_min' => $order );
1025
+				$orderby = array('TKT_min' => $order);
1026 1026
 				break;
1027 1027
 
1028 1028
 			case 'TKT_max' :
1029
-				$orderby = array( 'TKT_max' => $order );
1029
+				$orderby = array('TKT_max' => $order);
1030 1030
 				break;
1031 1031
 
1032 1032
 			case 'TKT_qty' :
1033
-				$orderby = array( 'TKT_qty' => $order );
1033
+				$orderby = array('TKT_qty' => $order);
1034 1034
 				break;
1035 1035
 		}
1036 1036
 
1037
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1038
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1037
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1038
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1039 1039
 
1040 1040
 		$_where = array(
1041 1041
 			'TKT_is_default' => 1,
1042 1042
 			'TKT_deleted' => $trashed
1043 1043
 			);
1044 1044
 
1045
-		$offset = ($current_page-1)*$per_page;
1046
-		$limit = array( $offset, $per_page );
1045
+		$offset = ($current_page - 1) * $per_page;
1046
+		$limit = array($offset, $per_page);
1047 1047
 
1048
-		if ( isset( $this->_req_data['s'] ) ) {
1049
-			$sstr = '%' . $this->_req_data['s'] . '%';
1048
+		if (isset($this->_req_data['s'])) {
1049
+			$sstr = '%'.$this->_req_data['s'].'%';
1050 1050
 			$_where['OR'] = array(
1051
-				'TKT_name' => array('LIKE',$sstr ),
1052
-				'TKT_description' => array('LIKE',$sstr )
1051
+				'TKT_name' => array('LIKE', $sstr),
1052
+				'TKT_description' => array('LIKE', $sstr)
1053 1053
 				);
1054 1054
 		}
1055 1055
 
@@ -1060,9 +1060,9 @@  discard block
 block discarded – undo
1060 1060
 			'group_by'=>'TKT_ID'
1061 1061
 			);
1062 1062
 
1063
-		if($count){
1063
+		if ($count) {
1064 1064
 			return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where));
1065
-		}else{
1065
+		} else {
1066 1066
 			return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params);
1067 1067
 		}
1068 1068
 
@@ -1072,35 +1072,35 @@  discard block
 block discarded – undo
1072 1072
 
1073 1073
 
1074 1074
 
1075
-	protected function _trash_or_restore_ticket(  $trash = FALSE ) {
1075
+	protected function _trash_or_restore_ticket($trash = FALSE) {
1076 1076
 		$success = 1;
1077 1077
 
1078 1078
 		$TKT = EEM_Ticket::instance();
1079 1079
 
1080 1080
 		//checkboxes?
1081
-		if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
1081
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1082 1082
 			//if array has more than one element then success message should be plural
1083
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1083
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1084 1084
 
1085 1085
 			//cycle thru the boxes
1086
-			while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
1087
-				if ( $trash ) {
1088
-					if ( ! $TKT->delete_by_ID( $TKT_ID ) )
1086
+			while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
1087
+				if ($trash) {
1088
+					if ( ! $TKT->delete_by_ID($TKT_ID))
1089 1089
 						$success = 0;
1090 1090
 				} else {
1091
-					if ( ! $TKT->restore_by_ID( $TKT_ID ) )
1091
+					if ( ! $TKT->restore_by_ID($TKT_ID))
1092 1092
 						$success = 0;
1093 1093
 				}
1094 1094
 			}
1095 1095
 		} else {
1096 1096
 			//grab single id and trash
1097
-			$TKT_ID = absint( $this->_req_data['TKT_ID'] );
1097
+			$TKT_ID = absint($this->_req_data['TKT_ID']);
1098 1098
 
1099
-			if ( $trash ) {
1100
-				if ( ! $TKT->delete_by_ID( $TKT_ID ) )
1099
+			if ($trash) {
1100
+				if ( ! $TKT->delete_by_ID($TKT_ID))
1101 1101
 					$success = 0;
1102 1102
 			} else {
1103
-				if ( ! $TKT->restore_by_ID( $TKT_ID ) )
1103
+				if ( ! $TKT->restore_by_ID($TKT_ID))
1104 1104
 					$success = 0;
1105 1105
 			}
1106 1106
 		}
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
 			'action' => 'ticket_list_table',
1111 1111
 			'status' => $trash ? '' : 'trashed'
1112 1112
 			);
1113
-		$this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args );
1113
+		$this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args);
1114 1114
 	}
1115 1115
 
1116 1116
 
@@ -1123,21 +1123,21 @@  discard block
 block discarded – undo
1123 1123
 		$TKT = EEM_Ticket::instance();
1124 1124
 
1125 1125
 		//checkboxes?
1126
-		if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
1126
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1127 1127
 			//if array has more than one element then success message should be plural
1128
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1128
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1129 1129
 
1130 1130
 			//cycle thru the boxes
1131
-			while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
1131
+			while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
1132 1132
 				//delete
1133
-				if ( ! $this->_delete_the_ticket( $TKT_ID ) ) {
1133
+				if ( ! $this->_delete_the_ticket($TKT_ID)) {
1134 1134
 					$success = 0;
1135 1135
 				}
1136 1136
 			}
1137 1137
 		} else {
1138 1138
 			//grab single id and trash
1139
-			$TKT_ID = absint( $this->_req_data['TKT_ID'] );
1140
-			if ( ! $this->_delete_the_ticket( $TKT_ID ) ) {
1139
+			$TKT_ID = absint($this->_req_data['TKT_ID']);
1140
+			if ( ! $this->_delete_the_ticket($TKT_ID)) {
1141 1141
 					$success = 0;
1142 1142
 				}
1143 1143
 		}
@@ -1149,16 +1149,16 @@  discard block
 block discarded – undo
1149 1149
 			);
1150 1150
 
1151 1151
 		//failsafe.  If the default ticket count === 1 then we need to redirect to event overview.
1152
-		if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) )
1152
+		if (EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE))
1153 1153
 			$query_args = array();
1154
-		$this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args );
1154
+		$this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args);
1155 1155
 	}
1156 1156
 
1157 1157
 
1158 1158
 
1159 1159
 
1160
-	protected function _delete_the_ticket( $TKT_ID ) {
1161
-		$tkt = EEM_Ticket::instance()->get_one_by_ID( $TKT_ID );
1160
+	protected function _delete_the_ticket($TKT_ID) {
1161
+		$tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID);
1162 1162
 		$tkt->_remove_relations('Datetime');
1163 1163
 		//delete all related prices first
1164 1164
 		$tkt->delete_related_permanently('Price');
Please login to merge, or discard this patch.
admin/extend/registrations/Extend_Registrations_Admin_Page.core.php 1 patch
Spacing   +234 added lines, -234 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
 /**
@@ -37,20 +37,20 @@  discard block
 block discarded – undo
37 37
 	protected $_reports_template_data = array();
38 38
 
39 39
 
40
-	public function __construct( $routing = TRUE ) {
41
-		parent::__construct( $routing );
42
-		define( 'REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/');
43
-		define( 'REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/');
44
-		define( 'REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/');
40
+	public function __construct($routing = TRUE) {
41
+		parent::__construct($routing);
42
+		define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/');
43
+		define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/');
44
+		define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/');
45 45
 	}
46 46
 
47 47
 
48 48
 	protected function _extend_page_config() {
49
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations';
49
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations';
50 50
 
51
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
52
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) ? ! is_array( $this->_req_data['ATT_ID'] ) : 0;
53
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
51
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
52
+		$att_id = ! empty($this->_req_data['ATT_ID']) ? ! is_array($this->_req_data['ATT_ID']) : 0;
53
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
54 54
 
55 55
 		$new_page_routes = array(
56 56
 			'reports' => array(
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 				)
90 90
 			);
91 91
 
92
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
92
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
93 93
 
94 94
 		$new_page_config = array(
95 95
 			'reports' => array(
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 						'filename' => 'registrations_event_checkin_other'
135 135
 					)
136 136
 				),
137
-				'help_tour' => array( 'Event_Checkin_Help_Tour' ),
138
-				'qtips' => array('Registration_List_Table_Tips' ),
137
+				'help_tour' => array('Event_Checkin_Help_Tour'),
138
+				'qtips' => array('Registration_List_Table_Tips'),
139 139
 				'list_table' => 'EE_Event_Registrations_List_Table',
140 140
 				'metaboxes' => array(),
141 141
 				'require_nonce' => FALSE
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 				),
154 154
 			);
155 155
 
156
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
156
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
157 157
 		$this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table';
158 158
 		$this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table';
159 159
 	}
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
 	protected function _ajax_hooks() {
164 164
 		parent::_ajax_hooks();
165
-		add_action( 'wp_ajax_get_newsletter_form_content', array( $this, 'get_newsletter_form_content' ) );
165
+		add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content'));
166 166
 	}
167 167
 
168 168
 
@@ -171,20 +171,20 @@  discard block
 block discarded – undo
171 171
 		parent::load_scripts_styles();
172 172
 
173 173
 		//if newsletter message type is active then let's add filter and load js for it.
174
-		if ( EEH_MSG_Template::is_mt_active('newsletter') ) {
174
+		if (EEH_MSG_Template::is_mt_active('newsletter')) {
175 175
 			//enqueue newsletter js
176
-			wp_enqueue_script( 'ee-newsletter-trigger', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, TRUE );
177
-			wp_enqueue_style( 'ee-newsletter-trigger-css', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION );
176
+			wp_enqueue_script('ee-newsletter-trigger', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE);
177
+			wp_enqueue_style('ee-newsletter-trigger-css', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION);
178 178
 			//hook in buttons for newsletter message type trigger.
179
-			add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array( $this, 'add_newsletter_action_buttons'), 10 );
179
+			add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_newsletter_action_buttons'), 10);
180 180
 		}
181 181
 	}
182 182
 
183 183
 
184 184
 
185 185
 	public function load_scripts_styles_reports() {
186
-		wp_register_script( 'ee-reg-reports-js', REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js', array( 'google-charts' ), EVENT_ESPRESSO_VERSION, true );
187
-		wp_enqueue_script( 'ee-reg-reports-js' );
186
+		wp_register_script('ee-reg-reports-js', REG_CAF_ASSETS_URL.'ee-registration-admin-reports.js', array('google-charts'), EVENT_ESPRESSO_VERSION, true);
187
+		wp_enqueue_script('ee-reg-reports-js');
188 188
 		$this->_registration_reports_js_setup();
189 189
 	}
190 190
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 				'slug' => 'all',
217 217
 				'label' => __('All', 'event_espresso'),
218 218
 				'count' => 0,
219
-				'bulk_action' => !isset( $this->_req_data['event_id'] ) ? array() : array(
219
+				'bulk_action' => ! isset($this->_req_data['event_id']) ? array() : array(
220 220
 					'toggle_checkin_status' => __('Toggle Check-In', 'event_espresso'),
221 221
 					//'trash_registrations' => __('Trash Registrations', 'event_espresso')
222 222
 					)
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 				'slug' => 'all',
235 235
 				'label' => __('All', 'event_espresso'),
236 236
 				'count' => 0,
237
-				'bulk_action' => array( 'delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso') )
237
+				'bulk_action' => array('delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso'))
238 238
 				),
239 239
 			);
240 240
 	}
@@ -250,20 +250,20 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	public function get_newsletter_form_content() {
252 252
 		//do a nonce check cause we're not coming in from an normal route here.
253
-		$nonce = isset( $this->_req_data['get_newsletter_form_content_nonce'] ) ? sanitize_text_field( $this->_req_data['get_newsletter_form_content_nonce'] ) : '';
253
+		$nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field($this->_req_data['get_newsletter_form_content_nonce']) : '';
254 254
 		$nonce_ref = 'get_newsletter_form_content_nonce';
255 255
 
256
-		$this->_verify_nonce( $nonce, $nonce_ref );
256
+		$this->_verify_nonce($nonce, $nonce_ref);
257 257
 		//let's get the mtp for the incoming MTP_ ID
258
-		if ( !isset( $this->_req_data['GRP_ID'] ) ) {
259
-			EE_Error::add_error( __('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
258
+		if ( ! isset($this->_req_data['GRP_ID'])) {
259
+			EE_Error::add_error(__('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
260 260
 			$this->_template_args['success'] = FALSE;
261 261
 			$this->_template_args['error'] = TRUE;
262 262
 			$this->_return_json();
263 263
 		}
264
-		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['GRP_ID'] );
265
-		if ( ! $MTPG instanceof EE_Message_Template_Group ) {
266
-			EE_Error::add_error( sprintf( __('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID'] ), __FILE__, __FUNCTION__, __LINE__  );
264
+		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);
265
+		if ( ! $MTPG instanceof EE_Message_Template_Group) {
266
+			EE_Error::add_error(sprintf(__('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID']), __FILE__, __FUNCTION__, __LINE__);
267 267
 			$this->_template_args['success'] = FALSE;
268 268
 			$this->_template_args['error'] = TRUE;
269 269
 			$this->_return_json();
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
 		$MTPs = $MTPG->context_templates();
273 273
 		$MTPs = $MTPs['attendee'];
274 274
 		$template_fields = array();
275
-		foreach ( $MTPs as $MTP ) {
275
+		foreach ($MTPs as $MTP) {
276 276
 			$field = $MTP->get('MTP_template_field');
277
-			if ( $field == 'content'  ) {
277
+			if ($field == 'content') {
278 278
 				$content = $MTP->get('MTP_content');
279
-				if ( !empty( $content['newsletter_content'] ) ) {
279
+				if ( ! empty($content['newsletter_content'])) {
280 280
 					$template_fields['newsletter_content'] = $content['newsletter_content'];
281 281
 					}
282 282
 				continue;
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		$this->_template_args['data'] = array(
290 290
 			'batch_message_from' => isset($template_fields['from']) ? $template_fields['from'] : '',
291 291
 			'batch_message_subject' => isset($template_fields['subject']) ? $template_fields['subject'] : '',
292
-			'batch_message_content' => isset( $template_fields['newsletter_content'] ) ? $template_fields['newsletter_content'] : ''
292
+			'batch_message_content' => isset($template_fields['newsletter_content']) ? $template_fields['newsletter_content'] : ''
293 293
 			);
294 294
 		$this->_return_json();
295 295
 	}
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 	 * @param EE_Admin_List_Table $list_table
306 306
 	 * @return string html string for extra buttons
307 307
 	 */
308
-	public function add_newsletter_action_buttons( EE_Admin_List_Table $list_table ) {
309
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_newsletter_selected_send' ) ) {
308
+	public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table) {
309
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_newsletter_selected_send')) {
310 310
 			return '';
311 311
 		}
312 312
 
@@ -315,13 +315,13 @@  discard block
 block discarded – undo
315 315
 			'event_registrations',
316 316
 			'default'
317 317
 			);
318
-		if ( $this->_current_page == 'espresso_registrations' && in_array( $this->_req_action, $routes_to_add_to )  ) {
319
-			if ( ( $this->_req_action == 'event_registrations' && empty( $this->_req_data['event_id'] ) ) || ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ) ) {
318
+		if ($this->_current_page == 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) {
319
+			if (($this->_req_action == 'event_registrations' && empty($this->_req_data['event_id'])) || (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash')) {
320 320
 				echo '';
321 321
 			} else {
322
-				$button_text = sprintf( __('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>' );
323
-				echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>' . $button_text . '</button>';
324
-				add_action('admin_footer', array( $this, 'newsletter_send_form_skeleton') );
322
+				$button_text = sprintf(__('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>');
323
+				echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>'.$button_text.'</button>';
324
+				add_action('admin_footer', array($this, 'newsletter_send_form_skeleton'));
325 325
 			}
326 326
 		}
327 327
 	}
@@ -333,37 +333,37 @@  discard block
 block discarded – undo
333 333
 		$list_table = $this->_list_table_object;
334 334
 		$codes = array();
335 335
 		//need to templates for the newsletter message type for the template selector.
336
-		$values[] = array( 'text' => __('Select Template to Use', 'event_espresso'), 'id' => 0 );
337
-		$mtps = EEM_Message_Template_Group::instance()->get_all( array( array( 'MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email' ) ) );
338
-		foreach ( $mtps as $mtp ) {
336
+		$values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0);
337
+		$mtps = EEM_Message_Template_Group::instance()->get_all(array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email')));
338
+		foreach ($mtps as $mtp) {
339 339
 			$name = $mtp->name();
340 340
 			$values[] = array(
341
-				'text' => empty( $name ) ? __('Global', 'event_espresso') : $name,
341
+				'text' => empty($name) ? __('Global', 'event_espresso') : $name,
342 342
 				'id' => $mtp->ID()
343 343
 				);
344 344
 		}
345 345
 
346 346
 		//need to get a list of shortcodes that are available for the newsletter message type.
347
-		$shortcodes = EEH_MSG_Template::get_shortcodes( 'newsletter', 'email', array(), 'attendee', FALSE );
348
-		foreach ( $shortcodes as $field => $shortcode_array ) {
349
-			$codes[$field] = implode(', ', array_keys($shortcode_array ) );
347
+		$shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', FALSE);
348
+		foreach ($shortcodes as $field => $shortcode_array) {
349
+			$codes[$field] = implode(', ', array_keys($shortcode_array));
350 350
 		}
351 351
 
352 352
 		$shortcodes = $codes;
353 353
 
354
-		$form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
354
+		$form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php';
355 355
 		$form_template_args = array(
356 356
 			'form_action' => admin_url('admin.php?page=espresso_registrations'),
357 357
 			'form_route' => 'newsletter_selected_send',
358 358
 			'form_nonce_name' => 'newsletter_selected_send_nonce',
359
-			'form_nonce' => wp_create_nonce( 'newsletter_selected_send_nonce' ),
359
+			'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'),
360 360
 			'redirect_back_to' => $this->_req_action,
361
-			'ajax_nonce' => wp_create_nonce( 'get_newsletter_form_content_nonce'),
362
-			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values ),
361
+			'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'),
362
+			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values),
363 363
 			'shortcodes' => $shortcodes,
364 364
 			'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration'
365 365
 			);
366
-		EEH_Template::display_template( $form_template, $form_template_args );
366
+		EEH_Template::display_template($form_template, $form_template_args);
367 367
 	}
368 368
 
369 369
 
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 	protected function _newsletter_selected_send() {
379 379
 		$success = TRUE;
380 380
 		//first we need to make sure we have a GRP_ID so we know what template we're sending and updating!
381
-		if ( empty( $this->_req_data['newsletter_mtp_selected'] ) ) {
381
+		if (empty($this->_req_data['newsletter_mtp_selected'])) {
382 382
 			EE_Error::add_error(
383 383
 				__(
384 384
 					'In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.',
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 			$success = FALSE;
390 390
 		}
391 391
 
392
-		if ( $success ) {
392
+		if ($success) {
393 393
 			//update Message template in case there are any changes
394 394
 			$Message_Template_Group = EEM_Message_Template_Group::instance()->get_one_by_ID(
395 395
 				$this->_req_data['newsletter_mtp_selected']
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 			$Message_Templates = $Message_Template_Group instanceof EE_Message_Template_Group
398 398
 				? $Message_Template_Group->context_templates()
399 399
 				: array();
400
-			if ( empty( $Message_Templates ) ) {
400
+			if (empty($Message_Templates)) {
401 401
 				EE_Error::add_error(
402 402
 					__(
403 403
 						'Unable to retrieve message template fields from the db. Messages not sent.',
@@ -408,25 +408,25 @@  discard block
 block discarded – undo
408 408
 			}
409 409
 
410 410
 			//let's just update the specific fields
411
-			foreach ( $Message_Templates['attendee'] as $Message_Template ) {
412
-				if ( $Message_Template instanceof EE_Message_Template ) {
413
-					$field = $Message_Template->get( 'MTP_template_field' );
414
-					$content = $Message_Template->get( 'MTP_content' );
411
+			foreach ($Message_Templates['attendee'] as $Message_Template) {
412
+				if ($Message_Template instanceof EE_Message_Template) {
413
+					$field = $Message_Template->get('MTP_template_field');
414
+					$content = $Message_Template->get('MTP_content');
415 415
 					$new_content = $content;
416
-					switch ( $field ) {
416
+					switch ($field) {
417 417
 						case 'from' :
418
-							$new_content = ! empty( $this->_req_data['batch_message']['from'] )
418
+							$new_content = ! empty($this->_req_data['batch_message']['from'])
419 419
 								? $this->_req_data['batch_message']['from']
420 420
 								: $content;
421 421
 							break;
422 422
 						case 'subject' :
423
-							$new_content = ! empty( $this->_req_data['batch_message']['subject'] )
423
+							$new_content = ! empty($this->_req_data['batch_message']['subject'])
424 424
 								? $this->_req_data['batch_message']['subject']
425 425
 								: $content;
426 426
 							break;
427 427
 						case 'content' :
428 428
 							$new_content = $content;
429
-							$new_content['newsletter_content'] = ! empty( $this->_req_data['batch_message']['content'] )
429
+							$new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content'])
430 430
 								? $this->_req_data['batch_message']['content']
431 431
 								: $content['newsletter_content'];
432 432
 							break;
@@ -434,35 +434,35 @@  discard block
 block discarded – undo
434 434
 							continue;
435 435
 							break;
436 436
 					}
437
-					$Message_Template->set( 'MTP_content', $new_content );
437
+					$Message_Template->set('MTP_content', $new_content);
438 438
 					$Message_Template->save();
439 439
 				}
440 440
 			}
441 441
 
442 442
 			//great fields are updated!  now let's make sure we just have contact objects (EE_Attendee).
443
-			$id_type = ! empty( $this->_req_data['batch_message']['id_type'] )
443
+			$id_type = ! empty($this->_req_data['batch_message']['id_type'])
444 444
 				? $this->_req_data['batch_message']['id_type']
445 445
 				: 'registration';
446 446
 
447 447
 			//id_type will affect how we assemble the ids.
448
-			$ids = ! empty( $this->_req_data['batch_message']['ids'] )
449
-				? json_decode( stripslashes($this->_req_data['batch_message']['ids']) )
448
+			$ids = ! empty($this->_req_data['batch_message']['ids'])
449
+				? json_decode(stripslashes($this->_req_data['batch_message']['ids']))
450 450
 				: array();
451 451
 
452 452
 			$registrations_used_for_contact_data = array();
453 453
 			//using switch because eventually we'll have other contexts that will be used for generating messages.
454
-			switch ( $id_type ) {
454
+			switch ($id_type) {
455 455
 				case 'registration' :
456 456
 					$registrations_used_for_contact_data = EEM_Registration::instance()->get_all(
457 457
 						array(
458 458
 							array(
459
-								'REG_ID' => array( 'IN', $ids )
459
+								'REG_ID' => array('IN', $ids)
460 460
 							)
461 461
 						)
462 462
 					);
463 463
 					break;
464 464
 				case 'contact' :
465
-					$registrations_used_for_contact_data = EEM_Registration::instance()->get_latest_registration_for_each_of_given_contacts( $ids );
465
+					$registrations_used_for_contact_data = EEM_Registration::instance()->get_latest_registration_for_each_of_given_contacts($ids);
466 466
 					break;
467 467
 			}
468 468
 			do_action(
@@ -473,8 +473,8 @@  discard block
 block discarded – undo
473 473
 			//kept for backward compat, internally we no longer use this action.
474 474
 			//@deprecated 4.8.36.rc.002
475 475
 			$contacts = $id_type == 'registration'
476
-				? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids( $ids )
477
-				: EEM_Attendee::instance()->get_all( array( array( 'ATT_ID' => array('in', $ids ) ) ) );
476
+				? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids)
477
+				: EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids))));
478 478
 			do_action(
479 479
 				'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send',
480 480
 				$contacts,
@@ -482,11 +482,11 @@  discard block
 block discarded – undo
482 482
 			);
483 483
 		}
484 484
 		$query_args = array(
485
-			'action' => !empty( $this->_req_data['redirect_back_to'] )
485
+			'action' => ! empty($this->_req_data['redirect_back_to'])
486 486
 				? $this->_req_data['redirect_back_to']
487 487
 				: 'default'
488 488
 			);
489
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
489
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
490 490
 	}
491 491
 
492 492
 
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 	*		@return void
509 509
 	*/
510 510
 	protected function _registration_reports() {
511
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
512
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_reports_template_data, true );
511
+		$template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php';
512
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_reports_template_data, true);
513 513
 		// the final template wrapper
514 514
 		$this->display_admin_page_with_no_sidebar();
515 515
 
@@ -522,28 +522,28 @@  discard block
 block discarded – undo
522 522
 	 *
523 523
 	 * @return string
524 524
 	 */
525
-	private function _registrations_per_day_report( $period = '-1 month' ) {
525
+	private function _registrations_per_day_report($period = '-1 month') {
526 526
 		$report_ID = 'reg-admin-registrations-per-day-report-dv';
527 527
 
528
-		$results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report( $period );
528
+		$results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period);
529 529
 
530 530
 		$results = (array) $results;
531 531
 		$regs = array();
532 532
 		$subtitle = '';
533 533
 
534
-		if( $results ) {
534
+		if ($results) {
535 535
 			$column_titles = array();
536 536
 			$tracker = 0;
537
-			foreach ( $results as $result ) {
537
+			foreach ($results as $result) {
538 538
 				$report_column_values = array();
539
-				foreach( $result as $property_name => $property_value ) {
539
+				foreach ($result as $property_name => $property_value) {
540 540
 					$property_value = $property_name == 'Registration_REG_date' ? $property_value : (int) $property_value;
541 541
 					$report_column_values[] = $property_value;
542
-					if ( $tracker === 0 ) {
543
-						if ( $property_name == 'Registration_REG_date' ) {
544
-							$column_titles[] = __( 'Date (only days with registrations are shown)', 'event_espresso' );
542
+					if ($tracker === 0) {
543
+						if ($property_name == 'Registration_REG_date') {
544
+							$column_titles[] = __('Date (only days with registrations are shown)', 'event_espresso');
545 545
 						} else {
546
-							$column_titles[] = EEH_Template::pretty_status( $property_name, false, 'sentence' );
546
+							$column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
547 547
 						}
548 548
 					}
549 549
 				}
@@ -552,36 +552,36 @@  discard block
 block discarded – undo
552 552
 			}
553 553
 
554 554
 			//make sure the column_titles is pushed to the beginning of the array
555
-			array_unshift( $regs, $column_titles );
555
+			array_unshift($regs, $column_titles);
556 556
 			//setup the date range.
557
-			$DateTimeZone = new DateTimeZone( EEH_DTT_Helper::get_timezone() );
558
-			$beginning_date = new DateTime( "now " . $period, $DateTimeZone );
559
-			$ending_date = new DateTime( "now", $DateTimeZone );
557
+			$DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
558
+			$beginning_date = new DateTime("now ".$period, $DateTimeZone);
559
+			$ending_date = new DateTime("now", $DateTimeZone);
560 560
 			$subtitle = sprintf(
561
-				_x( 'For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso' ),
562
-				$beginning_date->format( 'Y-m-d' ),
563
-				$ending_date->format( 'Y-m-d' )
561
+				_x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
562
+				$beginning_date->format('Y-m-d'),
563
+				$ending_date->format('Y-m-d')
564 564
 			);
565 565
 		}
566 566
 
567
-		$report_title = __( 'Total Registrations per Day', 'event_espresso' );
567
+		$report_title = __('Total Registrations per Day', 'event_espresso');
568 568
 
569 569
 		$report_params = array(
570 570
 			'title' 	=> $report_title,
571 571
 			'subtitle' => $subtitle,
572 572
 			'id' 		=> $report_ID,
573 573
 			'regs' 	=> $regs,
574
-			'noResults' => empty( $regs ),
574
+			'noResults' => empty($regs),
575 575
 			'noRegsMsg' => sprintf(
576 576
 				__(
577 577
 					'%sThere are currently no registration records in the last month for this report.%s',
578 578
 					'event_espresso'
579 579
 				),
580
-				'<h2>' . $report_title . '</h2><p>',
580
+				'<h2>'.$report_title.'</h2><p>',
581 581
 				'</p>'
582 582
 			),
583 583
 		);
584
-		wp_localize_script( 'ee-reg-reports-js', 'regPerDay', $report_params );
584
+		wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params);
585 585
 
586 586
 		return $report_ID;
587 587
 	}
@@ -593,29 +593,29 @@  discard block
 block discarded – undo
593 593
 	 *
594 594
 	 * @return string
595 595
 	 */
596
-	private function _registrations_per_event_report( $period = '-1 month' ) {
596
+	private function _registrations_per_event_report($period = '-1 month') {
597 597
 
598 598
 		$report_ID = 'reg-admin-registrations-per-event-report-dv';
599 599
 
600
-		$results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report( $period );
600
+		$results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period);
601 601
 
602 602
 		$results = (array) $results;
603 603
 		$regs = array();
604 604
 		$subtitle = '';
605 605
 
606
-		if ( $results ) {
606
+		if ($results) {
607 607
 			$column_titles = array();
608 608
 			$tracker = 0;
609
-			foreach ( $results as $result ) {
609
+			foreach ($results as $result) {
610 610
 				$report_column_values = array();
611
-				foreach( $result as $property_name => $property_value ) {
612
-					$property_value = $property_name == 'Registration_Event' ? wp_trim_words( $property_value, 4, '...' ) : (int) $property_value;
611
+				foreach ($result as $property_name => $property_value) {
612
+					$property_value = $property_name == 'Registration_Event' ? wp_trim_words($property_value, 4, '...') : (int) $property_value;
613 613
 					$report_column_values[] = $property_value;
614
-					if ( $tracker === 0 ) {
615
-						if ( $property_name == 'Registration_Event' ) {
616
-							$column_titles[] = __( 'Event', 'event_espresso' );
614
+					if ($tracker === 0) {
615
+						if ($property_name == 'Registration_Event') {
616
+							$column_titles[] = __('Event', 'event_espresso');
617 617
 						} else {
618
-							$column_titles[] = EEH_Template::pretty_status( $property_name, false, 'sentence' );
618
+							$column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
619 619
 						}
620 620
 					}
621 621
 				}
@@ -624,37 +624,37 @@  discard block
 block discarded – undo
624 624
 			}
625 625
 
626 626
 			//make sure the column_titles is pushed to the beginning of the array
627
-			array_unshift( $regs, $column_titles );
627
+			array_unshift($regs, $column_titles);
628 628
 
629 629
 			//setup the date range.
630
-			$DateTimeZone = new DateTimeZone( EEH_DTT_Helper::get_timezone() );
631
-			$beginning_date = new DateTime( "now " . $period, $DateTimeZone );
632
-			$ending_date = new DateTime( "now", $DateTimeZone );
630
+			$DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
631
+			$beginning_date = new DateTime("now ".$period, $DateTimeZone);
632
+			$ending_date = new DateTime("now", $DateTimeZone);
633 633
 			$subtitle = sprintf(
634
-				_x( 'For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso' ),
635
-				$beginning_date->format( 'Y-m-d' ),
636
-				$ending_date->format( 'Y-m-d' )
634
+				_x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
635
+				$beginning_date->format('Y-m-d'),
636
+				$ending_date->format('Y-m-d')
637 637
 			);
638 638
 		}
639 639
 
640
-		$report_title = __( 'Total Registrations per Event', 'event_espresso' );
640
+		$report_title = __('Total Registrations per Event', 'event_espresso');
641 641
 
642 642
 		$report_params = array(
643 643
 			'title' 	=> $report_title,
644 644
 			'subtitle' => $subtitle,
645 645
 			'id' 		=> $report_ID,
646 646
 			'regs' 	=> $regs,
647
-			'noResults' => empty( $regs ),
647
+			'noResults' => empty($regs),
648 648
 			'noRegsMsg' => sprintf(
649 649
 				__(
650 650
 					'%sThere are currently no registration records in the last month for this report.%s',
651 651
 					'event_espresso'
652 652
 				),
653
-				'<h2>' . $report_title . '</h2><p>',
653
+				'<h2>'.$report_title.'</h2><p>',
654 654
 				'</p>'
655 655
 			),
656 656
 		);
657
-		wp_localize_script( 'ee-reg-reports-js', 'regPerEvent', $report_params );
657
+		wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params);
658 658
 
659 659
 		return $report_ID;
660 660
 	}
@@ -668,8 +668,8 @@  discard block
 block discarded – undo
668 668
 	 * @return void
669 669
 	 */
670 670
 	protected function _registration_checkin_list_table() {
671
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
672
-		$reg_id = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : null;
671
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
672
+		$reg_id = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : null;
673 673
 		$reg = EEM_Registration::instance()->get_one_by_ID($reg_id);
674 674
 		$this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $reg->event_ID()), 'add-new-h2');
675 675
 
@@ -683,15 +683,15 @@  discard block
 block discarded – undo
683 683
 				'desc' => __('This indicates the attendee has been checked out', 'event_espresso')
684 684
 				)
685 685
 			);
686
-		$this->_template_args['after_list_table'] = $this->_display_legend( $legend_items );
686
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
687 687
 
688 688
 
689
-		$dtt_id = isset(  $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
690
-		$go_back_url = !empty( $reg_id )  ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id ), $this->_admin_base_url ) : '';
689
+		$dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
690
+		$go_back_url = ! empty($reg_id) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id), $this->_admin_base_url) : '';
691 691
 
692
-		$this->_template_args['before_list_table'] = !empty( $reg_id ) && !empty( $dtt_id ) ? '<h2>' . sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">' . EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name() . '</span>', '<span id="checkin-dtt"><a href="' . $go_back_url . '">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time() . ' - ' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time() . '</a></span>', '<span id="checkin-event-name">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name') . '</span>' ) . '</h2>' : '';
693
-		$this->_template_args['list_table_hidden_fields'] = !empty( $reg_id ) ? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : '';
694
-		$this->_template_args['list_table_hidden_fields'] .= !empty( $dtt_id ) ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
692
+		$this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id) ? '<h2>'.sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">'.EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name().'</span>', '<span id="checkin-dtt"><a href="'.$go_back_url.'">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time().' - '.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time().'</a></span>', '<span id="checkin-event-name">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name').'</span>').'</h2>' : '';
693
+		$this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) ? '<input type="hidden" name="_REGID" value="'.$reg_id.'">' : '';
694
+		$this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : '';
695 695
 
696 696
 		$this->display_admin_list_table_page_with_no_sidebar();
697 697
 	}
@@ -704,24 +704,24 @@  discard block
 block discarded – undo
704 704
 	 */
705 705
 	public function toggle_checkin_status() {
706 706
 		//first make sure we have the necessary data
707
-		if ( !isset( $this->_req_data['_regid'] ) ) {
708
-			EE_Error::add_error( __('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
707
+		if ( ! isset($this->_req_data['_regid'])) {
708
+			EE_Error::add_error(__('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
709 709
 			$this->_template_args['success'] = FALSE;
710 710
 			$this->_template_args['error'] = TRUE;
711 711
 			$this->_return_json();
712 712
 		};
713 713
 
714 714
 		//do a nonce check cause we're not coming in from an normal route here.
715
-		$nonce = isset( $this->_req_data['checkinnonce'] ) ? sanitize_text_field( $this->_req_data['checkinnonce'] ) : '';
715
+		$nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce']) : '';
716 716
 		$nonce_ref = 'checkin_nonce';
717 717
 
718
-		$this->_verify_nonce( $nonce, $nonce_ref );
718
+		$this->_verify_nonce($nonce, $nonce_ref);
719 719
 
720 720
 		//beautiful! Made it this far so let's get the status.
721 721
 		$new_status = $this->_toggle_checkin_status();
722 722
 
723 723
 		//setup new class to return via ajax
724
-		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-' . $new_status;
724
+		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-'.$new_status;
725 725
 		$this->_template_args['success'] = TRUE;
726 726
 		$this->_return_json();
727 727
 	}
@@ -741,32 +741,32 @@  discard block
 block discarded – undo
741 741
 		//first let's get the query args out of the way for the redirect
742 742
 		$query_args = array(
743 743
 			'action' => 'event_registrations',
744
-			'event_id' => isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL,
745
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL
744
+			'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL,
745
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL
746 746
 			);
747 747
 		$new_status = FALSE;
748 748
 
749 749
 		// bulk action check in toggle
750
-		if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) {
750
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
751 751
 			// cycle thru checkboxes
752
-			while ( list( $REG_ID, $value ) = each($this->_req_data['checkbox'])) {
753
-				$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
752
+			while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) {
753
+				$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
754 754
 				$new_status = $this->_toggle_checkin($REG_ID, $DTT_ID);
755 755
 			}
756 756
 
757
-		} elseif ( isset( $this->_req_data['_regid'] ) ) {
757
+		} elseif (isset($this->_req_data['_regid'])) {
758 758
 			//coming from ajax request
759
-			$DTT_ID = isset( $this->_req_data['dttid'] ) ? $this->_req_data['dttid'] : NULL;
759
+			$DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : NULL;
760 760
 			$query_args['DTT_ID'] = $DTT_ID;
761 761
 			$new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID);
762 762
 		} else {
763
-			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
763
+			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
764 764
 		}
765 765
 
766
-		if ( defined('DOING_AJAX' ) )
766
+		if (defined('DOING_AJAX'))
767 767
 			return $new_status;
768 768
 
769
-		$this->_redirect_after_action( FALSE,'', '', $query_args, TRUE );
769
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
770 770
 
771 771
 	}
772 772
 
@@ -782,11 +782,11 @@  discard block
 block discarded – undo
782 782
 	 */
783 783
 	private function _toggle_checkin($REG_ID, $DTT_ID) {
784 784
 		$REG = EEM_Registration::instance()->get_one_by_ID($REG_ID);
785
-		$new_status = $REG->toggle_checkin_status( $DTT_ID );
786
-		if ( $new_status !== FALSE ) {
787
-			EE_Error::add_success($REG->get_checkin_msg($DTT_ID) );
785
+		$new_status = $REG->toggle_checkin_status($DTT_ID);
786
+		if ($new_status !== FALSE) {
787
+			EE_Error::add_success($REG->get_checkin_msg($DTT_ID));
788 788
 		} else {
789
-			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__ );
789
+			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__);
790 790
 			$new_status = FALSE;
791 791
 		}
792 792
 		return $new_status;
@@ -802,28 +802,28 @@  discard block
 block discarded – undo
802 802
 	protected function _delete_checkin_rows() {
803 803
 		$query_args = array(
804 804
 			'action' => 'registration_checkins',
805
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0,
806
-			'_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0
805
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
806
+			'_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0
807 807
 			);
808
-		if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
809
-			while ( list( $CHK_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
808
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
809
+			while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) {
810 810
 				$errors = 0;
811
-				if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID ) ) {
811
+				if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
812 812
 					$errors++;
813 813
 				}
814 814
 			}
815 815
 		} else {
816
-			EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
817
-			$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
816
+			EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
817
+			$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
818 818
 		}
819 819
 
820
-		if ( $errors > 0 ) {
821
-			EE_Error::add_error( sprintf( __('There were %d records that did not delete successfully', 'event_espresso'), $errors ), __FILE__, __FUNCTION__, __LINE__ );
820
+		if ($errors > 0) {
821
+			EE_Error::add_error(sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors), __FILE__, __FUNCTION__, __LINE__);
822 822
 		} else {
823
-			EE_Error::add_success( __('Records were successfully deleted', 'event_espresso') );
823
+			EE_Error::add_success(__('Records were successfully deleted', 'event_espresso'));
824 824
 		}
825 825
 
826
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
826
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
827 827
 	}
828 828
 
829 829
 
@@ -835,20 +835,20 @@  discard block
 block discarded – undo
835 835
 	protected function _delete_checkin_row() {
836 836
 		$query_args = array(
837 837
 			'action' => 'registration_checkins',
838
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0,
839
-			'_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0
838
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
839
+			'_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0
840 840
 			);
841 841
 
842
-		if ( !empty( $this->_req_data['CHK_ID'] ) ) {
843
-			if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'] ) ) {
844
-				EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
842
+		if ( ! empty($this->_req_data['CHK_ID'])) {
843
+			if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
844
+				EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
845 845
 			} else {
846
-				EE_Error::add_success( __('Check-In record successfully deleted', 'event_espresso') );
846
+				EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso'));
847 847
 			}
848 848
 		} else {
849
-			EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
849
+			EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
850 850
 		}
851
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
851
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
852 852
 	}
853 853
 
854 854
 
@@ -861,8 +861,8 @@  discard block
 block discarded – undo
861 861
 	*		@return void
862 862
 	*/
863 863
 	protected function _event_registrations_list_table() {
864
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
865
-		$this->_admin_page_title .= isset( $this->_req_data['event_id'] ) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : '';
864
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
865
+		$this->_admin_page_title .= isset($this->_req_data['event_id']) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : '';
866 866
 
867 867
 		$legend_items = array(
868 868
 			'star-icon' => array(
@@ -886,31 +886,31 @@  discard block
 block discarded – undo
886 886
 				'desc' => __('View All Check-in Records for this Registrant', 'event_espresso')
887 887
 				),
888 888
 			'approved_status' => array(
889
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
890
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
889
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
890
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
891 891
 				),
892 892
             'cancelled_status' => array(
893
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
894
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
893
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
894
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
895 895
 				),
896 896
             'declined_status' => array(
897
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
898
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
897
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
898
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
899 899
 				),
900 900
 			'not_approved' => array(
901
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
902
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
901
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
902
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
903 903
 				),
904 904
 			'pending_status' => array(
905
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
906
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
905
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
906
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
907 907
 				)/**/
908 908
 			);
909
-		$this->_template_args['after_list_table'] = $this->_display_legend( $legend_items );
909
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
910 910
 
911
-		$event_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null;
912
-		$this->_template_args['before_list_table'] = !empty( $event_id ) ? '<h2>' . sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name') ) . '</h2>' : '';
913
-		$this->_template_args['list_table_hidden_fields'] = !empty( $event_id ) ? '<input type="hidden" name="event_id" value="' . $event_id . '">' : '';
911
+		$event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
912
+		$this->_template_args['before_list_table'] = ! empty($event_id) ? '<h2>'.sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')).'</h2>' : '';
913
+		$this->_template_args['list_table_hidden_fields'] = ! empty($event_id) ? '<input type="hidden" name="event_id" value="'.$event_id.'">' : '';
914 914
 
915 915
 		$this->display_admin_list_table_page_with_no_sidebar();
916 916
 	}
@@ -924,15 +924,15 @@  discard block
 block discarded – undo
924 924
 	*		@access public
925 925
 	*		@return array
926 926
 	*/
927
-	public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) {
927
+	public function get_event_attendees($per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '') {
928 928
 
929
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
930
-		require_once(EE_MODELS . 'EEM_Attendee.model.php');
929
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
930
+		require_once(EE_MODELS.'EEM_Attendee.model.php');
931 931
 		//$ATT_MDL = EEM_Attendee::instance();
932 932
 
933
-		$EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE;
934
-		$CAT_ID = isset($this->_req_data['category_id']) ? absint( $this->_req_data['category_id'] ) : FALSE;
935
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
933
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
934
+		$CAT_ID = isset($this->_req_data['category_id']) ? absint($this->_req_data['category_id']) : FALSE;
935
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
936 936
 
937 937
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby;
938 938
 
@@ -945,94 +945,94 @@  discard block
 block discarded – undo
945 945
 //				$orderby = 'reg.REG_final_price';
946 946
 		}
947 947
 
948
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
948
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
949 949
 
950
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
951
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
950
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
951
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
952 952
 
953 953
 
954
-		$offset = ($current_page-1)*$per_page;
955
-		$limit = $count ? NULL : array( $offset, $per_page );
956
-		$query_params = array(array('Event.status'=>array('IN',  array_keys(EEM_Event::instance()->get_status_array()))));
957
-		if ($EVT_ID){
958
-			$query_params[0]['EVT_ID']=$EVT_ID;
954
+		$offset = ($current_page - 1) * $per_page;
955
+		$limit = $count ? NULL : array($offset, $per_page);
956
+		$query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array()))));
957
+		if ($EVT_ID) {
958
+			$query_params[0]['EVT_ID'] = $EVT_ID;
959 959
 		}
960
-		if($CAT_ID){
960
+		if ($CAT_ID) {
961 961
 			throw new EE_Error("You specified a Category Id for this query. Thats odd because we are now using terms and taxonomies. So did you mean the term taxonomy id o rthe term id?");
962 962
 		}
963 963
 
964 964
 		//if DTT is included we do multiple datetimes.
965
-		if ( $DTT_ID ) {
965
+		if ($DTT_ID) {
966 966
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
967 967
 		}
968 968
 
969 969
 		//make sure we only have default where on the current regs
970 970
 		$query_params['default_where_conditions'] = 'this_model_only';
971 971
 
972
-		$status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) );
972
+		$status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved));
973 973
 
974
-		$query_params[0]['STS_ID']= array('IN', $status_ids_array );
974
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
975 975
 
976
-		if($trash){
977
-			$query_params[0]['Attendee.status']=  EEM_CPT_Base::post_status_trashed;
976
+		if ($trash) {
977
+			$query_params[0]['Attendee.status'] = EEM_CPT_Base::post_status_trashed;
978 978
 		}
979 979
 
980
-		if ( isset( $this->_req_data['s'] ) ) {
981
-			$sstr = '%' . $this->_req_data['s'] . '%';
980
+		if (isset($this->_req_data['s'])) {
981
+			$sstr = '%'.$this->_req_data['s'].'%';
982 982
 			$query_params[0]['OR'] = array(
983
-				'Event.EVT_name' => array( 'LIKE', $sstr),
984
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
985
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
986
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
987
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
988
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
989
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
990
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
991
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
992
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
993
-				'REG_final_price' => array( 'LIKE', $sstr ),
994
-				'REG_code' => array( 'LIKE', $sstr ),
995
-				'REG_count' => array( 'LIKE' , $sstr ),
996
-				'REG_group_size' => array( 'LIKE' , $sstr ),
997
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
998
-				'Ticket.TKT_description' => array( 'LIKE', $sstr )
983
+				'Event.EVT_name' => array('LIKE', $sstr),
984
+				'Event.EVT_desc' => array('LIKE', $sstr),
985
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
986
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
987
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
988
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
989
+				'Attendee.ATT_email' => array('LIKE', $sstr),
990
+				'Attendee.ATT_address' => array('LIKE', $sstr),
991
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
992
+				'Attendee.ATT_city' => array('LIKE', $sstr),
993
+				'REG_final_price' => array('LIKE', $sstr),
994
+				'REG_code' => array('LIKE', $sstr),
995
+				'REG_count' => array('LIKE', $sstr),
996
+				'REG_group_size' => array('LIKE', $sstr),
997
+				'Ticket.TKT_name' => array('LIKE', $sstr),
998
+				'Ticket.TKT_description' => array('LIKE', $sstr)
999 999
 				);
1000 1000
 		}
1001 1001
 
1002 1002
 		$query_params['order_by'][$orderby] = $sort;
1003 1003
 		$query_params['limit'] = $limit;
1004
-		$query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration
1005
-		if($count){
1006
-			$registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only' ));
1007
-		}else{
1004
+		$query_params['force_join'] = array('Attendee'); //force join to attendee model so that it gets cached, because we're going to need the attendee for each registration
1005
+		if ($count) {
1006
+			$registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only'));
1007
+		} else {
1008 1008
 			$registrations = EEM_Registration::instance()->get_all($query_params);
1009 1009
 
1010 1010
 
1011 1011
 	//		$registrations = EEM_Registration::instance();
1012 1012
 	//		$all_attendees = EEM_Attendee::instance()->get_event_attendees( $EVT_ID, $CAT_ID, $reg_status, $trash, $orderby, $sort, $limit, $output );
1013
-			if ( isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration ) {
1013
+			if (isset($registrations[0]) && $registrations[0] instanceof EE_Registration) {
1014 1014
 				//EEH_Debug_Tools::printr( $all_attendees[0], '$all_attendees[0]  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1015 1015
 				// name
1016 1016
 				$first_registration = $registrations[0];
1017 1017
 				$event_obj = $first_registration->event_obj();
1018
-				if($event_obj){
1018
+				if ($event_obj) {
1019 1019
 					$event_name = $first_registration->event_obj()->name();
1020
-					$event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?';//$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1020
+					$event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?'; //$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1021 1021
 					// edit event link
1022
-					if ( $event_name != '' ) {
1023
-						$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1024
-						$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1025
-						$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1022
+					if ($event_name != '') {
1023
+						$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1024
+						$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1025
+						$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1026 1026
 					}
1027 1027
 
1028
-					$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1029
-					$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">&laquo; ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>';
1028
+					$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1029
+					$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">&laquo; '.__('Back to All Registrations', 'event_espresso').'</a>';
1030 1030
 
1031 1031
 					$this->_template_args['before_admin_page_content'] = '
1032 1032
 				<div id="admin-page-header">
1033
-					<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1034
-					<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1035
-					<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1033
+					<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1034
+					<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1035
+					<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1036 1036
 				</div>
1037 1037
 				';
1038 1038
 				}
Please login to merge, or discard this patch.
admin/extend/registrations/EE_Event_Registrations_List_Table.class.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 
18 18
 
19
-	public function __construct( $admin_page ) {
19
+	public function __construct($admin_page) {
20 20
 		parent::__construct($admin_page);
21 21
 		$this->_status = $this->_admin_page->get_registration_status_array();
22 22
 	}
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 
26 26
 
27 27
 	protected function _setup_data() {
28
-		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page ) : $this->_admin_page->get_event_attendees( $this->_per_page, FALSE, TRUE );
29
-		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees(  $this->_per_page, TRUE ) : $this->_admin_page->get_event_attendees(  $this->_per_page, TRUE, TRUE);
28
+		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) : $this->_admin_page->get_event_attendees($this->_per_page, FALSE, TRUE);
29
+		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page, TRUE) : $this->_admin_page->get_event_attendees($this->_per_page, TRUE, TRUE);
30 30
 	}
31 31
 
32 32
 
33 33
 
34 34
 
35 35
 	protected function _set_properties() {
36
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL;
36
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL;
37 37
 
38 38
 		$this->_wp_list_args = array(
39 39
 			'singular' => __('registrant', 'event_espresso'),
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 		$columns = array();
46 46
 		//$columns['_Reg_Status'] = '';
47
-		if ( !empty( $evt_id ) ) {
47
+		if ( ! empty($evt_id)) {
48 48
 			$columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text
49 49
 			$this->_has_checkbox_column = true;
50 50
 		}
@@ -60,43 +60,43 @@  discard block
 block discarded – undo
60 60
 				'TXN_total' => __('Total', 'event_espresso')
61 61
 			);
62 62
 
63
-		$this->_columns = array_merge( $columns, $this->_columns);
63
+		$this->_columns = array_merge($columns, $this->_columns);
64 64
 
65 65
 		$this->_primary_column = '_REG_att_checked_in';
66 66
 
67
-		if ( !empty( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id )  ) {
67
+		if ( ! empty($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id)) {
68 68
 			$this->_bottom_buttons = array(
69 69
 				'report'=> array(
70 70
 					'route' => 'registrations_report',
71 71
 					'extra_request' => 
72 72
 						array( 
73 73
 							'EVT_ID'=> $evt_id, 
74
-							'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
74
+							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
75 75
 				)
76 76
 			);
77 77
 		}
78 78
 
79 79
 		$this->_sortable_columns = array(
80 80
 			 //true means its already sorted
81
-			'ATT_name' => array( 'ATT_name' => TRUE ),
82
-			'Event' => array( 'Event.EVT.Name' => FALSE )
81
+			'ATT_name' => array('ATT_name' => TRUE),
82
+			'Event' => array('Event.EVT.Name' => FALSE)
83 83
 		);
84 84
 
85 85
 		$this->_hidden_columns = array();
86 86
 
87 87
 		$this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id);
88
-		$this->_dtts_for_event = !empty($evt_id) ? $this->_evt->datetimes_ordered() : array();
88
+		$this->_dtts_for_event = ! empty($evt_id) ? $this->_evt->datetimes_ordered() : array();
89 89
 
90 90
 	}
91 91
 
92 92
 
93 93
 
94 94
 
95
-	protected function _get_row_class( $item ) {
96
-		$class = parent::_get_row_class( $item );
95
+	protected function _get_row_class($item) {
96
+		$class = parent::_get_row_class($item);
97 97
 		//add status class
98
-		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
99
-		if ( $this->_has_checkbox_column ) {
98
+		$class .= ' ee-status-strip reg-status-'.$item->status_ID();
99
+		if ($this->_has_checkbox_column) {
100 100
 			$class .= ' has-checkbox-column';
101 101
 		}
102 102
 		return $class;
@@ -108,42 +108,42 @@  discard block
 block discarded – undo
108 108
 		$filters = $where = array();
109 109
 
110 110
 
111
-		if ( empty( $this->_dtts_for_event ) ) {
111
+		if (empty($this->_dtts_for_event)) {
112 112
 			//this means we don't have an event so let's setup a filter dropdown for all the events to select
113 113
 			//note possible capability restrictions
114
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events') ) {
115
-				$where['status**'] =  array( '!=', 'private' );
114
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
115
+				$where['status**'] = array('!=', 'private');
116 116
 			}
117 117
 
118
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
119
-				$where['EVT_wp_user'] =  get_current_user_id();
118
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
119
+				$where['EVT_wp_user'] = get_current_user_id();
120 120
 			}
121 121
 
122
-			$events = EEM_Event::instance()->get_all(array( $where, 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ) ) );
123
-			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') );
124
-			foreach ( $events as $evt ) {
122
+			$events = EEM_Event::instance()->get_all(array($where, 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC')));
123
+			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso'));
124
+			foreach ($events as $evt) {
125 125
 				//any registrations for this event?
126
-				if ( ! $evt->get_count_of_all_registrations() )
126
+				if ( ! $evt->get_count_of_all_registrations())
127 127
 					continue;
128 128
 				$evts[] = array(
129 129
 					'id' => $evt->ID(),
130
-					'text' => $evt->get( 'EVT_name' ),
130
+					'text' => $evt->get('EVT_name'),
131 131
 					'class' => $evt->is_expired() ? 'ee-expired-event' : ''
132 132
 				);
133 133
 			}
134 134
 			$event_filter = '<div class="ee-event-filter">';
135
-			$event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts );
136
-			$event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>' . ' ' . __( 'Hide Expired Events', 'event_espresso' ) . '</span>';
135
+			$event_filter .= EEH_Form_Fields::select_input('event_id', $evts);
136
+			$event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>'.' '.__('Hide Expired Events', 'event_espresso').'</span>';
137 137
 			$event_filter .= '</div>';
138 138
 			$filters[] = $event_filter;
139 139
 
140 140
 		} else {
141 141
 			//DTT datetimes filter
142
-			$cur_dtt = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();
142
+			$cur_dtt = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();
143 143
 			$dtts = array();
144
-			foreach ( $this->_dtts_for_event as $dtt ) {
145
-				$datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time();
146
-				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string );
144
+			foreach ($this->_dtts_for_event as $dtt) {
145
+				$datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time();
146
+				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string);
147 147
 			}
148 148
 			$filters[] = EEH_Form_Fields::select_input('DTT_ID', $dtts, $cur_dtt);
149 149
 		}
@@ -164,19 +164,19 @@  discard block
 block discarded – undo
164 164
 
165 165
 
166 166
 	protected function _get_total_event_attendees() {
167
-		$EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE;
168
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
167
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
168
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
169 169
 		$query_params = array();
170
-		if ($EVT_ID){
171
-			$query_params[0]['EVT_ID']=$EVT_ID;
170
+		if ($EVT_ID) {
171
+			$query_params[0]['EVT_ID'] = $EVT_ID;
172 172
 		}
173 173
 		//if DTT is included we do multiple datetimes.  Otherwise we just do primary datetime
174
-		if ( $DTT_ID ) {
174
+		if ($DTT_ID) {
175 175
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
176 176
 		}
177
-		$status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) );
177
+		$status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved));
178 178
 
179
-		$query_params[0]['STS_ID']= array('IN', $status_ids_array );
179
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
180 180
 
181 181
 		return EEM_Registration::instance()->count($query_params);
182 182
 	}
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 
188 188
 
189 189
 
190
-	function column__Reg_Status( EE_Registration $item ) {
191
-		return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
190
+	function column__Reg_Status(EE_Registration $item) {
191
+		return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>';
192 192
 	}
193 193
 
194 194
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
 
198 198
 	function column_cb($item) {
199
-		return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() );
199
+		return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
200 200
 	}
201 201
 
202 202
 
@@ -209,18 +209,18 @@  discard block
 block discarded – undo
209 209
 	/**
210 210
 	 * 		column_REG_att_checked_in
211 211
 	*/
212
-	function column__REG_att_checked_in(EE_Registration $item){
212
+	function column__REG_att_checked_in(EE_Registration $item) {
213 213
 		$attendee = $item->attendee();
214 214
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
215
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0;
215
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;
216 216
 		$checkinstatus = $item->check_in_status_for_datetime($DTT_ID);
217 217
 		$nonce = wp_create_nonce('checkin_nonce');
218
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL;
219
-		$toggle_active = !empty ( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID() ) ? ' clickable trigger-checkin' : '';
218
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL;
219
+		$toggle_active = ! empty ($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID()) ? ' clickable trigger-checkin' : '';
220 220
 
221
-		$mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
221
+		$mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>';
222 222
 
223
-		 return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '" data-_regid="' . $item->ID() . '" data-dttid="' . $DTT_ID . '" data-nonce="' . $nonce . '"></span>' . $mobile_view_content;
223
+		 return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'" data-_regid="'.$item->ID().'" data-dttid="'.$DTT_ID.'" data-nonce="'.$nonce.'"></span>'.$mobile_view_content;
224 224
 	}
225 225
 
226 226
 
@@ -229,43 +229,43 @@  discard block
 block discarded – undo
229 229
 
230 230
 	function column_ATT_name(EE_Registration $item) {
231 231
 		$attendee = $item->attendee();
232
-		if ( ! $attendee instanceof EE_Attendee ) {
232
+		if ( ! $attendee instanceof EE_Attendee) {
233 233
 			return __('No contact record for this registration.', 'event_espresso');
234 234
 		}
235 235
 
236 236
 		// edit attendee link
237
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
238
-		$name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_contacts', 'espresso_registrations_edit_attendee' ) ?  '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' . $item->attendee()->full_name() . '</a>' : $item->attendee()->full_name();
237
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
238
+		$name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact', 'event_espresso').'">'.$item->attendee()->full_name().'</a>' : $item->attendee()->full_name();
239 239
 		$name_link .= $item->count() == 1 ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>	' : '';
240 240
 
241 241
 		//add group details
242
-		$name_link .= '&nbsp;' . sprintf(__( '(%s of %s)', 'event_espresso' ),$item->count(), $item->group_size());
242
+		$name_link .= '&nbsp;'.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
243 243
 
244 244
 		//add regcode
245
-		$link = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), REG_ADMIN_URL );
245
+		$link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL);
246 246
 		$name_link .= '<br>';
247
-		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID() )
248
-			? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') .'">' . $item->reg_code() . '</a>'
247
+		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID())
248
+			? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$item->reg_code().'</a>'
249 249
 			: $item->reg_code();
250 250
 
251 251
 		//status
252
-		$name_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
252
+		$name_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
253 253
 
254 254
 		$actions = array();
255
-		$DTT_ID = !empty( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
256
-		$DTT_ID = empty( $DTT_ID ) && !empty( $this->_req_data['event_id'] ) ? EEM_Event::instance()->get_one_by_ID( $this->_req_data['event_id'] )->primary_datetime()->ID() : $DTT_ID;
255
+		$DTT_ID = ! empty($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
256
+		$DTT_ID = empty($DTT_ID) && ! empty($this->_req_data['event_id']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['event_id'])->primary_datetime()->ID() : $DTT_ID;
257 257
 
258
-		if ( !empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ) {
259
-			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID));
260
-			$actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso' ) . '">' . __('View', 'event_espresso') . '</a>';
258
+		if ( ! empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins')) {
259
+			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID));
260
+			$actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso').'">'.__('View', 'event_espresso').'</a>';
261 261
 		}
262 262
 
263
-		return !empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions($actions) ) : $name_link;
263
+		return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link;
264 264
 	}
265 265
 
266 266
 
267 267
 
268
-	function column_ATT_email( EE_Registration $item ) {
268
+	function column_ATT_email(EE_Registration $item) {
269 269
 		$attendee = $item->attendee();
270 270
 		return $attendee instanceof EE_Attendee ? $attendee->email() : '';
271 271
 		return $item->get_first_related('Attendee')->email();
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 
278 278
 	function column_Event(EE_Registration $item) {
279 279
 		$event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event();
280
-		$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$event->ID() ), REG_ADMIN_URL );
281
-		$event_label = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ?  '<a href="'.$chkin_lnk_url.'" title="' . esc_attr__( 'View Checkins for this Event', 'event_espresso' ) . '">' . $event->name() . '</a>' : $event->name();
280
+		$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$event->ID()), REG_ADMIN_URL);
281
+		$event_label = EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins') ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__('View Checkins for this Event', 'event_espresso').'">'.$event->name().'</a>' : $event->name();
282 282
 		return $event_label;
283 283
 	}
284 284
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
 
288 288
 
289
-	function column_PRC_name(EE_Registration $item){
289
+	function column_PRC_name(EE_Registration $item) {
290 290
 		return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso");
291 291
 	}
292 292
 
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
 	/**
299 299
 	 * 		column_REG_final_price
300 300
 	*/
301
-	function column__REG_final_price(EE_Registration $item){
302
-		return '<span class="reg-pad-rght">' .  ' ' . $item->pretty_final_price() . '</span>';
301
+	function column__REG_final_price(EE_Registration $item) {
302
+		return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>';
303 303
 	}
304 304
 
305 305
 
@@ -309,20 +309,20 @@  discard block
 block discarded – undo
309 309
 	/**
310 310
 	 * 		column_TXN_paid
311 311
 	*/
312
-	function column_TXN_paid(EE_Registration $item){
312
+	function column_TXN_paid(EE_Registration $item) {
313 313
 
314
-		if ( $item->count() == 1 ) {
314
+		if ($item->count() == 1) {
315 315
 
316
-			if ( $item->transaction()->paid() >= $item->transaction()->total() ) {
316
+			if ($item->transaction()->paid() >= $item->transaction()->total()) {
317 317
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
318 318
 			} else {
319
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
320
-				return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '
319
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
320
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '
321 321
 				<span class="reg-pad-rght">
322
-					<a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">
323
-						' . $item->transaction()->pretty_paid(). '
322
+					<a class="status-'. $item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">
323
+						' . $item->transaction()->pretty_paid().'
324 324
 					</a>
325
-				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
325
+				<span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
326 326
 			}
327 327
 		} else {
328 328
 			return '<span class="reg-pad-rght"></span>';
@@ -336,13 +336,13 @@  discard block
 block discarded – undo
336 336
 	/**
337 337
 	 * 		column_TXN_total
338 338
 	*/
339
-	function column_TXN_total(EE_Registration $item){
339
+	function column_TXN_total(EE_Registration $item) {
340 340
 		$txn = $item->transaction();
341
-		$view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL );
342
-		if ( $item->get('REG_count') == 1 ) {
341
+		$view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL);
342
+		if ($item->get('REG_count') == 1) {
343 343
 			$line_total_obj = $txn->total_line_item();
344 344
 			$txn_total = $line_total_obj instanceof EE_Line_Item ? $line_total_obj->get_pretty('LIN_total') : __('View Transaction', 'event_espresso');
345
-			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '<a href="' . $view_txn_url . '" title="' . esc_attr__('View Transaction', 'event_espresso') . '"><span class="reg-pad-rght">'. $txn_total  .'</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
345
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_txn_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"><span class="reg-pad-rght">'.$txn_total.'</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>';
346 346
 		} else {
347 347
 			return '<span class="reg-pad-rght"></span>';
348 348
 		}
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php 1 patch
Spacing   +381 added lines, -381 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
 /**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		$this->_name = 'pricing';
55 55
 
56 56
 		//capability check
57
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) {
57
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) {
58 58
 			return;
59 59
 		}
60 60
 
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 		//if we were going to add our own metaboxes we'd use the below.
63 63
 		$this->_metaboxes = array(
64 64
 			0 => array(
65
-				'page_route' => array('edit','create_new'),
65
+				'page_route' => array('edit', 'create_new'),
66 66
 				'func' => 'pricing_metabox',
67 67
 				'label' => __('Event Tickets & Datetimes', 'event_espresso'),
68 68
 				'priority' => 'high',
69 69
 				'context' => 'normal'
70 70
 				),
71 71
 
72
-			);/**/
72
+			); /**/
73 73
 
74 74
 		$this->_remove_metaboxes = array(
75 75
 			0 => array(
@@ -88,24 +88,24 @@  discard block
 block discarded – undo
88 88
 		 *
89 89
 		 * @var array  Expected an array returned with 'date' and 'time' keys.
90 90
 		 */
91
-		$this->_date_format_strings = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
91
+		$this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
92 92
 				'date' => 'Y-m-d',
93 93
 				'time' => 'h:i a'
94 94
 			));
95 95
 
96 96
 		//validate
97
-		$this->_date_format_strings['date'] = isset( $this->_date_format_strings['date'] ) ? $this->_date_format_strings['date'] : null;
98
-		$this->_date_format_strings['time'] = isset( $this->_date_format_strings['time'] ) ? $this->_date_format_strings['time'] : null;
97
+		$this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null;
98
+		$this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null;
99 99
 
100 100
 		//validate format strings
101
-		$format_validation = EEH_DTT_Helper::validate_format_string( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
102
-		if ( is_array( $format_validation ) ) {
103
-			$msg = '<p>' . sprintf( __( 'The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso' ), $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ) . '</p><ul>';
104
-			foreach ( $format_validation as $error ) {
105
-				$msg .= '<li>' . $error . '</li>';
101
+		$format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
102
+		if (is_array($format_validation)) {
103
+			$msg = '<p>'.sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso'), $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']).'</p><ul>';
104
+			foreach ($format_validation as $error) {
105
+				$msg .= '<li>'.$error.'</li>';
106 106
 			}
107
-			$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
108
-			EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
107
+			$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
108
+			EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
109 109
 			$this->_date_format_strings = array(
110 110
 				'date' => 'Y-m-d',
111 111
 				'time' => 'h:i a'
@@ -116,60 +116,60 @@  discard block
 block discarded – undo
116 116
 		$this->_scripts_styles = array(
117 117
 			'registers' => array(
118 118
 				'ee-tickets-datetimes-css' => array(
119
-					'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css',
119
+					'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css',
120 120
 					'type' => 'css'
121 121
 					),
122 122
 				'ee-dtt-ticket-metabox' => array(
123
-					'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js',
123
+					'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js',
124 124
 					'depends' => array('ee-datepicker', 'ee-dialog', 'underscore')
125 125
 					)
126 126
 				),
127 127
 			'deregisters' => array(
128
-				'event-editor-css' => array('type' => 'css' ),
128
+				'event-editor-css' => array('type' => 'css'),
129 129
 				'event-datetime-metabox' => array('type' => 'js')
130 130
 				),
131 131
 			'enqueues' => array(
132
-				'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ),
133
-				'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' )
132
+				'ee-tickets-datetimes-css' => array('edit', 'create_new'),
133
+				'ee-dtt-ticket-metabox' => array('edit', 'create_new')
134 134
 				),
135 135
 			'localize' => array(
136 136
 				'ee-dtt-ticket-metabox' => array(
137 137
 					'DTT_TRASH_BLOCK' => array(
138 138
 						'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'),
139 139
 						'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'),
140
-						'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>',
140
+						'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>',
141 141
 						'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
142 142
 						'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket.  Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
143
-						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>'
143
+						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>'
144 144
 						),
145 145
 					'DTT_ERROR_MSG' => array(
146 146
 						'no_ticket_name' => __('General Admission', 'event_espresso'),
147
-						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>'
147
+						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>'
148 148
 						),
149 149
 					'DTT_OVERSELL_WARNING' => array(
150 150
 						'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', 'event_espresso'),
151 151
 						'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', 'event_espresso')
152 152
 						),
153
-					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats( $this->_date_format_strings['date'], $this->_date_format_strings['time'] ),
154
-					'DTT_START_OF_WEEK' => array( 'dayValue' => (int) get_option( 'start_of_week' ) )
153
+					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']),
154
+					'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week'))
155 155
 					)
156 156
 				)
157 157
 			);
158 158
 
159 159
 
160
-		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 );
161
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
160
+		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10);
161
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
162 162
 	}
163 163
 
164 164
 
165 165
 
166
-	public function caf_updates( $update_callbacks ) {
167
-		foreach ( $update_callbacks as $key => $callback ) {
168
-			if ( $callback[1] == '_default_tickets_update' )
169
-				unset( $update_callbacks[$key] );
166
+	public function caf_updates($update_callbacks) {
167
+		foreach ($update_callbacks as $key => $callback) {
168
+			if ($callback[1] == '_default_tickets_update')
169
+				unset($update_callbacks[$key]);
170 170
 		}
171 171
 
172
-		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
172
+		$update_callbacks[] = array($this, 'dtt_and_tickets_caf_update');
173 173
 		return $update_callbacks;
174 174
 	}
175 175
 
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 	 * @param  array    $data   The request data from the form
183 183
 	 * @return bool             success or fail
184 184
 	 */
185
-	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
185
+	public function dtt_and_tickets_caf_update($evtobj, $data) {
186 186
 		//first we need to start with datetimes cause they are the "root" items attached to events.
187
-		$saved_dtts = $this->_update_dtts( $evtobj, $data );
187
+		$saved_dtts = $this->_update_dtts($evtobj, $data);
188 188
 		//next tackle the tickets (and prices?)
189
-		$this->_update_tkts( $evtobj, $saved_dtts, $data );
189
+		$this->_update_tkts($evtobj, $saved_dtts, $data);
190 190
 	}
191 191
 
192 192
 
@@ -197,41 +197,41 @@  discard block
 block discarded – undo
197 197
 	 * @param  array    	$data    the request data from the form
198 198
 	 * @return EE_Datetime[]
199 199
 	 */
200
-	protected function _update_dtts( $evt_obj, $data ) {
201
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
200
+	protected function _update_dtts($evt_obj, $data) {
201
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
202 202
 		$saved_dtt_ids = array();
203 203
 		$saved_dtt_objs = array();
204 204
 
205
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
205
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
206 206
 			//trim all values to ensure any excess whitespace is removed.
207 207
 			$dtt = array_map(
208
-				function( $datetime_data ) {
209
-					return is_array( $datetime_data ) ? $datetime_data : trim( $datetime_data );
208
+				function($datetime_data) {
209
+					return is_array($datetime_data) ? $datetime_data : trim($datetime_data);
210 210
 				},
211 211
 				$dtt
212 212
 			);
213
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
213
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
214 214
 			$datetime_values = array(
215
-				'DTT_ID' 			=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
216
-				'DTT_name' 			=> ! empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '',
217
-				'DTT_description' 	=> ! empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '',
215
+				'DTT_ID' 			=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
216
+				'DTT_name' 			=> ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '',
217
+				'DTT_description' 	=> ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '',
218 218
 				'DTT_EVT_start' 	=> $dtt['DTT_EVT_start'],
219 219
 				'DTT_EVT_end' 		=> $dtt['DTT_EVT_end'],
220
-				'DTT_reg_limit' 	=> empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt[ 'DTT_reg_limit' ],
221
-				'DTT_order' 		=> ! isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'],
220
+				'DTT_reg_limit' 	=> empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
221
+				'DTT_order' 		=> ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'],
222 222
 			);
223 223
 
224 224
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
225 225
 
226
-			if ( !empty( $dtt['DTT_ID'] ) ) {
227
-				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] );
226
+			if ( ! empty($dtt['DTT_ID'])) {
227
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']);
228 228
 
229 229
 				//set date and time format according to what is set in this class.
230
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
231
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
230
+				$DTM->set_date_format($this->_date_format_strings['date']);
231
+				$DTM->set_time_format($this->_date_format_strings['time']);
232 232
 
233
-				foreach ( $datetime_values as $field => $value ) {
234
-					$DTM->set( $field, $value );
233
+				foreach ($datetime_values as $field => $value) {
234
+					$DTM->set($field, $value);
235 235
 				}
236 236
 
237 237
 				// make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.
@@ -239,24 +239,24 @@  discard block
 block discarded – undo
239 239
 				$saved_dtt_ids[$DTM->ID()] = $DTM->ID();
240 240
 
241 241
 			} else {
242
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE );
242
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE);
243 243
 
244 244
 				//reset date and times to match the format
245
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
246
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
247
-				foreach( $datetime_values as $field => $value ) {
248
-					$DTM->set( $field, $value );
245
+				$DTM->set_date_format($this->_date_format_strings['date']);
246
+				$DTM->set_time_format($this->_date_format_strings['time']);
247
+				foreach ($datetime_values as $field => $value) {
248
+					$DTM->set($field, $value);
249 249
 				}
250 250
 			}
251 251
 
252 252
 
253 253
 			$DTM->save();
254
-			$DTM = $evt_obj->_add_relation_to( $DTM, 'Datetime' );
254
+			$DTM = $evt_obj->_add_relation_to($DTM, 'Datetime');
255 255
 			$evt_obj->save();
256 256
 
257 257
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
258
-			if( $DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end') ) {
259
-				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start') );
258
+			if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) {
259
+				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start'));
260 260
 				$DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days');
261 261
 				$DTM->save();
262 262
 			}
@@ -271,25 +271,25 @@  discard block
 block discarded – undo
271 271
 		}
272 272
 
273 273
 		//now we need to REMOVE any dtts that got deleted.  Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point.
274
-		$old_datetimes = explode(',', $data['datetime_IDs'] );
274
+		$old_datetimes = explode(',', $data['datetime_IDs']);
275 275
 		$old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes;
276 276
 
277
-		if ( is_array( $old_datetimes ) ) {
278
-			$dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids );
279
-			foreach ( $dtts_to_delete as $id ) {
280
-				$id = absint( $id );
281
-				if ( empty( $id ) )
277
+		if (is_array($old_datetimes)) {
278
+			$dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids);
279
+			foreach ($dtts_to_delete as $id) {
280
+				$id = absint($id);
281
+				if (empty($id))
282 282
 					continue;
283 283
 
284 284
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
285 285
 
286 286
 				//remove tkt relationships.
287 287
 				$related_tickets = $dtt_to_remove->get_many_related('Ticket');
288
-				foreach ( $related_tickets as $tkt ) {
288
+				foreach ($related_tickets as $tkt) {
289 289
 					$dtt_to_remove->_remove_relation_to($tkt, 'Ticket');
290 290
 				}
291 291
 
292
-				$evt_obj->_remove_relation_to( $id, 'Datetime' );
292
+				$evt_obj->_remove_relation_to($id, 'Datetime');
293 293
 				$dtt_to_remove->refresh_cache_of_related_objects();
294 294
 
295 295
 			}
@@ -310,85 +310,85 @@  discard block
 block discarded – undo
310 310
 	 * @param  array            $data       incoming request data
311 311
 	 * @return EE_Ticket[]
312 312
 	 */
313
-	protected function _update_tkts( $evtobj, $saved_dtts, $data ) {
313
+	protected function _update_tkts($evtobj, $saved_dtts, $data) {
314 314
 
315 315
 		$new_tkt = null;
316 316
 		$new_default = null;
317 317
 		//stripslashes because WP filtered the $_POST ($data) array to add slashes
318 318
 		$data = stripslashes_deep($data);
319
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
319
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
320 320
 		$saved_tickets = $dtts_on_existing = array();
321
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
321
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
322 322
 
323 323
 		//load money helper
324 324
 
325
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
325
+		foreach ($data['edit_tickets'] as $row => $tkt) {
326 326
 
327 327
 			$update_prices = $create_new_TKT = FALSE;
328 328
 
329 329
 			//figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session.
330 330
 
331
-			$starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]);
332
-			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] );
331
+			$starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]);
332
+			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]);
333 333
 			$dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows);
334 334
 			$dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows);
335 335
 
336 336
 			// trim inputs to ensure any excess whitespace is removed.
337 337
 			$tkt = array_map(
338
-				function( $ticket_data ) {
339
-					return is_array( $ticket_data ) ? $ticket_data : trim( $ticket_data );
338
+				function($ticket_data) {
339
+					return is_array($ticket_data) ? $ticket_data : trim($ticket_data);
340 340
 				},
341 341
 				$tkt
342 342
 			);
343 343
 
344 344
 			//note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models.
345 345
 			//note incoming ['TKT_price'] value is already in standard notation (via js).
346
-			$ticket_price = isset( $tkt['TKT_price'] ) ?  round ( (float) $tkt['TKT_price'], 3 ) : 0;
346
+			$ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0;
347 347
 
348 348
 			//note incoming base price needs converted from localized value.
349
-			$base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0;
349
+			$base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0;
350 350
 			//if ticket price == 0 and $base_price != 0 then ticket price == base_price
351 351
 			$ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price;
352
-			$base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0;
352
+			$base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0;
353 353
 
354 354
 			$price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array();
355 355
 
356 356
 			$now = null;
357
-			if ( empty( $tkt['TKT_start_date'] ) ) {
357
+			if (empty($tkt['TKT_start_date'])) {
358 358
 				//lets' use now in the set timezone.
359
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
360
-				$tkt['TKT_start_date'] = $now->format( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
359
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
360
+				$tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
361 361
 			}
362 362
 
363
-			if ( empty( $tkt['TKT_end_date'] ) ) {
363
+			if (empty($tkt['TKT_end_date'])) {
364 364
 				/**
365 365
 				 * set the TKT_end_date to the first datetime attached to the ticket.
366 366
 				 */
367
-				$first_dtt = $saved_dtts[reset( $tkt_dtt_rows )];
368
-				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time( $this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time'] );
367
+				$first_dtt = $saved_dtts[reset($tkt_dtt_rows)];
368
+				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']);
369 369
 			}
370 370
 
371 371
 			$TKT_values = array(
372
-				'TKT_ID' 			=> ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
373
-				'TTM_ID' 			=> ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
374
-				'TKT_name' 			=> ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
375
-				'TKT_description' 	=> ! empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
372
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
373
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
374
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
375
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
376 376
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
377 377
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
378
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt[ 'TKT_qty' ],
379
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt['TKT_uses'],
380
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
381
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
378
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
379
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
380
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
381
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
382 382
 				'TKT_row' 			=> $row,
383
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0,
384
-				'TKT_taxable' 		=> ! empty( $tkt['TKT_taxable'] ) ? 1 : 0,
385
-				'TKT_required' 		=> ! empty( $tkt['TKT_required'] ) ? 1 : 0,
383
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0,
384
+				'TKT_taxable' 		=> ! empty($tkt['TKT_taxable']) ? 1 : 0,
385
+				'TKT_required' 		=> ! empty($tkt['TKT_required']) ? 1 : 0,
386 386
 				'TKT_price' 		=> $ticket_price
387 387
 			);
388 388
 
389 389
 
390 390
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
391
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
391
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
392 392
 				$TKT_values['TKT_ID'] = 0;
393 393
 				$TKT_values['TKT_is_default'] = 0;
394 394
 				$update_prices = TRUE;
@@ -400,21 +400,21 @@  discard block
 block discarded – undo
400 400
 			// but DID have it's items modified.
401 401
 			// keep in mind that if the TKT has been sold (and we have changed pricing information),
402 402
 			// then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
403
-			if ( absint( $TKT_values['TKT_ID'] ) ) {
404
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] );
405
-				if ( $TKT instanceof EE_Ticket ) {
403
+			if (absint($TKT_values['TKT_ID'])) {
404
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']);
405
+				if ($TKT instanceof EE_Ticket) {
406 406
 
407
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
407
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
408 408
 					// are there any registrations using this ticket ?
409 409
 					$tickets_sold = $TKT->count_related(
410 410
 						'Registration',
411
-						array( array(
412
-								'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) )
413
-						) )
411
+						array(array(
412
+								'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))
413
+						))
414 414
 					);
415 415
 					//set ticket formats
416
-					$TKT->set_date_format( $this->_date_format_strings['date'] );
417
-					$TKT->set_time_format( $this->_date_format_strings['time'] );
416
+					$TKT->set_date_format($this->_date_format_strings['date']);
417
+					$TKT->set_time_format($this->_date_format_strings['time']);
418 418
 
419 419
 					// let's just check the total price for the existing ticket
420 420
 					// and determine if it matches the new total price.
@@ -424,17 +424,17 @@  discard block
 block discarded – undo
424 424
 							? TRUE : FALSE;
425 425
 
426 426
 					//set new values
427
-					foreach ( $TKT_values as $field => $value ) {
428
-						if ( $field === 'TKT_qty' ) {
429
-							$TKT->set_qty( $value );
427
+					foreach ($TKT_values as $field => $value) {
428
+						if ($field === 'TKT_qty') {
429
+							$TKT->set_qty($value);
430 430
 						} else {
431
-							$TKT->set( $field, $value );
431
+							$TKT->set($field, $value);
432 432
 						}
433 433
 					}
434 434
 
435 435
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
436
-					if ( $create_new_TKT ) {
437
-						$new_tkt = $this->_duplicate_ticket( $TKT, $price_rows, $ticket_price, $base_price, $base_price_id );
436
+					if ($create_new_TKT) {
437
+						$new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price, $base_price_id);
438 438
 					}
439 439
 				}
440 440
 
@@ -443,12 +443,12 @@  discard block
 block discarded – undo
443 443
 				$TKT = EE_Ticket::new_instance(
444 444
 					$TKT_values,
445 445
 					$timezone,
446
-					array( $this->_date_format_strings[ 'date' ], $this->_date_format_strings[ 'time' ]  )
446
+					array($this->_date_format_strings['date'], $this->_date_format_strings['time'])
447 447
 				);
448
-				if ( $TKT instanceof EE_Ticket ) {
448
+				if ($TKT instanceof EE_Ticket) {
449 449
 					// make sure ticket has an ID of setting relations won't work
450 450
 					$TKT->save();
451
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
451
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
452 452
 					$update_prices = TRUE;
453 453
 				}
454 454
 			}
@@ -456,37 +456,37 @@  discard block
 block discarded – undo
456 456
 			//$TKT->save();
457 457
 
458 458
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
459
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
460
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
459
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
460
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
461 461
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
462 462
 			}
463 463
 
464 464
 			//let's make sure the base price is handled
465
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT;
465
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT;
466 466
 
467 467
 			//add/update price_modifiers
468
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT;
468
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT;
469 469
 
470 470
 			//need to make sue that the TKT_price is accurate after saving the prices.
471 471
 			$TKT->ensure_TKT_Price_correct();
472 472
 
473 473
 			//handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave.
474
-			if ( ! defined('DOING_AUTOSAVE' ) ) {
475
-				if ( !empty($tkt['TKT_is_default_selector'] ) ) {
474
+			if ( ! defined('DOING_AUTOSAVE')) {
475
+				if ( ! empty($tkt['TKT_is_default_selector'])) {
476 476
 					$update_prices = TRUE;
477 477
 					$new_default = clone $TKT;
478
-					$new_default->set( 'TKT_ID', 0 );
479
-					$new_default->set( 'TKT_is_default', 1 );
480
-					$new_default->set( 'TKT_row', 1 );
481
-					$new_default->set( 'TKT_price', $ticket_price );
478
+					$new_default->set('TKT_ID', 0);
479
+					$new_default->set('TKT_is_default', 1);
480
+					$new_default->set('TKT_row', 1);
481
+					$new_default->set('TKT_price', $ticket_price);
482 482
 					//remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object)
483 483
 					$new_default->_remove_relations('Datetime');
484 484
 					//todo we need to add the current attached prices as new prices to the new default ticket.
485
-					$new_default = $this->_add_prices_to_ticket( $price_rows, $new_default, $update_prices );
485
+					$new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices);
486 486
 					//don't forget the base price!
487
-					$new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id );
487
+					$new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id);
488 488
 					$new_default->save();
489
-					do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data );
489
+					do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data);
490 490
 				}
491 491
 			}
492 492
 
@@ -497,19 +497,19 @@  discard block
 block discarded – undo
497 497
 			//let's assign any tickets that have been setup to the saved_tickets tracker
498 498
 			//save existing TKT
499 499
 			$TKT->save();
500
-			if ( $create_new_TKT && $new_tkt instanceof EE_Ticket ) {
500
+			if ($create_new_TKT && $new_tkt instanceof EE_Ticket) {
501 501
 				//save new TKT
502 502
 				$new_tkt->save();
503 503
 				//add new ticket to array
504
-				$saved_tickets[ $new_tkt->ID() ] = $new_tkt;
504
+				$saved_tickets[$new_tkt->ID()] = $new_tkt;
505 505
 
506
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data );
506
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data);
507 507
 
508 508
 			} else {
509 509
 				//add tkt to saved tkts
510
-				$saved_tickets[ $TKT->ID() ] = $TKT;
510
+				$saved_tickets[$TKT->ID()] = $TKT;
511 511
 
512
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data );
512
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data);
513 513
 			}
514 514
 
515 515
 		}
@@ -519,22 +519,22 @@  discard block
 block discarded – undo
519 519
 		// (i.e. autosaves are happening and then in between autosaves the user trashes a ticket).
520 520
 		// Or a draft event was saved and in the process of editing a ticket is trashed.
521 521
 		// No sense in keeping all the related data in the db!
522
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
523
-		$tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) );
522
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
523
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
524 524
 
525
-		foreach ( $tickets_removed as $id ) {
526
-			$id = absint( $id );
525
+		foreach ($tickets_removed as $id) {
526
+			$id = absint($id);
527 527
 
528 528
 			//get the ticket for this id
529 529
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
530 530
 
531 531
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
532
-			if ( $tkt_to_remove->get('TKT_is_default') )
532
+			if ($tkt_to_remove->get('TKT_is_default'))
533 533
 				continue;
534 534
 
535 535
 			// if this tkt has any registrations attached so then we just ARCHIVE
536 536
 			// because we don't actually permanently delete these tickets.
537
-			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
537
+			if ($tkt_to_remove->count_related('Registration') > 0) {
538 538
 				$tkt_to_remove->delete();
539 539
 				continue;
540 540
 			}
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 			// (remember this process can ONLY kick off if there are NO tkts_sold)
544 544
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
545 545
 
546
-			foreach( $dtts as $dtt ) {
546
+			foreach ($dtts as $dtt) {
547 547
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
548 548
 			}
549 549
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 			// tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
552 552
 			$tkt_to_remove->delete_related_permanently('Price');
553 553
 
554
-			do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove );
554
+			do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove);
555 555
 
556 556
 			// finally let's delete this ticket
557 557
 			// (which should not be blocked at this point b/c we've removed all our relationships)
@@ -583,39 +583,39 @@  discard block
 block discarded – undo
583 583
 		// and removing the ticket from datetimes it got removed from.
584 584
 
585 585
 		// first let's add datetimes
586
-		if ( ! empty( $added_datetimes ) && is_array( $added_datetimes ) ) {
587
-			foreach ( $added_datetimes as $row_id ) {
588
-				$row_id = (int)$row_id;
589
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
590
-					$ticket->_add_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
586
+		if ( ! empty($added_datetimes) && is_array($added_datetimes)) {
587
+			foreach ($added_datetimes as $row_id) {
588
+				$row_id = (int) $row_id;
589
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
590
+					$ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime');
591 591
 					// Is this an existing ticket (has an ID) and does it have any sold?
592 592
 					// If so, then we need to add that to the DTT sold because this DTT is getting added.
593
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
594
-						$saved_datetimes[ $row_id ]->increase_sold( $ticket->sold() );
595
-						$saved_datetimes[ $row_id ]->save();
593
+					if ($ticket->ID() && $ticket->sold() > 0) {
594
+						$saved_datetimes[$row_id]->increase_sold($ticket->sold());
595
+						$saved_datetimes[$row_id]->save();
596 596
 					}
597 597
 				}
598 598
 			}
599 599
 		}
600 600
 		// then remove datetimes
601
-		if ( ! empty( $removed_datetimes ) && is_array( $removed_datetimes ) ) {
602
-			foreach ( $removed_datetimes as $row_id ) {
603
-				$row_id = (int)$row_id;
601
+		if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) {
602
+			foreach ($removed_datetimes as $row_id) {
603
+				$row_id = (int) $row_id;
604 604
 				// its entirely possible that a datetime got deleted (instead of just removed from relationship.
605 605
 				// So make sure we skip over this if the dtt isn't in the $saved_datetimes array)
606
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
607
-					$ticket->_remove_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
606
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
607
+					$ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime');
608 608
 					// Is this an existing ticket (has an ID) and does it have any sold?
609 609
 					// If so, then we need to remove it's sold from the DTT_sold.
610
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
611
-						$saved_datetimes[ $row_id ]->decrease_sold( $ticket->sold() );
612
-						$saved_datetimes[ $row_id ]->save();
610
+					if ($ticket->ID() && $ticket->sold() > 0) {
611
+						$saved_datetimes[$row_id]->decrease_sold($ticket->sold());
612
+						$saved_datetimes[$row_id]->save();
613 613
 					}
614 614
 				}
615 615
 			}
616 616
 		}
617 617
 		// cap ticket qty by datetime reg limits
618
-		$ticket->set_qty( min( $ticket->qty(), $ticket->qty( 'reg_limit' ) ) );
618
+		$ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit')));
619 619
 		return $ticket;
620 620
 	}
621 621
 
@@ -636,39 +636,39 @@  discard block
 block discarded – undo
636 636
 		EE_Ticket $ticket,
637 637
 		$price_rows = array(),
638 638
 		$ticket_price = 0,
639
-		$base_price = 0 ,
639
+		$base_price = 0,
640 640
 		$base_price_id = 0
641 641
 	) {
642 642
 
643 643
 		// create new ticket that's a copy of the existing
644 644
 		// except a new id of course (and not archived)
645 645
 		// AND has the new TKT_price associated with it.
646
-		$new_ticket = clone( $ticket );
647
-		$new_ticket->set( 'TKT_ID', 0 );
648
-		$new_ticket->set( 'TKT_deleted', 0 );
649
-		$new_ticket->set( 'TKT_price', $ticket_price );
650
-		$new_ticket->set( 'TKT_sold', 0 );
646
+		$new_ticket = clone($ticket);
647
+		$new_ticket->set('TKT_ID', 0);
648
+		$new_ticket->set('TKT_deleted', 0);
649
+		$new_ticket->set('TKT_price', $ticket_price);
650
+		$new_ticket->set('TKT_sold', 0);
651 651
 		// let's get a new ID for this ticket
652 652
 		$new_ticket->save();
653 653
 		// we also need to make sure this new ticket gets the same datetime attachments as the archived ticket
654
-		$datetimes_on_existing = $ticket->get_many_related( 'Datetime' );
654
+		$datetimes_on_existing = $ticket->get_many_related('Datetime');
655 655
 		$new_ticket = $this->_update_ticket_datetimes(
656 656
 			$new_ticket,
657 657
 			$datetimes_on_existing,
658
-			array_keys( $datetimes_on_existing )
658
+			array_keys($datetimes_on_existing)
659 659
 		);
660 660
 
661 661
 		// $ticket will get archived later b/c we are NOT adding it to the saved_tickets array.
662 662
 		// if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining
663 663
 		// available.
664
-		if ( $ticket->sold() > 0 ) {
664
+		if ($ticket->sold() > 0) {
665 665
 			$new_qty = $ticket->qty() - $ticket->sold();
666
-			$new_ticket->set_qty( $new_qty );
666
+			$new_ticket->set_qty($new_qty);
667 667
 		}
668 668
 		//now we update the prices just for this ticket
669
-		$new_ticket = $this->_add_prices_to_ticket( $price_rows, $new_ticket, true );
669
+		$new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true);
670 670
 		//and we update the base price
671
-		$new_ticket = $this->_add_prices_to_ticket( array(), $new_ticket, true, $base_price, $base_price_id );
671
+		$new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id);
672 672
 		return $new_ticket;
673 673
 	}
674 674
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
689 689
 	 * @return EE_Ticket
690 690
 	 */
691
-	protected function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
691
+	protected function  _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) {
692 692
 
693 693
 		//let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session.
694 694
 		$current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers();
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 		$updated_prices = array();
697 697
 
698 698
 		// if $base_price ! FALSE then updating a base price.
699
-		if ( $base_price !== FALSE ) {
699
+		if ($base_price !== FALSE) {
700 700
 			$prices[1] = array(
701 701
 				'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id,
702 702
 				'PRT_ID' => 1,
@@ -707,47 +707,47 @@  discard block
 block discarded – undo
707 707
 		}
708 708
 
709 709
 		//possibly need to save tkt
710
-		if ( ! $ticket->ID() )
710
+		if ( ! $ticket->ID())
711 711
 			$ticket->save();
712 712
 
713
-		foreach ( $prices as $row => $prc ) {
714
-			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
715
-			if ( empty($prt_id) )
713
+		foreach ($prices as $row => $prc) {
714
+			$prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL;
715
+			if (empty($prt_id))
716 716
 				continue; //prices MUST have a price type id.
717 717
 			$PRC_values = array(
718
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
718
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
719 719
 				'PRT_ID' => $prt_id,
720
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
721
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
722
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
720
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
721
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
722
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
723 723
 				'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor
724 724
 				'PRC_order' => $row
725 725
 				);
726
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
726
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
727 727
 				$PRC_values['PRC_ID'] = 0;
728
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
728
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
729 729
 			} else {
730
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
730
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
731 731
 				//update this price with new values
732
-				foreach ( $PRC_values as $field => $newprc ) {
733
-					$PRC->set( $field, $newprc );
732
+				foreach ($PRC_values as $field => $newprc) {
733
+					$PRC->set($field, $newprc);
734 734
 				}
735 735
 			}
736 736
 			$PRC->save();
737 737
 			$prcid = $PRC->ID();
738 738
 			$updated_prices[$prcid] = $PRC;
739
-			$ticket->_add_relation_to( $PRC, 'Price' );
739
+			$ticket->_add_relation_to($PRC, 'Price');
740 740
 		}
741 741
 
742 742
 		//now let's remove any prices that got removed from the ticket
743
-		if ( !empty ( $current_prices_on_ticket ) ) {
743
+		if ( ! empty ($current_prices_on_ticket)) {
744 744
 			$current = array_keys($current_prices_on_ticket);
745 745
 			$updated = array_keys($updated_prices);
746 746
 			$prices_to_remove = array_diff($current, $updated);
747
-			if ( !empty( $prices_to_remove ) ) {
748
-				foreach ( $prices_to_remove as $prc_id ) {
747
+			if ( ! empty($prices_to_remove)) {
748
+				foreach ($prices_to_remove as $prc_id) {
749 749
 					$p = $current_prices_on_ticket[$prc_id];
750
-					$ticket->_remove_relation_to( $p, 'Price' );
750
+					$ticket->_remove_relation_to($p, 'Price');
751 751
 
752 752
 					//delete permanently the price
753 753
 					$p->delete_permanently();
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 
761 761
 
762 762
 
763
-	public function autosave_handling( $event_admin_obj ) {
763
+	public function autosave_handling($event_admin_obj) {
764 764
 		return $event_admin_obj; //doing nothing for the moment.
765 765
 		//todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method)
766 766
 
@@ -794,12 +794,12 @@  discard block
 block discarded – undo
794 794
 
795 795
 		//default main template args
796 796
 		$main_template_args = array(
797
-			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
797
+			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
798 798
 			'existing_datetime_ids' => '',
799 799
 			'total_dtt_rows' => 1,
800
-			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
800
+			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
801 801
 			'datetime_rows' => '',
802
-			'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
802
+			'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
803 803
 			'ticket_rows' => '',
804 804
 			'existing_ticket_ids' => '',
805 805
 			'total_ticket_rows' => 1,
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 
810 810
 		$timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL;
811 811
 
812
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
812
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
813 813
 
814 814
 		/**
815 815
 		 * 1. Start with retrieving Datetimes
@@ -817,37 +817,37 @@  discard block
 block discarded – undo
817 817
 		 * 3. For each ticket get related prices
818 818
 		 */
819 819
 
820
-		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) );
821
-		$times = $DTM->get_all_event_dates( $evtID );
820
+		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone));
821
+		$times = $DTM->get_all_event_dates($evtID);
822 822
 
823 823
 
824 824
 
825 825
 		$main_template_args['total_dtt_rows'] = count($times);
826
-		foreach ( $times as $time ) {
826
+		foreach ($times as $time) {
827 827
 			$dttid = $time->get('DTT_ID');
828 828
 			$dttrow = $time->get('DTT_order');
829 829
 			$existing_datetime_ids[] = $dttid;
830 830
 
831 831
 			//tickets attached
832
-			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC' ) ) ) : array();
832
+			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC'))) : array();
833 833
 
834 834
 			//if there are no related tickets this is likely a new event OR autodraft
835 835
 			// event so we need to generate the default tickets because dtts
836 836
 			// ALWAYS have at least one related ticket!!.  EXCEPT, we dont' do this if there is already more than one
837 837
 			// datetime on the event.
838
-			if ( empty ( $related_tickets ) && count( $times ) < 2 ) {
838
+			if (empty ($related_tickets) && count($times) < 2) {
839 839
 				$related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
840 840
 
841 841
 				//this should be ordered by TKT_ID, so let's grab the first default ticket (which will be the main default) and ensure it has any default prices added to it (but do NOT save).
842 842
 				$default_prices = EEM_Price::instance()->get_all_default_prices();
843 843
 
844
-				$main_default_ticket = reset( $related_tickets );
845
-				if ( $main_default_ticket instanceof EE_Ticket ) {
846
-					foreach ( $default_prices as $default_price ) {
847
-						if ( $default_price->is_base_price() ) {
844
+				$main_default_ticket = reset($related_tickets);
845
+				if ($main_default_ticket instanceof EE_Ticket) {
846
+					foreach ($default_prices as $default_price) {
847
+						if ($default_price->is_base_price()) {
848 848
 							continue;
849 849
 						}
850
-						$main_default_ticket->cache( 'Price', $default_price );
850
+						$main_default_ticket->cache('Price', $default_price);
851 851
 					}
852 852
 				}
853 853
 			}
@@ -856,11 +856,11 @@  discard block
 block discarded – undo
856 856
 			//we can't actually setup rows in this loop yet cause we don't know all the unique tickets for this event yet (tickets are linked through all datetimes). So we're going to temporarily cache some of that information.
857 857
 
858 858
 			//loop through and setup the ticket rows and make sure the order is set.
859
-			foreach ( $related_tickets as $ticket ) {
859
+			foreach ($related_tickets as $ticket) {
860 860
 				$tktid = $ticket->get('TKT_ID');
861 861
 				$tktrow = $ticket->get('TKT_row');
862 862
 				//we only want unique tickets in our final display!!
863
-				if ( !in_array( $tktid, $existing_ticket_ids ) ) {
863
+				if ( ! in_array($tktid, $existing_ticket_ids)) {
864 864
 					$existing_ticket_ids[] = $tktid;
865 865
 					$all_tickets[] = $ticket;
866 866
 				}
@@ -869,56 +869,56 @@  discard block
 block discarded – undo
869 869
 				$datetime_tickets[$dttid][] = $tktrow;
870 870
 
871 871
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
872
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
872
+				if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid]))
873 873
 					$ticket_datetimes[$tktid][] = $dttrow;
874 874
 			}
875 875
 		}
876 876
 
877
-		$main_template_args['total_ticket_rows'] = count( $existing_ticket_ids );
878
-		$main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids );
879
-		$main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids );
877
+		$main_template_args['total_ticket_rows'] = count($existing_ticket_ids);
878
+		$main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
879
+		$main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
880 880
 
881 881
 		//sort $all_tickets by order
882
-		usort( $all_tickets, function( $a, $b ) {
882
+		usort($all_tickets, function($a, $b) {
883 883
 			$a_order = (int) $a->get('TKT_order');
884 884
 			$b_order = (int) $b->get('TKT_order');
885
-			if ( $a_order == $b_order ) {
885
+			if ($a_order == $b_order) {
886 886
 				return 0;
887 887
 			}
888
-			return ( $a_order < $b_order ) ? -1 : 1;
888
+			return ($a_order < $b_order) ? -1 : 1;
889 889
 		});
890 890
 
891 891
 		//k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again.
892 892
 		$dttrow = 1;
893
-		foreach ( $times as $time ) {
894
-			$main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times );
893
+		foreach ($times as $time) {
894
+			$main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times);
895 895
 			$dttrow++;
896 896
 		}
897 897
 
898 898
 		//then loop through all tickets for the ticket rows.
899 899
 		$tktrow = 1;
900
-		foreach ( $all_tickets as $ticket ) {
901
-			$main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets );
900
+		foreach ($all_tickets as $ticket) {
901
+			$main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets);
902 902
 			$tktrow++;
903 903
 		}
904 904
 
905 905
 		$main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets);
906
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php';
907
-		EEH_Template::display_template( $template, $main_template_args );
906
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php';
907
+		EEH_Template::display_template($template, $main_template_args);
908 908
 		return;
909 909
 	}
910 910
 
911 911
 
912 912
 
913
-	protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
913
+	protected function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) {
914 914
 
915 915
 		$dtt_display_template_args = array(
916
-			'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ),
917
-			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ),
916
+			'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts),
917
+			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default),
918 918
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow
919 919
 			);
920
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php';
921
-		return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE);
920
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php';
921
+		return EEH_Template::display_template($template, $dtt_display_template_args, TRUE);
922 922
 	}
923 923
 
924 924
 
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 	 *
937 937
 	 * @return string Generated edit row.
938 938
 	 */
939
-	protected function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) {
939
+	protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) {
940 940
 
941 941
 		// if the incomign $dtt object is NOT an instance of EE_Datetime then force default to true.
942 942
 		$default = ! $dtt instanceof EE_Datetime ? true : false;
@@ -944,30 +944,30 @@  discard block
 block discarded – undo
944 944
 		$template_args = array(
945 945
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
946 946
 			'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
947
-			'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
947
+			'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
948 948
 			'DTT_ID' => $default ? '' : $dtt->ID(),
949 949
 			'DTT_name' => $default ? '' : $dtt->name(),
950 950
 			'DTT_description' => $default ? '' : $dtt->description(),
951
-			'DTT_EVT_start' => $default ? '' : $dtt->start_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
952
-			'DTT_EVT_end' => $default ? '' : $dtt->end_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
953
-			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'),
951
+			'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
952
+			'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
953
+			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'),
954 954
 			'DTT_order' => $default ? 'DTTNUM' : $dttrow,
955 955
 			'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'),
956
-			'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
957
-			'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0  ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
956
+			'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
957
+			'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
958 958
 			);
959 959
 
960
-		$template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
960
+		$template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
961 961
 
962 962
 		//allow filtering of template args at this point.
963
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event );
963
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event);
964 964
 
965
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php';
966
-		return EEH_Template::display_template( $template, $template_args, TRUE );
965
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php';
966
+		return EEH_Template::display_template($template, $template_args, TRUE);
967 967
 	}
968 968
 
969 969
 
970
-	protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
970
+	protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) {
971 971
 
972 972
 		$template_args = array(
973 973
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
@@ -975,47 +975,47 @@  discard block
 block discarded – undo
975 975
 			'DTT_description' => $default ? '' : $dtt->description(),
976 976
 			'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '',
977 977
 			'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '',
978
-			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
978
+			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
979 979
 			'DTT_ID' => $default ? '' : $dtt->ID()
980 980
 			);
981 981
 
982 982
 		//need to setup the list items (but only if this isnt' a default skeleton setup)
983
-		if ( !$default ) {
983
+		if ( ! $default) {
984 984
 			$tktrow = 1;
985
-			foreach ( $all_tickets as $ticket ) {
986
-				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default );
985
+			foreach ($all_tickets as $ticket) {
986
+				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default);
987 987
 				$tktrow++;
988 988
 			}
989 989
 		}
990 990
 
991 991
 		//filter template args at this point
992
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event );
992
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event);
993 993
 
994
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php';
995
-		return EEH_Template::display_template( $template, $template_args, TRUE );
994
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php';
995
+		return EEH_Template::display_template($template, $template_args, TRUE);
996 996
 	}
997 997
 
998 998
 
999 999
 
1000
-	protected function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) {
1001
-		$tktid = !empty( $ticket ) ? $ticket->ID() : 0;
1002
-		$dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array();
1000
+	protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) {
1001
+		$tktid = ! empty($ticket) ? $ticket->ID() : 0;
1002
+		$dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array();
1003 1003
 
1004
-		$displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0;
1004
+		$displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0;
1005 1005
 		$template_args = array(
1006 1006
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
1007
-			'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow,
1007
+			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1008 1008
 			'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '',
1009 1009
 			'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '',
1010
-			'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'),
1011
-			'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
1010
+			'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'),
1011
+			'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
1012 1012
 			);
1013 1013
 
1014 1014
 		//filter template args
1015
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event );
1015
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event);
1016 1016
 
1017
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php';
1018
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1017
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php';
1018
+		return EEH_Template::display_template($template, $template_args, TRUE);
1019 1019
 	}
1020 1020
 
1021 1021
 
@@ -1037,37 +1037,37 @@  discard block
 block discarded – undo
1037 1037
 	 *
1038 1038
 	 * @return [type] [description]
1039 1039
 	 */
1040
-	protected function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) {
1040
+	protected function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) {
1041 1041
 
1042 1042
 		//if $ticket is not an instance of EE_Ticket then force default to true.
1043
-		$default =  ! $ticket instanceof EE_Ticket ? true : false;
1043
+		$default = ! $ticket instanceof EE_Ticket ? true : false;
1044 1044
 
1045
-		$prices = ! empty( $ticket ) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array();
1045
+		$prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array();
1046 1046
 
1047 1047
 		//if there is only one price (which would be the base price) or NO prices and this ticket is a default ticket, let's just make sure there are no cached default prices on
1048 1048
 		//the object.  This is done by not including any query_params.
1049
-		if ( $ticket instanceof EE_Ticket && $ticket->is_default() && ( count( $prices ) === 1  || empty( $prices ) ) ) {
1050
-			$prices = $ticket->get_many_related( 'Price' );
1049
+		if ($ticket instanceof EE_Ticket && $ticket->is_default() && (count($prices) === 1 || empty($prices))) {
1050
+			$prices = $ticket->get_many_related('Price');
1051 1051
 		}
1052 1052
 
1053 1053
 		// check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket).  This will future proof in case there is ever any behaviour change between what the primary_key defaults to.
1054
-		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE;
1054
+		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE;
1055 1055
 
1056
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1056
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1057 1057
 
1058 1058
 		$ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal();
1059
-		$base_price = $default ? NULL :  $ticket->base_price();
1059
+		$base_price = $default ? NULL : $ticket->base_price();
1060 1060
 		$count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE);
1061 1061
 
1062 1062
 		//breaking out complicated condition for ticket_status
1063
-		if ( $default ) {
1064
-			$ticket_status_class = ' tkt-status-' . EE_Ticket::onsale;
1063
+		if ($default) {
1064
+			$ticket_status_class = ' tkt-status-'.EE_Ticket::onsale;
1065 1065
 		} else {
1066
-			$ticket_status_class =  $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status();
1066
+			$ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status();
1067 1067
 		}
1068 1068
 
1069 1069
 		//breaking out complicated condition for TKT_taxable
1070
-		if ( $default ) {
1070
+		if ($default) {
1071 1071
 			$TKT_taxable = '';
1072 1072
 		} else {
1073 1073
 			$TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : '';
@@ -1082,19 +1082,19 @@  discard block
 block discarded – undo
1082 1082
 			'edit_tkt_expanded' => '',
1083 1083
 			'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets',
1084 1084
 			'TKT_name' => $default ? '' : $ticket->get('TKT_name'),
1085
-			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
1086
-			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']  ),
1087
-			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
1085
+			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1086
+			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1087
+			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
1088 1088
 			'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE),
1089 1089
 			'TKT_price_code' => EE_Registry::instance()->CFG->currency->code,
1090 1090
 			'TKT_price_amount' => $default ? 0 : $ticket_subtotal,
1091
-			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'),
1092
-			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'),
1093
-			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'),
1094
-			'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ),
1095
-			'TKT_max' => $default ? '' :  $ticket->get_pretty('TKT_max','input'),
1091
+			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'),
1092
+			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'),
1093
+			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'),
1094
+			'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')),
1095
+			'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'),
1096 1096
 			'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'),
1097
-			'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ),
1097
+			'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))),
1098 1098
 			'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'),
1099 1099
 			'TKT_description' => $default ? '' : $ticket->get('TKT_description'),
1100 1100
 			'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'),
@@ -1103,99 +1103,99 @@  discard block
 block discarded – undo
1103 1103
 			'ticket_price_rows' => '',
1104 1104
 			'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'),
1105 1105
 			'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(),
1106
-			'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"',
1107
-			'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '',
1106
+			'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"',
1107
+			'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '',
1108 1108
 			'total_price_rows' => count($prices) > 1 ? count($prices) : 1,
1109 1109
 			'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '',
1110 1110
 			'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts),
1111 1111
 			'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts),
1112
-			'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ),
1112
+			'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)),
1113 1113
 			'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'),
1114 1114
 			'TKT_taxable' => $TKT_taxable,
1115 1115
 			'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
1116 1116
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1117
-			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ),
1117
+			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE),
1118 1118
 			'TKT_subtotal_amount' => $ticket_subtotal,
1119
-			'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ),
1120
-			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE: FALSE,
1119
+			'tax_rows' => $this->_get_tax_rows($tktrow, $ticket),
1120
+			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE : FALSE,
1121 1121
 			'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
1122 1122
 			'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
1123 1123
 			'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
1124 1124
 			);
1125 1125
 
1126
-		$template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1126
+		$template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1127 1127
 
1128 1128
 		//handle rows that should NOT be empty
1129
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1129
+		if (empty($template_args['TKT_start_date'])) {
1130 1130
 			//if empty then the start date will be now.
1131
-			$template_args['TKT_start_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , current_time('timestamp'));
1132
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1131
+			$template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], current_time('timestamp'));
1132
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1133 1133
 		}
1134 1134
 
1135
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1135
+		if (empty($template_args['TKT_end_date'])) {
1136 1136
 
1137 1137
 			//get the earliest datetime (if present);
1138
-			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1138
+			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1139 1139
 
1140
-			if ( !empty( $earliest_dtt ) ) {
1141
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
1140
+			if ( ! empty($earliest_dtt)) {
1141
+				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
1142 1142
 			} else {
1143 1143
 				//default so let's just use what's been set for the default date-time which is 30 days from now.
1144
-				$template_args['TKT_end_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") )  );
1144
+				$template_args['TKT_end_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], mktime(24, 0, 0, date("m"), date("d") + 29, date("Y")));
1145 1145
 			}
1146
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1146
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1147 1147
 		}
1148 1148
 
1149 1149
 		//generate ticket_datetime items
1150
-		if ( ! $default ) {
1150
+		if ( ! $default) {
1151 1151
 			$dttrow = 1;
1152
-			foreach ( $all_dtts as $dtt ) {
1153
-				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default );
1152
+			foreach ($all_dtts as $dtt) {
1153
+				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default);
1154 1154
 				$dttrow++;
1155 1155
 			}
1156 1156
 		}
1157 1157
 
1158 1158
 		$prcrow = 1;
1159
-		foreach ( $prices as $price ) {
1160
-			if ( $price->is_base_price() ) {
1159
+		foreach ($prices as $price) {
1160
+			if ($price->is_base_price()) {
1161 1161
 				$prcrow++;
1162 1162
 				continue;
1163 1163
 			}
1164
-			$show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1  ? FALSE : TRUE;
1165
-			$show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE;
1166
-			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create );
1164
+			$show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE;
1165
+			$show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE;
1166
+			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create);
1167 1167
 			$prcrow++;
1168 1168
 		}
1169 1169
 
1170 1170
 		//filter $template_args
1171
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event );
1171
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event);
1172 1172
 
1173
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php';
1174
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1173
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php';
1174
+		return EEH_Template::display_template($template, $template_args, TRUE);
1175 1175
 	}
1176 1176
 
1177 1177
 
1178 1178
 
1179 1179
 
1180 1180
 
1181
-	protected function _get_tax_rows( $tktrow, $ticket ) {
1181
+	protected function _get_tax_rows($tktrow, $ticket) {
1182 1182
 		$tax_rows = '';
1183
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
1183
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php';
1184 1184
 		$template_args = array();
1185
-		$taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1186
-		foreach ( $taxes as $tax ) {
1187
-			$tax_added = $this->_get_tax_added( $tax, $ticket );
1185
+		$taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1186
+		foreach ($taxes as $tax) {
1187
+			$tax_added = $this->_get_tax_added($tax, $ticket);
1188 1188
 			$template_args = array(
1189
-				'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1189
+				'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1190 1190
 				'tax_id' => $tax->ID(),
1191 1191
 				'tkt_row' => $tktrow,
1192 1192
 				'tax_label' => $tax->get('PRC_name'),
1193 1193
 				'tax_added' => $tax_added,
1194
-				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ),
1194
+				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE),
1195 1195
 				'tax_amount' => $tax->get('PRC_amount')
1196 1196
 				);
1197
-			$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event  );
1198
-			$tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE );
1197
+			$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event);
1198
+			$tax_rows .= EEH_Template::display_template($template, $template_args, TRUE);
1199 1199
 		}
1200 1200
 
1201 1201
 
@@ -1203,81 +1203,81 @@  discard block
 block discarded – undo
1203 1203
 	}
1204 1204
 
1205 1205
 
1206
-	protected function _get_tax_added( EE_Price $tax, $ticket ) {
1207
-		$subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal();
1206
+	protected function _get_tax_added(EE_Price $tax, $ticket) {
1207
+		$subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal();
1208 1208
 		return $subtotal * $tax->get('PRC_amount') / 100;
1209 1209
 	}
1210 1210
 
1211 1211
 
1212 1212
 
1213 1213
 
1214
-	protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
1215
-		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1214
+	protected function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) {
1215
+		$send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1216 1216
 		$template_args = array(
1217 1217
 			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1218 1218
 			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1219 1219
 			'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices',
1220
-			'price_type_selector' => $default && empty( $price ) ? $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ) : $this->_get_price_type_selector( $tktrow, $prcrow, $price, $default, $send_disabled ),
1220
+			'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled),
1221 1221
 			'PRC_ID' => $default && empty($price) ? 0 : $price->ID(),
1222 1222
 			'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'),
1223 1223
 			'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'),
1224 1224
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1225 1225
 			'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"',
1226
-			'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1227
-			'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1228
-			'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ),
1229
-			'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1230
-			'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ),
1226
+			'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1227
+			'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1228
+			'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''),
1229
+			'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1230
+			'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'),
1231 1231
 			'show_trash_icon' => $show_trash ? '' : ' style="display:none;"',
1232 1232
 			'show_create_button' => $show_create ? '' : ' style="display:none;"',
1233
-			'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'),
1234
-			'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1233
+			'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'),
1234
+			'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1235 1235
 			);
1236 1236
 
1237
-	$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event );
1237
+	$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event);
1238 1238
 
1239
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php';
1240
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1239
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php';
1240
+		return EEH_Template::display_template($template, $template_args, TRUE);
1241 1241
 	}
1242 1242
 
1243 1243
 
1244
-	protected function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1245
-		if ( $price->is_base_price() ) {
1246
-			return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default );
1244
+	protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1245
+		if ($price->is_base_price()) {
1246
+			return $this->_get_base_price_template($tktrow, $prcrow, $price, $default);
1247 1247
 		} else {
1248
-			return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled );
1248
+			return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled);
1249 1249
 		}
1250 1250
 
1251 1251
 	}
1252 1252
 
1253 1253
 
1254
-	protected function _get_base_price_template( $tktrow, $prcrow, $price, $default ) {
1254
+	protected function _get_base_price_template($tktrow, $prcrow, $price, $default) {
1255 1255
 		$template_args = array(
1256 1256
 				'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1257
-				'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1258
-				'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'),
1257
+				'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1258
+				'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'),
1259 1259
 				'PRT_name' => __('Price', 'event_espresso'),
1260 1260
 				'price_selected_operator' => '+',
1261 1261
 				'price_selected_is_percent' => 0
1262 1262
 			);
1263
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php';
1263
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php';
1264 1264
 
1265
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event );
1265
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event);
1266 1266
 
1267
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1267
+		return EEH_Template::display_template($template, $template_args, TRUE);
1268 1268
 	}
1269 1269
 
1270 1270
 
1271 1271
 
1272
-	protected function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1273
-		$select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]';
1274
-		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) );
1275
-		$price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php';
1276
-		$all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array();
1277
-		$selected_price_type_id = $default && empty( $price ) ? 0 : $price->type();
1272
+	protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1273
+		$select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]';
1274
+		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3'))));
1275
+		$price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php';
1276
+		$all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array();
1277
+		$selected_price_type_id = $default && empty($price) ? 0 : $price->type();
1278 1278
 		$price_option_spans = '';
1279 1279
 		//setup pricetypes for selector
1280
-		foreach ( $price_types as $price_type ) {
1280
+		foreach ($price_types as $price_type) {
1281 1281
 			$all_price_types[] = array(
1282 1282
 				'id' => $price_type->ID(),
1283 1283
 				'text' => $price_type->get('PRT_name'),
@@ -1289,50 +1289,50 @@  discard block
 block discarded – undo
1289 1289
 				'PRT_operator' => $price_type->is_discount() ? '-' : '+',
1290 1290
 				'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0
1291 1291
 				);
1292
-			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE );
1292
+			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE);
1293 1293
 		}
1294 1294
 
1295
-		$select_params = $disabled ? 'style="width:auto;" disabled'  : 'style="width:auto;"';
1295
+		$select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"';
1296 1296
 		$main_name = $select_name;
1297
-		$select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name;
1297
+		$select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name;
1298 1298
 
1299 1299
 		$template_args = array(
1300 1300
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1301
-			'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1302
-			'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ),
1301
+			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1302
+			'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'),
1303 1303
 			'main_name' => $main_name,
1304 1304
 			'selected_price_type_id' => $selected_price_type_id,
1305 1305
 			'price_option_spans' => $price_option_spans,
1306
-			'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ),
1307
-			'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ),
1306
+			'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'),
1307
+			'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0),
1308 1308
 			'disabled' => $disabled
1309 1309
 			);
1310 1310
 
1311
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event );
1311
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event);
1312 1312
 
1313
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php';
1313
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php';
1314 1314
 
1315
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1315
+		return EEH_Template::display_template($template, $template_args, TRUE);
1316 1316
 	}
1317 1317
 
1318 1318
 
1319 1319
 
1320
-	protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1321
-		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1322
-		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
1323
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1320
+	protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) {
1321
+		$dttid = ! empty($dtt) ? $dtt->ID() : 0;
1322
+		$displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0;
1323
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1324 1324
 		$template_args = array(
1325
-			'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow,
1325
+			'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow,
1326 1326
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1327
-			'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '',
1328
-			'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '',
1329
-			'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ),
1327
+			'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '',
1328
+			'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '',
1329
+			'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE),
1330 1330
 			'tkt_status_class' => '',
1331 1331
 			);
1332 1332
 
1333
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event );
1334
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1335
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1333
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event);
1334
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1335
+		return EEH_Template::display_template($template, $template_args, TRUE);
1336 1336
 	}
1337 1337
 
1338 1338
 
@@ -1340,53 +1340,53 @@  discard block
 block discarded – undo
1340 1340
 	protected function _get_ticket_js_structure($all_dtts, $all_tickets) {
1341 1341
 		$template_args = array(
1342 1342
 			'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts),
1343
-			'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE),
1344
-			'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ),
1343
+			'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE),
1344
+			'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL),
1345 1345
 			'default_price_rows' => '',
1346 1346
 			'default_base_price_amount' => 0,
1347 1347
 			'default_base_price_name' => '',
1348 1348
 			'default_base_price_description' => '',
1349
-			'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ),
1350
-			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ),
1349
+			'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE),
1350
+			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE),
1351 1351
 			'existing_available_datetime_tickets_list' => '',
1352 1352
 			'existing_available_ticket_datetimes_list' => '',
1353
-			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ),
1354
-			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE )
1353
+			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE),
1354
+			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE)
1355 1355
 			);
1356 1356
 
1357 1357
 		$tktrow = 1;
1358
-		foreach ( $all_tickets as $ticket ) {
1359
-			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE );
1358
+		foreach ($all_tickets as $ticket) {
1359
+			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE);
1360 1360
 			$tktrow++;
1361 1361
 		}
1362 1362
 
1363 1363
 
1364 1364
 		$dttrow = 1;
1365
-		foreach ( $all_dtts as $dtt ) {
1366
-			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE );
1365
+		foreach ($all_dtts as $dtt) {
1366
+			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE);
1367 1367
 			$dttrow++;
1368 1368
 		}
1369 1369
 
1370 1370
 		$default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices();
1371 1371
 		$prcrow = 1;
1372
-		foreach ( $default_prices as $price ) {
1373
-			if ( $price->is_base_price() ) {
1372
+		foreach ($default_prices as $price) {
1373
+			if ($price->is_base_price()) {
1374 1374
 				$template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float');
1375 1375
 				$template_args['default_base_price_name'] = $price->get('PRC_name');
1376 1376
 				$template_args['default_base_price_description'] = $price->get('PRC_desc');
1377 1377
 				$prcrow++;
1378 1378
 				continue;
1379 1379
 			}
1380
-			$show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1  ? FALSE : TRUE;
1381
-			$show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE;
1382
-			$template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create );
1380
+			$show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE;
1381
+			$show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE;
1382
+			$template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create);
1383 1383
 			$prcrow++;
1384 1384
 		}
1385 1385
 
1386
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event );
1386
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event);
1387 1387
 
1388
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php';
1389
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1388
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php';
1389
+		return EEH_Template::display_template($template, $template_args, TRUE);
1390 1390
 	}
1391 1391
 
1392 1392
 
Please login to merge, or discard this patch.
caffeinated/modules/recaptcha/EED_Recaptcha.module.php 1 patch
Spacing   +128 added lines, -129 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @return EED_Recaptcha
44 44
 	 */
45 45
 	public static function instance() {
46
-		return parent::get_instance( __CLASS__ );
46
+		return parent::get_instance(__CLASS__);
47 47
 	}
48 48
 
49 49
 
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public static function set_hooks() {
58 58
 		// use_captcha ?
59
-		if ( EE_Registry::instance()->CFG->registration->use_captcha ) {
59
+		if (EE_Registry::instance()->CFG->registration->use_captcha) {
60 60
 			EED_Recaptcha::set_definitions();
61 61
 			EED_Recaptcha::enqueue_styles_and_scripts();
62
-			add_action( 'wp', array( 'EED_Recaptcha', 'set_late_hooks' ), 1, 0 );
63
-			add_action( 'AHEE__before_spco_whats_next_buttons', array( 'EED_Recaptcha', 'display_recaptcha' ), 10, 0 );
64
-			add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
65
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
66
-			add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 );
67
-			add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method' ), 10, 1 );
62
+			add_action('wp', array('EED_Recaptcha', 'set_late_hooks'), 1, 0);
63
+			add_action('AHEE__before_spco_whats_next_buttons', array('EED_Recaptcha', 'display_recaptcha'), 10, 0);
64
+			add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10);
65
+			add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10);
66
+			add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1);
67
+			add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method'), 10, 1);
68 68
 		}
69 69
 	}
70 70
 
@@ -79,15 +79,15 @@  discard block
 block discarded – undo
79 79
 	public static function set_hooks_admin() {
80 80
 		EED_Recaptcha::set_definitions();
81 81
 		// use_captcha ?
82
-		if ( EE_Registry::instance()->CFG->registration->use_captcha ) {
82
+		if (EE_Registry::instance()->CFG->registration->use_captcha) {
83 83
 			EED_Recaptcha::enqueue_styles_and_scripts();
84
-			add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
85
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
86
-			add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 );
84
+			add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10);
85
+			add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10);
86
+			add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1);
87 87
 		}
88 88
 		// admin settings
89
-		add_action( 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array( 'EED_Recaptcha', 'admin_settings' ), 10, 1 );
90
-		add_filter( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array( 'EED_Recaptcha', 'update_admin_settings' ), 10, 1 );
89
+		add_action('AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array('EED_Recaptcha', 'admin_settings'), 10, 1);
90
+		add_filter('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array('EED_Recaptcha', 'update_admin_settings'), 10, 1);
91 91
 	}
92 92
 
93 93
 
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 	 *  @return 	void
100 100
 	 */
101 101
 	public static function set_definitions() {
102
-		if ( is_user_logged_in() ) {
102
+		if (is_user_logged_in()) {
103 103
 			EED_Recaptcha::$_not_a_robot = true;
104 104
 		}
105
-		define( 'RECAPTCHA_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
106
-		define( 'RECAPTCHA_BASE_URL', plugin_dir_url( __FILE__ ));
105
+		define('RECAPTCHA_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
106
+		define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__));
107 107
 	}
108 108
 
109 109
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	public static function set_late_hooks() {
118 118
 		add_filter(
119 119
 			'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit',
120
-			array( 'EED_Recaptcha', 'not_a_robot' )
120
+			array('EED_Recaptcha', 'not_a_robot')
121 121
 		);
122 122
 	}
123 123
 
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
 	 *  @return 	void
131 131
 	 */
132 132
 	public static function enqueue_styles_and_scripts() {
133
-		wp_register_script( 'espresso_recaptcha', RECAPTCHA_BASE_URL . 'scripts' . DS . 'espresso_recaptcha.js', array( 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, TRUE );
134
-		wp_register_script( 'google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . EE_Registry::instance()->CFG->registration->recaptcha_language, array( 'espresso_recaptcha' ), EVENT_ESPRESSO_VERSION, TRUE );
135
-		EE_Registry::$i18n_js_strings['no_SPCO_error'] = __( 'It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso' );
136
-		EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __( 'There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso' );
137
-		EE_Registry::$i18n_js_strings['recaptcha_fail'] = __( 'Please complete the anti-spam test before proceeding.', 'event_espresso' );
133
+		wp_register_script('espresso_recaptcha', RECAPTCHA_BASE_URL.'scripts'.DS.'espresso_recaptcha.js', array('single_page_checkout'), EVENT_ESPRESSO_VERSION, TRUE);
134
+		wp_register_script('google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl='.EE_Registry::instance()->CFG->registration->recaptcha_language, array('espresso_recaptcha'), EVENT_ESPRESSO_VERSION, TRUE);
135
+		EE_Registry::$i18n_js_strings['no_SPCO_error'] = __('It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso');
136
+		EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __('There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso');
137
+		EE_Registry::$i18n_js_strings['recaptcha_fail'] = __('Please complete the anti-spam test before proceeding.', 'event_espresso');
138 138
 	}
139 139
 
140 140
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @access    public
146 146
 	 * @param \WP $WP
147 147
 	 */
148
-	public function run( $WP ) {
148
+	public function run($WP) {
149 149
 	}
150 150
 
151 151
 
@@ -155,8 +155,7 @@  discard block
 block discarded – undo
155 155
 	 *  @return boolean
156 156
 	 */
157 157
 	public static function not_a_robot() {
158
-		$not_a_robot = is_bool( EED_Recaptcha::$_not_a_robot ) ? EED_Recaptcha::$_not_a_robot :
159
-			EED_Recaptcha::recaptcha_passed();
158
+		$not_a_robot = is_bool(EED_Recaptcha::$_not_a_robot) ? EED_Recaptcha::$_not_a_robot : EED_Recaptcha::recaptcha_passed();
160 159
 		return $not_a_robot;
161 160
 	}
162 161
 
@@ -172,22 +171,22 @@  discard block
 block discarded – undo
172 171
 	 */
173 172
 	public static function display_recaptcha() {
174 173
 		// logged in means you have already passed a turing test of sorts
175
-		if ( is_user_logged_in() ) {
174
+		if (is_user_logged_in()) {
176 175
 			return;
177 176
 		}
178 177
 		// don't display if not using recaptcha or user is logged in
179
-		if ( EE_Registry::instance()->CFG->registration->use_captcha ) {
178
+		if (EE_Registry::instance()->CFG->registration->use_captcha) {
180 179
 			// only display if they have NOT passed the test yet
181
-			if ( ! EED_Recaptcha::$_not_a_robot ) {
180
+			if ( ! EED_Recaptcha::$_not_a_robot) {
182 181
 				EEH_Template::display_template(
183
-					RECAPTCHA_BASE_PATH . DS . 'templates' . DS . 'recaptcha.template.php',
182
+					RECAPTCHA_BASE_PATH.DS.'templates'.DS.'recaptcha.template.php',
184 183
 					array(
185 184
 						'recaptcha_publickey' 	=> EE_Registry::instance()->CFG->registration->recaptcha_publickey,
186 185
 						'recaptcha_theme' 		=> EE_Registry::instance()->CFG->registration->recaptcha_theme,
187 186
 						'recaptcha_type' 			=> EE_Registry::instance()->CFG->registration->recaptcha_type
188 187
 					)
189 188
 				);
190
-				wp_enqueue_script( 'google_recaptcha' );
189
+				wp_enqueue_script('google_recaptcha');
191 190
 			}
192 191
 		}
193 192
 	}
@@ -218,17 +217,17 @@  discard block
 block discarded – undo
218 217
 	 */
219 218
 	public static function recaptcha_passed() {
220 219
 		// logged in means you have already passed a turing test of sorts
221
-		if ( is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha() ) {
220
+		if (is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha()) {
222 221
 			return TRUE;
223 222
 		}
224 223
 		// was test already passed?
225
-		$recaptcha_passed = EE_Registry::instance()->SSN->get_session_data( 'recaptcha_passed' );
226
-		$recaptcha_passed = filter_var( $recaptcha_passed, FILTER_VALIDATE_BOOLEAN );
224
+		$recaptcha_passed = EE_Registry::instance()->SSN->get_session_data('recaptcha_passed');
225
+		$recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN);
227 226
 		// verify recaptcha
228 227
 		EED_Recaptcha::_get_recaptcha_response();
229
-		if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response ) {
228
+		if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) {
230 229
 			$recaptcha_passed = EED_Recaptcha::_process_recaptcha_response();
231
-			EE_Registry::instance()->SSN->set_session_data( array( 'recaptcha_passed' => $recaptcha_passed ));
230
+			EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed));
232 231
 			EE_Registry::instance()->SSN->update();
233 232
 		}
234 233
 		EED_Recaptcha::$_not_a_robot = $recaptcha_passed;
@@ -244,8 +243,8 @@  discard block
 block discarded – undo
244 243
 	 * @param array $recaptcha_response
245 244
 	 * @return boolean
246 245
 	 */
247
-	public static function recaptcha_response( $recaptcha_response = array() ) {
248
-		if ( EED_Recaptcha::_bypass_recaptcha() ) {
246
+	public static function recaptcha_response($recaptcha_response = array()) {
247
+		if (EED_Recaptcha::_bypass_recaptcha()) {
249 248
 			$recaptcha_response['bypass_recaptcha'] = TRUE;
250 249
 			$recaptcha_response['recaptcha_passed'] = TRUE;
251 250
 		} else {
@@ -265,16 +264,16 @@  discard block
 block discarded – undo
265 264
 	 */
266 265
 	private static function _bypass_recaptcha() {
267 266
 		// an array of key value pairs that must match exactly with the incoming request, in order to bypass recaptcha for the current request ONLY
268
-		$bypass_request_params_array = apply_filters( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array() );
267
+		$bypass_request_params_array = apply_filters('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array());
269 268
 		// does $bypass_request_params_array have any values ?
270
-		if ( empty( $bypass_request_params_array )) {
269
+		if (empty($bypass_request_params_array)) {
271 270
 			return FALSE;
272 271
 		}
273 272
 		// initially set bypass to TRUE
274 273
 		$bypass_recaptcha = TRUE;
275
-		foreach ( $bypass_request_params_array as $key => $value ) {
274
+		foreach ($bypass_request_params_array as $key => $value) {
276 275
 			// if $key is not found or value doesn't match exactly, then toggle bypass to FALSE, otherwise carry over it's value. This way, one missed setting results in no bypass
277
-			$bypass_recaptcha = isset( $_REQUEST[ $key ] ) && $_REQUEST[ $key ] === $value ? $bypass_recaptcha : FALSE;
276
+			$bypass_recaptcha = isset($_REQUEST[$key]) && $_REQUEST[$key] === $value ? $bypass_recaptcha : FALSE;
278 277
 		}
279 278
 		return $bypass_recaptcha;
280 279
 	}
@@ -289,7 +288,7 @@  discard block
 block discarded – undo
289 288
 	 * 	@return 	boolean
290 289
 	 */
291 290
 	private static function _get_recaptcha_response() {
292
-		EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false );
291
+		EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get('g-recaptcha-response', false);
293 292
 	}
294 293
 
295 294
 
@@ -303,26 +302,26 @@  discard block
 block discarded – undo
303 302
 	 */
304 303
 	private static function _process_recaptcha_response() {
305 304
 		// verify library is loaded
306
-		if ( ! class_exists( '\\ReCaptcha\\ReCaptcha' )) {
307
-			require_once( RECAPTCHA_BASE_PATH . DS . 'autoload.php' );
305
+		if ( ! class_exists('\\ReCaptcha\\ReCaptcha')) {
306
+			require_once(RECAPTCHA_BASE_PATH.DS.'autoload.php');
308 307
 		}
309 308
 		// The response from reCAPTCHA
310 309
 		EED_Recaptcha::_get_recaptcha_response();
311 310
 		$recaptcha_response = EED_Recaptcha::$_recaptcha_response;
312 311
 		// Was there a reCAPTCHA response?
313
-		if ( $recaptcha_response ) {
312
+		if ($recaptcha_response) {
314 313
 			// if allow_url_fopen is Off, then set a different request method
315
-			$request_method = ! ini_get( 'allow_url_fopen' ) ? new \ReCaptcha\RequestMethod\SocketPost() : null;
314
+			$request_method = ! ini_get('allow_url_fopen') ? new \ReCaptcha\RequestMethod\SocketPost() : null;
316 315
 			$recaptcha = new \ReCaptcha\ReCaptcha(
317 316
 				EE_Registry::instance()->CFG->registration->recaptcha_privatekey,
318 317
 				$request_method
319 318
 			);
320 319
 			$recaptcha_response = $recaptcha->verify(
321 320
 				EED_Recaptcha::$_recaptcha_response,
322
-				$_SERVER[ 'REMOTE_ADDR' ]
321
+				$_SERVER['REMOTE_ADDR']
323 322
 			);
324 323
 		}
325
-		if ( $recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess() ) {
324
+		if ($recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess()) {
326 325
 			return TRUE;
327 326
 		}
328 327
 		// sorry... it appears you can't don't know what soup or hamburgers are !!!
@@ -366,12 +365,12 @@  discard block
 block discarded – undo
366 365
 				'subsections' 			=> apply_filters(
367 366
 					'FHEE__EED_Recaptcha___recaptcha_settings_form__form_subsections',
368 367
 					array(
369
-						'main_settings_hdr' 				=> new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Anti-spam Settings', 'event_espresso' ) . EEH_Template::get_help_tab_link( 'recaptcha_info' ))),
368
+						'main_settings_hdr' 				=> new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Anti-spam Settings', 'event_espresso').EEH_Template::get_help_tab_link('recaptcha_info'))),
370 369
 						'main_settings' 						=> EED_Recaptcha::_recaptcha_main_settings(),
371
-						'appearance_settings_hdr' 	=> new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Appearance', 'event_espresso' ) )),
370
+						'appearance_settings_hdr' 	=> new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Appearance', 'event_espresso'))),
372 371
 						'appearance_settings' 			=> EED_Recaptcha::_recaptcha_appearance_settings(),
373 372
 						// 'recaptcha_example' 				=> new EE_Form_Section_HTML( EED_Recaptcha::display_recaptcha() ),
374
-						'required_fields_note' 			=> new EE_Form_Section_HTML( EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' ))
373
+						'required_fields_note' 			=> new EE_Form_Section_HTML(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text'))
375 374
 					)
376 375
 				)
377 376
 			)
@@ -398,28 +397,28 @@  discard block
 block discarded – undo
398 397
 					array(
399 398
 						'use_captcha' 				=> new EE_Yes_No_Input(
400 399
 							array(
401
-								'html_label_text'	 	=> __( 'Use reCAPTCHA', 'event_espresso' ),
400
+								'html_label_text'	 	=> __('Use reCAPTCHA', 'event_espresso'),
402 401
 								'html_help_text' 		=> sprintf(
403
-									__( 'reCAPTCHA is a free service that  protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso' ),
402
+									__('reCAPTCHA is a free service that  protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso'),
404 403
 									'<a href="https://www.google.com/recaptcha/intro/index.html">',
405 404
 									'</a>'
406 405
 								),
407
-								'default' 								=> isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE,
406
+								'default' 								=> isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE,
408 407
 								'display_html_label_text' 	=> FALSE
409 408
 							)
410 409
 						),
411 410
 						'recaptcha_publickey' 		=> new EE_Text_Input(
412 411
 							array(
413
-								'html_label_text'	 	=> __( 'Site Key', 'event_espresso' ),
414
-								'html_help_text' 		=> __( 'The site key is used to display the widget on your site.', 'event_espresso' ),
415
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : ''
412
+								'html_label_text'	 	=> __('Site Key', 'event_espresso'),
413
+								'html_help_text' 		=> __('The site key is used to display the widget on your site.', 'event_espresso'),
414
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : ''
416 415
 							)
417 416
 						),
418 417
 						'recaptcha_privatekey' 		=> new EE_Text_Input(
419 418
 							array(
420
-								'html_label_text'	 	=> __( 'Secret Key', 'event_espresso' ),
421
-								'html_help_text' 		=> __( 'The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso' ),
422
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : ''
419
+								'html_label_text'	 	=> __('Secret Key', 'event_espresso'),
420
+								'html_help_text' 		=> __('The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso'),
421
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : ''
423 422
 							)
424 423
 						)
425 424
 					)
@@ -451,81 +450,81 @@  discard block
 block discarded – undo
451 450
 					array(
452 451
 						'recaptcha_theme' 		=> new EE_Radio_Button_Input(
453 452
 							array(
454
-								'light' => __( 'Light', 'event_espresso' ),
455
-								'dark' => __( 'Dark', 'event_espresso' )
453
+								'light' => __('Light', 'event_espresso'),
454
+								'dark' => __('Dark', 'event_espresso')
456 455
 							),
457 456
 							array(
458
-								'html_label_text'	 	=> __( 'Theme', 'event_espresso' ),
459
-								'html_help_text' 		=> __( 'The color theme of the widget.', 'event_espresso' ),
460
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light',
457
+								'html_label_text'	 	=> __('Theme', 'event_espresso'),
458
+								'html_help_text' 		=> __('The color theme of the widget.', 'event_espresso'),
459
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light',
461 460
 								'display_html_label_text' => FALSE
462 461
 							)
463 462
 						),
464 463
 						'recaptcha_type' 		=> new EE_Radio_Button_Input(
465 464
 							array(
466
-								'image' => __( 'Image', 'event_espresso' ),
467
-								'audio' => __( 'Audio', 'event_espresso' )
465
+								'image' => __('Image', 'event_espresso'),
466
+								'audio' => __('Audio', 'event_espresso')
468 467
 							),
469 468
 							array(
470
-								'html_label_text'	 	=> __( 'Type', 'event_espresso' ),
471
-								'html_help_text' 		=> __( 'The type of CAPTCHA to serve.', 'event_espresso' ),
472
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_type ) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image',
469
+								'html_label_text'	 	=> __('Type', 'event_espresso'),
470
+								'html_help_text' 		=> __('The type of CAPTCHA to serve.', 'event_espresso'),
471
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_type) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image',
473 472
 								'display_html_label_text' =>FALSE
474 473
 							)
475 474
 						),
476 475
 						'recaptcha_language' 		=> new EE_Select_Input(
477 476
 							array(
478
-								 'ar' 			=> __( 'Arabic', 'event_espresso' ),
479
-								 'bg' 		=> __( 'Bulgarian', 'event_espresso' ),
480
-								 'ca' 			=> __( 'Catalan', 'event_espresso' ),
481
-								 'zh-CN' 	=>  __( 'Chinese (Simplified)', 'event_espresso' ),
482
-								 'zh-TW' 	=>  __( 'Chinese (Traditional)	', 'event_espresso' ),
483
-								 'hr' 			=> __( 'Croatian', 'event_espresso' ),
484
-								 'cs' 			=> __( 'Czech', 'event_espresso' ),
485
-								 'da' 			=> __( 'Danish', 'event_espresso' ),
486
-								 'nl' 			=> __( 'Dutch', 'event_espresso' ),
487
-								 'en-GB' 	=>  __( 'English (UK)', 'event_espresso' ),
488
-								 'en' 			=> __( 'English (US)', 'event_espresso' ),
489
-								 'fil' 			=> __( 'Filipino', 'event_espresso' ),
490
-								 'fi' 			=> __( 'Finnish', 'event_espresso' ),
491
-								 'fr' 			=> __( 'French', 'event_espresso' ),
492
-								 'fr-CA' 	=>  __( 'French (Canadian)', 'event_espresso' ),
493
-								 'de' 			=> __( 'German', 'event_espresso' ),
494
-								 'de-AT' 	=>  __( 'German (Austria)', 'event_espresso' ),
495
-								 'de-CH' 	=>  __( 'German (Switzerland)', 'event_espresso' ),
496
-								 'el' 			=> __( 'Greek', 'event_espresso' ),
497
-								 'iw' 			=> __( 'Hebrew', 'event_espresso' ),
498
-								 'hi' 			=> __( 'Hindi', 'event_espresso' ),
499
-								 'hu' 		=> __( 'Hungarian', 'event_espresso' ),
500
-								 'id' 			=> __( 'Indonesian', 'event_espresso' ),
501
-								 'it' 			=> __( 'Italian', 'event_espresso' ),
502
-								 'ja' 			=> __( 'Japanese', 'event_espresso' ),
503
-								 'ko' 			=> __( 'Korean', 'event_espresso' ),
504
-								 'lv' 			=> __( 'Latvian', 'event_espresso' ),
505
-								 'lt' 			=> __( 'Lithuanian', 'event_espresso' ),
506
-								 'no' 		=> __( 'Norwegian', 'event_espresso' ),
507
-								 'fa' 			=> __( 'Persian', 'event_espresso' ),
508
-								 'pl' 			=> __( 'Polish', 'event_espresso' ),
509
-								 'pt' 			=> __( 'Portuguese', 'event_espresso' ),
510
-								 'pt-BR' 	=>  __( 'Portuguese (Brazil)', 'event_espresso' ),
511
-								 'pt-PT' 	=>  __( 'Portuguese (Portugal)', 'event_espresso' ),
512
-								 'ro' 			=> __( 'Romanian', 'event_espresso' ),
513
-								 'ru' 			=> __( 'Russian', 'event_espresso' ),
514
-								 'sr' 			=> __( 'Serbian', 'event_espresso' ),
515
-								 'sk' 			=> __( 'Slovak', 'event_espresso' ),
516
-								 'sl' 			=> __( 'Slovenian', 'event_espresso' ),
517
-								 'es' 			=> __( 'Spanish', 'event_espresso' ),
518
-								 'es-419' 	=>  __( 'Spanish (Latin America)', 'event_espresso' ),
519
-								 'sv' 			=> __( 'Swedish', 'event_espresso' ),
520
-								 'th' 			=> __( 'Thai', 'event_espresso' ),
521
-								 'tr' 			=> __( 'Turkish', 'event_espresso' ),
522
-								 'uk' 			=> __( 'Ukrainian', 'event_espresso' ),
523
-								 'vi' 			=> __( 'Vietnamese', 'event_espresso')
477
+								 'ar' 			=> __('Arabic', 'event_espresso'),
478
+								 'bg' 		=> __('Bulgarian', 'event_espresso'),
479
+								 'ca' 			=> __('Catalan', 'event_espresso'),
480
+								 'zh-CN' 	=>  __('Chinese (Simplified)', 'event_espresso'),
481
+								 'zh-TW' 	=>  __('Chinese (Traditional)	', 'event_espresso'),
482
+								 'hr' 			=> __('Croatian', 'event_espresso'),
483
+								 'cs' 			=> __('Czech', 'event_espresso'),
484
+								 'da' 			=> __('Danish', 'event_espresso'),
485
+								 'nl' 			=> __('Dutch', 'event_espresso'),
486
+								 'en-GB' 	=>  __('English (UK)', 'event_espresso'),
487
+								 'en' 			=> __('English (US)', 'event_espresso'),
488
+								 'fil' 			=> __('Filipino', 'event_espresso'),
489
+								 'fi' 			=> __('Finnish', 'event_espresso'),
490
+								 'fr' 			=> __('French', 'event_espresso'),
491
+								 'fr-CA' 	=>  __('French (Canadian)', 'event_espresso'),
492
+								 'de' 			=> __('German', 'event_espresso'),
493
+								 'de-AT' 	=>  __('German (Austria)', 'event_espresso'),
494
+								 'de-CH' 	=>  __('German (Switzerland)', 'event_espresso'),
495
+								 'el' 			=> __('Greek', 'event_espresso'),
496
+								 'iw' 			=> __('Hebrew', 'event_espresso'),
497
+								 'hi' 			=> __('Hindi', 'event_espresso'),
498
+								 'hu' 		=> __('Hungarian', 'event_espresso'),
499
+								 'id' 			=> __('Indonesian', 'event_espresso'),
500
+								 'it' 			=> __('Italian', 'event_espresso'),
501
+								 'ja' 			=> __('Japanese', 'event_espresso'),
502
+								 'ko' 			=> __('Korean', 'event_espresso'),
503
+								 'lv' 			=> __('Latvian', 'event_espresso'),
504
+								 'lt' 			=> __('Lithuanian', 'event_espresso'),
505
+								 'no' 		=> __('Norwegian', 'event_espresso'),
506
+								 'fa' 			=> __('Persian', 'event_espresso'),
507
+								 'pl' 			=> __('Polish', 'event_espresso'),
508
+								 'pt' 			=> __('Portuguese', 'event_espresso'),
509
+								 'pt-BR' 	=>  __('Portuguese (Brazil)', 'event_espresso'),
510
+								 'pt-PT' 	=>  __('Portuguese (Portugal)', 'event_espresso'),
511
+								 'ro' 			=> __('Romanian', 'event_espresso'),
512
+								 'ru' 			=> __('Russian', 'event_espresso'),
513
+								 'sr' 			=> __('Serbian', 'event_espresso'),
514
+								 'sk' 			=> __('Slovak', 'event_espresso'),
515
+								 'sl' 			=> __('Slovenian', 'event_espresso'),
516
+								 'es' 			=> __('Spanish', 'event_espresso'),
517
+								 'es-419' 	=>  __('Spanish (Latin America)', 'event_espresso'),
518
+								 'sv' 			=> __('Swedish', 'event_espresso'),
519
+								 'th' 			=> __('Thai', 'event_espresso'),
520
+								 'tr' 			=> __('Turkish', 'event_espresso'),
521
+								 'uk' 			=> __('Ukrainian', 'event_espresso'),
522
+								 'vi' 			=> __('Vietnamese', 'event_espresso')
524 523
 							),
525 524
 							array(
526
-								'html_label_text'	 	=> __( 'Language', 'event_espresso' ),
527
-								'html_help_text' 		=> __( 'Forces the widget to render in a specific language.', 'event_espresso' ),
528
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'
525
+								'html_label_text'	 	=> __('Language', 'event_espresso'),
526
+								'html_help_text' 		=> __('Forces the widget to render in a specific language.', 'event_espresso'),
527
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'
529 528
 							)
530 529
 						)
531 530
 					)
@@ -573,25 +572,25 @@  discard block
 block discarded – undo
573 572
 	 * @param EE_Registration_Config $EE_Registration_Config
574 573
 	 * @return array
575 574
 	 */
576
-	public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) {
575
+	public static function update_admin_settings(EE_Registration_Config $EE_Registration_Config) {
577 576
 		try {
578 577
 			$recaptcha_settings_form = EED_Recaptcha::_recaptcha_settings_form();
579 578
 			// if not displaying a form, then check for form submission
580
-			if ( $recaptcha_settings_form->was_submitted() ) {
579
+			if ($recaptcha_settings_form->was_submitted()) {
581 580
 				// capture form data
582 581
 				$recaptcha_settings_form->receive_form_submission();
583 582
 				// validate form data
584
-				if ( $recaptcha_settings_form->is_valid() ) {
583
+				if ($recaptcha_settings_form->is_valid()) {
585 584
 					// grab validated data from form
586 585
 					$valid_data = $recaptcha_settings_form->valid_data();
587 586
 					// user proofing recaptcha:  If Use reCAPTCHA is set to yes but we dont' have site or secret keys then set Use reCAPTCHA to FALSE and give error message.
588 587
 					if (
589
-						apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config )
588
+						apply_filters('FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config)
590 589
 						&& $valid_data['main_settings']['use_captcha']
591
-						&& ( ! $EE_Registration_Config->use_captcha && ( empty( $valid_data['main_settings']['recaptcha_publickey'] ) || empty( $valid_data['main_settings']['recaptcha_privatekey'] )))
590
+						&& ( ! $EE_Registration_Config->use_captcha && (empty($valid_data['main_settings']['recaptcha_publickey']) || empty($valid_data['main_settings']['recaptcha_privatekey'])))
592 591
 					) {
593 592
 						$valid_data['main_settings']['use_captcha'] = FALSE;
594
-						EE_Error::add_error( __('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
593
+						EE_Error::add_error(__('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
595 594
 					}
596 595
 					$EE_Registration_Config->use_captcha = $valid_data['main_settings']['use_captcha'];
597 596
 					$EE_Registration_Config->recaptcha_publickey = $valid_data['main_settings']['recaptcha_publickey'];
@@ -600,12 +599,12 @@  discard block
 block discarded – undo
600 599
 					$EE_Registration_Config->recaptcha_theme = $valid_data['appearance_settings']['recaptcha_theme'];
601 600
 					$EE_Registration_Config->recaptcha_language = $valid_data['appearance_settings']['recaptcha_language'];
602 601
 				} else {
603
-					if ( $recaptcha_settings_form->submission_error_message() != '' ) {
604
-						EE_Error::add_error( $recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
602
+					if ($recaptcha_settings_form->submission_error_message() != '') {
603
+						EE_Error::add_error($recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
605 604
 					}
606 605
 				}
607 606
 			}
608
-		} catch( EE_Error $e ) {
607
+		} catch (EE_Error $e) {
609 608
 			$e->get_error();
610 609
 		}
611 610
 
Please login to merge, or discard this patch.
event_single_caff/templates/admin-event-single-settings.template.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2
-add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' );
2
+add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
3 3
 $values = EEH_Form_Fields::prep_answer_options(
4 4
 	array(
5
-		array( 'id' => 1, 'text' => __( 'Yes', 'event_espresso' ) ),
6
-		array( 'id' => 0, 'text' => __( 'No', 'event_espresso' ) )
5
+		array('id' => 1, 'text' => __('Yes', 'event_espresso')),
6
+		array('id' => 0, 'text' => __('No', 'event_espresso'))
7 7
 	)
8 8
 );
9 9
 ?>
@@ -22,27 +22,27 @@  discard block
 block discarded – undo
22 22
 					</label>
23 23
 				</th>
24 24
 				<td>
25
-					<?php echo EEH_Form_Fields::select( 'display_status_banner_single', $display_status_banner_single, $values, 'display_status_banner_single', 'display_status_banner_single' ); ?>
26
-					<p class="description"><?php _e( 'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the single event page.', 'event_espresso' ); ?></p>
25
+					<?php echo EEH_Form_Fields::select('display_status_banner_single', $display_status_banner_single, $values, 'display_status_banner_single', 'display_status_banner_single'); ?>
26
+					<p class="description"><?php _e('Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the single event page.', 'event_espresso'); ?></p>
27 27
 				</td>
28 28
 			</tr>
29 29
 
30 30
 			<tr>
31 31
 				<th>
32 32
 					<label for="display_venue">
33
-						<?php _e( 'Display Venue Details', 'event_espresso' ); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info');?>
33
+						<?php _e('Display Venue Details', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info'); ?>
34 34
 					</label>
35 35
 				</th>
36 36
 				<td>
37
-					<?php echo EEH_Form_Fields::select( 'display_venue', $display_venue, $values, 'display_venue', 'display_venue' ); ?>
38
-					<p class="description"><?php _e( 'Do not use this if you are using the venue shortcodes in your event description.', 'event_espresso' ); ?></p>
37
+					<?php echo EEH_Form_Fields::select('display_venue', $display_venue, $values, 'display_venue', 'display_venue'); ?>
38
+					<p class="description"><?php _e('Do not use this if you are using the venue shortcodes in your event description.', 'event_espresso'); ?></p>
39 39
 				</td>
40 40
 			</tr>
41 41
 
42 42
 			<tr>
43 43
 				<th>
44 44
 					<label for="EED_Events_Single_use_sortable_display_order">
45
-						<?php _e( 'Use Custom Display Order?', 'event_espresso' ); ?>
45
+						<?php _e('Use Custom Display Order?', 'event_espresso'); ?>
46 46
 					</label>
47 47
 				</th>
48 48
 				<td>
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 					<p class="description ">
59 59
 						<?php
60 60
 						echo sprintf(
61
-							__( '%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Single page display, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso' ),
61
+							__('%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Single page display, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso'),
62 62
 							'<span class="important-notice">',
63 63
 							'</span>',
64 64
 							'<br />'
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 
71 71
 			<tr>
72 72
 				<th>
73
-					<?php _e('Display Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info');?>
73
+					<?php _e('Display Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info'); ?>
74 74
 				</th>
75 75
 				<td>
76 76
 
77
-					<?php wp_nonce_field( 'espresso_update_event_single_order', 'espresso_update_event_single_order_nonce', false ); ?>
77
+					<?php wp_nonce_field('espresso_update_event_single_order', 'espresso_update_event_single_order_nonce', false); ?>
78 78
 					<?php echo $event_single_display_order; ?>
79 79
 
80 80
 					<p class="description"><?php _e('Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the single event page.', 'event_espresso'); ?></p>
Please login to merge, or discard this patch.