@@ -1,6 +1,6 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | |
| 3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) | 
                                                        |
| 3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) | 
                                                        |
| 4 | 4 |  	exit('NO direct script access allowed'); | 
                                                        
| 5 | 5 | |
| 6 | 6 | /**  | 
                                                        
@@ -58,96 +58,96 @@ discard block  | 
                                                    ||
| 58 | 58 |  			'[CO_GOOGLE_URL]' => esc_html__('Link to organization Google page', 'event_espresso'), | 
                                                        
| 59 | 59 |  			'[CO_LINKEDIN_URL]' => esc_html__('Link to organization LinkedIn page', 'event_espresso'), | 
                                                        
| 60 | 60 |  			'[CO_INSTAGRAM_URL]' => esc_html__('Link to organization Instagram page', 'event_espresso'), | 
                                                        
| 61 | -			'[CO_TAX_NUMBER_*]' => sprintf( esc_html__('This is the shortcode used for displaying any tax number for the company.  %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is.  It defaults to "VAT/Tax Number:".  To change this prefix you do the following format for this shortcode:  [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56.  Also take note that if you have NO number in your settings, the prefix is not output either.', 'event_espresso' ),'<strong>','</strong>') | 
                                                        |
| 61 | +			'[CO_TAX_NUMBER_*]' => sprintf(esc_html__('This is the shortcode used for displaying any tax number for the company.  %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is.  It defaults to "VAT/Tax Number:".  To change this prefix you do the following format for this shortcode:  [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56.  Also take note that if you have NO number in your settings, the prefix is not output either.', 'event_espresso'), '<strong>', '</strong>') | 
                                                        |
| 62 | 62 | );  | 
                                                        
| 63 | 63 | }  | 
                                                        
| 64 | 64 | |
| 65 | 65 | |
| 66 | -	protected function _parser( $shortcode ) { | 
                                                        |
| 66 | +	protected function _parser($shortcode) { | 
                                                        |
| 67 | 67 | |
| 68 | -		switch ( $shortcode ) { | 
                                                        |
| 68 | +		switch ($shortcode) { | 
                                                        |
| 69 | 69 | |
| 70 | 70 | case '[COMPANY]' :  | 
                                                        
| 71 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'name' );  | 
                                                        |
| 71 | +				return EE_Registry::instance()->CFG->organization->get_pretty('name'); | 
                                                        |
| 72 | 72 | break;  | 
                                                        
| 73 | 73 | |
| 74 | 74 | case '[CO_ADD1]' :  | 
                                                        
| 75 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' );  | 
                                                        |
| 75 | +				return EE_Registry::instance()->CFG->organization->get_pretty('address_1'); | 
                                                        |
| 76 | 76 | break;  | 
                                                        
| 77 | 77 | |
| 78 | 78 | case '[CO_ADD2]' :  | 
                                                        
| 79 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' );  | 
                                                        |
| 79 | +				return EE_Registry::instance()->CFG->organization->get_pretty('address_2'); | 
                                                        |
| 80 | 80 | break;  | 
                                                        
| 81 | 81 | |
| 82 | 82 | case '[CO_CITY]' :  | 
                                                        
| 83 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'city' );  | 
                                                        |
| 83 | +				return EE_Registry::instance()->CFG->organization->get_pretty('city'); | 
                                                        |
| 84 | 84 | break;  | 
                                                        
| 85 | 85 | |
| 86 | 86 | case '[CO_STATE]' :  | 
                                                        
| 87 | - $state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( EE_Registry::instance()->CFG->organization->STA_ID );  | 
                                                        |
| 87 | +				$state = EE_Registry::instance()->load_model('State')->get_one_by_ID(EE_Registry::instance()->CFG->organization->STA_ID); | 
                                                        |
| 88 | 88 | return $state->name();  | 
                                                        
| 89 | 89 | break;  | 
                                                        
| 90 | 90 | |
| 91 | 91 | case '[CO_ZIP]' :  | 
                                                        
| 92 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'zip' );  | 
                                                        |
| 92 | +				return EE_Registry::instance()->CFG->organization->get_pretty('zip'); | 
                                                        |
| 93 | 93 | break;  | 
                                                        
| 94 | 94 | |
| 95 | 95 | case '[CO_EMAIL]' :  | 
                                                        
| 96 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'email' );  | 
                                                        |
| 96 | +				return EE_Registry::instance()->CFG->organization->get_pretty('email'); | 
                                                        |
| 97 | 97 | break;  | 
                                                        
| 98 | 98 | |
| 99 | 99 | case '[CO_PHONE]' :  | 
                                                        
| 100 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'phone' );  | 
                                                        |
| 100 | +				return EE_Registry::instance()->CFG->organization->get_pretty('phone'); | 
                                                        |
| 101 | 101 | break;  | 
                                                        
| 102 | 102 | |
| 103 | 103 | case '[CO_LOGO]' :  | 
                                                        
| 104 | - return '<img src="' . EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) . '" id="headerImage" />';  | 
                                                        |
| 104 | +				return '<img src="'.EE_Registry::instance()->CFG->organization->get_pretty('logo_url').'" id="headerImage" />'; | 
                                                        |
| 105 | 105 | break;  | 
                                                        
| 106 | 106 | |
| 107 | 107 | case '[CO_LOGO_URL]' :  | 
                                                        
| 108 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' );  | 
                                                        |
| 108 | +				return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); | 
                                                        |
| 109 | 109 | break;  | 
                                                        
| 110 | 110 | |
| 111 | 111 | case '[CO_FACEBOOK_URL]' :  | 
                                                        
| 112 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' );  | 
                                                        |
| 112 | +				return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); | 
                                                        |
| 113 | 113 | break;  | 
                                                        
| 114 | 114 | |
| 115 | 115 | case '[CO_TWITTER_URL]' :  | 
                                                        
| 116 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' );  | 
                                                        |
| 116 | +				return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); | 
                                                        |
| 117 | 117 | break;  | 
                                                        
| 118 | 118 | |
| 119 | 119 | case '[CO_PINTEREST_URL]' :  | 
                                                        
| 120 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' );  | 
                                                        |
| 120 | +				return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); | 
                                                        |
| 121 | 121 | break;  | 
                                                        
| 122 | 122 | |
| 123 | 123 | case '[CO_LINKEDIN_URL]' :  | 
                                                        
| 124 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' );  | 
                                                        |
| 124 | +				return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); | 
                                                        |
| 125 | 125 | break;  | 
                                                        
| 126 | 126 | |
| 127 | 127 | case '[CO_GOOGLE_URL]' :  | 
                                                        
| 128 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'google' );  | 
                                                        |
| 128 | +				return EE_Registry::instance()->CFG->organization->get_pretty('google'); | 
                                                        |
| 129 | 129 | break;  | 
                                                        
| 130 | 130 | |
| 131 | 131 | case '[CO_INSTAGRAM_URL]' :  | 
                                                        
| 132 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' );  | 
                                                        |
| 132 | +				return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); | 
                                                        |
| 133 | 133 | break;  | 
                                                        
| 134 | 134 | |
| 135 | 135 | }  | 
                                                        
| 136 | 136 | |
| 137 | 137 | //also allow for parameter shortcode  | 
                                                        
| 138 | -		if ( strpos( $shortcode, '[CO_TAX_NUMBER_*' ) !== FALSE ) { | 
                                                        |
| 138 | +		if (strpos($shortcode, '[CO_TAX_NUMBER_*') !== FALSE) { | 
                                                        |
| 139 | 139 | //first see if there is any company tax number set and bail early if not  | 
                                                        
| 140 | 140 | $tax_number = EE_Registry::instance()->CFG->organization->vat;  | 
                                                        
| 141 | -			if ( empty( $tax_number ) ) { | 
                                                        |
| 141 | +			if (empty($tax_number)) { | 
                                                        |
| 142 | 142 | return '';  | 
                                                        
| 143 | 143 | }  | 
                                                        
| 144 | 144 | |
| 145 | 145 | //see if there are any attributes.  | 
                                                        
| 146 | - $attrs = $this->_get_shortcode_attrs( $shortcode );  | 
                                                        |
| 146 | + $attrs = $this->_get_shortcode_attrs($shortcode);  | 
                                                        |
| 147 | 147 | |
| 148 | 148 | //set custom attrs if present (or default)  | 
                                                        
| 149 | -			$prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso'); | 
                                                        |
| 150 | - return $prefix . $tax_number;  | 
                                                        |
| 149 | +			$prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso'); | 
                                                        |
| 150 | + return $prefix.$tax_number;  | 
                                                        |
| 151 | 151 | }  | 
                                                        
| 152 | 152 | |
| 153 | 153 | return '';  | 
                                                        
@@ -1,6 +1,6 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | |
| 3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) | 
                                                        |
| 3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) | 
                                                        |
| 4 | 4 |  	exit('NO direct script access allowed'); | 
                                                        
| 5 | 5 | |
| 6 | 6 | /**  | 
                                                        
@@ -43,19 +43,19 @@ discard block  | 
                                                    ||
| 43 | 43 |  		$this->description = esc_html__('All shortcodes related to emails', 'event_espresso'); | 
                                                        
| 44 | 44 | $this->_shortcodes = array(  | 
                                                        
| 45 | 45 |  			'[SITE_ADMIN_EMAIL]' => esc_html__('Will be replaced with the admin email for the site that Event Espresso is installed on', 'event_espresso'), | 
                                                        
| 46 | -			'[EVENT_AUTHOR_FORMATTED_EMAIL]' => sprintf( esc_html__('This will be replaced with a properly formatted list of Event Creator emails for the events in a registration. %1$sNOTE:%2$s If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', 'event_espresso'),'<strong>','</strong>' ), | 
                                                        |
| 47 | -			'[EVENT_AUTHOR_EMAIL]' => sprintf( esc_html__('This is the same as %1$s shortcode except it is just a list of emails (not fancy headers).', 'event_espresso'), '[EVENT_AUTHOR_FORMATTED_EMAIL]' ), | 
                                                        |
| 48 | -			'[CO_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization <[email protected]>"', 'event_espresso' ), | 
                                                        |
| 46 | +			'[EVENT_AUTHOR_FORMATTED_EMAIL]' => sprintf(esc_html__('This will be replaced with a properly formatted list of Event Creator emails for the events in a registration. %1$sNOTE:%2$s If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', 'event_espresso'), '<strong>', '</strong>'), | 
                                                        |
| 47 | +			'[EVENT_AUTHOR_EMAIL]' => sprintf(esc_html__('This is the same as %1$s shortcode except it is just a list of emails (not fancy headers).', 'event_espresso'), '[EVENT_AUTHOR_FORMATTED_EMAIL]'), | 
                                                        |
| 48 | +			'[CO_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization <[email protected]>"', 'event_espresso'), | 
                                                        |
| 49 | 49 |  			'[CO_EMAIL]' => esc_html__('This will parse to the email address only for the organization set in Your Organization Settings.', 'event_espresso'), | 
                                                        
| 50 | -			'[ESPRESSO_ADMIN_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization <[email protected]>"', 'event_espresso' ), | 
                                                        |
| 50 | +			'[ESPRESSO_ADMIN_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization <[email protected]>"', 'event_espresso'), | 
                                                        |
| 51 | 51 |  			'[ESPRESSO_ADMIN_EMAIL]' => esc_html__('This parses to the email address only for the organization set in Your Organization Settings page.', 'event_espresso') | 
                                                        
| 52 | 52 | );  | 
                                                        
| 53 | 53 | }  | 
                                                        
| 54 | 54 | |
| 55 | 55 | |
| 56 | -	protected function _parser( $shortcode ) { | 
                                                        |
| 56 | +	protected function _parser($shortcode) { | 
                                                        |
| 57 | 57 | |
| 58 | -		switch ( $shortcode ) { | 
                                                        |
| 58 | +		switch ($shortcode) { | 
                                                        |
| 59 | 59 | |
| 60 | 60 | case '[SITE_ADMIN_EMAIL]' :  | 
                                                        
| 61 | 61 | return $this->_get_site_admin_email();  | 
                                                        
@@ -66,17 +66,17 @@ discard block  | 
                                                    ||
| 66 | 66 | break;  | 
                                                        
| 67 | 67 | |
| 68 | 68 | case '[EVENT_AUTHOR_EMAIL]' :  | 
                                                        
| 69 | - return $this->_get_event_admin_emails( FALSE );  | 
                                                        |
| 69 | + return $this->_get_event_admin_emails(FALSE);  | 
                                                        |
| 70 | 70 | break;  | 
                                                        
| 71 | 71 | |
| 72 | 72 | case '[CO_FORMATTED_EMAIL]' :  | 
                                                        
| 73 | 73 | case '[ESPRESSO_ADMIN_FORMATTED_EMAIL]' :  | 
                                                        
| 74 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) . '>';  | 
                                                        |
| 74 | +				return EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.EE_Registry::instance()->CFG->organization->get_pretty('email').'>'; | 
                                                        |
| 75 | 75 | break;  | 
                                                        
| 76 | 76 | |
| 77 | 77 | case '[CO_EMAIL]' :  | 
                                                        
| 78 | 78 | case '[ESPRESSO_ADMIN_EMAIL]' :  | 
                                                        
| 79 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'email' );  | 
                                                        |
| 79 | +				return EE_Registry::instance()->CFG->organization->get_pretty('email'); | 
                                                        |
| 80 | 80 | break;  | 
                                                        
| 81 | 81 | |
| 82 | 82 | default :  | 
                                                        
@@ -98,12 +98,12 @@ discard block  | 
                                                    ||
| 98 | 98 | }  | 
                                                        
| 99 | 99 | |
| 100 | 100 | |
| 101 | -	private function _get_event_admin_emails( $fancy_headers = TRUE ) { | 
                                                        |
| 101 | +	private function _get_event_admin_emails($fancy_headers = TRUE) { | 
                                                        |
| 102 | 102 | |
| 103 | -		if ( !empty( $this->_data->admin_email ) ) { | 
                                                        |
| 104 | - if ( ! $fancy_headers )  | 
                                                        |
| 103 | +		if ( ! empty($this->_data->admin_email)) { | 
                                                        |
| 104 | + if ( ! $fancy_headers)  | 
                                                        |
| 105 | 105 | return $this->_data->admin_email;  | 
                                                        
| 106 | - return !empty( $this->_data->fname ) ? $this->_data->fname . ' ' . $this->_data->lname . ' <' . $this->_data->admin_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $this->_data->admin_email . '>';  | 
                                                        |
| 106 | +			return ! empty($this->_data->fname) ? $this->_data->fname.' '.$this->_data->lname.' <'.$this->_data->admin_email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.$this->_data->admin_email.'>'; | 
                                                        |
| 107 | 107 | }  | 
                                                        
| 108 | 108 | |
| 109 | 109 | //k this shortcode has been used else where. Since we don't know what particular event this is for, let's loop through the events and get an array of event admins for the events. We'll return the formatted list of admin emails and let the messenger make sure we only pick one if this is for a field that can only have ONE!.  | 
                                                        
@@ -111,18 +111,18 @@ discard block  | 
                                                    ||
| 111 | 111 | $admin_email = array();  | 
                                                        
| 112 | 112 | |
| 113 | 113 | //loop through events and set the list of event_ids to retrieve so we can do ONE query.  | 
                                                        
| 114 | -		foreach ( $this->_data->events as $event ) { | 
                                                        |
| 114 | +		foreach ($this->_data->events as $event) { | 
                                                        |
| 115 | 115 | $ids[] = $event['ID'];  | 
                                                        
| 116 | 116 | }  | 
                                                        
| 117 | 117 | |
| 118 | 118 | //get all the events  | 
                                                        
| 119 | -		$events = EE_Registry::instance()->load_model('Event')->get_all( array(array('EVT_ID' => array('IN', $ids ) ) ) ); | 
                                                        |
| 119 | +		$events = EE_Registry::instance()->load_model('Event')->get_all(array(array('EVT_ID' => array('IN', $ids)))); | 
                                                        |
| 120 | 120 | |
| 121 | 121 | //now loop through each event and setup the details  | 
                                                        
| 122 | 122 | $admin_details = array();  | 
                                                        
| 123 | 123 | $cnt = 0;  | 
                                                        
| 124 | -		foreach ( $events as $event ) { | 
                                                        |
| 125 | -			$user = get_userdata($event->get('EVT_wp_user') ); | 
                                                        |
| 124 | +		foreach ($events as $event) { | 
                                                        |
| 125 | +			$user = get_userdata($event->get('EVT_wp_user')); | 
                                                        |
| 126 | 126 | $admin_details[$cnt] = new stdClass();  | 
                                                        
| 127 | 127 | $admin_details[$cnt]->email = $user->user_email;  | 
                                                        
| 128 | 128 | $admin_details[$cnt]->first_name = $user->user_firstname;  | 
                                                        
@@ -131,28 +131,28 @@ discard block  | 
                                                    ||
| 131 | 131 | }  | 
                                                        
| 132 | 132 | |
| 133 | 133 | //results?  | 
                                                        
| 134 | -		if ( empty($admin_details) || !is_array($admin_details) ) { | 
                                                        |
| 134 | +		if (empty($admin_details) || ! is_array($admin_details)) { | 
                                                        |
| 135 | 135 |  			$msg[] = esc_html__('The admin details could not be retrieved from the database.', 'event_espresso'); | 
                                                        
| 136 | -			$msg[] = sprintf( esc_html__('Query: %s', 'event_espresso'), $sql ); | 
                                                        |
| 137 | -			$msg[] = sprintf( esc_html__('Events Data: %s', 'event_espresso'), var_export($this->_data->events, TRUE) ); | 
                                                        |
| 138 | -			$msg[] = sprintf( esc_html__('Event IDS: %s', 'event_espresso'), var_export($ids, TRUE) ); | 
                                                        |
| 139 | -			$msg[] = sprintf( esc_html__('Query Results: %s', 'event_espresso'), var_export($admin_details) ); | 
                                                        |
| 140 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, implode( PHP_EOL, $msg ), 'shortcode_parser' );  | 
                                                        |
| 136 | +			$msg[] = sprintf(esc_html__('Query: %s', 'event_espresso'), $sql); | 
                                                        |
| 137 | +			$msg[] = sprintf(esc_html__('Events Data: %s', 'event_espresso'), var_export($this->_data->events, TRUE)); | 
                                                        |
| 138 | +			$msg[] = sprintf(esc_html__('Event IDS: %s', 'event_espresso'), var_export($ids, TRUE)); | 
                                                        |
| 139 | +			$msg[] = sprintf(esc_html__('Query Results: %s', 'event_espresso'), var_export($admin_details)); | 
                                                        |
| 140 | +			do_action('AHEE_log', __FILE__, __FUNCTION__, implode(PHP_EOL, $msg), 'shortcode_parser'); | 
                                                        |
| 141 | 141 | }  | 
                                                        
| 142 | 142 | |
| 143 | -		foreach ( $admin_details as $admin ) { | 
                                                        |
| 143 | +		foreach ($admin_details as $admin) { | 
                                                        |
| 144 | 144 | //only add an admin email if it is present.  | 
                                                        
| 145 | - if ( empty( $admin->email ) || $admin->email == '' ) continue;  | 
                                                        |
| 145 | + if (empty($admin->email) || $admin->email == '') continue;  | 
                                                        |
| 146 | 146 | |
| 147 | -			if ( ! $fancy_headers ) { | 
                                                        |
| 147 | +			if ( ! $fancy_headers) { | 
                                                        |
| 148 | 148 | $admin_email[] = $admin->email;  | 
                                                        
| 149 | 149 | continue;  | 
                                                        
| 150 | 150 | }  | 
                                                        
| 151 | 151 | |
| 152 | - $admin_email[] = !empty( $admin->first_name ) ? $admin->first_name . ' ' . $admin->last_name . ' <' . $admin->email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $admin->email . '>';  | 
                                                        |
| 152 | +			$admin_email[] = ! empty($admin->first_name) ? $admin->first_name.' '.$admin->last_name.' <'.$admin->email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.$admin->email.'>'; | 
                                                        |
| 153 | 153 | }  | 
                                                        
| 154 | 154 | |
| 155 | - $admin_email = implode( ',', $admin_email );  | 
                                                        |
| 155 | +		$admin_email = implode(',', $admin_email); | 
                                                        |
| 156 | 156 | return $admin_email;  | 
                                                        
| 157 | 157 | }  | 
                                                        
| 158 | 158 | |
@@ -1,6 +1,6 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | |
| 3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) | 
                                                        |
| 3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) | 
                                                        |
| 4 | 4 |  	exit('NO direct script access allowed'); | 
                                                        
| 5 | 5 | |
| 6 | 6 | /**  | 
                                                        
@@ -42,25 +42,25 @@ discard block  | 
                                                    ||
| 42 | 42 | $this->_shortcodes = array(  | 
                                                        
| 43 | 43 |  			'[TXN_ID]' => esc_html__('The transaction id for the purchase.', 'event_espresso'), | 
                                                        
| 44 | 44 |  			'[PAYMENT_URL]' => esc_html__('This is a link to make a payment for the event', 'event_espresso'), | 
                                                        
| 45 | -			'[PAYMENT_LINK_IF_NEEDED_*]' => esc_html__('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso') . '<ul>' | 
                                                        |
| 46 | -				. '<li>' . sprintf( esc_html__('%sclass:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' | 
                                                        |
| 47 | -				. '<li>' . sprintf( esc_html__('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' | 
                                                        |
| 48 | -				. '<li>' . sprintf( esc_html__('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' | 
                                                        |
| 45 | +			'[PAYMENT_LINK_IF_NEEDED_*]' => esc_html__('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso').'<ul>' | 
                                                        |
| 46 | +				. '<li>'.sprintf(esc_html__('%sclass:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso'), '<strong>', '</strong>').'</li>' | 
                                                        |
| 47 | +				. '<li>'.sprintf(esc_html__('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso'), '<strong>', '</strong>').'</li>' | 
                                                        |
| 48 | +				. '<li>'.sprintf(esc_html__('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso'), '<strong>', '</strong>').'</li>' | 
                                                        |
| 49 | 49 | . '</ul>',  | 
                                                        
| 50 | - '[PAYMENT_DUE_DATE_*]' => esc_html__( 'This is a special dynamic shortcode that allows one to output a payment due date. It will only result in a date shown if there is money owing. Three parameters are available on this shortcode:', 'event_espresso' )  | 
                                                        |
| 50 | +			'[PAYMENT_DUE_DATE_*]' => esc_html__('This is a special dynamic shortcode that allows one to output a payment due date.  It will only result in a date shown if there is money owing.  Three parameters are available on this shortcode:', 'event_espresso') | 
                                                        |
| 51 | 51 | . '<ul>'  | 
                                                        
| 52 | - . '<li>' . sprintf( esc_html__( '%sformat:%s This is used to indicate what format the date is in. Default is whatever is set as date formats for your website.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'  | 
                                                        |
| 53 | - . '<li>' . sprintf( esc_html__( '%sdays_until_due:%s This is the number of days form the transaction creation date that the payment is due. Defaults to 30.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'  | 
                                                        |
| 54 | - . '<li>' . sprintf( esc_html__( '%sprefix_text:%s You can use this to indicate what text will prefix the date string. Defaults to "Payment in full due by:"', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>',  | 
                                                        |
| 52 | +				. '<li>'.sprintf(esc_html__('%sformat:%s This is used to indicate what format the date is in.  Default is whatever is set as date formats for your website.', 'event_espresso'), '<strong>', '</strong>').'</li>' | 
                                                        |
| 53 | +				. '<li>'.sprintf(esc_html__('%sdays_until_due:%s This is the number of days form the transaction creation date that the payment is due.  Defaults to 30.', 'event_espresso'), '<strong>', '</strong>').'</li>' | 
                                                        |
| 54 | +				. '<li>'.sprintf(esc_html__('%sprefix_text:%s You can use this to indicate what text will prefix the date string.  Defaults to "Payment in full due by:"', 'event_espresso'), '<strong>', '</strong>').'</li>', | 
                                                        |
| 55 | 55 |  			'[INVOICE_LINK]' => esc_html__('This is a full html link to the invoice', 'event_espresso'), | 
                                                        
| 56 | 56 |  			'[INVOICE_URL]' => esc_html__('This is just the url for the invoice', 'event_espresso'), | 
                                                        
| 57 | 57 |  			'[INVOICE_LOGO_URL]' => esc_html__('This returns the url for the logo uploaded via the invoice settings page.', 'event_espresso'), | 
                                                        
| 58 | 58 |  			'[INVOICE_LOGO]' => esc_html__('This returns the logo uploaded via the invoice settings page wrapped in img_tags and with a "logo screen" classes. The image size is also set in the img tags automatically to match the uploaded logo.', 'event_espresso'), | 
                                                        
| 59 | 59 |  			'[INVOICE_PAYEE_NAME]' => esc_html__('This will parse to either: the value of the "Company Name" field in the invoice payment method settings; if that is blank, then the value of the Company Name in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'), | 
                                                        
| 60 | -			'[INVOICE_PAYEE_ADDRESS]' => esc_html__('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ), | 
                                                        |
| 61 | -			'[INVOICE_PAYMENT_INSTRUCTIONS]' => esc_html__('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso' ), | 
                                                        |
| 62 | -			'[INVOICE_PAYEE_EMAIL]' => esc_html__('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ), | 
                                                        |
| 63 | -			'[INVOICE_PAYEE_TAX_NUMBER_*]' => sprintf( esc_html__('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number.  It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: %1$s[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]%2$s and that will ouptut: GST: 12345t56.  If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso' ), '<code>', '</code>' ), | 
                                                        |
| 60 | +			'[INVOICE_PAYEE_ADDRESS]' => esc_html__('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'), | 
                                                        |
| 61 | +			'[INVOICE_PAYMENT_INSTRUCTIONS]' => esc_html__('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso'), | 
                                                        |
| 62 | +			'[INVOICE_PAYEE_EMAIL]' => esc_html__('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'), | 
                                                        |
| 63 | +			'[INVOICE_PAYEE_TAX_NUMBER_*]' => sprintf(esc_html__('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number.  It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: %1$s[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]%2$s and that will ouptut: GST: 12345t56.  If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso'), '<code>', '</code>'), | 
                                                        |
| 64 | 64 |  			'[TOTAL_COST]' => esc_html__('The total cost for the transaction', 'event_espresso'), | 
                                                        
| 65 | 65 |  			'[TXN_STATUS]' => esc_html__('The transaction status for the transaction.', 'event_espresso'), | 
                                                        
| 66 | 66 |  			'[TXN_STATUS_ID]' => esc_html__('The ID representing the transaction status as saved in the db.  This tends to be useful for including with css classes for styling certain statuses differently from others.', 'event_espresso'), | 
                                                        
@@ -71,52 +71,52 @@ discard block  | 
                                                    ||
| 71 | 71 |  			'[TOTAL_OWING]' => esc_html__('The total owing on a transaction with no attributes.', 'event_espresso'), | 
                                                        
| 72 | 72 |  			'[TXN_SUBTOTAL]' => esc_html__('The subtotal for all txn line items.', 'event_espresso'), | 
                                                        
| 73 | 73 |  			'[TXN_TAX_SUBTOTAL]' => esc_html__('The subtotal for all tax line items.', 'event_espresso'), | 
                                                        
| 74 | -			'[OWING_STATUS_MESSAGE_*]' => esc_html__('A dynamic shortcode for adjusting how total oweing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso') . '<p></ul>' . | 
                                                        |
| 75 | -				'<li><strong>still_owing</strong>:' . esc_html__('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount oweing). The default is:', 'event_espresso' ) . sprintf( esc_html__( '%sPlease make a payment.%s', 'event_espresso'),  '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' ) . '</li>' . | 
                                                        |
| 76 | -				'<li><strong>none_owing</strong>:' . esc_html__('If the transaction is paid in full, then you can indicate how this gets displayed.  Note, that it defaults to just be the total oweing.', 'event_espresso') . '</li></ul></p>', | 
                                                        |
| 74 | +			'[OWING_STATUS_MESSAGE_*]' => esc_html__('A dynamic shortcode for adjusting how total oweing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso').'<p></ul>'. | 
                                                        |
| 75 | +				'<li><strong>still_owing</strong>:'.esc_html__('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount oweing). The default is:', 'event_espresso').sprintf(esc_html__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>').'</li>'. | 
                                                        |
| 76 | +				'<li><strong>none_owing</strong>:'.esc_html__('If the transaction is paid in full, then you can indicate how this gets displayed.  Note, that it defaults to just be the total oweing.', 'event_espresso').'</li></ul></p>', | 
                                                        |
| 77 | 77 |  			'[TXN_TOTAL_TICKETS]' => esc_html__('The total number of all tickets purchased in a transaction', 'event_espresso'), | 
                                                        
| 78 | -			'[TKT_QTY_PURCHASED]' => sprintf( esc_html__('The total number of all tickets purchased in a transaction. %1$sNOTE: This shortcode is good to use in the "[TICKET_LIST]" field but has been deprecated from all other contexts in favor of the more explicit [TXN_TOTAL_TICKETS] shortcode.%2$s', 'event_espresso'), '<strong>', '</strong>' ), | 
                                                        |
| 78 | +			'[TKT_QTY_PURCHASED]' => sprintf(esc_html__('The total number of all tickets purchased in a transaction. %1$sNOTE: This shortcode is good to use in the "[TICKET_LIST]" field but has been deprecated from all other contexts in favor of the more explicit [TXN_TOTAL_TICKETS] shortcode.%2$s', 'event_espresso'), '<strong>', '</strong>'), | 
                                                        |
| 79 | 79 |  			'[TRANSACTION_ADMIN_URL]' => esc_html__('The url to the admin page for this transaction', 'event_espresso'), | 
                                                        
| 80 | 80 |  			'[RECEIPT_URL]' => esc_html__('This parses to the generated url for retrieving the receipt for the transaction', 'event_espresso'), | 
                                                        
| 81 | - '[INVOICE_RECEIPT_SWITCHER_URL]' => esc_html__( 'This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active then will parse to an empty string.', 'event_espresso'),  | 
                                                        |
| 82 | - '[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf( esc_html__( 'The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso' ), '<code>', '</code>' )  | 
                                                        |
| 81 | +			'[INVOICE_RECEIPT_SWITCHER_URL]' => esc_html__('This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active  then will parse to an empty string.', 'event_espresso'), | 
                                                        |
| 82 | +			'[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf(esc_html__('The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso'), '<code>', '</code>') | 
                                                        |
| 83 | 83 | );  | 
                                                        
| 84 | 84 | }  | 
                                                        
| 85 | 85 | |
| 86 | 86 | |
| 87 | -	protected function _parser( $shortcode ) { | 
                                                        |
| 87 | +	protected function _parser($shortcode) { | 
                                                        |
| 88 | 88 | |
| 89 | 89 | //attempt to get the transaction. Since this is potentially used in more fields, we may have to look in the _extra_data for the transaction.  | 
                                                        
| 90 | 90 | $transaction = $this->_data->txn instanceof EE_Transaction ? $this->_data->txn : null;  | 
                                                        
| 91 | - $transaction = ! $transaction instanceof EE_Transaction && is_array( $this->_extra_data ) && isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn: $transaction;  | 
                                                        |
| 91 | + $transaction = ! $transaction instanceof EE_Transaction && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn : $transaction;  | 
                                                        |
| 92 | 92 | |
| 93 | 93 | //payment  | 
                                                        
| 94 | 94 | $payment = $this->_data->payment instanceof EE_Payment ? $this->_data->payment : null;  | 
                                                        
| 95 | - $payment = ! $payment instanceof EE_Payment && is_array( $this->_extra_data ) && isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment: $payment;  | 
                                                        |
| 95 | + $payment = ! $payment instanceof EE_Payment && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment : $payment;  | 
                                                        |
| 96 | 96 | |
| 97 | 97 | |
| 98 | - if ( ! $transaction instanceof EE_Transaction )  | 
                                                        |
| 98 | + if ( ! $transaction instanceof EE_Transaction)  | 
                                                        |
| 99 | 99 | return '';  | 
                                                        
| 100 | 100 | |
| 101 | -		switch ( $shortcode ) { | 
                                                        |
| 101 | +		switch ($shortcode) { | 
                                                        |
| 102 | 102 | case '[TXN_ID]' :  | 
                                                        
| 103 | 103 | return $transaction->ID();  | 
                                                        
| 104 | 104 | break;  | 
                                                        
| 105 | 105 | |
| 106 | 106 | case '[PAYMENT_URL]' :  | 
                                                        
| 107 | 107 | $payment_url = $transaction->payment_overview_url();  | 
                                                        
| 108 | - return empty( $payment_url ) ? esc_html__( 'http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url;  | 
                                                        |
| 108 | +				return empty($payment_url) ? esc_html__('http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url; | 
                                                        |
| 109 | 109 | break;  | 
                                                        
| 110 | 110 | |
| 111 | 111 | case '[INVOICE_LINK]' :  | 
                                                        
| 112 | 112 | $invoice_url = $transaction->invoice_url();  | 
                                                        
| 113 | - $invoice_url = empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;  | 
                                                        |
| 114 | -				return sprintf( esc_html__('%sClick here for Invoice%s', 'event_espresso'), '<a href="' . $invoice_url . '">', '</a>' ); | 
                                                        |
| 113 | + $invoice_url = empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;  | 
                                                        |
| 114 | +				return sprintf(esc_html__('%sClick here for Invoice%s', 'event_espresso'), '<a href="'.$invoice_url.'">', '</a>'); | 
                                                        |
| 115 | 115 | break; /**/  | 
                                                        
| 116 | 116 | |
| 117 | 117 | case '[INVOICE_URL]' :  | 
                                                        
| 118 | 118 | $invoice_url = $transaction->invoice_url();  | 
                                                        
| 119 | - return empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;  | 
                                                        |
| 119 | + return empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;  | 
                                                        |
| 120 | 120 | break;  | 
                                                        
| 121 | 121 | |
| 122 | 122 | case '[INVOICE_LOGO_URL]' :  | 
                                                        
@@ -124,7 +124,7 @@ discard block  | 
                                                    ||
| 124 | 124 | break;  | 
                                                        
| 125 | 125 | |
| 126 | 126 | case '[INVOICE_LOGO]' :  | 
                                                        
| 127 | - return $this->_get_invoice_logo( TRUE );  | 
                                                        |
| 127 | + return $this->_get_invoice_logo(TRUE);  | 
                                                        |
| 128 | 128 | break;  | 
                                                        
| 129 | 129 | |
| 130 | 130 | case '[INVOICE_PAYEE_NAME]' :  | 
                                                        
@@ -146,18 +146,18 @@ discard block  | 
                                                    ||
| 146 | 146 | |
| 147 | 147 | case "[TOTAL_COST]" :  | 
                                                        
| 148 | 148 | $total = $transaction->total();  | 
                                                        
| 149 | - return ! empty($total) ? EEH_Template::format_currency( $total ) : '';  | 
                                                        |
| 149 | + return ! empty($total) ? EEH_Template::format_currency($total) : '';  | 
                                                        |
| 150 | 150 | break;  | 
                                                        
| 151 | 151 | |
| 152 | 152 | case "[PAYMENT_STATUS]" :  | 
                                                        
| 153 | 153 | $status = $transaction->pretty_status();  | 
                                                        
| 154 | -				return !empty($status) ? $status : esc_html__('Unknown', 'event_espresso'); | 
                                                        |
| 154 | +				return ! empty($status) ? $status : esc_html__('Unknown', 'event_espresso'); | 
                                                        |
| 155 | 155 | break; /**/  | 
                                                        
| 156 | 156 | |
| 157 | 157 | // note the [payment_status] shortcode is kind of misleading because payment status might be different from txn status so I'm adding this here for clarity.  | 
                                                        
| 158 | 158 | case "[TXN_STATUS]" :  | 
                                                        
| 159 | 159 | $status = $transaction->pretty_status();  | 
                                                        
| 160 | -				return !empty( $status ) ? $status : esc_html__('Unknown', 'event_espresso'); | 
                                                        |
| 160 | +				return ! empty($status) ? $status : esc_html__('Unknown', 'event_espresso'); | 
                                                        |
| 161 | 161 | break;  | 
                                                        
| 162 | 162 | |
| 163 | 163 | case "[TXN_STATUS_ID]" :  | 
                                                        
@@ -165,21 +165,21 @@ discard block  | 
                                                    ||
| 165 | 165 | break;  | 
                                                        
| 166 | 166 | |
| 167 | 167 | case "[PAYMENT_GATEWAY]" :  | 
                                                        
| 168 | - return $this->_get_payment_gateway( $transaction );  | 
                                                        |
| 168 | + return $this->_get_payment_gateway($transaction);  | 
                                                        |
| 169 | 169 | break;  | 
                                                        
| 170 | 170 | |
| 171 | 171 | case "[AMOUNT_PAID]" :  | 
                                                        
| 172 | 172 | $amount = $payment instanceof EE_Payment ? $payment->amount() : 0;  | 
                                                        
| 173 | - return EEH_Template::format_currency( $amount );  | 
                                                        |
| 173 | + return EEH_Template::format_currency($amount);  | 
                                                        |
| 174 | 174 | break;  | 
                                                        
| 175 | 175 | |
| 176 | 176 | case "[TOTAL_AMOUNT_PAID]" :  | 
                                                        
