Completed
Branch BETA-4.9-messages-queue-fixed (941081)
by
unknown
17:38 queued 10s
created
admin/extend/registrations/Extend_Registrations_Admin_Page.core.php 1 patch
Spacing   +217 added lines, -217 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
 /**
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class Extend_Registrations_Admin_Page extends Registrations_Admin_Page {
31 31
 
32
-	public function __construct( $routing = TRUE ) {
33
-		parent::__construct( $routing );
34
-		define( 'REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/');
35
-		define( 'REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/');
36
-		define( 'REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/');
32
+	public function __construct($routing = TRUE) {
33
+		parent::__construct($routing);
34
+		define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/');
35
+		define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/');
36
+		define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/');
37 37
 	}
38 38
 
39 39
 
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 
43 43
 
44 44
 	protected function _extend_page_config() {
45
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations';
45
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations';
46 46
 
47
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
48
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) ? ! is_array( $this->_req_data['ATT_ID'] ) : 0;
49
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
47
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
48
+		$att_id = ! empty($this->_req_data['ATT_ID']) ? ! is_array($this->_req_data['ATT_ID']) : 0;
49
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
50 50
 
51 51
 		$new_page_routes = array(
52 52
 			'reports' => array(
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 				)
86 86
 			);
87 87
 
88
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
88
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
89 89
 
90 90
 		$new_page_config = array(
91 91
 			'reports' => array(
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 						'filename' => 'registrations_reports'
100 100
 						)
101 101
 					),
102
-				'help_tour' => array( 'Registration_Reports_Help_Tour' ),
102
+				'help_tour' => array('Registration_Reports_Help_Tour'),
103 103
 				'require_nonce' => FALSE
104 104
 				),
105 105
 			'event_registrations' => array(
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 						'filename' => 'registrations_event_checkin_other'
131 131
 					)
132 132
 				),
133
-				'help_tour' => array( 'Event_Checkin_Help_Tour' ),
134
-				'qtips' => array('Registration_List_Table_Tips' ),
133
+				'help_tour' => array('Event_Checkin_Help_Tour'),
134
+				'qtips' => array('Registration_List_Table_Tips'),
135 135
 				'list_table' => 'EE_Event_Registrations_List_Table',
136 136
 				'metaboxes' => array(),
137 137
 				'require_nonce' => FALSE
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		// var_dump($this->_req_data);
153 153
 		// exit();
154 154
 
155
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
155
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
156 156
 		$this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table';
157 157
 		$this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table';
158 158
 	}
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
 	protected function _ajax_hooks() {
163 163
 		parent::_ajax_hooks();
164
-		add_action('wp_ajax_get_newsletter_form_content', array( $this, 'get_newsletter_form_content') );
164
+		add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content'));
165 165
 	}
166 166
 
167 167
 
@@ -171,12 +171,12 @@  discard block
 block discarded – undo
171 171
 
172 172
 		//if newsletter message type is active then let's add filter and load js for it.
173 173
 		EE_Registry::instance()->load_helper('MSG_Template');
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
 
@@ -188,12 +188,12 @@  discard block
 block discarded – undo
188 188
 
189 189
 		//scripts
190 190
 		global $is_IE;
191
-		if ( $is_IE ) {
192
-			wp_enqueue_script( 'excanvas' );
191
+		if ($is_IE) {
192
+			wp_enqueue_script('excanvas');
193 193
 		}
194 194
 
195
-		wp_register_script('espresso_reg_admin_regs_per_day', REG_CAF_ASSETS_URL  . 'espresso_reg_admin_regs_per_day_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE );
196
-		wp_register_script('espresso_reg_admin_regs_per_event', REG_CAF_ASSETS_URL . 'espresso_reg_admin_regs_per_event_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE );
195
+		wp_register_script('espresso_reg_admin_regs_per_day', REG_CAF_ASSETS_URL.'espresso_reg_admin_regs_per_day_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE);
196
+		wp_register_script('espresso_reg_admin_regs_per_event', REG_CAF_ASSETS_URL.'espresso_reg_admin_regs_per_event_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE);
197 197
 	}
198 198
 
199 199
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 				'slug' => 'all',
225 225
 				'label' => __('All', 'event_espresso'),
226 226
 				'count' => 0,
227
-				'bulk_action' => !isset( $this->_req_data['event_id'] ) ? array() : array(
227
+				'bulk_action' => ! isset($this->_req_data['event_id']) ? array() : array(
228 228
 					'toggle_checkin_status' => __('Toggle Check-In', 'event_espresso'),
229 229
 					//'trash_registrations' => __('Trash Registrations', 'event_espresso')
230 230
 					)
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 				'slug' => 'all',
243 243
 				'label' => __('All', 'event_espresso'),
244 244
 				'count' => 0,
245
-				'bulk_action' => array( 'delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso') )
245
+				'bulk_action' => array('delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso'))
246 246
 				),
247 247
 			);
248 248
 	}
@@ -258,20 +258,20 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public function get_newsletter_form_content() {
260 260
 		//do a nonce check cause we're not coming in from an normal route here.
261
-		$nonce = isset( $this->_req_data['get_newsletter_form_content_nonce'] ) ? sanitize_text_field( $this->_req_data['get_newsletter_form_content_nonce'] ) : '';
261
+		$nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field($this->_req_data['get_newsletter_form_content_nonce']) : '';
262 262
 		$nonce_ref = 'get_newsletter_form_content_nonce';
263 263
 
264
-		$this->_verify_nonce( $nonce, $nonce_ref );
264
+		$this->_verify_nonce($nonce, $nonce_ref);
265 265
 		//let's get the mtp for the incoming MTP_ ID
266
-		if ( !isset( $this->_req_data['GRP_ID'] ) ) {
267
-			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__ );
266
+		if ( ! isset($this->_req_data['GRP_ID'])) {
267
+			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__);
268 268
 			$this->_template_args['success'] = FALSE;
269 269
 			$this->_template_args['error'] = TRUE;
270 270
 			$this->_return_json();
271 271
 		}
272
-		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['GRP_ID'] );
273
-		if ( ! $MTPG instanceof EE_Message_Template_Group ) {
274
-			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__  );
272
+		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);
273
+		if ( ! $MTPG instanceof EE_Message_Template_Group) {
274
+			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__);
275 275
 			$this->_template_args['success'] = FALSE;
276 276
 			$this->_template_args['error'] = TRUE;
277 277
 			$this->_return_json();
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
 		$MTPs = $MTPG->context_templates();
281 281
 		$MTPs = $MTPs['attendee'];
282 282
 		$template_fields = array();
283
-		foreach ( $MTPs as $MTP ) {
283
+		foreach ($MTPs as $MTP) {
284 284
 			$field = $MTP->get('MTP_template_field');
285
-			if ( $field == 'content'  ) {
285
+			if ($field == 'content') {
286 286
 				$content = $MTP->get('MTP_content');
287
-				if ( !empty( $content['newsletter_content'] ) ) {
287
+				if ( ! empty($content['newsletter_content'])) {
288 288
 					$template_fields['newsletter_content'] = $content['newsletter_content'];
289 289
 					}
290 290
 				continue;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		$this->_template_args['data'] = array(
298 298
 			'batch_message_from' => isset($template_fields['from']) ? $template_fields['from'] : '',
299 299
 			'batch_message_subject' => isset($template_fields['subject']) ? $template_fields['subject'] : '',
300
-			'batch_message_content' => isset( $template_fields['newsletter_content'] ) ? $template_fields['newsletter_content'] : ''
300
+			'batch_message_content' => isset($template_fields['newsletter_content']) ? $template_fields['newsletter_content'] : ''
301 301
 			);
302 302
 		$this->_return_json();
303 303
 	}
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
 	 * @param EE_Admin_List_Table $list_table
314 314
 	 * @return string html string for extra buttons
315 315
 	 */
316
-	public function add_newsletter_action_buttons( EE_Admin_List_Table $list_table ) {
317
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_newsletter_selected_send' ) ) {
316
+	public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table) {
317
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_newsletter_selected_send')) {
318 318
 			return '';
319 319
 		}
320 320
 
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
 			'event_registrations',
324 324
 			'default'
325 325
 			);
326
-		if ( $this->_current_page == 'espresso_registrations' && in_array( $this->_req_action, $routes_to_add_to )  ) {
327
-			if ( ( $this->_req_action == 'event_registrations' && empty( $this->_req_data['event_id'] ) ) || ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ) ) {
326
+		if ($this->_current_page == 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) {
327
+			if (($this->_req_action == 'event_registrations' && empty($this->_req_data['event_id'])) || (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash')) {
328 328
 				echo '';
329 329
 			} else {
330
-				$button_text = sprintf( __('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>' );
331
-				echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>' . $button_text . '</button>';
332
-				add_action('admin_footer', array( $this, 'newsletter_send_form_skeleton') );
330
+				$button_text = sprintf(__('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>');
331
+				echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>'.$button_text.'</button>';
332
+				add_action('admin_footer', array($this, 'newsletter_send_form_skeleton'));
333 333
 			}
334 334
 		}
335 335
 	}
@@ -341,38 +341,38 @@  discard block
 block discarded – undo
341 341
 		$list_table = $this->_list_table_object;
342 342
 		$codes = array();
343 343
 		//need to templates for the newsletter message type for the template selector.
344
-		$values[] = array( 'text' => __('Select Template to Use', 'event_espresso'), 'id' => 0 );
345
-		$mtps = EEM_Message_Template_Group::instance()->get_all( array( array( 'MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email' ) ) );
346
-		foreach ( $mtps as $mtp ) {
344
+		$values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0);
345
+		$mtps = EEM_Message_Template_Group::instance()->get_all(array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email')));
346
+		foreach ($mtps as $mtp) {
347 347
 			$name = $mtp->name();
348 348
 			$values[] = array(
349
-				'text' => empty( $name ) ? __('Global', 'event_espresso') : $name,
349
+				'text' => empty($name) ? __('Global', 'event_espresso') : $name,
350 350
 				'id' => $mtp->ID()
351 351
 				);
352 352
 		}
353 353
 
354 354
 		//need to get a list of shortcodes that are available for the newsletter message type.
355 355
 		EE_Registry::instance()->load_helper('MSG_Template');
356
-		$shortcodes = EEH_MSG_Template::get_shortcodes( 'newsletter', 'email', array(), 'attendee', FALSE );
357
-		foreach ( $shortcodes as $field => $shortcode_array ) {
358
-			$codes[$field] = implode(', ', array_keys($shortcode_array ) );
356
+		$shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', FALSE);
357
+		foreach ($shortcodes as $field => $shortcode_array) {
358
+			$codes[$field] = implode(', ', array_keys($shortcode_array));
359 359
 		}
360 360
 
361 361
 		$shortcodes = $codes;
362 362
 
363
-		$form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
363
+		$form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php';
364 364
 		$form_template_args = array(
365 365
 			'form_action' => admin_url('admin.php?page=espresso_registrations'),
366 366
 			'form_route' => 'newsletter_selected_send',
367 367
 			'form_nonce_name' => 'newsletter_selected_send_nonce',
368
-			'form_nonce' => wp_create_nonce( 'newsletter_selected_send_nonce' ),
368
+			'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'),
369 369
 			'redirect_back_to' => $this->_req_action,
370
-			'ajax_nonce' => wp_create_nonce( 'get_newsletter_form_content_nonce'),
371
-			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values ),
370
+			'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'),
371
+			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values),
372 372
 			'shortcodes' => $shortcodes,
373 373
 			'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration'
374 374
 			);
375
-		EEH_Template::display_template( $form_template, $form_template_args );
375
+		EEH_Template::display_template($form_template, $form_template_args);
376 376
 	}
377 377
 
378 378
 
@@ -387,35 +387,35 @@  discard block
 block discarded – undo
387 387
 	protected function _newsletter_selected_send() {
388 388
 		$success = TRUE;
389 389
 		//first we need to make sure we have a GRP_ID so we know what template we're sending and updating!
390
-		if ( empty( $this->_req_data['newsletter_mtp_selected'] ) ) {
391
-			EE_Error::add_error( __('In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
390
+		if (empty($this->_req_data['newsletter_mtp_selected'])) {
391
+			EE_Error::add_error(__('In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
392 392
 			$success = FALSE;
393 393
 		}
394 394
 
395
-		if ( $success ) {
395
+		if ($success) {
396 396
 			//update Message template in case there are any changes
397
-			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['newsletter_mtp_selected'] );
397
+			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['newsletter_mtp_selected']);
398 398
 			$MTPs = $MTPG instanceof EE_Message_Template_Group ? $MTPG->context_templates() : array();
399
-			if ( empty( $MTPs ) ) {
400
-				EE_Error::add_error( __('Unable to retrieve message template fields from the db. Messages not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
399
+			if (empty($MTPs)) {
400
+				EE_Error::add_error(__('Unable to retrieve message template fields from the db. Messages not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
401 401
 				$success = FALSE;
402 402
 			}
403 403
 
404 404
 			//let's just update the specific fields
405
-			foreach ( $MTPs['attendee'] as $MTP ) {
405
+			foreach ($MTPs['attendee'] as $MTP) {
406 406
 				$field = $MTP->get('MTP_template_field');
407 407
 				$content = $MTP->get('MTP_content');
408 408
 				$new_content = $content;
409
-				switch( $field ) {
409
+				switch ($field) {
410 410
 					case 'from' :
411
-						$new_content = !empty( $this->_req_data['batch_message']['from'] ) ? $this->_req_data['batch_message']['from'] : $content;
411
+						$new_content = ! empty($this->_req_data['batch_message']['from']) ? $this->_req_data['batch_message']['from'] : $content;
412 412
 						break;
413 413
 					case 'subject' :
414
-						$new_content = !empty( $this->_req_data['batch_message']['subject'] ) ? $this->_req_data['batch_message']['subject'] : $content;
414
+						$new_content = ! empty($this->_req_data['batch_message']['subject']) ? $this->_req_data['batch_message']['subject'] : $content;
415 415
 						break;
416 416
 					case 'content' :
417 417
 						$new_content = $content;
418
-						$new_content['newsletter_content'] = !empty( $this->_req_data['batch_message']['content'] ) ? $this->_req_data['batch_message']['content'] : $content['newsletter_content'];
418
+						$new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content']) ? $this->_req_data['batch_message']['content'] : $content['newsletter_content'];
419 419
 						break;
420 420
 					default :
421 421
 						continue;
@@ -426,20 +426,20 @@  discard block
 block discarded – undo
426 426
 			}
427 427
 
428 428
 			//great fields are updated!  now let's make sure we just have contact objects (EE_Attendee).
429
-			$id_type = !empty( $this->_req_data['batch_message']['id_type'] ) ? $this->_req_data['batch_message']['id_type'] : 'registration';
429
+			$id_type = ! empty($this->_req_data['batch_message']['id_type']) ? $this->_req_data['batch_message']['id_type'] : 'registration';
430 430
 
431 431
 			//id_type will affect how we assemble the ids.
432
-			$ids = !empty( $this->_req_data['batch_message']['ids'] ) ? json_decode( stripslashes($this->_req_data['batch_message']['ids']) ) : array();
432
+			$ids = ! empty($this->_req_data['batch_message']['ids']) ? json_decode(stripslashes($this->_req_data['batch_message']['ids'])) : array();
433 433
 
434
-			$contacts = $id_type == 'registration' ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids( $ids ) : EEM_Attendee::instance()->get_all( array( array( 'ATT_ID' => array('in', $ids ) ) ) );
434
+			$contacts = $id_type == 'registration' ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids) : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids))));
435 435
 
436 436
 			//we do _action because ALL triggers are handled in EED_Messages.
437
-			do_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', $contacts, $MTPG->ID() );
437
+			do_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', $contacts, $MTPG->ID());
438 438
 		}
439 439
 		$query_args = array(
440
-			'action' => !empty( $this->_req_data['redirect_back_to'] ) ? $this->_req_data['redirect_back_to'] : 'default'
440
+			'action' => ! empty($this->_req_data['redirect_back_to']) ? $this->_req_data['redirect_back_to'] : 'default'
441 441
 			);
442
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
442
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
443 443
 	}
444 444
 
445 445
 
@@ -452,16 +452,16 @@  discard block
 block discarded – undo
452 452
 	*/
453 453
 	protected function _registration_reports() {
454 454
 
455
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
455
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
456 456
 
457 457
 		$page_args = array();
458 458
 
459
-		$page_args['admin_reports'][] = $this->_registrations_per_day_report( '-1 month' );  //  option: '-1 week', '-2 weeks' defaults to '-1 month'
460
-		$page_args['admin_reports'][] = $this->_get_registrations_per_event_report( '-1 month' ); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
459
+		$page_args['admin_reports'][] = $this->_registrations_per_day_report('-1 month'); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
460
+		$page_args['admin_reports'][] = $this->_get_registrations_per_event_report('-1 month'); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
461 461
 //		$page_args['admin_reports'][] = 'chart1';
462 462
 
463
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
464
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $page_args, TRUE );
463
+		$template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php';
464
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $page_args, TRUE);
465 465
 
466 466
 //		EEH_Debug_Tools::printr( $page_args, '$page_args' );
467 467
 
@@ -480,36 +480,36 @@  discard block
 block discarded – undo
480 480
 	*		@access private
481 481
 	*		@return void
482 482
 	*/
483
-	private function _registrations_per_day_report( $period = '-1 month' ) {
483
+	private function _registrations_per_day_report($period = '-1 month') {
484 484
 
485 485
 		$report_ID = 'reg-admin-registrations-per-day-report-dv';
486 486
 		$report_JS = 'espresso_reg_admin_regs_per_day';
487 487
 
488
-		wp_enqueue_script( $report_JS );
488
+		wp_enqueue_script($report_JS);
489 489
 
490 490
 		$REG = EEM_Registration::instance();
491 491
 
492
-		$results = $REG->get_registrations_per_day_report( $period );
492
+		$results = $REG->get_registrations_per_day_report($period);
493 493
 
494 494
 		//EEH_Debug_Tools::printr( $results, '$registrations_per_day' );
495 495
 		$regs = array();
496
-		$xmin = date( 'Y-m-d', strtotime( '+1 year' ));
496
+		$xmin = date('Y-m-d', strtotime('+1 year'));
497 497
 		$xmax = 0;
498 498
 		$ymax = 0;
499 499
 		$results = (array) $results;
500
-		foreach ( $results as $result ) {
501
-			$regs[] = array( $result->regDate, (int)$result->total );
502
-			$xmin = strtotime( $result->regDate ) < strtotime( $xmin ) ? $result->regDate : $xmin;
503
-			$xmax = strtotime( $result->regDate ) > strtotime( $xmax ) ? $result->regDate : $xmax;
500
+		foreach ($results as $result) {
501
+			$regs[] = array($result->regDate, (int) $result->total);
502
+			$xmin = strtotime($result->regDate) < strtotime($xmin) ? $result->regDate : $xmin;
503
+			$xmax = strtotime($result->regDate) > strtotime($xmax) ? $result->regDate : $xmax;
504 504
 			$ymax = $result->total > $ymax ? $result->total : $ymax;
505 505
 		}
506 506
 
507
-		$xmin = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmin)) . ' -1 day' ));
508
-		$xmax = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmax)) . ' +1 day' ));
507
+		$xmin = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmin)).' -1 day'));
508
+		$xmax = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmax)).' +1 day'));
509 509
 		// calculate # days between our min and max dates
510
-		$span = floor( (strtotime($xmax) - strtotime($xmin)) / (60*60*24)) + 1;
510
+		$span = floor((strtotime($xmax) - strtotime($xmin)) / (60 * 60 * 24)) + 1;
511 511
 
512
-		$report_title = __( 'Total Registrations per Day', 'event_espresso' );
512
+		$report_title = __('Total Registrations per Day', 'event_espresso');
513 513
 