| 177 | - return EEH_Template::format_currency( $transaction->paid() );  | 
                                                        |
| 177 | + return EEH_Template::format_currency($transaction->paid());  | 
                                                        |
| 178 | 178 | break;  | 
                                                        
| 179 | 179 | |
| 180 | 180 | case "[TOTAL_OWING]" :  | 
                                                        
| 181 | 181 | $total_owing = $transaction->remaining();  | 
                                                        
| 182 | - return EEH_Template::format_currency( $total_owing );  | 
                                                        |
| 182 | + return EEH_Template::format_currency($total_owing);  | 
                                                        |
| 183 | 183 | break;  | 
                                                        
| 184 | 184 | |
| 185 | 185 | case "[TXN_SUBTOTAL]" :  | 
                                                        
@@ -187,7 +187,7 @@ discard block  | 
                                                    ||
| 187 | 187 | break;  | 
                                                        
| 188 | 188 | |
| 189 | 189 | case "[TXN_TAX_SUBTOTAL]" :  | 
                                                        
| 190 | - return EEH_Template::format_currency($this->_get_subtotal( TRUE ));  | 
                                                        |
| 190 | + return EEH_Template::format_currency($this->_get_subtotal(TRUE));  | 
                                                        |
| 191 | 191 | break;  | 
                                                        
| 192 | 192 | |
| 193 | 193 | case "[TKT_QTY_PURCHASED]" :  | 
                                                        
@@ -196,9 +196,9 @@ discard block  | 
                                                    ||
| 196 | 196 | break;  | 
                                                        
| 197 | 197 | |
| 198 | 198 | case "[TRANSACTION_ADMIN_URL]" :  | 
                                                        
| 199 | - require_once EE_CORE . 'admin/EE_Admin_Page.core.php';  | 
                                                        |