514 514
 		$report_params = array(
515 515
 				'title' 	=> $report_title,
@@ -520,9 +520,9 @@  discard block
 block discarded – undo
520 520
 				'ymax' 	=> ceil($ymax * 1.25),
521 521
 				'span' 	=> $span,
522 522
 				'width'	=> ceil(900 / $span),
523
-				'noRegsMsg' => sprintf( __('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title )
523
+				'noRegsMsg' => sprintf(__('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title)
524 524
 			);
525
-		wp_localize_script( $report_JS, 'regPerDay', $report_params );
525
+		wp_localize_script($report_JS, 'regPerDay', $report_params);
526 526
 
527 527
 		return $report_ID;
528 528
 	}
@@ -537,29 +537,29 @@  discard block
 block discarded – undo
537 537
 	*		@access private
538 538
 	*		@return void
539 539
 	*/
540
-	private function _get_registrations_per_event_report( $period = '-1 month' ) {
540
+	private function _get_registrations_per_event_report($period = '-1 month') {
541 541
 
542 542
 		$report_ID = 'reg-admin-registrations-per-event-report-dv';
543 543
 		$report_JS = 'espresso_reg_admin_regs_per_event';
544 544
 
545
-		wp_enqueue_script( $report_JS );
545
+		wp_enqueue_script($report_JS);
546 546
 
547
-		require_once ( EE_MODELS . 'EEM_Registration.model.php' );
547
+		require_once (EE_MODELS.'EEM_Registration.model.php');
548 548
 		$REG = EEM_Registration::instance();
549 549
 
550
-		$results = $REG->get_registrations_per_event_report( $period );
550
+		$results = $REG->get_registrations_per_event_report($period);
551 551
 		//EEH_Debug_Tools::printr( $results, '$registrations_per_event' );
552 552
 		$regs = array();
553 553
 		$ymax = 0;
554 554
 		$results = (array) $results;
555
-		foreach ( $results as $result ) {
556
-			$regs[] = array( wp_trim_words( $result->event_name, 4, '...' ), (int)$result->total );
555
+		foreach ($results as $result) {
556
+			$regs[] = array(wp_trim_words($result->event_name, 4, '...'), (int) $result->total);
557 557
 			$ymax = $result->total > $ymax ? $result->total : $ymax;
558 558
 		}
559 559
 
560 560
 		$span = $period == 'week' ? 9 : 33;
561 561
 
562
-		$report_title = __( 'Total Registrations per Event', 'event_espresso' );
562
+		$report_title = __('Total Registrations per Event', 'event_espresso');
563 563
 
564 564
 		$report_params = array(
565 565
 			'title' 	=> $report_title,
@@ -568,9 +568,9 @@  discard block
 block discarded – undo
568 568
 			'ymax' 	=> ceil($ymax * 1.25),
569 569
 			'span' 	=> $span,
570 570
 			'width'	=> ceil(900 / $span),
571
-			'noRegsMsg' => sprintf( __('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title )
571
+			'noRegsMsg' => sprintf(__('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title)
572 572
 		);
573
-		wp_localize_script( $report_JS, 'regPerEvent', $report_params );
573
+		wp_localize_script($report_JS, 'regPerEvent', $report_params);
574 574
 
575 575
 		return $report_ID;
576 576
 	}
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
 	 * @return void
585 585
 	 */
586 586
 	protected function _registration_checkin_list_table() {
587
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
588
-		$reg_id = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : null;
587
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
588
+		$reg_id = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : null;
589 589
 		$reg = EEM_Registration::instance()->get_one_by_ID($reg_id);
590 590
 		$this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $reg->event_ID()), 'add-new-h2');
591 591
 
@@ -599,15 +599,15 @@  discard block
 block discarded – undo
599 599
 				'desc' => __('This indicates the attendee has been checked out', 'event_espresso')
600 600
 				)
601 601
 			);
602
-		$this->_template_args['after_list_table'] = $this->_display_legend( $legend_items );
602
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
603 603
 
604 604
 
605
-		$dtt_id = isset(  $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
606
-		$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 ) : '';
605
+		$dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
606
+		$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) : '';
607 607
 
608
-		$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>' : '';
609
-		$this->_template_args['list_table_hidden_fields'] = !empty( $reg_id ) ? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : '';
610
-		$this->_template_args['list_table_hidden_fields'] .= !empty( $dtt_id ) ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
608
+		$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>' : '';
609
+		$this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) ? '<input type="hidden" name="_REGID" value="'.$reg_id.'">' : '';
610
+		$this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : '';
611 611
 
612 612
 		$this->display_admin_list_table_page_with_no_sidebar();
613 613
 	}
@@ -620,24 +620,24 @@  discard block
 block discarded – undo
620 620
 	 */
621 621
 	public function toggle_checkin_status() {
622 622
 		//first make sure we have the necessary data
623
-		if ( !isset( $this->_req_data['_regid'] ) ) {
624
-			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__ );
623
+		if ( ! isset($this->_req_data['_regid'])) {
624
+			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__);
625 625
 			$this->_template_args['success'] = FALSE;
626 626
 			$this->_template_args['error'] = TRUE;
627 627
 			$this->_return_json();
628 628
 		};
629 629
 
630 630
 		//do a nonce check cause we're not coming in from an normal route here.
631
-		$nonce = isset( $this->_req_data['checkinnonce'] ) ? sanitize_text_field( $this->_req_data['checkinnonce'] ) : '';
631
+		$nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce']) : '';
632 632
 		$nonce_ref = 'checkin_nonce';
633 633
 
634
-		$this->_verify_nonce( $nonce, $nonce_ref );
634
+		$this->_verify_nonce($nonce, $nonce_ref);
635 635
 
636 636
 		//beautiful! Made it this far so let's get the status.
637 637
 		$new_status = $this->_toggle_checkin_status();
638 638
 
639 639
 		//setup new class to return via ajax
640
-		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-' . $new_status;
640
+		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-'.$new_status;
641 641
 		$this->_template_args['success'] = TRUE;
642 642
 		$this->_return_json();
643 643
 	}
@@ -657,32 +657,32 @@  discard block
 block discarded – undo
657 657
 		//first let's get the query args out of the way for the redirect
658 658
 		$query_args = array(
659 659
 			'action' => 'event_registrations',
660
-			'event_id' => isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL,
661
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL
660
+			'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL,
661
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL
662 662
 			);
663 663
 		$new_status = FALSE;
664 664
 
665 665
 		// bulk action check in toggle
666
-		if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) {
666
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
667 667
 			// cycle thru checkboxes
668
-			while ( list( $REG_ID, $value ) = each($this->_req_data['checkbox'])) {
669
-				$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
668
+			while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) {
669
+				$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
670 670
 				$new_status = $this->_toggle_checkin($REG_ID, $DTT_ID);
671 671
 			}
672 672
 
673
-		} elseif ( isset( $this->_req_data['_regid'] ) ) {
673
+		} elseif (isset($this->_req_data['_regid'])) {
674 674
 			//coming from ajax request
675
-			$DTT_ID = isset( $this->_req_data['dttid'] ) ? $this->_req_data['dttid'] : NULL;
675
+			$DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : NULL;
676 676
 			$query_args['DTT_ID'] = $DTT_ID;
677 677
 			$new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID);
678 678
 		} else {
679
-			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
679
+			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
680 680
 		}
681 681
 
682
-		if ( defined('DOING_AJAX' ) )
682
+		if (defined('DOING_AJAX'))
683 683
 			return $new_status;
684 684
 
685
-		$this->_redirect_after_action( FALSE,'', '', $query_args, TRUE );
685
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
686 686
 
687 687
 	}
688 688
 
@@ -698,11 +698,11 @@  discard block
 block discarded – undo
698 698
 	 */
699 699
 	private function _toggle_checkin($REG_ID, $DTT_ID) {
700 700
 		$REG = EEM_Registration::instance()->get_one_by_ID($REG_ID);
701
-		$new_status = $REG->toggle_checkin_status( $DTT_ID );
702
-		if ( $new_status !== FALSE ) {
703
-			EE_Error::add_success($REG->get_checkin_msg($DTT_ID) );
701
+		$new_status = $REG->toggle_checkin_status($DTT_ID);
702
+		if ($new_status !== FALSE) {
703
+			EE_Error::add_success($REG->get_checkin_msg($DTT_ID));
704 704
 		} else {
705
-			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__ );
705
+			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__);
706 706
 			$new_status = FALSE;
707 707
 		}
708 708
 		return $new_status;
@@ -718,28 +718,28 @@  discard block
 block discarded – undo
718 718
 	protected function _delete_checkin_rows() {
719 719
 		$query_args = array(
720 720
 			'action' => 'registration_checkins',
721
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0,
722
-			'_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0
721
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
722
+			'_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0
723 723
 			);
724
-		if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
725
-			while ( list( $CHK_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
724
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
725
+			while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) {
726 726
 				$errors = 0;
727
-				if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID ) ) {
727
+				if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
728 728
 					$errors++;
729 729
 				}
730 730
 			}
731 731
 		} else {
732
-			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__ );
733
-			$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
732
+			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__);
733
+			$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
734 734
 		}
735 735
 
736
-		if ( $errors > 0 ) {
737
-			EE_Error::add_error( sprintf( __('There were %d records that did not delete successfully', 'event_espresso'), $errors ), __FILE__, __FUNCTION__, __LINE__ );
736
+		if ($errors > 0) {
737
+			EE_Error::add_error(sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors), __FILE__, __FUNCTION__, __LINE__);
738 738
 		} else {
739
-			EE_Error::add_success( __('Records were successfully deleted', 'event_espresso') );
739
+			EE_Error::add_success(__('Records were successfully deleted', 'event_espresso'));
740 740
 		}
741 741
 
742
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
742
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
743 743
 	}
744 744
 
745 745
 
@@ -751,20 +751,20 @@  discard block
 block discarded – undo
751 751
 	protected function _delete_checkin_row() {
752 752
 		$query_args = array(
753 753
 			'action' => 'registration_checkins',
754
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0,
755
-			'_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0
754
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
755
+			'_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0
756 756
 			);
757 757
 
758
-		if ( !empty( $this->_req_data['CHK_ID'] ) ) {
759
-			if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'] ) ) {
760
-				EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
758
+		if ( ! empty($this->_req_data['CHK_ID'])) {
759
+			if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
760
+				EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
761 761
 			} else {
762
-				EE_Error::add_success( __('Check-In record successfully deleted', 'event_espresso') );
762
+				EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso'));
763 763
 			}
764 764
 		} else {
765
-			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__ );
765
+			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__);
766 766
 		}
767
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
767
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
768 768
 	}
769 769
 
770 770
 
@@ -777,8 +777,8 @@  discard block
 block discarded – undo
777 777
 	*		@return void
778 778
 	*/
779 779
 	protected function _event_registrations_list_table() {
780
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
781
-		$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') : '';
780
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
781
+		$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') : '';
782 782
 
783 783
 		$legend_items = array(
784 784
 			'star-icon' => array(
@@ -802,31 +802,31 @@  discard block
 block discarded – undo
802 802
 				'desc' => __('View All Check-in Records for this Registrant', 'event_espresso')
803 803
 				),
804 804
 			'approved_status' => array(
805
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
806
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
805
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
806
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
807 807
 				),
808 808
             'cancelled_status' => array(
809
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
810
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
809
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
810
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
811 811
 				),
812 812
             'declined_status' => array(
813
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
814
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
813
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
814
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
815 815
 				),
816 816
 			'not_approved' => array(
817
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
818
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
817
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
818
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
819 819
 				),
820 820
 			'pending_status' => array(
821
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
822
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
821
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
822
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
823 823
 				)/**/
824 824
 			);
825
-		$this->_template_args['after_list_table'] = $this->_display_legend( $legend_items );
825
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
826 826
 
827
-		$event_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null;
828
-		$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>' : '';
829
-		$this->_template_args['list_table_hidden_fields'] = !empty( $event_id ) ? '<input type="hidden" name="event_id" value="' . $event_id . '">' : '';
827
+		$event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
828
+		$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>' : '';
829
+		$this->_template_args['list_table_hidden_fields'] = ! empty($event_id) ? '<input type="hidden" name="event_id" value="'.$event_id.'">' : '';
830 830
 
831 831
 		$this->display_admin_list_table_page_with_no_sidebar();
832 832
 	}
@@ -840,15 +840,15 @@  discard block
 block discarded – undo
840 840
 	*		@access public
841 841
 	*		@return array
842 842
 	*/
843
-	public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) {
843
+	public function get_event_attendees($per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '') {
844 844
 
845
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
846
-		require_once(EE_MODELS . 'EEM_Attendee.model.php');
845
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
846
+		require_once(EE_MODELS.'EEM_Attendee.model.php');
847 847
 		//$ATT_MDL = EEM_Attendee::instance();
848 848
 
849
-		$EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE;
850
-		$CAT_ID = isset($this->_req_data['category_id']) ? absint( $this->_req_data['category_id'] ) : FALSE;
851
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
849
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
850
+		$CAT_ID = isset($this->_req_data['category_id']) ? absint($this->_req_data['category_id']) : FALSE;
851
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
852 852
 
853 853
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby;
854 854
 
@@ -861,94 +861,94 @@  discard block
 block discarded – undo
861 861
 //				$orderby = 'reg.REG_final_price';
862 862
 		}
863 863
 
864
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
864
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
865 865
 
866
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
867
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
866
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
867
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
868 868
 
869 869
 
870
-		$offset = ($current_page-1)*$per_page;
871
-		$limit = $count ? NULL : array( $offset, $per_page );
872
-		$query_params = array(array('Event.status'=>array('IN',  array_keys(EEM_Event::instance()->get_status_array()))));
873
-		if ($EVT_ID){
874
-			$query_params[0]['EVT_ID']=$EVT_ID;
870
+		$offset = ($current_page - 1) * $per_page;
871
+		$limit = $count ? NULL : array($offset, $per_page);
872
+		$query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array()))));
873
+		if ($EVT_ID) {
874
+			$query_params[0]['EVT_ID'] = $EVT_ID;
875 875
 		}
876
-		if($CAT_ID){
876
+		if ($CAT_ID) {
877 877
 			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?");
878 878
 		}
879 879
 
880 880
 		//if DTT is included we do multiple datetimes.
881
-		if ( $DTT_ID ) {
881
+		if ($DTT_ID) {
882 882
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
883 883
 		}
884 884
 
885 885
 		//make sure we only have default where on the current regs
886 886
 		$query_params['default_where_conditions'] = 'this_model_only';
887 887
 
888
-		$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 ) );
888
+		$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));
889 889
 
890
-		$query_params[0]['STS_ID']= array('IN', $status_ids_array );
890
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
891 891
 