| 200 | - $query_args = array( 'page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID() );  | 
                                                        |
| 201 | -				$url = EE_Admin_Page::add_query_args_and_nonce( $query_args, admin_url('admin.php') ); | 
                                                        |
| 199 | + require_once EE_CORE.'admin/EE_Admin_Page.core.php';  | 
                                                        |
| 200 | +				$query_args = array('page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID()); | 
                                                        |
| 201 | +				$url = EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php')); | 
                                                        |
| 202 | 202 | return $url;  | 
                                                        
| 203 | 203 | break;  | 
                                                        
| 204 | 204 | |
@@ -206,14 +206,14 @@ discard block  | 
                                                    ||
| 206 | 206 | //get primary_registration  | 
                                                        
| 207 | 207 | $reg = $this->_data->primary_reg_obj;  | 
                                                        
| 208 | 208 | |
| 209 | -				if ( ! $reg instanceof EE_Registration ) { | 
                                                        |
| 209 | +				if ( ! $reg instanceof EE_Registration) { | 
                                                        |
| 210 | 210 | return '';  | 
                                                        
| 211 | 211 | }  | 
                                                        
| 212 | 212 | return $reg->receipt_url();  | 
                                                        
| 213 | 213 | break;  | 
                                                        
| 214 | 214 | |
| 215 | 215 | case "[INVOICE_RECEIPT_SWITCHER_URL]" :  | 
                                                        
| 216 | - return $this->_get_invoice_receipt_switcher( FALSE );  | 
                                                        |
| 216 | + return $this->_get_invoice_receipt_switcher(FALSE);  | 
                                                        |
| 217 | 217 | break;  | 
                                                        
| 218 | 218 | |
| 219 | 219 | case "[INVOICE_RECEIPT_SWITCHER_BUTTON]" :  | 
                                                        
@@ -223,20 +223,20 @@ discard block  | 
                                                    ||
| 223 | 223 | |
| 224 | 224 | }  | 
                                                        
| 225 | 225 | |
| 226 | -		if ( strpos( $shortcode, '[OWING_STATUS_MESSAGE_*' ) !== FALSE ) { | 
                                                        |
| 227 | - return $this->_get_custom_total_oweing( $shortcode );  | 
                                                        |
| 226 | +		if (strpos($shortcode, '[OWING_STATUS_MESSAGE_*') !== FALSE) { | 
                                                        |
| 227 | + return $this->_get_custom_total_oweing($shortcode);  | 
                                                        |
| 228 | 228 | }  | 
                                                        
| 229 | 229 | |
| 230 | -		if ( strpos( $shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*' ) !== FALSE ) { | 
                                                        |
| 231 | - return $this->_get_invoice_payee_tax_number( $shortcode );  | 
                                                        |
| 230 | +		if (strpos($shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*') !== FALSE) { | 
                                                        |
| 231 | + return $this->_get_invoice_payee_tax_number($shortcode);  | 
                                                        |
| 232 | 232 | }  | 
                                                        
| 233 | 233 | |
| 234 | -		if ( strpos( $shortcode, '[PAYMENT_LINK_IF_NEEDED_*' ) !== FALSE ) { | 
                                                        |
| 235 | - return $this->_get_payment_link_if_needed( $shortcode );  | 
                                                        |
| 234 | +		if (strpos($shortcode, '[PAYMENT_LINK_IF_NEEDED_*') !== FALSE) { | 
                                                        |
| 235 | + return $this->_get_payment_link_if_needed($shortcode);  | 
                                                        |
| 236 | 236 | }  | 
                                                        
| 237 | 237 | |
| 238 | -		if ( strpos( $shortcode, '[PAYMENT_DUE_DATE_*' ) !== false ) { | 
                                                        |
| 239 | - return $this->_get_payment_due_date( $shortcode, $transaction );  | 
                                                        |
| 238 | +		if (strpos($shortcode, '[PAYMENT_DUE_DATE_*') !== false) { | 
                                                        |
| 239 | + return $this->_get_payment_due_date($shortcode, $transaction);  | 
                                                        |
| 240 | 240 | }  | 
                                                        
| 241 | 241 | |
| 242 | 242 | return '';  | 
                                                        
@@ -253,19 +253,19 @@ discard block  | 
                                                    ||
| 253 | 253 | *  | 
                                                        
| 254 | 254 | * @return string parsed.  | 
                                                        
| 255 | 255 | */  | 
                                                        
| 256 | -	private function _get_custom_total_oweing( $shortcode ) { | 
                                                        |
| 257 | - $valid_shortcodes = array( 'transaction' );  | 
                                                        |
| 258 | - $attrs = $this->_get_shortcode_attrs( $shortcode );  | 
                                                        |
| 256 | +	private function _get_custom_total_oweing($shortcode) { | 
                                                        |
| 257 | +		$valid_shortcodes = array('transaction'); | 
                                                        |
| 258 | + $attrs = $this->_get_shortcode_attrs($shortcode);  | 
                                                        |
| 259 | 259 | |
| 260 | 260 | //ensure default is set.  | 
                                                        
| 261 | 261 | $addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;  | 
                                                        
| 262 | 262 | $total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0;  | 
                                                        
| 263 | 263 | |
| 264 | -		if ( $total_owing > 0 ) { | 
                                                        |
| 265 | - $owing_content = ! empty( $attrs['still_owing'] ) ? $attrs['still_owing'] : sprintf( esc_html__( '%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' );  | 
                                                        |
| 266 | - $owing_content = $this->_shortcode_helper->parse_message_template( $owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message );  | 
                                                        |
| 264 | +		if ($total_owing > 0) { | 
                                                        |
| 265 | +			$owing_content = ! empty($attrs['still_owing']) ? $attrs['still_owing'] : sprintf(esc_html__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>'); | 
                                                        |
| 266 | + $owing_content = $this->_shortcode_helper->parse_message_template($owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message);  | 
                                                        |
| 267 | 267 |  		} else { | 
                                                        
| 268 | - $owing_content = !empty( $attrs['none_owing']) ? $attrs['none_owing'] : '';  | 
                                                        |
| 268 | + $owing_content = ! empty($attrs['none_owing']) ? $attrs['none_owing'] : '';  | 
                                                        |
| 269 | 269 | }  | 
                                                        
| 270 | 270 | |
| 271 | 271 | return $owing_content;  | 
                                                        
@@ -273,8 +273,8 @@ discard block  | 
                                                    ||
| 273 | 273 | |
| 274 | 274 | |
| 275 | 275 | |
| 276 | -	private function _get_payment_gateway( $transaction ) { | 
                                                        |
| 277 | - $pm = $this->_get_payment_method( $transaction );  | 
                                                        |
| 276 | +	private function _get_payment_gateway($transaction) { | 
                                                        |
| 277 | + $pm = $this->_get_payment_method($transaction);  | 
                                                        |
| 278 | 278 | return $pm instanceof EE_Payment_Method ? $pm->name() : '';  | 
                                                        
| 279 | 279 | }  | 
                                                        
| 280 | 280 | |
@@ -289,37 +289,37 @@ discard block  | 
                                                    ||
| 289 | 289 | *  | 
                                                        
| 290 | 290 | * @return string url or html  | 
                                                        
| 291 | 291 | */  | 
                                                        
| 292 | -	private function _get_invoice_logo( $img_tags = FALSE ) { | 
                                                        |
| 292 | +	private function _get_invoice_logo($img_tags = FALSE) { | 
                                                        |
| 293 | 293 | //try to get the invoice payment method's logo for this transaction image first  | 
                                                        
| 294 | 294 | $pm = $this->_get_payment_method();  | 
                                                        
| 295 | -		if ( $pm instanceof EE_Payment_Method ){ | 
                                                        |
| 296 | - $invoice_logo_url = $pm->get_extra_meta( 'pdf_logo_image', TRUE );  | 
                                                        |
| 297 | -		}else{ | 
                                                        |
| 295 | +		if ($pm instanceof EE_Payment_Method) { | 
                                                        |
| 296 | +			$invoice_logo_url = $pm->get_extra_meta('pdf_logo_image', TRUE); | 
                                                        |
| 297 | +		} else { | 
                                                        |
| 298 | 298 | $invoice_logo_url = NULL;  | 
                                                        
| 299 | 299 | }  | 
                                                        
| 300 | -		if( empty( $invoice_logo_url ) ){ | 
                                                        |
| 300 | +		if (empty($invoice_logo_url)) { | 
                                                        |
| 301 | 301 | $invoice_logo_url = EE_Registry::instance()->CFG->organization->logo_url;  | 
                                                        
| 302 | 302 | }  | 
                                                        
| 303 | 303 | |
| 304 | -		if ( empty( $invoice_logo_url ) ) { | 
                                                        |
| 304 | +		if (empty($invoice_logo_url)) { | 
                                                        |
| 305 | 305 | return '';  | 
                                                        
| 306 | 306 | }  | 
                                                        
| 307 | 307 | |
| 308 | -		if ( ! $img_tags ) { | 
                                                        |
| 308 | +		if ( ! $img_tags) { | 
                                                        |
| 309 | 309 | return $invoice_logo_url;  | 
                                                        
| 310 | 310 | }  | 
                                                        
| 311 | 311 | |
| 312 | 312 | //image tags have been requested.  | 
                                                        
| 313 | - $image_size = getimagesize( $invoice_logo_url );  | 
                                                        |
| 313 | + $image_size = getimagesize($invoice_logo_url);  | 
                                                        |
| 314 | 314 | |
| 315 | 315 | //if image is wider than 200px, set the wideth to 200  | 
                                                        
| 316 | -		if ( $image_size[0] > 300 ) { | 
                                                        |
| 316 | +		if ($image_size[0] > 300) { | 
                                                        |
| 317 | 317 | $image_width = 300;  | 
                                                        
| 318 | -		}else{ | 
                                                        |
| 318 | +		} else { | 
                                                        |
| 319 | 319 | $image_width = $image_size[0];  | 
                                                        
| 320 | 320 | }  | 
                                                        
| 321 | 321 | |
| 322 | - return '<img class="logo screen" src="' . $invoice_logo_url . '" width="' . $image_width . '" alt="logo" />';  | 
                                                        |
| 322 | + return '<img class="logo screen" src="'.$invoice_logo_url.'" width="'.$image_width.'" alt="logo" />';  | 
                                                        |
| 323 | 323 | }  | 
                                                        
| 324 | 324 | |
| 325 | 325 | |
@@ -336,26 +336,26 @@ discard block  | 
                                                    ||
| 336 | 336 |  	private function _get_invoice_payee_name() { | 
                                                        
| 337 | 337 | $payee_name = NULL;  | 
                                                        
| 338 | 338 | $pm = $this->_get_payment_method();  | 
                                                        
| 339 | -		if( $pm instanceof EE_Payment_Method ){ | 
                                                        |
| 340 | - $payee_name = $pm->get_extra_meta( 'pdf_payee_name', TRUE );  | 
                                                        |
| 339 | +		if ($pm instanceof EE_Payment_Method) { | 
                                                        |
| 340 | +			$payee_name = $pm->get_extra_meta('pdf_payee_name', TRUE); | 
                                                        |
| 341 | 341 | }  | 
                                                        
| 342 | - $payee_name = empty( $payee_name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : $payee_name;  | 
                                                        |
| 342 | +		$payee_name = empty($payee_name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : $payee_name; | 
                                                        |
| 343 | 343 | return $payee_name;  | 
                                                        
| 344 | 344 | }  | 
                                                        
| 345 | 345 | |
| 346 | 346 | /**  | 
                                                        
| 347 | 347 | * gets the payment method for this transaction. Otherwise gets a default one.  | 
                                                        
| 348 | 348 | */  | 
                                                        
| 349 | -	private function _get_payment_method( $transaction = null ){ | 
                                                        |
| 350 | -		if( $transaction instanceof EE_Transaction ) { | 
                                                        |
| 349 | +	private function _get_payment_method($transaction = null) { | 
                                                        |
| 350 | +		if ($transaction instanceof EE_Transaction) { | 
                                                        |
| 351 | 351 | $payment_method = $transaction->payment_method();  | 
                                                        
| 352 | -			if ( empty( $payment_method ) ) { | 
                                                        |
| 353 | -				return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); | 
                                                        |
| 352 | +			if (empty($payment_method)) { | 
                                                        |
| 353 | +				return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); | 
                                                        |
| 354 | 354 | }  | 
                                                        
| 355 | 355 | return $payment_method;  | 
                                                        
| 356 | -		}else{ | 
                                                        |
| 356 | +		} else { | 
                                                        |
| 357 | 357 | //get the first payment method we can find  | 
                                                        
| 358 | -			return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); | 
                                                        |
| 358 | +			return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); | 
                                                        |
| 359 | 359 | }  | 
                                                        
| 360 | 360 | }  | 
                                                        
| 361 | 361 | |
@@ -372,10 +372,10 @@ discard block  | 
                                                    ||
| 372 | 372 |  	private function _get_invoice_payee_email() { | 
                                                        
| 373 | 373 | $payee_email = NULL;  | 
                                                        
| 374 | 374 | $pm = $this->_get_payment_method();  | 
                                                        
| 375 | -		if( $pm instanceof EE_Payment_Method ){ | 
                                                        |
| 376 | - $payee_email = $pm->get_extra_meta( 'pdf_payee_email', TRUE );  | 
                                                        |
| 375 | +		if ($pm instanceof EE_Payment_Method) { | 
                                                        |
| 376 | +			$payee_email = $pm->get_extra_meta('pdf_payee_email', TRUE); | 
                                                        |
| 377 | 377 | }  | 
                                                        
| 378 | - $payee_email = empty( $payee_email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : $payee_email;  | 
                                                        |
| 378 | +		$payee_email = empty($payee_email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : $payee_email; | 
                                                        |
| 379 | 379 | return $payee_email;  | 
                                                        
| 380 | 380 | }  | 
                                                        
| 381 | 381 | |
@@ -391,24 +391,24 @@ discard block  | 
                                                    ||
| 391 | 391 | *  | 
                                                        
| 392 | 392 | * @return string  | 
                                                        
| 393 | 393 | */  | 
                                                        
| 394 | -	private function _get_invoice_payee_tax_number( $shortcode ) { | 
                                                        |
| 394 | +	private function _get_invoice_payee_tax_number($shortcode) { | 
                                                        |
| 395 | 395 | $payee_tax_number = NULL;  | 
                                                        
| 396 | 396 | $pm = $this->_get_payment_method();  | 
                                                        
| 397 | -		if( $pm instanceof EE_Payment_Method ){ | 
                                                        |
| 398 | - $payee_tax_number = $pm->get_extra_meta( 'pdf_payee_tax_number', TRUE );  | 
                                                        |
| 397 | +		if ($pm instanceof EE_Payment_Method) { | 
                                                        |
| 398 | +			$payee_tax_number = $pm->get_extra_meta('pdf_payee_tax_number', TRUE); | 
                                                        |
| 399 | 399 | }  | 
                                                        
| 400 | - $payee_tax_number = empty( $payee_tax_number ) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number;  | 
                                                        |
| 400 | + $payee_tax_number = empty($payee_tax_number) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number;  | 
                                                        |
| 401 | 401 | |
| 402 | -		if ( empty( $payee_tax_number ) ) { | 
                                                        |
| 402 | +		if (empty($payee_tax_number)) { | 
                                                        |
| 403 | 403 | return '';  | 
                                                        
| 404 | 404 | }  | 
                                                        
| 405 | 405 | |
| 406 | 406 | //any attributes?  | 
                                                        
| 407 | - $attrs = $this->_get_shortcode_attrs( $shortcode );  | 
                                                        |
| 407 | + $attrs = $this->_get_shortcode_attrs($shortcode);  | 
                                                        |
| 408 | 408 | |
| 409 | 409 | //prefix?  | 
                                                        
| 410 | - $prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : esc_html__( 'VAT/Tax Number: ', 'event_espresso' );  | 
                                                        |
| 411 | - return $prefix . $payee_tax_number;  | 
                                                        |
| 410 | +		$prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso'); | 
                                                        |
| 411 | + return $prefix.$payee_tax_number;  | 
                                                        |
| 412 | 412 | }  | 
                                                        
| 413 | 413 | |
| 414 | 414 | |
@@ -425,22 +425,22 @@ discard block  | 
                                                    ||
| 425 | 425 |  	private function _get_invoice_payee_address() { | 
                                                        
| 426 | 426 | $payee_address = NULL;  | 
                                                        
| 427 | 427 | $pm = $this->_get_payment_method();  | 
                                                        
| 428 | -		if( $pm instanceof EE_Payment_Method ){ | 
                                                        |
| 429 | - $payee_address = $pm->get_extra_meta( 'pdf_payee_address', TRUE );  | 
                                                        |
| 428 | +		if ($pm instanceof EE_Payment_Method) { | 
                                                        |
| 429 | +			$payee_address = $pm->get_extra_meta('pdf_payee_address', TRUE); | 
                                                        |
| 430 | 430 | }  | 
                                                        
| 431 | -		if ( empty( $payee_address ) ) { | 
                                                        |
| 431 | +		if (empty($payee_address)) { | 
                                                        |
| 432 | 432 | $organization = EE_Registry::instance()->CFG->organization;  | 
                                                        
| 433 | - $payee_address = $organization->get_pretty( 'address_1' ) . '<br>';  | 
                                                        |
| 434 | - $payee_address .= !empty( $organization->address_2 ) ? $organization->get_pretty( 'address_2' ) . '<br>' : '';  | 
                                                        |
| 435 | - $payee_address .= $organization->get_pretty( 'city' ) . '<br>';  | 
                                                        |
| 433 | +			$payee_address = $organization->get_pretty('address_1').'<br>'; | 
                                                        |
| 434 | +			$payee_address .= ! empty($organization->address_2) ? $organization->get_pretty('address_2').'<br>' : ''; | 
                                                        |
| 435 | +			$payee_address .= $organization->get_pretty('city').'<br>'; | 
                                                        |
| 436 | 436 | |
| 437 | 437 | //state  | 
                                                        
| 438 | - $state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $organization->STA_ID );  | 
                                                        |
| 439 | - $payee_address .= $state instanceof EE_State ? $state->name() : '';  | 
                                                        |
| 438 | +			$state = EE_Registry::instance()->load_model('State')->get_one_by_ID($organization->STA_ID); | 
                                                        |
| 439 | + $payee_address .= $state instanceof EE_State ? $state->name() : '';  | 
                                                        |
| 440 | 440 | |
| 441 | 441 | //Country  | 
                                                        
| 442 | - $payee_address .= ! empty( $organization->CNT_ISO ) ? ', ' . $organization->CNT_ISO . '<br>' : '';  | 
                                                        |
| 443 | - $payee_address .= ! empty( $organization->zip ) ? $organization->zip : '';  | 
                                                        |
| 442 | + $payee_address .= ! empty($organization->CNT_ISO) ? ', '.$organization->CNT_ISO.'<br>' : '';  | 
                                                        |
| 443 | + $payee_address .= ! empty($organization->zip) ? $organization->zip : '';  | 
                                                        |
| 444 | 444 | }  | 
                                                        
| 445 | 445 | return $payee_address;  | 
                                                        
| 446 | 446 | }  | 
                                                        
@@ -458,7 +458,7 @@ discard block  | 
                                                    ||
| 458 | 458 |  	private function _get_invoice_payment_instructions() { | 
                                                        
| 459 | 459 | $instructions = NULL;  | 
                                                        
| 460 | 460 | $pm = $this->_get_payment_method();  | 
                                                        
| 461 | - return ( $pm instanceof EE_Payment_Method ) ? $pm->get_extra_meta( 'pdf_instructions', TRUE) : '';  | 
                                                        |
| 461 | +		return ($pm instanceof EE_Payment_Method) ? $pm->get_extra_meta('pdf_instructions', TRUE) : ''; | 
                                                        |
| 462 | 462 | }  | 
                                                        
| 463 | 463 | |
| 464 | 464 | |
@@ -472,27 +472,27 @@ discard block  | 
                                                    ||
| 472 | 472 | *  | 
                                                        
| 473 | 473 | * @return string  | 
                                                        
| 474 | 474 | */  | 
                                                        
| 475 | -	protected function _get_invoice_receipt_switcher( $button = TRUE ) { | 
                                                        |
| 475 | +	protected function _get_invoice_receipt_switcher($button = TRUE) { | 
                                                        |
| 476 | 476 | $reg = $this->_data->primary_reg_obj;  | 
                                                        
| 477 | - $message_type = isset( $this->_extra_data['message_type'] ) ? $this->_extra_data['message_type'] : '';  | 
                                                        |
| 478 | -		if ( ! $reg instanceof EE_Registration || empty( $message_type ) ) { | 
                                                        |
| 477 | + $message_type = isset($this->_extra_data['message_type']) ? $this->_extra_data['message_type'] : '';  | 
                                                        |
| 478 | +		if ( ! $reg instanceof EE_Registration || empty($message_type)) { | 
                                                        |
| 479 | 479 | return '';  | 
                                                        
| 480 | 480 | }  | 
                                                        
| 481 | 481 | |
| 482 | - $switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type ? true : false;  | 
                                                        |
| 483 | -		$switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? esc_html__('View Invoice', 'event_espresso' ) : esc_html__( 'Switch to Invoice', 'event_espresso' ); | 
                                                        |
| 484 | - $switch_to_label = ! $switch_to_invoice ? esc_html__( 'Switch to Receipt', 'event_espresso' ) : $switch_to_label;  | 
                                                        |
| 482 | + $switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type ? true : false;  | 
                                                        |
| 483 | +		$switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? esc_html__('View Invoice', 'event_espresso') : esc_html__('Switch to Invoice', 'event_espresso'); | 
                                                        |
| 484 | +		$switch_to_label = ! $switch_to_invoice ? esc_html__('Switch to Receipt', 'event_espresso') : $switch_to_label; | 
                                                        |
| 485 | 485 | $switch_to_url = $switch_to_invoice ? $reg->invoice_url() : $reg->receipt_url();  | 
                                                        
| 486 | 486 | |
| 487 | -		if ( ! $button ) { | 
                                                        |
| 487 | +		if ( ! $button) { | 
                                                        |
| 488 | 488 | return $switch_to_url;  | 
                                                        
| 489 | 489 | }  | 
                                                        
| 490 | 490 | |
| 491 | -		if ( ! empty( $switch_to_url ) ) { | 
                                                        |
| 491 | +		if ( ! empty($switch_to_url)) { | 
                                                        |
| 492 | 492 | |
| 493 | 493 | return '  | 
                                                        
| 494 | - <form method="post" action="' . $switch_to_url . '" >  | 
                                                        |
| 495 | - <input class="print_button" type="submit" value="' . $switch_to_label . '" />  | 
                                                        |
| 494 | + <form method="post" action="' . $switch_to_url.'" >  | 
                                                        |
| 495 | + <input class="print_button" type="submit" value="' . $switch_to_label.'" />  | 
                                                        |
| 496 | 496 | </form>  | 
                                                        
| 497 | 497 | ';  | 
                                                        
| 498 | 498 | }  | 
                                                        
@@ -512,11 +512,11 @@ discard block  | 
                                                    ||
| 512 | 512 | *  | 
                                                        
| 513 | 513 | * @return string  | 
                                                        
| 514 | 514 | */  | 
                                                        
| 515 | -	private function _get_receipt_url( EE_Transaction $transaction ) { | 
                                                        |
| 515 | +	private function _get_receipt_url(EE_Transaction $transaction) { | 
                                                        |
| 516 | 516 | //get primary_registration  | 
                                                        
| 517 | 517 | $reg = $this->_data->primary_reg_obj;  | 
                                                        
| 518 | 518 | |
| 519 | -		if ( ! $reg instanceof EE_Registration ) { | 
                                                        |
| 519 | +		if ( ! $reg instanceof EE_Registration) { | 
                                                        |
| 520 | 520 | return '';  | 
                                                        
| 521 | 521 | }  | 
                                                        
| 522 | 522 | |
@@ -532,10 +532,10 @@ discard block  | 
                                                    ||
| 532 | 532 | *  | 
                                                        
| 533 | 533 | * @return int  | 
                                                        
| 534 | 534 | */  | 
                                                        
| 535 | -	private function _get_subtotal( $tax = FALSE ) { | 
                                                        |
| 536 | - $grand_total = isset( $this->_data->grand_total_line_item ) ? $this->_data->grand_total_line_item : NULL;  | 
                                                        |
| 535 | +	private function _get_subtotal($tax = FALSE) { | 
                                                        |
| 536 | + $grand_total = isset($this->_data->grand_total_line_item) ? $this->_data->grand_total_line_item : NULL;  | 
                                                        |
| 537 | 537 | |
| 538 | -		if ( ! $grand_total instanceof EE_Line_Item ) { | 
                                                        |
| 538 | +		if ( ! $grand_total instanceof EE_Line_Item) { | 
                                                        |
| 539 | 539 | return 0;  | 
                                                        
| 540 | 540 | }  | 
                                                        
| 541 | 541 | |
@@ -554,26 +554,26 @@ discard block  | 
                                                    ||
| 554 | 554 | *  | 
                                                        
| 555 | 555 | * @return string parsed.  | 
                                                        
| 556 | 556 | */  | 
                                                        
| 557 | -	private function _get_payment_link_if_needed( $shortcode ) { | 
                                                        |
| 558 | - $valid_shortcodes = array( 'transaction' );  | 
                                                        |
| 559 | - $attrs = $this->_get_shortcode_attrs( $shortcode );  | 
                                                        |
| 557 | +	private function _get_payment_link_if_needed($shortcode) { | 
                                                        |
| 558 | +		$valid_shortcodes = array('transaction'); | 
                                                        |
| 559 | + $attrs = $this->_get_shortcode_attrs($shortcode);  | 
                                                        |
| 560 | 560 | |
| 561 | 561 | //ensure default is set.  | 
                                                        
| 562 | 562 | $addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;  | 
                                                        
| 563 | 563 | $total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0;  | 
                                                        
| 564 | 564 | |
| 565 | -		if ( $total_owing > 0 ) { | 
                                                        |
| 566 | - $class = isset( $attrs['class'] ) ? $attrs['class'] : 'callout';  | 
                                                        |
| 567 | - $custom_text = isset( $attrs['custom_text'] ) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.';  | 
                                                        |
| 568 | - $container_tag = isset( $attrs['container_tag'] ) ? $attrs['container_tag'] : 'p';  | 
                                                        |
| 569 | - $opening_tag = ! empty( $container_tag ) ? '<' . $container_tag : '';  | 
                                                        |
| 570 | - $opening_tag .= ! empty( $opening_tag ) && !empty( $class ) ? ' class="' . $class . '"' : $opening_tag;  | 
                                                        |
| 571 | - $opening_tag .= !empty( $opening_tag ) ? '>' : $opening_tag;  | 
                                                        |
| 572 | - $closing_tag = ! empty( $container_tag ) ? '</' . $container_tag .'>' : '';  | 
                                                        |
| 573 | - $content = $opening_tag . sprintf( $custom_text, '<a href="[PAYMENT_URL]">', '</a>' ) . $closing_tag;  | 
                                                        |
| 565 | +		if ($total_owing > 0) { | 
                                                        |
| 566 | + $class = isset($attrs['class']) ? $attrs['class'] : 'callout';  | 
                                                        |
| 567 | + $custom_text = isset($attrs['custom_text']) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.';  | 
                                                        |
| 568 | + $container_tag = isset($attrs['container_tag']) ? $attrs['container_tag'] : 'p';  | 
                                                        |
| 569 | + $opening_tag = ! empty($container_tag) ? '<'.$container_tag : '';  | 
                                                        |
| 570 | + $opening_tag .= ! empty($opening_tag) && ! empty($class) ? ' class="'.$class.'"' : $opening_tag;  | 
                                                        |
| 571 | + $opening_tag .= ! empty($opening_tag) ? '>' : $opening_tag;  | 
                                                        |
| 572 | + $closing_tag = ! empty($container_tag) ? '</'.$container_tag.'>' : '';  | 
                                                        |
| 573 | + $content = $opening_tag.sprintf($custom_text, '<a href="[PAYMENT_URL]">', '</a>').$closing_tag;  | 
                                                        |
| 574 | 574 | |
| 575 | 575 | //we need to re run this string through the parser to catch any shortcodes that are in it.  | 
                                                        
| 576 | - $owing_content = $this->_shortcode_helper->parse_message_template( $content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message );  | 
                                                        |
| 576 | + $owing_content = $this->_shortcode_helper->parse_message_template($content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message);  | 
                                                        |
| 577 | 577 |  		} else { | 
                                                        
| 578 | 578 | return '';  | 
                                                        
| 579 | 579 | }  | 
                                                        
@@ -593,31 +593,31 @@ discard block  | 
                                                    ||
| 593 | 593 | * @param EE_Transaction $transaction  | 
                                                        
| 594 | 594 | * @return string  | 
                                                        
| 595 | 595 | */  | 
                                                        
| 596 | -	protected function _get_payment_due_date( $shortcode, EE_Transaction $transaction ) { | 
                                                        |
| 596 | +	protected function _get_payment_due_date($shortcode, EE_Transaction $transaction) { | 
                                                        |
| 597 | 597 | //if transaction is paid in full then we can just return an empty string  | 
                                                        
| 598 | -		if ( $transaction->remaining() === 0 ) { | 
                                                        |
| 598 | +		if ($transaction->remaining() === 0) { | 
                                                        |
| 599 | 599 | return '';  | 
                                                        
| 600 | 600 | }  | 
                                                        
| 601 | 601 | |
| 602 | - $attrs = $this->_get_shortcode_attrs( $shortcode );  | 
                                                        |
| 603 | - $format = isset( $attrs['format'] ) ? $attrs['format'] : get_option( 'date_format' );  | 
                                                        |
| 604 | - $days_until_due = isset( $attrs['days_until_due'] ) ? (int) $attrs['days_until_due'] : 30;  | 
                                                        |
| 605 | - $prefix_text = isset( $attrs['prefix_text'] ) ? $attrs['prefix_text'] : esc_html__( 'Payment in full due by: ', 'event_espresso' );  | 
                                                        |
| 606 | - $transaction_created = $transaction->get_DateTime_object( 'TXN_timestamp' );  | 
                                                        |
| 602 | + $attrs = $this->_get_shortcode_attrs($shortcode);  | 
                                                        |
| 603 | +		$format = isset($attrs['format']) ? $attrs['format'] : get_option('date_format'); | 
                                                        |
| 604 | + $days_until_due = isset($attrs['days_until_due']) ? (int) $attrs['days_until_due'] : 30;  | 
                                                        |
| 605 | +		$prefix_text = isset($attrs['prefix_text']) ? $attrs['prefix_text'] : esc_html__('Payment in full due by: ', 'event_espresso'); | 
                                                        |
| 606 | +		$transaction_created = $transaction->get_DateTime_object('TXN_timestamp'); | 
                                                        |
| 607 | 607 | |
| 608 | 608 | //setup date due:  | 
                                                        
| 609 | 609 |  		try { | 
                                                        
| 610 | -			if ( $transaction_created instanceof DateTime ) { | 
                                                        |
| 611 | - $date_due = $transaction_created->add( new DateInterval( 'P' . $days_until_due . 'D' ) )->format( $format );  | 
                                                        |
| 610 | +			if ($transaction_created instanceof DateTime) { | 
                                                        |
| 611 | +				$date_due = $transaction_created->add(new DateInterval('P'.$days_until_due.'D'))->format($format); | 
                                                        |
| 612 | 612 |  			} else { | 
                                                        
| 613 | 613 | throw new Exception();  | 
                                                        
| 614 | 614 | }  | 
                                                        
| 615 | -		} catch( Exception $e ) { | 
                                                        |
| 615 | +		} catch (Exception $e) { | 
                                                        |
| 616 | 616 | //format was likely invalid.  | 
                                                        
| 617 | 617 | $date_due = 'Unable to calculate date due, likely the format string is invalid.';  | 
                                                        
| 618 | 618 | }  | 
                                                        
| 619 | 619 | |
| 620 | - return $prefix_text . $date_due;  | 
                                                        |
| 620 | + return $prefix_text.$date_due;  | 
                                                        |
| 621 | 621 | }  | 
                                                        
| 622 | 622 | |
| 623 | 623 | } //end EE_Transaction Shortcodes library  | 
                                                        
@@ -16,7 +16,7 @@ discard block  | 
                                                    ||
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | |
| 19 | -	public function __construct( $admin_page ) { | 
                                                        |
| 19 | +	public function __construct($admin_page) { | 
                                                        |
| 20 | 20 | parent::__construct($admin_page);  | 
                                                        
| 21 | 21 | $this->_status = $this->_admin_page->get_registration_status_array();  | 
                                                        
| 22 | 22 | }  | 
                                                        
@@ -25,15 +25,15 @@ discard block  | 
                                                    ||
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 |  	protected function _setup_data() { | 
                                                        
| 28 | - $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page ) : $this->_admin_page->get_event_attendees( $this->_per_page, FALSE, TRUE );  | 
                                                        |
| 29 | - $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page, TRUE ) : $this->_admin_page->get_event_attendees( $this->_per_page, TRUE, TRUE);  | 
                                                        |
| 28 | + $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) : $this->_admin_page->get_event_attendees($this->_per_page, FALSE, TRUE);  | 
                                                        |
| 29 | + $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page, TRUE) : $this->_admin_page->get_event_attendees($this->_per_page, TRUE, TRUE);  | 
                                                        |
| 30 | 30 | }  | 
                                                        
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 |  	protected function _set_properties() { | 
                                                        
| 36 | - $evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL;  | 
                                                        |
| 36 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL;  | 
                                                        |
| 37 | 37 | |
| 38 | 38 | $this->_wp_list_args = array(  | 
                                                        
| 39 | 39 |  			'singular' => __('registrant', 'event_espresso'), | 
                                                        
@@ -44,7 +44,7 @@ discard block  | 
                                                    ||
| 44 | 44 | |
| 45 | 45 | $columns = array();  | 
                                                        
| 46 | 46 | //$columns['_Reg_Status'] = '';  | 
                                                        
| 47 | -		if ( !empty( $evt_id ) ) { | 
                                                        |
| 47 | +		if ( ! empty($evt_id)) { | 
                                                        |
| 48 | 48 | $columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text  | 
                                                        
| 49 | 49 | $this->_has_checkbox_column = true;  | 
                                                        
| 50 | 50 | }  | 
                                                        
@@ -60,26 +60,26 @@ discard block  | 
                                                    ||
| 60 | 60 |  				'TXN_total' => __('Total', 'event_espresso') | 
                                                        
| 61 | 61 | );  | 
                                                        
| 62 | 62 | |
| 63 | - $this->_columns = array_merge( $columns, $this->_columns);  | 
                                                        |
| 63 | + $this->_columns = array_merge($columns, $this->_columns);  | 
                                                        |
| 64 | 64 | |
| 65 | 65 | $this->_primary_column = '_REG_att_checked_in';  | 
                                                        
| 66 | 66 | |
| 67 | -		if ( !empty( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id )  ) { | 
                                                        |
| 67 | +		if ( ! empty($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id)) { | 
                                                        |
| 68 | 68 | $this->_bottom_buttons = array(  | 
                                                        
| 69 | 69 | 'report'=> array(  | 
                                                        
| 70 | 70 | 'route' => 'registrations_report',  | 
                                                        
| 71 | 71 | 'extra_request' =>  | 
                                                        
| 72 | 72 | array(  | 
                                                        
| 73 | 73 | 'EVT_ID'=> $evt_id,  | 
                                                        
| 74 | -							'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) | 
                                                        |
| 74 | +							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) | 
                                                        |
| 75 | 75 | )  | 
                                                        
| 76 | 76 | );  | 
                                                        
| 77 | 77 | }  | 
                                                        
| 78 | 78 | |
| 79 | 79 | $this->_sortable_columns = array(  | 
                                                        
| 80 | 80 | //true means its already sorted  | 
                                                        
| 81 | - 'ATT_name' => array( 'ATT_name' => TRUE ),  | 
                                                        |
| 82 | - 'Event' => array( 'Event.EVT.Name' => FALSE )  | 
                                                        |
| 81 | +			'ATT_name' => array('ATT_name' => TRUE), | 
                                                        |
| 82 | +			'Event' => array('Event.EVT.Name' => FALSE) | 
                                                        |
| 83 | 83 | );  | 
                                                        
| 84 | 84 | |
| 85 | 85 | $this->_hidden_columns = array();  | 
                                                        
@@ -91,11 +91,11 @@ discard block  | 
                                                    ||
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | |
| 94 | -	protected function _get_row_class( $item ) { | 
                                                        |
| 95 | - $class = parent::_get_row_class( $item );  | 
                                                        |
| 94 | +	protected function _get_row_class($item) { | 
                                                        |
| 95 | + $class = parent::_get_row_class($item);  | 
                                                        |
| 96 | 96 | //add status class  | 
                                                        
| 97 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID();  | 
                                                        |
| 98 | -		if ( $this->_has_checkbox_column ) { | 
                                                        |
| 97 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID();  | 
                                                        |
| 98 | +		if ($this->_has_checkbox_column) { | 
                                                        |
| 99 | 99 | $class .= ' has-checkbox-column';  | 
                                                        
| 100 | 100 | }  | 
                                                        
| 101 | 101 | return $class;  | 
                                                        
@@ -107,42 +107,42 @@ discard block  | 
                                                    ||
| 107 | 107 | $filters = $where = array();  | 
                                                        
| 108 | 108 | |
| 109 | 109 | |
| 110 | -		if ( empty( $this->_dtts_for_event ) ) { | 
                                                        |
| 110 | +		if (empty($this->_dtts_for_event)) { | 
                                                        |
| 111 | 111 | //this means we don't have an event so let's setup a filter dropdown for all the events to select  | 
                                                        
| 112 | 112 | //note possible capability restrictions  | 
                                                        
| 113 | -			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events') ) { | 
                                                        |
| 114 | - $where['status**'] = array( '!=', 'private' );  | 
                                                        |
| 113 | +			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { | 
                                                        |
| 114 | +				$where['status**'] = array('!=', 'private'); | 
                                                        |
| 115 | 115 | }  | 
                                                        
| 116 | 116 | |
| 117 | -			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { | 
                                                        |
| 118 | - $where['EVT_wp_user'] = get_current_user_id();  | 
                                                        |
| 117 | +			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { | 
                                                        |
| 118 | + $where['EVT_wp_user'] = get_current_user_id();  | 
                                                        |
| 119 | 119 | }  | 
                                                        
| 120 | 120 | |
| 121 | - $events = EEM_Event::instance()->get_all(array( $where, 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ) ) );  | 
                                                        |
| 122 | -			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') ); | 
                                                        |
| 123 | -			foreach ( $events as $evt ) { | 
                                                        |
| 121 | +			$events = EEM_Event::instance()->get_all(array($where, 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'))); | 
                                                        |
| 122 | +			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso')); | 
                                                        |
| 123 | +			foreach ($events as $evt) { | 
                                                        |
| 124 | 124 | //any registrations for this event?  | 
                                                        
| 125 | - if ( ! $evt->get_count_of_all_registrations() )  | 
                                                        |
| 125 | + if ( ! $evt->get_count_of_all_registrations())  | 
                                                        |
| 126 | 126 | continue;  | 
                                                        
| 127 | 127 | $evts[] = array(  | 
                                                        
| 128 | 128 | 'id' => $evt->ID(),  | 
                                                        
| 129 | - 'text' => $evt->get( 'EVT_name' ),  | 
                                                        |
| 129 | +					'text' => $evt->get('EVT_name'), | 
                                                        |
| 130 | 130 | 'class' => $evt->is_expired() ? 'ee-expired-event' : ''  | 
                                                        
| 131 | 131 | );  | 
                                                        
| 132 | 132 | }  | 
                                                        
| 133 | 133 | $event_filter = '<div class="ee-event-filter">';  | 
                                                        
| 134 | - $event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts );  | 
                                                        |
| 135 | - $event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>' . ' ' . __( 'Hide Expired Events', 'event_espresso' ) . '</span>';  | 
                                                        |
| 134 | +			$event_filter .= EEH_Form_Fields::select_input('event_id', $evts); | 
                                                        |
| 135 | +			$event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>'.' '.__('Hide Expired Events', 'event_espresso').'</span>'; | 
                                                        |
| 136 | 136 | $event_filter .= '</div>';  | 
                                                        
| 137 | 137 | $filters[] = $event_filter;  | 
                                                        
| 138 | 138 | |
| 139 | 139 |  		} else { | 
                                                        
| 140 | 140 | //DTT datetimes filter  | 
                                                        
| 141 | - $cur_dtt = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();  | 
                                                        |
| 141 | + $cur_dtt = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();  | 
                                                        |
| 142 | 142 | $dtts = array();  | 
                                                        
| 143 | -			foreach ( $this->_dtts_for_event as $dtt ) { | 
                                                        |
| 144 | - $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time();  | 
                                                        |
| 145 | -				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string ); | 
                                                        |
| 143 | +			foreach ($this->_dtts_for_event as $dtt) { | 
                                                        |
| 144 | + $datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time();  | 
                                                        |
| 145 | +				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string); | 
                                                        |
| 146 | 146 | }  | 
                                                        
| 147 | 147 |  			$filters[] = EEH_Form_Fields::select_input('DTT_ID', $dtts, $cur_dtt); | 
                                                        
| 148 | 148 | }  | 
                                                        
@@ -163,19 +163,19 @@ discard block  | 
                                                    ||
| 163 | 163 | |
| 164 | 164 | |
| 165 | 165 |  	protected function _get_total_event_attendees() { | 
                                                        
| 166 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE;  | 
                                                        |
| 167 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;  | 
                                                        |
| 166 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;  | 
                                                        |
| 167 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;  | 
                                                        |
| 168 | 168 | $query_params = array();  | 
                                                        
| 169 | -		if ($EVT_ID){ | 
                                                        |
| 170 | - $query_params[0]['EVT_ID']=$EVT_ID;  | 
                                                        |
| 169 | +		if ($EVT_ID) { | 
                                                        |
| 170 | + $query_params[0]['EVT_ID'] = $EVT_ID;  | 
                                                        |
| 171 | 171 | }  | 
                                                        
| 172 | 172 | //if DTT is included we do multiple datetimes. Otherwise we just do primary datetime  | 
                                                        
| 173 | -		if ( $DTT_ID ) { | 
                                                        |
| 173 | +		if ($DTT_ID) { | 
                                                        |
| 174 | 174 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;  | 
                                                        
| 175 | 175 | }  | 
                                                        
| 176 | - $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 ) );  | 
                                                        |
| 176 | +		$status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)); | 
                                                        |
| 177 | 177 | |
| 178 | -		$query_params[0]['STS_ID']= array('IN', $status_ids_array ); | 
                                                        |
| 178 | +		$query_params[0]['STS_ID'] = array('IN', $status_ids_array); | 
                                                        |
| 179 | 179 | |
| 180 | 180 | return EEM_Registration::instance()->count($query_params);  | 
                                                        
| 181 | 181 | }  | 
                                                        
@@ -186,8 +186,8 @@ discard block  | 
                                                    ||
| 186 | 186 | |
| 187 | 187 | |
| 188 | 188 | |
| 189 | -	function column__Reg_Status( EE_Registration $item ) { | 
                                                        |
| 190 | - return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';  | 
                                                        |
| 189 | +	function column__Reg_Status(EE_Registration $item) { | 
                                                        |
| 190 | + return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>';  | 
                                                        |
| 191 | 191 | }  | 
                                                        
| 192 | 192 | |
| 193 | 193 | |
@@ -195,7 +195,7 @@ discard block  | 
                                                    ||
| 195 | 195 | |
| 196 | 196 | |
| 197 | 197 |  	function column_cb($item) { | 
                                                        
| 198 | - return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() );  | 
                                                        |
| 198 | +		return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID()); | 
                                                        |
| 199 | 199 | }  | 
                                                        
| 200 | 200 | |
| 201 | 201 | |
@@ -208,18 +208,18 @@ discard block  | 
                                                    ||
| 208 | 208 | /**  | 
                                                        
| 209 | 209 | * column_REG_att_checked_in  | 
                                                        
| 210 | 210 | */  | 
                                                        
| 211 | -	function column__REG_att_checked_in(EE_Registration $item){ | 
                                                        |
| 211 | +	function column__REG_att_checked_in(EE_Registration $item) { | 
                                                        |
| 212 | 212 | $attendee = $item->attendee();  | 
                                                        
| 213 | 213 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';  | 
                                                        
| 214 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0;  | 
                                                        |
| 214 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;  | 
                                                        |
| 215 | 215 | $checkinstatus = $item->check_in_status_for_datetime($DTT_ID);  | 
                                                        
| 216 | 216 |  		$nonce = wp_create_nonce('checkin_nonce'); | 
                                                        
| 217 | - $evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL;  | 
                                                        |
| 218 | - $toggle_active = !empty ( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID() ) ? ' clickable trigger-checkin' : '';  | 
                                                        |
| 217 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL;  | 
                                                        |
| 218 | +		$toggle_active = ! empty ($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID()) ? ' clickable trigger-checkin' : ''; | 
                                                        |
| 219 | 219 | |
| 220 | - $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';  | 
                                                        |
| 220 | + $mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>';  | 
                                                        |
| 221 | 221 | |
| 222 | - return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '" data-_regid="' . $item->ID() . '" data-dttid="' . $DTT_ID . '" data-nonce="' . $nonce . '"></span>' . $mobile_view_content;  | 
                                                        |
| 222 | + return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'" data-_regid="'.$item->ID().'" data-dttid="'.$DTT_ID.'" data-nonce="'.$nonce.'"></span>'.$mobile_view_content;  | 
                                                        |
| 223 | 223 | }  | 
                                                        
| 224 | 224 | |
| 225 | 225 | |
@@ -228,45 +228,45 @@ discard block  | 
                                                    ||
| 228 | 228 | |
| 229 | 229 |  	function column_ATT_name(EE_Registration $item) { | 
                                                        
| 230 | 230 | $attendee = $item->attendee();  | 
                                                        
| 231 | -		if ( ! $attendee instanceof EE_Attendee ) { | 
                                                        |
| 231 | +		if ( ! $attendee instanceof EE_Attendee) { | 
                                                        |
| 232 | 232 |  			return __('No contact record for this registration.', 'event_espresso'); | 
                                                        
| 233 | 233 | }  | 
                                                        
| 234 | 234 | |
| 235 | 235 | // edit attendee link  | 
                                                        
| 236 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );  | 
                                                        |
| 237 | - $name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_contacts', 'espresso_registrations_edit_attendee' ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' . $item->attendee()->full_name() . '</a>' : $item->attendee()->full_name();  | 
                                                        |
| 236 | +		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); | 
                                                        |
| 237 | +		$name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact', 'event_espresso').'">'.$item->attendee()->full_name().'</a>' : $item->attendee()->full_name(); | 
                                                        |
| 238 | 238 | $name_link .= $item->count() == 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup> ' : '';  | 
                                                        
| 239 | 239 | |
| 240 | 240 | //add group details  | 
                                                        
| 241 | - $name_link .= ' ' . sprintf(__( '(%s of %s)', 'event_espresso' ),$item->count(), $item->group_size());  | 
                                                        |
| 241 | +		$name_link .= ' '.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size()); | 
                                                        |
| 242 | 242 | |
| 243 | 243 | //add regcode  | 
                                                        
| 244 | - $link = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), REG_ADMIN_URL );  | 
                                                        |
| 244 | +		$link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL); | 
                                                        |
| 245 | 245 | $name_link .= '<br>';  | 
                                                        
| 246 | -		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID() ) | 
                                                        |
| 247 | -			? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') .'">' . $item->reg_code() . '</a>' | 
                                                        |
| 246 | +		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID()) | 
                                                        |
| 247 | +			? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$item->reg_code().'</a>' | 
                                                        |
| 248 | 248 | : $item->reg_code();  | 
                                                        
| 249 | 249 | |
| 250 | 250 | //status  | 
                                                        
| 251 | - $name_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';  | 
                                                        |
| 251 | + $name_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';  | 
                                                        |
| 252 | 252 | |
| 253 | 253 | $actions = array();  | 
                                                        
| 254 | - $DTT_ID = !empty( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;  | 
                                                        |
| 255 | - $DTT_ID = empty( $DTT_ID ) && !empty( $this->_req_data['event_id'] ) ? EEM_Event::instance()->get_one_by_ID( $this->_req_data['event_id'] )->primary_datetime()->ID() : $DTT_ID;  | 
                                                        |
| 254 | + $DTT_ID = ! empty($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;  | 
                                                        |
| 255 | + $DTT_ID = empty($DTT_ID) && ! empty($this->_req_data['event_id']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['event_id'])->primary_datetime()->ID() : $DTT_ID;  | 
                                                        |
| 256 | 256 | |
| 257 | -		if ( !empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ) { | 
                                                        |
| 258 | -			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)); | 
                                                        |
| 259 | -			$actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso' ) . '">' . __('View', 'event_espresso') . '</a>'; | 
                                                        |
| 257 | +		if ( ! empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins')) { | 
                                                        |
| 258 | +			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)); | 
                                                        |
| 259 | +			$actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso').'">'.__('View', 'event_espresso').'</a>'; | 
                                                        |
| 260 | 260 | }  | 
                                                        
| 261 | 261 | |
| 262 | 262 | |
| 263 | 263 | |
| 264 | - return !empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions($actions) ) : $name_link;  | 
                                                        |
| 264 | +		return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link; | 
                                                        |
| 265 | 265 | }  | 
                                                        
| 266 | 266 | |
| 267 | 267 | |
| 268 | 268 | |
| 269 | -	function column_ATT_email( EE_Registration $item ) { | 
                                                        |
| 269 | +	function column_ATT_email(EE_Registration $item) { | 
                                                        |
| 270 | 270 | $attendee = $item->attendee();  | 
                                                        
| 271 | 271 | return $attendee instanceof EE_Attendee ? $attendee->email() : '';  | 
                                                        
| 272 | 272 |  		return $item->get_first_related('Attendee')->email(); | 
                                                        
@@ -279,10 +279,10 @@ discard block  | 
                                                    ||
| 279 | 279 |  	function column_Event(EE_Registration $item) { | 
                                                        
| 280 | 280 |  		try { | 
                                                        
| 281 | 281 | $event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event();  | 
                                                        
| 282 | - $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$event->ID() ), REG_ADMIN_URL );  | 
                                                        |
| 283 | - $event_label = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ? '<a href="'.$chkin_lnk_url.'" title="' . esc_attr__( 'View Checkins for this Event', 'event_espresso' ) . '">' . $event->name() . '</a>' : $event->name();  | 
                                                        |
| 284 | -		} catch( \EventEspresso\core\exceptions\EntityNotFoundException $e ) { | 
                                                        |
| 285 | - $event_label = esc_html__( 'Unknown', 'event_espresso' );  | 
                                                        |
| 282 | +			$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$event->ID()), REG_ADMIN_URL); | 
                                                        |
| 283 | +			$event_label = EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins') ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__('View Checkins for this Event', 'event_espresso').'">'.$event->name().'</a>' : $event->name(); | 
                                                        |
| 284 | +		} catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) { | 
                                                        |
| 285 | +			$event_label = esc_html__('Unknown', 'event_espresso'); | 
                                                        |
| 286 | 286 | }  | 
                                                        
| 287 | 287 | |
| 288 | 288 | return $event_label;  | 
                                                        
@@ -292,7 +292,7 @@ discard block  | 
                                                    ||
| 292 | 292 | |
| 293 | 293 | |
| 294 | 294 | |
| 295 | -	function column_PRC_name(EE_Registration $item){ | 
                                                        |
| 295 | +	function column_PRC_name(EE_Registration $item) { | 
                                                        |
| 296 | 296 |  		return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso"); | 
                                                        
| 297 | 297 | }  | 
                                                        
| 298 | 298 | |
@@ -304,8 +304,8 @@ discard block  | 
                                                    ||
| 304 | 304 | /**  | 
                                                        
| 305 | 305 | * column_REG_final_price  | 
                                                        
| 306 | 306 | */  | 
                                                        
| 307 | -	function column__REG_final_price(EE_Registration $item){ | 
                                                        |
| 308 | - return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>';  | 
                                                        |
| 307 | +	function column__REG_final_price(EE_Registration $item) { | 
                                                        |
| 308 | + return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>';  | 
                                                        |
| 309 | 309 | }  | 
                                                        
| 310 | 310 | |
| 311 | 311 | |
@@ -315,20 +315,20 @@ discard block  | 
                                                    ||
| 315 | 315 | /**  | 
                                                        
| 316 | 316 | * column_TXN_paid  | 
                                                        
| 317 | 317 | */  | 
                                                        
| 318 | -	function column_TXN_paid(EE_Registration $item){ | 
                                                        |
| 318 | +	function column_TXN_paid(EE_Registration $item) { | 
                                                        |
| 319 | 319 | |
| 320 | -		if ( $item->count() == 1 ) { | 
                                                        |
| 320 | +		if ($item->count() == 1) { | 
                                                        |
| 321 | 321 | |
| 322 | -			if ( $item->transaction()->paid() >= $item->transaction()->total() ) { | 
                                                        |
| 322 | +			if ($item->transaction()->paid() >= $item->transaction()->total()) { | 
                                                        |
| 323 | 323 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';  | 
                                                        
| 324 | 324 |  			} else { | 
                                                        
| 325 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );  | 
                                                        |
| 326 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? '  | 
                                                        |
| 325 | +				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); | 
                                                        |
| 326 | +				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? ' | 
                                                        |
| 327 | 327 | <span class="reg-pad-rght">  | 
                                                        
| 328 | - <a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">  | 
                                                        |
| 329 | - ' . $item->transaction()->pretty_paid(). '  | 
                                                        |
| 328 | +					<a class="status-'. $item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'"> | 
                                                        |
| 329 | + ' . $item->transaction()->pretty_paid().'  | 
                                                        |
| 330 | 330 | </a>  | 
                                                        
| 331 | - <span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';  | 
                                                        |
| 331 | + <span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';  | 
                                                        |
| 332 | 332 | }  | 
                                                        
| 333 | 333 |  		} else { | 
                                                        
| 334 | 334 | return '<span class="reg-pad-rght"></span>';  | 
                                                        
@@ -342,13 +342,13 @@ discard block  | 
                                                    ||
| 342 | 342 | /**  | 
                                                        
| 343 | 343 | * column_TXN_total  | 
                                                        
| 344 | 344 | */  | 
                                                        
| 345 | -	function column_TXN_total(EE_Registration $item){ | 
                                                        |
| 345 | +	function column_TXN_total(EE_Registration $item) { | 
                                                        |
| 346 | 346 | $txn = $item->transaction();  | 
                                                        
| 347 | -		$view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL ); | 
                                                        |
| 348 | -		if ( $item->get('REG_count') == 1 ) { | 
                                                        |
| 347 | +		$view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL); | 
                                                        |
| 348 | +		if ($item->get('REG_count') == 1) { | 
                                                        |
| 349 | 349 | $line_total_obj = $txn->total_line_item();  | 
                                                        
| 350 | 350 |  			$txn_total = $line_total_obj instanceof EE_Line_Item ? $line_total_obj->get_pretty('LIN_total') : __('View Transaction', 'event_espresso'); | 
                                                        
| 351 | -			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '<a href="' . $view_txn_url . '" title="' . esc_attr__('View Transaction', 'event_espresso') . '"><span class="reg-pad-rght">'. $txn_total  .'</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>'; | 
                                                        |
| 351 | +			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_txn_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"><span class="reg-pad-rght">'.$txn_total.'</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>'; | 
                                                        |
| 352 | 352 |  		} else { | 
                                                        
| 353 | 353 | return '<span class="reg-pad-rght"></span>';  | 
                                                        
| 354 | 354 | }  | 
                                                        
@@ -92,7 +92,7 @@  | 
                                                    ||
| 92 | 92 | /**  | 
                                                        
| 93 | 93 | * Model_Version_Info constructor.  | 
                                                        
| 94 | 94 | *  | 
                                                        
| 95 | - * @param array $requested_version  | 
                                                        |
| 95 | + * @param string $requested_version  | 
                                                        |
| 96 | 96 | */  | 
                                                        
| 97 | 97 |      public function __construct( $requested_version ) { | 
                                                        
| 98 | 98 | $this->_requested_version = $requested_version;  | 
                                                        
@@ -89,12 +89,12 @@ discard block  | 
                                                    ||
| 89 | 89 | |
| 90 | 90 | |
| 91 | 91 | |
| 92 | - /**  | 
                                                        |
| 93 | - * Model_Version_Info constructor.  | 
                                                        |
| 94 | - *  | 
                                                        |
| 95 | - * @param array $requested_version  | 
                                                        |
| 96 | - */  | 
                                                        |
| 97 | -    public function __construct( $requested_version ) { | 
                                                        |
| 92 | + /**  | 
                                                        |
| 93 | + * Model_Version_Info constructor.  | 
                                                        |
| 94 | + *  | 
                                                        |
| 95 | + * @param array $requested_version  | 
                                                        |
| 96 | + */  | 
                                                        |
| 97 | +	public function __construct( $requested_version ) { | 
                                                        |
| 98 | 98 | $this->_requested_version = $requested_version;  | 
                                                        
| 99 | 99 | $this->_model_changes = array(  | 
                                                        
| 100 | 100 | '4.8.29' => array(  | 
                                                        
@@ -209,10 +209,10 @@ discard block  | 
                                                    ||
| 209 | 209 | }  | 
                                                        
| 210 | 210 | }  | 
                                                        
| 211 | 211 | $this->_cached_models_for_requested_version = apply_filters(  | 
                                                        
| 212 | - 'FHEE__EventEspresso_core_libraries_rest_api__models_for_requested_version',  | 
                                                        |
| 213 | - $all_models_in_current_version,  | 
                                                        |
| 214 | - $this  | 
                                                        |
| 215 | - );  | 
                                                        |
| 212 | + 'FHEE__EventEspresso_core_libraries_rest_api__models_for_requested_version',  | 
                                                        |
| 213 | + $all_models_in_current_version,  | 
                                                        |
| 214 | + $this  | 
                                                        |
| 215 | + );  | 
                                                        |
| 216 | 216 | }  | 
                                                        
| 217 | 217 | return $this->_cached_models_for_requested_version;  | 
                                                        
| 218 | 218 | }  | 
                                                        
@@ -1,8 +1,8 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | namespace EventEspresso\core\libraries\rest_api;  | 
                                                        
| 3 | 3 | |
| 4 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { | 
                                                        |
| 5 | - exit( 'No direct script access allowed' );  | 
                                                        |
| 4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { | 
                                                        |
| 5 | +	exit('No direct script access allowed'); | 
                                                        |
| 6 | 6 | }  | 
                                                        
| 7 | 7 | |
| 8 | 8 | /**  | 
                                                        
@@ -94,7 +94,7 @@ discard block  | 
                                                    ||
| 94 | 94 | *  | 
                                                        
| 95 | 95 | * @param array $requested_version  | 
                                                        
| 96 | 96 | */  | 
                                                        
| 97 | -    public function __construct( $requested_version ) { | 
                                                        |
| 97 | +    public function __construct($requested_version) { | 
                                                        |
| 98 | 98 | $this->_requested_version = $requested_version;  | 
                                                        
| 99 | 99 | $this->_model_changes = array(  | 
                                                        
| 100 | 100 | '4.8.29' => array(  | 
                                                        
@@ -116,13 +116,13 @@ discard block  | 
                                                    ||
| 116 | 116 | 'table_column' => 'N/A',  | 
                                                        
| 117 | 117 | 'always_available' => true,  | 
                                                        
| 118 | 118 | );  | 
                                                        
| 119 | -		foreach( $this->_resource_changes as $version => $model_classnames ) { | 
                                                        |
| 120 | -			foreach( $model_classnames as $model_classname => $extra_fields ) { | 
                                                        |
| 121 | -				foreach( $extra_fields as $fieldname => $field_data ) { | 
                                                        |
| 122 | - $this->_resource_changes[ $model_classname ][ $fieldname ][ 'name' ] = $fieldname;  | 
                                                        |
| 123 | -					foreach( $defaults as $attribute => $default_value ) { | 
                                                        |
| 124 | -						if( ! isset( $this->_resource_changes[ $model_classname ][ $fieldname ][ $attribute ] ) ) { | 
                                                        |
| 125 | - $this->_resource_changes[ $model_classname ][ $fieldname ][ $attribute ] = $default_value;  | 
                                                        |
| 119 | +		foreach ($this->_resource_changes as $version => $model_classnames) { | 
                                                        |
| 120 | +			foreach ($model_classnames as $model_classname => $extra_fields) { | 
                                                        |
| 121 | +				foreach ($extra_fields as $fieldname => $field_data) { | 
                                                        |
| 122 | + $this->_resource_changes[$model_classname][$fieldname]['name'] = $fieldname;  | 
                                                        |
| 123 | +					foreach ($defaults as $attribute => $default_value) { | 
                                                        |
| 124 | +						if ( ! isset($this->_resource_changes[$model_classname][$fieldname][$attribute])) { | 
                                                        |
| 125 | + $this->_resource_changes[$model_classname][$fieldname][$attribute] = $default_value;  | 
                                                        |
| 126 | 126 | }  | 
                                                        
| 127 | 127 | }  | 
                                                        
| 128 | 128 | }  | 
                                                        
@@ -138,11 +138,11 @@ discard block  | 
                                                    ||
| 138 | 138 | * @return array  | 
                                                        
| 139 | 139 | */  | 
                                                        
| 140 | 140 |  	public function model_changes_between_requested_version_and_current() { | 
                                                        
| 141 | -		if( $this->_cached_model_changes_between_requested_version_and_current === null ) { | 
                                                        |
| 141 | +		if ($this->_cached_model_changes_between_requested_version_and_current === null) { | 
                                                        |
| 142 | 142 | $model_changes = array();  | 
                                                        
| 143 | -			foreach( $this->model_changes() as $version => $models_changed_in_version ) { | 
                                                        |
| 144 | -				if( $version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version() ) { | 
                                                        |
| 145 | - $model_changes[ $version ] = $models_changed_in_version;  | 
                                                        |
| 143 | +			foreach ($this->model_changes() as $version => $models_changed_in_version) { | 
                                                        |
| 144 | +				if ($version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version()) { | 
                                                        |
| 145 | + $model_changes[$version] = $models_changed_in_version;  | 
                                                        |
| 146 | 146 | }  | 
                                                        
| 147 | 147 | }  | 
                                                        
| 148 | 148 | $this->_cached_model_changes_between_requested_version_and_current = $model_changes;  | 
                                                        
@@ -158,11 +158,11 @@ discard block  | 
                                                    ||
| 158 | 158 | * @return array  | 
                                                        
| 159 | 159 | */  | 
                                                        
| 160 | 160 |  	public function resource_changes_between_requested_version_and_current() { | 
                                                        
| 161 | -		if( $this->_cached_resource_changes_between_requested_version_and_current === null ) { | 
                                                        |
| 161 | +		if ($this->_cached_resource_changes_between_requested_version_and_current === null) { | 
                                                        |
| 162 | 162 | $resource_changes = array();  | 
                                                        
| 163 | -			foreach( $this->resource_changes() as $version => $model_classnames ) { | 
                                                        |
| 164 | -				if( $version <= \EED_Core_Rest_Api::core_version()  && $version > $this->requested_version()  ) { | 
                                                        |
| 165 | - $resource_changes[ $version ] = $model_classnames;  | 
                                                        |
| 163 | +			foreach ($this->resource_changes() as $version => $model_classnames) { | 
                                                        |
| 164 | +				if ($version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version()) { | 
                                                        |
| 165 | + $resource_changes[$version] = $model_classnames;  | 
                                                        |
| 166 | 166 | }  | 
                                                        
| 167 | 167 | }  | 
                                                        
| 168 | 168 | $this->_cached_resource_changes_between_requested_version_and_current = $resource_changes;  | 
                                                        
@@ -174,7 +174,7 @@ discard block  | 
                                                    ||
| 174 | 174 | * If a request was sent to 'wp-json/ee/v4.7/events' this would be '4.7'  | 
                                                        
| 175 | 175 | * @return string like '4.6'  | 
                                                        
| 176 | 176 | */  | 
                                                        
| 177 | -	public function requested_version(){ | 
                                                        |
| 177 | +	public function requested_version() { | 
                                                        |
| 178 | 178 | return $this->_requested_version;  | 
                                                        
| 179 | 179 | }  | 
                                                        
| 180 | 180 | |
@@ -188,7 +188,7 @@ discard block  | 
                                                    ||
| 188 | 188 | * If a version is missing then we don't know anything about what changes it introduced from the previous version  | 
                                                        
| 189 | 189 | * @return array  | 
                                                        
| 190 | 190 | */  | 
                                                        
| 191 | -	public function model_changes(){ | 
                                                        |
| 191 | +	public function model_changes() { | 
                                                        |
| 192 | 192 | return $this->_model_changes;  | 
                                                        
| 193 | 193 | }  | 
                                                        
| 194 | 194 | |
@@ -199,12 +199,12 @@ discard block  | 
                                                    ||
| 199 | 199 | * @return array keys are model names, values are their classname  | 
                                                        
| 200 | 200 | */  | 
                                                        
| 201 | 201 |  	public function models_for_requested_version() { | 
                                                        
| 202 | -		if( $this->_cached_models_for_requested_version === null ) { | 
                                                        |
| 202 | +		if ($this->_cached_models_for_requested_version === null) { | 
                                                        |
| 203 | 203 | $all_models_in_current_version = \EE_Registry::instance()->non_abstract_db_models;  | 
                                                        
| 204 | -			foreach( $this->model_changes_between_requested_version_and_current() as $version => $models_changed ) { | 
                                                        |
| 205 | -				foreach( $models_changed as $model_name => $new_indicator_or_fields_added ) { | 
                                                        |
| 206 | -					if( $new_indicator_or_fields_added === Model_Version_Info::model_added ) { | 
                                                        |
| 207 | - unset( $all_models_in_current_version[ $model_name ] );  | 
                                                        |
| 204 | +			foreach ($this->model_changes_between_requested_version_and_current() as $version => $models_changed) { | 
                                                        |
| 205 | +				foreach ($models_changed as $model_name => $new_indicator_or_fields_added) { | 
                                                        |
| 206 | +					if ($new_indicator_or_fields_added === Model_Version_Info::model_added) { | 
                                                        |
| 207 | + unset($all_models_in_current_version[$model_name]);  | 
                                                        |
| 208 | 208 | }  | 
                                                        
| 209 | 209 | }  | 
                                                        
| 210 | 210 | }  | 
                                                        
@@ -227,11 +227,11 @@ discard block  | 
                                                    ||
| 227 | 227 | * @param string $model_name eg 'Event'  | 
                                                        
| 228 | 228 | * @return boolean  | 
                                                        
| 229 | 229 | */  | 
                                                        
| 230 | -	public function is_model_name_in_this_version( $model_name ) { | 
                                                        |
| 230 | +	public function is_model_name_in_this_version($model_name) { | 
                                                        |
| 231 | 231 | $model_names = $this->models_for_requested_version();  | 
                                                        
| 232 | -		if( isset( $model_names[ $model_name ] ) ) { | 
                                                        |
| 232 | +		if (isset($model_names[$model_name])) { | 
                                                        |
| 233 | 233 | return true;  | 
                                                        
| 234 | -		}else{ | 
                                                        |
| 234 | +		} else { | 
                                                        |
| 235 | 235 | return false;  | 
                                                        
| 236 | 236 | }  | 
                                                        
| 237 | 237 | }  | 
                                                        
@@ -246,10 +246,10 @@ discard block  | 
                                                    ||
| 246 | 246 | * @return \EEM_Base  | 
                                                        
| 247 | 247 | * @throws \EE_Error  | 
                                                        
| 248 | 248 | */  | 
                                                        
| 249 | -	public function load_model( $model_name ) { | 
                                                        |
| 250 | -		if( $this->is_model_name_in_this_version( $model_name ) ) { | 
                                                        |
| 251 | - return \EE_Registry::instance()->load_model( $model_name );  | 
                                                        |
| 252 | -		}else{ | 
                                                        |
| 249 | +	public function load_model($model_name) { | 
                                                        |
| 250 | +		if ($this->is_model_name_in_this_version($model_name)) { | 
                                                        |
| 251 | + return \EE_Registry::instance()->load_model($model_name);  | 
                                                        |
| 252 | +		} else { | 
                                                        |
| 253 | 253 | throw new \EE_Error(  | 
                                                        
| 254 | 254 | sprintf(  | 
                                                        
| 255 | 255 | __(  | 
                                                        
@@ -271,21 +271,21 @@ discard block  | 
                                                    ||
| 271 | 271 | * @param \EEM_Base $model  | 
                                                        
| 272 | 272 | * @return array|\EE_Model_Field_Base[]  | 
                                                        
| 273 | 273 | */  | 
                                                        
| 274 | -	public function fields_on_model_in_this_version( $model ) { | 
                                                        |
| 275 | -		if( ! isset( $this->_cached_fields_on_models[ $model->get_this_model_name() ] ) ) { | 
                                                        |
| 274 | +	public function fields_on_model_in_this_version($model) { | 
                                                        |
| 275 | +		if ( ! isset($this->_cached_fields_on_models[$model->get_this_model_name()])) { | 
                                                        |
| 276 | 276 | //get all model changes between the requested version and current core version  | 
                                                        
| 277 | 277 | $changes = $this->model_changes_between_requested_version_and_current();  | 
                                                        
| 278 | 278 | //fetch all fields currently on this model  | 
                                                        
| 279 | 279 | $current_fields = $model->field_settings();  | 
                                                        
| 280 | 280 | //remove all fields that have been added since  | 
                                                        
| 281 | -			foreach( $changes as $version => $changes_in_version ) { | 
                                                        |
| 282 | - if(  | 
                                                        |
| 283 | - isset( $changes_in_version[ $model->get_this_model_name() ] )  | 
                                                        |
| 284 | - && $changes_in_version[ $model->get_this_model_name() ] !== Model_Version_Info::model_added  | 
                                                        |
| 281 | +			foreach ($changes as $version => $changes_in_version) { | 
                                                        |
| 282 | + if (  | 
                                                        |
| 283 | + isset($changes_in_version[$model->get_this_model_name()])  | 
                                                        |
| 284 | + && $changes_in_version[$model->get_this_model_name()] !== Model_Version_Info::model_added  | 
                                                        |
| 285 | 285 |  				) { | 
                                                        
| 286 | 286 | $current_fields = array_diff_key(  | 
                                                        
| 287 | 287 | $current_fields,  | 
                                                        
| 288 | - array_flip( $changes_in_version[ $model->get_this_model_name() ] )  | 
                                                        |
| 288 | + array_flip($changes_in_version[$model->get_this_model_name()])  | 
                                                        |
| 289 | 289 | );  | 
                                                        
| 290 | 290 | }  | 
                                                        
| 291 | 291 | }  | 
                                                        
@@ -303,9 +303,9 @@ discard block  | 
                                                    ||
| 303 | 303 | * @param array $classnames  | 
                                                        
| 304 | 304 | * @return boolean  | 
                                                        
| 305 | 305 | */  | 
                                                        
| 306 | -	public function is_subclass_of_one( $object, $classnames ) { | 
                                                        |
| 307 | -		foreach( $classnames as $classname ) { | 
                                                        |
| 308 | -			if( is_a( $object, $classname ) ) { | 
                                                        |
| 306 | +	public function is_subclass_of_one($object, $classnames) { | 
                                                        |
| 307 | +		foreach ($classnames as $classname) { | 
                                                        |
| 308 | +			if (is_a($object, $classname)) { | 
                                                        |
| 309 | 309 | return true;  | 
                                                        
| 310 | 310 | }  | 
                                                        
| 311 | 311 | }  | 
                                                        
@@ -316,10 +316,10 @@ discard block  | 
                                                    ||
| 316 | 316 | * Returns the list of model field classes that that the API basically ignores  | 
                                                        
| 317 | 317 | * @return array  | 
                                                        
| 318 | 318 | */  | 
                                                        
| 319 | -	public function fields_ignored(){ | 
                                                        |
| 319 | +	public function fields_ignored() { | 
                                                        |
| 320 | 320 | return apply_filters(  | 
                                                        
| 321 | 321 | 'FHEE__Controller_Model_Read_fields_ignored',  | 
                                                        
| 322 | - array( 'EE_Foreign_Key_Field_Base', 'EE_Any_Foreign_Model_Name_Field' )  | 
                                                        |
| 322 | +			array('EE_Foreign_Key_Field_Base', 'EE_Any_Foreign_Model_Name_Field') | 
                                                        |
| 323 | 323 | );  | 
                                                        
| 324 | 324 | }  | 
                                                        
| 325 | 325 | |
@@ -328,8 +328,8 @@ discard block  | 
                                                    ||
| 328 | 328 | * @param EE_Model_Field_Base  | 
                                                        
| 329 | 329 | * @return boolean  | 
                                                        
| 330 | 330 | */  | 
                                                        
| 331 | -	public function field_is_ignored( $field_obj ){ | 
                                                        |
| 332 | - return $this->is_subclass_of_one( $field_obj, $this->fields_ignored() );  | 
                                                        |
| 331 | +	public function field_is_ignored($field_obj) { | 
                                                        |
| 332 | + return $this->is_subclass_of_one($field_obj, $this->fields_ignored());  | 
                                                        |
| 333 | 333 | }  | 
                                                        
| 334 | 334 | |
| 335 | 335 | /**  | 
                                                        
@@ -340,7 +340,7 @@ discard block  | 
                                                    ||
| 340 | 340 |  	public function fields_that_have_rendered_format() { | 
                                                        
| 341 | 341 | return apply_filters(  | 
                                                        
| 342 | 342 | 'FHEE__Controller_Model_Read__fields_raw',  | 
                                                        
| 343 | - array( 'EE_Post_Content_Field', 'EE_Full_HTML_Field' )  | 
                                                        |
| 343 | +			array('EE_Post_Content_Field', 'EE_Full_HTML_Field') | 
                                                        |
| 344 | 344 | );  | 
                                                        
| 345 | 345 | }  | 
                                                        
| 346 | 346 | |
@@ -349,8 +349,8 @@ discard block  | 
                                                    ||
| 349 | 349 | * @param EE_Model_Field_Base  | 
                                                        
| 350 | 350 | * @return boolean  | 
                                                        
| 351 | 351 | */  | 
                                                        
| 352 | -	public function field_has_rendered_format( $field_obj ){ | 
                                                        |
| 353 | - return $this->is_subclass_of_one( $field_obj, $this->fields_that_have_rendered_format() );  | 
                                                        |
| 352 | +	public function field_has_rendered_format($field_obj) { | 
                                                        |
| 353 | + return $this->is_subclass_of_one($field_obj, $this->fields_that_have_rendered_format());  | 
                                                        |
| 354 | 354 | }  | 
                                                        
| 355 | 355 | |
| 356 | 356 | /**  | 
                                                        
@@ -362,7 +362,7 @@ discard block  | 
                                                    ||
| 362 | 362 |  	public function fields_that_have_pretty_format() { | 
                                                        
| 363 | 363 | return apply_filters(  | 
                                                        
| 364 | 364 | 'FHEE__Controller_Model_Read__fields_pretty',  | 
                                                        
| 365 | - array( 'EE_Enum_Integer_Field', 'EE_Enum_Text_Field', 'EE_Money_Field' )  | 
                                                        |
| 365 | +			array('EE_Enum_Integer_Field', 'EE_Enum_Text_Field', 'EE_Money_Field') | 
                                                        |
| 366 | 366 | );  | 
                                                        
| 367 | 367 | }  | 
                                                        
| 368 | 368 | |
@@ -371,8 +371,8 @@ discard block  | 
                                                    ||
| 371 | 371 | * @param EE_Model_Field_Base  | 
                                                        
| 372 | 372 | * @return boolean  | 
                                                        
| 373 | 373 | */  | 
                                                        
| 374 | -	public function field_has_pretty_format( $field_obj ){ | 
                                                        |
| 375 | - return $this->is_subclass_of_one( $field_obj, $this->fields_that_have_pretty_format() );  | 
                                                        |
| 374 | +	public function field_has_pretty_format($field_obj) { | 
                                                        |
| 375 | + return $this->is_subclass_of_one($field_obj, $this->fields_that_have_pretty_format());  | 
                                                        |
| 376 | 376 | }  | 
                                                        
| 377 | 377 | |
| 378 | 378 | /**  | 
                                                        
@@ -389,12 +389,12 @@ discard block  | 
                                                    ||
| 389 | 389 | * @param \EEM_Base $model  | 
                                                        
| 390 | 390 | * @return array  | 
                                                        
| 391 | 391 | */  | 
                                                        
| 392 | -	public function extra_resource_properties_for_model( $model ) { | 
                                                        |
| 392 | +	public function extra_resource_properties_for_model($model) { | 
                                                        |
| 393 | 393 | $extra_properties = array();  | 
                                                        
| 394 | -		foreach( $this->resource_changes_between_requested_version_and_current() as $version => $model_classnames ) { | 
                                                        |
| 395 | -			foreach( $model_classnames as $model_classname => $properties_added_in_this_version ) { | 
                                                        |
| 396 | -				if( is_subclass_of( $model, $model_classname ) ) { | 
                                                        |
| 397 | - $extra_properties = array_merge( $extra_properties, $properties_added_in_this_version );  | 
                                                        |
| 394 | +		foreach ($this->resource_changes_between_requested_version_and_current() as $version => $model_classnames) { | 
                                                        |
| 395 | +			foreach ($model_classnames as $model_classname => $properties_added_in_this_version) { | 
                                                        |
| 396 | +				if (is_subclass_of($model, $model_classname)) { | 
                                                        |
| 397 | + $extra_properties = array_merge($extra_properties, $properties_added_in_this_version);  | 
                                                        |
| 398 | 398 | }  | 
                                                        
| 399 | 399 | }  | 
                                                        
| 400 | 400 | }  | 
                                                        
@@ -407,11 +407,11 @@ discard block  | 
                                                    ||
| 407 | 407 | * @param \EEM_Base $model  | 
                                                        
| 408 | 408 | * @return \EE_Model_Relation_Base[]  | 
                                                        
| 409 | 409 | */  | 
                                                        
| 410 | -	public function relation_settings( \EEM_Base $model ) { | 
                                                        |
| 410 | +	public function relation_settings(\EEM_Base $model) { | 
                                                        |
| 411 | 411 | $relations = array();  | 
                                                        
| 412 | -		foreach( $model->relation_settings() as $relation_name => $relation_obj ) { | 
                                                        |
| 413 | -			if( $this->is_model_name_in_this_version(  $relation_name ) ) { | 
                                                        |
| 414 | - $relations[ $relation_name ] = $relation_obj;  | 
                                                        |
| 412 | +		foreach ($model->relation_settings() as $relation_name => $relation_obj) { | 
                                                        |
| 413 | +			if ($this->is_model_name_in_this_version($relation_name)) { | 
                                                        |
| 414 | + $relations[$relation_name] = $relation_obj;  | 
                                                        |
| 415 | 415 | }  | 
                                                        
| 416 | 416 | }  | 
                                                        
| 417 | 417 | //filter the results, but use the old filter name  | 
                                                        
@@ -1,8 +1,8 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | use EventEspresso\core\libraries\rest_api\Calculated_Model_Fields;  | 
                                                        
| 3 | 3 | |
| 4 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { | 
                                                        |
| 5 | - exit( 'No direct script access allowed' );  | 
                                                        |
| 4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { | 
                                                        |
| 5 | +	exit('No direct script access allowed'); | 
                                                        |
| 6 | 6 | }  | 
                                                        
| 7 | 7 | |
| 8 | 8 | /**  | 
                                                        
@@ -35,7 +35,7 @@ discard block  | 
                                                    ||
| 35 | 35 | */  | 
                                                        
| 36 | 36 |  	public static function instance() { | 
                                                        
| 37 | 37 | self::$_field_calculator = new Calculated_Model_Fields();  | 
                                                        
| 38 | - return parent::get_instance( __CLASS__ );  | 
                                                        |
| 38 | + return parent::get_instance(__CLASS__);  | 
                                                        |
| 39 | 39 | }  | 
                                                        
| 40 | 40 | |
| 41 | 41 | |
@@ -65,10 +65,10 @@ discard block  | 
                                                    ||
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 |  	public static function set_hooks_both() { | 
                                                        
| 68 | - add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'register_routes' ), 10 );  | 
                                                        |
| 69 | - add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'set_hooks_rest_api' ), 5 );  | 
                                                        |
| 70 | - add_filter( 'rest_route_data', array( 'EED_Core_Rest_Api', 'hide_old_endpoints' ), 10, 2 );  | 
                                                        |
| 71 | - add_filter( 'rest_index', array( 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index' ) );  | 
                                                        |
| 68 | +		add_action('rest_api_init', array('EED_Core_Rest_Api', 'register_routes'), 10); | 
                                                        |
| 69 | +		add_action('rest_api_init', array('EED_Core_Rest_Api', 'set_hooks_rest_api'), 5); | 
                                                        |
| 70 | +		add_filter('rest_route_data', array('EED_Core_Rest_Api', 'hide_old_endpoints'), 10, 2); | 
                                                        |
| 71 | +		add_filter('rest_index', array('EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index')); | 
                                                        |
| 72 | 72 | EED_Core_Rest_Api::invalidate_cached_route_data_on_version_change();  | 
                                                        
| 73 | 73 | }  | 
                                                        
| 74 | 74 | |
@@ -87,7 +87,7 @@ discard block  | 
                                                    ||
| 87 | 87 | * Loads all the hooks which make requests to old versions of the API  | 
                                                        
| 88 | 88 | * appear the same as they always did  | 
                                                        
| 89 | 89 | */  | 
                                                        
| 90 | -	public static function set_hooks_for_changes(){ | 
                                                        |
| 90 | +	public static function set_hooks_for_changes() { | 
                                                        |
| 91 | 91 | self::_set_hooks_for_changes();  | 
                                                        
| 92 | 92 | }  | 
                                                        
| 93 | 93 | |
@@ -97,27 +97,27 @@ discard block  | 
                                                    ||
| 97 | 97 | * replace it with application passwords.  | 
                                                        
| 98 | 98 | */  | 
                                                        
| 99 | 99 |  	public static function maybe_notify_of_basic_auth_removal() { | 
                                                        
| 100 | - if( ! isset( $_SERVER['PHP_AUTH_USER'] )  | 
                                                        |
| 101 | -			&& ! isset( $_SERVER['HTTP_AUTHORIZATION'] ) ) { | 
                                                        |
| 100 | + if ( ! isset($_SERVER['PHP_AUTH_USER'])  | 
                                                        |
| 101 | +			&& ! isset($_SERVER['HTTP_AUTHORIZATION'])) { | 
                                                        |
| 102 | 102 | //sure it's a WP API request, but they aren't using basic auth, so don't bother them  | 
                                                        
| 103 | 103 | return;  | 
                                                        
| 104 | 104 | }  | 
                                                        
| 105 | 105 | //ok they're using the WP API with Basic Auth  | 
                                                        
| 106 | 106 | $message = sprintf(  | 
                                                        
| 107 | - __( 'We noticed you\'re using the WP API, which is used by the Event Espresso 4 mobile apps. Because of security and compatibility concerns, we will soon be removing our default authentication mechanism, WP API Basic Auth, from Event Espresso. It is recommended you instead install the %1$sWP Application Passwords plugin%2$s and use it with the EE4 Mobile apps. See %3$sour mobile app documentation%2$s for more information. %4$sIf you have installed the WP API Basic Auth plugin separately, or are not using the Event Espresso 4 mobile apps, you can disregard this message.%4$sThe Event Espresso Team', 'event_espresso' ),  | 
                                                        |
| 107 | +			__('We noticed you\'re using the WP API, which is used by the Event Espresso 4 mobile apps. Because of security and compatibility concerns, we will soon be removing our default authentication mechanism, WP API Basic Auth, from Event Espresso. It is recommended you instead install the %1$sWP Application Passwords plugin%2$s and use it with the EE4 Mobile apps. See %3$sour mobile app documentation%2$s for more information. %4$sIf you have installed the WP API Basic Auth plugin separately, or are not using the Event Espresso 4 mobile apps, you can disregard this message.%4$sThe Event Espresso Team', 'event_espresso'), | 
                                                        |
| 108 | 108 | '<a href="https://wordpress.org/plugins/application-passwords/">',  | 
                                                        
| 109 | 109 | '</a>',  | 
                                                        
| 110 | 110 | '<a href="https://eventespresso.com/wiki/ee4-event-apps/#authentication">',  | 
                                                        
| 111 | 111 | '<br/>'  | 
                                                        
| 112 | 112 | );  | 
                                                        
| 113 | - EE_Error::add_persistent_admin_notice( 'using_basic_auth', $message );  | 
                                                        |
| 114 | -		if( ! get_option( 'ee_notified_admin_on_basic_auth_removal', false ) ) { | 
                                                        |
| 115 | - add_option( 'ee_notified_admin_on_basic_auth_removal', true );  | 
                                                        |
| 113 | +		EE_Error::add_persistent_admin_notice('using_basic_auth', $message); | 
                                                        |
| 114 | +		if ( ! get_option('ee_notified_admin_on_basic_auth_removal', false)) { | 
                                                        |
| 115 | +			add_option('ee_notified_admin_on_basic_auth_removal', true); | 
                                                        |
| 116 | 116 | //piggy back off EE_Error::set_content_type, which sets the content type to HTML  | 
                                                        
| 117 | - add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' ));  | 
                                                        |
| 117 | +			add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type')); | 
                                                        |
| 118 | 118 | //and send the message to the site admin too  | 
                                                        
| 119 | - wp_mail( get_option( 'admin_email' ), __( 'Notice of Removal of WP API Basic Auth From Event Espresso 4', 'event_espresso' ), $message );  | 
                                                        |
| 120 | - remove_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' ));  | 
                                                        |
| 119 | +			wp_mail(get_option('admin_email'), __('Notice of Removal of WP API Basic Auth From Event Espresso 4', 'event_espresso'), $message); | 
                                                        |
| 120 | +			remove_filter('wp_mail_content_type', array('EE_Error', 'set_content_type')); | 
                                                        |
| 121 | 121 | }  | 
                                                        
| 122 | 122 | }  | 
                                                        
| 123 | 123 | /**  | 
                                                        
@@ -125,16 +125,16 @@ discard block  | 
                                                    ||
| 125 | 125 | * appear the same as they always did  | 
                                                        
| 126 | 126 | */  | 
                                                        
| 127 | 127 |  	protected static function _set_hooks_for_changes() { | 
                                                        
| 128 | - $folder_contents = EEH_File::get_contents_of_folders( array( EE_LIBRARIES . 'rest_api' . DS . 'changes' ), false );  | 
                                                        |
| 129 | -		foreach( $folder_contents as $classname_in_namespace => $filepath ) { | 
                                                        |
| 128 | + $folder_contents = EEH_File::get_contents_of_folders(array(EE_LIBRARIES.'rest_api'.DS.'changes'), false);  | 
                                                        |
| 129 | +		foreach ($folder_contents as $classname_in_namespace => $filepath) { | 
                                                        |
| 130 | 130 | //ignore the base parent class  | 
                                                        
| 131 | -			if( $classname_in_namespace === 'Changes_In_Base' ) { | 
                                                        |
| 131 | +			if ($classname_in_namespace === 'Changes_In_Base') { | 
                                                        |
| 132 | 132 | continue;  | 
                                                        
| 133 | 133 | }  | 
                                                        
| 134 | - $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace;  | 
                                                        |
| 135 | -			if ( class_exists( $full_classname )) { | 
                                                        |
| 134 | + $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\'.$classname_in_namespace;  | 
                                                        |
| 135 | +			if (class_exists($full_classname)) { | 
                                                        |
| 136 | 136 | $instance_of_class = new $full_classname;  | 
                                                        
| 137 | -				if ( $instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base ) { | 
                                                        |
| 137 | +				if ($instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base) { | 
                                                        |
| 138 | 138 | $instance_of_class->set_hooks();  | 
                                                        
| 139 | 139 | }  | 
                                                        
| 140 | 140 | }  | 
                                                        
@@ -147,16 +147,16 @@ discard block  | 
                                                    ||
| 147 | 147 | * so we actually prefer to only do it when an EE plugin is activated or upgraded  | 
                                                        
| 148 | 148 | */  | 
                                                        
| 149 | 149 |  	public static function register_routes() { | 
                                                        
| 150 | -		foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) { | 
                                                        |
| 151 | -			foreach( $relative_urls as $endpoint => $routes ) { | 
                                                        |
| 152 | -				foreach( $routes as $route ) { | 
                                                        |
| 150 | +		foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { | 
                                                        |
| 151 | +			foreach ($relative_urls as $endpoint => $routes) { | 
                                                        |
| 152 | +				foreach ($routes as $route) { | 
                                                        |
| 153 | 153 | register_rest_route(  | 
                                                        
| 154 | 154 | $namespace,  | 
                                                        
| 155 | 155 | $endpoint,  | 
                                                        
| 156 | 156 | array(  | 
                                                        
| 157 | - 'callback' => $route[ 'callback' ],  | 
                                                        |
| 158 | - 'methods' => $route[ 'methods' ],  | 
                                                        |
| 159 | - 'args' => isset( $route[ 'args' ] ) ? $route[ 'args' ] : array(),  | 
                                                        |
| 157 | + 'callback' => $route['callback'],  | 
                                                        |
| 158 | + 'methods' => $route['methods'],  | 
                                                        |
| 159 | + 'args' => isset($route['args']) ? $route['args'] : array(),  | 
                                                        |
| 160 | 160 | )  | 
                                                        
| 161 | 161 | );  | 
                                                        
| 162 | 162 | }  | 
                                                        
@@ -170,11 +170,11 @@ discard block  | 
                                                    ||
| 170 | 170 | * next time the WP API is used  | 
                                                        
| 171 | 171 | */  | 
                                                        
| 172 | 172 |  	public static function invalidate_cached_route_data_on_version_change() { | 
                                                        
| 173 | -		if( EE_System::instance()->detect_req_type() != EE_System::req_type_normal ) { | 
                                                        |
| 173 | +		if (EE_System::instance()->detect_req_type() != EE_System::req_type_normal) { | 
                                                        |
| 174 | 174 | EED_Core_Rest_Api::invalidate_cached_route_data();  | 
                                                        
| 175 | 175 | }  | 
                                                        
| 176 | -		foreach( EE_Registry::instance()->addons as $addon ){ | 
                                                        |
| 177 | -			if( $addon instanceof EE_Addon && $addon->detect_req_type() != EE_System::req_type_normal ) { | 
                                                        |
| 176 | +		foreach (EE_Registry::instance()->addons as $addon) { | 
                                                        |
| 177 | +			if ($addon instanceof EE_Addon && $addon->detect_req_type() != EE_System::req_type_normal) { | 
                                                        |
| 178 | 178 | EED_Core_Rest_Api::invalidate_cached_route_data();  | 
                                                        
| 179 | 179 | }  | 
                                                        
| 180 | 180 | }  | 
                                                        
@@ -185,7 +185,7 @@ discard block  | 
                                                    ||
| 185 | 185 | */  | 
                                                        
| 186 | 186 |  	public static function invalidate_cached_route_data() { | 
                                                        
| 187 | 187 | //delete the saved EE REST API routes  | 
                                                        
| 188 | - delete_option( EED_Core_Rest_Api::saved_routes_option_names );  | 
                                                        |
| 188 | + delete_option(EED_Core_Rest_Api::saved_routes_option_names);  | 
                                                        |
| 189 | 189 | }  | 
                                                        
| 190 | 190 | |
| 191 | 191 | /**  | 
                                                        
@@ -198,8 +198,8 @@ discard block  | 
                                                    ||
| 198 | 198 | */  | 
                                                        
| 199 | 199 |  	public static function get_ee_route_data() { | 
                                                        
| 200 | 200 | $ee_routes = array();  | 
                                                        
| 201 | -		foreach( self::versions_served() as $version => $hidden_endpoints ) { | 
                                                        |
| 202 | - $ee_routes[ self::ee_api_namespace . $version ] = self::_get_ee_route_data_for_version( $version, $hidden_endpoints );  | 
                                                        |
| 201 | +		foreach (self::versions_served() as $version => $hidden_endpoints) { | 
                                                        |
| 202 | + $ee_routes[self::ee_api_namespace.$version] = self::_get_ee_route_data_for_version($version, $hidden_endpoints);  | 
                                                        |
| 203 | 203 | }  | 
                                                        
| 204 | 204 | return $ee_routes;  | 
                                                        
| 205 | 205 | }  | 
                                                        
@@ -211,10 +211,10 @@ discard block  | 
                                                    ||
| 211 | 211 | * @param boolean $hidden_endpoints  | 
                                                        
| 212 | 212 | * @return array  | 
                                                        
| 213 | 213 | */  | 
                                                        
| 214 | -	protected static function _get_ee_route_data_for_version( $version, $hidden_endpoints = false ) { | 
                                                        |
| 215 | - $ee_routes = get_option( self::saved_routes_option_names . $version , null );  | 
                                                        |
| 216 | -		if( ! $ee_routes || ( defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE )){ | 
                                                        |
| 217 | - $ee_routes = self::_save_ee_route_data_for_version( $version, $hidden_endpoints );  | 
                                                        |
| 214 | +	protected static function _get_ee_route_data_for_version($version, $hidden_endpoints = false) { | 
                                                        |
| 215 | + $ee_routes = get_option(self::saved_routes_option_names.$version, null);  | 
                                                        |
| 216 | +		if ( ! $ee_routes || (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE)) { | 
                                                        |
| 217 | + $ee_routes = self::_save_ee_route_data_for_version($version, $hidden_endpoints);  | 
                                                        |
| 218 | 218 | }  | 
                                                        
| 219 | 219 | return $ee_routes;  | 
                                                        
| 220 | 220 | }  | 
                                                        
@@ -228,18 +228,18 @@ discard block  | 
                                                    ||
| 228 | 228 | * @param boolean $hidden_endpoints  | 
                                                        
| 229 | 229 | * @return mixed|null|void  | 
                                                        
| 230 | 230 | */  | 
                                                        
| 231 | -	protected static function _save_ee_route_data_for_version( $version, $hidden_endpoints = false ) { | 
                                                        |
| 231 | +	protected static function _save_ee_route_data_for_version($version, $hidden_endpoints = false) { | 
                                                        |
| 232 | 232 | $instance = self::instance();  | 
                                                        
| 233 | 233 | $routes = apply_filters(  | 
                                                        
| 234 | 234 | 'EED_Core_Rest_Api__save_ee_route_data_for_version__routes',  | 
                                                        
| 235 | 235 | array_replace_recursive(  | 
                                                        
| 236 | - $instance->_get_config_route_data_for_version( $version, $hidden_endpoints ),  | 
                                                        |
| 237 | - $instance->_get_meta_route_data_for_version( $version, $hidden_endpoints ),  | 
                                                        |
| 238 | - $instance->_get_model_route_data_for_version( $version, $hidden_endpoints ),  | 
                                                        |
| 239 | - $instance->_get_rpc_route_data_for_version( $version, $hidden_endpoints )  | 
                                                        |
| 236 | + $instance->_get_config_route_data_for_version($version, $hidden_endpoints),  | 
                                                        |
| 237 | + $instance->_get_meta_route_data_for_version($version, $hidden_endpoints),  | 
                                                        |
| 238 | + $instance->_get_model_route_data_for_version($version, $hidden_endpoints),  | 
                                                        |
| 239 | + $instance->_get_rpc_route_data_for_version($version, $hidden_endpoints)  | 
                                                        |
| 240 | 240 | )  | 
                                                        
| 241 | 241 | );  | 
                                                        
| 242 | - update_option( self::saved_routes_option_names . $version, $routes, true );  | 
                                                        |
| 242 | + update_option(self::saved_routes_option_names.$version, $routes, true);  | 
                                                        |
| 243 | 243 | return $routes;  | 
                                                        
| 244 | 244 | }  | 
                                                        
| 245 | 245 | |
@@ -250,7 +250,7 @@ discard block  | 
                                                    ||
| 250 | 250 | * @return void  | 
                                                        
| 251 | 251 | */  | 
                                                        
| 252 | 252 |  	public static function save_ee_routes() { | 
                                                        
| 253 | -		if( EE_Maintenance_Mode::instance()->models_can_query() ){ | 
                                                        |
| 253 | +		if (EE_Maintenance_Mode::instance()->models_can_query()) { | 
                                                        |
| 254 | 254 | $instance = self::instance();  | 
                                                        
| 255 | 255 | $routes = apply_filters(  | 
                                                        
| 256 | 256 | 'EED_Core_Rest_Api__save_ee_routes__routes',  | 
                                                        
@@ -261,7 +261,7 @@ discard block  | 
                                                    ||
| 261 | 261 | $instance->_register_rpc_routes()  | 
                                                        
| 262 | 262 | )  | 
                                                        
| 263 | 263 | );  | 
                                                        
| 264 | - update_option( self::saved_routes_option_names, $routes, true );  | 
                                                        |
| 264 | + update_option(self::saved_routes_option_names, $routes, true);  | 
                                                        |
| 265 | 265 | }  | 
                                                        
| 266 | 266 | }  | 
                                                        
| 267 | 267 | |
@@ -272,8 +272,8 @@ discard block  | 
                                                    ||
| 272 | 272 | */  | 
                                                        
| 273 | 273 |  	protected function _register_model_routes() { | 
                                                        
| 274 | 274 | $model_routes = array( );  | 
                                                        
| 275 | -		foreach( self::versions_served() as $version => $hidden_endpoint ) { | 
                                                        |
| 276 | - $model_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_config_route_data_for_version( $version, $hidden_endpoint );  | 
                                                        |
| 275 | +		foreach (self::versions_served() as $version => $hidden_endpoint) { | 
                                                        |
| 276 | + $model_routes[EED_Core_Rest_Api::ee_api_namespace.$version] = $this->_get_config_route_data_for_version($version, $hidden_endpoint);  | 
                                                        |
| 277 | 277 | }  | 
                                                        
| 278 | 278 | return $model_routes;  | 
                                                        
| 279 | 279 | }  | 
                                                        
@@ -284,8 +284,8 @@ discard block  | 
                                                    ||
| 284 | 284 | * @param boolean $hidden_endpoint  | 
                                                        
| 285 | 285 | * @return array  | 
                                                        
| 286 | 286 | */  | 
                                                        
| 287 | -	protected function _get_model_route_data_for_version( $version, $hidden_endpoint = false ) { | 
                                                        |
| 288 | - $model_version_info = new \EventEspresso\core\libraries\rest_api\Model_Version_Info( $version );  | 
                                                        |
| 287 | +	protected function _get_model_route_data_for_version($version, $hidden_endpoint = false) { | 
                                                        |
| 288 | + $model_version_info = new \EventEspresso\core\libraries\rest_api\Model_Version_Info($version);  | 
                                                        |
| 289 | 289 | $models_to_register = apply_filters(  | 
                                                        
| 290 | 290 | 'FHEE__EED_Core_REST_API___register_model_routes',  | 
                                                        
| 291 | 291 | $model_version_info->models_for_requested_version()  | 
                                                        
@@ -294,21 +294,21 @@ discard block  | 
                                                    ||
| 294 | 294 | unset($models_to_register['Extra_Meta']);  | 
                                                        
| 295 | 295 | unset($models_to_register['Extra_Join']);  | 
                                                        
| 296 | 296 | $model_routes = array();  | 
                                                        
| 297 | -		foreach ( $models_to_register as $model_name => $model_classname ) { | 
                                                        |
| 298 | - $model = \EE_Registry::instance()->load_model( $model_name );  | 
                                                        |
| 297 | +		foreach ($models_to_register as $model_name => $model_classname) { | 
                                                        |
| 298 | + $model = \EE_Registry::instance()->load_model($model_name);  | 
                                                        |
| 299 | 299 | //yes we could just register one route for ALL models, but then they wouldn't show up in the index  | 
                                                        
| 300 | - $plural_model_route = EEH_Inflector::pluralize_and_lower( $model_name );  | 
                                                        |
| 301 | - $singular_model_route = $plural_model_route . '/(?P<id>\d+)' ;  | 
                                                        |
| 302 | - $model_routes[ $plural_model_route ] = array(  | 
                                                        |
| 300 | + $plural_model_route = EEH_Inflector::pluralize_and_lower($model_name);  | 
                                                        |
| 301 | + $singular_model_route = $plural_model_route.'/(?P<id>\d+)';  | 
                                                        |
| 302 | + $model_routes[$plural_model_route] = array(  | 
                                                        |
| 303 | 303 | array(  | 
                                                        
| 304 | 304 | 'callback' => array(  | 
                                                        
| 305 | 305 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read',  | 
                                                        
| 306 | 306 | 'handle_request_get_all' ),  | 
                                                        
| 307 | 307 | 'methods' => WP_REST_Server::READABLE,  | 
                                                        
| 308 | 308 | 'hidden_endpoint' => $hidden_endpoint,  | 
                                                        
| 309 | - 'args' => $this->_get_read_query_params( $model, $version ),  | 
                                                        |
| 309 | + 'args' => $this->_get_read_query_params($model, $version),  | 
                                                        |
| 310 | 310 | '_links' => array(  | 
                                                        
| 311 | - 'self' => rest_url( EED_Core_Rest_Api::ee_api_namespace . $version . $singular_model_route ),  | 
                                                        |
| 311 | + 'self' => rest_url(EED_Core_Rest_Api::ee_api_namespace.$version.$singular_model_route),  | 
                                                        |
| 312 | 312 | )  | 
                                                        
| 313 | 313 | ),  | 
                                                        
| 314 | 314 | // array(  | 
                                                        
@@ -319,14 +319,14 @@ discard block  | 
                                                    ||
| 319 | 319 | // 'hidden_endpoint' => $hidden_endpoint  | 
                                                        
| 320 | 320 | // )  | 
                                                        
| 321 | 321 | );  | 
                                                        
| 322 | - $model_routes[ $singular_model_route ] = array(  | 
                                                        |
| 322 | + $model_routes[$singular_model_route] = array(  | 
                                                        |
| 323 | 323 | array(  | 
                                                        
| 324 | 324 | 'callback' => array(  | 
                                                        
| 325 | 325 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read',  | 
                                                        
| 326 | 326 | 'handle_request_get_one' ),  | 
                                                        
| 327 | 327 | 'methods' => WP_REST_Server::READABLE,  | 
                                                        
| 328 | 328 | 'hidden_endpoint' => $hidden_endpoint,  | 
                                                        
| 329 | - 'args' => $this->_get_response_selection_query_params( $model, $version)  | 
                                                        |
| 329 | + 'args' => $this->_get_response_selection_query_params($model, $version)  | 
                                                        |
| 330 | 330 | ),  | 
                                                        
| 331 | 331 | // array(  | 
                                                        
| 332 | 332 | // 'callback' => array(  | 
                                                        
@@ -337,19 +337,19 @@ discard block  | 
                                                    ||
| 337 | 337 | // ),  | 
                                                        
| 338 | 338 | );  | 
                                                        
| 339 | 339 | //@todo: also handle DELETE for a single item  | 
                                                        
| 340 | -			foreach ( $model_version_info->relation_settings( $model ) as $relation_name => $relation_obj ) { | 
                                                        |
| 340 | +			foreach ($model_version_info->relation_settings($model) as $relation_name => $relation_obj) { | 
                                                        |
| 341 | 341 | $related_model_name_endpoint_part = EventEspresso\core\libraries\rest_api\controllers\model\Read::get_related_entity_name(  | 
                                                        
| 342 | 342 | $relation_name,  | 
                                                        
| 343 | 343 | $relation_obj  | 
                                                        
| 344 | 344 | );  | 
                                                        
| 345 | - $model_routes[ $singular_model_route . '/' . $related_model_name_endpoint_part ] = array(  | 
                                                        |
| 345 | + $model_routes[$singular_model_route.'/'.$related_model_name_endpoint_part] = array(  | 
                                                        |
| 346 | 346 | array(  | 
                                                        
| 347 | 347 | 'callback' => array(  | 
                                                        
| 348 | 348 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read',  | 
                                                        
| 349 | 349 | 'handle_request_get_related' ),  | 
                                                        
| 350 | 350 | 'methods' => WP_REST_Server::READABLE,  | 
                                                        
| 351 | 351 | 'hidden_endpoint' => $hidden_endpoint,  | 
                                                        
| 352 | - 'args' => $this->_get_read_query_params( $relation_obj->get_other_model(), $version ),  | 
                                                        |
| 352 | + 'args' => $this->_get_read_query_params($relation_obj->get_other_model(), $version),  | 
                                                        |
| 353 | 353 | ),  | 
                                                        
| 354 | 354 | // array(  | 
                                                        
| 355 | 355 | // 'callback' => array(  | 
                                                        
@@ -372,8 +372,8 @@ discard block  | 
                                                    ||
| 372 | 372 | */  | 
                                                        
| 373 | 373 |  	protected function _register_rpc_routes() { | 
                                                        
| 374 | 374 | $routes = array();  | 
                                                        
| 375 | -		foreach( self::versions_served() as $version => $hidden_endpoint ) { | 
                                                        |
| 376 | - $routes[ self::ee_api_namespace . $version ] = $this->_get_rpc_route_data_for_version( $version, $hidden_endpoint );  | 
                                                        |
| 375 | +		foreach (self::versions_served() as $version => $hidden_endpoint) { | 
                                                        |
| 376 | + $routes[self::ee_api_namespace.$version] = $this->_get_rpc_route_data_for_version($version, $hidden_endpoint);  | 
                                                        |
| 377 | 377 | }  | 
                                                        
| 378 | 378 | return $routes;  | 
                                                        
| 379 | 379 | }  | 
                                                        
@@ -384,10 +384,10 @@ discard block  | 
                                                    ||
| 384 | 384 | * @param boolean $hidden_endpoint  | 
                                                        
| 385 | 385 | * @return array  | 
                                                        
| 386 | 386 | */  | 
                                                        
| 387 | -	protected function _get_rpc_route_data_for_version( $version, $hidden_endpoint = false ) { | 
                                                        |
| 387 | +	protected function _get_rpc_route_data_for_version($version, $hidden_endpoint = false) { | 
                                                        |
| 388 | 388 | $this_versions_routes = array();  | 
                                                        
| 389 | 389 | //checkin endpoint  | 
                                                        
| 390 | - $this_versions_routes[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] = array(  | 
                                                        |
| 390 | + $this_versions_routes['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)'] = array(  | 
                                                        |
| 391 | 391 | array(  | 
                                                        
| 392 | 392 | 'callback' => array(  | 
                                                        
| 393 | 393 | 'EventEspresso\core\libraries\rest_api\controllers\rpc\Checkin',  | 
                                                        
@@ -398,7 +398,7 @@ discard block  | 
                                                    ||
| 398 | 398 | 'force' => array(  | 
                                                        
| 399 | 399 | 'required' => false,  | 
                                                        
| 400 | 400 | 'default' => false,  | 
                                                        
| 401 | - 'description' => __( 'Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso' )  | 
                                                        |
| 401 | +							'description' => __('Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso') | 
                                                        |
| 402 | 402 | )  | 
                                                        
| 403 | 403 | )  | 
                                                        
| 404 | 404 | )  | 
                                                        
@@ -417,7 +417,7 @@ discard block  | 
                                                    ||
| 417 | 417 | * @param string $version  | 
                                                        
| 418 | 418 | * @return array  | 
                                                        
| 419 | 419 | */  | 
                                                        
| 420 | -	protected function _get_response_selection_query_params( \EEM_Base $model, $version ) { | 
                                                        |
| 420 | +	protected function _get_response_selection_query_params(\EEM_Base $model, $version) { | 
                                                        |
| 421 | 421 | return apply_filters(  | 
                                                        
| 422 | 422 | 'FHEE__EED_Core_Rest_Api___get_response_selection_query_params',  | 
                                                        
| 423 | 423 | array(  | 
                                                        
@@ -428,7 +428,7 @@ discard block  | 
                                                    ||
| 428 | 428 | 'calculate' => array(  | 
                                                        
| 429 | 429 | 'required' => false,  | 
                                                        
| 430 | 430 | 'default' => '',  | 
                                                        
| 431 | - 'enum' => self::$_field_calculator->retrieve_calculated_fields_for_model( $model )  | 
                                                        |
| 431 | + 'enum' => self::$_field_calculator->retrieve_calculated_fields_for_model($model)  | 
                                                        |
| 432 | 432 | )  | 
                                                        
| 433 | 433 | ),  | 
                                                        
| 434 | 434 | $model,  | 
                                                        
@@ -446,13 +446,13 @@ discard block  | 
                                                    ||
| 446 | 446 | * @return array describing the args acceptable when querying this model  | 
                                                        
| 447 | 447 | * @throws \EE_Error  | 
                                                        
| 448 | 448 | */  | 
                                                        
| 449 | -	protected function _get_read_query_params( \EEM_Base $model, $version ) { | 
                                                        |
| 449 | +	protected function _get_read_query_params(\EEM_Base $model, $version) { | 
                                                        |
| 450 | 450 | $default_orderby = array();  | 
                                                        
| 451 | -		foreach( $model->get_combined_primary_key_fields() as $key_field ) { | 
                                                        |
| 452 | - $default_orderby[ $key_field->get_name() ] = 'ASC';  | 
                                                        |
| 451 | +		foreach ($model->get_combined_primary_key_fields() as $key_field) { | 
                                                        |
| 452 | + $default_orderby[$key_field->get_name()] = 'ASC';  | 
                                                        |
| 453 | 453 | }  | 
                                                        
| 454 | 454 | return array_merge(  | 
                                                        
| 455 | - $this->_get_response_selection_query_params( $model, $version ),  | 
                                                        |
| 455 | + $this->_get_response_selection_query_params($model, $version),  | 
                                                        |
| 456 | 456 | array(  | 
                                                        
| 457 | 457 | 'where' => array(  | 
                                                        
| 458 | 458 | 'required' => false,  | 
                                                        
@@ -489,8 +489,8 @@ discard block  | 
                                                    ||
| 489 | 489 | */  | 
                                                        
| 490 | 490 |  	protected function _register_config_routes() { | 
                                                        
| 491 | 491 | $config_routes = array();  | 
                                                        
| 492 | -		foreach( self::versions_served() as $version => $hidden_endpoint ) { | 
                                                        |
| 493 | - $config_routes[ self::ee_api_namespace . $version ] = $this->_get_config_route_data_for_version( $version, $hidden_endpoint );  | 
                                                        |
| 492 | +		foreach (self::versions_served() as $version => $hidden_endpoint) { | 
                                                        |
| 493 | + $config_routes[self::ee_api_namespace.$version] = $this->_get_config_route_data_for_version($version, $hidden_endpoint);  | 
                                                        |
| 494 | 494 | }  | 
                                                        
| 495 | 495 | return $config_routes;  | 
                                                        
| 496 | 496 | }  | 
                                                        
@@ -501,7 +501,7 @@ discard block  | 
                                                    ||
| 501 | 501 | * @param boolean $hidden_endpoint  | 
                                                        
| 502 | 502 | * @return array  | 
                                                        
| 503 | 503 | */  | 
                                                        
| 504 | -	protected function _get_config_route_data_for_version( $version, $hidden_endpoint ) { | 
                                                        |
| 504 | +	protected function _get_config_route_data_for_version($version, $hidden_endpoint) { | 
                                                        |
| 505 | 505 | return array(  | 
                                                        
| 506 | 506 | 'config' => array(  | 
                                                        
| 507 | 507 | array(  | 
                                                        
@@ -522,8 +522,8 @@ discard block  | 
                                                    ||
| 522 | 522 | */  | 
                                                        
| 523 | 523 |  	protected function _register_meta_routes() { | 
                                                        
| 524 | 524 | $meta_routes = array();  | 
                                                        
| 525 | -		foreach( self::versions_served() as $version => $hidden_endpoint ) { | 
                                                        |
| 526 | - $meta_routes[ self::ee_api_namespace . $version ] = $this->_get_meta_route_data_for_version( $version, $hidden_endpoint );  | 
                                                        |
| 525 | +		foreach (self::versions_served() as $version => $hidden_endpoint) { | 
                                                        |
| 526 | + $meta_routes[self::ee_api_namespace.$version] = $this->_get_meta_route_data_for_version($version, $hidden_endpoint);  | 
                                                        |
| 527 | 527 | }  | 
                                                        
| 528 | 528 | return $meta_routes;  | 
                                                        
| 529 | 529 | }  | 
                                                        
@@ -534,7 +534,7 @@ discard block  | 
                                                    ||
| 534 | 534 | * @param boolean $hidden_endpoint  | 
                                                        
| 535 | 535 | * @return array  | 
                                                        
| 536 | 536 | */  | 
                                                        
| 537 | -	protected function _get_meta_route_data_for_version( $version, $hidden_endpoint = false ) { | 
                                                        |
| 537 | +	protected function _get_meta_route_data_for_version($version, $hidden_endpoint = false) { | 
                                                        |
| 538 | 538 | return array(  | 
                                                        
| 539 | 539 | 'resources' => array(  | 
                                                        
| 540 | 540 | array(  | 
                                                        
@@ -556,13 +556,13 @@ discard block  | 
                                                    ||
| 556 | 556 | * @param array $route_data  | 
                                                        
| 557 | 557 | * @return array  | 
                                                        
| 558 | 558 | */  | 
                                                        
| 559 | -	public static function hide_old_endpoints( $route_data ) { | 
                                                        |
| 560 | -		foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) { | 
                                                        |
| 561 | -			foreach( $relative_urls as $endpoint => $routes ) { | 
                                                        |
| 562 | -				foreach( $routes as $route ) { | 
                                                        |
| 563 | -					if( $route[ 'hidden_endpoint' ] ) { | 
                                                        |
| 564 | - $full_route = '/' . ltrim( $namespace, '/' ) . '/' . ltrim( $endpoint, '/' );  | 
                                                        |
| 565 | - unset( $route_data[ $full_route ] );  | 
                                                        |
| 559 | +	public static function hide_old_endpoints($route_data) { | 
                                                        |
| 560 | +		foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { | 
                                                        |
| 561 | +			foreach ($relative_urls as $endpoint => $routes) { | 
                                                        |
| 562 | +				foreach ($routes as $route) { | 
                                                        |
| 563 | +					if ($route['hidden_endpoint']) { | 
                                                        |
| 564 | + $full_route = '/'.ltrim($namespace, '/').'/'.ltrim($endpoint, '/');  | 
                                                        |
| 565 | + unset($route_data[$full_route]);  | 
                                                        |
| 566 | 566 | }  | 
                                                        
| 567 | 567 | }  | 
                                                        
| 568 | 568 | }  | 
                                                        
@@ -601,8 +601,8 @@ discard block  | 
                                                    ||
| 601 | 601 | */  | 
                                                        
| 602 | 602 |  	public static function latest_rest_api_version() { | 
                                                        
| 603 | 603 | $versions_served = \EED_Core_Rest_Api::versions_served();  | 
                                                        
| 604 | - $versions_served_keys = array_keys( $versions_served );  | 
                                                        |
| 605 | - return end( $versions_served_keys );  | 
                                                        |
| 604 | + $versions_served_keys = array_keys($versions_served);  | 
                                                        |
| 605 | + return end($versions_served_keys);  | 
                                                        |
| 606 | 606 | }  | 
                                                        
| 607 | 607 | |
| 608 | 608 | /**  | 
                                                        
@@ -616,32 +616,32 @@ discard block  | 
                                                    ||
| 616 | 616 |  	public static function versions_served() { | 
                                                        
| 617 | 617 | $versions_served = array();  | 
                                                        
| 618 | 618 | $possibly_served_versions = EED_Core_Rest_Api::version_compatibilities();  | 
                                                        
| 619 | - $lowest_compatible_version = end( $possibly_served_versions);  | 
                                                        |
| 620 | - reset( $possibly_served_versions );  | 
                                                        |
| 621 | - $versions_served_historically = array_keys( $possibly_served_versions );  | 
                                                        |
| 622 | - $latest_version = end( $versions_served_historically );  | 
                                                        |
| 623 | - reset( $versions_served_historically );  | 
                                                        |
| 619 | + $lowest_compatible_version = end($possibly_served_versions);  | 
                                                        |
| 620 | + reset($possibly_served_versions);  | 
                                                        |
| 621 | + $versions_served_historically = array_keys($possibly_served_versions);  | 
                                                        |
| 622 | + $latest_version = end($versions_served_historically);  | 
                                                        |
| 623 | + reset($versions_served_historically);  | 
                                                        |
| 624 | 624 | //for each version of core we have ever served:  | 
                                                        
| 625 | -		foreach ( $versions_served_historically as $key_versioned_endpoint ) { | 
                                                        |
| 625 | +		foreach ($versions_served_historically as $key_versioned_endpoint) { | 
                                                        |
| 626 | 626 | //if it's not above the current core version, and it's compatible with the current version of core  | 
                                                        
| 627 | -			if( $key_versioned_endpoint == $latest_version ) { | 
                                                        |
| 627 | +			if ($key_versioned_endpoint == $latest_version) { | 
                                                        |
| 628 | 628 | //don't hide the latest version in the index  | 
                                                        
| 629 | - $versions_served[ $key_versioned_endpoint ] = false;  | 
                                                        |
| 630 | - } else if(  | 
                                                        |
| 629 | + $versions_served[$key_versioned_endpoint] = false;  | 
                                                        |
| 630 | + } else if (  | 
                                                        |
| 631 | 631 | $key_versioned_endpoint < EED_Core_Rest_Api::core_version()  | 
                                                        
| 632 | 632 | && $key_versioned_endpoint >= $lowest_compatible_version  | 
                                                        
| 633 | 633 |  			) { | 
                                                        
| 634 | 634 | //include, but hide, previous versions which are still supported  | 
                                                        
| 635 | - $versions_served[ $key_versioned_endpoint ] = true;  | 
                                                        |
| 636 | - } elseif(  | 
                                                        |
| 635 | + $versions_served[$key_versioned_endpoint] = true;  | 
                                                        |
| 636 | + } elseif (  | 
                                                        |
| 637 | 637 | apply_filters(  | 
                                                        
| 638 | 638 | 'FHEE__EED_Core_Rest_Api__versions_served__include_incompatible_versions',  | 
                                                        
| 639 | 639 | false,  | 
                                                        
| 640 | 640 | $possibly_served_versions  | 
                                                        
| 641 | 641 | )  | 
                                                        
| 642 | -			){ | 
                                                        |
| 642 | +			) { | 
                                                        |
| 643 | 643 | //if a version is no longer supported, don't include it in index or list of versions served  | 
                                                        
| 644 | - $versions_served[ $key_versioned_endpoint ] = true;  | 
                                                        |
| 644 | + $versions_served[$key_versioned_endpoint] = true;  | 
                                                        |
| 645 | 645 | }  | 
                                                        
| 646 | 646 | }  | 
                                                        
| 647 | 647 | return $versions_served;  | 
                                                        
@@ -654,7 +654,7 @@ discard block  | 
                                                    ||
| 654 | 654 | * @return string  | 
                                                        
| 655 | 655 | */  | 
                                                        
| 656 | 656 |  	public static function core_version() { | 
                                                        
| 657 | -		return apply_filters( 'FHEE__EED_Core_REST_API__core_version', implode('.', array_slice( explode( '.', espresso_version() ), 0, 3 ) ) ); | 
                                                        |
| 657 | +		return apply_filters('FHEE__EED_Core_REST_API__core_version', implode('.', array_slice(explode('.', espresso_version()), 0, 3))); | 
                                                        |
| 658 | 658 | }  | 
                                                        
| 659 | 659 | |
| 660 | 660 | /**  | 
                                                        
@@ -679,7 +679,7 @@ discard block  | 
                                                    ||
| 679 | 679 | * @param WP $WP  | 
                                                        
| 680 | 680 | * @return void  | 
                                                        
| 681 | 681 | */  | 
                                                        
| 682 | -	public function run( $WP ) { | 
                                                        |
| 682 | +	public function run($WP) { | 
                                                        |
| 683 | 683 | |
| 684 | 684 | }  | 
                                                        
| 685 | 685 | |
@@ -32,7 +32,7 @@ discard block  | 
                                                    ||
| 32 | 32 | */  | 
                                                        
| 33 | 33 | |
| 34 | 34 |  if ( ! class_exists( 'WP_List_Table' )) { | 
                                                        
| 35 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );  | 
                                                        |
| 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 { | 
                                                        
@@ -771,19 +771,19 @@ discard block  | 
                                                    ||
| 771 | 771 | $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : '';  | 
                                                        
| 772 | 772 | $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : '';  | 
                                                        
| 773 | 773 | $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : '';  | 
                                                        
| 774 | -        try { | 
                                                        |
| 775 | - $content .= apply_filters(  | 
                                                        |
| 776 | - 'FHEE__EE_Admin_List_Table___action_string__action_items',  | 
                                                        |
| 777 | - $action_items,  | 
                                                        |
| 778 | - $item,  | 
                                                        |
| 779 | - $this  | 
                                                        |
| 780 | - );  | 
                                                        |
| 781 | -        } catch (\Exception $e) { | 
                                                        |
| 782 | -            if (WP_DEBUG) { | 
                                                        |
| 783 | - \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 784 | - }  | 
                                                        |
| 785 | - $content .= $action_items;  | 
                                                        |
| 786 | - }  | 
                                                        |
| 774 | +		try { | 
                                                        |
| 775 | + $content .= apply_filters(  | 
                                                        |
| 776 | + 'FHEE__EE_Admin_List_Table___action_string__action_items',  | 
                                                        |
| 777 | + $action_items,  | 
                                                        |
| 778 | + $item,  | 
                                                        |
| 779 | + $this  | 
                                                        |
| 780 | + );  | 
                                                        |
| 781 | +		} catch (\Exception $e) { | 
                                                        |
| 782 | +			if (WP_DEBUG) { | 
                                                        |
| 783 | + \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 784 | + }  | 
                                                        |
| 785 | + $content .= $action_items;  | 
                                                        |
| 786 | + }  | 
                                                        |
| 787 | 787 | $content .= ! empty( $action_container ) ? '</' . $action_container . '>' : '';  | 
                                                        
| 788 | 788 | return $content;  | 
                                                        
| 789 | 789 | }  | 
                                                        
@@ -1,5 +1,5 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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 { | 
                                                        
@@ -244,16 +244,16 @@ discard block  | 
                                                    ||
| 244 | 244 | * constructor  | 
                                                        
| 245 | 245 | * @param EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table.  | 
                                                        
| 246 | 246 | */  | 
                                                        
| 247 | -	public function __construct( EE_Admin_Page $admin_page ) { | 
                                                        |
| 247 | +	public function __construct(EE_Admin_Page $admin_page) { | 
                                                        |
| 248 | 248 | $this->_admin_page = $admin_page;  | 
                                                        
| 249 | 249 | $this->_req_data = $this->_admin_page->get_request_data();  | 
                                                        
| 250 | 250 | $this->_view = $this->_admin_page->get_view();  | 
                                                        
| 251 | - $this->_views = empty( $this->_views ) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views;  | 
                                                        |
| 251 | + $this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views;  | 
                                                        |
| 252 | 252 | $this->_current_page = $this->get_pagenum();  | 
                                                        
| 253 | - $this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view();  | 
                                                        |
| 254 | -		$this->_yes_no = array(  __('No', 'event_espresso'), __('Yes', 'event_espresso')); | 
                                                        |
| 253 | + $this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view();  | 
                                                        |
| 254 | +		$this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso')); | 
                                                        |
| 255 | 255 | |
| 256 | - $this->_per_page = $this->get_items_per_page( $this->_screen . '_per_page', 10 );  | 
                                                        |
| 256 | + $this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 10);  | 
                                                        |
| 257 | 257 | |
| 258 | 258 | $this->_setup_data();  | 
                                                        
| 259 | 259 | $this->_add_view_counts();  | 
                                                        
@@ -263,7 +263,7 @@ discard block  | 
                                                    ||
| 263 | 263 | $this->_set_properties();  | 
                                                        
| 264 | 264 | |
| 265 | 265 | //set primary column  | 
                                                        
| 266 | - add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ) );  | 
                                                        |
| 266 | +		add_filter('list_table_primary_column', array($this, 'set_primary_column')); | 
                                                        |
| 267 | 267 | |
| 268 | 268 | //set parent defaults  | 
                                                        
| 269 | 269 | parent::__construct($this->_wp_list_args);  | 
                                                        
@@ -339,17 +339,17 @@ discard block  | 
                                                    ||
| 339 | 339 | * @return string  | 
                                                        
| 340 | 340 | */  | 
                                                        
| 341 | 341 |  	protected function _get_hidden_fields() { | 
                                                        
| 342 | - $action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : '';  | 
                                                        |
| 343 | - $action = empty( $action ) && isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : $action;  | 
                                                        |
| 342 | + $action = isset($this->_req_data['route']) ? $this->_req_data['route'] : '';  | 
                                                        |
| 343 | + $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action;  | 
                                                        |
| 344 | 344 | //if action is STILL empty, then we set it to default  | 
                                                        
| 345 | - $action = empty( $action ) ? 'default' : $action;  | 
                                                        |
| 346 | - $field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n";  | 
                                                        |
| 347 | - $field .= '<input type="hidden" name="route" value="'. $action .'" />' . "\n";/**/  | 
                                                        |
| 348 | - $field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n";  | 
                                                        |
| 345 | + $action = empty($action) ? 'default' : $action;  | 
                                                        |
| 346 | + $field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n";  | 
                                                        |
| 347 | + $field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/  | 
                                                        |
| 348 | + $field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n";  | 
                                                        |
| 349 | 349 | |
| 350 | 350 | $bulk_actions = $this->_get_bulk_actions();  | 
                                                        
| 351 | -		foreach ( $bulk_actions as $bulk_action => $label ) { | 
                                                        |
| 352 | - $field .= '<input type="hidden" name="' . $bulk_action . '_nonce" value="' . wp_create_nonce ( $bulk_action . '_nonce' ) . '" />' . "\n";  | 
                                                        |
| 351 | +		foreach ($bulk_actions as $bulk_action => $label) { | 
                                                        |
| 352 | + $field .= '<input type="hidden" name="'.$bulk_action.'_nonce" value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n";  | 
                                                        |
| 353 | 353 | }  | 
                                                        
| 354 | 354 | |
| 355 | 355 | return $field;  | 
                                                        
@@ -379,15 +379,15 @@ discard block  | 
                                                    ||
| 379 | 379 | *  | 
                                                        
| 380 | 380 | * @var array  | 
                                                        
| 381 | 381 | */  | 
                                                        
| 382 | -		$_sortable = apply_filters( "FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen ); | 
                                                        |
| 382 | +		$_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen); | 
                                                        |
| 383 | 383 | |
| 384 | 384 | $sortable = array();  | 
                                                        
| 385 | -		foreach ( $_sortable as $id => $data ) { | 
                                                        |
| 386 | - if ( empty( $data ) )  | 
                                                        |
| 385 | +		foreach ($_sortable as $id => $data) { | 
                                                        |
| 386 | + if (empty($data))  | 
                                                        |
| 387 | 387 | continue;  | 
                                                        
| 388 | 388 | |
| 389 | 389 | //fix for offset errors with WP_List_Table default get_columninfo()  | 
                                                        
| 390 | -			if ( is_array($data) ) { | 
                                                        |
| 390 | +			if (is_array($data)) { | 
                                                        |
| 391 | 391 | $_data[0] = key($data);  | 
                                                        
| 392 | 392 | $_data[1] = isset($data[1]) ? $data[1] : false;  | 
                                                        
| 393 | 393 |  			} else { | 
                                                        
@@ -396,14 +396,14 @@ discard block  | 
                                                    ||
| 396 | 396 | |
| 397 | 397 | $data = (array) $data;  | 
                                                        
| 398 | 398 | |
| 399 | - if ( !isset( $data[1] ) )  | 
                                                        |
| 399 | + if ( ! isset($data[1]))  | 
                                                        |
| 400 | 400 | $_data[1] = false;  | 
                                                        
| 401 | 401 | |
| 402 | 402 | |
| 403 | 403 | $sortable[$id] = $_data;  | 
                                                        
| 404 | 404 | }  | 
                                                        
| 405 | 405 | $primary = $this->get_primary_column_name();  | 
                                                        
| 406 | - $this->_column_headers = array( $columns, $hidden, $sortable, $primary );  | 
                                                        |
| 406 | + $this->_column_headers = array($columns, $hidden, $sortable, $primary);  | 
                                                        |
| 407 | 407 | }  | 
                                                        
| 408 | 408 | |
| 409 | 409 | |
@@ -412,8 +412,8 @@ discard block  | 
                                                    ||
| 412 | 412 | * @return string  | 
                                                        
| 413 | 413 | */  | 
                                                        
| 414 | 414 |  	protected function get_primary_column_name() { | 
                                                        
| 415 | -		foreach( class_parents( $this ) as $parent ) { | 
                                                        |
| 416 | -			if ( method_exists( $parent, 'get_primary_column_name' ) && $parent == 'WP_List_Table' ) { | 
                                                        |
| 415 | +		foreach (class_parents($this) as $parent) { | 
                                                        |
| 416 | +			if (method_exists($parent, 'get_primary_column_name') && $parent == 'WP_List_Table') { | 
                                                        |
| 417 | 417 | return parent::get_primary_column_name();  | 
                                                        
| 418 | 418 | }  | 
                                                        
| 419 | 419 | }  | 
                                                        
@@ -430,10 +430,10 @@ discard block  | 
                                                    ||
| 430 | 430 | * @param string $primary  | 
                                                        
| 431 | 431 | * @return string  | 
                                                        
| 432 | 432 | */  | 
                                                        
| 433 | -	protected function handle_row_actions( $item, $column_name, $primary ) { | 
                                                        |
| 434 | -		foreach( class_parents( $this ) as $parent ) { | 
                                                        |
| 435 | -			if ( method_exists( $parent, 'handle_row_actions' ) && $parent == 'WP_List_Table' ) { | 
                                                        |
| 436 | - return parent::handle_row_actions( $item, $column_name, $primary );  | 
                                                        |
| 433 | +	protected function handle_row_actions($item, $column_name, $primary) { | 
                                                        |
| 434 | +		foreach (class_parents($this) as $parent) { | 
                                                        |
| 435 | +			if (method_exists($parent, 'handle_row_actions') && $parent == 'WP_List_Table') { | 
                                                        |
| 436 | + return parent::handle_row_actions($item, $column_name, $primary);  | 
                                                        |
| 437 | 437 | }  | 
                                                        
| 438 | 438 | }  | 
                                                        
| 439 | 439 | return '';  | 
                                                        
@@ -451,11 +451,11 @@ discard block  | 
                                                    ||
| 451 | 451 |  	protected function _get_bulk_actions() { | 
                                                        
| 452 | 452 | $actions = array();  | 
                                                        
| 453 | 453 | //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();  | 
                                                        
| 454 | -		foreach ( $this->_views as $view => $args) { | 
                                                        |
| 455 | - if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view )  | 
                                                        |
| 454 | +		foreach ($this->_views as $view => $args) { | 
                                                        |
| 455 | + if (isset($args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view)  | 
                                                        |
| 456 | 456 | //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.  | 
                                                        
| 457 | -				foreach ( $args['bulk_action'] as $route =>$label ) { | 
                                                        |
| 458 | -					if ( $this->_admin_page->check_user_access( $route, true ) ) { | 
                                                        |
| 457 | +				foreach ($args['bulk_action'] as $route =>$label) { | 
                                                        |
| 458 | +					if ($this->_admin_page->check_user_access($route, true)) { | 
                                                        |
| 459 | 459 | $actions[$route] = $label;  | 
                                                        
| 460 | 460 | }  | 
                                                        
| 461 | 461 | }  | 
                                                        
@@ -473,18 +473,18 @@ discard block  | 
                                                    ||
| 473 | 473 | */  | 
                                                        
| 474 | 474 |  	private function _filters() { | 
                                                        
| 475 | 475 | $classname = get_class($this);  | 
                                                        
| 476 | -		$filters = apply_filters( "FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen ); | 
                                                        |
| 476 | +		$filters = apply_filters("FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen); | 
                                                        |
| 477 | 477 | |
| 478 | -		if ( empty( $filters )) { | 
                                                        |
| 478 | +		if (empty($filters)) { | 
                                                        |
| 479 | 479 | return;  | 
                                                        
| 480 | 480 | }  | 
                                                        
| 481 | -		foreach ( $filters as $filter ) { | 
                                                        |
| 481 | +		foreach ($filters as $filter) { | 
                                                        |
| 482 | 482 | echo $filter;  | 
                                                        
| 483 | 483 | }  | 
                                                        
| 484 | 484 | //add filter button at end  | 
                                                        
| 485 | -		echo '<input type="submit" class="button-secondary" value="' . __('Filter', 'event_espresso') . '" id="post-query-submit" />'; | 
                                                        |
| 485 | +		echo '<input type="submit" class="button-secondary" value="'.__('Filter', 'event_espresso').'" id="post-query-submit" />'; | 
                                                        |
| 486 | 486 | //add reset filters button at end  | 
                                                        
| 487 | -		echo '<a class="button button-secondary"  href="' . $this->_admin_page->get_current_page_view_url() . '" style="display:inline-block">' . __('Reset Filters', 'event_espresso') . '</a>'; | 
                                                        |
| 487 | +		echo '<a class="button button-secondary"  href="'.$this->_admin_page->get_current_page_view_url().'" style="display:inline-block">'.__('Reset Filters', 'event_espresso').'</a>'; | 
                                                        |
| 488 | 488 | }  | 
                                                        
| 489 | 489 | |
| 490 | 490 | |
@@ -498,8 +498,8 @@ discard block  | 
                                                    ||
| 498 | 498 | * @param string $column_name  | 
                                                        
| 499 | 499 | * @return string  | 
                                                        
| 500 | 500 | */  | 
                                                        
| 501 | -	public function set_primary_column( $column_name ) { | 
                                                        |
| 502 | - return ! empty( $this->_primary_column ) ? $this->_primary_column : $column_name;  | 
                                                        |
| 501 | +	public function set_primary_column($column_name) { | 
                                                        |
| 502 | + return ! empty($this->_primary_column) ? $this->_primary_column : $column_name;  | 
                                                        |
| 503 | 503 | }  | 
                                                        
| 504 | 504 | |
| 505 | 505 | |
@@ -518,7 +518,7 @@ discard block  | 
                                                    ||
| 518 | 518 | array(  | 
                                                        
| 519 | 519 | 'total_items' => $total_items,  | 
                                                        
| 520 | 520 | 'per_page' => $this->_per_page,  | 
                                                        
| 521 | - 'total_pages' => ceil($total_items / $this->_per_page )  | 
                                                        |
| 521 | + 'total_pages' => ceil($total_items / $this->_per_page)  | 
                                                        |
| 522 | 522 | )  | 
                                                        
| 523 | 523 | );  | 
                                                        
| 524 | 524 | }  | 
                                                        
@@ -534,7 +534,7 @@ discard block  | 
                                                    ||
| 534 | 534 | *  | 
                                                        
| 535 | 535 | * @return string html content for the column  | 
                                                        
| 536 | 536 | */  | 
                                                        
| 537 | -	public function column_default( $item, $column_name ) { | 
                                                        |
| 537 | +	public function column_default($item, $column_name) { | 
                                                        |
| 538 | 538 | /**  | 
                                                        
| 539 | 539 | * Dynamic hook allowing for adding additional column content in this list table.  | 
                                                        
| 540 | 540 | * Note that $this->screen->id is in the format  | 
                                                        
@@ -544,7 +544,7 @@ discard block  | 
                                                    ||
| 544 | 544 |  		 * hook prefix ("event-espresso") will be different. | 
                                                        
| 545 | 545 | *  | 
                                                        
| 546 | 546 | */  | 
                                                        
| 547 | - do_action( 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, $item, $this->_screen );  | 
                                                        |
| 547 | +		do_action('AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, $item, $this->_screen); | 
                                                        |
| 548 | 548 | }  | 
                                                        
| 549 | 549 | |
| 550 | 550 | |
@@ -560,7 +560,7 @@ discard block  | 
                                                    ||
| 560 | 560 | *  | 
                                                        
| 561 | 561 | * @var array  | 
                                                        
| 562 | 562 | */  | 
                                                        
| 563 | - $columns = apply_filters( 'FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen );  | 
                                                        |
| 563 | +		$columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen); | 
                                                        |
| 564 | 564 | return $columns;  | 
                                                        
| 565 | 565 | }  | 
                                                        
| 566 | 566 | |
@@ -572,18 +572,18 @@ discard block  | 
                                                    ||
| 572 | 572 | $views = $this->get_views();  | 
                                                        
| 573 | 573 | $assembled_views = '';  | 
                                                        
| 574 | 574 | |
| 575 | -		if ( empty( $views )) { | 
                                                        |
| 575 | +		if (empty($views)) { | 
                                                        |
| 576 | 576 | return;  | 
                                                        
| 577 | 577 | }  | 
                                                        
| 578 | 578 | echo "<ul class='subsubsub'>\n";  | 
                                                        
| 579 | -		foreach ( $views as $view ) { | 
                                                        |
| 580 | - $count = isset($view['count'] ) && !empty($view['count']) ? absint( $view['count'] ) : 0;  | 
                                                        |
| 581 | -			if ( isset( $view['slug'] ) && isset( $view['class'] ) && isset( $view['url'] ) && isset( $view['label']) ) { | 
                                                        |
| 582 | -				$assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" . '<a href="' . $view['url'] . '">' . $view['label'] . '</a> <span class="count">(' . $count . ')</span>'; | 
                                                        |
| 579 | +		foreach ($views as $view) { | 
                                                        |
| 580 | + $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0;  | 
                                                        |
| 581 | +			if (isset($view['slug']) && isset($view['class']) && isset($view['url']) && isset($view['label'])) { | 
                                                        |
| 582 | +				$assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>".'<a href="'.$view['url'].'">'.$view['label'].'</a> <span class="count">('.$count.')</span>'; | 
                                                        |
| 583 | 583 | }  | 
                                                        
| 584 | 584 | }  | 
                                                        
| 585 | 585 | |
| 586 | - echo is_array( $assembled_views) && ! empty( $assembled_views ) ? implode( " |</li>\n", $assembled_views ) . "</li>\n" : '';  | 
                                                        |
| 586 | +		echo is_array($assembled_views) && ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : ''; | 
                                                        |
| 587 | 587 | echo "</ul>";  | 
                                                        
| 588 | 588 | }  | 
                                                        
| 589 | 589 | |
@@ -596,10 +596,10 @@ discard block  | 
                                                    ||
| 596 | 596 | *  | 
                                                        
| 597 | 597 | * @param object $item The current item  | 
                                                        
| 598 | 598 | */  | 
                                                        
| 599 | -	public function single_row( $item ) { | 
                                                        |
| 600 | - $row_class = $this->_get_row_class( $item );  | 
                                                        |
| 601 | - echo '<tr class="' . esc_attr( $row_class ) . '">';  | 
                                                        |
| 602 | - $this->single_row_columns( $item );  | 
                                                        |
| 599 | +	public function single_row($item) { | 
                                                        |
| 600 | + $row_class = $this->_get_row_class($item);  | 
                                                        |
| 601 | + echo '<tr class="'.esc_attr($row_class).'">';  | 
                                                        |
| 602 | + $this->single_row_columns($item);  | 
                                                        |
| 603 | 603 | echo '</tr>';  | 
                                                        
| 604 | 604 | }  | 
                                                        
| 605 | 605 | |
@@ -610,13 +610,13 @@ discard block  | 
                                                    ||
| 610 | 610 | * @param object $item the current item  | 
                                                        
| 611 | 611 | * @return string  | 
                                                        
| 612 | 612 | */  | 
                                                        
| 613 | -	protected function _get_row_class( $item ) { | 
                                                        |
| 613 | +	protected function _get_row_class($item) { | 
                                                        |
| 614 | 614 | static $row_class = '';  | 
                                                        
| 615 | - $row_class = ( $row_class == '' ? 'alternate' : '' );  | 
                                                        |
| 615 | + $row_class = ($row_class == '' ? 'alternate' : '');  | 
                                                        |
| 616 | 616 | |
| 617 | 617 | $new_row_class = $row_class;  | 
                                                        
| 618 | 618 | |
| 619 | -		if ( !empty($this->_ajax_sorting_callback) ) { | 
                                                        |
| 619 | +		if ( ! empty($this->_ajax_sorting_callback)) { | 
                                                        |
| 620 | 620 | $new_row_class .= ' rowsortable';  | 
                                                        
| 621 | 621 | }  | 
                                                        
| 622 | 622 | |
@@ -635,13 +635,13 @@ discard block  | 
                                                    ||
| 635 | 635 | |
| 636 | 636 |  	public function get_hidden_columns() { | 
                                                        
| 637 | 637 | $user_id = get_current_user_id();  | 
                                                        
| 638 | -		$has_default = get_user_option('default'. $this->screen->id . 'columnshidden', $user_id); | 
                                                        |
| 639 | -		if ( empty( $has_default ) && !empty($this->_hidden_columns ) ) { | 
                                                        |
| 640 | - update_user_option($user_id, 'default'.$this->screen->id . 'columnshidden', TRUE);  | 
                                                        |
| 641 | - update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, TRUE );  | 
                                                        |
| 638 | +		$has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id); | 
                                                        |
| 639 | +		if (empty($has_default) && ! empty($this->_hidden_columns)) { | 
                                                        |
| 640 | + update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', TRUE);  | 
                                                        |
| 641 | + update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, TRUE);  | 
                                                        |
| 642 | 642 | }  | 
                                                        
| 643 | - $ref = 'manage' . $this->screen->id . 'columnshidden';  | 
                                                        |
| 644 | - $saved_columns = (array) get_user_option( $ref, $user_id );  | 
                                                        |
| 643 | + $ref = 'manage'.$this->screen->id.'columnshidden';  | 
                                                        |
| 644 | + $saved_columns = (array) get_user_option($ref, $user_id);  | 
                                                        |
| 645 | 645 | return $saved_columns;  | 
                                                        
| 646 | 646 | }  | 
                                                        
| 647 | 647 | |
@@ -656,47 +656,47 @@ discard block  | 
                                                    ||
| 656 | 656 | *  | 
                                                        
| 657 | 657 | * @param object $item The current item  | 
                                                        
| 658 | 658 | */  | 
                                                        
| 659 | -	public function single_row_columns( $item ) { | 
                                                        |
| 660 | - list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();  | 
                                                        |
| 659 | +	public function single_row_columns($item) { | 
                                                        |
| 660 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info();  | 
                                                        |
| 661 | 661 | |
| 662 | 662 | global $wp_version;  | 
                                                        
| 663 | - $use_hidden_class = version_compare( $wp_version, '4.3-RC', '>=' );  | 
                                                        |
| 663 | + $use_hidden_class = version_compare($wp_version, '4.3-RC', '>=');  | 
                                                        |
| 664 | 664 | |
| 665 | -		foreach ( $columns as $column_name => $column_display_name ) { | 
                                                        |
| 665 | +		foreach ($columns as $column_name => $column_display_name) { | 
                                                        |
| 666 | 666 | |
| 667 | 667 | /**  | 
                                                        
| 668 | 668 | * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns are  | 
                                                        
| 669 | 669 | * hidden or not instead of using "display:none;". This bit of code provides backward compat.  | 
                                                        
| 670 | 670 | */  | 
                                                        
| 671 | - $hidden_class = $use_hidden_class && in_array( $column_name, $hidden ) ? ' hidden' : '';  | 
                                                        |
| 672 | - $style = ! $use_hidden_class && in_array( $column_name, $hidden ) ? ' style="display:none;"' : '';  | 
                                                        |
| 671 | + $hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : '';  | 
                                                        |
| 672 | + $style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : '';  | 
                                                        |
| 673 | 673 | |
| 674 | - $classes = $column_name . ' column-' . $column_name.$hidden_class;  | 
                                                        |
| 675 | -			if ( $primary == $column_name ) { | 
                                                        |
| 674 | + $classes = $column_name.' column-'.$column_name.$hidden_class;  | 
                                                        |
| 675 | +			if ($primary == $column_name) { | 
                                                        |
| 676 | 676 | $classes .= ' has-row-actions column-primary';  | 
                                                        
| 677 | 677 | }  | 
                                                        
| 678 | 678 | |
| 679 | - $data = ' data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';  | 
                                                        |
| 679 | + $data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"';  | 
                                                        |
| 680 | 680 | |
| 681 | 681 | $class = "class='$classes'";  | 
                                                        
| 682 | 682 | |
| 683 | 683 | $attributes = "$class$style$data";  | 
                                                        
| 684 | 684 | |
| 685 | -			if ( 'cb' === $column_name ) { | 
                                                        |
| 685 | +			if ('cb' === $column_name) { | 
                                                        |
| 686 | 686 | echo '<th scope="row" class="check-column">';  | 
                                                        
| 687 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this );  | 
                                                        |
| 687 | +				echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb($item), $item, $this); | 
                                                        |
| 688 | 688 | echo '</th>';  | 
                                                        
| 689 | 689 | }  | 
                                                        
| 690 | -			elseif ( method_exists( $this, 'column_' . $column_name ) ) { | 
                                                        |
| 690 | +			elseif (method_exists($this, 'column_'.$column_name)) { | 
                                                        |
| 691 | 691 | echo "<td $attributes>";  | 
                                                        
| 692 | - 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 );  | 
                                                        |
| 693 | - echo $this->handle_row_actions( $item, $column_name, $primary );  | 
                                                        |
| 692 | +				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); | 
                                                        |
| 693 | + echo $this->handle_row_actions($item, $column_name, $primary);  | 
                                                        |
| 694 | 694 | echo "</td>";  | 
                                                        
| 695 | 695 | }  | 
                                                        
| 696 | 696 |  			else { | 
                                                        
| 697 | 697 | echo "<td $attributes>";  | 
                                                        
| 698 | - 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 );  | 
                                                        |
| 699 | - echo $this->handle_row_actions( $item, $column_name, $primary );  | 
                                                        |
| 698 | +				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); | 
                                                        |
| 699 | + echo $this->handle_row_actions($item, $column_name, $primary);  | 
                                                        |
| 700 | 700 | echo "</td>";  | 
                                                        
| 701 | 701 | }  | 
                                                        
| 702 | 702 | }  | 
                                                        
@@ -704,19 +704,19 @@ discard block  | 
                                                    ||
| 704 | 704 | |
| 705 | 705 | |
| 706 | 706 | |
| 707 | -	public function extra_tablenav( $which ) { | 
                                                        |
| 708 | -		if ( $which == 'top' ) { | 
                                                        |
| 707 | +	public function extra_tablenav($which) { | 
                                                        |
| 708 | +		if ($which == 'top') { | 
                                                        |
| 709 | 709 | $this->_filters();  | 
                                                        
| 710 | 710 | echo $this->_get_hidden_fields();  | 
                                                        
| 711 | 711 | echo '<br class="clear">';  | 
                                                        
| 712 | -		}else{ | 
                                                        |
| 712 | +		} else { | 
                                                        |
| 713 | 713 | echo '<div class="list-table-bottom-buttons alignleft actions">';  | 
                                                        
| 714 | -			foreach($this->_bottom_buttons as $type => $action){ | 
                                                        |
| 715 | - $route = isset( $action['route'] ) ? $action['route'] : '';  | 
                                                        |
| 716 | - $extra_request = isset( $action['extra_request'] ) ? $action['extra_request'] : '';  | 
                                                        |
| 714 | +			foreach ($this->_bottom_buttons as $type => $action) { | 
                                                        |
| 715 | + $route = isset($action['route']) ? $action['route'] : '';  | 
                                                        |
| 716 | + $extra_request = isset($action['extra_request']) ? $action['extra_request'] : '';  | 
                                                        |
| 717 | 717 | echo $this->_admin_page->get_action_link_or_button($route, $type, $extra_request);  | 
                                                        
| 718 | 718 | }  | 
                                                        
| 719 | - do_action( 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen );  | 
                                                        |
| 719 | +			do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen); | 
                                                        |
| 720 | 720 | echo '</div>';  | 
                                                        
| 721 | 721 | }  | 
                                                        
| 722 | 722 | //echo $this->_entries_per_page_dropdown;  | 
                                                        
@@ -766,11 +766,11 @@ discard block  | 
                                                    ||
| 766 | 766 | *  | 
                                                        
| 767 | 767 | * @return string The assembled action elements container.  | 
                                                        
| 768 | 768 | */  | 
                                                        
| 769 | -	protected function _action_string( $action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '' ) { | 
                                                        |
| 769 | +	protected function _action_string($action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '') { | 
                                                        |
| 770 | 770 | $content = '';  | 
                                                        
| 771 | - $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : '';  | 
                                                        |
| 772 | - $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : '';  | 
                                                        |
| 773 | - $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : '';  | 
                                                        |
| 771 | + $action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : '';  | 
                                                        |
| 772 | + $action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : '';  | 
                                                        |
| 773 | + $content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : '';  | 
                                                        |
| 774 | 774 |          try { | 
                                                        
| 775 | 775 | $content .= apply_filters(  | 
                                                        
| 776 | 776 | 'FHEE__EE_Admin_List_Table___action_string__action_items',  | 
                                                        
@@ -780,11 +780,11 @@ discard block  | 
                                                    ||
| 780 | 780 | );  | 
                                                        
| 781 | 781 |          } catch (\Exception $e) { | 
                                                        
| 782 | 782 |              if (WP_DEBUG) { | 
                                                        
| 783 | - \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 783 | + \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 784 | 784 | }  | 
                                                        
| 785 | 785 | $content .= $action_items;  | 
                                                        
| 786 | 786 | }  | 
                                                        
| 787 | - $content .= ! empty( $action_container ) ? '</' . $action_container . '>' : '';  | 
                                                        |
| 787 | + $content .= ! empty($action_container) ? '</'.$action_container.'>' : '';  | 
                                                        |
| 788 | 788 | return $content;  | 
                                                        
| 789 | 789 | }  | 
                                                        
| 790 | 790 | }  | 
                                                        
@@ -113,7 +113,6 @@ discard block  | 
                                                    ||
| 113 | 113 | |
| 114 | 114 | /**  | 
                                                        
| 115 | 115 | * This sets the meta caps property.  | 
                                                        
| 116 | -  | 
                                                        |
| 117 | 116 | * @since 4.5.0  | 
                                                        
| 118 | 117 | *  | 
                                                        
| 119 | 118 | * @return void  | 
                                                        
@@ -227,7 +226,7 @@ discard block  | 
                                                    ||
| 227 | 226 | * capability mapping which will be used for accessing payment methods owned by  | 
                                                        
| 228 | 227 | * other users. This is not fully implemented yet in the payment method ui.  | 
                                                        
| 229 | 228 | * Currently only the "plural" caps are in active use. (Specific payment method caps are in use as well).  | 
                                                        
| 230 | - **/  | 
                                                        |
| 229 | + **/  | 
                                                        |
| 231 | 230 | 'ee_manage_gateways',  | 
                                                        
| 232 | 231 | 'ee_read_payment_method',  | 
                                                        
| 233 | 232 | 'ee_read_payment_methods',  | 
                                                        
@@ -739,15 +738,15 @@ discard block  | 
                                                    ||
| 739 | 738 | }  | 
                                                        
| 740 | 739 | }  | 
                                                        
| 741 | 740 |  		} else { | 
                                                        
| 742 | - //not a cpt object so handled differently  | 
                                                        |
| 743 | - $has_cap = false;  | 
                                                        |
| 744 | -            try { | 
                                                        |
| 745 | - $has_cap = method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user();  | 
                                                        |
| 746 | -            } catch (Exception $e) { | 
                                                        |
| 747 | -                if (WP_DEBUG) { | 
                                                        |
| 748 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 749 | - }  | 
                                                        |
| 750 | - }  | 
                                                        |
| 741 | + //not a cpt object so handled differently  | 
                                                        |
| 742 | + $has_cap = false;  | 
                                                        |
| 743 | +			try { | 
                                                        |
| 744 | + $has_cap = method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user();  | 
                                                        |
| 745 | +			} catch (Exception $e) { | 
                                                        |
| 746 | +				if (WP_DEBUG) { | 
                                                        |
| 747 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 748 | + }  | 
                                                        |
| 749 | + }  | 
                                                        |
| 751 | 750 |  			if ($has_cap) { | 
                                                        
| 752 | 751 | $caps[] = $cap;  | 
                                                        
| 753 | 752 |  			} else { | 
                                                        
@@ -854,15 +853,15 @@ discard block  | 
                                                    ||
| 854 | 853 | $caps[] = $cap;  | 
                                                        
| 855 | 854 | }  | 
                                                        
| 856 | 855 |  		} else { | 
                                                        
| 857 | - //not a cpt object so handled differently  | 
                                                        |
| 858 | - $has_cap = false;  | 
                                                        |
| 859 | -            try { | 
                                                        |
| 860 | - $has_cap = method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user();  | 
                                                        |
| 861 | -            } catch (Exception $e) { | 
                                                        |
| 862 | -                if (WP_DEBUG) { | 
                                                        |
| 863 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 864 | - }  | 
                                                        |
| 865 | - }  | 
                                                        |
| 856 | + //not a cpt object so handled differently  | 
                                                        |
| 857 | + $has_cap = false;  | 
                                                        |
| 858 | +			try { | 
                                                        |
| 859 | + $has_cap = method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user();  | 
                                                        |
| 860 | +			} catch (Exception $e) { | 
                                                        |
| 861 | +				if (WP_DEBUG) { | 
                                                        |
| 862 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 863 | + }  | 
                                                        |
| 864 | + }  | 
                                                        |
| 866 | 865 |  			if ($has_cap) { | 
                                                        
| 867 | 866 | $caps[] = $cap;  | 
                                                        
| 868 | 867 |  			} elseif ( ! empty( $this->private_cap ) ) { | 
                                                        
@@ -7,8 +7,8 @@ discard block  | 
                                                    ||
| 7 | 7 | * @package Event Espresso  | 
                                                        
| 8 | 8 | * @subpackage core, capabilities  | 
                                                        
| 9 | 9 | */  | 
                                                        
| 10 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { | 
                                                        |
| 11 | - exit( 'No direct script access allowed' );  | 
                                                        |
| 10 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { | 
                                                        |
| 11 | +	exit('No direct script access allowed'); | 
                                                        |
| 12 | 12 | }  | 
                                                        
| 13 | 13 | |
| 14 | 14 | |
@@ -71,7 +71,7 @@ discard block  | 
                                                    ||
| 71 | 71 | */  | 
                                                        
| 72 | 72 |  	public static function instance() { | 
                                                        
| 73 | 73 | //check if instantiated, and if not do so.  | 
                                                        
| 74 | -		if ( ! self::$_instance instanceof EE_Capabilities ) { | 
                                                        |
| 74 | +		if ( ! self::$_instance instanceof EE_Capabilities) { | 
                                                        |
| 75 | 75 | self::$_instance = new self();  | 
                                                        
| 76 | 76 | }  | 
                                                        
| 77 | 77 | return self::$_instance;  | 
                                                        
@@ -100,10 +100,10 @@ discard block  | 
                                                    ||
| 100 | 100 | * @since 4.5.0  | 
                                                        
| 101 | 101 | * @return void  | 
                                                        
| 102 | 102 | */  | 
                                                        
| 103 | -	public function init_caps( $reset = false ) { | 
                                                        |
| 104 | -		if ( EE_Maintenance_Mode::instance()->models_can_query() ){ | 
                                                        |
| 103 | +	public function init_caps($reset = false) { | 
                                                        |
| 104 | +		if (EE_Maintenance_Mode::instance()->models_can_query()) { | 
                                                        |
| 105 | 105 | $this->_caps_map = $this->_init_caps_map();  | 
                                                        
| 106 | - $this->init_role_caps( $reset );  | 
                                                        |
| 106 | + $this->init_role_caps($reset);  | 
                                                        |
| 107 | 107 | $this->_set_meta_caps();  | 
                                                        
| 108 | 108 | }  | 
                                                        
| 109 | 109 | }  | 
                                                        
@@ -122,11 +122,11 @@ discard block  | 
                                                    ||
| 122 | 122 | //make sure we're only ever initializing the default _meta_caps array once if it's empty.  | 
                                                        
| 123 | 123 | $this->_meta_caps = $this->_get_default_meta_caps_array();  | 
                                                        
| 124 | 124 | |
| 125 | - $this->_meta_caps = apply_filters( 'FHEE__EE_Capabilities___set_meta_caps__meta_caps', $this->_meta_caps );  | 
                                                        |
| 125 | +		$this->_meta_caps = apply_filters('FHEE__EE_Capabilities___set_meta_caps__meta_caps', $this->_meta_caps); | 
                                                        |
| 126 | 126 | |
| 127 | 127 | //add filter for map_meta_caps but only if models can query.  | 
                                                        
| 128 | -		if ( EE_Maintenance_Mode::instance()->models_can_query() && ! has_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ) ) ) { | 
                                                        |
| 129 | - add_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ), 10, 4 );  | 
                                                        |
| 128 | +		if (EE_Maintenance_Mode::instance()->models_can_query() && ! has_filter('map_meta_cap', array($this, 'map_meta_caps'))) { | 
                                                        |
| 129 | +			add_filter('map_meta_cap', array($this, 'map_meta_caps'), 10, 4); | 
                                                        |
| 130 | 130 | }  | 
                                                        
| 131 | 131 | }  | 
                                                        
| 132 | 132 | |
@@ -139,37 +139,37 @@ discard block  | 
                                                    ||
| 139 | 139 | */  | 
                                                        
| 140 | 140 |  	private function _get_default_meta_caps_array() { | 
                                                        
| 141 | 141 | static $default_meta_caps = array();  | 
                                                        
| 142 | -		if ( empty( $default_meta_caps ) ) { | 
                                                        |
| 142 | +		if (empty($default_meta_caps)) { | 
                                                        |
| 143 | 143 | $default_meta_caps = array(  | 
                                                        
| 144 | 144 | //edits  | 
                                                        
| 145 | - new EE_Meta_Capability_Map_Edit( 'ee_edit_event', array( 'Event', 'ee_edit_published_events', 'ee_edit_others_events', 'ee_edit_private_events' ) ),  | 
                                                        |
| 146 | - new EE_Meta_Capability_Map_Edit( 'ee_edit_venue', array( 'Venue', 'ee_edit_published_venues', 'ee_edit_others_venues', 'ee_edit_private_venues' ) ),  | 
                                                        |
| 147 | - new EE_Meta_Capability_Map_Edit( 'ee_edit_registration', array( 'Registration', '', 'ee_edit_others_registrations', '' ) ),  | 
                                                        |
| 148 | - new EE_Meta_Capability_Map_Edit( 'ee_edit_checkin', array( 'Registration', '', 'ee_edit_others_checkins', '' ) ),  | 
                                                        |
| 149 | - new EE_Meta_Capability_Map_Messages_Cap( 'ee_edit_message', array( 'Message_Template_Group', '', 'ee_edit_others_messages', 'ee_edit_global_messages' ) ),  | 
                                                        |
| 150 | - new EE_Meta_Capability_Map_Edit( 'ee_edit_default_ticket', array( 'Ticket', '', 'ee_edit_others_default_tickets', '' ) ),  | 
                                                        |
| 151 | - new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_edit_question', array( 'Question', '', '', 'ee_edit_system_questions' ) ),  | 
                                                        |
| 152 | - new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_edit_question_group', array( 'Question_Group', '', '', 'ee_edit_system_question_groups' ) ),  | 
                                                        |
| 153 | - new EE_Meta_Capability_Map_Edit( 'ee_edit_payment_method', array( 'Payment_Method', '', 'ee_edit_others_payment_methods', '' ) ),  | 
                                                        |
| 145 | +				new EE_Meta_Capability_Map_Edit('ee_edit_event', array('Event', 'ee_edit_published_events', 'ee_edit_others_events', 'ee_edit_private_events')), | 
                                                        |
| 146 | +				new EE_Meta_Capability_Map_Edit('ee_edit_venue', array('Venue', 'ee_edit_published_venues', 'ee_edit_others_venues', 'ee_edit_private_venues')), | 
                                                        |
| 147 | +				new EE_Meta_Capability_Map_Edit('ee_edit_registration', array('Registration', '', 'ee_edit_others_registrations', '')), | 
                                                        |
| 148 | +				new EE_Meta_Capability_Map_Edit('ee_edit_checkin', array('Registration', '', 'ee_edit_others_checkins', '')), | 
                                                        |
| 149 | +				new EE_Meta_Capability_Map_Messages_Cap('ee_edit_message', array('Message_Template_Group', '', 'ee_edit_others_messages', 'ee_edit_global_messages')), | 
                                                        |
| 150 | +				new EE_Meta_Capability_Map_Edit('ee_edit_default_ticket', array('Ticket', '', 'ee_edit_others_default_tickets', '')), | 
                                                        |
| 151 | +				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_edit_question', array('Question', '', '', 'ee_edit_system_questions')), | 
                                                        |
| 152 | +				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_edit_question_group', array('Question_Group', '', '', 'ee_edit_system_question_groups')), | 
                                                        |
| 153 | +				new EE_Meta_Capability_Map_Edit('ee_edit_payment_method', array('Payment_Method', '', 'ee_edit_others_payment_methods', '')), | 
                                                        |
| 154 | 154 | //reads  | 
                                                        
| 155 | - new EE_Meta_Capability_Map_Read( 'ee_read_event', array( 'Event', '', 'ee_read_others_events', 'ee_read_private_events' ) ),  | 
                                                        |
| 156 | - new EE_Meta_Capability_Map_Read( 'ee_read_venue', array( 'Venue', '', 'ee_read_others_venues', 'ee_read_private_venues' ) ),  | 
                                                        |
| 157 | - new EE_Meta_Capability_Map_Read( 'ee_read_registration', array( 'Registration', '', '', 'ee_edit_others_registrations' ) ),  | 
                                                        |
| 158 | - new EE_Meta_Capability_Map_Read( 'ee_read_checkin', array( 'Registration', '', '', 'ee_read_others_checkins' ) ),  | 
                                                        |
| 159 | - new EE_Meta_Capability_Map_Messages_Cap( 'ee_read_message', array( 'Message_Template_Group', '', 'ee_read_others_messages', 'ee_read_global_messages' ) ),  | 
                                                        |
| 160 | - new EE_Meta_Capability_Map_Read( 'ee_read_default_ticket', array( 'Ticket', '', '', 'ee_read_others_default_tickets' ) ),  | 
                                                        |
| 161 | - new EE_Meta_Capability_Map_Read( 'ee_read_payment_method', array( 'Payment_Method', '', '', 'ee_read_others_payment_methods' ) ),  | 
                                                        |
| 155 | +				new EE_Meta_Capability_Map_Read('ee_read_event', array('Event', '', 'ee_read_others_events', 'ee_read_private_events')), | 
                                                        |
| 156 | +				new EE_Meta_Capability_Map_Read('ee_read_venue', array('Venue', '', 'ee_read_others_venues', 'ee_read_private_venues')), | 
                                                        |
| 157 | +				new EE_Meta_Capability_Map_Read('ee_read_registration', array('Registration', '', '', 'ee_edit_others_registrations')), | 
                                                        |
| 158 | +				new EE_Meta_Capability_Map_Read('ee_read_checkin', array('Registration', '', '', 'ee_read_others_checkins')), | 
                                                        |
| 159 | +				new EE_Meta_Capability_Map_Messages_Cap('ee_read_message', array('Message_Template_Group', '', 'ee_read_others_messages', 'ee_read_global_messages')), | 
                                                        |
| 160 | +				new EE_Meta_Capability_Map_Read('ee_read_default_ticket', array('Ticket', '', '', 'ee_read_others_default_tickets')), | 
                                                        |
| 161 | +				new EE_Meta_Capability_Map_Read('ee_read_payment_method', array('Payment_Method', '', '', 'ee_read_others_payment_methods')), | 
                                                        |
| 162 | 162 | |
| 163 | 163 | //deletes  | 
                                                        
| 164 | - new EE_Meta_Capability_Map_Delete( 'ee_delete_event', array( 'Event', 'ee_delete_published_events', 'ee_delete_others_events', 'ee_delete_private_events' ) ),  | 
                                                        |
| 165 | - new EE_Meta_Capability_Map_Delete( 'ee_delete_venue', array( 'Venue', 'ee_delete_published_venues', 'ee_delete_others_venues', 'ee_delete_private_venues' ) ),  | 
                                                        |
| 166 | - new EE_Meta_Capability_Map_Delete( 'ee_delete_registration', array( 'Registration', '', 'ee_delete_others_registrations', '' ) ),  | 
                                                        |
| 167 | - new EE_Meta_Capability_Map_Delete( 'ee_delete_checkin', array( 'Registration', '', 'ee_delete_others_checkins', '' ) ),  | 
                                                        |
| 168 | - new EE_Meta_Capability_Map_Messages_Cap( 'ee_delete_message', array( 'Message_Template_Group', '', 'ee_delete_others_messages', 'ee_delete_global_messages' ) ),  | 
                                                        |
| 169 | - new EE_Meta_Capability_Map_Delete( 'ee_delete_default_ticket', array( 'Ticket', '', 'ee_delete_others_default_tickets', '' ) ),  | 
                                                        |
| 170 | - new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_delete_question', array( 'Question', '', '', 'delete_system_questions' ) ),  | 
                                                        |
| 171 | - new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_delete_question_group', array( 'Question_Group', '', '', 'delete_system_question_groups' ) ),  | 
                                                        |
| 172 | - new EE_Meta_Capability_Map_Delete( 'ee_delete_payment_method', array( 'Payment_Method', '', 'ee_delete_others_payment_methods', '' ) ),  | 
                                                        |
| 164 | +				new EE_Meta_Capability_Map_Delete('ee_delete_event', array('Event', 'ee_delete_published_events', 'ee_delete_others_events', 'ee_delete_private_events')), | 
                                                        |
| 165 | +				new EE_Meta_Capability_Map_Delete('ee_delete_venue', array('Venue', 'ee_delete_published_venues', 'ee_delete_others_venues', 'ee_delete_private_venues')), | 
                                                        |
| 166 | +				new EE_Meta_Capability_Map_Delete('ee_delete_registration', array('Registration', '', 'ee_delete_others_registrations', '')), | 
                                                        |
| 167 | +				new EE_Meta_Capability_Map_Delete('ee_delete_checkin', array('Registration', '', 'ee_delete_others_checkins', '')), | 
                                                        |
| 168 | +				new EE_Meta_Capability_Map_Messages_Cap('ee_delete_message', array('Message_Template_Group', '', 'ee_delete_others_messages', 'ee_delete_global_messages')), | 
                                                        |
| 169 | +				new EE_Meta_Capability_Map_Delete('ee_delete_default_ticket', array('Ticket', '', 'ee_delete_others_default_tickets', '')), | 
                                                        |
| 170 | +				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_delete_question', array('Question', '', '', 'delete_system_questions')), | 
                                                        |
| 171 | +				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_delete_question_group', array('Question_Group', '', '', 'delete_system_question_groups')), | 
                                                        |
| 172 | +				new EE_Meta_Capability_Map_Delete('ee_delete_payment_method', array('Payment_Method', '', 'ee_delete_others_payment_methods', '')), | 
                                                        |
| 173 | 173 | );  | 
                                                        
| 174 | 174 | }  | 
                                                        
| 175 | 175 | return $default_meta_caps;  | 
                                                        
@@ -193,15 +193,15 @@ discard block  | 
                                                    ||
| 193 | 193 | *  | 
                                                        
| 194 | 194 | * @return array actual users capabilities  | 
                                                        
| 195 | 195 | */  | 
                                                        
| 196 | -	public function map_meta_caps( $caps, $cap, $user_id, $args ) { | 
                                                        |
| 196 | +	public function map_meta_caps($caps, $cap, $user_id, $args) { | 
                                                        |
| 197 | 197 | //loop through our _meta_caps array  | 
                                                        
| 198 | -		foreach ( $this->_meta_caps as $meta_map ) { | 
                                                        |
| 199 | -			if ( ! $meta_map instanceof EE_Meta_Capability_Map ) { | 
                                                        |
| 198 | +		foreach ($this->_meta_caps as $meta_map) { | 
                                                        |
| 199 | +			if ( ! $meta_map instanceof EE_Meta_Capability_Map) { | 
                                                        |
| 200 | 200 | continue;  | 
                                                        
| 201 | 201 | }  | 
                                                        
| 202 | 202 | $meta_map->ensure_is_model();  | 
                                                        
| 203 | 203 | |
| 204 | - $caps = $meta_map->map_meta_caps( $caps, $cap, $user_id, $args );  | 
                                                        |
| 204 | + $caps = $meta_map->map_meta_caps($caps, $cap, $user_id, $args);  | 
                                                        |
| 205 | 205 | }  | 
                                                        
| 206 | 206 | return $caps;  | 
                                                        
| 207 | 207 | }  | 
                                                        
@@ -528,7 +528,7 @@ discard block  | 
                                                    ||
| 528 | 528 | )  | 
                                                        
| 529 | 529 | );  | 
                                                        
| 530 | 530 | |
| 531 | - $caps = apply_filters( 'FHEE__EE_Capabilities__init_caps_map__caps', $caps );  | 
                                                        |
| 531 | +		$caps = apply_filters('FHEE__EE_Capabilities__init_caps_map__caps', $caps); | 
                                                        |
| 532 | 532 | return $caps;  | 
                                                        
| 533 | 533 | }  | 
                                                        
| 534 | 534 | |
@@ -545,27 +545,27 @@ discard block  | 
                                                    ||
| 545 | 545 | *  | 
                                                        
| 546 | 546 | * @return void  | 
                                                        
| 547 | 547 | */  | 
                                                        
| 548 | -	public function init_role_caps( $reset = false, $custom_map = array() ) { | 
                                                        |
| 548 | +	public function init_role_caps($reset = false, $custom_map = array()) { | 
                                                        |
| 549 | 549 | |
| 550 | - $caps_map = empty( $custom_map ) ? $this->_caps_map : $custom_map;  | 
                                                        |
| 550 | + $caps_map = empty($custom_map) ? $this->_caps_map : $custom_map;  | 
                                                        |
| 551 | 551 | |
| 552 | 552 | //first let's determine if these caps have already been set.  | 
                                                        
| 553 | - $caps_set_before = get_option( self::option_name, array() );  | 
                                                        |
| 553 | + $caps_set_before = get_option(self::option_name, array());  | 
                                                        |
| 554 | 554 | //if not reset, see what caps are new for each role. if they're new, add them.  | 
                                                        
| 555 | -		foreach ( $caps_map as $role => $caps_for_role ) { | 
                                                        |
| 556 | -			foreach ( $caps_for_role as $cap ) { | 
                                                        |
| 555 | +		foreach ($caps_map as $role => $caps_for_role) { | 
                                                        |
| 556 | +			foreach ($caps_for_role as $cap) { | 
                                                        |
| 557 | 557 | //first check we haven't already added this cap before, or it's a reset  | 
                                                        
| 558 | -				if ( $reset || ! isset( $caps_set_before[ $role ] ) || ! in_array( $cap, $caps_set_before[ $role ] ) ) { | 
                                                        |
| 559 | -					if ( $this->add_cap_to_role( $role, $cap ) ) { | 
                                                        |
| 560 | - $caps_set_before[ $role ][] = $cap;  | 
                                                        |
| 558 | +				if ($reset || ! isset($caps_set_before[$role]) || ! in_array($cap, $caps_set_before[$role])) { | 
                                                        |
| 559 | +					if ($this->add_cap_to_role($role, $cap)) { | 
                                                        |
| 560 | + $caps_set_before[$role][] = $cap;  | 
                                                        |
| 561 | 561 | }  | 
                                                        
| 562 | 562 | }  | 
                                                        
| 563 | 563 | }  | 
                                                        
| 564 | 564 | }  | 
                                                        
| 565 | 565 | |
| 566 | 566 | //now let's just save the cap that has been set.  | 
                                                        
| 567 | - update_option( self::option_name, $caps_set_before );  | 
                                                        |
| 568 | - do_action( 'AHEE__EE_Capabilities__init_role_caps__complete', $caps_set_before );  | 
                                                        |
| 567 | + update_option(self::option_name, $caps_set_before);  | 
                                                        |
| 568 | +		do_action('AHEE__EE_Capabilities__init_role_caps__complete', $caps_set_before); | 
                                                        |
| 569 | 569 | }  | 
                                                        
| 570 | 570 | |
| 571 | 571 | |
@@ -584,20 +584,20 @@ discard block  | 
                                                    ||
| 584 | 584 | * @param bool $grant Whether to grant access to this cap on this role.  | 
                                                        
| 585 | 585 | * @return bool  | 
                                                        
| 586 | 586 | */  | 
                                                        
| 587 | -	public function add_cap_to_role( $role, $cap, $grant = true ) { | 
                                                        |
| 588 | - $role_object = get_role( $role );  | 
                                                        |
| 587 | +	public function add_cap_to_role($role, $cap, $grant = true) { | 
                                                        |
| 588 | + $role_object = get_role($role);  | 
                                                        |
| 589 | 589 | //if the role isn't available then we create it.  | 
                                                        
| 590 | -		if ( ! $role_object instanceof WP_Role ) { | 
                                                        |
| 590 | +		if ( ! $role_object instanceof WP_Role) { | 
                                                        |
| 591 | 591 | //if a plugin wants to create a specific role name then they should create the role before  | 
                                                        
| 592 | 592 | //EE_Capabilities does. Otherwise this function will create the role name from the slug:  | 
                                                        
| 593 | 593 | // - removes any `ee_` namespacing from the start of the slug.  | 
                                                        
| 594 | 594 | // - replaces `_` with ` ` (empty space).  | 
                                                        
| 595 | 595 | // - sentence case on the resulting string.  | 
                                                        
| 596 | - $role_label = ucwords( str_replace( '_', ' ', str_replace( 'ee_', '', $role ) ) );  | 
                                                        |
| 597 | - $role_object = add_role( $role, $role_label );  | 
                                                        |
| 596 | +			$role_label = ucwords(str_replace('_', ' ', str_replace('ee_', '', $role))); | 
                                                        |
| 597 | + $role_object = add_role($role, $role_label);  | 
                                                        |
| 598 | 598 | }  | 
                                                        
| 599 | -		if ( $role_object instanceof WP_Role ) { | 
                                                        |
| 600 | - $role_object->add_cap( $cap, $grant );  | 
                                                        |
| 599 | +		if ($role_object instanceof WP_Role) { | 
                                                        |
| 600 | + $role_object->add_cap($cap, $grant);  | 
                                                        |
| 601 | 601 | return true;  | 
                                                        
| 602 | 602 | }  | 
                                                        
| 603 | 603 | return false;  | 
                                                        
@@ -619,10 +619,10 @@ discard block  | 
                                                    ||
| 619 | 619 | *  | 
                                                        
| 620 | 620 | * @return void  | 
                                                        
| 621 | 621 | */  | 
                                                        
| 622 | -	public function remove_cap_from_role( $role, $cap ) { | 
                                                        |
| 623 | - $role = get_role( $role );  | 
                                                        |
| 624 | -		if ( $role instanceof WP_Role ) { | 
                                                        |
| 625 | - $role->remove_cap( $cap );  | 
                                                        |
| 622 | +	public function remove_cap_from_role($role, $cap) { | 
                                                        |
| 623 | + $role = get_role($role);  | 
                                                        |
| 624 | +		if ($role instanceof WP_Role) { | 
                                                        |
| 625 | + $role->remove_cap($cap);  | 
                                                        |
| 626 | 626 | }  | 
                                                        
| 627 | 627 | }  | 
                                                        
| 628 | 628 | |
@@ -643,11 +643,11 @@ discard block  | 
                                                    ||
| 643 | 643 | *  | 
                                                        
| 644 | 644 | * @return bool Whether user can or not.  | 
                                                        
| 645 | 645 | */  | 
                                                        
| 646 | -	public function current_user_can( $cap, $context, $id = 0 ) { | 
                                                        |
| 646 | +	public function current_user_can($cap, $context, $id = 0) { | 
                                                        |
| 647 | 647 | //apply filters (both a global on just the cap, and context specific. Global overrides context specific)  | 
                                                        
| 648 | - $filtered_cap = apply_filters( 'FHEE__EE_Capabilities__current_user_can__cap__' . $context, $cap, $id );  | 
                                                        |
| 649 | - $filtered_cap = apply_filters( 'FHEE__EE_Capabilities__current_user_can__cap', $filtered_cap, $context, $cap, $id );  | 
                                                        |
| 650 | - return ! empty( $id ) ? current_user_can( $filtered_cap, $id ) : current_user_can( $filtered_cap );  | 
                                                        |
| 648 | +		$filtered_cap = apply_filters('FHEE__EE_Capabilities__current_user_can__cap__'.$context, $cap, $id); | 
                                                        |
| 649 | +		$filtered_cap = apply_filters('FHEE__EE_Capabilities__current_user_can__cap', $filtered_cap, $context, $cap, $id); | 
                                                        |
| 650 | + return ! empty($id) ? current_user_can($filtered_cap, $id) : current_user_can($filtered_cap);  | 
                                                        |
| 651 | 651 | }  | 
                                                        
| 652 | 652 | |
| 653 | 653 | |
@@ -664,11 +664,11 @@ discard block  | 
                                                    ||
| 664 | 664 | *  | 
                                                        
| 665 | 665 | * @return bool Whether user can or not.  | 
                                                        
| 666 | 666 | */  | 
                                                        
| 667 | -	public function user_can( $user, $cap, $context, $id = 0 ) { | 
                                                        |
| 667 | +	public function user_can($user, $cap, $context, $id = 0) { | 
                                                        |
| 668 | 668 | //apply filters (both a global on just the cap, and context specific. Global overrides context specific)  | 
                                                        
| 669 | - $filtered_cap = apply_filters( 'FHEE__EE_Capabilities__user_can__cap__' . $context, $cap, $user, $id );  | 
                                                        |
| 670 | - $filtered_cap = apply_filters( 'FHEE__EE_Capabilities__user_can__cap', $filtered_cap, $context, $cap, $user, $id );  | 
                                                        |
| 671 | - return ! empty( $id ) ? user_can( $user, $filtered_cap, $id ) : user_can( $user, $filtered_cap );  | 
                                                        |
| 669 | +		$filtered_cap = apply_filters('FHEE__EE_Capabilities__user_can__cap__'.$context, $cap, $user, $id); | 
                                                        |
| 670 | +		$filtered_cap = apply_filters('FHEE__EE_Capabilities__user_can__cap', $filtered_cap, $context, $cap, $user, $id); | 
                                                        |
| 671 | + return ! empty($id) ? user_can($user, $filtered_cap, $id) : user_can($user, $filtered_cap);  | 
                                                        |
| 672 | 672 | }  | 
                                                        
| 673 | 673 | |
| 674 | 674 | |
@@ -688,12 +688,12 @@ discard block  | 
                                                    ||
| 688 | 688 | *  | 
                                                        
| 689 | 689 | * @return bool Whether user can or not.  | 
                                                        
| 690 | 690 | */  | 
                                                        
| 691 | -	public function current_user_can_for_blog( $blog_id, $cap, $context, $id = 0 ) { | 
                                                        |
| 692 | - $user_can = ! empty( $id ) ? current_user_can_for_blog( $blog_id, $cap, $id ) : current_user_can( $blog_id, $cap );  | 
                                                        |
| 691 | +	public function current_user_can_for_blog($blog_id, $cap, $context, $id = 0) { | 
                                                        |
| 692 | + $user_can = ! empty($id) ? current_user_can_for_blog($blog_id, $cap, $id) : current_user_can($blog_id, $cap);  | 
                                                        |
| 693 | 693 | |
| 694 | 694 | //apply filters (both a global on just the cap, and context specific. Global overrides context specific)  | 
                                                        
| 695 | - $user_can = apply_filters( 'FHEE__EE_Capabilities__current_user_can_for_blog__user_can__' . $context, $user_can, $blog_id, $cap, $id );  | 
                                                        |
| 696 | - $user_can = apply_filters( 'FHEE__EE_Capabilities__current_user_can_for_blog__user_can', $user_can, $context, $blog_id, $cap, $id );  | 
                                                        |
| 695 | +		$user_can = apply_filters('FHEE__EE_Capabilities__current_user_can_for_blog__user_can__'.$context, $user_can, $blog_id, $cap, $id); | 
                                                        |
| 696 | +		$user_can = apply_filters('FHEE__EE_Capabilities__current_user_can_for_blog__user_can', $user_can, $context, $blog_id, $cap, $id); | 
                                                        |
| 697 | 697 | return $user_can;  | 
                                                        
| 698 | 698 | }  | 
                                                        
| 699 | 699 | |
@@ -709,12 +709,12 @@ discard block  | 
                                                    ||
| 709 | 709 | *  | 
                                                        
| 710 | 710 | * @return array  | 
                                                        
| 711 | 711 | */  | 
                                                        
| 712 | -	public function get_ee_capabilities( $role = 'administrator' ) { | 
                                                        |
| 712 | +	public function get_ee_capabilities($role = 'administrator') { | 
                                                        |
| 713 | 713 | $capabilities = $this->_init_caps_map();  | 
                                                        
| 714 | -		if ( empty( $role ) ) { | 
                                                        |
| 714 | +		if (empty($role)) { | 
                                                        |
| 715 | 715 | return $capabilities;  | 
                                                        
| 716 | 716 | }  | 
                                                        
| 717 | - return isset( $capabilities[ $role ] ) ? $capabilities[ $role ] : array();  | 
                                                        |
| 717 | + return isset($capabilities[$role]) ? $capabilities[$role] : array();  | 
                                                        |
| 718 | 718 | }  | 
                                                        
| 719 | 719 | }  | 
                                                        
| 720 | 720 | |
@@ -762,11 +762,11 @@ discard block  | 
                                                    ||
| 762 | 762 | * }  | 
                                                        
| 763 | 763 | * @throws EE_Error  | 
                                                        
| 764 | 764 | */  | 
                                                        
| 765 | -	public function __construct( $meta_cap, $map_values ) { | 
                                                        |
| 765 | +	public function __construct($meta_cap, $map_values) { | 
                                                        |
| 766 | 766 | $this->meta_cap = $meta_cap;  | 
                                                        
| 767 | 767 | //verify there are four args in the $map_values array;  | 
                                                        
| 768 | -		if ( count( $map_values ) !== 4 ) { | 
                                                        |
| 769 | - throw new EE_Error( sprintf( __( 'Incoming $map_values array should have a count of four values in it. This is what was given: %s', 'event_espresso' ), '<br>' . print_r( $map_values, true ) ) );  | 
                                                        |
| 768 | +		if (count($map_values) !== 4) { | 
                                                        |
| 769 | +			throw new EE_Error(sprintf(__('Incoming $map_values array should have a count of four values in it.  This is what was given: %s', 'event_espresso'), '<br>'.print_r($map_values, true))); | 
                                                        |
| 770 | 770 | }  | 
                                                        
| 771 | 771 | |
| 772 | 772 | //set properties  | 
                                                        
@@ -780,8 +780,8 @@ discard block  | 
                                                    ||
| 780 | 780 | /**  | 
                                                        
| 781 | 781 | * Makes it so this object stops filtering caps  | 
                                                        
| 782 | 782 | */  | 
                                                        
| 783 | -	public function remove_filters(){ | 
                                                        |
| 784 | - remove_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ), 10 );  | 
                                                        |
| 783 | +	public function remove_filters() { | 
                                                        |
| 784 | +		remove_filter('map_meta_cap', array($this, 'map_meta_caps'), 10); | 
                                                        |
| 785 | 785 | }  | 
                                                        
| 786 | 786 | |
| 787 | 787 | |
@@ -796,19 +796,19 @@ discard block  | 
                                                    ||
| 796 | 796 | */  | 
                                                        
| 797 | 797 |  	public function ensure_is_model() { | 
                                                        
| 798 | 798 | //is it already instantiated?  | 
                                                        
| 799 | -		if ( $this->_model instanceof EEM_Base ) { | 
                                                        |
| 799 | +		if ($this->_model instanceof EEM_Base) { | 
                                                        |
| 800 | 800 | return;  | 
                                                        
| 801 | 801 | }  | 
                                                        
| 802 | 802 | |
| 803 | 803 | //ensure model name is string  | 
                                                        
| 804 | 804 | $this->_model_name = (string) $this->_model_name;  | 
                                                        
| 805 | 805 | //error proof if the name has EEM in it  | 
                                                        
| 806 | - $this->_model_name = str_replace( 'EEM', '', $this->_model_name );  | 
                                                        |
| 806 | +		$this->_model_name = str_replace('EEM', '', $this->_model_name); | 
                                                        |
| 807 | 807 | |
| 808 | - $this->_model = EE_Registry::instance()->load_model( $this->_model_name );  | 
                                                        |
| 808 | + $this->_model = EE_Registry::instance()->load_model($this->_model_name);  | 
                                                        |
| 809 | 809 | |
| 810 | -		if ( ! $this->_model instanceof EEM_Base ) { | 
                                                        |
| 811 | - throw new EE_Error( sprintf( __( 'This string passed in to %s to represent a EEM_Base model class was not able to be used to instantiate the class. Please ensure that the string is a match for the EEM_Base model name (not including the EEM_ part). This was given: %s', 'event_espresso' ), get_class( $this ), $this->_model ) );  | 
                                                        |
| 810 | +		if ( ! $this->_model instanceof EEM_Base) { | 
                                                        |
| 811 | +			throw new EE_Error(sprintf(__('This string passed in to %s to represent a EEM_Base model class was not able to be used to instantiate the class.   Please ensure that the string is a match for the EEM_Base model name (not including the EEM_ part). This was given: %s', 'event_espresso'), get_class($this), $this->_model)); | 
                                                        |
| 812 | 812 | }  | 
                                                        
| 813 | 813 | }  | 
                                                        
| 814 | 814 | |
@@ -824,8 +824,8 @@ discard block  | 
                                                    ||
| 824 | 824 | *  | 
                                                        
| 825 | 825 | * @return array  | 
                                                        
| 826 | 826 | */  | 
                                                        
| 827 | -	public function map_meta_caps( $caps, $cap, $user_id, $args ) { | 
                                                        |
| 828 | - return $this->_map_meta_caps( $caps, $cap, $user_id, $args );  | 
                                                        |
| 827 | +	public function map_meta_caps($caps, $cap, $user_id, $args) { | 
                                                        |
| 828 | + return $this->_map_meta_caps($caps, $cap, $user_id, $args);  | 
                                                        |
| 829 | 829 | }  | 
                                                        
| 830 | 830 | |
| 831 | 831 | |
@@ -843,7 +843,7 @@ discard block  | 
                                                    ||
| 843 | 843 | *  | 
                                                        
| 844 | 844 | * @return array actual users capabilities  | 
                                                        
| 845 | 845 | */  | 
                                                        
| 846 | - abstract protected function _map_meta_caps( $caps, $cap, $user_id, $args );  | 
                                                        |
| 846 | + abstract protected function _map_meta_caps($caps, $cap, $user_id, $args);  | 
                                                        |
| 847 | 847 | }  | 
                                                        
| 848 | 848 | |
| 849 | 849 | |
@@ -875,28 +875,28 @@ discard block  | 
                                                    ||
| 875 | 875 | *  | 
                                                        
| 876 | 876 | * @return array actual users capabilities  | 
                                                        
| 877 | 877 | */  | 
                                                        
| 878 | -	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) { | 
                                                        |
| 878 | +	protected function _map_meta_caps($caps, $cap, $user_id, $args) { | 
                                                        |
| 879 | 879 | //only process if we're checking our mapped_cap  | 
                                                        
| 880 | -		if ( $cap !== $this->meta_cap ) { | 
                                                        |
| 880 | +		if ($cap !== $this->meta_cap) { | 
                                                        |
| 881 | 881 | return $caps;  | 
                                                        
| 882 | 882 | }  | 
                                                        
| 883 | 883 | |
| 884 | - $obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;  | 
                                                        |
| 884 | + $obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;  | 
                                                        |
| 885 | 885 | |
| 886 | 886 | //if no obj then let's just do cap  | 
                                                        
| 887 | -		if ( ! $obj instanceof EE_Base_Class ) { | 
                                                        |
| 887 | +		if ( ! $obj instanceof EE_Base_Class) { | 
                                                        |
| 888 | 888 | $caps[] = $cap;  | 
                                                        
| 889 | 889 | return $caps;  | 
                                                        
| 890 | 890 | }  | 
                                                        
| 891 | 891 | |
| 892 | -		if ( $obj instanceof EE_CPT_Base ) { | 
                                                        |
| 892 | +		if ($obj instanceof EE_CPT_Base) { | 
                                                        |
| 893 | 893 | //if the item author is set and the user is the author...  | 
                                                        
| 894 | -			if ( $obj->wp_user() && $user_id == $obj->wp_user() ) { | 
                                                        |
| 895 | -				if ( empty( $this->published_cap ) ) { | 
                                                        |
| 894 | +			if ($obj->wp_user() && $user_id == $obj->wp_user()) { | 
                                                        |
| 895 | +				if (empty($this->published_cap)) { | 
                                                        |
| 896 | 896 | $caps[] = $cap;  | 
                                                        
| 897 | 897 |  				} else { | 
                                                        
| 898 | 898 | //if obj is published...  | 
                                                        
| 899 | -					if ( $obj->status() == 'publish' ) { | 
                                                        |
| 899 | +					if ($obj->status() == 'publish') { | 
                                                        |
| 900 | 900 | $caps[] = $this->published_cap;  | 
                                                        
| 901 | 901 |  					} else { | 
                                                        
| 902 | 902 | $caps[] = $cap;  | 
                                                        
@@ -904,12 +904,12 @@ discard block  | 
                                                    ||
| 904 | 904 | }  | 
                                                        
| 905 | 905 |  			} else { | 
                                                        
| 906 | 906 | //the user is trying to edit someone else's obj  | 
                                                        
| 907 | -				if ( ! empty( $this->others_cap ) ) { | 
                                                        |
| 907 | +				if ( ! empty($this->others_cap)) { | 
                                                        |
| 908 | 908 | $caps[] = $this->others_cap;  | 
                                                        
| 909 | 909 | }  | 
                                                        
| 910 | -				if ( ! empty( $this->published_cap ) && $obj->status() == 'publish' ) { | 
                                                        |
| 910 | +				if ( ! empty($this->published_cap) && $obj->status() == 'publish') { | 
                                                        |
| 911 | 911 | $caps[] = $this->published_cap;  | 
                                                        
| 912 | -				} elseif ( ! empty( $this->private_cap ) && $obj->status() == 'private' ) { | 
                                                        |
| 912 | +				} elseif ( ! empty($this->private_cap) && $obj->status() == 'private') { | 
                                                        |
| 913 | 913 | $caps[] = $this->private_cap;  | 
                                                        
| 914 | 914 | }  | 
                                                        
| 915 | 915 | }  | 
                                                        
@@ -926,7 +926,7 @@ discard block  | 
                                                    ||
| 926 | 926 |  			if ($has_cap) { | 
                                                        
| 927 | 927 | $caps[] = $cap;  | 
                                                        
| 928 | 928 |  			} else { | 
                                                        
| 929 | -				if ( ! empty( $this->others_cap ) ) { | 
                                                        |
| 929 | +				if ( ! empty($this->others_cap)) { | 
                                                        |
| 930 | 930 | $caps[] = $this->others_cap;  | 
                                                        
| 931 | 931 | }  | 
                                                        
| 932 | 932 | }  | 
                                                        
@@ -963,8 +963,8 @@ discard block  | 
                                                    ||
| 963 | 963 | *  | 
                                                        
| 964 | 964 | * @return array actual users capabilities  | 
                                                        
| 965 | 965 | */  | 
                                                        
| 966 | -	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) { | 
                                                        |
| 967 | - return parent::_map_meta_caps( $caps, $cap, $user_id, $args );  | 
                                                        |
| 966 | +	protected function _map_meta_caps($caps, $cap, $user_id, $args) { | 
                                                        |
| 967 | + return parent::_map_meta_caps($caps, $cap, $user_id, $args);  | 
                                                        |
| 968 | 968 | }  | 
                                                        
| 969 | 969 | }  | 
                                                        
| 970 | 970 | |
@@ -996,34 +996,34 @@ discard block  | 
                                                    ||
| 996 | 996 | *  | 
                                                        
| 997 | 997 | * @return array actual users capabilities  | 
                                                        
| 998 | 998 | */  | 
                                                        
| 999 | -	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) { | 
                                                        |
| 999 | +	protected function _map_meta_caps($caps, $cap, $user_id, $args) { | 
                                                        |
| 1000 | 1000 | //only process if we're checking our mapped cap;  | 
                                                        
| 1001 | -		if ( $cap !== $this->meta_cap ) { | 
                                                        |
| 1001 | +		if ($cap !== $this->meta_cap) { | 
                                                        |
| 1002 | 1002 | return $caps;  | 
                                                        
| 1003 | 1003 | }  | 
                                                        
| 1004 | 1004 | |
| 1005 | - $obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;  | 
                                                        |
| 1005 | + $obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;  | 
                                                        |
| 1006 | 1006 | |
| 1007 | 1007 | //if no obj then let's just do cap  | 
                                                        
| 1008 | -		if ( ! $obj instanceof EE_Base_Class ) { | 
                                                        |
| 1008 | +		if ( ! $obj instanceof EE_Base_Class) { | 
                                                        |
| 1009 | 1009 | $caps[] = $cap;  | 
                                                        
| 1010 | 1010 | return $caps;  | 
                                                        
| 1011 | 1011 | }  | 
                                                        
| 1012 | 1012 | |
| 1013 | -		if ( $obj instanceof EE_CPT_Base ) { | 
                                                        |
| 1014 | - $status_obj = get_post_status_object( $obj->status() );  | 
                                                        |
| 1015 | -			if ( $status_obj->public ) { | 
                                                        |
| 1013 | +		if ($obj instanceof EE_CPT_Base) { | 
                                                        |
| 1014 | + $status_obj = get_post_status_object($obj->status());  | 
                                                        |
| 1015 | +			if ($status_obj->public) { | 
                                                        |
| 1016 | 1016 | $caps[] = $cap;  | 
                                                        
| 1017 | 1017 | return $caps;  | 
                                                        
| 1018 | 1018 | }  | 
                                                        
| 1019 | 1019 | |
| 1020 | 1020 | //if the item author is set and the user is the author...  | 
                                                        
| 1021 | -			if ( $obj->wp_user() && $user_id == $obj->wp_user() ) { | 
                                                        |
| 1021 | +			if ($obj->wp_user() && $user_id == $obj->wp_user()) { | 
                                                        |
| 1022 | 1022 | $caps[] = $cap;  | 
                                                        
| 1023 | -			} elseif ( $status_obj->private && ! empty( $this->private_cap ) ) { | 
                                                        |
| 1023 | +			} elseif ($status_obj->private && ! empty($this->private_cap)) { | 
                                                        |
| 1024 | 1024 | //the user is trying to view someone else's obj  | 
                                                        
| 1025 | 1025 | $caps[] = $this->private_cap;  | 
                                                        
| 1026 | -			} elseif ( ! empty( $this->others_cap ) ) { | 
                                                        |
| 1026 | +			} elseif ( ! empty($this->others_cap)) { | 
                                                        |
| 1027 | 1027 | $caps[] = $this->others_cap;  | 
                                                        
| 1028 | 1028 |  			} else { | 
                                                        
| 1029 | 1029 | $caps[] = $cap;  | 
                                                        
@@ -1040,9 +1040,9 @@ discard block  | 
                                                    ||
| 1040 | 1040 | }  | 
                                                        
| 1041 | 1041 |  			if ($has_cap) { | 
                                                        
| 1042 | 1042 | $caps[] = $cap;  | 
                                                        
| 1043 | -			} elseif ( ! empty( $this->private_cap ) ) { | 
                                                        |
| 1043 | +			} elseif ( ! empty($this->private_cap)) { | 
                                                        |
| 1044 | 1044 | $caps[] = $this->private_cap;  | 
                                                        
| 1045 | -			} elseif ( ! empty( $this->others_cap ) ) { | 
                                                        |
| 1045 | +			} elseif ( ! empty($this->others_cap)) { | 
                                                        |
| 1046 | 1046 | $caps[] = $this->others_cap;  | 
                                                        
| 1047 | 1047 |  			} else { | 
                                                        
| 1048 | 1048 | $caps[] = $cap;  | 
                                                        
@@ -1079,30 +1079,30 @@ discard block  | 
                                                    ||
| 1079 | 1079 | *  | 
                                                        
| 1080 | 1080 | * @return array actual users capabilities  | 
                                                        
| 1081 | 1081 | */  | 
                                                        
| 1082 | -	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) { | 
                                                        |
| 1082 | +	protected function _map_meta_caps($caps, $cap, $user_id, $args) { | 
                                                        |
| 1083 | 1083 | //only process if we're checking our mapped_cap  | 
                                                        
| 1084 | -		if ( $cap !== $this->meta_cap ) { | 
                                                        |
| 1084 | +		if ($cap !== $this->meta_cap) { | 
                                                        |
| 1085 | 1085 | return $caps;  | 
                                                        
| 1086 | 1086 | }  | 
                                                        
| 1087 | 1087 | |
| 1088 | - $obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;  | 
                                                        |
| 1088 | + $obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;  | 
                                                        |
| 1089 | 1089 | |
| 1090 | 1090 | //if no obj then let's just do cap  | 
                                                        
| 1091 | -		if ( ! $obj instanceof EE_Message_Template_Group ) { | 
                                                        |
| 1091 | +		if ( ! $obj instanceof EE_Message_Template_Group) { | 
                                                        |
| 1092 | 1092 | $caps[] = $cap;  | 
                                                        
| 1093 | 1093 | return $caps;  | 
                                                        
| 1094 | 1094 | }  | 
                                                        
| 1095 | 1095 | |
| 1096 | 1096 | $is_global = $obj->is_global();  | 
                                                        
| 1097 | 1097 | |
| 1098 | -		if ( $obj->wp_user() && $user_id == $obj->wp_user() ) { | 
                                                        |
| 1099 | -			if ( $is_global ) { | 
                                                        |
| 1100 | - $caps[] = $this->private_cap;  | 
                                                        |
| 1098 | +		if ($obj->wp_user() && $user_id == $obj->wp_user()) { | 
                                                        |
| 1099 | +			if ($is_global) { | 
                                                        |
| 1100 | + $caps[] = $this->private_cap;  | 
                                                        |
| 1101 | 1101 |  			} else { | 
                                                        
| 1102 | 1102 | $caps[] = $cap;  | 
                                                        
| 1103 | 1103 | }  | 
                                                        
| 1104 | 1104 |  		} else { | 
                                                        
| 1105 | -			if ( $is_global ) { | 
                                                        |
| 1105 | +			if ($is_global) { | 
                                                        |
| 1106 | 1106 | $caps[] = $this->private_cap;  | 
                                                        
| 1107 | 1107 |  			} else { | 
                                                        
| 1108 | 1108 | $caps[] = $this->others_cap;  | 
                                                        
@@ -1140,16 +1140,16 @@ discard block  | 
                                                    ||
| 1140 | 1140 | *  | 
                                                        
| 1141 | 1141 | * @return array actual users capabilities  | 
                                                        
| 1142 | 1142 | */  | 
                                                        
| 1143 | -	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) { | 
                                                        |
| 1143 | +	protected function _map_meta_caps($caps, $cap, $user_id, $args) { | 
                                                        |
| 1144 | 1144 | //only process if we're checking our mapped_cap  | 
                                                        
| 1145 | -		if ( $cap !== $this->meta_cap ) { | 
                                                        |
| 1145 | +		if ($cap !== $this->meta_cap) { | 
                                                        |
| 1146 | 1146 | return $caps;  | 
                                                        
| 1147 | 1147 | }  | 
                                                        
| 1148 | 1148 | |
| 1149 | - $obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;  | 
                                                        |
| 1149 | + $obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;  | 
                                                        |
| 1150 | 1150 | |
| 1151 | 1151 | //if no obj then let's just do cap  | 
                                                        
| 1152 | -		if ( ! $obj instanceof EE_Base_Class ) { | 
                                                        |
| 1152 | +		if ( ! $obj instanceof EE_Base_Class) { | 
                                                        |
| 1153 | 1153 | $caps[] = $cap;  | 
                                                        
| 1154 | 1154 | return $caps;  | 
                                                        
| 1155 | 1155 | }  | 
                                                        
@@ -1157,7 +1157,7 @@ discard block  | 
                                                    ||
| 1157 | 1157 | $is_system = $obj instanceof EE_Question_Group ? $obj->system_group() : false;  | 
                                                        
| 1158 | 1158 | $is_system = $obj instanceof EE_Question ? $obj->is_system_question() : $is_system;  | 
                                                        
| 1159 | 1159 | |
| 1160 | -		if ( $is_system ) { | 
                                                        |
| 1160 | +		if ($is_system) { | 
                                                        |
| 1161 | 1161 | $caps[] = $this->private_cap;  | 
                                                        
| 1162 | 1162 |  		} else { | 
                                                        
| 1163 | 1163 | $caps[] = $cap;  | 
                                                        
@@ -374,18 +374,18 @@ discard block  | 
                                                    ||
| 374 | 374 | * @return string  | 
                                                        
| 375 | 375 | * @throws \EE_Error  | 
                                                        
| 376 | 376 | */  | 
                                                        
| 377 | -    public function column_cb($item){ | 
                                                        |
| 378 | - /** checkbox/lock **/  | 
                                                        |
| 379 | - $transaction = $item->get_first_related( 'Transaction' );  | 
                                                        |
| 380 | - $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0;  | 
                                                        |
| 381 | - return $payment_count > 0  | 
                                                        |
| 382 | - ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() )  | 
                                                        |
| 383 | - . '<span class="ee-lock-icon"></span>'  | 
                                                        |
| 384 | - : sprintf(  | 
                                                        |
| 385 | - '<input type="checkbox" name="_REG_ID[]" value="%1$s" />',  | 
                                                        |
| 386 | - $item->ID()  | 
                                                        |
| 387 | - );  | 
                                                        |
| 388 | - }  | 
                                                        |
| 377 | +	public function column_cb($item){ | 
                                                        |
| 378 | + /** checkbox/lock **/  | 
                                                        |
| 379 | + $transaction = $item->get_first_related( 'Transaction' );  | 
                                                        |
| 380 | + $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0;  | 
                                                        |
| 381 | + return $payment_count > 0  | 
                                                        |
| 382 | + ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() )  | 
                                                        |
| 383 | + . '<span class="ee-lock-icon"></span>'  | 
                                                        |
| 384 | + : sprintf(  | 
                                                        |
| 385 | + '<input type="checkbox" name="_REG_ID[]" value="%1$s" />',  | 
                                                        |
| 386 | + $item->ID()  | 
                                                        |
| 387 | + );  | 
                                                        |
| 388 | + }  | 
                                                        |
| 389 | 389 | |
| 390 | 390 | |
| 391 | 391 | |
@@ -398,7 +398,7 @@ discard block  | 
                                                    ||
| 398 | 398 | * @throws \EE_Error  | 
                                                        
| 399 | 399 | */  | 
                                                        
| 400 | 400 |  	public function column__REG_ID(EE_Registration $item){ | 
                                                        
| 401 | - $attendee = $item->attendee();  | 
                                                        |
| 401 | + $attendee = $item->attendee();  | 
                                                        |
| 402 | 402 | $content = $item->ID();  | 
                                                        
| 403 | 403 | $content .= '<div class="show-on-mobile-view-only">';  | 
                                                        
| 404 | 404 | $content .= '<br>';  | 
                                                        
@@ -421,7 +421,7 @@ discard block  | 
                                                    ||
| 421 | 421 | */  | 
                                                        
| 422 | 422 |  	public function column__REG_date(EE_Registration $item){ | 
                                                        
| 423 | 423 | $this->_set_related_details($item);  | 
                                                        
| 424 | - //Build row actions  | 
                                                        |
| 424 | + //Build row actions  | 
                                                        |
| 425 | 425 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL );  | 
                                                        
| 426 | 426 |  		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); | 
                                                        
| 427 | 427 | $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>';  | 
                                                        
@@ -441,27 +441,27 @@ discard block  | 
                                                    ||
| 441 | 441 |  	public function column_event_name(EE_Registration $item){ | 
                                                        
| 442 | 442 | $this->_set_related_details( $item );  | 
                                                        
| 443 | 443 | // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62  | 
                                                        
| 444 | - $EVT_ID = $item->event_ID();  | 
                                                        |
| 445 | - $event_name = $item->event_name();  | 
                                                        |
| 446 | -        $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); | 
                                                        |
| 447 | - $event_name = wp_trim_words($event_name, 30, '...');  | 
                                                        |
| 448 | -        if ($EVT_ID) { | 
                                                        |
| 449 | -            $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $EVT_ID), | 
                                                        |
| 450 | - EVENTS_ADMIN_URL);  | 
                                                        |
| 451 | -            $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID) | 
                                                        |
| 452 | - ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr($this->_event_details['title_attr']) . '">' . $event_name . '</a>'  | 
                                                        |
| 453 | - : $event_name;  | 
                                                        |
| 454 | -            $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL); | 
                                                        |
| 455 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="';  | 
                                                        |
| 456 | - $actions['event_filter'] .= sprintf(  | 
                                                        |
| 457 | -                esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), | 
                                                        |
| 458 | - $event_name  | 
                                                        |
| 459 | - );  | 
                                                        |
| 460 | -            $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>'; | 
                                                        |
| 461 | -        } else { | 
                                                        |
| 462 | - $edit_event = $event_name;  | 
                                                        |
| 463 | - $actions['event_filter'] = '';  | 
                                                        |
| 464 | - }  | 
                                                        |
| 444 | + $EVT_ID = $item->event_ID();  | 
                                                        |
| 445 | + $event_name = $item->event_name();  | 
                                                        |
| 446 | +		$event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); | 
                                                        |
| 447 | + $event_name = wp_trim_words($event_name, 30, '...');  | 
                                                        |
| 448 | +		if ($EVT_ID) { | 
                                                        |
| 449 | +			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $EVT_ID), | 
                                                        |
| 450 | + EVENTS_ADMIN_URL);  | 
                                                        |
| 451 | +			$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID) | 
                                                        |
| 452 | + ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr($this->_event_details['title_attr']) . '">' . $event_name . '</a>'  | 
                                                        |
| 453 | + : $event_name;  | 
                                                        |
| 454 | +			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL); | 
                                                        |
| 455 | + $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="';  | 
                                                        |
| 456 | + $actions['event_filter'] .= sprintf(  | 
                                                        |
| 457 | +				esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), | 
                                                        |
| 458 | + $event_name  | 
                                                        |
| 459 | + );  | 
                                                        |
| 460 | +			$actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>'; | 
                                                        |
| 461 | +		} else { | 
                                                        |
| 462 | + $edit_event = $event_name;  | 
                                                        |
| 463 | + $actions['event_filter'] = '';  | 
                                                        |
| 464 | + }  | 
                                                        |
| 465 | 465 | |
| 466 | 466 |  		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) ); | 
                                                        
| 467 | 467 | }  | 
                                                        
@@ -489,7 +489,7 @@ discard block  | 
                                                    ||
| 489 | 489 |  		} else { | 
                                                        
| 490 | 490 | return __( 'There is no ticket on this registration', 'event_espresso' );  | 
                                                        
| 491 | 491 | }  | 
                                                        
| 492 | - }  | 
                                                        |
| 492 | + }  | 
                                                        |
| 493 | 493 | |
| 494 | 494 | |
| 495 | 495 | |
@@ -502,32 +502,32 @@ discard block  | 
                                                    ||
| 502 | 502 | * @throws \EE_Error  | 
                                                        
| 503 | 503 | */  | 
                                                        
| 504 | 504 |     	public function column_ATT_fname(EE_Registration $item){ | 
                                                        
| 505 | - $attendee = $item->attendee();  | 
                                                        |
| 505 | + $attendee = $item->attendee();  | 
                                                        |
| 506 | 506 | |
| 507 | 507 | $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );  | 
                                                        
| 508 | 508 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';  | 
                                                        
| 509 | 509 | $link = EE_Registry::instance()->CAP->current_user_can(  | 
                                                        
| 510 | - 'ee_read_registration',  | 
                                                        |
| 511 | - 'espresso_registrations_view_registration',  | 
                                                        |
| 512 | - $item->ID()  | 
                                                        |
| 513 | - )  | 
                                                        |
| 514 | - ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>'  | 
                                                        |
| 515 | - : $attendee_name;  | 
                                                        |
| 510 | + 'ee_read_registration',  | 
                                                        |
| 511 | + 'espresso_registrations_view_registration',  | 
                                                        |
| 512 | + $item->ID()  | 
                                                        |
| 513 | + )  | 
                                                        |
| 514 | + ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>'  | 
                                                        |
| 515 | + : $attendee_name;  | 
                                                        |
| 516 | 516 | $link .= $item->count() === 1  | 
                                                        
| 517 | - ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>'  | 
                                                        |
| 518 | - : '';  | 
                                                        |
| 517 | + ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>'  | 
                                                        |
| 518 | + : '';  | 
                                                        |
| 519 | 519 | |
| 520 | 520 |  		$t = $item->get_first_related('Transaction'); | 
                                                        
| 521 | 521 |  		$payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; | 
                                                        
| 522 | 522 | |
| 523 | - //append group count to name  | 
                                                        |
| 524 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());  | 
                                                        |
| 523 | + //append group count to name  | 
                                                        |
| 524 | + $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());  | 
                                                        |
| 525 | 525 | |
| 526 | - //append reg_code  | 
                                                        |
| 527 | -	    $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); | 
                                                        |
| 526 | + //append reg_code  | 
                                                        |
| 527 | +		$link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); | 
                                                        |
| 528 | 528 | |
| 529 | - //reg status text for accessibility  | 
                                                        |
| 530 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';  | 
                                                        |
| 529 | + //reg status text for accessibility  | 
                                                        |
| 530 | + $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';  | 
                                                        |
| 531 | 531 | |
| 532 | 532 | //trash/restore/delete actions  | 
                                                        
| 533 | 533 | $actions = array();  | 
                                                        
@@ -755,14 +755,14 @@ discard block  | 
                                                    ||
| 755 | 755 | //message list table link (filtered by REG_ID  | 
                                                        
| 756 | 756 |  		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { | 
                                                        
| 757 | 757 | $actions['filtered_messages_link'] = '<li>'  | 
                                                        
| 758 | - . EEH_MSG_Template::get_message_action_link(  | 
                                                        |
| 758 | + . EEH_MSG_Template::get_message_action_link(  | 
                                                        |
| 759 | 759 | 'see_notifications_for',  | 
                                                        
| 760 | 760 | null,  | 
                                                        
| 761 | 761 | array(  | 
                                                        
| 762 | 762 | '_REG_ID' => $item->ID()  | 
                                                        
| 763 | 763 | )  | 
                                                        
| 764 | 764 | )  | 
                                                        
| 765 | - . '</li>';  | 
                                                        |
| 765 | + . '</li>';  | 
                                                        |
| 766 | 766 | }  | 
                                                        
| 767 | 767 | $actions = apply_filters( 'FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this );  | 
                                                        
| 768 | 768 | return $this->_action_string(  | 
                                                        
@@ -54,13 +54,13 @@ discard block  | 
                                                    ||
| 54 | 54 | /**  | 
                                                        
| 55 | 55 | * @param \Registrations_Admin_Page $admin_page  | 
                                                        
| 56 | 56 | */  | 
                                                        
| 57 | -	public function __construct( Registrations_Admin_Page $admin_page ){ | 
                                                        |
| 58 | -		if ( ! empty( $_GET['event_id'] ) ) { | 
                                                        |
| 57 | +	public function __construct(Registrations_Admin_Page $admin_page) { | 
                                                        |
| 58 | +		if ( ! empty($_GET['event_id'])) { | 
                                                        |
| 59 | 59 | $extra_query_args = array();  | 
                                                        
| 60 | -			foreach ( $admin_page->get_views() as $key => $view_details ) { | 
                                                        |
| 61 | - $extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] );  | 
                                                        |
| 60 | +			foreach ($admin_page->get_views() as $key => $view_details) { | 
                                                        |
| 61 | +				$extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']); | 
                                                        |
| 62 | 62 | }  | 
                                                        
| 63 | - $this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args );  | 
                                                        |
| 63 | + $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);  | 
                                                        |
| 64 | 64 | }  | 
                                                        
| 65 | 65 | parent::__construct($admin_page);  | 
                                                        
| 66 | 66 | $this->_status = $this->_admin_page->get_registration_status_array();  | 
                                                        
@@ -75,8 +75,8 @@ discard block  | 
                                                    ||
| 75 | 75 | * @return void  | 
                                                        
| 76 | 76 | */  | 
                                                        
| 77 | 77 |  	protected function _setup_data() { | 
                                                        
| 78 | - $this->_data = $this->_admin_page->get_registrations( $this->_per_page );  | 
                                                        |
| 79 | - $this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE );  | 
                                                        |
| 78 | + $this->_data = $this->_admin_page->get_registrations($this->_per_page);  | 
                                                        |
| 79 | + $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE);  | 
                                                        |
| 80 | 80 | }  | 
                                                        
| 81 | 81 | |
| 82 | 82 | |
@@ -93,30 +93,30 @@ discard block  | 
                                                    ||
| 93 | 93 | 'ajax' => TRUE,  | 
                                                        
| 94 | 94 | 'screen' => $this->_admin_page->get_current_screen()->id  | 
                                                        
| 95 | 95 | );  | 
                                                        
| 96 | - $ID_column_name = __( 'ID', 'event_espresso' );  | 
                                                        |
| 96 | +		$ID_column_name = __('ID', 'event_espresso'); | 
                                                        |
| 97 | 97 | $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">';  | 
                                                        
| 98 | - $ID_column_name .= __( 'Registrant Name', 'event_espresso' );  | 
                                                        |
| 98 | +		$ID_column_name .= __('Registrant Name', 'event_espresso'); | 
                                                        |
| 99 | 99 | $ID_column_name .= '</span> ';  | 
                                                        
| 100 | -		if ( isset( $_GET['event_id'] )) { | 
                                                        |
| 100 | +		if (isset($_GET['event_id'])) { | 
                                                        |
| 101 | 101 | $this->_columns = array(  | 
                                                        
| 102 | 102 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text  | 
                                                        
| 103 | 103 | '_REG_ID' => $ID_column_name,  | 
                                                        
| 104 | - 'ATT_fname' => __( 'Name', 'event_espresso' ),  | 
                                                        |
| 104 | +				'ATT_fname' => __('Name', 'event_espresso'), | 
                                                        |
| 105 | 105 |  				'ATT_email' =>  __('Email', 'event_espresso'), | 
                                                        
| 106 | - '_REG_date' => __( 'Reg Date', 'event_espresso' ),  | 
                                                        |
| 107 | - 'PRC_amount' => __( 'TKT Price', 'event_espresso' ),  | 
                                                        |
| 108 | - '_REG_final_price' => __( 'Final Price', 'event_espresso' ),  | 
                                                        |
| 109 | - 'TXN_total' => __( 'Total Txn', 'event_espresso' ),  | 
                                                        |
| 106 | +				'_REG_date' => __('Reg Date', 'event_espresso'), | 
                                                        |
| 107 | +				'PRC_amount' => __('TKT Price', 'event_espresso'), | 
                                                        |
| 108 | +				'_REG_final_price' => __('Final Price', 'event_espresso'), | 
                                                        |
| 109 | +				'TXN_total' => __('Total Txn', 'event_espresso'), | 
                                                        |
| 110 | 110 |  				'TXN_paid' => __('Paid', 'event_espresso'), | 
                                                        
| 111 | - 'actions' => __( 'Actions', 'event_espresso' )  | 
                                                        |
| 111 | +				'actions' => __('Actions', 'event_espresso') | 
                                                        |
| 112 | 112 | );  | 
                                                        
| 113 | 113 | $this->_bottom_buttons = array(  | 
                                                        
| 114 | 114 | 'report'=> array(  | 
                                                        
| 115 | 115 | 'route' => 'registrations_report',  | 
                                                        
| 116 | 116 | 'extra_request' =>  | 
                                                        
| 117 | 117 | array(  | 
                                                        
| 118 | - 'EVT_ID'=> isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null,  | 
                                                        |
| 119 | -							'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) | 
                                                        |
| 118 | + 'EVT_ID'=> isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,  | 
                                                        |
| 119 | +							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") | 
                                                        |
| 120 | 120 | )  | 
                                                        
| 121 | 121 | ),  | 
                                                        
| 122 | 122 | );  | 
                                                        
@@ -124,19 +124,19 @@ discard block  | 
                                                    ||
| 124 | 124 | $this->_columns = array(  | 
                                                        
| 125 | 125 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text  | 
                                                        
| 126 | 126 | '_REG_ID' => $ID_column_name,  | 
                                                        
| 127 | - 'ATT_fname' => __( 'Name', 'event_espresso' ),  | 
                                                        |
| 128 | - '_REG_date' => __( 'TXN Date', 'event_espresso' ),  | 
                                                        |
| 129 | - 'event_name' => __( 'Event', 'event_espresso' ),  | 
                                                        |
| 130 | - 'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ),  | 
                                                        |
| 131 | - '_REG_final_price' => __( 'Price', 'event_espresso' ),  | 
                                                        |
| 132 | - '_REG_paid' => __( 'Paid', 'event_espresso' ),  | 
                                                        |
| 133 | - 'actions' => __( 'Actions', 'event_espresso' )  | 
                                                        |
| 127 | +				'ATT_fname' => __('Name', 'event_espresso'), | 
                                                        |
| 128 | +				'_REG_date' => __('TXN Date', 'event_espresso'), | 
                                                        |
| 129 | +				'event_name' => __('Event', 'event_espresso'), | 
                                                        |
| 130 | +				'DTT_EVT_start' => __('Event Date', 'event_espresso'), | 
                                                        |
| 131 | +				'_REG_final_price' => __('Price', 'event_espresso'), | 
                                                        |
| 132 | +				'_REG_paid' => __('Paid', 'event_espresso'), | 
                                                        |
| 133 | +				'actions' => __('Actions', 'event_espresso') | 
                                                        |
| 134 | 134 | );  | 
                                                        
| 135 | 135 | $this->_bottom_buttons = array(  | 
                                                        
| 136 | 136 | 'report_all'=> array(  | 
                                                        
| 137 | 137 | 'route' => 'registrations_report',  | 
                                                        
| 138 | 138 | 'extra_request' => array(  | 
                                                        
| 139 | -					'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) | 
                                                        |
| 139 | +					'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) | 
                                                        |
| 140 | 140 | ),  | 
                                                        
| 141 | 141 | );  | 
                                                        
| 142 | 142 | }  | 
                                                        
@@ -144,11 +144,11 @@ discard block  | 
                                                    ||
| 144 | 144 | $this->_primary_column = '_REG_ID';  | 
                                                        
| 145 | 145 | |
| 146 | 146 | $this->_sortable_columns = array(  | 
                                                        
| 147 | - '_REG_date' => array( '_REG_date' => TRUE ), //true means its already sorted  | 
                                                        |
| 148 | - 'ATT_fname' => array( 'ATT_fname' => FALSE ),  | 
                                                        |
| 149 | - 'event_name' => array( 'event_name' => FALSE ),  | 
                                                        |
| 150 | - 'DTT_EVT_start' => array( 'DTT_EVT_start' => FALSE ),  | 
                                                        |
| 151 | - '_REG_ID' => array( '_REG_ID' => FALSE ),  | 
                                                        |
| 147 | +			'_REG_date' => array('_REG_date' => TRUE), //true means its already sorted | 
                                                        |
| 148 | +			'ATT_fname' => array('ATT_fname' => FALSE), | 
                                                        |
| 149 | +			'event_name' => array('event_name' => FALSE), | 
                                                        |
| 150 | +			'DTT_EVT_start'	=> array('DTT_EVT_start' => FALSE), | 
                                                        |
| 151 | +			'_REG_ID' => array('_REG_ID' => FALSE), | 
                                                        |
| 152 | 152 | );  | 
                                                        
| 153 | 153 | |
| 154 | 154 | $this->_hidden_columns = array();  | 
                                                        
@@ -162,11 +162,11 @@ discard block  | 
                                                    ||
| 162 | 162 | * @param EE_Registration $item the current item  | 
                                                        
| 163 | 163 | * @return string  | 
                                                        
| 164 | 164 | */  | 
                                                        
| 165 | -	protected function _get_row_class( $item ) { | 
                                                        |
| 166 | - $class = parent::_get_row_class( $item );  | 
                                                        |
| 165 | +	protected function _get_row_class($item) { | 
                                                        |
| 166 | + $class = parent::_get_row_class($item);  | 
                                                        |
| 167 | 167 | //add status class  | 
                                                        
| 168 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID();  | 
                                                        |
| 169 | -		if ( $this->_has_checkbox_column ) { | 
                                                        |
| 168 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID();  | 
                                                        |
| 169 | +		if ($this->_has_checkbox_column) { | 
                                                        |
| 170 | 170 | $class .= ' has-checkbox-column';  | 
                                                        
| 171 | 171 | }  | 
                                                        
| 172 | 172 | return $class;  | 
                                                        
@@ -180,9 +180,9 @@ discard block  | 
                                                    ||
| 180 | 180 | * @param EE_Registration $registration  | 
                                                        
| 181 | 181 | * @throws \EE_Error  | 
                                                        
| 182 | 182 | */  | 
                                                        
| 183 | -	protected function _set_related_details( EE_Registration $registration ) { | 
                                                        |
| 183 | +	protected function _set_related_details(EE_Registration $registration) { | 
                                                        |
| 184 | 184 | |
| 185 | - $transaction = $registration->get_first_related( 'Transaction' );  | 
                                                        |
| 185 | +		$transaction = $registration->get_first_related('Transaction'); | 
                                                        |
| 186 | 186 | $status = $transaction instanceof EE_Transaction  | 
                                                        
| 187 | 187 | ? $transaction->status_ID()  | 
                                                        
| 188 | 188 | : EEM_Transaction::failed_status_code;  | 
                                                        
@@ -191,14 +191,14 @@ discard block  | 
                                                    ||
| 191 | 191 | 'status' => $status,  | 
                                                        
| 192 | 192 | 'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0,  | 
                                                        
| 193 | 193 | 'title_attr' => sprintf(  | 
                                                        
| 194 | - __( 'View Transaction Details (%s)', 'event_espresso' ),  | 
                                                        |
| 195 | - EEH_Template::pretty_status( $status, false, 'sentence' )  | 
                                                        |
| 194 | +				__('View Transaction Details (%s)', 'event_espresso'), | 
                                                        |
| 195 | + EEH_Template::pretty_status($status, false, 'sentence')  | 
                                                        |
| 196 | 196 | )  | 
                                                        
| 197 | 197 | );  | 
                                                        
| 198 | 198 | |
| 199 | 199 |  		try { | 
                                                        
| 200 | 200 | $event = $registration->event();  | 
                                                        
| 201 | -		} catch( \EventEspresso\core\exceptions\EntityNotFoundException $e ) { | 
                                                        |
| 201 | +		} catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) { | 
                                                        |
| 202 | 202 | $event = null;  | 
                                                        
| 203 | 203 | }  | 
                                                        
| 204 | 204 | $status = $event instanceof EE_Event ? $event->get_active_status() : EE_Datetime::inactive;  | 
                                                        
@@ -207,8 +207,8 @@ discard block  | 
                                                    ||
| 207 | 207 | 'status' => $status,  | 
                                                        
| 208 | 208 | 'id' => $event instanceof EE_Event ? $event->ID() : 0,  | 
                                                        
| 209 | 209 | 'title_attr' => sprintf(  | 
                                                        
| 210 | - __( 'Edit Event (%s)', 'event_espresso' ),  | 
                                                        |
| 211 | - EEH_Template::pretty_status( $status, false, 'sentence' )  | 
                                                        |
| 210 | +				__('Edit Event (%s)', 'event_espresso'), | 
                                                        |
| 211 | + EEH_Template::pretty_status($status, false, 'sentence')  | 
                                                        |
| 212 | 212 | )  | 
                                                        
| 213 | 213 | );  | 
                                                        
| 214 | 214 | }  | 
                                                        
@@ -225,30 +225,30 @@ discard block  | 
                                                    ||
| 225 | 225 | |
| 226 | 226 | //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.  | 
                                                        
| 227 | 227 | |
| 228 | - $cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : '';  | 
                                                        |
| 229 | - $cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1;  | 
                                                        |
| 230 | - $reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : '';  | 
                                                        |
| 228 | + $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';  | 
                                                        |
| 229 | + $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;  | 
                                                        |
| 230 | + $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : '';  | 
                                                        |
| 231 | 231 | |
| 232 | - $filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category );  | 
                                                        |
| 233 | - $filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category );  | 
                                                        |
| 232 | + $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);  | 
                                                        |
| 233 | + $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category);  | 
                                                        |
| 234 | 234 | |
| 235 | 235 | $status = array();  | 
                                                        
| 236 | -		$status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') ); | 
                                                        |
| 237 | -		foreach ( $this->_status as $key => $value ) { | 
                                                        |
| 238 | - $status[] = array( 'id' => $key, 'text' => $value );  | 
                                                        |
| 236 | +		$status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso')); | 
                                                        |
| 237 | +		foreach ($this->_status as $key => $value) { | 
                                                        |
| 238 | +			$status[] = array('id' => $key, 'text' => $value); | 
                                                        |
| 239 | 239 | }  | 
                                                        
| 240 | -		if ( $this->_view !== 'incomplete' ) { | 
                                                        |
| 240 | +		if ($this->_view !== 'incomplete') { | 
                                                        |
| 241 | 241 | $filters[] = EEH_Form_Fields::select_input(  | 
                                                        
| 242 | 242 | '_reg_status',  | 
                                                        
| 243 | 243 | $status,  | 
                                                        
| 244 | - isset( $this->_req_data['_reg_status'] )  | 
                                                        |
| 245 | - ? strtoupper( sanitize_key( $this->_req_data['_reg_status'] ))  | 
                                                        |
| 244 | + isset($this->_req_data['_reg_status'])  | 
                                                        |
| 245 | + ? strtoupper(sanitize_key($this->_req_data['_reg_status']))  | 
                                                        |
| 246 | 246 | : ''  | 
                                                        
| 247 | 247 | );  | 
                                                        
| 248 | 248 | }  | 
                                                        
| 249 | 249 | |
| 250 | -		if ( isset( $this->_req_data['event_id'] ) ) { | 
                                                        |
| 251 | - $filters[] = EEH_Form_Fields::hidden_input( 'event_id', $this->_req_data['event_id'], 'reg_event_id' );  | 
                                                        |
| 250 | +		if (isset($this->_req_data['event_id'])) { | 
                                                        |
| 251 | +			$filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); | 
                                                        |
| 252 | 252 | }  | 
                                                        
| 253 | 253 | |
| 254 | 254 | return $filters;  | 
                                                        
@@ -267,9 +267,9 @@ discard block  | 
                                                    ||
| 267 | 267 | $this->_views['all']['count'] = $this->_total_registrations();  | 
                                                        
| 268 | 268 | $this->_views['month']['count'] = $this->_total_registrations_this_month();  | 
                                                        
| 269 | 269 | $this->_views['today']['count'] = $this->_total_registrations_today();  | 
                                                        
| 270 | -		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) { | 
                                                        |
| 271 | - $this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' );  | 
                                                        |
| 272 | - $this->_views['trash']['count'] = $this->_total_registrations( 'trash' );  | 
                                                        |
| 270 | +		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) { | 
                                                        |
| 271 | +			$this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); | 
                                                        |
| 272 | +			$this->_views['trash']['count'] = $this->_total_registrations('trash'); | 
                                                        |
| 273 | 273 | }  | 
                                                        
| 274 | 274 | }  | 
                                                        
| 275 | 275 | |
@@ -283,23 +283,23 @@ discard block  | 
                                                    ||
| 283 | 283 | * @return int  | 
                                                        
| 284 | 284 | * @throws \EE_Error  | 
                                                        
| 285 | 285 | */  | 
                                                        
| 286 | -	protected function _total_registrations( $view = '' ){ | 
                                                        |
| 286 | +	protected function _total_registrations($view = '') { | 
                                                        |
| 287 | 287 | $_where = array();  | 
                                                        
| 288 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;  | 
                                                        |
| 289 | -		if( $EVT_ID ) { | 
                                                        |
| 288 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;  | 
                                                        |
| 289 | +		if ($EVT_ID) { | 
                                                        |
| 290 | 290 | $_where['EVT_ID'] = $EVT_ID;  | 
                                                        
| 291 | 291 | }  | 
                                                        
| 292 | -		switch ( $view ) { | 
                                                        |
| 292 | +		switch ($view) { | 
                                                        |
| 293 | 293 | case 'trash' :  | 
                                                        
| 294 | - return EEM_Registration::instance()->count_deleted( array( $_where ));  | 
                                                        |
| 294 | + return EEM_Registration::instance()->count_deleted(array($_where));  | 
                                                        |
| 295 | 295 | break;  | 
                                                        
| 296 | 296 | case 'incomplete' :  | 
                                                        
| 297 | 297 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete;  | 
                                                        
| 298 | 298 | break;  | 
                                                        
| 299 | 299 | default :  | 
                                                        
| 300 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );  | 
                                                        |
| 300 | +				$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); | 
                                                        |
| 301 | 301 | }  | 
                                                        
| 302 | - return EEM_Registration::instance()->count( array( $_where ));  | 
                                                        |
| 302 | + return EEM_Registration::instance()->count(array($_where));  | 
                                                        |
| 303 | 303 | }  | 
                                                        
| 304 | 304 | |
| 305 | 305 | |
@@ -311,32 +311,32 @@ discard block  | 
                                                    ||
| 311 | 311 | * @return int  | 
                                                        
| 312 | 312 | * @throws \EE_Error  | 
                                                        
| 313 | 313 | */  | 
                                                        
| 314 | -	protected function _total_registrations_this_month(){ | 
                                                        |
| 315 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;  | 
                                                        |
| 316 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();  | 
                                                        |
| 314 | +	protected function _total_registrations_this_month() { | 
                                                        |
| 315 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;  | 
                                                        |
| 316 | +		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); | 
                                                        |
| 317 | 317 |  		$this_year_r = date('Y', current_time('timestamp')); | 
                                                        
| 318 | 318 | $time_start = ' 00:00:00';  | 
                                                        
| 319 | 319 | $time_end = ' 23:59:59';  | 
                                                        
| 320 | 320 |  		$this_month_r = date('m', current_time('timestamp')); | 
                                                        
| 321 | -		$days_this_month = date( 't', current_time('timestamp') ); | 
                                                        |
| 321 | +		$days_this_month = date('t', current_time('timestamp')); | 
                                                        |
| 322 | 322 | //setup date query.  | 
                                                        
| 323 | 323 | $beginning_string = EEM_Registration::instance()->convert_datetime_for_query(  | 
                                                        
| 324 | 324 | 'REG_date',  | 
                                                        
| 325 | - $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start,  | 
                                                        |
| 325 | + $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start,  | 
                                                        |
| 326 | 326 | 'Y-m-d H:i:s'  | 
                                                        
| 327 | 327 | );  | 
                                                        
| 328 | 328 | $end_string = EEM_Registration::instance()->convert_datetime_for_query(  | 
                                                        
| 329 | 329 | 'REG_date',  | 
                                                        
| 330 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end,  | 
                                                        |
| 330 | + $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end,  | 
                                                        |
| 331 | 331 | 'Y-m-d H:i:s'  | 
                                                        
| 332 | 332 | );  | 
                                                        
| 333 | -		$_where['REG_date']= array('BETWEEN', | 
                                                        |
| 333 | +		$_where['REG_date'] = array('BETWEEN', | 
                                                        |
| 334 | 334 | array(  | 
                                                        
| 335 | 335 | $beginning_string,  | 
                                                        
| 336 | 336 | $end_string  | 
                                                        
| 337 | 337 | ));  | 
                                                        
| 338 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );  | 
                                                        |
| 339 | - return EEM_Registration::instance()->count(array( $_where ) );  | 
                                                        |
| 338 | +		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); | 
                                                        |
| 339 | + return EEM_Registration::instance()->count(array($_where));  | 
                                                        |
| 340 | 340 | }  | 
                                                        
| 341 | 341 | |
| 342 | 342 | |
@@ -348,20 +348,20 @@ discard block  | 
                                                    ||
| 348 | 348 | * @return int  | 
                                                        
| 349 | 349 | * @throws \EE_Error  | 
                                                        
| 350 | 350 | */  | 
                                                        
| 351 | -	protected function _total_registrations_today(){ | 
                                                        |
| 351 | +	protected function _total_registrations_today() { | 
                                                        |
| 352 | 352 | |
| 353 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;  | 
                                                        |
| 354 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();  | 
                                                        |
| 353 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;  | 
                                                        |
| 354 | +		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); | 
                                                        |
| 355 | 355 |  		$current_date = date('Y-m-d', current_time('timestamp')); | 
                                                        
| 356 | 356 | $time_start = ' 00:00:00';  | 
                                                        
| 357 | 357 | $time_end = ' 23:59:59';  | 
                                                        
| 358 | -		$_where['REG_date']= array('BETWEEN', | 
                                                        |
| 358 | +		$_where['REG_date'] = array('BETWEEN', | 
                                                        |
| 359 | 359 | array(  | 
                                                        
| 360 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ),  | 
                                                        |
| 361 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' )  | 
                                                        |
| 360 | +				EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'), | 
                                                        |
| 361 | +				EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s') | 
                                                        |
| 362 | 362 | ));  | 
                                                        
| 363 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );  | 
                                                        |
| 364 | - return EEM_Registration::instance()->count(array( $_where ) );  | 
                                                        |
| 363 | +		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); | 
                                                        |
| 364 | + return EEM_Registration::instance()->count(array($_where));  | 
                                                        |
| 365 | 365 | }  | 
                                                        
| 366 | 366 | |
| 367 | 367 | |
@@ -374,12 +374,12 @@ discard block  | 
                                                    ||
| 374 | 374 | * @return string  | 
                                                        
| 375 | 375 | * @throws \EE_Error  | 
                                                        
| 376 | 376 | */  | 
                                                        
| 377 | -    public function column_cb($item){ | 
                                                        |
| 377 | +    public function column_cb($item) { | 
                                                        |
| 378 | 378 | /** checkbox/lock **/  | 
                                                        
| 379 | - $transaction = $item->get_first_related( 'Transaction' );  | 
                                                        |
| 380 | - $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0;  | 
                                                        |
| 379 | +        $transaction = $item->get_first_related('Transaction'); | 
                                                        |
| 380 | +        $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0; | 
                                                        |
| 381 | 381 | return $payment_count > 0  | 
                                                        
| 382 | - ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() )  | 
                                                        |
| 382 | +		    ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()) | 
                                                        |
| 383 | 383 | . '<span class="ee-lock-icon"></span>'  | 
                                                        
| 384 | 384 | : sprintf(  | 
                                                        
| 385 | 385 | '<input type="checkbox" name="_REG_ID[]" value="%1$s" />',  | 
                                                        
@@ -397,14 +397,14 @@ discard block  | 
                                                    ||
| 397 | 397 | * @return string  | 
                                                        
| 398 | 398 | * @throws \EE_Error  | 
                                                        
| 399 | 399 | */  | 
                                                        
| 400 | -	public function column__REG_ID(EE_Registration $item){ | 
                                                        |
| 400 | +	public function column__REG_ID(EE_Registration $item) { | 
                                                        |
| 401 | 401 | $attendee = $item->attendee();  | 
                                                        
| 402 | 402 | $content = $item->ID();  | 
                                                        
| 403 | 403 | $content .= '<div class="show-on-mobile-view-only">';  | 
                                                        
| 404 | 404 | $content .= '<br>';  | 
                                                        
| 405 | 405 | $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : '';  | 
                                                        
| 406 | - $content .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());  | 
                                                        |
| 407 | -		$content .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); | 
                                                        |
| 406 | +		$content .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); | 
                                                        |
| 407 | +		$content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); | 
                                                        |
| 408 | 408 | $content .= '</div>';  | 
                                                        
| 409 | 409 | return $content;  | 
                                                        
| 410 | 410 | }  | 
                                                        
@@ -419,12 +419,12 @@ discard block  | 
                                                    ||
| 419 | 419 | * @return string  | 
                                                        
| 420 | 420 | * @throws \EE_Error  | 
                                                        
| 421 | 421 | */  | 
                                                        
| 422 | -	public function column__REG_date(EE_Registration $item){ | 
                                                        |
| 422 | +	public function column__REG_date(EE_Registration $item) { | 
                                                        |
| 423 | 423 | $this->_set_related_details($item);  | 
                                                        
| 424 | 424 | //Build row actions  | 
                                                        
| 425 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL );  | 
                                                        |
| 426 | -		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); | 
                                                        |
| 427 | - $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>';  | 
                                                        |
| 425 | +		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL); | 
                                                        |
| 426 | +		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date'); | 
                                                        |
| 427 | + $view_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence').'</span>';  | 
                                                        |
| 428 | 428 | return $view_link;  | 
                                                        
| 429 | 429 | }  | 
                                                        
| 430 | 430 | |
@@ -438,8 +438,8 @@ discard block  | 
                                                    ||
| 438 | 438 | * @return string  | 
                                                        
| 439 | 439 | * @throws \EE_Error  | 
                                                        
| 440 | 440 | */  | 
                                                        
| 441 | -	public function column_event_name(EE_Registration $item){ | 
                                                        |
| 442 | - $this->_set_related_details( $item );  | 
                                                        |
| 441 | +	public function column_event_name(EE_Registration $item) { | 
                                                        |
| 442 | + $this->_set_related_details($item);  | 
                                                        |
| 443 | 443 | // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62  | 
                                                        
| 444 | 444 | $EVT_ID = $item->event_ID();  | 
                                                        
| 445 | 445 | $event_name = $item->event_name();  | 
                                                        
@@ -449,21 +449,21 @@ discard block  | 
                                                    ||
| 449 | 449 |              $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $EVT_ID), | 
                                                        
| 450 | 450 | EVENTS_ADMIN_URL);  | 
                                                        
| 451 | 451 |              $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID) | 
                                                        
| 452 | - ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr($this->_event_details['title_attr']) . '">' . $event_name . '</a>'  | 
                                                        |
| 452 | + ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.$event_name.'</a>'  | 
                                                        |
| 453 | 453 | : $event_name;  | 
                                                        
| 454 | 454 |              $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL); | 
                                                        
| 455 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="';  | 
                                                        |
| 455 | + $actions['event_filter'] = '<a href="'.$edit_event_url.'" title="';  | 
                                                        |
| 456 | 456 | $actions['event_filter'] .= sprintf(  | 
                                                        
| 457 | 457 |                  esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), | 
                                                        
| 458 | 458 | $event_name  | 
                                                        
| 459 | 459 | );  | 
                                                        
| 460 | -            $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>'; | 
                                                        |
| 460 | +            $actions['event_filter'] .= '">'.__('View Registrations', 'event_espresso').'</a>'; | 
                                                        |
| 461 | 461 |          } else { | 
                                                        
| 462 | 462 | $edit_event = $event_name;  | 
                                                        
| 463 | 463 | $actions['event_filter'] = '';  | 
                                                        
| 464 | 464 | }  | 
                                                        
| 465 | 465 | |
| 466 | -		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) ); | 
                                                        |
| 466 | +		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); | 
                                                        |
| 467 | 467 | }  | 
                                                        
| 468 | 468 | |
| 469 | 469 | |
@@ -476,18 +476,18 @@ discard block  | 
                                                    ||
| 476 | 476 | * @return string  | 
                                                        
| 477 | 477 | * @throws \EE_Error  | 
                                                        
| 478 | 478 | */  | 
                                                        
| 479 | -   	public function column_DTT_EVT_start(EE_Registration $item){ | 
                                                        |
| 479 | +   	public function column_DTT_EVT_start(EE_Registration $item) { | 
                                                        |
| 480 | 480 | $datetime_strings = array();  | 
                                                        
| 481 | - $ticket = $item->ticket( TRUE );  | 
                                                        |
| 482 | -		if ( $ticket instanceof EE_Ticket ) { | 
                                                        |
| 481 | + $ticket = $item->ticket(TRUE);  | 
                                                        |
| 482 | +		if ($ticket instanceof EE_Ticket) { | 
                                                        |
| 483 | 483 |  			$remove_defaults = array('default_where_conditions' => 'none'); | 
                                                        
| 484 | 484 | $datetimes = $ticket->datetimes($remove_defaults);  | 
                                                        
| 485 | -			foreach($datetimes as $datetime){ | 
                                                        |
| 486 | - $datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' );  | 
                                                        |
| 485 | +			foreach ($datetimes as $datetime) { | 
                                                        |
| 486 | +				$datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start'); | 
                                                        |
| 487 | 487 | }  | 
                                                        
| 488 | -			return implode("<br />",$datetime_strings); | 
                                                        |
| 488 | +			return implode("<br />", $datetime_strings); | 
                                                        |
| 489 | 489 |  		} else { | 
                                                        
| 490 | - return __( 'There is no ticket on this registration', 'event_espresso' );  | 
                                                        |
| 490 | +			return __('There is no ticket on this registration', 'event_espresso'); | 
                                                        |
| 491 | 491 | }  | 
                                                        
| 492 | 492 | }  | 
                                                        
| 493 | 493 | |
@@ -501,17 +501,17 @@ discard block  | 
                                                    ||
| 501 | 501 | * @return string  | 
                                                        
| 502 | 502 | * @throws \EE_Error  | 
                                                        
| 503 | 503 | */  | 
                                                        
| 504 | -   	public function column_ATT_fname(EE_Registration $item){ | 
                                                        |
| 504 | +   	public function column_ATT_fname(EE_Registration $item) { | 
                                                        |
| 505 | 505 | $attendee = $item->attendee();  | 
                                                        
| 506 | 506 | |
| 507 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );  | 
                                                        |
| 507 | +		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); | 
                                                        |
| 508 | 508 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';  | 
                                                        
| 509 | 509 | $link = EE_Registry::instance()->CAP->current_user_can(  | 
                                                        
| 510 | 510 | 'ee_read_registration',  | 
                                                        
| 511 | 511 | 'espresso_registrations_view_registration',  | 
                                                        
| 512 | 512 | $item->ID()  | 
                                                        
| 513 | 513 | )  | 
                                                        
| 514 | - ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>'  | 
                                                        |
| 514 | +            ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' | 
                                                        |
| 515 | 515 | : $attendee_name;  | 
                                                        
| 516 | 516 | $link .= $item->count() === 1  | 
                                                        
| 517 | 517 | ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>'  | 
                                                        
@@ -521,33 +521,33 @@ discard block  | 
                                                    ||
| 521 | 521 |  		$payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; | 
                                                        
| 522 | 522 | |
| 523 | 523 | //append group count to name  | 
                                                        
| 524 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());  | 
                                                        |
| 524 | +	    $link .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); | 
                                                        |
| 525 | 525 | |
| 526 | 526 | //append reg_code  | 
                                                        
| 527 | -	    $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); | 
                                                        |
| 527 | +	    $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); | 
                                                        |
| 528 | 528 | |
| 529 | 529 | //reg status text for accessibility  | 
                                                        
| 530 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';  | 
                                                        |
| 530 | + $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';  | 
                                                        |
| 531 | 531 | |
| 532 | 532 | //trash/restore/delete actions  | 
                                                        
| 533 | 533 | $actions = array();  | 
                                                        
| 534 | -		if ( $this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) { | 
                                                        |
| 535 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );  | 
                                                        |
| 536 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>';  | 
                                                        |
| 537 | -		} elseif ( $this->_view === 'trash' ) { | 
                                                        |
| 534 | +		if ($this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) { | 
                                                        |
| 535 | +			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); | 
                                                        |
| 536 | +			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; | 
                                                        |
| 537 | +		} elseif ($this->_view === 'trash') { | 
                                                        |
| 538 | 538 | // restore registration link  | 
                                                        
| 539 | -			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) { | 
                                                        |
| 540 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );  | 
                                                        |
| 541 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>';  | 
                                                        |
| 539 | +			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) { | 
                                                        |
| 540 | +				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); | 
                                                        |
| 541 | +				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; | 
                                                        |
| 542 | 542 | }  | 
                                                        
| 543 | -			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) { | 
                                                        |
| 544 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );  | 
                                                        |
| 543 | +			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) { | 
                                                        |
| 544 | +				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); | 
                                                        |
| 545 | 545 | |
| 546 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>';  | 
                                                        |
| 546 | +				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>'; | 
                                                        |
| 547 | 547 | }  | 
                                                        
| 548 | 548 | }  | 
                                                        
| 549 | 549 | |
| 550 | -		return sprintf('%1$s %2$s', $link, $this->row_actions($actions) ); | 
                                                        |
| 550 | +		return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); | 
                                                        |
| 551 | 551 | }  | 
                                                        
| 552 | 552 | |
| 553 | 553 | |
@@ -560,7 +560,7 @@ discard block  | 
                                                    ||
| 560 | 560 | * @return string  | 
                                                        
| 561 | 561 | * @throws \EE_Error  | 
                                                        
| 562 | 562 | */  | 
                                                        
| 563 | -	public function column_ATT_email( EE_Registration $item ) { | 
                                                        |
| 563 | +	public function column_ATT_email(EE_Registration $item) { | 
                                                        |
| 564 | 564 |  		$attendee = $item->get_first_related('Attendee'); | 
                                                        
| 565 | 565 |  		return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email(); | 
                                                        
| 566 | 566 | }  | 
                                                        
@@ -574,8 +574,8 @@ discard block  | 
                                                    ||
| 574 | 574 | * @param \EE_Registration $item  | 
                                                        
| 575 | 575 | * @return string  | 
                                                        
| 576 | 576 | */  | 
                                                        
| 577 | -	public function column__REG_count(EE_Registration $item){ | 
                                                        |
| 578 | - return sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size());  | 
                                                        |
| 577 | +	public function column__REG_count(EE_Registration $item) { | 
                                                        |
| 578 | +		return  sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size()); | 
                                                        |
| 579 | 579 | }  | 
                                                        
| 580 | 580 | |
| 581 | 581 | |
@@ -587,16 +587,16 @@ discard block  | 
                                                    ||
| 587 | 587 | * @param \EE_Registration $item  | 
                                                        
| 588 | 588 | * @return string  | 
                                                        
| 589 | 589 | */  | 
                                                        
| 590 | -	public function column_PRC_amount(EE_Registration $item){ | 
                                                        |
| 590 | +	public function column_PRC_amount(EE_Registration $item) { | 
                                                        |
| 591 | 591 | $ticket = $item->ticket();  | 
                                                        
| 592 | 592 | |
| 593 | - $content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : '';  | 
                                                        |
| 593 | + $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : '';  | 
                                                        |
| 594 | 594 | |
| 595 | -		if ( $item->final_price() > 0 ) { | 
                                                        |
| 596 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';  | 
                                                        |
| 595 | +		if ($item->final_price() > 0) { | 
                                                        |
| 596 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';  | 
                                                        |
| 597 | 597 |  		} else { | 
                                                        
| 598 | 598 | // free event  | 
                                                        
| 599 | - $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>';  | 
                                                        |
| 599 | +			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>'; | 
                                                        |
| 600 | 600 | }  | 
                                                        
| 601 | 601 | |
| 602 | 602 | return $content;  | 
                                                        
@@ -612,11 +612,11 @@ discard block  | 
                                                    ||
| 612 | 612 | * @param \EE_Registration $item  | 
                                                        
| 613 | 613 | * @return string  | 
                                                        
| 614 | 614 | */  | 
                                                        
| 615 | -	public function column__REG_final_price(EE_Registration $item){ | 
                                                        |
| 615 | +	public function column__REG_final_price(EE_Registration $item) { | 
                                                        |
| 616 | 616 | $ticket = $item->ticket();  | 
                                                        
| 617 | - $content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />';  | 
                                                        |
| 617 | + $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />';  | 
                                                        |
| 618 | 618 | |
| 619 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';  | 
                                                        |
| 619 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';  | 
                                                        |
| 620 | 620 | return $content;  | 
                                                        
| 621 | 621 | |
| 622 | 622 | }  | 
                                                        
@@ -630,13 +630,13 @@ discard block  | 
                                                    ||
| 630 | 630 | * @param \EE_Registration $item  | 
                                                        
| 631 | 631 | * @return string  | 
                                                        
| 632 | 632 | */  | 
                                                        
| 633 | -	public function column__REG_paid(EE_Registration $item){ | 
                                                        |
| 633 | +	public function column__REG_paid(EE_Registration $item) { | 
                                                        |
| 634 | 634 | $payment_method = $item->payment_method();  | 
                                                        
| 635 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' );  | 
                                                        |
| 635 | +		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); | 
                                                        |
| 636 | 636 | |
| 637 | - $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>';  | 
                                                        |
| 638 | -		if ( $item->paid() > 0 ) { | 
                                                        |
| 639 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>';  | 
                                                        |
| 637 | + $content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>';  | 
                                                        |
| 638 | +		if ($item->paid() > 0) { | 
                                                        |
| 639 | +			$content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; | 
                                                        |
| 640 | 640 | }  | 
                                                        
| 641 | 641 | return $content;  | 
                                                        
| 642 | 642 | }  | 
                                                        
@@ -651,11 +651,11 @@ discard block  | 
                                                    ||
| 651 | 651 | * @return string  | 
                                                        
| 652 | 652 | * @throws \EE_Error  | 
                                                        
| 653 | 653 | */  | 
                                                        
| 654 | -	public function column_TXN_total(EE_Registration $item){ | 
                                                        |
| 655 | -		if($item->transaction()){ | 
                                                        |
| 656 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );  | 
                                                        |
| 657 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';  | 
                                                        |
| 658 | -		}else{ | 
                                                        |
| 654 | +	public function column_TXN_total(EE_Registration $item) { | 
                                                        |
| 655 | +		if ($item->transaction()) { | 
                                                        |
| 656 | +			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); | 
                                                        |
| 657 | +			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>'; | 
                                                        |
| 658 | +		} else { | 
                                                        |
| 659 | 659 |  			return __("None", "event_espresso"); | 
                                                        
| 660 | 660 | }  | 
                                                        
| 661 | 661 | }  | 
                                                        
@@ -670,15 +670,15 @@ discard block  | 
                                                    ||
| 670 | 670 | * @return string  | 
                                                        
| 671 | 671 | * @throws \EE_Error  | 
                                                        
| 672 | 672 | */  | 
                                                        
| 673 | -	public function column_TXN_paid(EE_Registration $item){ | 
                                                        |
| 673 | +	public function column_TXN_paid(EE_Registration $item) { | 
                                                        |
| 674 | 674 | |
| 675 | -		if ( $item->count() === 1 ) { | 
                                                        |
| 675 | +		if ($item->count() === 1) { | 
                                                        |
| 676 | 676 | $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance();  | 
                                                        
| 677 | -			if ( $transaction->paid() >= $transaction->total() ) { | 
                                                        |
| 677 | +			if ($transaction->paid() >= $transaction->total()) { | 
                                                        |
| 678 | 678 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';  | 
                                                        
| 679 | 679 |  			} else { | 
                                                        
| 680 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );  | 
                                                        |
| 681 | -				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; | 
                                                        |
| 680 | +				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); | 
                                                        |
| 681 | +				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; | 
                                                        |
| 682 | 682 | }  | 
                                                        
| 683 | 683 | }  | 
                                                        
| 684 | 684 | |
@@ -699,42 +699,42 @@ discard block  | 
                                                    ||
| 699 | 699 |  	public function column_actions(EE_Registration $item) { | 
                                                        
| 700 | 700 | $actions = array();  | 
                                                        
| 701 | 701 | $attendee = $item->attendee();  | 
                                                        
| 702 | - $this->_set_related_details( $item );  | 
                                                        |
| 702 | + $this->_set_related_details($item);  | 
                                                        |
| 703 | 703 | |
| 704 | 704 | //Build row actions  | 
                                                        
| 705 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );  | 
                                                        |
| 706 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL );  | 
                                                        |
| 705 | +		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); | 
                                                        |
| 706 | +		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL); | 
                                                        |
| 707 | 707 | |
| 708 | 708 | // page=attendees&event_admin_reports=resend_email®istration_id=43653465634&event_id=2&form_action=resend_email  | 
                                                        
| 709 | 709 | //$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID );  | 
                                                        
| 710 | - $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true );  | 
                                                        |
| 710 | +		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true); | 
                                                        |
| 711 | 711 | |
| 712 | 712 | |
| 713 | 713 | //Build row actions  | 
                                                        
| 714 | -		$actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? ' | 
                                                        |
| 714 | +		$actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? ' | 
                                                        |
| 715 | 715 | <li>  | 
                                                        
| 716 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">  | 
                                                        |
| 716 | +			<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> | 
                                                        |
| 717 | 717 | <div class="dashicons dashicons-clipboard"></div>  | 
                                                        
| 718 | 718 | </a>  | 
                                                        
| 719 | 719 | </li>' : '';  | 
                                                        
| 720 | -		$actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) &&  $attendee instanceof EE_Attendee ?' | 
                                                        |
| 720 | +		$actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? ' | 
                                                        |
| 721 | 721 | <li>  | 
                                                        
| 722 | - <a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text">  | 
                                                        |
| 722 | +			<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text"> | 
                                                        |
| 723 | 723 | <div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div>  | 
                                                        
| 724 | 724 | </a>  | 
                                                        
| 725 | 725 | </li>' : '';  | 
                                                        
| 726 | - $actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? '  | 
                                                        |
| 726 | +		$actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? ' | 
                                                        |
| 727 | 727 | <li>  | 
                                                        
| 728 | - <a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text">  | 
                                                        |
| 728 | +			<a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text"> | 
                                                        |
| 729 | 729 | <div class="dashicons dashicons-email-alt"></div>  | 
                                                        
| 730 | 730 | </a>  | 
                                                        
| 731 | 731 | </li>' : '';  | 
                                                        
| 732 | 732 | |
| 733 | 733 | // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb  | 
                                                        
| 734 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL );  | 
                                                        |
| 735 | - $actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? '  | 
                                                        |
| 734 | +		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL); | 
                                                        |
| 735 | +		$actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? ' | 
                                                        |
| 736 | 736 | <li>  | 
                                                        
| 737 | - <a class="ee-status-color-' . $this->_transaction_details['status'] . ' tiny-text" href="'.$view_txn_lnk_url.'" title="' . $this->_transaction_details['title_attr'] . '">  | 
                                                        |
| 737 | + <a class="ee-status-color-' . $this->_transaction_details['status'].' tiny-text" href="'.$view_txn_lnk_url.'" title="'.$this->_transaction_details['title_attr'].'">  | 
                                                        |
| 738 | 738 | <div class="dashicons dashicons-cart"></div>  | 
                                                        
| 739 | 739 | </a>  | 
                                                        
| 740 | 740 | </li>' : '';  | 
                                                        
@@ -743,17 +743,17 @@ discard block  | 
                                                    ||
| 743 | 743 | $actions['dl_invoice_lnk'] = '';  | 
                                                        
| 744 | 744 | $dl_invoice_lnk_url = $item->invoice_url();  | 
                                                        
| 745 | 745 | //only show invoice link if message type is active.  | 
                                                        
| 746 | -		if ( $attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { | 
                                                        |
| 746 | +		if ($attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active('invoice')) { | 
                                                        |
| 747 | 747 | $actions['dl_invoice_lnk'] = '  | 
                                                        
| 748 | 748 | <li>  | 
                                                        
| 749 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">  | 
                                                        |
| 749 | +			<a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> | 
                                                        |
| 750 | 750 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>  | 
                                                        
| 751 | 751 | </a>  | 
                                                        
| 752 | 752 | </li>';  | 
                                                        
| 753 | 753 | }  | 
                                                        
| 754 | 754 | $actions['filtered_messages_link'] = '';  | 
                                                        
| 755 | 755 | //message list table link (filtered by REG_ID  | 
                                                        
| 756 | -		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { | 
                                                        |
| 756 | +		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { | 
                                                        |
| 757 | 757 | $actions['filtered_messages_link'] = '<li>'  | 
                                                        
| 758 | 758 | . EEH_MSG_Template::get_message_action_link(  | 
                                                        
| 759 | 759 | 'see_notifications_for',  | 
                                                        
@@ -764,9 +764,9 @@ discard block  | 
                                                    ||
| 764 | 764 | )  | 
                                                        
| 765 | 765 | . '</li>';  | 
                                                        
| 766 | 766 | }  | 
                                                        
| 767 | - $actions = apply_filters( 'FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this );  | 
                                                        |
| 767 | +		$actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this); | 
                                                        |
| 768 | 768 | return $this->_action_string(  | 
                                                        
| 769 | - implode( '', $actions ),  | 
                                                        |
| 769 | +			implode('', $actions), | 
                                                        |
| 770 | 770 | $item,  | 
                                                        
| 771 | 771 | 'ul',  | 
                                                        
| 772 | 772 | 'reg-overview-actions-ul'  |