892
-		if($trash){
893
-			$query_params[0]['Attendee.status']=  EEM_CPT_Base::post_status_trashed;
892
+		if ($trash) {
893
+			$query_params[0]['Attendee.status'] = EEM_CPT_Base::post_status_trashed;
894 894
 		}
895 895
 
896
-		if ( isset( $this->_req_data['s'] ) ) {
897
-			$sstr = '%' . $this->_req_data['s'] . '%';
896
+		if (isset($this->_req_data['s'])) {
897
+			$sstr = '%'.$this->_req_data['s'].'%';
898 898
 			$query_params[0]['OR'] = array(
899
-				'Event.EVT_name' => array( 'LIKE', $sstr),
900
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
901
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
902
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
903
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
904
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
905
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
906
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
907
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
908
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
909
-				'REG_final_price' => array( 'LIKE', $sstr ),
910
-				'REG_code' => array( 'LIKE', $sstr ),
911
-				'REG_count' => array( 'LIKE' , $sstr ),
912
-				'REG_group_size' => array( 'LIKE' , $sstr ),
913
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
914
-				'Ticket.TKT_description' => array( 'LIKE', $sstr )
899
+				'Event.EVT_name' => array('LIKE', $sstr),
900
+				'Event.EVT_desc' => array('LIKE', $sstr),
901
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
902
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
903
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
904
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
905
+				'Attendee.ATT_email' => array('LIKE', $sstr),
906
+				'Attendee.ATT_address' => array('LIKE', $sstr),
907
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
908
+				'Attendee.ATT_city' => array('LIKE', $sstr),
909
+				'REG_final_price' => array('LIKE', $sstr),
910
+				'REG_code' => array('LIKE', $sstr),
911
+				'REG_count' => array('LIKE', $sstr),
912
+				'REG_group_size' => array('LIKE', $sstr),
913
+				'Ticket.TKT_name' => array('LIKE', $sstr),
914
+				'Ticket.TKT_description' => array('LIKE', $sstr)
915 915
 				);
916 916
 		}
917 917
 
918 918
 		$query_params['order_by'][$orderby] = $sort;
919 919
 		$query_params['limit'] = $limit;
920
-		$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
921
-		if($count){
922
-			$registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only' ));
923
-		}else{
920
+		$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
921
+		if ($count) {
922
+			$registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only'));
923
+		} else {
924 924
 			$registrations = EEM_Registration::instance()->get_all($query_params);
925 925
 
926 926
 
927 927
 	//		$registrations = EEM_Registration::instance();
928 928
 	//		$all_attendees = EEM_Attendee::instance()->get_event_attendees( $EVT_ID, $CAT_ID, $reg_status, $trash, $orderby, $sort, $limit, $output );
929
-			if ( isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration ) {
929
+			if (isset($registrations[0]) && $registrations[0] instanceof EE_Registration) {
930 930
 				//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' );
931 931
 				// name
932 932
 				$first_registration = $registrations[0];
933 933
 				$event_obj = $first_registration->event_obj();
934
-				if($event_obj){
934
+				if ($event_obj) {
935 935
 					$event_name = $first_registration->event_obj()->name();
936
-					$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 ) : '';
936
+					$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 ) : '';
937 937
 					// edit event link
938
-					if ( $event_name != '' ) {
939
-						$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
940
-						$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
941
-						$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
938
+					if ($event_name != '') {
939
+						$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
940
+						$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
941
+						$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
942 942
 					}
943 943
 
944
-					$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
945
-					$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>';
944
+					$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
945
+					$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>';
946 946
 
947 947
 					$this->_template_args['before_admin_page_content'] = '
948 948
 				<div id="admin-page-header">
949
-					<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
950
-					<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
951
-					<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
949
+					<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
950
+					<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
951
+					<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
952 952
 				</div>
953 953
 				';
954 954
 				}
Please login to merge, or discard this patch.
modules/mijireh_payment_checker/EED_Mijireh_Payment_Checker.module.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  * @author				Mike Nelson
20 20
  *
21 21
  */
22
-class EED_Mijireh_Payment_Checker extends EED_Module{
22
+class EED_Mijireh_Payment_Checker extends EED_Module {
23 23
 
24 24
 	/**
25 25
 	 * 	set_hooks - for hooking into EE Core, other modules, etc
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 	 *  @return 	void
41 41
 	 */
42 42
 	public static function set_hooks_admin() {
43
-		add_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', array( 'EED_Mijireh_Payment_Checker', 'check_for_payment_update_on_transaction' ), 10, 1 );
43
+		add_action('AHEE__Transactions_Admin_Page__transaction_details__start', array('EED_Mijireh_Payment_Checker', 'check_for_payment_update_on_transaction'), 10, 1);
44 44
 	}
45 45
 
46
-	public static function check_for_payment_update_on_transaction( $transaction ) {
47
-		if( $transaction instanceof EE_Transaction ) {
46
+	public static function check_for_payment_update_on_transaction($transaction) {
47
+		if ($transaction instanceof EE_Transaction) {
48 48
 			$last_payment = $transaction->last_payment();
49 49
 			//if this payment is from Mijireh and so far unapproved
50
-			if(
50
+			if (
51 51
 				$last_payment instanceof EE_Payment &&
52 52
 				$last_payment->payment_method() instanceof EE_Payment_Method &&
53 53
 				$last_payment->payment_method()->type_obj() instanceof EE_PMT_Mijireh &&
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 			) {
56 56
 				add_action(
57 57
 					'AHEE__EE_Registration_Processor__trigger_registration_update_notifications',
58
-					array( 'EED_Mijireh_Payment_Checker', 'send_notifications_after_mijireh_ipn' ),
58
+					array('EED_Mijireh_Payment_Checker', 'send_notifications_after_mijireh_ipn'),
59 59
 					5, 2
60 60
 				);
61
-				EE_Payment_Processor::instance()->process_ipn( null, $transaction, $last_payment->payment_method() );
61
+				EE_Payment_Processor::instance()->process_ipn(null, $transaction, $last_payment->payment_method());
62 62
 			}
63 63
 		}
64 64
 	}
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 	 * @param EE_Registration $registration
75 75
 	 * @param array $additional_details
76 76
 	 */
77
-	public static function send_notifications_after_mijireh_ipn( $registration, $additional_details ) {
78
-		$last_payment = isset( $additional_details[ 'last_payment' ] ) ? $additional_details[ 'last_payment' ] : null;
79
-		if ( ! $last_payment instanceof EE_Payment || $last_payment->status() != EEM_Payment::status_id_approved ) {
80
-			add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
77
+	public static function send_notifications_after_mijireh_ipn($registration, $additional_details) {
78
+		$last_payment = isset($additional_details['last_payment']) ? $additional_details['last_payment'] : null;
79
+		if ( ! $last_payment instanceof EE_Payment || $last_payment->status() != EEM_Payment::status_id_approved) {
80
+			add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
81 81
 		}
82 82
 	}
83 83
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @access    public
90 90
 	 * @param WP_Query $WP_Query
91 91
 	 */
92
-	public function run( $WP_Query = null ) {
92
+	public function run($WP_Query = null) {
93 93
 	}
94 94
 }
95 95
 
Please login to merge, or discard this patch.
Mijireh/help_tabs/payment_methods_overview_mijireh.help_tab.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1
-<h3><?php _e( 'Mijireh', 'event_espresso' ); ?></h3>
1
+<h3><?php _e('Mijireh', 'event_espresso'); ?></h3>
2 2
 <p>
3
-	<?php _e( 'Adjust the settings for the Mijireh payment gateway.', 'event_espresso' ); ?>
3
+	<?php _e('Adjust the settings for the Mijireh payment gateway.', 'event_espresso'); ?>
4 4
 </p>
5 5
 <p>
6 6
 	<?php
7 7
 	printf(
8
-		__( 'Mijireh is basically a middle-man between Event Espresso and over 90 payment gateways. Most of the configuration occurs on %1$sMijireh\' website%2$s, where you configure your Mijireh store with the %3$spayment gateway of your choice%4$s.', 'event_espresso' ),
8
+		__('Mijireh is basically a middle-man between Event Espresso and over 90 payment gateways. Most of the configuration occurs on %1$sMijireh\' website%2$s, where you configure your Mijireh store with the %3$spayment gateway of your choice%4$s.', 'event_espresso'),
9 9
 		'<a href="http://www.mijireh.com/" target="_blank">',
10 10
 		'</a>',
11 11
 		'<a href="http://www.mijireh.com/docs/payment-gateways/" target="_blank">',
@@ -14,26 +14,26 @@  discard block
 block discarded – undo
14 14
 	?>
15 15
 </p>
16 16
 <p>
17
-	<?php _e( 'For information on what currencies you can use with Mijireh, please consult the payment gateway Mijireh is setup to use.', 'event_espresso' ) ?>
17
+	<?php _e('For information on what currencies you can use with Mijireh, please consult the payment gateway Mijireh is setup to use.', 'event_espresso') ?>
18 18
 </p>
19 19
 <ul>
20 20
 	<li>
21
-		<strong><?php _e( 'Mijireh Access Key', 'event_espresso' ); ?></strong><br/>
21
+		<strong><?php _e('Mijireh Access Key', 'event_espresso'); ?></strong><br/>
22 22
 		<?php
23 23
 		printf(
24
-			__( 'Enter your Access Key for Mijireh. Your Access Key can be found in your %1$sMijireh account dashboard%2$s.', 'event_espresso' ),
24
+			__('Enter your Access Key for Mijireh. Your Access Key can be found in your %1$sMijireh account dashboard%2$s.', 'event_espresso'),
25 25
 			'<a href="https://secure.mijireh.com/login" target="_blank">',
26 26
 			'</a>'
27 27
 		);
28 28
 		?>
29 29
 	</li>
30 30
 	<li>
31
-		<strong><?php _e( 'Button Image URL', 'event_espresso' ); ?></strong><br/>
32
-		<?php _e( 'Change the image that is used for this payment gateway.', 'event_espresso' ); ?>
31
+		<strong><?php _e('Button Image URL', 'event_espresso'); ?></strong><br/>
32
+		<?php _e('Change the image that is used for this payment gateway.', 'event_espresso'); ?>
33 33
 	</li>
34 34
 </ul>
35
-<h3><?php _e( 'Mijireh Checkout Page Design', 'event_espresso' ); ?></h3>
35
+<h3><?php _e('Mijireh Checkout Page Design', 'event_espresso'); ?></h3>
36 36
 <p>
37
-	<?php _e( "As you are probably aware, when users pay with Mijireh Payment Method, they are taken to a secure offsite page, hosted by Mijireh. This page can easily be made to have the look-and-feel of your website through a process called 'slurping', where Mijireh 'slurps' up your website's design and uses it on their checkout page.", 'event_espresso' ); ?>
38
-	<?php printf( __( "In order to do this, we automatically create a new WordPress page which is designed to be slurped by Mijireh. You can customize the page like any other, but the page must contain Mijireh's special '{{mijireh-checkout-form}}' shortcode. Once you have finished designing the page, publish it, and %s then click the special 'slurp now' button%s. Mijireh may take several minutes to slurp the page. Once Mijireh is finished slurping, you can delete the page, or mark it as a draft.", 'event_espresso' ), '<a href="http://ee-screenshots.s3.amazonaws.com/ee4/event-espresso-mijireh-slurp-page-example.jpg" target="_blank">', '</a>' ); ?>
37
+	<?php _e("As you are probably aware, when users pay with Mijireh Payment Method, they are taken to a secure offsite page, hosted by Mijireh. This page can easily be made to have the look-and-feel of your website through a process called 'slurping', where Mijireh 'slurps' up your website's design and uses it on their checkout page.", 'event_espresso'); ?>
38
+	<?php printf(__("In order to do this, we automatically create a new WordPress page which is designed to be slurped by Mijireh. You can customize the page like any other, but the page must contain Mijireh's special '{{mijireh-checkout-form}}' shortcode. Once you have finished designing the page, publish it, and %s then click the special 'slurp now' button%s. Mijireh may take several minutes to slurp the page. Once Mijireh is finished slurping, you can delete the page, or mark it as a draft.", 'event_espresso'), '<a href="http://ee-screenshots.s3.amazonaws.com/ee4/event-espresso-mijireh-slurp-page-example.jpg" target="_blank">', '</a>'); ?>
39 39
 </p>
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
payment_methods/Mijireh/templates/mijireh_settings_after_form.template.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php if (!defined('EVENT_ESPRESSO_VERSION'))
2 2
 	exit('No direct script access allowed');
3 3
 /**
4
- * mijireh_settings_after_form
5
- *
6
- * @package			Event Espresso
7
- * @subpackage
8
- * @author				Mike Nelson
9
- */
4
+	 * mijireh_settings_after_form
5
+	 *
6
+	 * @package			Event Espresso
7
+	 * @subpackage
8
+	 * @author				Mike Nelson
9
+	 */
10 10
 do_action('AHEE__EE_Mijireh__settings_end');
11 11
 ?><br/><?php
12 12
 // End of file mijireh_settings_after_form.template.php
13 13
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION'))
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION'))
2 2
 	exit('No direct script access allowed');
3 3
 /**
4 4
  * mijireh_settings_after_form
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,6 @@
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION'))
1
+<?php if (!defined('EVENT_ESPRESSO_VERSION')) {
2 2
 	exit('No direct script access allowed');
3
+}
3 4
 /**
4 5
  * mijireh_settings_after_form
5 6
  *
Please login to merge, or discard this patch.
core/EE_Addon.core.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  *
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 *    class constructor
96 96
 	 */
97 97
 	public function __construct() {
98
-		add_action( 'AHEE__EE_System__load_controllers__load_admin_controllers', array( $this, 'admin_init' ) );
98
+		add_action('AHEE__EE_System__load_controllers__load_admin_controllers', array($this, 'admin_init'));
99 99
 	}
100 100
 
101 101
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	/**
104 104
 	 * @param mixed $version
105 105
 	 */
106
-	public function set_version( $version = NULL ) {
106
+	public function set_version($version = NULL) {
107 107
 		$this->_version = $version;
108 108
 	}
109 109
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	/**
122 122
 	 * @param mixed $min_core_version
123 123
 	 */
124
-	public function set_min_core_version( $min_core_version = NULL ) {
124
+	public function set_min_core_version($min_core_version = NULL) {
125 125
 		$this->_min_core_version = $min_core_version;
126 126
 	}
127 127
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @param string $addon_name
143 143
 	 * @return boolean
144 144
 	 */
145
-	function set_name( $addon_name ) {
145
+	function set_name($addon_name) {
146 146
 		return $this->_addon_name = $addon_name;
147 147
 	}
148 148
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	/**
171 171
 	 * @param string $plugin_basename
172 172
 	 */
173
-	public function set_plugin_basename( $plugin_basename ) {
173
+	public function set_plugin_basename($plugin_basename) {
174 174
 
175 175
 		$this->_plugin_basename = $plugin_basename;
176 176
 	}
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	/**
191 191
 	 * @param string $plugin_slug
192 192
 	 */
193
-	public function set_plugin_slug( $plugin_slug ) {
193
+	public function set_plugin_slug($plugin_slug) {
194 194
 
195 195
 		$this->_plugin_slug = $plugin_slug;
196 196
 	}
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	/**
211 211
 	 * @param string $plugin_action_slug
212 212
 	 */
213
-	public function set_plugin_action_slug( $plugin_action_slug ) {
213
+	public function set_plugin_action_slug($plugin_action_slug) {
214 214
 
215 215
 		$this->_plugin_action_slug = $plugin_action_slug;
216 216
 	}
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
 	/**
231 231
 	 * @param array $plugins_page_row
232 232
 	 */
233
-	public function set_plugins_page_row( $plugins_page_row = array() ) {
233
+	public function set_plugins_page_row($plugins_page_row = array()) {
234 234
 		// sigh.... check for example content that I stupidly merged to master and remove it if found
235
-		if ( ! is_array( $plugins_page_row ) && strpos( $plugins_page_row, '<h3>Promotions Addon Upsell Info</h3>' ) !== false ) {
235
+		if ( ! is_array($plugins_page_row) && strpos($plugins_page_row, '<h3>Promotions Addon Upsell Info</h3>') !== false) {
236 236
 			$plugins_page_row = '';
237 237
 		}
238 238
 		$this->_plugins_page_row = $plugins_page_row;
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 		do_action("AHEE__{$classname}__new_install");
252 252
 		do_action("AHEE__EE_Addon__new_install", $this);
253 253
 		EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
254
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ) );
254
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
255 255
 	}
256 256
 
257 257
 
@@ -266,16 +266,16 @@  discard block
 block discarded – undo
266 266
 		do_action("AHEE__{$classname}__reactivation");
267 267
 		do_action("AHEE__EE_Addon__reactivation", $this);
268 268
 		EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
269
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ) );
269
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
270 270
 	}
271 271
 
272
-	public function deactivation(){
272
+	public function deactivation() {
273 273
 		$classname = get_class($this);
274 274
 //		echo "Deactivating $classname";die;
275 275
 		do_action("AHEE__{$classname}__deactivation");
276 276
 		do_action("AHEE__EE_Addon__deactivation", $this);
277 277
 		//check if the site no longer needs to be in maintenance mode
278
-		EE_Register_Addon::deregister( $this->name() );
278
+		EE_Register_Addon::deregister($this->name());
279 279
 		EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
280 280
 	}
281 281
 
@@ -289,16 +289,16 @@  discard block
 block discarded – undo
289 289
 	 * This is a resource-intensive job so we prefer to only do it when necessary
290 290
 	 * @return void
291 291
 	 */
292
-	public function initialize_db_if_no_migrations_required( $verify_schema = true ) {
293
-		if( $verify_schema === '' ) {
292
+	public function initialize_db_if_no_migrations_required($verify_schema = true) {
293
+		if ($verify_schema === '') {
294 294
 			//wp core bug imo: if no args are passed to `do_action('some_hook_name')` besides the hook's name
295 295
 			//(ie, no 2nd or 3rd arguments), instead of calling the registered callbacks with no arguments, it
296 296
 			//calls them with an argument of an empty string (ie ""), which evaluates to false
297 297
 			//so we need to treat the empty string as if nothing had been passed, and should instead use the default
298 298
 			$verify_schema = true;
299 299
 		}
300
-		if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) {
301
-			if( $verify_schema ) {
300
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
301
+			if ($verify_schema) {
302 302
 				$this->initialize_db();
303 303
 			}
304 304
 			$this->initialize_default_data();
@@ -312,15 +312,15 @@  discard block
 block discarded – undo
312 312
 			 */
313 313
 			EE_Registry::instance()->load_helper('Activation');
314 314
 			EEH_Activation::initialize_db_content();
315
-			update_option( 'ee_flush_rewrite_rules', TRUE );
315
+			update_option('ee_flush_rewrite_rules', TRUE);
316 316
 			//in case there are lots of addons being activated at once, let's force garbage collection
317 317
 			//to help avoid memory limit errors
318 318
 			//EEH_Debug_Tools::instance()->measure_memory( 'db content initialized for ' . get_class( $this), true );
319 319
 			gc_collect_cycles();
320
-		}else{
320
+		} else {
321 321
 			//ask the data migration manager to init this addon's data
322 322
 			//when migrations are finished because we can't do it now
323
-			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( $this->name() );
323
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for($this->name());
324 324
 		}
325 325
 	}
326 326
 
@@ -334,20 +334,20 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	public function initialize_db() {
336 336
 		//find the migration script that sets the database to be compatible with the code
337
-		$current_dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms( $this->name() );
338
-		if( $current_dms_name ){
339
-			$current_data_migration_script = EE_Registry::instance()->load_dms( $current_dms_name );
340
-			$current_data_migration_script->set_migrating( FALSE );
337
+		$current_dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms($this->name());
338
+		if ($current_dms_name) {
339
+			$current_data_migration_script = EE_Registry::instance()->load_dms($current_dms_name);
340
+			$current_data_migration_script->set_migrating(FALSE);
341 341
 			$current_data_migration_script->schema_changes_before_migration();
342 342
 			$current_data_migration_script->schema_changes_after_migration();
343
-			if ( $current_data_migration_script->get_errors() ) {
344
-				foreach( $current_data_migration_script->get_errors() as $error ) {
345
-					EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
343
+			if ($current_data_migration_script->get_errors()) {
344
+				foreach ($current_data_migration_script->get_errors() as $error) {
345
+					EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
346 346
 				}
347 347
 			}
348 348
 		}
349 349
 		//if not DMS was found that should be ok. This addon just doesn't require any database changes
350
-		EE_Data_Migration_Manager::instance()->update_current_database_state_to( array( 'slug' => $this->name(), 'version' => $this->version() ) );
350
+		EE_Data_Migration_Manager::instance()->update_current_database_state_to(array('slug' => $this->name(), 'version' => $this->version()));
351 351
 	}
352 352
 
353 353
 
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 		 * default data)
370 370
 		 * @param EE_Addon $addon the addon that called this
371 371
 		 */
372
-		do_action( 'AHEE__EE_Addon__initialize_default_data__begin', $this );
372
+		do_action('AHEE__EE_Addon__initialize_default_data__begin', $this);
373 373
 		//override to insert default data. It is safe to use the models here
374 374
 		//because the site should not be in maintenance mode
375 375
 	}
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 		do_action("AHEE__EE_Addon__upgrade", $this);
389 389
 		EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
390 390
 		//also it's possible there is new default data that needs to be added
391
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ) );
391
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
392 392
 	}
393 393
 
394 394
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 		do_action("AHEE__{$classname}__downgrade");
402 402
 		do_action("AHEE__EE_Addon__downgrade", $this);
403 403
 		//it's possible there's old default data that needs to be double-checked
404
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ) );
404
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
405 405
 	}
406 406
 
407 407
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 * plugin activation only. In the future, we'll want to do it on plugin updates too
413 413
 	 * @return bool
414 414
 	 */
415
-	public function set_db_update_option_name(){
415
+	public function set_db_update_option_name() {
416 416
 		EE_Error::doing_it_wrong(__FUNCTION__, __('EE_Addon::set_db_update_option_name was renamed to EE_Addon::set_activation_indicator_option', 'event_espresso'), '4.3.0.alpha.016');
417 417
 		//let's just handle this on the next request, ok? right now we're just not really ready
418 418
 		return $this->set_activation_indicator_option();
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 */
441 441
 	public function set_activation_indicator_option() {
442 442
 		// let's just handle this on the next request, ok? right now we're just not really ready
443
-		return update_option( $this->get_activation_indicator_option_name(), TRUE );
443
+		return update_option($this->get_activation_indicator_option_name(), TRUE);
444 444
 	}
445 445
 
446 446
 
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
 	 * Gets the name of the wp option which is used to temporarily indicate that this addon was activated
449 449
 	 * @return string
450 450
 	 */
451
-	public function get_activation_indicator_option_name(){
452
-		return 'ee_activation_' . $this->name();
451
+	public function get_activation_indicator_option_name() {
452
+		return 'ee_activation_'.$this->name();
453 453
 	}
454 454
 
455 455
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 	 * Used by EE_System to set the request type of this addon. Should not be used by addon developers
460 460
 	 * @param int $req_type
461 461
 	 */
462
-	function set_req_type( $req_type ) {
462
+	function set_req_type($req_type) {
463 463
 		$this->_req_type = $req_type;
464 464
 	}
465 465
 
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 	 * of addons
471 471
 	 */
472 472
 	function detect_req_type() {
473
-		if( ! $this->_req_type ){
473
+		if ( ! $this->_req_type) {
474 474
 			$this->detect_activation_or_upgrade();
475 475
 		}
476 476
 		return $this->_req_type;
@@ -483,36 +483,36 @@  discard block
 block discarded – undo
483 483
 	 * Should only be called once per request
484 484
 	 * @return void
485 485
 	 */
486
-	function detect_activation_or_upgrade(){
486
+	function detect_activation_or_upgrade() {
487 487
 		$activation_history_for_addon = $this->get_activation_history();
488 488
 //		d($activation_history_for_addon);
489 489
 		$request_type = EE_System::detect_req_type_given_activation_history($activation_history_for_addon, $this->get_activation_indicator_option_name(), $this->version());
490 490
 		$this->set_req_type($request_type);
491 491
 		$classname = get_class($this);
492
-		switch($request_type){
492
+		switch ($request_type) {
493 493
 			case EE_System::req_type_new_activation:
494
-				do_action( "AHEE__{$classname}__detect_activations_or_upgrades__new_activation" );
495
-				do_action( "AHEE__EE_Addon__detect_activations_or_upgrades__new_activation", $this );
494
+				do_action("AHEE__{$classname}__detect_activations_or_upgrades__new_activation");
495
+				do_action("AHEE__EE_Addon__detect_activations_or_upgrades__new_activation", $this);
496 496
 				$this->new_install();
497
-				$this->update_list_of_installed_versions( $activation_history_for_addon );
497
+				$this->update_list_of_installed_versions($activation_history_for_addon);
498 498
 				break;
499 499
 			case EE_System::req_type_reactivation:
500
-				do_action( "AHEE__{$classname}__detect_activations_or_upgrades__reactivation" );
501
-				do_action( "AHEE__EE_Addon__detect_activations_or_upgrades__reactivation", $this );
500
+				do_action("AHEE__{$classname}__detect_activations_or_upgrades__reactivation");
501
+				do_action("AHEE__EE_Addon__detect_activations_or_upgrades__reactivation", $this);
502 502
 				$this->reactivation();
503
-				$this->update_list_of_installed_versions( $activation_history_for_addon );
503
+				$this->update_list_of_installed_versions($activation_history_for_addon);
504 504
 				break;
505 505
 			case EE_System::req_type_upgrade:
506
-				do_action( "AHEE__{$classname}__detect_activations_or_upgrades__upgrade" );
507
-				do_action( "AHEE__EE_Addon__detect_activations_or_upgrades__upgrade", $this );
506
+				do_action("AHEE__{$classname}__detect_activations_or_upgrades__upgrade");
507
+				do_action("AHEE__EE_Addon__detect_activations_or_upgrades__upgrade", $this);
508 508
 				$this->upgrade();
509
-				$this->update_list_of_installed_versions($activation_history_for_addon );
509
+				$this->update_list_of_installed_versions($activation_history_for_addon);
510 510
 				break;
511 511
 			case EE_System::req_type_downgrade:
512
-				do_action( "AHEE__{$classname}__detect_activations_or_upgrades__downgrade" );
513
-				do_action( "AHEE__EE_Addon__detect_activations_or_upgrades__downgrade", $this );
512
+				do_action("AHEE__{$classname}__detect_activations_or_upgrades__downgrade");
513
+				do_action("AHEE__EE_Addon__detect_activations_or_upgrades__downgrade", $this);
514 514
 				$this->downgrade();
515
-				$this->update_list_of_installed_versions($activation_history_for_addon );
515
+				$this->update_list_of_installed_versions($activation_history_for_addon);
516 516
 				break;
517 517
 			case EE_System::req_type_normal:
518 518
 			default:
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 				break;
521 521
 		}
522 522
 
523
-		do_action( "AHEE__{$classname}__detect_if_activation_or_upgrade__complete" );
523
+		do_action("AHEE__{$classname}__detect_if_activation_or_upgrade__complete");
524 524
 	}
525 525
 
526 526
 	/**
@@ -529,17 +529,17 @@  discard block
 block discarded – undo
529 529
 	 * @param string $current_version_to_add
530 530
 	 * @return boolean success
531 531
 	 */
532
-	public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) {
533
-		if( ! $version_history ) {
532
+	public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) {
533
+		if ( ! $version_history) {
534 534
 			$version_history = $this->get_activation_history();
535 535
 		}
536
-		if( $current_version_to_add == NULL){
536
+		if ($current_version_to_add == NULL) {
537 537
 			$current_version_to_add = $this->version();
538 538
 		}
539
-		$version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() );
539
+		$version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
540 540
 		// resave
541 541
 //		echo "updating list of installed versions:".$this->get_activation_history_option_name();d($version_history);
542
-		return update_option( $this->get_activation_history_option_name(), $version_history );
542
+		return update_option($this->get_activation_history_option_name(), $version_history);
543 543
 	}
544 544
 
545 545
 	/**
@@ -547,8 +547,8 @@  discard block
 block discarded – undo
547 547
 	 * of this addon
548 548
 	 * @return string
549 549
 	 */
550
-	function get_activation_history_option_name(){
551
-		return self::ee_addon_version_history_option_prefix . $this->name();
550
+	function get_activation_history_option_name() {
551
+		return self::ee_addon_version_history_option_prefix.$this->name();
552 552
 	}
553 553
 
554 554
 
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 	 * Gets the wp option which stores the activation history for this addon
558 558
 	 * @return array
559 559
 	 */
560
-	function get_activation_history(){
560
+	function get_activation_history() {
561 561
 		return get_option($this->get_activation_history_option_name(), NULL);
562 562
 	}
563 563
 
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
 	/**
567 567
 	 * @param string $config_section
568 568
 	 */
569
-	public function set_config_section( $config_section = '' ) {
570
-		$this->_config_section = ! empty( $config_section ) ? $config_section : 'addons';
569
+	public function set_config_section($config_section = '') {
570
+		$this->_config_section = ! empty($config_section) ? $config_section : 'addons';
571 571
 	}
572 572
 	/**
573 573
 	 *	filepath to the main file, which can be used for register_activation_hook, register_deactivation_hook, etc.
@@ -580,14 +580,14 @@  discard block
 block discarded – undo
580 580
 	 * Sets the filepath to the main plugin file
581 581
 	 * @param string $filepath
582 582
 	 */
583
-	public function set_main_plugin_file( $filepath ) {
583
+	public function set_main_plugin_file($filepath) {
584 584
 		$this->_main_plugin_file = $filepath;
585 585
 	}
586 586
 	/**
587 587
 	 * gets the filepath to teh main file
588 588
 	 * @return string
589 589
 	 */
590
-	public function get_main_plugin_file(){
590
+	public function get_main_plugin_file() {
591 591
 		return $this->_main_plugin_file;
592 592
 	}
593 593
 
@@ -597,15 +597,15 @@  discard block
 block discarded – undo
597 597
 	 * @return string
598 598
 	 */
599 599
 	public function get_main_plugin_file_basename() {
600
-		return plugin_basename( $this->get_main_plugin_file() );
600
+		return plugin_basename($this->get_main_plugin_file());
601 601
 	}
602 602
 
603 603
 	/**
604 604
 	 * Gets the folder name which contains the main plugin file
605 605
 	 * @return string
606 606
 	 */
607
-	public function get_main_plugin_file_dirname(){
608
-		return dirname( $this->get_main_plugin_file() );
607
+	public function get_main_plugin_file_dirname() {
608
+		return dirname($this->get_main_plugin_file());
609 609
 	}
610 610
 
611 611
 
@@ -614,11 +614,11 @@  discard block
 block discarded – undo
614 614
 	 *
615 615
 *@return string
616 616
 	 */
617
-	public function admin_init(){
617
+	public function admin_init() {
618 618
 		// is admin and not in M-Mode ?
619
-		if ( is_admin() && ! EE_Maintenance_Mode::instance()->level() ) {
620
-			add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2 );
621
-			add_filter( 'after_plugin_row_' . $this->_plugin_basename, array( $this, 'after_plugin_row' ), 10, 3 );
619
+		if (is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
620
+			add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
621
+			add_filter('after_plugin_row_'.$this->_plugin_basename, array($this, 'after_plugin_row'), 10, 3);
622 622
 		}
623 623
 	}
624 624
 
@@ -633,10 +633,10 @@  discard block
 block discarded – undo
633 633
 	 * @param $file
634 634
 	 * @return array
635 635
 	 */
636
-	public function plugin_action_links( $links, $file ) {
637
-		if ( $file == $this->plugin_basename() && $this->plugin_action_slug() != '' ) {
636
+	public function plugin_action_links($links, $file) {
637
+		if ($file == $this->plugin_basename() && $this->plugin_action_slug() != '') {
638 638
 			// before other links
639
-			array_unshift( $links, '<a href="admin.php?page=' . $this->plugin_action_slug() . '">' . __( 'Settings' ) . '</a>' );
639
+			array_unshift($links, '<a href="admin.php?page='.$this->plugin_action_slug().'">'.__('Settings').'</a>');
640 640
 		}
641 641
 		return $links;
642 642
 	}
@@ -654,17 +654,17 @@  discard block
 block discarded – undo
654 654
 	 * @param $status
655 655
 	 * @return string
656 656
 	 */
657
-	public function after_plugin_row( $plugin_file, $plugin_data, $status ) {
657
+	public function after_plugin_row($plugin_file, $plugin_data, $status) {
658 658
 
659 659
 		$after_plugin_row = '';
660
-		if ( $plugin_file == $this->plugin_basename() && $this->get_plugins_page_row() != '' ) {
660
+		if ($plugin_file == $this->plugin_basename() && $this->get_plugins_page_row() != '') {
661 661
 			$class = $status ? 'active' : 'inactive';
662 662
 			$plugins_page_row = $this->get_plugins_page_row();
663
-			$link_text = isset( $plugins_page_row[ 'link_text' ] ) ? $plugins_page_row[ 'link_text' ] : '';
664
-			$link_url = isset( $plugins_page_row[ 'link_url' ] ) ? $plugins_page_row[ 'link_url' ] : '';
665
-			$description = isset( $plugins_page_row[ 'description' ] ) ? $plugins_page_row[ 'description' ] : $plugins_page_row;
666
-			if ( ! empty( $link_text ) && ! empty( $link_url ) && ! empty( $description )) {
667
-				$after_plugin_row .= '<tr id="' . sanitize_title( $plugin_file ) . '-ee-addon" class="' . $class . '">';
663
+			$link_text = isset($plugins_page_row['link_text']) ? $plugins_page_row['link_text'] : '';
664
+			$link_url = isset($plugins_page_row['link_url']) ? $plugins_page_row['link_url'] : '';
665
+			$description = isset($plugins_page_row['description']) ? $plugins_page_row['description'] : $plugins_page_row;
666
+			if ( ! empty($link_text) && ! empty($link_url) && ! empty($description)) {
667
+				$after_plugin_row .= '<tr id="'.sanitize_title($plugin_file).'-ee-addon" class="'.$class.'">';
668 668
 				$after_plugin_row .= '<th class="check-column" scope="row"></th>';
669 669
 				$after_plugin_row .= '<td class="ee-addon-upsell-info-title-td plugin-title column-primary">';
670 670
 				$after_plugin_row .= '<style>
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 </style>';
707 707
 				$after_plugin_row .= '
708 708
 <p class="ee-addon-upsell-info-dv">
709
-	<a class="ee-button" href="' . $link_url . '">' . $link_text . ' &nbsp;<span class="dashicons dashicons-arrow-right-alt2" style="margin:0;"></span></a>
709
+	<a class="ee-button" href="' . $link_url.'">'.$link_text.' &nbsp;<span class="dashicons dashicons-arrow-right-alt2" style="margin:0;"></span></a>
710 710
 </p>';
711 711
 				$after_plugin_row .= '</td>';
712 712
 				$after_plugin_row .= '<td class="ee-addon-upsell-info-desc-td column-description desc">';
Please login to merge, or discard this patch.
core/EE_PUE.core.php 1 patch
Spacing   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	public function __construct() {
50 50
 //		throw new EE_Error('error');
51 51
 
52
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
52
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
53 53
 
54 54
 		//wp have no MONTH_IN_SECONDS constant.  So we approximate our own assuming all months are 4 weeks long.
55
-		if ( !defined('MONTH_IN_SECONDS' ) )
56
-			define( 'MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4 );
55
+		if ( ! defined('MONTH_IN_SECONDS'))
56
+			define('MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4);
57 57
 
58
-		if(EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance){
58
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
59 59
 			$this->_uxip_hooks();
60 60
 		}
61 61
 
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 		$ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified;
65 65
 
66 66
 		//has optin been selected for data collection?
67
-		$espresso_data_optin = !empty($ueip_optin) ? $ueip_optin : NULL;
67
+		$espresso_data_optin = ! empty($ueip_optin) ? $ueip_optin : NULL;
68 68
 
69
-		if ( empty($ueip_has_notified) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_mode::level_2_complete_maintenance ) {
70
-			add_action('admin_notices', array( $this, 'espresso_data_collection_optin_notice' ), 10 );
71
-			add_action('admin_enqueue_scripts', array( $this, 'espresso_data_collection_enqueue_scripts' ), 10 );
72
-			add_action('wp_ajax_espresso_data_optin', array( $this, 'espresso_data_optin_ajax_handler' ), 10 );
69
+		if (empty($ueip_has_notified) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_mode::level_2_complete_maintenance) {
70
+			add_action('admin_notices', array($this, 'espresso_data_collection_optin_notice'), 10);
71
+			add_action('admin_enqueue_scripts', array($this, 'espresso_data_collection_enqueue_scripts'), 10);
72
+			add_action('wp_ajax_espresso_data_optin', array($this, 'espresso_data_optin_ajax_handler'), 10);
73 73
 			update_option('ee_ueip_optin', 'yes');
74 74
 			$espresso_data_optin = 'yes';
75 75
 		}
@@ -78,80 +78,80 @@  discard block
 block discarded – undo
78 78
 		$extra_stats = array();
79 79
 
80 80
 		//only collect extra stats if the plugin user has opted in.
81
-		if ( !empty($espresso_data_optin) && $espresso_data_optin == 'yes' ) {
81
+		if ( ! empty($espresso_data_optin) && $espresso_data_optin == 'yes') {
82 82
 			//let's only setup extra data if transient has expired
83
-			if ( false === ( $transient = get_transient('ee_extra_data') ) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) {
83
+			if (false === ($transient = get_transient('ee_extra_data')) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
84 84
 
85 85
 				$current_site = is_multisite() ? get_current_site() : NULL;
86
-				$site_pre = ! is_main_site() && ! empty($current_site) ? trim( preg_replace('/\b\w\S\w\b/', '', $current_site->domain ), '.' ) . '_' : '';
86
+				$site_pre = ! is_main_site() && ! empty($current_site) ? trim(preg_replace('/\b\w\S\w\b/', '', $current_site->domain), '.').'_' : '';
87 87
 
88 88
 
89 89
 				//active gateways
90 90
 				$active_gateways = get_option('event_espresso_active_gateways');
91
-				if ( !empty($active_gateways ) ) {
92
-					foreach ( (array) $active_gateways as $gateway => $ignore ) {
93
-						$extra_stats[$site_pre . $gateway . '_gateway_active'] = 1;
91
+				if ( ! empty($active_gateways)) {
92
+					foreach ((array) $active_gateways as $gateway => $ignore) {
93
+						$extra_stats[$site_pre.$gateway.'_gateway_active'] = 1;
94 94
 					}
95 95
 				}
96 96
 
97
-				if ( is_multisite() && is_main_site() ) {
97
+				if (is_multisite() && is_main_site()) {
98 98
 					$extra_stats['is_multisite'] = true;
99 99
 				}
100 100
 
101 101
 				//what is the current active theme?
102 102
 				$active_theme = get_option('uxip_ee_active_theme');
103
-				if ( !empty( $active_theme ) )
104
-					$extra_stats[$site_pre . 'active_theme'] = $active_theme;
103
+				if ( ! empty($active_theme))
104
+					$extra_stats[$site_pre.'active_theme'] = $active_theme;
105 105
 
106 106
 				//event info regarding an all event count and all "active" event count
107 107
 				$all_events_count = get_option('uxip_ee4_all_events_count');
108
-				if ( !empty( $all_events_count ) )
109
-					$extra_stats[$site_pre . 'ee4_all_events_count'] = $all_events_count;
108
+				if ( ! empty($all_events_count))
109
+					$extra_stats[$site_pre.'ee4_all_events_count'] = $all_events_count;
110 110
 				$active_events_count = get_option('uxip_ee4_active_events_count');
111
-				if ( !empty( $active_events_count ) )
112
-					$extra_stats[$site_pre . 'ee4_active_events_count'] = $active_events_count;
111
+				if ( ! empty($active_events_count))
112
+					$extra_stats[$site_pre.'ee4_active_events_count'] = $active_events_count;
113 113
 
114 114
 				//datetime stuff
115 115
 				$dtt_count = get_option('uxip_ee_all_dtts_count');
116
-				if ( !empty( $dtt_count ) )
117
-					$extra_stats[$site_pre . 'all_dtts_count'] = $dtt_count;
116
+				if ( ! empty($dtt_count))
117
+					$extra_stats[$site_pre.'all_dtts_count'] = $dtt_count;
118 118
 
119 119
 				$dtt_sold = get_option('uxip_ee_dtt_sold');
120
-				if ( !empty( $dtt_sold ) )
121
-					$extra_stats[$site_pre . 'dtt_sold'] = $dtt_sold;
120
+				if ( ! empty($dtt_sold))
121
+					$extra_stats[$site_pre.'dtt_sold'] = $dtt_sold;
122 122
 
123 123
 				//ticket stuff
124 124
 				$all_tkt_count = get_option('uxip_ee_all_tkt_count');
125
-				if ( !empty( $all_tkt_count ) )
126
-					$extra_stats[$site_pre . 'all_tkt_count'] = $all_tkt_count;
125
+				if ( ! empty($all_tkt_count))
126
+					$extra_stats[$site_pre.'all_tkt_count'] = $all_tkt_count;
127 127
 
128 128
 				$free_tkt_count = get_option('uxip_ee_free_tkt_count');
129
-				if ( !empty( $free_tkt_count ) )
130
-					$extra_stats[$site_pre . 'free_tkt_count'] = $free_tkt_count;
129
+				if ( ! empty($free_tkt_count))
130
+					$extra_stats[$site_pre.'free_tkt_count'] = $free_tkt_count;
131 131
 
132 132
 				$paid_tkt_count = get_option('uxip_ee_paid_tkt_count');
133
-				if ( !empty( $paid_tkt_count ) )
134
-					$extra_stats[$site_pre . 'paid_tkt_count'] = $paid_tkt_count;
133
+				if ( ! empty($paid_tkt_count))
134
+					$extra_stats[$site_pre.'paid_tkt_count'] = $paid_tkt_count;
135 135
 
136
-				$tkt_sold = get_option('uxip_ee_tkt_sold' );
137
-				if ( !empty($tkt_sold) )
138
-					$extra_stats[$site_pre . 'tkt_sold'] = $tkt_sold;
136
+				$tkt_sold = get_option('uxip_ee_tkt_sold');
137
+				if ( ! empty($tkt_sold))
138
+					$extra_stats[$site_pre.'tkt_sold'] = $tkt_sold;
139 139
 
140 140
 				//phpversion checking
141 141
 				$extra_stats['phpversion'] = function_exists('phpversion') ? phpversion() : 'unknown';
142 142
 
143 143
 				//set transient
144
-				set_transient( 'ee_extra_data', $extra_stats, WEEK_IN_SECONDS );
144
+				set_transient('ee_extra_data', $extra_stats, WEEK_IN_SECONDS);
145 145
 			}
146 146
 		}
147 147
 
148 148
 
149 149
 
150 150
 		// PUE Auto Upgrades stuff
151
-		if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { //include the file
152
-			require_once(EE_THIRD_PARTY . 'pue/pue-client.php' );
151
+		if (is_readable(EE_THIRD_PARTY.'pue/pue-client.php')) { //include the file
152
+			require_once(EE_THIRD_PARTY.'pue/pue-client.php');
153 153
 
154
-			$api_key = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->site_license_key : '';
154
+			$api_key = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->site_license_key : '';
155 155
 			$host_server_url = 'http://eventespresso.com'; //this needs to be the host server where plugin update engine is installed. Note, if you leave this blank then it is assumed the WordPress repo will be used and we'll just check there.
156 156
 
157 157
 			//Note: PUE uses a simple preg_match to determine what type is currently installed based on version number.  So it's important that you use a key for the version type that is unique and not found in another key.
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 			//$plugin_slug['prerelease']['b'] = 'some-pre-release-slug';
164 164
 			//..WOULD work!
165 165
 			$plugin_slug = array(
166
-				'free' => array( 'decaf' => 'event-espresso-core-decaf' ),
167
-				'premium' => array( 'p' => 'event-espresso-core-reg' ),
168
-				'prerelease' => array( 'beta' => 'event-espresso-core-pr' )
166
+				'free' => array('decaf' => 'event-espresso-core-decaf'),
167
+				'premium' => array('p' => 'event-espresso-core-reg'),
168
+				'prerelease' => array('beta' => 'event-espresso-core-pr')
169 169
 				);
170 170
 
171 171
 
@@ -192,14 +192,14 @@  discard block
 block discarded – undo
192 192
 	 * The purpose of this function is to display information about Event Espresso data collection and a optin selection for extra data collecting by users.
193 193
 	 * @return string html.
194 194
 	 */
195
-	 public static function espresso_data_collection_optin_text( $extra = TRUE ) {
196
-	 	if ( ! $extra ) {
197
-			 echo '<h2 class="ee-admin-settings-hdr" '. (!$extra ? 'id="UXIP_settings"' : '').'>'.__('User eXperience Improvement Program (UXIP)', 'event_espresso').EEH_Template::get_help_tab_link('organization_logo_info').'</h2>';
198
-			 echo sprintf( __('%sPlease help us make Event Espresso better and vote for your favorite features.%s The %sUser eXperience Improvement Program (UXIP)%s, has been created so when you use Event Espresso you are voting for the features and settings that are important to you. The UXIP helps us understand how you use our products and services, track problems and in what context. If you opt-out of the UXIP you essentially elect for us to disregard how you use Event Espresso as we build new features and make changes. Participation in the program is completely voluntary but it is enabled by default. The end results of the UXIP are software improvements to better meet your needs. The data we collect will never be sold, traded, or misused in any way. %sPlease see our %sPrivacy Policy%s for more information.', 'event_espresso'), '<p><em>', '</em></p>','<a href="http://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">','</a>','<br><br>','<a href="http://eventespresso.com/about/privacy-policy/" target="_blank">','</a>' );
195
+	 public static function espresso_data_collection_optin_text($extra = TRUE) {
196
+	 	if ( ! $extra) {
197
+			 echo '<h2 class="ee-admin-settings-hdr" '.( ! $extra ? 'id="UXIP_settings"' : '').'>'.__('User eXperience Improvement Program (UXIP)', 'event_espresso').EEH_Template::get_help_tab_link('organization_logo_info').'</h2>';
198
+			 echo sprintf(__('%sPlease help us make Event Espresso better and vote for your favorite features.%s The %sUser eXperience Improvement Program (UXIP)%s, has been created so when you use Event Espresso you are voting for the features and settings that are important to you. The UXIP helps us understand how you use our products and services, track problems and in what context. If you opt-out of the UXIP you essentially elect for us to disregard how you use Event Espresso as we build new features and make changes. Participation in the program is completely voluntary but it is enabled by default. The end results of the UXIP are software improvements to better meet your needs. The data we collect will never be sold, traded, or misused in any way. %sPlease see our %sPrivacy Policy%s for more information.', 'event_espresso'), '<p><em>', '</em></p>', '<a href="http://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">', '</a>', '<br><br>', '<a href="http://eventespresso.com/about/privacy-policy/" target="_blank">', '</a>');
199 199
 		} else {
200
-			$settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') );
200
+			$settings_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default'), admin_url('admin.php?page=espresso_general_settings'));
201 201
 			$settings_url .= '#UXIP_settings';
202
-			echo sprintf( __( 'The Event Espresso UXIP feature is active on your site. For %smore info%s and to opt-out %sclick here%s.', 'event_espresso' ), '<a href="http://eventespresso.com/about/user-experience-improvement-program-uxip/" traget="_blank">', '</a>', '<a href="' . $settings_url . '" target="_blank">', '</a>' );
202
+			echo sprintf(__('The Event Espresso UXIP feature is active on your site. For %smore info%s and to opt-out %sclick here%s.', 'event_espresso'), '<a href="http://eventespresso.com/about/user-experience-improvement-program-uxip/" traget="_blank">', '</a>', '<a href="'.$settings_url.'" target="_blank">', '</a>');
203 203
 		}
204 204
 	}
205 205
 
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 
209 209
 	function espresso_data_collection_optin_notice() {
210 210
 		$ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified;
211
-		if ( $ueip_has_notified ) return;
212
-		$settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') );
213
-		$settings_url = $settings_url . '#UXIP_settings';
211
+		if ($ueip_has_notified) return;
212
+		$settings_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default'), admin_url('admin.php?page=espresso_general_settings'));
213
+		$settings_url = $settings_url.'#UXIP_settings';
214 214
 		?>
215 215
 		<div class="updated data-collect-optin" id="espresso-data-collect-optin-container">
216 216
 			<div id="data-collect-optin-options-container">
@@ -232,8 +232,8 @@  discard block
 block discarded – undo
232 232
 	 * @return void
233 233
 	 */
234 234
 	function espresso_data_collection_enqueue_scripts() {
235
-		wp_register_script( 'ee-data-optin-js', EE_GLOBAL_ASSETS_URL . 'scripts/ee-data-optin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
236
-		wp_register_style( 'ee-data-optin-css', EE_GLOBAL_ASSETS_URL . 'css/ee-data-optin.css', array(), EVENT_ESPRESSO_VERSION );
235
+		wp_register_script('ee-data-optin-js', EE_GLOBAL_ASSETS_URL.'scripts/ee-data-optin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
236
+		wp_register_style('ee-data-optin-css', EE_GLOBAL_ASSETS_URL.'css/ee-data-optin.css', array(), EVENT_ESPRESSO_VERSION);
237 237
 
238 238
 		wp_enqueue_script('ee-data-optin-js');
239 239
 		wp_enqueue_style('ee-data-optin-css');
@@ -248,14 +248,14 @@  discard block
 block discarded – undo
248 248
 	function espresso_data_optin_ajax_handler() {
249 249
 
250 250
 		//verify nonce
251
-		if ( isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], 'ee-data-optin') ) exit();
251
+		if (isset($_POST['nonce']) && ! wp_verify_nonce($_POST['nonce'], 'ee-data-optin')) exit();
252 252
 
253 253
 		//made it here so let's save the selection
254
-		$ueip_optin = isset( $_POST['selection'] ) ? $_POST['selection'] : 'no';
254
+		$ueip_optin = isset($_POST['selection']) ? $_POST['selection'] : 'no';
255 255
 
256 256
 		//update_option('ee_ueip_optin', $ueip_optin);
257 257
 		EE_Registry::instance()->CFG->core->ee_ueip_has_notified = 1;
258
-		EE_Registry::instance()->CFG->update_espresso_config( FALSE, FALSE );
258
+		EE_Registry::instance()->CFG->update_espresso_config(FALSE, FALSE);
259 259
 		exit();
260 260
 	}
261 261
 
@@ -268,22 +268,22 @@  discard block
 block discarded – undo
268 268
 	 */
269 269
 	public static function is_update_available($basename = '') {
270 270
 
271
-		$basename = ! empty( $basename ) ? $basename : EE_PLUGIN_BASENAME;
271
+		$basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME;
272 272
 
273 273
 		$update = false;
274 274
 
275
-		$folder = DS . dirname($basename); // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core"
275
+		$folder = DS.dirname($basename); // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core"
276 276
 
277 277
 		$plugins = get_plugins($folder);
278
-		$current = get_site_transient( 'update_plugins' );
278
+		$current = get_site_transient('update_plugins');
279 279
 
280
-		foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
281
-			if ( isset( $current->response['plugin_file'] ) )
280
+		foreach ((array) $plugins as $plugin_file => $plugin_data) {
281
+			if (isset($current->response['plugin_file']))
282 282
 				$update = true;
283 283
 		}
284 284
 
285 285
 		//it's possible that there is an update but an invalid site-license-key is in use
286
-		if ( get_site_option('pue_json_error_' . $basename ) )
286
+		if (get_site_option('pue_json_error_'.$basename))
287 287
 			$update = true;
288 288
 
289 289
 		return $update;
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
 	 * @return void
302 302
 	 */
303 303
 	public function _uxip_hooks() {
304
-		if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) {
305
-			add_action('admin_init', array( $this, 'track_active_theme' ) );
306
-			add_action('admin_init', array( $this, 'track_event_info' ) );
304
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
305
+			add_action('admin_init', array($this, 'track_active_theme'));
306
+			add_action('admin_init', array($this, 'track_event_info'));
307 307
 		}
308 308
 	}
309 309
 
@@ -312,65 +312,65 @@  discard block
 block discarded – undo
312 312
 
313 313
 	public function track_active_theme() {
314 314
 		//we only check this once a month.
315
-		if ( false === ( $transient = get_transient( 'ee_active_theme_check' ) ) ) {
315
+		if (false === ($transient = get_transient('ee_active_theme_check'))) {
316 316
 			$theme = wp_get_theme();
317
-			update_option('uxip_ee_active_theme', $theme->get('Name') );
318
-			set_transient('ee_active_theme_check', 1, MONTH_IN_SECONDS );
317
+			update_option('uxip_ee_active_theme', $theme->get('Name'));
318
+			set_transient('ee_active_theme_check', 1, MONTH_IN_SECONDS);
319 319
 		}
320 320
 	}
321 321
 
322 322
 
323 323
 	public function track_event_info() {
324 324
 		//we only check this once every couple weeks.
325
-		if ( false === ( $transient = get_transient( 'ee4_event_info_check') ) ) {
325
+		if (false === ($transient = get_transient('ee4_event_info_check'))) {
326 326
 			//first let's get the number for ALL events
327 327
 			$EVT = EE_Registry::instance()->load_model('Event');
328 328
 			$DTT = EE_Registry::instance()->load_model('Datetime');
329 329
 			$TKT = EE_Registry::instance()->load_model('Ticket');
330 330
 			$count = $EVT->count();
331
-			if ( $count > 0 )
331
+			if ($count > 0)
332 332
 				update_option('uxip_ee4_all_events_count', $count);
333 333
 
334 334
 			//next let's just get the number of ACTIVE events
335 335
 			$count_active = $EVT->get_active_events(array(), TRUE);
336
-			if ( $count_active > 0 )
336
+			if ($count_active > 0)
337 337
 				update_option('uxip_ee4_active_events_count', $count_active);
338 338
 
339 339
 			//datetimes!
340 340
 			$dtt_count = $DTT->count();
341
-			if ( $dtt_count > 0 )
342
-				update_option( 'uxip_ee_all_dtts_count', $dtt_count );
341
+			if ($dtt_count > 0)
342
+				update_option('uxip_ee_all_dtts_count', $dtt_count);
343 343
 
344 344
 
345 345
 			//dttsold
346 346
 			$dtt_sold = $DTT->sum(array(), 'DTT_sold');
347
-			if ( $dtt_sold > 0 )
348
-				update_option( 'uxip_ee_dtt_sold', $dtt_sold );
347
+			if ($dtt_sold > 0)
348
+				update_option('uxip_ee_dtt_sold', $dtt_sold);
349 349
 
350 350
 			//allticketcount
351 351
 			$all_tkt_count = $TKT->count();
352
-			if ( $all_tkt_count > 0 )
353
-				update_option( 'uxip_ee_all_tkt_count', $all_tkt_count );
352
+			if ($all_tkt_count > 0)
353
+				update_option('uxip_ee_all_tkt_count', $all_tkt_count);
354 354
 
355 355
 			//freetktcount
356
-			$_where = array( 'TKT_price' => 0 );
356
+			$_where = array('TKT_price' => 0);
357 357
 			$free_tkt_count = $TKT->count(array($_where));
358
-			if ( $free_tkt_count > 0 )
359
-				update_option( 'uxip_ee_free_tkt_count', $free_tkt_count );
358
+			if ($free_tkt_count > 0)
359
+				update_option('uxip_ee_free_tkt_count', $free_tkt_count);
360 360
 
361 361
 			//paidtktcount
362
-			$_where = array( 'TKT_price' => array('>', 0) );
363
-			$paid_tkt_count = $TKT->count( array( $_where ) );
364
-			if ( $paid_tkt_count > 0 )
365
-				update_option( 'uxip_ee_paid_tkt_count', $paid_tkt_count );
362
+			$_where = array('TKT_price' => array('>', 0));
363
+			$paid_tkt_count = $TKT->count(array($_where));
364
+			if ($paid_tkt_count > 0)
365
+				update_option('uxip_ee_paid_tkt_count', $paid_tkt_count);
366 366
 
367 367
 			//tktsold
368
-			$tkt_sold = $TKT->sum( array(), 'TKT_sold' );
369
-			if( $tkt_sold > 0 )
370
-				update_option( 'uxip_ee_tkt_sold', $tkt_sold );
368
+			$tkt_sold = $TKT->sum(array(), 'TKT_sold');
369
+			if ($tkt_sold > 0)
370
+				update_option('uxip_ee_tkt_sold', $tkt_sold);
371 371
 
372 372
 
373
-			set_transient( 'ee4_event_info_check', 1, WEEK_IN_SECONDS * 2 );
373
+			set_transient('ee4_event_info_check', 1, WEEK_IN_SECONDS * 2);
374 374
 		}
375 375
 	}
376 376
 
Please login to merge, or discard this patch.
core/admin/EE_Admin_List_Table.core.php 1 patch
Spacing   +92 added lines, -92 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
 
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
  * ------------------------------------------------------------------------
32 32
  */
33 33
 
34
-if ( ! class_exists( 'WP_List_Table' )) {
35
-    require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
34
+if ( ! class_exists('WP_List_Table')) {
35
+    require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php');
36 36
 }
37 37
 
38 38
 abstract class EE_Admin_List_Table extends WP_List_Table {
@@ -234,16 +234,16 @@  discard block
 block discarded – undo
234 234
 	 * constructor
235 235
 	 * @param EE_Admin_Page object $admin_page we use this for obtaining everything we need in the list table.
236 236
 	 */
237
-	public function __construct( EE_Admin_Page $admin_page ) {
237
+	public function __construct(EE_Admin_Page $admin_page) {
238 238
 		$this->_admin_page = $admin_page;
239 239
 		$this->_req_data = $this->_admin_page->get_request_data();
240 240
 		$this->_view = $this->_admin_page->get_view();
241
-		$this->_views = empty( $this->_views ) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views;
241
+		$this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views;
242 242
 		$this->_current_page = $this->get_pagenum();
243
-		$this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view();
244
-		$this->_yes_no = array(  __('No', 'event_espresso'), __('Yes', 'event_espresso'));
243
+		$this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view();
244
+		$this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso'));
245 245
 
246
-		$this->_per_page = $this->get_items_per_page( $this->_screen . '_per_page', 10 );
246
+		$this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 10);
247 247
 
248 248
 		$this->_setup_data();
249 249
 		$this->_add_view_counts();
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 		$this->_set_properties();
254 254
 
255 255
 		//set primary column
256
-		add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ) );
256
+		add_filter('list_table_primary_column', array($this, 'set_primary_column'));
257 257
 
258 258
 		//set parent defaults
259 259
 		parent::__construct($this->_wp_list_args);
@@ -329,17 +329,17 @@  discard block
 block discarded – undo
329 329
 	 * @return html string
330 330
 	 */
331 331
 	protected function _get_hidden_fields() {
332
-		$action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : '';
333
-		$action = empty( $action ) && isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : $action;
332
+		$action = isset($this->_req_data['route']) ? $this->_req_data['route'] : '';
333
+		$action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action;
334 334
 		//if action is STILL empty, then we set it to default
335
-		$action = empty( $action ) ? 'default' : $action;
336
-		$field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n";
337
-		$field .= '<input type="hidden" name="route" value="'. $action .'" />' . "\n";/**/
338
-		$field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n";
335
+		$action = empty($action) ? 'default' : $action;
336
+		$field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n";
337
+		$field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/
338
+		$field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n";
339 339
 
340 340
 		$bulk_actions = $this->_get_bulk_actions();
341
-		foreach ( $bulk_actions as $bulk_action => $label ) {
342
-			$field .= '<input type="hidden" name="' . $bulk_action . '_nonce" value="' . wp_create_nonce  ( $bulk_action . '_nonce' ) . '" />' . "\n";
341
+		foreach ($bulk_actions as $bulk_action => $label) {
342
+			$field .= '<input type="hidden" name="'.$bulk_action.'_nonce" value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n";
343 343
 		}
344 344
 
345 345
 		return $field;
@@ -369,15 +369,15 @@  discard block
 block discarded – undo
369 369
 		 *
370 370
 		 * @var array
371 371
 		 */
372
-		$_sortable = apply_filters( "FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen );
372
+		$_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen);
373 373
 
374 374
 		$sortable = array();
375
-		foreach ( $_sortable as $id => $data ) {
376
-			if ( empty( $data ) )
375
+		foreach ($_sortable as $id => $data) {
376
+			if (empty($data))
377 377
 				continue;
378 378
 
379 379
 			//fix for offset errors with WP_List_Table default get_columninfo()
380
-			if ( is_array($data) ) {
380
+			if (is_array($data)) {
381 381
 				$_data[0] = key($data);
382 382
 				$_data[1] = isset($data[1]) ? $data[1] : false;
383 383
 			} else {
@@ -386,14 +386,14 @@  discard block
 block discarded – undo
386 386
 
387 387
 			$data = (array) $data;
388 388
 
389
-			if ( !isset( $data[1] ) )
389
+			if ( ! isset($data[1]))
390 390
 				$_data[1] = false;
391 391
 
392 392
 
393 393
 			$sortable[$id] = $_data;
394 394
 		}
395 395
 		$primary = $this->get_primary_column_name();
396
-		$this->_column_headers = array( $columns, $hidden, $sortable, $primary );
396
+		$this->_column_headers = array($columns, $hidden, $sortable, $primary);
397 397
 	}
398 398
 
399 399
 
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
 	 * @return string
403 403
 	 */
404 404
 	protected function get_primary_column_name() {
405
-		foreach( class_parents( $this ) as $parent ) {
406
-			if ( method_exists( $parent, 'get_primary_column_name' ) && $parent == 'WP_List_Table' ) {
405
+		foreach (class_parents($this) as $parent) {
406
+			if (method_exists($parent, 'get_primary_column_name') && $parent == 'WP_List_Table') {
407 407
 				return parent::get_primary_column_name();
408 408
 			}
409 409
 		}
@@ -415,10 +415,10 @@  discard block
 block discarded – undo
415 415
 	 * Added for WP4.1 backward compat (@see https://events.codebasehq.com/projects/event-espresso/tickets/8814)
416 416
 	 * @return string
417 417
 	 */
418
-	protected function handle_row_actions( $item, $column_name, $primary ) {
419
-		foreach( class_parents( $this ) as $parent ) {
420
-			if ( method_exists( $parent, 'handle_row_actions' ) && $parent == 'WP_List_Table' ) {
421
-				return parent::handle_row_actions( $item, $column_name, $primary );
418
+	protected function handle_row_actions($item, $column_name, $primary) {
419
+		foreach (class_parents($this) as $parent) {
420
+			if (method_exists($parent, 'handle_row_actions') && $parent == 'WP_List_Table') {
421
+				return parent::handle_row_actions($item, $column_name, $primary);
422 422
 			}
423 423
 		}
424 424
 		'';
@@ -436,11 +436,11 @@  discard block
 block discarded – undo
436 436
 	protected function _get_bulk_actions() {
437 437
 		$actions = array();
438 438
 		//the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table();
439
-		foreach ( $this->_views as $view => $args) {
440
-			if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view )
439
+		foreach ($this->_views as $view => $args) {
440
+			if (isset($args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view)
441 441
 				//each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user.
442
-				foreach ( $args['bulk_action'] as $route =>$label ) {
443
-					if ( $this->_admin_page->check_user_access( $route, true ) ) {
442
+				foreach ($args['bulk_action'] as $route =>$label) {
443
+					if ($this->_admin_page->check_user_access($route, true)) {
444 444
 						$actions[$route] = $label;
445 445
 					}
446 446
 				}
@@ -458,18 +458,18 @@  discard block
 block discarded – undo
458 458
 	 */
459 459
 	private function _filters() {
460 460
 		$classname = get_class($this);
461
-		$filters = apply_filters( "FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen );
461
+		$filters = apply_filters("FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen);
462 462
 
463
-		if ( empty( $filters )) {
463
+		if (empty($filters)) {
464 464
 			return;
465 465
 		}
466
-		foreach ( $filters as $filter ) {
466
+		foreach ($filters as $filter) {
467 467
 			echo $filter;
468 468
 		}
469 469
 		//add filter button at end
470
-		echo '<input type="submit" class="button-secondary" value="' . __('Filter', 'event_espresso') . '" id="post-query-submit" />';
470
+		echo '<input type="submit" class="button-secondary" value="'.__('Filter', 'event_espresso').'" id="post-query-submit" />';
471 471
 		//add reset filters button at end
472
-		echo '<a class="button button-secondary"  href="' . $this->_admin_page->get_current_page_view_url() . '" style="display:inline-block">' . __('Reset Filters', 'event_espresso') . '</a>';
472
+		echo '<a class="button button-secondary"  href="'.$this->_admin_page->get_current_page_view_url().'" style="display:inline-block">'.__('Reset Filters', 'event_espresso').'</a>';
473 473
 	}
474 474
 
475 475
 
@@ -483,8 +483,8 @@  discard block
 block discarded – undo
483 483
 	 * @param string $column_name
484 484
 	 * @return string
485 485
 	 */
486
-	public function set_primary_column( $column_name ) {
487
-		return ! empty( $this->_primary_column ) ? $this->_primary_column : $column_name;
486
+	public function set_primary_column($column_name) {
487
+		return ! empty($this->_primary_column) ? $this->_primary_column : $column_name;
488 488
 	}
489 489
 
490 490
 
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 			array(
504 504
 				'total_items' => $total_items,
505 505
 				'per_page' => $this->_per_page,
506
-				'total_pages' => ceil($total_items / $this->_per_page )
506
+				'total_pages' => ceil($total_items / $this->_per_page)
507 507
 			)
508 508
 		);
509 509
 	}
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 	 *
520 520
 	 * @return string html content for the column
521 521
 	 */
522
-	public function column_default( $item, $column_name ) {
522
+	public function column_default($item, $column_name) {
523 523
 		/**
524 524
 		 * Dynamic hook allowing for adding additional column content in this list table.
525 525
 		 * Note that $this->screen->id is in the format
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 		 * hook prefix ("event-espresso") will be different.
530 530
 		 *
531 531
 		 */
532
-		do_action( 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, $item, $this->_screen );
532
+		do_action('AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, $item, $this->_screen);
533 533
 	}
534 534
 
535 535
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 		 *
546 546
 		 * @var array
547 547
 		 */
548
-		$columns = apply_filters( 'FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen );
548
+		$columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen);
549 549
 		return $columns;
550 550
 	}
551 551
 
@@ -557,18 +557,18 @@  discard block
 block discarded – undo
557 557
 		$views = $this->get_views();
558 558
 		$assembled_views = '';
559 559
 
560
-		if ( empty( $views )) {
560
+		if (empty($views)) {
561 561
 			return;
562 562
 		}
563 563
 		echo "<ul class='subsubsub'>\n";
564
-		foreach ( $views as $view ) {
565
-			$count = isset($view['count'] ) && !empty($view['count']) ? absint( $view['count'] )  : 0;
566
-			if ( isset( $view['slug'] ) && isset( $view['class'] ) && isset( $view['url'] ) && isset( $view['label']) ) {
567
-				$assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" . '<a href="' . $view['url'] . '">' . $view['label'] . '</a> <span class="count">(' . $count . ')</span>';
564
+		foreach ($views as $view) {
565
+			$count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0;
566
+			if (isset($view['slug']) && isset($view['class']) && isset($view['url']) && isset($view['label'])) {
567
+				$assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>".'<a href="'.$view['url'].'">'.$view['label'].'</a> <span class="count">('.$count.')</span>';
568 568
 			}
569 569
 		}
570 570
 
571
-		echo is_array( $assembled_views) && ! empty( $assembled_views ) ? implode( " |</li>\n", $assembled_views ) . "</li>\n" : '';
571
+		echo is_array($assembled_views) && ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : '';
572 572
 		echo "</ul>";
573 573
 	}
574 574
 
@@ -581,10 +581,10 @@  discard block
 block discarded – undo
581 581
 	 *
582 582
 	 * @param object $item The current item
583 583
 	 */
584
-	public function single_row( $item ) {
585
-		$row_class = $this->_get_row_class( $item );
586
-		echo '<tr class="' . esc_attr( $row_class ) . '">';
587
-		$this->single_row_columns( $item );
584
+	public function single_row($item) {
585
+		$row_class = $this->_get_row_class($item);
586
+		echo '<tr class="'.esc_attr($row_class).'">';
587
+		$this->single_row_columns($item);
588 588
 		echo '</tr>';
589 589
 	}
590 590
 
@@ -595,13 +595,13 @@  discard block
 block discarded – undo
595 595
 	 * @param  object $item the current item
596 596
 	 * @return string
597 597
 	 */
598
-	protected function _get_row_class( $item ) {
598
+	protected function _get_row_class($item) {
599 599
 		static $row_class = '';
600
-		$row_class = ( $row_class == '' ? 'alternate' : '' );
600
+		$row_class = ($row_class == '' ? 'alternate' : '');
601 601
 
602 602
 		$new_row_class = $row_class;
603 603
 
604
-		if ( !empty($this->_ajax_sorting_callback) ) {
604
+		if ( ! empty($this->_ajax_sorting_callback)) {
605 605
 			$new_row_class .= ' rowsortable';
606 606
 		}
607 607
 
@@ -620,13 +620,13 @@  discard block
 block discarded – undo
620 620
 
621 621
 	public function get_hidden_columns() {
622 622
 		$user_id = get_current_user_id();
623
-		$has_default = get_user_option('default'. $this->screen->id . 'columnshidden', $user_id);
624
-		if ( empty( $has_default ) && !empty($this->_hidden_columns ) ) {
625
-			update_user_option($user_id, 'default'.$this->screen->id . 'columnshidden', TRUE);
626
-			update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, TRUE );
623
+		$has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id);
624
+		if (empty($has_default) && ! empty($this->_hidden_columns)) {
625
+			update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', TRUE);
626
+			update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, TRUE);
627 627
 		}
628
-		$ref = 'manage' . $this->screen->id . 'columnshidden';
629
-		$saved_columns = (array) get_user_option( $ref, $user_id );
628
+		$ref = 'manage'.$this->screen->id.'columnshidden';
629
+		$saved_columns = (array) get_user_option($ref, $user_id);
630 630
 		return $saved_columns;
631 631
 	}
632 632
 
@@ -641,47 +641,47 @@  discard block
 block discarded – undo
641 641
 	 *
642 642
 	 * @param object $item The current item
643 643
 	 */
644
-	public function single_row_columns( $item ) {
645
-		list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
644
+	public function single_row_columns($item) {
645
+		list($columns, $hidden, $sortable, $primary) = $this->get_column_info();
646 646
 
647 647
 		global $wp_version;
648
-		$use_hidden_class = version_compare( $wp_version, '4.3-RC', '>=' );
648
+		$use_hidden_class = version_compare($wp_version, '4.3-RC', '>=');
649 649
 
650
-		foreach ( $columns as $column_name => $column_display_name ) {
650
+		foreach ($columns as $column_name => $column_display_name) {
651 651
 
652 652
 			/**
653 653
 			 * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns are
654 654
 			 * hidden or not instead of using "display:none;".  This bit of code provides backward compat.
655 655
 			 */
656
-			$hidden_class = $use_hidden_class && in_array( $column_name, $hidden ) ? ' hidden' : '';
657
-			$style = ! $use_hidden_class && in_array( $column_name, $hidden ) ? ' style="display:none;"' : '';
656
+			$hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : '';
657
+			$style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : '';
658 658
 
659
-			$classes = $column_name . ' column-' . $column_name.$hidden_class;
660
-			if ( $primary == $column_name ) {
659
+			$classes = $column_name.' column-'.$column_name.$hidden_class;
660
+			if ($primary == $column_name) {
661 661
 				$classes .= ' has-row-actions column-primary';
662 662
 			}
663 663
 
664
-			$data = ' data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';
664
+			$data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"';
665 665
 
666 666
 			$class = "class='$classes'";
667 667
 
668 668
 			$attributes = "$class$style$data";
669 669
 
670
-			if ( 'cb' === $column_name ) {
670
+			if ('cb' === $column_name) {
671 671
 				echo '<th scope="row" class="check-column">';
672
-				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this );
672
+				echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb($item), $item, $this);
673 673
 				echo '</th>';
674 674
 			}
675
-			elseif ( method_exists( $this, 'column_' . $column_name ) ) {
675
+			elseif (method_exists($this, 'column_'.$column_name)) {
676 676
 				echo "<td $attributes>";
677
-				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this );
678
-				echo $this->handle_row_actions( $item, $column_name, $primary );
677
+				echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content', call_user_func(array($this, 'column_'.$column_name), $item), $item, $this);
678
+				echo $this->handle_row_actions($item, $column_name, $primary);
679 679
 				echo "</td>";
680 680
 			}
681 681
 			else {
682 682
 				echo "<td $attributes>";
683
-				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this );
684
-				echo $this->handle_row_actions( $item, $column_name, $primary );
683
+				echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default($item, $column_name), $item, $column_name, $this);
684
+				echo $this->handle_row_actions($item, $column_name, $primary);
685 685
 				echo "</td>";
686 686
 			}
687 687
 		}
@@ -689,19 +689,19 @@  discard block
 block discarded – undo
689 689
 
690 690
 
691 691
 
692
-	public function extra_tablenav( $which ) {
693
-		if ( $which == 'top' ) {
692
+	public function extra_tablenav($which) {
693
+		if ($which == 'top') {
694 694
 			$this->_filters();
695 695
 			echo $this->_get_hidden_fields();
696 696
 			echo '<br class="clear">';
697
-		}else{
697
+		} else {
698 698
 			echo '<div class="list-table-bottom-buttons alignleft actions">';
699
-			foreach($this->_bottom_buttons as $type => $action){
700
-				$route = isset( $action['route'] ) ? $action['route'] : '';
701
-				$extra_request = isset( $action['extra_request'] ) ? $action['extra_request'] : '';
699
+			foreach ($this->_bottom_buttons as $type => $action) {
700
+				$route = isset($action['route']) ? $action['route'] : '';
701
+				$extra_request = isset($action['extra_request']) ? $action['extra_request'] : '';
702 702
 				echo $this->_admin_page->get_action_link_or_button($route, $type, $extra_request);
703 703
 			}
704
-			do_action( 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen );
704
+			do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen);
705 705
 			echo '</div>';
706 706
 		}
707 707
 		//echo $this->_entries_per_page_dropdown;
@@ -751,13 +751,13 @@  discard block
 block discarded – undo
751 751
 	 *
752 752
 	 * @return string The assembled action elements container.
753 753
 	 */
754
-	protected function _action_string( $action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '' ) {
754
+	protected function _action_string($action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '') {
755 755
 		$content = '';
756
-		$action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : '';
757
-		$action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : '';
758
-		$content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : '';
759
-		$content .= apply_filters( 'FHEE__EE_Admin_List_Table___action_string__action_items', $action_items, $item, $this );
760
-		$content .= ! empty( $container ) ? '</' . $container . '>' : '';
756
+		$action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : '';
757
+		$action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : '';
758
+		$content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : '';
759
+		$content .= apply_filters('FHEE__EE_Admin_List_Table___action_string__action_items', $action_items, $item, $this);
760
+		$content .= ! empty($container) ? '</'.$container.'>' : '';
761 761
 		return $content;
762 762
 	}
763 763
 }
Please login to merge, or discard this patch.
data_migration_scripts/4_1_0_stages/EE_DMS_4_1_0_attendees.dmsstage.php 1 patch
Spacing   +182 added lines, -182 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 			)
215 215
 		);
216 216
  */
217
-class EE_DMS_4_1_0_attendees extends EE_Data_Migration_Script_Stage_Table{
217
+class EE_DMS_4_1_0_attendees extends EE_Data_Migration_Script_Stage_Table {
218 218
 	private $_new_attendee_cpt_table;
219 219
 	private $_new_attendee_meta_table;
220 220
 	private $_new_reg_table;
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		global $wpdb;
238 238
 		$this->_pretty_name = __("Attendees", "event_espresso");
239 239
 		$this->_old_table = $wpdb->prefix."events_attendee";
240
-		$this->_old_mer_table = $wpdb->prefix."events_multi_event_registration_id_group";;
240
+		$this->_old_mer_table = $wpdb->prefix."events_multi_event_registration_id_group"; ;
241 241
 		$this->_new_attendee_cpt_table = $wpdb->posts;
242 242
 		$this->_new_attendee_meta_table = $wpdb->prefix."esp_attendee_meta";
243 243
 		$this->_new_reg_table = $wpdb->prefix."esp_registration";
@@ -256,34 +256,34 @@  discard block
 block discarded – undo
256 256
 	protected function _migrate_old_row($old_row) {
257 257
 		//first check if there's already a new attendee with similar characteristics
258 258
 		$new_att_id = $this->_find_attendee_cpt_matching($old_row);
259
-		if( ! $new_att_id ){
259
+		if ( ! $new_att_id) {
260 260
 			$new_att_id = $this->_insert_new_attendee_cpt($old_row);
261
-			if( ! $new_att_id){
261
+			if ( ! $new_att_id) {
262 262
 				//if we couldnt even make an attendee, abandon all hope
263 263
 				return false;
264 264
 			}
265 265
 			$new_att_meta_id = $this->_insert_attendee_meta_row($old_row, $new_att_id);
266
-			if($new_att_meta_id){
266
+			if ($new_att_meta_id) {
267 267
 				$this->get_migration_script()->set_mapping($this->_old_table, $old_row['id'], $this->_new_attendee_meta_table, $new_att_meta_id);
268 268
 			}
269 269
 		}
270 270
 		$this->get_migration_script()->set_mapping($this->_old_table, $old_row['id'], $this->_new_attendee_cpt_table, $new_att_id);
271 271
 
272 272
 		$txn_id = $this->_insert_new_transaction($old_row);
273
-		if( ! $txn_id){
273
+		if ( ! $txn_id) {
274 274
 			//if we couldnt make the transaction, also abandon all hope
275 275
 			return false;
276 276
 		}
277
-		$this->get_migration_script()->set_mapping($this->_old_table, $old_row['id'], $this->_new_transaction_table, $txn_id);$pay_id = $this->_insert_new_payment($old_row,$txn_id);
278
-		if($pay_id){
279
-			$this->get_migration_script()->set_mapping($this->_old_table,$old_row['id'],$this->_new_payment_table,$pay_id);
277
+		$this->get_migration_script()->set_mapping($this->_old_table, $old_row['id'], $this->_new_transaction_table, $txn_id); $pay_id = $this->_insert_new_payment($old_row, $txn_id);
278
+		if ($pay_id) {
279
+			$this->get_migration_script()->set_mapping($this->_old_table, $old_row['id'], $this->_new_payment_table, $pay_id);
280 280
 		}
281 281
 
282 282
 
283 283
 		//even if there was no payment, we can go ahead with adding the reg
284
-		$new_regs = $this->_insert_new_registrations($old_row,$new_att_id,$txn_id);
285
-		if($new_regs){
286
-			$this->get_migration_script()->set_mapping($this->_old_table,$old_row['id'],$this->_new_reg_table,$new_regs);
284
+		$new_regs = $this->_insert_new_registrations($old_row, $new_att_id, $txn_id);
285
+		if ($new_regs) {
286
+			$this->get_migration_script()->set_mapping($this->_old_table, $old_row['id'], $this->_new_reg_table, $new_regs);
287 287
 		}
288 288
 	}
289 289
 	/**
@@ -293,39 +293,39 @@  discard block
 block discarded – undo
293 293
 	 * @param array $old_attendee
294 294
 	 * @return int
295 295
 	 */
296
-	private function _find_attendee_cpt_matching($old_attendee){
296
+	private function _find_attendee_cpt_matching($old_attendee) {
297 297
 		global $wpdb;
298
-		$existing_attendee_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM ".$this->_new_attendee_cpt_table." AS cpt INNER JOIN ".$this->_new_attendee_meta_table." AS meta ON cpt.ID = meta.ATT_ID WHERE meta.ATT_fname = %s AND meta.ATT_lname = %s AND meta.ATT_email = %s LIMIT 1",$old_attendee['fname'],$old_attendee['lname'],$old_attendee['email']));
298
+		$existing_attendee_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM ".$this->_new_attendee_cpt_table." AS cpt INNER JOIN ".$this->_new_attendee_meta_table." AS meta ON cpt.ID = meta.ATT_ID WHERE meta.ATT_fname = %s AND meta.ATT_lname = %s AND meta.ATT_email = %s LIMIT 1", $old_attendee['fname'], $old_attendee['lname'], $old_attendee['email']));
299 299
 		return intval($existing_attendee_id);
300 300
 	}
301
-	private function _insert_new_attendee_cpt($old_attendee){
301
+	private function _insert_new_attendee_cpt($old_attendee) {
302 302
 		global $wpdb;
303 303
 		$cols_n_values = array(
304
-			'post_title'=>stripslashes($old_attendee['fname']." ".$old_attendee['lname']),//ATT_full_name
305
-			'post_content'=>'',//ATT_bio
306
-			'post_name'=>sanitize_title($old_attendee['fname']."-".$old_attendee['lname']),//ATT_slug
307
-			'post_date'=>$this->get_migration_script()->convert_date_string_to_utc($this,$old_attendee,$old_attendee['date']),//ATT_created
308
-			'post_excerpt'=>'',//ATT_short_bio
309
-			'post_modified'=>$this->get_migration_script()->convert_date_string_to_utc($this,$old_attendee,$old_attendee['date']),//ATT_modified
310
-			'post_author'=>0,//ATT_author
311
-			'post_parent'=>0,//ATT_parent
312
-			'post_type'=>'espresso_attendees',//post_type
304
+			'post_title'=>stripslashes($old_attendee['fname']." ".$old_attendee['lname']), //ATT_full_name
305
+			'post_content'=>'', //ATT_bio
306
+			'post_name'=>sanitize_title($old_attendee['fname']."-".$old_attendee['lname']), //ATT_slug
307
+			'post_date'=>$this->get_migration_script()->convert_date_string_to_utc($this, $old_attendee, $old_attendee['date']), //ATT_created
308
+			'post_excerpt'=>'', //ATT_short_bio
309
+			'post_modified'=>$this->get_migration_script()->convert_date_string_to_utc($this, $old_attendee, $old_attendee['date']), //ATT_modified
310
+			'post_author'=>0, //ATT_author
311
+			'post_parent'=>0, //ATT_parent
312
+			'post_type'=>'espresso_attendees', //post_type
313 313
 			'post_status'=>'publish'//status
314 314
 		);
315 315
 		$datatypes = array(
316
-			'%s',//ATT_full_name
317
-			'%s',//ATT_bio
318
-			'%s',//ATT_slug
319
-			'%s',//ATT_created
320
-			'%s',//ATT_short_bio
321
-			'%s',//ATT_modified
322
-			'%d',//ATT_author
323
-			'%d',//ATT_parent
324
-			'%s',//post_type
325
-			'%s',//status
316
+			'%s', //ATT_full_name
317
+			'%s', //ATT_bio
318
+			'%s', //ATT_slug
319
+			'%s', //ATT_created
320
+			'%s', //ATT_short_bio
321
+			'%s', //ATT_modified
322
+			'%d', //ATT_author
323
+			'%d', //ATT_parent
324
+			'%s', //post_type
325
+			'%s', //status
326 326
 		);
327
-		$success = $wpdb->insert($this->_new_attendee_cpt_table,$cols_n_values,$datatypes);
328
-		if ( ! $success){
327
+		$success = $wpdb->insert($this->_new_attendee_cpt_table, $cols_n_values, $datatypes);
328
+		if ( ! $success) {
329 329
 			$this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_attendee, $this->_new_attendee_cpt_table, $cols_n_values, $datatypes));
330 330
 			return 0;
331 331
 		}
@@ -333,19 +333,19 @@  discard block
 block discarded – undo
333 333
 		return $new_id;
334 334
 	}
335 335
 
336
-	private function _insert_attendee_meta_row($old_attendee,$new_attendee_cpt_id){
336
+	private function _insert_attendee_meta_row($old_attendee, $new_attendee_cpt_id) {
337 337
 		global $wpdb;
338 338
 		//get the state and country ids from the old row
339
-		try{
339
+		try {
340 340
 			$new_country = $this->get_migration_script()->get_or_create_country(stripslashes($old_attendee['country_id']));
341 341
 			$new_country_iso = $new_country['CNT_ISO'];
342
-		}catch(EE_Error $exception){
342
+		} catch (EE_Error $exception) {
343 343
 			$new_country_iso = $this->get_migration_script()->get_default_country_iso();
344 344
 		}
345
-		try{
346
-			$new_state = $this->get_migration_script()->get_or_create_state(stripslashes($old_attendee['state']),$new_country_iso);
345
+		try {
346
+			$new_state = $this->get_migration_script()->get_or_create_state(stripslashes($old_attendee['state']), $new_country_iso);
347 347
 			$new_state_id = $new_state['STA_ID'];
348
-		}catch(EE_Error $exception){
348
+		} catch (EE_Error $exception) {
349 349
 			$new_state_id = 0;
350 350
 		}
351 351
 		$cols_n_values = array(
@@ -362,20 +362,20 @@  discard block
 block discarded – undo
362 362
 			'ATT_phone'=>stripslashes($old_attendee['phone']),
363 363
 		);
364 364
 		$datatypes = array(
365
-			'%d',//ATT_ID
366
-			'%s',//ATT_fname
367
-			'%s',//ATT_lname
368
-			'%s',//ATT_address
369
-			'%s',//ATT_address2
370
-			'%s',//ATT_city
371
-			'%d',//STA_ID
372
-			'%s',//CNT_ISO
373
-			'%s',//ATT_zip
374
-			'%s',//ATT_email
375
-			'%s',//ATT_phone
365
+			'%d', //ATT_ID
366
+			'%s', //ATT_fname
367
+			'%s', //ATT_lname
368
+			'%s', //ATT_address
369
+			'%s', //ATT_address2
370
+			'%s', //ATT_city
371
+			'%d', //STA_ID
372
+			'%s', //CNT_ISO
373
+			'%s', //ATT_zip
374
+			'%s', //ATT_email
375
+			'%s', //ATT_phone
376 376
 		);
377
-		$success = $wpdb->insert($this->_new_attendee_meta_table,$cols_n_values,$datatypes);
378
-		if ( ! $success){
377
+		$success = $wpdb->insert($this->_new_attendee_meta_table, $cols_n_values, $datatypes);
378
+		if ( ! $success) {
379 379
 			$this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_attendee, $this->_new_attendee_meta_table, $cols_n_values, $datatypes));
380 380
 			return 0;
381 381
 		}
@@ -391,28 +391,28 @@  discard block
 block discarded – undo
391 391
 	 * @param type $old_attendee
392 392
 	 * @return int new transaction id
393 393
 	 */
394
-	private function _insert_new_transaction($old_attendee){
394
+	private function _insert_new_transaction($old_attendee) {
395 395
 		global $wpdb;
396 396
 
397 397
 		//first: let's check for an existing transaction for this old attendee
398
-		if( intval( $old_attendee[ 'is_primary' ] ) ) {//primary attendee, so create txn
399
-			$txn_id = $this->get_migration_script()->get_mapping_new_pk( $this->_old_table, intval($old_attendee['id']), $this->_new_transaction_table );
398
+		if (intval($old_attendee['is_primary'])) {//primary attendee, so create txn
399
+			$txn_id = $this->get_migration_script()->get_mapping_new_pk($this->_old_table, intval($old_attendee['id']), $this->_new_transaction_table);
400 400
 		} else { //non-primary attendee, so find its primary attendee's transaction
401
-			$primary_attendee_old_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM ".$this->_old_table." WHERE is_primary=1 and registration_id=%s",$old_attendee['registration_id']));
402
-			if( ! $primary_attendee_old_id){
401
+			$primary_attendee_old_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM ".$this->_old_table." WHERE is_primary=1 and registration_id=%s", $old_attendee['registration_id']));
402
+			if ( ! $primary_attendee_old_id) {
403 403
 				$primary_attendee = $this->_find_mer_primary_attendee_using_mer_tables($old_attendee['registration_id']);
404 404
 				$primary_attendee_old_id = is_array($primary_attendee) ? $primary_attendee['id'] : NULL;
405 405
 			}
406 406
 			$txn_id = $this->get_migration_script()->get_mapping_new_pk($this->_old_table, intval($primary_attendee_old_id), $this->_new_transaction_table);
407
-			if( ! $txn_id){
408
-				$this->add_error(sprintf(__("Could not find primary attendee's new transaction. Current attendee is: %s, we think the 3.1 primary attendee for it has id %d, but there's no 4.1 transaction for that primary attendee id.", "event_espresso"),  $this->_json_encode($old_attendee),$primary_attendee_old_id));
407
+			if ( ! $txn_id) {
408
+				$this->add_error(sprintf(__("Could not find primary attendee's new transaction. Current attendee is: %s, we think the 3.1 primary attendee for it has id %d, but there's no 4.1 transaction for that primary attendee id.", "event_espresso"), $this->_json_encode($old_attendee), $primary_attendee_old_id));
409 409
 				$txn_id = 0;
410 410
 			}
411 411
 		}
412 412
 		//if there isn't yet a transaction row for this, create one
413 413
 		//(so even if it was a non-primary attendee with no EE3 primary attendee,
414 414
 		// it ought to have SOME transaction, so we'll make one)
415
-		if( ! $txn_id ) {
415
+		if ( ! $txn_id) {
416 416
 			//maps 3.1 payment stati onto 4.1 transaction stati
417 417
 			$txn_status_mapping = array(
418 418
 				'Completed'=>'TCM',
@@ -425,21 +425,21 @@  discard block
 block discarded – undo
425 425
 			);
426 426
 			$STS_ID = isset($txn_status_mapping[$old_attendee['payment_status']]) ? $txn_status_mapping[$old_attendee['payment_status']] : 'TIN';
427 427
 			$cols_n_values = array(
428
-				'TXN_timestamp'=>$this->get_migration_script()->convert_date_string_to_utc($this,$old_attendee,$old_attendee['date']),
428
+				'TXN_timestamp'=>$this->get_migration_script()->convert_date_string_to_utc($this, $old_attendee, $old_attendee['date']),
429 429
 				'TXN_total'=>floatval($old_attendee['total_cost']),
430 430
 				'TXN_paid'=>floatval($old_attendee['amount_pd']),
431 431
 				'STS_ID'=>$STS_ID,
432 432
 				'TXN_hash_salt'=>$old_attendee['hashSalt']
433 433
 			);
434 434
 			$datatypes = array(
435
-				'%s',//TXN_timestamp
436
-				'%f',//TXN_total
437
-				'%f',//TXN_paid
438
-				'%s',//STS_ID
439
-				'%s',//TXN_hash_salt
435
+				'%s', //TXN_timestamp
436
+				'%f', //TXN_total
437
+				'%f', //TXN_paid
438
+				'%s', //STS_ID
439
+				'%s', //TXN_hash_salt
440 440
 			);
441
-			$success = $wpdb->insert($this->_new_transaction_table,$cols_n_values,$datatypes);
442
-			if ( ! $success){
441
+			$success = $wpdb->insert($this->_new_transaction_table, $cols_n_values, $datatypes);
442
+			if ( ! $success) {
443 443
 				$this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_attendee, $this->_new_transaction_table, $cols_n_values, $datatypes));
444 444
 				return 0;
445 445
 			}
@@ -453,13 +453,13 @@  discard block
 block discarded – undo
453 453
 	 * @global type $wpdb
454 454
 	 * @return boolean
455 455
 	 */
456
-	private function _mer_tables_exist(){
457
-		if( $this->_mer_tables_exist === NULL){
456
+	private function _mer_tables_exist() {
457
+		if ($this->_mer_tables_exist === NULL) {
458 458
 			global $wpdb;
459 459
 
460
-			if( $wpdb->get_var("SHOW TABLES LIKE '{$this->_old_mer_table}'") != $this->_old_mer_table){
460
+			if ($wpdb->get_var("SHOW TABLES LIKE '{$this->_old_mer_table}'") != $this->_old_mer_table) {
461 461
 				$this->_mer_tables_exist = false;
462
-			}else{
462
+			} else {
463 463
 				$this->_mer_tables_exist = true;
464 464
 			}
465 465
 		}
@@ -473,10 +473,10 @@  discard block
 block discarded – undo
473 473
 	 * @param type $old_attendee_row
474 474
 	 * @return string
475 475
 	 */
476
-	private function _get_reg_status_for_old_payment_status($old_attendee_row){
476
+	private function _get_reg_status_for_old_payment_status($old_attendee_row) {
477 477
 		//need event default reg status and if pre_approval was required
478 478
 		global $wpdb;
479
-		$event_required_pre_approval = $wpdb->get_var($wpdb->prepare("SELECT require_pre_approval FROM ".$wpdb->prefix."events_detail WHERE id = %d",$old_attendee_row['event_id']));
479
+		$event_required_pre_approval = $wpdb->get_var($wpdb->prepare("SELECT require_pre_approval FROM ".$wpdb->prefix."events_detail WHERE id = %d", $old_attendee_row['event_id']));
480 480
 		return $this->get_migration_script()->convert_3_1_payment_status_to_4_1_STS_ID($old_attendee_row['payment_status'],
481 481
 				intval($event_required_pre_approval) && intval($old_attendee_row['pre_approve']));
482 482
 	}
@@ -489,19 +489,19 @@  discard block
 block discarded – undo
489 489
 	 * @param int $new_txn_id
490 490
 	 * @return array of new registratio ids
491 491
 	 */
492
-	private function _insert_new_registrations($old_attendee,$new_attendee_id,$new_txn_id){
492
+	private function _insert_new_registrations($old_attendee, $new_attendee_id, $new_txn_id) {
493 493
 		global $wpdb;
494 494
 
495 495
 		$STS_ID = $this->_get_reg_status_for_old_payment_status($old_attendee);
496 496
 		$new_event_id = $this->get_migration_script()->get_mapping_new_pk($wpdb->prefix.'events_detail', $old_attendee['event_id'], $wpdb->posts);
497
-		if( ! $new_event_id){
498
-			$this->add_error(sprintf(__("Could not find NEW event CPT ID for old event '%d' on old attendee %s", "event_espresso"),$old_attendee['event_id'],$this->_json_encode($old_attendee)));
497
+		if ( ! $new_event_id) {
498
+			$this->add_error(sprintf(__("Could not find NEW event CPT ID for old event '%d' on old attendee %s", "event_espresso"), $old_attendee['event_id'], $this->_json_encode($old_attendee)));
499 499
 		}
500 500
 
501
-		$ticket_id = $this->_try_to_find_new_ticket_id($old_attendee,$new_event_id);
502
-		if( ! $ticket_id){
503
-			$ticket_id = $this->_insert_new_ticket_because_none_found( $old_attendee, $new_event_id );
504
-			$this->add_error( sprintf( __( 'Could not find a ticket for old attendee with id %d for new event %d, so created a new ticket with id %d', 'event_espresso' ), $old_attendee['id'], $new_event_id, $ticket_id ) );
501
+		$ticket_id = $this->_try_to_find_new_ticket_id($old_attendee, $new_event_id);
502
+		if ( ! $ticket_id) {
503
+			$ticket_id = $this->_insert_new_ticket_because_none_found($old_attendee, $new_event_id);
504
+			$this->add_error(sprintf(__('Could not find a ticket for old attendee with id %d for new event %d, so created a new ticket with id %d', 'event_espresso'), $old_attendee['id'], $new_event_id, $ticket_id));
505 505
 		}
506 506
 		$regs_on_this_row = intval($old_attendee['quantity']);
507 507
 		$new_regs = array();
@@ -510,50 +510,50 @@  discard block
 block discarded – undo
510 510
 		//Y old attendee_details rows with a quantity of 1 (no mer) joined by their common registration_id
511 511
 		//Y old attendee_details rows with a quantity of x (because of mer)
512 512
 		//Y old attendee_details rows with a quantity of 1 (because of mer) joined by wp_events_multi_event_registration_id_group
513
-		for($count = 1; $count <= $regs_on_this_row; $count++){
513
+		for ($count = 1; $count <= $regs_on_this_row; $count++) {
514 514
 			//sum regs on older rows
515
-			$regs_on_this_event_and_txn = $this->_sum_old_attendees_on_old_txn($old_attendee,true);
515
+			$regs_on_this_event_and_txn = $this->_sum_old_attendees_on_old_txn($old_attendee, true);
516 516
 			$cols_n_values = array(
517 517
 				'EVT_ID'=>$new_event_id,
518 518
 				'ATT_ID'=>$new_attendee_id,
519 519
 				'TXN_ID'=>$new_txn_id,
520 520
 				'TKT_ID'=>$ticket_id,
521 521
 				'STS_ID'=>$STS_ID,
522
-				'REG_date'=>$this->get_migration_script()->convert_date_string_to_utc($this,$old_attendee,$old_attendee['date']),
522
+				'REG_date'=>$this->get_migration_script()->convert_date_string_to_utc($this, $old_attendee, $old_attendee['date']),
523 523
 				'REG_final_price'=>$old_attendee['final_price'],
524
-				'REG_session'=> substr( $old_attendee['attendee_session'], 0, 44 ),
524
+				'REG_session'=> substr($old_attendee['attendee_session'], 0, 44),
525 525
 				'REG_code'=>sanitize_key($old_attendee['registration_id']),
526 526
 				'REG_url_link'=>  sanitize_key($old_attendee['registration_id'].'-'.$count),
527 527
 				'REG_count'=>$regs_on_this_event_and_txn + $count,
528
-				'REG_group_size'=>$this->_sum_old_attendees_on_old_txn($old_attendee,false),
528
+				'REG_group_size'=>$this->_sum_old_attendees_on_old_txn($old_attendee, false),
529 529
 				'REG_att_is_going'=>true,
530 530
 				'REG_deleted'=>false
531 531
 			);
532 532
 			$datatypes = array(
533
-				'%d',//EVT_ID
534
-				'%d',//ATT_ID
535
-				'%d',//TXN_ID
536
-				'%d',//TKT_ID
537
-				'%s',//STS_ID
538
-				'%s',//REG_date
539
-				'%f',//REG_final_price
540
-				'%s',//REG_session
541
-				'%s',//REG_code
542
-				'%s',//REG_url_link
543
-				'%d',//REG_count
544
-				'%d',//REG_group_size
545
-				'%d',//REG_att_is_going
546
-				'%d',//REG_deleted
533
+				'%d', //EVT_ID
534
+				'%d', //ATT_ID
535
+				'%d', //TXN_ID
536
+				'%d', //TKT_ID
537
+				'%s', //STS_ID
538
+				'%s', //REG_date
539
+				'%f', //REG_final_price
540
+				'%s', //REG_session
541
+				'%s', //REG_code
542
+				'%s', //REG_url_link
543
+				'%d', //REG_count
544
+				'%d', //REG_group_size
545
+				'%d', //REG_att_is_going
546
+				'%d', //REG_deleted
547 547
 			);
548
-			$success = $wpdb->insert($this->_new_reg_table,$cols_n_values,$datatypes);
549
-			if ( ! $success){
548
+			$success = $wpdb->insert($this->_new_reg_table, $cols_n_values, $datatypes);
549
+			if ( ! $success) {
550 550
 				$this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_attendee, $this->_new_reg_table, $cols_n_values, $datatypes));
551 551
 				return 0;
552 552
 			}
553 553
 			$cols_n_values['REG_ID'] = $wpdb->insert_id;
554 554
 			$new_regs[] = $wpdb->insert_id;
555 555
 		}
556
-		$this->_add_regs_to_ticket_and_datetimes($ticket_id,count($new_regs),$STS_ID);
556
+		$this->_add_regs_to_ticket_and_datetimes($ticket_id, count($new_regs), $STS_ID);
557 557
 		return $new_regs;
558 558
 	}
559 559
 
@@ -569,23 +569,23 @@  discard block
 block discarded – undo
569 569
 	 * @param type $STS_ID
570 570
 	 * @return boolean whether they were successfully updated or not
571 571
 	 */
572
-	protected function _add_regs_to_ticket_and_datetimes($new_ticket_id,$quantity_sold,$STS_ID){
573
-		if($STS_ID != 'RAP'){
572
+	protected function _add_regs_to_ticket_and_datetimes($new_ticket_id, $quantity_sold, $STS_ID) {
573
+		if ($STS_ID != 'RAP') {
574 574
 			return true;
575 575
 		}
576 576
 		global $wpdb;
577
-		$success = $wpdb->query($wpdb->prepare("UPDATE {$this->_new_ticket_table} SET TKT_sold=TKT_sold+%d WHERE TKT_ID=%d",$quantity_sold,$new_ticket_id));
578
-		if($success){
577
+		$success = $wpdb->query($wpdb->prepare("UPDATE {$this->_new_ticket_table} SET TKT_sold=TKT_sold+%d WHERE TKT_ID=%d", $quantity_sold, $new_ticket_id));
578
+		if ($success) {
579 579
 			//get the ticket's datetimes, and increment them too
580
-			$success_update_dateimtes =  $wpdb->query($wpdb->prepare("UPDATE {$this->_new_ticket_table} TKT
580
+			$success_update_dateimtes = $wpdb->query($wpdb->prepare("UPDATE {$this->_new_ticket_table} TKT
581 581
 				INNER JOIN {$this->_new_ticket_datetime_table} as DTK ON TKT.TKT_ID = DTK.TKT_ID
582 582
 				INNER JOIN {$this->_new_datetime_table} as DTT ON DTK.DTT_ID = DTT.DTT_ID
583
-				SET DTT.DTT_sold = DTT.DTT_sold + %d WHERE TKT.TKT_ID = %d",$quantity_sold,$new_ticket_id));
584
-			if( ! $success_update_dateimtes){
585
-				$this->add_error(sprintf(__("Could not update datetimes related to ticket with ID %d's TKT_sold by %d because %s", "event_espresso"),$new_ticket_id,$quantity_sold,$wpdb->last_error));
583
+				SET DTT.DTT_sold = DTT.DTT_sold + %d WHERE TKT.TKT_ID = %d", $quantity_sold, $new_ticket_id));
584
+			if ( ! $success_update_dateimtes) {
585
+				$this->add_error(sprintf(__("Could not update datetimes related to ticket with ID %d's TKT_sold by %d because %s", "event_espresso"), $new_ticket_id, $quantity_sold, $wpdb->last_error));
586 586
 			}
587
-		}else{
588
-			$this->add_error(sprintf(__("Could not update ticket with ID %d's TKT_sold by %d because %s", "event_espresso"),$new_ticket_id,$quantity_sold,$wpdb->last_error));
587
+		} else {
588
+			$this->add_error(sprintf(__("Could not update ticket with ID %d's TKT_sold by %d because %s", "event_espresso"), $new_ticket_id, $quantity_sold, $wpdb->last_error));
589 589
 		}
590 590
 		return true;
591 591
 	}
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 	 * and lastly if none of that works, just use the first ticket for the event we find
598 598
 	 * @param array $old_attendee
599 599
 	 */
600
-	private function _try_to_find_new_ticket_id($old_attendee,$new_event_id){
600
+	private function _try_to_find_new_ticket_id($old_attendee, $new_event_id) {
601 601
 		global $wpdb;
602 602
 		$tickets_table = $this->_new_ticket_table;
603 603
 		$datetime_tickets_table = $this->_new_ticket_datetime_table;
@@ -608,24 +608,24 @@  discard block
 block discarded – undo
608 608
 
609 609
 		$old_att_start_date = $old_attendee['start_date'];
610 610
 		$old_att_start_time = $this->get_migration_script()->convertTimeFromAMPM($old_attendee['event_time']);
611
-		$old_att_datetime = $this->get_migration_script()->convert_date_string_to_utc($this,$old_attendee,"$old_att_start_date $old_att_start_time:00");
611
+		$old_att_datetime = $this->get_migration_script()->convert_date_string_to_utc($this, $old_attendee, "$old_att_start_date $old_att_start_time:00");
612 612
 		//add all conditions to an array from which we can SHIFT conditions off in order to widen our search
613 613
 		//the most important condition should be last, as it will be array_shift'ed off last
614 614
 		$conditions = array(
615
-			$wpdb->prepare("$datetime_table.DTT_EVT_start = %s",$old_att_datetime),//times match?
616
-			$wpdb->prepare("$tickets_table.TKT_price = %f",$old_att_price),//prices match?
617
-			$wpdb->prepare("$tickets_table.TKT_name = %s",$old_att_price_option),//names match?
618
-			$wpdb->prepare("$datetime_table.EVT_ID = %d",$new_event_id),//events match?
615
+			$wpdb->prepare("$datetime_table.DTT_EVT_start = %s", $old_att_datetime), //times match?
616
+			$wpdb->prepare("$tickets_table.TKT_price = %f", $old_att_price), //prices match?
617
+			$wpdb->prepare("$tickets_table.TKT_name = %s", $old_att_price_option), //names match?
618
+			$wpdb->prepare("$datetime_table.EVT_ID = %d", $new_event_id), //events match?
619 619
 		);
620 620
 		$select_and_join_part = "SELECT $tickets_table.TKT_ID FROM $tickets_table INNER JOIN
621 621
 			$datetime_tickets_table ON $tickets_table.TKT_ID = $datetime_tickets_table.TKT_ID INNER JOIN
622 622
 			$datetime_table ON $datetime_tickets_table.DTT_ID = $datetime_table.DTT_ID";
623 623
 		//start running queries, widening search each time by removing a condition
624
-		do{
625
-			$full_query = $select_and_join_part." WHERE ".implode(" AND ",$conditions)." LIMIT 1";
624
+		do {
625
+			$full_query = $select_and_join_part." WHERE ".implode(" AND ", $conditions)." LIMIT 1";
626 626
 			$ticket_id_found = $wpdb->get_var($full_query);
627 627
 			array_shift($conditions);
628
-		}while( ! $ticket_id_found && $conditions);
628
+		}while ( ! $ticket_id_found && $conditions);
629 629
 		return $ticket_id_found;
630 630
 
631 631
 	}
@@ -636,23 +636,23 @@  discard block
 block discarded – undo
636 636
 	 * the new ticket to that datetime and price.
637 637
 	 * @return int ticket id
638 638
 	 */
639
-	private function _insert_new_ticket_because_none_found( $old_attendee, $new_event_id ) {
639
+	private function _insert_new_ticket_because_none_found($old_attendee, $new_event_id) {
640 640
 		global $wpdb;
641 641
 		$old_att_price_option = $old_attendee['price_option'];
642 642
 		$old_att_price = floatval($old_attendee['orig_price']);
643 643
 
644 644
 		$old_att_start_date = $old_attendee['start_date'];
645 645
 		$old_att_start_time = $this->get_migration_script()->convertTimeFromAMPM($old_attendee['event_time']);
646
-		$old_att_start_datetime = $this->get_migration_script()->convert_date_string_to_utc($this,$old_attendee,"$old_att_start_date $old_att_start_time:00");
646
+		$old_att_start_datetime = $this->get_migration_script()->convert_date_string_to_utc($this, $old_attendee, "$old_att_start_date $old_att_start_time:00");
647 647
 
648 648
 
649 649
 		//insert new datetime unless we find one
650
-		$datetime_id = $wpdb->get_var( $wpdb->prepare( "SELECT DTT_ID FROM " . $this->_new_datetime_table . " WHERE DTT_EVT_start=%s AND EVT_ID=%d LIMIT 1", $old_att_start_datetime, $new_event_id ), ARRAY_A );
651
-		if( ! $datetime_id ) {
650
+		$datetime_id = $wpdb->get_var($wpdb->prepare("SELECT DTT_ID FROM ".$this->_new_datetime_table." WHERE DTT_EVT_start=%s AND EVT_ID=%d LIMIT 1", $old_att_start_datetime, $new_event_id), ARRAY_A);
651
+		if ( ! $datetime_id) {
652 652
 			$old_att_end_date = $old_attendee['start_date'];
653 653
 			$old_att_end_time = $this->get_migration_script()->convertTimeFromAMPM($old_attendee['event_time']);
654
-			$old_att_end_datetime = $this->get_migration_script()->convert_date_string_to_utc($this,$old_attendee,"$old_att_end_date $old_att_end_time:00");
655
-			$wpdb->insert( $this->_new_datetime_table,
654
+			$old_att_end_datetime = $this->get_migration_script()->convert_date_string_to_utc($this, $old_attendee, "$old_att_end_date $old_att_end_time:00");
655
+			$wpdb->insert($this->_new_datetime_table,
656 656
 					array(
657 657
 						'EVT_ID' => $new_event_id,
658 658
 						'DTT_EVT_start' => $old_att_start_datetime,
@@ -660,44 +660,44 @@  discard block
 block discarded – undo
660 660
 						'DTT_deleted' => TRUE
661 661
 					),
662 662
 					array(
663
-						'%d',//EVT_ID
664
-						'%s',//DTT_EVT_start
665
-						'%s',//DTT_EVT_end
666
-						'%d',//DTT_deleted
663
+						'%d', //EVT_ID
664
+						'%s', //DTT_EVT_start
665
+						'%s', //DTT_EVT_end
666
+						'%d', //DTT_deleted
667 667
 					));
668 668
 			$datetime_id = $wpdb->insert_id;
669 669
 		}
670 670
 
671 671
 		//insert new ticket
672
-		$success = $wpdb->insert( $wpdb->prefix . 'esp_ticket',
672
+		$success = $wpdb->insert($wpdb->prefix.'esp_ticket',
673 673
 				array(
674 674
 					'TKT_name' => $old_att_price_option,
675 675
 					'TKT_qty' => -1,
676 676
 					'TKT_price' => $old_att_price,
677
-					'TKT_start_date' => $old_att_start_datetime,//we really have no clue what the time should be, but at least it was available when they attended
677
+					'TKT_start_date' => $old_att_start_datetime, //we really have no clue what the time should be, but at least it was available when they attended
678 678
 					'TKT_end_date' => $old_att_end_datetime,
679 679
 
680 680
 				),
681 681
 				array(
682
-					'%s',//name
683
-					'%d',//qty
684
-					'%d',//price
685
-					'%s',//start_date
686
-					'%s',//end_date
682
+					'%s', //name
683
+					'%d', //qty
684
+					'%d', //price
685
+					'%s', //start_date
686
+					'%s', //end_date
687 687
 				));
688 688
 		$ticket_id = $wpdb->insert_id;
689 689
 		//associate the ticket with the datetime we found earlier
690
-		$wpdb->insert( $this->_new_datetime_ticket_table,
690
+		$wpdb->insert($this->_new_datetime_ticket_table,
691 691
 				array(
692 692
 					'DTT_ID' => $datetime_id,
693 693
 					'TKT_ID' => $ticket_id
694 694
 				),
695 695
 				array(
696
-					'%d',//DTT_ID
697
-					'%d',//TKT_ID
696
+					'%d', //DTT_ID
697
+					'%d', //TKT_ID
698 698
 				));
699 699
 		//insert new price
700
-		$wpdb->insert( $this->_new_price_table,
700
+		$wpdb->insert($this->_new_price_table,
701 701
 				array(
702 702
 					'PRC_amount' => $old_att_price,
703 703
 					'PRT_ID' => EE_DMS_4_1_0_prices::price_type_base,
@@ -705,22 +705,22 @@  discard block
 block discarded – undo
705 705
 					'PRC_deleted' => TRUE
706 706
 				),
707 707
 				array(
708
-					'%d',//PRC_amount
709
-					'%d',//PRT_ID
710
-					'%s',//PRC_name
711
-					'%d',//PRC_deleted
708
+					'%d', //PRC_amount
709
+					'%d', //PRT_ID
710
+					'%s', //PRC_name
711
+					'%d', //PRC_deleted
712 712
 				));
713 713
 		$price_id = $wpdb->insert_id;
714 714
 		//associate the price to the ticket
715
-		$wpdb->insert( $this->_new_ticket_price_table,
715
+		$wpdb->insert($this->_new_ticket_price_table,
716 716
 				array(
717 717
 					'TKT_ID' => $ticket_id,
718 718
 					'PRC_ID' => $price_id
719 719
 				),
720 720
 				array(
721
-					'%d',//TKT_ID
722
-					'%d',//PRC_ID
723
-				) );
721
+					'%d', //TKT_ID
722
+					'%d', //PRC_ID
723
+				));
724 724
 		return $ticket_id;
725 725
 	}
726 726
 	/**
@@ -731,12 +731,12 @@  discard block
 block discarded – undo
731 731
 	 * @param boolean $count_only_older true if you want the running count (ie, the total up to this row), and false if you want ALL
732 732
 	 * @return int
733 733
 	 */
734
-	private function _sum_old_attendees_on_old_txn($old_attendee_row,$count_only_older = false){
734
+	private function _sum_old_attendees_on_old_txn($old_attendee_row, $count_only_older = false) {
735 735
 		global $wpdb;
736
-		$count_only_older_sql = $count_only_older ? $wpdb->prepare(" AND id<%d",$old_attendee_row['id']) : '';
737
-		$count = intval($wpdb->get_var($wpdb->prepare("SELECT SUM(quantity) FROM ".$this->_old_table." WHERE registration_id=%s $count_only_older_sql",$old_attendee_row['registration_id'])));
736
+		$count_only_older_sql = $count_only_older ? $wpdb->prepare(" AND id<%d", $old_attendee_row['id']) : '';
737
+		$count = intval($wpdb->get_var($wpdb->prepare("SELECT SUM(quantity) FROM ".$this->_old_table." WHERE registration_id=%s $count_only_older_sql", $old_attendee_row['registration_id'])));
738 738
 
739
-		if( $this->_mer_tables_exist()){
739
+		if ($this->_mer_tables_exist()) {
740 740
 			//if MER exists, then its a little tricky.
741 741
 			//when users registered by adding items to the cart, and it was a
742 742
 			//group registration requiring additional attendee INFO, then the attendee rows
@@ -745,17 +745,17 @@  discard block
 block discarded – undo
745 745
 			//BUT we want to count all the MER attendee rows for the same registration
746 746
 			$primary_attendee = $this->_find_mer_primary_attendee_using_mer_tables($old_attendee_row['registration_id']);
747 747
 
748
-			$count_using_mer_table = $wpdb->get_var($wpdb->prepare("SELECT SUM(quantity) FROM {$this->_old_table} att INNER JOIN {$this->_old_mer_table} mer ON att.registration_id = mer.registration_id WHERE att.event_id=%d AND mer.primary_registration_id = %s $count_only_older_sql",$old_attendee_row['event_id'],$primary_attendee['registration_id']));
749
-			$count = max($count_using_mer_table,$count);
748
+			$count_using_mer_table = $wpdb->get_var($wpdb->prepare("SELECT SUM(quantity) FROM {$this->_old_table} att INNER JOIN {$this->_old_mer_table} mer ON att.registration_id = mer.registration_id WHERE att.event_id=%d AND mer.primary_registration_id = %s $count_only_older_sql", $old_attendee_row['event_id'], $primary_attendee['registration_id']));
749
+			$count = max($count_using_mer_table, $count);
750 750
 		}
751 751
 		return $count;
752 752
 	}
753
-	private function _insert_new_payment($old_attendee,$new_txn_id){
753
+	private function _insert_new_payment($old_attendee, $new_txn_id) {
754 754
 		global $wpdb;
755 755
 		//only add a payment for primary attendees
756
-		$old_pay_stati_indicating_no_payment = array('Pending','Incomplete','Not Completed');
756
+		$old_pay_stati_indicating_no_payment = array('Pending', 'Incomplete', 'Not Completed');
757 757
 		//if this is for a primary 3.1 attendee which WASN'T free and has a completed, cancelled, or declined payment...
758
-		if(intval($old_attendee['is_primary']) && floatval($old_attendee['total_cost']) && ! in_array($old_attendee['payment_status'], $old_pay_stati_indicating_no_payment)){
758
+		if (intval($old_attendee['is_primary']) && floatval($old_attendee['total_cost']) && ! in_array($old_attendee['payment_status'], $old_pay_stati_indicating_no_payment)) {
759 759
 			$pay_status_mapping = array(
760 760
 				'Completed'=>'PAP',
761 761
 				'Payment Declined'=>'PDC',
@@ -763,41 +763,41 @@  discard block
 block discarded – undo
763 763
 				'Declined'=>'PDC'
764 764
 			);
765 765
 			$by_admin = $old_attendee['payment'] == 'Admin';
766
-			$STS_ID = isset($pay_status_mapping[$old_attendee['payment_status']]) ? $pay_status_mapping[$old_attendee['payment_status']] : 'PFL';//IE, if we don't recognize the status, assume payment failed
766
+			$STS_ID = isset($pay_status_mapping[$old_attendee['payment_status']]) ? $pay_status_mapping[$old_attendee['payment_status']] : 'PFL'; //IE, if we don't recognize the status, assume payment failed
767 767
 			$cols_n_values = array(
768 768
 				'TXN_ID'=>$new_txn_id,
769 769
 				'STS_ID'=>$STS_ID,
770
-				'PAY_timestamp'=>$this->get_migration_script()->convert_date_string_to_utc($this,$old_attendee,$old_attendee['date']),
770
+				'PAY_timestamp'=>$this->get_migration_script()->convert_date_string_to_utc($this, $old_attendee, $old_attendee['date']),
771 771
 				'PAY_method'=>'CART',
772 772
 				'PAY_amount'=>$old_attendee['amount_pd'],
773 773
 				'PAY_gateway'=>$old_attendee['txn_type'],
774 774
 				'PAY_gateway_response'=>'',
775
-				'PAY_txn_id_chq_nmbr'=>substr( $old_attendee['txn_id'], 0, 32 ),
775
+				'PAY_txn_id_chq_nmbr'=>substr($old_attendee['txn_id'], 0, 32),
776 776
 				'PAY_via_admin'=>$by_admin,
777 777
 				'PAY_details'=>$old_attendee['transaction_details']
778 778
 
779 779
 			);
780 780
 			$datatypes = array(
781
-				'%d',//TXN_Id
782
-				'%s',//STS_ID
783
-				'%s',//PAY_timestamp
784
-				'%s',//PAY_method
785
-				'%f',//PAY_amount
786
-				'%s',//PAY_gateway
787
-				'%s',//PAY_gateway_response
788
-				'%s',//PAY_txn_id_chq_nmbr
789
-				'%d',//PAY_via_admin
790
-				'%s',//PAY_details
781
+				'%d', //TXN_Id
782
+				'%s', //STS_ID
783
+				'%s', //PAY_timestamp
784
+				'%s', //PAY_method
785
+				'%f', //PAY_amount
786
+				'%s', //PAY_gateway
787
+				'%s', //PAY_gateway_response
788
+				'%s', //PAY_txn_id_chq_nmbr
789
+				'%d', //PAY_via_admin
790
+				'%s', //PAY_details
791 791
 			);
792
-			$success = $wpdb->insert($this->_new_payment_table,$cols_n_values,$datatypes);
793
-			if ( ! $success){
792
+			$success = $wpdb->insert($this->_new_payment_table, $cols_n_values, $datatypes);
793
+			if ( ! $success) {
794 794
 				$this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_attendee, $this->_new_attendee_cpt_table, $cols_n_values, $datatypes));
795 795
 				return 0;
796 796
 			}
797 797
 			$new_id = $wpdb->insert_id;
798 798
 			return $new_id;
799 799
 
800
-		}else{
800
+		} else {
801 801
 			return 0;
802 802
 		}
803 803
 
@@ -810,12 +810,12 @@  discard block
 block discarded – undo
810 810
 	 * @param type $old_registration_id
811 811
 	 * @return array
812 812
 	 */
813
-	private function _find_mer_primary_attendee_using_mer_tables($old_registration_id){
814
-		if (! $this->_mer_tables_exist()){
813
+	private function _find_mer_primary_attendee_using_mer_tables($old_registration_id) {
814
+		if ( ! $this->_mer_tables_exist()) {
815 815
 			return false;
816 816
 		}
817 817
 		global $wpdb;
818
-		$old_att_for_primary_reg = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$this->_old_mer_table} AS mer INNER JOIN {$this->_old_table} AS att ON mer.primary_registration_id = att.registration_id WHERE mer.registration_id=%s LIMIT 1",$old_registration_id),ARRAY_A);
818
+		$old_att_for_primary_reg = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$this->_old_mer_table} AS mer INNER JOIN {$this->_old_table} AS att ON mer.primary_registration_id = att.registration_id WHERE mer.registration_id=%s LIMIT 1", $old_registration_id), ARRAY_A);
819 819
 return $old_att_for_primary_reg;
820 820
 	}
821 821
 
Please login to merge, or discard this patch.
data_migration_scripts/4_1_0_stages/EE_DMS_4_1_0_event_venue.dmsstage.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -30,20 +30,20 @@  discard block
 block discarded – undo
30 30
 
31 31
  * 
32 32
  */
33
-class EE_DMS_4_1_0_event_venue extends EE_Data_Migration_Script_Stage{
33
+class EE_DMS_4_1_0_event_venue extends EE_Data_Migration_Script_Stage {
34 34
 	private $_old_table;
35 35
 	private $_new_table;
36
-	function _migration_step($num_items=50){
36
+	function _migration_step($num_items = 50) {
37 37
 		
38 38
 		global $wpdb;
39 39
 		$start_at_record = $this->count_records_migrated();
40
-		$rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d",$start_at_record,$num_items),ARRAY_A);
40
+		$rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A);
41 41
 		$items_actually_migrated = 0;
42
-		foreach($rows as $event_venue_rel){
42
+		foreach ($rows as $event_venue_rel) {
43 43
 			$this->_insert_new_event_to_venue_rel($event_venue_rel);
44 44
 			$items_actually_migrated++;
45 45
 		}
46
-		if($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()){
46
+		if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) {
47 47
 			$this->set_completed();
48 48
 		}
49 49
 		return $items_actually_migrated;
@@ -67,26 +67,26 @@  discard block
 block discarded – undo
67 67
 	 * @param array $old_event_venue_rel
68 68
 	 * @return int
69 69
 	 */
70
-	private function _insert_new_event_to_venue_rel($old_event_venue_rel){
70
+	private function _insert_new_event_to_venue_rel($old_event_venue_rel) {
71 71
 		global $wpdb;
72 72
 		$new_event_id = $this->get_migration_script()->get_mapping_new_pk($wpdb->prefix."events_detail", $old_event_venue_rel['event_id'], $wpdb->prefix."posts");
73 73
 		$new_venue_id = $this->get_migration_script()->get_mapping_new_pk($wpdb->prefix."events_venue", $old_event_venue_rel['venue_id'], $wpdb->prefix."posts");
74
-		if( ! $new_event_id){
75
-			$this->add_error(sprintf(__("Could not find 4.1 event id for 3.1 event #%d.", "event_espresso"),$old_event_venue_rel['event_id']));
74
+		if ( ! $new_event_id) {
75
+			$this->add_error(sprintf(__("Could not find 4.1 event id for 3.1 event #%d.", "event_espresso"), $old_event_venue_rel['event_id']));
76 76
 			return 0;
77 77
 		}
78
-		if( ! $new_venue_id){
79
-			$this->add_error(sprintf(__("Could not find 4.1 venue id for 3.1 venue #%d.", "event_espresso"),$old_event_venue_rel['venue_id']));
78
+		if ( ! $new_venue_id) {
79
+			$this->add_error(sprintf(__("Could not find 4.1 venue id for 3.1 venue #%d.", "event_espresso"), $old_event_venue_rel['venue_id']));
80 80
 			return 0;
81 81
 		}
82 82
 		//first ensure there are no other relation entries for this event
83 83
 		//because although EE4 supports it, EE3 didn't really
84
-		$wpdb->delete( $this->_new_table, 
84
+		$wpdb->delete($this->_new_table, 
85 85
 				array(
86 86
 					'EVT_ID' => $new_event_id,
87 87
 				),
88 88
 				array(
89
-					'%d',//EVT_ID
89
+					'%d', //EVT_ID
90 90
 				));
91 91
 //		echo "last query". $wpdb->last_query;die;
92 92
 		$cols_n_values = array(
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 			'EVV_primary'=>true
96 96
 		);
97 97
 		$datatypes = array(
98
-			'%d',//EVT_ID
99
-			'%d',//VNU_ID
100
-			'%d',//EVT_primary
98
+			'%d', //EVT_ID
99
+			'%d', //VNU_ID
100
+			'%d', //EVT_primary
101 101
 		);
102
-		$success = $wpdb->insert($this->_new_table,$cols_n_values,$datatypes);
103
-		if ( ! $success){
102
+		$success = $wpdb->insert($this->_new_table, $cols_n_values, $datatypes);
103
+		if ( ! $success) {
104 104
 			$this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_event_venue_rel, $this->_new_table, $cols_n_values, $datatypes));
105 105
 			return 0;
106 106
 		}
Please login to merge, or discard this patch.